apply-clients 3.1.68 → 3.1.70

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,1303 +1,1303 @@
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
-
85
- if (this.show_data && this.show_data.f_process_id == this.data.f_process_id
86
- && this.show_data.defname==this.selectdata.defname){
87
- this.data = Object.assign({}, this.data, this.selectdata,this.show_data)
88
- }
89
- // 如果selectdata有这些key,则把selectdata的value赋值给data的value
90
- this.data.fields.forEach(item => {
91
- if (this.selectdata[item.field]) {
92
- if (String(this.selectdata[item.field]).startsWith("{")) {
93
- item.value = JSON.parse(this.selectdata[item.field])
94
- this.selectdata[item.field] = JSON.parse(this.selectdata[item.field])
95
- } else {
96
- item.value = this.selectdata[item.field]
97
- }
98
- }
99
- })
100
-
101
- // 如果配置类型为select,优先从参数列表获取options
102
- this.data.fields.forEach(item => {
103
- if (item.type === 'select') {
104
- let temp = Vue.$appdata.getParam(item.label)
105
- if (temp && temp.length > 0 && item.label) {
106
- item.options = Vue.$appdata.getParam(item.label)
107
- }
108
- }
109
- })
110
- // 初始化 fields
111
- this.data.fields.forEach(item => {
112
- // 可对数据进行特殊处理
113
- if (item.label === '整改条件') {
114
- item.value = '测试'
115
- }
116
- })
117
-
118
- // 初始化 buttons_fields
119
- for (let i = 0; i < this.data.buttons.length; i++) {
120
- if (this.data.buttons[i].button_name === '下发') {
121
- if (this.data.buttons[i].button_fields && this.data.buttons[i].button_fields.length === 1) {
122
- if (this.data.buttons[i].source){
123
- let http = new HttpResetClass()
124
- let res = await http.load('POST', 'rs/search', {
125
- source: this.data.buttons[i].source,
126
- userid: this.$login.f.id
127
- }, {resolveMsg: null, rejectMsg: null})
128
-
129
- let options = []
130
- for (let i = 0; i < res.data.length; i++) {
131
- options.push(
132
- {
133
- "label": res.data[i].name,
134
- "value": res.data[i].id
135
- // {
136
- // 'id': res.data[i].id,
137
- // 'name': res.data[i].name
138
- // }
139
- }
140
- )
141
- }
142
- this.data.buttons[i].button_fields[0]['options'] = options
143
- } else {
144
- this.$showMessage("请配置获取人员表达式")
145
- }
146
- } else {
147
- this.$showMessage("下发按钮必须满足 当且仅当一个字段")
148
- }
149
- }
150
- if (this.data.buttons[i].button_fields) {
151
- this.data.buttons[i].button_fields.forEach(x => {
152
- // 如果配置类型为select,优先从参数列表获取options
153
- if (x.type === 'select' && this.$appdata.getParam(x.label)) {
154
- x.options = this.$appdata.getParam(x.label).trim()
155
- }
156
- })
157
- }
158
- }
159
-
160
- // onetomany 数据获取
161
- if (this.data.onetomany) {
162
- for (let index = 0; index < this.data.onetomany.length; index++) {
163
- let http = new HttpResetClass()
164
- let data = {
165
- tablename: this.data.onetomany[index].tables[0],
166
- condition: `f_process_id='${this.selectdata.f_process_id}'`
167
- }
168
-
169
- let res = await http.load('POST', 'rs/sql/singleTable', {data: data}, {
170
- resolveMsg: null,
171
- rejectMsg: 'onetomany查询失败'
172
- })
173
-
174
- // 初始化 onetomany
175
- this.data.onetomany[index].rows = res.data
176
-
177
- // 初始化onetomany中的fields
178
- for (let j = 0; j < this.data.onetomany[index].fields.length; j++) {
179
- // 如果配置类型为select,优先从参数列表获取options
180
- if (this.data.onetomany[index].fields[j].type === 'select') {
181
- let temp = Vue.$appdata.getParam(this.data.onetomany[index].fields[j].label)
182
- if (temp && temp.length > 0) {
183
- this.data.onetomany[index].fields[j].options = Vue.$appdata.getParam(this.data.onetomany[index].fields[j].label)
184
- }
185
- }
186
- }
187
-
188
- }
189
- }
190
-
191
- // 消除双向绑定,避免子组件(显示层)数据更改,父组件(控制层)也更改
192
- let temp = JSON.parse(JSON.stringify(this.data))
193
- debugger
194
- this.show_data = temp
195
- this.$nextTick(() => {
196
- this.showview = true
197
- })
198
-
199
- // ===================安康逸华前端需求逻辑===========================
200
- this.getArea()
201
- this.setArea()
202
- this.getGasMeter()
203
- this.getGasPrice()
204
- this.sure_last()
205
- this.arrearsMoney()
206
- this.meterOrPrice()
207
- if (this.selectdata.f_apply_type !== '散户报建') {
208
- this.moneyDue()
209
- this.moneySumArrears()
210
- }
211
- let istrue=this.data.f_is_true;
212
- let isrefund=this.data.f_is_refund;
213
- if(istrue==="是"||isrefund==="是"){
214
- this.show_data.buttons[2].hidden = true
215
- }
216
-
217
- },
218
- // 金额转大写
219
- smalltoBIG(n) {
220
- let fraction = ['角', '分'];
221
- let digit = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖'];
222
- let unit = [['元', '万', '亿'], ['', '拾', '佰', '仟']];
223
- let head = n < 0 ? '欠' : '';
224
- n = Math.abs(n);
225
-
226
- let s = '';
227
-
228
- for (var i = 0; i < fraction.length; i++) {
229
- s += (digit[Math.floor(n * 10 * Math.pow(10, i)) % 10] + fraction[i]).replace(/零./, '');
230
- }
231
- s = s || '整';
232
- n = Math.floor(n);
233
-
234
- for (var i = 0; i < unit[0].length && n > 0; i++) {
235
- let p = '';
236
- for (var j = 0; j < unit[1].length && n > 0; j++) {
237
- p = digit[n % 10] + unit[1][j] + p;
238
- n = Math.floor(n / 10);
239
- }
240
- s = p.replace(/(零.)*零$/, '').replace(/^$/, '零') + unit[0][i] + s;
241
- }
242
- return head + s.replace(/(零.)*零元/, '元').replace(/(零.)+/g, '零').replace(/^整$/, '零元整')
243
- },
244
- async setArea () {
245
- if (this.selectdata.defname === '申请登记') {
246
- for (let i = 0; i < this.show_data.fields.length; i++) {
247
- if (this.show_data.fields[i].label == '县/区') {
248
- this.show_data.fields[i].value = '陕西省安康市'
249
- }
250
- }
251
- }
252
- },
253
- async getArea () {
254
- if (this.selectdata.defname === '申请登记') {
255
- let http = new HttpResetClass()
256
- let condition = "f_filialeid = " + this.$login.f.orgid
257
- let res = await http.load('POST','rs/logic/apply_queryArea',{data:{condition:condition}}, {resolveMsg: null, rejectMsg: null})
258
- for (let i = 0; i < this.show_data.fields.length; i++) {
259
- // if (this.show_data.fields[i].label == '县/区') {
260
- // let data = []
261
- // let array = []
262
- // data = res.data.map(item => {
263
- // return item.f_pcd;
264
- // })
265
- // for (let q = 0; q < data.length; q++) {
266
- // let arraydata = {
267
- // 'label': data[q],
268
- // 'value': data[q]
269
- // }
270
- // if (array.length != 0) {
271
- // for (let w = 0; w < array.length; w++) {
272
- // if (array[w].label == data[q]) {
273
- // break
274
- // }
275
- // while (w == array.length - 1) {
276
- // array.push(arraydata)
277
- // break
278
- // }
279
- // }
280
- // } else {
281
- // array.push(arraydata)
282
- // }
283
- // }
284
- // this.show_data.fields[i].options = array
285
- // console.log("县/区选择框数据:" + JSON.stringify(this.show_data.fields[i].options))
286
- // }
287
- if (this.show_data.fields[i].label == '街道') {
288
- let data = []
289
- let array = []
290
- data = res.data.queryStreet.map(item => {
291
- return item.f_street;
292
- })
293
- for (let q = 0; q < data.length; q++) {
294
- let arraydata = {
295
- 'label': data[q],
296
- 'value': data[q]
297
- }
298
- if (array.length != 0) {
299
- for (let w = 0; w < array.length; w++) {
300
- if (array[w].label == data[q]) {
301
- break
302
- }
303
- while (w == array.length - 1) {
304
- array.push(arraydata)
305
- break
306
- }
307
- }
308
- } else {
309
- array.push(arraydata)
310
- }
311
- }
312
- this.show_data.fields[i].options = array
313
- console.log("街道选择框数据:" + JSON.stringify(this.show_data.fields[i].options))
314
- }
315
- if (this.show_data.fields[i].label == '小区') {
316
- let data = []
317
- let array = []
318
- data = res.data.queryArea.map(item => {
319
- return item.f_residential_area;
320
- })
321
- for (let q = 0; q < data.length; q++) {
322
- let arraydata = {
323
- 'label': data[q],
324
- 'value': data[q]
325
- }
326
- if (array.length != 0) {
327
- for (let w = 0; w < array.length; w++) {
328
- if (array[w].label == data[q]) {
329
- break
330
- }
331
- while (w == array.length - 1) {
332
- array.push(arraydata)
333
- break
334
- }
335
- }
336
- } else {
337
- array.push(arraydata)
338
- }
339
- }
340
- this.show_data.fields[i].options = array
341
- console.log("小区选择框数据:" + JSON.stringify(this.show_data.fields[i].options))
342
- }
343
- }
344
- }
345
- },
346
- async getGasMeter () {
347
- for (let i = 0; i < this.show_data.fields.length; i++) {
348
- if (
349
- this.show_data.fields[i].label === '气表品牌'
350
- // ||
351
- // this.show_data.fields[i].label === '气表型号'
352
- ) {
353
- let http = new HttpResetClass()
354
- let condition = "f_orgid = '" + this.$login.f.orgid + "'"
355
- let res = await http.load('POST','rs/sql/applysingleTable',{data:{tablename:'t_gasbrand',condition:condition}}, {resolveMsg: null, rejectMsg: null})
356
- for (let i = 0; i < this.show_data.fields.length; i++) {
357
- if (this.show_data.fields[i].label == '气表品牌') {
358
- let data = []
359
- let array = []
360
- data = res.data.map(item => {
361
- return item.f_meter_brand;
362
- })
363
- for (let q = 0; q < data.length; q++) {
364
- let arraydata = {
365
- 'label': data[q],
366
- 'value': data[q]
367
- }
368
- if (array.length != 0) {
369
- for (let w = 0; w < array.length; w++) {
370
- if (array[w].label == data[q]) {
371
- break
372
- }
373
- while (w == array.length - 1) {
374
- array.push(arraydata)
375
- break
376
- }
377
- }
378
- } else {
379
- array.push(arraydata)
380
- }
381
- }
382
- this.show_data.fields[i].options = array
383
- console.log("选择框数据:" + JSON.stringify(this.show_data.fields[i].options))
384
- }
385
- }
386
-
387
- }
388
- }
389
- },
390
- async getGasMeter1 () {
391
- for (let i = 0; i < this.show_data.fields.length; i++) {
392
- if (
393
- this.show_data.fields[i].label === '气表品牌' ||
394
- this.show_data.fields[i].label === '气表型号'
395
- ) {
396
-
397
- if (this.$refs.service_show.data.fields[i].label == '气表品牌' && this.$refs.service_show.data.fields[i].value.length != 0) {
398
- let http2 = new HttpResetClass()
399
- 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})
400
- // console.log("气表型号查询数据:" + JSON.stringify(res2.data))
401
- for (let j = 0; j < this.show_data.fields.length; j++) {
402
- if (this.$refs.service_show.data.fields[j].label == '气表型号') {
403
- let data = []
404
- let data2 = []
405
- let array = []
406
- data = res2.data.map(item => {
407
- return item.f_meter_style;
408
- })
409
- data2 = res2.data.map(item => {
410
- return item.f_type;
411
- })
412
- for (let q = 0; q < data.length; q++) {
413
- let arraydata = {
414
- 'label': data[q] + data2[q],
415
- 'value': data[q] + data2[q]
416
- }
417
- let then = data[q] + data2[q]
418
- if (array.length != 0) {
419
- for (let w = 0; w < array.length; w++) {
420
- if (array[w].label == then) {
421
- break
422
- }
423
- while (w == array.length - 1) {
424
- array.push(arraydata)
425
- break
426
- }
427
- }
428
- } else {
429
- array.push(arraydata)
430
- }
431
- }
432
- this.$refs.service_show.data.fields[j].options = array
433
- console.log("气表型号选择框数据:" + JSON.stringify(this.$refs.service_show.data.fields[j].options))
434
- }
435
-
436
-
437
-
438
-
439
- }
440
-
441
- }
442
- }
443
- }
444
- },
445
- async getGasPrice () {
446
- for (let i = 0; i < this.show_data.fields.length; i++) {
447
- //气价名称、气价类型
448
- if (
449
- this.show_data.fields[i].label === '气价名称' ||
450
- this.show_data.fields[i].label === '气价类型' ||
451
- this.show_data.fields[i].label === '气价' ||
452
- this.show_data.fields[i].label === '客户类型' ||
453
- this.show_data.fields[i].label === '用气性质'
454
- ) {
455
- let http = new HttpResetClass()
456
- let condition = "f_filialeid = '" + this.$login.f.orgid + "'"
457
- let res = await http.load('POST','rs/sql/applysingleTable',{data:{tablename:'t_stairprice',condition:condition}}, {resolveMsg: null, rejectMsg: null})
458
- for (let i = 0; i < this.show_data.fields.length; i++) {
459
- if (this.show_data.fields[i].label == '气价名称') {
460
- let data = []
461
- let array = []
462
- data = res.data.map(item => {
463
- return item.f_price_name;
464
- })
465
- for (let q = 0; q < data.length; q++) {
466
- let arraydata = {
467
- 'label': data[q],
468
- 'value': data[q]
469
- }
470
- if (array.length != 0) {
471
- for (let w = 0; w < array.length; w++) {
472
- if (array[w].label == data[q]) {
473
- break
474
- }
475
- while (w == array.length - 1) {
476
- array.push(arraydata)
477
- break
478
- }
479
- }
480
- } else {
481
- array.push(arraydata)
482
- }
483
- }
484
- this.show_data.fields[i].options = array
485
- console.log("选择框数据:" + JSON.stringify(this.show_data.fields[i].options))
486
- console.log("有没有数据长度:" + this.show_data.fields[i].value.length)
487
- }
488
-
489
- if (this.show_data.fields[i].label == '气价名称' && this.show_data.fields[i].value.length != 0) {
490
- let http2 = new HttpResetClass()
491
- let condition2 = "s.f_filialeid = '" + this.$login.f.orgid + "'" + " and s.f_price_name = '" + this.show_data.fields[i].value + "'"
492
- let res2 = await http2.load('POST','rs/sql/searchGasPrice',{data:{condition:condition2}}, {resolveMsg: null, rejectMsg: null})
493
- console.log("气价数据:" + JSON.stringify(res2.data))
494
- for (let j = 0; j < this.show_data.fields.length; j++) {
495
- if (this.show_data.fields[j].label == '气价类型') {
496
- console.log("气价类型:" + res2.data[0])
497
- console.log("气价类型1:" + res2.data[0].f_price_type)
498
- this.show_data.fields[j].value = res2.data[0].f_price_type
499
- this.show_data.f_price_type = this.show_data.fields[j].value
500
- console.log("气价类型2:" + this.show_data.fields[j].value)
501
- }
502
- //气价拼接
503
- if (this.show_data.fields[j].label == '气价') {
504
- if(this.show_data.f_price_type == '阶梯气价'){
505
- let p = 1
506
- let resultPrice = ''
507
- for(let l = 0; l < res2.data.length; l++){
508
- resultPrice = resultPrice + res2.data[l].price + ' |'
509
- if (p == 3) {
510
- break
511
- }
512
- p++
513
- }
514
- console.log("拼接的价格:" + resultPrice)
515
- this.show_data.fields[j].value = resultPrice
516
- }else {
517
- this.show_data.fields[j].value = res2.data[0].price
518
- }
519
- }
520
- if (this.show_data.fields[j].label == '用气性质') {
521
- this.show_data.fields[j].value = res2.data[0].f_gasproperties
522
- }
523
- if (this.show_data.fields[j].label == '客户类型') {
524
- this.show_data.fields[j].value = res2.data[0].f_user_type
525
- }
526
- }
527
-
528
-
529
- }
530
-
531
- }
532
-
533
-
534
-
535
- }
536
- }
537
- },
538
- getTotalCost(){
539
- if (this.selectdata.defname === '结算') {
540
- for (let i = 0; i < this.show_data.fields.length; i++) {
541
- if (this.show_data.fields[i].label === '低压工程款') {
542
- this.show_data.f_project_money_down = Number(this.show_data.fields[i].value)
543
- console.log("测试1", this.show_data.f_project_money_down)
544
- } else if (this.show_data.fields[i].label === '中压工程款') {
545
- this.show_data.f_project_money_up = Number(this.show_data.fields[i].value)
546
- console.log("测试2", this.show_data.f_project_money_up)
547
- } else if (this.show_data.fields[i].label === '低压材料款') {
548
- this.show_data.f_material_money_down = Number(this.show_data.fields[i].value)
549
- console.log("测试3", this.show_data.f_material_money_down)
550
- } else if (this.show_data.fields[i].label === '中压材料款') {
551
- this.show_data.f_material_money_up = Number(this.show_data.fields[i].value)
552
- console.log("测试4", this.show_data.f_material_money_up)
553
- } else if (this.show_data.fields[i].label === '支付结算') {
554
- console.log("测试5", this.show_data.f_payment_settlement)
555
- if ((this.show_data.f_project_money_down + this.show_data.f_project_money_up) > 0) {
556
- this.show_data.fields[i].value = this.show_data.f_project_money_down + this.show_data.f_project_money_up
557
- }
558
- this.show_data.f_payment_settlement = Number(this.show_data.fields[i].value)
559
- } else if (this.show_data.fields[i].label === '支付材料') {
560
- console.log("测试6", (this.show_data.f_material_money_down + this.show_data.f_material_money_up))
561
- if ((this.show_data.f_material_money_down + this.show_data.f_material_money_up) > 0) {
562
- console.log("测试6", (this.show_data.f_material_money_down + this.show_data.f_material_money_up))
563
- this.show_data.fields[i].value = this.show_data.f_material_money_down + this.show_data.f_material_money_up
564
- }
565
- this.show_data.f_payment_material = Number(this.show_data.fields[i].value)
566
- } else if (this.show_data.fields[i].label === '总成本') {
567
- if ((this.show_data.f_payment_material + this.show_data.f_payment_settlement) > 0) {
568
- console.log("测试7")
569
- this.show_data.fields[i].value = this.show_data.f_payment_material + this.show_data.f_payment_settlement
570
- }
571
- this.show_data.f_total_cost = this.show_data.fields[i].value
572
- } else if (this.show_data.fields[i].label === '毛利') {
573
- if (this.show_data.f_total_cost > 0) {
574
- console.log("测试8")
575
- let number = parseFloat((this.selectdata.f_contract_money - this.show_data.f_total_cost) / this.selectdata.f_contract_money).toFixed(5)
576
- let realVal = number.substring(0, number.length - 1)
577
- this.show_data.fields[i].value =(realVal * 100).toFixed(2)+"%"
578
- }
579
- }
580
- }
581
- console.log("测试", this.show_data)
582
- }
583
- },
584
- an_kang_yi_hua () {
585
- //===================安康逸华前端特殊逻辑===========================
586
- let swap1 = null // 小区名称转换
587
- let swap2 = null // 户数
588
- let swap3 = null // 单价
589
- let swap4 = null // 报警器户数
590
- let swap5 = null // 报警器单价
591
- let swap6 = null // 其他费用
592
- let swap7 = null // 灶具费
593
- for (let i = 0; i < this.show_data.fields.length; i++) {
594
- // 客户名称 = 小区名称
595
- // 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 === '申请登记') {
596
- // swap1 = this.show_data.fields[i].value
597
- // }
598
- // for (let j = 0; j < this.show_data.fields.length; j++) {
599
- // if (this.show_data.fields[j].label === '客户名称' && this.selectdata.defname === '申请登记' && this.selectdata.f_apply_type === '集中报建') {
600
- // this.show_data.fields[j].value = swap1
601
- // }
602
- // }
603
- // 预算的计算逻辑
604
- // if (this.selectdata.defname === '收费标准制定' || this.selectdata.defname === '收费审核' && this.selectdata.f_apply_type === '散户报建') {
605
- if (this.selectdata.defname === '收费标准制定') {
606
- if (this.show_data.fields[i].label === '户数') {
607
- swap2 = this.show_data.fields[i].value
608
- }
609
- if (this.show_data.fields[i].label === '单价') {
610
- swap3 = this.show_data.fields[i].value
611
- }
612
- if (this.show_data.fields[i].label === '报警器户数') {
613
- swap4 = this.show_data.fields[i].value
614
- }
615
- if (this.show_data.fields[i].label === '报警器单价') {
616
- swap5 = this.show_data.fields[i].value
617
- }
618
- if (this.show_data.fields[i].label === '其他费用') {
619
- swap6 = this.show_data.fields[i].value
620
- }
621
- let sum1 = swap2 * swap3
622
- let sum2 = swap4 * swap5
623
- if (swap6 == null || swap6 == undefined || swap6 == '') {
624
- swap6 = 0
625
- }
626
- if (this.show_data.fields[i].label === '预算') {
627
- console.log("预算计算1:" + sum1 + " 预算计算2:" + sum2 + " 预算计算3:" + swap6)
628
- this.show_data.fields[i].value = parseFloat(sum1) + parseFloat(sum2) + parseFloat(swap6)
629
- }
630
- }
631
- if (this.selectdata.defname === '收费审核' && this.selectdata.f_apply_type === '散户报建') {
632
- if (this.show_data.fields[i].label === '户数') {
633
- swap2 = this.show_data.fields[i].value
634
- }
635
- if (this.show_data.fields[i].label === '单价') {
636
- swap3 = this.show_data.fields[i].value
637
- }
638
- if (this.show_data.fields[i].label === '报警器户数') {
639
- swap4 = this.show_data.fields[i].value
640
- }
641
- if (this.show_data.fields[i].label === '报警器单价') {
642
- swap5 = this.show_data.fields[i].value
643
- }
644
- if (this.show_data.fields[i].label === '其他费用') {
645
- swap6 = this.show_data.fields[i].value
646
- }
647
- if (this.show_data.fields[i].label === '安装费') {
648
- this.show_data.fields[i].value = swap2 * swap3
649
- }
650
- if (this.show_data.fields[i].label === '报警器费') {
651
- this.show_data.fields[i].value = swap4 * swap5
652
- }
653
- if (this.show_data.fields[i].label === '灶具费') {
654
- swap7 = this.show_data.fields[i].value
655
- }
656
- let sum1 = swap2 * swap3
657
- let sum2 = swap4 * swap5
658
- if (swap6 == null || swap6 == undefined || swap6 == '') {
659
- swap6 = 0
660
- }
661
- if (swap7 == null || swap7 == undefined || swap7 == '') {
662
- swap7 = 0
663
- }
664
- if (this.show_data.fields[i].label === '预算') {
665
- console.log("预算计算1:" + sum1 + " 预算计算2:" + sum2 + " 预算计算3:" + swap6)
666
- this.show_data.fields[i].value = parseFloat(sum1) + parseFloat(sum2) + parseFloat(swap6) + parseFloat(swap7)
667
- }
668
-
669
- }
670
- }
671
- },
672
- sure_last() {
673
- if (this.selectdata.defname == '确认尾款') {
674
-
675
- for (let i = 0; i < this.show_data.fields.length; i++) {
676
- // 每个部门只能填写自己的
677
- // console.log("登录的信息:" + JSON.stringify(this.$login.f))
678
- if (this.$login.f.deps == '市场部') {
679
- if (this.show_data.fields[i].label == '财务部确认尾款') {
680
- this.show_data.fields[i].type = 'input'
681
- this.show_data.fields[i].required = false
682
- this.show_data.fields[i].readonly = true
683
- }
684
- }
685
- // 财务部
686
- if (this.$login.f.deps == '财务部') {
687
- if (this.show_data.fields[i].label == '市场部确认尾款') {
688
- this.show_data.fields[i].type = 'input'
689
- this.show_data.fields[i].required = false
690
- this.show_data.fields[i].readonly = true
691
- }
692
- }
693
- }
694
- }
695
- },
696
- // 根据小区名称获取合同编号
697
- async getContractNumber() {
698
- if (this.selectdata.defname == '申请登记') {
699
- console.log("获取合同编号")
700
- for (let i = 0; i < this.show_data.fields.length; i++) {
701
- // console.log("进来了没有2")
702
- // console.log("选择框的名称:" + this.show_data.fields[i].label + "---小区名称的长度:" + this.show_data.fields[i].value.length)
703
- if (this.show_data.fields[i].label == '小区' && this.show_data.fields[i].value.length != 0) {
704
- console.log("进来了没有3")
705
- let http = new HttpResetClass()
706
- // 组织数据
707
- let data = {
708
- tablename: 't_contract_no',
709
- condition: "f_residential_name = '" + this.show_data.fields[i].value + "'"
710
- }
711
- let res = await http.load('POST','rs/sql/applysingleTable',{data: data}, {
712
- resolveMsg: null,
713
- rejectMsg: '查询合同编号失败'
714
- })
715
- for (let j = 0; j < this.show_data.fields.length; j++) {
716
- if (this.show_data.fields[j].label === '合同编号') {
717
- this.show_data.fields[j].value = res.data[0].f_contract_number
718
- }
719
- }
720
-
721
- }
722
- }
723
- }
724
-
725
- },
726
- // 应交金额计算
727
- async moneyDue() {
728
- // 应交金额 = 合同价格
729
- if (this.selectdata.defname === '报建缴费' && this.selectdata.f_apply_type !== '集中报建') {
730
- console.log("进来没有-------")
731
- let result = 0.00
732
- for (let i = 0; i < this.show_data.fields.length; i++) {
733
-
734
- if (this.show_data.fields[i].label === '合同价格') {
735
- // console.log("计算金额1")
736
- result = this.show_data.fields[i].value
737
- }
738
- // console.log("计算金额:" + result)
739
- if (this.show_data.fields[i].label === '应交金额') {
740
- // console.log("计算金额2")
741
- this.show_data.fields[i].value = result
742
- }
743
-
744
- }
745
- }
746
-
747
-
748
- },
749
- // 累计缴费金额和欠费金额
750
- async moneySumArrears() {
751
- if (this.selectdata.defname === '报建缴费') {
752
- // 查询是否有缴费记录
753
- let http = new HttpResetClass()
754
- // 组织数据
755
- let data = {
756
- tablename: 't_charge_record',
757
- condition: "f_process_id = '" + this.selectdata.f_process_id + "' and f_charge_state = '有效'"
758
- }
759
- let res = await http.load('POST','rs/sql/applysingleTable',{data: data}, {
760
- resolveMsg: null,
761
- rejectMsg: '查询收费记录失败'
762
- })
763
- if (res.data.length > 0) {
764
- for (let i = 0; i < this.show_data.fields.length; i++) {
765
- if (this.show_data.fields[i].label === '累计缴费金额') {
766
- this.show_data.fields[i].value
767
- }
768
- if (this.show_data.fields[i].label === '欠费金额') {
769
- this.show_data.fields[i].value
770
- }
771
- }
772
- }else {
773
- let result = 0.00
774
- for (let i = 0; i < this.show_data.fields.length; i++) {
775
- if (this.show_data.fields[i].label === '应交金额') {
776
- result = this.show_data.fields[i].value
777
- }
778
- if (this.show_data.fields[i].label === '累计缴费金额') {
779
- this.show_data.fields[i].value = 0
780
- }
781
- if (this.show_data.fields[i].label === '欠费金额') {
782
- this.show_data.fields[i].value = result
783
- }
784
- }
785
- }
786
-
787
- }
788
- },
789
- // 欠费金额为0时的不显示解决
790
- async arrearsMoney() {
791
- // 应交金额 = 合同价格
792
- if (this.selectdata.defname === '收费审核' || this.selectdata.defname === '报建缴费') {
793
- for (let i = 0; i < this.show_data.fields.length; i++) {
794
-
795
- if (this.show_data.fields[i].label === '欠费金额') {
796
- 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 == '') {
797
- this.show_data.fields[i].value = 0
798
- }
799
- }
800
-
801
- }
802
- }
803
-
804
-
805
- },
806
- // 散户改管时气表信息和通气信息非必填
807
- async meterOrPrice() {
808
- // 应交金额 = 合同价格
809
- if (this.selectdata.f_apply_type == '散户报建') {
810
- if (this.selectdata.defname == '施工' && this.selectdata.f_project_type == '改管') {
811
- for (let i = 0; i < this.show_data.fields.length; i++) {
812
-
813
- if (this.show_data.fields[i].label == '表号') {
814
- this.show_data.fields[i].required = false
815
- }
816
- if (this.show_data.fields[i].label == '左右表') {
817
- this.show_data.fields[i].required = false
818
- }
819
- if (this.show_data.fields[i].label == '气表品牌') {
820
- this.show_data.fields[i].required = false
821
- }
822
- if (this.show_data.fields[i].label == '气表型号') {
823
- this.show_data.fields[i].required = false
824
- }
825
-
826
- }
827
- }
828
- if (this.selectdata.defname == '通气' && this.selectdata.f_project_type == '改管') {
829
- for (let i = 0; i < this.show_data.fields.length; i++) {
830
-
831
- if (this.show_data.fields[i].label == '气价名称') {
832
- this.show_data.fields[i].required = false
833
- }
834
- if (this.show_data.fields[i].label == '用气性质') {
835
- this.show_data.fields[i].required = false
836
- }
837
- if (this.show_data.fields[i].label == '气价') {
838
- this.show_data.fields[i].required = false
839
- }
840
- if (this.show_data.fields[i].label == '客户类型') {
841
- this.show_data.fields[i].required = false
842
- }
843
- if (this.show_data.fields[i].label == '气价类型') {
844
- this.show_data.fields[i].required = false
845
- }
846
- if (this.show_data.fields[i].label == '通气人') {
847
- this.show_data.fields[i].required = false
848
- }
849
- if (this.show_data.fields[i].label == '通气时间') {
850
- this.show_data.fields[i].required = false
851
- this.show_data.fields[i].value = ''
852
- }
853
-
854
- }
855
- }
856
- }
857
-
858
-
859
-
860
- },
861
- async stopApply () {
862
- console.log('终止报建!!!!!')
863
-
864
- if (this.show_data.defname === '报建受理') {
865
- this.show_data.f_stop_reason = this.show_data.f_accept_result
866
- }
867
- if (this.show_data.defname === '现场勘察') {
868
- this.show_data.f_stop_reason = this.show_data.f_project_describe
869
- }
870
- if(!this.show_data.f_stop_reason){
871
- this.show_data.f_stop_reason = '终止'
872
- }
873
- let data = {
874
- selectdata: this.show_data,
875
- loginUser: this.$login.f,
876
- model: {f_stop_remarks: this.show_data.f_stop_reason}
877
- }
878
-
879
- let res = await this.$resetpost(
880
- `rs/logic/stopApply`,
881
- {data: data},
882
- {resolveMsg: null, rejectMsg: '终止报建失败!!!'}
883
- )
884
-
885
- this.$dispatch('selfsearch')
886
-
887
- },
888
- // 获取片区
889
- async getPcd () {
890
- let data = {
891
- tablename: 't_pcd',
892
- condition: `f_filialeid = '${this.$login.f.orgid}'`
893
- }
894
- let http = new HttpResetClass()
895
- let res = await http.load(
896
- 'POST',
897
- `rs/sql/applysingleTable`,
898
- {data: data},
899
- {resolveMsg: null, rejectMsg: '片区查询失败!!!'}
900
- )
901
-
902
- let pcd = res.data.map(item => {
903
- return {
904
- label: item.f_pcd,
905
- value: item.f_pcd
906
- }
907
- })
908
- for (const item of this.show_data.fields) {
909
- if (item.label === '片区') {
910
- item.options = pcd
911
- }
912
- }
913
- },
914
- // 获取街道
915
- async getStreet (){
916
- let http = new HttpResetClass()
917
- let condition = "f_filialeid = " + this.$login.f.orgid
918
- let res = await http.load('POST','rs/logic/apply_queryArea',{data:{condition:condition}}, {resolveMsg: null, rejectMsg: null})
919
- let street = res.data.queryStreet.map(item=>{
920
- return {
921
- label: item.f_street,
922
- value: item.f_street
923
- }
924
- })
925
- for (const item of this.show_data.fields) {
926
- if (item.label === '街道') {
927
- item.options = street
928
- }
929
- }
930
- }
931
- },
932
- events: {
933
- async 'updateArea' (index) {
934
- if (this.show_data.fields[index].value === '新小区') {
935
- console.log("测试小区",index)
936
- for (const item of this.show_data.fields) {
937
- if (item.label === '小区') {
938
- item.value = ''
939
- item.hidden = true
940
- }
941
- if (item.label === '小区名称') {
942
- item.value = ''
943
- item.hidden = false
944
- }
945
- }
946
- } else {
947
- for (const item of this.show_data.fields) {
948
- if (item.label === '小区名称') {
949
- item.value = ''
950
- item.hidden = true
951
- }
952
- if (item.label === '小区') {
953
- item.value = ''
954
- item.hidden = false
955
- }
956
- }
957
- }
958
- },
959
- 'confirmBuildFiles'(index){
960
- if (this.show_data.fields[index].value === '否') {
961
- for (const item of this.show_data.buttons){
962
- if (item.button_name === '提交') {
963
- item.disabled = true
964
- }
965
- }
966
- }
967
- },
968
- 'buildArea'(){
969
- if(this.show_data.f_area_type === '新小区'){
970
- // this.getPcd()
971
- this.getStreet()
972
- for (const item of this.show_data.fields) {
973
- if (item.label === '县/区') {
974
- item.required = true
975
- item.hidden = false
976
- }
977
- if (item.label === '街道') {
978
- item.required = true
979
- item.hidden = false
980
- }
981
- if (item.label === '片区') {
982
- item.required = true
983
- item.hidden = false
984
- }
985
- if (item.label === '小区名称') {
986
- item.required = true
987
- item.hidden = false
988
- }
989
- }
990
- }
991
- },
992
- test(i, j){
993
- console.log('删除')
994
- console.log(i + '-----' +j)
995
- },
996
- // 获取view层button事件/
997
- async 'button'(model) {
998
- //before事件
999
- console.log("当前按钮",model.button)
1000
- if (model.button.before) {
1001
- await this[model.button.before]()
1002
- }
1003
- // 点击重置按钮就重置数据
1004
- if (model.button.button_name === '重置') {
1005
- this.refurbish()
1006
- return
1007
- }
1008
-
1009
- // 获取上传附件是否上传过身份证
1010
- // if (this.selectdata.defname == '申请登记' && model.button.button_name === '提交') {
1011
- // // 获取上传附件是否上传过身份证
1012
- //
1013
- // let http = new HttpResetClass()
1014
- // // 组织数据
1015
- // let data = {
1016
- // tablename: 't_files',
1017
- // condition: "f_blobid = '" + this.selectdata.f_process_id + "' and fusetype = '身份证'"
1018
- // }
1019
- // let res = await http.load('POST','rs/sql/applysingleTable',{data: data}, {
1020
- // resolveMsg: null,
1021
- // rejectMsg: '查询附件身份证号失败'
1022
- // })
1023
- // if (!res.data.length > 0) {
1024
- // this.$showMessage("请上传身份证附件")
1025
- // return
1026
- // }
1027
- //
1028
- //
1029
- // }
1030
- // 判断是否都填写
1031
- if (this.selectdata.defname == '确认尾款' && model.button.button_name === '提交') {
1032
-
1033
- for (let i = 0; i < this.show_data.fields.length; i++) {
1034
- // 判断是否都填写
1035
- if (this.show_data.fields[i].label == '市场部确认尾款') {
1036
- 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) {
1037
- this.$showMessage("市场部未确认,请点击保存!")
1038
- return
1039
- }
1040
- }
1041
- if (this.show_data.fields[i].label == '财务部确认尾款') {
1042
- 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) {
1043
- this.$showMessage("财务部未确认,请点击保存!")
1044
- return
1045
- }
1046
- }
1047
- }
1048
- }
1049
- // 给后台存工改接口所需的附件
1050
- if(this.data.defname=='方案确认'){
1051
- let http = new HttpResetClass()
1052
- await http.load('POST', 'rs/sql/singleTable', {
1053
- data: {
1054
- tablename: 't_files',
1055
- condition: " f_blobid='" +this.data.f_process_id + "' order by id desc"
1056
- }
1057
- }, {resolveMsg: null, rejectMsg: "附件获取失败"}, {silent: true})
1058
- .then(async (res1) => {
1059
- if(res1.data.length>0){
1060
- model.url=res1.data[0].f_downloadpath
1061
- }
1062
- })
1063
- }
1064
- // 修改提交数据
1065
- model = Object.assign({}, this.selectdata, model)
1066
- let http = new HttpResetClass()
1067
- let requestData = {
1068
- tables: this.data.tables,
1069
- start_activity: this.$workflow_vue.start_activity,
1070
- model: model,
1071
- loginUser: this.$login.f,
1072
- workflow_xmlfilename: this.$workflow_vue.workflow_xmlfilename
1073
- }
1074
- // 下发,提交,保存,退回通用业务后台处理logic
1075
- let url = 'rs/logic/ApplyProductService'
1076
-
1077
- let res = await http.load('POST', url, {data: requestData}, {resolveMsg: null, rejectMsg: '数据保存失败'})
1078
- if (res.data.code == 200) {
1079
- model = res.data.model
1080
-
1081
- this.showview = false
1082
- // 特殊处理
1083
- this.$dispatch('close')
1084
- this.initializtion()
1085
-
1086
- } else {
1087
- if (res.data.msg) {
1088
- this.$showMessage(res.data.msg)
1089
- }
1090
- }
1091
- },
1092
- // 失去焦点出触发事件
1093
- async 'check'(index) {
1094
- // =====================================安康逸华特殊逻辑===========================================
1095
- this.moneyDue()
1096
- this.moneySumArrears()
1097
- this.getContractNumber()
1098
- this.an_kang_yi_hua()
1099
- this.getGasMeter1()
1100
- this.getGasPrice()
1101
- this.getTotalCost()
1102
-
1103
-
1104
- // 合成地址
1105
- if (
1106
- this.$refs.service_show.data.fields[index].label === '县/区' ||
1107
- this.$refs.service_show.data.fields[index].label === '街道' ||
1108
- this.$refs.service_show.data.fields[index].label === '小区' ||
1109
- this.$refs.service_show.data.fields[index].label === '小区名称' ||
1110
- this.$refs.service_show.data.fields[index].label === '楼号' ||
1111
- this.$refs.service_show.data.fields[index].label === '单元号' ||
1112
- this.$refs.service_show.data.fields[index].label === '楼层' ||
1113
- this.$refs.service_show.data.fields[index].label === '门牌号'
1114
- ) {
1115
- console.log('即将合成地址')
1116
- var address = ''
1117
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1118
- // 控制设置级联
1119
- // 源select所选的值 this.$refs.service_show.data.activitys.fields[index].value
1120
- // xxx xx xxx
1121
- if (this.$refs.service_show.data.fields[i].label === '县/区' && this.$refs.service_show.data.fields[i].value) {
1122
- address += this.$refs.service_show.data.fields[i].value
1123
- }
1124
- if (this.$refs.service_show.data.fields[i].label === '街道' && this.$refs.service_show.data.fields[i].value) {
1125
- address += this.$refs.service_show.data.fields[i].value
1126
- }
1127
- if ((this.$refs.service_show.data.fields[i].label === '小区名称' || this.$refs.service_show.data.fields[i].label === '小区') && this.$refs.service_show.data.fields[i].value) {
1128
- address += this.$refs.service_show.data.fields[i].value
1129
- }
1130
- if (this.$refs.service_show.data.fields[i].label === '楼号' && this.$refs.service_show.data.fields[i].value) {
1131
- address += ' ' + this.$refs.service_show.data.fields[i].value
1132
- }
1133
- if (this.$refs.service_show.data.fields[i].label === '单元号' && this.$refs.service_show.data.fields[i].value) {
1134
- address += '-' + this.$refs.service_show.data.fields[i].value
1135
- }
1136
- if (this.$refs.service_show.data.fields[i].label === '楼层' && this.$refs.service_show.data.fields[i].value) {
1137
- address += '-' + this.$refs.service_show.data.fields[i].value
1138
- }
1139
- if (this.$refs.service_show.data.fields[i].label === '门牌号' && this.$refs.service_show.data.fields[i].value) {
1140
- address += '-' + this.$refs.service_show.data.fields[i].value
1141
- }
1142
- }
1143
- console.log('获取到的address=>' + address)
1144
- // 数据获取完毕时放入地址text
1145
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1146
- if (this.$refs.service_show.data.fields[i].label === '地址') {
1147
- this.$refs.service_show.data.fields[i].value = address
1148
- console.log('修改fields[i].value后的值=>' + this.$refs.service_show.data.fields[i].value)
1149
- }
1150
- }
1151
- }
1152
- // 号码检测
1153
- if (this.$refs.service_show.data.fields[index].label == '电话号码') {
1154
- let phone = this.$refs.service_show.data.fields[index].value
1155
- // 电话号码效验
1156
- if (!(/^1[3456789]\d{9}$/.test(phone))) {
1157
- this.$refs.service_show.data.fields[index].value = ""
1158
- this.$showAlert('电话号码格式不正确,请重新输入。', 'info', 2000)
1159
- }
1160
- }
1161
- //时间提醒
1162
- if (this.$refs.service_show.data.fields[index].label.includes("时间") || this.$refs.service_show.data.fields[index].type === 'datepicker') {
1163
- let setTime = this.$refs.service_show.data.fields[i].value
1164
- let nowTime = new Date().Format("yyyy-MM-dd HH:mm:ss")
1165
- if (nowTime >= setTime) {
1166
- this.$showMessage("请注意,当前节点时间/工期已过期!")
1167
- }
1168
- }
1169
-
1170
- // 派工是,退费否,不提交,不退费
1171
- //派工否,退费是,到退费环节
1172
- //派工是,退费是,到退费环节-》施工
1173
- //派工否,退费否,不提交,不退费
1174
- let paigong= this.$refs.service_show.data.fields[9].value
1175
- let tuifei= this.$refs.service_show.data.fields[10].value
1176
-
1177
- if ( paigong === '否' && tuifei === '是') {
1178
- //禁用提交按钮,启用退费按钮
1179
- //获取id值为1的button,设置disabled为false
1180
- var button = document.getElementById("1"); // 获取id值为1的button元素
1181
- button.disabled = true; // 设置button元素为不可用
1182
- var button2 = document.getElementById("2"); // 获取id值为1的button元素
1183
- button2.disabled = false; // 设置button元素为不可用
1184
- }else if ( paigong === '是' && tuifei === '是') {
1185
- //禁用提交按钮,启用退费按钮,后转到施工环节
1186
- var button = document.getElementById("1"); // 获取id值为1的button元素
1187
- button.disabled = true; // 设置button元素为不可用
1188
- var button2 = document.getElementById("2"); // 获取id值为1的button元素
1189
- button2.disabled = false; // 设置button元素为不可用
1190
- }else if ( paigong === '否' && tuifei === '否') {
1191
- //禁用提交按钮,禁用退费按钮
1192
- var button1 = document.getElementById("1"); // 获取id值为1的button元素
1193
- button1.disabled = true; // 设置button元素为不可用
1194
- var button2 = document.getElementById("2"); // 获取id值为1的button元素
1195
- button2.disabled = true; // 设置button元素为不可用
1196
-
1197
- } else if ( paigong === '是' && tuifei === '否') {
1198
- //启用提交按钮,禁用退费按钮
1199
- var button1 = document.getElementById("1"); // 获取id值为1的button元素
1200
- button1.disabled = false; // 设置button元素为不可用
1201
- var button2 = document.getElementById("2"); //
1202
- button2.disabled = true; // 设置button元素为不可用
1203
-
1204
- }
1205
- },
1206
- // input值发生变·
1207
- async 'oninput'(index) {},
1208
- // 错误事件
1209
- error_check(index) {
1210
- // 时间格式检测
1211
- if (this.$refs.service_show.data.fields[index].type == 'datepicker') {
1212
- 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)$/)
1213
- 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])$/)
1214
- 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) {
1215
- this.$refs.service_show.data.fields[index].error.flag = false
1216
- } else if (dateRe.test(this.$refs.service_show.data.fields[index].value) && this.$refs.service_show.data.fields[index].value.trim().length == 10) {
1217
- this.$refs.service_show.data.fields[index].error.flag = false
1218
- } else {
1219
- if (this.$refs.service_show.data.fields[index].fullsize) {
1220
- this.$refs.service_show.data.fields[index].error = Object.assign({}, this.$refs.service_show.data.fields[index].error)
1221
- 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'
1222
- this.$showAlert(this.$refs.service_show.data.fields[index].label + '格式错误' + this.$refs.service_show.data.fields[index].error.msg, 'warning', 3000)
1223
- this.$refs.service_show.data.fields[index].error.flag = true
1224
- this.$refs.service_show.data.fields[index].value = ''
1225
- } else {
1226
- this.$refs.service_show.data.fields[index].error = Object.assign({}, this.$refs.service_show.data.fields[index].error)
1227
- 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'
1228
- this.$showAlert(this.$refs.service_show.data.fields[index].label + '格式错误' + this.$refs.service_show.data.fields[index].error.msg, 'warning', 3000)
1229
- this.$refs.service_show.data.fields[index].error.flag = true
1230
- this.$refs.service_show.data.fields[index].value = ''
1231
- }
1232
-
1233
- }
1234
- }
1235
- },
1236
- // onetomany模态框默认监听监听事件
1237
- async 'onetomanydelete'(i, j) {
1238
- console.log('默认删除')
1239
- let http = new HttpResetClass()
1240
- let data = {
1241
- table: this.show_data.onetomany[i].tables[0],
1242
- row: this.show_data.onetomany[i].rows[j]
1243
- }
1244
- let res = await http.load('POST', 'rs/logic/onetomanyDefaultDeleteEvent', {data: data}, {
1245
- resolveMsg: null,
1246
- rejectMsg: '删除失败'
1247
- })
1248
-
1249
- if (res.data <= 0){
1250
- this.$showMessage('删除失败')
1251
- return
1252
- }
1253
-
1254
- this.$dispatch('selfsearch')
1255
- this.$refs.service_show.data.onetomany[i].rows.splice(j, 1)
1256
- },
1257
- async 'onetomanyadd'(inedx) {
1258
- let data = {
1259
- f_process_id : this.show_data.f_process_id
1260
- }
1261
- this.show_data.onetomany[inedx].fields.forEach(item => {
1262
- data[item.field] = item.value
1263
- })
1264
- let res = await this.$resetpost(
1265
- `rs/entity/${this.show_data.onetomany[inedx].tables[0]}`,
1266
- data
1267
- )
1268
-
1269
- console.log('res.data.id')
1270
- console.log(res.data.id)
1271
- data.id = res.data.id
1272
- this.$dispatch('selfsearch')
1273
- this.$refs.service_show.data.onetomany[inedx].rows.push(data)
1274
- },
1275
- async 'onetomanyupdate'(i, j) {
1276
- let onetomany = this.show_data.onetomany[i]
1277
- let data = onetomany.rows[j]
1278
-
1279
- onetomany.fields.forEach(item => {
1280
- data[item.field] = item.value
1281
- })
1282
- let res = await this.$resetpost(
1283
- `rs/entity/${this.show_data.onetomany[i].tables[0]}`,
1284
- data
1285
- )
1286
- this.$dispatch('selfsearch')
1287
- this.$refs.service_show.data.onetomany[i].rows.splice(j,1,data)
1288
- },
1289
- // onetomany模态框监听事件
1290
- async 'check_modal'(index) {},
1291
- async 'oninput_modal'(index) {}
1292
- }
1293
- }
1294
- </script>
1295
- <style scoped>
1296
- /*清除model中的浮动*/
1297
- .clearfix:after,.clearfix:before{
1298
- display: table;
1299
- }
1300
- .clearfix:after{
1301
- clear: both;
1302
- }
1303
- </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
+
85
+ if (this.show_data && this.show_data.f_process_id == this.data.f_process_id
86
+ && this.show_data.defname==this.selectdata.defname){
87
+ this.data = Object.assign({}, this.data, this.selectdata,this.show_data)
88
+ }
89
+ // 如果selectdata有这些key,则把selectdata的value赋值给data的value
90
+ this.data.fields.forEach(item => {
91
+ if (this.selectdata[item.field]) {
92
+ if (String(this.selectdata[item.field]).startsWith("{")) {
93
+ item.value = JSON.parse(this.selectdata[item.field])
94
+ this.selectdata[item.field] = JSON.parse(this.selectdata[item.field])
95
+ } else {
96
+ item.value = this.selectdata[item.field]
97
+ }
98
+ }
99
+ })
100
+
101
+ // 如果配置类型为select,优先从参数列表获取options
102
+ this.data.fields.forEach(item => {
103
+ if (item.type === 'select') {
104
+ let temp = Vue.$appdata.getParam(item.label)
105
+ if (temp && temp.length > 0 && item.label) {
106
+ item.options = Vue.$appdata.getParam(item.label)
107
+ }
108
+ }
109
+ })
110
+ // 初始化 fields
111
+ this.data.fields.forEach(item => {
112
+ // 可对数据进行特殊处理
113
+ if (item.label === '整改条件') {
114
+ item.value = '测试'
115
+ }
116
+ })
117
+
118
+ // 初始化 buttons_fields
119
+ for (let i = 0; i < this.data.buttons.length; i++) {
120
+ if (this.data.buttons[i].button_name === '下发') {
121
+ if (this.data.buttons[i].button_fields && this.data.buttons[i].button_fields.length === 1) {
122
+ if (this.data.buttons[i].source){
123
+ let http = new HttpResetClass()
124
+ let res = await http.load('POST', 'rs/search', {
125
+ source: this.data.buttons[i].source,
126
+ userid: this.$login.f.id
127
+ }, {resolveMsg: null, rejectMsg: null})
128
+
129
+ let options = []
130
+ for (let i = 0; i < res.data.length; i++) {
131
+ options.push(
132
+ {
133
+ "label": res.data[i].name,
134
+ "value": res.data[i].id
135
+ // {
136
+ // 'id': res.data[i].id,
137
+ // 'name': res.data[i].name
138
+ // }
139
+ }
140
+ )
141
+ }
142
+ this.data.buttons[i].button_fields[0]['options'] = options
143
+ } else {
144
+ this.$showMessage("请配置获取人员表达式")
145
+ }
146
+ } else {
147
+ this.$showMessage("下发按钮必须满足 当且仅当一个字段")
148
+ }
149
+ }
150
+ if (this.data.buttons[i].button_fields) {
151
+ this.data.buttons[i].button_fields.forEach(x => {
152
+ // 如果配置类型为select,优先从参数列表获取options
153
+ if (x.type === 'select' && this.$appdata.getParam(x.label)) {
154
+ x.options = this.$appdata.getParam(x.label).trim()
155
+ }
156
+ })
157
+ }
158
+ }
159
+
160
+ // onetomany 数据获取
161
+ if (this.data.onetomany) {
162
+ for (let index = 0; index < this.data.onetomany.length; index++) {
163
+ let http = new HttpResetClass()
164
+ let data = {
165
+ tablename: this.data.onetomany[index].tables[0],
166
+ condition: `f_process_id='${this.selectdata.f_process_id}'`
167
+ }
168
+
169
+ let res = await http.load('POST', 'rs/sql/singleTable', {data: data}, {
170
+ resolveMsg: null,
171
+ rejectMsg: 'onetomany查询失败'
172
+ })
173
+
174
+ // 初始化 onetomany
175
+ this.data.onetomany[index].rows = res.data
176
+
177
+ // 初始化onetomany中的fields
178
+ for (let j = 0; j < this.data.onetomany[index].fields.length; j++) {
179
+ // 如果配置类型为select,优先从参数列表获取options
180
+ if (this.data.onetomany[index].fields[j].type === 'select') {
181
+ let temp = Vue.$appdata.getParam(this.data.onetomany[index].fields[j].label)
182
+ if (temp && temp.length > 0) {
183
+ this.data.onetomany[index].fields[j].options = Vue.$appdata.getParam(this.data.onetomany[index].fields[j].label)
184
+ }
185
+ }
186
+ }
187
+
188
+ }
189
+ }
190
+
191
+ // 消除双向绑定,避免子组件(显示层)数据更改,父组件(控制层)也更改
192
+ let temp = JSON.parse(JSON.stringify(this.data))
193
+ debugger
194
+ this.show_data = temp
195
+ this.$nextTick(() => {
196
+ this.showview = true
197
+ })
198
+
199
+ // ===================安康逸华前端需求逻辑===========================
200
+ this.getArea()
201
+ this.setArea()
202
+ this.getGasMeter()
203
+ this.getGasPrice()
204
+ this.sure_last()
205
+ this.arrearsMoney()
206
+ this.meterOrPrice()
207
+ if (this.selectdata.f_apply_type !== '散户报建') {
208
+ this.moneyDue()
209
+ this.moneySumArrears()
210
+ }
211
+ let istrue=this.data.f_is_true;
212
+ let isrefund=this.data.f_is_refund;
213
+ if(istrue==="是"||isrefund==="是"){
214
+ this.show_data.buttons[2].hidden = true
215
+ }
216
+
217
+ },
218
+ // 金额转大写
219
+ smalltoBIG(n) {
220
+ let fraction = ['角', '分'];
221
+ let digit = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖'];
222
+ let unit = [['元', '万', '亿'], ['', '拾', '佰', '仟']];
223
+ let head = n < 0 ? '欠' : '';
224
+ n = Math.abs(n);
225
+
226
+ let s = '';
227
+
228
+ for (var i = 0; i < fraction.length; i++) {
229
+ s += (digit[Math.floor(n * 10 * Math.pow(10, i)) % 10] + fraction[i]).replace(/零./, '');
230
+ }
231
+ s = s || '整';
232
+ n = Math.floor(n);
233
+
234
+ for (var i = 0; i < unit[0].length && n > 0; i++) {
235
+ let p = '';
236
+ for (var j = 0; j < unit[1].length && n > 0; j++) {
237
+ p = digit[n % 10] + unit[1][j] + p;
238
+ n = Math.floor(n / 10);
239
+ }
240
+ s = p.replace(/(零.)*零$/, '').replace(/^$/, '零') + unit[0][i] + s;
241
+ }
242
+ return head + s.replace(/(零.)*零元/, '元').replace(/(零.)+/g, '零').replace(/^整$/, '零元整')
243
+ },
244
+ async setArea () {
245
+ if (this.selectdata.defname === '申请登记') {
246
+ for (let i = 0; i < this.show_data.fields.length; i++) {
247
+ if (this.show_data.fields[i].label == '县/区') {
248
+ this.show_data.fields[i].value = '陕西省安康市'
249
+ }
250
+ }
251
+ }
252
+ },
253
+ async getArea () {
254
+ if (this.selectdata.defname === '申请登记') {
255
+ let http = new HttpResetClass()
256
+ let condition = "f_filialeid = " + this.$login.f.orgid
257
+ let res = await http.load('POST','rs/logic/apply_queryArea',{data:{condition:condition}}, {resolveMsg: null, rejectMsg: null})
258
+ for (let i = 0; i < this.show_data.fields.length; i++) {
259
+ // if (this.show_data.fields[i].label == '县/区') {
260
+ // let data = []
261
+ // let array = []
262
+ // data = res.data.map(item => {
263
+ // return item.f_pcd;
264
+ // })
265
+ // for (let q = 0; q < data.length; q++) {
266
+ // let arraydata = {
267
+ // 'label': data[q],
268
+ // 'value': data[q]
269
+ // }
270
+ // if (array.length != 0) {
271
+ // for (let w = 0; w < array.length; w++) {
272
+ // if (array[w].label == data[q]) {
273
+ // break
274
+ // }
275
+ // while (w == array.length - 1) {
276
+ // array.push(arraydata)
277
+ // break
278
+ // }
279
+ // }
280
+ // } else {
281
+ // array.push(arraydata)
282
+ // }
283
+ // }
284
+ // this.show_data.fields[i].options = array
285
+ // console.log("县/区选择框数据:" + JSON.stringify(this.show_data.fields[i].options))
286
+ // }
287
+ if (this.show_data.fields[i].label == '街道') {
288
+ let data = []
289
+ let array = []
290
+ data = res.data.queryStreet.map(item => {
291
+ return item.f_street;
292
+ })
293
+ for (let q = 0; q < data.length; q++) {
294
+ let arraydata = {
295
+ 'label': data[q],
296
+ 'value': data[q]
297
+ }
298
+ if (array.length != 0) {
299
+ for (let w = 0; w < array.length; w++) {
300
+ if (array[w].label == data[q]) {
301
+ break
302
+ }
303
+ while (w == array.length - 1) {
304
+ array.push(arraydata)
305
+ break
306
+ }
307
+ }
308
+ } else {
309
+ array.push(arraydata)
310
+ }
311
+ }
312
+ this.show_data.fields[i].options = array
313
+ console.log("街道选择框数据:" + JSON.stringify(this.show_data.fields[i].options))
314
+ }
315
+ if (this.show_data.fields[i].label == '小区') {
316
+ let data = []
317
+ let array = []
318
+ data = res.data.queryArea.map(item => {
319
+ return item.f_residential_area;
320
+ })
321
+ for (let q = 0; q < data.length; q++) {
322
+ let arraydata = {
323
+ 'label': data[q],
324
+ 'value': data[q]
325
+ }
326
+ if (array.length != 0) {
327
+ for (let w = 0; w < array.length; w++) {
328
+ if (array[w].label == data[q]) {
329
+ break
330
+ }
331
+ while (w == array.length - 1) {
332
+ array.push(arraydata)
333
+ break
334
+ }
335
+ }
336
+ } else {
337
+ array.push(arraydata)
338
+ }
339
+ }
340
+ this.show_data.fields[i].options = array
341
+ console.log("小区选择框数据:" + JSON.stringify(this.show_data.fields[i].options))
342
+ }
343
+ }
344
+ }
345
+ },
346
+ async getGasMeter () {
347
+ for (let i = 0; i < this.show_data.fields.length; i++) {
348
+ if (
349
+ this.show_data.fields[i].label === '气表品牌'
350
+ // ||
351
+ // this.show_data.fields[i].label === '气表型号'
352
+ ) {
353
+ let http = new HttpResetClass()
354
+ let condition = "f_orgid = '" + this.$login.f.orgid + "'"
355
+ let res = await http.load('POST','rs/sql/applysingleTable',{data:{tablename:'t_gasbrand',condition:condition}}, {resolveMsg: null, rejectMsg: null})
356
+ for (let i = 0; i < this.show_data.fields.length; i++) {
357
+ if (this.show_data.fields[i].label == '气表品牌') {
358
+ let data = []
359
+ let array = []
360
+ data = res.data.map(item => {
361
+ return item.f_meter_brand;
362
+ })
363
+ for (let q = 0; q < data.length; q++) {
364
+ let arraydata = {
365
+ 'label': data[q],
366
+ 'value': data[q]
367
+ }
368
+ if (array.length != 0) {
369
+ for (let w = 0; w < array.length; w++) {
370
+ if (array[w].label == data[q]) {
371
+ break
372
+ }
373
+ while (w == array.length - 1) {
374
+ array.push(arraydata)
375
+ break
376
+ }
377
+ }
378
+ } else {
379
+ array.push(arraydata)
380
+ }
381
+ }
382
+ this.show_data.fields[i].options = array
383
+ console.log("选择框数据:" + JSON.stringify(this.show_data.fields[i].options))
384
+ }
385
+ }
386
+
387
+ }
388
+ }
389
+ },
390
+ async getGasMeter1 () {
391
+ for (let i = 0; i < this.show_data.fields.length; i++) {
392
+ if (
393
+ this.show_data.fields[i].label === '气表品牌' ||
394
+ this.show_data.fields[i].label === '气表型号'
395
+ ) {
396
+
397
+ if (this.$refs.service_show.data.fields[i].label == '气表品牌' && this.$refs.service_show.data.fields[i].value.length != 0) {
398
+ let http2 = new HttpResetClass()
399
+ 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})
400
+ // console.log("气表型号查询数据:" + JSON.stringify(res2.data))
401
+ for (let j = 0; j < this.show_data.fields.length; j++) {
402
+ if (this.$refs.service_show.data.fields[j].label == '气表型号') {
403
+ let data = []
404
+ let data2 = []
405
+ let array = []
406
+ data = res2.data.map(item => {
407
+ return item.f_meter_style;
408
+ })
409
+ data2 = res2.data.map(item => {
410
+ return item.f_type;
411
+ })
412
+ for (let q = 0; q < data.length; q++) {
413
+ let arraydata = {
414
+ 'label': data[q] + data2[q],
415
+ 'value': data[q] + data2[q]
416
+ }
417
+ let then = data[q] + data2[q]
418
+ if (array.length != 0) {
419
+ for (let w = 0; w < array.length; w++) {
420
+ if (array[w].label == then) {
421
+ break
422
+ }
423
+ while (w == array.length - 1) {
424
+ array.push(arraydata)
425
+ break
426
+ }
427
+ }
428
+ } else {
429
+ array.push(arraydata)
430
+ }
431
+ }
432
+ this.$refs.service_show.data.fields[j].options = array
433
+ console.log("气表型号选择框数据:" + JSON.stringify(this.$refs.service_show.data.fields[j].options))
434
+ }
435
+
436
+
437
+
438
+
439
+ }
440
+
441
+ }
442
+ }
443
+ }
444
+ },
445
+ async getGasPrice () {
446
+ for (let i = 0; i < this.show_data.fields.length; i++) {
447
+ //气价名称、气价类型
448
+ if (
449
+ this.show_data.fields[i].label === '气价名称' ||
450
+ this.show_data.fields[i].label === '气价类型' ||
451
+ this.show_data.fields[i].label === '气价' ||
452
+ this.show_data.fields[i].label === '客户类型' ||
453
+ this.show_data.fields[i].label === '用气性质'
454
+ ) {
455
+ let http = new HttpResetClass()
456
+ let condition = "f_filialeid = '" + this.$login.f.orgid + "'"
457
+ let res = await http.load('POST','rs/sql/applysingleTable',{data:{tablename:'t_stairprice',condition:condition}}, {resolveMsg: null, rejectMsg: null})
458
+ for (let i = 0; i < this.show_data.fields.length; i++) {
459
+ if (this.show_data.fields[i].label == '气价名称') {
460
+ let data = []
461
+ let array = []
462
+ data = res.data.map(item => {
463
+ return item.f_price_name;
464
+ })
465
+ for (let q = 0; q < data.length; q++) {
466
+ let arraydata = {
467
+ 'label': data[q],
468
+ 'value': data[q]
469
+ }
470
+ if (array.length != 0) {
471
+ for (let w = 0; w < array.length; w++) {
472
+ if (array[w].label == data[q]) {
473
+ break
474
+ }
475
+ while (w == array.length - 1) {
476
+ array.push(arraydata)
477
+ break
478
+ }
479
+ }
480
+ } else {
481
+ array.push(arraydata)
482
+ }
483
+ }
484
+ this.show_data.fields[i].options = array
485
+ console.log("选择框数据:" + JSON.stringify(this.show_data.fields[i].options))
486
+ console.log("有没有数据长度:" + this.show_data.fields[i].value.length)
487
+ }
488
+
489
+ if (this.show_data.fields[i].label == '气价名称' && this.show_data.fields[i].value.length != 0) {
490
+ let http2 = new HttpResetClass()
491
+ let condition2 = "s.f_filialeid = '" + this.$login.f.orgid + "'" + " and s.f_price_name = '" + this.show_data.fields[i].value + "'"
492
+ let res2 = await http2.load('POST','rs/sql/searchGasPrice',{data:{condition:condition2}}, {resolveMsg: null, rejectMsg: null})
493
+ console.log("气价数据:" + JSON.stringify(res2.data))
494
+ for (let j = 0; j < this.show_data.fields.length; j++) {
495
+ if (this.show_data.fields[j].label == '气价类型') {
496
+ console.log("气价类型:" + res2.data[0])
497
+ console.log("气价类型1:" + res2.data[0].f_price_type)
498
+ this.show_data.fields[j].value = res2.data[0].f_price_type
499
+ this.show_data.f_price_type = this.show_data.fields[j].value
500
+ console.log("气价类型2:" + this.show_data.fields[j].value)
501
+ }
502
+ //气价拼接
503
+ if (this.show_data.fields[j].label == '气价') {
504
+ if(this.show_data.f_price_type == '阶梯气价'){
505
+ let p = 1
506
+ let resultPrice = ''
507
+ for(let l = 0; l < res2.data.length; l++){
508
+ resultPrice = resultPrice + res2.data[l].price + ' |'
509
+ if (p == 3) {
510
+ break
511
+ }
512
+ p++
513
+ }
514
+ console.log("拼接的价格:" + resultPrice)
515
+ this.show_data.fields[j].value = resultPrice
516
+ }else {
517
+ this.show_data.fields[j].value = res2.data[0].price
518
+ }
519
+ }
520
+ if (this.show_data.fields[j].label == '用气性质') {
521
+ this.show_data.fields[j].value = res2.data[0].f_gasproperties
522
+ }
523
+ if (this.show_data.fields[j].label == '客户类型') {
524
+ this.show_data.fields[j].value = res2.data[0].f_user_type
525
+ }
526
+ }
527
+
528
+
529
+ }
530
+
531
+ }
532
+
533
+
534
+
535
+ }
536
+ }
537
+ },
538
+ getTotalCost(){
539
+ if (this.selectdata.defname === '结算') {
540
+ for (let i = 0; i < this.show_data.fields.length; i++) {
541
+ if (this.show_data.fields[i].label === '低压工程款') {
542
+ this.show_data.f_project_money_down = Number(this.show_data.fields[i].value)
543
+ console.log("测试1", this.show_data.f_project_money_down)
544
+ } else if (this.show_data.fields[i].label === '中压工程款') {
545
+ this.show_data.f_project_money_up = Number(this.show_data.fields[i].value)
546
+ console.log("测试2", this.show_data.f_project_money_up)
547
+ } else if (this.show_data.fields[i].label === '低压材料款') {
548
+ this.show_data.f_material_money_down = Number(this.show_data.fields[i].value)
549
+ console.log("测试3", this.show_data.f_material_money_down)
550
+ } else if (this.show_data.fields[i].label === '中压材料款') {
551
+ this.show_data.f_material_money_up = Number(this.show_data.fields[i].value)
552
+ console.log("测试4", this.show_data.f_material_money_up)
553
+ } else if (this.show_data.fields[i].label === '支付结算') {
554
+ console.log("测试5", this.show_data.f_payment_settlement)
555
+ if ((this.show_data.f_project_money_down + this.show_data.f_project_money_up) > 0) {
556
+ this.show_data.fields[i].value = this.show_data.f_project_money_down + this.show_data.f_project_money_up
557
+ }
558
+ this.show_data.f_payment_settlement = Number(this.show_data.fields[i].value)
559
+ } else if (this.show_data.fields[i].label === '支付材料') {
560
+ console.log("测试6", (this.show_data.f_material_money_down + this.show_data.f_material_money_up))
561
+ if ((this.show_data.f_material_money_down + this.show_data.f_material_money_up) > 0) {
562
+ console.log("测试6", (this.show_data.f_material_money_down + this.show_data.f_material_money_up))
563
+ this.show_data.fields[i].value = this.show_data.f_material_money_down + this.show_data.f_material_money_up
564
+ }
565
+ this.show_data.f_payment_material = Number(this.show_data.fields[i].value)
566
+ } else if (this.show_data.fields[i].label === '总成本') {
567
+ if ((this.show_data.f_payment_material + this.show_data.f_payment_settlement) > 0) {
568
+ console.log("测试7")
569
+ this.show_data.fields[i].value = this.show_data.f_payment_material + this.show_data.f_payment_settlement
570
+ }
571
+ this.show_data.f_total_cost = this.show_data.fields[i].value
572
+ } else if (this.show_data.fields[i].label === '毛利') {
573
+ if (this.show_data.f_total_cost > 0) {
574
+ console.log("测试8")
575
+ let number = parseFloat((this.selectdata.f_contract_money - this.show_data.f_total_cost) / this.selectdata.f_contract_money).toFixed(5)
576
+ let realVal = number.substring(0, number.length - 1)
577
+ this.show_data.fields[i].value =(realVal * 100).toFixed(2)+"%"
578
+ }
579
+ }
580
+ }
581
+ console.log("测试", this.show_data)
582
+ }
583
+ },
584
+ an_kang_yi_hua () {
585
+ //===================安康逸华前端特殊逻辑===========================
586
+ let swap1 = null // 小区名称转换
587
+ let swap2 = null // 户数
588
+ let swap3 = null // 单价
589
+ let swap4 = null // 报警器户数
590
+ let swap5 = null // 报警器单价
591
+ let swap6 = null // 其他费用
592
+ let swap7 = null // 灶具费
593
+ for (let i = 0; i < this.show_data.fields.length; i++) {
594
+ // 客户名称 = 小区名称
595
+ // 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 === '申请登记') {
596
+ // swap1 = this.show_data.fields[i].value
597
+ // }
598
+ // for (let j = 0; j < this.show_data.fields.length; j++) {
599
+ // if (this.show_data.fields[j].label === '客户名称' && this.selectdata.defname === '申请登记' && this.selectdata.f_apply_type === '集中报建') {
600
+ // this.show_data.fields[j].value = swap1
601
+ // }
602
+ // }
603
+ // 预算的计算逻辑
604
+ // if (this.selectdata.defname === '收费标准制定' || this.selectdata.defname === '收费审核' && this.selectdata.f_apply_type === '散户报建') {
605
+ if (this.selectdata.defname === '收费标准制定') {
606
+ if (this.show_data.fields[i].label === '户数') {
607
+ swap2 = this.show_data.fields[i].value
608
+ }
609
+ if (this.show_data.fields[i].label === '单价') {
610
+ swap3 = this.show_data.fields[i].value
611
+ }
612
+ if (this.show_data.fields[i].label === '报警器户数') {
613
+ swap4 = this.show_data.fields[i].value
614
+ }
615
+ if (this.show_data.fields[i].label === '报警器单价') {
616
+ swap5 = this.show_data.fields[i].value
617
+ }
618
+ if (this.show_data.fields[i].label === '其他费用') {
619
+ swap6 = this.show_data.fields[i].value
620
+ }
621
+ let sum1 = swap2 * swap3
622
+ let sum2 = swap4 * swap5
623
+ if (swap6 == null || swap6 == undefined || swap6 == '') {
624
+ swap6 = 0
625
+ }
626
+ if (this.show_data.fields[i].label === '预算') {
627
+ console.log("预算计算1:" + sum1 + " 预算计算2:" + sum2 + " 预算计算3:" + swap6)
628
+ this.show_data.fields[i].value = parseFloat(sum1) + parseFloat(sum2) + parseFloat(swap6)
629
+ }
630
+ }
631
+ if (this.selectdata.defname === '收费审核' && this.selectdata.f_apply_type === '散户报建') {
632
+ if (this.show_data.fields[i].label === '户数') {
633
+ swap2 = this.show_data.fields[i].value
634
+ }
635
+ if (this.show_data.fields[i].label === '单价') {
636
+ swap3 = this.show_data.fields[i].value
637
+ }
638
+ if (this.show_data.fields[i].label === '报警器户数') {
639
+ swap4 = this.show_data.fields[i].value
640
+ }
641
+ if (this.show_data.fields[i].label === '报警器单价') {
642
+ swap5 = this.show_data.fields[i].value
643
+ }
644
+ if (this.show_data.fields[i].label === '其他费用') {
645
+ swap6 = this.show_data.fields[i].value
646
+ }
647
+ if (this.show_data.fields[i].label === '安装费') {
648
+ this.show_data.fields[i].value = swap2 * swap3
649
+ }
650
+ if (this.show_data.fields[i].label === '报警器费') {
651
+ this.show_data.fields[i].value = swap4 * swap5
652
+ }
653
+ if (this.show_data.fields[i].label === '灶具费') {
654
+ swap7 = this.show_data.fields[i].value
655
+ }
656
+ let sum1 = swap2 * swap3
657
+ let sum2 = swap4 * swap5
658
+ if (swap6 == null || swap6 == undefined || swap6 == '') {
659
+ swap6 = 0
660
+ }
661
+ if (swap7 == null || swap7 == undefined || swap7 == '') {
662
+ swap7 = 0
663
+ }
664
+ if (this.show_data.fields[i].label === '预算') {
665
+ console.log("预算计算1:" + sum1 + " 预算计算2:" + sum2 + " 预算计算3:" + swap6)
666
+ this.show_data.fields[i].value = parseFloat(sum1) + parseFloat(sum2) + parseFloat(swap6) + parseFloat(swap7)
667
+ }
668
+
669
+ }
670
+ }
671
+ },
672
+ sure_last() {
673
+ if (this.selectdata.defname == '确认尾款') {
674
+
675
+ for (let i = 0; i < this.show_data.fields.length; i++) {
676
+ // 每个部门只能填写自己的
677
+ // console.log("登录的信息:" + JSON.stringify(this.$login.f))
678
+ if (this.$login.f.deps == '市场部') {
679
+ if (this.show_data.fields[i].label == '财务部确认尾款') {
680
+ this.show_data.fields[i].type = 'input'
681
+ this.show_data.fields[i].required = false
682
+ this.show_data.fields[i].readonly = true
683
+ }
684
+ }
685
+ // 财务部
686
+ if (this.$login.f.deps == '财务部') {
687
+ if (this.show_data.fields[i].label == '市场部确认尾款') {
688
+ this.show_data.fields[i].type = 'input'
689
+ this.show_data.fields[i].required = false
690
+ this.show_data.fields[i].readonly = true
691
+ }
692
+ }
693
+ }
694
+ }
695
+ },
696
+ // 根据小区名称获取合同编号
697
+ async getContractNumber() {
698
+ if (this.selectdata.defname == '申请登记') {
699
+ console.log("获取合同编号")
700
+ for (let i = 0; i < this.show_data.fields.length; i++) {
701
+ // console.log("进来了没有2")
702
+ // console.log("选择框的名称:" + this.show_data.fields[i].label + "---小区名称的长度:" + this.show_data.fields[i].value.length)
703
+ if (this.show_data.fields[i].label == '小区' && this.show_data.fields[i].value.length != 0) {
704
+ console.log("进来了没有3")
705
+ let http = new HttpResetClass()
706
+ // 组织数据
707
+ let data = {
708
+ tablename: 't_contract_no',
709
+ condition: "f_residential_name = '" + this.show_data.fields[i].value + "'"
710
+ }
711
+ let res = await http.load('POST','rs/sql/applysingleTable',{data: data}, {
712
+ resolveMsg: null,
713
+ rejectMsg: '查询合同编号失败'
714
+ })
715
+ for (let j = 0; j < this.show_data.fields.length; j++) {
716
+ if (this.show_data.fields[j].label === '合同编号') {
717
+ this.show_data.fields[j].value = res.data[0].f_contract_number
718
+ }
719
+ }
720
+
721
+ }
722
+ }
723
+ }
724
+
725
+ },
726
+ // 应交金额计算
727
+ async moneyDue() {
728
+ // 应交金额 = 合同价格
729
+ if (this.selectdata.defname === '报建缴费' && this.selectdata.f_apply_type !== '集中报建') {
730
+ console.log("进来没有-------")
731
+ let result = 0.00
732
+ for (let i = 0; i < this.show_data.fields.length; i++) {
733
+
734
+ if (this.show_data.fields[i].label === '合同价格') {
735
+ // console.log("计算金额1")
736
+ result = this.show_data.fields[i].value
737
+ }
738
+ // console.log("计算金额:" + result)
739
+ if (this.show_data.fields[i].label === '应交金额') {
740
+ // console.log("计算金额2")
741
+ this.show_data.fields[i].value = result
742
+ }
743
+
744
+ }
745
+ }
746
+
747
+
748
+ },
749
+ // 累计缴费金额和欠费金额
750
+ async moneySumArrears() {
751
+ if (this.selectdata.defname === '报建缴费') {
752
+ // 查询是否有缴费记录
753
+ let http = new HttpResetClass()
754
+ // 组织数据
755
+ let data = {
756
+ tablename: 't_charge_record',
757
+ condition: "f_process_id = '" + this.selectdata.f_process_id + "' and f_charge_state = '有效'"
758
+ }
759
+ let res = await http.load('POST','rs/sql/applysingleTable',{data: data}, {
760
+ resolveMsg: null,
761
+ rejectMsg: '查询收费记录失败'
762
+ })
763
+ if (res.data.length > 0) {
764
+ for (let i = 0; i < this.show_data.fields.length; i++) {
765
+ if (this.show_data.fields[i].label === '累计缴费金额') {
766
+ this.show_data.fields[i].value
767
+ }
768
+ if (this.show_data.fields[i].label === '欠费金额') {
769
+ this.show_data.fields[i].value
770
+ }
771
+ }
772
+ }else {
773
+ let result = 0.00
774
+ for (let i = 0; i < this.show_data.fields.length; i++) {
775
+ if (this.show_data.fields[i].label === '应交金额') {
776
+ result = this.show_data.fields[i].value
777
+ }
778
+ if (this.show_data.fields[i].label === '累计缴费金额') {
779
+ this.show_data.fields[i].value = 0
780
+ }
781
+ if (this.show_data.fields[i].label === '欠费金额') {
782
+ this.show_data.fields[i].value = result
783
+ }
784
+ }
785
+ }
786
+
787
+ }
788
+ },
789
+ // 欠费金额为0时的不显示解决
790
+ async arrearsMoney() {
791
+ // 应交金额 = 合同价格
792
+ if (this.selectdata.defname === '收费审核' || this.selectdata.defname === '报建缴费') {
793
+ for (let i = 0; i < this.show_data.fields.length; i++) {
794
+
795
+ if (this.show_data.fields[i].label === '欠费金额') {
796
+ 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 == '') {
797
+ this.show_data.fields[i].value = 0
798
+ }
799
+ }
800
+
801
+ }
802
+ }
803
+
804
+
805
+ },
806
+ // 散户改管时气表信息和通气信息非必填
807
+ async meterOrPrice() {
808
+ // 应交金额 = 合同价格
809
+ if (this.selectdata.f_apply_type == '散户报建') {
810
+ if (this.selectdata.defname == '施工' && this.selectdata.f_project_type == '改管') {
811
+ for (let i = 0; i < this.show_data.fields.length; i++) {
812
+
813
+ if (this.show_data.fields[i].label == '表号') {
814
+ this.show_data.fields[i].required = false
815
+ }
816
+ if (this.show_data.fields[i].label == '左右表') {
817
+ this.show_data.fields[i].required = false
818
+ }
819
+ if (this.show_data.fields[i].label == '气表品牌') {
820
+ this.show_data.fields[i].required = false
821
+ }
822
+ if (this.show_data.fields[i].label == '气表型号') {
823
+ this.show_data.fields[i].required = false
824
+ }
825
+
826
+ }
827
+ }
828
+ if (this.selectdata.defname == '通气' && this.selectdata.f_project_type == '改管') {
829
+ for (let i = 0; i < this.show_data.fields.length; i++) {
830
+
831
+ if (this.show_data.fields[i].label == '气价名称') {
832
+ this.show_data.fields[i].required = false
833
+ }
834
+ if (this.show_data.fields[i].label == '用气性质') {
835
+ this.show_data.fields[i].required = false
836
+ }
837
+ if (this.show_data.fields[i].label == '气价') {
838
+ this.show_data.fields[i].required = false
839
+ }
840
+ if (this.show_data.fields[i].label == '客户类型') {
841
+ this.show_data.fields[i].required = false
842
+ }
843
+ if (this.show_data.fields[i].label == '气价类型') {
844
+ this.show_data.fields[i].required = false
845
+ }
846
+ if (this.show_data.fields[i].label == '通气人') {
847
+ this.show_data.fields[i].required = false
848
+ }
849
+ if (this.show_data.fields[i].label == '通气时间') {
850
+ this.show_data.fields[i].required = false
851
+ this.show_data.fields[i].value = ''
852
+ }
853
+
854
+ }
855
+ }
856
+ }
857
+
858
+
859
+
860
+ },
861
+ async stopApply () {
862
+ console.log('终止报建!!!!!')
863
+
864
+ if (this.show_data.defname === '报建受理') {
865
+ this.show_data.f_stop_reason = this.show_data.f_accept_result
866
+ }
867
+ if (this.show_data.defname === '现场勘察') {
868
+ this.show_data.f_stop_reason = this.show_data.f_project_describe
869
+ }
870
+ if(!this.show_data.f_stop_reason){
871
+ this.show_data.f_stop_reason = '终止'
872
+ }
873
+ let data = {
874
+ selectdata: this.show_data,
875
+ loginUser: this.$login.f,
876
+ model: {f_stop_remarks: this.show_data.f_stop_reason}
877
+ }
878
+
879
+ let res = await this.$resetpost(
880
+ `rs/logic/stopApply`,
881
+ {data: data},
882
+ {resolveMsg: null, rejectMsg: '终止报建失败!!!'}
883
+ )
884
+
885
+ this.$dispatch('selfsearch')
886
+
887
+ },
888
+ // 获取片区
889
+ async getPcd () {
890
+ let data = {
891
+ tablename: 't_pcd',
892
+ condition: `f_filialeid = '${this.$login.f.orgid}'`
893
+ }
894
+ let http = new HttpResetClass()
895
+ let res = await http.load(
896
+ 'POST',
897
+ `rs/sql/applysingleTable`,
898
+ {data: data},
899
+ {resolveMsg: null, rejectMsg: '片区查询失败!!!'}
900
+ )
901
+
902
+ let pcd = res.data.map(item => {
903
+ return {
904
+ label: item.f_pcd,
905
+ value: item.f_pcd
906
+ }
907
+ })
908
+ for (const item of this.show_data.fields) {
909
+ if (item.label === '片区') {
910
+ item.options = pcd
911
+ }
912
+ }
913
+ },
914
+ // 获取街道
915
+ async getStreet (){
916
+ let http = new HttpResetClass()
917
+ let condition = "f_filialeid = " + this.$login.f.orgid
918
+ let res = await http.load('POST','rs/logic/apply_queryArea',{data:{condition:condition}}, {resolveMsg: null, rejectMsg: null})
919
+ let street = res.data.queryStreet.map(item=>{
920
+ return {
921
+ label: item.f_street,
922
+ value: item.f_street
923
+ }
924
+ })
925
+ for (const item of this.show_data.fields) {
926
+ if (item.label === '街道') {
927
+ item.options = street
928
+ }
929
+ }
930
+ }
931
+ },
932
+ events: {
933
+ async 'updateArea' (index) {
934
+ if (this.show_data.fields[index].value === '新小区') {
935
+ console.log("测试小区",index)
936
+ for (const item of this.show_data.fields) {
937
+ if (item.label === '小区') {
938
+ item.value = ''
939
+ item.hidden = true
940
+ }
941
+ if (item.label === '小区名称') {
942
+ item.value = ''
943
+ item.hidden = false
944
+ }
945
+ }
946
+ } else {
947
+ for (const item of this.show_data.fields) {
948
+ if (item.label === '小区名称') {
949
+ item.value = ''
950
+ item.hidden = true
951
+ }
952
+ if (item.label === '小区') {
953
+ item.value = ''
954
+ item.hidden = false
955
+ }
956
+ }
957
+ }
958
+ },
959
+ 'confirmBuildFiles'(index){
960
+ if (this.show_data.fields[index].value === '否') {
961
+ for (const item of this.show_data.buttons){
962
+ if (item.button_name === '提交') {
963
+ item.disabled = true
964
+ }
965
+ }
966
+ }
967
+ },
968
+ 'buildArea'(){
969
+ if(this.show_data.f_area_type === '新小区'){
970
+ // this.getPcd()
971
+ this.getStreet()
972
+ for (const item of this.show_data.fields) {
973
+ if (item.label === '县/区') {
974
+ item.required = true
975
+ item.hidden = false
976
+ }
977
+ if (item.label === '街道') {
978
+ item.required = true
979
+ item.hidden = false
980
+ }
981
+ if (item.label === '片区') {
982
+ item.required = true
983
+ item.hidden = false
984
+ }
985
+ if (item.label === '小区名称') {
986
+ item.required = true
987
+ item.hidden = false
988
+ }
989
+ }
990
+ }
991
+ },
992
+ test(i, j){
993
+ console.log('删除')
994
+ console.log(i + '-----' +j)
995
+ },
996
+ // 获取view层button事件/
997
+ async 'button'(model) {
998
+ //before事件
999
+ console.log("当前按钮",model.button)
1000
+ if (model.button.before) {
1001
+ await this[model.button.before]()
1002
+ }
1003
+ // 点击重置按钮就重置数据
1004
+ if (model.button.button_name === '重置') {
1005
+ this.refurbish()
1006
+ return
1007
+ }
1008
+
1009
+ // 获取上传附件是否上传过身份证
1010
+ // if (this.selectdata.defname == '申请登记' && model.button.button_name === '提交') {
1011
+ // // 获取上传附件是否上传过身份证
1012
+ //
1013
+ // let http = new HttpResetClass()
1014
+ // // 组织数据
1015
+ // let data = {
1016
+ // tablename: 't_files',
1017
+ // condition: "f_blobid = '" + this.selectdata.f_process_id + "' and fusetype = '身份证'"
1018
+ // }
1019
+ // let res = await http.load('POST','rs/sql/applysingleTable',{data: data}, {
1020
+ // resolveMsg: null,
1021
+ // rejectMsg: '查询附件身份证号失败'
1022
+ // })
1023
+ // if (!res.data.length > 0) {
1024
+ // this.$showMessage("请上传身份证附件")
1025
+ // return
1026
+ // }
1027
+ //
1028
+ //
1029
+ // }
1030
+ // 判断是否都填写
1031
+ if (this.selectdata.defname == '确认尾款' && model.button.button_name === '提交') {
1032
+
1033
+ for (let i = 0; i < this.show_data.fields.length; i++) {
1034
+ // 判断是否都填写
1035
+ if (this.show_data.fields[i].label == '市场部确认尾款') {
1036
+ 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) {
1037
+ this.$showMessage("市场部未确认,请点击保存!")
1038
+ return
1039
+ }
1040
+ }
1041
+ if (this.show_data.fields[i].label == '财务部确认尾款') {
1042
+ 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) {
1043
+ this.$showMessage("财务部未确认,请点击保存!")
1044
+ return
1045
+ }
1046
+ }
1047
+ }
1048
+ }
1049
+ // 给后台存工改接口所需的附件
1050
+ if(this.data.defname=='方案确认'){
1051
+ let http = new HttpResetClass()
1052
+ await http.load('POST', 'rs/sql/singleTable', {
1053
+ data: {
1054
+ tablename: 't_files',
1055
+ condition: " f_blobid='" +this.data.f_process_id + "' order by id desc"
1056
+ }
1057
+ }, {resolveMsg: null, rejectMsg: "附件获取失败"}, {silent: true})
1058
+ .then(async (res1) => {
1059
+ if(res1.data.length>0){
1060
+ model.url=res1.data[0].f_downloadpath
1061
+ }
1062
+ })
1063
+ }
1064
+ // 修改提交数据
1065
+ model = Object.assign({}, this.selectdata, model)
1066
+ let http = new HttpResetClass()
1067
+ let requestData = {
1068
+ tables: this.data.tables,
1069
+ start_activity: this.$workflow_vue.start_activity,
1070
+ model: model,
1071
+ loginUser: this.$login.f,
1072
+ workflow_xmlfilename: this.$workflow_vue.workflow_xmlfilename
1073
+ }
1074
+ // 下发,提交,保存,退回通用业务后台处理logic
1075
+ let url = 'rs/logic/ApplyProductService'
1076
+
1077
+ let res = await http.load('POST', url, {data: requestData}, {resolveMsg: null, rejectMsg: '数据保存失败'})
1078
+ if (res.data.code == 200) {
1079
+ model = res.data.model
1080
+
1081
+ this.showview = false
1082
+ // 特殊处理
1083
+ this.$dispatch('close')
1084
+ this.initializtion()
1085
+
1086
+ } else {
1087
+ if (res.data.msg) {
1088
+ this.$showMessage(res.data.msg)
1089
+ }
1090
+ }
1091
+ },
1092
+ // 失去焦点出触发事件
1093
+ async 'check'(index) {
1094
+ // =====================================安康逸华特殊逻辑===========================================
1095
+ this.moneyDue()
1096
+ this.moneySumArrears()
1097
+ this.getContractNumber()
1098
+ this.an_kang_yi_hua()
1099
+ this.getGasMeter1()
1100
+ this.getGasPrice()
1101
+ this.getTotalCost()
1102
+
1103
+
1104
+ // 合成地址
1105
+ if (
1106
+ this.$refs.service_show.data.fields[index].label === '县/区' ||
1107
+ this.$refs.service_show.data.fields[index].label === '街道' ||
1108
+ this.$refs.service_show.data.fields[index].label === '小区' ||
1109
+ this.$refs.service_show.data.fields[index].label === '小区名称' ||
1110
+ this.$refs.service_show.data.fields[index].label === '楼号' ||
1111
+ this.$refs.service_show.data.fields[index].label === '单元号' ||
1112
+ this.$refs.service_show.data.fields[index].label === '楼层' ||
1113
+ this.$refs.service_show.data.fields[index].label === '门牌号'
1114
+ ) {
1115
+ console.log('即将合成地址')
1116
+ var address = ''
1117
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1118
+ // 控制设置级联
1119
+ // 源select所选的值 this.$refs.service_show.data.activitys.fields[index].value
1120
+ // xxx xx xxx
1121
+ if (this.$refs.service_show.data.fields[i].label === '县/区' && this.$refs.service_show.data.fields[i].value) {
1122
+ address += this.$refs.service_show.data.fields[i].value
1123
+ }
1124
+ if (this.$refs.service_show.data.fields[i].label === '街道' && this.$refs.service_show.data.fields[i].value) {
1125
+ address += this.$refs.service_show.data.fields[i].value
1126
+ }
1127
+ if ((this.$refs.service_show.data.fields[i].label === '小区名称' || this.$refs.service_show.data.fields[i].label === '小区') && this.$refs.service_show.data.fields[i].value) {
1128
+ address += this.$refs.service_show.data.fields[i].value
1129
+ }
1130
+ if (this.$refs.service_show.data.fields[i].label === '楼号' && this.$refs.service_show.data.fields[i].value) {
1131
+ address += ' ' + this.$refs.service_show.data.fields[i].value
1132
+ }
1133
+ if (this.$refs.service_show.data.fields[i].label === '单元号' && this.$refs.service_show.data.fields[i].value) {
1134
+ address += '-' + this.$refs.service_show.data.fields[i].value
1135
+ }
1136
+ if (this.$refs.service_show.data.fields[i].label === '楼层' && this.$refs.service_show.data.fields[i].value) {
1137
+ address += '-' + this.$refs.service_show.data.fields[i].value
1138
+ }
1139
+ if (this.$refs.service_show.data.fields[i].label === '门牌号' && this.$refs.service_show.data.fields[i].value) {
1140
+ address += '-' + this.$refs.service_show.data.fields[i].value
1141
+ }
1142
+ }
1143
+ console.log('获取到的address=>' + address)
1144
+ // 数据获取完毕时放入地址text
1145
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1146
+ if (this.$refs.service_show.data.fields[i].label === '地址') {
1147
+ this.$refs.service_show.data.fields[i].value = address
1148
+ console.log('修改fields[i].value后的值=>' + this.$refs.service_show.data.fields[i].value)
1149
+ }
1150
+ }
1151
+ }
1152
+ // 号码检测
1153
+ if (this.$refs.service_show.data.fields[index].label == '电话号码') {
1154
+ let phone = this.$refs.service_show.data.fields[index].value
1155
+ // 电话号码效验
1156
+ if (!(/^1[3456789]\d{9}$/.test(phone))) {
1157
+ this.$refs.service_show.data.fields[index].value = ""
1158
+ this.$showAlert('电话号码格式不正确,请重新输入。', 'info', 2000)
1159
+ }
1160
+ }
1161
+ //时间提醒
1162
+ if (this.$refs.service_show.data.fields[index].label.includes("时间") || this.$refs.service_show.data.fields[index].type === 'datepicker') {
1163
+ let setTime = this.$refs.service_show.data.fields[i].value
1164
+ let nowTime = new Date().Format("yyyy-MM-dd HH:mm:ss")
1165
+ if (nowTime >= setTime) {
1166
+ this.$showMessage("请注意,当前节点时间/工期已过期!")
1167
+ }
1168
+ }
1169
+
1170
+ // 派工是,退费否,不提交,不退费
1171
+ //派工否,退费是,到退费环节
1172
+ //派工是,退费是,到退费环节-》施工
1173
+ //派工否,退费否,不提交,不退费
1174
+ let paigong= this.$refs.service_show.data.fields[9].value
1175
+ let tuifei= this.$refs.service_show.data.fields[10].value
1176
+
1177
+ if ( paigong === '否' && tuifei === '是') {
1178
+ //禁用提交按钮,启用退费按钮
1179
+ //获取id值为1的button,设置disabled为false
1180
+ var button = document.getElementById("1"); // 获取id值为1的button元素
1181
+ button.disabled = true; // 设置button元素为不可用
1182
+ var button2 = document.getElementById("2"); // 获取id值为1的button元素
1183
+ button2.disabled = false; // 设置button元素为不可用
1184
+ }else if ( paigong === '是' && tuifei === '是') {
1185
+ //禁用提交按钮,启用退费按钮,后转到施工环节
1186
+ var button = document.getElementById("1"); // 获取id值为1的button元素
1187
+ button.disabled = true; // 设置button元素为不可用
1188
+ var button2 = document.getElementById("2"); // 获取id值为1的button元素
1189
+ button2.disabled = false; // 设置button元素为不可用
1190
+ }else if ( paigong === '否' && tuifei === '否') {
1191
+ //禁用提交按钮,禁用退费按钮
1192
+ var button1 = document.getElementById("1"); // 获取id值为1的button元素
1193
+ button1.disabled = true; // 设置button元素为不可用
1194
+ var button2 = document.getElementById("2"); // 获取id值为1的button元素
1195
+ button2.disabled = true; // 设置button元素为不可用
1196
+
1197
+ } else if ( paigong === '是' && tuifei === '否') {
1198
+ //启用提交按钮,禁用退费按钮
1199
+ var button1 = document.getElementById("1"); // 获取id值为1的button元素
1200
+ button1.disabled = false; // 设置button元素为不可用
1201
+ var button2 = document.getElementById("2"); //
1202
+ button2.disabled = true; // 设置button元素为不可用
1203
+
1204
+ }
1205
+ },
1206
+ // input值发生变·
1207
+ async 'oninput'(index) {},
1208
+ // 错误事件
1209
+ error_check(index) {
1210
+ // 时间格式检测
1211
+ if (this.$refs.service_show.data.fields[index].type == 'datepicker') {
1212
+ 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)$/)
1213
+ 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])$/)
1214
+ 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) {
1215
+ this.$refs.service_show.data.fields[index].error.flag = false
1216
+ } else if (dateRe.test(this.$refs.service_show.data.fields[index].value) && this.$refs.service_show.data.fields[index].value.trim().length == 10) {
1217
+ this.$refs.service_show.data.fields[index].error.flag = false
1218
+ } else {
1219
+ if (this.$refs.service_show.data.fields[index].fullsize) {
1220
+ this.$refs.service_show.data.fields[index].error = Object.assign({}, this.$refs.service_show.data.fields[index].error)
1221
+ 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'
1222
+ this.$showAlert(this.$refs.service_show.data.fields[index].label + '格式错误' + this.$refs.service_show.data.fields[index].error.msg, 'warning', 3000)
1223
+ this.$refs.service_show.data.fields[index].error.flag = true
1224
+ this.$refs.service_show.data.fields[index].value = ''
1225
+ } else {
1226
+ this.$refs.service_show.data.fields[index].error = Object.assign({}, this.$refs.service_show.data.fields[index].error)
1227
+ 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'
1228
+ this.$showAlert(this.$refs.service_show.data.fields[index].label + '格式错误' + this.$refs.service_show.data.fields[index].error.msg, 'warning', 3000)
1229
+ this.$refs.service_show.data.fields[index].error.flag = true
1230
+ this.$refs.service_show.data.fields[index].value = ''
1231
+ }
1232
+
1233
+ }
1234
+ }
1235
+ },
1236
+ // onetomany模态框默认监听监听事件
1237
+ async 'onetomanydelete'(i, j) {
1238
+ console.log('默认删除')
1239
+ let http = new HttpResetClass()
1240
+ let data = {
1241
+ table: this.show_data.onetomany[i].tables[0],
1242
+ row: this.show_data.onetomany[i].rows[j]
1243
+ }
1244
+ let res = await http.load('POST', 'rs/logic/onetomanyDefaultDeleteEvent', {data: data}, {
1245
+ resolveMsg: null,
1246
+ rejectMsg: '删除失败'
1247
+ })
1248
+
1249
+ if (res.data <= 0){
1250
+ this.$showMessage('删除失败')
1251
+ return
1252
+ }
1253
+
1254
+ this.$dispatch('selfsearch')
1255
+ this.$refs.service_show.data.onetomany[i].rows.splice(j, 1)
1256
+ },
1257
+ async 'onetomanyadd'(inedx) {
1258
+ let data = {
1259
+ f_process_id : this.show_data.f_process_id
1260
+ }
1261
+ this.show_data.onetomany[inedx].fields.forEach(item => {
1262
+ data[item.field] = item.value
1263
+ })
1264
+ let res = await this.$resetpost(
1265
+ `rs/entity/${this.show_data.onetomany[inedx].tables[0]}`,
1266
+ data
1267
+ )
1268
+
1269
+ console.log('res.data.id')
1270
+ console.log(res.data.id)
1271
+ data.id = res.data.id
1272
+ this.$dispatch('selfsearch')
1273
+ this.$refs.service_show.data.onetomany[inedx].rows.push(data)
1274
+ },
1275
+ async 'onetomanyupdate'(i, j) {
1276
+ let onetomany = this.show_data.onetomany[i]
1277
+ let data = onetomany.rows[j]
1278
+
1279
+ onetomany.fields.forEach(item => {
1280
+ data[item.field] = item.value
1281
+ })
1282
+ let res = await this.$resetpost(
1283
+ `rs/entity/${this.show_data.onetomany[i].tables[0]}`,
1284
+ data
1285
+ )
1286
+ this.$dispatch('selfsearch')
1287
+ this.$refs.service_show.data.onetomany[i].rows.splice(j,1,data)
1288
+ },
1289
+ // onetomany模态框监听事件
1290
+ async 'check_modal'(index) {},
1291
+ async 'oninput_modal'(index) {}
1292
+ }
1293
+ }
1294
+ </script>
1295
+ <style scoped>
1296
+ /*清除model中的浮动*/
1297
+ .clearfix:after,.clearfix:before{
1298
+ display: table;
1299
+ }
1300
+ .clearfix:after{
1301
+ clear: both;
1302
+ }
1303
+ </style>