educode_sales 0.7.2 → 0.7.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.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/educode_sales/assessment.png +0 -0
  3. data/app/assets/images/educode_sales/indexlogo.png +0 -0
  4. data/app/controllers/educode_sales/assessments_controller.rb +490 -0
  5. data/app/controllers/educode_sales/businesses_controller.rb +13 -4
  6. data/app/controllers/educode_sales/customers_controller.rb +3 -0
  7. data/app/controllers/educode_sales/follow_ups_controller.rb +13 -1
  8. data/app/controllers/educode_sales/home_controller.rb +4 -3
  9. data/app/controllers/educode_sales/money_plans_controller.rb +2 -0
  10. data/app/controllers/educode_sales/plans_controller.rb +1 -0
  11. data/app/controllers/educode_sales/results_controller.rb +54 -0
  12. data/app/controllers/educode_sales/roles_controller.rb +4 -1
  13. data/app/controllers/educode_sales/sessions_controller.rb +2 -1
  14. data/app/helpers/educode_sales/application_helper.rb +61 -0
  15. data/app/helpers/educode_sales/assessments_help.rb +52 -0
  16. data/app/models/educode_sales/assessments_setting.rb +28 -0
  17. data/app/models/educode_sales/business.rb +2 -1
  18. data/app/models/educode_sales/follow_up.rb +1 -1
  19. data/app/models/educode_sales/money_plan.rb +1 -0
  20. data/app/models/educode_sales/permission.rb +2 -1
  21. data/app/models/educode_sales/result.rb +4 -0
  22. data/app/models/educode_sales/role_area.rb +2 -1
  23. data/app/views/educode_sales/assessments/_progress.html.erb +433 -0
  24. data/app/views/educode_sales/assessments/_setup.html.erb +331 -0
  25. data/app/views/educode_sales/assessments/edit.html.erb +238 -0
  26. data/app/views/educode_sales/assessments/get_export_data.json.jbuilder +197 -0
  27. data/app/views/educode_sales/assessments/index.html.erb +63 -0
  28. data/app/views/educode_sales/assessments/index.json.jbuilder +26 -0
  29. data/app/views/educode_sales/assessments/new.html.erb +310 -0
  30. data/app/views/educode_sales/assessments/progress.json.jbuilder +372 -0
  31. data/app/views/educode_sales/businesses/edit_follow_record.html.erb +150 -114
  32. data/app/views/educode_sales/businesses/get_export_data.json.jbuilder +1 -0
  33. data/app/views/educode_sales/businesses/index.html.erb +25 -19
  34. data/app/views/educode_sales/businesses/index.json.jbuilder +1 -0
  35. data/app/views/educode_sales/businesses/new_follow_record.html.erb +163 -126
  36. data/app/views/educode_sales/businesses/show_follow.html.erb +25 -20
  37. data/app/views/educode_sales/businesses/show_follow.json.jbuilder +1 -0
  38. data/app/views/educode_sales/businesses/show_follow_record.html.erb +8 -1
  39. data/app/views/educode_sales/places/index.html.erb +5 -3
  40. data/app/views/educode_sales/plans/_monthPlan.html.erb +3 -1
  41. data/app/views/educode_sales/plans/new_month.html.erb +2 -0
  42. data/app/views/educode_sales/plans/new_week.html.erb +5 -1
  43. data/app/views/educode_sales/results/edit.html.erb +111 -0
  44. data/app/views/educode_sales/results/index.html.erb +0 -0
  45. data/app/views/educode_sales/results/index.json.jbuilder +13 -0
  46. data/app/views/educode_sales/results/new.html.erb +58 -0
  47. data/app/views/educode_sales/results/show.json.jbuilder +9 -0
  48. data/app/views/educode_sales/roles/edit.html.erb +26 -18
  49. data/app/views/educode_sales/sale_reports/index.json.jbuilder +1 -0
  50. data/app/views/layouts/educode_sales/application.html.erb +18 -12
  51. data/app/views/layouts/educode_sales/login.html.erb +1 -1
  52. data/config/routes.rb +18 -1
  53. data/db/migrate/20210902064109_create_educode_sales_role_permissions.rb +9 -1
  54. data/db/migrate/20220314053856_add_service_start_time_to_follow_ups.rb +6 -0
  55. data/db/migrate/20220314074354_add_service_time_long_to_follow_ups.rb +5 -0
  56. data/db/migrate/20220402020233_create_educode_sales_assessments_settings.rb +27 -0
  57. data/db/migrate/20220411021641_add_new_column_assessments_settings.rb +20 -0
  58. data/db/migrate/20220413090940_add_september_progress_to_assessment_settings.rb +5 -0
  59. data/lib/educode_sales/version.rb +1 -1
  60. metadata +31 -6
@@ -0,0 +1,433 @@
1
+ <script type="text/html" id="progress_Toolbar">
2
+ <div class="layui-btn-container">
3
+ <span class="table-label">指标完成情况</span>
4
+ <% if can?(:export_result, EducodeSales::AssessmentsSetting) %>
5
+ <button class="layui-btn layui-btn-primary layui-border-green layui-btn-sm data-count-edit export_more-btn pull-right" style="color: #0000FF;" data-name="export" data-id="export">
6
+ 导出<i class="layui-icon layui-icon-down layui-nav-more" style="font-size: 12px"></i></button>
7
+ <%end %>
8
+ </div>
9
+ </script>
10
+ <!--搜索-->
11
+ <div class="layuimini-main min-height-table" id="monthly_table_wraper">
12
+ <form class="layui-form layui-form-pane" lay-filter="assessment_progress_form">
13
+ <div class="layui-form-item">
14
+ <div class="layui-inline">
15
+ <label class="layui-form-label">考核年度</label>
16
+ <div class="layui-input-inline">
17
+ <input type="text" class="layui-input" id="assessment_year" autocomplete="off" name="assessment_year" value="2022">
18
+ </div>
19
+ </div>
20
+ <div class="layui-inline">
21
+ <label class="layui-form-label">考核指标</label>
22
+ <div class="layui-input-inline">
23
+ <select class="layui-select" name="assessment_id" >
24
+ <option value="1" selected >签单金额</option>
25
+ <option value="2">回款金额</option>
26
+ <option value="3">拜访量</option>
27
+ <option value="4">新增商机数</option>
28
+ </select>
29
+ </div>
30
+ </div>
31
+ <div class="layui-inline">
32
+ <label class="layui-form-label">人员</label>
33
+ <div class="layui-input-inline large-select">
34
+ <%= select_tag "staff_id", options_for_select(@staffs), { id: 'weekly_staff_id', include_blank: true} %>
35
+ </div>
36
+ </div>
37
+ <div class="layui-inline">
38
+ <button type="reset" class="layui-btn layui-btn-primary" lay-submit lay-filter="progress_resert_btn">重置
39
+ </button>
40
+ <button type="submit" class="layui-btn layui-btn-primary" lay-submit lay-filter="progress_search_btn">检索
41
+ </button>
42
+ </div>
43
+ </div>
44
+ </form>
45
+
46
+ <!--表格-->
47
+ <table class="layui-hide" id="progressTable" style="min-height: 600px;" lay-filter="progressTable"></table>
48
+
49
+
50
+
51
+
52
+ </div>
53
+
54
+
55
+
56
+
57
+ <script>
58
+ layui.use(['form', 'table', 'miniPage', 'element', 'rate', 'laydate', 'request'], function () {
59
+
60
+
61
+
62
+
63
+ var $ = layui.jquery,
64
+ form = layui.form,
65
+ laydate = layui.laydate,
66
+ request = layui.request,
67
+ table = layui.table,
68
+ rate = layui.rate,
69
+ miniPage = layui.miniPage;
70
+ dropdown = layui.dropdown;
71
+
72
+ laydate.render({
73
+ elem: '#assessment_year',
74
+ type: 'year'
75
+ });
76
+
77
+
78
+
79
+ var progress_table = table.render({
80
+ elem: '#progressTable'
81
+ ,url: '/missions/assessments/progress'
82
+ ,toolbar: '#progress_Toolbar'
83
+ ,totalRow:true
84
+ ,defaultToolbar: ['filter']
85
+ // ,limit: 10
86
+ ,limits: [10,15,20,30,40,50,60,70,80,90]
87
+ ,limit: 10
88
+ ,page: true
89
+ ,cols:[
90
+ [ //标题栏
91
+ { title: '序号', width: 80, rowspan: 2,type:'numbers',fixed:'left',sort: true,} //rowspan即纵向跨越的单元格数
92
+ ,{field: 'name', title: '考核人员', width: 80, rowspan: 2,fixed:'left'}
93
+ ,{align: 'center', title: '全年', colspan: 5} //colspan即横跨的单元格数,这种情况下不用设置field和width
94
+ ,{align: 'center', title: '第1季度', colspan: 5} //colspan即横跨的单元格数,这种情况下不用设置field和width
95
+ ,{align: 'center', title: '1月', colspan: 5} //colspan即横跨的单元格数,这种情况下不用设置field和width
96
+ ,{align: 'center', title: '2月', colspan: 5} //colspan即横跨的单元格数,这种情况下不用设置field和width
97
+ ,{align: 'center', title: '3月', colspan: 5} //colspan即横跨的单元格数,这种情况下不用设置field和width
98
+ ,{align: 'center', title: '第2季度', colspan: 5} //colspan即横跨的单元格数,这种情况下不用设置field和width
99
+ ,{align: 'center', title: '4月', colspan: 5} //colspan即横跨的单元格数,这种情况下不用设置field和width
100
+ ,{align: 'center', title: '5月', colspan: 5} //colspan即横跨的单元格数,这种情况下不用设置field和width
101
+ ,{align: 'center', title: '6月', colspan: 5} //colspan即横跨的单元格数,这种情况下不用设置field和width
102
+ ,{align: 'center', title: '第3季度', colspan: 5} //colspan即横跨的单元格数,这种情况下不用设置field和width
103
+ ,{align: 'center', title: '7月', colspan: 5} //colspan即横跨的单元格数,这种情况下不用设置field和width
104
+ ,{align: 'center', title: '8月', colspan: 5} //colspan即横跨的单元格数,这种情况下不用设置field和width
105
+ ,{align: 'center', title: '9月', colspan: 5} //colspan即横跨的单元格数,这种情况下不用设置field和width
106
+ ,{align: 'center', title: '第4季度', colspan: 5} //colspan即横跨的单元格数,这种情况下不用设置field和width
107
+ ,{align: 'center', title: '10月', colspan: 5} //colspan即横跨的单元格数,这种情况下不用设置field和width
108
+ ,{align: 'center', title: '11月', colspan: 5} //colspan即横跨的单元格数,这种情况下不用设置field和width
109
+ ,{align: 'center', title: '12月', colspan: 5} //colspan即横跨的单元格数,这种情况下不用设置field和width
110
+ ],
111
+ [
112
+ {field: 'annual', title: '目标', width: 80}
113
+ ,{field: 'annual_progress', title: '完成', width: 80}
114
+ ,{field: 'annual_dif', title: '差额', width: 80}
115
+ ,{field: 'annual_rate', title: '完成率', width:80}
116
+ ,{field: 'annual_score', title: '得分', width: 80}
117
+ ,{field: 'first_quarter', title: '目标', width: 80}
118
+ ,{field: 'first_quarter_progress', title: '完成', width: 80}
119
+ ,{field: 'first_quarter_dif', title: '差额', width: 80}
120
+ ,{field: 'first_quarter_rate', title: '完成率', width:80}
121
+ ,{field: 'first_quarter_score', title: '得分', width: 80}
122
+ ,{field: 'january', title: '目标', width: 80}
123
+ ,{field: 'january_progress', title: '完成', width: 80}
124
+ ,{field: 'january_dif', title: '差额', width: 80}
125
+ ,{field: 'january_rate', title: '完成率', width:80}
126
+ ,{field: 'january_score', title: '得分', width: 80}
127
+ ,{field: 'february', title: '目标', width: 80}
128
+ ,{field: 'february_progress', title: '完成', width: 80}
129
+ ,{field: 'february_dif', title: '差额', width: 80}
130
+ ,{field: 'february_rate', title: '完成率', width:80}
131
+ ,{field: 'february_score', title: '得分', width: 80}
132
+ ,{field: 'march', title: '目标', width: 80}
133
+ ,{field: 'march_progress', title: '完成', width: 80}
134
+ ,{field: 'march_dif', title: '差额', width: 80}
135
+ ,{field: 'march_rate', title: '完成率', width:80}
136
+ ,{field: 'march_score', title: '得分', width: 80}
137
+ ,{field: 'second_quarter', title: '目标', width: 80}
138
+ ,{field: 'second_quarter_progress', title: '完成', width: 80}
139
+ ,{field: 'second_quarter_dif', title: '差额', width: 80}
140
+ ,{field: 'second_quarter_rate', title: '完成率', width:80}
141
+ ,{field: 'second_quarter_score', title: '得分', width: 80}
142
+ ,{field: 'april', title: '目标', width: 80}
143
+ ,{field: 'april_progress', title: '完成', width: 80}
144
+ ,{field: 'april_dif', title: '差额', width: 80}
145
+ ,{field: 'april_rate', title: '完成率', width:80}
146
+ ,{field: 'april_score', title: '得分', width: 80}
147
+ ,{field: 'may', title: '目标', width: 80}
148
+ ,{field: 'may_progress', title: '完成', width: 80}
149
+ ,{field: 'may_dif', title: '差额', width: 80}
150
+ ,{field: 'may_rate', title: '完成率', width:80}
151
+ ,{field: 'may_score', title: '得分', width: 80}
152
+ ,{field: 'june', title: '目标', width: 80}
153
+ ,{field: 'june_progress', title: '完成', width: 80}
154
+ ,{field: 'june_dif', title: '差额', width: 80}
155
+ ,{field: 'june_rate', title: '完成率', width:80}
156
+ ,{field: 'june_score', title: '得分', width: 80}
157
+ ,{field: 'third_quarter', title: '目标', width: 80}
158
+ ,{field: 'third_quarter_progress', title: '完成', width: 80}
159
+ ,{field: 'third_quarter_dif', title: '差额', width: 80}
160
+ ,{field: 'third_quarter_rate', title: '完成率', width:80}
161
+ ,{field: 'third_quarter_score', title: '得分', width: 80}
162
+ ,{field: 'july', title: '目标', width: 80}
163
+ ,{field: 'july_progress', title: '完成', width: 80}
164
+ ,{field: 'july_dif', title: '差额', width: 80}
165
+ ,{field: 'july_rate', title: '完成率', width:80}
166
+ ,{field: 'july_score', title: '得分', width: 80}
167
+ ,{field: 'august', title: '目标', width: 80}
168
+ ,{field: 'august_progress', title: '完成', width: 80}
169
+ ,{field: 'august_dif', title: '差额', width: 80}
170
+ ,{field: 'august_rate', title: '完成率', width:80}
171
+ ,{field: 'august_score', title: '得分', width: 80}
172
+ ,{field: 'september', title: '目标', width: 80}
173
+ ,{field: 'september_progress', title: '完成', width: 80}
174
+ ,{field: 'september_dif', title: '差额', width: 80}
175
+ ,{field: 'september_rate', title: '完成率', width:80}
176
+ ,{field: 'september_score', title: '得分', width: 80}
177
+ ,{field: 'fourth_quarter', title: '目标', width: 80}
178
+ ,{field: 'fourth_quarter_progress', title: '完成', width: 80}
179
+ ,{field: 'fourth_quarter_dif', title: '差额', width: 80}
180
+ ,{field: 'fourth_quarter_rate', title: '完成率', width:80}
181
+ ,{field: 'fourth_quarter_score', title: '得分', width: 80}
182
+ ,{field: 'october', title: '目标', width: 80}
183
+ ,{field: 'october_progress', title: '完成', width: 80}
184
+ ,{field: 'october_dif', title: '差额', width: 80}
185
+ ,{field: 'october_rate', title: '完成率', width:80}
186
+ ,{field: 'october_score', title: '得分', width: 80}
187
+ ,{field: 'november', title: '目标', width: 80}
188
+ ,{field: 'november_progress', title: '完成', width: 80}
189
+ ,{field: 'november_dif', title: '差额', width: 80}
190
+ ,{field: 'november_rate', title: '完成率', width:80}
191
+ ,{field: 'november_score', title: '得分', width: 80}
192
+ ,{field: 'december', title: '目标', width: 80}
193
+ ,{field: 'december_progress', title: '完成', width: 80}
194
+ ,{field: 'december_dif', title: '差额', width: 80}
195
+ ,{field: 'december_rate', title: '完成率', width:80}
196
+ ,{field: 'december_score', title: '得分', width: 80}
197
+ ]]
198
+ ,parseData: function(res){ //将原始数据解析成 table 组件所规定的数据,res为从url中get到的数据
199
+ var result;
200
+ if(this.page.curr){
201
+ result = res.data.slice(this.limit*(this.page.curr-1),this.limit*this.page.curr);
202
+ }
203
+ else{
204
+ result=res.data.slice(0,this.limit);
205
+ }
206
+ var length =0;
207
+ for (var ever in res.data){
208
+ length++
209
+ }
210
+ return {
211
+ "code": 0, //解析接口状态
212
+ "msg": res.msg, //解析提示文本
213
+ "count": length, //解析数据长度
214
+ "data": result //解析数据列表
215
+ };
216
+ }
217
+ ,done: function (res) {
218
+ export_drowpdwonRender()
219
+ }
220
+ });
221
+
222
+ // 这个注意一下 直接html请求的后端中直接拿取gon.export_menus数据
223
+ // 使用dropdown模块
224
+ var export_dropmenu = gon.export_menus;
225
+ export_drowpdwonRender = function() {
226
+ dropdown.render({
227
+ elem: '.export_more-btn',
228
+ data: export_dropmenu,
229
+ click: function(data, othis){
230
+ var elem = $(this.elem);
231
+ id = elem.data('id');
232
+ switch (data.event) {
233
+ case 'export_csv':
234
+ export_csv();
235
+ break;
236
+ case 'export_excel':
237
+ export_excel();
238
+ break;
239
+
240
+ }
241
+ }
242
+ });
243
+ }
244
+
245
+ function export_csv() {
246
+ var data = form.val("assessment_progress_form");
247
+ request.authPost("/missions/assessments/get_export_data", {
248
+ // 这个请求注意一下 除了会发送自定义的数据 还会发送一些数据(在自定义数据外面增加一个hash)--注意有意思
249
+ assessment_year: data.assessment_year,
250
+ assessment_id: data.assessment_id,
251
+ staff_id: data.staff_id,
252
+ // select: data.select, //有点东西
253
+ }, function (res) {
254
+ data = res.data
255
+ table.exportFile(progress_table.config.id,data, 'csv');
256
+ layer.closeAll('loading');
257
+ })
258
+
259
+ }
260
+ function export_excel() {
261
+ var data = form.val("assessment_progress_form");
262
+ request.authPost("/missions/businesses/get_export_data", {
263
+ assessment_year: data.assessment_year,
264
+ assessment_id: data.assessment_id,
265
+ staff_id: data.staff_id,
266
+ }, function (res) {
267
+ data = res.data
268
+ table.exportFile(progress_table.config.id,data, 'xls');
269
+ layer.closeAll('loading');
270
+ })
271
+
272
+ }
273
+
274
+
275
+
276
+ var sort = {},
277
+ search = {};
278
+ table.on('sort(progressTable)', function (obj) {
279
+ sort.field = obj.field;
280
+ sort.order = obj.type;
281
+ table.reload('progressTable', {
282
+ initSort: obj,
283
+ where: {
284
+ sort: sort,
285
+ q: search
286
+ }
287
+ });
288
+ })
289
+
290
+ // 监听搜索操作
291
+ form.on('submit(progress_search_btn)', function (data) {
292
+ search = data.field
293
+ table.reload('progressTable', {
294
+ page: {
295
+ curr: 1
296
+ },
297
+ where: {
298
+ q: search,
299
+ sort: sort
300
+ }
301
+ }, 'data');
302
+
303
+ return false;
304
+ });
305
+
306
+ form.on('submit(progress_resert_btn)', function (data) {
307
+ var field = data.field;
308
+ console.log("--------------------")
309
+ console.log(gon.export_menus)
310
+ form.val('assessment_progress_form', {
311
+ staff_id: '',
312
+ assessment_year: '2022',
313
+ assessment_id: '签单金额',
314
+ })
315
+ return false;
316
+ });
317
+
318
+
319
+
320
+
321
+
322
+
323
+
324
+
325
+
326
+
327
+
328
+
329
+
330
+
331
+
332
+
333
+
334
+
335
+
336
+
337
+
338
+ /**
339
+ * toolbar事件监听
340
+ */
341
+ // table.on('toolbar(progressTable)', function (obj) {
342
+ // if (obj.event === 'add') { // 监听添加操作
343
+ // var content = miniPage.getHrefContent('/missions/plans/new_monthly');
344
+ // var openWH = miniPage.getOpenWidthHeight();
345
+ // sindex = layer.open({
346
+ // title: '添加月报',
347
+ // type: 1,
348
+ // shade: 0.2,
349
+ // maxmin: true,
350
+ // shadeClose: true,
351
+ // area: [openWH[0] + 'px', openWH[1] + 'px'],
352
+ // offset: [openWH[2] + 'px', openWH[3] + 'px'],
353
+ // content: content,
354
+ // success: function (layero, index) {
355
+ // // 重新渲染弹层中的下拉选择框select
356
+ // form.render('select');
357
+ // }
358
+ // });
359
+ // $(window).on("resize", function () {
360
+ // layer.full(sindex);
361
+ // });
362
+ // }
363
+ // });
364
+
365
+ // table.on('tool(progressTable)', function (obj) {
366
+ // var data = obj.data;
367
+ // if (obj.event === 'edit') {
368
+ // var content = miniPage.getHrefContent('/missions/sale_reports/' + data.id + "/edit");
369
+ // var openWH = miniPage.getOpenWidthHeight();
370
+ // from_edit_monthly = true
371
+ // sindex = layer.open({
372
+ // title: '编辑月报',
373
+ // type: 1,
374
+ // shade: 0.2,
375
+ // maxmin: true,
376
+ // shadeClose: true,
377
+ // area: [openWH[0] + 'px', openWH[1] + 'px'],
378
+ // offset: [openWH[2] + 'px', openWH[3] + 'px'],
379
+ // content: content,
380
+ // });
381
+ // $(window).on("resize", function () {
382
+ // layer.full(sindex);
383
+ // });
384
+ // return false;
385
+ // } else if (obj.event === 'delete') {
386
+ // layer.confirm('确定删除ID为' + data.id + " 的月报", function (index) {
387
+ // request.delete('missions/sale_reports/' + data.id, {}, function (res) {
388
+ // layer.close(index);
389
+ // table.reload("progressTable")
390
+ // })
391
+ // });
392
+ // } else if (obj.event === 'show') {
393
+ // content = miniPage.getHrefContent('/missions/sale_reports/' + data.id);
394
+ // openWH = miniPage.getOpenWidthHeight();
395
+ // index = layer.open({
396
+ // title: '查看月报',
397
+ // type: 1,
398
+ // shade: 0.2,
399
+ // maxmin: true,
400
+ // shadeClose: true,
401
+ // area: [openWH[0] + 'px', openWH[1] + 'px'],
402
+ // offset: [openWH[2] + 'px', openWH[3] + 'px'],
403
+ // content: content,
404
+ // });
405
+ // $(window).on("resize", function () {
406
+ // layer.full(index);
407
+ // });
408
+ // return false;
409
+ // } else if (obj.event === 'audit') {
410
+ // content = miniPage.getHrefContent('/missions/sale_reports/' + data.id + "/audit");
411
+ // openWH = miniPage.getOpenWidthHeight();
412
+ // from_source = 'monthly';
413
+ // report_id = data.id;
414
+ // sindex = layer.open({
415
+ // title: '审查'+ data.staff +'的月报',
416
+ // type: 1,
417
+ // shade: 0.2,
418
+ // maxmin: true,
419
+ // shadeClose: true,
420
+ // area: [openWH[0] + 'px', openWH[1] + 'px'],
421
+ // offset: [openWH[2] + 'px', openWH[3] + 'px'],
422
+ // content: content,
423
+ // });
424
+ // $(window).on("resize", function () {
425
+ // layer.full(sindex);
426
+ // });
427
+ // return false;
428
+ // }
429
+ // });
430
+
431
+ });
432
+ </script>
433
+