apply-clients 3.4.7 → 3.4.9

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.
@@ -0,0 +1,1882 @@
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 "../../../../../components/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
+ Pricetype:''
40
+ }
41
+ },
42
+ ready () {
43
+ this.refurbish()
44
+ this.servicer()
45
+ },
46
+ methods: {
47
+ async servicer(){
48
+ debugger
49
+ let data = {
50
+ tablename: 't_user',
51
+ condition: `1=1`
52
+ }
53
+ let http = new HttpResetClass()
54
+ let res = await http.load(
55
+ 'POST',
56
+ `rs/sql/singleTable`,
57
+ {data: data},
58
+ {resolveMsg: null, rejectMsg: '服务人查询失败!!!'}
59
+ )
60
+ debugger
61
+ this.setLabelOptions('服务人', res.data.map(item => {
62
+ return {
63
+ label: item.name,
64
+ value: item.name
65
+ }
66
+ }))
67
+ },
68
+ // 组件初始化操作
69
+ async refurbish() {
70
+ this.json_datas = this.$workflow_vue
71
+ let sum = 0
72
+ let jsonData = {}
73
+ if (!this.json_datas || !this.json_datas.activitys || this.json_datas.activitys.length === 0) {
74
+ this.$showMessage("网络故障,请刷新页面")
75
+ return
76
+ }
77
+ this.json_datas.activitys.forEach(item => {
78
+ if (this.selectdata.defname === item.title) {
79
+ jsonData = item // 拿到当前节点的json配置信息
80
+ sum++ // 节点名一样的个数
81
+ }
82
+ return this.selectdata.defname === item.title // 拿到当前节点的json配置信息
83
+ })
84
+
85
+ if (sum === 0) {
86
+ this.$showMessage(`没有在JSON配置文件中找到活动名为:(${this.selectdata.defname})的节点配置`)
87
+ return
88
+ }
89
+ if (sum > 1) {
90
+ this.$showMessage(`在JSON配置文件中找到活动名为:(${this.selectdata.defname})的节点配置:${sum}个`)
91
+ return
92
+ }
93
+
94
+ this.selectdata = Object.assign({}, this.selectdata, jsonData)
95
+
96
+ // fields 字段填充值
97
+ for (const item of this.selectdata.fields) {
98
+ if (!item.value) {
99
+ item.value = null
100
+ }
101
+
102
+ if (!item.value && (item.default || item.default === 0) && item.type !== 'datepicker') {
103
+ if (item.eval) {
104
+ item.value = eval(item.default)
105
+ } else {
106
+ item.value = item.default
107
+ }
108
+ }
109
+
110
+ if (this.selectdata[item.field]) {
111
+ // 将json字符串格式化赋值给value
112
+ if (String(this.selectdata[item.field]).startsWith("{")) {
113
+ item.value = JSON.parse(this.selectdata[item.field])
114
+ } else {
115
+ item.value = this.selectdata[item.field]
116
+ }
117
+ }
118
+ if (this.selectdata[item.field] === 0) {
119
+ item.value = 0
120
+ }
121
+
122
+ // datepicker
123
+ if (item.type === 'datepicker' && !item.value && item.default) {
124
+ item.value = new Date().Format(`${item.format ? item.format : 'yyyy-MM-dd HH:mm:ss'}`)
125
+ }
126
+
127
+ // 如果配置类型为select,优先从参数列表获取options
128
+ if (item.type === 'select' || item.type === 'checkbox') {
129
+ if (item.param) {
130
+ let temp = this.$appdata.getParam(item.label)
131
+
132
+ if (temp && temp.length > 0) {
133
+ item.options = temp
134
+ }
135
+
136
+ if (item.paramLabel) {
137
+ temp = this.$appdata.getParam(item.paramLabel)
138
+ if (temp && temp.length > 0) {
139
+ item.options = temp
140
+ }
141
+ }
142
+ }
143
+
144
+ if (item.ready) {
145
+ item.options = await this[item.ready]()
146
+ }
147
+ }
148
+
149
+
150
+ if (item.type === 'checkbox') {
151
+ if (this.selectdata[item.field]) {
152
+ item.value = JSON.parse(this.selectdata[item.field])
153
+ } else {
154
+ item.value = []
155
+ }
156
+ }
157
+
158
+ this.selectdata[item.field] = item.value
159
+ }
160
+
161
+ // 控制组件
162
+ if (this.selectdata.components) {
163
+ this.selectdata.components.forEach(item => {
164
+ if (!item.mark) {
165
+ item.mark = 0
166
+ }
167
+ })
168
+ }
169
+
170
+ // 初始化onetomany
171
+ if (this.selectdata.onetomany) {
172
+ for (const item of this.selectdata.onetomany) {
173
+ let res = null
174
+ if (item.queryEvent) {
175
+ res = this[item.queryEvent]()
176
+ } else {
177
+ let data = {
178
+ tablename: item.tables[0],
179
+ condition: `f_process_id='${this.selectdata.f_process_id}'`
180
+ }
181
+ res = await this.$resetpost(
182
+ 'rs/sql/singleTable',
183
+ {data: data},
184
+ {resolveMsg: null, rejectMsg: 'onetomany查询失败'}
185
+ )
186
+ }
187
+
188
+ item.rows = res.data
189
+
190
+ // 初始化onetomany中的fields
191
+ for (const field of item.fields) {
192
+ if (!field.value) {
193
+ if (field.value !== 0) {
194
+ field.value = null
195
+ }
196
+ }
197
+
198
+ if (field.default || field.default === 0) {
199
+ field.value = field.default
200
+ }
201
+
202
+ // datepicker
203
+ if (field.type === 'datepicker' && !field.value && field.default) {
204
+ field.value = new Date().Format(`${field.format ? field.format : 'yyyy-MM-dd HH:mm:ss'}`)
205
+ }
206
+
207
+ if (field.type === 'select') {
208
+
209
+ let temp = this.$appdata.getParam(field.label)
210
+
211
+ if (temp && temp.length > 0) {
212
+ field.options = temp
213
+ }
214
+
215
+ if (field.paramLabel) {
216
+ temp = this.$appdata.getParam(field.paramLabel)
217
+ if (temp && temp.length > 0) {
218
+ item.options = temp
219
+ }
220
+ }
221
+ }
222
+ }
223
+ }
224
+ }
225
+
226
+ // 初始化 buttons_fields
227
+ for (const item of this.selectdata.buttons) {
228
+ if (item.button_name === '下发') {
229
+
230
+ let data = {
231
+ source: item.source,
232
+ userid: this.$login.f.id
233
+ }
234
+ if (item.sourceMethod) {
235
+ data.source = this[item.sourceMethod]()
236
+ }
237
+ if (!data.source) {
238
+ this.$showMessage("请配置获取人员表达式")
239
+ return
240
+ }
241
+
242
+ let res = await this.$resetpost(
243
+ 'rs/search',
244
+ {data: data},
245
+ {resolveMsg: null, rejectMsg: '下发人员查询失败!!!'}
246
+ )
247
+
248
+ let options = res.data.map(source => {
249
+ return {
250
+ "label": source.name,
251
+ "value": source.id
252
+ }
253
+ })
254
+
255
+ if (item.button_fields.length !== 1) {
256
+ this.$showMessage("下发有且只能有一个字段!!!")
257
+ return
258
+ }
259
+
260
+ item.button_fields[0].options = options
261
+ }
262
+ if (item.button_fields) {
263
+ item.button_fields.forEach(x => {
264
+ // 如果配置类型为select,优先从参数列表获取options
265
+ if (x.type === 'select') {
266
+
267
+ if (x.param) {
268
+ let temp = this.$appdata.getParam(x.label)
269
+
270
+ if (temp && temp.length > 0) {
271
+ x.options = temp
272
+ }
273
+
274
+ if (x.paramLabel) {
275
+ temp = this.$appdata.getParam(x.paramLabel)
276
+ if (temp && temp.length > 0) {
277
+ x.options = temp
278
+ }
279
+ }
280
+ }
281
+
282
+ }
283
+ })
284
+ }
285
+ }
286
+
287
+ // 消除双向绑定,避免子组件(显示层)数据更改,父组件(控制层)也更改
288
+ let temp = JSON.parse(JSON.stringify(this.selectdata))
289
+ console.log('打印下temp',temp)
290
+ this.show_data = temp
291
+ this.$nextTick(() => {
292
+ this.showview = true
293
+ })
294
+ },
295
+ // 金额转大写
296
+ smalltoBIG(n) {
297
+ let fraction = ['角', '分'];
298
+ let digit = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖'];
299
+ let unit = [['元', '万', '亿'], ['', '拾', '佰', '仟']];
300
+ let head = n < 0 ? '欠' : '';
301
+ n = Math.abs(n);
302
+
303
+ let s = '';
304
+
305
+ for (var i = 0; i < fraction.length; i++) {
306
+ s += (digit[Math.floor(n * 10 * Math.pow(10, i)) % 10] + fraction[i]).replace(/零./, '');
307
+ }
308
+ s = s || '整';
309
+ n = Math.floor(n);
310
+
311
+ for (var i = 0; i < unit[0].length && n > 0; i++) {
312
+ let p = '';
313
+ for (var j = 0; j < unit[1].length && n > 0; j++) {
314
+ p = digit[n % 10] + unit[1][j] + p;
315
+ n = Math.floor(n / 10);
316
+ }
317
+ s = p.replace(/(零.)*零$/, '').replace(/^$/, '零') + unit[0][i] + s;
318
+ }
319
+ return head + s.replace(/(零.)*零元/, '元').replace(/(零.)+/g, '零').replace(/^整$/, '零元整')
320
+ },
321
+ getLableValue(label) {
322
+ for (const item of this.show_data.fields) {
323
+ if (item.label === label && item.type !== 'number') {
324
+ return item.value || ''
325
+ }
326
+ if (item.label === label && item.type === 'number') {
327
+ return item.value || 0
328
+ }
329
+ }
330
+ },
331
+ getLableOptions(label) {
332
+ for (const item of this.show_data.fields) {
333
+ if (item.label === label) {
334
+ return item.options
335
+ }
336
+ }
337
+ },
338
+ setLabelValue(label, value) {
339
+ for (const item of this.show_data.fields) {
340
+ if (item.label === label) {
341
+ item.value = value
342
+ this.show_data[item.field] = value
343
+ }
344
+ }
345
+ },
346
+ setLabelOptions(label, options) {
347
+ for (const item of this.show_data.fields) {
348
+ if (item.label === label) {
349
+ item.options = options
350
+ }
351
+ }
352
+ },
353
+ showLabels(...labels) {
354
+ for (const item of this.show_data.fields) {
355
+ if (labels.includes(item.label)) {
356
+ item.hidden = false
357
+ }
358
+ }
359
+ },
360
+ hideLabels(...labels) {
361
+ for (const item of this.show_data.fields) {
362
+ if (labels.includes(item.label)) {
363
+ item.hidden = true
364
+ }
365
+ }
366
+ },
367
+ requiredLabels(...labels) {
368
+ for (const item of this.show_data.fields) {
369
+ if (labels.includes(item.label)) {
370
+ item.required = true
371
+ }
372
+ }
373
+ },
374
+ electiveLabels(...labels) {
375
+ for (const item of this.show_data.fields) {
376
+ if (labels.includes(item.label)) {
377
+ item.required = false
378
+ }
379
+ }
380
+ },
381
+ readonlyLabels(...labels) {
382
+ for (const item of this.show_data.fields) {
383
+ if (labels.includes(item.label)) {
384
+ item.readonly = true
385
+ item.disabled = true
386
+ }
387
+ }
388
+ },
389
+ readwriteLabels(...labels) {
390
+ for (const item of this.show_data.fields) {
391
+ if (labels.includes(item.label)) {
392
+ item.readonly = false
393
+ item.disabled = false
394
+ }
395
+ }
396
+ },
397
+ disabledButtons(...buttons) {
398
+ for (const item of this.show_data.buttons) {
399
+ if (buttons.includes(item.button_name)) {
400
+ item.disabled = true
401
+ }
402
+ }
403
+ },
404
+ enableButtons(...buttons) {
405
+ for (const item of this.show_data.buttons) {
406
+ if (buttons.includes(item.button_name)) {
407
+ item.disabled = false
408
+ }
409
+ }
410
+ },
411
+ showButtons(...buttons) {
412
+ for (const item of this.show_data.buttons) {
413
+ if (buttons.includes(item.button_name)) {
414
+ item.hidden = false
415
+ }
416
+ }
417
+ },
418
+ hideButtons(...buttons) {
419
+ for (const item of this.show_data.buttons) {
420
+ if (buttons.includes(item.button_name)) {
421
+ item.hidden = true
422
+ }
423
+ }
424
+ },
425
+ async checkDuplicate(index) {
426
+ let http = new HttpResetClass()
427
+ let data = {
428
+ tablename: 't_apply',
429
+ condition: `${this.show_data.fields[index].field} = '${this.show_data.fields[index].value}'`
430
+ }
431
+ let res = await http.load('POST', 'rs/sql/singleTable', {data: data}, {
432
+ resolveMsg: null,
433
+ rejectMsg: `${this.show_data.fields[index].label}查询失败`
434
+ })
435
+ if (res.data.length > 0) {
436
+ this.show_data.fields[index].value = null
437
+ this.$showAlert(`${this.show_data.fields[index].label}已存在!!!`, 'warning', 3000)
438
+ }
439
+ },
440
+ // 获取片区
441
+ async getSliceArea () {
442
+ let data = {
443
+ source: 'this.getParentByType($organization$).getAllChildrens().where(row.getType() == $zone$)',
444
+ userid: this.$login.f.id
445
+ }
446
+
447
+ let http = new HttpResetClass()
448
+ let res = await http.load(
449
+ 'POST',
450
+ `rs/search`,
451
+ {data: data},
452
+ {resolveMsg: null, rejectMsg: '片区查询失败!!!'}
453
+ )
454
+
455
+ return res.data.map(item => {
456
+ return {
457
+ label: item.name,
458
+ value: item.name
459
+ }
460
+ })
461
+ },
462
+ // 获取区县
463
+ async getPcd () {
464
+ let data = {
465
+ tablename: 't_pcd',
466
+ condition: `f_filialeid = '${this.$login.f.orgid}'`
467
+ }
468
+ let http = new HttpResetClass()
469
+ let res = await http.load(
470
+ 'POST',
471
+ `rs/sql/singleTable`,
472
+ {data: data},
473
+ {resolveMsg: null, rejectMsg: '区县查询失败!!!'}
474
+ )
475
+
476
+ return res.data.map(item => {
477
+ return {
478
+ label: item.f_pcd,
479
+ value: item.f_pcd
480
+ }
481
+ })
482
+ },
483
+ // 获取集收单位
484
+ async getArea () {
485
+ let data = {
486
+ tablename: 't_area',
487
+ condition: `f_filialeid = '${this.$login.f.orgid}'`
488
+ }
489
+ let http = new HttpResetClass()
490
+ let res = await http.load(
491
+ 'POST',
492
+ `rs/sql/singleTable`,
493
+ {data: data},
494
+ {resolveMsg: null, rejectMsg: '集收单位查询失败!!!'}
495
+ )
496
+
497
+ return res.data.map(item => {
498
+ return {
499
+ label: item.f_residential_area,
500
+ value: item.f_residential_area
501
+ }
502
+ })
503
+ },
504
+ // 缴费前置
505
+ chargeBefore () {
506
+ if (Number(this.show_data.f_due_money) > Number(this.show_data.f_cumulative_payment_money) || Number(this.show_data.f_surplus_money) > 0) {
507
+ this.$showAlert('费用未结清!!!', 'warning', 3000)
508
+ throw null
509
+ }
510
+ },
511
+ // 施工前置 加表具后状态是待开通 提交后是正常 所以这里的判断条件需改正 (and uf.f_meter_classify is null and f_meternumber is null)
512
+ async constructionBefore () {
513
+ let http = new HttpResetClass()
514
+ let data = {
515
+ condition: `ui.f_process_id = '${this.show_data.f_process_id}' and uf.f_meter_classify is null and f_meternumber is null`
516
+ }
517
+ let res = await http.load(
518
+ 'POST',
519
+ 'rs/sql/countApplyUserinfo',
520
+ {data: data},
521
+ {
522
+ resolveMsg: null,
523
+ rejectMsg: '安装明细查询失败!!!'
524
+ })
525
+ if (res.data[0].num > 0) {
526
+ this.$showAlert(`还有${res.data[0].num}户未安装,无法提交`, 'warning', 3000)
527
+ throw `还有${res.data[0].num}户未安装,无法提交`
528
+ }
529
+ },
530
+ changePipeBuild () {
531
+ if (this.selectdata.f_process_dep === '工程部') {
532
+ return 'this.getParentByType($organization$).getChildByName($工程部报装$).getChildren()'
533
+ }
534
+ if (this.selectdata.f_process_dep === '运营部') {
535
+ return 'this.getParentByType($organization$).getChildByName($运营部报装$).getChildren()'
536
+ }
537
+ return 'this.getParentByType($organization$).getChildByName($工程部报装$).getChildren()'
538
+ },
539
+ async getDevInfo () {
540
+ let data = {
541
+ tablename: 't_dev_info',
542
+ condition: `f_orgid = '${this.$login.f.orgid}'`
543
+ }
544
+ let http = new HttpResetClass()
545
+ let res = await http.load(
546
+ 'POST',
547
+ `rs/sql/singleTable`,
548
+ {data: data},
549
+ {resolveMsg: null, rejectMsg: '公司查询失败!!!'}
550
+ )
551
+
552
+ return res.data.map(item => {
553
+ return {
554
+ label: item.f_dev_name,
555
+ value: item.f_dev_name
556
+ }
557
+ })
558
+ },
559
+ async getPrice (f_price_id) {
560
+ console.log('=======================')
561
+ console.log(f_price_id)
562
+
563
+ let data = {
564
+ condition: `sp.f_filialeid = '${this.$login.f.orgid}'`
565
+ }
566
+ if(this.Pricetype==='机表'){
567
+ data.condition=`sp.f_custom = '机表'`
568
+ }
569
+ if(this.Pricetype==='非机表'){
570
+ data.condition=`sp.f_custom = '非机表'`
571
+ }
572
+
573
+ if (!isEmpty(f_price_id)) {
574
+ data.condition = `sp.f_filialeid = '${this.$login.f.orgid}' and sp.f_price_id = ${f_price_id}`
575
+ }
576
+ let http = new HttpResetClass()
577
+ let res = await http.load(
578
+ 'POST',
579
+ `rs/sql/applyGetPrice`,
580
+ {data: data},
581
+ {resolveMsg: null, rejectMsg: '气价查询失败!!!'}
582
+ )
583
+
584
+ let a= res.data.map(item => {
585
+ return {
586
+ label: item.f_price_name,
587
+ value: item
588
+ }
589
+ })
590
+ this.selectdata.fields.forEach(field => {
591
+ if (field.label === '气价名称') {
592
+ field.options = a}
593
+ })
594
+ return a
595
+ },
596
+ addressInitialization () {
597
+ this.$getConfig(this, 'UserAddress')
598
+
599
+ let f_address_type = this.show_data.f_address_type
600
+
601
+ for (const item of this.show_data.fields) {
602
+ if (f_address_type === '民用市区') {
603
+ if (item.label === '区/县' || item.label === '街道/乡镇' || item.label === '集收单位' || item.label === '门牌号') {
604
+ item.hidden = false
605
+ item.required = true
606
+ }
607
+ if (item.label === '楼号/组' || item.label === '单元/排' || item.label === '楼层') {
608
+ item.hidden = false
609
+ item.required = false
610
+ }
611
+ if (item.label === '地址') {
612
+ item.readonly = true
613
+ }
614
+ }
615
+ if (f_address_type === '民用乡镇') {
616
+ if (item.label === '区/县' || item.label === '街道/乡镇' || item.label === '集收单位' || item.label === '门牌号') {
617
+ item.hidden = false
618
+ item.required = true
619
+ }
620
+ if (item.label === '楼号/组' || item.label === '单元/排' || item.label === '楼层') {
621
+ item.hidden = false
622
+ item.required = false
623
+ }
624
+ if (item.label === '楼层') {
625
+ item.hidden = true
626
+ item.required = false
627
+ }
628
+ if (item.label === '地址') {
629
+ item.readonly = true
630
+ }
631
+ }
632
+ if (f_address_type === '特殊地址') {
633
+ if (item.label === '区/县' || item.label === '街道/乡镇') {
634
+ item.hidden = false
635
+ item.required = true
636
+ }
637
+ if (item.label === '集收单位') {
638
+ item.hidden = false
639
+ if (this.show_data.f_apply_type === '工商户报建'){
640
+ item.required = false
641
+ } else {
642
+ item.required = false
643
+ }
644
+
645
+ }
646
+ if (item.label === '楼号/组' || item.label === '单元/排' || item.label === '楼层' || item.label === '门牌号') {
647
+ item.hidden = true
648
+ item.required = false
649
+ }
650
+ if (item.label === '地址') {
651
+ item.readonly = false
652
+ }
653
+ }
654
+
655
+ if (this.show_data.f_apply_source === '线下发起' && item.label === '预约地址') {
656
+ item.hidden = true
657
+ }
658
+ }
659
+ },
660
+ async streetChange () {
661
+ if (isEmpty(this.show_data.f_street)) {
662
+ return
663
+ }
664
+
665
+ let data = {
666
+ tablename: 't_area',
667
+ condition: `f_filialeid = '${this.$login.f.orgid}' and f_street = '${this.show_data.f_street}'`
668
+ }
669
+ let http = new HttpResetClass()
670
+ let res = await http.load(
671
+ 'POST',
672
+ `rs/sql/singleTable`,
673
+ {data: data},
674
+ {resolveMsg: null, rejectMsg: '集收单位查询失败!!!'}
675
+ )
676
+
677
+ this.setLabelOptions('集收单位', res.data.map(item => {
678
+ return {
679
+ label: item.f_residential_area,
680
+ value: item.f_residential_area
681
+ }
682
+ }))
683
+ },
684
+ async pcdChange () {
685
+ if (isEmpty(this.show_data.f_pcd)) {
686
+ return
687
+ }
688
+
689
+ let data = {
690
+ tablename: 't_street',
691
+ condition: `f_filialeid = '${this.$login.f.orgid}' and f_pcd = '${this.show_data.f_pcd}'`
692
+ }
693
+ let f_address_type = this.getLableValue('地址类型')
694
+
695
+ if (f_address_type === '民用市区') {
696
+ data.condition = `f_filialeid = '${this.$login.f.orgid}' and f_pcd = '${this.show_data.f_pcd}' and f_iscity = '市区'`
697
+ }
698
+ if (f_address_type === '民用乡镇') {
699
+ data.condition = `f_filialeid = '${this.$login.f.orgid}' and f_pcd = '${this.show_data.f_pcd}' and f_iscity = '乡镇'`
700
+ }
701
+
702
+ let http = new HttpResetClass()
703
+ let res = await http.load(
704
+ 'POST',
705
+ `rs/sql/singleTable`,
706
+ {data: data},
707
+ {resolveMsg: null, rejectMsg: '街道/乡镇查询失败!!!'}
708
+ )
709
+
710
+ this.setLabelOptions('街道/乡镇', res.data.map(item => {
711
+ return {
712
+ label: item.f_street,
713
+ value: item.f_street
714
+ }
715
+ }))
716
+ },
717
+ async addressTips () {
718
+ // console.log('======================='+this.show_data.f_apply_type)
719
+ let res = ''
720
+ if (this.show_data.f_apply_type === '报警器报建' || this.show_data.f_apply_type === '工商业报警器报建') {
721
+ res = await this.$showMessage('报警器报建下单后将不能修改用户信息,请确认用户信息地址等是否正确,如不完善可在档案中进行修正!!!')
722
+ }else{
723
+ res = await this.$showMessage('增容改管下单后将不能修改用户信息,请确认用户信息地址等是否正确,如不完善可在档案中进行修正!!!')
724
+ }
725
+ if (res == 'confirm') {
726
+ return
727
+ }
728
+ throw '用户信息确认!!!'
729
+ },
730
+ async getDesignerPeople () {
731
+ let data = {
732
+ source: 'this.getParentByType($organization$).getChildByName($设计部报装$).getChildren()',
733
+ userid: this.$login.f.id
734
+ }
735
+
736
+ let http = new HttpResetClass()
737
+ let res = await http.load(
738
+ 'POST',
739
+ `rs/search`,
740
+ {data: data},
741
+ {resolveMsg: null, rejectMsg: '设计人员查询失败!!!'}
742
+ )
743
+
744
+ return res.data.map(item => {
745
+ return {
746
+ label: item.name,
747
+ value: item.id
748
+ }
749
+ })
750
+ },
751
+ async surveyStopApply () {
752
+ console.log('终止报建!!!!!')
753
+
754
+ this.show_data.f_stop_reason = '现场勘察不符合报装条件'
755
+
756
+ let data = {
757
+ data: this.show_data,
758
+ user: this.$login.f
759
+ }
760
+
761
+ let res = await this.$resetpost(
762
+ `rs/logic/surveyStopApply`,
763
+ {data: data},
764
+ {resolveMsg: null, rejectMsg: '终止报建失败!!!'}
765
+ )
766
+
767
+ this.$dispatch('loadPage')
768
+
769
+ throw '终止报建!!!'
770
+ },
771
+ async contract_number() {
772
+ console.log("进入编号合同编号生成",this.$login.f.orgs)
773
+ let f_contract_number = ''
774
+ const nowDate = new Date();
775
+ const date = {
776
+ year: nowDate.getFullYear(),
777
+ month: nowDate.getMonth() + 1,
778
+ day: nowDate.getDate()
779
+ }
780
+
781
+ function upperCaseChars(dir) {
782
+ let string = '';
783
+ switch (dir){
784
+ case '周口市天然气有限公司':
785
+ string = 'ZK' // 当表达式的结果等于 房产 时,则执行该代码
786
+ break;
787
+ case '项城市天然气有限公司':
788
+ string = "XC" // 当表达式的结果等于 自建房 时,则执行该代码
789
+ break;
790
+ case '西华县天然气有限公司':
791
+ string = 'XH' // 当表达式的结果等于 商业 时,则执行该代码
792
+ break;
793
+ case '鹿邑县天然气有限公司':
794
+ string = 'LY' // 当表达式的结果等于 工业 时,则执行该代码
795
+ break;
796
+ case '郸城县天然气有限公司':
797
+ string = 'DC' // 当表达式的结果等于 中压 时,则执行该代码
798
+ break;
799
+ case '测试公司(一)':
800
+ string = 'CS' // 当表达式的结果等于 中压 时,则执行该代码
801
+ break;
802
+ default :
803
+ break; // 如果没有与表达式相同的值,则执行该代码
804
+ }
805
+ return string;
806
+ }
807
+
808
+ const dir = upperCaseChars(this.$login.f.orgs) //分公司
809
+
810
+ let type = 0 //类型
811
+
812
+ switch (this.show_data.f_entry_type){
813
+ case '城区/县城':
814
+ type = 1 // 当表达式的结果等于 城区 时,则执行该代码
815
+ break;
816
+ case '新农村':
817
+ type = 2 // 当表达式的结果等于 新农村 时,则执行该代码
818
+ break;
819
+ case '测试':
820
+ type = 3 // 当表达式的结果等于 新农村 时,则执行该代码
821
+ break;
822
+ default :
823
+ break; // 如果没有与表达式相同的值,则执行该代码
824
+ }
825
+
826
+ let nature = 0 // 性质
827
+ switch (this.show_data.f_apply_nature){
828
+ case '楼房':
829
+ nature = 1 // 当表达式的结果等于 楼房 时,则执行该代码
830
+ break;
831
+ case '房产':
832
+ nature = 1 // 当表达式的结果等于 房产 时,则执行该代码
833
+ break;
834
+ case '自建房':
835
+ nature = 2 // 当表达式的结果等于 自建房 时,则执行该代码
836
+ break;
837
+ case '商业':
838
+ nature = 3 // 当表达式的结果等于 商业 时,则执行该代码
839
+ break;
840
+ case '学校':
841
+ nature = 3 // 当表达式的结果等于 学校 时,则执行该代码
842
+ break;
843
+ case '福利机构':
844
+ nature = 3 // 当表达式的结果等于 福利机构 时,则执行该代码
845
+ break;
846
+ case '其他':
847
+ nature = 3 // 当表达式的结果等于 其他 时,则执行该代码
848
+ break;
849
+ case '工业':
850
+ nature = 4 // 当表达式的结果等于 工业 时,则执行该代码
851
+ break;
852
+ case '中压':
853
+ nature = 5 // 当表达式的结果等于 中压 时,则执行该代码
854
+ break;
855
+ case '测试':
856
+ nature = 6 // 当表达式的结果等于 中压 时,则执行该代码
857
+ break;
858
+ default :
859
+ break; // 如果没有与表达式相同的值,则执行该代码
860
+ }
861
+
862
+ const newMonth = date.month >= 10 ? date.month : '0' + date.month //月份
863
+ const dataYm = date.year + '-01-01'
864
+ const newYear = date.year + 1
865
+ const year = date.year.toString().substring(2,4) //年份
866
+
867
+ let data = {
868
+ orgid: this.$login.f.orgid
869
+ }
870
+
871
+ let http = new HttpResetClass()
872
+ let res = await http.load('POST', 'rs/sql/contractCount', {data:data}, {
873
+ resolveMsg: null,
874
+ rejectMsg: null
875
+ })
876
+ let oldDate
877
+ for (const item of res.data) {
878
+ if (item.name === '合同编号最后更新日期'){
879
+ oldDate = item.value
880
+ }
881
+ }
882
+ for (const item of res.data){
883
+ if (item.name === '合同编号'){
884
+ if (item.value === 0 || Date.parse(oldDate) < Date.parse(dataYm)) {
885
+ f_contract_number = dir + type + nature + year + newMonth + '001'
886
+ console.log("触发if", f_contract_number)
887
+ } else {
888
+ let count = item.value
889
+ f_contract_number = dir + type + nature + year + newMonth + this.PrefixInteger(count, 3)
890
+ console.log("触发else", f_contract_number)
891
+ }
892
+ }
893
+ }
894
+ this.selectdata.f_contract_number = f_contract_number
895
+ this.show_data.f_contract_number = f_contract_number
896
+ return f_contract_number
897
+ },
898
+ PrefixInteger(num, n) {
899
+ return (Array(n).join(0) + num).slice(-n);
900
+ }
901
+ },
902
+ events: {
903
+ 'priceType'(index){
904
+ this.Pricetype = this.getLableValue('所属类型')
905
+ console.log('打印方法值',this.getPrice(this.show_data.f_price_id))
906
+ for (const item of this.show_data.fields) {
907
+ if (this.show_data.f_sprice_type !=null && this.show_data.f_sprice_type !='') {
908
+ if(item.label==='气价名称'){
909
+ this.getPrice(this.show_data.f_price_id).then(value =>{
910
+ item.options=value
911
+ })
912
+ console.log('最终',item.options)
913
+ }
914
+ }
915
+ }
916
+ },
917
+ 'complyInstallation' (index) {
918
+ if (this.show_data.f_is_have === '否') {
919
+ this.hideButtons('提交', '出图', '缴费')
920
+ this.showButtons('终止')
921
+ }
922
+ if (this.show_data.f_is_have === '是') {
923
+ this.hideButtons('终止')
924
+ this.showButtons('提交', '出图', '缴费')
925
+ }
926
+ },
927
+ async 'igniteDispatchReadyEvent' () {
928
+ let data = {
929
+ tablename: 'activityins',
930
+ condition: `processid = '${this.show_data.f_process_id}' and defname = '工程施工' and state = '结束'`
931
+ }
932
+ let http = new HttpResetClass()
933
+ let res = await http.load(
934
+ 'POST',
935
+ `rs/sql/singleTable`,
936
+ {data: data},
937
+ {resolveMsg: null, rejectMsg: '查询失败!!!'}
938
+ )
939
+ if (res.data.length <= 0) {
940
+ console.log('+++++++++++++++++++++++++++++')
941
+ console.log('没有施工,不能退回')
942
+ this.hideButtons('退回')
943
+ }
944
+ },
945
+ 'buildReadyEvent' () {
946
+ this.setLabelValue('施工单位', this.$login.f.name)
947
+ this.setLabelValue('施工安装时间', new Date().Format('yyyy-MM-dd HH:mm:ss'))
948
+ },
949
+ // 选择材料
950
+ async materialNameChenge (index, fieldIndex) {
951
+ let material = this.show_data.onetomany[index].fields[fieldIndex].value
952
+
953
+ this.show_data.onetomany[index].fields.forEach(item => {
954
+ if (material[item.field]) {
955
+ item.value = material[item.field]
956
+ }
957
+ })
958
+ },
959
+ // 打开模态框获取材料
960
+ async 'getMaterialName' (index) {
961
+ let data = {
962
+ condition: `1=1`
963
+ }
964
+ let http = new HttpResetClass()
965
+ let res = await http.load(
966
+ 'POST',
967
+ `rs/sql/getStockMaterial`,
968
+ {data: data},
969
+ {resolveMsg: null, rejectMsg: '材料查询失败!!!'}
970
+ )
971
+
972
+ this.show_data.onetomany[index].fields.forEach(field => {
973
+ if (field.label === '选择材料') {
974
+ field.options = res.data.map(item => {
975
+ return {
976
+ 'label': `${item.f_material_name}--${item.f_material_style}--${item.f_material_unit}`,
977
+ 'value': item
978
+ }
979
+ })
980
+ }
981
+ })
982
+ },
983
+ // 搜索小区
984
+ async 'searchArea' (area, index) {
985
+ let data = {
986
+ tablename: 't_area',
987
+ condition: `f_filialeid = '${this.$login.f.orgid}' and f_street = '${this.show_data.f_street}' and f_residential_area like '%${area}%'`
988
+ }
989
+ let http = new HttpResetClass()
990
+ let res = await http.load(
991
+ 'POST',
992
+ `rs/sql/singleTable`,
993
+ {data: data},
994
+ {resolveMsg: null, rejectMsg: '集收单位查询失败!!!'}
995
+ )
996
+
997
+ if (res.data.length === 0) {
998
+ return
999
+ }
1000
+
1001
+ this.setLabelOptions('集收单位', res.data.map(item => {
1002
+ return {
1003
+ label: item.f_residential_area,
1004
+ value: item.f_residential_area
1005
+ }
1006
+ }))
1007
+ },
1008
+ // 搜索小区
1009
+ async 'searchAreaCollective' (area, index) {
1010
+ let data = {
1011
+ tablename: 't_area',
1012
+ condition: `f_filialeid = '${this.$login.f.orgid}' and f_residential_area like '%${area}%'`
1013
+ }
1014
+ let http = new HttpResetClass()
1015
+ let res = await http.load(
1016
+ 'POST',
1017
+ `rs/sql/singleTable`,
1018
+ {data: data},
1019
+ {resolveMsg: null, rejectMsg: '集收单位查询失败!!!'}
1020
+ )
1021
+
1022
+ if (res.data.length === 0) {
1023
+ return
1024
+ }
1025
+
1026
+ this.setLabelOptions('集收单位', res.data.map(item => {
1027
+ return {
1028
+ label: item.f_residential_area,
1029
+ value: item.f_residential_area
1030
+ }
1031
+ }))
1032
+ },
1033
+ // 选择气价
1034
+ 'priceChange' (index) {
1035
+ debugger
1036
+ if (isEmpty(this.show_data.stairPrice)) {
1037
+ return
1038
+ }
1039
+
1040
+ let stairPrice = this.getLableValue('气价名称')
1041
+
1042
+ this.setLabelValue('气价类型', stairPrice.f_price_type)
1043
+ this.setLabelValue('用气性质', stairPrice.f_gasproperties)
1044
+ this.setLabelValue('价格', stairPrice.f_price)
1045
+ this.setLabelValue('客户类型', stairPrice.f_user_type)
1046
+
1047
+ this.show_data.f_price_id = stairPrice.f_price_id
1048
+ this.show_data.f_price_name = stairPrice.f_price_name
1049
+ },
1050
+ // 选择开发商
1051
+ async 'devInfoChange' (index) {
1052
+ if (isEmpty(this.show_data.f_company_name)) {
1053
+ return
1054
+ }
1055
+ let data = {
1056
+ tablename: 't_dev_info',
1057
+ condition: `f_orgid = '${this.$login.f.orgid}' and f_dev_name = '${this.show_data.f_company_name}'`
1058
+ }
1059
+ let res = await this.$resetpost(
1060
+ `rs/sql/singleTable`,
1061
+ {data: data},
1062
+ {resolveMsg: null, rejectMsg: '公司查询失败!!!'}
1063
+ )
1064
+ this.show_data.f_dev_id = res.data[0].id
1065
+ this.show_data.f_dev_code = res.data[0].f_dev_code
1066
+ this.setLabelValue('法人名称', res.data[0].f_legal_person)
1067
+ this.setLabelValue('身份证', res.data[0].f_idnumber)
1068
+ this.setLabelValue('营业执照', res.data[0].f_license_num)
1069
+ },
1070
+ // 退款金额
1071
+ 'refundMoneyChange' (index) {
1072
+ let f_cumulative_payment_money = this.show_data.f_cumulative_payment_money
1073
+ let f_refund_money = this.show_data.fields[index].value
1074
+
1075
+ if (f_refund_money > f_cumulative_payment_money) {
1076
+ this.$showAlert('退款金额不能大于累计缴费金额!!!', 'warning', 3000)
1077
+ this.show_data.fields[index].value = null
1078
+ }
1079
+ },
1080
+ // 检查重复
1081
+ 'checkRepeat' (index) {
1082
+ this.checkDuplicate(index)
1083
+ },
1084
+ // 选择报建项目
1085
+ 'selectApply' (row) {
1086
+ this.setLabelValue('工程名称', row.f_entry_name)
1087
+ this.setLabelValue('工程编号', row.f_apply_num)
1088
+ this.setLabelValue('报建类型', row.f_apply_type)
1089
+ this.setLabelValue('用户名称', row.f_user_name)
1090
+ this.setLabelValue('用户电话', row.f_phone)
1091
+ this.setLabelValue('证件类型', row.f_credentials)
1092
+ this.setLabelValue('证件号码', row.f_idnumber)
1093
+ this.setLabelValue('地址', row.f_address)
1094
+ this.setLabelValue('累计缴费金额', row.f_cumulative_payment_money)
1095
+
1096
+ this.show_data.parentApply = JSON.parse(JSON.stringify(row))
1097
+
1098
+ delete row.id
1099
+ delete row.actid
1100
+ delete row.defid
1101
+ delete row.defname
1102
+ delete row.version
1103
+ delete row.f_apply_num
1104
+ delete row.f_sub_state
1105
+ delete row.f_apply_type
1106
+ delete row.f_process_id
1107
+
1108
+ this.show_data = Object.assign({}, this.show_data, row)
1109
+
1110
+ this.show_data.f_parent_process_id = this.show_data.parentApply.f_process_id
1111
+ },
1112
+ // 是否终止
1113
+ 'isStopChange' (index) {
1114
+ let f_is_stop = this.show_data.f_is_stop
1115
+
1116
+ for (const item of this.show_data.fields) {
1117
+ if (f_is_stop === '是') {
1118
+ if (item.label === '终止原因') {
1119
+ item.hidden = false
1120
+ item.required = true
1121
+ }
1122
+ } else {
1123
+ if (item.label === '终止原因') {
1124
+ item.hidden = true
1125
+ item.required = false
1126
+ }
1127
+ }
1128
+ }
1129
+ },
1130
+ // 终止报建初始化
1131
+ async 'stopApplyReadyEvent' () {
1132
+
1133
+ let f_is_stop = this.getLableValue('是否终止')
1134
+
1135
+ for (const item of this.show_data.fields) {
1136
+ if (f_is_stop === '是') {
1137
+ if (item.label === '终止原因') {
1138
+ item.hidden = false
1139
+ item.required = true
1140
+ }
1141
+ } else {
1142
+ if (item.label === '终止原因') {
1143
+ item.hidden = true
1144
+ item.required = false
1145
+ }
1146
+ }
1147
+ }
1148
+
1149
+ if (isEmpty(this.show_data.f_parent_process_id)) {
1150
+ return
1151
+ }
1152
+ let data = {
1153
+ condition: `f_process_id = '${this.show_data.f_parent_process_id}'`,
1154
+ data: {
1155
+ id: this.$login.f.id,
1156
+ orgid: this.$login.f.orgid
1157
+ }
1158
+ }
1159
+ let res = await this.$resetpost(
1160
+ `rs/sql/supervisory`,
1161
+ {data: data},
1162
+ {resolveMsg: null, rejectMsg: '项目查询失败!!!'}
1163
+ )
1164
+ this.show_data.parentApply = res.data[0]
1165
+ },
1166
+ // 选择用户档案信息
1167
+ 'selectUserinfo' (row) {
1168
+ this.setLabelValue('用户编号', row.f_userinfo_code)
1169
+ this.setLabelValue('用户名称', row.f_user_name)
1170
+ this.setLabelValue('用户电话', row.f_user_phone)
1171
+ this.setLabelValue('证件类型', row.f_credentials)
1172
+ this.setLabelValue('证件号码', row.f_idnumber)
1173
+ this.setLabelValue('地址', row.f_address)
1174
+
1175
+ this.show_data.f_userinfo_id = row.f_userinfo_id
1176
+ this.show_data.f_userinfo_code = row.f_userinfo_code
1177
+ },
1178
+ // 是否购买保险
1179
+ async 'isInsureChange' (index) {
1180
+ if (!this.show_data.f_is_insure) {
1181
+ return
1182
+ }
1183
+ let f_is_insure = this.show_data.f_is_insure
1184
+ for (const item of this.show_data.fields) {
1185
+ if (f_is_insure === '是') {
1186
+ if (item.label === '保费开始日期' || item.label === '保费结束日期' || item.label === '险种' || item.label === '保费金额') {
1187
+ item.hidden = false
1188
+ item.required = true
1189
+ }
1190
+ if (item.label === '保险备注') {
1191
+ item.hidden = false
1192
+ }
1193
+ } else {
1194
+ if (item.label === '保费开始日期' || item.label === '保费结束日期' || item.label === '险种' || item.label === '保费金额' || item.label === '保险备注') {
1195
+ item.hidden = true
1196
+ item.required = false
1197
+ }
1198
+ }
1199
+ }
1200
+ },
1201
+ // 通气点火初始化
1202
+ async 'gasReadyEvent' () {
1203
+ // 是否有气价信息
1204
+ if (!isEmpty(this.show_data.f_price_id)) {
1205
+ let priceList = await this.getPrice(this.show_data.f_price_id)
1206
+ this.setLabelValue('气价名称', priceList[0].value)
1207
+ }
1208
+
1209
+ let data = {
1210
+ tablename: 't_userfees',
1211
+ condition: `f_orgid = '${this.$login.f.orgid}' and f_userinfo_id = '${this.show_data.f_userinfo_id}' and f_state = '待执行'`
1212
+ }
1213
+ let http = new HttpResetClass()
1214
+ let res = await http.load(
1215
+ 'POST',
1216
+ `rs/sql/singleTable`,
1217
+ {data: data},
1218
+ {resolveMsg: null, rejectMsg: '保险查询失败!!!'}
1219
+ )
1220
+ if (res.data.length > 0) {
1221
+ this.setLabelValue('待执行保险', '是')
1222
+ for (const item of this.show_data.fields) {
1223
+ if (item.label === '保费开始日期' || item.label === '是否购买保险' || item.label === '保费结束日期' || item.label === '险种' || item.label === '保费金额' || item.label === '保险备注') {
1224
+ item.hidden = true
1225
+ item.required = false
1226
+ item.value = null
1227
+ }
1228
+ }
1229
+ } else {
1230
+ this.setLabelValue('待执行保险', '否')
1231
+ for (const item of this.show_data.fields) {
1232
+ if (item.label === '是否购买保险' || item.label === '保费开始日期' || item.label === '保费结束日期' || item.label === '险种' || item.label === '保费金额' || item.label === '保险备注') {
1233
+ item.hidden = false
1234
+ item.required = true
1235
+ }
1236
+ }
1237
+ }
1238
+
1239
+ // 保险初始化显示内容
1240
+ let f_is_insure = this.getLableValue('是否购买保险')
1241
+ for (const item of this.show_data.fields) {
1242
+ if (f_is_insure === '是') {
1243
+ if (item.label === '保费开始日期' || item.label === '保费结束日期' || item.label === '险种' || item.label === '保费金额') {
1244
+ item.hidden = false
1245
+ item.required = true
1246
+ }
1247
+ if (item.label === '保险备注') {
1248
+ item.hidden = false
1249
+ }
1250
+ // 本期保费到期时间默认一年
1251
+ if (isEmpty(this.selectdata.f_ins_expiration_date)) {
1252
+ let f_ins_expiration_date = new Date().setFullYear(new Date().getFullYear() + 1)
1253
+ this.setLabelValue("保费结束日期", new Date(f_ins_expiration_date).Format('yyyy-MM-dd'))
1254
+ }
1255
+ }
1256
+ if (f_is_insure === '否') {
1257
+ if (item.label === '保费开始日期' || item.label === '保费结束日期' || item.label === '险种' || item.label === '保费金额' || item.label === '保险备注') {
1258
+ item.hidden = true
1259
+ item.required = false
1260
+ }
1261
+ }
1262
+ }
1263
+ },
1264
+ // 合同金额失去焦点
1265
+ async 'contractMoneyChange' (index) {
1266
+ let data = {
1267
+ operator: '+',
1268
+ num1: this.show_data.f_contract_money || 0,
1269
+ num2: this.getLableValue('追加金额') || 0
1270
+ }
1271
+ let res = await this.$resetpost(
1272
+ `rs/logic/compute`,
1273
+ {data: data},
1274
+ {resolveMsg: null, rejectMsg: '金额计算失败!!!'}
1275
+ )
1276
+
1277
+ this.setLabelValue('应交金额', res.data)
1278
+ },
1279
+ // 街道失去焦点
1280
+ async 'streetChange' (index) {
1281
+ if (isEmpty(this.show_data.f_street)) {
1282
+ return
1283
+ }
1284
+
1285
+ this.setLabelValue('集收单位', null)
1286
+
1287
+ let data = {
1288
+ tablename: 't_area',
1289
+ condition: `f_filialeid = '${this.$login.f.orgid}' and f_street = '${this.show_data.f_street}'`
1290
+ }
1291
+ let http = new HttpResetClass()
1292
+ let res = await http.load(
1293
+ 'POST',
1294
+ `rs/sql/singleTable`,
1295
+ {data: data},
1296
+ {resolveMsg: null, rejectMsg: '集收单位查询失败!!!'}
1297
+ )
1298
+
1299
+ this.setLabelOptions('集收单位', res.data.map(item => {
1300
+ return {
1301
+ label: item.f_residential_area,
1302
+ value: item.f_residential_area
1303
+ }
1304
+ }))
1305
+ },
1306
+ // 区县失去焦点
1307
+ async 'pcdChange' (index) {
1308
+ if (isEmpty(this.show_data.f_pcd)) {
1309
+ return
1310
+ }
1311
+
1312
+ this.setLabelValue('街道/乡镇', null)
1313
+ this.setLabelValue('集收单位', null)
1314
+
1315
+
1316
+
1317
+ let data = {
1318
+ tablename: 't_street',
1319
+ condition: `f_filialeid = '${this.$login.f.orgid}' and f_pcd = '${this.show_data.f_pcd}'`
1320
+ }
1321
+ let f_address_type = this.getLableValue('地址类型')
1322
+
1323
+ if (f_address_type === '民用市区') {
1324
+ data.condition = `f_filialeid = '${this.$login.f.orgid}' and f_pcd = '${this.show_data.f_pcd}' and f_iscity = '市区'`
1325
+ }
1326
+ if (f_address_type === '民用乡镇') {
1327
+ data.condition = `f_filialeid = '${this.$login.f.orgid}' and f_pcd = '${this.show_data.f_pcd}' and f_iscity = '乡镇'`
1328
+ }
1329
+
1330
+ let http = new HttpResetClass()
1331
+ let res = await http.load(
1332
+ 'POST',
1333
+ `rs/sql/singleTable`,
1334
+ {data: data},
1335
+ {resolveMsg: null, rejectMsg: '街道/乡镇查询失败!!!'}
1336
+ )
1337
+
1338
+ this.setLabelOptions('街道/乡镇', res.data.map(item => {
1339
+ return {
1340
+ label: item.f_street,
1341
+ value: item.f_street
1342
+ }
1343
+ }))
1344
+ },
1345
+ // 地址类型失去焦点
1346
+ 'addressTypeChange' (index) {
1347
+ this.setLabelValue('街道/乡镇', null)
1348
+ this.setLabelValue('集收单位', null)
1349
+ let f_address_type = this.show_data.fields[index].value
1350
+ for (const item of this.show_data.fields) {
1351
+ if (f_address_type === '民用市区') {
1352
+ if (item.label === '区/县' || item.label === '街道/乡镇' || item.label === '集收单位' || item.label === '门牌号') {
1353
+ item.hidden = false
1354
+ item.required = true
1355
+ item.value = null
1356
+ }
1357
+ if (item.label === '楼号/组' || item.label === '单元/排' || item.label === '楼层') {
1358
+ item.hidden = false
1359
+ item.required = false
1360
+ item.value = null
1361
+ }
1362
+ if (item.label === '地址') {
1363
+ item.readonly = true
1364
+ item.value = null
1365
+ }
1366
+ }
1367
+ if (f_address_type === '民用乡镇') {
1368
+ if (item.label === '区/县' || item.label === '街道/乡镇' || item.label === '集收单位' || item.label === '门牌号') {
1369
+ item.hidden = false
1370
+ item.required = true
1371
+ item.value = null
1372
+ }
1373
+ if (item.label === '楼号/组' || item.label === '单元/排' || item.label === '楼层') {
1374
+ item.hidden = false
1375
+ item.required = false
1376
+ item.value = null
1377
+ }
1378
+ if (item.label === '楼层') {
1379
+ item.hidden = true
1380
+ item.required = false
1381
+ item.value = null
1382
+ }
1383
+ if (item.label === '地址') {
1384
+ item.readonly = true
1385
+ item.value = null
1386
+ }
1387
+ }
1388
+ if (f_address_type === '特殊地址') {
1389
+ if (item.label === '区/县' || item.label === '街道/乡镇') {
1390
+ item.hidden = false
1391
+ item.required = true
1392
+ item.value = null
1393
+ }
1394
+ if (item.label === '集收单位') {
1395
+ item.hidden = false
1396
+ item.required = false
1397
+ item.value = null
1398
+ }
1399
+ if (item.label === '楼号/组' || item.label === '单元/排' || item.label === '楼层' || item.label === '门牌号') {
1400
+ item.hidden = true
1401
+ item.required = false
1402
+ item.value = null
1403
+ }
1404
+ if (item.label === '地址') {
1405
+ item.readonly = false
1406
+ item.value = null
1407
+ }
1408
+ }
1409
+ }
1410
+ },
1411
+ // 团购转散户初始化
1412
+ 'apply2ReadyEvent' () {
1413
+ if (this.show_data.f_apply_source === '线下发起') {
1414
+ this.addressInitialization()
1415
+ this.hideLabels('用户编号')
1416
+ this.electiveLabels('用户编号')
1417
+ this.showLabels('片区', '地址类型')
1418
+ this.requiredLabels('片区', '地址类型')
1419
+ }
1420
+ if (this.show_data.f_apply_source === '自动发起') {
1421
+ this.hideLabels('片区', '地址类型')
1422
+ this.electiveLabels('片区', '地址类型',)
1423
+ }
1424
+ },
1425
+ // 申请节点初始化
1426
+ 'applyReadyEvent' () {
1427
+ this.addressInitialization()
1428
+ this.pcdChange()
1429
+ this.streetChange()
1430
+ },
1431
+ // ===========================================
1432
+ async 'button'() {
1433
+ if (this.show_data.button.before) {
1434
+ await this[this.show_data.button.before]()
1435
+ }
1436
+ // 点击重置按钮就重置数据
1437
+ if (this.show_data.button.button_name === '重置') {
1438
+ this.$dispatch('breakControl', this.selectdata)
1439
+ return
1440
+ }
1441
+
1442
+ this.show_data.user = this.$login.f
1443
+ this.show_data.start_activity = this.$workflow_vue.start_activity
1444
+ this.show_data.xmlfilename = this.$workflow_vue.workflow_xmlfilename
1445
+
1446
+ if ((this.show_data.f_apply_type === '报警器报建' || this.show_data.f_apply_type === '工商业报警器报建') && this.show_data.defname === '工程施工' && this.show_data.f_sub_state !='完工' && this.show_data.button.button_name === '完工'){
1447
+ //判断是否添加报警器材料
1448
+ let bjqlag = false
1449
+ let datatemp = {
1450
+ 'bjqid':"",
1451
+ 'fprocessid':"",
1452
+ 'sqvalue':"",
1453
+ 'f_bjq_sid':"",
1454
+ 'f_material_code':"",
1455
+ 'f_bjq_baidu_lng':"",
1456
+ 'f_bjq_baidu_lat':"",
1457
+ 'f_bjq_gaode_lng':"",
1458
+ 'f_bjq_gaode_lat':""
1459
+ }
1460
+
1461
+ let bjqststedata = {
1462
+ "sid":"",
1463
+ "bjqtype":"",
1464
+ "f_process_id":"",
1465
+ "bjqstate":"",
1466
+ "f_userinfo_code":""
1467
+ }
1468
+ let numOne = [];
1469
+
1470
+ let http = new HttpResetClass()
1471
+ let data = {
1472
+ tablename: `t_material_apply`,
1473
+ condition: `f_process_id='${this.show_data.f_process_id}'`
1474
+ }
1475
+ let res = await http.load(
1476
+ 'POST',
1477
+ `rs/sql/singleTable`,
1478
+ {data: data},
1479
+ {resolveMsg: null, rejectMsg: 'onetomany查询失败'}
1480
+ )
1481
+ res.data.forEach(item => {
1482
+ if (item.f_material_name.substr(0,3) === '报警器'){
1483
+ var bjname = item.f_material_name.split("-")
1484
+ bjqststedata.sid = item.f_bjq_sid
1485
+ bjqststedata.f_process_id = item.f_process_id
1486
+ bjqststedata.bjqtype = bjname[1]
1487
+ //====================================
1488
+ bjqlag = true
1489
+ datatemp.bjqid = item.id
1490
+ datatemp.fprocessid = item.f_process_id
1491
+ datatemp.f_bjq_sid = item.f_bjq_sid
1492
+ datatemp.f_material_code = item.f_material_code
1493
+ datatemp.f_bjq_lng = item.f_bjq_lng
1494
+ datatemp.f_bjq_lat = item.f_bjq_lat
1495
+ datatemp.f_bjq_gaode_lng = item.f_bjq_gaode_lng
1496
+ datatemp.f_bjq_gaode_lat = item.f_bjq_gaode_lng
1497
+ datatemp.f_bjq_baidu_lng = item.f_bjq_baidu_lng
1498
+ datatemp.f_bjq_baidu_lat = item.f_bjq_baidu_lat
1499
+ numOne.push(item.f_bjq_sid)
1500
+ }
1501
+ })
1502
+
1503
+ // this.show_data.onetomany.forEach(item=>{
1504
+ // console.log("查看报警器材料",item)
1505
+ // item.rows.forEach(i=>{
1506
+ // if (i.f_material_name.substr(0,3) === '报警器'){
1507
+ // var bjname = i.f_material_name.split("-")
1508
+ // bjqststedata.sid = i.f_bjq_sid
1509
+ // bjqststedata.f_process_id = i.f_process_id
1510
+ // bjqststedata.bjqtype = bjname[1]
1511
+ // //====================================
1512
+ // bjqlag = true
1513
+ // datatemp.bjqid = i.id
1514
+ // datatemp.fprocessid = i.f_process_id
1515
+ // datatemp.f_bjq_sid = i.f_bjq_sid
1516
+ // datatemp.f_material_code = i.f_material_code
1517
+ // numOne.push(i.f_bjq_sid)
1518
+ // }
1519
+ // })
1520
+ // })
1521
+ if (!bjqlag){
1522
+ this.$showMessage('请添加报警器物料信息!!!')
1523
+ return
1524
+ }
1525
+ if (numOne.length > 1){
1526
+ this.$showMessage("暂时支持单个报警器物料安装!!!")
1527
+ return
1528
+ }
1529
+ datatemp.sqvalue = this.show_data.areaData.sqvalue
1530
+ datatemp.f_bjq_baidu_lng = this.show_data.templatlng.baidutemplng
1531
+ datatemp.f_bjq_baidu_lat = this.show_data.templatlng.baidutemplat
1532
+ datatemp.f_bjq_gaode_lng = this.show_data.templatlng.gaodetemplng
1533
+ datatemp.f_bjq_gaode_lat = this.show_data.templatlng.gaodetemplat
1534
+ datatemp.f_bjq_lng = this.show_data.templatlng.baidutemplng
1535
+ datatemp.f_bjq_lat = this.show_data.templatlng.baidutemplat
1536
+
1537
+ bjqststedata.f_userinfo_code = this.show_data.f_userinfo_code
1538
+
1539
+ //判断是否推送 及推送的状态
1540
+ //查询是否存在, 以型号及厂家判断
1541
+ let bjqres = await this.$resetpost(
1542
+ `rs/logic/getbjqsyncinfo`,
1543
+ bjqststedata
1544
+ )
1545
+ if (bjqres.data.bjqstate != "成功"){
1546
+ //区域地址存入材料记录表
1547
+ let areares = await this.$resetpost(
1548
+ `rs/logic/saveArea`,
1549
+ {data: datatemp},
1550
+ {resolveMsg: null, rejectMsg: '区域地址保存失败'}
1551
+ )
1552
+
1553
+ //完工之后推送数据到汉威
1554
+ let adddata = {
1555
+ f_bjq_sid : datatemp.f_bjq_sid,
1556
+ f_material_code : datatemp.f_material_code,
1557
+ f_bjq_address: this.show_data.areaData.sqvalue,
1558
+ f_user_name: this.show_data.f_user_name,
1559
+ f_address: this.show_data.f_address,
1560
+ f_user_phone: this.show_data.f_phone,
1561
+ f_userinfo_code: this.show_data.f_userinfo_code,
1562
+ installtime: this.show_data.f_construction_date,
1563
+ f_orgid : this.show_data.f_orgid,
1564
+ f_bjq_lng: datatemp.f_bjq_baidu_lng,
1565
+ f_bjq_lat: datatemp.f_bjq_baidu_lat
1566
+ }
1567
+ let res = await this.$resetpost(
1568
+ `ncc/rs/logic/bjqadduser`,
1569
+ // `rs/logic/bjqadduser`,
1570
+ adddata
1571
+ )
1572
+ if (res.data.code != 200){
1573
+ if (bjqres.data.bjqstate.length == 0){
1574
+ bjqststedata.bjqstate = "失败"
1575
+ let bjqres3 = await this.$resetpost(
1576
+ `rs/logic/addbjqsyncinfo`,
1577
+ bjqststedata
1578
+ )
1579
+ }
1580
+ this.$showMessage(res.data.msg)
1581
+ return
1582
+ }
1583
+ //更改记录表状态
1584
+ if (bjqres.data.bjqstate === "失败"){
1585
+ bjqststedata.bjqstate = "成功"
1586
+ let bjqres1 = await this.$resetpost(
1587
+ `rs/logic/updatebjqsyncinfo`,
1588
+ bjqststedata
1589
+ )
1590
+ }else{
1591
+ bjqststedata.bjqstate = "成功"
1592
+ let bjqres2 = await this.$resetpost(
1593
+ `rs/logic/addbjqsyncinfo`,
1594
+ bjqststedata
1595
+ )
1596
+ }
1597
+ }
1598
+ }
1599
+ if ((this.show_data.f_apply_type === '工商户报建' || this.show_data.f_apply_type === '团购报建')
1600
+ && (this.show_data.defname === '报装申请') && this.show_data.button.button_name === '提交'){
1601
+ await this.contract_number()
1602
+ }
1603
+ if(this.show_data.f_apply_type === '散户报建' && this.show_data.defname === '合同签订' && (this.show_data.button.button_name === '保存'||this.show_data.button.button_name === '提交')){
1604
+ let dataz = {
1605
+ condition: `u.id = ${this.show_data.id}`,
1606
+ data: {
1607
+ id: this.$login.f.id,
1608
+ orgid: this.$login.f.orgid
1609
+ }
1610
+ }
1611
+ let http = new HttpResetClass()
1612
+ let restpz = await http.load(
1613
+ 'POST',
1614
+ `rs/sql/checkuser`,
1615
+ {data: dataz},
1616
+ {resolveMsg: null, rejectMsg: '报建数据查询失败!!!'}
1617
+ )
1618
+ this.show_data.actid=restpz.data[0].actid
1619
+ }
1620
+ let res = await this.$resetpost(
1621
+ `rs/logic/ApplyProductService`,
1622
+ {data: this.show_data},
1623
+ {resolveMsg: null, rejectMsg: '数据保存失败'}
1624
+ )
1625
+
1626
+
1627
+ if (this.show_data.button.after) {
1628
+ this[this.show_data.button.after]()
1629
+ }
1630
+ // 改管报建 增容报建 优化
1631
+ if((this.show_data.f_apply_type === '改管报建'||this.show_data.f_apply_type === '增容报建') && this.show_data.defname === '报装申请' && this.show_data.button.button_name === '缴费'){
1632
+ let datagg = {
1633
+ condition: `t.f_process_id='${this.show_data.f_process_id}'`,
1634
+ }
1635
+ let http = new HttpResetClass()
1636
+ let restgg = await http.load(
1637
+ 'POST',
1638
+ `rs/sql/checkusertwo`,
1639
+ {data: datagg},
1640
+ {resolveMsg: null, rejectMsg: '报建数据查询失败!!!'}
1641
+ )
1642
+ debugger
1643
+ if(this.show_data.f_apply_type === '改管报建'){
1644
+ restgg.data[0].processname = '改管报建流程'
1645
+ restgg.data[0].defname = '报装缴费'
1646
+ }else{
1647
+ restgg.data[0].processname = '增容报建流程'
1648
+ restgg.data[0].defname = '报装缴费'
1649
+ }
1650
+ restgg.data[0].actid = restgg.data[0].actid + 1
1651
+ this.$dispatch('apply',restgg.data[0])
1652
+
1653
+ }
1654
+
1655
+ // 退款报建 优化
1656
+ if(this.show_data.f_apply_type === '退款报建' && this.show_data.defname === '终止报建' && this.show_data.button.button_name === '提交'){
1657
+ let datatk = {
1658
+ condition: `t.f_process_id='${this.show_data.f_process_id}'`,
1659
+ }
1660
+ let http = new HttpResetClass()
1661
+ let resttk = await http.load(
1662
+ 'POST',
1663
+ `rs/sql/checkusertwo`,
1664
+ {data: datatk},
1665
+ {resolveMsg: null, rejectMsg: '报建数据查询失败!!!'}
1666
+ )
1667
+ debugger
1668
+ resttk.data[0].processname = '退款报建流程'
1669
+ resttk.data[0].defname = '退款'
1670
+ this.$dispatch('apply',resttk.data[0])
1671
+
1672
+ }
1673
+
1674
+
1675
+ if(this.show_data.f_apply_type === '散户报建' && this.show_data.defname === '报装申请' && this.show_data.button.button_name === '合同'){
1676
+ let data = {
1677
+ tablename: 't_apply',
1678
+ condition: `f_process_id='${this.show_data.f_process_id}'`
1679
+ }
1680
+ let http = new HttpResetClass()
1681
+ let restp = await http.load(
1682
+ 'POST',
1683
+ `rs/sql/singleTable`,
1684
+ {data: data},
1685
+ {resolveMsg: null, rejectMsg: '报建数据查询失败!!!'}
1686
+ )
1687
+ debugger
1688
+ restp.data[0].processname = '散户报建流程'
1689
+ restp.data[0].defname = '合同签订'
1690
+ this.$dispatch('apply',restp.data[0])
1691
+
1692
+ } else if(this.show_data.f_apply_type === '散户报建' && this.show_data.defname === '合同签订' && this.show_data.button.button_name === '提交'){
1693
+ let data2 = {
1694
+ condition: `u.id = ${this.show_data.id}`,
1695
+ data: {
1696
+ id: this.$login.f.id,
1697
+ orgid: this.$login.f.orgid
1698
+ }
1699
+ }
1700
+ let http = new HttpResetClass()
1701
+ let restp1 = await http.load(
1702
+ 'POST',
1703
+ `rs/sql/checkuser`,
1704
+ {data: data2},
1705
+ {resolveMsg: null, rejectMsg: '报建数据查询失败!!!'}
1706
+ )
1707
+ debugger
1708
+ console.log('有没有发请求打印查询的内容restp1',restp1)
1709
+ // restp1.data[0].processname = '散户报建流程'
1710
+ // restp1.data[0].defname = '报装缴费'
1711
+ this.$dispatch('apply',restp1.data[0])
1712
+ }else if(this.show_data.f_apply_type === '散户报建' && this.show_data.defname === '报装缴费' && this.show_data.button.button_name === '提交'){
1713
+ let data3 = {
1714
+ condition: `u.id = ${this.show_data.id}`,
1715
+ data: {
1716
+ id: this.$login.f.id,
1717
+ orgid: this.$login.f.orgid
1718
+ }
1719
+ }
1720
+ let http = new HttpResetClass()
1721
+ let restp2 = await http.load(
1722
+ 'POST',
1723
+ `rs/sql/checkuser`,
1724
+ {data: data3},
1725
+ {resolveMsg: null, rejectMsg: '报建数据查询失败!!!'}
1726
+ )
1727
+ debugger
1728
+ console.log('打印查询的内容',restp2)
1729
+ if(restp2.length>0){
1730
+ this.$dispatch('apply',restp2.data[0])
1731
+ }else{
1732
+ debugger
1733
+ this.$dispatch('loadPage')
1734
+ }
1735
+ }
1736
+ else{
1737
+ this.$dispatch('loadPage')
1738
+ }
1739
+
1740
+ },
1741
+ // 失去焦点出触发事件
1742
+ 'onchange' (index) {
1743
+ if (this.show_data.defname === '报装申请' || this.show_data.defname === '信息确认') {
1744
+ if (
1745
+ this.show_data.fields[index].label === '区/县' ||
1746
+ this.show_data.fields[index].label === '街道/乡镇' ||
1747
+ this.show_data.fields[index].label === '集收单位' ||
1748
+ this.show_data.fields[index].label === '楼号/组' ||
1749
+ this.show_data.fields[index].label === '单元/排' ||
1750
+ this.show_data.fields[index].label === '楼层' ||
1751
+ this.show_data.fields[index].label === '门牌号'
1752
+ ) {
1753
+
1754
+ let f_pcd = this.getLableValue('区/县') || ''
1755
+ let f_street = this.getLableValue('街道/乡镇') || ''
1756
+ let f_residential_area = this.getLableValue('集收单位') || ''
1757
+ let f_building = this.getLableValue('楼号/组') || ''
1758
+ let f_building_suffix = f_building ? this.config.f_building_suffix : ''
1759
+ let f_unit = this.getLableValue('单元/排') || ''
1760
+ let f_unit_suffix = f_unit ? this.config.f_unit_suffix : ''
1761
+ let f_floor = this.getLableValue('楼层') || ''
1762
+ let f_floor_suffix = f_floor ? this.config.f_floor_suffix : ''
1763
+ let f_room = this.getLableValue('门牌号') || ''
1764
+ let f_room_suffix = f_room ? this.config.f_room_suffix : ''
1765
+
1766
+ 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
1767
+ this.setLabelValue("地址", f_address)
1768
+ }
1769
+ }
1770
+ },
1771
+ selectSearch (val, index) {},
1772
+ 'onblur' (index) {},
1773
+ 'oninput' (index) {},
1774
+ 'initializtionView' () {},
1775
+ async 'onchangeModal' (index, fieldIndex) {
1776
+ },
1777
+ async 'onblurModal' (index, fieldIndex) {
1778
+
1779
+ },
1780
+ async 'oninputModal' (index, fieldIndex) {
1781
+
1782
+ },
1783
+ async 'onetomanydelete' (index, rowIndex) {
1784
+
1785
+ let http = new HttpResetClass()
1786
+
1787
+ let res = await http.load(
1788
+ 'DELETE',
1789
+ `rs/entity/${this.show_data.onetomany[index].tables[0]}/${this.show_data.onetomany[index].rows[rowIndex].id}`,
1790
+ null,
1791
+ {resolveMsg: null, rejectMsg: '删除失败!!!'}
1792
+ )
1793
+
1794
+ res = await this.$resetpost(
1795
+ 'rs/entity/t_apply',
1796
+ this.show_data
1797
+ )
1798
+
1799
+ this.$dispatch('breakControl', this.show_data)
1800
+ },
1801
+ async 'onetomanyupdate' (index, rowIndex) {
1802
+ let data = this.show_data.onetomany[index].rows[rowIndex]
1803
+
1804
+ this.show_data.onetomany[index].fields.forEach(item => {
1805
+ data[item.field] = item.value
1806
+ })
1807
+ let res = await this.$resetpost(
1808
+ `rs/entity/${this.show_data.onetomany[index].tables[0]}`,
1809
+ data
1810
+ )
1811
+
1812
+ res = await this.$resetpost(
1813
+ 'rs/entity/t_apply',
1814
+ this.show_data
1815
+ )
1816
+
1817
+ this.$dispatch('breakControl', this.show_data)
1818
+ },
1819
+ async 'onetomanyadd' (index) {
1820
+ let data = {
1821
+ f_process_id : this.show_data.f_process_id,
1822
+ f_operator_id: this.$login.f.id,
1823
+ f_operator: this.$login.f.name,
1824
+ f_operation_date: new Date().Format('yyyy-MM-dd HH:mm:ss'),
1825
+ f_orgid: this.$login.f.orgid,
1826
+ f_orgname: this.$login.f.orgs
1827
+ }
1828
+ this.show_data.onetomany[index].fields.forEach(item => {
1829
+ data[item.field] = item.value
1830
+ })
1831
+ let res = await this.$resetpost(
1832
+ `rs/entity/${this.show_data.onetomany[index].tables[0]}`,
1833
+ data
1834
+ )
1835
+
1836
+ res = await this.$resetpost(
1837
+ 'rs/entity/t_apply',
1838
+ this.show_data
1839
+ )
1840
+
1841
+ this.$dispatch('breakControl', this.show_data)
1842
+ },
1843
+ async 'importEvent' (index, table, configName, filepath) {
1844
+ let data = {
1845
+ selectdata: this.show_data,
1846
+ table: table,
1847
+ filepath: filepath,
1848
+ configName: configName,
1849
+ user: this.$login.f
1850
+ }
1851
+
1852
+ let res = await this.$resetpost(
1853
+ `rs/logic/importEvent`,
1854
+ data
1855
+ )
1856
+
1857
+ this.$dispatch('breakControl', this.show_data)
1858
+ },
1859
+ 'onbutchange' (index) {
1860
+
1861
+ },
1862
+ 'onbutblur' (index) {
1863
+
1864
+ },
1865
+ 'onbutinput' (index) {
1866
+
1867
+
1868
+ }
1869
+ },
1870
+ watch: {
1871
+ }
1872
+ }
1873
+ </script>
1874
+ <style scoped>
1875
+ /*清除model中的浮动*/
1876
+ .clearfix:after,.clearfix:before{
1877
+ display: table;
1878
+ }
1879
+ .clearfix:after{
1880
+ clear: both;
1881
+ }
1882
+ </style>