educode_sales 0.5.8 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/educode_sales//345/256/242/346/210/267/347/256/241/347/220/206.png +0 -0
  3. data/app/controllers/educode_sales/businesses_controller.rb +4 -2
  4. data/app/controllers/educode_sales/customer_extensions_controller.rb +17 -0
  5. data/app/controllers/educode_sales/customer_follows_controller.rb +41 -0
  6. data/app/controllers/educode_sales/customers_controller.rb +204 -0
  7. data/app/controllers/educode_sales/places_controller.rb +5 -1
  8. data/app/controllers/educode_sales/roles_controller.rb +4 -1
  9. data/app/controllers/educode_sales/sale_trends_controller.rb +16 -1
  10. data/app/controllers/educode_sales/teachers_controller.rb +13 -2
  11. data/app/models/educode_sales/customer.rb +4 -0
  12. data/app/models/educode_sales/customer_extension.rb +7 -0
  13. data/app/models/educode_sales/customer_follow.rb +5 -0
  14. data/app/models/educode_sales/permission.rb +3 -2
  15. data/app/models/educode_sales/role_area.rb +1 -0
  16. data/app/views/educode_sales/businesses/_follows.html.erb +10 -4
  17. data/app/views/educode_sales/businesses/edit_follow_record.html.erb +2 -2
  18. data/app/views/educode_sales/businesses/index.html.erb +25 -18
  19. data/app/views/educode_sales/businesses/index.json.jbuilder +1 -0
  20. data/app/views/educode_sales/businesses/new.html.erb +3 -0
  21. data/app/views/educode_sales/businesses/new_follow_record.html.erb +2 -2
  22. data/app/views/educode_sales/businesses/show_follow.html.erb +7 -2
  23. data/app/views/educode_sales/businesses/show_follow.json.jbuilder +1 -0
  24. data/app/views/educode_sales/businesses/time_line.html.erb +1 -1
  25. data/app/views/educode_sales/customers/edit.html.erb +94 -0
  26. data/app/views/educode_sales/customers/edit_department.html.erb +54 -0
  27. data/app/views/educode_sales/customers/edit_follow_record.html.erb +50 -0
  28. data/app/views/educode_sales/customers/give.html.erb +51 -0
  29. data/app/views/educode_sales/customers/index.html.erb +493 -0
  30. data/app/views/educode_sales/customers/index.json.jbuilder +24 -0
  31. data/app/views/educode_sales/customers/new.html.erb +96 -0
  32. data/app/views/educode_sales/customers/new_department.html.erb +56 -0
  33. data/app/views/educode_sales/customers/new_follow_record.html.erb +54 -0
  34. data/app/views/educode_sales/customers/show_department.json.jbuilder +13 -0
  35. data/app/views/educode_sales/customers/show_follow.html.erb +442 -0
  36. data/app/views/educode_sales/customers/show_follow.json.jbuilder +13 -0
  37. data/app/views/educode_sales/customers/show_follow_record.html.erb +18 -0
  38. data/app/views/educode_sales/follow_ups/index.json.jbuilder +1 -0
  39. data/app/views/educode_sales/places/index.html.erb +64 -0
  40. data/app/views/educode_sales/places/index.json.jbuilder +1 -1
  41. data/app/views/educode_sales/roles/edit.html.erb +9 -1
  42. data/app/views/educode_sales/sale_trends/trends.html.erb +20 -0
  43. data/app/views/educode_sales/sales/index.html.erb +63 -21
  44. data/app/views/educode_sales/sales/index.json.jbuilder +32 -5
  45. data/app/views/educode_sales/teachers/index.html.erb +4 -11
  46. data/app/views/educode_sales/teachers/index.json.jbuilder +3 -3
  47. data/app/views/educode_sales/teachers/show_follow.html.erb +10 -5
  48. data/app/views/educode_sales/teachers/show_follow.json.jbuilder +1 -0
  49. data/app/views/layouts/educode_sales/application.html.erb +8 -1
  50. data/config/routes.rb +25 -0
  51. data/db/migrate/20210902064109_create_educode_sales_role_permissions.rb +15 -0
  52. data/db/migrate/20211214100803_create_customer_extensions.rb +9 -0
  53. data/db/migrate/20211215025029_create_educode_sales_customer_follows.rb +12 -0
  54. data/db/migrate/20211220102720_add_position_to_commons.rb +12 -0
  55. data/db/migrate/20211221075146_add_school_id_to_educode_sales_businesses.rb +8 -0
  56. data/lib/educode_sales/version.rb +1 -1
  57. metadata +26 -2
@@ -0,0 +1,493 @@
1
+ <div style="margin: 10px 10px 10px 10px">
2
+ <form class="layui-form layui-form-pane" lay-filter="search_teachers">
3
+ <div class="layui-form-item">
4
+ <div class="layui-inline">
5
+ <label class="layui-form-label">客户名称</label>
6
+ <div class="layui-input-inline">
7
+ <input type="text" name="name" autocomplete="off" class="layui-input">
8
+ </div>
9
+ </div>
10
+ <div class="layui-inline">
11
+ <label class="layui-form-label">区域</label>
12
+ <div class="layui-input-inline">
13
+ <%= select_tag "area", options_for_select(EducodeSales::Common.where(clazz: 'area').pluck(:name)), { include_blank: true } %>
14
+ </div>
15
+ </div>
16
+ <div class="layui-inline">
17
+ <label class="layui-form-label">负责人</label>
18
+ <div class="layui-input-inline">
19
+ <%= select_tag "staff_id", options_for_select(@staffs,params[:staff_id]), { include_blank: true } %>
20
+ </div>
21
+ </div>
22
+ <div class="layui-inline">
23
+ <label class="layui-form-label">最后跟进</label>
24
+ <div class="layui-input-inline">
25
+ <input type="text" class="layui-input" id="date" name="date" placeholder=" - ">
26
+ </div>
27
+ </div>
28
+
29
+ <div class="layui-inline">
30
+ <button type="reset" class="layui-btn layui-btn-primary" lay-submit lay-filter="reset_business_search">重置
31
+ </button>
32
+ <button type="submit" class="layui-btn layui-btn-primary" id="search_bt" lay-submit lay-filter="search_teachers">搜 索
33
+ </button>
34
+ </div>
35
+ </div>
36
+ </form>
37
+ </div>
38
+
39
+ <script type="text/html" id="toolbarDemo">
40
+ <div class="layui-btn-container">
41
+ <span class="table-label">客户列表</span>
42
+ <% if can? :create, EducodeSales::Customer %>
43
+ <button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn pull-right" lay-event="add">添加客户</button>
44
+ <% end %>
45
+ <% if can? :give, EducodeSales::Customer %>
46
+ <button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn pull-right" lay-event="give">分配/移交</button>
47
+ <% end %>
48
+ </button>
49
+ </div>
50
+ </script>
51
+ <div class="">
52
+ <table class="layui-hide" id="customers_table" style="min-height: 300px;" lay-filter="customers_table"></table>
53
+ </div>
54
+ <script type="text/html" id="currentTableBar">
55
+ <% if can? :create_department, EducodeSales::Customer %>
56
+ <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="add_department">添加部门</a>
57
+ <% end %>
58
+ <% if can? :create_follow, EducodeSales::Customer %>
59
+ <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="add_follow">添加跟进记录</a>
60
+ <% end %>
61
+ <% if can? :update, EducodeSales::Customer %>
62
+ <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="edit">编辑</a>
63
+ <% end %>
64
+ </script>
65
+ <script type="text/html" id="business">
66
+ <a href="/missions/businesses?school={{d.name}}" class="layui-table-link">{{ d.business }}</a>
67
+ </script>
68
+ <script type="text/html" id="name">
69
+ <a href="<%= base_url%>/colleges/{{d.id}}/statistics" class="layui-table-link" target="_blank">{{ d.name }}</a>
70
+ </script>
71
+ <script type="text/html" id="department">
72
+ <a href="javascript:void(0);" lay-event="department" class="layui-table-link">{{ d.department }}</a>
73
+ </script>
74
+ <script type="text/html" id="follow">
75
+ <a href="javascript:void(0);" lay-event="follow" class="layui-table-link">{{ d.follow }}</a>
76
+ </script>
77
+
78
+
79
+ <script>
80
+ layui.use(['form', 'table', 'miniPage', 'element', 'request', 'laydate'], function () {
81
+ var $ = layui.jquery,
82
+ form = layui.form,
83
+ request = layui.request,
84
+ dropdown = layui.dropdown,
85
+ miniPage = layui.miniPage,
86
+ laydate = layui.laydate;
87
+
88
+ var laydate = layui.laydate;
89
+
90
+ // function hn(){
91
+ // $("#search_bt").trigger("click");
92
+ // }
93
+ // $(document).ready(function(){
94
+ // window.onload=hn;
95
+ // });
96
+
97
+ laydate.render({
98
+ elem: '#date',
99
+ range: true
100
+ });
101
+ laydate.render({
102
+ elem: '#time',
103
+ });
104
+
105
+ table = layui.table;
106
+ table.render({
107
+ elem: '#customers_table',
108
+ url: '/missions/customers',
109
+ where: {q: form.val('search_teachers')},
110
+ toolbar: '#toolbarDemo',
111
+ // totalRow:true,
112
+ defaultToolbar: ['filter'],
113
+ cols: [
114
+ [
115
+ {type: 'checkbox'},
116
+ {
117
+ field: 'id',
118
+ width: 60,
119
+ title: '序号', type: 'numbers',
120
+
121
+ },
122
+ {
123
+ field: 'name',
124
+ title: '客户名称',
125
+ templet: "#name"
126
+ },
127
+ {
128
+ field: 'area',
129
+ width: 100,
130
+ title: '区域',
131
+ },
132
+ {
133
+ field: 'department',
134
+ width: 100,
135
+ title: '二级部门',
136
+ templet: "#department"
137
+ },
138
+ {
139
+ field: 'business',
140
+ width: 60,
141
+ title: '商机',
142
+ templet: "#business"
143
+ },
144
+ {
145
+ field: 'follow',
146
+ width: 100,
147
+ title: '跟进次数',
148
+ templet: "#follow"
149
+ },
150
+ {
151
+ field: 'last_follow_time',
152
+ width: 170,
153
+ title: '最后跟进时间',
154
+ sort: true
155
+ },
156
+ {
157
+ field: 'staff',
158
+ width: 100,
159
+ title: '负责人',
160
+ },
161
+ {
162
+ title: '操作',
163
+ width: 300,
164
+ toolbar: '#currentTableBar',
165
+ align: "center",
166
+ fixed: 'right'
167
+ }
168
+ ]
169
+ ],
170
+
171
+ limit: 20,
172
+ limits: [10,15,20,30,40,50,60,70,80,90],
173
+ page: true,
174
+ });
175
+
176
+ //监听表格复选框选择
177
+ table.on('checkbox(customers_table)', function (obj) {
178
+ });
179
+
180
+
181
+
182
+ function edit(id) {
183
+ var content = miniPage.getHrefContent('/missions/teachers/' + id + '/edit');
184
+ var openWH = miniPage.getOpenWidthHeight();
185
+ sindex = layer.open({
186
+ title: '编辑',
187
+ type: 1,
188
+ shade: 0.2,
189
+ maxmin: true,
190
+ shadeClose: true,
191
+ area: [openWH[0] + 'px', openWH[1] + 'px'],
192
+ offset: [openWH[2] + 'px', openWH[3] + 'px'],
193
+ content: content
194
+ });
195
+ $(window).on("resize", function () {
196
+ layer.full(sindex);
197
+ });
198
+ }
199
+
200
+ function month(id) {
201
+ var content = miniPage.getHrefContent('/missions/operation_plans/new_month?teacher_id=' + id);
202
+ var openWH = miniPage.getOpenWidthHeight();
203
+ teacherindex2 = layer.open({
204
+ title: '添加月计划',
205
+ type: 1,
206
+ shade: 0.2,
207
+ maxmin: true,
208
+ shadeClose: true,
209
+ area: [openWH[0] + 'px', openWH[1] + 'px'],
210
+ offset: [openWH[2] + 'px', openWH[3] + 'px'],
211
+ content: content
212
+ });
213
+ $(window).on("resize", function () {
214
+ layer.full(sindex);
215
+ });
216
+ }
217
+
218
+ function deleteBusiness(id, name) {
219
+ layer.confirm('确定删除' + name, function (index) {
220
+ request.delete('missions/teachers/' + id, {}, function (res) {
221
+ layer.close(index);
222
+ table.reload("customers_table")
223
+ })
224
+ });
225
+ }
226
+
227
+ var sort = {}, search = {};
228
+ table.on('sort(customers_table)', function (obj) {
229
+ sort.field = obj.field;
230
+ sort.order = obj.type;
231
+ table.reload('customers_table', {
232
+ initSort: obj,
233
+ where: {
234
+ sort: sort,
235
+ q: search
236
+ }
237
+ });
238
+ })
239
+
240
+ // 监听搜索操作
241
+ form.on('submit(search_teachers)', function (data) {
242
+ search = data.field
243
+ table.reload('customers_table', {
244
+ page: {
245
+ curr: 1
246
+ },
247
+ where: {q: search, sort: sort}
248
+ }, 'data');
249
+ return false;
250
+ });
251
+
252
+ form.on('submit(reset_business_search)', function (data) {
253
+ var field = data.field;
254
+ form.val('search_teachers', {
255
+ area: "",
256
+ date: "",
257
+ attitude: "",
258
+ name: "",
259
+ professional_title: "",
260
+ regist_at: "",
261
+ staff_id: "",
262
+ status: "",
263
+ school: "",
264
+ assist: "",
265
+ teacher_source: ""
266
+ });
267
+ return false;
268
+ });
269
+ /**
270
+ * toolbar事件监听
271
+ */
272
+ table.on('toolbar(customers_table)', function (obj) {
273
+ if (obj.event === 'add') { // 手动添加
274
+ var content = miniPage.getHrefContent('/missions/customers/new');
275
+ var openWH = miniPage.getOpenWidthHeight();
276
+ index = layer.open({
277
+ title: '添加客户',
278
+ type: 1,
279
+ shade: 0.2,
280
+ maxmin: true,
281
+ shadeClose: true,
282
+ area: [openWH[0] + 'px', openWH[1] + 'px'],
283
+ offset: [openWH[2] + 'px', openWH[3] + 'px'],
284
+ content: content,
285
+ });
286
+ $(window).on("resize", function () {
287
+ layer.full(index);
288
+ });
289
+ }else if (obj.event === 'give') { //
290
+ var school_ids = []
291
+ var checkStatus = table.checkStatus('customers_table')
292
+ ,data = checkStatus.data;
293
+ for (var i=0,len=data.length; i<len; i++){
294
+ school_ids.push(data[i].id)
295
+ }
296
+ ids = school_ids
297
+ if(ids.length == 0){
298
+ layer.msg('请选择客户')
299
+ return
300
+ }
301
+ content = miniPage.getHrefContent('/missions/customers/give');
302
+ openWH = miniPage.getOpenWidthHeight();
303
+ index = layer.open({
304
+ title: '分配/移交',
305
+ type: 1,
306
+ shade: 0.2,
307
+ maxmin: true,
308
+ shadeClose: true,
309
+ area: [openWH[0] + 'px', openWH[1] + 'px'],
310
+ offset: [openWH[2] + 'px', openWH[3] + 'px'],
311
+ content: content,
312
+ });
313
+ $(window).on("resize", function () {
314
+ layer.full(index);
315
+ });
316
+ } else if (obj.event === 'search_new') { // 搜索添加
317
+ content = miniPage.getHrefContent('/missions/teachers/search_new');
318
+ openWH = miniPage.getOpenWidthHeight();
319
+ index = layer.open({
320
+ title: '搜索添加',
321
+ type: 1,
322
+ shade: 0.2,
323
+ maxmin: true,
324
+ shadeClose: true,
325
+ area: [openWH[0] + 'px', openWH[1] + 'px'],
326
+ offset: [openWH[2] + 'px', openWH[3] + 'px'],
327
+ content: content,
328
+ });
329
+ $(window).on("resize", function () {
330
+ layer.full(index);
331
+ });
332
+ }
333
+ });
334
+
335
+
336
+
337
+ table.on('tool(customers_table)', function (obj) {
338
+ var data = obj.data;
339
+ id = data.id
340
+ if (obj.event === 'edit') { // 监听添加操作
341
+ var content = miniPage.getHrefContent('/missions/customers/' + data.id + '/edit');
342
+ var openWH = miniPage.getOpenWidthHeight();
343
+ sale_plan_index = layer.open({
344
+ title: '编辑客户',
345
+ type: 1,
346
+ shade: 0.2,
347
+ maxmin: true,
348
+ shadeClose: true,
349
+ area: [openWH[0] + 'px', openWH[1] + 'px'],
350
+ offset: [openWH[2] + 'px', openWH[3] + 'px'],
351
+ content: content,
352
+ success: function (layero, index) {
353
+ form.render('select');
354
+ }
355
+ });
356
+ $(window).on("resize", function () {
357
+ layer.full(sale_plan_index);
358
+ });
359
+ } else if (obj.event === 'delete') {
360
+ layer.confirm('确定删除' + data.name, function (index) {
361
+ request.delete('missions/teachers/' + data.id, {}, function (res) {
362
+ layer.close(index);
363
+ table.reload("customers_table")
364
+ })
365
+ });
366
+ } else if (obj.event === 'addWeek') {
367
+ var content = miniPage.getHrefContent('/missions/operation_plans/new_week?teacher_id=' + obj.data.id);
368
+ var openWH = miniPage.getOpenWidthHeight();
369
+
370
+ teacherindex1 = layer.open({
371
+ title: '添加周计划',
372
+ type: 1,
373
+ shade: 0.2,
374
+ maxmin: true,
375
+ shadeClose: true,
376
+ area: [openWH[0] + 'px', openWH[1] + 'px'],
377
+ offset: [openWH[2] + 'px', openWH[3] + 'px'],
378
+ content: content
379
+ });
380
+ $(window).on("resize", function () {
381
+ layer.full(sindex);
382
+ });
383
+ } else if (obj.event === 'addMonth') {
384
+ var content = miniPage.getHrefContent('/missions/operation_plans/new_month?teacher_id=' + obj.data.id);
385
+ var openWH = miniPage.getOpenWidthHeight();
386
+ teacherindex2 = layer.open({
387
+ title: '添加月计划',
388
+ type: 1,
389
+ shade: 0.2,
390
+ maxmin: true,
391
+ shadeClose: true,
392
+ area: [openWH[0] + 'px', openWH[1] + 'px'],
393
+ offset: [openWH[2] + 'px', openWH[3] + 'px'],
394
+ content: content
395
+ });
396
+ $(window).on("resize", function () {
397
+ layer.full(sindex);
398
+ });
399
+
400
+ } else if (obj.event === 'courses') {
401
+ teacher_id = data.id
402
+ content = miniPage.getHrefContent('/missions/teachers/add_courses?id='+data.id);
403
+ openWH = miniPage.getOpenWidthHeight();
404
+ index = layer.open({
405
+ title: '课程方向',
406
+ type: 1,
407
+ shade: 0.2,
408
+ maxmin: true,
409
+ shadeClose: true,
410
+ area: [openWH[0] + 'px', openWH[1] + 'px'],
411
+ offset: [openWH[2] + 'px', openWH[3] + 'px'],
412
+ content: content,
413
+ success: function (layero, index) {
414
+ // 重新渲染弹层中的下拉选择框select
415
+ // form.render('select');
416
+ }
417
+ });
418
+ $(window).on("resize", function () {
419
+ layer.full(index);
420
+ });
421
+ } else if (obj.event === 'add_department') {
422
+ school_id = data.id
423
+ var content = miniPage.getHrefContent('/missions/customers/new_department?id=' + data.id);
424
+ var openWH = miniPage.getOpenWidthHeight();
425
+ new_department_index = layer.open({
426
+ title: '添加部门',
427
+ type: 1,
428
+ shade: 0.2,
429
+ maxmin: true,
430
+ shadeClose: true,
431
+ area: [openWH[0] + 'px', openWH[1] + 'px'],
432
+ offset: [openWH[2] + 'px', openWH[3] + 'px'],
433
+ content: content,
434
+ success: function (layero, index) {
435
+ // 重新渲染弹层中的下拉选择框select
436
+ form.render('select');
437
+ }
438
+ });
439
+ $(window).on("resize", function () {
440
+ layer.full(index);
441
+ });
442
+ } else if (obj.event === 'add_follow') { // 监听添加操作
443
+ var content = miniPage.getHrefContent('/missions/customers/new_follow_record?id=' + data.id)
444
+ var openWH = miniPage.getOpenWidthHeight();
445
+ addFollowIndex = layer.open({
446
+ title: '添加跟进记录',
447
+ type: 1,
448
+ shade: 0.2,
449
+ maxmin: true,
450
+ shadeClose: true,
451
+ area: [openWH[0] + 'px', openWH[1] + 'px'],
452
+ offset: [openWH[2] + 'px', openWH[3] + 'px'],
453
+ content: content,
454
+ success: function (layero, index) {
455
+ // 重新渲染弹层中的下拉选择框select
456
+ form.render('select');
457
+ }
458
+ });
459
+ $(window).on("resize", function () {
460
+ layer.full(index);
461
+ });
462
+ } else if (obj.event === 'follow' || obj.event === 'name' ||obj.event === 'department' ) {
463
+ id = data.id
464
+ time = data.last_follow_time || ''
465
+ content = miniPage.getHrefContent('/missions/customers/show_follow?id=' + data.id);
466
+ openWH = miniPage.getOpenWidthHeight();
467
+ index = layer.open({
468
+ title: '客户列表/' + data.name,
469
+ type: 1,
470
+ shade: 0.2,
471
+ maxmin: true,
472
+ shadeClose: true,
473
+ area: [openWH[0] + 'px', openWH[1] + 'px'],
474
+ offset: [openWH[2] + 'px', openWH[3] + 'px'],
475
+ content: content,
476
+ success: function (layero, index) {
477
+ // 重新渲染弹层中的下拉选择框select
478
+ // form.render('select');
479
+ }
480
+ });
481
+ $(window).on("resize", function () {
482
+ layer.full(index);
483
+ });
484
+ }
485
+ });
486
+
487
+ });
488
+ </script>
489
+ <style>
490
+ .layui-table-tool-temp{
491
+ padding-right: 30px; !important;
492
+ }
493
+ </style>
@@ -0,0 +1,24 @@
1
+ json.data do
2
+ json.array! @customers do |d|
3
+ business_ids = EducodeSales::Business.where(school_id: d.id).ids
4
+ follow_ups = EducodeSales::FollowUp.where(business_id: business_ids)
5
+ customer_follows = EducodeSales::CustomerFollow.where(school_id: d.id)
6
+ a_last_follow_time = follow_ups.last&.created_at&.to_s
7
+ b_last_follow_time = customer_follows.last&.created_at&.to_s
8
+ if a_last_follow_time.present? && b_last_follow_time.present?
9
+ json.last_follow_time a_last_follow_time < b_last_follow_time ? b_last_follow_time : a_last_follow_time
10
+ else
11
+ json.last_follow_time a_last_follow_time || b_last_follow_time
12
+ end
13
+ json.id d.id
14
+ json.name d.name
15
+ json.area d.province
16
+ json.department d.departments.size
17
+ json.business business_ids.size
18
+ json.follow follow_ups.size + customer_follows.size
19
+ json.staff EducodeSales::CustomerExtension.find_by(school_id: d.id)&.customer_staff&.user&.real_name
20
+ end
21
+ end
22
+
23
+ json.code 0
24
+ json.count @customers.total_count
@@ -0,0 +1,96 @@
1
+ <form class="layui-form layuimini-form" action="">
2
+ <div class="layui-form-item" style="padding: 25px">
3
+ <div class="layui-inline">
4
+ <label class="layui-form-label required">学校:</label>
5
+ <div class="layui-input-block">
6
+ <input type="text" name="name" lay-verify="required" placeholder="请输入学校" autocomplete="off"
7
+ class="layui-input" id="inputFocus">
8
+ </div>
9
+ </div>
10
+ <br>
11
+ <div class="layui-inline">
12
+ <label class="layui-form-label required">省:</label>
13
+ <div class="layui-input-block">
14
+ <input type="text" name="province" lay-verify="required" autocomplete="off"
15
+ class="layui-input" placeholder="请输入省" >
16
+ </div>
17
+ </div>
18
+ <br>
19
+ <div class="layui-inline">
20
+ <label class="layui-form-label ">市:</label>
21
+ <div class="layui-input-block">
22
+ <input type="text" name="city" autocomplete="off"
23
+ class="layui-input" placeholder="请输入市" >
24
+ </div>
25
+ </div>
26
+ <br>
27
+ <div class="layui-inline">
28
+ <label class="layui-form-label ">地址:</label>
29
+ <div class="layui-input-block">
30
+ <input type="text" name="address" autocomplete="off"
31
+ class="layui-input" placeholder="请输入地址" >
32
+ </div>
33
+ </div>
34
+ <div class="layui-form-item">
35
+ <label class="layui-form-label">学校性质:</label>
36
+ <div class="layui-input-block">
37
+ <input type="checkbox" name="project_985" lay-skin="primary" value="1" title="985工程">
38
+ <input type="checkbox" name="project_211" lay-skin="primary" value="1" title="211工程" >
39
+ <input type="checkbox" name="regular_college" lay-skin="primary" value="1" title="本科院校">
40
+ </div>
41
+ </div>
42
+ <div class="layui-form-item">
43
+ <div class="layui-input-block">
44
+ <input type="checkbox" name="junior_college" lay-skin="primary" value="1" title="大专院校">
45
+ <input type="checkbox" name="secondary_school" lay-skin="primary" value="1" title="中专院校" >
46
+ <input type="checkbox" name="military_school" lay-skin="primary" value="1" title="军事院校">
47
+ </div>
48
+ </div>
49
+ <div class="layui-form-item">
50
+ <div class="layui-input-block">
51
+ <input type="checkbox" name="enterprise" lay-skin="primary" value="1" title="企业">
52
+ </div>
53
+ </div>
54
+ <div class="layui-inline" style="padding-left: 30px">
55
+ <button type="submit" class="layui-btn layui-btn-normal" lay-submit lay-filter="data-reset-btn">提交
56
+ </button>
57
+ </div>
58
+ </div>
59
+ </form>
60
+
61
+
62
+ <script>
63
+ document.getElementById("inputFocus").focus();
64
+
65
+ layui.use(['form', 'table', 'upload', 'laytpl', 'request', 'selectInput', 'transfer'], function () {
66
+ var form = layui.form,
67
+ layer = layui.layer,
68
+ table = layui.table,
69
+ transfer = layui.transfer,
70
+ laytpl = layui.laytpl,
71
+ request = layui.request,
72
+ $ = layui.$;
73
+
74
+ form.render();
75
+
76
+ // 当前弹出层,防止ID被覆盖
77
+ var parentIndex = layer.index;
78
+
79
+
80
+
81
+
82
+ //监听提交
83
+ form.on('submit(data-reset-btn)', function (data) {
84
+ console.log(data.field);
85
+ request.authPost("missions/customers", data.field, function (res) {
86
+ if (res.success === false) {
87
+ layer.alert(res.msg)
88
+ } else {
89
+ layer.closeAll(); //关闭所有层
90
+ parent.table.reload('customers_table')
91
+ }
92
+ })
93
+ return false;
94
+ });
95
+ });
96
+ </script>
@@ -0,0 +1,56 @@
1
+ <div class="layuimini-main">
2
+ <form class="layui-form layuimini-form" action="">
3
+ <div class="layui-form-item" style="padding: 25px">
4
+ <div class="layui-form-item" style="padding: 25px">
5
+ <div class="layui-inline">
6
+ <label class="layui-form-label required">部门名称</label>
7
+ <div class="layui-input-block" style="width: 300px;">
8
+ <input type="text" name="department_name" required lay-verify="required" autocomplete="off" placeholder="请输入"
9
+ class="layui-input" id="inputFocus">
10
+ </div>
11
+ </div>
12
+ </div>
13
+ <div class="layui-form-item" style="padding-left: 130px">
14
+ <button type="submit" class="layui-btn layui-btn-normal" lay-submit lay-filter="data-reset-btn">提交
15
+ </button>
16
+ </div>
17
+ </div>
18
+ </form>
19
+ </div>
20
+
21
+ <script>
22
+
23
+ layui.use(['form', 'table', 'upload', 'laytpl', 'request', 'selectInput', 'transfer'], function () {
24
+ var form = layui.form,
25
+ layer = layui.layer,
26
+ table = layui.table,
27
+ transfer = layui.transfer,
28
+ laytpl = layui.laytpl,
29
+ request = layui.request,
30
+ laydate = layui.laydate,
31
+ $ = layui.$;
32
+
33
+
34
+
35
+ form.render();
36
+
37
+ // 当前弹出层,防止ID被覆盖
38
+ var parentIndex = layer.index;
39
+
40
+
41
+ //监听提交
42
+ form.on('submit(data-reset-btn)', function (data) {
43
+ data.field.school_id = parent.school_id
44
+ request.authPost("missions/customers/"+ parent.school_id +"/create_department", data.field, function (res) {
45
+ if (res.success === false) {
46
+ layer.alert(res.msg)
47
+ } else {
48
+ layer.close(parent.new_department_index); //关闭所有层
49
+ table.reload('sale_plan_follow_table')
50
+ parent.table.reload('customers_table')
51
+ }
52
+ })
53
+ return false;
54
+ });
55
+ });
56
+ </script>