educode_sales 0.8.2 → 0.8.5
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 +4 -4
- data/app/assets/javascripts/educode_sales/table2excel.js +2759 -0
- data/app/controllers/educode_sales/assessments_controller.rb +23 -9
- data/app/controllers/educode_sales/businesses_controller.rb +8 -0
- data/app/controllers/educode_sales/follow_ups_controller.rb +1 -1
- data/app/controllers/educode_sales/money_plans_controller.rb +0 -2
- data/app/helpers/educode_sales/application_helper.rb +1 -1
- data/app/models/educode_sales/filter.rb +0 -3
- data/app/models/educode_sales/follow_up.rb +8 -0
- data/app/models/educode_sales/staff.rb +1 -1
- data/app/views/educode_sales/assessments/_progress.html.erb +214 -146
- data/app/views/educode_sales/assessments/_setup.html.erb +247 -192
- data/app/views/educode_sales/assessments/edit.html.erb +53 -45
- data/app/views/educode_sales/assessments/index.html.erb +16 -4
- data/app/views/educode_sales/assessments/index.json.jbuilder +17 -17
- data/app/views/educode_sales/assessments/new.html.erb +113 -114
- data/app/views/educode_sales/assessments/progress.json.jbuilder +52 -52
- data/app/views/educode_sales/businesses/edit_follow_record.html.erb +13 -0
- data/app/views/educode_sales/businesses/index.html.erb +206 -187
- data/app/views/educode_sales/businesses/index.json.jbuilder +6 -0
- data/app/views/educode_sales/businesses/new_follow_record.html.erb +17 -3
- data/app/views/educode_sales/businesses/show_follow.html.erb +5 -0
- data/app/views/educode_sales/businesses/show_follow.json.jbuilder +7 -0
- data/app/views/educode_sales/businesses/show_follow_record.html.erb +15 -5
- data/db/migrate/20220512031715_add_column_o_business_deployment_to_follow_ups.rb +5 -0
- data/db/migrate/20220523023609_update_assessment_month_column_to_assessment_settings.rb +9 -0
- data/db/migrate/20220523101628_update_column_to_follow_ups.rb +8 -0
- data/lib/educode_sales/version.rb +1 -1
- metadata +6 -2
@@ -1,14 +1,3 @@
|
|
1
|
-
<script type="text/html" id="toolbarDemo5">
|
2
|
-
<div class="layui-btn-container">
|
3
|
-
<span class="table-label">指标完成情况</span>
|
4
|
-
<% if can?(:create, EducodeSales::AssessmentsSetting) %>
|
5
|
-
<button class="layui-btn layui-btn-primary layui-border-green layui-btn-sm pull-right" lay-event="add" >添加人员任务指标</button>
|
6
|
-
<% end %>
|
7
|
-
</div>
|
8
|
-
</script>
|
9
|
-
|
10
|
-
|
11
|
-
|
12
1
|
<!--搜索-->
|
13
2
|
<div class="layuimini-main min-height-table">
|
14
3
|
<form class="layui-form layui-form-pane" lay-filter="search_assessments_form">
|
@@ -33,7 +22,7 @@
|
|
33
22
|
<div class="layui-inline">
|
34
23
|
<label class="layui-form-label">考核人员</label>
|
35
24
|
<div class="layui-input-inline">
|
36
|
-
<%= select_tag "staff_id", options_for_select(@staffs, params[:staff_id]), { 'lay-filter':
|
25
|
+
<%= select_tag "staff_id", options_for_select(@staffs, params[:staff_id]), { 'lay-filter':"staff_id", include_blank: true } %>
|
37
26
|
</div>
|
38
27
|
</div>
|
39
28
|
<div class="layui-inline">
|
@@ -50,6 +39,16 @@
|
|
50
39
|
|
51
40
|
|
52
41
|
|
42
|
+
<script type="text/html" id="toolbarDemo5">
|
43
|
+
<div class="layui-btn-container">
|
44
|
+
<span class="table-label">人员任务指标</span>
|
45
|
+
<% if can?(:create, EducodeSales::AssessmentsSetting) %>
|
46
|
+
<button class="layui-btn layui-btn-primary layui-border-green layui-btn-sm pull-right" lay-event="add" >添加人员任务指标</button>
|
47
|
+
<% end %>
|
48
|
+
</div>
|
49
|
+
</script>
|
50
|
+
|
51
|
+
|
53
52
|
<table class="layui-hide" id="assessments" lay-filter="assessments"></table>
|
54
53
|
|
55
54
|
<script type="text/html" id="human_task_indicatorsTableBar">
|
@@ -79,140 +78,140 @@
|
|
79
78
|
value: '2022',
|
80
79
|
})
|
81
80
|
|
82
|
-
|
81
|
+
var cols_table = [//表头
|
82
|
+
[
|
83
|
+
{
|
84
|
+
type: 'numbers',
|
85
|
+
title: '序号',
|
86
|
+
width: 100,
|
87
|
+
fixed: 'left',
|
88
|
+
},
|
89
|
+
{
|
90
|
+
field: 'username',
|
91
|
+
title: '考核人员',
|
92
|
+
width: 100,
|
93
|
+
fixed: 'left',
|
94
|
+
hide: gon.filter["username"],
|
95
|
+
},
|
96
|
+
{
|
97
|
+
field: 'annual',
|
98
|
+
title: '全年',
|
99
|
+
width: 100,
|
100
|
+
hide: gon.filter["annual"],
|
101
|
+
},
|
102
|
+
{
|
103
|
+
field: 'first_quarter',
|
104
|
+
title: '第1季度',
|
105
|
+
width: 100,
|
106
|
+
hide: gon.filter["first_quarter"],
|
107
|
+
},
|
108
|
+
{
|
109
|
+
field: 'january',
|
110
|
+
title: '1月',
|
111
|
+
width: 100,
|
112
|
+
hide: gon.filter.january,
|
113
|
+
},
|
114
|
+
{
|
115
|
+
field: 'february',
|
116
|
+
title: '2月',
|
117
|
+
width: 100,
|
118
|
+
hide: gon.filter.february,
|
119
|
+
},
|
120
|
+
{
|
121
|
+
field: 'march',
|
122
|
+
title: '3月',
|
123
|
+
width: 100,
|
124
|
+
hide: gon.filter.march,
|
125
|
+
},
|
126
|
+
{
|
127
|
+
field: 'second_quarter',
|
128
|
+
title: '第2季度',
|
129
|
+
width: 100,
|
130
|
+
hide: gon.filter.second_quarter,
|
131
|
+
},
|
132
|
+
{
|
133
|
+
field: 'april',
|
134
|
+
title: '4月',
|
135
|
+
width: 100,
|
136
|
+
hide: gon.filter.april,
|
137
|
+
},
|
138
|
+
{
|
139
|
+
field: 'may',
|
140
|
+
title: '5月',
|
141
|
+
width: 100,
|
142
|
+
hide: gon.filter.may,
|
143
|
+
},
|
144
|
+
{
|
145
|
+
field: 'june',
|
146
|
+
title: '6月',
|
147
|
+
width: 100,
|
148
|
+
hide: gon.filter.june,
|
149
|
+
},
|
150
|
+
{
|
151
|
+
field: 'third_quarter',
|
152
|
+
title: '第3季度',
|
153
|
+
width: 100,
|
154
|
+
hide: gon.filter.third_quarter,
|
155
|
+
},
|
156
|
+
{
|
157
|
+
field: 'july',
|
158
|
+
title: '7月',
|
159
|
+
width: 100,
|
160
|
+
hide: gon.filter.july,
|
161
|
+
},
|
162
|
+
{
|
163
|
+
field: 'august',
|
164
|
+
title: '8月',
|
165
|
+
width: 100,
|
166
|
+
hide: gon.filter.august,
|
167
|
+
},
|
168
|
+
{
|
169
|
+
field: 'september',
|
170
|
+
title: '9月',
|
171
|
+
width: 100,
|
172
|
+
hide: gon.filter.september,
|
173
|
+
},
|
174
|
+
{
|
175
|
+
field: 'fourth_quarter',
|
176
|
+
title: '第4季度',
|
177
|
+
width: 100,
|
178
|
+
hide: gon.filter.fourth_quarter,
|
179
|
+
},
|
180
|
+
{
|
181
|
+
field: 'october',
|
182
|
+
title: '10月',
|
183
|
+
width: 100,
|
184
|
+
hide: gon.filter.october,
|
185
|
+
},
|
186
|
+
{
|
187
|
+
field: 'november',
|
188
|
+
title: '11月',
|
189
|
+
width: 100,
|
190
|
+
hide: gon.filter.november,
|
191
|
+
},
|
192
|
+
{
|
193
|
+
field: 'december',
|
194
|
+
title: '12月',
|
195
|
+
width: 100,
|
196
|
+
hide: gon.filter.december,
|
197
|
+
},
|
198
|
+
{
|
199
|
+
field: 'option',
|
200
|
+
title: '操作',
|
201
|
+
align: 'center',
|
202
|
+
fixed: 'right',
|
203
|
+
width: 200,
|
204
|
+
toolbar: '#human_task_indicatorsTableBar'
|
205
|
+
},
|
206
|
+
]
|
207
|
+
]
|
83
208
|
table.render({
|
84
209
|
elem: '#assessments',
|
85
210
|
url: '/missions/assessments',
|
86
211
|
toolbar: '#toolbarDemo5',
|
87
212
|
totalRow: true,
|
88
213
|
defaultToolbar: ['filter'],
|
89
|
-
cols:
|
90
|
-
[
|
91
|
-
{
|
92
|
-
type: 'numbers',
|
93
|
-
title: '序号',
|
94
|
-
width: 100,
|
95
|
-
sort: true,
|
96
|
-
fixed: 'left',
|
97
|
-
},
|
98
|
-
{
|
99
|
-
field: 'username',
|
100
|
-
title: '考核人员',
|
101
|
-
width: 100,
|
102
|
-
fixed: 'left',
|
103
|
-
hide: gon.filter["username"],
|
104
|
-
},
|
105
|
-
{
|
106
|
-
field: 'annual',
|
107
|
-
title: '全年',
|
108
|
-
width: 100,
|
109
|
-
hide: gon.filter["annual"],
|
110
|
-
},
|
111
|
-
{
|
112
|
-
field: 'first_quarter',
|
113
|
-
title: '第1季度',
|
114
|
-
width: 100,
|
115
|
-
hide: gon.filter["first_quarter"],
|
116
|
-
},
|
117
|
-
{
|
118
|
-
field: 'january',
|
119
|
-
title: '1月',
|
120
|
-
width: 70,
|
121
|
-
hide: gon.filter.january,
|
122
|
-
},
|
123
|
-
{
|
124
|
-
field: 'february',
|
125
|
-
title: '2月',
|
126
|
-
width: 70,
|
127
|
-
hide: gon.filter.february,
|
128
|
-
},
|
129
|
-
{
|
130
|
-
field: 'march',
|
131
|
-
title: '3月',
|
132
|
-
width: 70,
|
133
|
-
hide: gon.filter.march,
|
134
|
-
},
|
135
|
-
{
|
136
|
-
field: 'second_quarter',
|
137
|
-
title: '第2季度',
|
138
|
-
width: 100,
|
139
|
-
hide: gon.filter.second_quarter,
|
140
|
-
},
|
141
|
-
{
|
142
|
-
field: 'april',
|
143
|
-
title: '4月',
|
144
|
-
hide: gon.filter.april,
|
145
|
-
},
|
146
|
-
{
|
147
|
-
field: 'may',
|
148
|
-
title: '5月',
|
149
|
-
width: 70,
|
150
|
-
hide: gon.filter.may,
|
151
|
-
},
|
152
|
-
{
|
153
|
-
field: 'june',
|
154
|
-
title: '6月',
|
155
|
-
width: 70,
|
156
|
-
hide: gon.filter.june,
|
157
|
-
},
|
158
|
-
{
|
159
|
-
field: 'third_quarter',
|
160
|
-
title: '第3季度',
|
161
|
-
width: 100,
|
162
|
-
hide: gon.filter.third_quarter,
|
163
|
-
},
|
164
|
-
{
|
165
|
-
field: 'july',
|
166
|
-
title: '7月',
|
167
|
-
width: 70,
|
168
|
-
hide: gon.filter.july,
|
169
|
-
},
|
170
|
-
{
|
171
|
-
field: 'august',
|
172
|
-
title: '8月',
|
173
|
-
width: 70,
|
174
|
-
hide: gon.filter.august,
|
175
|
-
},
|
176
|
-
{
|
177
|
-
field: 'september',
|
178
|
-
title: '9月',
|
179
|
-
width: 70,
|
180
|
-
hide: gon.filter.september,
|
181
|
-
},
|
182
|
-
{
|
183
|
-
field: 'fourth_quarter',
|
184
|
-
title: '第4季度',
|
185
|
-
width: 100,
|
186
|
-
hide: gon.filter.fourth_quarter,
|
187
|
-
},
|
188
|
-
{
|
189
|
-
field: 'october',
|
190
|
-
title: '10月',
|
191
|
-
width: 70,
|
192
|
-
hide: gon.filter.october,
|
193
|
-
},
|
194
|
-
{
|
195
|
-
field: 'november',
|
196
|
-
title: '11月',
|
197
|
-
width: 70,
|
198
|
-
hide: gon.filter.november,
|
199
|
-
},
|
200
|
-
{
|
201
|
-
field: 'december',
|
202
|
-
title: '12月',
|
203
|
-
width: 70,
|
204
|
-
hide: gon.filter.december,
|
205
|
-
},
|
206
|
-
{
|
207
|
-
field: 'option',
|
208
|
-
title: '操作',
|
209
|
-
align: 'center',
|
210
|
-
fixed: 'right',
|
211
|
-
width: 200,
|
212
|
-
toolbar: '#human_task_indicatorsTableBar'
|
213
|
-
},
|
214
|
-
]
|
215
|
-
],
|
214
|
+
cols:cols_table,
|
216
215
|
done : function () {
|
217
216
|
$('.layui-table-fixed-r').removeClass('layui-hide'); // 与底部的css文件解决fixed第一次加载无法实现问题
|
218
217
|
},
|
@@ -258,18 +257,14 @@
|
|
258
257
|
|
259
258
|
|
260
259
|
table.on('tool(assessments)', function (obj) {
|
261
|
-
|
262
260
|
var data = obj.data;
|
263
|
-
console.log(obj)
|
264
|
-
console.log(data)
|
265
261
|
var id = data.id
|
266
|
-
console.log(id)
|
267
262
|
// 有些地方还要多看--------!!!!!!!
|
268
263
|
if (obj.event === 'edit') {
|
269
264
|
var content = miniPage.getHrefContent('/missions/assessments/' + id + '/edit');
|
270
265
|
var openWH = miniPage.getOpenWidthHeight();
|
271
266
|
var index = layer.open({
|
272
|
-
title: '
|
267
|
+
title: '编辑人员任务指标',
|
273
268
|
type: 1,
|
274
269
|
shade: 0.2,
|
275
270
|
maxmin: true,
|
@@ -278,8 +273,34 @@
|
|
278
273
|
offset: [openWH[2] + 'px', openWH[3] + 'px'],
|
279
274
|
content: content,
|
280
275
|
success: function (layero, index) {
|
281
|
-
form.
|
282
|
-
|
276
|
+
form.on('submit(cancel_edit_assessment)', function (data) {
|
277
|
+
console.log(data)
|
278
|
+
layer.closeAll();
|
279
|
+
});
|
280
|
+
form.verify({
|
281
|
+
data: function (value,item){
|
282
|
+
if (parseFloat(value) < 0 ){
|
283
|
+
console.log(value);
|
284
|
+
return "数据不能小于零"
|
285
|
+
}else if (parseFloat(value) > 100000000){
|
286
|
+
console.log(value);
|
287
|
+
return "数据不能大于一亿"
|
288
|
+
}
|
289
|
+
}
|
290
|
+
})
|
291
|
+
form.on('submit(edit_task_assessment)', function (data) {
|
292
|
+
data.field.id = obj.data.id;
|
293
|
+
request.authPut("missions/assessments/"+data.field.id , data.field, function (res) {
|
294
|
+
if (res.success == false) {
|
295
|
+
layer.alert(res.msg)
|
296
|
+
} else {
|
297
|
+
layer.closeAll();
|
298
|
+
table.reload("assessments");
|
299
|
+
}
|
300
|
+
})
|
301
|
+
return false;
|
302
|
+
});
|
303
|
+
},
|
283
304
|
});
|
284
305
|
$(window).on("resize", function (){
|
285
306
|
layer.full(index);
|
@@ -297,34 +318,11 @@
|
|
297
318
|
|
298
319
|
// * toolbar事件监听
|
299
320
|
table.on('toolbar(assessments)', function (obj) {
|
300
|
-
|
301
|
-
// case 'LAYTABLE_COLS':
|
302
|
-
// layui.form.on('checkbox(LAY_TABLE_TOOL_COLS)', function(obj) {
|
303
|
-
// var value = obj.elem.checked
|
304
|
-
// var name = obj.elem.attributes[1].value
|
305
|
-
// $.ajax({
|
306
|
-
// url: "filter",
|
307
|
-
// type: "GET",
|
308
|
-
// data: "type=assessments_setup&name=" + name + "&hidden=" + value,
|
309
|
-
// success: function (data){
|
310
|
-
// let hide_type = "[data-field='"+name+"']"
|
311
|
-
// if (data.hidden === '1'){
|
312
|
-
// $(hide_type).addClass('layui-hide');
|
313
|
-
// }else{
|
314
|
-
// $(hide_type).removeClass('layui-hide');
|
315
|
-
// }
|
316
|
-
// },
|
317
|
-
// dataType: 'Json'
|
318
|
-
// })
|
319
|
-
// });
|
320
|
-
// break;
|
321
|
-
//
|
322
|
-
// }
|
323
|
-
|
321
|
+
console.log(obj)
|
324
322
|
if (obj.event === 'LAYTABLE_COLS'){
|
325
|
-
layui.form.on('checkbox(LAY_TABLE_TOOL_COLS)', function(
|
326
|
-
var value =
|
327
|
-
var name =
|
323
|
+
layui.form.on('checkbox(LAY_TABLE_TOOL_COLS)', function(objs) {
|
324
|
+
var value = objs.elem.checked
|
325
|
+
var name = objs.elem.attributes[1].value
|
328
326
|
$.ajax({
|
329
327
|
url: "filter",
|
330
328
|
type: "GET",
|
@@ -336,6 +334,13 @@
|
|
336
334
|
}else if (data.hidden === 0){
|
337
335
|
$(hide_type).removeClass('layui-hide');
|
338
336
|
}
|
337
|
+
//(因为触发筛选器出现的checkbox是根据cols的值得到 这里必须修改 cols的值 然后才会出现下次点击筛选器时 checkbox正常显示)
|
338
|
+
for (i=1;i<cols_table[0].length;i++){
|
339
|
+
if (name === cols_table[0][i].field ){
|
340
|
+
cols_table[0][i].hide = !value
|
341
|
+
obj.config.cols = cols_table
|
342
|
+
}
|
343
|
+
}
|
339
344
|
},
|
340
345
|
error: function (data){
|
341
346
|
layer.msg("操作失败")
|
@@ -347,12 +352,14 @@
|
|
347
352
|
// 监听添加操作
|
348
353
|
var content = miniPage.getHrefContent('/missions/assessments/new');
|
349
354
|
var openWH = miniPage.getOpenWidthHeight();
|
355
|
+
console.log(content)
|
356
|
+
console.log(openWH)
|
350
357
|
var index = layer.open({
|
351
|
-
title: '
|
358
|
+
title: '添加人员任务指标',
|
352
359
|
type: 1,
|
353
360
|
shade: 0.2,
|
354
361
|
maxmin: true,
|
355
|
-
shadeClose: true,
|
362
|
+
shadeClose: true, //显示x按钮
|
356
363
|
area: [openWH[0] + 'px', openWH[1] + 'px'],
|
357
364
|
offset: [openWH[2] + 'px', openWH[3] + 'px'],
|
358
365
|
content: content,
|
@@ -361,25 +368,73 @@
|
|
361
368
|
form.render('select')
|
362
369
|
// clear上次弹层中的多选人员数据 // staffs不清楚为什么要写在单独的script下才有效
|
363
370
|
staffs.setValue([])
|
371
|
+
// 重新加载 laydate.reload(0
|
372
|
+
|
373
|
+
// 写在new页面时 在有些google浏览器下无法监控到layui中的form与select控件元素 但是在其他浏览器和一些google浏览器可以使用 为了保证全部浏览器可以监控 在open层的success中写
|
374
|
+
laydate.render({
|
375
|
+
elem: '#add_assessments_year',
|
376
|
+
type: 'year',
|
377
|
+
value: <%=Time.now.year %>
|
378
|
+
});
|
379
|
+
form.on('submit(add_task_assessment)', function (data) {
|
380
|
+
console.log(data.field)
|
381
|
+
var staffs_selectArr = staffs.getValue();
|
382
|
+
if ( data.field.assessment === '0' || staffs_selectArr.length === 0 ) {
|
383
|
+
if (data.field.assessment === '0'){
|
384
|
+
alert("请选择考核指标!!!");
|
385
|
+
}else {
|
386
|
+
alert("请选择员工!!!");
|
387
|
+
}
|
388
|
+
return false;
|
389
|
+
} else {
|
390
|
+
request.authPost("missions/assessments", data.field, function (res) {
|
391
|
+
if (res.success == false) {
|
392
|
+
layer.alert(res.msg)
|
393
|
+
} else {
|
394
|
+
layer.closeAll();
|
395
|
+
layer.alert("添加成功");
|
396
|
+
table.reload("assessments");
|
397
|
+
// 重新加载后 progressTable错位
|
398
|
+
// table.reload("progressTable");
|
399
|
+
}
|
400
|
+
});
|
401
|
+
}
|
402
|
+
});
|
403
|
+
form.on('select(new_assessment_id)', function (data){
|
404
|
+
console.log(data.value)
|
405
|
+
// 默认 签单金额 回款金额
|
406
|
+
if (data.value in ["2 ","1","0"]) {
|
407
|
+
// 默认 签单金额 回款金额
|
408
|
+
$(".label1").removeClass('layui-hide')
|
409
|
+
$(".label2").addClass('layui-hide')
|
410
|
+
$(".label3").addClass('layui-hide')
|
411
|
+
} else if (data.value === "3"){
|
412
|
+
// 拜访量
|
413
|
+
$(".label1").addClass('layui-hide')
|
414
|
+
$(".label2").removeClass('layui-hide')
|
415
|
+
$(".label3").addClass('layui-hide')
|
416
|
+
}else {
|
417
|
+
// 新增商机
|
418
|
+
$(".label1").addClass('layui-hide')
|
419
|
+
$(".label2").addClass('layui-hide')
|
420
|
+
$(".label3").removeClass('layui-hide')
|
421
|
+
}
|
422
|
+
})
|
423
|
+
form.verify({
|
424
|
+
data: function (value,item){
|
425
|
+
if (parseFloat(value) < 0 ){
|
426
|
+
console.log(value);
|
427
|
+
return "数据不能小于零"
|
428
|
+
}else if (parseFloat(value) > 100000000) {
|
429
|
+
console.log(value);
|
430
|
+
return "数据不能大于一亿"
|
431
|
+
}
|
432
|
+
}
|
433
|
+
})
|
364
434
|
|
365
435
|
}
|
366
436
|
});
|
367
|
-
|
368
|
-
// document.getElementById('clear_staffs').onclick = function() {
|
369
|
-
// console.log("delete")
|
370
|
-
// staffs.setValue([ {name:'', value:''} ])
|
371
|
-
// // console.log(staffs)
|
372
|
-
// // alert(staffs.setValue([ {name:'', value:''} ]))
|
373
|
-
// // staffs.setValue([ ])
|
374
|
-
// // alert(staffs.setValue([ ]))
|
375
|
-
// clear(staffs)
|
376
|
-
// console.log("ok")
|
377
|
-
// };
|
378
|
-
|
379
|
-
// 目前不清除有什么用
|
380
|
-
// $(window).on("resize", function () {
|
381
|
-
// layer.full(index);
|
382
|
-
// });
|
437
|
+
|
383
438
|
}
|
384
439
|
});
|
385
440
|
|