educode_sales 0.8.1 → 0.8.4

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.
@@ -79,140 +79,141 @@
79
79
  value: '2022',
80
80
  })
81
81
 
82
-
82
+ var cols_table = [//表头
83
+ [
84
+ {
85
+ type: 'numbers',
86
+ title: '序号',
87
+ width: 100,
88
+ sort: true,
89
+ fixed: 'left',
90
+ },
91
+ {
92
+ field: 'username',
93
+ title: '考核人员',
94
+ width: 100,
95
+ fixed: 'left',
96
+ hide: gon.filter["username"],
97
+ },
98
+ {
99
+ field: 'annual',
100
+ title: '全年',
101
+ width: 100,
102
+ hide: gon.filter["annual"],
103
+ },
104
+ {
105
+ field: 'first_quarter',
106
+ title: '第1季度',
107
+ width: 100,
108
+ hide: gon.filter["first_quarter"],
109
+ },
110
+ {
111
+ field: 'january',
112
+ title: '1月',
113
+ width: 100,
114
+ hide: gon.filter.january,
115
+ },
116
+ {
117
+ field: 'february',
118
+ title: '2月',
119
+ width: 100,
120
+ hide: gon.filter.february,
121
+ },
122
+ {
123
+ field: 'march',
124
+ title: '3月',
125
+ width: 100,
126
+ hide: gon.filter.march,
127
+ },
128
+ {
129
+ field: 'second_quarter',
130
+ title: '第2季度',
131
+ width: 100,
132
+ hide: gon.filter.second_quarter,
133
+ },
134
+ {
135
+ field: 'april',
136
+ title: '4月',
137
+ width: 100,
138
+ hide: gon.filter.april,
139
+ },
140
+ {
141
+ field: 'may',
142
+ title: '5月',
143
+ width: 100,
144
+ hide: gon.filter.may,
145
+ },
146
+ {
147
+ field: 'june',
148
+ title: '6月',
149
+ width: 100,
150
+ hide: gon.filter.june,
151
+ },
152
+ {
153
+ field: 'third_quarter',
154
+ title: '第3季度',
155
+ width: 100,
156
+ hide: gon.filter.third_quarter,
157
+ },
158
+ {
159
+ field: 'july',
160
+ title: '7月',
161
+ width: 100,
162
+ hide: gon.filter.july,
163
+ },
164
+ {
165
+ field: 'august',
166
+ title: '8月',
167
+ width: 100,
168
+ hide: gon.filter.august,
169
+ },
170
+ {
171
+ field: 'september',
172
+ title: '9月',
173
+ width: 100,
174
+ hide: gon.filter.september,
175
+ },
176
+ {
177
+ field: 'fourth_quarter',
178
+ title: '第4季度',
179
+ width: 100,
180
+ hide: gon.filter.fourth_quarter,
181
+ },
182
+ {
183
+ field: 'october',
184
+ title: '10月',
185
+ width: 100,
186
+ hide: gon.filter.october,
187
+ },
188
+ {
189
+ field: 'november',
190
+ title: '11月',
191
+ width: 100,
192
+ hide: gon.filter.november,
193
+ },
194
+ {
195
+ field: 'december',
196
+ title: '12月',
197
+ width: 100,
198
+ hide: gon.filter.december,
199
+ },
200
+ {
201
+ field: 'option',
202
+ title: '操作',
203
+ align: 'center',
204
+ fixed: 'right',
205
+ width: 200,
206
+ toolbar: '#human_task_indicatorsTableBar'
207
+ },
208
+ ]
209
+ ]
83
210
  table.render({
84
211
  elem: '#assessments',
85
212
  url: '/missions/assessments',
86
213
  toolbar: '#toolbarDemo5',
87
214
  totalRow: true,
88
215
  defaultToolbar: ['filter'],
89
- cols: [//表头
90
- [
91
- {
92
- type: 'numbers',
93
- title: '序号',
94
- width: 100,
95
- sort: true,
96
- fixed: 'left',
97
- // filter: false
98
- },
99
- {
100
- field: 'username',
101
- title: '考核人员',
102
- width: 100,
103
- fixed: 'left',
104
- hide: gon.filter["username"]
105
- },
106
- {
107
- field: 'annual',
108
- title: '全年',
109
- width: 100,
110
- hide: gon.filter["annual"],
111
- },
112
- {
113
- field: 'first_quarter',
114
- title: '第1季度',
115
- width: 100,
116
- hide: gon.filter["first_quarter"],
117
- },
118
- {
119
- field: 'january',
120
- title: '1月',
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
- ],
216
+ cols:cols_table,
216
217
  done : function () {
217
218
  $('.layui-table-fixed-r').removeClass('layui-hide'); // 与底部的css文件解决fixed第一次加载无法实现问题
218
219
  },
@@ -258,25 +259,8 @@
258
259
 
259
260
 
260
261
  table.on('tool(assessments)', function (obj) {
261
-
262
- switch (obj.event) {
263
- case 'username' :
264
- console.log(obj);
265
- console.log(obj.data);
266
- console.log("username")
267
- console.log("=================")
268
- break;
269
- case 'annual' :
270
- console.log("annual")
271
- break;
272
-
273
- }
274
-
275
262
  var data = obj.data;
276
- console.log(obj)
277
- console.log(data)
278
263
  var id = data.id
279
- console.log(id)
280
264
  // 有些地方还要多看--------!!!!!!!
281
265
  if (obj.event === 'edit') {
282
266
  var content = miniPage.getHrefContent('/missions/assessments/' + id + '/edit');
@@ -310,31 +294,38 @@
310
294
 
311
295
  // * toolbar事件监听
312
296
  table.on('toolbar(assessments)', function (obj) {
313
- switch (obj.event) {
314
- case 'LAYTABLE_COLS':
315
- console.log("start")
316
- var checkStatus = table.checkStatus(obj.config.id);
317
- console.log(checkStatus)
318
- layui.form.on('checkbox(LAY_TABLE_TOOL_COLS)', function(obj) {
319
- console.log(obj); //当前行的一些常用操作集合
320
- var value = obj.elem.checked
321
- console.log(value); //当前是否选中状态
322
- console.log('====checked'); //选中行的相关数据
323
- var name = obj.elem.attributes[1].value
324
- console.log(name);
325
- console.log("request start")
326
- request.get('missions/filter?type=assessments_setup&name='+name+'&hidden='+value, {}, function (res) {
327
- console.log("end")
328
- // layui.msg("重新加载生效")
329
- // layer.close(index);
330
- // table.reload("assessments")
331
- })
332
- });
333
- break;
334
-
335
- }
336
-
337
- if (obj.event === 'add') { // 监听添加操作
297
+ console.log(obj)
298
+ if (obj.event === 'LAYTABLE_COLS'){
299
+ layui.form.on('checkbox(LAY_TABLE_TOOL_COLS)', function(objs) {
300
+ var value = objs.elem.checked
301
+ var name = objs.elem.attributes[1].value
302
+ $.ajax({
303
+ url: "filter",
304
+ type: "GET",
305
+ data: "type=assessments_setup&name=" + name + "&check=" + value,
306
+ success: function (data){
307
+ let hide_type = "[data-field='"+name+"']"
308
+ if (data.hidden === 1){
309
+ $(hide_type).addClass('layui-hide');
310
+ }else if (data.hidden === 0){
311
+ $(hide_type).removeClass('layui-hide');
312
+ }
313
+ //(因为触发筛选器出现的checkbox是根据cols的值得到 这里必须修改 cols的值 然后才会出现下次点击筛选器时 checkbox正常显示)
314
+ for (i=1;i<cols_table[0].length;i++){
315
+ if (name === cols_table[0][i].field ){
316
+ cols_table[0][i].hide = !value
317
+ obj.config.cols = cols_table
318
+ }
319
+ }
320
+ },
321
+ error: function (data){
322
+ layer.msg("操作失败")
323
+ },
324
+ dataType: 'Json'
325
+ })
326
+ });
327
+ }else if( obj.event === 'add'){
328
+ // 监听添加操作
338
329
  var content = miniPage.getHrefContent('/missions/assessments/new');
339
330
  var openWH = miniPage.getOpenWidthHeight();
340
331
  var index = layer.open({
@@ -347,28 +338,30 @@
347
338
  offset: [openWH[2] + 'px', openWH[3] + 'px'],
348
339
  content: content,
349
340
  success: function (layero, index) {
350
- // 重新加载select下拉框(绩效考核标准)
341
+ // 重新加载select下拉框(绩效考核标准)
351
342
  form.render('select')
352
- // clear上次弹层中的多选人员数据 // staffs不清楚为什么要写在单独的script下才有效
353
- staffs.setValue([ ])
343
+ // clear上次弹层中的多选人员数据 // staffs不清楚为什么要写在单独的script下才有效
344
+ staffs.setValue([])
354
345
 
355
346
  }
356
347
  });
357
- // 这样写无法实现 要写在success中记住(open弹出层) 294
358
- // document.getElementById('clear_staffs').onclick = function() {
359
- // console.log("delete")
360
- // staffs.setValue([ {name:'', value:''} ])
361
- // // console.log(staffs)
362
- // // alert(staffs.setValue([ {name:'', value:''} ]))
363
- // // staffs.setValue([ ])
364
- // // alert(staffs.setValue([ ]))
365
- // clear(staffs)
366
- // console.log("ok")
367
- // };
368
- $(window).on("resize", function () {
369
- layer.full(index);
370
- });
371
- }
348
+ // 这样写无法实现 要写在success中记住(open弹出层) 294
349
+ // document.getElementById('clear_staffs').onclick = function() {
350
+ // console.log("delete")
351
+ // staffs.setValue([ {name:'', value:''} ])
352
+ // // console.log(staffs)
353
+ // // alert(staffs.setValue([ {name:'', value:''} ]))
354
+ // // staffs.setValue([ ])
355
+ // // alert(staffs.setValue([ ]))
356
+ // clear(staffs)
357
+ // console.log("ok")
358
+ // };
359
+
360
+ // 目前不清除有什么用
361
+ // $(window).on("resize", function () {
362
+ // layer.full(index);
363
+ // });
364
+ }
372
365
  });
373
366
 
374
367
 
@@ -70,6 +70,12 @@
70
70
  <input type="text" class="layui-input required" id="service_time" name="service_time" placeholder=" - " autocomplete="off" value="<%= (@follow_up.service_start_time.present? && @follow_up.service_end_time.present?) ? (@follow_up.service_start_time.to_s + ' - ' + @follow_up.service_end_time.to_s) : '' %>">
71
71
  </div>
72
72
  </div>
73
+ <div class="layui-inline deployment_type layui-hide">
74
+ <label class="layui-form-label required">部署类型</label>
75
+ <div class="layui-input-inline">
76
+ <%= select_tag "o_business_deployment", options_for_select(@deployment_type, @follow_up&.o_business_deployment), class: 'required' %>
77
+ </div>
78
+ </div>
73
79
  <br class="service_show layui-hide">
74
80
  <div class="layui-inline">
75
81
  <label class="layui-form-label">总额(万)</label>
@@ -168,6 +174,7 @@
168
174
  <%=@follow_up&.clazz_id == EducodeSales::Common.where(extras: EducodeSales::Common::OTYPE).first&.id %>
169
175
  if (flag) {
170
176
  $(".service_show").removeClass('layui-hide')
177
+ $(".deployment_type").removeClass('layui-hide')
171
178
  }
172
179
 
173
180
  form.on('select(clazz_id)', function (data) {
@@ -175,8 +182,10 @@
175
182
  const value = data.value;
176
183
  if (value == <%= EducodeSales::Common.where(extras: EducodeSales::Common::OTYPE).first&.id %>) {
177
184
  $(".service_show").removeClass('layui-hide')
185
+ $(".deployment_type").removeClass('layui-hide')
178
186
  } else {
179
187
  console.log(data.value)
188
+ $(".deployment_type").addClass('layui-hide')
180
189
  $(".service_show").addClass('layui-hide')
181
190
  }
182
191
  })
@@ -276,6 +285,10 @@
276
285
  layer.msg('请选择服务期', {time: 2000, icon: 2, shade: 0.01});
277
286
  return false;
278
287
  }
288
+ if (data.field.o_business_deployment === ''){
289
+ layer.msg('请选择部署类型');
290
+ return false // 退出添加该条记录
291
+ }
279
292
  }
280
293
  var assign_follow = [];
281
294
  sales_list.getValue().forEach(function (d) {