educode_sales 1.10.48 → 1.10.58

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/stylesheets/educode_sales/modules/easyeditor/easyeditor.css +130 -0
  3. data/app/assets/stylesheets/educode_sales/modules/easyeditor/fangge-style.css +4 -0
  4. data/app/controllers/educode_sales/application_controller.rb +22 -0
  5. data/app/controllers/educode_sales/business_courses_controller.rb +255 -0
  6. data/app/controllers/educode_sales/businesses_controller.rb +43 -7
  7. data/app/controllers/educode_sales/contracts_controller.rb +6 -0
  8. data/app/controllers/educode_sales/home_controller.rb +7 -0
  9. data/app/controllers/educode_sales/money_plan_records_controller.rb +6 -2
  10. data/app/controllers/educode_sales/money_plans_controller.rb +3 -0
  11. data/app/controllers/educode_sales/sale_trends_controller.rb +1 -1
  12. data/app/controllers/educode_sales/shixun_dectects_controller.rb +172 -0
  13. data/app/controllers/educode_sales/shixuns_controller.rb +218 -0
  14. data/app/controllers/educode_sales/subject_trends_controller.rb +144 -0
  15. data/app/controllers/educode_sales/subjects_controller.rb +213 -0
  16. data/app/helpers/educode_sales/application_helper.rb +10 -0
  17. data/app/helpers/educode_sales/business_courses_helper.rb +60 -0
  18. data/app/helpers/educode_sales/sale_trends_helper.rb +52 -52
  19. data/app/helpers/educode_sales/subject_helper.rb +33 -0
  20. data/app/models/educode_sales/business.rb +22 -0
  21. data/app/models/educode_sales/business_deliver_subject.rb +49 -0
  22. data/app/models/educode_sales/business_subject.rb +68 -0
  23. data/app/models/educode_sales/business_subject_shixun.rb +75 -0
  24. data/app/models/educode_sales/business_subject_staff.rb +36 -0
  25. data/app/models/educode_sales/permission.rb +2 -1
  26. data/app/models/educode_sales/shixun_dectect.rb +12 -0
  27. data/app/views/educode_sales/business_courses/edit.html.erb +174 -0
  28. data/app/views/educode_sales/business_courses/index.html.erb +334 -0
  29. data/app/views/educode_sales/business_courses/index.json.jbuilder +16 -0
  30. data/app/views/educode_sales/business_courses/list_shixuns.html.erb +292 -0
  31. data/app/views/educode_sales/business_courses/list_shixuns.json.jbuilder +23 -0
  32. data/app/views/educode_sales/business_courses/list_subjects.html.erb +212 -0
  33. data/app/views/educode_sales/business_courses/list_subjects.json.jbuilder +17 -0
  34. data/app/views/educode_sales/business_courses/new.html.erb +237 -0
  35. data/app/views/educode_sales/businesses/index.html.erb +11 -9
  36. data/app/views/educode_sales/contracts/_list.html.erb +16 -1
  37. data/app/views/educode_sales/contracts/index.html.erb +5 -2
  38. data/app/views/educode_sales/contracts/list.js.erb +4 -1
  39. data/app/views/educode_sales/money_plan_records/_index.html.erb +21 -5
  40. data/app/views/educode_sales/money_plan_records/index.js.erb +4 -1
  41. data/app/views/educode_sales/money_plans/list.html.erb +6 -2
  42. data/app/views/educode_sales/sale_trends/_return_money_forecast.html.erb +1 -1
  43. data/app/views/educode_sales/sale_trends/_user_stat.html.erb +1 -1
  44. data/app/views/educode_sales/sale_trends/_visit_analysis.html.erb +1 -1
  45. data/app/views/educode_sales/sale_trends/return_money_forecast.js.erb +1 -1
  46. data/app/views/educode_sales/sale_trends/trends.html.erb +6 -6
  47. data/app/views/educode_sales/sale_trends/user_stat.js.erb +1 -1
  48. data/app/views/educode_sales/sale_trends/visit_analysis.js.erb +1 -1
  49. data/app/views/educode_sales/shixun_dectects/index.html.erb +516 -0
  50. data/app/views/educode_sales/shixun_dectects/index.json.jbuilder +23 -0
  51. data/app/views/educode_sales/shixun_dectects/markdown.html.erb +60 -0
  52. data/app/views/educode_sales/shixuns/edit.html.erb +208 -0
  53. data/app/views/educode_sales/shixuns/index.html.erb +723 -0
  54. data/app/views/educode_sales/shixuns/index.json.jbuilder +26 -0
  55. data/app/views/educode_sales/shixuns/new.html.erb +261 -0
  56. data/app/views/educode_sales/subject_trends/trends.html.erb +676 -0
  57. data/app/views/educode_sales/subjects/edit.html.erb +86 -0
  58. data/app/views/educode_sales/subjects/index.html.erb +285 -0
  59. data/app/views/educode_sales/subjects/index.json.jbuilder +16 -0
  60. data/app/views/educode_sales/subjects/list_shixuns.html.erb +354 -0
  61. data/app/views/educode_sales/subjects/list_shixuns.json.jbuilder +22 -0
  62. data/app/views/educode_sales/subjects/new.html.erb +254 -0
  63. data/app/views/layouts/educode_sales/application.html.erb +38 -0
  64. data/config/routes.rb +37 -0
  65. data/lib/educode_sales/version.rb +1 -1
  66. metadata +42 -7
  67. data/app/assets/images/educode_sales/indexlogo.png +0 -0
@@ -0,0 +1,723 @@
1
+ <style>
2
+ .inner_div {
3
+ margin-bottom: 10px;
4
+ margin-right: 10px;
5
+ }
6
+ .markdown_list img{
7
+ max-width: 500px;
8
+ }
9
+ .layui-table-cell{
10
+ height: auto !important;
11
+ width: auto;
12
+ white-space: normal;
13
+ /*line-height: 28px;*/
14
+ }
15
+ </style>
16
+ <div class="layui-tab" style="margin: 10px" lay-filter="shixun_nav">
17
+ <ul class="layui-tab-title">
18
+ <li id="category_1" class="layui-this" lay-id="1">管培</li>
19
+ <li id="category_2" lay-id="2">全职</li>
20
+ <li id="category_3" lay-id="3">专职</li>
21
+
22
+ </ul>
23
+ <div class="layui-tab-content">
24
+ <div>
25
+ <form class="layui-form layui-form-pane" lay-filter="search_form">
26
+ <div>
27
+ <div class="layui-inline show_item_contract inner_div">
28
+ <label class="layui-form-label">项目级别</label>
29
+ <div class="layui-input-inline">
30
+ <%= select_tag "level", options_for_select(
31
+ [["全部", 0], ["不明确", 1], ["重要紧急", 2], ["重要不紧急", 3],
32
+ ["不重要紧急", 4], ["不重要不紧急", 5]], selected: 0
33
+ ), { include_blank: true } %>
34
+ </div>
35
+ </div>
36
+ <div class="layui-inline show_item_contract borders inner_div">
37
+ <label class="layui-form-label">项目状态</label>
38
+ <div class="layui-input-inline">
39
+ <%= select_tag "status", options_for_select(
40
+ [["全部", 0], ["待建设", 1], ["建设中", 3],
41
+ ["审核中", 4], ["返修中", 5], ["已内部发布", 6], ["已公开发布", 7],
42
+ ["已付费用",8],["审核通过",9]], selected: 0
43
+ ), { include_blank: true } %>
44
+ </div>
45
+ </div>
46
+ <div class="layui-inline inner_div">
47
+ <label class="layui-form-label">交付时间</label>
48
+ <div class="layui-inline" id="ID-laydate-range">
49
+ <input type="text" class="layui-input" name="time" id="ID-laydate-demo" placeholder="yyyy-MM-dd">
50
+ </div>
51
+ </div>
52
+
53
+ <!-- <div class="layui-inline inner_div">-->
54
+ <!-- <label class="layui-form-label">商机名称</label>-->
55
+ <!-- <div class="layui-inline" id="ID-laydate-range">-->
56
+ <!-- <input type="text" class="layui-input" name="business_name" id="business_name">-->
57
+ <!-- </div>-->
58
+ <!-- </div>-->
59
+ </div>
60
+ <div>
61
+ <div class="layui-inline borders inner_div">
62
+ <label class="layui-form-label" style="width: 120px">项目名称</label>
63
+ <div class="layui-input-inline">
64
+ <input type="text" class="layui-input" name="shixun_name">
65
+ </div>
66
+ </div>
67
+ <div class="layui-inline borders inner_div">
68
+ <label class="layui-form-label" style="width: 130px">实践课程名称</label>
69
+ <div class="layui-input-inline">
70
+ <input type="text" class="layui-input" name="subject_name">
71
+ </div>
72
+ </div>
73
+ <div class="layui-inline borders inner_div">
74
+ <button type="reset" class="layui-btn layui-btn-primary" lay-submit lay-filter="reset_business_search">重置
75
+ </button>
76
+ <button type="submit" id="search_bt" class="layui-btn layui-btn-primary" lay-submit lay-filter="search_contract">搜索
77
+ </button>
78
+ </div>
79
+ </div>
80
+ </form>
81
+ </div>
82
+
83
+ <div id="contact_table_wraper">
84
+ <table class="layui-hide" id="shixuns_table" lay-filter="shixuns_table"></table>
85
+ </div>
86
+ <input type="text" class="layui-input" name="subject_name" id="shixun_nav_type_id" value="1" style="display: none">
87
+ </div>
88
+ </div>
89
+
90
+ <script type="text/html" id="bussinessBar">
91
+ <div class="layui-btn-container">
92
+ <span class="table-label">项目列表</span>
93
+ <button class="layui-btn layui-btn-sm pull-right" lay-event="add">
94
+ 添加实践项目
95
+ </button>
96
+ <button class="layui-btn layui-btn-primary layui-border-green layui-btn-sm pull-right project_list-btn" lay-event="list">
97
+ 导出数据
98
+ </button>
99
+ </div>
100
+ </script>
101
+ <script type="text/html" id="show_state">
102
+ {{# if(d.shixun_status === 1){ }}
103
+ <span>待建设</span>
104
+ {{# } else if(d.shixun_status === 2){ }}
105
+ <span>已签协议</span>
106
+ {{# } else if(d.shixun_status === 3){ }}
107
+ <span>建设中</span>
108
+ {{# } else if(d.shixun_status === 4){ }}
109
+ <span>审核中</span>
110
+ {{# } else if(d.shixun_status === 5){ }}
111
+ <span>返修中</span>
112
+ {{# } else if(d.shixun_status === 6){ }}
113
+ <span>已内部发布</span>
114
+ {{# } else if(d.shixun_status === 7){ }}
115
+ <span>已公开发布</span>
116
+ {{# } else if(d.shixun_status === 8){ }}
117
+ <span>已付费用</span>
118
+ {{# } else if(d.shixun_status === 9){ }}
119
+ <span>审核通过</span>
120
+ {{# } }}
121
+ </script>
122
+ <script type="text/html" id="show_level">
123
+ {{# if(d.level === 1){ }}
124
+ <span>不明确</span>
125
+ {{# } else if(d.level === 2){ }}
126
+ <span>重要紧急</span>
127
+ {{# } else if(d.level === 3){ }}
128
+ <span>重要不紧急</span>
129
+ {{# } else if(d.level === 4){ }}
130
+ <span>不重要紧急</span>
131
+ {{# } else if(d.level === 5){ }}
132
+ <span>不重要不紧急</span>
133
+ {{# } }}
134
+ </script>
135
+ <script type="text/html" id="shixun_table_bar">
136
+ <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="edit">编辑</a>
137
+ {{# if(d.shixun_status === 3 || d.shixun_status === 5){ }}
138
+ <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="examine">提交审核</a>
139
+ {{# } else { }}
140
+ <a class="layui-btn layui-btn-disabled layui-btn-xs data-count-edit">提交审核</a>
141
+ {{# } }}
142
+ </script>
143
+ <!--<script type="text/html" id="show_markdown">-->
144
+ <!-- {{# if(d.dectect_feedback !== null && d.dectect_feedback !== '' ){ }}-->
145
+ <!-- <a lay-event="show_markdown">点击查看</a>-->
146
+ <!-- {{# } else { }}-->
147
+ <!-- <span>---</span>-->
148
+ <!-- {{# } }}-->
149
+ <!--</script>-->
150
+
151
+ <script type="text/html" id="shixun_name_t">
152
+ {{# if(d.s_identifier !== null && d.s_identifier !== ''){ }}
153
+ <a target='_blank' style='color: #1E9FFF' href='<%=@url %>/shixuns/{{=d.s_identifier}}/challenges'>{{=d.shixun_name}}</a>
154
+ {{# } else { }}
155
+ <a target='_blank' style='color: #1E9FFF' href='{{=d.link}}'>{{=d.shixun_name}}</a>
156
+ {{# } }}
157
+ </script>
158
+ <script type="text/html" id="subject_name_t">
159
+ {{# if(d.subject_name !== '--'){ }}
160
+ <a target='_blank' style='color: #1E9FFF' href='<%=@url %>/paths/{{=d.subjects_identifier}}'>{{=d.subject_name}}</a>
161
+ {{# } else { }}
162
+ <a style='color: #1E9FFF' >{{=d.subject_name}}</a>
163
+ {{# } }}
164
+ </script>
165
+ <script src="/markdown/marked.min.js" type="text/javascript" charset="utf-8"></script>
166
+ <script>
167
+ function extractFirstTenCharsAndImage(markdownText) {
168
+ let firstTenChars = '';
169
+ let imageTag = '';
170
+ // 行内图片的正则表达式
171
+ const inlineImageRegex = /!\[.*?\]\((.*?)\)/g;
172
+ // 处理行内图片
173
+ markdownText = markdownText.replace(inlineImageRegex, (_, imagePath) => {
174
+ // 如果匹配到行内图片,则生成图片标签,并将匹配的图片部分替换为空字符串
175
+ imageTag = `<img style="max-height: 100px" src="${imagePath}" />`;
176
+ return '';
177
+ });
178
+ // 去除Markdown格式,只保留纯文本内容
179
+ const pureText = markdownText.replace(/(^|\n)(\d+\.|)\s*/g, '$1').trim();
180
+ // 获取前十个字符
181
+ firstTenChars = pureText.substring(0, 10);
182
+ // 输出结果
183
+ return `<div lay-event="show_markdown"><p>${firstTenChars}</p> ${imageTag}</div>`
184
+ }
185
+ layui.config({
186
+ base: '/markdown/mods/' //存放layui拓展模块的目录位置
187
+ }).use(['form', 'table', 'miniPage', 'element', 'laydate', 'dropdown', 'jquery','easyeditor'], function () {
188
+ var laydate = layui.laydate,
189
+ easyeditor = layui.easyeditor,
190
+ element = layui.element,
191
+ form = layui.form,
192
+ table = layui.table,
193
+ $ = layui.jquery,
194
+ miniPage = layui.miniPage
195
+
196
+
197
+ laydate.render({
198
+ elem: '#ID-laydate-demo',
199
+ range: true
200
+ });
201
+
202
+
203
+ var cols_table = [
204
+ [
205
+ {
206
+ field: 'id',
207
+ width: 60,
208
+ title: '序号', type: 'numbers',
209
+ align: 'center',
210
+ },
211
+ {
212
+ field: 'school_name',
213
+ title: '交付单位',
214
+ width: 150,
215
+ align: 'center',
216
+ hide: gon.filter.school_name
217
+ },
218
+ {
219
+ field: 'subject_name',
220
+ title: '实践课程名称',
221
+ width: 200,
222
+ align: 'center',
223
+ templet: "#subject_name_t",
224
+ hide: gon.filter.subject_name
225
+ },
226
+ {
227
+ field: 'reception_at',
228
+ title: '交付时间',
229
+ width: 150,
230
+ align: 'center',
231
+ hide: gon.filter.reception_at
232
+ },
233
+ {
234
+ field: 'type',
235
+ title: '项目类型',
236
+ width: 150,
237
+ align: 'center',
238
+ templet: (d)=>{
239
+ return d.type === 1? "实践项目":"非实践项目"
240
+ },
241
+ hide: gon.filter.type
242
+ },
243
+ {
244
+ field: 'shixun_name',
245
+ title: '项目名称',
246
+ width: 150,
247
+ align: 'center',
248
+ templet: "#shixun_name_t",
249
+ hide: gon.filter.shixun_name
250
+ },
251
+ {
252
+ field: 'level',
253
+ title: '项目级别',
254
+ width: 150,
255
+ align: 'center',
256
+ templet: '#show_level',
257
+ hide: gon.filter.level
258
+ },
259
+ {
260
+ field: 'shixun_status',
261
+ title: '项目状态',
262
+ width: 150,
263
+ templet: '#show_state',
264
+ align: 'center',
265
+ hide: gon.filter.shixun_status
266
+ },
267
+ {
268
+ field: 'deliver_date',
269
+ title: '制作完成时间',
270
+ width: 150,
271
+ align: 'center',
272
+ hide: gon.filter.deliver_date
273
+ },
274
+ {
275
+ field: 'commit_dectect_time',
276
+ title: '提交审核时间',
277
+ width: 150,
278
+ align: 'center',
279
+ hide: gon.filter.commit_dectect_time
280
+ },
281
+ {
282
+ field: 'dectect_feedback',
283
+ title: '审核反馈',
284
+ width: 150,
285
+ align: 'center',
286
+ templet: (d)=>{
287
+ if(d.dectect_feedback){
288
+ return extractFirstTenCharsAndImage(d.dectect_feedback)
289
+ }
290
+ return ''
291
+ },
292
+ hide: gon.filter.dectect_feedback
293
+ },
294
+ {
295
+ field: 'shixun_producer',
296
+ title: '项目制作人',
297
+ width: 150,
298
+ align: 'center',
299
+ hide: gon.filter.shixun_producer
300
+ },
301
+ {
302
+ field: 'shixun_manages',
303
+ title: '课程组长',
304
+ width: 150,
305
+ align: 'center',
306
+ hide: gon.filter.shixun_manages
307
+ },
308
+ {
309
+ field: 'max_manage',
310
+ title: '课程组主管',
311
+ width: 150,
312
+ align: 'center',
313
+ hide: gon.filter.max_manage
314
+ },
315
+ {
316
+ field: 'shixun_staff',
317
+ title: '销售',
318
+ width: 150,
319
+ align: 'center',
320
+ hide: gon.filter.shixun_staff
321
+ },
322
+ {
323
+ title: '操作',
324
+ align: 'center',
325
+ width: 150,
326
+ templet: "#shixun_table_bar"
327
+ }
328
+ ]
329
+ ]
330
+
331
+ var money_cols_table = [
332
+ [
333
+ {
334
+ field: 'id',
335
+ width: 60,
336
+ title: '序号', type: 'numbers',
337
+ align: 'center',
338
+ },
339
+ {
340
+ field: 'school_name',
341
+ title: '交付单位',
342
+ width: 150,
343
+ align: 'center',
344
+ hide: gon.filter.school_name
345
+ },
346
+ {
347
+ field: 'subject_name',
348
+ title: '实践课程名称',
349
+ width: 200,
350
+ align: 'center',
351
+ templet: "#subject_name_t",
352
+ hide: gon.filter.subject_name
353
+ },
354
+ {
355
+ field: 'reception_at',
356
+ title: '交付时间',
357
+ width: 150,
358
+ align: 'center',
359
+ hide: gon.filter.reception_at
360
+ },
361
+ {
362
+ field: 'type',
363
+ title: '项目类型',
364
+ width: 150,
365
+ align: 'center',
366
+ templet: (d)=>{
367
+ return d.type === 1? "实践项目":"非实践项目"
368
+ },
369
+ hide: gon.filter.type
370
+ },
371
+ {
372
+ field: 'shixun_name',
373
+ title: '项目名称',
374
+ width: 150,
375
+ align: 'center',
376
+ templet: "#shixun_name_t",
377
+ hide: gon.filter.shixun_name
378
+ },
379
+ {
380
+ field: 'level',
381
+ title: '项目级别',
382
+ width: 150,
383
+ align: 'center',
384
+ templet: '#show_level',
385
+ hide: gon.filter.level
386
+ },
387
+ {
388
+ field: 'shixun_status',
389
+ title: '项目状态',
390
+ width: 150,
391
+ templet: '#show_state',
392
+ align: 'center',
393
+ hide: gon.filter.shixun_status
394
+ },
395
+ {
396
+ field: 'deliver_date',
397
+ title: '制作完成时间',
398
+ width: 150,
399
+ align: 'center',
400
+ hide: gon.filter.deliver_date
401
+ },
402
+ {
403
+ field: 'commit_dectect_time',
404
+ title: '提交审核时间',
405
+ width: 150,
406
+ align: 'center',
407
+ hide: gon.filter.commit_dectect_time
408
+ },
409
+ {
410
+ field: 'dectect_feedback',
411
+ title: '审核反馈',
412
+ width: 150,
413
+ align: 'center',
414
+ templet: (d)=>{
415
+ if(d.dectect_feedback){
416
+ return extractFirstTenCharsAndImage(d.dectect_feedback)
417
+ }
418
+ return ''
419
+ },
420
+ hide: gon.filter.dectect_feedback
421
+ },
422
+ {
423
+ field: 'shixun_producer',
424
+ title: '项目制作人',
425
+ width: 150,
426
+ align: 'center',
427
+ hide: gon.filter.shixun_producer
428
+ },
429
+ {
430
+ field: 'shixun_manages',
431
+ title: '课程组长',
432
+ width: 150,
433
+ align: 'center',
434
+ hide: gon.filter.shixun_manages
435
+ },
436
+ {
437
+ field: 'max_manage',
438
+ title: '课程组主管',
439
+ width: 150,
440
+ align: 'center',
441
+ hide: gon.filter.max_manage
442
+ },
443
+ {
444
+ field: 'shixun_staff',
445
+ title: '销售',
446
+ width: 150,
447
+ align: 'center',
448
+ hide: gon.filter.shixun_staff
449
+ },
450
+ {
451
+ title: '操作',
452
+ align: 'center',
453
+ width: 150,
454
+ templet: "#shixun_table_bar"
455
+ }
456
+ ]
457
+ ]
458
+ var data = form.val("search_form");
459
+ // 默认管培
460
+ data.category = gon.category
461
+ localStorage.setItem("is_admin-<%=session[:admin_id] %>",gon.is_admin)
462
+ element.tabChange("shixun_nav", gon.category);
463
+ console.log("is_admin-<%=session[:admin_id] %>")
464
+ console.log(gon.is_admin)
465
+ if (gon.is_admin && data.category == 3 ){
466
+ console.log("admin")
467
+ money_cols_table[0].splice(8, 0, {field: 'money',title: '金额',width: 150, align: 'center',hide: gon.filter.money })
468
+ // console.log(demo)
469
+ }
470
+
471
+ var tableDataCount = 0
472
+ var id = localStorage.getItem("subjects_id")
473
+ console.log(id)
474
+ var shixuns_table = table.render({
475
+ elem: '#shixuns_table',
476
+ url: '/missions/shixuns',
477
+ autoSort: false,
478
+ where: {q: data},
479
+ title: '实践项目列表',
480
+ toolbar: '#bussinessBar',
481
+ defaultToolbar: ['filter'],
482
+ cols: money_cols_table,
483
+ limit: 10,
484
+ limits: [10, 15, 20, 30, 40, 50, 60, 70, 80, 90],
485
+ page: true,
486
+ skin: 'line',
487
+ done:function (res, curr, count){
488
+ tableDataCount = count;
489
+ }
490
+ });
491
+ // 重置
492
+ form.on('submit(reset_business_search)', function (data) {
493
+ $(".layui-form")[0].reset();
494
+ var category = localStorage.getItem("category")
495
+ console.log(category)
496
+ table.reload('shixuns_table', {
497
+ page: {
498
+ curr: 1
499
+ },
500
+ where: {q: {category:category}}
501
+ }, 'data');
502
+ form.render()
503
+ return false;
504
+ });
505
+ var sort = {}, search = {};
506
+ // 监听搜索操作
507
+ form.on('submit(search_contract)', function (data) {
508
+ search = data.field
509
+ search.category = document.getElementById('shixun_nav_type_id').value
510
+ console.log(search)
511
+ table.reload('shixuns_table', {
512
+ page: {
513
+ curr: 1
514
+ },
515
+ where: {q: search, sort: sort}
516
+ }, 'data');
517
+ return false;
518
+ });
519
+
520
+ table.on('tool(shixuns_table)', function (obj) {
521
+ var data = obj.data;
522
+ console.log(data)
523
+ // 编辑按钮监听
524
+ if (obj.event === 'edit') {
525
+ var content = miniPage.getHrefContent('/missions/shixuns/' + data.id + '/edit');
526
+ var openWH = miniPage.getOpenWidthHeight();
527
+
528
+ var edit = layer.open({
529
+ title: '编辑实践项目',
530
+ type: 1,
531
+ shade: 0.2,
532
+ maxmin: true,
533
+ shadeClose: false,
534
+ area: [openWH[0] + 'px', openWH[1] + 'px'],
535
+ offset: [openWH[2] + 'px', openWH[3] + 'px'],
536
+ content: content
537
+ });
538
+ $(window).on("resize", function () {
539
+ });
540
+ return false;
541
+ } else if (obj.event === 'examine') {
542
+ var status = data.shixun_status
543
+ console.log(status)
544
+ if (status != 3 && status != 5) {
545
+ layer.confirm("当前状态无法提交审核")
546
+ return false
547
+ }
548
+
549
+ $.ajax('/missions/shixun_dectects/submit', {
550
+ method: 'POST',
551
+ data: data,
552
+ dataType: 'json',
553
+ success: function (res) {
554
+ var data = res.data;
555
+ console.log(res)
556
+ if (res.success) {
557
+ layer.msg("提交成功")
558
+ search = form.val()
559
+ search.category = document.getElementById('shixun_nav_type_id').value
560
+ console.log(search)
561
+ table.reload('shixuns_table', {
562
+ page: {
563
+ curr: 1
564
+ },
565
+ where: {q: search, sort: sort}
566
+ }, 'data');
567
+ return false;
568
+ }
569
+ },
570
+ error: (res) => {
571
+ layer.msg("已经提交过了")
572
+ }
573
+ })
574
+ return false
575
+ }else if(obj.event === 'show_markdown'){
576
+ if(data.dectect_feedback !== '--'){
577
+ var text = `<div class="markdown_list" style="margin: 50px" >` + data.dectect_feedback + `</div>`
578
+ layer.open({
579
+ type: 1,
580
+ title: '审核反馈',
581
+ area: ['900px', '700px'], // 宽高
582
+ content: text,
583
+ move: '#ID-test-layer-move'
584
+ });
585
+ easyeditor.render({
586
+ elem: ".markdown_list"
587
+ });
588
+ }
589
+ }
590
+ });
591
+
592
+
593
+ table.on('toolbar(shixuns_table)', function (obj) {
594
+ // 新增按钮监听
595
+ if (obj.event === 'add') {
596
+ var content = miniPage.getHrefContent('/missions/shixuns/new');
597
+ var openWH = miniPage.getOpenWidthHeight();
598
+ add_courses = layer.open({
599
+ title: '添加实践项目',
600
+ type: 1,
601
+ shade: 0.2,
602
+ maxmin: true,
603
+ shadeClose: false,
604
+ area: [openWH[0] + 'px', openWH[1] + 'px'],
605
+ offset: [openWH[2] + 'px', openWH[3] + 'px'],
606
+ content: content,
607
+ });
608
+ $(window).on("resize", function () {
609
+ });
610
+ } else if (obj.event === 'LAYTABLE_COLS') {
611
+ layui.form.on('checkbox(LAY_TABLE_TOOL_COLS)', function (objs) {
612
+ var value = objs.elem.checked
613
+ console.log(objs)
614
+ var name = objs.elem.attributes[1].value
615
+ console.log(name)
616
+ $.ajax({
617
+ url: "filter",
618
+ type: "GET",
619
+ data: "type=shixuns&name=" + name + "&check=" + value,
620
+ success: function (data) {
621
+ let hide_type = "[data-field='" + name + "']"
622
+ if (data.hidden === 1) {
623
+ $(hide_type).addClass('layui-hide');
624
+ } else if (data.hidden === 0) {
625
+ $(hide_type).removeClass('layui-hide');
626
+ }
627
+ //(因为触发筛选器出现的checkbox是根据cols的值得到 这里必须修改 cols的值 然后才会出现下次点击筛选器时 checkbox正常显示)
628
+ for (i = 1; i < cols_table[0].length; i++) {
629
+ if (name === cols_table[0][i].field) {
630
+ cols_table[0][i].hide = !value
631
+ obj.config.cols = cols_table
632
+ }
633
+
634
+ if (i < money_cols_table[0].length && name === money_cols_table[0][i].field) {
635
+ money_cols_table[0][i].hide = !value
636
+ obj.config.cols = money_cols_table
637
+ }
638
+ }
639
+ },
640
+ error: function (data) {
641
+ layer.msg("操作失败")
642
+ },
643
+ dataType: 'Json'
644
+ })
645
+ });
646
+ }else if(obj.event === 'list'){
647
+ table.reload('shixuns_table',{
648
+ page: 1,
649
+ limit:tableDataCount, //加载所有数据
650
+ done:function (){
651
+ //导出所有数据
652
+ table.exportFile("shixuns_table",false,"xls");
653
+ //恢复数据分页显示
654
+ table.reload('shixuns_table',{
655
+ page: 1,
656
+ limit:20,
657
+ done:function (res, curr, count){
658
+ tableDataCount = count;
659
+ }
660
+ })
661
+
662
+ }
663
+ })
664
+ }
665
+ });
666
+
667
+
668
+ for (let i = 1; i <= 3; i++) {
669
+ if (i !== 3) {
670
+ console.log("tabchange是否跳转")
671
+ $("#category_" + i).click(function () {
672
+ $(".layui-form")[0].reset();
673
+ data.category = i
674
+ localStorage.setItem("category",i)
675
+ table.reload('shixuns_table', {
676
+ page: {
677
+ curr: 1
678
+ },
679
+ cols: cols_table,
680
+ where: {q: data}
681
+ })
682
+ // 更换面包屑后,跟新类型
683
+ document.getElementById('shixun_nav_type_id').value = i
684
+ });
685
+ } else if (i === 3) {
686
+ $("#category_" + i).click(function () {
687
+ $(".layui-form")[0].reset();
688
+ data.category = i
689
+ localStorage.setItem("category",i)
690
+
691
+ var flag = true
692
+ for(let i = 0; i < money_cols_table[0].length; i ++){
693
+ if(money_cols_table[0][i].field === "money"){
694
+ flag = false
695
+ break
696
+ }
697
+ }
698
+
699
+ var is_admin = localStorage.getItem("is_admin-<%=session[:admin_id] %>")
700
+ if (flag && is_admin !== 'false' && data.category == 3 ){
701
+ hash = {field: 'money',title: '金额',width: 150, align: 'center',hide: gon.filter.money }
702
+ money_cols_table[0].splice(8, 0, hash)
703
+ }
704
+ table.reload('shixuns_table', {
705
+ page: {
706
+ curr: 1
707
+ },
708
+ cols: money_cols_table,
709
+ where: {q: data},
710
+ done:function (res, curr, count){
711
+ tableDataCount = count;
712
+ }
713
+ })
714
+
715
+
716
+ document.getElementById('shixun_nav_type_id').value = i
717
+ });
718
+ }
719
+
720
+ }
721
+
722
+ });
723
+ </script>