educode_sales 0.1.0 → 0.1.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.
Files changed (107) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/stylesheets/educode_sales/app.css +2 -1
  3. data/app/controllers/educode_sales/activities_controller.rb +7 -1
  4. data/app/controllers/educode_sales/application_controller.rb +0 -1
  5. data/app/controllers/educode_sales/businesses_controller.rb +16 -9
  6. data/app/controllers/educode_sales/follow_ups_controller.rb +12 -8
  7. data/app/controllers/educode_sales/operation_plans_controller.rb +155 -0
  8. data/app/controllers/educode_sales/operation_reports_controller.rb +125 -0
  9. data/app/controllers/educode_sales/places_controller.rb +3 -4
  10. data/app/controllers/educode_sales/plans_controller.rb +12 -10
  11. data/app/controllers/educode_sales/roles_controller.rb +11 -0
  12. data/app/controllers/educode_sales/sale_reports_controller.rb +5 -4
  13. data/app/controllers/educode_sales/sales_controller.rb +4 -1
  14. data/app/controllers/educode_sales/sessions_controller.rb +2 -1
  15. data/app/controllers/educode_sales/teacher_follows_controller.rb +146 -0
  16. data/app/controllers/educode_sales/teachers_controller.rb +113 -11
  17. data/app/models/ability.rb +0 -1
  18. data/app/models/educode_sales/activity.rb +2 -1
  19. data/app/models/educode_sales/business.rb +0 -1
  20. data/app/models/educode_sales/common.rb +1 -0
  21. data/app/models/educode_sales/course_subject.rb +1 -1
  22. data/app/models/educode_sales/money_plan.rb +3 -3
  23. data/app/models/educode_sales/operation_plan.rb +2 -0
  24. data/app/models/educode_sales/place.rb +1 -0
  25. data/app/models/educode_sales/sale_plan.rb +2 -0
  26. data/app/models/educode_sales/staff.rb +5 -3
  27. data/app/models/educode_sales/teacher.rb +20 -1
  28. data/app/views/educode_sales/activities/edit.html.erb +4 -4
  29. data/app/views/educode_sales/activities/index.html.erb +23 -8
  30. data/app/views/educode_sales/activities/index.json.jbuilder +1 -1
  31. data/app/views/educode_sales/activities/new.html.erb +4 -3
  32. data/app/views/educode_sales/businesses/edit_follow_record.html.erb +2 -2
  33. data/app/views/educode_sales/businesses/edit_plan.html.erb +12 -7
  34. data/app/views/educode_sales/businesses/index.html.erb +137 -141
  35. data/app/views/educode_sales/businesses/index.json.jbuilder +2 -1
  36. data/app/views/educode_sales/businesses/new.html.erb +1 -1
  37. data/app/views/educode_sales/businesses/show_follow.html.erb +18 -3
  38. data/app/views/educode_sales/businesses/show_follow_record.html.erb +1 -1
  39. data/app/views/educode_sales/home/search_users.json.jbuilder +1 -1
  40. data/app/views/educode_sales/operation_plans/_monthPlan.html.erb +82 -88
  41. data/app/views/educode_sales/operation_plans/_monthly.html.erb +126 -97
  42. data/app/views/educode_sales/operation_plans/_weekPlan.html.erb +103 -90
  43. data/app/views/educode_sales/operation_plans/_weekly.html.erb +116 -87
  44. data/app/views/educode_sales/operation_plans/edit_month.html.erb +44 -32
  45. data/app/views/educode_sales/operation_plans/edit_monthly.html.erb +1 -1
  46. data/app/views/educode_sales/operation_plans/edit_week.html.erb +49 -39
  47. data/app/views/educode_sales/operation_plans/edit_weekly.html.erb +1 -1
  48. data/app/views/educode_sales/operation_plans/index.html.erb +35 -5
  49. data/app/views/educode_sales/operation_plans/index.json.jbuilder +19 -0
  50. data/app/views/educode_sales/operation_plans/my_month.json.jbuilder +18 -0
  51. data/app/views/educode_sales/operation_plans/my_week.json.jbuilder +19 -0
  52. data/app/views/educode_sales/operation_plans/new_month.html.erb +13 -10
  53. data/app/views/educode_sales/operation_plans/new_monthly.html.erb +162 -72
  54. data/app/views/educode_sales/operation_plans/new_week.html.erb +14 -7
  55. data/app/views/educode_sales/operation_plans/new_weekly.html.erb +205 -120
  56. data/app/views/educode_sales/operation_plans/show_month.html.erb +4 -10
  57. data/app/views/educode_sales/operation_plans/show_week.html.erb +20 -25
  58. data/app/views/educode_sales/operation_plans/show_weekly.html.erb +6 -6
  59. data/app/views/educode_sales/operation_reports/audit.html.erb +214 -0
  60. data/app/views/educode_sales/operation_reports/edit.html.erb +234 -0
  61. data/app/views/educode_sales/operation_reports/index.json.jbuilder +18 -0
  62. data/app/views/educode_sales/operation_reports/plans.json.jbuilder +19 -0
  63. data/app/views/educode_sales/operation_reports/show.html.erb +139 -0
  64. data/app/views/educode_sales/operations/trends.html.erb +8 -0
  65. data/app/views/educode_sales/places/index.html.erb +6 -0
  66. data/app/views/educode_sales/places/index.json.jbuilder +1 -1
  67. data/app/views/educode_sales/plans/_monthPlan.html.erb +9 -1
  68. data/app/views/educode_sales/plans/_monthly.html.erb +10 -2
  69. data/app/views/educode_sales/plans/_weekPlan.html.erb +17 -5
  70. data/app/views/educode_sales/plans/_weekly.html.erb +10 -2
  71. data/app/views/educode_sales/plans/audit_weekly.html.erb +6 -0
  72. data/app/views/educode_sales/plans/edit_monthly.html.erb +8 -0
  73. data/app/views/educode_sales/plans/edit_week.html.erb +8 -2
  74. data/app/views/educode_sales/plans/edit_weekly.html.erb +8 -0
  75. data/app/views/educode_sales/plans/index.json.jbuilder +1 -1
  76. data/app/views/educode_sales/plans/my_month.json.jbuilder +1 -1
  77. data/app/views/educode_sales/plans/my_week.json.jbuilder +1 -1
  78. data/app/views/educode_sales/plans/new_month.html.erb +7 -3
  79. data/app/views/educode_sales/plans/new_monthly.html.erb +8 -0
  80. data/app/views/educode_sales/plans/new_week.html.erb +8 -2
  81. data/app/views/educode_sales/plans/new_weekly.html.erb +7 -1
  82. data/app/views/educode_sales/roles/index.html.erb +33 -2
  83. data/app/views/educode_sales/sale_reports/index.json.jbuilder +1 -1
  84. data/app/views/educode_sales/sale_trends/trends.html.erb +8 -0
  85. data/app/views/educode_sales/sales/index.html.erb +2 -1
  86. data/app/views/educode_sales/sales/operations.html.erb +5 -2
  87. data/app/views/educode_sales/sessions/login.html.erb +1 -1
  88. data/app/views/educode_sales/staffs/edit.html.erb +2 -3
  89. data/app/views/educode_sales/staffs/index.html.erb +4 -4
  90. data/app/views/educode_sales/staffs/new.html.erb +1 -1
  91. data/app/views/educode_sales/teachers/add_courses.html.erb +100 -19
  92. data/app/views/educode_sales/teachers/course_subject.json.jbuilder +10 -0
  93. data/app/views/educode_sales/teachers/edit.html.erb +54 -18
  94. data/app/views/educode_sales/teachers/edit_follow_record.html.erb +49 -30
  95. data/app/views/educode_sales/teachers/index.html.erb +20 -11
  96. data/app/views/educode_sales/teachers/index.json.jbuilder +2 -0
  97. data/app/views/educode_sales/teachers/new.html.erb +8 -6
  98. data/app/views/educode_sales/teachers/new_follow_record.html.erb +54 -29
  99. data/app/views/educode_sales/teachers/show_follow.html.erb +150 -170
  100. data/app/views/educode_sales/teachers/show_follow.json.jbuilder +20 -0
  101. data/app/views/educode_sales/teachers/show_follow_record.html.erb +11 -42
  102. data/app/views/educode_sales/teachers/unfinish_plans.json.jbuilder +14 -0
  103. data/app/views/layouts/educode_sales/application.html.erb +23 -2
  104. data/config/routes.rb +22 -4
  105. data/db/migrate/20210915061738_add_students_count_teacher_follow_ups.rb +9 -0
  106. data/lib/educode_sales/version.rb +1 -1
  107. metadata +19 -6
@@ -1,43 +1,38 @@
1
- <form class="layui-form " action="" style="padding: 18px">
1
+ <div class="layui-form form-value" style="padding: 18px">
2
2
  <div class="layui-form-item" style="padding: 25px">
3
3
  <div class="layui-inline">
4
- <label class="layui-form-label">月份</label>
5
- <div class="layui-input-block">
6
- <input type="text" name="title" lay-verify="title" autocomplete="off" disabled
7
- class="layui-input">
4
+ <label class="layui-form-label">月份:</label>
5
+ <div class="layui-input-inline">
6
+ <%= @sale_plan.month.strftime("%Y-%m") %>
8
7
  </div>
9
8
  </div>
10
- <div class="layui-inline">
11
- <label class="layui-form-label">周次</label>
12
- <div class="layui-input-block">
13
- <input type="text" name="title" lay-verify="title" autocomplete="off" disabled
14
- class="layui-input" id="show_week1">
9
+ <% if @sale_plan.weekly.present? %>
10
+ <div class="layui-inline">
11
+ <label class="layui-form-label">周次:</label>
12
+ <div class="layui-input-inline">
13
+ <%= @sale_plan.weekly %>
14
+ </div>
15
15
  </div>
16
- </div>
16
+ <% end %>
17
17
  <div class="layui-inline">
18
- <label class="layui-form-label">教师</label>
19
- <div class="layui-input-block">
20
- <input type="text" name="title" lay-verify="title" autocomplete="off" disabled
21
- class="layui-input" id="show_chance1">
18
+ <label class="layui-form-label">教师:</label>
19
+ <div class="layui-input-inline">
20
+ <%= @sale_plan.teacher.name %>
22
21
  </div>
23
22
  </div>
24
23
  <br>
25
24
  <br>
26
25
  <div class="layui-form-item layui-form-text">
27
- <label class="layui-form-label">计划内容</label>
26
+ <label class="layui-form-label">计划内容:</label>
28
27
  <div class="layui-input-block">
29
- <textarea name="desc" id="show_plan1" placeholder="简要填写具体的营销计划,例如:
30
- 1、推动xx老师用起来;
31
- 2、与xx老师介绍一下我们的方案;
32
- 3、与xx领导深度沟通一下,以获取到关键建设规划信息等等。" class="layui-textarea" disabled></textarea>
28
+ <pre><%= @sale_plan.content %></pre>
33
29
  </div>
34
30
  </div>
35
31
  <div class="layui-inline">
36
- <label class="layui-form-label">完成率</label>
37
- <div class="layui-input-block">
38
- <input type="text" name="title" lay-verify="title" autocomplete="off" disabled
39
- class="layui-input" id="show_rate1">
32
+ <label class="layui-form-label">完成率:</label>
33
+ <div class="layui-input-inline">
34
+ <%= @sale_plan.finish_rate %>%
40
35
  </div>
41
36
  </div>
42
37
  </div>
43
- </form>
38
+ </div>
@@ -8,11 +8,11 @@
8
8
  <div class="layui-form-item">
9
9
  <div class="layui-inline" style="margin:18px; font-weight: bold">
10
10
  <label>完成率:</label>
11
- <span>80%</span>
11
+ <span><%= @sale_report.finish_rate %></span>
12
12
  </div>
13
13
  <div class="layui-inline" style="margin:18px; font-weight: bold">
14
14
  <label style="margin-left: 100px">运营教师:</label>
15
- <span>5</span>
15
+ <span><%= @sale_report.client%></span>
16
16
  </div>
17
17
  </div>
18
18
  <div class="layui-form-item" style="margin-left: 18px">
@@ -22,27 +22,27 @@
22
22
  <textarea name="desc" placeholder="此处填写要点:
23
23
  1、一句话概括本周工作的主要成效和主要挫折;
24
24
  2、补充说明收获、经验;
25
- 3、补充说明需要上级解决的问题和挑战。" disabled class="layui-textarea"></textarea>
25
+ 3、补充说明需要上级解决的问题和挑战。" disabled class="layui-textarea"><%= @sale_report.content %></textarea>
26
26
  </div>
27
27
  </div>
28
28
  <div class="layui-form-item layui-form-text">
29
29
  <label class="layui-form-label">大区意见</label>
30
30
  <div class="layui-input-block">
31
- <textarea name="desc" placeholder="给出评价、提醒、建议、办法等。" disabled class="layui-textarea"></textarea>
31
+ <textarea name="desc" placeholder="给出评价、提醒、建议、办法等。" disabled class="layui-textarea"><%= @sale_report.level1_opinion %></textarea>
32
32
  </div>
33
33
  </div>
34
34
  <div id="weekStar4"></div>
35
35
  <div class="layui-form-item layui-form-text">
36
36
  <label class="layui-form-label">总监意见</label>
37
37
  <div class="layui-input-block">
38
- <textarea name="desc" placeholder="给出评价、提醒、建议、办法等。" disabled class="layui-textarea"></textarea>
38
+ <textarea name="desc" placeholder="给出评价、提醒、建议、办法等。" disabled class="layui-textarea"><%= @sale_report.level2_opinion %></textarea>
39
39
  </div>
40
40
  </div>
41
41
  <div id="weekStar5"></div>
42
42
  <div class="layui-form-item layui-form-text">
43
43
  <label class="layui-form-label">副总意见</label>
44
44
  <div class="layui-input-block">
45
- <textarea name="desc" placeholder="给出评价、提醒、建议、办法等。" disabled class="layui-textarea"></textarea>
45
+ <textarea name="desc" placeholder="给出评价、提醒、建议、办法等。" disabled class="layui-textarea"><%= @sale_report.level3_opinion %></textarea>
46
46
  </div>
47
47
  </div>
48
48
  <div id="weekStar6"></div>
@@ -0,0 +1,214 @@
1
+ <form class="layui-form layui-form-pane" action="">
2
+ <div class="layui-form-item">
3
+ <div class="layui-inline" style="margin:18px; font-weight: bold">
4
+ <label>完成率:</label>
5
+ <span><%= @sale_report.finish_rate %></span>
6
+ <%= hidden_field_tag :id, @sale_report.id, {id: 'sale_report_audito'} %>
7
+ </div>
8
+ <div class="layui-inline" style="margin:18px; font-weight: bold">
9
+ <label style="margin-left: 100px">运营教师:</label>
10
+ <span><%= @sale_report.client%></span>
11
+ </div>
12
+ </div>
13
+ <div class="layui-form-item" style="margin-left: 18px">
14
+ <div class="layui-form-item layui-form-text">
15
+ <label class="layui-form-label">个人总结</label>
16
+ <div class="layui-input-block">
17
+ <textarea name="content" placeholder="此处填写要点:
18
+ 1、一句话概括本周工作的主要成效和主要挫折;
19
+ 2、补充说明收获、经验;
20
+ 3、补充说明需要上级解决的问题和挑战。" disabled class="layui-textarea"><%= @sale_report.content %></textarea>
21
+ </div>
22
+ </div>
23
+ <div class="layui-form-item layui-form-text">
24
+ <label class="layui-form-label">大区意见</label>
25
+ <div class="layui-input-block">
26
+ <textarea name="level1_opinion" placeholder="给出评价、提醒、建议、办法等。"
27
+ class="layui-textarea"><%= @sale_report.level1_opinion %></textarea>
28
+ </div>
29
+ </div>
30
+ <div id="weekStar4"></div>
31
+ <div class="layui-form-item layui-form-text">
32
+ <label class="layui-form-label">总监意见</label>
33
+ <div class="layui-input-block">
34
+ <textarea name="level2_opinion" placeholder="给出评价、提醒、建议、办法等。"
35
+ class="layui-textarea"><%= @sale_report.level2_opinion %></textarea>
36
+ </div>
37
+ </div>
38
+ <div id="weekStar5"></div>
39
+ <div class="layui-form-item layui-form-text">
40
+ <label class="layui-form-label">副总意见</label>
41
+ <div class="layui-input-block">
42
+ <textarea name="level3_opinion" placeholder="给出评价、提醒、建议、办法等。"
43
+ class="layui-textarea"><%= @sale_report.level3_opinion %></textarea>
44
+ </div>
45
+ </div>
46
+ <div id="weekStar6"></div>
47
+ <div class="layui-inline m-t-10">
48
+ <button type="submit" class="layui-btn layui-btn-normal" lay-submit lay-filter="audit_weekly_report"
49
+ style="margin-left: 18px">提交
50
+ </button>
51
+ </div>
52
+ </div>
53
+ </form>
54
+
55
+ <!--表格-->
56
+ <table class="layui-hide" id="showWeeklyTable" lay-filter="showWeeklyTable"></table>
57
+ <script type="text/html" id="show_follow_audit">
58
+ <a href="javascript:void(0);" lay-event="show_follow_audit" class="layui-table-link">{{ d.count }}</a>
59
+ </script>
60
+ <script>
61
+ layui.use(['rate', 'table', 'miniPage', 'jquery', 'request', 'form'], function () {
62
+ var rate = layui.rate,
63
+ miniPage = layui.miniPage,
64
+ form = layui.form,
65
+ request = layui.request,
66
+ $ = layui.jquery;
67
+ table = layui.table;
68
+
69
+ var level1_score, level2_score, level3_score;
70
+ rate.render({
71
+ elem: '#weekStar4',
72
+ half: true,
73
+ value: "<%= @sale_report.level1_score %>",
74
+ length: 5,
75
+ choose: function(value){
76
+ level1_score = value
77
+ }
78
+ })
79
+ rate.render({
80
+ elem: '#weekStar5',
81
+ half: true,
82
+ value: "<%= @sale_report.level2_score %>",
83
+ length: 5,
84
+ choose: function(value){
85
+ level2_score = value
86
+ }
87
+ })
88
+ rate.render({
89
+ elem: '#weekStar6',
90
+ half: true,
91
+ value: "<%= @sale_report.level3_score %>",
92
+ length: 5,
93
+ choose: function(value){
94
+ level3_score = value
95
+ }
96
+ })
97
+
98
+ form.on('submit(audit_weekly_report)', function(res) {
99
+ res.field.level1_score = level1_score;
100
+ res.field.level2_score = level2_score;
101
+ res.field.level3_score = level3_score;
102
+ console.log(res.field, 444)
103
+ request.authPut("educode_sales/operation_reports/" + parent.report_id + "/update_audit", res.field, function (res) {
104
+ if (res.success == false) {
105
+ layer.alert(res.msg)
106
+ } else {
107
+ layer.close(parent.sindex);
108
+ parent.layer.close(parent.layer.getFrameIndex(window.name))
109
+ if (parent.from_source =='monthly') {
110
+ parent.table.reload('weeklyTable')
111
+ parent.table.reload('monthlyTable')
112
+ } else {
113
+ parent.table.reload('weeklyTable')
114
+ parent.table.reload('monthlyTable')
115
+
116
+ }
117
+ }
118
+ })
119
+
120
+ return false;
121
+ })
122
+
123
+
124
+ table.on('tool(showWeeklyTable)', function (obj) {
125
+ var data = obj.data;
126
+ if (obj.event === 'show_follow_audit') {
127
+ id = data.teacher_id
128
+ content = miniPage.getHrefContent('/educode_sales/teachers/show_follow?id=' + data.teacher_id);
129
+ openWH = miniPage.getOpenWidthHeight();
130
+ index = layer.open({
131
+ title: '教师列表/' + data.business_name + '的跟进记录',
132
+ type: 1,
133
+ shade: 0.2,
134
+ maxmin: true,
135
+ shadeClose: true,
136
+ area: [openWH[0] + 'px', openWH[1] + 'px'],
137
+ offset: [openWH[2] + 'px', openWH[3] + 'px'],
138
+ content: content
139
+ });
140
+ $(window).on("resize", function () {
141
+ layer.full(index);
142
+ });
143
+ }
144
+ });
145
+
146
+ table.render({
147
+ elem: '#showWeeklyTable',
148
+ url: '/educode_sales/operation_reports/' + "<%= @sale_report.id%>" + '/plans',
149
+ defaultToolbar: [],
150
+ cols: [
151
+ [{
152
+ field: 'id',
153
+ width: 80,
154
+ title: '序号'
155
+ },
156
+ {
157
+ field: 'staff',
158
+ width: 100,
159
+ title: '姓名'
160
+ },
161
+ {
162
+ field: 'teacher_name',
163
+ width: 100,
164
+ title: '教师姓名',
165
+ },
166
+ {
167
+ field: 'school',
168
+ width: 100,
169
+ title: '单位'
170
+ },
171
+ {
172
+ field: 'department',
173
+ width: 100,
174
+ title: '部门'
175
+ },
176
+ {
177
+ field: 'week',
178
+ width: 100,
179
+ title: '周次',
180
+ },
181
+ {
182
+ field: 'content',
183
+ width: 300,
184
+ title: '计划内容',
185
+ },
186
+ {
187
+ field: 'count',
188
+ width: 100,
189
+ title: '跟进',
190
+ templet: '#show_follow_audit'
191
+ },
192
+ {
193
+ field: 'rate',
194
+ width: 100,
195
+ title: '完成率',
196
+ },
197
+ {
198
+ field: 'updated_at',
199
+ width: 190,
200
+ title: '更新时间',
201
+ sort: true,
202
+ },
203
+ {
204
+ field: 'updated_at',
205
+ width: 170,
206
+ title: '更新时间',
207
+ sort: true,
208
+ }
209
+ ]
210
+ ],
211
+ page: true
212
+ });
213
+ })
214
+ </script>
@@ -0,0 +1,234 @@
1
+ <script type="text/html" id="newWeeklyToolbar">
2
+ <div class="layui-btn-container">
3
+ <span class="table-label">本周计划列表</span>
4
+ <button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn pull-right" lay-event="add"> 添加计划</button>
5
+ </div>
6
+ </script>
7
+ <form class="layui-form layui-form-pane">
8
+ <div class="layui-form-item">
9
+ <div class="layui-inline" style="margin:18px; font-weight: bold">
10
+ <label>完成率:</label>
11
+ <span><%= @sale_report.finish_rate %></span>
12
+ </div>
13
+ <div class="layui-inline" style="margin:18px; font-weight: bold">
14
+ <label style="margin-left: 100px">运营教师:</label>
15
+ <span><%= @sale_report.client%></span>
16
+ </div>
17
+ </div>
18
+ <div class="layui-form-item" style="margin-left: 18px">
19
+ <div class="layui-form-item layui-form-text">
20
+ <label class="layui-form-label">个人总结</label>
21
+ <div class="layui-input-block">
22
+ <textarea name="content" placeholder="此处填写要点:
23
+ 1、一句话概括本周工作的主要成效和主要挫折;
24
+ 2、补充说明收获、经验;
25
+ 3、补充说明需要上级解决的问题和挑战。" class="layui-textarea"><%= @sale_report.content %></textarea>
26
+ </div>
27
+ </div>
28
+ <div class="layui-inline m-t-10">
29
+ <button type="submit" class="layui-btn layui-btn-normal" lay-submit lay-filter="update_weekly_report"
30
+ style="margin-left: 18px">提交
31
+ </button>
32
+ </div>
33
+ </div>
34
+ </form>
35
+
36
+ <!--表格-->
37
+ <table class="layui-hide" id="newWeeklyTable" lay-filter="newWeeklyTable"></table>
38
+ <script type="text/html" id="show_follow_edit">
39
+ <a href="javascript:void(0);" lay-event="show_follow_edit" class="layui-table-link">{{ d.count }}</a>
40
+ </script>
41
+ <script type="text/html" id="currentWeekly">
42
+ <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="show">查看</a>
43
+ <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="edit">编辑</a>
44
+ <a class="layui-btn layui-btn-xs layui-btn-danger data-count-delete" lay-event="delete">删除</a>
45
+ </script>
46
+ <script>
47
+ layui.use(['rate', 'table', 'request', 'form', 'miniPage', 'jquery'], function () {
48
+ var rate = layui.rate,
49
+ form = layui.form,
50
+ $ = layui.jquery,
51
+ miniPage = layui.miniPage,
52
+ request = layui.request;
53
+ table = layui.table;
54
+
55
+
56
+ form.on('submit(update_weekly_report)', function (data) {
57
+ request.authPut("educode_sales/operation_reports/<%= @sale_report.id%>", data.field, function (res) {
58
+ if (res.success == false) {
59
+ layer.alert(res.msg)
60
+ } else {
61
+ layer.close(parent.sindex);
62
+ layer.close(parent.WeeklyIndex);
63
+ layer.close(parent.MonthlyIndex);
64
+ parent.layer.close(parent.layer.getFrameIndex(window.name))
65
+ parent.table.reload('monthlyTable');
66
+ parent.table.reload('weeklyTable');
67
+ parent.table.reload('monthlyTable');
68
+ }
69
+ })
70
+ return false;
71
+ });
72
+
73
+ table.render({
74
+ elem: '#newWeeklyTable',
75
+ url: '/educode_sales/operation_plans/my_week',
76
+ toolbar: '#newWeeklyToolbar',
77
+ defaultToolbar: [],
78
+ cols: [
79
+ [{
80
+ field: 'id',
81
+ width: 80,
82
+ title: '序号'
83
+ },
84
+ {
85
+ field: 'staff',
86
+ width: 100,
87
+ title: '姓名'
88
+ },
89
+ {
90
+ field: 'teacher_name',
91
+ width: 100,
92
+ title: '教师姓名',
93
+ },
94
+ {
95
+ field: 'school',
96
+ width: 100,
97
+ title: '单位'
98
+ },
99
+ {
100
+ field: 'department',
101
+ width: 100,
102
+ title: '部门'
103
+ },
104
+ {
105
+ field: 'week',
106
+ width: 100,
107
+ title: '周次',
108
+ },
109
+ {
110
+ field: 'content',
111
+ width: 300,
112
+ title: '计划内容',
113
+ },
114
+ {
115
+ field: 'count',
116
+ width: 100,
117
+ title: '跟进',
118
+ templet: '#show_follow_edit'
119
+ },
120
+ {
121
+ field: 'rate',
122
+ width: 100,
123
+ title: '完成率',
124
+ },
125
+ {
126
+ field: 'updated_at',
127
+ width: 190,
128
+ title: '更新时间',
129
+ sort: true,
130
+ },
131
+ {
132
+ title: '操作',
133
+ minWidth: 190,
134
+ toolbar: '#currentWeekly',
135
+ align: "center",
136
+ fixed: 'right'
137
+ }
138
+ ]
139
+ ],
140
+ page: true
141
+ });
142
+
143
+ table.on('toolbar(newWeeklyTable)', function (obj) {
144
+ if (obj.event === 'add') { // 监听添加操作
145
+ from_weekly = true;
146
+ var content = miniPage.getHrefContent('/educode_sales/operation_plans/new_week');
147
+ var openWH = miniPage.getOpenWidthHeight();
148
+ sindex = layer.open({
149
+ title: '添加计划',
150
+ type: 1,
151
+ shade: 0.2,
152
+ maxmin: true,
153
+ shadeClose: true,
154
+ area: [openWH[0] + 'px', openWH[1] + 'px'],
155
+ offset: [openWH[2] + 'px', openWH[3] + 'px'],
156
+ content: content,
157
+ success: function (layero, index) {
158
+ // 重新渲染弹层中的下拉选择框select
159
+ form.render('select');
160
+ }
161
+ });
162
+ $(window).on("resize", function () {
163
+ layer.full(sindex);
164
+ });
165
+ }
166
+ });
167
+ table.on('tool(newWeeklyTable)', function (obj) {
168
+ var data = obj.data;
169
+ id = data.id
170
+ if (obj.event === 'delete') {
171
+ layer.confirm('确定删除ID为' + id + " 的周计划", function (index) {
172
+ request.delete('educode_sales/operation_plans/' + id, {}, function (res) {
173
+ layer.close(index);
174
+ table.reload("newWeeklyTable")
175
+ })
176
+ });
177
+ } else if (obj.event === 'show') {
178
+ content = miniPage.getHrefContent('/educode_sales/operation_plans/show_week?id=' + id);
179
+ openWH = miniPage.getOpenWidthHeight();
180
+ index = layer.open({
181
+ title: '查看',
182
+ type: 1,
183
+ shade: 0.2,
184
+ maxmin: true,
185
+ shadeClose: true,
186
+ area: [openWH[0] + 'px', openWH[1] + 'px'],
187
+ offset: [openWH[2] + 'px', openWH[3] + 'px'],
188
+ content: content
189
+ });
190
+ $(window).on("resize", function () {
191
+ layer.full(index);
192
+ });
193
+ return false;
194
+ } else if (obj.event === 'edit') {
195
+ plan_id = id;
196
+ from_sales = true;
197
+ content = miniPage.getHrefContent('/educode_sales/operation_plans/edit_week?id=' + id);
198
+ openWH = miniPage.getOpenWidthHeight();
199
+ sindex = layer.open({
200
+ title: '编辑',
201
+ type: 1,
202
+ shade: 0.2,
203
+ maxmin: true,
204
+ shadeClose: true,
205
+ area: [openWH[0] + 'px', openWH[1] + 'px'],
206
+ offset: [openWH[2] + 'px', openWH[3] + 'px'],
207
+ content: content
208
+ });
209
+ $(window).on("resize", function () {
210
+ layer.full(sindex);
211
+ });
212
+ return false;
213
+ } else if (obj.event === 'show_follow_edit') {
214
+ id = data.teacher_id
215
+ content = miniPage.getHrefContent('/educode_sales/teachers/show_follow?id=' + data.teacher_id);
216
+ openWH = miniPage.getOpenWidthHeight();
217
+ index = layer.open({
218
+ title: '教师列表/' + data.business_name + '的跟进记录',
219
+ type: 1,
220
+ shade: 0.2,
221
+ maxmin: true,
222
+ shadeClose: true,
223
+ area: [openWH[0] + 'px', openWH[1] + 'px'],
224
+ offset: [openWH[2] + 'px', openWH[3] + 'px'],
225
+ content: content
226
+ });
227
+ $(window).on("resize", function () {
228
+ layer.full(index);
229
+ });
230
+ }
231
+ });
232
+
233
+ })
234
+ </script>