apply-clients 3.4.2-FuGu-6 → 3.4.2-FuGu-7

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.
@@ -1,1241 +1,1249 @@
1
- <template>
2
- <div class="" v-if="showview">
3
- <show-back-reason :selectdata="show_data"></show-back-reason>
4
- <service-view v-ref:serviceview :data="show_data"></service-view>
5
- </div>
6
- </template>
7
- <script>
8
- import Vue from 'vue'
9
- import {HttpResetClass} from 'vue-client'
10
- import {isEmpty} from "../../../Util";
11
-
12
- // Date格式化
13
- Date.prototype.Format = function (fmt) {
14
- var o = {
15
- "M+": this.getMonth() + 1, //月份
16
- "d+": this.getDate(), //日
17
- "H+": this.getHours(), //小时
18
- "m+": this.getMinutes(), //分
19
- "s+": this.getSeconds(), //秒
20
- "q+": Math.floor((this.getMonth() + 3) / 3), //季度
21
- "S": this.getMilliseconds() //毫秒
22
- };
23
- if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
24
- for (var k in o)
25
- if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
26
- return fmt;
27
- }
28
-
29
- export default {
30
- title: '报建流程业务控制层',
31
- props: ['selectdata'],
32
- data () {
33
- return {
34
- data: null, // 数据库数据,json配置文件数据的数据集合
35
- json_datas: null, // Json配置文件集合
36
- showview: false, // 控制显示service-view组件
37
- show_data: null, // 给view层显示的数据
38
- config: {}
39
- }
40
- },
41
- ready () {
42
- this.refurbish()
43
- },
44
- methods: {
45
- // 组件初始化操作
46
- async refurbish() {
47
- this.json_datas = this.$workflow_vue
48
- let sum = 0
49
- let jsonData = {}
50
- if (!this.json_datas || !this.json_datas.activitys || this.json_datas.activitys.length === 0) {
51
- this.$showMessage("网络故障,请刷新页面")
52
- return
53
- }
54
- this.json_datas.activitys.forEach(item => {
55
- if (this.selectdata.defname === item.title) {
56
- jsonData = item // 拿到当前节点的json配置信息
57
- sum++ // 节点名一样的个数
58
- }
59
- return this.selectdata.defname === item.title // 拿到当前节点的json配置信息
60
- })
61
-
62
- if (sum === 0) {
63
- this.$showMessage(`没有在JSON配置文件中找到活动名为:(${this.selectdata.defname})的节点配置`)
64
- return
65
- }
66
- if (sum > 1) {
67
- this.$showMessage(`在JSON配置文件中找到活动名为:(${this.selectdata.defname})的节点配置:${sum}个`)
68
- return
69
- }
70
-
71
- this.selectdata = Object.assign({}, this.selectdata, jsonData)
72
-
73
- // fields 字段填充值
74
- for (const item of this.selectdata.fields) {
75
- if (!item.value) {
76
- item.value = null
77
- }
78
-
79
- if (!item.value && (item.default || item.default === 0) && item.type !== 'datepicker') {
80
- if (item.eval) {
81
- item.value = eval(item.default)
82
- } else {
83
- item.value = item.default
84
- }
85
- }
86
-
87
- if (this.selectdata[item.field]) {
88
- // 将json字符串格式化赋值给value
89
- if (String(this.selectdata[item.field]).startsWith("{")) {
90
- item.value = JSON.parse(this.selectdata[item.field])
91
- } else {
92
- item.value = this.selectdata[item.field]
93
- }
94
- }
95
- if (this.selectdata[item.field] === 0) {
96
- item.value = 0
97
- }
98
-
99
- // datepicker
100
- if (item.type === 'datepicker' && !item.value && item.default) {
101
- item.value = new Date().Format(`${item.format ? item.format : 'yyyy-MM-dd HH:mm:ss'}`)
102
- }
103
-
104
- // 如果配置类型为select,优先从参数列表获取options
105
- if (item.type === 'select' || item.type === 'checkbox') {
106
- if (item.param) {
107
- let temp = this.$appdata.getParam(item.label)
108
-
109
- if (temp && temp.length > 0) {
110
- item.options = temp
111
- }
112
-
113
- if (item.paramLabel) {
114
- temp = this.$appdata.getParam(item.paramLabel)
115
- if (temp && temp.length > 0) {
116
- item.options = temp
117
- }
118
- }
119
- }
120
-
121
- if (item.ready) {
122
- item.options = await this[item.ready]()
123
- }
124
- }
125
-
126
-
127
- if (item.type === 'checkbox') {
128
- if (this.selectdata[item.field]) {
129
- item.value = JSON.parse(this.selectdata[item.field])
130
- } else {
131
- item.value = []
132
- }
133
- }
134
-
135
- this.selectdata[item.field] = item.value
136
- }
137
-
138
- // 控制组件
139
- if (this.selectdata.components) {
140
- this.selectdata.components.forEach(item => {
141
- if (!item.mark) {
142
- item.mark = 0
143
- }
144
- })
145
- }
146
-
147
- // 初始化onetomany
148
- if (this.selectdata.onetomany) {
149
- for (const item of this.selectdata.onetomany) {
150
- let res = null
151
- if (item.queryEvent) {
152
- res = this[item.queryEvent]()
153
- } else {
154
- let data = {
155
- tablename: item.tables[0],
156
- condition: `f_process_id='${this.selectdata.f_process_id}'`
157
- }
158
- res = await this.$resetpost(
159
- 'rs/sql/singleTable',
160
- {data: data},
161
- {resolveMsg: null, rejectMsg: 'onetomany查询失败'}
162
- )
163
- }
164
-
165
- item.rows = res.data
166
-
167
- // 初始化onetomany中的fields
168
- for (const field of item.fields) {
169
- if (!field.value) {
170
- if (field.value !== 0) {
171
- field.value = null
172
- }
173
- }
174
-
175
- if (field.default || field.default === 0) {
176
- field.value = field.default
177
- }
178
-
179
- // datepicker
180
- if (field.type === 'datepicker' && !field.value && field.default) {
181
- field.value = new Date().Format(`${field.format ? field.format : 'yyyy-MM-dd HH:mm:ss'}`)
182
- }
183
-
184
- if (field.type === 'select') {
185
-
186
- let temp = this.$appdata.getParam(field.label)
187
-
188
- if (temp && temp.length > 0) {
189
- field.options = temp
190
- }
191
-
192
- if (field.paramLabel) {
193
- temp = this.$appdata.getParam(field.paramLabel)
194
- if (temp && temp.length > 0) {
195
- item.options = temp
196
- }
197
- }
198
- }
199
- }
200
- }
201
- }
202
-
203
- // 初始化 buttons_fields
204
- for (const item of this.selectdata.buttons) {
205
- if (item.button_name === '下发') {
206
-
207
- let data = {
208
- source: item.source,
209
- userid: this.$login.f.id
210
- }
211
- if (item.sourceMethod) {
212
- data.source = this[item.sourceMethod]()
213
- }
214
- if (!data.source) {
215
- this.$showMessage("请配置获取人员表达式")
216
- return
217
- }
218
-
219
- let res = await this.$resetpost(
220
- 'rs/search',
221
- {data: data},
222
- {resolveMsg: null, rejectMsg: '下发人员查询失败!!!'}
223
- )
224
-
225
- let options = res.data.map(source => {
226
- return {
227
- "label": source.name,
228
- "value": source.id
229
- }
230
- })
231
-
232
- if (item.button_fields.length !== 1) {
233
- this.$showMessage("下发有且只能有一个字段!!!")
234
- return
235
- }
236
-
237
- item.button_fields[0].options = options
238
- }
239
- if (item.button_fields) {
240
- item.button_fields.forEach(x => {
241
- // 如果配置类型为select,优先从参数列表获取options
242
- if (x.type === 'select') {
243
-
244
- if (x.param) {
245
- let temp = this.$appdata.getParam(x.label)
246
-
247
- if (temp && temp.length > 0) {
248
- x.options = temp
249
- }
250
-
251
- if (x.paramLabel) {
252
- temp = this.$appdata.getParam(x.paramLabel)
253
- if (temp && temp.length > 0) {
254
- x.options = temp
255
- }
256
- }
257
- }
258
-
259
- }
260
- })
261
- }
262
- }
263
-
264
- // 消除双向绑定,避免子组件(显示层)数据更改,父组件(控制层)也更改
265
- let temp = JSON.parse(JSON.stringify(this.selectdata))
266
-
267
- this.show_data = temp
268
- this.$nextTick(() => {
269
- this.showview = true
270
- })
271
- },
272
- // 金额转大写
273
- smalltoBIG(n) {
274
- let fraction = ['角', '分'];
275
- let digit = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖'];
276
- let unit = [['元', '万', '亿'], ['', '拾', '佰', '仟']];
277
- let head = n < 0 ? '欠' : '';
278
- n = Math.abs(n);
279
-
280
- let s = '';
281
-
282
- for (var i = 0; i < fraction.length; i++) {
283
- s += (digit[Math.floor(n * 10 * Math.pow(10, i)) % 10] + fraction[i]).replace(/零./, '');
284
- }
285
- s = s || '整';
286
- n = Math.floor(n);
287
-
288
- for (var i = 0; i < unit[0].length && n > 0; i++) {
289
- let p = '';
290
- for (var j = 0; j < unit[1].length && n > 0; j++) {
291
- p = digit[n % 10] + unit[1][j] + p;
292
- n = Math.floor(n / 10);
293
- }
294
- s = p.replace(/(零.)*零$/, '').replace(/^$/, '零') + unit[0][i] + s;
295
- }
296
- return head + s.replace(/(零.)*零元/, '元').replace(/(零.)+/g, '零').replace(/^整$/, '零元整')
297
- },
298
- getLableValue(label) {
299
- for (const item of this.show_data.fields) {
300
- if (item.label === label && item.type !== 'number') {
301
- return item.value || ''
302
- }
303
- if (item.label === label && item.type === 'number') {
304
- return item.value || 0
305
- }
306
- }
307
- },
308
- getLableOptions(label) {
309
- for (const item of this.show_data.fields) {
310
- if (item.label === label) {
311
- return item.options
312
- }
313
- }
314
- },
315
- setLabelValue(label, value) {
316
- for (const item of this.show_data.fields) {
317
- if (item.label === label) {
318
- item.value = value
319
- this.show_data[item.field] = value
320
- }
321
- }
322
- },
323
- setLabelOptions(label, options) {
324
- for (const item of this.show_data.fields) {
325
- if (item.label === label) {
326
- item.options = options
327
- }
328
- }
329
- },
330
- showLabels(...labels) {
331
- for (const item of this.show_data.fields) {
332
- if (labels.includes(item.label)) {
333
- item.hidden = false
334
- }
335
- }
336
- },
337
- hideLabels(...labels) {
338
- for (const item of this.show_data.fields) {
339
- if (labels.includes(item.label)) {
340
- item.hidden = true
341
- }
342
- }
343
- },
344
- requiredLabels(...labels) {
345
- for (const item of this.show_data.fields) {
346
- if (labels.includes(item.label)) {
347
- item.required = true
348
- }
349
- }
350
- },
351
- electiveLabels(...labels) {
352
- for (const item of this.show_data.fields) {
353
- if (labels.includes(item.label)) {
354
- item.required = false
355
- }
356
- }
357
- },
358
- readonlyLabels(...labels) {
359
- for (const item of this.show_data.fields) {
360
- if (labels.includes(item.label)) {
361
- item.readonly = true
362
- item.disabled = true
363
- }
364
- }
365
- },
366
- readwriteLabels(...labels) {
367
- for (const item of this.show_data.fields) {
368
- if (labels.includes(item.label)) {
369
- item.readonly = false
370
- item.disabled = false
371
- }
372
- }
373
- },
374
- async checkDuplicate(index) {
375
- let http = new HttpResetClass()
376
- let data = {
377
- tablename: 't_apply',
378
- condition: `${this.show_data.fields[index].field} = '${this.show_data.fields[index].value}'`
379
- }
380
- let res = await http.load('POST', 'rs/sql/singleTable', {data: data}, {
381
- resolveMsg: null,
382
- rejectMsg: `${this.show_data.fields[index].label}查询失败`
383
- })
384
- if (res.data.length > 0) {
385
- this.show_data.fields[index].value = null
386
- this.$showAlert(`${this.show_data.fields[index].label}已存在!!!`, 'warning', 3000)
387
- }
388
- },
389
- // 获取片区
390
- async getSliceArea () {
391
- let data = {
392
- source: 'this.getParentByType($organization$).getAllChildrens().where(row.getType() == $zone$)',
393
- userid: this.$login.f.id
394
- }
395
-
396
- let http = new HttpResetClass()
397
- let res = await http.load(
398
- 'POST',
399
- `rs/search`,
400
- {data: data},
401
- {resolveMsg: null, rejectMsg: '片区查询失败!!!'}
402
- )
403
-
404
- return res.data.map(item => {
405
- return {
406
- label: item.name,
407
- value: item.name
408
- }
409
- })
410
- },
411
- // 获取区县
412
- async getPcd () {
413
- let data = {
414
- tablename: 't_pcd',
415
- condition: `f_filialeid = '${this.$login.f.orgid}'`
416
- }
417
- let http = new HttpResetClass()
418
- let res = await http.load(
419
- 'POST',
420
- `rs/sql/singleTable`,
421
- {data: data},
422
- {resolveMsg: null, rejectMsg: '区县查询失败!!!'}
423
- )
424
-
425
- return res.data.map(item => {
426
- return {
427
- label: item.f_pcd,
428
- value: item.f_pcd
429
- }
430
- })
431
- },
432
- // 缴费前置
433
- chargeBefore () {
434
- if (Number(this.show_data.f_due_money) > Number(this.show_data.f_cumulative_payment_money) || Number(this.show_data.f_surplus_money) > 0) {
435
- this.$showAlert('费用未结清!!!', 'warning', 3000)
436
- throw null
437
- }
438
- },
439
- // 施工前置
440
- async constructionBefore () {
441
- let http = new HttpResetClass()
442
- let data = {
443
- condition: `ui.f_process_id = '${this.show_data.f_process_id}' and uf.f_table_state = '待开通'`
444
- }
445
- let res = await http.load(
446
- 'POST',
447
- 'rs/sql/countApplyUserinfo',
448
- {data: data},
449
- {
450
- resolveMsg: null,
451
- rejectMsg: '安装明细查询失败!!!'
452
- })
453
- if (res.data[0].num > 0) {
454
- this.$showAlert(`还有${res.data[0].num}户未安装,无法提交`, 'warning', 3000)
455
- throw `还有${res.data[0].num}户未安装,无法提交`
456
- }
457
- },
458
- changePipeBuild () {
459
- if (this.selectdata.f_process_dep === '工程部') {
460
- return 'this.getParentByType($organization$).getChildByName($工程部报装$).getChildren()'
461
- }
462
- if (this.selectdata.f_process_dep === '运营部') {
463
- return 'this.getParentByType($organization$).getChildByName($运营部报装$).getChildren()'
464
- }
465
- return 'this.getParentByType($organization$).getChildByName($工程部报装$).getChildren()'
466
- },
467
- async getDevInfo () {
468
- let data = {
469
- tablename: 't_dev_info',
470
- condition: `f_orgid = '${this.$login.f.orgid}'`
471
- }
472
- let http = new HttpResetClass()
473
- let res = await http.load(
474
- 'POST',
475
- `rs/sql/singleTable`,
476
- {data: data},
477
- {resolveMsg: null, rejectMsg: '公司查询失败!!!'}
478
- )
479
-
480
- return res.data.map(item => {
481
- return {
482
- label: item.f_dev_name,
483
- value: item.f_dev_name
484
- }
485
- })
486
- },
487
- async getPrice (f_price_id) {
488
- console.log('=======================')
489
- console.log(f_price_id)
490
-
491
- let data = {
492
- condition: `sp.f_orgid = '${this.$login.f.orgid}'`
493
- }
494
-
495
- if (!isEmpty(f_price_id)) {
496
- data.condition = `sp.f_orgid = '${this.$login.f.orgid}' and sp.f_price_id = ${f_price_id}`
497
- }
498
- let http = new HttpResetClass()
499
- let res = await http.load(
500
- 'POST',
501
- `rs/sql/applyGetPrice`,
502
- {data: data},
503
- {resolveMsg: null, rejectMsg: '气价查询失败!!!'}
504
- )
505
-
506
- return res.data.map(item => {
507
- return {
508
- label: item.f_price_name,
509
- value: item
510
- }
511
- })
512
- },
513
- addressInitialization () {
514
- this.$getConfig(this, 'UserAddress')
515
-
516
- let f_address_type = this.show_data.f_address_type
517
-
518
- for (const item of this.show_data.fields) {
519
- if (f_address_type === '民用市区') {
520
- if (item.label === '区/县' || item.label === '街道' || item.label === '小区' || item.label === '门牌号') {
521
- item.hidden = false
522
- item.required = true
523
- }
524
- if (item.label === '楼号' || item.label === '单元' || item.label === '楼层') {
525
- item.hidden = false
526
- item.required = false
527
- }
528
- if (item.label === '地址') {
529
- item.readonly = true
530
- }
531
- }
532
- if (f_address_type === '民用乡镇') {
533
- if (item.label === '区/县' || item.label === '街道' || item.label === '小区' || item.label === '门牌号') {
534
- item.hidden = false
535
- item.required = true
536
- }
537
- if (item.label === '楼号' || item.label === '单元' || item.label === '楼层') {
538
- item.hidden = false
539
- item.required = false
540
- }
541
- if (item.label === '楼层') {
542
- item.hidden = true
543
- item.required = false
544
- }
545
- if (item.label === '地址') {
546
- item.readonly = true
547
- }
548
- }
549
- if (f_address_type === '特殊地址') {
550
- if (item.label === '区/县' || item.label === '街道') {
551
- item.hidden = false
552
- item.required = true
553
- }
554
- if (item.label === '小区') {
555
- item.hidden = false
556
- item.required = false
557
- }
558
- if (item.label === '楼号' || item.label === '单元' || item.label === '楼层' || item.label === '门牌号') {
559
- item.hidden = true
560
- item.required = false
561
- }
562
- if (item.label === '地址') {
563
- item.readonly = false
564
- }
565
- }
566
-
567
- if (this.show_data.f_apply_source === '线下发起' && item.label === '预约地址') {
568
- item.hidden = true
569
- }
570
- }
571
- },
572
- async streetChange () {
573
- if (isEmpty(this.show_data.f_street)) {
574
- return
575
- }
576
-
577
- let data = {
578
- tablename: 't_area',
579
- condition: `f_filialeid = '${this.$login.f.orgid}' and f_street = '${this.show_data.f_street}'`
580
- }
581
- let http = new HttpResetClass()
582
- let res = await http.load(
583
- 'POST',
584
- `rs/sql/singleTable`,
585
- {data: data},
586
- {resolveMsg: null, rejectMsg: '小区查询失败!!!'}
587
- )
588
-
589
- this.setLabelOptions('小区', res.data.map(item => {
590
- return {
591
- label: item.f_residential_area,
592
- value: item.f_residential_area
593
- }
594
- }))
595
- },
596
- async pcdChange () {
597
- if (isEmpty(this.show_data.f_pcd)) {
598
- return
599
- }
600
-
601
- let data = {
602
- tablename: 't_street',
603
- condition: `f_filialeid = '${this.$login.f.orgid}' and f_pcd = '${this.show_data.f_pcd}'`
604
- }
605
- let f_address_type = this.getLableValue('地址类型')
606
-
607
- if (f_address_type === '民用市区') {
608
- data.condition = `f_filialeid = '${this.$login.f.orgid}' and f_pcd = '${this.show_data.f_pcd}' and f_iscity = '市区'`
609
- }
610
- if (f_address_type === '民用乡镇') {
611
- data.condition = `f_filialeid = '${this.$login.f.orgid}' and f_pcd = '${this.show_data.f_pcd}' and f_iscity = '乡镇'`
612
- }
613
-
614
- let http = new HttpResetClass()
615
- let res = await http.load(
616
- 'POST',
617
- `rs/sql/singleTable`,
618
- {data: data},
619
- {resolveMsg: null, rejectMsg: '街道查询失败!!!'}
620
- )
621
-
622
- this.setLabelOptions('街道', res.data.map(item => {
623
- return {
624
- label: item.f_street,
625
- value: item.f_street
626
- }
627
- }))
628
- }
629
- },
630
- events: {
631
- // 选择材料
632
- async materialNameChenge (index, fieldIndex) {
633
- let material = this.show_data.onetomany[index].fields[fieldIndex].value
634
-
635
- this.show_data.onetomany[index].fields.forEach(item => {
636
- if (material[item.field]) {
637
- item.value = material[item.field]
638
- }
639
- })
640
- },
641
- // 打开模态框获取材料
642
- async 'getMaterialName' (index) {
643
- let data = {
644
- condition: `1=1`
645
- }
646
- let http = new HttpResetClass()
647
- let res = await http.load(
648
- 'POST',
649
- `rs/sql/getStockMaterial`,
650
- {data: data},
651
- {resolveMsg: null, rejectMsg: '材料查询失败!!!'}
652
- )
653
-
654
- this.show_data.onetomany[index].fields.forEach(field => {
655
- if (field.label === '选择材料') {
656
- field.options = res.data.map(item => {
657
- return {
658
- 'label': `${item.f_material_name}--${item.f_material_style}--${item.f_material_unit}`,
659
- 'value': item
660
- }
661
- })
662
- }
663
- })
664
- },
665
- // 搜索小区
666
- async 'searchArea' (area, index) {
667
- let data = {
668
- tablename: 't_area',
669
- condition: `f_filialeid = '${this.$login.f.orgid}' and f_street = '${this.show_data.f_street}' and f_residential_area like '%${area}%'`
670
- }
671
- let http = new HttpResetClass()
672
- let res = await http.load(
673
- 'POST',
674
- `rs/sql/singleTable`,
675
- {data: data},
676
- {resolveMsg: null, rejectMsg: '小区查询失败!!!'}
677
- )
678
-
679
- if (res.data.length === 0) {
680
- return
681
- }
682
-
683
- this.setLabelOptions('小区', res.data.map(item => {
684
- return {
685
- label: item.f_residential_area,
686
- value: item.f_residential_area
687
- }
688
- }))
689
- },
690
- // 选择气价
691
- 'priceChange' (index) {
692
- if (isEmpty(this.show_data.stairPrice)) {
693
- return
694
- }
695
-
696
- let stairPrice = this.getLableValue('气价名称')
697
-
698
- this.setLabelValue('气价类型', stairPrice.f_price_type)
699
- this.setLabelValue('用气性质', stairPrice.f_gasproperties)
700
- this.setLabelValue('价格', stairPrice.f_price)
701
- this.setLabelValue('客户类型', stairPrice.f_user_type)
702
-
703
- this.show_data.f_price_id = stairPrice.f_price_id
704
- this.show_data.f_price_name = stairPrice.f_price_name
705
- },
706
- // 选择开发商
707
- async 'devInfoChange' (index) {
708
- if (isEmpty(this.show_data.f_company_name)) {
709
- return
710
- }
711
- let data = {
712
- tablename: 't_dev_info',
713
- condition: `f_orgid = '${this.$login.f.orgid}' and f_dev_name = '${this.show_data.f_company_name}'`
714
- }
715
- let res = await this.$resetpost(
716
- `rs/sql/singleTable`,
717
- {data: data},
718
- {resolveMsg: null, rejectMsg: '公司查询失败!!!'}
719
- )
720
- this.show_data.f_dev_id = res.data[0].id
721
- this.show_data.f_dev_code = res.data[0].f_dev_code
722
- this.setLabelValue('法人名称', res.data[0].f_legal_person)
723
- this.setLabelValue('身份证', res.data[0].f_idnumber)
724
- this.setLabelValue('营业执照', res.data[0].f_license_num)
725
- },
726
- // 退款金额
727
- 'refundMoneyChange' (index) {
728
- let f_cumulative_payment_money = this.show_data.f_cumulative_payment_money
729
- let f_refund_money = this.show_data.fields[index].value
730
-
731
- if (f_refund_money > f_cumulative_payment_money) {
732
- this.$showAlert('退款金额不能大于累计缴费金额!!!', 'warning', 3000)
733
- this.show_data.fields[index].value = null
734
- }
735
- },
736
- // 检查重复
737
- 'checkRepeat' (index) {
738
- this.checkDuplicate(index)
739
- },
740
- // 选择报建项目
741
- 'selectApply' (row) {
742
- this.setLabelValue('工程名称', row.f_entry_name)
743
- this.setLabelValue('工程编号', row.f_apply_num)
744
- this.setLabelValue('报建类型', row.f_apply_type)
745
- this.setLabelValue('用户名称', row.f_user_name)
746
- this.setLabelValue('用户电话', row.f_phone)
747
- this.setLabelValue('证件类型', row.f_credentials)
748
- this.setLabelValue('证件号码', row.f_idnumber)
749
- this.setLabelValue('地址', row.f_address)
750
- this.setLabelValue('累计缴费金额', row.f_cumulative_payment_money)
751
-
752
- this.show_data.parentApply = JSON.parse(JSON.stringify(row))
753
-
754
- delete row.id
755
- delete row.actid
756
- delete row.defid
757
- delete row.defname
758
- delete row.version
759
- delete row.f_apply_num
760
- delete row.f_sub_state
761
- delete row.f_apply_type
762
- delete row.f_process_id
763
-
764
- this.show_data = Object.assign({}, this.show_data, row)
765
-
766
- this.show_data.f_parent_process_id = this.show_data.parentApply.f_process_id
767
- },
768
- // 是否终止
769
- 'isStopChange' (index) {
770
- let f_is_stop = this.show_data.f_is_stop
771
-
772
- for (const item of this.show_data.fields) {
773
- if (f_is_stop === '是') {
774
- if (item.label === '终止原因') {
775
- item.hidden = false
776
- item.required = true
777
- }
778
- } else {
779
- if (item.label === '终止原因') {
780
- item.hidden = true
781
- item.required = false
782
- }
783
- }
784
- }
785
- },
786
- // 终止报建初始化
787
- async 'stopApplyReadyEvent' () {
788
-
789
- let f_is_stop = this.getLableValue('是否终止')
790
-
791
- for (const item of this.show_data.fields) {
792
- if (f_is_stop === '是') {
793
- if (item.label === '终止原因') {
794
- item.hidden = false
795
- item.required = true
796
- }
797
- } else {
798
- if (item.label === '终止原因') {
799
- item.hidden = true
800
- item.required = false
801
- }
802
- }
803
- }
804
-
805
- if (isEmpty(this.show_data.f_parent_process_id)) {
806
- return
807
- }
808
- let data = {
809
- condition: `f_process_id = '${this.show_data.f_parent_process_id}'`,
810
- data: {
811
- id: this.$login.f.id,
812
- orgid: this.$login.f.orgid
813
- }
814
- }
815
- let res = await this.$resetpost(
816
- `rs/sql/supervisory`,
817
- {data: data},
818
- {resolveMsg: null, rejectMsg: '项目查询失败!!!'}
819
- )
820
- this.show_data.parentApply = res.data[0]
821
- },
822
- // 选择用户档案信息
823
- 'selectUserinfo' (row) {
824
- this.setLabelValue('用户编号', row.f_userinfo_code)
825
- this.setLabelValue('用户名称', row.f_user_name)
826
- this.setLabelValue('用户电话', row.f_user_phone)
827
- this.setLabelValue('证件类型', row.f_credentials)
828
- this.setLabelValue('证件号码', row.f_idnumber)
829
- this.setLabelValue('地址', row.f_address)
830
-
831
- this.show_data.f_userinfo_id = row.f_userinfo_id
832
- this.show_data.f_userinfo_code = row.f_userinfo_code
833
- },
834
- // 是否购买保险
835
- async 'isInsureChange' (index) {
836
- if (!this.show_data.f_is_insure) {
837
- return
838
- }
839
- let f_is_insure = this.show_data.f_is_insure
840
- for (const item of this.show_data.fields) {
841
- if (f_is_insure === '是') {
842
- if (item.label === '保费开始日期' || item.label === '保费结束日期' || item.label === '险种' || item.label === '保费金额') {
843
- item.hidden = false
844
- item.required = true
845
- }
846
- if (item.label === '保险备注') {
847
- item.hidden = false
848
- }
849
- } else {
850
- if (item.label === '保费开始日期' || item.label === '保费结束日期' || item.label === '险种' || item.label === '保费金额' || item.label === '保险备注') {
851
- item.hidden = true
852
- item.required = false
853
- }
854
- }
855
- }
856
- },
857
- // 通气点火初始化
858
- async 'gasReadyEvent' () {
859
- // 是否有气价信息
860
- if (!isEmpty(this.show_data.f_price_id)) {
861
- let priceList = await this.getPrice(this.show_data.f_price_id)
862
- this.setLabelValue('气价名称', priceList[0].value)
863
- }
864
-
865
- let data = {
866
- tablename: 't_userfees',
867
- condition: `f_orgid = '${this.$login.f.orgid}' and f_userinfo_id = '${this.show_data.f_userinfo_id}' and f_state = '待执行'`
868
- }
869
- let http = new HttpResetClass()
870
- let res = await http.load(
871
- 'POST',
872
- `rs/sql/singleTable`,
873
- {data: data},
874
- {resolveMsg: null, rejectMsg: '保险查询失败!!!'}
875
- )
876
- if (res.data.length > 0) {
877
- this.setLabelValue('待执行保险', '是')
878
- for (const item of this.show_data.fields) {
879
- if (item.label === '保费开始日期' || item.label === '是否购买保险' || item.label === '保费结束日期' || item.label === '险种' || item.label === '保费金额' || item.label === '保险备注') {
880
- item.hidden = true
881
- item.required = false
882
- item.value = null
883
- }
884
- }
885
- } else {
886
- this.setLabelValue('待执行保险', '否')
887
- for (const item of this.show_data.fields) {
888
- if (item.label === '是否购买保险' || item.label === '保费开始日期' || item.label === '保费结束日期' || item.label === '险种' || item.label === '保费金额' || item.label === '保险备注') {
889
- item.hidden = false
890
- item.required = true
891
- }
892
- }
893
- }
894
-
895
- // 保险初始化显示内容
896
- let f_is_insure = this.getLableValue('是否购买保险')
897
- for (const item of this.show_data.fields) {
898
- if (f_is_insure === '是') {
899
- if (item.label === '保费开始日期' || item.label === '保费结束日期' || item.label === '险种' || item.label === '保费金额') {
900
- item.hidden = false
901
- item.required = true
902
- }
903
- if (item.label === '保险备注') {
904
- item.hidden = false
905
- }
906
- // 本期保费到期时间默认一年
907
- if (isEmpty(this.selectdata.f_ins_expiration_date)) {
908
- let f_ins_expiration_date = new Date().setFullYear(new Date().getFullYear() + 1)
909
- this.setLabelValue("保费结束日期", new Date(f_ins_expiration_date).Format('yyyy-MM-dd'))
910
- }
911
- }
912
- if (f_is_insure === '否') {
913
- if (item.label === '保费开始日期' || item.label === '保费结束日期' || item.label === '险种' || item.label === '保费金额' || item.label === '保险备注') {
914
- item.hidden = true
915
- item.required = false
916
- }
917
- }
918
- }
919
- },
920
- // 合同金额失去焦点
921
- async 'contractMoneyChange' (index) {
922
- let data = {
923
- operator: '+',
924
- num1: this.show_data.f_contract_money || 0,
925
- num2: this.getLableValue('追加金额') || 0
926
- }
927
- let res = await this.$resetpost(
928
- `rs/logic/compute`,
929
- {data: data},
930
- {resolveMsg: null, rejectMsg: '金额计算失败!!!'}
931
- )
932
-
933
- this.setLabelValue('应交金额', res.data)
934
- },
935
- // 街道失去焦点
936
- async 'streetChange' (index) {
937
- if (isEmpty(this.show_data.f_street)) {
938
- return
939
- }
940
-
941
- this.setLabelValue('小区', null)
942
-
943
- let data = {
944
- tablename: 't_area',
945
- condition: `f_filialeid = '${this.$login.f.orgid}' and f_street = '${this.show_data.f_street}'`
946
- }
947
- let http = new HttpResetClass()
948
- let res = await http.load(
949
- 'POST',
950
- `rs/sql/singleTable`,
951
- {data: data},
952
- {resolveMsg: null, rejectMsg: '小区查询失败!!!'}
953
- )
954
-
955
- this.setLabelOptions('小区', res.data.map(item => {
956
- return {
957
- label: item.f_residential_area,
958
- value: item.f_residential_area
959
- }
960
- }))
961
- },
962
- // 区县失去焦点
963
- async 'pcdChange' (index) {
964
- if (isEmpty(this.show_data.f_pcd)) {
965
- return
966
- }
967
-
968
- this.setLabelValue('街道', null)
969
- this.setLabelValue('小区', null)
970
-
971
-
972
-
973
- let data = {
974
- tablename: 't_street',
975
- condition: `f_filialeid = '${this.$login.f.orgid}' and f_pcd = '${this.show_data.f_pcd}'`
976
- }
977
- let f_address_type = this.getLableValue('地址类型')
978
-
979
- if (f_address_type === '民用市区') {
980
- data.condition = `f_filialeid = '${this.$login.f.orgid}' and f_pcd = '${this.show_data.f_pcd}' and f_iscity = '市区'`
981
- }
982
- if (f_address_type === '民用乡镇') {
983
- data.condition = `f_filialeid = '${this.$login.f.orgid}' and f_pcd = '${this.show_data.f_pcd}' and f_iscity = '乡镇'`
984
- }
985
-
986
- let http = new HttpResetClass()
987
- let res = await http.load(
988
- 'POST',
989
- `rs/sql/singleTable`,
990
- {data: data},
991
- {resolveMsg: null, rejectMsg: '街道查询失败!!!'}
992
- )
993
-
994
- this.setLabelOptions('街道', res.data.map(item => {
995
- return {
996
- label: item.f_street,
997
- value: item.f_street
998
- }
999
- }))
1000
- },
1001
- // 地址类型失去焦点
1002
- 'addressTypeChange' (index) {
1003
- this.setLabelValue('街道', null)
1004
- this.setLabelValue('小区', null)
1005
- let f_address_type = this.show_data.fields[index].value
1006
- for (const item of this.show_data.fields) {
1007
- if (f_address_type === '民用地址') {
1008
- if (item.label === '区/县' || item.label === '街道' || item.label === '小区' || item.label === '门牌号') {
1009
- item.hidden = false
1010
- item.required = true
1011
- item.value = null
1012
- }
1013
- if (item.label === '楼号' || item.label === '单元' || item.label === '楼层') {
1014
- item.hidden = false
1015
- item.required = false
1016
- item.value = null
1017
- }
1018
- if (item.label === '地址') {
1019
- item.readonly = true
1020
- item.value = null
1021
- }
1022
- }
1023
- if (f_address_type === '特殊地址') {
1024
- if (item.label === '区/县' || item.label === '街道') {
1025
- item.hidden = false
1026
- item.required = true
1027
- item.value = null
1028
- }
1029
- if (item.label === '小区') {
1030
- item.hidden = false
1031
- item.required = false
1032
- item.value = null
1033
- }
1034
- if (item.label === '楼号' || item.label === '单元' || item.label === '楼层' || item.label === '门牌号') {
1035
- item.hidden = true
1036
- item.required = false
1037
- item.value = null
1038
- }
1039
- if (item.label === '地址') {
1040
- item.readonly = false
1041
- item.value = null
1042
- }
1043
- }
1044
- }
1045
- },
1046
- // 团购转散户初始化
1047
- 'apply2ReadyEvent' () {
1048
- if (this.show_data.f_apply_source === '线下发起') {
1049
- this.addressInitialization()
1050
- this.hideLabels('用户编号')
1051
- this.electiveLabels('用户编号')
1052
- this.showLabels('片区', '地址类型')
1053
- this.requiredLabels('片区', '地址类型')
1054
- }
1055
- if (this.show_data.f_apply_source === '自动发起') {
1056
- this.hideLabels('片区', '地址类型')
1057
- this.electiveLabels('片区', '地址类型',)
1058
- }
1059
- },
1060
- // 申请节点初始化
1061
- 'applyReadyEvent' () {
1062
- this.addressInitialization()
1063
-
1064
- this.pcdChange()
1065
- this.streetChange()
1066
- },
1067
- // ===========================================
1068
- async 'button'() {
1069
- if (this.show_data.button.before) {
1070
- await this[this.show_data.button.before]()
1071
- }
1072
- // 点击重置按钮就重置数据
1073
- if (this.show_data.button.button_name === '重置') {
1074
- this.$dispatch('breakControl', this.selectdata)
1075
- return
1076
- }
1077
-
1078
- this.show_data.user = this.$login.f
1079
- this.show_data.start_activity = this.$workflow_vue.start_activity
1080
- this.show_data.xmlfilename = this.$workflow_vue.workflow_xmlfilename
1081
-
1082
- let res = await this.$resetpost(
1083
- `rs/logic/ApplyProductService`,
1084
- {data: this.show_data},
1085
- {resolveMsg: null, rejectMsg: '数据保存失败'}
1086
- )
1087
-
1088
- if (this.show_data.button.after) {
1089
- this[this.show_data.button.after]()
1090
- }
1091
- this.$dispatch('loadPage')
1092
- },
1093
- // 失去焦点出触发事件
1094
- 'onchange' (index) {
1095
- if (this.show_data.defname === '申请登记') {
1096
- if (
1097
- this.show_data.fields[index].label === '片区' ||
1098
- this.show_data.fields[index].label === '区/县' ||
1099
- this.show_data.fields[index].label === '街道' ||
1100
- this.show_data.fields[index].label === '小区' ||
1101
- this.show_data.fields[index].label === '楼号' ||
1102
- this.show_data.fields[index].label === '单元' ||
1103
- this.show_data.fields[index].label === '楼层' ||
1104
- this.show_data.fields[index].label === '门牌号'
1105
- ) {
1106
- let f_pcd = this.getLableValue('区/县') || ''
1107
- let f_street = this.getLableValue('街道') || ''
1108
- let f_residential_area = this.getLableValue('小区') || ''
1109
- let f_building = this.getLableValue('楼号') || ''
1110
- let f_building_suffix = isEmpty(this.getLableValue('楼号')) ? '' : '号楼'
1111
- let f_unit = this.getLableValue('单元') || ''
1112
- let f_unit_suffix = isEmpty(this.getLableValue('单元')) ? '' : '单元'
1113
- let f_floor = this.getLableValue('楼层') || ''
1114
- let f_floor_suffix = isEmpty(this.getLableValue('楼层')) ? '' : '层'
1115
- let f_room = this.getLableValue('门牌号') || ''
1116
- let f_room_suffix = isEmpty(this.getLableValue('门牌号')) ? '' : '室'
1117
-
1118
- let f_address = f_pcd + f_street + f_residential_area + f_building + f_building_suffix + f_unit + f_unit_suffix + f_floor + f_floor_suffix + f_room + f_room_suffix
1119
- this.setLabelValue("地址", f_address)
1120
- }
1121
- }
1122
- if (this.show_data.fields[index].label === '联系电话') {
1123
- let phone = this.show_data.fields[index].value
1124
- // 电话号码效验
1125
- if (!(/^1[3456789]\d{9}$/.test(phone))) {
1126
- this.show_data.fields[index].value = ""
1127
- this.$showAlert('电话号码格式不正确,请重新输入。', 'info', 2000)
1128
- }
1129
- }
1130
- },
1131
- selectSearch (val, index) {},
1132
- 'onblur' (index) {},
1133
- 'oninput' (index) {},
1134
- 'initializtionView' () {},
1135
- async 'onchangeModal' (index, fieldIndex) {
1136
- },
1137
- async 'onblurModal' (index, fieldIndex) {
1138
-
1139
- },
1140
- async 'oninputModal' (index, fieldIndex) {
1141
-
1142
- },
1143
- async 'onetomanydelete' (index, rowIndex) {
1144
-
1145
- let http = new HttpResetClass()
1146
-
1147
- let res = await http.load(
1148
- 'DELETE',
1149
- `rs/entity/${this.show_data.onetomany[index].tables[0]}/${this.show_data.onetomany[index].rows[rowIndex].id}`,
1150
- null,
1151
- {resolveMsg: null, rejectMsg: '删除失败!!!'}
1152
- )
1153
-
1154
- res = await this.$resetpost(
1155
- 'rs/entity/t_apply',
1156
- this.show_data
1157
- )
1158
-
1159
- this.$dispatch('breakControl', this.show_data)
1160
- },
1161
- async 'onetomanyupdate' (index, rowIndex) {
1162
- let data = this.show_data.onetomany[index].rows[rowIndex]
1163
-
1164
- this.show_data.onetomany[index].fields.forEach(item => {
1165
- data[item.field] = item.value
1166
- })
1167
- let res = await this.$resetpost(
1168
- `rs/entity/${this.show_data.onetomany[index].tables[0]}`,
1169
- data
1170
- )
1171
-
1172
- res = await this.$resetpost(
1173
- 'rs/entity/t_apply',
1174
- this.show_data
1175
- )
1176
-
1177
- this.$dispatch('breakControl', this.show_data)
1178
- },
1179
- async 'onetomanyadd' (index) {
1180
- let data = {
1181
- f_process_id : this.show_data.f_process_id,
1182
- f_operator_id: this.$login.f.id,
1183
- f_operator: this.$login.f.name,
1184
- f_operation_date: new Date().Format('yyyy-MM-dd HH:mm:ss'),
1185
- f_orgid: this.$login.f.orgid,
1186
- f_orgname: this.$login.f.orgs
1187
- }
1188
- this.show_data.onetomany[index].fields.forEach(item => {
1189
- data[item.field] = item.value
1190
- })
1191
- let res = await this.$resetpost(
1192
- `rs/entity/${this.show_data.onetomany[index].tables[0]}`,
1193
- data
1194
- )
1195
-
1196
- res = await this.$resetpost(
1197
- 'rs/entity/t_apply',
1198
- this.show_data
1199
- )
1200
-
1201
- this.$dispatch('breakControl', this.show_data)
1202
- },
1203
- async 'importEvent' (index, table, configName, filepath) {
1204
- let data = {
1205
- selectdata: this.show_data,
1206
- table: table,
1207
- filepath: filepath,
1208
- configName: configName,
1209
- user: this.$login.f
1210
- }
1211
-
1212
- let res = await this.$resetpost(
1213
- `rs/logic/importEvent`,
1214
- data
1215
- )
1216
-
1217
- this.$dispatch('breakControl', this.show_data)
1218
- },
1219
- 'onbutchange' (index) {
1220
-
1221
- },
1222
- 'onbutblur' (index) {
1223
-
1224
- },
1225
- 'onbutinput' (index) {
1226
-
1227
- }
1228
- },
1229
- watch: {
1230
- }
1231
- }
1232
- </script>
1233
- <style scoped>
1234
- /*清除model中的浮动*/
1235
- .clearfix:after,.clearfix:before{
1236
- display: table;
1237
- }
1238
- .clearfix:after{
1239
- clear: both;
1240
- }
1241
- </style>
1
+ <template>
2
+ <div class="" v-if="showview">
3
+ <show-back-reason :selectdata="show_data"></show-back-reason>
4
+ <service-view v-ref:serviceview :data="show_data"></service-view>
5
+ </div>
6
+ </template>
7
+ <script>
8
+ import Vue from 'vue'
9
+ import {HttpResetClass} from 'vue-client'
10
+ import {isEmpty} from "../../../Util";
11
+
12
+ // Date格式化
13
+ Date.prototype.Format = function (fmt) {
14
+ var o = {
15
+ "M+": this.getMonth() + 1, //月份
16
+ "d+": this.getDate(), //日
17
+ "H+": this.getHours(), //小时
18
+ "m+": this.getMinutes(), //分
19
+ "s+": this.getSeconds(), //秒
20
+ "q+": Math.floor((this.getMonth() + 3) / 3), //季度
21
+ "S": this.getMilliseconds() //毫秒
22
+ };
23
+ if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
24
+ for (var k in o)
25
+ if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
26
+ return fmt;
27
+ }
28
+
29
+ export default {
30
+ title: '报建流程业务控制层',
31
+ props: ['selectdata'],
32
+ data () {
33
+ return {
34
+ data: null, // 数据库数据,json配置文件数据的数据集合
35
+ json_datas: null, // Json配置文件集合
36
+ showview: false, // 控制显示service-view组件
37
+ show_data: null, // 给view层显示的数据
38
+ config: {}
39
+ }
40
+ },
41
+ ready () {
42
+ this.refurbish()
43
+ },
44
+ methods: {
45
+ // 组件初始化操作
46
+ async refurbish() {
47
+ this.json_datas = this.$workflow_vue
48
+ let sum = 0
49
+ let jsonData = {}
50
+ if (!this.json_datas || !this.json_datas.activitys || this.json_datas.activitys.length === 0) {
51
+ this.$showMessage("网络故障,请刷新页面")
52
+ return
53
+ }
54
+ this.json_datas.activitys.forEach(item => {
55
+ if (this.selectdata.defname === item.title) {
56
+ jsonData = item // 拿到当前节点的json配置信息
57
+ sum++ // 节点名一样的个数
58
+ }
59
+ return this.selectdata.defname === item.title // 拿到当前节点的json配置信息
60
+ })
61
+
62
+ if (sum === 0) {
63
+ this.$showMessage(`没有在JSON配置文件中找到活动名为:(${this.selectdata.defname})的节点配置`)
64
+ return
65
+ }
66
+ if (sum > 1) {
67
+ this.$showMessage(`在JSON配置文件中找到活动名为:(${this.selectdata.defname})的节点配置:${sum}个`)
68
+ return
69
+ }
70
+
71
+ this.selectdata = Object.assign({}, this.selectdata, jsonData)
72
+
73
+ // fields 字段填充值
74
+ for (const item of this.selectdata.fields) {
75
+ if (!item.value) {
76
+ item.value = null
77
+ }
78
+
79
+ if (!item.value && (item.default || item.default === 0) && item.type !== 'datepicker') {
80
+ if (item.eval) {
81
+ item.value = eval(item.default)
82
+ } else {
83
+ item.value = item.default
84
+ }
85
+ }
86
+
87
+ if (this.selectdata[item.field]) {
88
+ // 将json字符串格式化赋值给value
89
+ if (String(this.selectdata[item.field]).startsWith("{")) {
90
+ item.value = JSON.parse(this.selectdata[item.field])
91
+ } else {
92
+ item.value = this.selectdata[item.field]
93
+ }
94
+ }
95
+ if (this.selectdata[item.field] === 0) {
96
+ item.value = 0
97
+ }
98
+
99
+ // datepicker
100
+ if (item.type === 'datepicker' && !item.value && item.default) {
101
+ item.value = new Date().Format(`${item.format ? item.format : 'yyyy-MM-dd HH:mm:ss'}`)
102
+ }
103
+
104
+ // 如果配置类型为select,优先从参数列表获取options
105
+ if (item.type === 'select' || item.type === 'checkbox') {
106
+ if (item.param) {
107
+ let temp = this.$appdata.getParam(item.label)
108
+
109
+ if (temp && temp.length > 0) {
110
+ item.options = temp
111
+ }
112
+
113
+ if (item.paramLabel) {
114
+ temp = this.$appdata.getParam(item.paramLabel)
115
+ if (temp && temp.length > 0) {
116
+ item.options = temp
117
+ }
118
+ }
119
+ }
120
+
121
+ if (item.ready) {
122
+ item.options = await this[item.ready]()
123
+ }
124
+ }
125
+
126
+
127
+ if (item.type === 'checkbox') {
128
+ if (this.selectdata[item.field]) {
129
+ item.value = JSON.parse(this.selectdata[item.field])
130
+ } else {
131
+ item.value = []
132
+ }
133
+ }
134
+
135
+ this.selectdata[item.field] = item.value
136
+ }
137
+
138
+ // 控制组件
139
+ if (this.selectdata.components) {
140
+ this.selectdata.components.forEach(item => {
141
+ if (!item.mark) {
142
+ item.mark = 0
143
+ }
144
+ })
145
+ }
146
+
147
+ // 初始化onetomany
148
+ if (this.selectdata.onetomany) {
149
+ for (const item of this.selectdata.onetomany) {
150
+ let res = null
151
+ if (item.queryEvent) {
152
+ res = this[item.queryEvent]()
153
+ } else {
154
+ let data = {
155
+ tablename: item.tables[0],
156
+ condition: `f_process_id='${this.selectdata.f_process_id}'`
157
+ }
158
+ res = await this.$resetpost(
159
+ 'rs/sql/singleTable',
160
+ {data: data},
161
+ {resolveMsg: null, rejectMsg: 'onetomany查询失败'}
162
+ )
163
+ }
164
+
165
+ item.rows = res.data
166
+
167
+ // 初始化onetomany中的fields
168
+ for (const field of item.fields) {
169
+ if (!field.value) {
170
+ if (field.value !== 0) {
171
+ field.value = null
172
+ }
173
+ }
174
+
175
+ if (field.default || field.default === 0) {
176
+ field.value = field.default
177
+ }
178
+
179
+ // datepicker
180
+ if (field.type === 'datepicker' && !field.value && field.default) {
181
+ field.value = new Date().Format(`${field.format ? field.format : 'yyyy-MM-dd HH:mm:ss'}`)
182
+ }
183
+
184
+ if (field.type === 'select') {
185
+
186
+ let temp = this.$appdata.getParam(field.label)
187
+
188
+ if (temp && temp.length > 0) {
189
+ field.options = temp
190
+ }
191
+
192
+ if (field.paramLabel) {
193
+ temp = this.$appdata.getParam(field.paramLabel)
194
+ if (temp && temp.length > 0) {
195
+ item.options = temp
196
+ }
197
+ }
198
+ }
199
+ }
200
+ }
201
+ }
202
+
203
+ // 初始化 buttons_fields
204
+ for (const item of this.selectdata.buttons) {
205
+ if (item.button_name === '下发') {
206
+
207
+ let data = {
208
+ source: item.source,
209
+ userid: this.$login.f.id
210
+ }
211
+ if (item.sourceMethod) {
212
+ data.source = this[item.sourceMethod]()
213
+ }
214
+ if (!data.source) {
215
+ this.$showMessage("请配置获取人员表达式")
216
+ return
217
+ }
218
+
219
+ let res = await this.$resetpost(
220
+ 'rs/search',
221
+ {data: data},
222
+ {resolveMsg: null, rejectMsg: '下发人员查询失败!!!'}
223
+ )
224
+
225
+ let options = res.data.map(source => {
226
+ return {
227
+ "label": source.name,
228
+ "value": source.id
229
+ }
230
+ })
231
+
232
+ if (item.button_fields.length !== 1) {
233
+ this.$showMessage("下发有且只能有一个字段!!!")
234
+ return
235
+ }
236
+
237
+ item.button_fields[0].options = options
238
+ }
239
+ if (item.button_fields) {
240
+ item.button_fields.forEach(x => {
241
+ // 如果配置类型为select,优先从参数列表获取options
242
+ if (x.type === 'select') {
243
+
244
+ if (x.param) {
245
+ let temp = this.$appdata.getParam(x.label)
246
+
247
+ if (temp && temp.length > 0) {
248
+ x.options = temp
249
+ }
250
+
251
+ if (x.paramLabel) {
252
+ temp = this.$appdata.getParam(x.paramLabel)
253
+ if (temp && temp.length > 0) {
254
+ x.options = temp
255
+ }
256
+ }
257
+ }
258
+
259
+ }
260
+ })
261
+ }
262
+ }
263
+
264
+ if (this.selectdata.f_apply_source === '微信公众号' && this.selectdata.defname === '现场勘察') {
265
+ for (const item of this.selectdata.fields) {
266
+ if (item.label==='预约地址' || item.label==='地址类型' || item.label==='片区' || item.label==='区/县' || item.label==='街道' || item.label==='小区') {
267
+ item.hidden = false
268
+ item.required = true
269
+ }
270
+ }
271
+ }
272
+ // 消除双向绑定,避免子组件(显示层)数据更改,父组件(控制层)也更改
273
+ let temp = JSON.parse(JSON.stringify(this.selectdata))
274
+
275
+ this.show_data = temp
276
+ this.$nextTick(() => {
277
+ this.showview = true
278
+ })
279
+ },
280
+ // 金额转大写
281
+ smalltoBIG(n) {
282
+ let fraction = ['角', '分'];
283
+ let digit = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖'];
284
+ let unit = [['元', '万', '亿'], ['', '拾', '佰', '仟']];
285
+ let head = n < 0 ? '欠' : '';
286
+ n = Math.abs(n);
287
+
288
+ let s = '';
289
+
290
+ for (var i = 0; i < fraction.length; i++) {
291
+ s += (digit[Math.floor(n * 10 * Math.pow(10, i)) % 10] + fraction[i]).replace(/零./, '');
292
+ }
293
+ s = s || '整';
294
+ n = Math.floor(n);
295
+
296
+ for (var i = 0; i < unit[0].length && n > 0; i++) {
297
+ let p = '';
298
+ for (var j = 0; j < unit[1].length && n > 0; j++) {
299
+ p = digit[n % 10] + unit[1][j] + p;
300
+ n = Math.floor(n / 10);
301
+ }
302
+ s = p.replace(/(零.)*零$/, '').replace(/^$/, '零') + unit[0][i] + s;
303
+ }
304
+ return head + s.replace(/(零.)*零元/, '元').replace(/(零.)+/g, '零').replace(/^整$/, '零元整')
305
+ },
306
+ getLableValue(label) {
307
+ for (const item of this.show_data.fields) {
308
+ if (item.label === label && item.type !== 'number') {
309
+ return item.value || ''
310
+ }
311
+ if (item.label === label && item.type === 'number') {
312
+ return item.value || 0
313
+ }
314
+ }
315
+ },
316
+ getLableOptions(label) {
317
+ for (const item of this.show_data.fields) {
318
+ if (item.label === label) {
319
+ return item.options
320
+ }
321
+ }
322
+ },
323
+ setLabelValue(label, value) {
324
+ for (const item of this.show_data.fields) {
325
+ if (item.label === label) {
326
+ item.value = value
327
+ this.show_data[item.field] = value
328
+ }
329
+ }
330
+ },
331
+ setLabelOptions(label, options) {
332
+ for (const item of this.show_data.fields) {
333
+ if (item.label === label) {
334
+ item.options = options
335
+ }
336
+ }
337
+ },
338
+ showLabels(...labels) {
339
+ for (const item of this.show_data.fields) {
340
+ if (labels.includes(item.label)) {
341
+ item.hidden = false
342
+ }
343
+ }
344
+ },
345
+ hideLabels(...labels) {
346
+ for (const item of this.show_data.fields) {
347
+ if (labels.includes(item.label)) {
348
+ item.hidden = true
349
+ }
350
+ }
351
+ },
352
+ requiredLabels(...labels) {
353
+ for (const item of this.show_data.fields) {
354
+ if (labels.includes(item.label)) {
355
+ item.required = true
356
+ }
357
+ }
358
+ },
359
+ electiveLabels(...labels) {
360
+ for (const item of this.show_data.fields) {
361
+ if (labels.includes(item.label)) {
362
+ item.required = false
363
+ }
364
+ }
365
+ },
366
+ readonlyLabels(...labels) {
367
+ for (const item of this.show_data.fields) {
368
+ if (labels.includes(item.label)) {
369
+ item.readonly = true
370
+ item.disabled = true
371
+ }
372
+ }
373
+ },
374
+ readwriteLabels(...labels) {
375
+ for (const item of this.show_data.fields) {
376
+ if (labels.includes(item.label)) {
377
+ item.readonly = false
378
+ item.disabled = false
379
+ }
380
+ }
381
+ },
382
+ async checkDuplicate(index) {
383
+ let http = new HttpResetClass()
384
+ let data = {
385
+ tablename: 't_apply',
386
+ condition: `${this.show_data.fields[index].field} = '${this.show_data.fields[index].value}'`
387
+ }
388
+ let res = await http.load('POST', 'rs/sql/singleTable', {data: data}, {
389
+ resolveMsg: null,
390
+ rejectMsg: `${this.show_data.fields[index].label}查询失败`
391
+ })
392
+ if (res.data.length > 0) {
393
+ this.show_data.fields[index].value = null
394
+ this.$showAlert(`${this.show_data.fields[index].label}已存在!!!`, 'warning', 3000)
395
+ }
396
+ },
397
+ // 获取片区
398
+ async getSliceArea () {
399
+ let data = {
400
+ source: 'this.getParentByType($organization$).getAllChildrens().where(row.getType() == $zone$)',
401
+ userid: this.$login.f.id
402
+ }
403
+
404
+ let http = new HttpResetClass()
405
+ let res = await http.load(
406
+ 'POST',
407
+ `rs/search`,
408
+ {data: data},
409
+ {resolveMsg: null, rejectMsg: '片区查询失败!!!'}
410
+ )
411
+
412
+ return res.data.map(item => {
413
+ return {
414
+ label: item.name,
415
+ value: item.name
416
+ }
417
+ })
418
+ },
419
+ // 获取区县
420
+ async getPcd () {
421
+ let data = {
422
+ tablename: 't_pcd',
423
+ condition: `f_filialeid = '${this.$login.f.orgid}'`
424
+ }
425
+ let http = new HttpResetClass()
426
+ let res = await http.load(
427
+ 'POST',
428
+ `rs/sql/singleTable`,
429
+ {data: data},
430
+ {resolveMsg: null, rejectMsg: '区县查询失败!!!'}
431
+ )
432
+
433
+ return res.data.map(item => {
434
+ return {
435
+ label: item.f_pcd,
436
+ value: item.f_pcd
437
+ }
438
+ })
439
+ },
440
+ // 缴费前置
441
+ chargeBefore () {
442
+ if (Number(this.show_data.f_due_money) > Number(this.show_data.f_cumulative_payment_money) || Number(this.show_data.f_surplus_money) > 0) {
443
+ this.$showAlert('费用未结清!!!', 'warning', 3000)
444
+ throw null
445
+ }
446
+ },
447
+ // 施工前置
448
+ async constructionBefore () {
449
+ let http = new HttpResetClass()
450
+ let data = {
451
+ condition: `ui.f_process_id = '${this.show_data.f_process_id}' and uf.f_table_state = '待开通'`
452
+ }
453
+ let res = await http.load(
454
+ 'POST',
455
+ 'rs/sql/countApplyUserinfo',
456
+ {data: data},
457
+ {
458
+ resolveMsg: null,
459
+ rejectMsg: '安装明细查询失败!!!'
460
+ })
461
+ if (res.data[0].num > 0) {
462
+ this.$showAlert(`还有${res.data[0].num}户未安装,无法提交`, 'warning', 3000)
463
+ throw `还有${res.data[0].num}户未安装,无法提交`
464
+ }
465
+ },
466
+ changePipeBuild () {
467
+ if (this.selectdata.f_process_dep === '工程部') {
468
+ return 'this.getParentByType($organization$).getChildByName($工程部报装$).getChildren()'
469
+ }
470
+ if (this.selectdata.f_process_dep === '运营部') {
471
+ return 'this.getParentByType($organization$).getChildByName($运营部报装$).getChildren()'
472
+ }
473
+ return 'this.getParentByType($organization$).getChildByName($工程部报装$).getChildren()'
474
+ },
475
+ async getDevInfo () {
476
+ let data = {
477
+ tablename: 't_dev_info',
478
+ condition: `f_orgid = '${this.$login.f.orgid}'`
479
+ }
480
+ let http = new HttpResetClass()
481
+ let res = await http.load(
482
+ 'POST',
483
+ `rs/sql/singleTable`,
484
+ {data: data},
485
+ {resolveMsg: null, rejectMsg: '公司查询失败!!!'}
486
+ )
487
+
488
+ return res.data.map(item => {
489
+ return {
490
+ label: item.f_dev_name,
491
+ value: item.f_dev_name
492
+ }
493
+ })
494
+ },
495
+ async getPrice (f_price_id) {
496
+ console.log('=======================')
497
+ console.log(f_price_id)
498
+
499
+ let data = {
500
+ condition: `sp.f_orgid = '${this.$login.f.orgid}'`
501
+ }
502
+
503
+ if (!isEmpty(f_price_id)) {
504
+ data.condition = `sp.f_orgid = '${this.$login.f.orgid}' and sp.f_price_id = ${f_price_id}`
505
+ }
506
+ let http = new HttpResetClass()
507
+ let res = await http.load(
508
+ 'POST',
509
+ `rs/sql/applyGetPrice`,
510
+ {data: data},
511
+ {resolveMsg: null, rejectMsg: '气价查询失败!!!'}
512
+ )
513
+
514
+ return res.data.map(item => {
515
+ return {
516
+ label: item.f_price_name,
517
+ value: item
518
+ }
519
+ })
520
+ },
521
+ addressInitialization () {
522
+ this.$getConfig(this, 'UserAddress')
523
+
524
+ let f_address_type = this.show_data.f_address_type
525
+
526
+ for (const item of this.show_data.fields) {
527
+ if (f_address_type === '民用市区') {
528
+ if (item.label === '区/县' || item.label === '街道' || item.label === '小区' || item.label === '门牌号') {
529
+ item.hidden = false
530
+ item.required = true
531
+ }
532
+ if (item.label === '楼号' || item.label === '单元' || item.label === '楼层') {
533
+ item.hidden = false
534
+ item.required = false
535
+ }
536
+ if (item.label === '地址') {
537
+ item.readonly = true
538
+ }
539
+ }
540
+ if (f_address_type === '民用乡镇') {
541
+ if (item.label === '区/县' || item.label === '街道' || item.label === '小区' || item.label === '门牌号') {
542
+ item.hidden = false
543
+ item.required = true
544
+ }
545
+ if (item.label === '楼号' || item.label === '单元' || item.label === '楼层') {
546
+ item.hidden = false
547
+ item.required = false
548
+ }
549
+ if (item.label === '楼层') {
550
+ item.hidden = true
551
+ item.required = false
552
+ }
553
+ if (item.label === '地址') {
554
+ item.readonly = true
555
+ }
556
+ }
557
+ if (f_address_type === '特殊地址') {
558
+ if (item.label === '区/县' || item.label === '街道') {
559
+ item.hidden = false
560
+ item.required = true
561
+ }
562
+ if (item.label === '小区') {
563
+ item.hidden = false
564
+ item.required = false
565
+ }
566
+ if (item.label === '楼号' || item.label === '单元' || item.label === '楼层' || item.label === '门牌号') {
567
+ item.hidden = true
568
+ item.required = false
569
+ }
570
+ if (item.label === '地址') {
571
+ item.readonly = false
572
+ }
573
+ }
574
+
575
+ if (this.show_data.f_apply_source === '线下发起' && item.label === '预约地址') {
576
+ item.hidden = true
577
+ }
578
+ }
579
+ },
580
+ async streetChange () {
581
+ if (isEmpty(this.show_data.f_street)) {
582
+ return
583
+ }
584
+
585
+ let data = {
586
+ tablename: 't_area',
587
+ condition: `f_filialeid = '${this.$login.f.orgid}' and f_street = '${this.show_data.f_street}'`
588
+ }
589
+ let http = new HttpResetClass()
590
+ let res = await http.load(
591
+ 'POST',
592
+ `rs/sql/singleTable`,
593
+ {data: data},
594
+ {resolveMsg: null, rejectMsg: '小区查询失败!!!'}
595
+ )
596
+
597
+ this.setLabelOptions('小区', res.data.map(item => {
598
+ return {
599
+ label: item.f_residential_area,
600
+ value: item.f_residential_area
601
+ }
602
+ }))
603
+ },
604
+ async pcdChange () {
605
+ if (isEmpty(this.show_data.f_pcd)) {
606
+ return
607
+ }
608
+
609
+ let data = {
610
+ tablename: 't_street',
611
+ condition: `f_filialeid = '${this.$login.f.orgid}' and f_pcd = '${this.show_data.f_pcd}'`
612
+ }
613
+ let f_address_type = this.getLableValue('地址类型')
614
+
615
+ if (f_address_type === '民用市区') {
616
+ data.condition = `f_filialeid = '${this.$login.f.orgid}' and f_pcd = '${this.show_data.f_pcd}' and f_iscity = '市区'`
617
+ }
618
+ if (f_address_type === '民用乡镇') {
619
+ data.condition = `f_filialeid = '${this.$login.f.orgid}' and f_pcd = '${this.show_data.f_pcd}' and f_iscity = '乡镇'`
620
+ }
621
+
622
+ let http = new HttpResetClass()
623
+ let res = await http.load(
624
+ 'POST',
625
+ `rs/sql/singleTable`,
626
+ {data: data},
627
+ {resolveMsg: null, rejectMsg: '街道查询失败!!!'}
628
+ )
629
+
630
+ this.setLabelOptions('街道', res.data.map(item => {
631
+ return {
632
+ label: item.f_street,
633
+ value: item.f_street
634
+ }
635
+ }))
636
+ }
637
+ },
638
+ events: {
639
+ // 选择材料
640
+ async materialNameChenge (index, fieldIndex) {
641
+ let material = this.show_data.onetomany[index].fields[fieldIndex].value
642
+
643
+ this.show_data.onetomany[index].fields.forEach(item => {
644
+ if (material[item.field]) {
645
+ item.value = material[item.field]
646
+ }
647
+ })
648
+ },
649
+ // 打开模态框获取材料
650
+ async 'getMaterialName' (index) {
651
+ let data = {
652
+ condition: `1=1`
653
+ }
654
+ let http = new HttpResetClass()
655
+ let res = await http.load(
656
+ 'POST',
657
+ `rs/sql/getStockMaterial`,
658
+ {data: data},
659
+ {resolveMsg: null, rejectMsg: '材料查询失败!!!'}
660
+ )
661
+
662
+ this.show_data.onetomany[index].fields.forEach(field => {
663
+ if (field.label === '选择材料') {
664
+ field.options = res.data.map(item => {
665
+ return {
666
+ 'label': `${item.f_material_name}--${item.f_material_style}--${item.f_material_unit}`,
667
+ 'value': item
668
+ }
669
+ })
670
+ }
671
+ })
672
+ },
673
+ // 搜索小区
674
+ async 'searchArea' (area, index) {
675
+ let data = {
676
+ tablename: 't_area',
677
+ condition: `f_filialeid = '${this.$login.f.orgid}' and f_street = '${this.show_data.f_street}' and f_residential_area like '%${area}%'`
678
+ }
679
+ let http = new HttpResetClass()
680
+ let res = await http.load(
681
+ 'POST',
682
+ `rs/sql/singleTable`,
683
+ {data: data},
684
+ {resolveMsg: null, rejectMsg: '小区查询失败!!!'}
685
+ )
686
+
687
+ if (res.data.length === 0) {
688
+ return
689
+ }
690
+
691
+ this.setLabelOptions('小区', res.data.map(item => {
692
+ return {
693
+ label: item.f_residential_area,
694
+ value: item.f_residential_area
695
+ }
696
+ }))
697
+ },
698
+ // 选择气价
699
+ 'priceChange' (index) {
700
+ if (isEmpty(this.show_data.stairPrice)) {
701
+ return
702
+ }
703
+
704
+ let stairPrice = this.getLableValue('气价名称')
705
+
706
+ this.setLabelValue('气价类型', stairPrice.f_price_type)
707
+ this.setLabelValue('用气性质', stairPrice.f_gasproperties)
708
+ this.setLabelValue('价格', stairPrice.f_price)
709
+ this.setLabelValue('客户类型', stairPrice.f_user_type)
710
+
711
+ this.show_data.f_price_id = stairPrice.f_price_id
712
+ this.show_data.f_price_name = stairPrice.f_price_name
713
+ },
714
+ // 选择开发商
715
+ async 'devInfoChange' (index) {
716
+ if (isEmpty(this.show_data.f_company_name)) {
717
+ return
718
+ }
719
+ let data = {
720
+ tablename: 't_dev_info',
721
+ condition: `f_orgid = '${this.$login.f.orgid}' and f_dev_name = '${this.show_data.f_company_name}'`
722
+ }
723
+ let res = await this.$resetpost(
724
+ `rs/sql/singleTable`,
725
+ {data: data},
726
+ {resolveMsg: null, rejectMsg: '公司查询失败!!!'}
727
+ )
728
+ this.show_data.f_dev_id = res.data[0].id
729
+ this.show_data.f_dev_code = res.data[0].f_dev_code
730
+ this.setLabelValue('法人名称', res.data[0].f_legal_person)
731
+ this.setLabelValue('身份证', res.data[0].f_idnumber)
732
+ this.setLabelValue('营业执照', res.data[0].f_license_num)
733
+ },
734
+ // 退款金额
735
+ 'refundMoneyChange' (index) {
736
+ let f_cumulative_payment_money = this.show_data.f_cumulative_payment_money
737
+ let f_refund_money = this.show_data.fields[index].value
738
+
739
+ if (f_refund_money > f_cumulative_payment_money) {
740
+ this.$showAlert('退款金额不能大于累计缴费金额!!!', 'warning', 3000)
741
+ this.show_data.fields[index].value = null
742
+ }
743
+ },
744
+ // 检查重复
745
+ 'checkRepeat' (index) {
746
+ this.checkDuplicate(index)
747
+ },
748
+ // 选择报建项目
749
+ 'selectApply' (row) {
750
+ this.setLabelValue('工程名称', row.f_entry_name)
751
+ this.setLabelValue('工程编号', row.f_apply_num)
752
+ this.setLabelValue('报建类型', row.f_apply_type)
753
+ this.setLabelValue('用户名称', row.f_user_name)
754
+ this.setLabelValue('用户电话', row.f_phone)
755
+ this.setLabelValue('证件类型', row.f_credentials)
756
+ this.setLabelValue('证件号码', row.f_idnumber)
757
+ this.setLabelValue('地址', row.f_address)
758
+ this.setLabelValue('累计缴费金额', row.f_cumulative_payment_money)
759
+
760
+ this.show_data.parentApply = JSON.parse(JSON.stringify(row))
761
+
762
+ delete row.id
763
+ delete row.actid
764
+ delete row.defid
765
+ delete row.defname
766
+ delete row.version
767
+ delete row.f_apply_num
768
+ delete row.f_sub_state
769
+ delete row.f_apply_type
770
+ delete row.f_process_id
771
+
772
+ this.show_data = Object.assign({}, this.show_data, row)
773
+
774
+ this.show_data.f_parent_process_id = this.show_data.parentApply.f_process_id
775
+ },
776
+ // 是否终止
777
+ 'isStopChange' (index) {
778
+ let f_is_stop = this.show_data.f_is_stop
779
+
780
+ for (const item of this.show_data.fields) {
781
+ if (f_is_stop === '是') {
782
+ if (item.label === '终止原因') {
783
+ item.hidden = false
784
+ item.required = true
785
+ }
786
+ } else {
787
+ if (item.label === '终止原因') {
788
+ item.hidden = true
789
+ item.required = false
790
+ }
791
+ }
792
+ }
793
+ },
794
+ // 终止报建初始化
795
+ async 'stopApplyReadyEvent' () {
796
+
797
+ let f_is_stop = this.getLableValue('是否终止')
798
+
799
+ for (const item of this.show_data.fields) {
800
+ if (f_is_stop === '是') {
801
+ if (item.label === '终止原因') {
802
+ item.hidden = false
803
+ item.required = true
804
+ }
805
+ } else {
806
+ if (item.label === '终止原因') {
807
+ item.hidden = true
808
+ item.required = false
809
+ }
810
+ }
811
+ }
812
+
813
+ if (isEmpty(this.show_data.f_parent_process_id)) {
814
+ return
815
+ }
816
+ let data = {
817
+ condition: `f_process_id = '${this.show_data.f_parent_process_id}'`,
818
+ data: {
819
+ id: this.$login.f.id,
820
+ orgid: this.$login.f.orgid
821
+ }
822
+ }
823
+ let res = await this.$resetpost(
824
+ `rs/sql/supervisory`,
825
+ {data: data},
826
+ {resolveMsg: null, rejectMsg: '项目查询失败!!!'}
827
+ )
828
+ this.show_data.parentApply = res.data[0]
829
+ },
830
+ // 选择用户档案信息
831
+ 'selectUserinfo' (row) {
832
+ this.setLabelValue('用户编号', row.f_userinfo_code)
833
+ this.setLabelValue('用户名称', row.f_user_name)
834
+ this.setLabelValue('用户电话', row.f_user_phone)
835
+ this.setLabelValue('证件类型', row.f_credentials)
836
+ this.setLabelValue('证件号码', row.f_idnumber)
837
+ this.setLabelValue('地址', row.f_address)
838
+
839
+ this.show_data.f_userinfo_id = row.f_userinfo_id
840
+ this.show_data.f_userinfo_code = row.f_userinfo_code
841
+ },
842
+ // 是否购买保险
843
+ async 'isInsureChange' (index) {
844
+ if (!this.show_data.f_is_insure) {
845
+ return
846
+ }
847
+ let f_is_insure = this.show_data.f_is_insure
848
+ for (const item of this.show_data.fields) {
849
+ if (f_is_insure === '是') {
850
+ if (item.label === '保费开始日期' || item.label === '保费结束日期' || item.label === '险种' || item.label === '保费金额') {
851
+ item.hidden = false
852
+ item.required = true
853
+ }
854
+ if (item.label === '保险备注') {
855
+ item.hidden = false
856
+ }
857
+ } else {
858
+ if (item.label === '保费开始日期' || item.label === '保费结束日期' || item.label === '险种' || item.label === '保费金额' || item.label === '保险备注') {
859
+ item.hidden = true
860
+ item.required = false
861
+ }
862
+ }
863
+ }
864
+ },
865
+ // 通气点火初始化
866
+ async 'gasReadyEvent' () {
867
+ // 是否有气价信息
868
+ if (!isEmpty(this.show_data.f_price_id)) {
869
+ let priceList = await this.getPrice(this.show_data.f_price_id)
870
+ this.setLabelValue('气价名称', priceList[0].value)
871
+ }
872
+
873
+ let data = {
874
+ tablename: 't_userfees',
875
+ condition: `f_orgid = '${this.$login.f.orgid}' and f_userinfo_id = '${this.show_data.f_userinfo_id}' and f_state = '待执行'`
876
+ }
877
+ let http = new HttpResetClass()
878
+ let res = await http.load(
879
+ 'POST',
880
+ `rs/sql/singleTable`,
881
+ {data: data},
882
+ {resolveMsg: null, rejectMsg: '保险查询失败!!!'}
883
+ )
884
+ if (res.data.length > 0) {
885
+ this.setLabelValue('待执行保险', '是')
886
+ for (const item of this.show_data.fields) {
887
+ if (item.label === '保费开始日期' || item.label === '是否购买保险' || item.label === '保费结束日期' || item.label === '险种' || item.label === '保费金额' || item.label === '保险备注') {
888
+ item.hidden = true
889
+ item.required = false
890
+ item.value = null
891
+ }
892
+ }
893
+ } else {
894
+ this.setLabelValue('待执行保险', '否')
895
+ for (const item of this.show_data.fields) {
896
+ if (item.label === '是否购买保险' || item.label === '保费开始日期' || item.label === '保费结束日期' || item.label === '险种' || item.label === '保费金额' || item.label === '保险备注') {
897
+ item.hidden = false
898
+ item.required = true
899
+ }
900
+ }
901
+ }
902
+
903
+ // 保险初始化显示内容
904
+ let f_is_insure = this.getLableValue('是否购买保险')
905
+ for (const item of this.show_data.fields) {
906
+ if (f_is_insure === '是') {
907
+ if (item.label === '保费开始日期' || item.label === '保费结束日期' || item.label === '险种' || item.label === '保费金额') {
908
+ item.hidden = false
909
+ item.required = true
910
+ }
911
+ if (item.label === '保险备注') {
912
+ item.hidden = false
913
+ }
914
+ // 本期保费到期时间默认一年
915
+ if (isEmpty(this.selectdata.f_ins_expiration_date)) {
916
+ let f_ins_expiration_date = new Date().setFullYear(new Date().getFullYear() + 1)
917
+ this.setLabelValue("保费结束日期", new Date(f_ins_expiration_date).Format('yyyy-MM-dd'))
918
+ }
919
+ }
920
+ if (f_is_insure === '否') {
921
+ if (item.label === '保费开始日期' || item.label === '保费结束日期' || item.label === '险种' || item.label === '保费金额' || item.label === '保险备注') {
922
+ item.hidden = true
923
+ item.required = false
924
+ }
925
+ }
926
+ }
927
+ },
928
+ // 合同金额失去焦点
929
+ async 'contractMoneyChange' (index) {
930
+ let data = {
931
+ operator: '+',
932
+ num1: this.show_data.f_contract_money || 0,
933
+ num2: this.getLableValue('追加金额') || 0
934
+ }
935
+ let res = await this.$resetpost(
936
+ `rs/logic/compute`,
937
+ {data: data},
938
+ {resolveMsg: null, rejectMsg: '金额计算失败!!!'}
939
+ )
940
+
941
+ this.setLabelValue('应交金额', res.data)
942
+ },
943
+ // 街道失去焦点
944
+ async 'streetChange' (index) {
945
+ if (isEmpty(this.show_data.f_street)) {
946
+ return
947
+ }
948
+
949
+ this.setLabelValue('小区', null)
950
+
951
+ let data = {
952
+ tablename: 't_area',
953
+ condition: `f_filialeid = '${this.$login.f.orgid}' and f_street = '${this.show_data.f_street}'`
954
+ }
955
+ let http = new HttpResetClass()
956
+ let res = await http.load(
957
+ 'POST',
958
+ `rs/sql/singleTable`,
959
+ {data: data},
960
+ {resolveMsg: null, rejectMsg: '小区查询失败!!!'}
961
+ )
962
+
963
+ this.setLabelOptions('小区', res.data.map(item => {
964
+ return {
965
+ label: item.f_residential_area,
966
+ value: item.f_residential_area
967
+ }
968
+ }))
969
+ },
970
+ // 区县失去焦点
971
+ async 'pcdChange' (index) {
972
+ if (isEmpty(this.show_data.f_pcd)) {
973
+ return
974
+ }
975
+
976
+ this.setLabelValue('街道', null)
977
+ this.setLabelValue('小区', null)
978
+
979
+
980
+
981
+ let data = {
982
+ tablename: 't_street',
983
+ condition: `f_filialeid = '${this.$login.f.orgid}' and f_pcd = '${this.show_data.f_pcd}'`
984
+ }
985
+ let f_address_type = this.getLableValue('地址类型')
986
+
987
+ if (f_address_type === '民用市区') {
988
+ data.condition = `f_filialeid = '${this.$login.f.orgid}' and f_pcd = '${this.show_data.f_pcd}' and f_iscity = '市区'`
989
+ }
990
+ if (f_address_type === '民用乡镇') {
991
+ data.condition = `f_filialeid = '${this.$login.f.orgid}' and f_pcd = '${this.show_data.f_pcd}' and f_iscity = '乡镇'`
992
+ }
993
+
994
+ let http = new HttpResetClass()
995
+ let res = await http.load(
996
+ 'POST',
997
+ `rs/sql/singleTable`,
998
+ {data: data},
999
+ {resolveMsg: null, rejectMsg: '街道查询失败!!!'}
1000
+ )
1001
+
1002
+ this.setLabelOptions('街道', res.data.map(item => {
1003
+ return {
1004
+ label: item.f_street,
1005
+ value: item.f_street
1006
+ }
1007
+ }))
1008
+ },
1009
+ // 地址类型失去焦点
1010
+ 'addressTypeChange' (index) {
1011
+ this.setLabelValue('街道', null)
1012
+ this.setLabelValue('小区', null)
1013
+ let f_address_type = this.show_data.fields[index].value
1014
+ for (const item of this.show_data.fields) {
1015
+ if (f_address_type === '民用地址') {
1016
+ if (item.label === '区/县' || item.label === '街道' || item.label === '小区' || item.label === '门牌号') {
1017
+ item.hidden = false
1018
+ item.required = true
1019
+ item.value = null
1020
+ }
1021
+ if (item.label === '楼号' || item.label === '单元' || item.label === '楼层') {
1022
+ item.hidden = false
1023
+ item.required = false
1024
+ item.value = null
1025
+ }
1026
+ if (item.label === '地址') {
1027
+ item.readonly = true
1028
+ item.value = null
1029
+ }
1030
+ }
1031
+ if (f_address_type === '特殊地址') {
1032
+ if (item.label === '区/县' || item.label === '街道') {
1033
+ item.hidden = false
1034
+ item.required = true
1035
+ item.value = null
1036
+ }
1037
+ if (item.label === '小区') {
1038
+ item.hidden = false
1039
+ item.required = false
1040
+ item.value = null
1041
+ }
1042
+ if (item.label === '楼号' || item.label === '单元' || item.label === '楼层' || item.label === '门牌号') {
1043
+ item.hidden = true
1044
+ item.required = false
1045
+ item.value = null
1046
+ }
1047
+ if (item.label === '地址') {
1048
+ item.readonly = false
1049
+ item.value = null
1050
+ }
1051
+ }
1052
+ }
1053
+ },
1054
+ // 团购转散户初始化
1055
+ 'apply2ReadyEvent' () {
1056
+ if (this.show_data.f_apply_source === '线下发起') {
1057
+ this.addressInitialization()
1058
+ this.hideLabels('用户编号')
1059
+ this.electiveLabels('用户编号')
1060
+ this.showLabels('片区', '地址类型')
1061
+ this.requiredLabels('片区', '地址类型')
1062
+ }
1063
+ if (this.show_data.f_apply_source === '自动发起') {
1064
+ this.hideLabels('片区', '地址类型')
1065
+ this.electiveLabels('片区', '地址类型',)
1066
+ }
1067
+ },
1068
+ // 申请节点初始化
1069
+ 'applyReadyEvent' () {
1070
+ this.addressInitialization()
1071
+
1072
+ this.pcdChange()
1073
+ this.streetChange()
1074
+ },
1075
+ // ===========================================
1076
+ async 'button'() {
1077
+ if (this.show_data.button.before) {
1078
+ await this[this.show_data.button.before]()
1079
+ }
1080
+ // 点击重置按钮就重置数据
1081
+ if (this.show_data.button.button_name === '重置') {
1082
+ this.$dispatch('breakControl', this.selectdata)
1083
+ return
1084
+ }
1085
+
1086
+ this.show_data.user = this.$login.f
1087
+ this.show_data.start_activity = this.$workflow_vue.start_activity
1088
+ this.show_data.xmlfilename = this.$workflow_vue.workflow_xmlfilename
1089
+
1090
+ let res = await this.$resetpost(
1091
+ `rs/logic/ApplyProductService`,
1092
+ {data: this.show_data},
1093
+ {resolveMsg: null, rejectMsg: '数据保存失败'}
1094
+ )
1095
+
1096
+ if (this.show_data.button.after) {
1097
+ this[this.show_data.button.after]()
1098
+ }
1099
+ this.$dispatch('loadPage')
1100
+ },
1101
+ // 失去焦点出触发事件
1102
+ 'onchange' (index) {
1103
+ if (this.show_data.defname === '申请登记' || (this.show_data.defname === '现场勘察' && this.show_data.f_apply_source === '微信公众号')) {
1104
+ if (
1105
+ this.show_data.fields[index].label === '片区' ||
1106
+ this.show_data.fields[index].label === '区/县' ||
1107
+ this.show_data.fields[index].label === '街道' ||
1108
+ this.show_data.fields[index].label === '小区' ||
1109
+ this.show_data.fields[index].label === '楼号' ||
1110
+ this.show_data.fields[index].label === '单元' ||
1111
+ this.show_data.fields[index].label === '楼层' ||
1112
+ this.show_data.fields[index].label === '门牌号'
1113
+ ) {
1114
+ let f_pcd = this.getLableValue('区/县') || ''
1115
+ let f_street = this.getLableValue('街道') || ''
1116
+ let f_residential_area = this.getLableValue('小区') || ''
1117
+ let f_building = this.getLableValue('楼号') || ''
1118
+ let f_building_suffix = isEmpty(this.getLableValue('楼号')) ? '' : '号楼'
1119
+ let f_unit = this.getLableValue('单元') || ''
1120
+ let f_unit_suffix = isEmpty(this.getLableValue('单元')) ? '' : '单元'
1121
+ let f_floor = this.getLableValue('楼层') || ''
1122
+ let f_floor_suffix = isEmpty(this.getLableValue('楼层')) ? '' : '层'
1123
+ let f_room = this.getLableValue('门牌号') || ''
1124
+ let f_room_suffix = isEmpty(this.getLableValue('门牌号')) ? '' : '室'
1125
+
1126
+ let f_address = f_pcd + f_street + f_residential_area + f_building + f_building_suffix + f_unit + f_unit_suffix + f_floor + f_floor_suffix + f_room + f_room_suffix
1127
+ this.setLabelValue("地址", f_address)
1128
+ }
1129
+ }
1130
+ if (this.show_data.fields[index].label === '联系电话') {
1131
+ let phone = this.show_data.fields[index].value
1132
+ // 电话号码效验
1133
+ if (!(/^1[3456789]\d{9}$/.test(phone))) {
1134
+ this.show_data.fields[index].value = ""
1135
+ this.$showAlert('电话号码格式不正确,请重新输入。', 'info', 2000)
1136
+ }
1137
+ }
1138
+ },
1139
+ selectSearch (val, index) {},
1140
+ 'onblur' (index) {},
1141
+ 'oninput' (index) {},
1142
+ 'initializtionView' () {},
1143
+ async 'onchangeModal' (index, fieldIndex) {
1144
+ },
1145
+ async 'onblurModal' (index, fieldIndex) {
1146
+
1147
+ },
1148
+ async 'oninputModal' (index, fieldIndex) {
1149
+
1150
+ },
1151
+ async 'onetomanydelete' (index, rowIndex) {
1152
+
1153
+ let http = new HttpResetClass()
1154
+
1155
+ let res = await http.load(
1156
+ 'DELETE',
1157
+ `rs/entity/${this.show_data.onetomany[index].tables[0]}/${this.show_data.onetomany[index].rows[rowIndex].id}`,
1158
+ null,
1159
+ {resolveMsg: null, rejectMsg: '删除失败!!!'}
1160
+ )
1161
+
1162
+ res = await this.$resetpost(
1163
+ 'rs/entity/t_apply',
1164
+ this.show_data
1165
+ )
1166
+
1167
+ this.$dispatch('breakControl', this.show_data)
1168
+ },
1169
+ async 'onetomanyupdate' (index, rowIndex) {
1170
+ let data = this.show_data.onetomany[index].rows[rowIndex]
1171
+
1172
+ this.show_data.onetomany[index].fields.forEach(item => {
1173
+ data[item.field] = item.value
1174
+ })
1175
+ let res = await this.$resetpost(
1176
+ `rs/entity/${this.show_data.onetomany[index].tables[0]}`,
1177
+ data
1178
+ )
1179
+
1180
+ res = await this.$resetpost(
1181
+ 'rs/entity/t_apply',
1182
+ this.show_data
1183
+ )
1184
+
1185
+ this.$dispatch('breakControl', this.show_data)
1186
+ },
1187
+ async 'onetomanyadd' (index) {
1188
+ let data = {
1189
+ f_process_id : this.show_data.f_process_id,
1190
+ f_operator_id: this.$login.f.id,
1191
+ f_operator: this.$login.f.name,
1192
+ f_operation_date: new Date().Format('yyyy-MM-dd HH:mm:ss'),
1193
+ f_orgid: this.$login.f.orgid,
1194
+ f_orgname: this.$login.f.orgs
1195
+ }
1196
+ this.show_data.onetomany[index].fields.forEach(item => {
1197
+ data[item.field] = item.value
1198
+ })
1199
+ let res = await this.$resetpost(
1200
+ `rs/entity/${this.show_data.onetomany[index].tables[0]}`,
1201
+ data
1202
+ )
1203
+
1204
+ res = await this.$resetpost(
1205
+ 'rs/entity/t_apply',
1206
+ this.show_data
1207
+ )
1208
+
1209
+ this.$dispatch('breakControl', this.show_data)
1210
+ },
1211
+ async 'importEvent' (index, table, configName, filepath) {
1212
+ let data = {
1213
+ selectdata: this.show_data,
1214
+ table: table,
1215
+ filepath: filepath,
1216
+ configName: configName,
1217
+ user: this.$login.f
1218
+ }
1219
+
1220
+ let res = await this.$resetpost(
1221
+ `rs/logic/importEvent`,
1222
+ data
1223
+ )
1224
+
1225
+ this.$dispatch('breakControl', this.show_data)
1226
+ },
1227
+ 'onbutchange' (index) {
1228
+
1229
+ },
1230
+ 'onbutblur' (index) {
1231
+
1232
+ },
1233
+ 'onbutinput' (index) {
1234
+
1235
+ }
1236
+ },
1237
+ watch: {
1238
+ }
1239
+ }
1240
+ </script>
1241
+ <style scoped>
1242
+ /*清除model中的浮动*/
1243
+ .clearfix:after,.clearfix:before{
1244
+ display: table;
1245
+ }
1246
+ .clearfix:after{
1247
+ clear: both;
1248
+ }
1249
+ </style>