educode_sales 1.10.28 → 1.10.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7918ebb9f76467d371b5f760a001bcd5fa91f78cac3149882bedd2506add6251
4
- data.tar.gz: 5225695183f80422067b3dbad8b0b3e7edd9ab0acaf08fc9261b970f8254f163
3
+ metadata.gz: b133a8fca27810c1c165bdab01c812af7c4ee76a0f80b02be3fcc064a353e4f9
4
+ data.tar.gz: 3631d821e73722d263dc9f724f09b19abd7dc0a9559a114f41f5bf204a334cb2
5
5
  SHA512:
6
- metadata.gz: 81319e099aeff24c0df0be5a6f7f6f408e5a2c2c053476788b954d29ca00b1719cb921f250afd9516e0efca9f081dcc3cbfb86dd4a08fc6ba12edc53ce7b0747
7
- data.tar.gz: da33b752f9b61b100f995c28377e0a1f8d38e5a375ba62302b9a2ed6b401f8a6d4547c8f3e17d8c474c935314a97b2bc896b6fbd6ffbdb4a87c6be418e841170
6
+ metadata.gz: b3f72cb4af3f4f343fefc8438d08bc041d3f3526e639a0714196fbd63c91b9a322e03d2fc2548632b97aeed7cd6a7425a2bc5c9e798563b10be870124e504539
7
+ data.tar.gz: 40fbf3c2c51e50c8eaac57940279e8ec16708b1bfddc6d3673aed16033aa07aaadfaa8f69a28f9f527987afe515e77f565272298ac1f915deeb883535d27a048
@@ -54,7 +54,12 @@ module EducodeSales
54
54
  business_ids = @businesses.joins(last_follow_up: :assign_follow_ups).where("educode_sales_assign_follow_ups.staff_id = ?", @current_admin.id).pluck(:id)
55
55
  assign_business_ids = EducodeSales::Business.joins(:assign_staffs).where("educode_sales_assign_staffs.staff_id = ?", @current_admin.id).pluck(:id)
56
56
 
57
- @businesses = @businesses.joins("JOIN departments ON educode_sales_businesses.department_id = departments.id").where("departments.school_id in (?) OR educode_sales_businesses.staff_id = #{@current_admin.id} OR educode_sales_businesses.id in (?)", school_ids, business_ids + assign_business_ids)
57
+ if @current_admin.staff_school_tags.present?
58
+ # 如果设置专项客户类型,则视为专项经理,根据专项客户查看对应商机
59
+ school_ids += School.joins(:school_tags).where("school_tags.id in (?)", @current_admin.staff_school_tags.pluck(:school_tag_id)).pluck(:id)
60
+ end
61
+ @businesses = @businesses.joins("JOIN departments ON educode_sales_businesses.department_id = departments.id").where("departments.school_id in (?) OR educode_sales_businesses.staff_id = #{@current_admin.id} OR educode_sales_businesses.id in (?)", school_ids.uniq, business_ids + assign_business_ids)
62
+
58
63
  end
59
64
  end
60
65
 
@@ -365,20 +370,36 @@ module EducodeSales
365
370
  current_2_actual = v
366
371
  end
367
372
 
368
- if i == 1 && last_follow_up
369
- # 验收时间
370
- last_follow_up.reception_at = v
371
- elsif i == 0 && last_follow_up
372
- # 合同部署时间
373
- last_follow_up.deploy_time = v
374
- @business.p_deploy_time = v
375
- end
373
+ # if i == 1 && last_follow_up
374
+ # # 验收时间
375
+ # last_follow_up.reception_at = v
376
+ # elsif i == 0 && last_follow_up
377
+ # # 合同部署时间
378
+ # last_follow_up.deploy_time = v
379
+ # @business.p_deploy_time = v
380
+ # end
376
381
  end
377
382
 
378
383
  end
379
- # data.each do |d|
380
- # d.select! { |d| d.delete_if{|f| f == ''}.present? }
381
- # end
384
+ data.each do |row|
385
+ # 全部为空的值去掉选项
386
+ row.select! do |d|
387
+ s = d.uniq
388
+ s.size == 1 && s[0].blank? ? false : true
389
+ end
390
+ end
391
+ if last_follow_up
392
+ if data[0].present?
393
+ # 合同部署时间
394
+ last_follow_up.deploy_time = data[0][-1][-1]
395
+ @business.p_deploy_time = data[0][-1][-1]
396
+ end
397
+ if data[1].present?
398
+ # 验收时间
399
+ last_follow_up.reception_at = data[1][-1][-1]
400
+ end
401
+ end
402
+
382
403
  current_week = Time.now.strftime('%W')
383
404
  staff_manage_ids = @business&.last_follow_up&.assign_follow_ups.present? ? @business.last_follow_up.assign_follow_ups.pluck(:staff_id) : [@business.staff_id]
384
405
  if current_1_plan && current_1_plan.to_date.strftime('%W') == current_week
@@ -42,6 +42,8 @@ module EducodeSales
42
42
  @creator_arr = EducodeSales::Staff.joins(:user).where(id: creator_ids).pluck("concat(users.lastname,users.firstname)", :id)
43
43
  @staff_arr = EducodeSales::Staff.joins(:user).where(id: staff_ids).pluck("concat(users.lastname,users.firstname)", :id)
44
44
  @sale_staff_arr = EducodeSales::Staff.joins(:user).where(id: sale_staff_ids).pluck("concat(users.lastname,users.firstname)", :id)
45
+ filter = Filter.find_or_create_by(staff_id: @current_admin.id, clazz: "ideas")
46
+ gon.filter = filter.extras || {}
45
47
  end
46
48
  format.json do
47
49
  @ideas = params[:is_deleted].to_s == "true" ? Idea.deleted : Idea.not_deleted
@@ -224,7 +226,9 @@ module EducodeSales
224
226
 
225
227
  def new_follow_up
226
228
  @idea = Idea.find(params[:id])
227
- gon.staffs = Staff.where.not(role_id: 11).includes(:user).map { |d| { name: d.user.real_name, value: d.id } }
229
+ staffs = Staff.where.not(role_id: 11).includes(:user)
230
+ gon.sale_staffs = staffs.map { |d| { name: d.user.real_name, value: d.id, selected: d.id == @idea.sale_staff_id } }
231
+ gon.idea_staffs = staffs.map { |d| { name: d.user.real_name, value: d.id, selected: d.id == @idea.staff_id } }
228
232
  render layout: false
229
233
  end
230
234
 
@@ -25,8 +25,12 @@ module EducodeSales
25
25
  @money_plan_records = @money_plan_records.where(staff_id: @current_admin.id)
26
26
  when '区域'
27
27
  school_ids = School.where(province: @current_admin.areas.pluck(:name)).pluck(:id) + StaffSchool.where(staff_id: @current_admin.id).pluck(:school_id)
28
- b_ids = Business.where(school_id: school_ids).pluck(:id)
29
- @money_plan_records = @money_plan_records.joins(:business).where("educode_sales_businesses.id in (?) OR educode_sales_money_plans.staff_id = ?", b_ids, @current_admin.id)
28
+ if @current_admin.staff_school_tags.present?
29
+ # 如果设置专项客户类型,则视为专项经理,根据专项客户查看对应商机
30
+ school_ids += School.joins(:school_tags).where("school_tags.id in (?)", @current_admin.staff_school_tags.pluck(:school_tag_id)).pluck(:id)
31
+ end
32
+ b_ids = Business.where(school_id: school_ids.uniq).pluck(:id)
33
+ @money_plan_records = @money_plan_records.joins(:business).where("educode_sales_businesses.id in (?) OR educode_sales_money_plan_records.staff_id = ?", b_ids, @current_admin.id)
30
34
  end
31
35
  end
32
36
 
@@ -20,7 +20,11 @@ module EducodeSales
20
20
  @money_plans = @money_plans.where(staff_id: @current_admin.id)
21
21
  when '区域'
22
22
  school_ids = School.where(province: @current_admin.areas.pluck(:name)).pluck(:id) + StaffSchool.where(staff_id: @current_admin.id).pluck(:school_id)
23
- b_ids = Business.where(school_id: school_ids).pluck(:id)
23
+ if @current_admin.staff_school_tags.present?
24
+ # 如果设置专项客户类型,则视为专项经理,根据专项客户查看对应商机
25
+ school_ids += School.joins(:school_tags).where("school_tags.id in (?)", @current_admin.staff_school_tags.pluck(:school_tag_id)).pluck(:id)
26
+ end
27
+ b_ids = Business.where(school_id: school_ids.uniq).pluck(:id)
24
28
  @money_plans = @money_plans.where("educode_sales_businesses.id in (?) OR educode_sales_money_plans.staff_id = ?", b_ids, @current_admin.id)
25
29
  end
26
30
  end
@@ -22,7 +22,14 @@ module EducodeSales
22
22
  @sale_plans = SalePlan.where(staff_id: @current_admin.id)
23
23
  when '区域'
24
24
  staff_ids = Staff.joins(user: [user_extension: [department: :school]]).where("schools.province in (?)", @current_admin.areas.pluck(:name)).pluck(:id)
25
- business_ids = Business.where(school_id: StaffSchool.where(staff_id: @current_admin.id).pluck(:school_id)).pluck(:id)
25
+
26
+ school_ids = StaffSchool.where(staff_id: @current_admin.id).pluck(:school_id)
27
+ if @current_admin.staff_school_tags.present?
28
+ # 如果设置专项客户类型,则视为专项经理,根据专项客户查看对应商机
29
+ school_ids += School.joins(:school_tags).where("school_tags.id in (?)", @current_admin.staff_school_tags.pluck(:school_tag_id)).pluck(:id)
30
+ end
31
+
32
+ business_ids = Business.where(school_id: school_ids.uniq).pluck(:id)
26
33
  @sale_plans = SalePlan.where("staff_id in (?) OR educode_sales_sale_plans.staff_id = ? OR educode_sales_sale_plans.business_id in (?)", staff_ids, @current_admin.id,business_ids)
27
34
  else
28
35
  @sale_plans = SalePlan
@@ -468,6 +475,41 @@ module EducodeSales
468
475
  render layout: false
469
476
  end
470
477
 
478
+ def week_plan
479
+ common = Common.find_by(clazz: 'staff_type', name: '销售')
480
+ @staffs = Staff.includes(:user).where(job_type: common.id).map { |d| [d.user.real_name, d.id] }
481
+ @years = (1..(Time.now.year - 2020)).map { |d| 2020 + d }
482
+ @months = (1..12).map { |d| d }
483
+ end
484
+
485
+ def weekly
486
+ common = Common.find_by(clazz: 'staff_type', name: '销售')
487
+ @staffs = Staff.includes(:user).where(job_type: common.id).map { |d| [d.user.real_name, d.id] }
488
+ @years = (1..(Time.now.year - 2020)).map { |d| 2020 + d }
489
+ @months = (1..12).map { |d| d }
490
+ end
491
+
492
+ def monthly
493
+ common = Common.find_by(clazz: 'staff_type', name: '销售')
494
+ @staffs = Staff.includes(:user).where(job_type: common.id).map { |d| [d.user.real_name, d.id] }
495
+ @years = (1..(Time.now.year - 2020)).map { |d| 2020 + d }
496
+ @months = (1..12).map { |d| d }
497
+ end
498
+
499
+ def month_plan
500
+ common = Common.find_by(clazz: 'staff_type', name: '销售')
501
+ @staffs = Staff.includes(:user).where(job_type: common.id).map { |d| [d.user.real_name, d.id] }
502
+ @years = (1..(Time.now.year - 2020)).map { |d| 2020 + d }
503
+ @months = (1..12).map { |d| d }
504
+ end
505
+
506
+ def year_plan
507
+ common = Common.find_by(clazz: 'staff_type', name: '销售')
508
+ @staffs = Staff.includes(:user).where(job_type: common.id).map { |d| [d.user.real_name, d.id] }
509
+ @years = (1..(Time.now.year - 2020)).map { |d| 2020 + d }
510
+ @months = (1..12).map { |d| d }
511
+ end
512
+
471
513
  private
472
514
 
473
515
  def plan_params
@@ -551,13 +551,6 @@
551
551
  sort: true,
552
552
  hide: gon.filter.invitation_money
553
553
  },
554
- {
555
- field: 'bidded_date',
556
- width: 105,
557
- title: '中标时间',
558
- sort: true,
559
- hide: gon.filter.bidded_date
560
- },
561
554
  {
562
555
  field: 'plan_return_date',
563
556
  width: 135,
@@ -580,6 +573,13 @@
580
573
  sort: true,
581
574
  hide: gon.filter.budget_amount
582
575
  },
576
+ {
577
+ field: 'bidded_date',
578
+ width: 105,
579
+ title: '中标时间',
580
+ sort: true,
581
+ hide: gon.filter.bidded_date
582
+ },
583
583
  {
584
584
  field: 'total_amount',
585
585
  width: 100,
@@ -157,114 +157,136 @@
157
157
  {
158
158
  field: 'school',
159
159
  width: 160,
160
- title: '单位名称'
160
+ title: '单位名称',
161
+ hide: gon.filter.school
161
162
  },
162
163
  {
163
164
  field: 'name',
164
165
  width: 160,
165
- title: '项目名称'
166
+ title: '项目名称',
167
+ hide: gon.filter.name
166
168
  },
167
169
  {
168
170
  field: 'level',
169
171
  width: 100,
170
- title: '优先级'
172
+ title: '优先级',
173
+ hide: gon.filter.level
171
174
  },
172
175
  {
173
176
  field: 'staff',
174
177
  title: '方案经理',
175
- width: 100
178
+ width: 100,
179
+ hide: gon.filter.staff
176
180
  },
177
181
  {
178
182
  field: 'sale_staff',
179
183
  title: '销售经理',
180
- width: 100
184
+ width: 100,
185
+ hide: gon.filter.sale_staff
181
186
  },
182
187
  {
183
188
  field: 'assist_staffs',
184
189
  title: '协助人',
185
- width: 200
190
+ width: 200,
191
+ hide: gon.filter.assist_staffs
186
192
  },
187
193
  {
188
194
  field: 'status',
189
195
  width: 100,
190
196
  title: '状态',
191
- templet: '#statusTpl'
197
+ templet: '#statusTpl',
198
+ hide: gon.filter.status
192
199
  },
193
200
  {
194
201
  field: 'types',
195
202
  width: 100,
196
203
  title: '定制类型',
204
+ hide: gon.filter.types
197
205
  },
198
206
  {
199
207
  field: 'idea_type',
200
208
  width: 100,
201
209
  title: '方案类型',
210
+ hide: gon.filter.idea_type
202
211
  },
203
212
  {
204
213
  field: 'idea_follows_count',
205
214
  width: 100,
206
215
  title: '跟进',
207
216
  templet: '#follow',
217
+ hide: gon.filter.idea_follows_count
208
218
  },
209
219
  {
210
220
  field: 'f_staff',
211
221
  width: 100,
212
222
  title: '跟进人',
223
+ hide: gon.filter.f_staff
213
224
  },
214
225
  {
215
226
  field: 'f_last_time',
216
227
  width: 150,
217
228
  title: '最新跟进时间',
229
+ hide: gon.filter.f_last_time
218
230
  },
219
231
  {
220
232
  field: 'model',
221
233
  width: 100,
222
234
  title: '部署模式',
235
+ hide: gon.filter.model
223
236
  },
224
237
  {
225
238
  field: 'hardware',
226
239
  width: 150,
227
- title: '硬件规模(万)'
240
+ title: '硬件规模(万)',
241
+ hide: gon.filter.hardware
228
242
  },
229
243
  {
230
244
  field: 'project',
231
245
  width: 150,
232
- title: '并发规模(人)'
246
+ title: '并发规模(人)',
247
+ hide: gon.filter.project
233
248
  },
234
249
  {
235
250
  field: 'money',
236
251
  width: 150,
237
- title: '项目预算(万)'
252
+ title: '项目预算(万)',
253
+ hide: gon.filter.money
238
254
  },
239
255
  {
240
256
  field: 'creator',
241
257
  width: 100,
242
- title: '申请人'
258
+ title: '申请人',
259
+ hide: gon.filter.creator
243
260
  },
244
261
  {
245
262
  field: 'end_time',
246
263
  width: 200,
247
- title: '截止时间'
264
+ title: '截止时间',
265
+ hide: gon.filter.end_time
248
266
  },
249
267
  {
250
268
  field: 'history_type',
251
269
  width: 150,
252
- title: '历史合作'
270
+ title: '历史合作',
271
+ hide: gon.filter.history_type
253
272
  },
254
273
  {
255
274
  field: 'created_at',
256
275
  width: 150,
257
- title: '创建时间'
276
+ title: '创建时间',
277
+ hide: gon.filter.created_at
258
278
  },
259
279
  {
260
280
  field: 'end_time',
261
281
  width: 150,
262
- title: '完成时间'
282
+ title: '完成时间',
283
+ hide: gon.filter.end_time
263
284
  },
264
285
  {
265
286
  field: 'content',
266
287
  width: 200,
267
- title: '需求说明'
288
+ title: '需求说明',
289
+ hide: gon.filter.content
268
290
  },
269
291
  {
270
292
  title: '操作',
@@ -274,7 +296,7 @@
274
296
  fixed: 'right'
275
297
  }
276
298
  ]
277
- ]
299
+ ];
278
300
 
279
301
  table = layui.table;
280
302
  table.render({
@@ -350,6 +372,37 @@
350
372
  * toolbar事件监听
351
373
  */
352
374
  table.on('toolbar(ideas_table)', function (obj) {
375
+ switch (obj.event) {
376
+ case 'LAYTABLE_COLS':
377
+ layui.form.on('checkbox(LAY_TABLE_TOOL_COLS)', function (objs) {
378
+ var value = objs.elem.checked;
379
+ var name = objs.elem.attributes[1].value;
380
+ $.ajax({
381
+ url: "filter",
382
+ type: "GET",
383
+ data: "type=ideas&name=" + name + "&check=" + value,
384
+ success: function (data) {
385
+ let hide_type = "[data-field='" + name + "']";
386
+ if (data.hidden === 1) {
387
+ $(hide_type).addClass('layui-hide');
388
+ } else if (data.hidden === 0) {
389
+ $(hide_type).removeClass('layui-hide');
390
+ }
391
+ //(因为触发筛选器出现的checkbox是根据cols的值得到 这里必须修改 cols的值 然后才会出现下次点击筛选器时 checkbox正常显示)
392
+ for (i = 1; i < cols_table[0].length; i++) {
393
+ if (name === cols_table[0][i].field) {
394
+ cols_table[0][i].hide = !value;
395
+ objs.config.cols = cols_table
396
+ }
397
+ }
398
+ },
399
+ error: function (data) {
400
+ layer.msg("操作失败")
401
+ },
402
+ dataType: 'Json'
403
+ })
404
+ });
405
+ }
353
406
  if (obj.event === 'add') { // 手动添加
354
407
  var content = miniPage.getHrefContent('/missions/ideas/new');
355
408
  var openWH = miniPage.getOpenWidthHeight();
@@ -35,13 +35,13 @@
35
35
  </div>
36
36
  <div class="layui-row" style="padding-top: 15px">
37
37
  <div class="layui-col-md6">
38
- <labeL class="layui-form-label required">销售经理:</labeL>
38
+ <labeL class="layui-form-label">销售经理:</labeL>
39
39
  <div class="layui-input-block">
40
40
  <div id="sale_staff_id"></div>
41
41
  </div>
42
42
  </div>
43
43
  <div class="layui-col-md6">
44
- <labeL class="layui-form-label required">项目名称:</labeL>
44
+ <labeL class="layui-form-label">项目名称:</labeL>
45
45
  <div class="layui-input-block">
46
46
  <div id="business_id" style="width: 600px;"></div>
47
47
  </div>
@@ -83,7 +83,7 @@
83
83
  </div>
84
84
  </div>
85
85
  <div class="layui-col-md6">
86
- <labeL class="layui-form-label required">部署模式:</labeL>
86
+ <labeL class="layui-form-label">部署模式:</labeL>
87
87
  <div class="layui-input-block">
88
88
  <%= select_tag "model", options_for_select(EducodeSales::Idea.models.keys, @idea&.model), { 'lay-filter': 'model', include_blank: false } %>
89
89
  </div>
@@ -35,13 +35,13 @@
35
35
  </div>
36
36
  <div class="layui-row" style="padding-top: 15px">
37
37
  <div class="layui-col-md6">
38
- <labeL class="layui-form-label required">销售经理:</labeL>
38
+ <labeL class="layui-form-label">销售经理:</labeL>
39
39
  <div class="layui-input-block">
40
40
  <div id="sale_staff_id"></div>
41
41
  </div>
42
42
  </div>
43
43
  <div class="layui-col-md6">
44
- <labeL class="layui-form-label required">项目名称:</labeL>
44
+ <labeL class="layui-form-label">项目名称:</labeL>
45
45
  <div class="layui-input-block">
46
46
  <div id="business_id" style="width: 600px;"></div>
47
47
  </div>
@@ -83,7 +83,7 @@
83
83
  </div>
84
84
  </div>
85
85
  <div class="layui-col-md6">
86
- <labeL class="layui-form-label required">部署模式:</labeL>
86
+ <labeL class="layui-form-label">部署模式:</labeL>
87
87
  <div class="layui-input-block">
88
88
  <%= select_tag "model", options_for_select(EducodeSales::Idea.models.keys, @idea&.model), { 'lay-filter': 'model', include_blank: false } %>
89
89
  </div>
@@ -100,13 +100,13 @@
100
100
  });
101
101
  var staff_list = xmSelect.render({
102
102
  el: '#new_idea_staff_id',
103
- data: gon.staffs,
103
+ data: gon.idea_staffs,
104
104
  filterable: true,
105
105
  radio: true,
106
106
  })
107
107
  var sale_staff_list = xmSelect.render({
108
108
  el: '#new_sale_staff_id',
109
- data: gon.staffs,
109
+ data: gon.sale_staffs,
110
110
  filterable: true,
111
111
  radio: true,
112
112
  })
@@ -64,6 +64,8 @@
64
64
  rate = layui.rate,
65
65
  miniPage = layui.miniPage;
66
66
 
67
+ form.render();
68
+
67
69
  laydate.render({
68
70
  elem: '#month_plan_year',
69
71
  type: 'year'
@@ -64,7 +64,7 @@
64
64
  table = layui.table,
65
65
  rate = layui.rate,
66
66
  miniPage = layui.miniPage;
67
-
67
+ form.render();
68
68
  laydate.render({
69
69
  elem: '#monthly_year',
70
70
  type: 'year'
@@ -65,6 +65,7 @@
65
65
  table = layui.table,
66
66
  rate = layui.rate,
67
67
  miniPage = layui.miniPage;
68
+ form.render();
68
69
 
69
70
  laydate.render({
70
71
  elem: '#weekly_year',
@@ -51,7 +51,7 @@
51
51
  rate = layui.rate,
52
52
  miniPage = layui.miniPage;
53
53
 
54
-
54
+ form.render();
55
55
  laydate.render({
56
56
  elem: '#year_plan_date',
57
57
  type: 'year'
@@ -11,16 +11,16 @@
11
11
  <%= render 'weekPlan' %>
12
12
  </div>
13
13
  <div class="layui-tab-item">
14
- <%= render 'weekly' %>
14
+ <div id="weekly_tab_wraper"></div>
15
15
  </div>
16
16
  <div class="layui-tab-item ">
17
- <%= render 'monthPlan' %>
17
+ <div id="month_plan_tab_wraper"></div>
18
18
  </div>
19
19
  <div class="layui-tab-item">
20
- <%= render 'monthly' %>
20
+ <div id="monthly_tab_wraper"></div>
21
21
  </div>
22
22
  <div class="layui-tab-item">
23
- <%= render 'yearPlan' %>
23
+ <div id="year_plan_tab_wraper"></div>
24
24
  </div>
25
25
  </div>
26
26
  </div>
@@ -30,34 +30,61 @@
30
30
  var $ = layui.jquery,
31
31
  table = layui.table,
32
32
  element = layui.element;
33
- element.on('tab(sale_tab)', function (data) {
34
- var status = $(this).attr('data')
35
- switch (status) {
36
- case 'week':
37
- $("#week_table_wraper .layui-table-fixed-r")[0].classList.remove('layui-hide');
38
- $("#week_table_wraper .layui-table-fixed-r .layui-table-body")[0].style.height="auto";
39
- break;
40
- case 'weekly':
41
- $("#sales_weelky_table .layui-table-fixed-r")[0].classList.remove('layui-hide');
42
- $("#sales_weelky_table .layui-table-fixed-r .layui-table-body")[0].style.height="auto";
43
- break;
44
- ;
45
- case 'monthly':
46
- $("#monthly_table_wraper .layui-table-fixed-r")[0].classList.remove('layui-hide');
47
- $("#monthly_table_wraper .layui-table-fixed-r .layui-table-body")[0].style.height="auto";
48
- break;
49
- case 'month':
50
- $("#month_table_wraper .layui-table-fixed-r")[0].classList.remove('layui-hide');
51
- $("#month_table_wraper .layui-table-fixed-r .layui-table-body")[0].style.height="auto";
52
- break;
53
- case 'year':
54
- $("#year_table_wraper .layui-table-fixed-r")[0].classList.remove('layui-hide');
55
- $("#year_table_wraper .layui-table-fixed-r .layui-table-body")[0].style.height="auto";
56
- break;
57
- }
33
+ // element.on('tab(sale_tab)', function (data) {
34
+ // var status = $(this).attr('data')
35
+ // switch (status) {
36
+ // case 'week':
37
+ // $("#week_table_wraper .layui-table-fixed-r")[0].classList.remove('layui-hide');
38
+ // $("#week_table_wraper .layui-table-fixed-r .layui-table-body")[0].style.height="auto";
39
+ // break;
40
+ // case 'weekly':
41
+ // $("#sales_weelky_table .layui-table-fixed-r")[0].classList.remove('layui-hide');
42
+ // $("#sales_weelky_table .layui-table-fixed-r .layui-table-body")[0].style.height="auto";
43
+ // break;
44
+ // ;
45
+ // case 'monthly':
46
+ // $("#monthly_table_wraper .layui-table-fixed-r")[0].classList.remove('layui-hide');
47
+ // $("#monthly_table_wraper .layui-table-fixed-r .layui-table-body")[0].style.height="auto";
48
+ // break;
49
+ // case 'month':
50
+ // $("#month_table_wraper .layui-table-fixed-r")[0].classList.remove('layui-hide');
51
+ // $("#month_table_wraper .layui-table-fixed-r .layui-table-body")[0].style.height="auto";
52
+ // break;
53
+ // case 'year':
54
+ // $("#year_table_wraper .layui-table-fixed-r")[0].classList.remove('layui-hide');
55
+ // $("#year_table_wraper .layui-table-fixed-r .layui-table-body")[0].style.height="auto";
56
+ // break;
57
+ // }
58
58
 
59
59
 
60
- })
60
+ // })
61
+
62
+
63
+ element.render();
64
+ element.on('tab(sale_tab)', function(data) {
65
+ if (data.index == 1 && $("#sales_weelky_table").length == 0) {
66
+ loadPage('/missions/plans/weekly')
67
+ } else if (data.index == 2 && $("#month_table_wraper").length == 0) {
68
+ loadPage('/missions/plans/month_plan')
69
+ } else if (data.index == 3 && $("#monthly_table_wraper").length == 0) {
70
+ loadPage('/missions/plans/monthly')
71
+ } else if (data.index == 4 && $("#year_table_wraper").length == 0) {
72
+ loadPage('/missions/plans/year_plan')
73
+ }
74
+ });
75
+
76
+
77
+ function loadPage(url) {
78
+ var layer_index = layer.load(0, {shade: [0.1, '#fff']});
79
+ Rails.ajax({
80
+ url: url,
81
+ type: 'GET',
82
+ dataType: "script",
83
+ success: function (res) {
84
+ layer.close(layer_index);
85
+ }
86
+ });
87
+ }
61
88
  })
62
89
  </script>
63
90
  <style>
@@ -0,0 +1 @@
1
+ $("#month_plan_tab_wraper").html("<%= j render 'monthPlan' %>");
@@ -0,0 +1 @@
1
+ $("#monthly_tab_wraper").html("<%= j render 'monthly' %>");
@@ -0,0 +1 @@
1
+ $("#weekly_tab_wraper").html("<%= j render 'weekly' %>");
@@ -0,0 +1 @@
1
+ $("#year_plan_tab_wraper").html("<%= j render 'yearPlan' %>");