apply-clients 4.0.67 → 4.0.68

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,2112 +1,2114 @@
1
- <template>
2
- <show-back-reason v-if="selectdata.f_back_reason && selectdata.f_back_reason!=''"
3
- :data="show_data"></show-back-reason>
4
- <!--<gas-stop v-if="selectdata.defname == '停气碰口'"></gas-stop>-->
5
- <material-message v-if="selectdata.defname=='材料导入'||selectdata.defname=='材料审核'" v-ref:material
6
- :selectdata="selectdata"
7
- :edit="true"></material-message>
8
- <batch-item v-if="selectdata.defname=='工商预算审核(技术科科长)'||selectdata.defname=='工商预算审核(分管副总)'||selectdata.defname=='工商预算审核(总经理)'||selectdata.defname=='点火申请'||selectdata.defname=='收费材料费'||
9
- selectdata.defname=='工商现场勘查'||selectdata.defname=='民用现场勘查'||selectdata.defname=='户内安装'||selectdata.defname=='安装审核'||selectdata.defname=='工程验收'||selectdata.defname=='点火'"
10
- v-ref:batch_item
11
- :selectdata="selectdata"
12
- :edit="true"></batch-item>
13
-
14
- <receive-batch v-if="selectdata.defname == '派工单'" :selectdata="selectdata"></receive-batch>
15
- <project-settlement v-if="selectdata.defname == '工程结算'" :selectdata="selectdata"></project-settlement>
16
- <service-view v-ref:service_show :data="show_data" v-if="showview" :is_show_datacheck="datacheck"></service-view>
17
- </template>
18
- <script>
19
- import Vue from 'vue'
20
- import {HttpResetClass} from 'vue-client'
21
- import * as Util from '../../../../Util'
22
- // import AppData from 'stores/AppData'
23
- // Date格式化
24
- Date.prototype.Format = function (fmt) {
25
- var o = {
26
- "M+": this.getMonth() + 1, //月份
27
- "d+": this.getDate(), //日
28
- "H+": this.getHours(), //小时
29
- "m+": this.getMinutes(), //分
30
- "s+": this.getSeconds(), //秒
31
- "q+": Math.floor((this.getMonth() + 3) / 3), //季度
32
- "S": this.getMilliseconds() //毫秒
33
- };
34
- if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
35
- for (var k in o)
36
- if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
37
- return fmt;
38
- }
39
-
40
- export default {
41
- title: '报建流程业务控制层',
42
- props: ['selectdata'],
43
- data() {
44
- return {
45
- data: null, // 数据库数据,json配置文件数据的数据集合
46
- json_datas: null, // Json配置文件集合
47
- showview: false, // 控制显示service-view组件
48
- show_data: null, // 给view层显示的数据
49
- department_search: null, // 当前部门下所有人
50
- contract: null, // 单值表合同编号记录
51
- technologist:[], // 技术人员 角色下的人
52
- price:0,
53
- jiesuansum:0,
54
- yusuansum:0,
55
- numbergongliao:0,
56
- selectMachine:[]//点火选择安装的机器
57
- }
58
- },
59
- methods: {
60
- // 特殊化处理
61
- async special(model) {
62
- if (model.button.button_name === '提交' && model.button.button_event && model.button.button_event === '分支流程异步处理') {
63
- // 分支流程异步处理
64
- let http = new HttpResetClass();
65
- let res = await http.load('POST', 'rs/logic/branchsyncprocess', {
66
- data: {
67
- model: model,
68
- loginUser: this.$login.f
69
- }
70
- }, {resolveMsg: null, rejectMsg: '分支流程异步处理保存失败'})
71
- console.log("分支流程异步处理:", JSON.stringify(res.data))
72
- }
73
- if (this.data.distribute_async && model.button.button_name === '下发') {
74
- // 同流程节点异步处理
75
- let http = new HttpResetClass();
76
- let res = await http.load('POST', 'rs/logic/syncprocess', {
77
- data: {
78
- model: model,
79
- loginUser: this.$login.f
80
- }
81
- }, {resolveMsg: null, rejectMsg: '流程异步下发据保存失败'})
82
- console.log("流程的异步处理:", JSON.stringify(res.data))
83
- }
84
- if (this.data.distribute_async && model.button.button_name === '完成') {
85
- // 强制结束
86
- let http = new HttpResetClass();
87
- let res = await http.load('POST', 'rs/logic/stoprocess', {
88
- data: {
89
- model: model,
90
- loginUser: this.$login.f
91
- }
92
- }, {resolveMsg: null, rejectMsg: '流程异步完成数据保存失败'})
93
- console.log("流程的异步处理:", JSON.stringify(res.data))
94
- }
95
- },
96
- // 组件初始化操作
97
- refurbish(val) {
98
- this.selectdata = val
99
- this.json_datas = this.$workflow_vue
100
- let sum = 0
101
- let jsonData = {}
102
- for (let i = 0; i < this.json_datas.activitys.length; i++) {
103
- if (this.selectdata.defname == this.json_datas.activitys[i].title) {
104
- jsonData = this.json_datas.activitys[i]
105
- sum++
106
- }
107
- }
108
- if(jsonData){
109
- for (let j = 0; j < jsonData.fields.length; j++) {
110
- jsonData.fields[j].value = ''
111
- if (jsonData.fields[j].default) {
112
- // 如果默认值是this.loginUser则,表示是当前登陆人
113
- if(jsonData.fields[j].default == "this.loginUser"){
114
- jsonData.fields[j].value = this.$login.f.name
115
- }else {
116
- jsonData.fields[j].value = jsonData.fields[j].default
117
- }
118
- }
119
- }
120
- }
121
-
122
- if (sum == 1) {
123
- this.data = null
124
- this.data = jsonData
125
- // selectdata 填充 data
126
- this.data = Object.assign({}, this.data, this.selectdata)
127
- this.initializtion()
128
- } else if (sum == 0) {
129
- this.$showMessage(`没有在JSON配置文件中找到活动名为:(${this.selectdata.defname})的节点配置`)
130
- } else {
131
- this.$showMessage(`在JSON配置文件中找到活动名为:(${this.selectdata.defname})的节点配置:${sum}个`)
132
- }
133
- },
134
- // json配置数据处理 比如下拉框的options
135
- async initializtion() {
136
- console.log("进入initializtion")
137
- if(this.show_data&&this.show_data.f_process_id == this.data.f_process_id&&this.show_data.defname==this.selectdata.defname){
138
- this.data = Object.assign({}, this.data, this.selectdata,this.show_data)
139
- }
140
- this.showview = false
141
- console.log('初始化方法中的this.selectdata=>' + JSON.stringify(this.selectdata))
142
- console.log('this.$workflow_vue.start_activitys=>' + JSON.stringify(this.$workflow_vue.start_activitys))
143
- // 下发人 options 处理,options初始化
144
- let searchParam
145
- // if (this.selectdata.actorexpression) {
146
- // console.log('有actorexpression,即将获取下发人员')
147
- // // let http = new HttpResetClass()
148
- // // let res = await http.load('POST', 'rs/search', this.selectdata.actorexpression, {
149
- // // resolveMsg: null,
150
- // // rejectMsg: 'search查询部门下所有人失败'
151
- // // })
152
- // searchParam = this.selectdata.actorexpression
153
- // }else if(this.selectdata.defname && this.$workflow_vue.start_activitys.indexOf(this.selectdata.defname) >= 0){
154
- // 如果没有actorexpression,走此特殊的获取部门人员方法
155
- console.log('当没有actorexpression,走特殊请求获取下发人员')
156
- let http = new HttpResetClass()
157
- let source = ''
158
- for (let i=0; i<this.$workflow_vue.activitys.length; i++){
159
- if(this.$workflow_vue.activitys[i].title == this.selectdata.defname&&this.$workflow_vue.activitys[i].send_express){
160
- console.log('匹配到的流程节点表达式=>' + this.$workflow_vue.activitys[i].send_express)
161
- source = this.$workflow_vue.activitys[i].send_express
162
- }
163
- }
164
- // if(source == ''){
165
- // this.$showMessage('配置文件不存在' + this.selectdata.defname + '流程环节,请联系系统管理员!')
166
- // return
167
- // }
168
- searchParam = `{"source": ${source},"userid":"${this.$login.f.id}"}`
169
- // }else{
170
- // this.$showMessage('不存在角色表达式也不是开始流程节点,如是开始流程节点请检查配置文件,否则请联系系统管理员!')
171
- // return
172
- // }
173
- console.log('即将请求资源服务,请求参数=>'+ searchParam)
174
- if(source){
175
- let http = new HttpResetClass()
176
- let res = await http.load('POST', 'rs/search', searchParam, {
177
- resolveMsg: null,
178
- rejectMsg: 'search查询部门下所有人失败'
179
- })
180
- console.log("search查询部门下所有人:", JSON.stringify(res.data))
181
- let jsonString = JSON.stringify(res.data)
182
- let jsonArray = []
183
- if (jsonString.startsWith("{")) {
184
- jsonArray.push(res.data)
185
- res.data = jsonArray
186
- }
187
- this.department_search = res.data
188
- }
189
-
190
- // onetomany 数据获取
191
- if (this.data.onetomany) {
192
- console.log('判断是onetomany,this.data.onetomany的数据为=>' + JSON.stringify(this.data.onetomany))
193
- for (let index = 0; index < this.data.onetomany.length; index++) {
194
- let http = new HttpResetClass()
195
- let data = {
196
- tablename: this.data.onetomany[index].tables[0],
197
- condition: `f_apply_num = '${this.selectdata.f_apply_num}' and f_process_id='${this.selectdata.f_process_id}'`
198
- }
199
- let res = await http.load('POST', 'rs/sql/singleTable', {data: data}, {
200
- resolveMsg: null,
201
- rejectMsg: 'onetomany查询失败'
202
- })
203
- // 初始化 onetomany
204
- let rows = []
205
- console.log('查询返回结果res.data=>' + JSON.stringify(res.data))
206
- this.data.onetomany[index].rows = res.data
207
- console.log(JSON.stringify('this.data.onetomany[index].rows=>' + JSON.stringify(this.data.onetomany[index].rows)))
208
-
209
- // 初始化onetomany中的fields
210
- for(let j =0;j<this.data.onetomany[index].fields.length;j++){
211
- // 如果配置类型为select,优先从参数列表获取options
212
- if (this.data.onetomany[index].fields[j].type === 'select') {
213
- let temp = Vue.$appdata.getParam(this.data.onetomany[index].fields[j].label)
214
- if (temp && temp.length > 0) {
215
- this.data.onetomany[index].fields[j].options = Vue.$appdata.getParam(this.data.onetomany[index].fields[j].label)
216
- }
217
- }
218
- }
219
-
220
- }
221
- }
222
- let http1 = new HttpResetClass()
223
- let condition = ''
224
- if(this.selectdata.f_gas_type&&(this.selectdata.f_gas_type.includes('民')||this.selectdata.f_gas_type.includes('公福'))){
225
- condition =`f_user_type = '民用' and f_filiale = '${this.$login.f.f_fengongsi}'
226
- and f_gasproperties = '${this.data.f_gas_type}'`
227
- }else{
228
- condition =`f_user_type = '非民用' and f_filiale = '${this.$login.f.f_fengongsi}'
229
- and f_gasproperties = '${this.data.f_gas_type}'`
230
- }
231
- let res1 = await http1.load('POST', 'rs/logic/getRecordItem', {condition}, {resolveMsg: null, rejectMsg: null})
232
-
233
- // 初始化 fields
234
- for (let i = 0; i < this.data.fields.length; i++) {
235
-
236
- if(this.selectdata.f_adjust_box!=null ){
237
- if(this.selectdata.f_adjust_box.includes("b") ||this.selectdata.f_adjust_box.length<6 || this.selectdata.f_adjust_box.includes("a"))
238
- this.selectdata.f_adjust_box="";
239
- }
240
- if(this.selectdata.f_connection_way!=null && this.selectdata.f_connection_way.includes("[")){
241
- this.selectdata.f_connection_way="";
242
- }
243
- if(this.selectdata.f_gasinto!=null && this.selectdata.f_gasinto.includes("[")){
244
- this.selectdata.f_gasinto="";
245
- }
246
- if(this.selectdata.f_is_gas!=null && this.selectdata.f_is_gas.includes("[")){
247
- this.selectdata.f_is_gas="";
248
- }
249
- if(this.selectdata.f_pocket_watch!=null && this.selectdata.f_pocket_watch.includes("[")){
250
- this.selectdata.f_pocket_watch="";
251
- }
252
-
253
-
254
- // 如果selectdata有这些key,则把selectdata的value赋值给data的value
255
- if (this.selectdata[this.data.fields[i].field]) {
256
- // console.log(JSON.stringify(this.selectdata))
257
- this.data.fields[i].value = this.selectdata[this.data.fields[i].field]
258
- }
259
- if (this.data.fields[i].type === 'select') {
260
-
261
- // 如果配置类型为select,优先从参数列表获取options
262
- console.log("appdata值" + Vue.$appdata);
263
- let temp = Vue.$appdata.getParam(this.data.fields[i].label)
264
- if (temp && temp.length > 0) {
265
- this.data.fields[i].options = Vue.$appdata.getParam(this.data.fields[i].label)
266
- }
267
- }
268
- if (this.data.defname === '工商现场勘查'||this.data.defname === '民用现场勘查') {
269
- for (let i = 0; i < this.data.fields.length; i++) {
270
- if (this.data.fields[i].label === '预算') {
271
- this.data.fields[i].value = this.yusuansum
272
-
273
- }
274
-
275
- }
276
-
277
- }
278
- if (this.data.defname === '户内安装') {
279
-
280
- for (let i = 0; i < this.data.fields.length; i++) {
281
- if (this.data.fields[i].label === '结算费用') {
282
- this.data.fields[i].value = this.jiesuansum
283
- }
284
-
285
- if (this.data.fields[i].label === '气价类型') {
286
- if (!this.data.fields[i].value) {
287
- console.log('获取的气价类型,',res1)
288
- let house2 = []
289
- if (res1.data.pricetype) {
290
- for (let row of res1.data.pricetype){
291
- house2.push({label: row.f_price_type,value: row.f_price_type})
292
- }
293
- this.data.fields[i].options = house2
294
- }
295
- }
296
- }
297
- if (this.data.fields[i].label === '燃气表品牌') {
298
- if (!this.data.fields[i].value) {
299
- console.log('获取的气价类型,',res1)
300
- let house2 = []
301
- if (res1.data.meterbrand) {
302
- for (let row of res1.data.meterbrand){
303
- house2.push({label: row.f_meter_brand,value: row.f_meter_brand})
304
- }
305
- this.data.fields[i].options = house2
306
- }
307
- }
308
-
309
- }
310
- //修改: 需求增加一些默认的值
311
- if (this.data.fields[i].label === '燃气表品牌') {
312
- this.data.fields[i].value="威星"
313
- }
314
- if (this.data.fields[i].label === '燃气表型号') {
315
- this.data.fields[i].value="G2.5"
316
- }
317
- if (this.data.fields[i].label === '表底数') {
318
- this.data.fields[i].value="0"
319
- }
320
- if (this.data.fields[i].label === '用户确认' && this.selectdata.f_user_name!="") {
321
- this.data.fields[i].value=this.selectdata.f_user_name;
322
- }
323
- if (this.data.fields[i].label === '安装项目') {
324
- this.data.fields[i].value="初装"
325
- }
326
- if (this.data.fields[i].label === '压力试验结果') {
327
- this.data.fields[i].value="合格"
328
- }
329
- if (this.data.fields[i].label === '有效期') {
330
- this.data.fields[i].value="10年"
331
- }
332
-
333
- }
334
-
335
- }
336
-
337
- // if (this.data.defname === '点火申请') {
338
- // for (let i = 0; i < this.data.fields.length; i++) {
339
- // if (this.data.fields[i].label === '工料费') {
340
- // this.data.fields[i].value = this.price
341
- // }
342
- // }
343
- // }
344
- if (this.data.defname === '工程结算') {
345
- var a = 0
346
- var b = 0
347
- var c = 0
348
- for (let i = 0; i < this.data.fields.length; i++) {
349
- if (this.data.fields[i].label === '最终核算成本金额') {
350
- this.data.fields[i].value = this.price
351
- a = this.data.fields[i].value
352
- }
353
- if (this.data.fields[i].label === '合同总金额') {
354
- b = this.data.fields[i].value
355
- }
356
- }
357
- c=b-a
358
- for (let i = 0; i < this.data.fields.length; i++) {
359
- if (this.data.fields[i].label === '工程盈利') {
360
- this.data.fields[i].value = c
361
- }
362
- }
363
- }
364
-
365
-
366
- if (this.data.defname === '点火') {
367
- let condition = `processid = '${this.data.f_process_id}'`
368
- this.$resetpost('rs/sql/getHuman', {data:{condition: condition}}, {resolveMsg: null, rejectMsg: null}).then((res) => {
369
- console.log('res',res)
370
- for (let row of res.data){
371
- if (row.defname ==='收费材料费'){
372
- console.log('下发来源',row.senderid)
373
-
374
- }
375
- }
376
- console.log('11111111111')
377
- })
378
- for (let i = 0; i < this.data.fields.length; i++) {
379
- if (this.data.fields[i].label === '最终核算成本金额') {
380
- this.data.fields[i].value = this.price
381
- a = this.data.fields[i].value
382
- }
383
- if (this.data.fields[i].label === '合同总金额') {
384
- b = this.data.fields[i].value
385
- }
386
- }
387
- c=b-a
388
- for (let i = 0; i < this.data.fields.length; i++) {
389
- if (this.data.fields[i].label === '工程盈利') {
390
- this.data.fields[i].value = c
391
- }
392
- }
393
- }
394
- // 特殊处理
395
- //施工环节 如果是个人报建需要提交表具信息
396
- if (this.data.defname === '施工') {
397
- for (let i = 0; i < this.data.fields.length; i++) {
398
- if (this.data.fields[i].label === '气表品牌'
399
- || this.data.fields[i].label === '气表型号'
400
- || this.data.fields[i].label === '气表厂家') {
401
- if (this.data.f_apply_type === '个人报建') {
402
- this.data.fields[i].hidden = false
403
- this.data.fields[i].required = true
404
- }
405
- }
406
- }
407
- }
408
-
409
-
410
-
411
- //通气环节可以调出施工环节的表信息来修改
412
- if (this.data.defname === '通气') {
413
- for (let i = 0; i < this.data.fields.length; i++) {
414
- if (this.data.fields[i].label === '气表品牌'
415
- || this.data.fields[i].label === '气表型号'
416
- || this.data.fields[i].label === '气表厂家') {
417
- if (this.data.fields[i].value != null && this.data.fields[i].value != '') {
418
- this.data.fields[i].hidden = false
419
- this.data.fields[i].required = true
420
- }
421
- }
422
- }
423
- }
424
- if(this.data.fields[i].label === '技术人员'){ //{"source":"this.getParentByType($organization$).getChildByName($技术人员$).getChildren()","userid":"296851"}
425
- let http = new HttpResetClass()
426
- let res = await http.load('POST', 'rs/search', `{"source":"this.getParentByType($organization$).getChildByName($技术人员$).getChildren()","userid":"${this.$login.f.id}"}`, {
427
- resolveMsg: null,
428
- rejectMsg: 'search查询部门下所有人失败'
429
- })
430
- console.log("search查询部门下所有人:"+ JSON.stringify(res.data))
431
- this.technologist = res.data
432
- if (this.technologist) {
433
- let array = []
434
- for (let k = 0; k < this.technologist.length; k++) {
435
- array.push({label: this.technologist[k].name, value: this.technologist[k].name})
436
- }
437
- this.data.fields[i].options = array
438
- }
439
- }
440
- //初始化调压箱
441
- if(this.data.fields[i].label == '调压箱'){
442
- let arr = []
443
- let filter = this.$login.f.f_orgids
444
- this.$ApplyGetSaleParam.getAdjustable(filter).forEach((item) => {
445
- let temp = {}
446
- temp.label = `[${item.value.f_adjustable_id}]-${item.label}`
447
- temp.value = `[${item.value.f_adjustable_id}]-${item.value.f_adjustable_name}`
448
- arr.push(temp)
449
- })
450
- let adjustables = [{label: '全部', value: ''}, ...arr]
451
- this.data.fields[i].options = adjustables;
452
- let res = await http.load('POST','rs/logic/getCommonAdjustBox', {data: {"f_building_id":this.data.f_building,"f_residential_area":this.data.f_residential_area}},{resolveMsg: null, rejectMsg: '获取区县失败!'})
453
-
454
- if(res.data.code == 1){
455
- this.$ApplyGetSaleParam.getAdjustable(filter).forEach((item) => {
456
- console.log(item.value.f_adjustable_id)
457
- if(item.value.f_adjustable_id ==res.data.result[0].f_building_id){
458
- this.data.fields[i].value = `[${item.value.f_adjustable_id}]-${item.value.f_adjustable_name}`;
459
- }
460
- })
461
- }
462
-
463
- // console.log(this.data.f_building);
464
- }
465
-
466
- if (this.data.fields[i].label == '县/区') {
467
- let loc = this.$login.f.f_orgids.split('.')
468
- // 获取区县
469
- console.log('初始化查询区县')
470
- let condition = `f_area is not null or f_area!=''`
471
- let http = new HttpResetClass()
472
- let res = await http.load('POST','rs/sql/singleTable_Final', {data: {items: 'f_area f_name',tablename: 't_user_address',orderitem: 'f_area',groupitem:'f_area',condition: condition}},{resolveMsg: null, rejectMsg: '获取区县失败!'})
473
- let areas = []
474
- res.data.forEach((row)=>{
475
- areas.push({label:row.f_name, value:row.f_name})
476
- })
477
- this.data.fields[i].options = areas
478
- }
479
- if ((
480
- this.data.fields[i].label === '工料费' ||
481
- this.data.fields[i].label === '延伸服务费' ||
482
- this.data.fields[i].label === '其他费用' ||
483
- this.data.fields[i].label === '金额')&&this.selectdata.defname !='点火申请'
484
- ) {
485
- console.log('即将计算合同金额')
486
- let a = 0
487
- let b = 0
488
- let c = 0
489
- for (let i = 0; i < this.data.fields.length; i++) {
490
- // 控制设置级联
491
- // 源select所选的值 this.$refs.service_show.data.activitys.fields[index].value
492
- // xxx xx xxx
493
- if (this.data.fields[i].label === '工料费' && this.data.fields[i].value) {
494
- a = this.data.fields[i].value
495
- }
496
- if (this.data.fields[i].label === '延伸服务费' && !this.data.fields[i].value) {
497
- b = this.data.fields[i].value
498
- }
499
- if (this.data.fields[i].label === '其他费用' && this.data.fields[i].value) {
500
- c = this.data.fields[i].value
501
- }
502
- }
503
- let d =0
504
- d= parseInt(b) + parseInt(c)
505
- // 数据计算完毕得到尾款
506
- for (let i = 0; i < this.data.fields.length; i++) {
507
- if (this.data.fields[i].label === '金额') {
508
-
509
- this.data.fields[i].value = d
510
-
511
- }
512
-
513
- }
514
- }
515
-
516
- if(this.data.fields[i].label == '工料费'||this.data.fields[i].label == '延伸服务费'||this.data.fields[i].label =='金额'||this.data.fields[i].label =='不锈钢波纹管费合计') {
517
- this.data.fields[i].readonly = true
518
- let httpf = new HttpResetClass()
519
- let resf = await httpf.load('POST','rs/sql/ApplyPaySearch', {data:{condition: ` f_apply_num ='${this.selectdata.f_apply_num}'`}},{resolveMsg: null, rejectMsg: '获取工料费和延伸服务费失败!'})
520
- if(this.data.fields[i].label == '工料费'){
521
- this.data.fields[i].value = resf.data[0].f_glf
522
- }else if(this.data.fields[i].label == '延伸服务费'&&!this.data.fields[i].value){
523
- this.data.fields[i].value = resf.data[0].f_ysfwf
524
- }else if(this.selectdata.defname == '点火'&&this.data.fields[i].label =='不锈钢波纹管费合计'){
525
- this.data.fields[i].value = resf.data[0].f_dhbxgbwg
526
- }else if(this.selectdata.defname == '点火申请'&&this.data.fields[i].label =='金额'){
527
- this.data.fields[i].value = resf.data[0].f_ysfwf
528
- }
529
- }
530
-
531
- if (this.data.fields[i].label == '燃气表品牌') {
532
- console.log('获取燃气表品牌。。。。。' ,this.$ApplyGetSaleParam.gasbrands)
533
- let rs = []
534
- for (let i = 0; i < this.$ApplyGetSaleParam.gasbrands.length; i++) {
535
- let temp = {
536
- label: this.$ApplyGetSaleParam.gasbrands[i].label,
537
- value: this.$ApplyGetSaleParam.gasbrands[i].label
538
- }
539
- rs.push(temp)
540
- }
541
- this.data.fields[i].options = [{label: '全部', value: ''}, ...rs]
542
- }
543
-
544
- if (this.data.fields[i].label == '合同类型') {
545
- this.data.fields[i].value == '主合同'
546
- }
547
-
548
- if (this.data.fields[i].label == '合同编号' && !this.selectdata[this.data.fields[i].field]) {
549
- if (!this.$appdata.getSingleValue(this.data.fields[i].label)) {
550
- this.$showMessage(`请先去参数管理设置: ${this.data.fields[i].label}`)
551
- } else {
552
- this.$appdata.load()
553
- let temp = this.$appdata.getSingleValue(this.data.fields[i].label)
554
- this.contract = temp
555
- while (temp.length < 4) {
556
- temp = '0' + temp
557
- }
558
- let dt = new Date()
559
- this.data.fields[i].value = dt.getFullYear() + ((dt.getMonth() + 1) < 10 ? '0' + (dt.getMonth() + 1) : dt.getMonth()) + temp
560
- }
561
- }
562
- }
563
- // 初始化 buttons_fields
564
- for (let i = 0; i < this.data.buttons.length; i++) {
565
- if (this.data.buttons[i].button_fields) {
566
- for (let j = 0; j < this.data.buttons[i].button_fields.length; j++) {
567
- // 如果selectdata有这些key,则把selectdata的value赋值给data的value
568
- if (this.selectdata[this.data.buttons[i].button_fields[j].field]) {
569
- this.data.buttons[i].button_fields[j].value = this.selectdata[this.data.buttons[i].button_fields[j].field]
570
- }
571
- // 如果配置类型为select,优先从参数列表获取options
572
- if (this.data.buttons[i].button_fields[j].type === 'select' && this.$appdata.getParam(this.data.buttons[i].button_fields[j].label)) {
573
- this.data.buttons[i].button_fields[j].options = this.$appdata.getParam(this.data.buttons[i].button_fields[j].label).trim()
574
- }
575
- // 下发特殊配置
576
- if (this.data.buttons[i].button_name === '下发') {
577
- if (this.data.buttons[i].button_fields.length === 1) {
578
- // value初始化
579
- // if(this.department_search){
580
-
581
- if (this.selectdata[this.data.buttons[i].button_fields[0].field]) {
582
- let flag = true
583
- for (let k = 0; k < this.department_search.length; k++) {
584
- // 将id转换为name
585
- if (Number(this.department_search[k].id) === Number(this.selectdata[this.data.buttons[i].button_fields[0].field])) {
586
- this.data.buttons[i].button_fields[0].value = this.department_search[k].name
587
- flag = false
588
- }
589
- }
590
- if(flag){
591
- this.data.buttons[i].button_fields[0].value = this.department_search[0].name
592
- }
593
- }
594
-
595
-
596
- if (this.department_search) {
597
- let array = []
598
- for (let k = 0; k < this.department_search.length; k++) {
599
- array.push({label: this.department_search[k].name, value: this.department_search[k].name})
600
- }
601
- this.data.buttons[i].button_fields[0].options = array
602
- }
603
- } else {
604
- this.$showMessage("下发按钮必须满足 当且仅当一个字段")
605
- }
606
- }
607
- }
608
- }
609
-
610
- }
611
- if (this.data.onetomany) {
612
- for (let i = 0; i < this.data.onetomany.length; i++) {
613
- if (this.data.onetomany[i].tables[0]==='t_fire_material'){
614
- console.log('1111111')
615
- for (let j = 0; j < this.data.onetomany[i].fields.length; j++) {
616
- if (this.data.onetomany[i].fields[j].label==='材料名称'){
617
- console.log('2222222')
618
- let http = new HttpResetClass()
619
- let res = await http.load('POST','rs/logic/getMaterialItem', {data: {condition: `1=1 and f_use_type='点火用材料'`}},{resolveMsg: null, rejectMsg: '获取材料失败!'})
620
- let house = []
621
- for (let row of res.data.material){
622
- house.push({label: row.f_name,value: row.f_name})
623
- }
624
- this.data.onetomany[i].fields[j].options = house
625
- console.log('3333333')
626
- }
627
- }
628
- }
629
- }
630
- }
631
-
632
- // 消除双向绑定,避免子组件(显示层)数据更改,父组件(控制层)也更改
633
- let temp = JSON.parse(JSON.stringify(this.data))
634
- // 退回原因展示
635
- if (this.selectdata.f_back_reason) {
636
- temp['back_reason'] = this.selectdata.f_back_reason
637
- }
638
- this.show_data = temp
639
- console.log('1242315235')
640
- // this.$nextTick(()=>{
641
- this.showview = true
642
- // })
643
- }
644
- },
645
- events: {
646
- 'get-price' (val,type) {
647
- if(type =='预算'){
648
- this.yusuansum = val
649
- if(this.show_data&&this.show_data.fields){
650
- for (let i = 0; i < this.show_data.fields.length; i++) {
651
- if (this.show_data.fields[i].label === '预算') {
652
- this.show_data.fields[i].value = this.yusuansum
653
- }
654
- }
655
- }
656
-
657
- }else if(type =='结算'){
658
- this.jiesuansum = val
659
- if(this.show_data&&this.show_data.fields) {
660
- for (let i = 0; i < this.show_data.fields.length; i++) {
661
- if (this.show_data.fields[i].label === '结算费用') {
662
- this.show_data.fields[i].value = this.jiesuansum
663
- }
664
- }
665
- }
666
- }else{
667
- this.price = val
668
- }
669
-
670
- this.initializtion()
671
- },
672
- 'get-numbergongliao' (val) {
673
- this.numbergongliao = val
674
- this.initializtion()
675
- },
676
- // 任意select选中时触发事件,关联性操作
677
- async 'select_cascade'(index) {
678
- console.log('触发了')
679
- // this.$refs.service_show.data // 子业务显示组件
680
- // 级联操作示例:
681
- /*
682
- if(this.$refs.service_show.data.fields[index].label==='报建类型'){
683
- for(let i=0;i<this.$refs.service_show.data.fields.length;i++){
684
- // 控制设置级联
685
- // 源select所选的值 this.$refs.service_show.data.fields[index].value
686
- if(this.$refs.service_show.data.fields[i].label==='级联测试2'){
687
- this.$refs.service_show.data.fields[i].options=[
688
- {label:'级联选项1',value:'级联选项1'},{label:'级联选项2',value:'级联选项2'},{label:'级联选项3',value:'级联选项3'}
689
- ]
690
- }
691
- }
692
- }
693
- */
694
- //燃气表号 位数 和 重复判断
695
- if(this.$refs.service_show.data.fields[index].label === '燃气表表号'){
696
- //位数校验
697
- let array = Vue.$appdata.getParam(this.$refs.service_show.data.fields[index].label+'位数校验')
698
- let flag = true
699
- for(let f=0;f<array.length;f++){
700
- if(this.$refs.service_show.data.fields[index].value&&this.$refs.service_show.data.fields[index].value.length == Number(array[f].value)){
701
- flag = false
702
- }
703
- }
704
- if(flag&&this.$refs.service_show.data.fields[index].value&&this.$refs.service_show.data.fields[index].value.length>0){
705
- this.$showMessage("表号位数不对,请重新录入")
706
- this.$refs.service_show.data.fields[index].value = null
707
- }else if(this.$refs.service_show.data.fields[index].value&&this.$refs.service_show.data.fields[index].value.length>0){
708
- // 重复校验
709
- let httpfd = new HttpResetClass()
710
- let data = {
711
- items:'f_meternumber',
712
- tablename: ' t_userinfo ui left join t_userfiles uf on ui.f_userinfo_id = uf.f_userinfo_id ',
713
- condition: `ui.f_user_state ='正常' and uf.f_meternumber = '${this.$refs.service_show.data.fields[index].value}' and ui.f_apply_num != '${this.selectdata.f_apply_num}'`
714
- }
715
- let res = await httpfd.load('POST', 'rs/sql/singleTableApply', {data: data}, {
716
- resolveMsg: null,
717
- rejectMsg: null
718
- })
719
- if(res.data.length>0){
720
- this.$showMessage("表号已经被使用,请查证后再输入")
721
- this.$refs.service_show.data.fields[index].value = null
722
- }
723
- }
724
- }
725
-
726
- if (
727
- this.$refs.service_show.data.fields[index].label === '最终核算成本金额' ||
728
- this.$refs.service_show.data.fields[index].label === '合同总金额' ||
729
- this.$refs.service_show.data.fields[index].label === '工程盈利'
730
- ) {
731
-
732
- var a=0
733
- var b=0
734
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
735
- // 控制设置级联
736
- // 源select所选的值 this.$refs.service_show.data.activitys.fields[index].value
737
- // xxx xx xxx
738
- if (this.$refs.service_show.data.fields[i].label === '最终核算成本金额' ) {
739
- this.$refs.service_show.data.fields[i].value = this.price
740
- a=this.$refs.service_show.data.fields[i].value
741
- }
742
-
743
- if (this.$refs.service_show.data.fields[i].label === '合同总金额' && this.$refs.service_show.data.fields[i].value) {
744
- b = this.$refs.service_show.data.fields[i].value
745
- }
746
- }
747
- var c =b - a
748
- // 数据计算完毕得到工程结余
749
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
750
- if (this.$refs.service_show.data.fields[i].label === '工程盈利') {
751
- this.$refs.service_show.data.fields[i].value = c
752
- }
753
- }
754
- }
755
-
756
-
757
-
758
-
759
- if (
760
- this.$refs.service_show.data.fields[index].label === '发票号'
761
- ) {
762
- let data = {
763
- condition: 'c.f_process_id=' + '\'' + this.selectdata.f_process_id + '\' and a.f_brand_spec =\'建安费\''
764
- }
765
- let http = new HttpResetClass()
766
- let res = await http.load('POST', 'rs/sql/getInvoice', {data: data}, {
767
- resolveMsg: null,
768
- rejectMsg: null
769
- })
770
- console.log('查询到的发票号:',res)
771
- // 数据计算完毕得到工程结余
772
-
773
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
774
- if (this.$refs.service_show.data.fields[i].label === '发票号') {
775
- if (!this.$refs.service_show.data.fields[i].value){
776
- if (res.data.length>0){
777
- this.$refs.service_show.data.fields[i].value = res.data[0].f_invoice_number
778
- }else {
779
- this.$showMessage('当前流程无收费记录,无法获取发票号')
780
- }
781
- }
782
- }
783
- }
784
- }
785
-
786
- if (
787
- this.$refs.service_show.data.fields[index].label === '工料费发票号'
788
- ) {
789
- let data = {
790
- condition: 'c.f_process_id=' + '\'' + this.selectdata.f_process_id + '\' and a.f_brand_spec =\'工料费\''
791
- }
792
- let http = new HttpResetClass()
793
- let res = await http.load('POST', 'rs/sql/getInvoice', {data: data}, {
794
- resolveMsg: null,
795
- rejectMsg: null
796
- })
797
- console.log('查询到的发票号:',res)
798
- // 数据计算完毕得到工程结余
799
-
800
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
801
- if (this.$refs.service_show.data.fields[i].label === '工料费发票号') {
802
- if (!this.$refs.service_show.data.fields[i].value){
803
- if (res.data.length>0){
804
- this.$refs.service_show.data.fields[i].value = res.data[0].f_invoice_number
805
- }else {
806
- this.$showMessage('当前流程无维修费收费记录,无法获取工料费发票号')
807
- }
808
- }
809
- }
810
- }
811
- }
812
- if (
813
- this.$refs.service_show.data.fields[index].label === '延伸服务费发票号'
814
- ) {
815
- let data = {
816
- condition: 'c.f_process_id=' + '\'' + this.selectdata.f_process_id + '\' and a.f_brand_spec =\'延伸服务费\''
817
- }
818
- let http = new HttpResetClass()
819
- let res = await http.load('POST', 'rs/sql/getInvoice', {data: data}, {
820
- resolveMsg: null,
821
- rejectMsg: null
822
- })
823
- console.log('查询到的发票号:',res)
824
- // 数据计算完毕得到工程结余
825
-
826
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
827
- if (this.$refs.service_show.data.fields[i].label === '延伸服务费发票号') {
828
- if (!this.$refs.service_show.data.fields[i].value){
829
- if (res.data.length>0){
830
- this.$refs.service_show.data.fields[i].value = res.data[0].f_invoice_number
831
- }else {
832
- this.$showMessage('当前流程无服务费收费记录,无法获取延伸服务费发票号')
833
- }
834
- }
835
- }
836
- }
837
- }
838
-
839
- if (
840
- this.$refs.service_show.data.fields[index].label === '材料费发票号'
841
- ) {
842
- let data = {
843
- condition: 'c.f_process_id=' + '\'' + this.selectdata.f_process_id + '\' and a.f_brand_spec =\'材料费\''
844
- }
845
- let http = new HttpResetClass()
846
- let res = await http.load('POST', 'rs/sql/getInvoice', {data: data}, {
847
- resolveMsg: null,
848
- rejectMsg: null
849
- })
850
- console.log('查询到的发票号:',res)
851
- // 数据计算完毕得到工程结余
852
-
853
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
854
- if (this.$refs.service_show.data.fields[i].label === '材料费发票号') {
855
- if (!this.$refs.service_show.data.fields[i].value){
856
- if (res.data.length>0){
857
- this.$refs.service_show.data.fields[i].value = res.data[0].f_invoice_number
858
- }else {
859
- this.$showMessage('当前流程无材料费收费记录,无法获取材料费发票号')
860
- }
861
- }
862
- }
863
- }
864
- }
865
- if (this.$refs.service_show.data.fields[index].label === '气价类型') {
866
- let pricetype=this.$refs.service_show.data.fields[index].value
867
- let http = new HttpResetClass()
868
- let condition = ''
869
- if(this.selectdata.f_gas_type&&(this.selectdata.f_gas_type.includes('民')||this.selectdata.f_gas_type.includes('公福'))){
870
- condition =`f_user_type = '民用' and f_filiale = '${this.$login.f.f_fengongsi}'
871
- and f_gasproperties = '${this.data.f_gas_type}' and f_price_type = '${pricetype}'`
872
- }else{
873
- condition =`f_user_type = '非民用' and f_filiale = '${this.$login.f.f_fengongsi}'
874
- and f_gasproperties = '${this.data.f_gas_type}' and f_price_type = '${pricetype}'`
875
- }
876
- // let condition =`f_user_type = '民用' and f_filiale = '${this.$login.f.f_fengongsi}'
877
- // and f_gasproperties = '${this.data.f_gas_type}' and f_price_type = '${pricetype}'`
878
- let res = await http.load('POST', 'rs/logic/getRecordItem', {condition}, {resolveMsg: null, rejectMsg: null})
879
- console.log('获取的气价类型,',res)
880
- let house2 = []
881
- if (res.data.pricename) {
882
- for (let row of res.data.pricename){
883
- house2.push({label: row.f_price_name,value: row.f_price_name})
884
- }
885
- }
886
-
887
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
888
- if (this.$refs.service_show.data.fields[i].label === '气价名称') {
889
- this.$refs.service_show.data.fields[i].options= house2
890
- }
891
- }
892
-
893
- }
894
-
895
-
896
- if (this.$refs.service_show.data.fields[index].label === '燃气表品牌') {
897
- let pricetype=this.$refs.service_show.data.fields[index].value
898
- let http = new HttpResetClass()
899
- let res = await http.load('POST', 'rs/logic/getMeterStyle', {data:{f_meter_brand :pricetype}}, {resolveMsg: null, rejectMsg: null})
900
- console.log('获取的气价类型,',res)
901
- let house2 = []
902
- if (res.data) {
903
- for (let row of res.data){
904
- house2.push({label: row.f_meter_style,value: row.f_meter_style})
905
- }
906
- }
907
-
908
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
909
- if (this.$refs.service_show.data.fields[i].label === '燃气表型号') {
910
- this.$refs.service_show.data.fields[i].options= house2
911
- }
912
- }
913
-
914
- }
915
- if (
916
- this.$refs.service_show.data.fields[index].label === '身份证号码'
917
- ) {
918
- if(this.$refs.service_show.data.fields[index].value.length!=18){
919
- this.$showMessage('身份证位数不是18位,请重新输入')
920
- this.$refs.service_show.data.fields[index].value = ''
921
- }
922
- }
923
-
924
- if (
925
- this.$refs.service_show.data.fields[index].label === '其他费用发票号'
926
- ) {
927
- let data = {
928
- condition: 'c.f_process_id=' + '\'' + this.selectdata.f_process_id + '\' and a.f_brand_spec =\'其他费用\''
929
- }
930
- let http = new HttpResetClass()
931
- let res = await http.load('POST', 'rs/sql/getInvoice', {data: data}, {
932
- resolveMsg: null,
933
- rejectMsg: null
934
- })
935
- console.log('查询到的发票号:',res)
936
- // 数据计算完毕得到工程结余
937
-
938
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
939
- if (this.$refs.service_show.data.fields[i].label === '其他费用发票号') {
940
- if (!this.$refs.service_show.data.fields[i].value){
941
- if (res.data.length>0){
942
- this.$refs.service_show.data.fields[i].value = res.data[0].f_invoice_number
943
- }else {
944
- this.$showMessage('当前流程无其他费用收费记录,无法获取其他费用发票号')
945
- }
946
- }
947
- }
948
- }
949
- }
950
-
951
-
952
- if (this.$refs.service_show.showadd_fields && this.$refs.service_show.showadd_fields.length > 0 && this.$refs.service_show.showadd_fields[index].label === '收费金额') {
953
- let chargeMoney = this.$refs.service_show.showadd_fields[index].value
954
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
955
- if (this.$refs.service_show.data.fields[i].label === '未结总金额') {
956
- let cumulativeMoney = this.$refs.service_show.data.fields[i].value
957
- if (Number(chargeMoney) > Number(cumulativeMoney)) {
958
- this.$showMessage("收费金额不得大于未结总金额!")
959
- this.$refs.service_show.showadd_fields[index].value = null
960
- return
961
- } else {
962
-
963
- }
964
- }
965
- }
966
- }
967
-
968
- //根据合同预算金额和累计缴费金额计算未结金额
969
- if (this.$refs.service_show.data.fields[index]&&this.$refs.service_show.data.fields[index].label === '累计缴费金额') {
970
- let cumulativeMoney = this.$refs.service_show.data.fields[index].value
971
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
972
- if (this.$refs.service_show.data.fields[i].label === '未结总金额') {
973
- this.$refs.service_show.data.fields[i].value = Number(this.selectdata.f_contract_total_money) - Number(cumulativeMoney)
974
- }
975
- }
976
- }
977
- //根据合同预算金额和累计开票金额计算未开票金额
978
- if (this.$refs.service_show.data.fields[index].label === '累计开票金额') {
979
- let residualInvoicing = this.$refs.service_show.data.fields[index].value
980
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
981
- if (this.$refs.service_show.data.fields[i].label === '未开票金额') {
982
- this.$refs.service_show.data.fields[i].value = Number(this.selectdata.f_contract_total_money) - Number(residualInvoicing)
983
- }
984
- }
985
- }
986
- //如果资料验收是否通过和工程验收是否通过为否的时候弹出原因填写框
987
- if (this.$refs.service_show.data.fields[index].label === '资料验收是否通过') {
988
- let res = this.$refs.service_show.data.fields[index].value
989
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
990
- if (this.$refs.service_show.data.fields[i].label === '资料验收不通过原因') {
991
- if (res === '否') {
992
- this.$refs.service_show.data.fields[i].hidden = false
993
- this.$refs.service_show.data.fields[i].required = true
994
- } else {
995
- this.$refs.service_show.data.fields[i].hidden = true
996
- this.$refs.service_show.data.fields[i].required = false
997
- }
998
- }
999
- }
1000
- }
1001
- if (this.$refs.service_show.data.fields[index].label === '工程验收是否通过') {
1002
- let res = this.$refs.service_show.data.fields[index].value
1003
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1004
- if (this.$refs.service_show.data.fields[i].label === '工程验收不通过原因') {
1005
- if (res === '否') {
1006
- this.$refs.service_show.data.fields[i].hidden = false
1007
- this.$refs.service_show.data.fields[i].required = true
1008
- } else {
1009
- this.$refs.service_show.data.fields[i].hidden = true
1010
- this.$refs.service_show.data.fields[i].required = false
1011
- }
1012
- }
1013
- }
1014
- }
1015
- //根据总户数和实际安装户数计算未安装户数
1016
- if (this.$refs.service_show.data.fields[index].label === '实际安装户数') {
1017
- let value = this.$refs.service_show.data.fields[index].value
1018
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1019
- if (this.$refs.service_show.data.fields[i].label === '未安装户数') {
1020
- this.$refs.service_show.data.fields[i].label === '未安装户数'
1021
- this.$refs.service_show.data.fields[i].value = Number(this.selectdata.f_install_num) - Number(value)
1022
- }
1023
- }
1024
- }
1025
-
1026
- if (this.$refs.service_show.data.fields[index].label === '已收费') {
1027
- let value = this.$refs.service_show.data.fields[index].value
1028
- if (value ==='是'){
1029
- for (let i = 0; i < this.$refs.service_show.data.buttons.length; i++) {
1030
- if (this.$refs.service_show.data.buttons[i].button_name ==='提交'){
1031
- console.log('已收费111')
1032
- this.$refs.service_show.data.buttons[i].disabled=false
1033
- }
1034
- }
1035
- }
1036
- if (value ==='否'){
1037
- for (let i = 0; i < this.$refs.service_show.data.buttons.length; i++) {
1038
- if (this.$refs.service_show.data.buttons[i].button_name ==='提交'){
1039
- console.log('已收费12222')
1040
- this.$refs.service_show.data.buttons[i].disabled=true
1041
- }
1042
- }
1043
- }
1044
- }
1045
-
1046
- if (this.$refs.service_show.data.fields[index].label === '燃气表品牌') {
1047
- let temp = this.$refs.service_show.data.fields[index].value
1048
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1049
- // 控制设置级联
1050
- // 源select所选的值 this.$refs.service_show.data.activitys.fields[index].value
1051
- if (this.$refs.service_show.data.fields[i].label === '生产厂家') {
1052
- this.$refs.service_show.data.fields[i].value = ''
1053
- this.$refs.service_show.data.fields[i].options = []
1054
- let rs = []
1055
- console.log('小区片区。。。', temp)
1056
- for (let j = 0; j < this.$ApplyGetSaleParam.gasbrands.length; j++) {
1057
- if (this.$ApplyGetSaleParam.gasbrands[j].label === temp) {
1058
- let temp = {
1059
- label: this.$ApplyGetSaleParam.gasbrands[j].value.f_manufacturers,
1060
- value: this.$ApplyGetSaleParam.gasbrands[j].value.f_manufacturers
1061
- }
1062
- rs.push(temp)
1063
- }
1064
- }
1065
- console.log('获取小区片区=>' + JSON.stringify(rs))
1066
- this.$refs.service_show.data.fields[i].options = [{label: '全部', value: ''}, ...rs]
1067
- this.$refs.service_show.update()
1068
- }
1069
- if (this.$refs.service_show.data.fields[i].label === '燃气表类型') {
1070
- this.$refs.service_show.data.fields[i].value = ''
1071
- this.$refs.service_show.data.fields[i].options = []
1072
- let rs = []
1073
- console.log('燃气表品牌。。。', temp)
1074
- for (let j = 0; j < this.$ApplyGetSaleParam.gasbrands.length; j++) {
1075
- if (this.$ApplyGetSaleParam.gasbrands[j].label === temp) {
1076
- let temp = {
1077
- label: this.$ApplyGetSaleParam.gasbrands[j].value.f_meter_type,
1078
- value: this.$ApplyGetSaleParam.gasbrands[j].value.f_meter_type
1079
- }
1080
- rs.push(temp)
1081
- }
1082
- }
1083
- console.log('获取小区片区=>' + JSON.stringify(rs))
1084
- this.$refs.service_show.data.fields[i].options = [{label: '全部', value: ''}, ...rs]
1085
- this.$refs.service_show.update()
1086
- }
1087
- }
1088
- }
1089
-
1090
-
1091
- if (this.$refs.service_show.data.fields[index].label === '县/区') {
1092
- let temp = this.$refs.service_show.data.fields[index].value
1093
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1094
- // 控制设置级联
1095
- // 源select所选的值 this.$refs.service_show.data.activitys.fields[index].value
1096
- if (this.$refs.service_show.data.fields[i].label === '乡镇') {
1097
- this.$refs.service_show.data.fields[i].value = ''
1098
- this.$refs.service_show.data.fields[i].options = []
1099
- let rs = []
1100
- console.log('县/区。。。', temp)
1101
- // for (let j = 0; j < this.$login.f.f_allArea.length; j++) {
1102
- // if (this.$login.f.f_allArea[j].label === temp) {
1103
- // rs = this.$login.f.f_allArea[j].value
1104
- // }
1105
- // }
1106
- let condition = `f_area = '${temp}' and (f_slice_area is not null or f_slice_area!='')`
1107
- let http = new HttpResetClass()
1108
- let res = await http.load('POST','rs/sql/singleTable_Final', {data: {items: 'f_slice_area f_name',tablename: 't_user_address',orderitem: 'f_slice_area',groupitem:'f_slice_area',condition: condition}},{resolveMsg: null, rejectMsg: '获取乡镇失败!'})
1109
- let areas = []
1110
- res.data.forEach((row)=>{
1111
- areas.push({label:row.f_name, value:row.f_name})
1112
- })
1113
- console.log('获取乡镇=>' + JSON.stringify(areas))
1114
- this.$refs.service_show.data.fields[i].options = areas
1115
- this.$refs.service_show.update()
1116
- }
1117
- }
1118
- }
1119
-
1120
- if (this.$refs.service_show.data.fields[index].label === '乡镇') {
1121
- let temp = this.$refs.service_show.data.fields[index].value
1122
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1123
- // 控制设置级联
1124
- // 源select所选的值 this.$refs.service_show.data.activitys.fields[index].value
1125
- if (this.$refs.service_show.data.fields[i].label === '街道') {
1126
- this.$refs.service_show.data.fields[i].value = ''
1127
- this.$refs.service_show.data.fields[i].options = []
1128
- let rs = []
1129
- console.log('乡镇。。。', temp)
1130
- // for (let j = 0; j < this.$login.f.f_allArea.length; j++) {
1131
- // if (this.$login.f.f_allArea[j].label === temp) {
1132
- // rs = this.$login.f.f_allArea[j].value
1133
- // }
1134
- // }
1135
- let condition = `f_slice_area = '${temp}' and (f_street is not null or f_street!='')`
1136
- let http = new HttpResetClass()
1137
- let res = await http.load('POST','rs/sql/singleTable_Final', {data: {items: 'f_street f_name',tablename: 't_user_address',orderitem: 'f_street',groupitem:'f_street',condition: condition}},{resolveMsg: null, rejectMsg: '获取街道失败!'})
1138
- let areas = []
1139
- res.data.forEach((row)=>{
1140
- areas.push({label:row.f_name, value:row.f_name})
1141
- })
1142
- console.log('获取街道=>' + JSON.stringify(areas))
1143
- this.$refs.service_show.data.fields[i].options = areas
1144
- this.$refs.service_show.update()
1145
- }
1146
- }
1147
- }
1148
- if (this.$refs.service_show.data.fields[index].label === '街道') {
1149
- let temp = this.$refs.service_show.data.fields[index].value
1150
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1151
- // 控制设置级联
1152
- // 源select所选的值 this.$refs.service_show.data.activitys.fields[index].value
1153
- if (this.$refs.service_show.data.fields[i].label === '小区') {
1154
- this.$refs.service_show.data.fields[i].value = ''
1155
- this.$refs.service_show.data.fields[i].options = []
1156
- let rs = []
1157
- console.log('街道。。。', temp)
1158
- // for (let j = 0; j < this.$login.f.f_allArea.length; j++) {
1159
- // if (this.$login.f.f_allArea[j].label === temp) {
1160
- // rs = this.$login.f.f_allArea[j].value
1161
- // }
1162
- // }
1163
- let condition = `f_street ='${temp}' and (f_residential_area is not null or f_residential_area!='')`
1164
- let http = new HttpResetClass()
1165
- let res = await http.load('POST','rs/sql/singleTable_Final', {data: {items: 'f_residential_area f_name',tablename: 't_user_address',orderitem: 'f_residential_area',groupitem:'f_residential_area',condition: condition}},{resolveMsg: null, rejectMsg: '获取小区失败!'})
1166
- let areas = []
1167
- res.data.forEach((row)=>{
1168
- areas.push({label:row.f_name, value:row.f_name})
1169
- })
1170
- console.log('获取小区=>' + JSON.stringify(areas))
1171
- this.$refs.service_show.data.fields[i].options = areas
1172
- this.$refs.service_show.update()
1173
- }
1174
- }
1175
- }
1176
- if (this.$refs.service_show.data.fields[index].label === '小区') {
1177
- let temp = this.$refs.service_show.data.fields[index].value
1178
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1179
- // 控制设置级联
1180
- // 源select所选的值 this.$refs.service_show.data.activitys.fields[index].value
1181
- if (this.$refs.service_show.data.fields[i].label === '楼号') {
1182
- this.$refs.service_show.data.fields[i].value = ''
1183
- this.$refs.service_show.data.fields[i].options = []
1184
- let rs = []
1185
- console.log('小区。。。', temp)
1186
- // for (let j = 0; j < this.$login.f.f_allArea.length; j++) {
1187
- // if (this.$login.f.f_allArea[j].label === temp) {
1188
- // rs = this.$login.f.f_allArea[j].value
1189
- // }
1190
- // }
1191
- let condition = `f_residential_area = '${temp}' and (f_building is not null or f_building!='')`
1192
- let http = new HttpResetClass()
1193
- let res = await http.load('POST','rs/sql/singleTable_Final', {data: {items: 'f_building f_name',tablename: 't_user_address',orderitem: 'f_building',groupitem:'f_building',condition: condition}},{resolveMsg: null, rejectMsg: '获取楼号失败!'})
1194
- let areas = []
1195
- res.data.forEach((row)=>{
1196
- areas.push({label:row.f_name, value:row.f_name})
1197
- })
1198
- console.log('获取楼号=>' + JSON.stringify(areas))
1199
- this.$refs.service_show.data.fields[i].options = areas
1200
- this.$refs.service_show.update()
1201
- }
1202
- }
1203
- }
1204
-
1205
- if (this.$refs.service_show.data.fields[index].label === '楼号') {
1206
- let temp = this.$refs.service_show.data.fields[index].value
1207
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1208
- // 控制设置级联
1209
- // 源select所选的值 this.$refs.service_show.data.activitys.fields[index].value
1210
- if (this.$refs.service_show.data.fields[i].label === '单元号') {
1211
- this.$refs.service_show.data.fields[i].value = ''
1212
- this.$refs.service_show.data.fields[i].options = []
1213
- let rs = []
1214
- console.log('楼号。。。', temp)
1215
- let condition = `f_building = '${temp}' and (f_unit is not null or f_unit!='')`
1216
- let http = new HttpResetClass()
1217
- let res = await http.load('POST','rs/sql/singleTable_Final', {data: {items: 'f_unit f_name',tablename: 't_user_address',orderitem: 'f_unit',groupitem:'f_unit',condition: condition}},{resolveMsg: null, rejectMsg: '获取单元号失败!'})
1218
- let areas = []
1219
- res.data.forEach((row)=>{
1220
- areas.push({label:row.f_name, value:row.f_name})
1221
- })
1222
- console.log('获取单元号=>' + JSON.stringify(areas))
1223
- this.$refs.service_show.data.fields[i].options = areas
1224
- this.$refs.service_show.update()
1225
- }
1226
- }
1227
- }
1228
-
1229
- if (this.$refs.service_show.data.fields[index].label === '单元号') {
1230
- let temp = this.$refs.service_show.data.fields[index].value
1231
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1232
- // 控制设置级联
1233
- // 源select所选的值 this.$refs.service_show.data.activitys.fields[index].value
1234
- if (this.$refs.service_show.data.fields[i].label === '楼层') {
1235
- this.$refs.service_show.data.fields[i].value = ''
1236
- this.$refs.service_show.data.fields[i].options = []
1237
- let rs = []
1238
- console.log('单元号。。。', temp)
1239
- let condition = `f_unit = '${temp}' and (f_floor is not null or f_floor!='')`
1240
- let http = new HttpResetClass()
1241
- let res = await http.load('POST','rs/sql/singleTable_Final', {data: {items: 'f_floor f_name',tablename: 't_user_address',orderitem: 'f_floor',groupitem:'f_floor',condition: condition}},{resolveMsg: null, rejectMsg: '获取楼层失败!'})
1242
- let areas = []
1243
- res.data.forEach((row)=>{
1244
- areas.push({label:row.f_name, value:row.f_name})
1245
- })
1246
- console.log('获取楼层=>' + JSON.stringify(areas))
1247
- this.$refs.service_show.data.fields[i].options = areas
1248
- this.$refs.service_show.update()
1249
- }
1250
- }
1251
- }
1252
-
1253
- if (this.$refs.service_show.data.fields[index].label === '楼层') {
1254
- let temp = this.$refs.service_show.data.fields[index].value
1255
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1256
- // 控制设置级联
1257
- // 源select所选的值 this.$refs.service_show.data.activitys.fields[index].value
1258
- if (this.$refs.service_show.data.fields[i].label === '门牌号') {
1259
- this.$refs.service_show.data.fields[i].value = ''
1260
- this.$refs.service_show.data.fields[i].options = []
1261
- let rs = []
1262
- console.log('楼层。。。', temp)
1263
- let condition = `f_floor = '${temp}' and (f_room is not null or f_room!='')`
1264
- let http = new HttpResetClass()
1265
- let res = await http.load('POST','rs/sql/singleTable_Final', {data: {items: 'f_room f_name',tablename: 't_user_address',orderitem: 'f_room',groupitem:'f_room',condition: condition}},{resolveMsg: null, rejectMsg: '获取门牌号失败!'})
1266
- let areas = []
1267
- res.data.forEach((row)=>{
1268
- areas.push({label:row.f_name, value:row.f_name})
1269
- })
1270
- console.log('获取门牌号=>' + JSON.stringify(areas))
1271
- this.$refs.service_show.data.fields[i].options = areas
1272
- this.$refs.service_show.update()
1273
- }
1274
- }
1275
- }
1276
-
1277
- //控制尾款
1278
- if (
1279
- this.$refs.service_show.data.fields[index].label === '合同金额' ||
1280
- this.$refs.service_show.data.fields[index].label === '首付' ||
1281
- this.$refs.service_show.data.fields[index].label === '进度款' ||
1282
- this.$refs.service_show.data.fields[index].label === '尾款'
1283
- ) {
1284
- console.log('即将计算合同金额')
1285
- var cash = 0
1286
- var downpayments=0
1287
- var tailmoney=0
1288
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1289
- // 控制设置级联
1290
- // 源select所选的值 this.$refs.service_show.data.activitys.fields[index].value
1291
- // xxx xx xxx
1292
- if (this.$refs.service_show.data.fields[i].label === '合同金额' && this.$refs.service_show.data.fields[i].value) {
1293
- cash = this.$refs.service_show.data.fields[i].value
1294
- }
1295
- if (this.$refs.service_show.data.fields[i].label === '首付' && this.$refs.service_show.data.fields[i].value) {
1296
- downpayments = this.$refs.service_show.data.fields[i].value
1297
- }
1298
- if (this.$refs.service_show.data.fields[i].label === '进度款' && this.$refs.service_show.data.fields[i].value) {
1299
- tailmoney = this.$refs.service_show.data.fields[i].value
1300
- }
1301
- }
1302
- var a =cash - downpayments
1303
- // 数据计算完毕得到尾款
1304
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1305
- if (this.$refs.service_show.data.fields[i].label === '尾款') {
1306
- if (cash === downpayments ){
1307
- this.$refs.service_show.data.fields[i].value = 0
1308
- } else{
1309
- this.$refs.service_show.data.fields[i].value = (cash - downpayments - tailmoney)
1310
- console.log('修改fields[i].value后的值=>' + this.$refs.service_show.data.fields[i].value)
1311
- }
1312
- }
1313
- if (this.$refs.service_show.data.fields[i].label === '首付') {
1314
- if (a<0){
1315
- this.$showMessage("首付款数额过大")
1316
- downpayments = 0
1317
- this.$refs.service_show.data.fields[i].value = 0
1318
- }
1319
- }
1320
-
1321
- if (this.$refs.service_show.data.fields[i].label === '进度款') {
1322
-
1323
- if (cash === downpayments ){
1324
- tailmoney = 0
1325
- this.$refs.service_show.data.fields[i].value = 0
1326
- this.$refs.service_show.data.fields[i].readonly=true
1327
- }else {
1328
- this.$refs.service_show.data.fields[i].readonly=false
1329
- tailmoney = this.$refs.service_show.data.fields[i].value
1330
- }
1331
- if (tailmoney>a){
1332
- this.$showMessage("进度款数额过大")
1333
- tailmoney = 0
1334
- this.$refs.service_show.data.fields[i].value = 0
1335
- }
1336
- }
1337
- }
1338
- }
1339
-
1340
-
1341
-
1342
- if ((
1343
- this.$refs.service_show.data.fields[index].label === '工料费' ||
1344
- this.$refs.service_show.data.fields[index].label === '延伸服务费' ||
1345
- this.$refs.service_show.data.fields[index].label === '其他费用' ||
1346
- this.$refs.service_show.data.fields[index].label === '金额')&&this.selectadata.defname != '点火申请'
1347
- ) {
1348
- console.log('即将计算合同金额')
1349
- let a = 0
1350
- let b = 0
1351
- let c = 0
1352
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1353
- // 控制设置级联
1354
- // 源select所选的值 this.$refs.service_show.data.activitys.fields[index].value
1355
- // xxx xx xxx
1356
- if (this.$refs.service_show.data.fields[i].label === '工料费' && this.$refs.service_show.data.fields[i].value) {
1357
- a = this.$refs.service_show.data.fields[i].value
1358
- }
1359
- if (this.$refs.service_show.data.fields[i].label === '延伸服务费' && !this.$refs.service_show.data.fields[i].value) {
1360
- b = this.$refs.service_show.data.fields[i].value
1361
- }
1362
- if (this.$refs.service_show.data.fields[i].label === '其他费用' && this.$refs.service_show.data.fields[i].value) {
1363
- c = this.$refs.service_show.data.fields[i].value
1364
- }
1365
- }
1366
- let d =0
1367
- d= parseInt(b) + parseInt(c)
1368
- // 数据计算完毕得到尾款
1369
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1370
- if (this.$refs.service_show.data.fields[i].label === '金额') {
1371
-
1372
- this.$refs.service_show.data.fields[i].value = d
1373
-
1374
- }
1375
-
1376
- }
1377
- }
1378
-
1379
-
1380
-
1381
- // 合成地址
1382
- if (
1383
- this.$refs.service_show.data.fields[index].label === '县/区' ||
1384
- this.$refs.service_show.data.fields[index].label === '乡镇' ||
1385
- this.$refs.service_show.data.fields[index].label === '街道' ||
1386
- this.$refs.service_show.data.fields[index].label === '小区' ||
1387
- this.$refs.service_show.data.fields[index].label === '单位名称' ||
1388
- this.$refs.service_show.data.fields[index].label === '楼号' ||
1389
- this.$refs.service_show.data.fields[index].label === '单元号' ||
1390
- this.$refs.service_show.data.fields[index].label === '楼层' ||
1391
- this.$refs.service_show.data.fields[index].label === '门牌号'
1392
- ) {
1393
- console.log('即将合成地址')
1394
- var address = ''
1395
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1396
- // 控制设置级联
1397
- // 源select所选的值 this.$refs.service_show.data.activitys.fields[index].value
1398
- // xxx xx xxx
1399
- if (this.$refs.service_show.data.fields[i].label === '县/区' && this.$refs.service_show.data.fields[i].value && typeof this.$refs.service_show.data.fields[i].value === 'string') {
1400
- address += this.$refs.service_show.data.fields[i].value
1401
- }else if(this.$refs.service_show.data.fields[i].label === '县/区' && this.$refs.service_show.data.fields[i].value && typeof this.$refs.service_show.data.fields[i].value === 'object'){
1402
- address += this.$refs.service_show.data.fields[i].value.name
1403
- }else {
1404
- let a =this.$refs.service_show.data.fields[i].value
1405
- console.log(`xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx${JSON.stringify(a)}让`)
1406
- }
1407
- if (this.$refs.service_show.data.fields[i].label === '乡镇' && this.$refs.service_show.data.fields[i].value && typeof this.$refs.service_show.data.fields[i].value === 'string') {
1408
- address += this.$refs.service_show.data.fields[i].value
1409
- }else if (this.$refs.service_show.data.fields[i].label === '乡镇' && this.$refs.service_show.data.fields[i].value && typeof this.$refs.service_show.data.fields[i].value === 'object') {
1410
- address += this.$refs.service_show.data.fields[i].value.name
1411
- }
1412
- if (this.$refs.service_show.data.fields[i].label === '街道' && this.$refs.service_show.data.fields[i].value && typeof this.$refs.service_show.data.fields[i].value === 'string') {
1413
- address += this.$refs.service_show.data.fields[i].value
1414
- }else if (this.$refs.service_show.data.fields[i].label === '街道' && this.$refs.service_show.data.fields[i].value && typeof this.$refs.service_show.data.fields[i].value === 'object'){
1415
- address += this.$refs.service_show.data.fields[i].value.name
1416
- }
1417
- if (this.$refs.service_show.data.fields[i].label === '小区' && this.$refs.service_show.data.fields[i].value && typeof this.$refs.service_show.data.fields[i].value === 'string') {
1418
- address += this.$refs.service_show.data.fields[i].value
1419
- }else if (this.$refs.service_show.data.fields[i].label === '小区' && this.$refs.service_show.data.fields[i].value && typeof this.$refs.service_show.data.fields[i].value === 'object'){
1420
- address += this.$refs.service_show.data.fields[i].value.name
1421
- }
1422
- if (this.$refs.service_show.data.fields[i].label === '单位名称' && this.$refs.service_show.data.fields[i].value && typeof this.$refs.service_show.data.fields[i].value === 'string') {
1423
- address += this.$refs.service_show.data.fields[i].value
1424
- }else if (this.$refs.service_show.data.fields[i].label === '单位名称' && this.$refs.service_show.data.fields[i].value && typeof this.$refs.service_show.data.fields[i].value === 'object'){
1425
- address += this.$refs.service_show.data.fields[i].value.name
1426
- }
1427
- if (this.$refs.service_show.data.fields[i].label === '楼号' && this.$refs.service_show.data.fields[i].value && typeof this.$refs.service_show.data.fields[i].value === 'string') {
1428
- address += this.$refs.service_show.data.fields[i].value+ '栋'
1429
- }else if (this.$refs.service_show.data.fields[i].label === '楼号' && this.$refs.service_show.data.fields[i].value && typeof this.$refs.service_show.data.fields[i].value === 'object'){
1430
- address += this.$refs.service_show.data.fields[i].value.name
1431
- }
1432
- if (this.$refs.service_show.data.fields[i].label === '单元号' && this.$refs.service_show.data.fields[i].value && typeof this.$refs.service_show.data.fields[i].value === 'string') {
1433
- address +=this.$refs.service_show.data.fields[i].value+ '单元'
1434
- }else if (this.$refs.service_show.data.fields[i].label === '单元号' && this.$refs.service_show.data.fields[i].value && typeof this.$refs.service_show.data.fields[i].value === 'object'){
1435
- address +=this.$refs.service_show.data.fields[i].value.name
1436
- }
1437
- if (this.$refs.service_show.data.fields[i].label === '楼层' && this.$refs.service_show.data.fields[i].value && typeof this.$refs.service_show.data.fields[i].value === 'string') {
1438
- address += this.$refs.service_show.data.fields[i].value+ '层'
1439
- }else if (this.$refs.service_show.data.fields[i].label === '楼层' && this.$refs.service_show.data.fields[i].value && typeof this.$refs.service_show.data.fields[i].value === 'object'){
1440
- address += this.$refs.service_show.data.fields[i].value.name
1441
- }
1442
- if (this.$refs.service_show.data.fields[i].label === '门牌号' && this.$refs.service_show.data.fields[i].value && typeof this.$refs.service_show.data.fields[i].value === 'string') {
1443
- address += this.$refs.service_show.data.fields[i].value+ '室'
1444
- }else if (this.$refs.service_show.data.fields[i].label === '门牌号' && this.$refs.service_show.data.fields[i].value && typeof this.$refs.service_show.data.fields[i].value === 'object'){
1445
- address += this.$refs.service_show.data.fields[i].value.name
1446
- }
1447
- }
1448
- //去除空格
1449
- address=address.replace(/\s*/g,"")
1450
- console.log('获取到的address=>' + address)
1451
- //效验地址是否被使用
1452
- let res = await this.$resetpost('rs/logic/checkAddress',{f_address:address}, {resolveMsg: null, rejectMsg: null})
1453
- if(res.data.data[0].count>0){
1454
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1455
- if(this.$refs.service_show.data.fields[i].label === '门牌号'){
1456
- this.$showMessage('用户地址已被使用,请重新输入')
1457
- this.$refs.service_show.data.fields[i].value=''
1458
- }
1459
- }
1460
- }
1461
- // 数据获取完毕时放入地址text
1462
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1463
- if (this.$refs.service_show.data.fields[i].label === '地址') {
1464
- this.$refs.service_show.data.fields[i].value = address
1465
- console.log('修改fields[i].value后的值=>' + this.$refs.service_show.data.fields[i].value)
1466
- }
1467
- }
1468
- }
1469
-
1470
-
1471
- // 开户费+材料费+人工费+设备安装费=合计
1472
- if (this.$refs.service_show.data.fields[index].label === '开户费' ||
1473
- this.$refs.service_show.data.fields[index].label === '材料费' ||
1474
- this.$refs.service_show.data.fields[index].label === '人工费' ||
1475
- this.$refs.service_show.data.fields[index].label === '设备安装费') {
1476
- let fee = 0
1477
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1478
- if (this.$refs.service_show.data.fields[index].label === '开户费' ||
1479
- this.$refs.service_show.data.fields[index].label === '材料费' ||
1480
- this.$refs.service_show.data.fields[index].label === '人工费' ||
1481
- this.$refs.service_show.data.fields[index].label === '设备安装费') {
1482
- fee += Number(this.$refs.service_show.data.fields[index].value)
1483
- }
1484
- if (this.$refs.service_show.data.fields[index].label === '合计') {
1485
- this.$refs.service_show.data.fields[index].value = fee
1486
- }
1487
- }
1488
-
1489
- }
1490
- // this.$refs.service_show.update()
1491
-
1492
- if(this.$refs.service_show.data.fields[index].label === '是否安装波纹管'){
1493
- if(this.$refs.service_show.data.fields[index].value==='是' )
1494
- this.selectMachine.push('波纹管')
1495
- if(this.$refs.service_show.data.fields[index].value==='否' ){
1496
- let newSelectMachine=[];
1497
- for(let i=0;i<this.selectMachine.length;i++){
1498
- if(this.selectMachine[i]!=='波纹管'){
1499
- newSelectMachine.push(this.selectMachine[i])
1500
- }
1501
- }
1502
- this.selectMachine=newSelectMachine;
1503
- }
1504
- }
1505
- if(this.$refs.service_show.data.fields[index].label === '是否安装热水器'){
1506
- if(this.$refs.service_show.data.fields[index].value==='是' )
1507
- this.selectMachine.push('热水器')
1508
- if(this.$refs.service_show.data.fields[index].value==='否' ){
1509
- let newSelectMachine=[];
1510
- for(let i=0;i<this.selectMachine.length;i++){
1511
- if(this.selectMachine[i]!=='热水器'){
1512
- newSelectMachine.push(this.selectMachine[i])
1513
- }
1514
- }
1515
- this.selectMachine=newSelectMachine;
1516
- }
1517
- }
1518
- if(this.$refs.service_show.data.fields[index].label === '是否安装燃气灶'){
1519
- if(this.$refs.service_show.data.fields[index].value==='是' )
1520
- this.selectMachine.push('燃气灶')
1521
- if(this.$refs.service_show.data.fields[index].value==='否' ){
1522
- let newSelectMachine=[];
1523
- for(let i=0;i<this.selectMachine.length;i++){
1524
- if(this.selectMachine[i]!=='燃气灶'){
1525
- newSelectMachine.push(this.selectMachine[i])
1526
- }
1527
- }
1528
- this.selectMachine=newSelectMachine;
1529
- }
1530
- }
1531
- },
1532
-
1533
- // onetomany模态框监听事件
1534
- async 'select_cascade_modal'(i,j){
1535
- let house = []
1536
- if (this.data.onetomany[i].tables[0]==='t_fire_material'){
1537
- console.log('1111111')
1538
-
1539
- if (this.data.onetomany[i].fields[j].label ==='材料名称'){
1540
- console.log('2222222')
1541
- let a =this.$refs.service_show.showadd_fields.fields[j].value
1542
- let http = new HttpResetClass()
1543
- http.load('POST','rs/logic/getMaterialItem', {data: {condition: `f_name='${a}' and f_use_type='点火用材料'`}},{resolveMsg: null, rejectMsg: '获取材料失败!'}).then((res)=>{
1544
- for (let row of res.data.material){
1545
- house.push({label: row.f_unit,value: row.f_unit})
1546
- }
1547
- for (let m = 0; m < this.data.onetomany[i].fields.length; m++) {
1548
- if (this.data.onetomany[i].fields[m].label==='材料单位'){
1549
- console.log('传值',house)
1550
- this.$refs.service_show.showadd_fields.fields[m].options= house
1551
- console.log(house[0].value);
1552
- this.$refs.service_show.showadd_fields.fields[m].value= house[0].value;
1553
- this.$refs.service_show.update();
1554
- // this.$refs.service_show.update_modal()
1555
- console.log(`3333333=====>${this.$refs.service_show.showadd_fields.fields[m].options}`)
1556
- // this.data.onetomany[i].fields[m].options
1557
- }
1558
- if(this.data.onetomany[i].fields[m].label==='单价'){
1559
- this.$refs.service_show.showadd_fields.fields[m].value= res.data.material[0].f_price
1560
- }
1561
- }
1562
- })
1563
-
1564
- }
1565
- if (this.data.onetomany[i].fields[j].label ==='数量'){
1566
- let danjia = 0
1567
- let shuliang = this.$refs.service_show.showadd_fields.fields[j].value
1568
- for (let m = 0; m < this.data.onetomany[i].fields.length; m++) {
1569
- if(this.data.onetomany[i].fields[m].label==='单价'){
1570
- danjia = this.$refs.service_show.showadd_fields.fields[m].value
1571
- }
1572
- if(this.data.onetomany[i].fields[m].label==='金额'){
1573
- this.$refs.service_show.showadd_fields.fields[m].value= danjia*shuliang
1574
- }
1575
- }
1576
- }
1577
- }
1578
-
1579
-
1580
- if (this.data.onetomany[i].tables[0]==='t_fire_machine') {
1581
- let a = 0
1582
-
1583
- if (this.data.onetomany[i].fields[j].label === '燃气具') {
1584
- if (this.$refs.service_show.showadd_fields.fields[j].value === '燃气灶') {
1585
- a = 1
1586
- }
1587
- if (this.$refs.service_show.showadd_fields.fields[j].value === '热水器') {
1588
- a = 2
1589
- }
1590
- }
1591
-
1592
-
1593
- for (let m = 0; m < this.data.onetomany[i].fields.length; m++) {
1594
- if (a === 1) {
1595
- console.log('燃气灶')
1596
- if (this.data.onetomany[i].fields[m].label === '安装方式') {
1597
- this.$refs.service_show.showadd_fields.fields[m].hidden = false
1598
- }
1599
- if (this.data.onetomany[i].fields[m].label === '面板') {
1600
- this.$refs.service_show.showadd_fields.fields[m].hidden = false
1601
- }
1602
- if (this.data.onetomany[i].fields[m].label === '连接方式') {
1603
- this.$refs.service_show.showadd_fields.fields[m].hidden = false
1604
- }
1605
- if (this.data.onetomany[i].fields[m].label === '安装位置') {
1606
- this.$refs.service_show.showadd_fields.fields[m].hidden = true
1607
- }
1608
- if (this.data.onetomany[i].fields[m].label === '排烟方式') {
1609
- this.$refs.service_show.showadd_fields.fields[m].hidden = true
1610
- }
1611
- if (this.data.onetomany[i].fields[m].label === '容积') {
1612
- this.$refs.service_show.showadd_fields.fields[m].hidden = true
1613
- }
1614
- }
1615
- if (a === 2) {
1616
- console.log('热水器')
1617
- if (this.data.onetomany[i].fields[m].label === '安装位置') {
1618
- this.$refs.service_show.showadd_fields.fields[m].hidden = false
1619
- }
1620
- if (this.data.onetomany[i].fields[m].label === '排烟方式') {
1621
- this.$refs.service_show.showadd_fields.fields[m].hidden = false
1622
- }
1623
- if (this.data.onetomany[i].fields[m].label === '容积') {
1624
- this.$refs.service_show.showadd_fields.fields[m].hidden = false
1625
- }
1626
- if (this.data.onetomany[i].fields[m].label === '安装方式') {
1627
- this.$refs.service_show.showadd_fields.fields[m].hidden = true
1628
- }
1629
- if (this.data.onetomany[i].fields[m].label === '面板') {
1630
- this.$refs.service_show.showadd_fields.fields[m].hidden = true
1631
- }
1632
- if (this.data.onetomany[i].fields[m].label === '连接方式') {
1633
- this.$refs.service_show.showadd_fields.fields[m].hidden = true
1634
- }
1635
- }
1636
- }
1637
- }
1638
- },
1639
-
1640
-
1641
- async 'onetomanyevent'(datas) {
1642
- console.log(`onetomany=======>${JSON.stringify(datas)}`)
1643
-
1644
- for (let i = 0; i < datas.rows.length; i++) {
1645
- datas.rows[i]['f_process_id'] = this.selectdata.f_process_id
1646
- datas.rows[i]['f_apply_num'] = this.selectdata.f_apply_num
1647
- datas.rows[i]['f_filiale'] = this.$login.f.f_fengongsi
1648
- datas.rows[i]['f_parentname'] = this.$login.f.f_parentname
1649
- datas.rows[i]['f_operator'] = this.$login.f.name
1650
- }
1651
- let http = new HttpResetClass()
1652
- await http.load('POST', 'rs/logic/saveentity', datas, {resolveMsg: null, rejectMsg: 'search查询部门下所有人失败'})
1653
- for(let i =0;i<this.$refs.service_show.data.fields.length;i++){
1654
- if(this.$refs.service_show.data.fields[i].label == '工料费'||this.$refs.service_show.data.fields[i].label == '延伸服务费'||this.$refs.service_show.data.fields[i].label =='金额'||this.$refs.service_show.data.fields[i].label =='不锈钢波纹管费合计') {
1655
- this.$refs.service_show.data.fields[i].readonly = true
1656
- let httpf = new HttpResetClass()
1657
- let resf = httpf.load('POST','rs/sql/ApplyPaySearch', {data:{condition: ` f_apply_num ='${this.selectdata.f_apply_num}'`}},{resolveMsg: null, rejectMsg: '获取工料费和延伸服务费失败!'})
1658
- if(this.$refs.service_show.datafields[i].label == '工料费'){
1659
- this.$refs.service_show.data.fields[i].value = resf.data[0].f_glf
1660
- }else if(this.$refs.service_show.data.fields[i].label == '延伸服务费'&&!this.$refs.service_show.data.fields[i].value){
1661
- this.$refs.service_show.data.fields[i].value = resf.data[0].f_ysfwf
1662
- }else if(this.selectdata.defname == '点火'&&this.$refs.service_show.data.fields[i].label =='不锈钢波纹管费合计'){
1663
- this.$refs.service_show.data.fields[i].value = resf.data[0].f_dhbxgbwg
1664
- }else if(this.selectdata.defname == '点火申请'&&this.$refs.service_show.data.fields[i].label =='金额'){
1665
- this.$refs.service_show.data.fields[i].value = resf.data[0].f_ysfwf
1666
- }
1667
- }
1668
- }
1669
- },
1670
- // 获取view层button事件/
1671
- async 'button'(model) {
1672
- console.log("button事件接收参数:", model)
1673
- // 点击重置按钮就重置数据
1674
- if (model.button.button_name === '重置') {
1675
- this.refurbish()
1676
- return
1677
- }
1678
-
1679
- if(this.selectdata.defname.includes('开户受理')){
1680
- let httpk = new HttpResetClass()
1681
- let data = {
1682
- tablename: 't_image',
1683
- condition: `f_type = '供气合同' and f_process_id = '${this.selectdata.f_process_id}'`
1684
- }
1685
- let resk = await httpk.load('POST', 'rs/sql/singleTable', {data: data}, {
1686
- resolveMsg: null,
1687
- rejectMsg: "查询供气合同失败,请联系开发人员"
1688
- })
1689
- if(resk.data.length==0){
1690
- this.$showMessage("请上传供气合同")
1691
- this.$refs.service_show.disable_button = false
1692
- return
1693
- }
1694
- }
1695
- // 如果不符合安装条件,就不能提交
1696
- if(model.f_is_gas == '不符合规范要求'){
1697
- this.$showMessage("不符合规范要求无法提交")
1698
- return
1699
- }
1700
-
1701
- var operate = ''
1702
- // 判断当前按钮是否为特殊业务,即子流程提交或者分发
1703
- if (model.button.button_name === '提交' && model.button.button_event && model.button.button_event === '子流程提交') {
1704
- operate = '子流程提交'
1705
- }
1706
- if (model.button.button_name === '提交' && model.button.button_event && model.button.button_event === '签订合同') {
1707
- model.f_budget_money = model.f_contract_money
1708
- model.f_unaccounts_money = model.f_contract_money
1709
- model.f_cumulative_money = 0
1710
- model.f_cumulative_invoicing = 0
1711
- model.f_residual_invoicing = model.f_contract_money
1712
- }
1713
- if (model.button.button_name === '下发') {
1714
- if (this.data.defname === '点火申请') {
1715
- let param={
1716
- dhyid:model.button.button_fields.f_apply_market_employee,
1717
- pdyname:model.f_operator,
1718
- f_process_id: model.f_process_id
1719
- }
1720
- let res = await this.$resetpost('rs/logic/saveHuman',param, {resolveMsg: null, rejectMsg: null})
1721
- console.log('返回的结果',res)
1722
-
1723
- model.f_payment_clerk = res.data.pdyname
1724
- model.f_dispatch_telephone = res.data.pdyphone
1725
- model.f_transfer_person = res.data.dhyname
1726
- model.f_igniter_telephone = res.data.dhyphone
1727
- model.button.button_name = '提交'
1728
- model.button.button_fields={}
1729
- console.log('下发处理为提交')
1730
- }else {
1731
- if (model.button && model.button.button_event === '分发') {
1732
- operate = '分发'
1733
- }
1734
- let person_name = model.button.button_fields[this.show_data.buttons[model.button.button_index].button_fields[0].field]
1735
- for (let i = 0; i < this.department_search.length; i++) {
1736
- // 找到人名为person_name 的人,然后把人名换成id
1737
- if (this.department_search[i].name === person_name) {
1738
- model.button.button_fields[this.show_data.buttons[model.button.button_index].button_fields[0].field] = this.department_search[i].id
1739
- }
1740
- }
1741
- }
1742
- }
1743
- if (model.button.button_name === '提交') {
1744
-
1745
-
1746
- if (this.data.defname === '民用开户受理'||this.data.defname === '工商开户受理'){
1747
- let f_area = {}
1748
- if(this.data.f_area&&this.data.f_area.startsWith('{')){
1749
- f_area = JSON.parse(this.data.f_area)
1750
- }else {
1751
- if(this.data.f_area){
1752
- f_area = this.data.f_area
1753
- }
1754
- }
1755
- let area = ''
1756
- if (f_area.name){
1757
- area =f_area.name
1758
- }
1759
- let f_slice_area = {}
1760
- if(this.data.f_address_town&&this.data.f_address_town.startsWith('{')){
1761
- f_slice_area = JSON.parse(this.data.f_address_town)
1762
- }else {
1763
- if(this.data.f_address_town){
1764
- f_slice_area = this.data.f_address_town
1765
- }
1766
- }
1767
- // let f_slice_area = JSON.parse(this.data.f_address_town)
1768
- let slice_area = ''
1769
- if (f_slice_area.name){
1770
- slice_area =f_slice_area.name
1771
- }
1772
- let f_street = {}
1773
- if(this.data.f_street&&this.data.f_street.startsWith('{')){
1774
- f_street = JSON.parse(this.data.f_street)
1775
- }else {
1776
- if(this.data.f_street){
1777
- f_street = this.data.f_street
1778
- }
1779
- }
1780
- // let f_street = JSON.parse(this.data.f_street)
1781
- let street = ''
1782
- if (f_street.name){
1783
- street =f_street.name
1784
- }
1785
- let f_residential_area = {}
1786
- if(this.data.f_residential_area&&this.data.f_residential_area.startsWith('{')){
1787
- f_residential_area = JSON.parse(this.data.f_residential_area)
1788
- }else {
1789
- if(this.data.f_residential_area){
1790
- f_residential_area = this.data.f_residential_area
1791
- }
1792
- }
1793
- // let f_residential_area = JSON.parse(this.data.f_residential_area)
1794
- let residential_area = ''
1795
- if (f_residential_area.name){
1796
- residential_area =f_residential_area.name
1797
- }else{
1798
- residential_area = f_residential_area
1799
- }
1800
- let param ={
1801
- version:1,
1802
- f_user_state:'正常',
1803
- f_apply_num:this.data.f_apply_num,
1804
- f_address:this.data.f_address,
1805
- f_adjustable_id:this.data.f_adjust_box.split("]")[0].substring(1),
1806
- f_credentials:'身份证',
1807
- f_cost_type:'现金缴费',
1808
- f_paper_type:'国税发票',
1809
- f_idnumber:this.data.f_idnumber,
1810
- f_people_num:this.data.f_population,
1811
- f_user_name:this.data.f_user_name,
1812
- f_user_phone: this.data.f_phone,
1813
- f_gasproperties:this.data.f_gas_type,
1814
- f_area:area,
1815
- f_slice_area:slice_area,
1816
- f_street:street,
1817
- f_unit:this.data.f_unit,
1818
- f_floor:this.data.f_floor,
1819
- f_room:this.data.f_room,
1820
- f_residential_area:residential_area,
1821
- f_building:this.data.f_building,
1822
- f_operator:this.$login.f.name,
1823
- f_filiale:this.$login.f.f_fengongsi,
1824
- f_outlets: this.$login.f.f_parentname,
1825
- f_orgstr: this.$login.f.orgpathstr,
1826
- f_filialeids: this.$login.f.f_orgids,
1827
- f_filialeid: this.$login.f.f_orgids.split('.')[this.$login.f.f_orgids.split('.').length - 2] + '.'
1828
- }
1829
- if(this.selectdata.f_gas_type&&(this.selectdata.f_gas_type.includes('民')||this.selectdata.f_gas_type.includes('公福'))){
1830
- param.f_user_type='民用'
1831
- }else{
1832
- param.f_user_type='非民用'
1833
- }
1834
- http = new HttpResetClass()
1835
- let res = await http.load('POST', 'rs/logic/recordSave', param, {
1836
- resolveMsg: null,
1837
- rejectMsg: "创建户档案失败"
1838
- })
1839
- }
1840
-
1841
- if (this.data.defname === '安装单返回客服'){
1842
- let param ={
1843
- f_meter_brand:this.data.f_meter_brand,
1844
- f_meter_style:this.data.f_meter_style,
1845
- f_apply_num:this.data.f_apply_num,
1846
- f_price_type:this.data.f_price_type,
1847
- f_price_name:this.data.f_price_name,
1848
- f_filiale:this.$login.f.f_fengongsi,
1849
- f_outlets: this.$login.f.f_parentname,
1850
- f_orgstr: this.$login.f.orgpathstr,
1851
- f_install_date: this.$login.toStandardTimeString(),
1852
- f_gas_date: this.$login.toStandardTimeString(),
1853
- f_changetube_date:this.$login.toStandardTimeString(),
1854
- f_meternumber:this.data.f_meter_number,
1855
- f_filialeids: this.$login.f.f_orgids,
1856
- f_operator:this.$login.f.name,
1857
- f_meter_base:this.data.f_meter_base,
1858
- f_gasproperties:this.data.f_gas_type,
1859
- f_aroundmeter:this.data.f_meter_direction,
1860
- f_whether_hairpin:'无卡',
1861
- f_meter_classify:'物联网表',
1862
- f_filialeid: this.$login.f.f_orgids.split('.')[this.$login.f.f_orgids.split('.').length - 2] + '.'
1863
- }
1864
- if(this.selectdata.f_gas_type&&(this.selectdata.f_gas_type.includes('')||this.selectdata.f_gas_type.includes('公福'))){
1865
- param.f_user_type='民用'
1866
- }else{
1867
- param.f_user_type='非民用'
1868
- }
1869
- http = new HttpResetClass()
1870
- let res = await http.load('POST', 'rs/logic/addmeterrecord', param, {
1871
- resolveMsg: null,
1872
- rejectMsg: "创建表档案失败"
1873
- })
1874
- console.log('创建表档案结果:',res)
1875
- }
1876
-
1877
- //资料归档前判断附件是否都上传成功
1878
- if (this.data.defname === '资料归档') {
1879
- let condition = `f_process_id = '${this.data.f_process_id}'`
1880
- let http = new HttpResetClass();
1881
- let res = await http.load('POST', 'rs/sql/getimage', {data: {condition: condition}}, {
1882
- resolveMsg: null,
1883
- rejectMsg: '获取图片路径失败'
1884
- })
1885
- if ((this.selectdata.f_customer_type !== '企业' && res.data.length < 13) || (this.selectdata.f_customer_type === '企业' && res.data.length < 14)) {
1886
- this.$showMessage('有附件未提交,请在“附件”功能中提交')
1887
- this.initializtion()
1888
- return
1889
- }
1890
- }
1891
-
1892
- if (this.data.defname === '点火'){
1893
- //判断选择安装的是否都已经安装
1894
- let selectedList = [];
1895
- for (let j = 0; j < this.data.onetomany.length; j++) {
1896
- if (this.data.onetomany[j].tables[0] === 't_fire_machine') {
1897
- for (let k = 0; k < this.data.onetomany[j].rows.length; k++) {
1898
- selectedList.push(this.data.onetomany[j].rows[k].f_name)
1899
- }
1900
- }
1901
- }
1902
- for (let i = 0; i < this.selectMachine.length; i++) {
1903
- if (this.selectMachine[i] === '波纹管' && selectedList.indexOf('波纹管') === -1) {
1904
- this.$showMessage("请添加已经选择安装的波纹管")
1905
- this.initializtion()
1906
- return
1907
- }
1908
- if (this.selectMachine[i] === '热水器' && selectedList.indexOf('热水器') === -1) {
1909
- this.$showMessage("请添加已经选择安装的热水器")
1910
- this.initializtion()
1911
- return
1912
- }
1913
- if (this.selectMachine[i] === '燃气灶' && selectedList.indexOf('燃气灶') === -1) {
1914
- this.$showMessage("请添加已经选择安装的燃气灶")
1915
- this.initializtion()
1916
- return
1917
- }
1918
- }
1919
-
1920
- let param ={
1921
- f_fire_state:'已点火',
1922
- f_apply_num:this.data.f_apply_num
1923
- }
1924
- http = new HttpResetClass()
1925
- let res = await http.load('POST', 'rs/logic/firemeterrecord', param, {
1926
- resolveMsg: null,
1927
- rejectMsg: "创建表档案失败"
1928
- })
1929
- console.log('创建包档案结果:',res)
1930
- }
1931
- // flag 为合同编号更新标志
1932
- var flag = false
1933
- if (model.f_contract_number) {
1934
- flag = true
1935
- http = new HttpResetClass()
1936
- let data = {
1937
- tablename: 't_singlevalue',
1938
- condition: `name = '合同编号' and f_filialeids = '${this.$login.f.f_orgids}'`
1939
- }
1940
- let res = await http.load('POST', 'rs/sql/singleTable', {data: data}, {
1941
- resolveMsg: null,
1942
- rejectMsg: "获取合同编号失败"
1943
- })
1944
- // if (this.contract != res.data[0].value && !this.selectdata.f_contract_number) {
1945
- // this.$showMessage("合同编号已经被使用,请按F5刷新页面后重新登记")
1946
- // return
1947
- // }
1948
- }
1949
-
1950
- }
1951
-
1952
- console.log('本次点击button执行的操作是=>' + operate)
1953
- model = Object.assign({}, this.selectdata, model)
1954
- let http = new HttpResetClass()
1955
- var url
1956
- var requestData = {
1957
- tables: this.data.tables,
1958
- start_activity: this.$workflow_vue.start_activity,
1959
- model: model,
1960
- loginUser: this.$login.f
1961
- }
1962
- if (operate != '') {
1963
- // 特殊操作走特殊logic业务处理
1964
- url = 'rs/logic/SubprocessService'
1965
- requestData = {
1966
- tables: this.data.tables, model: model
1967
- }
1968
- } else if(model.button.button_name === '提交' && model.button.button_event && model.button.button_event === '分支流程异步合并处理'){
1969
- url = 'rs/logic/branchsyncprocess'
1970
- requestData = {
1971
- tables: this.data.tables, model: model
1972
- }
1973
- } else{
1974
- // 下发,提交,保存,退回通用业务后台处理logic
1975
- console.log('选的什么:', model.f_ischeck)
1976
- if ((model.f_ischeck2 ==='是'&& model.button.button_name == '提交' && this.selectdata.defname == '点火申请')||
1977
- (model.f_ischeck ===''&& model.button.button_name == '提交' && (this.selectdata.defname == '民用开户受理'||this.selectdata.defname == '工商开户受理'))
1978
- ) {
1979
- model.button.button_name ='提交核减'
1980
- }
1981
- console.log('成功没有:',model.button.button_name)
1982
- url = 'rs/logic/ApplyProductService'
1983
- requestData = {
1984
- tables: this.data.tables, model: model
1985
- }
1986
- }
1987
- requestData.start_activity = this.$workflow_vue.start_activity
1988
- requestData.loginUser = this.$login.f
1989
- requestData.workflow_xmlfilename = this.$workflow_vue.workflow_xmlfilename
1990
- console.log('即将发送请求url=>' + url + ',参数=>' + JSON.stringify(requestData))
1991
- let res = res = await http.load('POST', url, {data: requestData}, {resolveMsg: null, rejectMsg: '数据保存失败'})
1992
- console.log("service处理完成返回数据:", JSON.stringify(res.data))
1993
- if (res.data.code == 200) {
1994
- // flag 为合同编号更新标志
1995
- if (flag) {
1996
- let http = new HttpResetClass()
1997
- let data = {
1998
- tablename: 't_singlevalue',
1999
- condition: `name = '合同编号' and f_filialeids = '${this.$login.f.f_orgids}'`,
2000
- value: (Number(this.contract) + 1) + ''
2001
- }
2002
- await http.load('POST', 'rs/logic/updatesinglevalue', {data: data}, {
2003
- resolveMsg: null,
2004
- rejectMsg: "获取合同编号更新失败"
2005
- })
2006
- }
2007
- this.showview = false
2008
- // 特殊处理
2009
- this.special(model)
2010
- this.$dispatch('close')
2011
- this.initializtion()
2012
- } else {
2013
- if (res.data.msg) {
2014
- this.$showMessage(res.data.msg)
2015
- }
2016
- }
2017
- },
2018
- async 'onetomanydelete'(i, j) {
2019
- let http = new HttpResetClass()
2020
- let data = {
2021
- tables: this.show_data.onetomany[i].tables,
2022
- row: this.$refs.service_show.model.rows[i][j]
2023
- }
2024
- await http.load('POST', 'rs/logic/applyDeleteValue', {data: data}, {
2025
- resolveMsg: null,
2026
- rejectMsg: 'onetomanydelete失败'
2027
- }).then(() => {
2028
- this.$dispatch('selfsearch')
2029
- this.$refs.service_show.model.rows[i].splice(j, 1)
2030
- })
2031
- this.initializtion()
2032
- },
2033
- //获取view层confirm事件
2034
- async 'confirm'(tables, row,showadd_index,j) {
2035
- var _this = this
2036
- for (let i = 0; i < tables.length; i++) {
2037
- let datas = {
2038
- tables: tables,
2039
- row: row
2040
- }
2041
- datas.row['f_process_id'] = this.selectdata.f_process_id
2042
- datas.row['f_apply_num'] = this.selectdata.f_apply_num
2043
- datas.row['f_filiale'] = this.selectdata.f_filiale
2044
- let http = new HttpResetClass()
2045
- if (tables[i] == 't_charge_record') {
2046
- await http.load('POST', 'rs/logic/applycharge', datas, {
2047
- resolveMsg: null,
2048
- rejectMsg: '收费保存失败'
2049
- }).then((res) => {
2050
- // 刷新列表数据
2051
- this.$dispatch('selfsearch')
2052
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
2053
-
2054
- if (this.$refs.service_show.data.fields[i].label == '累计缴费金额') {
2055
- this.$refs.service_show.data.fields[i].value = res.data.f_cumulative_money
2056
- }
2057
-
2058
- if (this.$refs.service_show.data.fields[i].label == '未结总金额') {
2059
- this.$refs.service_show.data.fields[i].value = res.data.f_unaccounts_money
2060
- }
2061
- }
2062
- _this.initializtion()
2063
- })
2064
- } else if (tables[i] == 't_batch_fire') {
2065
- console.log('即将要保存的数据:',datas)
2066
- datas.row.f_cash = (datas.row.f_number*datas.row.f_price)
2067
- await http.load('POST', 'rs/logic/saveentity', datas, {
2068
- resolveMsg: null,
2069
- rejectMsg: 'onetomany保存失败'
2070
- }).then((res) => {
2071
- // 刷新列表数据
2072
- this.$dispatch('selfsearch')
2073
- let temp = _this.$refs.service_show.model.rows[showadd_index][j]
2074
- temp.id = res.data.id
2075
- _this.$refs.service_show.model.rows[showadd_index][j] = temp
2076
- _this.initializtion()
2077
- })
2078
- }else {
2079
- await http.load('POST', 'rs/logic/saveentity', datas, {
2080
- resolveMsg: null,
2081
- rejectMsg: 'onetomany保存失败'
2082
- }).then((res) => {
2083
- // 刷新列表数据
2084
- this.$dispatch('selfsearch')
2085
- let temp = _this.$refs.service_show.model.rows[showadd_index][j]
2086
- temp.id = res.data.id
2087
- _this.$refs.service_show.model.rows[showadd_index][j] = temp
2088
- _this.initializtion()
2089
- for(let i =0;i<this.show_data.fields.length;i++){
2090
- if(this.show_data.fields[i].label == '工料费'||this.show_data.fields[i].label == '延伸服务费'||this.show_data.fields[i].label =='金额'||this.show_data.fields[i].label =='不锈钢波纹管费合计') {
2091
- this.show_data.fields[i].readonly = true
2092
- let httpf = new HttpResetClass()
2093
- let resf = httpf.load('POST','rs/sql/ApplyPaySearch', {data:{condition: ` f_apply_num ='${this.selectdata.f_apply_num}'`}},{resolveMsg: null, rejectMsg: '获取工料费和延伸服务费失败!'})
2094
- if(this.show_data.fields[i].label == '工料费'){
2095
- this.show_data.fields[i].value = resf.data[0].f_glf
2096
- }else if(this.data.fields[i].label == '延伸服务费'&&!this.show_data.fields[i].value){
2097
- this.show_data.fields[i].value = resf.data[0].f_ysfwf
2098
- }else if(this.selectdata.defname == '点火'&&this.show_data.fields[i].label =='不锈钢波纹管费合计'){
2099
- this.show_data.fields[i].value = resf.data[0].f_dhbxgbwg
2100
- }else if(this.selectdata.defname == '点火申请'&&this.show_data.fields[i].label =='金额'){
2101
- this.show_data.fields[i].value = resf.data[0].f_ysfwf
2102
- }
2103
- }
2104
- }
2105
- })
2106
- }
2107
- }
2108
-
2109
- }
2110
- }
2111
- }
2112
- </script>
1
+ <template>
2
+ <show-back-reason v-if="selectdata.f_back_reason && selectdata.f_back_reason!=''"
3
+ :data="show_data"></show-back-reason>
4
+ <!--<gas-stop v-if="selectdata.defname == '停气碰口'"></gas-stop>-->
5
+ <material-message v-if="selectdata.defname=='材料导入'||selectdata.defname=='材料审核'" v-ref:material
6
+ :selectdata="selectdata"
7
+ :edit="true"></material-message>
8
+ <batch-item v-if="selectdata.defname=='工商预算审核(技术科科长)'||selectdata.defname=='工商预算审核(分管副总)'||selectdata.defname=='工商预算审核(总经理)'||selectdata.defname=='点火申请'||selectdata.defname=='收费材料费'||
9
+ selectdata.defname=='工商现场勘查'||selectdata.defname=='民用现场勘查'||selectdata.defname=='户内安装'||selectdata.defname=='安装审核'||selectdata.defname=='工程验收'||selectdata.defname=='点火'"
10
+ v-ref:batch_item
11
+ :selectdata="selectdata"
12
+ :edit="true"></batch-item>
13
+
14
+ <receive-batch v-if="selectdata.defname == '派工单'" :selectdata="selectdata"></receive-batch>
15
+ <project-settlement v-if="selectdata.defname == '工程结算'" :selectdata="selectdata"></project-settlement>
16
+ <service-view v-ref:service_show :data="show_data" v-if="showview" :is_show_datacheck="datacheck"></service-view>
17
+ </template>
18
+ <script>
19
+ import Vue from 'vue'
20
+ import {HttpResetClass} from 'vue-client'
21
+ import * as Util from '../../../../Util'
22
+ // import AppData from 'stores/AppData'
23
+ // Date格式化
24
+ Date.prototype.Format = function (fmt) {
25
+ var o = {
26
+ "M+": this.getMonth() + 1, //月份
27
+ "d+": this.getDate(), //日
28
+ "H+": this.getHours(), //小时
29
+ "m+": this.getMinutes(), //分
30
+ "s+": this.getSeconds(), //秒
31
+ "q+": Math.floor((this.getMonth() + 3) / 3), //季度
32
+ "S": this.getMilliseconds() //毫秒
33
+ };
34
+ if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
35
+ for (var k in o)
36
+ if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
37
+ return fmt;
38
+ }
39
+
40
+ export default {
41
+ title: '报建流程业务控制层',
42
+ props: ['selectdata'],
43
+ data() {
44
+ return {
45
+ data: null, // 数据库数据,json配置文件数据的数据集合
46
+ json_datas: null, // Json配置文件集合
47
+ showview: false, // 控制显示service-view组件
48
+ show_data: null, // 给view层显示的数据
49
+ department_search: null, // 当前部门下所有人
50
+ contract: null, // 单值表合同编号记录
51
+ technologist:[], // 技术人员 角色下的人
52
+ price:0,
53
+ jiesuansum:0,
54
+ yusuansum:0,
55
+ numbergongliao:0,
56
+ selectMachine:[]//点火选择安装的机器
57
+ }
58
+ },
59
+ methods: {
60
+ // 特殊化处理
61
+ async special(model) {
62
+ if (model.button.button_name === '提交' && model.button.button_event && model.button.button_event === '分支流程异步处理') {
63
+ // 分支流程异步处理
64
+ let http = new HttpResetClass();
65
+ let res = await http.load('POST', 'rs/logic/branchsyncprocess', {
66
+ data: {
67
+ model: model,
68
+ loginUser: this.$login.f
69
+ }
70
+ }, {resolveMsg: null, rejectMsg: '分支流程异步处理保存失败'})
71
+ console.log("分支流程异步处理:", JSON.stringify(res.data))
72
+ }
73
+ if (this.data.distribute_async && model.button.button_name === '下发') {
74
+ // 同流程节点异步处理
75
+ let http = new HttpResetClass();
76
+ let res = await http.load('POST', 'rs/logic/syncprocess', {
77
+ data: {
78
+ model: model,
79
+ loginUser: this.$login.f
80
+ }
81
+ }, {resolveMsg: null, rejectMsg: '流程异步下发据保存失败'})
82
+ console.log("流程的异步处理:", JSON.stringify(res.data))
83
+ }
84
+ if (this.data.distribute_async && model.button.button_name === '完成') {
85
+ // 强制结束
86
+ let http = new HttpResetClass();
87
+ let res = await http.load('POST', 'rs/logic/stoprocess', {
88
+ data: {
89
+ model: model,
90
+ loginUser: this.$login.f
91
+ }
92
+ }, {resolveMsg: null, rejectMsg: '流程异步完成数据保存失败'})
93
+ console.log("流程的异步处理:", JSON.stringify(res.data))
94
+ }
95
+ },
96
+ // 组件初始化操作
97
+ refurbish(val) {
98
+ this.selectdata = val
99
+ this.json_datas = this.$workflow_vue
100
+ let sum = 0
101
+ let jsonData = {}
102
+ for (let i = 0; i < this.json_datas.activitys.length; i++) {
103
+ if (this.selectdata.defname == this.json_datas.activitys[i].title) {
104
+ jsonData = this.json_datas.activitys[i]
105
+ sum++
106
+ }
107
+ }
108
+ if(jsonData){
109
+ for (let j = 0; j < jsonData.fields.length; j++) {
110
+ jsonData.fields[j].value = ''
111
+ if (jsonData.fields[j].default) {
112
+ // 如果默认值是this.loginUser则,表示是当前登陆人
113
+ if(jsonData.fields[j].default == "this.loginUser"){
114
+ jsonData.fields[j].value = this.$login.f.name
115
+ }else {
116
+ jsonData.fields[j].value = jsonData.fields[j].default
117
+ }
118
+ }
119
+ }
120
+ }
121
+
122
+ if (sum == 1) {
123
+ this.data = null
124
+ this.data = jsonData
125
+ // selectdata 填充 data
126
+ this.data = Object.assign({}, this.data, this.selectdata)
127
+ this.initializtion()
128
+ } else if (sum == 0) {
129
+ this.$showMessage(`没有在JSON配置文件中找到活动名为:(${this.selectdata.defname})的节点配置`)
130
+ } else {
131
+ this.$showMessage(`在JSON配置文件中找到活动名为:(${this.selectdata.defname})的节点配置:${sum}个`)
132
+ }
133
+ },
134
+ // json配置数据处理 比如下拉框的options
135
+ async initializtion() {
136
+ console.log("进入initializtion")
137
+ if(this.show_data&&this.show_data.f_process_id == this.data.f_process_id&&this.show_data.defname==this.selectdata.defname){
138
+ this.data = Object.assign({}, this.data, this.selectdata,this.show_data)
139
+ }
140
+ this.showview = false
141
+ console.log('初始化方法中的this.selectdata=>' + JSON.stringify(this.selectdata))
142
+ console.log('this.$workflow_vue.start_activitys=>' + JSON.stringify(this.$workflow_vue.start_activitys))
143
+ // 下发人 options 处理,options初始化
144
+ let searchParam
145
+ // if (this.selectdata.actorexpression) {
146
+ // console.log('有actorexpression,即将获取下发人员')
147
+ // // let http = new HttpResetClass()
148
+ // // let res = await http.load('POST', 'rs/search', this.selectdata.actorexpression, {
149
+ // // resolveMsg: null,
150
+ // // rejectMsg: 'search查询部门下所有人失败'
151
+ // // })
152
+ // searchParam = this.selectdata.actorexpression
153
+ // }else if(this.selectdata.defname && this.$workflow_vue.start_activitys.indexOf(this.selectdata.defname) >= 0){
154
+ // 如果没有actorexpression,走此特殊的获取部门人员方法
155
+ console.log('当没有actorexpression,走特殊请求获取下发人员')
156
+ let http = new HttpResetClass()
157
+ let source = ''
158
+ for (let i=0; i<this.$workflow_vue.activitys.length; i++){
159
+ if(this.$workflow_vue.activitys[i].title == this.selectdata.defname&&this.$workflow_vue.activitys[i].send_express){
160
+ console.log('匹配到的流程节点表达式=>' + this.$workflow_vue.activitys[i].send_express)
161
+ source = this.$workflow_vue.activitys[i].send_express
162
+ }
163
+ }
164
+ // if(source == ''){
165
+ // this.$showMessage('配置文件不存在' + this.selectdata.defname + '流程环节,请联系系统管理员!')
166
+ // return
167
+ // }
168
+ searchParam = `{"source": ${source},"userid":"${this.$login.f.id}"}`
169
+ // }else{
170
+ // this.$showMessage('不存在角色表达式也不是开始流程节点,如是开始流程节点请检查配置文件,否则请联系系统管理员!')
171
+ // return
172
+ // }
173
+ console.log('即将请求资源服务,请求参数=>'+ searchParam)
174
+ if(source){
175
+ let http = new HttpResetClass()
176
+ let res = await http.load('POST', 'rs/search', searchParam, {
177
+ resolveMsg: null,
178
+ rejectMsg: 'search查询部门下所有人失败'
179
+ })
180
+ console.log("search查询部门下所有人:", JSON.stringify(res.data))
181
+ let jsonString = JSON.stringify(res.data)
182
+ let jsonArray = []
183
+ if (jsonString.startsWith("{")) {
184
+ jsonArray.push(res.data)
185
+ res.data = jsonArray
186
+ }
187
+ this.department_search = res.data
188
+ }
189
+
190
+ // onetomany 数据获取
191
+ if (this.data.onetomany) {
192
+ console.log('判断是onetomany,this.data.onetomany的数据为=>' + JSON.stringify(this.data.onetomany))
193
+ for (let index = 0; index < this.data.onetomany.length; index++) {
194
+ let http = new HttpResetClass()
195
+ let data = {
196
+ tablename: this.data.onetomany[index].tables[0],
197
+ condition: `f_apply_num = '${this.selectdata.f_apply_num}' and f_process_id='${this.selectdata.f_process_id}'`
198
+ }
199
+ let res = await http.load('POST', 'rs/sql/singleTable', {data: data}, {
200
+ resolveMsg: null,
201
+ rejectMsg: 'onetomany查询失败'
202
+ })
203
+ // 初始化 onetomany
204
+ let rows = []
205
+ console.log('查询返回结果res.data=>' + JSON.stringify(res.data))
206
+ this.data.onetomany[index].rows = res.data
207
+ console.log(JSON.stringify('this.data.onetomany[index].rows=>' + JSON.stringify(this.data.onetomany[index].rows)))
208
+
209
+ // 初始化onetomany中的fields
210
+ for(let j =0;j<this.data.onetomany[index].fields.length;j++){
211
+ // 如果配置类型为select,优先从参数列表获取options
212
+ if (this.data.onetomany[index].fields[j].type === 'select') {
213
+ let temp = Vue.$appdata.getParam(this.data.onetomany[index].fields[j].label)
214
+ if (temp && temp.length > 0) {
215
+ this.data.onetomany[index].fields[j].options = Vue.$appdata.getParam(this.data.onetomany[index].fields[j].label)
216
+ }
217
+ }
218
+ }
219
+
220
+ }
221
+ }
222
+ let http1 = new HttpResetClass()
223
+ let condition = ''
224
+ if(this.selectdata.f_gas_type&&(this.selectdata.f_gas_type.includes('民')||this.selectdata.f_gas_type.includes('公福'))){
225
+ condition =`f_user_type = '民用' and f_filiale = '${this.$login.f.f_fengongsi}'
226
+ and f_gasproperties = '${this.data.f_gas_type}'`
227
+ }else{
228
+ condition =`f_user_type = '非民用' and f_filiale = '${this.$login.f.f_fengongsi}'
229
+ and f_gasproperties = '${this.data.f_gas_type}'`
230
+ }
231
+ let res1 = await http1.load('POST', 'rs/logic/getRecordItem', {condition}, {resolveMsg: null, rejectMsg: null})
232
+
233
+ // 初始化 fields
234
+ for (let i = 0; i < this.data.fields.length; i++) {
235
+
236
+ if(this.selectdata.f_adjust_box!=null ){
237
+ if(this.selectdata.f_adjust_box.includes("b") ||this.selectdata.f_adjust_box.length<6 || this.selectdata.f_adjust_box.includes("a"))
238
+ this.selectdata.f_adjust_box="";
239
+ }
240
+ if(this.selectdata.f_connection_way!=null && this.selectdata.f_connection_way.includes("[")){
241
+ this.selectdata.f_connection_way="";
242
+ }
243
+ if(this.selectdata.f_gasinto!=null && this.selectdata.f_gasinto.includes("[")){
244
+ this.selectdata.f_gasinto="";
245
+ }
246
+ if(this.selectdata.f_is_gas!=null && this.selectdata.f_is_gas.includes("[")){
247
+ this.selectdata.f_is_gas="";
248
+ }
249
+ if(this.selectdata.f_pocket_watch!=null && this.selectdata.f_pocket_watch.includes("[")){
250
+ this.selectdata.f_pocket_watch="";
251
+ }
252
+
253
+
254
+ // 如果selectdata有这些key,则把selectdata的value赋值给data的value
255
+ if (this.selectdata[this.data.fields[i].field]) {
256
+ // console.log(JSON.stringify(this.selectdata))
257
+ this.data.fields[i].value = this.selectdata[this.data.fields[i].field]
258
+ }
259
+ if (this.data.fields[i].type === 'select') {
260
+
261
+ // 如果配置类型为select,优先从参数列表获取options
262
+ console.log("appdata值" + Vue.$appdata);
263
+ let temp = Vue.$appdata.getParam(this.data.fields[i].label)
264
+ if (temp && temp.length > 0) {
265
+ this.data.fields[i].options = Vue.$appdata.getParam(this.data.fields[i].label)
266
+ }
267
+ }
268
+ if (this.data.defname === '工商现场勘查'||this.data.defname === '民用现场勘查') {
269
+ for (let i = 0; i < this.data.fields.length; i++) {
270
+ if (this.data.fields[i].label === '预算') {
271
+ this.data.fields[i].value = this.yusuansum
272
+
273
+ }
274
+
275
+ }
276
+
277
+ }
278
+ if (this.data.defname === '户内安装') {
279
+
280
+ for (let i = 0; i < this.data.fields.length; i++) {
281
+ if (this.data.fields[i].label === '结算费用') {
282
+ this.data.fields[i].value = this.jiesuansum
283
+ }
284
+
285
+ if (this.data.fields[i].label === '气价类型') {
286
+ if (!this.data.fields[i].value) {
287
+ console.log('获取的气价类型,',res1)
288
+ let house2 = []
289
+ if (res1.data.pricetype) {
290
+ for (let row of res1.data.pricetype){
291
+ house2.push({label: row.f_price_type,value: row.f_price_type})
292
+ }
293
+ this.data.fields[i].options = house2
294
+ }
295
+ }
296
+ }
297
+ if (this.data.fields[i].label === '燃气表品牌') {
298
+ if (!this.data.fields[i].value) {
299
+ console.log('获取的气价类型,',res1)
300
+ let house2 = []
301
+ if (res1.data.meterbrand) {
302
+ for (let row of res1.data.meterbrand){
303
+ house2.push({label: row.f_meter_brand,value: row.f_meter_brand})
304
+ }
305
+ this.data.fields[i].options = house2
306
+ }
307
+ }
308
+
309
+ }
310
+ //修改: 需求增加一些默认的值
311
+ if (this.data.fields[i].label === '燃气表品牌') {
312
+ this.data.fields[i].value="威星"
313
+ }
314
+ if (this.data.fields[i].label === '燃气表型号') {
315
+ this.data.fields[i].value="G2.5"
316
+ }
317
+ if (this.data.fields[i].label === '表底数') {
318
+ this.data.fields[i].value="0"
319
+ }
320
+ if (this.data.fields[i].label === '用户确认' && this.selectdata.f_user_name!="") {
321
+ this.data.fields[i].value=this.selectdata.f_user_name;
322
+ }
323
+ if (this.data.fields[i].label === '安装项目') {
324
+ this.data.fields[i].value="初装"
325
+ }
326
+ if (this.data.fields[i].label === '压力试验结果') {
327
+ this.data.fields[i].value="合格"
328
+ }
329
+ if (this.data.fields[i].label === '有效期') {
330
+ this.data.fields[i].value="10年"
331
+ }
332
+
333
+ }
334
+
335
+ }
336
+
337
+ // if (this.data.defname === '点火申请') {
338
+ // for (let i = 0; i < this.data.fields.length; i++) {
339
+ // if (this.data.fields[i].label === '工料费') {
340
+ // this.data.fields[i].value = this.price
341
+ // }
342
+ // }
343
+ // }
344
+ if (this.data.defname === '工程结算') {
345
+ var a = 0
346
+ var b = 0
347
+ var c = 0
348
+ for (let i = 0; i < this.data.fields.length; i++) {
349
+ if (this.data.fields[i].label === '最终核算成本金额') {
350
+ this.data.fields[i].value = this.price
351
+ a = this.data.fields[i].value
352
+ }
353
+ if (this.data.fields[i].label === '合同总金额') {
354
+ b = this.data.fields[i].value
355
+ }
356
+ }
357
+ c=b-a
358
+ for (let i = 0; i < this.data.fields.length; i++) {
359
+ if (this.data.fields[i].label === '工程盈利') {
360
+ this.data.fields[i].value = c
361
+ }
362
+ }
363
+ }
364
+
365
+
366
+ if (this.data.defname === '点火') {
367
+ let condition = `processid = '${this.data.f_process_id}'`
368
+ this.$resetpost('rs/sql/getHuman', {data:{condition: condition}}, {resolveMsg: null, rejectMsg: null}).then((res) => {
369
+ console.log('res',res)
370
+ for (let row of res.data){
371
+ if (row.defname ==='收费材料费'){
372
+ console.log('下发来源',row.senderid)
373
+
374
+ }
375
+ }
376
+ console.log('11111111111')
377
+ })
378
+ for (let i = 0; i < this.data.fields.length; i++) {
379
+ if (this.data.fields[i].label === '最终核算成本金额') {
380
+ this.data.fields[i].value = this.price
381
+ a = this.data.fields[i].value
382
+ }
383
+ if (this.data.fields[i].label === '合同总金额') {
384
+ b = this.data.fields[i].value
385
+ }
386
+ }
387
+ c=b-a
388
+ for (let i = 0; i < this.data.fields.length; i++) {
389
+ if (this.data.fields[i].label === '工程盈利') {
390
+ this.data.fields[i].value = c
391
+ }
392
+ }
393
+ }
394
+ // 特殊处理
395
+ //施工环节 如果是个人报建需要提交表具信息
396
+ if (this.data.defname === '施工') {
397
+ for (let i = 0; i < this.data.fields.length; i++) {
398
+ if (this.data.fields[i].label === '气表品牌'
399
+ || this.data.fields[i].label === '气表型号'
400
+ || this.data.fields[i].label === '气表厂家') {
401
+ if (this.data.f_apply_type === '个人报建') {
402
+ this.data.fields[i].hidden = false
403
+ this.data.fields[i].required = true
404
+ }
405
+ }
406
+ }
407
+ }
408
+
409
+
410
+
411
+ //通气环节可以调出施工环节的表信息来修改
412
+ if (this.data.defname === '通气') {
413
+ for (let i = 0; i < this.data.fields.length; i++) {
414
+ if (this.data.fields[i].label === '气表品牌'
415
+ || this.data.fields[i].label === '气表型号'
416
+ || this.data.fields[i].label === '气表厂家') {
417
+ if (this.data.fields[i].value != null && this.data.fields[i].value != '') {
418
+ this.data.fields[i].hidden = false
419
+ this.data.fields[i].required = true
420
+ }
421
+ }
422
+ }
423
+ }
424
+ if(this.data.fields[i].label === '技术人员'){ //{"source":"this.getParentByType($organization$).getChildByName($技术人员$).getChildren()","userid":"296851"}
425
+ let http = new HttpResetClass()
426
+ let res = await http.load('POST', 'rs/search', `{"source":"this.getParentByType($organization$).getChildByName($技术人员$).getChildren()","userid":"${this.$login.f.id}"}`, {
427
+ resolveMsg: null,
428
+ rejectMsg: 'search查询部门下所有人失败'
429
+ })
430
+ console.log("search查询部门下所有人:"+ JSON.stringify(res.data))
431
+ this.technologist = res.data
432
+ if (this.technologist) {
433
+ let array = []
434
+ for (let k = 0; k < this.technologist.length; k++) {
435
+ array.push({label: this.technologist[k].name, value: this.technologist[k].name})
436
+ }
437
+ this.data.fields[i].options = array
438
+ }
439
+ }
440
+ //初始化调压箱
441
+ if(this.data.fields[i].label == '调压箱'){
442
+ let arr = []
443
+ let filter = this.$login.f.f_orgids
444
+ this.$ApplyGetSaleParam.getAdjustable(filter).forEach((item) => {
445
+ let temp = {}
446
+ temp.label = `[${item.value.f_adjustable_id}]-${item.label}`
447
+ temp.value = `[${item.value.f_adjustable_id}]-${item.value.f_adjustable_name}`
448
+ arr.push(temp)
449
+ })
450
+ let adjustables = [{label: '全部', value: ''}, ...arr]
451
+ this.data.fields[i].options = adjustables;
452
+ let res = await http.load('POST','rs/logic/getCommonAdjustBox', {data: {"f_building_id":this.data.f_building,"f_residential_area":this.data.f_residential_area}},{resolveMsg: null, rejectMsg: '获取区县失败!'})
453
+
454
+ if(res.data.code == 1){
455
+ this.$ApplyGetSaleParam.getAdjustable(filter).forEach((item) => {
456
+ console.log(item.value.f_adjustable_id)
457
+ if(item.value.f_adjustable_id ==res.data.result[0].f_building_id){
458
+ this.data.fields[i].value = `[${item.value.f_adjustable_id}]-${item.value.f_adjustable_name}`;
459
+ }
460
+ })
461
+ }
462
+
463
+ // console.log(this.data.f_building);
464
+ }
465
+
466
+ if (this.data.fields[i].label == '县/区') {
467
+ let loc = this.$login.f.f_orgids.split('.')
468
+ // 获取区县
469
+ console.log('初始化查询区县')
470
+ let condition = `f_area is not null or f_area!=''`
471
+ let http = new HttpResetClass()
472
+ let res = await http.load('POST','rs/sql/singleTable_Final', {data: {items: 'f_area f_name',tablename: 't_user_address',orderitem: 'f_area',groupitem:'f_area',condition: condition}},{resolveMsg: null, rejectMsg: '获取区县失败!'})
473
+ let areas = []
474
+ res.data.forEach((row)=>{
475
+ areas.push({label:row.f_name, value:row.f_name})
476
+ })
477
+ this.data.fields[i].options = areas
478
+ }
479
+ if ((
480
+ this.data.fields[i].label === '工料费' ||
481
+ this.data.fields[i].label === '延伸服务费' ||
482
+ this.data.fields[i].label === '其他费用' ||
483
+ this.data.fields[i].label === '金额')&&this.selectdata.defname !='点火申请'
484
+ ) {
485
+ console.log('即将计算合同金额')
486
+ let a = 0
487
+ let b = 0
488
+ let c = 0
489
+ for (let i = 0; i < this.data.fields.length; i++) {
490
+ // 控制设置级联
491
+ // 源select所选的值 this.$refs.service_show.data.activitys.fields[index].value
492
+ // xxx xx xxx
493
+ if (this.data.fields[i].label === '工料费' && this.data.fields[i].value) {
494
+ a = this.data.fields[i].value
495
+ }
496
+ if (this.data.fields[i].label === '延伸服务费' && !this.data.fields[i].value) {
497
+ b = this.data.fields[i].value
498
+ }
499
+ if (this.data.fields[i].label === '其他费用' && this.data.fields[i].value) {
500
+ c = this.data.fields[i].value
501
+ }
502
+ }
503
+ let d =0
504
+ d= parseInt(b) + parseInt(c)
505
+ // 数据计算完毕得到尾款
506
+ for (let i = 0; i < this.data.fields.length; i++) {
507
+ if (this.data.fields[i].label === '金额') {
508
+
509
+ this.data.fields[i].value = d
510
+
511
+ }
512
+
513
+ }
514
+ }
515
+
516
+ if(this.data.fields[i].label == '工料费'||this.data.fields[i].label == '延伸服务费'||this.data.fields[i].label =='金额'||this.data.fields[i].label =='不锈钢波纹管费合计') {
517
+ this.data.fields[i].readonly = true
518
+ let httpf = new HttpResetClass()
519
+ let resf = await httpf.load('POST','rs/sql/ApplyPaySearch', {data:{condition: ` f_apply_num ='${this.selectdata.f_apply_num}'`}},{resolveMsg: null, rejectMsg: '获取工料费和延伸服务费失败!'})
520
+ if(this.data.fields[i].label == '工料费'){
521
+ this.data.fields[i].value = resf.data[0].f_glf
522
+ }else if(this.data.fields[i].label == '延伸服务费'&&!this.data.fields[i].value){
523
+ this.data.fields[i].value = resf.data[0].f_ysfwf
524
+ }else if(this.selectdata.defname == '点火'&&this.data.fields[i].label =='不锈钢波纹管费合计'){
525
+ this.data.fields[i].value = resf.data[0].f_dhbxgbwg
526
+ }else if(this.selectdata.defname == '点火申请'&&this.data.fields[i].label =='金额'){
527
+ this.data.fields[i].value = resf.data[0].f_ysfwf
528
+ }
529
+ }
530
+
531
+ if (this.data.fields[i].label == '燃气表品牌') {
532
+ console.log('获取燃气表品牌。。。。。' ,this.$ApplyGetSaleParam.gasbrands)
533
+ let rs = []
534
+ for (let i = 0; i < this.$ApplyGetSaleParam.gasbrands.length; i++) {
535
+ let temp = {
536
+ label: this.$ApplyGetSaleParam.gasbrands[i].label,
537
+ value: this.$ApplyGetSaleParam.gasbrands[i].label
538
+ }
539
+ rs.push(temp)
540
+ }
541
+ this.data.fields[i].options = [{label: '全部', value: ''}, ...rs]
542
+ }
543
+
544
+ if (this.data.fields[i].label == '合同类型') {
545
+ this.data.fields[i].value == '主合同'
546
+ }
547
+
548
+ if (this.data.fields[i].label == '合同编号' && !this.selectdata[this.data.fields[i].field]) {
549
+ if (!this.$appdata.getSingleValue(this.data.fields[i].label)) {
550
+ this.$showMessage(`请先去参数管理设置: ${this.data.fields[i].label}`)
551
+ } else {
552
+ this.$appdata.load()
553
+ let temp = this.$appdata.getSingleValue(this.data.fields[i].label)
554
+ this.contract = temp
555
+ while (temp.length < 4) {
556
+ temp = '0' + temp
557
+ }
558
+ let dt = new Date()
559
+ this.data.fields[i].value = dt.getFullYear() + ((dt.getMonth() + 1) < 10 ? '0' + (dt.getMonth() + 1) : dt.getMonth()) + temp
560
+ }
561
+ }
562
+ }
563
+ // 初始化 buttons_fields
564
+ for (let i = 0; i < this.data.buttons.length; i++) {
565
+ if (this.data.buttons[i].button_fields) {
566
+ for (let j = 0; j < this.data.buttons[i].button_fields.length; j++) {
567
+ // 如果selectdata有这些key,则把selectdata的value赋值给data的value
568
+ if (this.selectdata[this.data.buttons[i].button_fields[j].field]) {
569
+ this.data.buttons[i].button_fields[j].value = this.selectdata[this.data.buttons[i].button_fields[j].field]
570
+ }
571
+ // 如果配置类型为select,优先从参数列表获取options
572
+ if (this.data.buttons[i].button_fields[j].type === 'select' && this.$appdata.getParam(this.data.buttons[i].button_fields[j].label)) {
573
+ this.data.buttons[i].button_fields[j].options = this.$appdata.getParam(this.data.buttons[i].button_fields[j].label).trim()
574
+ }
575
+ // 下发特殊配置
576
+ if (this.data.buttons[i].button_name === '下发') {
577
+ if (this.data.buttons[i].button_fields.length === 1) {
578
+ // value初始化
579
+ // if(this.department_search){
580
+
581
+ if (this.selectdata[this.data.buttons[i].button_fields[0].field]) {
582
+ let flag = true
583
+ for (let k = 0; k < this.department_search.length; k++) {
584
+ // 将id转换为name
585
+ if (Number(this.department_search[k].id) === Number(this.selectdata[this.data.buttons[i].button_fields[0].field])) {
586
+ this.data.buttons[i].button_fields[0].value = this.department_search[k].name
587
+ flag = false
588
+ }
589
+ }
590
+ if(flag){
591
+ this.data.buttons[i].button_fields[0].value = this.department_search[0].name
592
+ }
593
+ }
594
+
595
+
596
+ if (this.department_search) {
597
+ let array = []
598
+ for (let k = 0; k < this.department_search.length; k++) {
599
+ array.push({label: this.department_search[k].name, value: this.department_search[k].name})
600
+ }
601
+ this.data.buttons[i].button_fields[0].options = array
602
+ }
603
+ } else {
604
+ this.$showMessage("下发按钮必须满足 当且仅当一个字段")
605
+ }
606
+ }
607
+ }
608
+ }
609
+
610
+ }
611
+ if (this.data.onetomany) {
612
+ for (let i = 0; i < this.data.onetomany.length; i++) {
613
+ if (this.data.onetomany[i].tables[0]==='t_fire_material'){
614
+ console.log('1111111')
615
+ for (let j = 0; j < this.data.onetomany[i].fields.length; j++) {
616
+ if (this.data.onetomany[i].fields[j].label==='材料名称'){
617
+ console.log('2222222')
618
+ let http = new HttpResetClass()
619
+ let res = await http.load('POST','rs/logic/getMaterialItem', {data: {condition: `1=1 and f_use_type='点火用材料'`}},{resolveMsg: null, rejectMsg: '获取材料失败!'})
620
+ let house = []
621
+ for (let row of res.data.material){
622
+ house.push({label: row.f_name,value: row.f_name})
623
+ }
624
+ this.data.onetomany[i].fields[j].options = house
625
+ console.log('3333333')
626
+ }
627
+ }
628
+ }
629
+ }
630
+ }
631
+
632
+ // 消除双向绑定,避免子组件(显示层)数据更改,父组件(控制层)也更改
633
+ let temp = JSON.parse(JSON.stringify(this.data))
634
+ // 退回原因展示
635
+ if (this.selectdata.f_back_reason) {
636
+ temp['back_reason'] = this.selectdata.f_back_reason
637
+ }
638
+ this.show_data = temp
639
+ console.log('1242315235')
640
+ // this.$nextTick(()=>{
641
+ this.showview = true
642
+ // })
643
+ }
644
+ },
645
+ events: {
646
+ 'get-price' (val,type) {
647
+ if(type =='预算'){
648
+ this.yusuansum = val
649
+ if(this.show_data&&this.show_data.fields){
650
+ for (let i = 0; i < this.show_data.fields.length; i++) {
651
+ if (this.show_data.fields[i].label === '预算') {
652
+ this.show_data.fields[i].value = this.yusuansum
653
+ }
654
+ }
655
+ }
656
+
657
+ }else if(type =='结算'){
658
+ this.jiesuansum = val
659
+ if(this.show_data&&this.show_data.fields) {
660
+ for (let i = 0; i < this.show_data.fields.length; i++) {
661
+ if (this.show_data.fields[i].label === '结算费用') {
662
+ this.show_data.fields[i].value = this.jiesuansum
663
+ }
664
+ }
665
+ }
666
+ }else{
667
+ this.price = val
668
+ }
669
+
670
+ this.initializtion()
671
+ },
672
+ 'get-numbergongliao' (val) {
673
+ this.numbergongliao = val
674
+ this.initializtion()
675
+ },
676
+ // 任意select选中时触发事件,关联性操作
677
+ async 'select_cascade'(index) {
678
+ console.log('触发了')
679
+ // this.$refs.service_show.data // 子业务显示组件
680
+ // 级联操作示例:
681
+ /*
682
+ if(this.$refs.service_show.data.fields[index].label==='报建类型'){
683
+ for(let i=0;i<this.$refs.service_show.data.fields.length;i++){
684
+ // 控制设置级联
685
+ // 源select所选的值 this.$refs.service_show.data.fields[index].value
686
+ if(this.$refs.service_show.data.fields[i].label==='级联测试2'){
687
+ this.$refs.service_show.data.fields[i].options=[
688
+ {label:'级联选项1',value:'级联选项1'},{label:'级联选项2',value:'级联选项2'},{label:'级联选项3',value:'级联选项3'}
689
+ ]
690
+ }
691
+ }
692
+ }
693
+ */
694
+ //燃气表号 位数 和 重复判断
695
+ if(this.$refs.service_show.data.fields[index].label === '燃气表表号'){
696
+ //位数校验
697
+ let array = Vue.$appdata.getParam(this.$refs.service_show.data.fields[index].label+'位数校验')
698
+ let flag = true
699
+ for(let f=0;f<array.length;f++){
700
+ if(this.$refs.service_show.data.fields[index].value&&this.$refs.service_show.data.fields[index].value.length == Number(array[f].value)){
701
+ flag = false
702
+ }
703
+ }
704
+ if(flag&&this.$refs.service_show.data.fields[index].value&&this.$refs.service_show.data.fields[index].value.length>0){
705
+ this.$showMessage("表号位数不对,请重新录入")
706
+ this.$refs.service_show.data.fields[index].value = null
707
+ }else if(this.$refs.service_show.data.fields[index].value&&this.$refs.service_show.data.fields[index].value.length>0){
708
+ // 重复校验
709
+ let httpfd = new HttpResetClass()
710
+ let data = {
711
+ items:'f_meternumber',
712
+ tablename: ' t_userinfo ui left join t_userfiles uf on ui.f_userinfo_id = uf.f_userinfo_id ',
713
+ condition: `ui.f_user_state ='正常' and uf.f_meternumber = '${this.$refs.service_show.data.fields[index].value}' and ui.f_apply_num != '${this.selectdata.f_apply_num}'`
714
+ }
715
+ let res = await httpfd.load('POST', 'rs/sql/singleTableApply', {data: data}, {
716
+ resolveMsg: null,
717
+ rejectMsg: null
718
+ })
719
+ if(res.data.length>0){
720
+ this.$showMessage("表号已经被使用,请查证后再输入")
721
+ this.$refs.service_show.data.fields[index].value = null
722
+ }
723
+ }
724
+ }
725
+
726
+ if (
727
+ this.$refs.service_show.data.fields[index].label === '最终核算成本金额' ||
728
+ this.$refs.service_show.data.fields[index].label === '合同总金额' ||
729
+ this.$refs.service_show.data.fields[index].label === '工程盈利'
730
+ ) {
731
+
732
+ var a=0
733
+ var b=0
734
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
735
+ // 控制设置级联
736
+ // 源select所选的值 this.$refs.service_show.data.activitys.fields[index].value
737
+ // xxx xx xxx
738
+ if (this.$refs.service_show.data.fields[i].label === '最终核算成本金额' ) {
739
+ this.$refs.service_show.data.fields[i].value = this.price
740
+ a=this.$refs.service_show.data.fields[i].value
741
+ }
742
+
743
+ if (this.$refs.service_show.data.fields[i].label === '合同总金额' && this.$refs.service_show.data.fields[i].value) {
744
+ b = this.$refs.service_show.data.fields[i].value
745
+ }
746
+ }
747
+ var c =b - a
748
+ // 数据计算完毕得到工程结余
749
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
750
+ if (this.$refs.service_show.data.fields[i].label === '工程盈利') {
751
+ this.$refs.service_show.data.fields[i].value = c
752
+ }
753
+ }
754
+ }
755
+
756
+
757
+
758
+
759
+ if (
760
+ this.$refs.service_show.data.fields[index].label === '发票号'
761
+ ) {
762
+ let data = {
763
+ condition: 'c.f_process_id=' + '\'' + this.selectdata.f_process_id + '\' and a.f_brand_spec =\'建安费\''
764
+ }
765
+ let http = new HttpResetClass()
766
+ let res = await http.load('POST', 'rs/sql/getInvoice', {data: data}, {
767
+ resolveMsg: null,
768
+ rejectMsg: null
769
+ })
770
+ console.log('查询到的发票号:',res)
771
+ // 数据计算完毕得到工程结余
772
+
773
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
774
+ if (this.$refs.service_show.data.fields[i].label === '发票号') {
775
+ if (!this.$refs.service_show.data.fields[i].value){
776
+ if (res.data.length>0){
777
+ this.$refs.service_show.data.fields[i].value = res.data[0].f_invoice_number
778
+ }else {
779
+ this.$showMessage('当前流程无收费记录,无法获取发票号')
780
+ }
781
+ }
782
+ }
783
+ }
784
+ }
785
+
786
+ if (
787
+ this.$refs.service_show.data.fields[index].label === '工料费发票号'
788
+ ) {
789
+ let data = {
790
+ condition: 'c.f_process_id=' + '\'' + this.selectdata.f_process_id + '\' and a.f_brand_spec =\'工料费\''
791
+ }
792
+ let http = new HttpResetClass()
793
+ let res = await http.load('POST', 'rs/sql/getInvoice', {data: data}, {
794
+ resolveMsg: null,
795
+ rejectMsg: null
796
+ })
797
+ console.log('查询到的发票号:',res)
798
+ // 数据计算完毕得到工程结余
799
+
800
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
801
+ if (this.$refs.service_show.data.fields[i].label === '工料费发票号') {
802
+ if (!this.$refs.service_show.data.fields[i].value){
803
+ if (res.data.length>0){
804
+ this.$refs.service_show.data.fields[i].value = res.data[0].f_invoice_number
805
+ }else {
806
+ this.$showMessage('当前流程无维修费收费记录,无法获取工料费发票号')
807
+ }
808
+ }
809
+ }
810
+ }
811
+ }
812
+ if (
813
+ this.$refs.service_show.data.fields[index].label === '延伸服务费发票号'
814
+ ) {
815
+ let data = {
816
+ condition: 'c.f_process_id=' + '\'' + this.selectdata.f_process_id + '\' and a.f_brand_spec =\'延伸服务费\''
817
+ }
818
+ let http = new HttpResetClass()
819
+ let res = await http.load('POST', 'rs/sql/getInvoice', {data: data}, {
820
+ resolveMsg: null,
821
+ rejectMsg: null
822
+ })
823
+ console.log('查询到的发票号:',res)
824
+ // 数据计算完毕得到工程结余
825
+
826
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
827
+ if (this.$refs.service_show.data.fields[i].label === '延伸服务费发票号') {
828
+ if (!this.$refs.service_show.data.fields[i].value){
829
+ if (res.data.length>0){
830
+ this.$refs.service_show.data.fields[i].value = res.data[0].f_invoice_number
831
+ }else {
832
+ this.$showMessage('当前流程无服务费收费记录,无法获取延伸服务费发票号')
833
+ }
834
+ }
835
+ }
836
+ }
837
+ }
838
+
839
+ if (
840
+ this.$refs.service_show.data.fields[index].label === '材料费发票号'
841
+ ) {
842
+ let data = {
843
+ condition: 'c.f_process_id=' + '\'' + this.selectdata.f_process_id + '\' and a.f_brand_spec =\'材料费\''
844
+ }
845
+ let http = new HttpResetClass()
846
+ let res = await http.load('POST', 'rs/sql/getInvoice', {data: data}, {
847
+ resolveMsg: null,
848
+ rejectMsg: null
849
+ })
850
+ console.log('查询到的发票号:',res)
851
+ // 数据计算完毕得到工程结余
852
+
853
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
854
+ if (this.$refs.service_show.data.fields[i].label === '材料费发票号') {
855
+ if (!this.$refs.service_show.data.fields[i].value){
856
+ if (res.data.length>0){
857
+ this.$refs.service_show.data.fields[i].value = res.data[0].f_invoice_number
858
+ }else {
859
+ this.$showMessage('当前流程无材料费收费记录,无法获取材料费发票号')
860
+ }
861
+ }
862
+ }
863
+ }
864
+ }
865
+ if (this.$refs.service_show.data.fields[index].label === '气价类型') {
866
+ let pricetype=this.$refs.service_show.data.fields[index].value
867
+ let http = new HttpResetClass()
868
+ let condition = ''
869
+ if(this.selectdata.f_gas_type&&(this.selectdata.f_gas_type.includes('民')||this.selectdata.f_gas_type.includes('公福'))){
870
+ condition =`f_user_type = '民用' and f_filiale = '${this.$login.f.f_fengongsi}'
871
+ and f_gasproperties = '${this.data.f_gas_type}' and f_price_type = '${pricetype}'`
872
+ }else{
873
+ condition =`f_user_type = '非民用' and f_filiale = '${this.$login.f.f_fengongsi}'
874
+ and f_gasproperties = '${this.data.f_gas_type}' and f_price_type = '${pricetype}'`
875
+ }
876
+ // let condition =`f_user_type = '民用' and f_filiale = '${this.$login.f.f_fengongsi}'
877
+ // and f_gasproperties = '${this.data.f_gas_type}' and f_price_type = '${pricetype}'`
878
+ let res = await http.load('POST', 'rs/logic/getRecordItem', {condition}, {resolveMsg: null, rejectMsg: null})
879
+ console.log('获取的气价类型,',res)
880
+ let house2 = []
881
+ if (res.data.pricename) {
882
+ for (let row of res.data.pricename){
883
+ house2.push({label: row.f_price_name,value: row.f_price_name})
884
+ }
885
+ }
886
+
887
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
888
+ if (this.$refs.service_show.data.fields[i].label === '气价名称') {
889
+ this.$refs.service_show.data.fields[i].options= house2
890
+ }
891
+ }
892
+
893
+ }
894
+
895
+
896
+ if (this.$refs.service_show.data.fields[index].label === '燃气表品牌') {
897
+ let pricetype=this.$refs.service_show.data.fields[index].value
898
+ let http = new HttpResetClass()
899
+ let res = await http.load('POST', 'rs/logic/getMeterStyle', {data:{f_meter_brand :pricetype}}, {resolveMsg: null, rejectMsg: null})
900
+ console.log('获取的气价类型,',res)
901
+ let house2 = []
902
+ if (res.data) {
903
+ for (let row of res.data){
904
+ house2.push({label: row.f_meter_style,value: row.f_meter_style})
905
+ }
906
+ }
907
+
908
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
909
+ if (this.$refs.service_show.data.fields[i].label === '燃气表型号') {
910
+ this.$refs.service_show.data.fields[i].options= house2
911
+ }
912
+ }
913
+
914
+ }
915
+ if (
916
+ this.$refs.service_show.data.fields[index].label === '身份证号码'
917
+ ) {
918
+ if(this.$refs.service_show.data.fields[index].value.length!=18){
919
+ this.$showMessage('身份证位数不是18位,请重新输入')
920
+ this.$refs.service_show.data.fields[index].value = ''
921
+ }
922
+ }
923
+
924
+ if (
925
+ this.$refs.service_show.data.fields[index].label === '其他费用发票号'
926
+ ) {
927
+ let data = {
928
+ condition: 'c.f_process_id=' + '\'' + this.selectdata.f_process_id + '\' and a.f_brand_spec =\'其他费用\''
929
+ }
930
+ let http = new HttpResetClass()
931
+ let res = await http.load('POST', 'rs/sql/getInvoice', {data: data}, {
932
+ resolveMsg: null,
933
+ rejectMsg: null
934
+ })
935
+ console.log('查询到的发票号:',res)
936
+ // 数据计算完毕得到工程结余
937
+
938
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
939
+ if (this.$refs.service_show.data.fields[i].label === '其他费用发票号') {
940
+ if (!this.$refs.service_show.data.fields[i].value){
941
+ if (res.data.length>0){
942
+ this.$refs.service_show.data.fields[i].value = res.data[0].f_invoice_number
943
+ }else {
944
+ this.$showMessage('当前流程无其他费用收费记录,无法获取其他费用发票号')
945
+ }
946
+ }
947
+ }
948
+ }
949
+ }
950
+
951
+
952
+ if (this.$refs.service_show.showadd_fields && this.$refs.service_show.showadd_fields.length > 0 && this.$refs.service_show.showadd_fields[index].label === '收费金额') {
953
+ let chargeMoney = this.$refs.service_show.showadd_fields[index].value
954
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
955
+ if (this.$refs.service_show.data.fields[i].label === '未结总金额') {
956
+ let cumulativeMoney = this.$refs.service_show.data.fields[i].value
957
+ if (Number(chargeMoney) > Number(cumulativeMoney)) {
958
+ this.$showMessage("收费金额不得大于未结总金额!")
959
+ this.$refs.service_show.showadd_fields[index].value = null
960
+ return
961
+ } else {
962
+
963
+ }
964
+ }
965
+ }
966
+ }
967
+
968
+ //根据合同预算金额和累计缴费金额计算未结金额
969
+ if (this.$refs.service_show.data.fields[index]&&this.$refs.service_show.data.fields[index].label === '累计缴费金额') {
970
+ let cumulativeMoney = this.$refs.service_show.data.fields[index].value
971
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
972
+ if (this.$refs.service_show.data.fields[i].label === '未结总金额') {
973
+ this.$refs.service_show.data.fields[i].value = Number(this.selectdata.f_contract_total_money) - Number(cumulativeMoney)
974
+ }
975
+ }
976
+ }
977
+ //根据合同预算金额和累计开票金额计算未开票金额
978
+ if (this.$refs.service_show.data.fields[index].label === '累计开票金额') {
979
+ let residualInvoicing = this.$refs.service_show.data.fields[index].value
980
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
981
+ if (this.$refs.service_show.data.fields[i].label === '未开票金额') {
982
+ this.$refs.service_show.data.fields[i].value = Number(this.selectdata.f_contract_total_money) - Number(residualInvoicing)
983
+ }
984
+ }
985
+ }
986
+ //如果资料验收是否通过和工程验收是否通过为否的时候弹出原因填写框
987
+ if (this.$refs.service_show.data.fields[index].label === '资料验收是否通过') {
988
+ let res = this.$refs.service_show.data.fields[index].value
989
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
990
+ if (this.$refs.service_show.data.fields[i].label === '资料验收不通过原因') {
991
+ if (res === '否') {
992
+ this.$refs.service_show.data.fields[i].hidden = false
993
+ this.$refs.service_show.data.fields[i].required = true
994
+ } else {
995
+ this.$refs.service_show.data.fields[i].hidden = true
996
+ this.$refs.service_show.data.fields[i].required = false
997
+ }
998
+ }
999
+ }
1000
+ }
1001
+ if (this.$refs.service_show.data.fields[index].label === '工程验收是否通过') {
1002
+ let res = this.$refs.service_show.data.fields[index].value
1003
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1004
+ if (this.$refs.service_show.data.fields[i].label === '工程验收不通过原因') {
1005
+ if (res === '否') {
1006
+ this.$refs.service_show.data.fields[i].hidden = false
1007
+ this.$refs.service_show.data.fields[i].required = true
1008
+ } else {
1009
+ this.$refs.service_show.data.fields[i].hidden = true
1010
+ this.$refs.service_show.data.fields[i].required = false
1011
+ }
1012
+ }
1013
+ }
1014
+ }
1015
+ //根据总户数和实际安装户数计算未安装户数
1016
+ if (this.$refs.service_show.data.fields[index].label === '实际安装户数') {
1017
+ let value = this.$refs.service_show.data.fields[index].value
1018
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1019
+ if (this.$refs.service_show.data.fields[i].label === '未安装户数') {
1020
+ this.$refs.service_show.data.fields[i].label === '未安装户数'
1021
+ this.$refs.service_show.data.fields[i].value = Number(this.selectdata.f_install_num) - Number(value)
1022
+ }
1023
+ }
1024
+ }
1025
+
1026
+ if (this.$refs.service_show.data.fields[index].label === '已收费') {
1027
+ let value = this.$refs.service_show.data.fields[index].value
1028
+ if (value ==='是'){
1029
+ for (let i = 0; i < this.$refs.service_show.data.buttons.length; i++) {
1030
+ if (this.$refs.service_show.data.buttons[i].button_name ==='提交'){
1031
+ console.log('已收费111')
1032
+ this.$refs.service_show.data.buttons[i].disabled=false
1033
+ }
1034
+ }
1035
+ }
1036
+ if (value ==='否'){
1037
+ for (let i = 0; i < this.$refs.service_show.data.buttons.length; i++) {
1038
+ if (this.$refs.service_show.data.buttons[i].button_name ==='提交'){
1039
+ console.log('已收费12222')
1040
+ this.$refs.service_show.data.buttons[i].disabled=true
1041
+ }
1042
+ }
1043
+ }
1044
+ }
1045
+
1046
+ if (this.$refs.service_show.data.fields[index].label === '燃气表品牌') {
1047
+ let temp = this.$refs.service_show.data.fields[index].value
1048
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1049
+ // 控制设置级联
1050
+ // 源select所选的值 this.$refs.service_show.data.activitys.fields[index].value
1051
+ if (this.$refs.service_show.data.fields[i].label === '生产厂家') {
1052
+ this.$refs.service_show.data.fields[i].value = ''
1053
+ this.$refs.service_show.data.fields[i].options = []
1054
+ let rs = []
1055
+ console.log('小区片区。。。', temp)
1056
+ for (let j = 0; j < this.$ApplyGetSaleParam.gasbrands.length; j++) {
1057
+ if (this.$ApplyGetSaleParam.gasbrands[j].label === temp) {
1058
+ let temp = {
1059
+ label: this.$ApplyGetSaleParam.gasbrands[j].value.f_manufacturers,
1060
+ value: this.$ApplyGetSaleParam.gasbrands[j].value.f_manufacturers
1061
+ }
1062
+ rs.push(temp)
1063
+ }
1064
+ }
1065
+ console.log('获取小区片区=>' + JSON.stringify(rs))
1066
+ this.$refs.service_show.data.fields[i].options = [{label: '全部', value: ''}, ...rs]
1067
+ this.$refs.service_show.update()
1068
+ }
1069
+ if (this.$refs.service_show.data.fields[i].label === '燃气表类型') {
1070
+ this.$refs.service_show.data.fields[i].value = ''
1071
+ this.$refs.service_show.data.fields[i].options = []
1072
+ let rs = []
1073
+ console.log('燃气表品牌。。。', temp)
1074
+ for (let j = 0; j < this.$ApplyGetSaleParam.gasbrands.length; j++) {
1075
+ if (this.$ApplyGetSaleParam.gasbrands[j].label === temp) {
1076
+ let temp = {
1077
+ label: this.$ApplyGetSaleParam.gasbrands[j].value.f_meter_type,
1078
+ value: this.$ApplyGetSaleParam.gasbrands[j].value.f_meter_type
1079
+ }
1080
+ rs.push(temp)
1081
+ }
1082
+ }
1083
+ console.log('获取小区片区=>' + JSON.stringify(rs))
1084
+ this.$refs.service_show.data.fields[i].options = [{label: '全部', value: ''}, ...rs]
1085
+ this.$refs.service_show.update()
1086
+ }
1087
+ }
1088
+ }
1089
+
1090
+
1091
+ if (this.$refs.service_show.data.fields[index].label === '县/区') {
1092
+ let temp = this.$refs.service_show.data.fields[index].value
1093
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1094
+ // 控制设置级联
1095
+ // 源select所选的值 this.$refs.service_show.data.activitys.fields[index].value
1096
+ if (this.$refs.service_show.data.fields[i].label === '乡镇') {
1097
+ this.$refs.service_show.data.fields[i].value = ''
1098
+ this.$refs.service_show.data.fields[i].options = []
1099
+ let rs = []
1100
+ console.log('县/区。。。', temp)
1101
+ // for (let j = 0; j < this.$login.f.f_allArea.length; j++) {
1102
+ // if (this.$login.f.f_allArea[j].label === temp) {
1103
+ // rs = this.$login.f.f_allArea[j].value
1104
+ // }
1105
+ // }
1106
+ let condition = `f_area = '${temp}' and (f_slice_area is not null or f_slice_area!='')`
1107
+ let http = new HttpResetClass()
1108
+ let res = await http.load('POST','rs/sql/singleTable_Final', {data: {items: 'f_slice_area f_name',tablename: 't_user_address',orderitem: 'f_slice_area',groupitem:'f_slice_area',condition: condition}},{resolveMsg: null, rejectMsg: '获取乡镇失败!'})
1109
+ let areas = []
1110
+ res.data.forEach((row)=>{
1111
+ areas.push({label:row.f_name, value:row.f_name})
1112
+ })
1113
+ console.log('获取乡镇=>' + JSON.stringify(areas))
1114
+ this.$refs.service_show.data.fields[i].options = areas
1115
+ this.$refs.service_show.update()
1116
+ }
1117
+ }
1118
+ }
1119
+
1120
+ if (this.$refs.service_show.data.fields[index].label === '乡镇') {
1121
+ let temp = this.$refs.service_show.data.fields[index].value
1122
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1123
+ // 控制设置级联
1124
+ // 源select所选的值 this.$refs.service_show.data.activitys.fields[index].value
1125
+ if (this.$refs.service_show.data.fields[i].label === '街道') {
1126
+ this.$refs.service_show.data.fields[i].value = ''
1127
+ this.$refs.service_show.data.fields[i].options = []
1128
+ let rs = []
1129
+ console.log('乡镇。。。', temp)
1130
+ // for (let j = 0; j < this.$login.f.f_allArea.length; j++) {
1131
+ // if (this.$login.f.f_allArea[j].label === temp) {
1132
+ // rs = this.$login.f.f_allArea[j].value
1133
+ // }
1134
+ // }
1135
+ let condition = `f_slice_area = '${temp}' and (f_street is not null or f_street!='')`
1136
+ let http = new HttpResetClass()
1137
+ let res = await http.load('POST','rs/sql/singleTable_Final', {data: {items: 'f_street f_name',tablename: 't_user_address',orderitem: 'f_street',groupitem:'f_street',condition: condition}},{resolveMsg: null, rejectMsg: '获取街道失败!'})
1138
+ let areas = []
1139
+ res.data.forEach((row)=>{
1140
+ areas.push({label:row.f_name, value:row.f_name})
1141
+ })
1142
+ console.log('获取街道=>' + JSON.stringify(areas))
1143
+ this.$refs.service_show.data.fields[i].options = areas
1144
+ this.$refs.service_show.update()
1145
+ }
1146
+ }
1147
+ }
1148
+ if (this.$refs.service_show.data.fields[index].label === '街道') {
1149
+ let temp = this.$refs.service_show.data.fields[index].value
1150
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1151
+ // 控制设置级联
1152
+ // 源select所选的值 this.$refs.service_show.data.activitys.fields[index].value
1153
+ if (this.$refs.service_show.data.fields[i].label === '小区') {
1154
+ this.$refs.service_show.data.fields[i].value = ''
1155
+ this.$refs.service_show.data.fields[i].options = []
1156
+ let rs = []
1157
+ console.log('街道。。。', temp)
1158
+ // for (let j = 0; j < this.$login.f.f_allArea.length; j++) {
1159
+ // if (this.$login.f.f_allArea[j].label === temp) {
1160
+ // rs = this.$login.f.f_allArea[j].value
1161
+ // }
1162
+ // }
1163
+ let condition = `f_street ='${temp}' and (f_residential_area is not null or f_residential_area!='')`
1164
+ let http = new HttpResetClass()
1165
+ let res = await http.load('POST','rs/sql/singleTable_Final', {data: {items: 'f_residential_area f_name',tablename: 't_user_address',orderitem: 'f_residential_area',groupitem:'f_residential_area',condition: condition}},{resolveMsg: null, rejectMsg: '获取小区失败!'})
1166
+ let areas = []
1167
+ res.data.forEach((row)=>{
1168
+ areas.push({label:row.f_name, value:row.f_name})
1169
+ })
1170
+ console.log('获取小区=>' + JSON.stringify(areas))
1171
+ this.$refs.service_show.data.fields[i].options = areas
1172
+ this.$refs.service_show.update()
1173
+ }
1174
+ }
1175
+ }
1176
+ if (this.$refs.service_show.data.fields[index].label === '小区') {
1177
+ let temp = this.$refs.service_show.data.fields[index].value
1178
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1179
+ // 控制设置级联
1180
+ // 源select所选的值 this.$refs.service_show.data.activitys.fields[index].value
1181
+ if (this.$refs.service_show.data.fields[i].label === '楼号') {
1182
+ this.$refs.service_show.data.fields[i].value = ''
1183
+ this.$refs.service_show.data.fields[i].options = []
1184
+ let rs = []
1185
+ console.log('小区。。。', temp)
1186
+ // for (let j = 0; j < this.$login.f.f_allArea.length; j++) {
1187
+ // if (this.$login.f.f_allArea[j].label === temp) {
1188
+ // rs = this.$login.f.f_allArea[j].value
1189
+ // }
1190
+ // }
1191
+ let condition = `f_residential_area = '${temp}' and (f_building is not null or f_building!='')`
1192
+ let http = new HttpResetClass()
1193
+ let res = await http.load('POST','rs/sql/singleTable_Final', {data: {items: 'f_building f_name',tablename: 't_user_address',orderitem: 'f_building',groupitem:'f_building',condition: condition}},{resolveMsg: null, rejectMsg: '获取楼号失败!'})
1194
+ let areas = []
1195
+ res.data.forEach((row)=>{
1196
+ areas.push({label:row.f_name, value:row.f_name})
1197
+ })
1198
+ console.log('获取楼号=>' + JSON.stringify(areas))
1199
+ this.$refs.service_show.data.fields[i].options = areas
1200
+ this.$refs.service_show.update()
1201
+ }
1202
+ }
1203
+ }
1204
+
1205
+ if (this.$refs.service_show.data.fields[index].label === '楼号') {
1206
+ let temp = this.$refs.service_show.data.fields[index].value
1207
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1208
+ // 控制设置级联
1209
+ // 源select所选的值 this.$refs.service_show.data.activitys.fields[index].value
1210
+ if (this.$refs.service_show.data.fields[i].label === '单元号') {
1211
+ this.$refs.service_show.data.fields[i].value = ''
1212
+ this.$refs.service_show.data.fields[i].options = []
1213
+ let rs = []
1214
+ console.log('楼号。。。', temp)
1215
+ let condition = `f_building = '${temp}' and (f_unit is not null or f_unit!='')`
1216
+ let http = new HttpResetClass()
1217
+ let res = await http.load('POST','rs/sql/singleTable_Final', {data: {items: 'f_unit f_name',tablename: 't_user_address',orderitem: 'f_unit',groupitem:'f_unit',condition: condition}},{resolveMsg: null, rejectMsg: '获取单元号失败!'})
1218
+ let areas = []
1219
+ res.data.forEach((row)=>{
1220
+ areas.push({label:row.f_name, value:row.f_name})
1221
+ })
1222
+ console.log('获取单元号=>' + JSON.stringify(areas))
1223
+ this.$refs.service_show.data.fields[i].options = areas
1224
+ this.$refs.service_show.update()
1225
+ }
1226
+ }
1227
+ }
1228
+
1229
+ if (this.$refs.service_show.data.fields[index].label === '单元号') {
1230
+ let temp = this.$refs.service_show.data.fields[index].value
1231
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1232
+ // 控制设置级联
1233
+ // 源select所选的值 this.$refs.service_show.data.activitys.fields[index].value
1234
+ if (this.$refs.service_show.data.fields[i].label === '楼层') {
1235
+ this.$refs.service_show.data.fields[i].value = ''
1236
+ this.$refs.service_show.data.fields[i].options = []
1237
+ let rs = []
1238
+ console.log('单元号。。。', temp)
1239
+ let condition = `f_unit = '${temp}' and (f_floor is not null or f_floor!='')`
1240
+ let http = new HttpResetClass()
1241
+ let res = await http.load('POST','rs/sql/singleTable_Final', {data: {items: 'f_floor f_name',tablename: 't_user_address',orderitem: 'f_floor',groupitem:'f_floor',condition: condition}},{resolveMsg: null, rejectMsg: '获取楼层失败!'})
1242
+ let areas = []
1243
+ res.data.forEach((row)=>{
1244
+ areas.push({label:row.f_name, value:row.f_name})
1245
+ })
1246
+ console.log('获取楼层=>' + JSON.stringify(areas))
1247
+ this.$refs.service_show.data.fields[i].options = areas
1248
+ this.$refs.service_show.update()
1249
+ }
1250
+ }
1251
+ }
1252
+
1253
+ if (this.$refs.service_show.data.fields[index].label === '楼层') {
1254
+ let temp = this.$refs.service_show.data.fields[index].value
1255
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1256
+ // 控制设置级联
1257
+ // 源select所选的值 this.$refs.service_show.data.activitys.fields[index].value
1258
+ if (this.$refs.service_show.data.fields[i].label === '门牌号') {
1259
+ this.$refs.service_show.data.fields[i].value = ''
1260
+ this.$refs.service_show.data.fields[i].options = []
1261
+ let rs = []
1262
+ console.log('楼层。。。', temp)
1263
+ let condition = `f_floor = '${temp}' and (f_room is not null or f_room!='')`
1264
+ let http = new HttpResetClass()
1265
+ let res = await http.load('POST','rs/sql/singleTable_Final', {data: {items: 'f_room f_name',tablename: 't_user_address',orderitem: 'f_room',groupitem:'f_room',condition: condition}},{resolveMsg: null, rejectMsg: '获取门牌号失败!'})
1266
+ let areas = []
1267
+ res.data.forEach((row)=>{
1268
+ areas.push({label:row.f_name, value:row.f_name})
1269
+ })
1270
+ console.log('获取门牌号=>' + JSON.stringify(areas))
1271
+ this.$refs.service_show.data.fields[i].options = areas
1272
+ this.$refs.service_show.update()
1273
+ }
1274
+ }
1275
+ }
1276
+
1277
+ //控制尾款
1278
+ if (
1279
+ this.$refs.service_show.data.fields[index].label === '合同金额' ||
1280
+ this.$refs.service_show.data.fields[index].label === '首付' ||
1281
+ this.$refs.service_show.data.fields[index].label === '进度款' ||
1282
+ this.$refs.service_show.data.fields[index].label === '尾款'
1283
+ ) {
1284
+ console.log('即将计算合同金额')
1285
+ var cash = 0
1286
+ var downpayments=0
1287
+ var tailmoney=0
1288
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1289
+ // 控制设置级联
1290
+ // 源select所选的值 this.$refs.service_show.data.activitys.fields[index].value
1291
+ // xxx xx xxx
1292
+ if (this.$refs.service_show.data.fields[i].label === '合同金额' && this.$refs.service_show.data.fields[i].value) {
1293
+ cash = this.$refs.service_show.data.fields[i].value
1294
+ }
1295
+ if (this.$refs.service_show.data.fields[i].label === '首付' && this.$refs.service_show.data.fields[i].value) {
1296
+ downpayments = this.$refs.service_show.data.fields[i].value
1297
+ }
1298
+ if (this.$refs.service_show.data.fields[i].label === '进度款' && this.$refs.service_show.data.fields[i].value) {
1299
+ tailmoney = this.$refs.service_show.data.fields[i].value
1300
+ }
1301
+ }
1302
+ var a =cash - downpayments
1303
+ // 数据计算完毕得到尾款
1304
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1305
+ if (this.$refs.service_show.data.fields[i].label === '尾款') {
1306
+ if (cash === downpayments ){
1307
+ this.$refs.service_show.data.fields[i].value = 0
1308
+ } else{
1309
+ this.$refs.service_show.data.fields[i].value = (cash - downpayments - tailmoney)
1310
+ console.log('修改fields[i].value后的值=>' + this.$refs.service_show.data.fields[i].value)
1311
+ }
1312
+ }
1313
+ if (this.$refs.service_show.data.fields[i].label === '首付') {
1314
+ if (a<0){
1315
+ this.$showMessage("首付款数额过大")
1316
+ downpayments = 0
1317
+ this.$refs.service_show.data.fields[i].value = 0
1318
+ }
1319
+ }
1320
+
1321
+ if (this.$refs.service_show.data.fields[i].label === '进度款') {
1322
+
1323
+ if (cash === downpayments ){
1324
+ tailmoney = 0
1325
+ this.$refs.service_show.data.fields[i].value = 0
1326
+ this.$refs.service_show.data.fields[i].readonly=true
1327
+ }else {
1328
+ this.$refs.service_show.data.fields[i].readonly=false
1329
+ tailmoney = this.$refs.service_show.data.fields[i].value
1330
+ }
1331
+ if (tailmoney>a){
1332
+ this.$showMessage("进度款数额过大")
1333
+ tailmoney = 0
1334
+ this.$refs.service_show.data.fields[i].value = 0
1335
+ }
1336
+ }
1337
+ }
1338
+ }
1339
+
1340
+
1341
+
1342
+ if ((
1343
+ this.$refs.service_show.data.fields[index].label === '工料费' ||
1344
+ this.$refs.service_show.data.fields[index].label === '延伸服务费' ||
1345
+ this.$refs.service_show.data.fields[index].label === '其他费用' ||
1346
+ this.$refs.service_show.data.fields[index].label === '金额')&&this.selectadata.defname != '点火申请'
1347
+ ) {
1348
+ console.log('即将计算合同金额')
1349
+ let a = 0
1350
+ let b = 0
1351
+ let c = 0
1352
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1353
+ // 控制设置级联
1354
+ // 源select所选的值 this.$refs.service_show.data.activitys.fields[index].value
1355
+ // xxx xx xxx
1356
+ if (this.$refs.service_show.data.fields[i].label === '工料费' && this.$refs.service_show.data.fields[i].value) {
1357
+ a = this.$refs.service_show.data.fields[i].value
1358
+ }
1359
+ if (this.$refs.service_show.data.fields[i].label === '延伸服务费' && !this.$refs.service_show.data.fields[i].value) {
1360
+ b = this.$refs.service_show.data.fields[i].value
1361
+ }
1362
+ if (this.$refs.service_show.data.fields[i].label === '其他费用' && this.$refs.service_show.data.fields[i].value) {
1363
+ c = this.$refs.service_show.data.fields[i].value
1364
+ }
1365
+ }
1366
+ let d =0
1367
+ d= parseInt(b) + parseInt(c)
1368
+ // 数据计算完毕得到尾款
1369
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1370
+ if (this.$refs.service_show.data.fields[i].label === '金额') {
1371
+
1372
+ this.$refs.service_show.data.fields[i].value = d
1373
+
1374
+ }
1375
+
1376
+ }
1377
+ }
1378
+
1379
+
1380
+
1381
+ // 合成地址
1382
+ if (
1383
+ this.$refs.service_show.data.fields[index].label === '县/区' ||
1384
+ this.$refs.service_show.data.fields[index].label === '乡镇' ||
1385
+ this.$refs.service_show.data.fields[index].label === '街道' ||
1386
+ this.$refs.service_show.data.fields[index].label === '小区' ||
1387
+ this.$refs.service_show.data.fields[index].label === '单位名称' ||
1388
+ this.$refs.service_show.data.fields[index].label === '楼号' ||
1389
+ this.$refs.service_show.data.fields[index].label === '单元号' ||
1390
+ this.$refs.service_show.data.fields[index].label === '楼层' ||
1391
+ this.$refs.service_show.data.fields[index].label === '门牌号'
1392
+ ) {
1393
+ console.log('即将合成地址')
1394
+ var address = ''
1395
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1396
+ // 控制设置级联
1397
+ // 源select所选的值 this.$refs.service_show.data.activitys.fields[index].value
1398
+ // xxx xx xxx
1399
+ if (this.$refs.service_show.data.fields[i].label === '县/区' && this.$refs.service_show.data.fields[i].value && typeof this.$refs.service_show.data.fields[i].value === 'string') {
1400
+ address += this.$refs.service_show.data.fields[i].value
1401
+ }else if(this.$refs.service_show.data.fields[i].label === '县/区' && this.$refs.service_show.data.fields[i].value && typeof this.$refs.service_show.data.fields[i].value === 'object'){
1402
+ address += this.$refs.service_show.data.fields[i].value.name
1403
+ }else {
1404
+ let a =this.$refs.service_show.data.fields[i].value
1405
+ console.log(`xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx${JSON.stringify(a)}让`)
1406
+ }
1407
+ if (this.$refs.service_show.data.fields[i].label === '乡镇' && this.$refs.service_show.data.fields[i].value && typeof this.$refs.service_show.data.fields[i].value === 'string') {
1408
+ address += this.$refs.service_show.data.fields[i].value
1409
+ }else if (this.$refs.service_show.data.fields[i].label === '乡镇' && this.$refs.service_show.data.fields[i].value && typeof this.$refs.service_show.data.fields[i].value === 'object') {
1410
+ address += this.$refs.service_show.data.fields[i].value.name
1411
+ }
1412
+ if (this.$refs.service_show.data.fields[i].label === '街道' && this.$refs.service_show.data.fields[i].value && typeof this.$refs.service_show.data.fields[i].value === 'string') {
1413
+ address += this.$refs.service_show.data.fields[i].value
1414
+ }else if (this.$refs.service_show.data.fields[i].label === '街道' && this.$refs.service_show.data.fields[i].value && typeof this.$refs.service_show.data.fields[i].value === 'object'){
1415
+ address += this.$refs.service_show.data.fields[i].value.name
1416
+ }
1417
+ if (this.$refs.service_show.data.fields[i].label === '小区' && this.$refs.service_show.data.fields[i].value && typeof this.$refs.service_show.data.fields[i].value === 'string') {
1418
+ address += this.$refs.service_show.data.fields[i].value
1419
+ }else if (this.$refs.service_show.data.fields[i].label === '小区' && this.$refs.service_show.data.fields[i].value && typeof this.$refs.service_show.data.fields[i].value === 'object'){
1420
+ address += this.$refs.service_show.data.fields[i].value.name
1421
+ }
1422
+ if (this.$refs.service_show.data.fields[i].label === '单位名称' && this.$refs.service_show.data.fields[i].value && typeof this.$refs.service_show.data.fields[i].value === 'string') {
1423
+ address += this.$refs.service_show.data.fields[i].value
1424
+ }else if (this.$refs.service_show.data.fields[i].label === '单位名称' && this.$refs.service_show.data.fields[i].value && typeof this.$refs.service_show.data.fields[i].value === 'object'){
1425
+ address += this.$refs.service_show.data.fields[i].value.name
1426
+ }
1427
+ if (this.$refs.service_show.data.fields[i].label === '楼号' && this.$refs.service_show.data.fields[i].value && typeof this.$refs.service_show.data.fields[i].value === 'string') {
1428
+ address += this.$refs.service_show.data.fields[i].value+ '栋'
1429
+ }else if (this.$refs.service_show.data.fields[i].label === '楼号' && this.$refs.service_show.data.fields[i].value && typeof this.$refs.service_show.data.fields[i].value === 'object'){
1430
+ address += this.$refs.service_show.data.fields[i].value.name
1431
+ }
1432
+ if (this.$refs.service_show.data.fields[i].label === '单元号' && this.$refs.service_show.data.fields[i].value && typeof this.$refs.service_show.data.fields[i].value === 'string') {
1433
+ address +=this.$refs.service_show.data.fields[i].value+ '单元'
1434
+ }else if (this.$refs.service_show.data.fields[i].label === '单元号' && this.$refs.service_show.data.fields[i].value && typeof this.$refs.service_show.data.fields[i].value === 'object'){
1435
+ address +=this.$refs.service_show.data.fields[i].value.name
1436
+ }
1437
+ if (this.$refs.service_show.data.fields[i].label === '楼层' && this.$refs.service_show.data.fields[i].value && typeof this.$refs.service_show.data.fields[i].value === 'string') {
1438
+ address += this.$refs.service_show.data.fields[i].value+ '层'
1439
+ }else if (this.$refs.service_show.data.fields[i].label === '楼层' && this.$refs.service_show.data.fields[i].value && typeof this.$refs.service_show.data.fields[i].value === 'object'){
1440
+ address += this.$refs.service_show.data.fields[i].value.name
1441
+ }
1442
+ if (this.$refs.service_show.data.fields[i].label === '门牌号' && this.$refs.service_show.data.fields[i].value && typeof this.$refs.service_show.data.fields[i].value === 'string') {
1443
+ address += this.$refs.service_show.data.fields[i].value+ '室'
1444
+ }else if (this.$refs.service_show.data.fields[i].label === '门牌号' && this.$refs.service_show.data.fields[i].value && typeof this.$refs.service_show.data.fields[i].value === 'object'){
1445
+ address += this.$refs.service_show.data.fields[i].value.name
1446
+ }
1447
+ }
1448
+ //去除空格
1449
+ address=address.replace(/\s*/g,"")
1450
+ console.log('获取到的address=>' + address)
1451
+ //效验地址是否被使用
1452
+ let res = await this.$resetpost('rs/logic/checkAddress',{f_address:address}, {resolveMsg: null, rejectMsg: null})
1453
+ if(res.data.data[0].count>0){
1454
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1455
+ if(this.$refs.service_show.data.fields[i].label === '门牌号'){
1456
+ this.$showMessage('用户地址已被使用,请重新输入')
1457
+ this.$refs.service_show.data.fields[i].value=''
1458
+ }
1459
+ }
1460
+ }
1461
+ // 数据获取完毕时放入地址text
1462
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1463
+ if (this.$refs.service_show.data.fields[i].label === '地址') {
1464
+ this.$refs.service_show.data.fields[i].value = address
1465
+ console.log('修改fields[i].value后的值=>' + this.$refs.service_show.data.fields[i].value)
1466
+ }
1467
+ }
1468
+ }
1469
+
1470
+
1471
+ // 开户费+材料费+人工费+设备安装费=合计
1472
+ if (this.$refs.service_show.data.fields[index].label === '开户费' ||
1473
+ this.$refs.service_show.data.fields[index].label === '材料费' ||
1474
+ this.$refs.service_show.data.fields[index].label === '人工费' ||
1475
+ this.$refs.service_show.data.fields[index].label === '设备安装费') {
1476
+ let fee = 0
1477
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1478
+ if (this.$refs.service_show.data.fields[index].label === '开户费' ||
1479
+ this.$refs.service_show.data.fields[index].label === '材料费' ||
1480
+ this.$refs.service_show.data.fields[index].label === '人工费' ||
1481
+ this.$refs.service_show.data.fields[index].label === '设备安装费') {
1482
+ fee += Number(this.$refs.service_show.data.fields[index].value)
1483
+ }
1484
+ if (this.$refs.service_show.data.fields[index].label === '合计') {
1485
+ this.$refs.service_show.data.fields[index].value = fee
1486
+ }
1487
+ }
1488
+
1489
+ }
1490
+ // this.$refs.service_show.update()
1491
+
1492
+ if(this.$refs.service_show.data.fields[index].label === '是否安装波纹管'){
1493
+ if(this.$refs.service_show.data.fields[index].value==='是' )
1494
+ this.selectMachine.push('波纹管')
1495
+ if(this.$refs.service_show.data.fields[index].value==='否' ){
1496
+ let newSelectMachine=[];
1497
+ for(let i=0;i<this.selectMachine.length;i++){
1498
+ if(this.selectMachine[i]!=='波纹管'){
1499
+ newSelectMachine.push(this.selectMachine[i])
1500
+ }
1501
+ }
1502
+ this.selectMachine=newSelectMachine;
1503
+ }
1504
+ }
1505
+ if(this.$refs.service_show.data.fields[index].label === '是否安装热水器'){
1506
+ if(this.$refs.service_show.data.fields[index].value==='是' )
1507
+ this.selectMachine.push('热水器')
1508
+ if(this.$refs.service_show.data.fields[index].value==='否' ){
1509
+ let newSelectMachine=[];
1510
+ for(let i=0;i<this.selectMachine.length;i++){
1511
+ if(this.selectMachine[i]!=='热水器'){
1512
+ newSelectMachine.push(this.selectMachine[i])
1513
+ }
1514
+ }
1515
+ this.selectMachine=newSelectMachine;
1516
+ }
1517
+ }
1518
+ if(this.$refs.service_show.data.fields[index].label === '是否安装燃气灶'){
1519
+ if(this.$refs.service_show.data.fields[index].value==='是' )
1520
+ this.selectMachine.push('燃气灶')
1521
+ if(this.$refs.service_show.data.fields[index].value==='否' ){
1522
+ let newSelectMachine=[];
1523
+ for(let i=0;i<this.selectMachine.length;i++){
1524
+ if(this.selectMachine[i]!=='燃气灶'){
1525
+ newSelectMachine.push(this.selectMachine[i])
1526
+ }
1527
+ }
1528
+ this.selectMachine=newSelectMachine;
1529
+ }
1530
+ }
1531
+ },
1532
+
1533
+ // onetomany模态框监听事件
1534
+ async 'select_cascade_modal'(i,j){
1535
+ let house = []
1536
+ if (this.data.onetomany[i].tables[0]==='t_fire_material'){
1537
+ console.log('1111111')
1538
+
1539
+ if (this.data.onetomany[i].fields[j].label ==='材料名称'){
1540
+ console.log('2222222')
1541
+ let a =this.$refs.service_show.showadd_fields.fields[j].value
1542
+ let http = new HttpResetClass()
1543
+ http.load('POST','rs/logic/getMaterialItem', {data: {condition: `f_name='${a}' and f_use_type='点火用材料'`}},{resolveMsg: null, rejectMsg: '获取材料失败!'}).then((res)=>{
1544
+ for (let row of res.data.material){
1545
+ house.push({label: row.f_unit,value: row.f_unit})
1546
+ }
1547
+ for (let m = 0; m < this.data.onetomany[i].fields.length; m++) {
1548
+ if (this.data.onetomany[i].fields[m].label==='材料单位'){
1549
+ console.log('传值',house)
1550
+ this.$refs.service_show.showadd_fields.fields[m].options= house
1551
+ console.log(house[0].value);
1552
+ this.$refs.service_show.showadd_fields.fields[m].value= house[0].value;
1553
+ this.$refs.service_show.update();
1554
+ // this.$refs.service_show.update_modal()
1555
+ console.log(`3333333=====>${this.$refs.service_show.showadd_fields.fields[m].options}`)
1556
+ // this.data.onetomany[i].fields[m].options
1557
+ }
1558
+ if(this.data.onetomany[i].fields[m].label==='单价'){
1559
+ this.$refs.service_show.showadd_fields.fields[m].value= res.data.material[0].f_price
1560
+ }
1561
+ }
1562
+ })
1563
+
1564
+ }
1565
+ if (this.data.onetomany[i].fields[j].label ==='数量'){
1566
+ let danjia = 0
1567
+ let shuliang = this.$refs.service_show.showadd_fields.fields[j].value
1568
+ for (let m = 0; m < this.data.onetomany[i].fields.length; m++) {
1569
+ if(this.data.onetomany[i].fields[m].label==='单价'){
1570
+ danjia = this.$refs.service_show.showadd_fields.fields[m].value
1571
+ }
1572
+ if(this.data.onetomany[i].fields[m].label==='金额'){
1573
+ this.$refs.service_show.showadd_fields.fields[m].value= danjia*shuliang
1574
+ }
1575
+ }
1576
+ }
1577
+ }
1578
+
1579
+
1580
+ if (this.data.onetomany[i].tables[0]==='t_fire_machine') {
1581
+ let a = 0
1582
+
1583
+ if (this.data.onetomany[i].fields[j].label === '燃气具') {
1584
+ if (this.$refs.service_show.showadd_fields.fields[j].value === '燃气灶') {
1585
+ a = 1
1586
+ }
1587
+ if (this.$refs.service_show.showadd_fields.fields[j].value === '热水器') {
1588
+ a = 2
1589
+ }
1590
+ }
1591
+
1592
+
1593
+ for (let m = 0; m < this.data.onetomany[i].fields.length; m++) {
1594
+ if (a === 1) {
1595
+ console.log('燃气灶')
1596
+ if (this.data.onetomany[i].fields[m].label === '安装方式') {
1597
+ this.$refs.service_show.showadd_fields.fields[m].hidden = false
1598
+ }
1599
+ if (this.data.onetomany[i].fields[m].label === '面板') {
1600
+ this.$refs.service_show.showadd_fields.fields[m].hidden = false
1601
+ }
1602
+ if (this.data.onetomany[i].fields[m].label === '连接方式') {
1603
+ this.$refs.service_show.showadd_fields.fields[m].hidden = false
1604
+ }
1605
+ if (this.data.onetomany[i].fields[m].label === '安装位置') {
1606
+ this.$refs.service_show.showadd_fields.fields[m].hidden = true
1607
+ }
1608
+ if (this.data.onetomany[i].fields[m].label === '排烟方式') {
1609
+ this.$refs.service_show.showadd_fields.fields[m].hidden = true
1610
+ }
1611
+ if (this.data.onetomany[i].fields[m].label === '容积') {
1612
+ this.$refs.service_show.showadd_fields.fields[m].hidden = true
1613
+ }
1614
+ }
1615
+ if (a === 2) {
1616
+ console.log('热水器')
1617
+ if (this.data.onetomany[i].fields[m].label === '安装位置') {
1618
+ this.$refs.service_show.showadd_fields.fields[m].hidden = false
1619
+ }
1620
+ if (this.data.onetomany[i].fields[m].label === '排烟方式') {
1621
+ this.$refs.service_show.showadd_fields.fields[m].hidden = false
1622
+ }
1623
+ if (this.data.onetomany[i].fields[m].label === '容积') {
1624
+ this.$refs.service_show.showadd_fields.fields[m].hidden = false
1625
+ }
1626
+ if (this.data.onetomany[i].fields[m].label === '安装方式') {
1627
+ this.$refs.service_show.showadd_fields.fields[m].hidden = true
1628
+ }
1629
+ if (this.data.onetomany[i].fields[m].label === '面板') {
1630
+ this.$refs.service_show.showadd_fields.fields[m].hidden = true
1631
+ }
1632
+ if (this.data.onetomany[i].fields[m].label === '连接方式') {
1633
+ this.$refs.service_show.showadd_fields.fields[m].hidden = true
1634
+ }
1635
+ }
1636
+ }
1637
+ }
1638
+ },
1639
+
1640
+
1641
+ async 'onetomanyevent'(datas) {
1642
+ console.log(`onetomany=======>${JSON.stringify(datas)}`)
1643
+
1644
+ for (let i = 0; i < datas.rows.length; i++) {
1645
+ datas.rows[i]['f_process_id'] = this.selectdata.f_process_id
1646
+ datas.rows[i]['f_apply_num'] = this.selectdata.f_apply_num
1647
+ datas.rows[i]['f_filiale'] = this.$login.f.f_fengongsi
1648
+ datas.rows[i]['f_parentname'] = this.$login.f.f_parentname
1649
+ datas.rows[i]['f_operator'] = this.$login.f.name
1650
+ }
1651
+ let http = new HttpResetClass()
1652
+ await http.load('POST', 'rs/logic/saveentity', datas, {resolveMsg: null, rejectMsg: 'search查询部门下所有人失败'})
1653
+ for(let i =0;i<this.$refs.service_show.data.fields.length;i++){
1654
+ if(this.$refs.service_show.data.fields[i].label == '工料费'||this.$refs.service_show.data.fields[i].label == '延伸服务费'||this.$refs.service_show.data.fields[i].label =='金额'||this.$refs.service_show.data.fields[i].label =='不锈钢波纹管费合计') {
1655
+ this.$refs.service_show.data.fields[i].readonly = true
1656
+ let httpf = new HttpResetClass()
1657
+ let resf = httpf.load('POST','rs/sql/ApplyPaySearch', {data:{condition: ` f_apply_num ='${this.selectdata.f_apply_num}'`}},{resolveMsg: null, rejectMsg: '获取工料费和延伸服务费失败!'})
1658
+ if(this.$refs.service_show.datafields[i].label == '工料费'){
1659
+ this.$refs.service_show.data.fields[i].value = resf.data[0].f_glf
1660
+ }else if(this.$refs.service_show.data.fields[i].label == '延伸服务费'&&!this.$refs.service_show.data.fields[i].value){
1661
+ this.$refs.service_show.data.fields[i].value = resf.data[0].f_ysfwf
1662
+ }else if(this.selectdata.defname == '点火'&&this.$refs.service_show.data.fields[i].label =='不锈钢波纹管费合计'){
1663
+ this.$refs.service_show.data.fields[i].value = resf.data[0].f_dhbxgbwg
1664
+ }else if(this.selectdata.defname == '点火申请'&&this.$refs.service_show.data.fields[i].label =='金额'){
1665
+ this.$refs.service_show.data.fields[i].value = resf.data[0].f_ysfwf
1666
+ }
1667
+ }
1668
+ }
1669
+ },
1670
+ // 获取view层button事件/
1671
+ async 'button'(model) {
1672
+ console.log("button事件接收参数:", model)
1673
+ // 点击重置按钮就重置数据
1674
+ if (model.button.button_name === '重置') {
1675
+ this.refurbish()
1676
+ return
1677
+ }
1678
+
1679
+ if(this.selectdata.defname.includes('开户受理')){
1680
+ let httpk = new HttpResetClass()
1681
+ let data = {
1682
+ tablename: 't_image',
1683
+ condition: `f_type = '供气合同' and f_process_id = '${this.selectdata.f_process_id}'`
1684
+ }
1685
+ let resk = await httpk.load('POST', 'rs/sql/singleTable', {data: data}, {
1686
+ resolveMsg: null,
1687
+ rejectMsg: "查询供气合同失败,请联系开发人员"
1688
+ })
1689
+ if(resk.data.length==0){
1690
+ this.$showMessage("请上传供气合同")
1691
+ this.$refs.service_show.disable_button = false
1692
+ return
1693
+ }
1694
+ }
1695
+ // 如果不符合安装条件,就不能提交
1696
+ if(model.f_is_gas == '不符合规范要求'){
1697
+ this.$showMessage("不符合规范要求无法提交")
1698
+ return
1699
+ }
1700
+
1701
+ var operate = ''
1702
+ // 判断当前按钮是否为特殊业务,即子流程提交或者分发
1703
+ if (model.button.button_name === '提交' && model.button.button_event && model.button.button_event === '子流程提交') {
1704
+ operate = '子流程提交'
1705
+ }
1706
+ if (model.button.button_name === '提交' && model.button.button_event && model.button.button_event === '签订合同') {
1707
+ model.f_budget_money = model.f_contract_money
1708
+ model.f_unaccounts_money = model.f_contract_money
1709
+ model.f_cumulative_money = 0
1710
+ model.f_cumulative_invoicing = 0
1711
+ model.f_residual_invoicing = model.f_contract_money
1712
+ }
1713
+ if (model.button.button_name === '下发') {
1714
+ if (this.data.defname === '点火申请') {
1715
+ let param={
1716
+ dhyid:model.button.button_fields.f_apply_market_employee,
1717
+ pdyname:model.f_operator,
1718
+ f_process_id: model.f_process_id
1719
+ }
1720
+ let res = await this.$resetpost('rs/logic/saveHuman',param, {resolveMsg: null, rejectMsg: null})
1721
+ console.log('返回的结果',res)
1722
+
1723
+ model.f_payment_clerk = res.data.pdyname
1724
+ model.f_dispatch_telephone = res.data.pdyphone
1725
+ model.f_transfer_person = res.data.dhyname
1726
+ model.f_igniter_telephone = res.data.dhyphone
1727
+ model.button.button_name = '提交'
1728
+ model.button.button_fields={}
1729
+ console.log('下发处理为提交')
1730
+ }else {
1731
+ if (model.button && model.button.button_event === '分发') {
1732
+ operate = '分发'
1733
+ }
1734
+ let person_name = model.button.button_fields[this.show_data.buttons[model.button.button_index].button_fields[0].field]
1735
+ for (let i = 0; i < this.department_search.length; i++) {
1736
+ // 找到人名为person_name 的人,然后把人名换成id
1737
+ if (this.department_search[i].name === person_name) {
1738
+ model.button.button_fields[this.show_data.buttons[model.button.button_index].button_fields[0].field] = this.department_search[i].id
1739
+ }
1740
+ }
1741
+ }
1742
+ }
1743
+ if (model.button.button_name === '提交') {
1744
+
1745
+
1746
+ if (this.data.defname === '民用开户受理'||this.data.defname === '工商开户受理'){
1747
+ let f_area = {}
1748
+ if(this.data.f_area&&this.data.f_area.startsWith('{')){
1749
+ f_area = JSON.parse(this.data.f_area)
1750
+ }else {
1751
+ if(this.data.f_area){
1752
+ f_area = this.data.f_area
1753
+ }
1754
+ }
1755
+ let area = ''
1756
+ if (f_area.name){
1757
+ area =f_area.name
1758
+ }
1759
+ let f_slice_area = {}
1760
+ if(this.data.f_address_town&&this.data.f_address_town.startsWith('{')){
1761
+ f_slice_area = JSON.parse(this.data.f_address_town)
1762
+ }else {
1763
+ if(this.data.f_address_town){
1764
+ f_slice_area = this.data.f_address_town
1765
+ }
1766
+ }
1767
+ // let f_slice_area = JSON.parse(this.data.f_address_town)
1768
+ let slice_area = ''
1769
+ if (f_slice_area.name){
1770
+ slice_area =f_slice_area.name
1771
+ }
1772
+ let f_street = {}
1773
+ if(this.data.f_street&&this.data.f_street.startsWith('{')){
1774
+ f_street = JSON.parse(this.data.f_street)
1775
+ }else {
1776
+ if(this.data.f_street){
1777
+ f_street = this.data.f_street
1778
+ }
1779
+ }
1780
+ // let f_street = JSON.parse(this.data.f_street)
1781
+ let street = ''
1782
+ if (f_street.name){
1783
+ street =f_street.name
1784
+ }
1785
+ let f_residential_area = {}
1786
+ if(this.data.f_residential_area&&this.data.f_residential_area.startsWith('{')){
1787
+ f_residential_area = JSON.parse(this.data.f_residential_area)
1788
+ }else {
1789
+ if(this.data.f_residential_area){
1790
+ f_residential_area = this.data.f_residential_area
1791
+ }
1792
+ }
1793
+ // let f_residential_area = JSON.parse(this.data.f_residential_area)
1794
+ let residential_area = ''
1795
+ if (f_residential_area.name){
1796
+ residential_area =f_residential_area.name
1797
+ }else{
1798
+ residential_area = f_residential_area
1799
+ }
1800
+ let param ={
1801
+ version:1,
1802
+ f_user_state:'正常',
1803
+ f_apply_num:this.data.f_apply_num,
1804
+ f_address:this.data.f_address,
1805
+ f_credentials:'身份证',
1806
+ f_cost_type:'现金缴费',
1807
+ f_paper_type:'国税发票',
1808
+ f_idnumber:this.data.f_idnumber,
1809
+ f_people_num:this.data.f_population,
1810
+ f_user_name:this.data.f_user_name,
1811
+ f_user_phone: this.data.f_phone,
1812
+ f_gasproperties:this.data.f_gas_type,
1813
+ f_area:area,
1814
+ f_slice_area:slice_area,
1815
+ f_street:street,
1816
+ f_unit:this.data.f_unit,
1817
+ f_floor:this.data.f_floor,
1818
+ f_room:this.data.f_room,
1819
+ f_residential_area:residential_area,
1820
+ f_building:this.data.f_building,
1821
+ f_operator:this.$login.f.name,
1822
+ f_filiale:this.$login.f.f_fengongsi,
1823
+ f_outlets: this.$login.f.f_parentname,
1824
+ f_orgstr: this.$login.f.orgpathstr,
1825
+ f_filialeids: this.$login.f.f_orgids,
1826
+ f_filialeid: this.$login.f.f_orgids.split('.')[this.$login.f.f_orgids.split('.').length - 2] + '.'
1827
+ }
1828
+ if(this.data.f_adjust_box && this.data.f_adjust_box.includes(']')){
1829
+ param.f_adjustable_id = this.data.f_adjust_box.split("]")[0].substring(1)
1830
+ }
1831
+ if(this.selectdata.f_gas_type&&(this.selectdata.f_gas_type.includes('民')||this.selectdata.f_gas_type.includes('公福'))){
1832
+ param.f_user_type='民用'
1833
+ }else{
1834
+ param.f_user_type='非民用'
1835
+ }
1836
+ http = new HttpResetClass()
1837
+ let res = await http.load('POST', 'rs/logic/recordSave', param, {
1838
+ resolveMsg: null,
1839
+ rejectMsg: "创建户档案失败"
1840
+ })
1841
+ }
1842
+
1843
+ if (this.data.defname === '安装单返回客服'){
1844
+ let param ={
1845
+ f_meter_brand:this.data.f_meter_brand,
1846
+ f_meter_style:this.data.f_meter_style,
1847
+ f_apply_num:this.data.f_apply_num,
1848
+ f_price_type:this.data.f_price_type,
1849
+ f_price_name:this.data.f_price_name,
1850
+ f_filiale:this.$login.f.f_fengongsi,
1851
+ f_outlets: this.$login.f.f_parentname,
1852
+ f_orgstr: this.$login.f.orgpathstr,
1853
+ f_install_date: this.$login.toStandardTimeString(),
1854
+ f_gas_date: this.$login.toStandardTimeString(),
1855
+ f_changetube_date:this.$login.toStandardTimeString(),
1856
+ f_meternumber:this.data.f_meter_number,
1857
+ f_filialeids: this.$login.f.f_orgids,
1858
+ f_operator:this.$login.f.name,
1859
+ f_meter_base:this.data.f_meter_base,
1860
+ f_gasproperties:this.data.f_gas_type,
1861
+ f_aroundmeter:this.data.f_meter_direction,
1862
+ f_whether_hairpin:'无卡',
1863
+ f_meter_classify:'物联网表',
1864
+ f_filialeid: this.$login.f.f_orgids.split('.')[this.$login.f.f_orgids.split('.').length - 2] + '.'
1865
+ }
1866
+ if(this.selectdata.f_gas_type&&(this.selectdata.f_gas_type.includes('民')||this.selectdata.f_gas_type.includes('公福'))){
1867
+ param.f_user_type='民用'
1868
+ }else{
1869
+ param.f_user_type='非民用'
1870
+ }
1871
+ http = new HttpResetClass()
1872
+ let res = await http.load('POST', 'rs/logic/addmeterrecord', param, {
1873
+ resolveMsg: null,
1874
+ rejectMsg: "创建表档案失败"
1875
+ })
1876
+ console.log('创建表档案结果:',res)
1877
+ }
1878
+
1879
+ //资料归档前判断附件是否都上传成功
1880
+ if (this.data.defname === '资料归档') {
1881
+ let condition = `f_process_id = '${this.data.f_process_id}'`
1882
+ let http = new HttpResetClass();
1883
+ let res = await http.load('POST', 'rs/sql/getimage', {data: {condition: condition}}, {
1884
+ resolveMsg: null,
1885
+ rejectMsg: '获取图片路径失败'
1886
+ })
1887
+ if ((this.selectdata.f_customer_type !== '企业' && res.data.length < 13) || (this.selectdata.f_customer_type === '企业' && res.data.length < 14)) {
1888
+ this.$showMessage('有附件未提交,请在“附件”功能中提交')
1889
+ this.initializtion()
1890
+ return
1891
+ }
1892
+ }
1893
+
1894
+ if (this.data.defname === '点火'){
1895
+ //判断选择安装的是否都已经安装
1896
+ let selectedList = [];
1897
+ for (let j = 0; j < this.data.onetomany.length; j++) {
1898
+ if (this.data.onetomany[j].tables[0] === 't_fire_machine') {
1899
+ for (let k = 0; k < this.data.onetomany[j].rows.length; k++) {
1900
+ selectedList.push(this.data.onetomany[j].rows[k].f_name)
1901
+ }
1902
+ }
1903
+ }
1904
+ for (let i = 0; i < this.selectMachine.length; i++) {
1905
+ if (this.selectMachine[i] === '波纹管' && selectedList.indexOf('波纹管') === -1) {
1906
+ this.$showMessage("请添加已经选择安装的波纹管")
1907
+ this.initializtion()
1908
+ return
1909
+ }
1910
+ if (this.selectMachine[i] === '热水器' && selectedList.indexOf('热水器') === -1) {
1911
+ this.$showMessage("请添加已经选择安装的热水器")
1912
+ this.initializtion()
1913
+ return
1914
+ }
1915
+ if (this.selectMachine[i] === '燃气灶' && selectedList.indexOf('燃气灶') === -1) {
1916
+ this.$showMessage("请添加已经选择安装的燃气灶")
1917
+ this.initializtion()
1918
+ return
1919
+ }
1920
+ }
1921
+
1922
+ let param ={
1923
+ f_fire_state:'已点火',
1924
+ f_apply_num:this.data.f_apply_num
1925
+ }
1926
+ http = new HttpResetClass()
1927
+ let res = await http.load('POST', 'rs/logic/firemeterrecord', param, {
1928
+ resolveMsg: null,
1929
+ rejectMsg: "创建表档案失败"
1930
+ })
1931
+ console.log('创建包档案结果:',res)
1932
+ }
1933
+ // flag 为合同编号更新标志
1934
+ var flag = false
1935
+ if (model.f_contract_number) {
1936
+ flag = true
1937
+ http = new HttpResetClass()
1938
+ let data = {
1939
+ tablename: 't_singlevalue',
1940
+ condition: `name = '合同编号' and f_filialeids = '${this.$login.f.f_orgids}'`
1941
+ }
1942
+ let res = await http.load('POST', 'rs/sql/singleTable', {data: data}, {
1943
+ resolveMsg: null,
1944
+ rejectMsg: "获取合同编号失败"
1945
+ })
1946
+ // if (this.contract != res.data[0].value && !this.selectdata.f_contract_number) {
1947
+ // this.$showMessage("合同编号已经被使用,请按F5刷新页面后重新登记")
1948
+ // return
1949
+ // }
1950
+ }
1951
+
1952
+ }
1953
+
1954
+ console.log('本次点击button执行的操作是=>' + operate)
1955
+ model = Object.assign({}, this.selectdata, model)
1956
+ let http = new HttpResetClass()
1957
+ var url
1958
+ var requestData = {
1959
+ tables: this.data.tables,
1960
+ start_activity: this.$workflow_vue.start_activity,
1961
+ model: model,
1962
+ loginUser: this.$login.f
1963
+ }
1964
+ if (operate != '') {
1965
+ // 特殊操作走特殊logic业务处理
1966
+ url = 'rs/logic/SubprocessService'
1967
+ requestData = {
1968
+ tables: this.data.tables, model: model
1969
+ }
1970
+ } else if(model.button.button_name === '提交' && model.button.button_event && model.button.button_event === '分支流程异步合并处理'){
1971
+ url = 'rs/logic/branchsyncprocess'
1972
+ requestData = {
1973
+ tables: this.data.tables, model: model
1974
+ }
1975
+ } else{
1976
+ // 下发,提交,保存,退回通用业务后台处理logic
1977
+ console.log('选的什么:', model.f_ischeck)
1978
+ if ((model.f_ischeck2 ==='是'&& model.button.button_name == '提交' && this.selectdata.defname == '点火申请')||
1979
+ (model.f_ischeck ==='是'&& model.button.button_name == '提交' && (this.selectdata.defname == '民用开户受理'||this.selectdata.defname == '工商开户受理'))
1980
+ ) {
1981
+ model.button.button_name ='提交核减'
1982
+ }
1983
+ console.log('成功没有:',model.button.button_name)
1984
+ url = 'rs/logic/ApplyProductService'
1985
+ requestData = {
1986
+ tables: this.data.tables, model: model
1987
+ }
1988
+ }
1989
+ requestData.start_activity = this.$workflow_vue.start_activity
1990
+ requestData.loginUser = this.$login.f
1991
+ requestData.workflow_xmlfilename = this.$workflow_vue.workflow_xmlfilename
1992
+ console.log('即将发送请求url=>' + url + ',参数=>' + JSON.stringify(requestData))
1993
+ let res = res = await http.load('POST', url, {data: requestData}, {resolveMsg: null, rejectMsg: '数据保存失败'})
1994
+ console.log("service处理完成返回数据:", JSON.stringify(res.data))
1995
+ if (res.data.code == 200) {
1996
+ // flag 为合同编号更新标志
1997
+ if (flag) {
1998
+ let http = new HttpResetClass()
1999
+ let data = {
2000
+ tablename: 't_singlevalue',
2001
+ condition: `name = '合同编号' and f_filialeids = '${this.$login.f.f_orgids}'`,
2002
+ value: (Number(this.contract) + 1) + ''
2003
+ }
2004
+ await http.load('POST', 'rs/logic/updatesinglevalue', {data: data}, {
2005
+ resolveMsg: null,
2006
+ rejectMsg: "获取合同编号更新失败"
2007
+ })
2008
+ }
2009
+ this.showview = false
2010
+ // 特殊处理
2011
+ this.special(model)
2012
+ this.$dispatch('close')
2013
+ this.initializtion()
2014
+ } else {
2015
+ if (res.data.msg) {
2016
+ this.$showMessage(res.data.msg)
2017
+ }
2018
+ }
2019
+ },
2020
+ async 'onetomanydelete'(i, j) {
2021
+ let http = new HttpResetClass()
2022
+ let data = {
2023
+ tables: this.show_data.onetomany[i].tables,
2024
+ row: this.$refs.service_show.model.rows[i][j]
2025
+ }
2026
+ await http.load('POST', 'rs/logic/applyDeleteValue', {data: data}, {
2027
+ resolveMsg: null,
2028
+ rejectMsg: 'onetomanydelete失败'
2029
+ }).then(() => {
2030
+ this.$dispatch('selfsearch')
2031
+ this.$refs.service_show.model.rows[i].splice(j, 1)
2032
+ })
2033
+ this.initializtion()
2034
+ },
2035
+ //获取view层confirm事件
2036
+ async 'confirm'(tables, row,showadd_index,j) {
2037
+ var _this = this
2038
+ for (let i = 0; i < tables.length; i++) {
2039
+ let datas = {
2040
+ tables: tables,
2041
+ row: row
2042
+ }
2043
+ datas.row['f_process_id'] = this.selectdata.f_process_id
2044
+ datas.row['f_apply_num'] = this.selectdata.f_apply_num
2045
+ datas.row['f_filiale'] = this.selectdata.f_filiale
2046
+ let http = new HttpResetClass()
2047
+ if (tables[i] == 't_charge_record') {
2048
+ await http.load('POST', 'rs/logic/applycharge', datas, {
2049
+ resolveMsg: null,
2050
+ rejectMsg: '收费保存失败'
2051
+ }).then((res) => {
2052
+ // 刷新列表数据
2053
+ this.$dispatch('selfsearch')
2054
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
2055
+
2056
+ if (this.$refs.service_show.data.fields[i].label == '累计缴费金额') {
2057
+ this.$refs.service_show.data.fields[i].value = res.data.f_cumulative_money
2058
+ }
2059
+
2060
+ if (this.$refs.service_show.data.fields[i].label == '未结总金额') {
2061
+ this.$refs.service_show.data.fields[i].value = res.data.f_unaccounts_money
2062
+ }
2063
+ }
2064
+ _this.initializtion()
2065
+ })
2066
+ } else if (tables[i] == 't_batch_fire') {
2067
+ console.log('即将要保存的数据:',datas)
2068
+ datas.row.f_cash = (datas.row.f_number*datas.row.f_price)
2069
+ await http.load('POST', 'rs/logic/saveentity', datas, {
2070
+ resolveMsg: null,
2071
+ rejectMsg: 'onetomany保存失败'
2072
+ }).then((res) => {
2073
+ // 刷新列表数据
2074
+ this.$dispatch('selfsearch')
2075
+ let temp = _this.$refs.service_show.model.rows[showadd_index][j]
2076
+ temp.id = res.data.id
2077
+ _this.$refs.service_show.model.rows[showadd_index][j] = temp
2078
+ _this.initializtion()
2079
+ })
2080
+ }else {
2081
+ await http.load('POST', 'rs/logic/saveentity', datas, {
2082
+ resolveMsg: null,
2083
+ rejectMsg: 'onetomany保存失败'
2084
+ }).then((res) => {
2085
+ // 刷新列表数据
2086
+ this.$dispatch('selfsearch')
2087
+ let temp = _this.$refs.service_show.model.rows[showadd_index][j]
2088
+ temp.id = res.data.id
2089
+ _this.$refs.service_show.model.rows[showadd_index][j] = temp
2090
+ _this.initializtion()
2091
+ for(let i =0;i<this.show_data.fields.length;i++){
2092
+ if(this.show_data.fields[i].label == '工料费'||this.show_data.fields[i].label == '延伸服务费'||this.show_data.fields[i].label =='金额'||this.show_data.fields[i].label =='不锈钢波纹管费合计') {
2093
+ this.show_data.fields[i].readonly = true
2094
+ let httpf = new HttpResetClass()
2095
+ let resf = httpf.load('POST','rs/sql/ApplyPaySearch', {data:{condition: ` f_apply_num ='${this.selectdata.f_apply_num}'`}},{resolveMsg: null, rejectMsg: '获取工料费和延伸服务费失败!'})
2096
+ if(this.show_data.fields[i].label == '工料费'){
2097
+ this.show_data.fields[i].value = resf.data[0].f_glf
2098
+ }else if(this.data.fields[i].label == '延伸服务费'&&!this.show_data.fields[i].value){
2099
+ this.show_data.fields[i].value = resf.data[0].f_ysfwf
2100
+ }else if(this.selectdata.defname == '点火'&&this.show_data.fields[i].label =='不锈钢波纹管费合计'){
2101
+ this.show_data.fields[i].value = resf.data[0].f_dhbxgbwg
2102
+ }else if(this.selectdata.defname == '点火申请'&&this.show_data.fields[i].label =='金额'){
2103
+ this.show_data.fields[i].value = resf.data[0].f_ysfwf
2104
+ }
2105
+ }
2106
+ }
2107
+ })
2108
+ }
2109
+ }
2110
+
2111
+ }
2112
+ }
2113
+ }
2114
+ </script>