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,77 +1,82 @@
1
1
  <script type="text/html" id="weekPlanToolbar">
2
2
  <div class="layui-btn-container">
3
3
  <span class="table-label">周计划列表</span>
4
+ <% if can? :create, EducodeSales::OperationPlan %>
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
- <form class="layui-form layui-form-pane" action="">
10
+ <div class="layuimini-main min-height-table" id="o_week_table_wraper">
11
+ <div class="layui-form layui-form-pane" lay-filter="week_plan_form_filter">
9
12
  <div class="layui-form-item">
10
13
  <div class="layui-inline">
11
14
  <label class="layui-form-label">人员</label>
12
15
  <div class="layui-input-inline">
13
- <select name="quiz">
14
- <option value="">请选择</option>
15
- <option value="010">A类</option>
16
- <option value="021">B类</option>
17
- <option value="0571">C类</option>
18
- <option value="0572">D类</option>
19
- </select>
16
+ <%= select_tag "staff_id", options_for_select(@staffs), {'lay-filter': 'staff_id', include_blank: true} %>
20
17
  </div>
21
18
  </div>
22
19
  <div class="layui-inline">
23
20
  <label class="layui-form-label">年度</label>
24
21
  <div class="layui-input-inline">
25
- <select name="quiz">
26
- <option value="">请选择</option>
27
- <option value="010">北京</option>
28
- <option value="021">上海</option>
29
- <option value="0571">杭州</option>
30
- </select>
22
+ <input type="text" class="layui-input" id="week_plan_year" autocomplete="off" name="year">
31
23
  </div>
32
24
  </div>
33
25
  <div class="layui-inline">
34
26
  <label class="layui-form-label">月份</label>
35
27
  <div class="layui-input-inline">
36
- <select name="quiz">
37
- <option value="">请选择</option>
38
- <option value="010">北京</option>
39
- <option value="021">上海</option>
40
- <option value="0571">杭州</option>
41
- </select>
28
+ <input type="text" class="layui-input" id="week_plan_month" autocomplete="off" name="month">
42
29
  </div>
43
30
  </div>
44
31
  <div class="layui-inline">
45
- <button type="submit" class="layui-btn layui-btn-primary" lay-submit lay-filter="data-reset-btn">重置
32
+ <button type="submit" class="layui-btn layui-btn-primary" lay-submit lay-filter="week_plan_reset">重置
46
33
  </button>
47
- <button type="submit" class="layui-btn layui-btn-primary" lay-submit lay-filter="data-search-btn">检索
34
+ <button type="submit" class="layui-btn layui-btn-primary" lay-submit lay-filter="week_plan_search">检索
48
35
  </button>
49
36
  </div>
50
37
  </div>
51
- </form>
52
-
53
- <table class="layui-hide" id="weekPlanTable" lay-filter="currentTableFilter1"></table>
54
-
55
- <script type="text/html" id="currentTableBar">
38
+ </div>
39
+ <table class="layui-hide" id="weekPlanTable1" lay-filter="weekPlanTable1"></table>
40
+ </div>
41
+ <script type="text/html" id="week_plan_currentTableBar">
42
+ <% if can? :read, EducodeSales::OperationPlan %>
56
43
  <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="show">查看</a>
44
+ <% end %>
45
+ <% if can? :update, EducodeSales::OperationPlan %>
57
46
  <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="edit">编辑</a>
47
+ <% end %>
48
+ <% if can? :destroy, EducodeSales::OperationPlan %>
58
49
  <a class="layui-btn layui-btn-xs layui-btn-danger data-count-delete" lay-event="delete">删除</a>
50
+ <% end %>
59
51
  </script>
60
52
 
61
- <script type="text/html" id="show_follow">
62
- <a href="javascript:void(0);" lay-event="show_follow" class="layui-table-link">{{ d.follow }}</a>
53
+ <script type="text/html" id="show_follow1">
54
+ <a href="javascript:void(0);" lay-event="show_follow1" class="layui-table-link">{{ d.count }}</a>
63
55
  </script>
64
56
 
65
57
  <script>
66
58
  layui.use(['form', 'table', 'miniPage', 'element'], function () {
67
59
  var $ = layui.jquery,
68
60
  form = layui.form,
61
+ laydate = layui.laydate,
69
62
  table = layui.table,
63
+ request = layui.request,
70
64
  miniPage = layui.miniPage;
71
65
 
66
+
67
+ laydate.render({
68
+ elem: '#week_plan_year',
69
+ type: 'year'
70
+ });
71
+ laydate.render({
72
+ elem: '#week_plan_month',
73
+ type: 'month'
74
+ });
75
+
76
+
72
77
  table.render({
73
- elem: '#weekPlanTable',
74
- // url: 'api/table.json',
78
+ elem: '#weekPlanTable1',
79
+ url: '/educode_sales/operation_plans?clazz=week',
75
80
  toolbar: '#weekPlanToolbar',
76
81
  defaultToolbar: [],
77
82
  cols: [
@@ -82,40 +87,45 @@
82
87
  title: '序号'
83
88
  },
84
89
  {
85
- field: 'username',
90
+ field: 'staff',
86
91
  width: 100,
87
92
  title: '姓名'
88
93
  },
89
94
  {
90
- field: 'chance',
95
+ field: 'teacher_name',
91
96
  width: 100,
92
97
  title: '教师姓名',
93
98
  },
94
99
  {
95
- field: 'company',
96
- width: 100,
100
+ field: 'school',
101
+ width: 190,
97
102
  title: '单位'
98
103
  },
99
104
  {
100
- field: 'dep',
101
- width: 100,
105
+ field: 'department',
106
+ width: 190,
102
107
  title: '部门'
103
108
  },
109
+ {
110
+ field: 'month',
111
+ width: 100,
112
+ title: '月份',
113
+ },
104
114
  {
105
115
  field: 'week',
106
116
  width: 100,
107
117
  title: '周次',
108
118
  },
109
119
  {
110
- field: 'plan',
120
+ field: 'content',
111
121
  width: 300,
112
122
  title: '计划内容',
113
123
  },
114
124
  {
115
- field: 'follow',
125
+ field: 'count',
116
126
  width: 100,
117
127
  title: '跟进',
118
- templet: '#show_follow'
128
+ templet: '#show_follow1'
119
129
  },
120
130
  {
121
131
  field: 'rate',
@@ -123,7 +133,7 @@
123
133
  title: '完成率',
124
134
  },
125
135
  {
126
- field: 'updateTime',
136
+ field: 'updated_at',
127
137
  width: 150,
128
138
  title: '更新时间',
129
139
  sort: true,
@@ -131,57 +141,58 @@
131
141
  {
132
142
  title: '操作',
133
143
  minWidth: 280,
134
- toolbar: '#currentTableBar',
144
+ toolbar: '#week_plan_currentTableBar',
135
145
  align: "center",
136
146
  fixed: 'right'
137
147
  }
138
148
  ]
139
149
  ],
140
- data: [{
141
- "id": "1",
142
- "username": "丁亚莲",
143
- "chance": "老王",
144
- "company": "中南大学",
145
- "dep": "计算机学院",
146
- "week": "2021-33周",
147
- "plan": "对接决策人",
148
- "follow": "120",
149
- "rate": "100%",
150
- "updateTime": "2021-07-27",
151
- }],
152
150
  limits: [10, 15, 20, 25, 50, 100],
153
151
  limit: 15,
154
152
  page: true,
155
153
  skin: 'line'
156
154
  });
157
- // 监听搜索操作
158
- form.on('submit(data-search-btn)', function (data) {
159
- var result = JSON.stringify(data.field);
160
- layer.alert(result, {
161
- title: '最终的搜索信息'
155
+ var sort = {}, search = {};
156
+ table.on('sort(weekPlanTable1)', function(obj) {
157
+ sort.field = obj.field;
158
+ sort.order = obj.type;
159
+ table.reload('weekPlanTable1', {
160
+ initSort: obj,
161
+ where: {
162
+ sort: sort,
163
+ q: search
164
+ }
162
165
  });
166
+ })
163
167
 
164
- //执行搜索重载
165
- table.reload('currentTableId', {
168
+ // 监听搜索操作
169
+ form.on('submit(week_plan_search)', function (data) {
170
+ search = data.field
171
+ table.reload('weekPlanTable1', {
166
172
  page: {
167
173
  curr: 1
168
174
  },
169
- where: {
170
- searchParams: result
171
- }
175
+ where: {q: search, sort : sort}
172
176
  }, 'data');
173
177
 
174
178
  return false;
175
179
  });
176
180
 
181
+ form.on('submit(week_plan_reset)', function(data){
182
+ var field = data.field;
183
+ form.val('week_plan_form_filter', {staff_id: '', year: '', month: ''})
184
+ return false;
185
+ });
186
+
177
187
  /**
178
188
  * toolbar事件监听
179
189
  */
180
- table.on('toolbar(currentTableFilter1)', function (obj) {
190
+ table.on('toolbar(weekPlanTable1)', function (obj) {
191
+ var data = obj.data;
181
192
  if (obj.event === 'add') { // 监听添加操作
182
193
  var content = miniPage.getHrefContent('/educode_sales/operation_plans/new_week');
183
194
  var openWH = miniPage.getOpenWidthHeight();
184
- var index = layer.open({
195
+ new_weelPlan_index = layer.open({
185
196
  title: '添加计划',
186
197
  type: 1,
187
198
  shade: 0.2,
@@ -198,24 +209,25 @@
198
209
  $(window).on("resize", function () {
199
210
  layer.full(index);
200
211
  });
201
- } else if (obj.event === 'delete') { // 监听删除操作
202
- var checkStatus = table.checkStatus('currentTableId'),
203
- data = checkStatus.data;
204
- layer.alert(JSON.stringify(data));
205
212
  }
206
213
  });
207
214
 
208
215
 
209
- table.on('tool(currentTableFilter1)', function (obj) {
216
+ table.on('tool(weekPlanTable1)', function (obj) {
210
217
  var data = obj.data;
211
- var id = data.id
218
+ id = data.id
212
219
  if (obj.event === 'delete') {
213
- layer.confirm('真的删除行么', function (index) {
214
- obj.del();
215
- layer.close(index);
220
+ layer.confirm('确定删除' + data.id, function (index) {
221
+ console.log("aaaaa");
222
+ request.delete('educode_sales/operation_plans/' + data.id, {}, function (res) {
223
+ layer.close(index);
224
+ table.reload("weekPlanTable1")
225
+ })
216
226
  });
217
- } else if (obj.event === 'show') {
218
- content = miniPage.getHrefContent('/educode_sales/operation_plans/show_week');
227
+ }
228
+ else if (obj.event === 'show') {
229
+ console.log("a");
230
+ content = miniPage.getHrefContent('/educode_sales/operation_plans/show_week?id='+id);
219
231
  openWH = miniPage.getOpenWidthHeight();
220
232
  index = layer.open({
221
233
  title: '查看',
@@ -227,10 +239,10 @@
227
239
  offset: [openWH[2] + 'px', openWH[3] + 'px'],
228
240
  content: content,
229
241
  success: function (layero, index) {
230
- $("#show_chance1").val(data.chance);
231
- $("#show_plan1").val(data.plan);
232
- $("#show_rate1").val(data.rate);
233
- $("#show_week1").val(data.week);
242
+ // $("#show_chance1").val(data.chance);
243
+ // $("#show_plan1").val(data.plan);
244
+ // $("#show_rate1").val(data.rate);
245
+ // $("#show_week1").val(data.week);
234
246
  // 重新渲染弹层中的下拉选择框select
235
247
  form.render('select');
236
248
  },
@@ -240,9 +252,9 @@
240
252
  });
241
253
  return false;
242
254
  } else if (obj.event === 'edit') {
243
- content = miniPage.getHrefContent('/educode_sales/operation_plans/edit_week');
255
+ content = miniPage.getHrefContent('/educode_sales/operation_plans/edit_week?id='+id);
244
256
  openWH = miniPage.getOpenWidthHeight();
245
- index = layer.open({
257
+ editWeek_index = layer.open({
246
258
  title: '编辑',
247
259
  type: 1,
248
260
  shade: 0.2,
@@ -252,10 +264,10 @@
252
264
  offset: [openWH[2] + 'px', openWH[3] + 'px'],
253
265
  content: content,
254
266
  success: function (layero, index) {
255
- $("#edit_chance1").val(data.chance);
256
- $("#edit_plan1").val(data.plan);
257
- $("#edit_rate1").val(data.rate);
258
- $("#edit_week1").val(data.week);
267
+ // $("#edit_chance1").val(data.chance);
268
+ // $("#edit_plan1").val(data.plan);
269
+ // $("#edit_rate1").val(data.rate);
270
+ // $("#edit_week1").val(data.week);
259
271
  // 重新渲染弹层中的下拉选择框select
260
272
  form.render('select');
261
273
  },
@@ -264,11 +276,12 @@
264
276
  layer.full(index);
265
277
  });
266
278
  return false;
267
- } else if (obj.event === 'show_follow') {
268
- content = miniPage.getHrefContent('/educode_sales/businesses/show_follow');
279
+ } else if (obj.event === 'show_follow1') {
280
+ id = data.teacher_id
281
+ content = miniPage.getHrefContent('/educode_sales/teachers/show_follow?id=' + data.teacher_id);
269
282
  openWH = miniPage.getOpenWidthHeight();
270
283
  index = layer.open({
271
- title: 'xxxx/跟进记录',
284
+ title: data.teacher_name + '/跟进记录',
272
285
  type: 1,
273
286
  shade: 0.2,
274
287
  maxmin: true,
@@ -1,50 +1,37 @@
1
1
  <script type="text/html" id="weeklyToolbar">
2
2
  <div class="layui-btn-container">
3
3
  <span class="table-label">周报列表</span>
4
+ <% if can? :create, EducodeSales::OperationPlan %>
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
- <form class="layui-form layui-form-pane" action="">
10
+ <div class="layuimini-main min-height-table" id="o_sales_weelky_table">
11
+ <form class="layui-form layui-form-pane" lay-filter="weekly_plan_form_filter">
9
12
  <div class="layui-form-item">
10
13
  <div class="layui-inline">
11
14
  <label class="layui-form-label">人员</label>
12
15
  <div class="layui-input-inline">
13
- <select name="quiz">
14
- <option value="">请选择</option>
15
- <option value="010">A类</option>
16
- <option value="021">B类</option>
17
- <option value="0571">C类</option>
18
- <option value="0572">D类</option>
19
- </select>
16
+ <%= select_tag "staff_id", options_for_select(@staffs), {'lay-filter': 'staff_id', include_blank: true} %>
20
17
  </div>
21
18
  </div>
22
19
  <div class="layui-inline">
23
20
  <label class="layui-form-label">年度</label>
24
21
  <div class="layui-input-inline">
25
- <select name="quiz">
26
- <option value="">请选择</option>
27
- <option value="010">北京</option>
28
- <option value="021">上海</option>
29
- <option value="0571">杭州</option>
30
- </select>
22
+ <input type="text" class="layui-input" id="weekly_plan_year" autocomplete="off" name="year">
31
23
  </div>
32
24
  </div>
33
25
  <div class="layui-inline">
34
26
  <label class="layui-form-label">月份</label>
35
27
  <div class="layui-input-inline">
36
- <select name="quiz">
37
- <option value="">请选择</option>
38
- <option value="010">北京</option>
39
- <option value="021">上海</option>
40
- <option value="0571">杭州</option>
41
- </select>
28
+ <input type="text" class="layui-input" id="weekly_plan_month" autocomplete="off" name="month">
42
29
  </div>
43
30
  </div>
44
31
  <div class="layui-inline">
45
- <button type="submit" class="layui-btn layui-btn-primary" lay-submit lay-filter="data-reset-btn">重置
32
+ <button type="submit" class="layui-btn layui-btn-primary" lay-submit lay-filter="weekly_plan_reset">重置
46
33
  </button>
47
- <button type="submit" class="layui-btn layui-btn-primary" lay-submit lay-filter="data-search-btn">检索
34
+ <button type="submit" class="layui-btn layui-btn-primary" lay-submit lay-filter="weekly_plan_search">检索
48
35
  </button>
49
36
  </div>
50
37
  </div>
@@ -52,11 +39,20 @@
52
39
 
53
40
  <!--表格-->
54
41
  <table class="layui-hide" id="weeklyTable" lay-filter="currentTableFilter2"></table>
55
-
42
+ </div>
56
43
  <script type="text/html" id="currentWeekTableBar">
44
+ <% if can? :read, EducodeSales::OperationPlan %>
57
45
  <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="show">查看</a>
46
+ <% end %>
47
+ <% if can? :update, EducodeSales::OperationPlan %>
58
48
  <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="edit">编辑</a>
49
+ <% end %>
50
+ <% if can? :audit, EducodeSales::OperationReport %>
51
+ <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="audit">审查</a>
52
+ <% end %>
53
+ <% if can? :destroy, EducodeSales::OperationPlan %>
59
54
  <a class="layui-btn layui-btn-xs layui-btn-danger data-count-delete" lay-event="delete">删除</a>
55
+ <% end %>
60
56
  </script>
61
57
 
62
58
  <script>
@@ -66,11 +62,22 @@
66
62
  form = layui.form,
67
63
  table = layui.table,
68
64
  rate = layui.rate,
65
+ laydate = layui.laydate,
66
+ request = layui.request,
69
67
  miniPage = layui.miniPage;
70
68
 
69
+ laydate.render({
70
+ elem: '#weekly_plan_year',
71
+ type: 'year'
72
+ });
73
+ laydate.render({
74
+ elem: '#weekly_plan_month',
75
+ type: 'month'
76
+ });
77
+
71
78
  table.render({
72
79
  elem: '#weeklyTable',
73
- // url: 'api/table.json',
80
+ url: '/educode_sales/operation_reports?clazz=week',
74
81
  toolbar: '#weeklyToolbar',
75
82
  defaultToolbar: [],
76
83
  cols: [
@@ -81,47 +88,47 @@
81
88
  title: '序号'
82
89
  },
83
90
  {
84
- field: 'username',
91
+ field: 'staff',
85
92
  width: 100,
86
93
  title: '姓名'
87
94
  },
88
95
  {
89
- field: 'rate',
96
+ field: 'finish_rate',
90
97
  width: 100,
91
98
  title: '完成率',
92
99
  },
93
100
  {
94
- field: 'customer',
101
+ field: 'client',
95
102
  width: 100,
96
103
  title: '运营教师'
97
104
  },
98
105
  {
99
- field: 'sumUp',
106
+ field: 'content',
100
107
  width: 300,
101
108
  title: '个人总结',
102
109
  },
103
110
  {
104
- field: 'area',
111
+ field: 'level1_score',
105
112
  width: 180,
106
113
  title: '大区',
107
114
  templet: function (d) {
108
- return '<div id="star1"></div>'
115
+ return '<div class="star1"></div>'
109
116
  }
110
117
  },
111
118
  {
112
- field: 'zong',
119
+ field: 'level2_score',
113
120
  width: 180,
114
121
  title: '总监',
115
122
  templet: function (d) {
116
- return '<div id="star2"></div>'
123
+ return '<div class="star2"></div>'
117
124
  }
118
125
  },
119
126
  {
120
- field: 'fu',
127
+ field: 'level3_score',
121
128
  width: 180,
122
129
  title: '副总',
123
130
  templet: function (d) {
124
- return '<div id="star3"></div>'
131
+ return '<div class="star3"></div>'
125
132
  }
126
133
  },
127
134
  {
@@ -133,64 +140,66 @@
133
140
  }
134
141
  ]
135
142
  ], done: function (res) {
136
- //星级
137
- rate.render({//循环设置评分
138
- elem: '#star1'//给不同的id的rate绑定不同的值
139
- , length: 5 //星星个数
140
- , half: true //支持半颗星
141
- , readonly: true //只读
142
- });
143
- rate.render({//循环设置评分
144
- elem: '#star2'//给不同的id的rate绑定不同的值
145
- , length: 5 //星星个数
146
- , half: true //支持半颗星
147
- , readonly: true //只读
148
- });
149
- rate.render({//循环设置评分
150
- elem: '#star3'//给不同的id的rate绑定不同的值
151
- , length: 5 //星星个数
152
- , half: true //支持半颗星
153
- , readonly: true //只读
154
- });
155
-
143
+ $("#o_sales_weelky_table .star1").each(function (i) {
144
+ rate.render({
145
+ elem: this,
146
+ value: res.data[i].level1_score,
147
+ half: true,
148
+ readonly: true
149
+ });
150
+ })
151
+ $("#o_sales_weelky_table .star2").each(function (i) {
152
+ rate.render({
153
+ elem: this,
154
+ value: res.data[i].level2_score,
155
+ half: true,
156
+ readonly: true
157
+ });
158
+ })
159
+ $("#o_sales_weelky_table .star3").each(function (i) {
160
+ rate.render({
161
+ elem: this,
162
+ value: res.data[i].level3_score,
163
+ half: true,
164
+ readonly: true
165
+ });
166
+ })
156
167
  },
157
- data: [{
158
- "id": "1",
159
- "username": "段小龙",
160
- "rate": "90%",
161
- "customer": "12",
162
- "money": "128",
163
- "sumUp": "院长当面汇报一次",
164
- "area": "※",
165
- "zong": "※",
166
- "fu": "※",
167
- }],
168
- limits: [10, 15, 20, 25, 50, 100],
169
- limit: 15,
170
168
  page: true,
171
- skin: 'line'
172
169
  });
173
170
 
174
- // 监听搜索操作
175
- form.on('submit(data-search-btn)', function (data) {
176
- var result = JSON.stringify(data.field);
177
- layer.alert(result, {
178
- title: '最终的搜索信息'
171
+ var sort = {}, search = {};
172
+ table.on('sort(weeklyTable)', function(obj) {
173
+ sort.field = obj.field;
174
+ sort.order = obj.type;
175
+ table.reload('weeklyTable', {
176
+ initSort: obj,
177
+ where: {
178
+ sort: sort,
179
+ q: search
180
+ }
179
181
  });
182
+ })
180
183
 
181
- //执行搜索重载
182
- table.reload('currentTableId', {
184
+ // 监听搜索操作
185
+ form.on('submit(weekly_plan_search)', function (data) {
186
+ search = data.field
187
+ table.reload('weeklyTable', {
183
188
  page: {
184
189
  curr: 1
185
190
  },
186
- where: {
187
- searchParams: result
188
- }
191
+ where: {q: search, sort : sort}
189
192
  }, 'data');
190
193
 
191
194
  return false;
192
195
  });
193
196
 
197
+ form.on('submit(weekly_plan_reset)', function(data){
198
+ var field = data.field;
199
+ form.val('weekly_plan_form_filter', {staff_id: '', year: '', month: ''})
200
+ return false;
201
+ });
202
+
194
203
  /**
195
204
  * toolbar事件监听
196
205
  */
@@ -230,9 +239,9 @@
230
239
  table.on('tool(currentTableFilter2)', function (obj) {
231
240
  var data = obj.data;
232
241
  if (obj.event === 'edit') {
233
- var content = miniPage.getHrefContent('/educode_sales/operation_plans/edit_weekly');
242
+ var content = miniPage.getHrefContent('/educode_sales/operation_reports/' + data.id + '/edit')
234
243
  var openWH = miniPage.getOpenWidthHeight();
235
- var index = layer.open({
244
+ WeeklyIndex = layer.open({
236
245
  title: '编辑周报',
237
246
  type: 1,
238
247
  shade: 0.2,
@@ -246,13 +255,8 @@
246
255
  layer.full(index);
247
256
  });
248
257
  return false;
249
- } else if (obj.event === 'delete') {
250
- layer.confirm('真的删除行么', function (index) {
251
- obj.del();
252
- layer.close(index);
253
- });
254
- } else if (obj.event === 'show') {
255
- content = miniPage.getHrefContent('/educode_sales/operation_plans/show_weekly');
258
+ } else if (obj.event === 'show') {
259
+ content = miniPage.getHrefContent('/educode_sales/operation_reports/' + data.id);
256
260
  openWH = miniPage.getOpenWidthHeight();
257
261
  index = layer.open({
258
262
  title: '查看周报',
@@ -268,6 +272,31 @@
268
272
  layer.full(index);
269
273
  });
270
274
  return false;
275
+ }else if (obj.event === 'delete') {
276
+ layer.confirm('确定删除' + data.id, function (index) {
277
+ request.delete('educode_sales/operation_reports/' + data.id, {}, function (res) {
278
+ layer.close(index);
279
+ table.reload("weeklyTable")
280
+ })
281
+ });
282
+ }else if (obj.event === 'audit') {
283
+ content = miniPage.getHrefContent('/educode_sales/operation_reports/' + data.id + "/audit");
284
+ openWH = miniPage.getOpenWidthHeight();
285
+ report_id = data.id;
286
+ sindex = layer.open({
287
+ title: '审查'+ data.staff +'的周报',
288
+ type: 1,
289
+ shade: 0.2,
290
+ maxmin: true,
291
+ shadeClose: true,
292
+ area: [openWH[0] + 'px', openWH[1] + 'px'],
293
+ offset: [openWH[2] + 'px', openWH[3] + 'px'],
294
+ content: content,
295
+ });
296
+ $(window).on("resize", function () {
297
+ layer.full(sindex);
298
+ });
299
+ return false;
271
300
  }
272
301
  });
273
302