educode_sales 0.1.0 → 0.1.1

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 (56) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/educode_sales/activities_controller.rb +7 -1
  3. data/app/controllers/educode_sales/application_controller.rb +0 -1
  4. data/app/controllers/educode_sales/businesses_controller.rb +3 -2
  5. data/app/controllers/educode_sales/operation_plans_controller.rb +155 -0
  6. data/app/controllers/educode_sales/operation_reports_controller.rb +125 -0
  7. data/app/controllers/educode_sales/places_controller.rb +1 -0
  8. data/app/controllers/educode_sales/plans_controller.rb +3 -1
  9. data/app/controllers/educode_sales/sale_reports_controller.rb +2 -1
  10. data/app/controllers/educode_sales/sales_controller.rb +4 -1
  11. data/app/controllers/educode_sales/teacher_follows_controller.rb +6 -0
  12. data/app/controllers/educode_sales/teachers_controller.rb +17 -5
  13. data/app/models/ability.rb +4 -1
  14. data/app/models/educode_sales/common.rb +1 -0
  15. data/app/models/educode_sales/staff.rb +2 -0
  16. data/app/views/educode_sales/activities/index.html.erb +17 -8
  17. data/app/views/educode_sales/businesses/index.html.erb +136 -140
  18. data/app/views/educode_sales/businesses/show_follow.html.erb +18 -3
  19. data/app/views/educode_sales/operation_plans/_monthPlan.html.erb +60 -76
  20. data/app/views/educode_sales/operation_plans/_monthly.html.erb +116 -95
  21. data/app/views/educode_sales/operation_plans/_weekPlan.html.erb +73 -74
  22. data/app/views/educode_sales/operation_plans/_weekly.html.erb +108 -86
  23. data/app/views/educode_sales/operation_plans/edit_month.html.erb +35 -32
  24. data/app/views/educode_sales/operation_plans/edit_week.html.erb +40 -39
  25. data/app/views/educode_sales/operation_plans/index.json.jbuilder +19 -0
  26. data/app/views/educode_sales/operation_plans/my_month.json.jbuilder +18 -0
  27. data/app/views/educode_sales/operation_plans/my_week.json.jbuilder +19 -0
  28. data/app/views/educode_sales/operation_plans/new_month.html.erb +5 -10
  29. data/app/views/educode_sales/operation_plans/new_monthly.html.erb +27 -43
  30. data/app/views/educode_sales/operation_plans/new_week.html.erb +7 -7
  31. data/app/views/educode_sales/operation_plans/new_weekly.html.erb +46 -53
  32. data/app/views/educode_sales/operation_plans/show_month.html.erb +4 -10
  33. data/app/views/educode_sales/operation_plans/show_week.html.erb +20 -25
  34. data/app/views/educode_sales/operation_plans/show_weekly.html.erb +6 -6
  35. data/app/views/educode_sales/operation_reports/audit.html.erb +214 -0
  36. data/app/views/educode_sales/operation_reports/edit.html.erb +237 -0
  37. data/app/views/educode_sales/operation_reports/index.json.jbuilder +17 -0
  38. data/app/views/educode_sales/operation_reports/plans.json.jbuilder +19 -0
  39. data/app/views/educode_sales/operation_reports/show.html.erb +139 -0
  40. data/app/views/educode_sales/operations/trends.html.erb +8 -0
  41. data/app/views/educode_sales/places/index.html.erb +6 -0
  42. data/app/views/educode_sales/plans/_monthPlan.html.erb +8 -0
  43. data/app/views/educode_sales/plans/_monthly.html.erb +8 -0
  44. data/app/views/educode_sales/plans/_weekPlan.html.erb +10 -3
  45. data/app/views/educode_sales/plans/_weekly.html.erb +8 -0
  46. data/app/views/educode_sales/plans/audit_weekly.html.erb +6 -0
  47. data/app/views/educode_sales/plans/edit_monthly.html.erb +8 -0
  48. data/app/views/educode_sales/plans/edit_weekly.html.erb +8 -0
  49. data/app/views/educode_sales/plans/new_monthly.html.erb +8 -0
  50. data/app/views/educode_sales/plans/new_weekly.html.erb +7 -1
  51. data/app/views/educode_sales/sale_trends/trends.html.erb +8 -0
  52. data/app/views/educode_sales/teachers/index.html.erb +3 -5
  53. data/app/views/layouts/educode_sales/application.html.erb +23 -2
  54. data/config/routes.rb +11 -4
  55. data/lib/educode_sales/version.rb +1 -1
  56. metadata +14 -5
@@ -1,16 +1,25 @@
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? :add_follow, EducodeSales::Business %>
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
-
8
- <table class="layui-hide" id="sale_plan_follow_table" lay-filter="sale_plan_follow_table"></table>
9
- <table class="layui-hide" id="unfinish_table" lay-filter="unfinish_table"></table>
9
+ <div class="edit-table">
10
+ <table class="layui-hide" id="sale_plan_follow_table" lay-filter="sale_plan_follow_table" style="min-height: 300px;"></table>
11
+ <table class="layui-hide" id="unfinish_table" lay-filter="unfinish_table" style="min-height: 300px;"></table>
12
+ </div>
10
13
  <script type="text/html" id="currentTableBar_follow">
14
+ <% if can? :follow, EducodeSales::Business %>
11
15
  <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="show">查看</a>
16
+ <% end %>
17
+ <% if can? :update_follow, EducodeSales::Business %>
12
18
  <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="edit">编辑</a>
19
+ <% end %>
20
+ <% if can? :destroy_follow, EducodeSales::Business %>
13
21
  <a class="layui-btn layui-btn-xs layui-btn-danger data-count-delete" lay-event="delete">删除</a>
22
+ <% end %>
14
23
  </script>
15
24
 
16
25
  <!--关键人-->
@@ -30,9 +39,15 @@
30
39
  </script>
31
40
 
32
41
  <script type="text/html" id="currentTableBar1234">
42
+ <% if can? :read, EducodeSales::SalePlan %>
33
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::SalePlan %>
34
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::SalePlan %>
35
49
  <a class="layui-btn layui-btn-xs layui-btn-danger data-count-delete" lay-event="delete">删除</a>
50
+ <% end %>
36
51
  </script>
37
52
 
38
53
  <script>
@@ -5,46 +5,30 @@
5
5
  </div>
6
6
  </script>
7
7
  <!--搜索-->
8
- <form class="layui-form layui-form-pane" action="">
8
+ <form class="layui-form layui-form-pane" lay-filter="month_plan_form_filter">
9
9
  <div class="layui-form-item">
10
10
  <div class="layui-inline">
11
11
  <label class="layui-form-label">人员</label>
12
12
  <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>
13
+ <%= select_tag "staff_id", options_for_select(@staffs), { id: 'month_plan_staff_id', include_blank: true} %>
20
14
  </div>
21
15
  </div>
22
16
  <div class="layui-inline">
23
17
  <label class="layui-form-label">年度</label>
24
18
  <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>
19
+ <input type="text" class="layui-input" id="month_plan_year" autocomplete="off" name="year">
31
20
  </div>
32
21
  </div>
33
22
  <div class="layui-inline">
34
23
  <label class="layui-form-label">月份</label>
35
24
  <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>
25
+ <input type="text" class="layui-input" id="month_plan_month" autocomplete="off" name="month">
42
26
  </div>
43
27
  </div>
44
28
  <div class="layui-inline">
45
- <button type="submit" class="layui-btn layui-btn-primary" lay-submit lay-filter="data-reset-btn">重置
29
+ <button type="submit" class="layui-btn layui-btn-primary" lay-submit lay-filter="month_plan_reset">重置
46
30
  </button>
47
- <button type="submit" class="layui-btn layui-btn-primary" lay-submit lay-filter="data-search-btn">检索
31
+ <button type="submit" class="layui-btn layui-btn-primary" lay-submit lay-filter="month_plan_seach_btn">检索
48
32
  </button>
49
33
  </div>
50
34
  </div>
@@ -52,7 +36,7 @@
52
36
  <table class="layui-hide" id="monthPlanTable" lay-filter="currentTableFilter3"></table>
53
37
 
54
38
  <script type="text/html" id="currentTableBar">
55
- <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="edit">查看</a>
39
+ <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="show">查看</a>
56
40
  <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="edit">编辑</a>
57
41
  <a class="layui-btn layui-btn-xs layui-btn-danger data-count-delete" lay-event="delete">删除</a>
58
42
  </script>
@@ -66,11 +50,23 @@
66
50
  var $ = layui.jquery,
67
51
  form = layui.form,
68
52
  table = layui.table,
53
+ laydate = layui.laydate,
54
+ request = layui.request,
69
55
  miniPage = layui.miniPage;
70
56
 
57
+
58
+ laydate.render({
59
+ elem: '#month_plan_year',
60
+ type: 'year'
61
+ });
62
+ laydate.render({
63
+ elem: '#month_plan_month',
64
+ type: 'month'
65
+ });
66
+
71
67
  table.render({
72
68
  elem: '#monthPlanTable',
73
- // url: 'api/table.json',
69
+ url: '/educode_sales/operation_plans?clazz=month',
74
70
  toolbar: '#monthPlanToolbar',
75
71
  defaultToolbar: [],
76
72
  cols: [
@@ -81,27 +77,27 @@
81
77
  title: '序号'
82
78
  },
83
79
  {
84
- field: 'username',
80
+ field: 'staff',
85
81
  width: 100,
86
82
  title: '姓名'
87
83
  },
88
84
  {
89
- field: 'chance',
85
+ field: 'teacher_name',
90
86
  width: 100,
91
- title: '教师名称',
87
+ title: '教师姓名',
92
88
  },
93
89
  {
94
- field: 'company',
90
+ field: 'school',
95
91
  width: 100,
96
92
  title: '单位'
97
93
  },
98
94
  {
99
- field: 'dep',
95
+ field: 'department',
100
96
  width: 100,
101
97
  title: '部门'
102
98
  },
103
99
  {
104
- field: 'plan',
100
+ field: 'content',
105
101
  width: 400,
106
102
  title: '计划内容',
107
103
  },
@@ -117,7 +113,7 @@
117
113
  title: '完成率',
118
114
  },
119
115
  {
120
- field: 'updateTime',
116
+ field: 'updated_at',
121
117
  width: 150,
122
118
  title: '更新时间',
123
119
  sort: true,
@@ -131,48 +127,50 @@
131
127
  }
132
128
  ]
133
129
  ],
134
- data: [{
135
- "id": "11",
136
- "username": "丁亚莲1",
137
- "chance": "AA",
138
- "company": "中南大学1",
139
- "dep": "计算机学院",
140
- "plan": "对接决策人1",
141
- "follow": "1201",
142
- "rate": "1001%",
143
- "updateTime": "2021-07-271",
144
- }],
145
130
  limits: [10, 15, 20, 25, 50, 100],
146
131
  limit: 15,
147
132
  page: true,
148
133
  skin: 'line'
149
134
  });
150
135
 
151
- // 监听搜索操作
152
- form.on('submit(data-search-btn)', function (data) {
153
- var result = JSON.stringify(data.field);
154
- layer.alert(result, {
155
- title: '最终的搜索信息'
136
+ var sort = {}, search = {};
137
+ table.on('sort(monthPlanTable)', function(obj) {
138
+ sort.field = obj.field;
139
+ sort.order = obj.type;
140
+ table.reload('monthPlanTable', {
141
+ initSort: obj,
142
+ where: {
143
+ sort: sort,
144
+ q: search
145
+ }
156
146
  });
147
+ })
157
148
 
158
- //执行搜索重载
159
- table.reload('currentTableId', {
149
+ // 监听搜索操作
150
+ form.on('submit(month_plan_seach_btn)', function (data) {
151
+ search = data.field
152
+ table.reload('monthPlanTable', {
160
153
  page: {
161
154
  curr: 1
162
155
  },
163
- where: {
164
- searchParams: result
165
- }
156
+ where: {q: search, sort : sort}
166
157
  }, 'data');
167
158
 
168
159
  return false;
169
160
  });
170
161
 
162
+ form.on('submit(month_plan_reset)', function(data){
163
+ var field = data.field;
164
+ form.val('month_plan_form_filter', {staff_id: '', year: '', month: ''})
165
+ return false;
166
+ });
167
+
171
168
  /**
172
169
  * toolbar事件监听
173
170
  */
174
171
  table.on('toolbar(currentTableFilter3)', function (obj) {
175
172
  if (obj.event === 'add') { // 监听添加操作
173
+ console.log("a");
176
174
  var content = miniPage.getHrefContent('/educode_sales/operation_plans/new_month');
177
175
  var openWH = miniPage.getOpenWidthHeight();
178
176
  var index = layer.open({
@@ -192,29 +190,23 @@
192
190
  $(window).on("resize", function () {
193
191
  layer.full(index);
194
192
  });
195
- } else if (obj.event === 'delete') { // 监听删除操作
196
- var checkStatus = table.checkStatus('currentTableId'),
197
- data = checkStatus.data;
198
- layer.alert(JSON.stringify(data));
199
193
  }
200
194
  });
201
195
 
202
- //监听表格复选框选择
203
- table.on('checkbox(currentTableFilter3)', function (obj) {
204
- console.log(obj)
205
- });
206
196
 
207
197
  table.on('tool(currentTableFilter3)', function (obj) {
208
-
209
198
  var data = obj.data;
210
- var id = data.id;
211
199
  if (obj.event === 'delete') {
212
- layer.confirm('真的删除行么', function (index) {
213
- obj.del();
214
- layer.close(index);
200
+ layer.confirm('确定删除' + data.id, function (index) {
201
+ console.log("aaaaa");
202
+ request.delete('educode_sales/operation_plans/' + data.id, {}, function (res) {
203
+ layer.close(index);
204
+ table.reload("monthPlanTable")
205
+ })
215
206
  });
216
- } else if (obj.event === 'show') {
217
- content = miniPage.getHrefContent('/educode_sales/operation_plans/show_month');
207
+ }
208
+ else if (obj.event === 'show') {
209
+ content = miniPage.getHrefContent('/educode_sales/operation_plans/show_week?id='+ data.id);
218
210
  openWH = miniPage.getOpenWidthHeight();
219
211
  index = layer.open({
220
212
  title: '查看',
@@ -226,10 +218,6 @@
226
218
  offset: [openWH[2] + 'px', openWH[3] + 'px'],
227
219
  content: content,
228
220
  success: function (layero, index) {
229
- $("#show_chance3").val(data.chance);
230
- $("#show_plan3").val(data.plan);
231
- $("#show_rate3").val(data.rate);
232
- // 重新渲染弹层中的下拉选择框select
233
221
  form.render('select');
234
222
  },
235
223
  });
@@ -238,7 +226,7 @@
238
226
  });
239
227
  return false;
240
228
  } else if (obj.event === 'edit') {
241
- content = miniPage.getHrefContent('/educode_sales/operation_plans/edit_month');
229
+ content = miniPage.getHrefContent('/educode_sales/operation_plans/edit_month?id='+data.id);
242
230
  openWH = miniPage.getOpenWidthHeight();
243
231
  index = layer.open({
244
232
  title: '编辑',
@@ -250,10 +238,6 @@
250
238
  offset: [openWH[2] + 'px', openWH[3] + 'px'],
251
239
  content: content,
252
240
  success: function (layero, index) {
253
- $("#edit_chance3").val(data.chance);
254
- $("#edit_plan3").val(data.plan);
255
- $("#edit_rate3").val(data.rate);
256
- // 重新渲染弹层中的下拉选择框select
257
241
  form.render('select');
258
242
  },
259
243
  });
@@ -5,55 +5,44 @@
5
5
  </div>
6
6
  </script>
7
7
  <!--搜索-->
8
- <form class="layui-form layui-form-pane" action="">
8
+ <div class="layuimini-main edit-table" id="monthly_table_wraper">
9
+
10
+ <form class="layui-form layui-form-pane" lay-filter="monthly_form_filter">
9
11
  <div class="layui-form-item">
10
12
  <div class="layui-inline">
11
13
  <label class="layui-form-label">人员</label>
12
14
  <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>
15
+ <%= select_tag "staff_id", options_for_select(@staffs), { id: 'weekly_staff_id', include_blank: true} %>
20
16
  </div>
21
17
  </div>
22
18
  <div class="layui-inline">
23
19
  <label class="layui-form-label">年度</label>
24
20
  <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>
21
+ <input type="text" class="layui-input" id="monthly_year" autocomplete="off" name="year">
31
22
  </div>
32
23
  </div>
33
24
  <div class="layui-inline">
34
25
  <label class="layui-form-label">月份</label>
35
26
  <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>
27
+ <input type="text" class="layui-input" id="monthly_month" autocomplete="off" name="month">
42
28
  </div>
43
29
  </div>
44
30
  <div class="layui-inline">
45
- <button type="submit" class="layui-btn layui-btn-primary" lay-submit lay-filter="data-reset-btn">重置
31
+ <button type="submit" class="layui-btn layui-btn-primary" lay-submit lay-filter="monthly_plan_reset">重置
46
32
  </button>
47
- <button type="submit" class="layui-btn layui-btn-primary" lay-submit lay-filter="data-search-btn">检索
33
+ <button type="submit" class="layui-btn layui-btn-primary" lay-submit lay-filter="monthly_plan_search">检索
48
34
  </button>
49
35
  </div>
50
36
  </div>
51
37
  </form>
52
38
  <table class="layui-hide" id="monthlyTable" lay-filter="currentTableFilter4"></table>
53
-
54
- <script type="text/html" id="currentTableBar">
39
+ </div>
40
+ <script type="text/html" id="monthlyTableBar">
55
41
  <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="show">查看</a>
56
42
  <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="edit">编辑</a>
43
+ <%# if can? :audit, EducodeSales::SaleReport %>
44
+ <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="audit">审查</a>
45
+ <%# end %>
57
46
  <a class="layui-btn layui-btn-xs layui-btn-danger data-count-delete" lay-event="delete">删除</a>
58
47
  </script>
59
48
 
@@ -63,12 +52,23 @@
63
52
  var $ = layui.jquery,
64
53
  form = layui.form,
65
54
  table = layui.table,
55
+ laydate = layui.laydate,
56
+ request = layui.request,
66
57
  rate = layui.rate,
67
58
  miniPage = layui.miniPage;
68
59
 
60
+ laydate.render({
61
+ elem: '#monthly_year',
62
+ type: 'year'
63
+ });
64
+ laydate.render({
65
+ elem: '#monthly_month',
66
+ type: 'month'
67
+ });
68
+
69
69
  table.render({
70
70
  elem: '#monthlyTable',
71
- // url: 'api/table.json',
71
+ url: '/educode_sales/operation_reports?clazz=month',
72
72
  toolbar: '#monthlyToolbar',
73
73
  defaultToolbar: [],
74
74
  cols: [
@@ -79,116 +79,119 @@
79
79
  title: '序号'
80
80
  },
81
81
  {
82
- field: 'username',
82
+ field: 'staff',
83
83
  width: 100,
84
84
  title: '姓名'
85
85
  },
86
86
  {
87
- field: 'rate',
87
+ field: 'finish_rate',
88
88
  width: 100,
89
89
  title: '完成率',
90
90
  },
91
91
  {
92
- field: 'customer',
92
+ field: 'client',
93
93
  width: 100,
94
94
  title: '运营教师'
95
95
  },
96
96
  {
97
- field: 'sumUp',
97
+ field: 'content',
98
98
  width: 300,
99
99
  title: '个人总结',
100
100
  },
101
101
  {
102
- field: 'area',
102
+ field: 'level1_score',
103
103
  width: 180,
104
104
  title: '大区',
105
105
  templet: function (d) {
106
- return '<div id="star4"></div>'
106
+ return '<div class="star1"></div>'
107
107
  }
108
108
  },
109
109
  {
110
- field: 'zong',
110
+ field: 'level2_score',
111
111
  width: 180,
112
112
  title: '总监',
113
113
  templet: function (d) {
114
- return '<div id="star5"></div>'
114
+ return '<div class="star2"></div>'
115
115
  }
116
116
  },
117
117
  {
118
- field: 'fu',
118
+ field: 'level3_score',
119
119
  width: 180,
120
120
  title: '副总',
121
121
  templet: function (d) {
122
- return '<div id="star6"></div>'
122
+ return '<div class="star3"></div>'
123
123
  }
124
124
  },
125
125
  {
126
126
  title: '操作',
127
127
  minWidth: 350,
128
- toolbar: '#currentTableBar',
128
+ toolbar: '#monthlyTableBar',
129
129
  align: "center",
130
130
  fixed: 'right'
131
131
  }
132
132
  ]
133
- ], done: function (res) {
134
- //星级
135
- rate.render({//循环设置评分
136
- elem: '#star4'//给不同的id的rate绑定不同的值
137
- , length: 5 //星星个数
138
- , half: true //支持半颗星
139
- , readonly: true //只读
140
- });
141
- rate.render({//循环设置评分
142
- elem: '#star5'//给不同的id的rate绑定不同的值
143
- , length: 5 //星星个数
144
- , half: true //支持半颗星
145
- , readonly: true //只读
146
- });
147
- rate.render({//循环设置评分
148
- elem: '#star6'//给不同的id的rate绑定不同的值
149
- , length: 5 //星星个数
150
- , half: true //支持半颗星
151
- , readonly: true //只读
152
- });
153
-
133
+ ], done: function (res) {
134
+ $("#monthly_table_wraper .star1").each(function (i) {
135
+ rate.render({
136
+ elem: this,
137
+ value: res.data[i].level1_score,
138
+ half: true,
139
+ readonly: true
140
+ });
141
+ })
142
+ $("#monthly_table_wraper .star2").each(function (i) {
143
+ rate.render({
144
+ elem: this,
145
+ value: res.data[i].level2_score,
146
+ half: true,
147
+ readonly: true
148
+ });
149
+ })
150
+ $("#monthly_table_wraper .star3").each(function (i) {
151
+ rate.render({
152
+ elem: this,
153
+ value: res.data[i].level3_score,
154
+ half: true,
155
+ readonly: true
156
+ });
157
+ })
154
158
  },
155
- data: [{
156
- "id": "1",
157
- "username": "段小龙",
158
- "rate": "90%",
159
- "customer": "12",
160
- "money": "128",
161
- "sumUp": "院长当面汇报一次",
162
- "area": "※",
163
- "zong": "※",
164
- "fu": "※",
165
- }],
166
- limits: [10, 15, 20, 25, 50, 100],
167
- limit: 15,
168
- page: true,
169
- skin: 'line'
159
+ page: true
170
160
  });
171
161
 
172
- // 监听搜索操作
173
- form.on('submit(data-search-btn)', function (data) {
174
- var result = JSON.stringify(data.field);
175
- layer.alert(result, {
176
- title: '最终的搜索信息'
162
+
163
+ var sort = {}, search = {};
164
+ table.on('sort(monthlyTable)', function(obj) {
165
+ sort.field = obj.field;
166
+ sort.order = obj.type;
167
+ table.reload('monthlyTable', {
168
+ initSort: obj,
169
+ where: {
170
+ sort: sort,
171
+ q: search
172
+ }
177
173
  });
174
+ })
178
175
 
179
- //执行搜索重载
180
- table.reload('currentTableId', {
176
+ // 监听搜索操作
177
+ form.on('submit(monthly_plan_search)', function (data) {
178
+ search = data.field
179
+ table.reload('monthlyTable', {
181
180
  page: {
182
181
  curr: 1
183
182
  },
184
- where: {
185
- searchParams: result
186
- }
183
+ where: {q: search, sort : sort}
187
184
  }, 'data');
188
185
 
189
186
  return false;
190
187
  });
191
188
 
189
+ form.on('submit(monthly_plan_reset)', function(data){
190
+ var field = data.field;
191
+ form.val('monthly_form_filter', {staff_id: '', year: '', month: ''})
192
+ return false;
193
+ });
194
+
192
195
  /**
193
196
  * toolbar事件监听
194
197
  */
@@ -213,10 +216,6 @@
213
216
  $(window).on("resize", function () {
214
217
  layer.full(index);
215
218
  });
216
- } else if (obj.event === 'delete') { // 监听删除操作
217
- var checkStatus = table.checkStatus('currentTableId'),
218
- data = checkStatus.data;
219
- layer.alert(JSON.stringify(data));
220
219
  }
221
220
  });
222
221
 
@@ -229,7 +228,7 @@
229
228
  var data = obj.data;
230
229
  if (obj.event === 'edit') {
231
230
 
232
- var content = miniPage.getHrefContent('/educode_sales/operation_plans/edit_monthly');
231
+ var content = miniPage.getHrefContent('/educode_sales/operation_reports/' + data.id + "/edit");
233
232
  var openWH = miniPage.getOpenWidthHeight();
234
233
 
235
234
  var index = layer.open({
@@ -250,17 +249,12 @@
250
249
  layer.full(index);
251
250
  });
252
251
  return false;
253
- } else if (obj.event === 'delete') {
254
- layer.confirm('真的删除行么', function (index) {
255
- obj.del();
256
- layer.close(index);
257
- });
258
- } else if (obj.event === 'show') {
252
+ }else if (obj.event === 'show') {
259
253
 
260
- content = miniPage.getHrefContent('/educode_sales/operation_plans/show_monthly');
254
+ content = miniPage.getHrefContent('/educode_sales/operation_reports/' + data.id);
261
255
  openWH = miniPage.getOpenWidthHeight();
262
256
  index = layer.open({
263
- title: '编辑用户',
257
+ title: '查看',
264
258
  type: 1,
265
259
  shade: 0.2,
266
260
  maxmin: true,
@@ -278,6 +272,33 @@
278
272
  });
279
273
  return false;
280
274
  }
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("monthlyTable")
280
+ })
281
+ });
282
+ }else if (obj.event === 'audit') {
283
+ content = miniPage.getHrefContent('/educode_sales/operation_reports/' + data.id + "/audit");
284
+ openWH = miniPage.getOpenWidthHeight();
285
+ from_source = 'monthly';
286
+ report_id = data.id;
287
+ sindex = layer.open({
288
+ title: '审查'+ data.staff +'的月报',
289
+ type: 1,
290
+ shade: 0.2,
291
+ maxmin: true,
292
+ shadeClose: true,
293
+ area: [openWH[0] + 'px', openWH[1] + 'px'],
294
+ offset: [openWH[2] + 'px', openWH[3] + 'px'],
295
+ content: content,
296
+ });
297
+ $(window).on("resize", function () {
298
+ layer.full(sindex);
299
+ });
300
+ return false;
301
+ }
281
302
  });
282
303
 
283
304
  });