educode_sales 0.1.1 → 0.1.2

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 (67) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/educode_sales/follow_ups_controller.rb +8 -8
  3. data/app/controllers/educode_sales/operation_plans_controller.rb +7 -7
  4. data/app/controllers/educode_sales/plans_controller.rb +8 -8
  5. data/app/controllers/educode_sales/sale_reports_controller.rb +3 -3
  6. data/app/controllers/educode_sales/sessions_controller.rb +1 -1
  7. data/app/controllers/educode_sales/teacher_follows_controller.rb +140 -0
  8. data/app/controllers/educode_sales/teachers_controller.rb +95 -5
  9. data/app/models/ability.rb +0 -4
  10. data/app/models/educode_sales/activity.rb +2 -1
  11. data/app/models/educode_sales/business.rb +0 -1
  12. data/app/models/educode_sales/course_subject.rb +1 -1
  13. data/app/models/educode_sales/staff.rb +3 -3
  14. data/app/models/educode_sales/teacher.rb +20 -1
  15. data/app/views/educode_sales/activities/edit.html.erb +4 -4
  16. data/app/views/educode_sales/activities/index.html.erb +6 -0
  17. data/app/views/educode_sales/activities/index.json.jbuilder +1 -1
  18. data/app/views/educode_sales/activities/new.html.erb +4 -3
  19. data/app/views/educode_sales/businesses/edit_plan.html.erb +3 -2
  20. data/app/views/educode_sales/businesses/index.json.jbuilder +1 -1
  21. data/app/views/educode_sales/businesses/new.html.erb +1 -1
  22. data/app/views/educode_sales/businesses/show_follow_record.html.erb +1 -1
  23. data/app/views/educode_sales/home/search_users.json.jbuilder +1 -1
  24. data/app/views/educode_sales/operation_plans/_monthPlan.html.erb +17 -8
  25. data/app/views/educode_sales/operation_plans/_monthly.html.erb +13 -5
  26. data/app/views/educode_sales/operation_plans/_weekPlan.html.erb +30 -21
  27. data/app/views/educode_sales/operation_plans/_weekly.html.erb +12 -4
  28. data/app/views/educode_sales/operation_plans/edit_month.html.erb +8 -1
  29. data/app/views/educode_sales/operation_plans/edit_monthly.html.erb +1 -1
  30. data/app/views/educode_sales/operation_plans/edit_week.html.erb +12 -3
  31. data/app/views/educode_sales/operation_plans/edit_weekly.html.erb +1 -1
  32. data/app/views/educode_sales/operation_plans/index.json.jbuilder +2 -2
  33. data/app/views/educode_sales/operation_plans/my_month.json.jbuilder +1 -1
  34. data/app/views/educode_sales/operation_plans/my_week.json.jbuilder +2 -2
  35. data/app/views/educode_sales/operation_plans/new_month.html.erb +7 -1
  36. data/app/views/educode_sales/operation_plans/new_monthly.html.erb +1 -1
  37. data/app/views/educode_sales/operation_plans/new_week.html.erb +8 -2
  38. data/app/views/educode_sales/operation_reports/audit.html.erb +9 -9
  39. data/app/views/educode_sales/operation_reports/edit.html.erb +14 -17
  40. data/app/views/educode_sales/operation_reports/plans.json.jbuilder +1 -1
  41. data/app/views/educode_sales/plans/edit_week.html.erb +8 -2
  42. data/app/views/educode_sales/plans/index.json.jbuilder +1 -1
  43. data/app/views/educode_sales/plans/my_week.json.jbuilder +1 -1
  44. data/app/views/educode_sales/plans/new_month.html.erb +7 -3
  45. data/app/views/educode_sales/plans/new_week.html.erb +8 -2
  46. data/app/views/educode_sales/sales/index.html.erb +2 -1
  47. data/app/views/educode_sales/sales/operations.html.erb +5 -2
  48. data/app/views/educode_sales/sessions/login.html.erb +1 -1
  49. data/app/views/educode_sales/staffs/edit.html.erb +1 -2
  50. data/app/views/educode_sales/staffs/index.html.erb +4 -4
  51. data/app/views/educode_sales/staffs/new.html.erb +1 -1
  52. data/app/views/educode_sales/teachers/add_courses.html.erb +100 -19
  53. data/app/views/educode_sales/teachers/course_subject.json.jbuilder +10 -0
  54. data/app/views/educode_sales/teachers/edit.html.erb +54 -18
  55. data/app/views/educode_sales/teachers/edit_follow_record.html.erb +49 -30
  56. data/app/views/educode_sales/teachers/index.html.erb +15 -4
  57. data/app/views/educode_sales/teachers/index.json.jbuilder +1 -0
  58. data/app/views/educode_sales/teachers/new.html.erb +8 -6
  59. data/app/views/educode_sales/teachers/new_follow_record.html.erb +52 -29
  60. data/app/views/educode_sales/teachers/show_follow.html.erb +150 -170
  61. data/app/views/educode_sales/teachers/show_follow.json.jbuilder +20 -0
  62. data/app/views/educode_sales/teachers/show_follow_record.html.erb +11 -42
  63. data/app/views/educode_sales/teachers/unfinish_plans.json.jbuilder +14 -0
  64. data/config/routes.rb +10 -0
  65. data/db/migrate/20210915061738_add_students_count_teacher_follow_ups.rb +9 -0
  66. data/lib/educode_sales/version.rb +1 -1
  67. metadata +6 -2
@@ -63,7 +63,9 @@
63
63
  <script type="text/html" id="toolbarDemo">
64
64
  <div class="layui-btn-container">
65
65
  <span class="table-label">教师列表</span>
66
+ <% if can? :create, EducodeSales::Teacher %>
66
67
  <button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn pull-right" lay-event="add">添加</button>
68
+ <% end %>
67
69
  <!-- <button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn pull-right" lay-event="search_new"> 搜索添加 -->
68
70
  </button>
69
71
  </div>
@@ -72,16 +74,22 @@
72
74
  <table class="layui-hide" id="teachers_table" style="min-height: 300px;" lay-filter="teachers_table"></table>
73
75
  </div>
74
76
  <script type="text/html" id="currentTableBar">
77
+ <% if can? :create, EducodeSales::OperationPlan %>
75
78
  <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="addWeek">添加周计划</a>
76
79
  <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="addMonth">添加月计划</a>
80
+ <% end %>
81
+ <% if can? :update, EducodeSales::OperationPlan %>
77
82
  <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="edit">编辑</a>
83
+ <% end %>
84
+ <% if can? :destroy, EducodeSales::OperationPlan %>
78
85
  <a class="layui-btn layui-btn-xs layui-btn-danger data-count-delete" lay-event="delete">删除</a>
86
+ <% end %>
79
87
  </script>
80
88
  <script type="text/html" id="name">
81
89
  {{# if (d.login) { }}
82
90
  <a href="/users/{{d.login}}" class="layui-table-link" target="_blank">{{ d.name }}</a>
83
91
  {{# } else {}}
84
- <a href="/users/{{d.login}}" class="">{{ d.name }}</a>
92
+ <a href="javascript:;" class="">{{ d.name }}</a>
85
93
  {{# }}}
86
94
  </script>
87
95
  <script type="text/html" id="courses">
@@ -182,7 +190,7 @@
182
190
  templet: "#follow"
183
191
  },
184
192
  {
185
- field: 'actives',
193
+ field: 'teacher_used',
186
194
  width: 120,
187
195
  title: '学院渗透率',
188
196
  },
@@ -311,6 +319,7 @@
311
319
  if (obj.event === 'edit') { //编辑
312
320
  content = miniPage.getHrefContent('/educode_sales/teachers/' + id + '/edit');
313
321
  openWH = miniPage.getOpenWidthHeight();
322
+ teacher_id = id;
314
323
  sindex = layer.open({
315
324
  title: '编辑',
316
325
  type: 1,
@@ -372,7 +381,8 @@
372
381
  });
373
382
 
374
383
  } else if (obj.event === 'courses') {
375
- content = miniPage.getHrefContent('/educode_sales/teachers/add_courses');
384
+ teacher_id = data.id
385
+ content = miniPage.getHrefContent('/educode_sales/teachers/add_courses?id='+data.id);
376
386
  openWH = miniPage.getOpenWidthHeight();
377
387
  index = layer.open({
378
388
  title: '课程方向',
@@ -394,6 +404,7 @@
394
404
  } else if (obj.event === 'event') {
395
405
  content = miniPage.getHrefContent('/educode_sales/teachers/add_event');
396
406
  openWH = miniPage.getOpenWidthHeight();
407
+ teacher_id = obj.data.id;
397
408
  index = layer.open({
398
409
  title: '参与活动',
399
410
  type: 1,
@@ -433,7 +444,7 @@
433
444
  layer.full(index);
434
445
  });
435
446
  } else if (obj.event === 'follow') {
436
- content = miniPage.getHrefContent('/educode_sales/teachers/show_follow');
447
+ content = miniPage.getHrefContent('/educode_sales/teachers/show_follow?id=' + data.id);
437
448
  openWH = miniPage.getOpenWidthHeight();
438
449
  index = layer.open({
439
450
  title: '跟进记录',
@@ -17,6 +17,7 @@ json.data do
17
17
  json.actives d.actives
18
18
  json.students d.students
19
19
  json.regist_at d.regist_at ? d.regist_at.to_s(:date) : ''
20
+ json.teacher_used d.teacher_used_of_department
20
21
  end
21
22
  end
22
23
  json.code 0
@@ -17,15 +17,19 @@
17
17
  <%= select_tag "professional_title", options_for_select(['教授', '研究员', '副教授', '副研究员', '讲师', '助理研究员', '助理教授'], @person&.professional_title), { include_blank: true, "lay-verify": "required"} %>
18
18
  </div>
19
19
  </div>
20
+ </div>
21
+ <div class="layui-block">
20
22
  <div class="layui-inline">
21
- <label class="layui-form-label required" style="width: 40px;">职务</label>
22
- <div class="layui-input-block" style="margin-left: 70px;">
23
+ <label class="layui-form-label required">职务</label>
24
+ <div class="layui-input-block" style="width: 188px;">
23
25
  <input type="text" name="job" autocomplete="off" lay-verify="required" class="layui-input" placeholder="请输入职务">
24
26
  </div>
25
27
  </div>
28
+ </div>
29
+ <div class="layui-block">
26
30
  <div class="layui-inline">
27
- <label class="layui-form-label required" style="width: 40px;">来源</label>
28
- <div class="layui-input-block" style="margin-left: 70px;">
31
+ <label class="layui-form-label required">来源</label>
32
+ <div class="layui-input-block">
29
33
  <%= select_tag "source_id", options_for_select(EducodeSales::Common.where(clazz: 'teacher_source').pluck(:name, :id)), { include_blank: true, "lay-verify": "required" } %>
30
34
  </div>
31
35
  </div>
@@ -108,7 +112,6 @@
108
112
  add_teacher.on('itemInput(add_teacher)', function (obj) {
109
113
  department_id = '';
110
114
  user_id = '';
111
-
112
115
  });
113
116
 
114
117
  add_department.on('itemClear(add_department)', function() {
@@ -142,7 +145,6 @@
142
145
  data.field.user_id = user_id;
143
146
  data.field.department_id = department_id;
144
147
  data.field.activity_id = parent.activity_id;
145
- console.log(data.field)
146
148
  if (department_id == "") {
147
149
  return layer.alert("请选择单位部门")
148
150
  }
@@ -3,53 +3,33 @@
3
3
  <div class="layui-inline">
4
4
  <label class="layui-form-label">教师态度</label>
5
5
  <div class="layui-input-inline">
6
- <select name="quiz">
7
- <option value="">请选择</option>
8
- <option value="010">北京</option>
9
- <option value="021">上海</option>
10
- <option value="0571">杭州</option>
11
- </select>
6
+ <%= select_tag "attitude_id",options_for_select(EducodeSales::Common.where(clazz: "teacher_attitude").pluck(:name, :id))%>
12
7
  </div>
13
8
  </div>
14
9
  <div class="layui-inline">
15
10
  <label class="layui-form-label">开课计划</label>
16
11
  <div class="layui-input-inline">
17
- <select name="quiz">
18
- <option value="">请选择</option>
19
- <option value="010">北京</option>
20
- <option value="021">上海</option>
21
- <option value="0571">杭州</option>
22
- </select>
12
+ <%= select_tag "course_plan_id",options_for_select(EducodeSales::Common.where(clazz: "course_plan").pluck(:name, :id))%>
23
13
  </div>
24
14
  </div>
25
15
  <br>
26
16
  <div class="layui-inline">
27
17
  <label class="layui-form-label">课堂建设</label>
28
18
  <div class="layui-input-inline">
29
- <select name="quiz">
30
- <option value="">请选择</option>
31
- <option value="010">北京</option>
32
- <option value="021">上海</option>
33
- <option value="0571">杭州</option>
34
- </select>
19
+ <%= select_tag "course_build_id",options_for_select(EducodeSales::Common.where(clazz: "course_build").pluck(:name, :id))%>
35
20
  </div>
36
21
  </div>
37
22
  <div class="layui-inline">
38
23
  <label class="layui-form-label">跟进手段</label>
39
24
  <div class="layui-input-inline">
40
- <select name="quiz">
41
- <option value="">请选择</option>
42
- <option value="010">北京</option>
43
- <option value="021">上海</option>
44
- <option value="0571">杭州</option>
45
- </select>
25
+ <%= select_tag "follow_id",options_for_select(EducodeSales::Common.where(clazz: "contact").pluck(:name, :id))%>
46
26
  </div>
47
27
  </div>
48
28
  <br>
49
29
  <div class="layui-form-item layui-form-text">
50
30
  <label class="layui-form-label">跟进小结</label>
51
31
  <div class="layui-input-block">
52
- <textarea name="desc" placeholder="此处可以填写:
32
+ <textarea name="description" placeholder="此处可以填写:
53
33
  1、教师关注的痛点问题;
54
34
  2、教师关注的教学项目、教学成果类型;
55
35
  3、其他个性化需求,以及应对情况说明;
@@ -58,10 +38,53 @@
58
38
  </div>
59
39
  </div>
60
40
  <div class="layui-inline" style="padding-left: 50px">
61
- <button type="submit" class="layui-btn layui-btn-normal" lay-submit lay-filter="data-reset-btn">提交
62
- </button>
63
- <button type="submit" class="layui-btn layui-btn-primary" lay-submit lay-filter="data-search-btn">取消
41
+ <button type="submit" class="layui-btn layui-btn-normal" lay-submit lay-filter="add_follow_up">提交
64
42
  </button>
65
43
  </div>
66
44
  </div>
67
- </form>
45
+ </form>
46
+
47
+
48
+
49
+
50
+ <script>
51
+ layui.use(['form', 'table', 'upload', 'layer', 'laytpl', 'request', 'laydate'], function () {
52
+ var form = layui.form,
53
+ layer = layui.layer,
54
+ table = layui.table,
55
+ laytpl = layui.laytpl,
56
+ request = layui.request,
57
+ laydate = layui.laydate,
58
+ $ = layui.$;
59
+
60
+ // laydate.render({
61
+ // elem: '#invitation_at_add'
62
+ // })
63
+ //
64
+ // laydate.render({
65
+ // elem: '#reception_at_add'
66
+ // });
67
+
68
+ form.render();
69
+
70
+ form.on('submit(add_follow_up)', function (data) {
71
+ data.field.teacher_id = "<%= @teacher.id %>";
72
+ request.authPost("educode_sales/teacher_follows", data.field, function (res) {
73
+ if (res.success == false) {
74
+ layer.alert(res.msg)
75
+ } else {
76
+ layer.close(parent.sale_plan_index);
77
+ parent.layer.close(parent.layer.getFrameIndex(window.name))
78
+ parent.table.reload('sale_plan_follow_table')
79
+ parent.table.reload('teachers_table')
80
+ parent.table.reload('weekPlanTable1')
81
+ parent.table.reload('monthPlanTable')
82
+ }
83
+ })
84
+
85
+
86
+ return false;
87
+ });
88
+
89
+ });
90
+ </script>
@@ -1,16 +1,24 @@
1
1
  <script type="text/html" id="toolbarDemo_follow">
2
2
  <div class="layui-btn-container">
3
3
  <span class="table-label">跟进记录</span>
4
+ <% if can? :create, EducodeSales::TeacherFollow %>
4
5
  <button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn pull-right" lay-event="add"> 添加跟进记录</button>
6
+ <% end %>
5
7
  </div>
6
8
  </script>
7
9
 
8
- <table class="layui-hide" id="followTable" lay-filter="sale_plan_follow_table"></table>
10
+ <table class="layui-hide" id="sale_plan_follow_table" lay-filter="sale_plan_follow_table"></table>
9
11
 
10
12
  <script type="text/html" id="currentTableBar_follow">
13
+ <% if can? :read, EducodeSales::TeacherFollow %>
11
14
  <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="show">查看</a>
15
+ <% end %>
16
+ <% if can? :update, EducodeSales::TeacherFollow %>
12
17
  <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="edit">编辑</a>
18
+ <% end %>
19
+ <% if can? :destroy, EducodeSales::TeacherFollow %>
13
20
  <a class="layui-btn layui-btn-xs layui-btn-danger data-count-delete" lay-event="delete">删除</a>
21
+ <% end %>
14
22
  </script>
15
23
 
16
24
 
@@ -18,109 +26,94 @@
18
26
  layui.use(['form', 'table', 'miniPage', 'element'], function () {
19
27
  var $ = layui.jquery,
20
28
  form = layui.form,
21
- table = layui.table,
29
+ request =layui.request,
22
30
  miniPage = layui.miniPage;
23
31
 
24
- table.render({
25
- elem: '#followTable',
26
- // url: 'api/table.json',
27
- toolbar: '#toolbarDemo_follow',
28
- defaultToolbar: [],
29
- cols: [
30
- [
31
- {
32
- field: 'id',
33
- width: 100,
34
- title: '序号'
35
- },
36
- {
37
- field: 'time',
38
- width: 120,
39
- title: '时间',
40
- sort: true
41
- },
42
- {
43
- field: 'type',
44
- width: 120,
45
- title: '教师态度',
46
- },
47
- {
48
- field: 'step',
49
- width: 120,
50
- title: '跟进手段',
51
- // templet: '#showchance'
52
- },
53
- {
54
- field: 'key',
55
- width: 150,
56
- title: '开课计划',
57
- // templet: '#add_keys'
58
- },
59
- {
60
- field: 'upTime',
61
- width: 120,
62
- title: '课堂建设',
63
- },
64
- {
65
- field: 'downTime',
66
- width: 120,
67
- title: '当前学生',
68
- },
69
- {
70
- field: 'upmoney',
71
- width: 100,
72
- title: '课堂',
73
- },
74
- {
75
- field: 'downmoney',
76
- width: 100,
77
- title: '评测次数',
78
- },
79
- {
80
- field: 'rate',
81
- width: 100,
82
- title: '使用项目',
83
- },
84
- {
85
- field: 'backmoney',
86
- width: 100,
87
- title: '创建项目',
88
- },
89
- {
90
- field: 'plan',
91
- width: 100,
92
- title: '跟进人',
93
- // templet: '#edit_plan'
94
- },
95
- {
96
- title: '操作',
97
- minWidth: 150,
98
- toolbar: '#currentTableBar_follow',
99
- align: "center"
100
- }
101
- ]
102
- ],
103
- data: [{
104
- "id": "1",
105
- "time": "2021-07-27",
106
- "type": "A类",
107
- "step": "初步接洽",
108
- "key": "2",
109
- "upTime": "2021-07-21",
110
- "downTime": "2021-02-04",
111
- "upmoney": "100",
112
- "downmoney": "100",
113
- "rate": "100%",
114
- "backmoney": "100",
115
- "plan": "10",
116
- "follow": "丁亚莲",
117
- "ways": "康源科技有限公司",
118
- }],
119
- limits: [10, 15, 20, 25, 50, 100],
120
- limit: 15,
121
- page: true,
122
- skin: 'line'
123
- });
32
+ table = layui.table;
33
+ table.render({
34
+ elem: '#sale_plan_follow_table',
35
+ url: '/educode_sales/teachers/show_follow?id=' + parent.id ,
36
+ toolbar: '#toolbarDemo_follow',
37
+ defaultToolbar: [],
38
+ cols: [
39
+ [
40
+ {
41
+ field: 'id',
42
+ width: 100,
43
+ title: '序号'
44
+ },
45
+ {
46
+ field: 'time',
47
+ width: 120,
48
+ title: '时间',
49
+ sort: true
50
+ },
51
+ {
52
+ field: 'teacher_attitude',
53
+ width: 120,
54
+ title: '教师态度',
55
+ },
56
+ {
57
+ field: 'contact',
58
+ width: 120,
59
+ title: '跟进手段',
60
+ // templet: '#showchance'
61
+ },
62
+ {
63
+ field: 'course_plan',
64
+ width: 150,
65
+ title: '开课计划',
66
+ // templet: '#add_keys'
67
+ },
68
+ {
69
+ field: 'course_build',
70
+ width: 120,
71
+ title: '课堂建设',
72
+ },
73
+ {
74
+ field: 'students_count',
75
+ width: 120,
76
+ title: '当前学生',
77
+ },
78
+ {
79
+ field: 'courses_count',
80
+ width: 100,
81
+ title: '课堂',
82
+ },
83
+ {
84
+ field: 'evaluates_count',
85
+ width: 100,
86
+ title: '评测次数',
87
+ },
88
+ {
89
+ field: 'course_shixuns_count',
90
+ width: 100,
91
+ title: '使用项目',
92
+ },
93
+ {
94
+ field: 'shixuns_count',
95
+ width: 100,
96
+ title: '创建项目',
97
+ },
98
+ {
99
+ field: 'staff',
100
+ width: 100,
101
+ title: '跟进人',
102
+ },
103
+ {
104
+ title: '操作',
105
+ minWidth: 190,
106
+ toolbar: '#currentTableBar_follow',
107
+ align: "center",
108
+ fixed: 'right'
109
+ }
110
+ ]
111
+ ],
112
+ limits: [10, 15, 20, 25, 50, 100],
113
+ limit: 15,
114
+ page: true,
115
+ skin: 'line'
116
+ });
124
117
 
125
118
 
126
119
  /**
@@ -128,9 +121,9 @@
128
121
  */
129
122
  table.on('toolbar(sale_plan_follow_table)', function (obj) {
130
123
  if (obj.event === 'add') { // 监听添加操作
131
- var content = miniPage.getHrefContent('/educode_sales/teachers/new_follow_record');
124
+ var content = miniPage.getHrefContent('/educode_sales/teachers/new_follow_record?id=' +parent.id);
132
125
  var openWH = miniPage.getOpenWidthHeight();
133
- var index = layer.open({
126
+ sale_plan_index = layer.open({
134
127
  title: '添加',
135
128
  type: 1,
136
129
  shade: 0.2,
@@ -147,10 +140,6 @@
147
140
  $(window).on("resize", function () {
148
141
  layer.full(index);
149
142
  });
150
- } else if (obj.event === 'delete') { // 监听删除操作
151
- var checkStatus = table.checkStatus('currentTableId'),
152
- data = checkStatus.data;
153
- layer.alert(JSON.stringify(data));
154
143
  }
155
144
  });
156
145
 
@@ -158,14 +147,20 @@
158
147
  var data = obj.data;
159
148
  var id = data.id
160
149
  if (obj.event === 'delete') {
161
- layer.confirm('真的删除行么', function (index) {
162
- obj.del();
163
- layer.close(index);
150
+ layer.confirm('确定删除序号为' + data.id + "的跟进记录", function (index) {
151
+ request.authDelete("educode_sales/teacher_follows/" + data.id, {}, function() {
152
+ obj.del();
153
+ layer.close(index);
154
+ parent.table.reload('sale_plan_follow_table')
155
+ parent.table.reload('teachers_table')
156
+ parent.table.reload('weekPlanTable1')
157
+ parent.table.reload('monthPlanTable')
158
+ })
164
159
  });
165
160
  } else if (obj.event === 'show') { // 监听添加操作
166
- var content = miniPage.getHrefContent('/educode_sales/teachers/show_follow_record');
161
+ var content = miniPage.getHrefContent('/educode_sales/teachers/show_follow_record?id=' + id);
167
162
  var openWH = miniPage.getOpenWidthHeight();
168
- var index = layer.open({
163
+ sale_plan_index1 = layer.open({
169
164
  title: '查看',
170
165
  type: 1,
171
166
  shade: 0.2,
@@ -183,9 +178,9 @@
183
178
  layer.full(index);
184
179
  });
185
180
  } else if (obj.event === 'edit') {
186
- content = miniPage.getHrefContent('/educode_sales/teachers/edit_follow_record');
181
+ content = miniPage.getHrefContent('/educode_sales/teachers/edit_follow_record?id='+ obj.data.id);
187
182
  openWH = miniPage.getOpenWidthHeight();
188
- index = layer.open({
183
+ edit_index1 = layer.open({
189
184
  title: '编辑',
190
185
  type: 1,
191
186
  shade: 0.2,
@@ -255,22 +250,28 @@
255
250
 
256
251
 
257
252
  <!--未完成计划列表-->
258
- <script type="text/html" id="weekPlanToolbar">
253
+ <script type="text/html" id="unfinish_toolbar">
259
254
  <div class="layui-btn-container">
260
255
  <span class="table-label">未完成计划列表</span>
261
- <button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn pull-right" lay-event="addMonthPlan"> 添加月计划
262
- </button>
263
- <button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn pull-right" lay-event="addWeekPlan"> 添加周计划
264
- </button>
256
+ <!-- <button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn pull-right" lay-event="addMonthPlan"> 添加月计划-->
257
+ <!-- </button>-->
258
+ <!-- <button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn pull-right" lay-event="addWeekPlan"> 添加周计划-->
259
+ <!-- </button>-->
265
260
  </div>
266
261
  </script>
267
262
 
268
- <table class="layui-hide" id="weekPlanTable" lay-filter="currentTableFilter1"></table>
263
+ <table class="layui-hide" id="unfinish_table" lay-filter="unfinish_table"></table>
269
264
 
270
265
  <script type="text/html" id="currentTableBar1234">
266
+ <% if can? :read, EducodeSales::OperationPlan %>
271
267
  <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="show">查看</a>
268
+ <% end %>
269
+ <% if can? :update, EducodeSales::OperationPlan %>
272
270
  <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="edit">编辑</a>
271
+ <% end %>
272
+ <% if can? :destroy, EducodeSales::OperationPlan %>
273
273
  <a class="layui-btn layui-btn-xs layui-btn-danger data-count-delete" lay-event="delete">删除</a>
274
+ <% end %>
274
275
  </script>
275
276
 
276
277
 
@@ -279,12 +280,13 @@
279
280
  var $ = layui.jquery,
280
281
  form = layui.form,
281
282
  table = layui.table,
283
+ request = layui.request,
282
284
  miniPage = layui.miniPage;
283
285
 
284
286
  table.render({
285
- elem: '#weekPlanTable',
286
- // url: 'api/table.json',
287
- toolbar: '#weekPlanToolbar',
287
+ elem: '#unfinish_table',
288
+ url: '/educode_sales/teachers/' + parent.id + "/unfinish_plans",
289
+ toolbar: '#unfinish_toolbar',
288
290
  defaultToolbar: [],
289
291
  cols: [
290
292
  [
@@ -294,7 +296,7 @@
294
296
  title: '序号'
295
297
  },
296
298
  {
297
- field: 'username',
299
+ field: 'staff',
298
300
  width: 100,
299
301
  title: '姓名'
300
302
  },
@@ -304,46 +306,33 @@
304
306
  title: '月份',
305
307
  },
306
308
  {
307
- field: 'company',
309
+ field: 'weekly',
308
310
  width: 100,
309
311
  title: '周次'
310
312
  },
311
313
  {
312
- field: 'dep',
314
+ field: 'content',
313
315
  width: 300,
314
316
  title: '计划内容'
315
317
  },
316
318
  {
317
- field: 'week',
319
+ field: 'finish_rate',
318
320
  width: 100,
319
321
  title: '完成率',
320
322
  },
321
323
  {
322
- field: 'plan',
323
- width: 150,
324
+ field: 'updated_at',
325
+ width: 190,
324
326
  title: '更新时间',
325
327
  },
326
328
  {
327
329
  title: '操作',
328
- minWidth: 150,
330
+ minWidth: 190,
329
331
  toolbar: '#currentTableBar1234',
330
332
  align: "center"
331
333
  }
332
334
  ]
333
335
  ],
334
- data: [{
335
- "id": "1",
336
- "username": "丁亚莲",
337
- "month": "2021-08",
338
- "chance": "人工智能实验室建设",
339
- "company": "2021-33周",
340
- "dep": "对接决策人",
341
- "week": "100%",
342
- "plan": "2021-07-27",
343
- "follow": "120",
344
- "rate": "100%",
345
- "updateTime": "2021-07-27",
346
- }],
347
336
  limits: [10, 15, 20, 25, 50, 100],
348
337
  limit: 15,
349
338
  page: true,
@@ -372,7 +361,7 @@
372
361
  /**
373
362
  * toolbar事件监听
374
363
  */
375
- table.on('toolbar(currentTableFilter1)', function (obj) {
364
+ table.on('toolbar(unfinish_table)', function (obj) {
376
365
  if (obj.event === 'addWeekPlan') { // 监听添加操作
377
366
 
378
367
  var content = miniPage.getHrefContent('/educode_sales/operation_plans/new_week');
@@ -422,47 +411,42 @@
422
411
  });
423
412
 
424
413
  //监听表格复选框选择
425
- table.on('checkbox(currentTableFilter1)', function (obj) {
414
+ table.on('checkbox(unfinish_table)', function (obj) {
426
415
  console.log(obj)
427
416
  });
428
417
 
429
- table.on('tool(currentTableFilter1)', function (obj) {
418
+ table.on('tool(unfinish_table)', function (obj) {
430
419
  var data = obj.data;
431
420
  var id = data.id
432
421
  if (obj.event === 'delete') {
433
- layer.confirm('真的删除行么', function (index) {
434
- obj.del();
435
- layer.close(index);
422
+ layer.confirm('确定删除序号为' + data.id + "的计划", function (index) {
423
+ request.authDelete("educode_sales/operation_plans/" + data.id, {}, function() {
424
+ obj.del();
425
+ layer.close(index);
426
+ })
427
+
436
428
  });
437
429
  } else if (obj.event === 'show') {
438
- content = miniPage.getHrefContent('/educode_sales/operation_plans/show_week');
430
+ content = miniPage.getHrefContent('/educode_sales/operation_plans/show_week?id=' + data.id);
439
431
  openWH = miniPage.getOpenWidthHeight();
440
432
  index = layer.open({
441
- title: '查看',
433
+ title: '查看计划',
442
434
  type: 1,
443
435
  shade: 0.2,
444
436
  maxmin: true,
445
437
  shadeClose: true,
446
438
  area: [openWH[0] + 'px', openWH[1] + 'px'],
447
439
  offset: [openWH[2] + 'px', openWH[3] + 'px'],
448
- content: content,
449
- success: function (layero, index) {
450
- $("#show_chance1").val(data.chance);
451
- $("#show_plan1").val(data.plan);
452
- $("#show_rate1").val(data.rate);
453
- $("#show_week1").val(data.week);
454
- // 重新渲染弹层中的下拉选择框select
455
- form.render('select');
456
- },
440
+ content: content
457
441
  });
458
442
  $(window).on("resize", function () {
459
443
  layer.full(index);
460
444
  });
461
445
  return false;
462
446
  } else if (obj.event === 'edit') {
463
- content = miniPage.getHrefContent('/educode_sales/operation_plans/edit_week');
447
+ content = miniPage.getHrefContent('/educode_sales/operation_plans/edit_week?id=' + data.id);
464
448
  openWH = miniPage.getOpenWidthHeight();
465
- index = layer.open({
449
+ index10 = layer.open({
466
450
  title: '编辑',
467
451
  type: 1,
468
452
  shade: 0.2,
@@ -472,20 +456,16 @@
472
456
  offset: [openWH[2] + 'px', openWH[3] + 'px'],
473
457
  content: content,
474
458
  success: function (layero, index) {
475
- $("#edit_chance1").val(data.chance);
476
- $("#edit_plan1").val(data.plan);
477
- $("#edit_rate1").val(data.rate);
478
- $("#edit_week1").val(data.week);
479
459
  // 重新渲染弹层中的下拉选择框select
480
460
  form.render('select');
481
461
  },
482
462
  });
483
463
  $(window).on("resize", function () {
484
- layer.full(index);
464
+ layer.full(sindex);
485
465
  });
486
466
  return false;
487
- } else if (obj.event === 'show_follow') {
488
- content = miniPage.getHrefContent('/educode_sales/businesses/show_follow');
467
+ } else if (obj.event === 'show_follow') {
468
+ content = miniPage.getHrefContent('/educode_sales/teachers/show_follow');
489
469
  openWH = miniPage.getOpenWidthHeight();
490
470
  index = layer.open({
491
471
  title: 'xxxx/跟进记录',