educode_sales 1.0.4 → 1.0.6

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.
@@ -10,26 +10,26 @@ module EducodeSales
10
10
  labels.map do |d|
11
11
  quarter = d.split("-").last.to_i
12
12
  year = d.split("-").first.to_i
13
- plan_get[[year, quarter]]&.pluck(:budget_amount)&.reject(&:blank?)&.sum.to_f
13
+ plan_get[[year, quarter]]&.pluck(:budget_amount)&.reject(&:blank?)&.sum.to_f.round(3)
14
14
  end
15
15
  elsif select == NAMES[1]
16
16
  arr = labels.map do |d|
17
17
  quarter = d.split("-").last.to_i
18
18
  year = d.split("-").first.to_i
19
- plan_get[[year, quarter]]&.pluck(:budget_amount)&.reject(&:blank?)&.sum.to_f
19
+ plan_get[[year, quarter]]&.pluck(:budget_amount)&.reject(&:blank?)&.sum.to_f.round(3)
20
20
  end
21
21
  arr.map.with_index(1) { |num, i| arr.first(i).inject(:+) }
22
22
  elsif select == NAMES[2]
23
23
  labels.map do |d|
24
24
  quarter = d.split("-").last.to_i
25
25
  year = d.split("-").first.to_i
26
- actual_get[[year, quarter]]&.pluck(:actual_amount)&.reject(&:blank?)&.sum.to_f
26
+ actual_get[[year, quarter]]&.pluck(:actual_amount)&.reject(&:blank?)&.sum.to_f.round(3)
27
27
  end
28
28
  elsif select == NAMES[3]
29
29
  arr = labels.map do |d|
30
30
  quarter = d.split("-").last.to_i
31
31
  year = d.split("-").first.to_i
32
- actual_get[[year, quarter]]&.pluck(:actual_amount)&.reject(&:blank?)&.sum.to_f
32
+ actual_get[[year, quarter]]&.pluck(:actual_amount)&.reject(&:blank?)&.sum.to_f.round(3)
33
33
  end
34
34
  arr.map.with_index(1) { |num, i| arr.first(i).inject(:+) }
35
35
  end
@@ -75,14 +75,14 @@ module EducodeSales
75
75
  week = d.split("-").last
76
76
  year = d.split("-").first
77
77
  yearweek = "#{year}#{week}".to_i
78
- plan_get[yearweek].to_f
78
+ plan_get[yearweek].to_f.round(3)
79
79
  end
80
80
  elsif select == NAMES[1]
81
81
  arr = labels.map do |d|
82
82
  week = d.split("-").last
83
83
  year = d.split("-").first
84
84
  yearweek = "#{year}#{week}".to_i
85
- plan_get[yearweek].to_f
85
+ plan_get[yearweek].to_f.round(3)
86
86
  end
87
87
  arr.map.with_index(1) { |num, i| arr.first(i).inject(:+) }
88
88
  elsif select == NAMES[2]
@@ -90,14 +90,14 @@ module EducodeSales
90
90
  week = d.split("-").last
91
91
  year = d.split("-").first
92
92
  yearweek = "#{year}#{week}".to_i
93
- actual_get[yearweek].to_f
93
+ actual_get[yearweek].to_f.round(3)
94
94
  end
95
95
  elsif select == NAMES[3]
96
96
  arr = labels.map do |d|
97
97
  week = d.split("-").last
98
98
  year = d.split("-").first
99
99
  yearweek = "#{year}#{week}".to_i
100
- actual_get[yearweek].to_f
100
+ actual_get[yearweek].to_f.round(3)
101
101
  end
102
102
  arr.map.with_index(1) { |num, i| arr.first(i).inject(:+) }
103
103
  end
@@ -142,26 +142,26 @@ module EducodeSales
142
142
  labels.map do |d|
143
143
  month = d.split("-").last.to_i
144
144
  year = d.split("-").first.to_i
145
- plan_get[[year, month]]&.pluck(:budget_amount)&.reject(&:blank?)&.sum.to_f
145
+ plan_get[[year, month]]&.pluck(:budget_amount)&.reject(&:blank?)&.sum.to_f.round(3)
146
146
  end
147
147
  elsif select == NAMES[1]
148
148
  arr = labels.map do |d|
149
149
  month = d.split("-").last.to_i
150
150
  year = d.split("-").first.to_i
151
- plan_get[[year, month]]&.pluck(:budget_amount)&.reject(&:blank?)&.sum.to_f
151
+ plan_get[[year, month]]&.pluck(:budget_amount)&.reject(&:blank?)&.sum.to_f.round(3)
152
152
  end
153
153
  arr.map.with_index(1) { |num, i| arr.first(i).inject(:+) }
154
154
  elsif select == NAMES[2]
155
155
  labels.map do |d|
156
156
  month = d.split("-").last.to_i
157
157
  year = d.split("-").first.to_i
158
- actual_get[[year, month]]&.pluck(:actual_amount)&.reject(&:blank?)&.sum.to_f
158
+ actual_get[[year, month]]&.pluck(:actual_amount)&.reject(&:blank?)&.sum.to_f.round(3)
159
159
  end
160
160
  elsif select == NAMES[3]
161
161
  arr = labels.map do |d|
162
162
  month = d.split("-").last.to_i
163
163
  year = d.split("-").first.to_i
164
- actual_get[[year, month]]&.pluck(:actual_amount)&.reject(&:blank?)&.sum.to_f
164
+ actual_get[[year, month]]&.pluck(:actual_amount)&.reject(&:blank?)&.sum.to_f.round(3)
165
165
  end
166
166
  arr.map.with_index(1) { |num, i| arr.first(i).inject(:+) }
167
167
  end
@@ -32,6 +32,12 @@
32
32
  <%= select_tag "property", options_for_select(SchoolTag.where(for_missions: true).pluck(:name, :id), params[:property]), { include_blank: true } %>
33
33
  </div>
34
34
  </div>
35
+ <div class="layui-inline m-t-10">
36
+ <label class="layui-form-label">维度</label>
37
+ <div class="layui-input-inline">
38
+ <%= select_tag "forecast_type", options_for_select([['按金额统计', 'money'], ['按商机数统计', 'count']], params[:forecast_type]), { 'lay-filter': 'forecast_type' } %>
39
+ </div>
40
+ </div>
35
41
  <div class="layui-inline">
36
42
  <button type="button" id="search_bt" class="forecast_count_bt layui-btn layui-btn-primary" lay-submit lay-filter="search_sales">确定
37
43
  </button>
@@ -3,9 +3,17 @@
3
3
  <form class="layui-form " action="">
4
4
  <h4>编辑人员</h4>
5
5
  <div class="layui-form-item">
6
- <label class="layui-form-label required">姓名</label>
7
- <div class="layui-input-block" style="line-height: 36px;">
8
- <%= "#{@staff.user.real_name} - #{@staff.user.phone}" %>
6
+ <div class="layui-inline">
7
+ <label class="layui-form-label">用户名</label>
8
+ <div class="layui-input-inline" style="line-height: 38px;">
9
+ <%= "#{@staff.user.real_name} - #{@staff.user.phone}" %>
10
+ </div>
11
+ </div>
12
+ <div class="layui-inline">
13
+ <label class="layui-form-label">姓名</label>
14
+ <div class="layui-input-inline">
15
+ <input type="text" name="name" class="layui-input" value="<%= @staff.name %>">
16
+ </div>
9
17
  </div>
10
18
  </div>
11
19
  <div class="layui-form-item">
@@ -73,10 +73,15 @@
73
73
  sort: true
74
74
  },
75
75
  {
76
- field: 'name',
76
+ field: 'user_name',
77
77
  width: 120,
78
78
  title: '用户名'
79
79
  },
80
+ {
81
+ field: 'name',
82
+ width: 120,
83
+ title: '姓名'
84
+ },
80
85
  {
81
86
  field: 'role',
82
87
  width: 120,
@@ -2,7 +2,8 @@ area_ids = EducodeSales::Common.where(clazz: 'area').ids.sort.to_s
2
2
  json.data do
3
3
  json.array! @staffs do |d|
4
4
  json.id d.id
5
- json.name d.user.real_name
5
+ json.user_name d.user.real_name
6
+ json.name d.name
6
7
  json.role d.role&.name
7
8
  json.schools d.staff_schools.map(&:school).map(&:name).join("、")
8
9
  json.job_type EducodeSales::Common.job_type_name[d.job_type]
@@ -5,6 +5,12 @@
5
5
  <label class="layui-form-label required">人员</label>
6
6
  <div class="layui-input-block" id="user"></div>
7
7
  </div>
8
+ <div class="layui-form-item">
9
+ <label class="layui-form-label required">姓名</label>
10
+ <div class="layui-input-block">
11
+ <input type="text" name="name" class="layui-input" value="" lay-verify="required">
12
+ </div>
13
+ </div>
8
14
  <hr>
9
15
  <div class="layui-form-item">
10
16
  <div class="layui-input-block">
@@ -54,11 +60,10 @@
54
60
 
55
61
  //监听提交
56
62
  form.on('submit(saveBtn)', function (data) {
57
- console.log(ins.getValue())
58
63
  if (ins.getValue() == "") {
59
64
  return layer.alert("请选择平台用户")
60
65
  }
61
- request.authPost("missions/staffs", {id: ins.getValue()}, function (res) {
66
+ request.authPost("missions/staffs", {id: ins.getValue(), name: data.field.name}, function (res) {
62
67
  if (res.success == false) {
63
68
  layer.alert(res.msg)
64
69
  } else {
@@ -86,6 +86,12 @@
86
86
  <input type="text" class="layui-input" id="mobile" placeholder="请输入电话" autocomplete="off" name="mobile">
87
87
  </div>
88
88
  </div>
89
+ <div class="layui-inline show_item" style="display:none;">
90
+ <label class="layui-form-label">是否联系上</label>
91
+ <div class="layui-input-inline">
92
+ <%= select_tag "is_contact", options_for_select([["",""],["已联系上","1"],["未联系上","0"]]), { include_blank: true } %>
93
+ </div>
94
+ </div>
89
95
 
90
96
  <div class="layui-inline">
91
97
  <button type="reset" class="layui-btn layui-btn-primary" lay-submit lay-filter="reset_business_search">重置
@@ -152,214 +158,249 @@
152
158
  var laydate = layui.laydate;
153
159
 
154
160
  laydate.render({
155
- elem: '#date',
156
- range: true
161
+ elem: '#date',
162
+ range: true
157
163
  });
158
164
  laydate.render({
159
- elem: '#time',
165
+ elem: '#time',
160
166
  });
161
167
 
168
+ cols_table = [[
169
+ {
170
+ field: 'id',
171
+ width: 60,
172
+ title: '序号', type: 'numbers',
173
+ totalRowText: '合计',
174
+ fixed: 'left'
175
+
176
+ },
177
+ {
178
+ field: 'name',
179
+ width: 100,
180
+ title: '姓名',
181
+ fixed: 'left',
182
+ templet: "#name",
183
+ hide: gon.filter.name
184
+ },
185
+ {
186
+ field: 'realname',
187
+ width: 100,
188
+ title: '真实姓名',
189
+ hide: gon.filter.realname
190
+ },
191
+ {
192
+ field: 'school',
193
+ width: 160,
194
+ title: '单位',
195
+ templet: '<div><span title="{{d.school}}">{{d.school}}</span></div>',
196
+ hide: gon.filter.school
197
+
198
+ },
199
+ {
200
+ field: 'department',
201
+ width: 130,
202
+ title: '部门',
203
+ templet: '<div><span title="{{d.department}}">{{d.department}}</span></div>',
204
+ hide: gon.filter.department
205
+ },
206
+ {
207
+ field: 'majors',
208
+ width: 160,
209
+ title: '专业',
210
+ hide: gon.filter.majors
211
+ },
212
+ {
213
+ field: 'area',
214
+ width: 80,
215
+ title: '区域',
216
+ hide: gon.filter.area
217
+ },
218
+ {
219
+ field: 'business_count',
220
+ width: 120,
221
+ title: '单位商机数',
222
+ hide: gon.filter.business_count
223
+ },
224
+ {
225
+ field: 'professional_title',
226
+ title: '职称',
227
+ width: 80,
228
+ templet: '#show_follow',
229
+ hide: gon.filter.professional_title
230
+ },
231
+ {
232
+ field: 'job',
233
+ width: 80,
234
+ title: '职务',
235
+ templet: '#show_keys',
236
+ hide: gon.filter.job
237
+
238
+ },
239
+ {
240
+ field: 'source',
241
+ width: 90,
242
+ title: '来源',
243
+ hide: gon.filter.source
244
+ },
245
+ {
246
+ field: 'attitude',
247
+ width: 60,
248
+ title: '态度',
249
+ hide: gon.filter.attitude
250
+ },
251
+ {
252
+ field: 'course_subjects_count',
253
+ width: 90,
254
+ title: '课程方向',
255
+ templet: "#courses",
256
+ hide: gon.filter.course_subjects_count
257
+ },
258
+ {
259
+ field: 'teacher_follows_count',
260
+ width: 90,
261
+ title: '跟进情况',
262
+ totalRow: true,
263
+ templet: "#follow",
264
+ hide: gon.filter.teacher_follows_count
265
+ },
266
+ {
267
+ field: 'sales_manage',
268
+ width: 160,
269
+ title: '销售经理',
270
+ hide: gon.filter.sales_manage
271
+ },
272
+ {
273
+ field: 'staff_manage',
274
+ width: 160,
275
+ title: '生态经理',
276
+ hide: gon.filter.staff_manage
277
+ },
278
+ {
279
+ field: 'follow_person',
280
+ width: 120,
281
+ title: '最新跟进人',
282
+ hide: gon.filter.follow_person
283
+ },
284
+ {
285
+ field: 'followup_at',
286
+ width: 180,
287
+ title: '最新跟进时间',
288
+ hide: gon.filter.followup_at
289
+ },
290
+ {
291
+ field: 'latest_time',
292
+ width: 120,
293
+ title: '无跟进天数',
294
+ sort: true,
295
+ hide: gon.filter.latest_time
296
+ },
297
+ {
298
+ field: 'teacher_used',
299
+ width: 120,
300
+ title: '学院渗透率',
301
+ hide: gon.filter.teacher_used
302
+ },
303
+ {
304
+ field: 'students',
305
+ width: 60,
306
+ totalRow: '{{ parseInt(d.TOTAL_NUMS) }}',
307
+ title: '学生',
308
+ hide: gon.filter.students
309
+ },
310
+ {
311
+ field: 'courses_count',
312
+ width: 60,
313
+ title: '课堂',
314
+ totalRow: true,
315
+ templet: "#class",
316
+ hide: gon.filter.courses_count
317
+ },
318
+ {
319
+ field: 'activities_count',
320
+ width: 100,
321
+ title: '参与活动',
322
+ templet: "#event",
323
+ hide: gon.filter.activities_count
324
+ },
325
+ {
326
+ field: 'created_on',
327
+ width: 120,
328
+ title: '注册时间',
329
+ sort: true,
330
+ hide: gon.filter.created_on
331
+ },
332
+ {
333
+ field: 'last_login_on',
334
+ width: 120,
335
+ title: '最近登录',
336
+ sort: true,
337
+ hide: gon.filter.last_login_on
338
+ },
339
+ {
340
+ field: 'created_at',
341
+ width: 120,
342
+ title: '添加时间',
343
+ sort: true,
344
+ hide: gon.filter.created_at
345
+ },
346
+ {
347
+ field: 'experience',
348
+ width: 120,
349
+ title: '经验值',
350
+ sort: true,
351
+ hide: gon.filter.experience
352
+ },
353
+ {
354
+ field: 'grade',
355
+ width: 120,
356
+ title: '金币',
357
+ sort: true,
358
+ hide: gon.filter.grade
359
+ },
360
+ {
361
+ field: 'mobile',
362
+ width: 120,
363
+ title: '联系电话',
364
+ hide: gon.filter.mobile
365
+ },
366
+ {
367
+ field: 'wechat',
368
+ width: 120,
369
+ title: '微信号',
370
+ hide: gon.filter.wechat
371
+ },
372
+ {
373
+ field: 'teacher_assist',
374
+ width: 120,
375
+ title: '教研助理',
376
+ hide: gon.filter.teacher_assist
377
+ },
378
+ {
379
+ field: 'is_contact',
380
+ width: 120,
381
+ title: '是否联系上',
382
+ hide: gon.filter.is_contact
383
+ },
384
+ {
385
+ title: '操作',
386
+ minWidth: 170,
387
+ toolbar: '#currentTableBar',
388
+ align: "center",
389
+ fixed: 'right'
390
+ }
391
+ ]]
392
+
162
393
  table = layui.table;
163
394
  table.render({
164
395
  elem: '#teachers_table',
165
396
  url: '/missions/teachers',
166
397
  where: {q: form.val('search_form')},
167
398
  toolbar: '#toolbarDemo',
168
- totalRow:true,
399
+ totalRow: true,
169
400
  defaultToolbar: ['filter'],
170
- cols: [
171
- [
172
- {
173
- field: 'id',
174
- width: 60,
175
- title:'序号',type: 'numbers',
176
- totalRowText:'合计',
177
- fixed: 'left'
178
-
179
- },
180
- {
181
- field: 'name',
182
- width: 100,
183
- title: '姓名',
184
- fixed: 'left',
185
- templet: "#name"
186
- },
187
- {
188
- field: 'realname',
189
- width: 100,
190
- title: '真实姓名',
191
- },
192
- {
193
- field: 'school',
194
- width: 160,
195
- title: '单位',
196
- templet:'<div><span title="{{d.school}}">{{d.school}}</span></div>'
197
-
198
- },
199
- {
200
- field: 'department',
201
- width: 130,
202
- title: '部门',
203
- templet:'<div><span title="{{d.department}}">{{d.department}}</span></div>'
204
- },
205
- {
206
- field: 'majors',
207
- width: 160,
208
- title: '专业',
209
- },
210
- {
211
- field: 'area',
212
- width: 80,
213
- title: '区域',
214
- },
215
- {
216
- field: 'business_count',
217
- width: 120,
218
- title: '单位商机数',
219
- },
220
- {
221
- field: 'professional_title',
222
- title: '职称',
223
- width: 80,
224
- templet: '#show_follow'
225
- },
226
- {
227
- field: 'job',
228
- width: 80,
229
- title: '职务',
230
- templet: '#show_keys'
231
-
232
- },
233
- {
234
- field: 'source',
235
- width: 90,
236
- title: '来源',
237
- },
238
- {
239
- field: 'attitude',
240
- width: 60,
241
- title: '态度',
242
- },
243
- {
244
- field: 'course_subjects_count',
245
- width: 90,
246
- title: '课程方向',
247
- templet: "#courses"
248
- },
249
- {
250
- field: 'teacher_follows_count',
251
- width: 90,
252
- title: '跟进情况',
253
- totalRow:true,
254
- templet: "#follow"
255
- },
256
- {
257
- field: 'sales_manage',
258
- width: 160,
259
- title: '销售经理',
260
- },
261
- {
262
- field: 'staff_manage',
263
- width: 160,
264
- title: '生态经理',
265
- },
266
- {
267
- field: 'follow_person',
268
- width: 120,
269
- title: '最新跟进人',
270
- },
271
- {
272
- field: 'followup_at',
273
- width: 180,
274
- title: '最新跟进时间',
275
- },
276
- {
277
- field: 'latest_time',
278
- width: 120,
279
- title: '无跟进天数',
280
- sort: true,
281
- },
282
- {
283
- field: 'teacher_used',
284
- width: 120,
285
- title: '学院渗透率',
286
- },
287
- {
288
- field: 'students',
289
- width: 60,
290
- totalRow:'{{ parseInt(d.TOTAL_NUMS) }}',
291
- title: '学生',
292
- },
293
- {
294
- field: 'courses_count',
295
- width: 60,
296
- title: '课堂',
297
- totalRow:true,
298
- templet: "#class"
299
- },
300
- {
301
- field: 'activities_count',
302
- width: 100,
303
- title: '参与活动',
304
- templet: "#event"
305
- },
306
- {
307
- field: 'created_on',
308
- width: 120,
309
- title: '注册时间',
310
- sort: true,
311
- },
312
- {
313
- field: 'last_login_on',
314
- width: 120,
315
- title: '最近登录',
316
- sort: true,
317
- },
318
- {
319
- field: 'created_at',
320
- width: 120,
321
- title: '添加时间',
322
- sort: true,
323
- },
324
- {
325
- field: 'experience',
326
- width: 120,
327
- title: '经验值',
328
- sort: true,
329
- },
330
- {
331
- field: 'grade',
332
- width: 120,
333
- title: '金币',
334
- sort: true,
335
- },
336
- {
337
- field: 'mobile',
338
- width: 120,
339
- title: '联系电话',
340
- },
341
- {
342
- field: 'wechat',
343
- width: 120,
344
- title: '微信号',
345
- },
346
- {
347
- field: 'teacher_assist',
348
- width: 120,
349
- title: '教研助理',
350
- },
351
- {
352
- title: '操作',
353
- minWidth: 170,
354
- toolbar: '#currentTableBar',
355
- align: "center",
356
- fixed: 'right'
357
- }
358
- ]
359
- ],
360
-
401
+ cols: cols_table,
361
402
  limit: 20,
362
- limits: [10,15,20,30,40,50,60,70,80,90],
403
+ limits: [10, 15, 20, 30, 40, 50, 60, 70, 80, 90],
363
404
  page: true,
364
405
  done: function (res) {
365
406
  drowpdwonRender()
@@ -367,7 +408,7 @@
367
408
  });
368
409
  var dropmenu = gon.menus;
369
410
 
370
- drowpdwonRender = function() {
411
+ drowpdwonRender = function () {
371
412
  dropdown.render({
372
413
  elem: '.more-btn',
373
414
  data: dropmenu,
@@ -505,6 +546,37 @@
505
546
  * toolbar事件监听
506
547
  */
507
548
  table.on('toolbar(teachers_table)', function (obj) {
549
+ switch (obj.event) {
550
+ case 'LAYTABLE_COLS':
551
+ layui.form.on('checkbox(LAY_TABLE_TOOL_COLS)', function (objs) {
552
+ var value = objs.elem.checked
553
+ var name = objs.elem.attributes[1].value
554
+ $.ajax({
555
+ url: "filter",
556
+ type: "GET",
557
+ data: "type=teachers&name=" + name + "&check=" + value,
558
+ success: function (data) {
559
+ let hide_type = "[data-field='" + name + "']"
560
+ if (data.hidden === 1) {
561
+ $(hide_type).addClass('layui-hide');
562
+ } else if (data.hidden === 0) {
563
+ $(hide_type).removeClass('layui-hide');
564
+ }
565
+ //(因为触发筛选器出现的checkbox是根据cols的值得到 这里必须修改 cols的值 然后才会出现下次点击筛选器时 checkbox正常显示)
566
+ for (i = 1; i < cols_table[0].length; i++) {
567
+ if (name === cols_table[0][i].field) {
568
+ cols_table[0][i].hide = !value
569
+ objs.config.cols = cols_table
570
+ }
571
+ }
572
+ },
573
+ error: function (data) {
574
+ layer.msg("操作失败")
575
+ },
576
+ dataType: 'Json'
577
+ })
578
+ });
579
+ }
508
580
  if (obj.event === 'add') { // 手动添加
509
581
  var content = miniPage.getHrefContent('/missions/teachers/new');
510
582
  var openWH = miniPage.getOpenWidthHeight();