apply-clients 3.1.37 → 3.1.40

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,1074 +1,1075 @@
1
- <template>
2
-
3
- <div class="auto clearfix">
4
- <show-back-reason v-if="selectdata.f_back_reason && selectdata.f_back_reason!=''"
5
- :data="show_data"></show-back-reason>
6
- </div>
7
-
8
- <service-view v-ref:service_show :data="show_data" v-if="showview"></service-view>
9
-
10
- </template>
11
- <script>
12
- import Vue from 'vue'
13
- import {HttpResetClass} from 'vue-client'
14
- // Date格式化
15
- Date.prototype.Format = function (fmt) {
16
- var o = {
17
- "M+": this.getMonth() + 1, //月份
18
- "d+": this.getDate(), //日
19
- "H+": this.getHours(), //小时
20
- "m+": this.getMinutes(), //分
21
- "s+": this.getSeconds(), //秒
22
- "q+": Math.floor((this.getMonth() + 3) / 3), //季度
23
- "S": this.getMilliseconds() //毫秒
24
- };
25
- if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
26
- for (var k in o)
27
- if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
28
- return fmt;
29
- }
30
-
31
- export default {
32
- title: '报建流程业务控制层',
33
- props: ['selectdata'],
34
- data() {
35
- return {
36
- data: null, // 数据库数据,json配置文件数据的数据集合
37
- json_datas: null, // Json配置文件集合
38
- showview: false, // 控制显示service-view组件
39
- show_data: null, // 给view层显示的数据
40
- }
41
- },
42
- created () {
43
- this.refurbish()
44
- },
45
- methods: {
46
- // 组件初始化操作
47
- refurbish() {
48
- // this.selectdata = val
49
- this.json_datas = this.$workflow_vue
50
- let sum = 0
51
- let jsonData = {}
52
- if (!this.json_datas || !this.json_datas.activitys || this.json_datas.activitys.length == 0) {
53
- this.$showMessage("网络故障,请刷新页面")
54
- return
55
- }
56
- for (let i = 0; i < this.json_datas.activitys.length; i++) {
57
- if (this.selectdata.defname == this.json_datas.activitys[i].title) {
58
- jsonData = this.json_datas.activitys[i]
59
- sum++
60
- }
61
- }
62
- for (let j = 0; j < jsonData.fields.length; j++) {
63
- jsonData.fields[j].value = ''
64
- if (jsonData.fields[j].default) {
65
- jsonData.fields[j].value = jsonData.fields[j].default
66
- }
67
- }
68
- if (sum == 1) {
69
- this.data = null
70
- this.data = jsonData
71
- // selectdata 填充 data
72
- this.data = Object.assign({}, this.data, this.selectdata)
73
-
74
- this.initializtion()
75
- } else if (sum == 0) {
76
- this.$showMessage(`没有在JSON配置文件中找到活动名为:(${this.selectdata.defname})的节点配置`)
77
- } else {
78
- this.$showMessage(`在JSON配置文件中找到活动名为:(${this.selectdata.defname})的节点配置:${sum}个`)
79
- }
80
- },
81
- // AOP:进入vue组件前初始化内容
82
- // json配置数据处理 比如下拉框的options
83
- async initializtion() {
84
- if (this.show_data && this.show_data.f_process_id == this.data.f_process_id
85
- && this.show_data.defname==this.selectdata.defname){
86
- this.data = Object.assign({}, this.data, this.selectdata,this.show_data)
87
- }
88
- // 如果selectdata有这些key,则把selectdata的value赋值给data的value
89
- this.data.fields.forEach(item => {
90
- if (this.selectdata[item.field]) {
91
- if (String(this.selectdata[item.field]).startsWith("{")) {
92
- item.value = JSON.parse(this.selectdata[item.field])
93
- this.selectdata[item.field] = JSON.parse(this.selectdata[item.field])
94
- } else {
95
- item.value = this.selectdata[item.field]
96
- }
97
- }
98
- })
99
-
100
- // 如果配置类型为select,优先从参数列表获取options
101
- this.data.fields.forEach(item => {
102
- if (item.type === 'select') {
103
- let temp = Vue.$appdata.getParam(item.label)
104
- if (temp && temp.length > 0 && item.label) {
105
- item.options = Vue.$appdata.getParam(item.label)
106
- }
107
- }
108
- })
109
- // 初始化 fields
110
- this.data.fields.forEach(item => {
111
- // 可对数据进行特殊处理
112
- if (item.label === '整改条件') {
113
- item.value = '测试'
114
- }
115
- })
116
-
117
- // 初始化 buttons_fields
118
- for (let i = 0; i < this.data.buttons.length; i++) {
119
- if (this.data.buttons[i].button_name === '下发') {
120
- if (this.data.buttons[i].button_fields && this.data.buttons[i].button_fields.length === 1) {
121
- if (this.data.buttons[i].source){
122
- let http = new HttpResetClass()
123
- let res = await http.load('POST', 'rs/search', {
124
- source: this.data.buttons[i].source,
125
- userid: this.$login.f.id
126
- }, {resolveMsg: null, rejectMsg: null})
127
-
128
- let options = []
129
- for (let i = 0; i < res.data.length; i++) {
130
- options.push(
131
- {
132
- "label": res.data[i].name,
133
- "value": res.data[i].id
134
- // {
135
- // 'id': res.data[i].id,
136
- // 'name': res.data[i].name
137
- // }
138
- }
139
- )
140
- }
141
- this.data.buttons[i].button_fields[0]['options'] = options
142
- } else {
143
- this.$showMessage("请配置获取人员表达式")
144
- }
145
- } else {
146
- this.$showMessage("下发按钮必须满足 当且仅当一个字段")
147
- }
148
- }
149
- if (this.data.buttons[i].button_fields) {
150
- this.data.buttons[i].button_fields.forEach(x => {
151
- // 如果配置类型为select,优先从参数列表获取options
152
- if (x.type === 'select' && this.$appdata.getParam(x.label)) {
153
- x.options = this.$appdata.getParam(x.label).trim()
154
- }
155
- })
156
- }
157
- }
158
-
159
- // onetomany 数据获取
160
- if (this.data.onetomany) {
161
- for (let index = 0; index < this.data.onetomany.length; index++) {
162
- let http = new HttpResetClass()
163
- let data = {
164
- tablename: this.data.onetomany[index].tables[0],
165
- condition: `f_process_id='${this.selectdata.f_process_id}'`
166
- }
167
-
168
- let res = await http.load('POST', 'rs/sql/singleTable', {data: data}, {
169
- resolveMsg: null,
170
- rejectMsg: 'onetomany查询失败'
171
- })
172
-
173
- // 初始化 onetomany
174
- this.data.onetomany[index].rows = res.data
175
-
176
- // 初始化onetomany中的fields
177
- for (let j = 0; j < this.data.onetomany[index].fields.length; j++) {
178
- // 如果配置类型为select,优先从参数列表获取options
179
- if (this.data.onetomany[index].fields[j].type === 'select') {
180
- let temp = Vue.$appdata.getParam(this.data.onetomany[index].fields[j].label)
181
- if (temp && temp.length > 0) {
182
- this.data.onetomany[index].fields[j].options = Vue.$appdata.getParam(this.data.onetomany[index].fields[j].label)
183
- }
184
- }
185
- }
186
-
187
- }
188
- }
189
-
190
- // 消除双向绑定,避免子组件(显示层)数据更改,父组件(控制层)也更改
191
- let temp = JSON.parse(JSON.stringify(this.data))
192
-
193
- this.show_data = temp
194
- this.$nextTick(() => {
195
- this.showview = true
196
- })
197
-
198
- // ===================安康逸华前端需求逻辑===========================
199
- this.getArea()
200
- this.setArea()
201
- this.getGasMeter()
202
- this.getGasPrice()
203
- this.sure_last()
204
- this.arrearsMoney()
205
- this.meterOrPrice()
206
- if (this.selectdata.f_apply_type != '散户报建') {
207
- this.moneyDue()
208
- this.moneySumArrears()
209
- }
210
-
211
- },
212
- // 金额转大写
213
- smalltoBIG(n) {
214
- let fraction = ['角', '分'];
215
- let digit = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖'];
216
- let unit = [['元', '万', '亿'], ['', '拾', '佰', '仟']];
217
- let head = n < 0 ? '欠' : '';
218
- n = Math.abs(n);
219
-
220
- let s = '';
221
-
222
- for (var i = 0; i < fraction.length; i++) {
223
- s += (digit[Math.floor(n * 10 * Math.pow(10, i)) % 10] + fraction[i]).replace(/零./, '');
224
- }
225
- s = s || '整';
226
- n = Math.floor(n);
227
-
228
- for (var i = 0; i < unit[0].length && n > 0; i++) {
229
- let p = '';
230
- for (var j = 0; j < unit[1].length && n > 0; j++) {
231
- p = digit[n % 10] + unit[1][j] + p;
232
- n = Math.floor(n / 10);
233
- }
234
- s = p.replace(/(零.)*零$/, '').replace(/^$/, '零') + unit[0][i] + s;
235
- }
236
- return head + s.replace(/(零.)*零元/, '元').replace(/(零.)+/g, '零').replace(/^整$/, '零元整')
237
- },
238
- async setArea () {
239
- if (this.selectdata.defname === '申请登记') {
240
- for (let i = 0; i < this.show_data.fields.length; i++) {
241
- if (this.show_data.fields[i].label == '县/区') {
242
- this.show_data.fields[i].value = '陕西省安康市'
243
- }
244
- }
245
- }
246
- },
247
- async getArea () {
248
- if (this.selectdata.defname === '申请登记') {
249
- let http = new HttpResetClass()
250
- let condition = "f_filialeid = " + this.$login.f.orgid
251
- let res = await http.load('POST','rs/logic/apply_queryArea',{data:{condition:condition}}, {resolveMsg: null, rejectMsg: null})
252
- for (let i = 0; i < this.show_data.fields.length; i++) {
253
- // if (this.show_data.fields[i].label == '县/区') {
254
- // let data = []
255
- // let array = []
256
- // data = res.data.map(item => {
257
- // return item.f_pcd;
258
- // })
259
- // for (let q = 0; q < data.length; q++) {
260
- // let arraydata = {
261
- // 'label': data[q],
262
- // 'value': data[q]
263
- // }
264
- // if (array.length != 0) {
265
- // for (let w = 0; w < array.length; w++) {
266
- // if (array[w].label == data[q]) {
267
- // break
268
- // }
269
- // while (w == array.length - 1) {
270
- // array.push(arraydata)
271
- // break
272
- // }
273
- // }
274
- // } else {
275
- // array.push(arraydata)
276
- // }
277
- // }
278
- // this.show_data.fields[i].options = array
279
- // console.log("县/区选择框数据:" + JSON.stringify(this.show_data.fields[i].options))
280
- // }
281
- if (this.show_data.fields[i].label == '街道') {
282
- let data = []
283
- let array = []
284
- data = res.data.queryStreet.map(item => {
285
- return item.f_street;
286
- })
287
- for (let q = 0; q < data.length; q++) {
288
- let arraydata = {
289
- 'label': data[q],
290
- 'value': data[q]
291
- }
292
- if (array.length != 0) {
293
- for (let w = 0; w < array.length; w++) {
294
- if (array[w].label == data[q]) {
295
- break
296
- }
297
- while (w == array.length - 1) {
298
- array.push(arraydata)
299
- break
300
- }
301
- }
302
- } else {
303
- array.push(arraydata)
304
- }
305
- }
306
- this.show_data.fields[i].options = array
307
- console.log("街道选择框数据:" + JSON.stringify(this.show_data.fields[i].options))
308
- }
309
- if (this.show_data.fields[i].label == '小区') {
310
- let data = []
311
- let array = []
312
- data = res.data.queryArea.map(item => {
313
- return item.f_residential_area;
314
- })
315
- for (let q = 0; q < data.length; q++) {
316
- let arraydata = {
317
- 'label': data[q],
318
- 'value': data[q]
319
- }
320
- if (array.length != 0) {
321
- for (let w = 0; w < array.length; w++) {
322
- if (array[w].label == data[q]) {
323
- break
324
- }
325
- while (w == array.length - 1) {
326
- array.push(arraydata)
327
- break
328
- }
329
- }
330
- } else {
331
- array.push(arraydata)
332
- }
333
- }
334
- this.show_data.fields[i].options = array
335
- console.log("小区选择框数据:" + JSON.stringify(this.show_data.fields[i].options))
336
- }
337
- }
338
- }
339
- },
340
- async getGasMeter () {
341
- for (let i = 0; i < this.show_data.fields.length; i++) {
342
- if (
343
- this.show_data.fields[i].label === '气表品牌'
344
- // ||
345
- // this.show_data.fields[i].label === '气表型号'
346
- ) {
347
- let http = new HttpResetClass()
348
- let condition = "f_orgid = '" + this.$login.f.orgid + "'"
349
- let res = await http.load('POST','rs/sql/applysingleTable',{data:{tablename:'t_gasbrand',condition:condition}}, {resolveMsg: null, rejectMsg: null})
350
- for (let i = 0; i < this.show_data.fields.length; i++) {
351
- if (this.show_data.fields[i].label == '气表品牌') {
352
- let data = []
353
- let array = []
354
- data = res.data.map(item => {
355
- return item.f_meter_brand;
356
- })
357
- for (let q = 0; q < data.length; q++) {
358
- let arraydata = {
359
- 'label': data[q],
360
- 'value': data[q]
361
- }
362
- if (array.length != 0) {
363
- for (let w = 0; w < array.length; w++) {
364
- if (array[w].label == data[q]) {
365
- break
366
- }
367
- while (w == array.length - 1) {
368
- array.push(arraydata)
369
- break
370
- }
371
- }
372
- } else {
373
- array.push(arraydata)
374
- }
375
- }
376
- this.show_data.fields[i].options = array
377
- console.log("选择框数据:" + JSON.stringify(this.show_data.fields[i].options))
378
- }
379
- }
380
-
381
- }
382
- }
383
- },
384
- async getGasMeter1 () {
385
- for (let i = 0; i < this.show_data.fields.length; i++) {
386
- if (
387
- this.show_data.fields[i].label === '气表品牌' ||
388
- this.show_data.fields[i].label === '气表型号'
389
- ) {
390
-
391
- if (this.$refs.service_show.data.fields[i].label == '气表品牌' && this.$refs.service_show.data.fields[i].value.length != 0) {
392
- let http2 = new HttpResetClass()
393
- let res2 = await http2.load('POST','rs/sql/queryGasType',{data:{f_orgid:this.$login.f.orgid,f_meter_brand:this.$refs.service_show.data.fields[i].value}}, {resolveMsg: null, rejectMsg: null})
394
- // console.log("气表型号查询数据:" + JSON.stringify(res2.data))
395
- for (let j = 0; j < this.show_data.fields.length; j++) {
396
- if (this.$refs.service_show.data.fields[j].label == '气表型号') {
397
- let data = []
398
- let data2 = []
399
- let array = []
400
- data = res2.data.map(item => {
401
- return item.f_meter_style;
402
- })
403
- data2 = res2.data.map(item => {
404
- return item.f_type;
405
- })
406
- for (let q = 0; q < data.length; q++) {
407
- let arraydata = {
408
- 'label': data[q] + data2[q],
409
- 'value': data[q] + data2[q]
410
- }
411
- let then = data[q] + data2[q]
412
- if (array.length != 0) {
413
- for (let w = 0; w < array.length; w++) {
414
- if (array[w].label == then) {
415
- break
416
- }
417
- while (w == array.length - 1) {
418
- array.push(arraydata)
419
- break
420
- }
421
- }
422
- } else {
423
- array.push(arraydata)
424
- }
425
- }
426
- this.$refs.service_show.data.fields[j].options = array
427
- console.log("气表型号选择框数据:" + JSON.stringify(this.$refs.service_show.data.fields[j].options))
428
- }
429
-
430
-
431
-
432
-
433
- }
434
-
435
- }
436
- }
437
- }
438
- },
439
- async getGasPrice () {
440
- for (let i = 0; i < this.show_data.fields.length; i++) {
441
- //气价名称、气价类型
442
- if (
443
- this.show_data.fields[i].label === '气价名称' ||
444
- this.show_data.fields[i].label === '气价类型' ||
445
- this.show_data.fields[i].label === '气价' ||
446
- this.show_data.fields[i].label === '客户类型' ||
447
- this.show_data.fields[i].label === '用气性质'
448
- ) {
449
- let http = new HttpResetClass()
450
- let condition = "f_orgid = '" + this.$login.f.orgid + "'"
451
- let res = await http.load('POST','rs/sql/applysingleTable',{data:{tablename:'t_stairprice',condition:condition}}, {resolveMsg: null, rejectMsg: null})
452
- for (let i = 0; i < this.show_data.fields.length; i++) {
453
- if (this.show_data.fields[i].label == '气价名称') {
454
- let data = []
455
- let array = []
456
- data = res.data.map(item => {
457
- return item.f_price_name;
458
- })
459
- for (let q = 0; q < data.length; q++) {
460
- let arraydata = {
461
- 'label': data[q],
462
- 'value': data[q]
463
- }
464
- if (array.length != 0) {
465
- for (let w = 0; w < array.length; w++) {
466
- if (array[w].label == data[q]) {
467
- break
468
- }
469
- while (w == array.length - 1) {
470
- array.push(arraydata)
471
- break
472
- }
473
- }
474
- } else {
475
- array.push(arraydata)
476
- }
477
- }
478
- this.show_data.fields[i].options = array
479
- console.log("选择框数据:" + JSON.stringify(this.show_data.fields[i].options))
480
- console.log("有没有数据长度:" + this.show_data.fields[i].value.length)
481
- }
482
-
483
- if (this.show_data.fields[i].label == '气价名称' && this.show_data.fields[i].value.length != 0) {
484
- let http2 = new HttpResetClass()
485
- let condition2 = "s.f_orgid = '" + this.$login.f.orgid + "'" + " and s.f_price_name = '" + this.show_data.fields[i].value + "'"
486
- let res2 = await http2.load('POST','rs/sql/searchGasPrice',{data:{condition:condition2}}, {resolveMsg: null, rejectMsg: null})
487
- console.log("气价数据:" + JSON.stringify(res2.data))
488
- for (let j = 0; j < this.show_data.fields.length; j++) {
489
- if (this.show_data.fields[j].label == '气价类型') {
490
- console.log("气价类型:" + res2.data[0])
491
- console.log("气价类型1:" + res2.data[0].f_price_type)
492
- this.show_data.fields[j].value = res2.data[0].f_price_type
493
- console.log("气价类型2:" + this.show_data.fields[j].value)
494
- }
495
- //气价拼接
496
- if (this.show_data.fields[j].label == '气价') {
497
- let p = 1
498
- let resultPrice = ''
499
- for(let l = 0; l < res2.data.length; l++){
500
- resultPrice = resultPrice + res2.data[l].price + ' |'
501
- if (p == 3) {
502
- break
503
- }
504
- p++
505
- }
506
- console.log("拼接的价格:" + resultPrice)
507
- this.show_data.fields[j].value = resultPrice
508
- }
509
- if (this.show_data.fields[j].label == '用气性质') {
510
- this.show_data.fields[j].value = res2.data[0].f_gasproperties
511
- }
512
- if (this.show_data.fields[j].label == '客户类型') {
513
- this.show_data.fields[j].value = res2.data[0].f_user_type
514
- }
515
- }
516
-
517
-
518
- }
519
-
520
- }
521
-
522
-
523
-
524
- }
525
- }
526
- },
527
- an_kang_yi_hua () {
528
- //===================安康逸华前端特殊逻辑===========================
529
- let swap1 = null // 小区名称转换
530
- let swap2 = null // 户数
531
- let swap3 = null // 单价
532
- let swap4 = null // 报警器户数
533
- let swap5 = null // 报警器单价
534
- let swap6 = null // 其他费用
535
- let swap7 = null // 灶具费
536
- for (let i = 0; i < this.show_data.fields.length; i++) {
537
- // 客户名称 = 小区名称
538
- // if (this.show_data.fields[i].label === '小区' && this.show_data.fields[i].value != null && this.show_data.fields[i].value != undefined && this.show_data.fields[i].value != '' && this.selectdata.defname === '申请登记') {
539
- // swap1 = this.show_data.fields[i].value
540
- // }
541
- // for (let j = 0; j < this.show_data.fields.length; j++) {
542
- // if (this.show_data.fields[j].label === '客户名称' && this.selectdata.defname === '申请登记' && this.selectdata.f_apply_type === '集中报建') {
543
- // this.show_data.fields[j].value = swap1
544
- // }
545
- // }
546
- // 预算的计算逻辑
547
- // if (this.selectdata.defname === '收费标准制定' || this.selectdata.defname === '收费审核' && this.selectdata.f_apply_type === '散户报建') {
548
- if (this.selectdata.defname === '收费标准制定') {
549
- if (this.show_data.fields[i].label === '户数') {
550
- swap2 = this.show_data.fields[i].value
551
- }
552
- if (this.show_data.fields[i].label === '单价') {
553
- swap3 = this.show_data.fields[i].value
554
- }
555
- if (this.show_data.fields[i].label === '报警器户数') {
556
- swap4 = this.show_data.fields[i].value
557
- }
558
- if (this.show_data.fields[i].label === '报警器单价') {
559
- swap5 = this.show_data.fields[i].value
560
- }
561
- if (this.show_data.fields[i].label === '其他费用') {
562
- swap6 = this.show_data.fields[i].value
563
- }
564
- let sum1 = swap2 * swap3
565
- let sum2 = swap4 * swap5
566
- if (swap6 == null || swap6 == undefined || swap6 == '') {
567
- swap6 = 0
568
- }
569
- if (this.show_data.fields[i].label === '预算') {
570
- console.log("预算计算1:" + sum1 + " 预算计算2:" + sum2 + " 预算计算3:" + swap6)
571
- this.show_data.fields[i].value = parseFloat(sum1) + parseFloat(sum2) + parseFloat(swap6)
572
- }
573
- }
574
- if (this.selectdata.defname === '收费审核' && this.selectdata.f_apply_type === '散户报建') {
575
- if (this.show_data.fields[i].label === '户数') {
576
- swap2 = this.show_data.fields[i].value
577
- }
578
- if (this.show_data.fields[i].label === '单价') {
579
- swap3 = this.show_data.fields[i].value
580
- }
581
- if (this.show_data.fields[i].label === '报警器户数') {
582
- swap4 = this.show_data.fields[i].value
583
- }
584
- if (this.show_data.fields[i].label === '报警器单价') {
585
- swap5 = this.show_data.fields[i].value
586
- }
587
- if (this.show_data.fields[i].label === '其他费用') {
588
- swap6 = this.show_data.fields[i].value
589
- }
590
- if (this.show_data.fields[i].label === '安装费') {
591
- this.show_data.fields[i].value = swap2 * swap3
592
- }
593
- if (this.show_data.fields[i].label === '报警器费') {
594
- this.show_data.fields[i].value = swap4 * swap5
595
- }
596
- if (this.show_data.fields[i].label === '灶具费') {
597
- swap7 = this.show_data.fields[i].value
598
- }
599
- let sum1 = swap2 * swap3
600
- let sum2 = swap4 * swap5
601
- if (swap6 == null || swap6 == undefined || swap6 == '') {
602
- swap6 = 0
603
- }
604
- if (swap7 == null || swap7 == undefined || swap7 == '') {
605
- swap7 = 0
606
- }
607
- if (this.show_data.fields[i].label === '预算') {
608
- console.log("预算计算1:" + sum1 + " 预算计算2:" + sum2 + " 预算计算3:" + swap6)
609
- this.show_data.fields[i].value = parseFloat(sum1) + parseFloat(sum2) + parseFloat(swap6) + parseFloat(swap7)
610
- }
611
-
612
- }
613
- }
614
- },
615
- sure_last() {
616
- if (this.selectdata.defname == '确认尾款') {
617
-
618
- for (let i = 0; i < this.show_data.fields.length; i++) {
619
- // 每个部门只能填写自己的
620
- // console.log("登录的信息:" + JSON.stringify(this.$login.f))
621
- if (this.$login.f.deps == '市场部') {
622
- if (this.show_data.fields[i].label == '财务部确认尾款') {
623
- this.show_data.fields[i].type = 'input'
624
- this.show_data.fields[i].required = false
625
- this.show_data.fields[i].readonly = true
626
- }
627
- }
628
- // 财务部
629
- if (this.$login.f.deps == '财务部') {
630
- if (this.show_data.fields[i].label == '市场部确认尾款') {
631
- this.show_data.fields[i].type = 'input'
632
- this.show_data.fields[i].required = false
633
- this.show_data.fields[i].readonly = true
634
- }
635
- }
636
- }
637
- }
638
- },
639
- // 根据小区名称获取合同编号
640
- async getContractNumber() {
641
- console.log("进来了没有1")
642
- if (this.selectdata.defname == '申请登记') {
643
-
644
- for (let i = 0; i < this.show_data.fields.length; i++) {
645
- // console.log("进来了没有2")
646
- // console.log("选择框的名称:" + this.show_data.fields[i].label + "---小区名称的长度:" + this.show_data.fields[i].value.length)
647
- if (this.show_data.fields[i].label == '小区' && this.show_data.fields[i].value.length != 0) {
648
- console.log("进来了没有3")
649
- let http = new HttpResetClass()
650
- // 组织数据
651
- let data = {
652
- tablename: 't_contract_no',
653
- condition: "f_residential_name = '" + this.show_data.fields[i].value + "'"
654
- }
655
- let res = await http.load('POST','rs/sql/applysingleTable',{data: data}, {
656
- resolveMsg: null,
657
- rejectMsg: '查询合同编号失败'
658
- })
659
- for (let j = 0; j < this.show_data.fields.length; j++) {
660
- if (this.show_data.fields[j].label == '合同编号') {
661
- this.show_data.fields[j].value = res.data[0].f_contract_number
662
- }
663
- }
664
-
665
- }
666
- }
667
- }
668
-
669
- },
670
- // 应交金额计算
671
- async moneyDue() {
672
- // 应交金额 = 合同价格
673
- if (this.selectdata.defname == '报建缴费') {
674
- let result = 0.00
675
- for (let i = 0; i < this.show_data.fields.length; i++) {
676
-
677
- if (this.show_data.fields[i].label == '合同价格') {
678
- // console.log("计算金额1")
679
- result = this.show_data.fields[i].value
680
- }
681
- // console.log("计算金额:" + result)
682
- if (this.show_data.fields[i].label == '应交金额') {
683
- // console.log("计算金额2")
684
- this.show_data.fields[i].value = result
685
- }
686
-
687
- }
688
- }
689
-
690
-
691
- },
692
- // 累计缴费金额和欠费金额
693
- async moneySumArrears() {
694
- if (this.selectdata.defname == '报建缴费') {
695
- // 查询是否有缴费记录
696
- let http = new HttpResetClass()
697
- // 组织数据
698
- let data = {
699
- tablename: 't_charge_record',
700
- condition: "f_process_id = '" + this.selectdata.f_process_id + "' and f_charge_state = '有效'"
701
- }
702
- let res = await http.load('POST','rs/sql/applysingleTable',{data: data}, {
703
- resolveMsg: null,
704
- rejectMsg: '查询收费记录失败'
705
- })
706
- if (res.data.length > 0) {
707
- for (let i = 0; i < this.show_data.fields.length; i++) {
708
- if (this.show_data.fields[i].label == '累计缴费金额') {
709
- this.show_data.fields[i].value
710
- }
711
- if (this.show_data.fields[i].label == '欠费金额') {
712
- this.show_data.fields[i].value
713
- }
714
- }
715
- }else {
716
- let result = 0.00
717
- for (let i = 0; i < this.show_data.fields.length; i++) {
718
- if (this.show_data.fields[i].label == '应交金额') {
719
- result = this.show_data.fields[i].value
720
- }
721
- if (this.show_data.fields[i].label == '累计缴费金额') {
722
- this.show_data.fields[i].value = 0
723
- }
724
- if (this.show_data.fields[i].label == '欠费金额') {
725
- this.show_data.fields[i].value = result
726
- }
727
- }
728
- }
729
-
730
- }
731
- },
732
- // 欠费金额为0时的不显示解决
733
- async arrearsMoney() {
734
- // 应交金额 = 合同价格
735
- if (this.selectdata.defname == '收费审核') {
736
- for (let i = 0; i < this.show_data.fields.length; i++) {
737
-
738
- if (this.show_data.fields[i].label == '欠费金额') {
739
- if (this.show_data.fields[i].value == 0.00 || this.show_data.fields[i].value == undefined || this.show_data.fields[i].value == null || this.show_data.fields[i].value == '') {
740
- this.show_data.fields[i].value = 0
741
- }
742
- }
743
-
744
- }
745
- }
746
-
747
-
748
- },
749
- // 散户改管时气表信息和通气信息非必填
750
- async meterOrPrice() {
751
- // 应交金额 = 合同价格
752
- if (this.selectdata.f_apply_type == '散户报建') {
753
- if (this.selectdata.defname == '施工' && this.selectdata.f_project_type == '改管') {
754
- for (let i = 0; i < this.show_data.fields.length; i++) {
755
-
756
- if (this.show_data.fields[i].label == '表号') {
757
- this.show_data.fields[i].required = false
758
- }
759
- if (this.show_data.fields[i].label == '左右表') {
760
- this.show_data.fields[i].required = false
761
- }
762
- if (this.show_data.fields[i].label == '气表品牌') {
763
- this.show_data.fields[i].required = false
764
- }
765
- if (this.show_data.fields[i].label == '气表型号') {
766
- this.show_data.fields[i].required = false
767
- }
768
-
769
- }
770
- }
771
- if (this.selectdata.defname == '通气' && this.selectdata.f_project_type == '改管') {
772
- for (let i = 0; i < this.show_data.fields.length; i++) {
773
-
774
- if (this.show_data.fields[i].label == '气价名称') {
775
- this.show_data.fields[i].required = false
776
- }
777
- if (this.show_data.fields[i].label == '用气性质') {
778
- this.show_data.fields[i].required = false
779
- }
780
- if (this.show_data.fields[i].label == '气价') {
781
- this.show_data.fields[i].required = false
782
- }
783
- if (this.show_data.fields[i].label == '客户类型') {
784
- this.show_data.fields[i].required = false
785
- }
786
- if (this.show_data.fields[i].label == '气价类型') {
787
- this.show_data.fields[i].required = false
788
- }
789
- if (this.show_data.fields[i].label == '通气人') {
790
- this.show_data.fields[i].required = false
791
- }
792
- if (this.show_data.fields[i].label == '通气时间') {
793
- this.show_data.fields[i].required = false
794
- this.show_data.fields[i].value = ''
795
- }
796
-
797
- }
798
- }
799
- }
800
-
801
-
802
-
803
- }
804
-
805
- },
806
- events: {
807
- test(i, j){
808
- console.log('删除')
809
- console.log(i + '-----' +j)
810
- },
811
- // 获取view层button事件/
812
- async 'button'(model) {
813
- // 点击重置按钮就重置数据
814
- if (model.button.button_name === '重置') {
815
- this.refurbish()
816
- return
817
- }
818
-
819
- // 获取上传附件是否上传过身份证
820
- // if (this.selectdata.defname == '申请登记' && model.button.button_name === '提交') {
821
- // // 获取上传附件是否上传过身份证
822
- //
823
- // let http = new HttpResetClass()
824
- // // 组织数据
825
- // let data = {
826
- // tablename: 't_files',
827
- // condition: "f_blobid = '" + this.selectdata.f_process_id + "' and fusetype = '身份证'"
828
- // }
829
- // let res = await http.load('POST','rs/sql/applysingleTable',{data: data}, {
830
- // resolveMsg: null,
831
- // rejectMsg: '查询附件身份证号失败'
832
- // })
833
- // if (!res.data.length > 0) {
834
- // this.$showMessage("请上传身份证附件")
835
- // return
836
- // }
837
- //
838
- //
839
- // }
840
- // 判断是否都填写
841
- if (this.selectdata.defname == '确认尾款' && model.button.button_name === '提交') {
842
-
843
- for (let i = 0; i < this.show_data.fields.length; i++) {
844
- // 判断是否都填写
845
- if (this.show_data.fields[i].label == '市场部确认尾款') {
846
- if (this.show_data.fields[i].value.trim().length == 0 || this.show_data.fields[i].value.length == undefined || this.show_data.fields[i].value.length == null) {
847
- this.$showMessage("市场部未确认,请点击保存!")
848
- return
849
- }
850
- }
851
- if (this.show_data.fields[i].label == '财务部确认尾款') {
852
- if (this.show_data.fields[i].value.trim().length == 0 || this.show_data.fields[i].value.length == undefined || this.show_data.fields[i].value.length == null) {
853
- this.$showMessage("财务部未确认,请点击保存!")
854
- return
855
- }
856
- }
857
- }
858
- }
859
-
860
-
861
- // 修改提交数据
862
- model = Object.assign({}, this.selectdata, model)
863
- let http = new HttpResetClass()
864
- let requestData = {
865
- tables: this.data.tables,
866
- start_activity: this.$workflow_vue.start_activity,
867
- model: model,
868
- loginUser: this.$login.f,
869
- workflow_xmlfilename: this.$workflow_vue.workflow_xmlfilename
870
- }
871
- // 下发,提交,保存,退回通用业务后台处理logic
872
- let url = 'rs/logic/ApplyProductService'
873
-
874
- let res = await http.load('POST', url, {data: requestData}, {resolveMsg: null, rejectMsg: '数据保存失败'})
875
- if (res.data.code == 200) {
876
- model = res.data.model
877
-
878
- this.showview = false
879
- // 特殊处理
880
- this.$dispatch('close')
881
- this.initializtion()
882
-
883
- } else {
884
- if (res.data.msg) {
885
- this.$showMessage(res.data.msg)
886
- }
887
- }
888
- },
889
- // 失去焦点出触发事件
890
- async 'check'(index) {
891
- // =====================================安康逸华特殊逻辑===========================================
892
- this.moneyDue()
893
- this.moneySumArrears()
894
- this.getContractNumber()
895
- this.an_kang_yi_hua()
896
- this.getGasMeter1()
897
- this.getGasPrice()
898
-
899
-
900
- // 合成地址
901
- if (
902
- this.$refs.service_show.data.fields[index].label === '县/区' ||
903
- this.$refs.service_show.data.fields[index].label === '街道' ||
904
- this.$refs.service_show.data.fields[index].label === '小区' ||
905
- this.$refs.service_show.data.fields[index].label === '楼号' ||
906
- this.$refs.service_show.data.fields[index].label === '单元号' ||
907
- this.$refs.service_show.data.fields[index].label === '楼层' ||
908
- this.$refs.service_show.data.fields[index].label === '门牌号'
909
- ) {
910
- console.log('即将合成地址')
911
- var address = ''
912
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
913
- // 控制设置级联
914
- // 源select所选的值 this.$refs.service_show.data.activitys.fields[index].value
915
- // xxx xx xxx
916
- if (this.$refs.service_show.data.fields[i].label === '县/区' && this.$refs.service_show.data.fields[i].value) {
917
- address += this.$refs.service_show.data.fields[i].value
918
- }
919
- if (this.$refs.service_show.data.fields[i].label === '街道' && this.$refs.service_show.data.fields[i].value) {
920
- address += this.$refs.service_show.data.fields[i].value
921
- }
922
- if (this.$refs.service_show.data.fields[i].label === '小区' && this.$refs.service_show.data.fields[i].value) {
923
- address += this.$refs.service_show.data.fields[i].value
924
- }
925
- if (this.$refs.service_show.data.fields[i].label === '楼号' && this.$refs.service_show.data.fields[i].value) {
926
- address += ' ' + this.$refs.service_show.data.fields[i].value
927
- }
928
- if (this.$refs.service_show.data.fields[i].label === '单元号' && this.$refs.service_show.data.fields[i].value) {
929
- address += '-' + this.$refs.service_show.data.fields[i].value
930
- }
931
- if (this.$refs.service_show.data.fields[i].label === '楼层' && this.$refs.service_show.data.fields[i].value) {
932
- address += '-' + this.$refs.service_show.data.fields[i].value
933
- }
934
- if (this.$refs.service_show.data.fields[i].label === '门牌号' && this.$refs.service_show.data.fields[i].value) {
935
- address += '-' + this.$refs.service_show.data.fields[i].value
936
- }
937
- }
938
- console.log('获取到的address=>' + address)
939
- // 数据获取完毕时放入地址text
940
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
941
- if (this.$refs.service_show.data.fields[i].label === '地址') {
942
- this.$refs.service_show.data.fields[i].value = address
943
- console.log('修改fields[i].value后的值=>' + this.$refs.service_show.data.fields[i].value)
944
- }
945
- }
946
- }
947
- // 号码检测
948
- if (this.$refs.service_show.data.fields[index].label == '电话号码') {
949
- let phone = this.$refs.service_show.data.fields[index].value
950
- // 电话号码效验
951
- if (!(/^1[3456789]\d{9}$/.test(phone))) {
952
- this.$refs.service_show.data.fields[index].value = ""
953
- this.$showAlert('电话号码格式不正确,请重新输入。', 'info', 2000)
954
- }
955
- }
956
-
957
- //时间提醒
958
- if (this.$refs.service_show.data.fields[index].label.includes("时间") || this.$refs.service_show.data.fields[index].type === 'datepicker') {
959
- let setTime = this.$refs.service_show.data.fields[i].value
960
- let nowTime = new Date().Format("yyyy-MM-dd HH:mm:ss")
961
- if (nowTime >= setTime) {
962
- this.$showMessage("请注意,当前节点时间/工期已过期!")
963
- }
964
- }
965
-
966
- // // 任何是否的选择框只要是否都不能提交
967
- // if (this.$refs.service_show.data.fields[index].value === '否') {
968
- // this.$refs.service_show.disable_button = true
969
- // // this.$refs.service_show.data.buttons[1].button_name = '保存'
970
- // this.$showMessage("当审核/确认为否时,无法提交")
971
- // return
972
- // }else {
973
- // // this.$refs.service_show.data.buttons[1].button_name = '提交'
974
- // this.$refs.service_show.disable_button = false
975
- // }
976
- },
977
- // input值发生变化
978
- async 'oninput'(index) {},
979
- // 错误事件
980
- error_check(index) {
981
- // 时间格式检测
982
- if (this.$refs.service_show.data.fields[index].type == 'datepicker') {
983
- let dateRe = new RegExp(/(([0-9]{3}[1-9]|[0-9]{2}[1-9][0-9]{1}|[0-9]{1}[1-9][0-9]{2}|[1-9][0-9]{3})-(((0[13578]|1[02])-(0[1-9]|[12][0-9]|3[01]))|((0[469]|11)-(0[1-9]|[12][0-9]|30))|(02-(0[1-9]|[1][0-9]|2[0-8]))))|((([0-9]{2})(0[48]|[2468][048]|[13579][26])|((0[48]|[2468][048]|[3579][26])00))-02-29)$/)
984
- let datetimeRe = new RegExp(/((([0-9]{3}[1-9]|[0-9]{2}[1-9][0-9]{1}|[0-9]{1}[1-9][0-9]{2}|[1-9][0-9]{3})-(((0[13578]|1[02])-(0[1-9]|[12][0-9]|3[01]))|((0[469]|11)-(0[1-9]|[12][0-9]|30))|(02-(0[1-9]|[1][0-9]|2[0-8]))))|((([0-9]{2})(0[48]|[2468][048]|[13579][26])|((0[48]|[2468][048]|[3579][26])00))-02-29))\s([0-1][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])$/)
985
- if (datetimeRe.test(this.$refs.service_show.data.fields[index].value) && this.$refs.service_show.data.fields[index].value.trim().length == 19 && this.$refs.service_show.data.fields[index].fullsize) {
986
- this.$refs.service_show.data.fields[index].error.flag = false
987
- } else if (dateRe.test(this.$refs.service_show.data.fields[index].value) && this.$refs.service_show.data.fields[index].value.trim().length == 10) {
988
- this.$refs.service_show.data.fields[index].error.flag = false
989
- } else {
990
- if (this.$refs.service_show.data.fields[index].fullsize) {
991
- this.$refs.service_show.data.fields[index].error = Object.assign({}, this.$refs.service_show.data.fields[index].error)
992
- this.$refs.service_show.data.fields[index].error.msg = this.$refs.service_show.data.fields[index].error.msg ? this.$refs.service_show.data.fields[index].error.msg : '时间格式如:2019-05-02 09:23:21'
993
- this.$showAlert(this.$refs.service_show.data.fields[index].label + '格式错误' + this.$refs.service_show.data.fields[index].error.msg, 'warning', 3000)
994
- this.$refs.service_show.data.fields[index].error.flag = true
995
- this.$refs.service_show.data.fields[index].value = ''
996
- } else {
997
- this.$refs.service_show.data.fields[index].error = Object.assign({}, this.$refs.service_show.data.fields[index].error)
998
- this.$refs.service_show.data.fields[index].error.msg = this.$refs.service_show.data.fields[index].error.msg ? this.$refs.service_show.data.fields[index].error.msg : '时间格式如:2019-05-02'
999
- this.$showAlert(this.$refs.service_show.data.fields[index].label + '格式错误' + this.$refs.service_show.data.fields[index].error.msg, 'warning', 3000)
1000
- this.$refs.service_show.data.fields[index].error.flag = true
1001
- this.$refs.service_show.data.fields[index].value = ''
1002
- }
1003
-
1004
- }
1005
- }
1006
- },
1007
- // onetomany模态框默认监听监听事件
1008
- async 'onetomanydelete'(i, j) {
1009
- console.log('默认删除')
1010
- let http = new HttpResetClass()
1011
- let data = {
1012
- table: this.show_data.onetomany[i].tables[0],
1013
- row: this.show_data.onetomany[i].rows[j]
1014
- }
1015
- let res = await http.load('POST', 'rs/logic/onetomanyDefaultDeleteEvent', {data: data}, {
1016
- resolveMsg: null,
1017
- rejectMsg: '删除失败'
1018
- })
1019
-
1020
- if (res.data <= 0){
1021
- this.$showMessage('删除失败')
1022
- return
1023
- }
1024
-
1025
- this.$dispatch('selfsearch')
1026
- this.$refs.service_show.data.onetomany[i].rows.splice(j, 1)
1027
- },
1028
- async 'onetomanyadd'(inedx) {
1029
- let data = {
1030
- f_process_id : this.show_data.f_process_id
1031
- }
1032
- this.show_data.onetomany[inedx].fields.forEach(item => {
1033
- data[item.field] = item.value
1034
- })
1035
- let res = await this.$resetpost(
1036
- `rs/entity/${this.show_data.onetomany[inedx].tables[0]}`,
1037
- data
1038
- )
1039
-
1040
- console.log('res.data.id')
1041
- console.log(res.data.id)
1042
- data.id = res.data.id
1043
- this.$dispatch('selfsearch')
1044
- this.$refs.service_show.data.onetomany[inedx].rows.push(data)
1045
- },
1046
- async 'onetomanyupdate'(i, j) {
1047
- let onetomany = this.show_data.onetomany[i]
1048
- let data = onetomany.rows[j]
1049
-
1050
- onetomany.fields.forEach(item => {
1051
- data[item.field] = item.value
1052
- })
1053
- let res = await this.$resetpost(
1054
- `rs/entity/${this.show_data.onetomany[i].tables[0]}`,
1055
- data
1056
- )
1057
- this.$dispatch('selfsearch')
1058
- this.$refs.service_show.data.onetomany[i].rows.splice(j,1,data)
1059
- },
1060
- // onetomany模态框监听事件
1061
- async 'check_modal'(index) {},
1062
- async 'oninput_modal'(index) {}
1063
- }
1064
- }
1065
- </script>
1066
- <style scoped>
1067
- /*清除model中的浮动*/
1068
- .clearfix:after,.clearfix:before{
1069
- display: table;
1070
- }
1071
- .clearfix:after{
1072
- clear: both;
1073
- }
1074
- </style>
1
+ <template>
2
+
3
+ <div class="auto clearfix">
4
+ <show-back-reason v-if="selectdata.f_back_reason && selectdata.f_back_reason!=''"
5
+ :data="show_data"></show-back-reason>
6
+ </div>
7
+
8
+ <service-view v-ref:service_show :data="show_data" v-if="showview"></service-view>
9
+
10
+ </template>
11
+ <script>
12
+ import Vue from 'vue'
13
+ import {HttpResetClass} from 'vue-client'
14
+ // Date格式化
15
+ Date.prototype.Format = function (fmt) {
16
+ var o = {
17
+ "M+": this.getMonth() + 1, //月份
18
+ "d+": this.getDate(), //日
19
+ "H+": this.getHours(), //小时
20
+ "m+": this.getMinutes(), //分
21
+ "s+": this.getSeconds(), //秒
22
+ "q+": Math.floor((this.getMonth() + 3) / 3), //季度
23
+ "S": this.getMilliseconds() //毫秒
24
+ };
25
+ if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
26
+ for (var k in o)
27
+ if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
28
+ return fmt;
29
+ }
30
+
31
+ export default {
32
+ title: '报建流程业务控制层',
33
+ props: ['selectdata'],
34
+ data() {
35
+ return {
36
+ data: null, // 数据库数据,json配置文件数据的数据集合
37
+ json_datas: null, // Json配置文件集合
38
+ showview: false, // 控制显示service-view组件
39
+ show_data: null, // 给view层显示的数据
40
+ }
41
+ },
42
+ created () {
43
+ this.refurbish()
44
+ },
45
+ methods: {
46
+ // 组件初始化操作
47
+ refurbish() {
48
+ // this.selectdata = val
49
+ this.json_datas = this.$workflow_vue
50
+ let sum = 0
51
+ let jsonData = {}
52
+ if (!this.json_datas || !this.json_datas.activitys || this.json_datas.activitys.length == 0) {
53
+ this.$showMessage("网络故障,请刷新页面")
54
+ return
55
+ }
56
+ for (let i = 0; i < this.json_datas.activitys.length; i++) {
57
+ if (this.selectdata.defname == this.json_datas.activitys[i].title) {
58
+ jsonData = this.json_datas.activitys[i]
59
+ sum++
60
+ }
61
+ }
62
+ for (let j = 0; j < jsonData.fields.length; j++) {
63
+ jsonData.fields[j].value = ''
64
+ if (jsonData.fields[j].default) {
65
+ jsonData.fields[j].value = jsonData.fields[j].default
66
+ }
67
+ }
68
+ if (sum == 1) {
69
+ this.data = null
70
+ this.data = jsonData
71
+ // selectdata 填充 data
72
+ this.data = Object.assign({}, this.data, this.selectdata)
73
+
74
+ this.initializtion()
75
+ } else if (sum == 0) {
76
+ this.$showMessage(`没有在JSON配置文件中找到活动名为:(${this.selectdata.defname})的节点配置`)
77
+ } else {
78
+ this.$showMessage(`在JSON配置文件中找到活动名为:(${this.selectdata.defname})的节点配置:${sum}个`)
79
+ }
80
+ },
81
+ // AOP:进入vue组件前初始化内容
82
+ // json配置数据处理 比如下拉框的options
83
+ async initializtion() {
84
+ if (this.show_data && this.show_data.f_process_id == this.data.f_process_id
85
+ && this.show_data.defname==this.selectdata.defname){
86
+ this.data = Object.assign({}, this.data, this.selectdata,this.show_data)
87
+ }
88
+ // 如果selectdata有这些key,则把selectdata的value赋值给data的value
89
+ this.data.fields.forEach(item => {
90
+ if (this.selectdata[item.field]) {
91
+ if (String(this.selectdata[item.field]).startsWith("{")) {
92
+ item.value = JSON.parse(this.selectdata[item.field])
93
+ this.selectdata[item.field] = JSON.parse(this.selectdata[item.field])
94
+ } else {
95
+ item.value = this.selectdata[item.field]
96
+ }
97
+ }
98
+ })
99
+
100
+ // 如果配置类型为select,优先从参数列表获取options
101
+ this.data.fields.forEach(item => {
102
+ if (item.type === 'select') {
103
+ let temp = Vue.$appdata.getParam(item.label)
104
+ if (temp && temp.length > 0 && item.label) {
105
+ item.options = Vue.$appdata.getParam(item.label)
106
+ }
107
+ }
108
+ })
109
+ // 初始化 fields
110
+ this.data.fields.forEach(item => {
111
+ // 可对数据进行特殊处理
112
+ if (item.label === '整改条件') {
113
+ item.value = '测试'
114
+ }
115
+ })
116
+
117
+ // 初始化 buttons_fields
118
+ for (let i = 0; i < this.data.buttons.length; i++) {
119
+ if (this.data.buttons[i].button_name === '下发') {
120
+ if (this.data.buttons[i].button_fields && this.data.buttons[i].button_fields.length === 1) {
121
+ if (this.data.buttons[i].source){
122
+ let http = new HttpResetClass()
123
+ let res = await http.load('POST', 'rs/search', {
124
+ source: this.data.buttons[i].source,
125
+ userid: this.$login.f.id
126
+ }, {resolveMsg: null, rejectMsg: null})
127
+
128
+ let options = []
129
+ for (let i = 0; i < res.data.length; i++) {
130
+ options.push(
131
+ {
132
+ "label": res.data[i].name,
133
+ "value": res.data[i].id
134
+ // {
135
+ // 'id': res.data[i].id,
136
+ // 'name': res.data[i].name
137
+ // }
138
+ }
139
+ )
140
+ }
141
+ this.data.buttons[i].button_fields[0]['options'] = options
142
+ } else {
143
+ this.$showMessage("请配置获取人员表达式")
144
+ }
145
+ } else {
146
+ this.$showMessage("下发按钮必须满足 当且仅当一个字段")
147
+ }
148
+ }
149
+ if (this.data.buttons[i].button_fields) {
150
+ this.data.buttons[i].button_fields.forEach(x => {
151
+ // 如果配置类型为select,优先从参数列表获取options
152
+ if (x.type === 'select' && this.$appdata.getParam(x.label)) {
153
+ x.options = this.$appdata.getParam(x.label).trim()
154
+ }
155
+ })
156
+ }
157
+ }
158
+
159
+ // onetomany 数据获取
160
+ if (this.data.onetomany) {
161
+ for (let index = 0; index < this.data.onetomany.length; index++) {
162
+ let http = new HttpResetClass()
163
+ let data = {
164
+ tablename: this.data.onetomany[index].tables[0],
165
+ condition: `f_process_id='${this.selectdata.f_process_id}'`
166
+ }
167
+
168
+ let res = await http.load('POST', 'rs/sql/singleTable', {data: data}, {
169
+ resolveMsg: null,
170
+ rejectMsg: 'onetomany查询失败'
171
+ })
172
+
173
+ // 初始化 onetomany
174
+ this.data.onetomany[index].rows = res.data
175
+
176
+ // 初始化onetomany中的fields
177
+ for (let j = 0; j < this.data.onetomany[index].fields.length; j++) {
178
+ // 如果配置类型为select,优先从参数列表获取options
179
+ if (this.data.onetomany[index].fields[j].type === 'select') {
180
+ let temp = Vue.$appdata.getParam(this.data.onetomany[index].fields[j].label)
181
+ if (temp && temp.length > 0) {
182
+ this.data.onetomany[index].fields[j].options = Vue.$appdata.getParam(this.data.onetomany[index].fields[j].label)
183
+ }
184
+ }
185
+ }
186
+
187
+ }
188
+ }
189
+
190
+ // 消除双向绑定,避免子组件(显示层)数据更改,父组件(控制层)也更改
191
+ let temp = JSON.parse(JSON.stringify(this.data))
192
+
193
+ this.show_data = temp
194
+ this.$nextTick(() => {
195
+ this.showview = true
196
+ })
197
+
198
+ // ===================安康逸华前端需求逻辑===========================
199
+ this.getArea()
200
+ this.setArea()
201
+ this.getGasMeter()
202
+ this.getGasPrice()
203
+ this.sure_last()
204
+ this.arrearsMoney()
205
+ this.meterOrPrice()
206
+ if (this.selectdata.f_apply_type !== '散户报建') {
207
+ this.moneyDue()
208
+ this.moneySumArrears()
209
+ }
210
+
211
+ },
212
+ // 金额转大写
213
+ smalltoBIG(n) {
214
+ let fraction = ['角', '分'];
215
+ let digit = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖'];
216
+ let unit = [['元', '万', '亿'], ['', '拾', '佰', '仟']];
217
+ let head = n < 0 ? '欠' : '';
218
+ n = Math.abs(n);
219
+
220
+ let s = '';
221
+
222
+ for (var i = 0; i < fraction.length; i++) {
223
+ s += (digit[Math.floor(n * 10 * Math.pow(10, i)) % 10] + fraction[i]).replace(/零./, '');
224
+ }
225
+ s = s || '整';
226
+ n = Math.floor(n);
227
+
228
+ for (var i = 0; i < unit[0].length && n > 0; i++) {
229
+ let p = '';
230
+ for (var j = 0; j < unit[1].length && n > 0; j++) {
231
+ p = digit[n % 10] + unit[1][j] + p;
232
+ n = Math.floor(n / 10);
233
+ }
234
+ s = p.replace(/(零.)*零$/, '').replace(/^$/, '零') + unit[0][i] + s;
235
+ }
236
+ return head + s.replace(/(零.)*零元/, '元').replace(/(零.)+/g, '零').replace(/^整$/, '零元整')
237
+ },
238
+ async setArea () {
239
+ if (this.selectdata.defname === '申请登记') {
240
+ for (let i = 0; i < this.show_data.fields.length; i++) {
241
+ if (this.show_data.fields[i].label == '县/区') {
242
+ this.show_data.fields[i].value = '陕西省安康市'
243
+ }
244
+ }
245
+ }
246
+ },
247
+ async getArea () {
248
+ if (this.selectdata.defname === '申请登记') {
249
+ let http = new HttpResetClass()
250
+ let condition = "f_filialeid = " + this.$login.f.orgid
251
+ let res = await http.load('POST','rs/logic/apply_queryArea',{data:{condition:condition}}, {resolveMsg: null, rejectMsg: null})
252
+ for (let i = 0; i < this.show_data.fields.length; i++) {
253
+ // if (this.show_data.fields[i].label == '县/区') {
254
+ // let data = []
255
+ // let array = []
256
+ // data = res.data.map(item => {
257
+ // return item.f_pcd;
258
+ // })
259
+ // for (let q = 0; q < data.length; q++) {
260
+ // let arraydata = {
261
+ // 'label': data[q],
262
+ // 'value': data[q]
263
+ // }
264
+ // if (array.length != 0) {
265
+ // for (let w = 0; w < array.length; w++) {
266
+ // if (array[w].label == data[q]) {
267
+ // break
268
+ // }
269
+ // while (w == array.length - 1) {
270
+ // array.push(arraydata)
271
+ // break
272
+ // }
273
+ // }
274
+ // } else {
275
+ // array.push(arraydata)
276
+ // }
277
+ // }
278
+ // this.show_data.fields[i].options = array
279
+ // console.log("县/区选择框数据:" + JSON.stringify(this.show_data.fields[i].options))
280
+ // }
281
+ if (this.show_data.fields[i].label == '街道') {
282
+ let data = []
283
+ let array = []
284
+ data = res.data.queryStreet.map(item => {
285
+ return item.f_street;
286
+ })
287
+ for (let q = 0; q < data.length; q++) {
288
+ let arraydata = {
289
+ 'label': data[q],
290
+ 'value': data[q]
291
+ }
292
+ if (array.length != 0) {
293
+ for (let w = 0; w < array.length; w++) {
294
+ if (array[w].label == data[q]) {
295
+ break
296
+ }
297
+ while (w == array.length - 1) {
298
+ array.push(arraydata)
299
+ break
300
+ }
301
+ }
302
+ } else {
303
+ array.push(arraydata)
304
+ }
305
+ }
306
+ this.show_data.fields[i].options = array
307
+ console.log("街道选择框数据:" + JSON.stringify(this.show_data.fields[i].options))
308
+ }
309
+ if (this.show_data.fields[i].label == '小区') {
310
+ let data = []
311
+ let array = []
312
+ data = res.data.queryArea.map(item => {
313
+ return item.f_residential_area;
314
+ })
315
+ for (let q = 0; q < data.length; q++) {
316
+ let arraydata = {
317
+ 'label': data[q],
318
+ 'value': data[q]
319
+ }
320
+ if (array.length != 0) {
321
+ for (let w = 0; w < array.length; w++) {
322
+ if (array[w].label == data[q]) {
323
+ break
324
+ }
325
+ while (w == array.length - 1) {
326
+ array.push(arraydata)
327
+ break
328
+ }
329
+ }
330
+ } else {
331
+ array.push(arraydata)
332
+ }
333
+ }
334
+ this.show_data.fields[i].options = array
335
+ console.log("小区选择框数据:" + JSON.stringify(this.show_data.fields[i].options))
336
+ }
337
+ }
338
+ }
339
+ },
340
+ async getGasMeter () {
341
+ for (let i = 0; i < this.show_data.fields.length; i++) {
342
+ if (
343
+ this.show_data.fields[i].label === '气表品牌'
344
+ // ||
345
+ // this.show_data.fields[i].label === '气表型号'
346
+ ) {
347
+ let http = new HttpResetClass()
348
+ let condition = "f_orgid = '" + this.$login.f.orgid + "'"
349
+ let res = await http.load('POST','rs/sql/applysingleTable',{data:{tablename:'t_gasbrand',condition:condition}}, {resolveMsg: null, rejectMsg: null})
350
+ for (let i = 0; i < this.show_data.fields.length; i++) {
351
+ if (this.show_data.fields[i].label == '气表品牌') {
352
+ let data = []
353
+ let array = []
354
+ data = res.data.map(item => {
355
+ return item.f_meter_brand;
356
+ })
357
+ for (let q = 0; q < data.length; q++) {
358
+ let arraydata = {
359
+ 'label': data[q],
360
+ 'value': data[q]
361
+ }
362
+ if (array.length != 0) {
363
+ for (let w = 0; w < array.length; w++) {
364
+ if (array[w].label == data[q]) {
365
+ break
366
+ }
367
+ while (w == array.length - 1) {
368
+ array.push(arraydata)
369
+ break
370
+ }
371
+ }
372
+ } else {
373
+ array.push(arraydata)
374
+ }
375
+ }
376
+ this.show_data.fields[i].options = array
377
+ console.log("选择框数据:" + JSON.stringify(this.show_data.fields[i].options))
378
+ }
379
+ }
380
+
381
+ }
382
+ }
383
+ },
384
+ async getGasMeter1 () {
385
+ for (let i = 0; i < this.show_data.fields.length; i++) {
386
+ if (
387
+ this.show_data.fields[i].label === '气表品牌' ||
388
+ this.show_data.fields[i].label === '气表型号'
389
+ ) {
390
+
391
+ if (this.$refs.service_show.data.fields[i].label == '气表品牌' && this.$refs.service_show.data.fields[i].value.length != 0) {
392
+ let http2 = new HttpResetClass()
393
+ let res2 = await http2.load('POST','rs/sql/queryGasType',{data:{f_orgid:this.$login.f.orgid,f_meter_brand:this.$refs.service_show.data.fields[i].value}}, {resolveMsg: null, rejectMsg: null})
394
+ // console.log("气表型号查询数据:" + JSON.stringify(res2.data))
395
+ for (let j = 0; j < this.show_data.fields.length; j++) {
396
+ if (this.$refs.service_show.data.fields[j].label == '气表型号') {
397
+ let data = []
398
+ let data2 = []
399
+ let array = []
400
+ data = res2.data.map(item => {
401
+ return item.f_meter_style;
402
+ })
403
+ data2 = res2.data.map(item => {
404
+ return item.f_type;
405
+ })
406
+ for (let q = 0; q < data.length; q++) {
407
+ let arraydata = {
408
+ 'label': data[q] + data2[q],
409
+ 'value': data[q] + data2[q]
410
+ }
411
+ let then = data[q] + data2[q]
412
+ if (array.length != 0) {
413
+ for (let w = 0; w < array.length; w++) {
414
+ if (array[w].label == then) {
415
+ break
416
+ }
417
+ while (w == array.length - 1) {
418
+ array.push(arraydata)
419
+ break
420
+ }
421
+ }
422
+ } else {
423
+ array.push(arraydata)
424
+ }
425
+ }
426
+ this.$refs.service_show.data.fields[j].options = array
427
+ console.log("气表型号选择框数据:" + JSON.stringify(this.$refs.service_show.data.fields[j].options))
428
+ }
429
+
430
+
431
+
432
+
433
+ }
434
+
435
+ }
436
+ }
437
+ }
438
+ },
439
+ async getGasPrice () {
440
+ for (let i = 0; i < this.show_data.fields.length; i++) {
441
+ //气价名称、气价类型
442
+ if (
443
+ this.show_data.fields[i].label === '气价名称' ||
444
+ this.show_data.fields[i].label === '气价类型' ||
445
+ this.show_data.fields[i].label === '气价' ||
446
+ this.show_data.fields[i].label === '客户类型' ||
447
+ this.show_data.fields[i].label === '用气性质'
448
+ ) {
449
+ let http = new HttpResetClass()
450
+ let condition = "f_orgid = '" + this.$login.f.orgid + "'"
451
+ let res = await http.load('POST','rs/sql/applysingleTable',{data:{tablename:'t_stairprice',condition:condition}}, {resolveMsg: null, rejectMsg: null})
452
+ for (let i = 0; i < this.show_data.fields.length; i++) {
453
+ if (this.show_data.fields[i].label == '气价名称') {
454
+ let data = []
455
+ let array = []
456
+ data = res.data.map(item => {
457
+ return item.f_price_name;
458
+ })
459
+ for (let q = 0; q < data.length; q++) {
460
+ let arraydata = {
461
+ 'label': data[q],
462
+ 'value': data[q]
463
+ }
464
+ if (array.length != 0) {
465
+ for (let w = 0; w < array.length; w++) {
466
+ if (array[w].label == data[q]) {
467
+ break
468
+ }
469
+ while (w == array.length - 1) {
470
+ array.push(arraydata)
471
+ break
472
+ }
473
+ }
474
+ } else {
475
+ array.push(arraydata)
476
+ }
477
+ }
478
+ this.show_data.fields[i].options = array
479
+ console.log("选择框数据:" + JSON.stringify(this.show_data.fields[i].options))
480
+ console.log("有没有数据长度:" + this.show_data.fields[i].value.length)
481
+ }
482
+
483
+ if (this.show_data.fields[i].label == '气价名称' && this.show_data.fields[i].value.length != 0) {
484
+ let http2 = new HttpResetClass()
485
+ let condition2 = "s.f_orgid = '" + this.$login.f.orgid + "'" + " and s.f_price_name = '" + this.show_data.fields[i].value + "'"
486
+ let res2 = await http2.load('POST','rs/sql/searchGasPrice',{data:{condition:condition2}}, {resolveMsg: null, rejectMsg: null})
487
+ console.log("气价数据:" + JSON.stringify(res2.data))
488
+ for (let j = 0; j < this.show_data.fields.length; j++) {
489
+ if (this.show_data.fields[j].label == '气价类型') {
490
+ console.log("气价类型:" + res2.data[0])
491
+ console.log("气价类型1:" + res2.data[0].f_price_type)
492
+ this.show_data.fields[j].value = res2.data[0].f_price_type
493
+ console.log("气价类型2:" + this.show_data.fields[j].value)
494
+ }
495
+ //气价拼接
496
+ if (this.show_data.fields[j].label == '气价') {
497
+ let p = 1
498
+ let resultPrice = ''
499
+ for(let l = 0; l < res2.data.length; l++){
500
+ resultPrice = resultPrice + res2.data[l].price + ' |'
501
+ if (p == 3) {
502
+ break
503
+ }
504
+ p++
505
+ }
506
+ console.log("拼接的价格:" + resultPrice)
507
+ this.show_data.fields[j].value = resultPrice
508
+ }
509
+ if (this.show_data.fields[j].label == '用气性质') {
510
+ this.show_data.fields[j].value = res2.data[0].f_gasproperties
511
+ }
512
+ if (this.show_data.fields[j].label == '客户类型') {
513
+ this.show_data.fields[j].value = res2.data[0].f_user_type
514
+ }
515
+ }
516
+
517
+
518
+ }
519
+
520
+ }
521
+
522
+
523
+
524
+ }
525
+ }
526
+ },
527
+ an_kang_yi_hua () {
528
+ //===================安康逸华前端特殊逻辑===========================
529
+ let swap1 = null // 小区名称转换
530
+ let swap2 = null // 户数
531
+ let swap3 = null // 单价
532
+ let swap4 = null // 报警器户数
533
+ let swap5 = null // 报警器单价
534
+ let swap6 = null // 其他费用
535
+ let swap7 = null // 灶具费
536
+ for (let i = 0; i < this.show_data.fields.length; i++) {
537
+ // 客户名称 = 小区名称
538
+ // if (this.show_data.fields[i].label === '小区' && this.show_data.fields[i].value != null && this.show_data.fields[i].value != undefined && this.show_data.fields[i].value != '' && this.selectdata.defname === '申请登记') {
539
+ // swap1 = this.show_data.fields[i].value
540
+ // }
541
+ // for (let j = 0; j < this.show_data.fields.length; j++) {
542
+ // if (this.show_data.fields[j].label === '客户名称' && this.selectdata.defname === '申请登记' && this.selectdata.f_apply_type === '集中报建') {
543
+ // this.show_data.fields[j].value = swap1
544
+ // }
545
+ // }
546
+ // 预算的计算逻辑
547
+ // if (this.selectdata.defname === '收费标准制定' || this.selectdata.defname === '收费审核' && this.selectdata.f_apply_type === '散户报建') {
548
+ if (this.selectdata.defname === '收费标准制定') {
549
+ if (this.show_data.fields[i].label === '户数') {
550
+ swap2 = this.show_data.fields[i].value
551
+ }
552
+ if (this.show_data.fields[i].label === '单价') {
553
+ swap3 = this.show_data.fields[i].value
554
+ }
555
+ if (this.show_data.fields[i].label === '报警器户数') {
556
+ swap4 = this.show_data.fields[i].value
557
+ }
558
+ if (this.show_data.fields[i].label === '报警器单价') {
559
+ swap5 = this.show_data.fields[i].value
560
+ }
561
+ if (this.show_data.fields[i].label === '其他费用') {
562
+ swap6 = this.show_data.fields[i].value
563
+ }
564
+ let sum1 = swap2 * swap3
565
+ let sum2 = swap4 * swap5
566
+ if (swap6 == null || swap6 == undefined || swap6 == '') {
567
+ swap6 = 0
568
+ }
569
+ if (this.show_data.fields[i].label === '预算') {
570
+ console.log("预算计算1:" + sum1 + " 预算计算2:" + sum2 + " 预算计算3:" + swap6)
571
+ this.show_data.fields[i].value = parseFloat(sum1) + parseFloat(sum2) + parseFloat(swap6)
572
+ }
573
+ }
574
+ if (this.selectdata.defname === '收费审核' && this.selectdata.f_apply_type === '散户报建') {
575
+ if (this.show_data.fields[i].label === '户数') {
576
+ swap2 = this.show_data.fields[i].value
577
+ }
578
+ if (this.show_data.fields[i].label === '单价') {
579
+ swap3 = this.show_data.fields[i].value
580
+ }
581
+ if (this.show_data.fields[i].label === '报警器户数') {
582
+ swap4 = this.show_data.fields[i].value
583
+ }
584
+ if (this.show_data.fields[i].label === '报警器单价') {
585
+ swap5 = this.show_data.fields[i].value
586
+ }
587
+ if (this.show_data.fields[i].label === '其他费用') {
588
+ swap6 = this.show_data.fields[i].value
589
+ }
590
+ if (this.show_data.fields[i].label === '安装费') {
591
+ this.show_data.fields[i].value = swap2 * swap3
592
+ }
593
+ if (this.show_data.fields[i].label === '报警器费') {
594
+ this.show_data.fields[i].value = swap4 * swap5
595
+ }
596
+ if (this.show_data.fields[i].label === '灶具费') {
597
+ swap7 = this.show_data.fields[i].value
598
+ }
599
+ let sum1 = swap2 * swap3
600
+ let sum2 = swap4 * swap5
601
+ if (swap6 == null || swap6 == undefined || swap6 == '') {
602
+ swap6 = 0
603
+ }
604
+ if (swap7 == null || swap7 == undefined || swap7 == '') {
605
+ swap7 = 0
606
+ }
607
+ if (this.show_data.fields[i].label === '预算') {
608
+ console.log("预算计算1:" + sum1 + " 预算计算2:" + sum2 + " 预算计算3:" + swap6)
609
+ this.show_data.fields[i].value = parseFloat(sum1) + parseFloat(sum2) + parseFloat(swap6) + parseFloat(swap7)
610
+ }
611
+
612
+ }
613
+ }
614
+ },
615
+ sure_last() {
616
+ if (this.selectdata.defname == '确认尾款') {
617
+
618
+ for (let i = 0; i < this.show_data.fields.length; i++) {
619
+ // 每个部门只能填写自己的
620
+ // console.log("登录的信息:" + JSON.stringify(this.$login.f))
621
+ if (this.$login.f.deps == '市场部') {
622
+ if (this.show_data.fields[i].label == '财务部确认尾款') {
623
+ this.show_data.fields[i].type = 'input'
624
+ this.show_data.fields[i].required = false
625
+ this.show_data.fields[i].readonly = true
626
+ }
627
+ }
628
+ // 财务部
629
+ if (this.$login.f.deps == '财务部') {
630
+ if (this.show_data.fields[i].label == '市场部确认尾款') {
631
+ this.show_data.fields[i].type = 'input'
632
+ this.show_data.fields[i].required = false
633
+ this.show_data.fields[i].readonly = true
634
+ }
635
+ }
636
+ }
637
+ }
638
+ },
639
+ // 根据小区名称获取合同编号
640
+ async getContractNumber() {
641
+ console.log("进来了没有1")
642
+ if (this.selectdata.defname == '申请登记') {
643
+
644
+ for (let i = 0; i < this.show_data.fields.length; i++) {
645
+ // console.log("进来了没有2")
646
+ // console.log("选择框的名称:" + this.show_data.fields[i].label + "---小区名称的长度:" + this.show_data.fields[i].value.length)
647
+ if (this.show_data.fields[i].label == '小区' && this.show_data.fields[i].value.length != 0) {
648
+ console.log("进来了没有3")
649
+ let http = new HttpResetClass()
650
+ // 组织数据
651
+ let data = {
652
+ tablename: 't_contract_no',
653
+ condition: "f_residential_name = '" + this.show_data.fields[i].value + "'"
654
+ }
655
+ let res = await http.load('POST','rs/sql/applysingleTable',{data: data}, {
656
+ resolveMsg: null,
657
+ rejectMsg: '查询合同编号失败'
658
+ })
659
+ for (let j = 0; j < this.show_data.fields.length; j++) {
660
+ if (this.show_data.fields[j].label === '合同编号') {
661
+ this.show_data.fields[j].value = res.data[0].f_contract_number
662
+ }
663
+ }
664
+
665
+ }
666
+ }
667
+ }
668
+
669
+ },
670
+ // 应交金额计算
671
+ async moneyDue() {
672
+ // 应交金额 = 合同价格
673
+ if (this.selectdata.defname === '报建缴费' && this.selectdata.f_apply_type !== '集中报建') {
674
+ console.log("进来没有-------")
675
+ let result = 0.00
676
+ for (let i = 0; i < this.show_data.fields.length; i++) {
677
+
678
+ if (this.show_data.fields[i].label === '合同价格') {
679
+ // console.log("计算金额1")
680
+ result = this.show_data.fields[i].value
681
+ }
682
+ // console.log("计算金额:" + result)
683
+ if (this.show_data.fields[i].label === '应交金额') {
684
+ // console.log("计算金额2")
685
+ this.show_data.fields[i].value = result
686
+ }
687
+
688
+ }
689
+ }
690
+
691
+
692
+ },
693
+ // 累计缴费金额和欠费金额
694
+ async moneySumArrears() {
695
+ if (this.selectdata.defname === '报建缴费') {
696
+ // 查询是否有缴费记录
697
+ let http = new HttpResetClass()
698
+ // 组织数据
699
+ let data = {
700
+ tablename: 't_charge_record',
701
+ condition: "f_process_id = '" + this.selectdata.f_process_id + "' and f_charge_state = '有效'"
702
+ }
703
+ let res = await http.load('POST','rs/sql/applysingleTable',{data: data}, {
704
+ resolveMsg: null,
705
+ rejectMsg: '查询收费记录失败'
706
+ })
707
+ if (res.data.length > 0) {
708
+ for (let i = 0; i < this.show_data.fields.length; i++) {
709
+ if (this.show_data.fields[i].label === '累计缴费金额') {
710
+ this.show_data.fields[i].value
711
+ }
712
+ if (this.show_data.fields[i].label === '欠费金额') {
713
+ this.show_data.fields[i].value
714
+ }
715
+ }
716
+ }else {
717
+ let result = 0.00
718
+ for (let i = 0; i < this.show_data.fields.length; i++) {
719
+ if (this.show_data.fields[i].label === '应交金额') {
720
+ result = this.show_data.fields[i].value
721
+ }
722
+ if (this.show_data.fields[i].label === '累计缴费金额') {
723
+ this.show_data.fields[i].value = 0
724
+ }
725
+ if (this.show_data.fields[i].label === '欠费金额') {
726
+ this.show_data.fields[i].value = result
727
+ }
728
+ }
729
+ }
730
+
731
+ }
732
+ },
733
+ // 欠费金额为0时的不显示解决
734
+ async arrearsMoney() {
735
+ // 应交金额 = 合同价格
736
+ if (this.selectdata.defname === '收费审核' || this.selectdata.defname === '报建缴费') {
737
+ for (let i = 0; i < this.show_data.fields.length; i++) {
738
+
739
+ if (this.show_data.fields[i].label === '欠费金额') {
740
+ if (this.show_data.fields[i].value === 0.00 || this.show_data.fields[i].value === undefined || this.show_data.fields[i].value == null || this.show_data.fields[i].value == '') {
741
+ this.show_data.fields[i].value = 0
742
+ }
743
+ }
744
+
745
+ }
746
+ }
747
+
748
+
749
+ },
750
+ // 散户改管时气表信息和通气信息非必填
751
+ async meterOrPrice() {
752
+ // 应交金额 = 合同价格
753
+ if (this.selectdata.f_apply_type == '散户报建') {
754
+ if (this.selectdata.defname == '施工' && this.selectdata.f_project_type == '改管') {
755
+ for (let i = 0; i < this.show_data.fields.length; i++) {
756
+
757
+ if (this.show_data.fields[i].label == '表号') {
758
+ this.show_data.fields[i].required = false
759
+ }
760
+ if (this.show_data.fields[i].label == '左右表') {
761
+ this.show_data.fields[i].required = false
762
+ }
763
+ if (this.show_data.fields[i].label == '气表品牌') {
764
+ this.show_data.fields[i].required = false
765
+ }
766
+ if (this.show_data.fields[i].label == '气表型号') {
767
+ this.show_data.fields[i].required = false
768
+ }
769
+
770
+ }
771
+ }
772
+ if (this.selectdata.defname == '通气' && this.selectdata.f_project_type == '改管') {
773
+ for (let i = 0; i < this.show_data.fields.length; i++) {
774
+
775
+ if (this.show_data.fields[i].label == '气价名称') {
776
+ this.show_data.fields[i].required = false
777
+ }
778
+ if (this.show_data.fields[i].label == '用气性质') {
779
+ this.show_data.fields[i].required = false
780
+ }
781
+ if (this.show_data.fields[i].label == '气价') {
782
+ this.show_data.fields[i].required = false
783
+ }
784
+ if (this.show_data.fields[i].label == '客户类型') {
785
+ this.show_data.fields[i].required = false
786
+ }
787
+ if (this.show_data.fields[i].label == '气价类型') {
788
+ this.show_data.fields[i].required = false
789
+ }
790
+ if (this.show_data.fields[i].label == '通气人') {
791
+ this.show_data.fields[i].required = false
792
+ }
793
+ if (this.show_data.fields[i].label == '通气时间') {
794
+ this.show_data.fields[i].required = false
795
+ this.show_data.fields[i].value = ''
796
+ }
797
+
798
+ }
799
+ }
800
+ }
801
+
802
+
803
+
804
+ }
805
+
806
+ },
807
+ events: {
808
+ test(i, j){
809
+ console.log('删除')
810
+ console.log(i + '-----' +j)
811
+ },
812
+ // 获取view层button事件/
813
+ async 'button'(model) {
814
+ // 点击重置按钮就重置数据
815
+ if (model.button.button_name === '重置') {
816
+ this.refurbish()
817
+ return
818
+ }
819
+
820
+ // 获取上传附件是否上传过身份证
821
+ // if (this.selectdata.defname == '申请登记' && model.button.button_name === '提交') {
822
+ // // 获取上传附件是否上传过身份证
823
+ //
824
+ // let http = new HttpResetClass()
825
+ // // 组织数据
826
+ // let data = {
827
+ // tablename: 't_files',
828
+ // condition: "f_blobid = '" + this.selectdata.f_process_id + "' and fusetype = '身份证'"
829
+ // }
830
+ // let res = await http.load('POST','rs/sql/applysingleTable',{data: data}, {
831
+ // resolveMsg: null,
832
+ // rejectMsg: '查询附件身份证号失败'
833
+ // })
834
+ // if (!res.data.length > 0) {
835
+ // this.$showMessage("请上传身份证附件")
836
+ // return
837
+ // }
838
+ //
839
+ //
840
+ // }
841
+ // 判断是否都填写
842
+ if (this.selectdata.defname == '确认尾款' && model.button.button_name === '提交') {
843
+
844
+ for (let i = 0; i < this.show_data.fields.length; i++) {
845
+ // 判断是否都填写
846
+ if (this.show_data.fields[i].label == '市场部确认尾款') {
847
+ if (this.show_data.fields[i].value.trim().length == 0 || this.show_data.fields[i].value.length == undefined || this.show_data.fields[i].value.length == null) {
848
+ this.$showMessage("市场部未确认,请点击保存!")
849
+ return
850
+ }
851
+ }
852
+ if (this.show_data.fields[i].label == '财务部确认尾款') {
853
+ if (this.show_data.fields[i].value.trim().length == 0 || this.show_data.fields[i].value.length == undefined || this.show_data.fields[i].value.length == null) {
854
+ this.$showMessage("财务部未确认,请点击保存!")
855
+ return
856
+ }
857
+ }
858
+ }
859
+ }
860
+
861
+
862
+ // 修改提交数据
863
+ model = Object.assign({}, this.selectdata, model)
864
+ let http = new HttpResetClass()
865
+ let requestData = {
866
+ tables: this.data.tables,
867
+ start_activity: this.$workflow_vue.start_activity,
868
+ model: model,
869
+ loginUser: this.$login.f,
870
+ workflow_xmlfilename: this.$workflow_vue.workflow_xmlfilename
871
+ }
872
+ // 下发,提交,保存,退回通用业务后台处理logic
873
+ let url = 'rs/logic/ApplyProductService'
874
+
875
+ let res = await http.load('POST', url, {data: requestData}, {resolveMsg: null, rejectMsg: '数据保存失败'})
876
+ if (res.data.code == 200) {
877
+ model = res.data.model
878
+
879
+ this.showview = false
880
+ // 特殊处理
881
+ this.$dispatch('close')
882
+ this.initializtion()
883
+
884
+ } else {
885
+ if (res.data.msg) {
886
+ this.$showMessage(res.data.msg)
887
+ }
888
+ }
889
+ },
890
+ // 失去焦点出触发事件
891
+ async 'check'(index) {
892
+ // =====================================安康逸华特殊逻辑===========================================
893
+ this.moneyDue()
894
+ this.moneySumArrears()
895
+ this.getContractNumber()
896
+ this.an_kang_yi_hua()
897
+ this.getGasMeter1()
898
+ this.getGasPrice()
899
+
900
+
901
+ // 合成地址
902
+ if (
903
+ this.$refs.service_show.data.fields[index].label === '县/区' ||
904
+ this.$refs.service_show.data.fields[index].label === '街道' ||
905
+ this.$refs.service_show.data.fields[index].label === '小区' ||
906
+ this.$refs.service_show.data.fields[index].label === '楼号' ||
907
+ this.$refs.service_show.data.fields[index].label === '单元号' ||
908
+ this.$refs.service_show.data.fields[index].label === '楼层' ||
909
+ this.$refs.service_show.data.fields[index].label === '门牌号'
910
+ ) {
911
+ console.log('即将合成地址')
912
+ var address = ''
913
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
914
+ // 控制设置级联
915
+ // 源select所选的值 this.$refs.service_show.data.activitys.fields[index].value
916
+ // xxx xx xxx
917
+ if (this.$refs.service_show.data.fields[i].label === '县/区' && this.$refs.service_show.data.fields[i].value) {
918
+ address += this.$refs.service_show.data.fields[i].value
919
+ }
920
+ if (this.$refs.service_show.data.fields[i].label === '街道' && this.$refs.service_show.data.fields[i].value) {
921
+ address += this.$refs.service_show.data.fields[i].value
922
+ }
923
+ if (this.$refs.service_show.data.fields[i].label === '小区' && this.$refs.service_show.data.fields[i].value) {
924
+ address += this.$refs.service_show.data.fields[i].value
925
+ }
926
+ if (this.$refs.service_show.data.fields[i].label === '楼号' && this.$refs.service_show.data.fields[i].value) {
927
+ address += ' ' + this.$refs.service_show.data.fields[i].value
928
+ }
929
+ if (this.$refs.service_show.data.fields[i].label === '单元号' && this.$refs.service_show.data.fields[i].value) {
930
+ address += '-' + this.$refs.service_show.data.fields[i].value
931
+ }
932
+ if (this.$refs.service_show.data.fields[i].label === '楼层' && this.$refs.service_show.data.fields[i].value) {
933
+ address += '-' + this.$refs.service_show.data.fields[i].value
934
+ }
935
+ if (this.$refs.service_show.data.fields[i].label === '门牌号' && this.$refs.service_show.data.fields[i].value) {
936
+ address += '-' + this.$refs.service_show.data.fields[i].value
937
+ }
938
+ }
939
+ console.log('获取到的address=>' + address)
940
+ // 数据获取完毕时放入地址text
941
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
942
+ if (this.$refs.service_show.data.fields[i].label === '地址') {
943
+ this.$refs.service_show.data.fields[i].value = address
944
+ console.log('修改fields[i].value后的值=>' + this.$refs.service_show.data.fields[i].value)
945
+ }
946
+ }
947
+ }
948
+ // 号码检测
949
+ if (this.$refs.service_show.data.fields[index].label == '电话号码') {
950
+ let phone = this.$refs.service_show.data.fields[index].value
951
+ // 电话号码效验
952
+ if (!(/^1[3456789]\d{9}$/.test(phone))) {
953
+ this.$refs.service_show.data.fields[index].value = ""
954
+ this.$showAlert('电话号码格式不正确,请重新输入。', 'info', 2000)
955
+ }
956
+ }
957
+
958
+ //时间提醒
959
+ if (this.$refs.service_show.data.fields[index].label.includes("时间") || this.$refs.service_show.data.fields[index].type === 'datepicker') {
960
+ let setTime = this.$refs.service_show.data.fields[i].value
961
+ let nowTime = new Date().Format("yyyy-MM-dd HH:mm:ss")
962
+ if (nowTime >= setTime) {
963
+ this.$showMessage("请注意,当前节点时间/工期已过期!")
964
+ }
965
+ }
966
+
967
+ // // 任何是否的选择框只要是否都不能提交
968
+ // if (this.$refs.service_show.data.fields[index].value === '否') {
969
+ // this.$refs.service_show.disable_button = true
970
+ // // this.$refs.service_show.data.buttons[1].button_name = '保存'
971
+ // this.$showMessage("当审核/确认为否时,无法提交")
972
+ // return
973
+ // }else {
974
+ // // this.$refs.service_show.data.buttons[1].button_name = '提交'
975
+ // this.$refs.service_show.disable_button = false
976
+ // }
977
+ },
978
+ // input值发生变化
979
+ async 'oninput'(index) {},
980
+ // 错误事件
981
+ error_check(index) {
982
+ // 时间格式检测
983
+ if (this.$refs.service_show.data.fields[index].type == 'datepicker') {
984
+ let dateRe = new RegExp(/(([0-9]{3}[1-9]|[0-9]{2}[1-9][0-9]{1}|[0-9]{1}[1-9][0-9]{2}|[1-9][0-9]{3})-(((0[13578]|1[02])-(0[1-9]|[12][0-9]|3[01]))|((0[469]|11)-(0[1-9]|[12][0-9]|30))|(02-(0[1-9]|[1][0-9]|2[0-8]))))|((([0-9]{2})(0[48]|[2468][048]|[13579][26])|((0[48]|[2468][048]|[3579][26])00))-02-29)$/)
985
+ let datetimeRe = new RegExp(/((([0-9]{3}[1-9]|[0-9]{2}[1-9][0-9]{1}|[0-9]{1}[1-9][0-9]{2}|[1-9][0-9]{3})-(((0[13578]|1[02])-(0[1-9]|[12][0-9]|3[01]))|((0[469]|11)-(0[1-9]|[12][0-9]|30))|(02-(0[1-9]|[1][0-9]|2[0-8]))))|((([0-9]{2})(0[48]|[2468][048]|[13579][26])|((0[48]|[2468][048]|[3579][26])00))-02-29))\s([0-1][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])$/)
986
+ if (datetimeRe.test(this.$refs.service_show.data.fields[index].value) && this.$refs.service_show.data.fields[index].value.trim().length == 19 && this.$refs.service_show.data.fields[index].fullsize) {
987
+ this.$refs.service_show.data.fields[index].error.flag = false
988
+ } else if (dateRe.test(this.$refs.service_show.data.fields[index].value) && this.$refs.service_show.data.fields[index].value.trim().length == 10) {
989
+ this.$refs.service_show.data.fields[index].error.flag = false
990
+ } else {
991
+ if (this.$refs.service_show.data.fields[index].fullsize) {
992
+ this.$refs.service_show.data.fields[index].error = Object.assign({}, this.$refs.service_show.data.fields[index].error)
993
+ this.$refs.service_show.data.fields[index].error.msg = this.$refs.service_show.data.fields[index].error.msg ? this.$refs.service_show.data.fields[index].error.msg : '时间格式如:2019-05-02 09:23:21'
994
+ this.$showAlert(this.$refs.service_show.data.fields[index].label + '格式错误' + this.$refs.service_show.data.fields[index].error.msg, 'warning', 3000)
995
+ this.$refs.service_show.data.fields[index].error.flag = true
996
+ this.$refs.service_show.data.fields[index].value = ''
997
+ } else {
998
+ this.$refs.service_show.data.fields[index].error = Object.assign({}, this.$refs.service_show.data.fields[index].error)
999
+ this.$refs.service_show.data.fields[index].error.msg = this.$refs.service_show.data.fields[index].error.msg ? this.$refs.service_show.data.fields[index].error.msg : '时间格式如:2019-05-02'
1000
+ this.$showAlert(this.$refs.service_show.data.fields[index].label + '格式错误' + this.$refs.service_show.data.fields[index].error.msg, 'warning', 3000)
1001
+ this.$refs.service_show.data.fields[index].error.flag = true
1002
+ this.$refs.service_show.data.fields[index].value = ''
1003
+ }
1004
+
1005
+ }
1006
+ }
1007
+ },
1008
+ // onetomany模态框默认监听监听事件
1009
+ async 'onetomanydelete'(i, j) {
1010
+ console.log('默认删除')
1011
+ let http = new HttpResetClass()
1012
+ let data = {
1013
+ table: this.show_data.onetomany[i].tables[0],
1014
+ row: this.show_data.onetomany[i].rows[j]
1015
+ }
1016
+ let res = await http.load('POST', 'rs/logic/onetomanyDefaultDeleteEvent', {data: data}, {
1017
+ resolveMsg: null,
1018
+ rejectMsg: '删除失败'
1019
+ })
1020
+
1021
+ if (res.data <= 0){
1022
+ this.$showMessage('删除失败')
1023
+ return
1024
+ }
1025
+
1026
+ this.$dispatch('selfsearch')
1027
+ this.$refs.service_show.data.onetomany[i].rows.splice(j, 1)
1028
+ },
1029
+ async 'onetomanyadd'(inedx) {
1030
+ let data = {
1031
+ f_process_id : this.show_data.f_process_id
1032
+ }
1033
+ this.show_data.onetomany[inedx].fields.forEach(item => {
1034
+ data[item.field] = item.value
1035
+ })
1036
+ let res = await this.$resetpost(
1037
+ `rs/entity/${this.show_data.onetomany[inedx].tables[0]}`,
1038
+ data
1039
+ )
1040
+
1041
+ console.log('res.data.id')
1042
+ console.log(res.data.id)
1043
+ data.id = res.data.id
1044
+ this.$dispatch('selfsearch')
1045
+ this.$refs.service_show.data.onetomany[inedx].rows.push(data)
1046
+ },
1047
+ async 'onetomanyupdate'(i, j) {
1048
+ let onetomany = this.show_data.onetomany[i]
1049
+ let data = onetomany.rows[j]
1050
+
1051
+ onetomany.fields.forEach(item => {
1052
+ data[item.field] = item.value
1053
+ })
1054
+ let res = await this.$resetpost(
1055
+ `rs/entity/${this.show_data.onetomany[i].tables[0]}`,
1056
+ data
1057
+ )
1058
+ this.$dispatch('selfsearch')
1059
+ this.$refs.service_show.data.onetomany[i].rows.splice(j,1,data)
1060
+ },
1061
+ // onetomany模态框监听事件
1062
+ async 'check_modal'(index) {},
1063
+ async 'oninput_modal'(index) {}
1064
+ }
1065
+ }
1066
+ </script>
1067
+ <style scoped>
1068
+ /*清除model中的浮动*/
1069
+ .clearfix:after,.clearfix:before{
1070
+ display: table;
1071
+ }
1072
+ .clearfix:after{
1073
+ clear: both;
1074
+ }
1075
+ </style>