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
@@ -13,8 +13,9 @@ json.data do
13
13
  json.reception_at d.last_follow_up&.reception_at.to_s
14
14
  json.total_amount d.last_follow_up&.total_amount
15
15
  json.return_money d.return_money
16
- json.place d.place&.name
16
+ json.place d.last_follow_up&.place&.name
17
17
  end
18
18
  end
19
19
  json.code 0
20
+ json.count @business_count
20
21
  json.msg 'succcess'
@@ -3,7 +3,7 @@
3
3
  <div class="layui-inline">
4
4
  <label class="layui-form-label required">名称</label>
5
5
  <div class="layui-input-block">
6
- <input type="text" name="name" autocomplete="off" lay-verify="required" class="layui-input" style="width: 240px;">
6
+ <input type="text" name="name" autocomplete="off" lay-verify="required" class="layui-input" style="width: 300px;">
7
7
  </div>
8
8
  </div>
9
9
  <div class="layui-inline">
@@ -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>
@@ -1,5 +1,5 @@
1
1
  <h1 class="text-center m-t-20"><%= @follow_up.business.name %></h1>
2
- <div class="layui-form form-value">
2
+ <form class="layui-form form-value">
3
3
  <div class="layui-form-item" style="padding: 25px">
4
4
  <div class="layui-inline">
5
5
  <label class="layui-form-label">单位:</label>
@@ -1,7 +1,7 @@
1
1
  json.data do
2
2
  json.array! @users do |d|
3
3
  json.value d.id
4
- json.name "#{d.real_name}--(#{d.login})"
4
+ json.name "#{d.real_name}--(#{d.mail}-#{d.phone}-#{d.login})"
5
5
  end
6
6
  end
7
7
  json.code 0
@@ -1,64 +1,57 @@
1
1
  <script type="text/html" id="monthPlanToolbar">
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_month_table_wraper">
11
+ <form class="layui-form layui-form-pane" lay-filter="month_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), { id: 'month_plan_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="month_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="month_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="month_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="month_plan_seach_btn">检索
48
35
  </button>
49
36
  </div>
50
37
  </div>
51
38
  </form>
52
39
  <table class="layui-hide" id="monthPlanTable" lay-filter="currentTableFilter3"></table>
53
-
40
+ </div>
54
41
  <script type="text/html" id="currentTableBar">
55
- <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="edit">查看</a>
42
+ <% if can? :read, EducodeSales::OperationPlan %>
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 %>
56
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 %>
57
49
  <a class="layui-btn layui-btn-xs layui-btn-danger data-count-delete" lay-event="delete">删除</a>
50
+ <% end %>
58
51
  </script>
59
52
 
60
- <script type="text/html" id="show_follow">
61
- <a href="javascript:void(0);" lay-event="show_follow" class="layui-table-link">{{ d.follow }}</a>
53
+ <script type="text/html" id="show_follow2">
54
+ <a href="javascript:void(0);" lay-event="show_follow2" class="layui-table-link">{{ d.count }}</a>
62
55
  </script>
63
56
 
64
57
  <script>
@@ -66,11 +59,23 @@
66
59
  var $ = layui.jquery,
67
60
  form = layui.form,
68
61
  table = layui.table,
62
+ laydate = layui.laydate,
63
+ request = layui.request,
69
64
  miniPage = layui.miniPage;
70
65
 
66
+
67
+ laydate.render({
68
+ elem: '#month_plan_year',
69
+ type: 'year'
70
+ });
71
+ laydate.render({
72
+ elem: '#month_plan_month',
73
+ type: 'month'
74
+ });
75
+
71
76
  table.render({
72
77
  elem: '#monthPlanTable',
73
- // url: 'api/table.json',
78
+ url: '/educode_sales/operation_plans?clazz=month',
74
79
  toolbar: '#monthPlanToolbar',
75
80
  defaultToolbar: [],
76
81
  cols: [
@@ -81,35 +86,35 @@
81
86
  title: '序号'
82
87
  },
83
88
  {
84
- field: 'username',
89
+ field: 'staff',
85
90
  width: 100,
86
91
  title: '姓名'
87
92
  },
88
93
  {
89
- field: 'chance',
94
+ field: 'teacher_name',
90
95
  width: 100,
91
- title: '教师名称',
96
+ title: '教师姓名',
92
97
  },
93
98
  {
94
- field: 'company',
95
- width: 100,
99
+ field: 'school',
100
+ width: 190,
96
101
  title: '单位'
97
102
  },
98
103
  {
99
- field: 'dep',
100
- width: 100,
104
+ field: 'department',
105
+ width: 190,
101
106
  title: '部门'
102
107
  },
103
108
  {
104
- field: 'plan',
109
+ field: 'content',
105
110
  width: 400,
106
111
  title: '计划内容',
107
112
  },
108
113
  {
109
- field: 'follow',
114
+ field: 'count',
110
115
  width: 100,
111
116
  title: '跟进',
112
- templet: '#show_follow'
117
+ templet: '#show_follow2'
113
118
  },
114
119
  {
115
120
  field: 'rate',
@@ -117,7 +122,7 @@
117
122
  title: '完成率',
118
123
  },
119
124
  {
120
- field: 'updateTime',
125
+ field: 'updated_at',
121
126
  width: 150,
122
127
  title: '更新时间',
123
128
  sort: true,
@@ -131,51 +136,53 @@
131
136
  }
132
137
  ]
133
138
  ],
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
139
  limits: [10, 15, 20, 25, 50, 100],
146
140
  limit: 15,
147
141
  page: true,
148
142
  skin: 'line'
149
143
  });
150
144
 
151
- // 监听搜索操作
152
- form.on('submit(data-search-btn)', function (data) {
153
- var result = JSON.stringify(data.field);
154
- layer.alert(result, {
155
- title: '最终的搜索信息'
145
+ var sort = {}, search = {};
146
+ table.on('sort(monthPlanTable)', function(obj) {
147
+ sort.field = obj.field;
148
+ sort.order = obj.type;
149
+ table.reload('monthPlanTable', {
150
+ initSort: obj,
151
+ where: {
152
+ sort: sort,
153
+ q: search
154
+ }
156
155
  });
156
+ })
157
157
 
158
- //执行搜索重载
159
- table.reload('currentTableId', {
158
+ // 监听搜索操作
159
+ form.on('submit(month_plan_seach_btn)', function (data) {
160
+ search = data.field
161
+ table.reload('monthPlanTable', {
160
162
  page: {
161
163
  curr: 1
162
164
  },
163
- where: {
164
- searchParams: result
165
- }
165
+ where: {q: search, sort : sort}
166
166
  }, 'data');
167
167
 
168
168
  return false;
169
169
  });
170
170
 
171
+ form.on('submit(month_plan_reset)', function(data){
172
+ var field = data.field;
173
+ form.val('month_plan_form_filter', {staff_id: '', year: '', month: ''})
174
+ return false;
175
+ });
176
+
171
177
  /**
172
178
  * toolbar事件监听
173
179
  */
174
180
  table.on('toolbar(currentTableFilter3)', function (obj) {
175
181
  if (obj.event === 'add') { // 监听添加操作
182
+ console.log("a");
176
183
  var content = miniPage.getHrefContent('/educode_sales/operation_plans/new_month');
177
184
  var openWH = miniPage.getOpenWidthHeight();
178
- var index = layer.open({
185
+ monthPlanIndex = layer.open({
179
186
  title: '添加计划',
180
187
  type: 1,
181
188
  shade: 0.2,
@@ -192,29 +199,23 @@
192
199
  $(window).on("resize", function () {
193
200
  layer.full(index);
194
201
  });
195
- } else if (obj.event === 'delete') { // 监听删除操作
196
- var checkStatus = table.checkStatus('currentTableId'),
197
- data = checkStatus.data;
198
- layer.alert(JSON.stringify(data));
199
202
  }
200
203
  });
201
204
 
202
- //监听表格复选框选择
203
- table.on('checkbox(currentTableFilter3)', function (obj) {
204
- console.log(obj)
205
- });
206
205
 
207
206
  table.on('tool(currentTableFilter3)', function (obj) {
208
-
209
207
  var data = obj.data;
210
- var id = data.id;
211
208
  if (obj.event === 'delete') {
212
- layer.confirm('真的删除行么', function (index) {
213
- obj.del();
214
- layer.close(index);
209
+ layer.confirm('确定删除' + data.id, function (index) {
210
+ console.log("aaaaa");
211
+ request.delete('educode_sales/operation_plans/' + data.id, {}, function (res) {
212
+ layer.close(index);
213
+ table.reload("monthPlanTable")
214
+ })
215
215
  });
216
- } else if (obj.event === 'show') {
217
- content = miniPage.getHrefContent('/educode_sales/operation_plans/show_month');
216
+ }
217
+ else if (obj.event === 'show') {
218
+ content = miniPage.getHrefContent('/educode_sales/operation_plans/show_week?id='+ data.id);
218
219
  openWH = miniPage.getOpenWidthHeight();
219
220
  index = layer.open({
220
221
  title: '查看',
@@ -226,10 +227,6 @@
226
227
  offset: [openWH[2] + 'px', openWH[3] + 'px'],
227
228
  content: content,
228
229
  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
230
  form.render('select');
234
231
  },
235
232
  });
@@ -238,9 +235,9 @@
238
235
  });
239
236
  return false;
240
237
  } else if (obj.event === 'edit') {
241
- content = miniPage.getHrefContent('/educode_sales/operation_plans/edit_month');
238
+ content = miniPage.getHrefContent('/educode_sales/operation_plans/edit_month?id='+data.id);
242
239
  openWH = miniPage.getOpenWidthHeight();
243
- index = layer.open({
240
+ indexOfmonthPlan = layer.open({
244
241
  title: '编辑',
245
242
  type: 1,
246
243
  shade: 0.2,
@@ -250,10 +247,6 @@
250
247
  offset: [openWH[2] + 'px', openWH[3] + 'px'],
251
248
  content: content,
252
249
  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
250
  form.render('select');
258
251
  },
259
252
  });
@@ -261,11 +254,12 @@
261
254
  layer.full(index);
262
255
  });
263
256
  return false;
264
- } else if (obj.event === 'show_follow') {
265
- content = miniPage.getHrefContent('/educode_sales/businesses/show_follow');
257
+ } else if (obj.event === 'show_follow2') {
258
+ id = data.teacher_id
259
+ content = miniPage.getHrefContent('/educode_sales/teachers/show_follow?id=' + data.teacher_id);
266
260
  openWH = miniPage.getOpenWidthHeight();
267
261
  index = layer.open({
268
- title: 'xxxx/跟进记录',
262
+ title: data.teacher_name + '/跟进记录',
269
263
  type: 1,
270
264
  shade: 0.2,
271
265
  maxmin: true,
@@ -1,60 +1,57 @@
1
1
  <script type="text/html" id="monthlyToolbar">
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_monthly_table_wraper">
11
+
12
+ <form class="layui-form layui-form-pane" lay-filter="monthly_form_filter">
9
13
  <div class="layui-form-item">
10
14
  <div class="layui-inline">
11
15
  <label class="layui-form-label">人员</label>
12
16
  <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>
17
+ <%= select_tag "staff_id", options_for_select(@staffs), { id: 'weekly_staff_id', include_blank: true} %>
20
18
  </div>
21
19
  </div>
22
20
  <div class="layui-inline">
23
21
  <label class="layui-form-label">年度</label>
24
22
  <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>
23
+ <input type="text" class="layui-input" id="monthly_year" autocomplete="off" name="year">
31
24
  </div>
32
25
  </div>
33
26
  <div class="layui-inline">
34
27
  <label class="layui-form-label">月份</label>
35
28
  <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>
29
+ <input type="text" class="layui-input" id="monthly_month" autocomplete="off" name="month">
42
30
  </div>
43
31
  </div>
44
32
  <div class="layui-inline">
45
- <button type="submit" class="layui-btn layui-btn-primary" lay-submit lay-filter="data-reset-btn">重置
33
+ <button type="submit" class="layui-btn layui-btn-primary" lay-submit lay-filter="monthly_plan_reset">重置
46
34
  </button>
47
- <button type="submit" class="layui-btn layui-btn-primary" lay-submit lay-filter="data-search-btn">检索
35
+ <button type="submit" class="layui-btn layui-btn-primary" lay-submit lay-filter="monthly_plan_search">检索
48
36
  </button>
49
37
  </div>
50
38
  </div>
51
39
  </form>
52
40
  <table class="layui-hide" id="monthlyTable" lay-filter="currentTableFilter4"></table>
53
-
54
- <script type="text/html" id="currentTableBar">
41
+ </div>
42
+ <script type="text/html" id="monthlyTableBar">
43
+ <% if can? :read, EducodeSales::OperationPlan %>
55
44
  <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="show">查看</a>
45
+ <% end %>
46
+ <% if can? :create, EducodeSales::OperationPlan %>
56
47
  <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="edit">编辑</a>
48
+ <% end %>
49
+ <% if can? :audit, EducodeSales::OperationReport %>
50
+ <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="audit">审查</a>
51
+ <% end %>
52
+ <% if can? :destroy, EducodeSales::OperationPlan %>
57
53
  <a class="layui-btn layui-btn-xs layui-btn-danger data-count-delete" lay-event="delete">删除</a>
54
+ <% end %>
58
55
  </script>
59
56
 
60
57
 
@@ -63,12 +60,23 @@
63
60
  var $ = layui.jquery,
64
61
  form = layui.form,
65
62
  table = layui.table,
63
+ laydate = layui.laydate,
64
+ request = layui.request,
66
65
  rate = layui.rate,
67
66
  miniPage = layui.miniPage;
68
67
 
68
+ laydate.render({
69
+ elem: '#monthly_year',
70
+ type: 'year'
71
+ });
72
+ laydate.render({
73
+ elem: '#monthly_month',
74
+ type: 'month'
75
+ });
76
+
69
77
  table.render({
70
78
  elem: '#monthlyTable',
71
- // url: 'api/table.json',
79
+ url: '/educode_sales/operation_reports?clazz=month',
72
80
  toolbar: '#monthlyToolbar',
73
81
  defaultToolbar: [],
74
82
  cols: [
@@ -79,116 +87,119 @@
79
87
  title: '序号'
80
88
  },
81
89
  {
82
- field: 'username',
90
+ field: 'staff',
83
91
  width: 100,
84
92
  title: '姓名'
85
93
  },
86
94
  {
87
- field: 'rate',
95
+ field: 'finish_rate',
88
96
  width: 100,
89
97
  title: '完成率',
90
98
  },
91
99
  {
92
- field: 'customer',
100
+ field: 'client',
93
101
  width: 100,
94
102
  title: '运营教师'
95
103
  },
96
104
  {
97
- field: 'sumUp',
105
+ field: 'content',
98
106
  width: 300,
99
107
  title: '个人总结',
100
108
  },
101
109
  {
102
- field: 'area',
110
+ field: 'level1_score',
103
111
  width: 180,
104
112
  title: '大区',
105
113
  templet: function (d) {
106
- return '<div id="star4"></div>'
114
+ return '<div class="star1"></div>'
107
115
  }
108
116
  },
109
117
  {
110
- field: 'zong',
118
+ field: 'level2_score',
111
119
  width: 180,
112
120
  title: '总监',
113
121
  templet: function (d) {
114
- return '<div id="star5"></div>'
122
+ return '<div class="star2"></div>'
115
123
  }
116
124
  },
117
125
  {
118
- field: 'fu',
126
+ field: 'level3_score',
119
127
  width: 180,
120
128
  title: '副总',
121
129
  templet: function (d) {
122
- return '<div id="star6"></div>'
130
+ return '<div class="star3"></div>'
123
131
  }
124
132
  },
125
133
  {
126
134
  title: '操作',
127
135
  minWidth: 350,
128
- toolbar: '#currentTableBar',
136
+ toolbar: '#monthlyTableBar',
129
137
  align: "center",
130
138
  fixed: 'right'
131
139
  }
132
140
  ]
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
-
141
+ ], done: function (res) {
142
+ $("#o_monthly_table_wraper .star1").each(function (i) {
143
+ rate.render({
144
+ elem: this,
145
+ value: res.data[i].level1_score,
146
+ half: true,
147
+ readonly: true
148
+ });
149
+ })
150
+ $("#o_monthly_table_wraper .star2").each(function (i) {
151
+ rate.render({
152
+ elem: this,
153
+ value: res.data[i].level2_score,
154
+ half: true,
155
+ readonly: true
156
+ });
157
+ })
158
+ $("#o_monthly_table_wraper .star3").each(function (i) {
159
+ rate.render({
160
+ elem: this,
161
+ value: res.data[i].level3_score,
162
+ half: true,
163
+ readonly: true
164
+ });
165
+ })
154
166
  },
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'
167
+ page: true
170
168
  });
171
169
 
172
- // 监听搜索操作
173
- form.on('submit(data-search-btn)', function (data) {
174
- var result = JSON.stringify(data.field);
175
- layer.alert(result, {
176
- title: '最终的搜索信息'
170
+
171
+ var sort = {}, search = {};
172
+ table.on('sort(monthlyTable)', function(obj) {
173
+ sort.field = obj.field;
174
+ sort.order = obj.type;
175
+ table.reload('monthlyTable', {
176
+ initSort: obj,
177
+ where: {
178
+ sort: sort,
179
+ q: search
180
+ }
177
181
  });
182
+ })
178
183
 
179
- //执行搜索重载
180
- table.reload('currentTableId', {
184
+ // 监听搜索操作
185
+ form.on('submit(monthly_plan_search)', function (data) {
186
+ search = data.field
187
+ table.reload('monthlyTable', {
181
188
  page: {
182
189
  curr: 1
183
190
  },
184
- where: {
185
- searchParams: result
186
- }
191
+ where: {q: search, sort : sort}
187
192
  }, 'data');
188
193
 
189
194
  return false;
190
195
  });
191
196
 
197
+ form.on('submit(monthly_plan_reset)', function(data){
198
+ var field = data.field;
199
+ form.val('monthly_form_filter', {staff_id: '', year: '', month: ''})
200
+ return false;
201
+ });
202
+
192
203
  /**
193
204
  * toolbar事件监听
194
205
  */
@@ -213,10 +224,6 @@
213
224
  $(window).on("resize", function () {
214
225
  layer.full(index);
215
226
  });
216
- } else if (obj.event === 'delete') { // 监听删除操作
217
- var checkStatus = table.checkStatus('currentTableId'),
218
- data = checkStatus.data;
219
- layer.alert(JSON.stringify(data));
220
227
  }
221
228
  });
222
229
 
@@ -229,11 +236,11 @@
229
236
  var data = obj.data;
230
237
  if (obj.event === 'edit') {
231
238
 
232
- var content = miniPage.getHrefContent('/educode_sales/operation_plans/edit_monthly');
239
+ var content = miniPage.getHrefContent('/educode_sales/operation_reports/' + data.id + '/edit');
233
240
  var openWH = miniPage.getOpenWidthHeight();
234
241
 
235
- var index = layer.open({
236
- title: '编辑用户',
242
+ MonthlyIndex = layer.open({
243
+ title: '编辑',
237
244
  type: 1,
238
245
  shade: 0.2,
239
246
  maxmin: true,
@@ -250,17 +257,12 @@
250
257
  layer.full(index);
251
258
  });
252
259
  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') {
260
+ }else if (obj.event === 'show') {
259
261
 
260
- content = miniPage.getHrefContent('/educode_sales/operation_plans/show_monthly');
262
+ content = miniPage.getHrefContent('/educode_sales/operation_reports/' + data.id);
261
263
  openWH = miniPage.getOpenWidthHeight();
262
264
  index = layer.open({
263
- title: '编辑用户',
265
+ title: '查看',
264
266
  type: 1,
265
267
  shade: 0.2,
266
268
  maxmin: true,
@@ -278,6 +280,33 @@
278
280
  });
279
281
  return false;
280
282
  }
283
+ else if (obj.event === 'delete') {
284
+ layer.confirm('确定删除' + data.id, function (index) {
285
+ request.delete('educode_sales/operation_reports/' + data.id, {}, function (res) {
286
+ layer.close(index);
287
+ table.reload("monthlyTable")
288
+ })
289
+ });
290
+ }else if (obj.event === 'audit') {
291
+ content = miniPage.getHrefContent('/educode_sales/operation_reports/' + data.id + "/audit");
292
+ openWH = miniPage.getOpenWidthHeight();
293
+ from_source = 'monthly';
294
+ report_id = data.id;
295
+ sindex = layer.open({
296
+ title: '审查'+ data.staff +'的月报',
297
+ type: 1,
298
+ shade: 0.2,
299
+ maxmin: true,
300
+ shadeClose: true,
301
+ area: [openWH[0] + 'px', openWH[1] + 'px'],
302
+ offset: [openWH[2] + 'px', openWH[3] + 'px'],
303
+ content: content,
304
+ });
305
+ $(window).on("resize", function () {
306
+ layer.full(sindex);
307
+ });
308
+ return false;
309
+ }
281
310
  });
282
311
 
283
312
  });