apply-clients 5.0.35-33 → 5.0.35-36

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,1812 +1,1827 @@
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=='材料导入'" v-ref:material
6
- :selectdata="selectdata"
7
- :state="2"
8
- :edit="true"></material-message>
9
- <material-message v-if="selectdata.defname=='材料审核'" v-ref:material
10
- :selectdata="selectdata"
11
- :state="1"
12
- :edit="true"></material-message>
13
- <receive-batch v-if="selectdata.defname == '派工单'" :selectdata="selectdata" v-ref:receivebatch></receive-batch>
14
- <project-settlement v-if="selectdata.defname == '工程结算'" :selectdata="selectdata"></project-settlement>
15
- <!-- <installfee :infee="selectdata" :showfee='true' v-if="selectdata.defname == '通气条件确认'"></installfee>-->
16
- <buyer-message v-ref:buyermessagev :selectdata="selectdata" :state="1" v-if="selectdata.defname == '收费'" ></buyer-message>
17
- <!-- <installfee :infee="selectdata" v-if="selectdata.defname == '收费'"></installfee>-->
18
- <service-view v-ref:service_show :data="show_data" v-if="showview" :is_show_datacheck="datacheck"></service-view>
19
-
20
- <modal :show.sync="showbuyerinfo" v-ref:modal backdrop="false">
21
- <header slot="modal-header" class="modal-header">
22
- <button type="button" class="close" @click="closebuyerinfo"><span>&times;</span></button>
23
- <h4 class="modal-title">打印电子发票,请请选择购货方信息</h4>
24
- </header>
25
- <article slot="modal-body" class="modal-body">
26
- <div v-if="showbuyerinfo">
27
- <div class="col-sm-12 span recordTable" style="margin-top: 10px;min-height: 350px">
28
- <partial-view v-ref:single-load>
29
- <data-grid :model="buyerinfo" v-ref:grid>
30
- <template partial='head'>
31
- <tr>
32
- <th>序号</th>
33
- <th>购货方名称</th>
34
- <th>购货方纳税人识别号</th>
35
- <th>购货方地址、电话</th>
36
- <th>购货方开户行及账号</th>
37
- <th>购货方电子邮箱</th>
38
- <th>操作</th>
39
- </tr>
40
- </template>
41
- <template partial='body'>
42
- <td style="text-align: center">{{$index+1}}</td>
43
- <td style="text-align: center">{{row.f_buyer_name}}</td>
44
- <td style="text-align: center">{{row.f_buyer_identify}}</td>
45
- <td style="text-align: center">{{row.f_buyer_addphone}}</td>
46
- <td style="text-align: center">{{row.f_buyer_bank}}</td>
47
- <td style="text-align: center">{{row.f_buyer_email}}</td>
48
- <td style="text-align: center">
49
- <button type="button" class="btn btn-success"
50
- @click='$parent.$parent.$parent.$parent.confirmbuyerinfo(row)'>选择
51
- </button>
52
- </td>
53
- </template>
54
- </data-grid>
55
- </partial-view>
56
- </div>
57
- </div>
58
- </article>
59
- <footer slot="modal-footer" class="modal-footer">
60
- <button v-show="showbuyerinfo" type="button" class="btn btn-default" @click='closebuyerinfo'>取消</button>
61
- </footer>
62
- </modal>
63
-
64
- <apply-accept-bill :show="acceptprint" :bill-url='acceptUrl' v-on:toggle="close" :data='row' :billdata="printData" v-ref:acceptbill @closeaccept="closeAccept"></apply-accept-bill>
65
- <!--打印报表html-->
66
- <!-- <div v-show="false">-->
67
- <!-- <div class="row" style="display: flex;justify-content: center;" id='bill-fee'>-->
68
- <!-- {{{bill}}}-->
69
- <!-- </div>-->
70
- <!-- <report-print id='bill-fee' top='15mm' left='5mm' width='90%' height='70%' :showbtn="false" preview="true"-->
71
- <!-- v-ref:reportprint></report-print>-->
72
- <!-- </div>-->
73
-
74
-
75
- </template>
76
- <script>
77
- import Vue from 'vue'
78
- import {HttpResetClass} from 'vue-client'
79
- import * as Util from '../../../../Util'
80
- // import AppData from 'stores/AppData'
81
- // Date格式化
82
- Date.prototype.Format = function (fmt) {
83
- var o = {
84
- "M+": this.getMonth() + 1, //月份
85
- "d+": this.getDate(), //日
86
- "H+": this.getHours(), //小时
87
- "m+": this.getMinutes(), //分
88
- "s+": this.getSeconds(), //秒
89
- "q+": Math.floor((this.getMonth() + 3) / 3), //季度
90
- "S": this.getMilliseconds() //毫秒
91
- };
92
- if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
93
- for (var k in o)
94
- if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
95
- return fmt;
96
- }
97
-
98
- export default {
99
- title: '报建流程业务控制层',
100
- props: ['selectdata'],
101
- data() {
102
- return {
103
- acceptprint: false,
104
- acceptUrl: 'rs/report/printReceiptbill',
105
- printData:{
106
- f_user_name: '',
107
- f_address: '',
108
- f_user_phone:'',
109
- f_work_type: '新报装',
110
- f_news:'身份证'
111
- },
112
- data: null, // 数据库数据,json配置文件数据的数据集合
113
- json_datas: null, // Json配置文件集合
114
- showview: false, // 控制显示service-view组件
115
- show_data: null, // 给view层显示的数据
116
- department_search: [], // 当前部门下所有人
117
- contract: null, // 单值表合同编号记录
118
- technologist: [], // 技术人员 角色下的人
119
- price: 0,
120
- cost: 0,
121
- number: 0,
122
- pgd: '',
123
- showbuyerinfo: false, // 新增购货方信息模态框开关
124
- selectsellid: null, //需要打票收费id
125
- buyerinfo: {
126
- id: '',
127
- f_buyer_name: '',
128
- f_buyer_identify: '',
129
- f_buyer_addphone: '',
130
- f_buyer_bank: '',
131
- f_buyer_email: '',
132
- rows: [] // 购货方信息
133
- },
134
- bill: '',
135
- areaall:[]
136
- }
137
- },
138
- methods: {
139
- /*
140
- ============================================收费临时使用
141
- */
142
- closeAccept () {
143
- this.acceptprint = false
144
- },
145
- close () {
146
- this.acceptprint = false
147
- },
148
- printok () {
149
- this.$dispatch('success')
150
- },
151
- validateBill (val) {
152
- this.validateOk = !val.isOk
153
- this.billData.bill = val.bill
154
- },
155
- async printReceipt(model) {
156
- console.log('打印回单了11111111111111111model', model)
157
- this.acceptprint = true
158
- this.acceptUrl = 'rs/report/printReceiptbill'
159
- this.printData.f_work_type = `'${model.f_work_type}'`
160
- this.printData.f_news = `'${model.f_news}'`
161
- this.printData.f_user_name = `'${model.f_user_name}'`
162
- this.printData.f_address = `'${model.f_address}'`
163
- this.printData.f_user_phone = `'${model.f_phone}'`
164
- },
165
-
166
- async printbill(sellid) {
167
- let result = await this.$resetpost('rs/report/applyCharge_bill', {data: {condition: `c.id = ${sellid}`}}, {
168
- resolveMsg: null,
169
- rejectMsg: "提取数据出错,请重试!"
170
- })
171
- this.bill = result.data
172
- console.log('this.bill', this.bill)
173
- this.$nextTick(() => {
174
- this.$refs.reportprint.print()
175
- })
176
- },
177
- confirmbuyerinfo(args) {
178
- let drawbilldata = {
179
- sellid: this.selectsellid,
180
- buyerid: args.id,
181
- operator: this.$login.f.name
182
- }
183
- this.closebuyerinfo()
184
- this.$resetpost('rs/logic/applyDrawBill', {data: drawbilldata}, {resolveMsg: null, rejectMsg: "开发票失败"})
185
- .then((res) => {
186
- if (res.data.status === 200) {
187
- this.$showAlert('申请开具增值税电子发票成功,请稍后到报建功能中【报建收费】中查看电子发票', 'success', 5000)
188
- /*let n = 0
189
- var id = setInterval(async ()=>{
190
- if(n>=3){
191
- this.$showMessage('电子票延迟,请稍后查看!')
192
- clearInterval(id)
193
- }
194
- if (this.seeeticket(res.data) === 'success'){
195
- clearInterval(id)
196
- this.load()
197
- }
198
- n++
199
- this.$showAlert('电子发票开票中,请稍后...', 'info',3000)
200
- },3000)*/
201
- } else {
202
- this.$showAlert('电子发票开票失败,失败代码为:' + res.data.status, 'warning', 3000)
203
- }
204
- })
205
- },
206
- // 金额转大写
207
- smalltoBIG(n) {
208
- let fraction = ['角', '分'];
209
- let digit = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖'];
210
- let unit = [['', '', '亿'], ['', '拾', '佰', '仟']];
211
- let head = n < 0 ? '' : '';
212
- n = Math.abs(n);
213
-
214
- let s = '';
215
-
216
- for (var i = 0; i < fraction.length; i++) {
217
- s += (digit[Math.floor(n * 10 * Math.pow(10, i)) % 10] + fraction[i]).replace(/零./, '');
218
- }
219
- s = s || '';
220
- n = Math.floor(n);
221
-
222
- for (var i = 0; i < unit[0].length && n > 0; i++) {
223
- let p = '';
224
- for (var j = 0; j < unit[1].length && n > 0; j++) {
225
- p = digit[n % 10] + unit[1][j] + p;
226
- n = Math.floor(n / 10);
227
- }
228
- s = p.replace(/(零.)*零$/, '').replace(/^$/, '零') + unit[0][i] + s;
229
- }
230
- return head + s.replace(/(零.)*零元/, '').replace(/(零.)+/g, '零').replace(/^整$/, '零元整')
231
- },
232
- // 关闭模态框
233
- closebuyerinfo() {
234
- this.showbuyerinfo = false
235
- this.selectsellid = null
236
- },
237
- //根据票据流水号查看票据
238
- async seeeticket(val) {
239
- console.log('该票据流水号为:', val.f_fpqqlsh)
240
- var eticketData = await this.$resetpost('rs/sql/querySingleTable', {
241
- data: {
242
- items: 'f_bill_url,f_url_code',
243
- tablename: 't_eticket',
244
- condition: `f_serial_number=${val.f_fpqqlsh}`
245
- }
246
- }, {resolveMsg: null, rejectMsg: null})
247
- console.log('eticketData:', eticketData)
248
- var data = eticketData.data[0]
249
- if (data.f_bill_url && data.f_bill_url != '') {
250
- console.log(data)
251
- var auth = data.f_bill_url.split("/")
252
- console.log("截取", auth)
253
- var authCode = auth[auth.length - 1]
254
- var url = `https://${auth[2]}/ent-views/fpExtract/get_fapiao.html?pwd=${data.f_url_code}&authCode=${authCode}`
255
- this.$showAlert('开票成功!', 'success', 500)
256
- window.open(url)
257
- return 'success'
258
- }
259
- return 'fail'
260
- },
261
- async loadbuyer() {
262
- //获取购货方信息
263
- let querybuyerdata = {
264
- tablename: 't_buyer_info',
265
- condition: `f_process_id = '${this.selectdata.f_process_id}' and f_apply_num = '${this.selectdata.f_apply_num}'`
266
- }
267
- let buyerinfos = await this.$resetpost('rs/sql/singleTable', {data: querybuyerdata}, {
268
- resolveMsg: null,
269
- rejectMsg: '获取购货方信息失败'
270
- })
271
- this.buyerinfo.rows = buyerinfos.data
272
- },
273
- /*
274
- ============================================收费临时使用结束
275
- */
276
- // AOP后续特殊化处理
277
- async special(model) {
278
- if (model.button.button_name === '提交' && model.button.button_event && model.button.button_event === '分支流程异步处理') {
279
- // 分支流程异步处理
280
- let http = new HttpResetClass();
281
- let res = await http.load('POST', 'rs/logic/branchsyncprocess', {
282
- data: {
283
- model: model,
284
- loginUser: this.$login.f
285
- }
286
- }, {resolveMsg: null, rejectMsg: '分支流程异步处理保存失败'})
287
- console.log("分支流程异步处理:", JSON.stringify(res.data))
288
- }
289
-
290
- if (this.data.distribute_async && model.button.button_name === '下发') {
291
- // 同流程节点异步处理
292
- let http = new HttpResetClass();
293
- let res = await http.load('POST', 'rs/logic/syncprocess', {
294
- data: {
295
- model: model,
296
- loginUser: this.$login.f
297
- }
298
- }, {resolveMsg: null, rejectMsg: '流程异步下发据保存失败'})
299
- console.log("流程的异步处理:", JSON.stringify(res.data))
300
- }
301
- if (this.data.distribute_async && model.button.button_name === '完成') {
302
- // 强制结束
303
- let http = new HttpResetClass();
304
- let res = await http.load('POST', 'rs/logic/stoprocess', {
305
- data: {
306
- model: model,
307
- loginUser: this.$login.f
308
- }
309
- }, {resolveMsg: null, rejectMsg: '流程异步完成数据保存失败'})
310
- console.log("流程的异步处理:", JSON.stringify(res.data))
311
- }
312
- },
313
- // 组件初始化操作
314
- refurbish(val) {
315
- this.selectdata = val
316
- this.json_datas = this.$workflow_vue
317
- console.log("初始化jsonDataS==", this.json_datas)
318
- let sum = 0
319
- let jsonData = {}
320
- if(!this.json_datas||!this.json_datas.activitys||this.json_datas.activitys.length==0){
321
- this.$showMessage("网络故障,请刷新页面")
322
- return
323
- }
324
- for (let i = 0; i < this.json_datas.activitys.length; i++) {
325
- if (this.selectdata.defname == this.json_datas.activitys[i].title) {
326
- jsonData = this.json_datas.activitys[i]
327
- sum++
328
- }
329
- }
330
- for (let j = 0; j < jsonData.fields.length; j++) {
331
- jsonData.fields[j].value = ''
332
- console.log("是否有default属性jsonData.fields[j]", jsonData.fields[j])
333
- if (jsonData.fields[j].default) {
334
- jsonData.fields[j].value = jsonData.fields[j].default
335
- }
336
- }
337
- if (sum == 1) {
338
- console.log("jsonData==", jsonData)
339
- this.data = null
340
- this.data = jsonData
341
- this.initializtion()
342
- } else if (sum == 0) {
343
- this.$showMessage(`没有在JSON配置文件中找到活动名为:(${this.selectdata.defname})的节点配置`)
344
- } else {
345
- this.$showMessage(`在JSON配置文件中找到活动名为:(${this.selectdata.defname})的节点配置:${sum}个`)
346
- }
347
- },
348
- //生成派工单号
349
- createpgd() {
350
- this.pgd = "BJ"
351
- var d = new Date()
352
- this.pgd+=d.getFullYear()
353
- if(d.getMonth() + 1<10){
354
- this.pgd+='0'+(d.getMonth() + 1)
355
- }
356
- else{
357
- this.pgd+=(d.getMonth() + 1)
358
- }
359
- if(d.getDate() <10){
360
- this.pgd+='0'+d.getDate()
361
- }
362
- else{
363
- this.pgd+=d.getDate()
364
- }
365
- if(d.getHours() <10){
366
- this.pgd+='0'+d.getHours()
367
- }
368
- else{
369
- this.pgd+=d.getHours()
370
- }
371
- if(d.getMinutes() <10){
372
- this.pgd+='0'+d.getMinutes()
373
- }
374
- else{
375
- this.pgd+=d.getMinutes()
376
- }
377
- if(d.getSeconds() <10){
378
- this.pgd+='0'+d.getSeconds()
379
- }
380
- else{
381
- this.pgd+=d.getSeconds()
382
- }
383
- },
384
-
385
-
386
-
387
- // AOP:进入vue组件前初始化内容
388
- // json配置数据处理 比如下拉框的options
389
- async initializtion() {
390
- console.log("this.data.table", this.data.tables)
391
- this.showview = false
392
- // 有合同号不给合同表里插入数据
393
- for(let i=0;i<this.data.tables.length;i++){
394
- if('t_contract'==this.data.tables[i]&&this.selectdata.f_contract_number){
395
- this.data.tables.splice(i,1)
396
- }
397
- }
398
- // 下发人 options 处理,options初始化
399
- if (this.selectdata.defname.indexOf('派单')>=0&&this.selectdata.actorexpression) {
400
- let http = new HttpResetClass()
401
- http.load('POST', 'rs/search', `{"source":"this.getParentByType($organization$).getChildByName($工程部门$).getChildByName($工程部门负责人$).getChildren()","userid":"${this.$login.f.id}"}`, {
402
- resolveMsg: null,
403
- rejectMsg: null
404
- }).then((res)=>{
405
-
406
-
407
- let jsonString = JSON.stringify(res.data)
408
- let jsonArray = []
409
- if (jsonString.startsWith("{")) {
410
- jsonArray.push(res.data)
411
- res.data = jsonArray
412
- }
413
- this.department_search = res.data
414
- if (this.department_search&&this.showview) {
415
- let array = []
416
- for (let k = 0; k < this.department_search.length; k++) {
417
- array.push({
418
- label: this.department_search[k].name,
419
- value: {id: this.department_search[k].id, name: this.department_search[k].name}
420
- })
421
- }
422
- for(let x=0;x<this.data.buttons.length;x++){
423
- if(this.data&&this.data.buttons[x].button_name=="下发"){
424
- this.data.buttons[x].button_fields[0].options = array
425
- }
426
- if(this.show_data &&this.show_data.buttons[x].button_name=="下发"){
427
- this.show_data.buttons[x].button_fields[0].options = array
428
- }
429
- }
430
- }
431
- })
432
- }
433
-
434
- //debugger
435
-
436
- // selectdata 填充 data
437
- this.data = Object.assign({}, this.data, this.selectdata)
438
- // onetomany 数据获取
439
- if (this.data.onetomany) {
440
- console.log('判断是onetomany,this.data.onetomany的数据为=>' + JSON.stringify(this.data.onetomany))
441
- for (let index = 0; index < this.data.onetomany.length; index++) {
442
- let http = new HttpResetClass()
443
- let data = {}
444
- if (this.data.onetomany[index].tables[0] == 't_charge_record') {
445
- data = {
446
- tablename: this.data.onetomany[index].tables[0],
447
- condition: `f_apply_num = '${this.selectdata.f_apply_num}' and f_process_id='${this.selectdata.f_process_id}' and f_charging_status != '作废'`
448
- }
449
- } else {
450
- data = {
451
- tablename: this.data.onetomany[index].tables[0],
452
- condition: `f_apply_num = '${this.selectdata.f_apply_num}' and f_process_id='${this.selectdata.f_process_id}'`
453
- }
454
- }
455
- let res = await http.load('POST', 'rs/sql/singleTable', {data: data}, {
456
- resolveMsg: null,
457
- rejectMsg: 'onetomany查询失败'
458
- })
459
- // 初始化 onetomany
460
- let rows = []
461
- console.log('查询返回结果res.data=>' + JSON.stringify(res.data))
462
- this.data.onetomany[index].rows = res.data
463
- // console.log(JSON.stringify('this.data.onetomany[index].rows=>' + JSON.stringify(this.data.onetomany[index].rows)))
464
-
465
- // 初始化onetomany中的fields
466
- for (let j = 0; j < this.data.onetomany[index].fields.length; j++) {
467
- // 如果配置类型为select,优先从参数列表获取options
468
- if (this.data.onetomany[index].fields[j].type === 'select') {
469
- let temp = Vue.$appdata.getParam(this.data.onetomany[index].fields[j].label)
470
- if (temp && temp.length > 0) {
471
- this.data.onetomany[index].fields[j].options = Vue.$appdata.getParam(this.data.onetomany[index].fields[j].label)
472
- }
473
- }
474
- }
475
- }
476
- }
477
- // 初始化 fields
478
- for (let i = 0; i < this.data.fields.length; i++) {
479
- // 如果selectdata有这些key,则把selectdata的value赋值给data的value
480
- if (this.selectdata[this.data.fields[i].field]) {
481
- if (String(this.selectdata[this.data.fields[i].field]).startsWith("{")) {
482
- this.data.fields[i].value = JSON.parse(this.selectdata[this.data.fields[i].field])
483
- } else {
484
- this.data.fields[i].value = this.selectdata[this.data.fields[i].field]
485
- }
486
-
487
- }
488
- // 如果配置类型为select,优先从参数列表获取options
489
- if (this.data.fields[i].type === 'select') {
490
- let temp = Vue.$appdata.getParam(this.data.fields[i].label)
491
- if (temp && temp.length > 0) {
492
- this.data.fields[i].options = Vue.$appdata.getParam(this.data.fields[i].label)
493
- }
494
- }
495
-
496
- if (this.data.defname === '工程结算') {
497
- var a = 0
498
- var b = 0
499
- var c = 0
500
- for (let i = 0; i < this.data.fields.length; i++) {
501
- if (this.data.fields[i].label === '最终核算成本金额') {
502
- this.data.fields[i].value = (this.cost + this.number)
503
- a = this.data.fields[i].value
504
- }
505
- if (this.data.fields[i].label === '合同总金额') {
506
- b = this.data.fields[i].value
507
- }
508
- if (this.data.fields[i].label === '材料成本金额') {
509
- this.data.fields[i].value = this.number
510
- }
511
- if (this.data.fields[i].label === '其他成本金额') {
512
- this.data.fields[i].value = this.cost
513
- }
514
- }
515
- c = b - a
516
- for (let i = 0; i < this.data.fields.length; i++) {
517
- if (this.data.fields[i].label === '工程盈利') {
518
- this.data.fields[i].value = c
519
- }
520
- }
521
- }
522
- if (this.selectdata.defname.indexOf('派单')>=0) {
523
- let money=0
524
-
525
- for (let i = 0; i < this.data.fields.length; i++) {
526
- if (this.data.fields[i].label === '派工单号') {
527
- console.log("给派工单号赋值")
528
- this.createpgd()
529
- console.log(this.pgd)
530
- this.data.fields[i].value = this.pgd
531
- }
532
- if (this.data.fields[i].label === '合同总金额') {
533
- console.log('合同总金额===>'+this.data.fields[i].value )
534
- money=this.data.fields[i].value
535
- }
536
- let dealmoney=0;
537
- if (this.data.fields[i].label == '累计缴费金额') {
538
- dealmoney=this.data.fields[i].value
539
- console.log('累计缴费金额===>'+dealmoney )
540
- }
541
-
542
- if (this.data.fields[i ].label == '未结总金额') {
543
- /// if(money=="" || dealmoney==""){
544
- /// money=0;
545
- /// dealmoney=0;
546
- /// }
547
- /// if(money==null || dealmoney==null){
548
- /// money=0;
549
- /// dealmoney=0;
550
- /// }
551
- ///
552
- let othermoney = money-dealmoney;
553
- console.log('jine'+othermoney)
554
- this.data.fields[i].value=money-dealmoney
555
- console.log('未结总金额'+this.data.fields[i].value )
556
- }
557
- }
558
- }
559
- if(this.data.defname=="派单"){
560
- for (let i = 0; i < this.data.fields.length; i++) {
561
- if (this.data.fields[i].label === '未结总金额') {
562
- this.data.fields[i].value=0
563
- console.log("派单"+this.data.fields[i].value)
564
- }
565
- }
566
- }
567
-
568
-
569
- if (this.selectdata.defname ==='报价审核') {
570
- let unaccount=0
571
- for (let i = 0; i < this.data.fields.length; i++) {
572
- if (this.data.fields[i].label === '费用合计') {
573
- console.log("算一下未结算金额")
574
- unaccount=this.data.fields[i].value
575
- }
576
- if (this.data.fields[i].label === '未结总金额') {
577
- this.data.fields[i].value=unaccount
578
- }
579
-
580
- }
581
- }
582
-
583
-
584
- if (this.data.defname === '收费') {
585
- let account_money=0
586
- let total_money=0
587
- let bill_money=0
588
- for (let i = 0; i < this.data.fields.length; i++) {
589
- if (this.data.fields[i].label === '合同金额') {
590
- total_money=this.data.fields[i].value
591
- }
592
- if (this.data.fields[i].label === '累计缴费金额') {
593
- account_money=this.data.fields[i].value
594
- }
595
- if (this.data.fields[i].label === '未结总金额') {
596
- this.data.fields[i].value=total_money-account_money
597
- }
598
- if (this.data.fields[i].label === '累计开票金额') {
599
- bill_money=this.data.fields[i].value
600
- }
601
- if (this.data.fields[i].label === '未开票金额') {
602
- this.data.fields[i].value=total_money-bill_money
603
-
604
- }
605
- }
606
- }
607
- // 特殊处理
608
- //施工环节 如果是个人报建需要提交表具信息
609
- if (this.data.defname === '施工') {
610
- for (let i = 0; i < this.data.fields.length; i++) {
611
- if (this.data.fields[i].label === '气表品牌'
612
- || this.data.fields[i].label === '气表型号'
613
- || this.data.fields[i].label === '气表厂家') {
614
- if (this.data.f_apply_type === '个人报建') {
615
- this.data.fields[i].hidden = false
616
- this.data.fields[i].required = true
617
- }
618
- }
619
- }
620
- }
621
-
622
- // 特殊处理
623
- //施工环节 如果是个人报建需要提交表具信息
624
- if (this.data.defname === '安装通气') {
625
- for (let i = 0; i < this.data.fields.length; i++) {
626
- if (this.data.fields[i].label === '气表品牌'
627
- || this.data.fields[i].label === '气表型号'
628
- || this.data.fields[i].label === '气表厂家') {
629
- this.data.fields[i].required = true
630
- this.data.fields[i].hidden = false
631
- if(this.data.f_work_type=='改管'){
632
- this.data.fields[i].required = false
633
- }
634
-
635
- }
636
- if(this.data.fields[i].label === '验收结果'){
637
- this.data.fields[i].required = true
638
- }
639
-
640
- }
641
- }
642
- if (this.data.defname === '设计报价') {
643
- for (let i = 0; i < this.data.fields.length; i++) {
644
- if (this.data.fields[i].label === '气表品牌'
645
- || this.data.fields[i].label === '气表型号') {
646
- this.data.fields[i].required = true
647
- this.data.fields[i].hidden = false
648
- if(this.data.f_work_type=='改管'){
649
- this.data.fields[i].required = false
650
- }
651
-
652
- }
653
-
654
- }
655
- }
656
- if (this.data.defname === '现场勘查定价') {
657
- for (let i = 0; i < this.data.fields.length; i++) {
658
- if (this.data.fields[i].label === '勘查结果') {
659
- this.data.fields[i].required = true
660
- }
661
- }
662
- }
663
- //通气环节可以调出施工环节的表信息来修改
664
- if (this.data.defname === '通气') {
665
- for (let i = 0; i < this.data.fields.length; i++) {
666
- if (this.data.fields[i].label === '气表品牌'
667
- || this.data.fields[i].label === '气表型号'
668
- || this.data.fields[i].label === '气表厂家') {
669
- if (this.data.fields[i].value != null && this.data.fields[i].value != '') {
670
- this.data.fields[i].hidden = false
671
- this.data.fields[i].required = true
672
- }
673
- }
674
- }
675
- }
676
- let array = this.$login.f.rolesnames.split(',')
677
- if ((this.data.fields[i].label === '技术人员' || array.includes("工程技术部负责人"))&&(this.selectdata.defname=='勘察初设'||this.selectdata.defname=='任务分配'||this.selectdata.defname=='合同信息')) { //{"source":"this.getParentByType($organization$).getChildByName($技术人员$).getChildren()","userid":"296851"}
678
- let http = new HttpResetClass()
679
- let res = await http.load('POST', 'rs/search', `{"source":"this.getParentByType($organization$).getChildByName($工程技术部门$).getChildByName($技术人员$).getChildren()","userid":"${this.$login.f.id}"}`, {
680
- resolveMsg: null,
681
- rejectMsg:null // 'search查询技术人员失败,请联系管理员配置技术人员角色'
682
- })
683
- // console.log("search查询部门下所有人:", JSON.stringify(res.data))
684
- this.technologist = res.data
685
- if (this.technologist) {
686
- let array = []
687
- for (let k = 0; k < this.technologist.length; k++) {
688
- array.push({
689
- label: this.technologist[k].name,
690
- value: {name: this.technologist[k].name, id: this.technologist[k].id}
691
- })
692
- }
693
- if (!array.includes("工程技术部负责人")&&this.data.fields[i].label === '技术人员') {
694
- this.data.fields[i].options = array
695
- }
696
-
697
- }
698
- }
699
- if (this.data.fields[i].label == '县/区') {
700
- let area = await this.$resetpost('rs/sql/singleTable', {
701
- data: {
702
- // items: 'f_bill_url,f_url_code',
703
- tablename: 't_pcd',
704
- condition: `f_filialeids = '${this.$login.f.f_orgids}'`
705
- }
706
- }, {resolveMsg: null, rejectMsg: null})
707
- let rs = []
708
- for (let i = 0; i < area.data.length; i++) {
709
- let temp = {
710
- label: area.data[i].f_pcd,
711
- value: area.data[i].f_pcd
712
- }
713
- rs.push(temp)
714
- }
715
- this.data.fields[i].options = [{label: '全部', value: ''}, ...rs]
716
- }
717
- let gasbrand_id=''
718
- if (this.data.fields[i].label == '气表品牌') {
719
- let meterbrand = await this.$resetpost('rs/sql/singleTable', {
720
- data: {
721
- items: 'f_meter_brand',
722
- tablename: 't_gasbrand',
723
- condition: `f_filialeids = '${this.$login.f.f_orgids}'`
724
- }
725
- }, {resolveMsg: null, rejectMsg: null})
726
- let rs = []
727
- for (let i = 0; i < meterbrand.data.length; i++) {
728
- let temp = {
729
- label: meterbrand.data[i].f_meter_brand,
730
- value: meterbrand.data[i].f_meter_brand
731
- }
732
- rs.push(temp)
733
- }
734
- this.data.fields[i].options = [{label: '全部', value: ''}, ...rs]
735
- }
736
- if (this.data.fields[i].label == '气表型号') {
737
- this.data.fields[i].options = [];
738
- }
739
- if (this.data.fields[i].label == '气价名称') {
740
- let meterbrand = await this.$resetpost('rs/sql/singleTable', {
741
- data: {
742
- items: 'f_price_name',
743
- tablename: 't_stairprice',
744
- condition: `f_filialeids = '${this.$login.f.f_orgids}' and f_state= '有效' and getdate()>=f_perform_date and getdate()<=f_end_date `
745
- }
746
- }, {resolveMsg: null, rejectMsg: null})
747
- let rs = []
748
- for (let i = 0; i < meterbrand.data.length; i++) {
749
- let temp = {
750
- label: meterbrand.data[i].f_price_name,
751
- value: meterbrand.data[i].f_price_name
752
- }
753
- rs.push(temp)
754
- }
755
- this.data.fields[i].options = [{label: '全部', value: ''}, ...rs]
756
- }
757
- if (this.data.fields[i].label == '合同类型') {
758
- this.data.fields[i].value = '主合同'
759
- }
760
- if (this.data.fields[i].label == '合同业务办理人') {
761
- if (this.selectdata.f_apply_kefu_employee) {
762
- if (this.selectdata.f_apply_kefu_employee.startsWith("{") && this.selectdata.f_apply_kefu_employee.endsWith("}")) {
763
- let temp = JSON.parse(this.selectdata.f_apply_kefu_employee)
764
- this.data.fields[i].value = temp.name
765
- } else {
766
- this.data.fields[i].value = this.selectdata.f_apply_kefu_employee
767
- }
768
- } else {
769
- if (this.selectdata.f_survey_name) {
770
- if (this.selectdata.f_survey_name.startsWith("{") && this.selectdata.f_survey_name.endsWith("}")) {
771
- let temp = JSON.parse(this.selectdata.f_survey_name)
772
- this.data.fields[i].value = temp.name
773
- } else {
774
- this.data.fields[i].value = this.selectdata.f_survey_name
775
- }
776
- }
777
- }
778
- }
779
- if (this.data.fields[i].label == '合同编号' && !this.selectdata[this.data.fields[i].field] && this.selectdata.defname == '合同审核') {
780
- if (!this.$appdata.getSingleValue('所属公司编码')) {
781
- this.$showMessage(`请先去参数管理设置: 所属公司编码`)
782
- }
783
- if (!this.$appdata.getSingleValue(this.data.fields[i].label)) {
784
- this.$showMessage(`请先去参数管理设置: ${this.data.fields[i].label}`)
785
- } else {
786
- let http = new HttpResetClass()
787
- //获取购货方信息
788
- let data = {
789
- tablename: 't_singlevalue',
790
- condition: `name = '合同编号' and f_filialeids = '${this.$login.f.f_orgids}'`
791
- }
792
- let res = await http.load('POST','rs/sql/singleTable', {data: data}, {
793
- resolveMsg: null,
794
- rejectMsg: '获取合同编号失败'
795
- }).then((res)=>{
796
- let temp = res.data[0].value
797
- this.contract = temp
798
- while (temp.length < 4) {
799
- temp = '0' + temp
800
- }
801
- let dt = new Date()
802
- this.data.fields[i].value = this.$appdata.getSingleValue('所属公司编码') + dt.getFullYear() + ((dt.getMonth() + 1) < 10 ? '0' + (dt.getMonth() + 1) : dt.getMonth()) + temp
803
- if(this.showview){
804
- this.$refs.service_show.data.fields[i].value = this.$appdata.getSingleValue('所属公司编码') + dt.getFullYear() + ((dt.getMonth() + 1) < 10 ? '0' + (dt.getMonth() + 1) : dt.getMonth()) + temp
805
- this.$refs.service_show.update()
806
- }
807
-
808
- })
809
- // this.$refs.service_show.update()
810
- }
811
- }
812
- }
813
- // 初始化 buttons_fields
814
- //debugger
815
- for (let i = 0; i < this.data.buttons.length; i++) {
816
- if (this.data.buttons[i].button_fields) {
817
- for (let j = 0; j < this.data.buttons[i].button_fields.length; j++) {
818
- // 如果selectdata有这些key,则把selectdata的value赋值给data的value
819
- if (this.selectdata[this.data.buttons[i].button_fields[j].field]) {
820
- this.data.buttons[i].button_fields[j].value = this.selectdata[this.data.buttons[i].button_fields[j].field]
821
- }
822
- // 如果配置类型为select,优先从参数列表获取options
823
- if (this.data.buttons[i].button_fields[j].type === 'select' && this.$appdata.getParam(this.data.buttons[i].button_fields[j].label)) {
824
- this.data.buttons[i].button_fields[j].options = this.$appdata.getParam(this.data.buttons[i].button_fields[j].label).trim()
825
- }
826
- // 下发特殊配置
827
- if (this.data.buttons[i].button_name === '下发') {
828
- if (this.data.buttons[i].button_fields.length === 1) {
829
- // value初始化
830
- // if(this.department_search){
831
- if (this.selectdata[this.data.buttons[i].button_fields[0].field]) {
832
- for (let k = 0; k < this.department_search.length; k++) {
833
- // 将id转换为name
834
- if (Number(this.department_search[k].id) === Number(this.selectdata[this.data.buttons[i].button_fields[0].field])) {
835
- this.data.buttons[i].button_fields[0].value = {
836
- id: this.department_search[k].id,
837
- name: this.department_search[k].name
838
- }
839
- }
840
- }
841
- }
842
-
843
- if (this.department_search) {
844
- let array = []
845
- for (let k = 0; k < this.department_search.length; k++) {
846
- array.push({
847
- label: this.department_search[k].name,
848
- value: {id: this.department_search[k].id, name: this.department_search[k].name}
849
- })
850
- }
851
- this.data.buttons[i].button_fields[0].options = array
852
- }
853
- let array = this.$login.f.rolesnames.split(',')
854
- if (this.selectdata.defname == '任务分配' && array.includes("工程技术部负责人")) {
855
- let array = []
856
- for (let k = 0; k < this.technologist.length; k++) {
857
- array.push({
858
- label: this.technologist[k].name,
859
- value: {id: this.technologist[k].id, name: this.technologist[k].name}
860
- })
861
- }
862
- this.data.buttons[i].button_fields[0].options = array
863
- }
864
- } else {
865
- this.$showMessage("下发按钮必须满足 当且仅当一个字段")
866
- }
867
- }
868
- }
869
- }
870
-
871
- }
872
- var count =0;
873
- let money=0;
874
- let dealmoney=0;
875
- for (count = 0; count < this.data.fields.length; count++) {
876
- if (this.selectdata.defname.indexOf('派单')>=0) {
877
- if (this.data.fields[count].label === '合同总金额') {
878
- console.log('合同总金额===>'+this.data.fields[count].value )
879
- money=this.data.fields[count].value
880
- }
881
-
882
- if (this.data.fields[count].label == '累计缴费金额') {
883
- dealmoney=this.data.fields[count].value
884
- console.log('累计缴费金额===>'+dealmoney )
885
- }
886
-
887
- if (this.data.fields[count].label == '未结总金额') {
888
- let othermoney = money-dealmoney;
889
- console.log('jine'+othermoney)
890
- this.data.fields[count].value=money-dealmoney
891
- console.log('未结总金额'+this.data.fields[count].value )
892
- }
893
- }
894
- }
895
- //debugger
896
- // 消除双向绑定,避免子组件(显示层)数据更改,父组件(控制层)也更改
897
- let temp = JSON.parse(JSON.stringify(this.data))
898
- // let temp = this.data
899
- // 退回原因展示
900
- if (this.selectdata.f_back_reason) {
901
- temp['back_reason'] = this.selectdata.f_back_reason
902
- }
903
- this.show_data = temp
904
- console.log("====="+this.show_data)
905
- /**
906
- * 新增需求: 个人报建非民用流程中小区名称需选填
907
- */
908
- let j=0;
909
- if(this.show_data.defname=="现场勘查人员分配" && this.show_data.f_apply_type=="个人报建"){
910
-
911
- for (j = 0; j < this.show_data.fields.length; j++) {
912
- if (this.show_data.fields[j].label == '小区名称') {
913
- this.show_data.fields[j].required=false
914
- }
915
- }
916
- }
917
- // 显示组件
918
- // this.showview = false
919
- // debugger
920
- this.$nextTick(()=>{
921
- this.showview = true
922
- })
923
- }
924
- }
925
- ,
926
- events: {
927
- 'get-cost'(val) {
928
- this.cost = val
929
-
930
- this.initializtion()
931
- },
932
- 'checkboxSelectControl'(index,index2){
933
- console.log("chufa事件control");
934
- console.log('this.$refs.service_show.data.fields[index]==>:'+JSON.stringify(this.$refs.service_show.data.fields[index]));
935
- if(this.$refs.service_show.data.fields[index].label=="提交资料"){
936
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
937
-
938
- if(this.$refs.service_show.data.fields[i].label=="用户提交资料"){
939
- //if(this.$refs.service_show.data.fields[index].value == ""){
940
- console.log("this.$refs.service_show.data.fields[index].items[index2].value==>"+JSON.stringify(this.$refs.service_show.data.fields[index].items[index2]))
941
- //增加和删除框中的内容
942
- if(this.$refs.service_show.data.fields[index].items[index2].value == false){
943
- this.$refs.service_show.data.fields[i].value+=this.$refs.service_show.data.fields[index].items[index2].label+" ";
944
- this.$refs.service_show.data.fields[index].items[index2].value=true;
945
- }else{
946
- let deleteValue = this.$refs.service_show.data.fields[index].items[index2].label;
947
- let values =this.$refs.service_show.data.fields[i].value;
948
- let result = values.split(" ").filter((item)=>{
949
- return item!=deleteValue;
950
- }).join(" ")
951
- console.log(result);
952
- this.$refs.service_show.data.fields[i].value =result;
953
- this.$refs.service_show.data.fields[index].items[index2].value=false;
954
- }
955
- //}
956
- }
957
- }
958
- }
959
- },
960
- 'get-number'(val) {
961
- this.number = val
962
-
963
- this.initializtion()
964
- }
965
- ,
966
- 'get-pgd'(val) {
967
- this.pgd = val
968
- this.initializtion()
969
- }
970
- ,
971
- // 任意select选中时触发事件,关联性操作
972
- async 'select_cascade'(index) {
973
-
974
-
975
-
976
-
977
- if (this.$refs.service_show.data.fields[index].label == '施工单位' ||
978
- this.$refs.service_show.data.fields[index].label == '检测单位' ||
979
- this.$refs.service_show.data.fields[index].label == '监理单位' ||
980
- this.$refs.service_show.data.fields[index].label == '土建单位' ||
981
- this.$refs.service_show.data.fields[index].label == '设计单位') {
982
- this.$refs.service_show.update()
983
- return
984
- }
985
- if (
986
- this.$refs.service_show.data.fields[index].label === '最终核算成本金额' ||
987
- this.$refs.service_show.data.fields[index].label === '合同总金额' ||
988
- this.$refs.service_show.data.fields[index].label === '工程盈利'
989
- ) {
990
-
991
- var a = 0
992
- var b = 0
993
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
994
- // 控制设置级联
995
- // 源select所选的值 this.$refs.service_show.data.activitys.fields[index].value
996
- // xxx xx xxx
997
- if (this.$refs.service_show.data.fields[i].label === '最终核算成本金额') {
998
- this.$refs.service_show.data.fields[i].value = (this.number + this.cost)
999
- a = this.$refs.service_show.data.fields[i].value
1000
- }
1001
-
1002
- if (this.$refs.service_show.data.fields[i].label === '合同总金额' && this.$refs.service_show.data.fields[i].value) {
1003
- b = this.$refs.service_show.data.fields[i].value
1004
- }
1005
- }
1006
- var c = b - a
1007
- // 数据计算完毕得到工程结余
1008
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1009
- if (this.$refs.service_show.data.fields[i].label === '工程盈利') {
1010
- this.$refs.service_show.data.fields[i].value = c
1011
- }
1012
- }
1013
- }
1014
- //根据合同预算金额和累计缴费金额计算未结金额
1015
- if (
1016
- this.$refs.service_show.data.fields[index].label === '累计缴费金额' ||
1017
- this.$refs.service_show.data.fields[index].label === '合同总金额') {
1018
- let cumulativeMoney = 0
1019
- let unaccountMoney = 0
1020
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1021
-
1022
- if (this.$refs.service_show.data.fields[i].label === '合同总金额' && this.$refs.service_show.data.fields[i].value) {
1023
- cumulativeMoney += parseInt(this.$refs.service_show.data.fields[i].value)
1024
- }
1025
- if (this.$refs.service_show.data.fields[i].label === '累计缴费金额' && this.$refs.service_show.data.fields[i].value) {
1026
- unaccountMoney += parseInt(this.$refs.service_show.data.fields[i].value)
1027
- }
1028
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1029
- // if (this.$refs.service_show.data.fields[i].label === '未结总金额') {
1030
- // //this.$refs.service_show.data.fields[i].value = cumulativeMoney - unaccountMoney
1031
- // this.$refs.service_show.data.fields[i].value =0;
1032
- //
1033
- // }
1034
- }
1035
- }
1036
- }
1037
-
1038
-
1039
- //根据合同预算金额和累计开票金额计算未开票金额
1040
-
1041
-
1042
- if (this.$refs.service_show.data.fields[index].label === '累计开票金额') {
1043
- let residualInvoicing = this.$refs.service_show.data.fields[index].value
1044
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1045
- if (this.$refs.service_show.data.fields[i].label === '未开票金额') {
1046
- this.$refs.service_show.data.fields[i].value = Number(this.selectdata.f_contract_total_money) - Number(residualInvoicing)
1047
- }
1048
- }
1049
- }
1050
- //如果资料验收是否通过和工程验收是否通过为否的时候弹出原因填写框
1051
- if (this.$refs.service_show.data.fields[index].label === '资料验收是否通过') {
1052
- let res = this.$refs.service_show.data.fields[index].value
1053
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1054
- if (this.$refs.service_show.data.fields[i].label === '资料验收不通过原因') {
1055
- if (res === '否') {
1056
- this.$refs.service_show.data.fields[i].hidden = false
1057
- this.$refs.service_show.data.fields[i].required = true
1058
- } else {
1059
- this.$refs.service_show.data.fields[i].hidden = true
1060
- this.$refs.service_show.data.fields[i].required = false
1061
- }
1062
- }
1063
- }
1064
- }
1065
- if (this.$refs.service_show.data.fields[index].label === '工程验收是否通过') {
1066
- let res = this.$refs.service_show.data.fields[index].value
1067
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1068
- if (this.$refs.service_show.data.fields[i].label === '工程验收不通过原因') {
1069
- if (res === '否') {
1070
- this.$refs.service_show.data.fields[i].hidden = false
1071
- this.$refs.service_show.data.fields[i].required = true
1072
- } else {
1073
- this.$refs.service_show.data.fields[i].hidden = true
1074
- this.$refs.service_show.data.fields[i].required = false
1075
- }
1076
- }
1077
- }
1078
- }
1079
- // }
1080
-
1081
- //金额小写得到大写
1082
- if (this.$refs.service_show.showadd_fields && this.$refs.service_show.showadd_fields.length > 0 && this.$refs.service_show.showadd_fields.fields[index].label === '收费金额') {
1083
- if (this.$refs.service_show.showadd_fields[index].value || this.$refs.service_show.showadd_fields.fields[index].value) {
1084
- var re = /^[0-9]+.?[0-9]*/
1085
- let temp = this.$refs.service_show.showadd_fields[index].value
1086
- if (temp == "" || isNaN(temp)) {
1087
- this.$showMessage("请输入纯数字")
1088
- this.$refs.service_show.showadd_fields[index].value = 0
1089
- }
1090
- }
1091
- let temp = this.$refs.service_show.showadd_fields[index]
1092
- let value = temp.value
1093
- // let chargeMoney = this.$refs.service_show.showadd_fields[index].value
1094
- for (let i = 0; i < this.$refs.service_show.showadd_fields.fields.length; i++) {
1095
- if (this.$refs.service_show.showadd_fields.fields[i].label === '金额大写') {
1096
- let te = {
1097
- value: this.smalltoBIG(value)
1098
- }
1099
- this.$refs.service_show.showadd_fields[i] = te
1100
- }
1101
- }
1102
- }
1103
-
1104
-
1105
-
1106
- if (this.$refs.service_show.data.fields[index].label === '县/区') {
1107
- let temp = this.$refs.service_show.data.fields[index].value
1108
- console.log('==============================县/区:' + temp)
1109
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1110
- // 控制设置级联
1111
- // 源select所选的值 this.$refs.service_show.data.activitys.fields[index].value
1112
- if (this.$refs.service_show.data.fields[i].label === '街道名称') {
1113
- this.$refs.service_show.data.fields[i].value = ''
1114
- let street = await this.$resetpost('rs/sql/singleTable', {
1115
- data: {
1116
- tablename: 't_street',
1117
- condition: `f_filialeids = '${this.$login.f.f_orgids}' and f_pcd='${temp}'`
1118
- }
1119
- }, {resolveMsg: null, rejectMsg: null})
1120
- let streetrs = []
1121
- for (let i = 0; i < street.data.length; i++) {
1122
- let temp = {
1123
- label: street.data[i].f_street,
1124
- value: street.data[i].f_street
1125
- }
1126
- streetrs.push(temp)
1127
- }
1128
-
1129
- this.$refs.service_show.data.fields[i].options = [{label: '全部', value: ''}, ...streetrs]
1130
- //this.data.fields[i].options = [{label: '全部', value: ''}, ...streetrs]
1131
- // console.log('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~option:', this.data.fields[i].options)
1132
-
1133
- this.$refs.service_show.update()
1134
- }
1135
- }
1136
- }
1137
- if (this.$refs.service_show.data.fields[index].label === '气表品牌') {
1138
- let temp = this.$refs.service_show.data.fields[index].value
1139
- let meterbrand = await this.$resetpost('rs/sql/singleTable', {
1140
- data: {
1141
- //items: 'f_bill_url,f_url_code',
1142
- tablename: 't_gasbrand',
1143
- condition: `f_filialeids = '${this.$login.f.f_orgids}' and f_meter_brand='${temp}'`
1144
- }
1145
- }, {resolveMsg: null, rejectMsg: null})
1146
- console.log(meterbrand)
1147
- console.log(meterbrand.data)
1148
- let idstring = '('
1149
- idstring += meterbrand.data[0].id
1150
- console.log("idstring第一个" + idstring)
1151
- if (meterbrand.data.length > 1) {
1152
- for (let i = 1; i < meterbrand.data.length; i++) {
1153
- idstring += ',' + meterbrand.data[i].id
1154
- }
1155
- }
1156
- idstring += ')'
1157
- console.log("idstring" + idstring)
1158
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1159
-
1160
- if (this.$refs.service_show.data.fields[i].label === '气表型号') {
1161
- this.$refs.service_show.data.fields[i].value = ''
1162
-
1163
-
1164
- let gasbrand = await this.$resetpost('rs/sql/singleTable', {
1165
- data: {
1166
- tablename: 't_gasmodel',
1167
- condition: ` f_gasbrand_id in ${idstring}`
1168
- }
1169
- }, {resolveMsg: null, rejectMsg: null})
1170
- let brandstr = []
1171
- for (let i = 0; i < gasbrand.data.length; i++) {
1172
- let brand = {
1173
- label: gasbrand.data[i].f_meter_style,
1174
- value: gasbrand.data[i].f_meter_style
1175
- }
1176
- brandstr.push(brand)
1177
- }
1178
-
1179
- this.$refs.service_show.data.fields[i].options = [{label: '全部', value: ''}, ...brandstr]
1180
- //this.data.fields[i].options = [{label: '全部', value: ''}, ...streetrs]
1181
- // console.log('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~option:', this.data.fields[i].options)
1182
-
1183
- this.$refs.service_show.update()
1184
- }
1185
- }
1186
- }
1187
-
1188
-
1189
- if (this.$refs.service_show.data.fields[index].label === '气表型号') {
1190
- let meterstyle= this.$refs.service_show.data.fields[index].value
1191
- let meterbrand = ''
1192
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1193
- if (this.$refs.service_show.data.fields[i].label === '气表品牌') {
1194
- meterbrand = this.$refs.service_show.data.fields[i].value
1195
- }}
1196
-
1197
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1198
-
1199
- if (this.$refs.service_show.data.fields[i].label === '别名') {
1200
- console.log("获取别名")
1201
- this.$refs.service_show.data.fields[i].value = ''
1202
-
1203
- let meterbrandalias = await this.$resetpost('rs/sql/getMeterBrand', {
1204
- data: {
1205
- condition: `f_filialeids = '${this.$login.f.f_orgids}' and f_meter_brand='${meterbrand}' and f_meter_style='${meterstyle}'`
1206
- }
1207
- }, {resolveMsg: null, rejectMsg: null})
1208
-
1209
- let alias = []
1210
- for (let i = 0; i < meterbrandalias.data.length; i++) {
1211
- let brand = {
1212
- label: meterbrandalias.data[i].f_alias,
1213
- value: meterbrandalias.data[i].f_alias
1214
- }
1215
- alias.push(brand)
1216
- }
1217
-
1218
- this.$refs.service_show.data.fields[i].options = [{label: '全部', value: ''}, ...alias]
1219
- //this.data.fields[i].options = [{label: '全部', value: ''}, ...streetrs]
1220
- // console.log('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~option:', this.data.fields[i].options)
1221
-
1222
- this.$refs.service_show.update()
1223
-
1224
- }
1225
- }
1226
-
1227
- }
1228
-
1229
-
1230
- if (this.$refs.service_show.data.fields[index].label === '证件类型') {
1231
- let temp = this.$refs.service_show.data.fields[index].value
1232
- console.log('==============================证件类型:' + temp)
1233
- if (temp === '身份证') {
1234
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1235
- if (this.$refs.service_show.data.fields[i].label === '证件号码') {
1236
- this.$refs.service_show.data.fields[i].required = true
1237
- }
1238
- }
1239
- } else {
1240
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1241
- if (this.$refs.service_show.data.fields[i].label === '证件号码') {
1242
- this.$refs.service_show.data.fields[i].required = false
1243
- }
1244
- }
1245
- }
1246
- }
1247
-
1248
- if (this.$refs.service_show.data.fields[index].label === '是否设计出图') {
1249
- let temp = this.$refs.service_show.data.fields[index].value
1250
-
1251
- if (temp === '是') {
1252
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1253
- if (this.$refs.service_show.data.fields[i].label === '设计派工日期' ||
1254
- this.$refs.service_show.data.fields[i].label === '设计人员'
1255
- ) {
1256
- this.$refs.service_show.data.fields[i].required = true
1257
- }
1258
- }
1259
- } else {
1260
- console.log("不设计出图,进入else")
1261
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1262
- if (this.$refs.service_show.data.fields[i].label === '设计派工日期' || this.$refs.service_show.data.fields[i].label === '设计人员') {
1263
-
1264
- this.$refs.service_show.data.fields[i].required = false
1265
- }
1266
- }
1267
- }
1268
- }
1269
-
1270
- if (this.$refs.service_show.data.fields[index].label === '派工单号') {
1271
- this.$refs.service_show.data.fields[index].value = this.pgd
1272
- }
1273
-
1274
-
1275
- if (this.$refs.service_show.data.fields[index].label === '街道名称') {
1276
- let temp = this.$refs.service_show.data.fields[index].value
1277
- console.log('=============================街道:' + temp)
1278
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1279
- // 控制设置级联
1280
- // 源select所选的值 this.$refs.service_show.data.activitys.fields[index].value
1281
- if (this.$refs.service_show.data.fields[i].label === '小区名称') {
1282
- this.$refs.service_show.data.fields[i].value = ''
1283
-
1284
- let area = await this.$resetpost('rs/sql/singleTable', {
1285
- data: {
1286
- tablename: 't_area',
1287
- condition: `f_filialeids = '${this.$login.f.f_orgids}' and f_street='${temp}'`
1288
- }
1289
- }, {resolveMsg: null, rejectMsg: null})
1290
- let arears = []
1291
- this.areaall=area.data;
1292
- for (let i = 0; i < area.data.length; i++) {
1293
- let temp = {
1294
- label: area.data[i].f_residential_area,
1295
- value: area.data[i].f_residential_area
1296
- }
1297
- arears.push(temp)
1298
- }
1299
- this.$refs.service_show.data.fields[i].options = [{label: '全部', value: ''}, ...arears]
1300
- //this.data.fields[i].options = [{label: '全部', value: ''}, ...streetrs]
1301
- console.log('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~option:', this.$refs.service_show.data.fields[i].options)
1302
-
1303
- this.$refs.service_show.update()
1304
-
1305
- }
1306
- }
1307
- }
1308
-
1309
- if(this.$refs.service_show.data.fields[index].label === '小区名称'){
1310
- for (let i = 0; i < this.areaall.length; i++) {
1311
- console.log("aaaaaaaaaaaa")
1312
- if(this.areaall[i].f_residential_area== this.$refs.service_show.data.fields[index].value){
1313
- console.log("abbbbbbbbb")
1314
- for (let j = 0; j < this.$refs.service_show.data.fields.length; j++) {
1315
- if(this.$refs.service_show.data.fields[j].label === '小区地址'){
1316
- console.log(this.areaall[i].f_area_address)
1317
- this.$refs.service_show.data.fields[j].value=this.areaall[i].f_area_address
1318
- }
1319
- }
1320
- }
1321
- }
1322
- }
1323
- //控制尾款
1324
- if (
1325
- this.$refs.service_show.data.fields[index].label === '合同金额' ||
1326
- this.$refs.service_show.data.fields[index].label === '首付' ||
1327
- this.$refs.service_show.data.fields[index].label === '进度款' ||
1328
- this.$refs.service_show.data.fields[index].label === '尾款'
1329
- ) {
1330
- console.log('即将计算合同金额')
1331
- var cash = 0
1332
- var downpayments = 0
1333
- var tailmoney = 0
1334
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1335
- // 控制设置级联
1336
- // 源select所选的值 this.$refs.service_show.data.activitys.fields[index].value
1337
- // xxx xx xxx
1338
- if (this.$refs.service_show.data.fields[i].label === '合同金额' && this.$refs.service_show.data.fields[i].value) {
1339
- cash = this.$refs.service_show.data.fields[i].value
1340
- }
1341
- if (this.$refs.service_show.data.fields[i].label === '首付' && this.$refs.service_show.data.fields[i].value) {
1342
- downpayments = this.$refs.service_show.data.fields[i].value
1343
- }
1344
- if (this.$refs.service_show.data.fields[i].label === '进度款' && this.$refs.service_show.data.fields[i].value) {
1345
- tailmoney = this.$refs.service_show.data.fields[i].value
1346
- }
1347
- }
1348
- var a = cash - downpayments
1349
- // 数据计算完毕得到尾款
1350
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1351
- if (this.$refs.service_show.data.fields[i].label === '尾款') {
1352
- if (cash === downpayments) {
1353
- this.$refs.service_show.data.fields[i].value = 0
1354
- } else {
1355
- this.$refs.service_show.data.fields[i].value = (cash - downpayments - tailmoney)
1356
- console.log('修改fields[i].value后的值=>' + this.$refs.service_show.data.fields[i].value)
1357
- }
1358
- }
1359
- if (this.$refs.service_show.data.fields[i].label === '首付') {
1360
- if (a < 0) {
1361
- this.$showMessage("首付款数额过大")
1362
- downpayments = 0
1363
- this.$refs.service_show.data.fields[i].value = 0
1364
- }
1365
- }
1366
-
1367
- if (this.$refs.service_show.data.fields[i].label === '进度款') {
1368
-
1369
- if (cash === downpayments) {
1370
- tailmoney = 0
1371
- this.$refs.service_show.data.fields[i].value = 0
1372
- this.$refs.service_show.data.fields[i].readonly = true
1373
- } else {
1374
- this.$refs.service_show.data.fields[i].readonly = false
1375
- tailmoney = this.$refs.service_show.data.fields[i].value
1376
- }
1377
- if (tailmoney > a) {
1378
- this.$showMessage("进度款数额过大")
1379
- tailmoney = 0
1380
- this.$refs.service_show.data.fields[i].value = 0
1381
- }
1382
- }
1383
- }
1384
- }
1385
-
1386
-
1387
- // 合成地址
1388
- if (
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
- this.$refs.service_show.data.fields[index].label === '楼号' ||
1393
- this.$refs.service_show.data.fields[index].label === '单元号' ||
1394
- this.$refs.service_show.data.fields[index].label === '楼层' ||
1395
- this.$refs.service_show.data.fields[index].label === '门牌号'
1396
- ) {
1397
- console.log('即将合成地址')
1398
- var address = ''
1399
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1400
- // 控制设置级联
1401
- // 源select所选的值 this.$refs.service_show.data.activitys.fields[index].value
1402
- // xxx xx xxx
1403
- if (this.$refs.service_show.data.fields[i].label === '县/区' && this.$refs.service_show.data.fields[i].value) {
1404
- address += this.$refs.service_show.data.fields[i].value
1405
- }
1406
- if (this.$refs.service_show.data.fields[i].label === '街道名称' && this.$refs.service_show.data.fields[i].value) {
1407
- address += this.$refs.service_show.data.fields[i].value
1408
- }
1409
- if (this.$refs.service_show.data.fields[i].label === '小区名称' && this.$refs.service_show.data.fields[i].value) {
1410
- address += this.$refs.service_show.data.fields[i].value
1411
- }
1412
- if (this.$refs.service_show.data.fields[i].label === '楼号' && this.$refs.service_show.data.fields[i].value) {
1413
- address += this.$refs.service_show.data.fields[i].value
1414
- }
1415
- if (this.$refs.service_show.data.fields[i].label === '单元号' && this.$refs.service_show.data.fields[i].value) {
1416
- address += '-' +this.$refs.service_show.data.fields[i].value
1417
- }
1418
- if (this.$refs.service_show.data.fields[i].label === '楼层' && this.$refs.service_show.data.fields[i].value) {
1419
- address += '-' +this.$refs.service_show.data.fields[i].value
1420
- }
1421
- if (this.$refs.service_show.data.fields[i].label === '门牌号' && this.$refs.service_show.data.fields[i].value) {
1422
- address += '-' +this.$refs.service_show.data.fields[i].value
1423
- }
1424
-
1425
- }
1426
- console.log('获取到的address=>' + address)
1427
- // 数据获取完毕时放入地址text
1428
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1429
- if (this.$refs.service_show.data.fields[i].label === '地址') {
1430
- this.$refs.service_show.data.fields[i].value = address
1431
- console.log('修改fields[i].value后的值=>' + this.$refs.service_show.data.fields[i].value)
1432
- }
1433
- }
1434
- }
1435
- // 开户费+材料费+人工费+设备安装费=合计
1436
- if (
1437
- this.$refs.service_show.data.fields[index].label === '工程安装费' ||
1438
- this.$refs.service_show.data.fields[index].label === '材料费' ||
1439
- this.$refs.service_show.data.fields[index].label === '人工费'
1440
- ) {
1441
- console.log('即将合成价格')
1442
- let a1 = 0
1443
- let b1 = 0
1444
- let c1 = 0
1445
- let fee = 0
1446
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1447
- // 控制设置级联
1448
- // 源select所选的值 this.$refs.service_show.data.activitys.fields[index].value
1449
- // xxx xx xxx
1450
- if (this.$refs.service_show.data.fields[i].label === '工程安装费' && this.$refs.service_show.data.fields[i].value) {
1451
- a1 = this.$refs.service_show.data.fields[i].value
1452
- }
1453
- if (this.$refs.service_show.data.fields[i].label === '材料费' && this.$refs.service_show.data.fields[i].value) {
1454
- b1= this.$refs.service_show.data.fields[i].value
1455
- }
1456
- if (this.$refs.service_show.data.fields[i].label === '人工费' && this.$refs.service_show.data.fields[i].value) {
1457
- c1 = this.$refs.service_show.data.fields[i].value
1458
- }
1459
- fee=parseFloat(parseFloat(a1) + parseFloat(b1)+parseFloat(c1)).toFixed(2)
1460
- // 数据获取完毕时放入地址text
1461
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1462
- if (this.$refs.service_show.data.fields[i].label === '费用合计'||this.$refs.service_show.data.fields[i].label === '未结总金额') {
1463
- this.$refs.service_show.data.fields[i].value =fee
1464
- console.log('修改fields[i].value后的值=>' + this.$refs.service_show.data.fields[i].value)
1465
- }
1466
- }
1467
- }
1468
- }
1469
- if (this.$refs.service_show.data.fields[index].label == '用户类型'){
1470
- debugger
1471
- if(this.$refs.service_show.data.fields[index].value == '非民用'){
1472
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1473
- if (this.$refs.service_show.data.fields[i].label === '小区名称') {
1474
- this.$refs.service_show.data.fields[i].required=false;
1475
- }
1476
- }
1477
- }else{
1478
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1479
- if (this.$refs.service_show.data.fields[i].label === '小区名称') {
1480
- this.$refs.service_show.data.fields[i].required=true;
1481
- }
1482
- }
1483
- }
1484
- }
1485
- },
1486
- // onetomany模态框监听事件
1487
- async 'select_cascade_modal'(i,j){
1488
- if(this.data.onetomany[i].tables[0]=='t_apply_construct_balance'){
1489
- if(this.data.onetomany[i].fields[j].label == '第三施工方'){
1490
- for(let k =0;k<this.data.onetomany[i].fields.length;k++){
1491
-
1492
- if(this.data.onetomany[i].fields[k].label.includes('当前累计结算比例')){
1493
- let sum = 0
1494
- for(let p =0;p<this.$refs.service_show.model.rows[i].length;p++){
1495
- if(this.$refs.service_show.model.rows[i][p].f_construct_company == this.$refs.service_show.showadd_fields.fields[j].value){
1496
- sum+=Number(this.$refs.service_show.showadd_fields.fields[k-2].value)
1497
- sum+=Number(this.$refs.service_show.model.rows[i][p].f_balance_scale)
1498
- }
1499
- }
1500
- if(this.$refs.service_show.model.rows[i].length==0){
1501
- sum = Number(this.$refs.service_show.showadd_fields.fields[k-2].value)
1502
- }
1503
- this.$refs.service_show.update_showadd_fields_value(k,sum)
1504
- }
1505
- }
1506
- }
1507
- }
1508
- },
1509
- async 'onetomanyevent'(datas) {
1510
- // console.log(`onetomany=======>${JSON.stringify(datas)}`)
1511
-
1512
- for (let i = 0; i < datas.rows.length; i++) {
1513
- datas.rows[i]['f_process_id'] = this.selectdata.f_process_id
1514
- datas.rows[i]['f_apply_num'] = this.selectdata.f_apply_num
1515
- datas.rows[i]['f_filiale'] = this.$login.f.f_fengongsi
1516
- datas.rows[i]['f_parentname'] = this.$login.f.f_parentname
1517
- datas.rows[i]['f_operator'] = this.$login.f.name
1518
- }
1519
- let http = new HttpResetClass()
1520
- await http.load('POST', 'rs/logic/saveentity', datas, {resolveMsg: null, rejectMsg: 'search查询部门下所有人失败'})
1521
- }
1522
- ,
1523
- // 获取view层button事件/
1524
- async 'button'(model) {
1525
- // console.log("button事件接收参数:", model)
1526
- // 点击重置按钮就重置数据
1527
- if (model.button.button_name === '重置') {
1528
- this.refurbish()
1529
- return
1530
- }
1531
- if (model.button.button_name === '打印回单') {
1532
- this.printReceipt(model)
1533
- return
1534
- }
1535
- var operate = ''
1536
- // 判断当前按钮是否为特殊业务,即子流程提交或者分发
1537
- if (model.button.button_name === '提交' && model.button.button_event && model.button.button_event === '子流程提交') {
1538
- operate = '子流程提交'
1539
- }
1540
- if (model.button.button_name === '提交' && model.button.button_event && model.button.button_event === '合同信息') {
1541
- model.f_budget_money = model.f_contract_money
1542
- //未结算总金额=合计
1543
- model.f_unaccounts_money = model.f_total_cost
1544
- model.f_cumulative_money = 0
1545
- model.f_cumulative_invoicing = 0
1546
- model.f_additional_payment = 0
1547
- model.f_residual_invoicing = model.f_contract_money
1548
- }
1549
- if (model.button.button_name === '下发') {
1550
- if (model.button && model.button.button_event === '分发') {
1551
- operate = '分发'
1552
- }
1553
- let array = this.$login.f.rolesnames.split(',')
1554
- if (this.selectdata.defname == '任务分配' && array.includes("工程技术部负责人")) {
1555
- model.f_survey_name = model.button.button_fields.f_apply_kefu_employee
1556
- }
1557
- }
1558
-
1559
- if (model.button.button_name == '提交' && model.button.button_person && model.button.button_person.button_event === '获取之前被下发人' && model.button.button_person.button_person_field) {
1560
- model.button.button_name = '下发'
1561
- model.button.button_fields = {}
1562
- console.log(model.button.button_person.button_person_field)
1563
- console.log(this.selectdata[model.button.button_person.button_person_field])
1564
- console.log(this.selectdata)
1565
- if(this.selectdata[model.button.button_person.button_person_field].startsWith('{')){
1566
- let temp= JSON.parse(this.selectdata[model.button.button_person.button_person_field])
1567
- model.button.button_fields[model.button.button_person.button_person_field] = temp.id
1568
- }else{
1569
- model.button.button_fields[model.button.button_person.button_person_field] = this.selectdata[model.button.button_person.button_person_field]
1570
- }
1571
-
1572
- }
1573
- if (model.button.button_name === '提交') {
1574
- var flag = false
1575
- if (this.data.defname == '合同审核') {
1576
- flag = true
1577
- http = new HttpResetClass()
1578
- let data = {
1579
- tablename: 't_singlevalue',
1580
- condition: `name = '合同编号' and f_filialeids = '${this.$login.f.f_orgids}'`
1581
- }
1582
- let res = await http.load('POST', 'rs/sql/singleTable', {data: data}, {
1583
- resolveMsg: null,
1584
- rejectMsg: "获取合同编号失败"
1585
- })
1586
- if (this.contract != res.data[0].value && !this.selectdata.f_contract_number) {
1587
- this.$showMessage("合同编号已经被使用,请按F5刷新页面后重新登记")
1588
- return
1589
- }
1590
- }
1591
-
1592
- }
1593
- console.log('本次点击button执行的操作是=>' + operate)
1594
- model = Object.assign({}, this.selectdata, model)
1595
- let http = new HttpResetClass()
1596
- var url
1597
- var requestData = {
1598
- tables: this.data.tables,
1599
- start_activity: this.$workflow_vue.start_activity,
1600
- model: model,
1601
- loginUser: this.$login.f
1602
- }
1603
- if (operate != '') {
1604
- // 特殊操作走特殊logic业务处理
1605
- url = 'rs/logic/SubprocessService'
1606
- requestData = {
1607
- tables: this.data.tables, model: model
1608
- }
1609
- } else if (model.button.button_name === '提交' && model.button.button_event && model.button.button_event === '分支流程异步合并处理') {
1610
- url = 'rs/logic/branchsyncprocess'
1611
- requestData = {
1612
- tables: this.data.tables, model: model
1613
- }
1614
- } else {
1615
- if(requestData.model.f_stair_price_name === ''|| requestData.model.f_stair_price_name === null|| requestData.model.f_stair_price_name === undefined){
1616
- requestData.model.f_stair_price_name = this.selectdata.f_stair_price_name
1617
- }
1618
- console.log(requestData.model.f_stair_price_name)
1619
- // 下发,提交,保存,退回通用业务后台处理logic
1620
- url = 'rs/logic/ApplyProductService'
1621
- requestData = {
1622
- tables: this.data.tables, model: model
1623
- }
1624
- }
1625
- requestData.start_activity = this.$workflow_vue.start_activity
1626
- requestData.loginUser = this.$login.f
1627
- requestData.workflow_xmlfilename = this.$workflow_vue.workflow_xmlfilename
1628
- console.log('即将发送请求url=>' + url + ',参数=>' + JSON.stringify(requestData))
1629
- let res = res = await http.load('POST', url, {data: requestData}, {resolveMsg: null, rejectMsg: '数据保存失败'})
1630
- console.log("service处理完成返回数据:", JSON.stringify(res.data))
1631
- if(res.data.msg=="地址重复,请修改后重新提交"){
1632
- this.$showMessage(res.data.msg)
1633
- }
1634
- if (res.data.code == 200) {
1635
- // flag 为合同编号更新标志
1636
- if (flag) {
1637
- let http = new HttpResetClass()
1638
- let data = {
1639
- tablename: 't_singlevalue',
1640
- condition: `name = '合同编号' and f_filialeids = '${this.$login.f.f_orgids}'`,
1641
- value: (Number(this.contract) + 1) + ''
1642
- }
1643
- await http.load('POST', 'rs/logic/updatesinglevalue', {data: data}, {
1644
- resolveMsg: null,
1645
- rejectMsg: "获取合同编号更新失败"
1646
- })
1647
- }
1648
- this.showview = false
1649
- // 特殊处理
1650
- this.special(model)
1651
- this.$dispatch('close')
1652
- this.initializtion()
1653
- } else {
1654
- if (res.data.msg) {
1655
- this.$showMessage(res.data.msg)
1656
- }
1657
- }
1658
-
1659
-
1660
- /*
1661
- if(this.selectdata.defname =='报装申请'|| this.selectdata.defname =='现场勘查'|| this.selectdata.defname =='验收'||this.selectdata.defname =='集体报装申请'||this.selectdata.defname =='现场勘查人员分配'||this.selectdata.defname =='安装通气' ){
1662
- console.log("defname======================================",this.selectdata.defname)
1663
- let http1 = new HttpResetClass();
1664
- let sendtime = null;
1665
- let finishtime = null;
1666
- let f_department = null;
1667
- let f_process_id = null;
1668
- let data1 = {
1669
- f_process_id: this.selectdata.f_process_id,
1670
- defname : this.selectdata.defname
1671
- }
1672
- console.log("res1=======================================",data1)
1673
- await http1.load('POST', 'rs/logic/getTime', {data:data1}).then((res) => {
1674
- console.log("objk===>",res.data)
1675
- sendtime=res.data.getUserid[0].sendtime;
1676
- finishtime=res.data.getUserid[0].finishtime;
1677
- f_department=res.data.resdata[0].name;
1678
- console.log("objk===>")
1679
- })
1680
-
1681
- let data2 = {
1682
- department:f_department,
1683
- resourceCatalog:this.selectdata.defname,
1684
- sqzt:model.f_user_name,
1685
- code:model.f_idnumber,
1686
- sqsj:sendtime,
1687
- slsj:sendtime,
1688
- bjsj:finishtime,
1689
- blcb:0,
1690
- sqclsl:0,
1691
- sqclmc:'',
1692
- gdlsh:'',
1693
- sbdz:model.f_address,
1694
- sldw:'鄂州市安泰天然气有限责任公司',
1695
- sfyj:'',
1696
- gxzq:'',
1697
- type:this.selectdata.defname
1698
- }
1699
- console.log("====================================",data2)
1700
- await http1.load('POST', 'rs/logic/getPost', {data:data2})
1701
- }
1702
- */
1703
-
1704
-
1705
-
1706
- }
1707
- ,
1708
- async 'onetomanydelete'(i, j) {
1709
- let http = new HttpResetClass()
1710
- let data = {
1711
- tables: this.show_data.onetomany[i].tables,
1712
- row: this.$refs.service_show.model.rows[i][j]
1713
- }
1714
- await http.load('POST', 'rs/logic/applyDeleteValue', {data: data}, {
1715
- resolveMsg: null,
1716
- rejectMsg: 'onetomanydelete失败'
1717
- }).then(() => {
1718
- this.$dispatch('selfsearch')
1719
- this.$refs.service_show.model.rows[i].splice(j, 1)
1720
- })
1721
- }
1722
- ,
1723
- //获取view层confirm事件
1724
- async 'confirm'(tables, row, showadd_index, j) {
1725
- var _this = this
1726
- for (let i = 0; i < tables.length; i++) {
1727
- let datas = {
1728
- tables: tables,
1729
- row: row
1730
- }
1731
- console.log("看看datas")
1732
- console.log(datas)
1733
- console.log("看看showadd_index")
1734
- console.log(showadd_index)
1735
- datas.row['f_process_id'] = this.selectdata.f_process_id
1736
- datas.row['f_apply_num'] = this.selectdata.f_apply_num
1737
- datas.row['f_filiale'] = this.selectdata.f_filiale
1738
- let http = new HttpResetClass()
1739
- let sellid = ''
1740
- let billtype = datas.row['f_bill_style']
1741
- if (tables[i] == 't_charge_record') {
1742
- await this.loadbuyer()
1743
- if (this.buyerinfo.rows.length < 1 && billtype === '增值税电子发票' && this.$appdata.getSingleValue('默认打印票据') === '是') {
1744
- this.$showAlert('未找到购买方信息,请去报建功能"购买方信息"中完善购买方信息后再收费', 'info', 2000)
1745
- this.$refs.service_show.model.rows[showadd_index].splice(j, 1)
1746
- this.$refs.service_show.initializtion()
1747
- return
1748
- }
1749
- datas.row.f_charging_status = '有效'
1750
- datas.row.f_is_correct = '否'
1751
- datas.row.f_charge_collectors = this.$login.f.name
1752
- datas.row.f_amount_words=this.smalltoBIG(datas.row.f_charge_money)
1753
- await http.load('POST', 'rs/logic/applycharge', datas, {
1754
- resolveMsg: null,
1755
- rejectMsg: '收费保存失败'
1756
- }).then((res) => {
1757
- sellid = JSON.parse(res.data.sellid).id
1758
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1759
- //
1760
- // if (this.$refs.service_show.data.fields[i].label == '累计缴费金额') {
1761
- // this.$refs.service_show.data.fields[i].value = res.data.f_cumulative_money
1762
- // }
1763
- //
1764
- // if (this.$refs.service_show.data.fields[i].label == '未结总金额') {
1765
- // this.$refs.service_show.data.fields[i].value = res.data.f_unaccounts_money
1766
- // }
1767
-
1768
- }
1769
- let temp = _this.$refs.service_show.model.rows[showadd_index][j]
1770
- temp.id = sellid
1771
- _this.$refs.service_show.model.rows[showadd_index][j] = temp
1772
- })
1773
- if (this.$appdata.getSingleValue('默认打印票据') && this.$appdata.getSingleValue('默认打印票据') === '是') {
1774
- this.$showMessage('是否打票据', ['confirm', 'cancel']).then((res) => {
1775
- if (res === 'confirm') {
1776
- console.log('打印票据')
1777
- if (billtype === '增值税电子发票') {
1778
- this.selectsellid = sellid
1779
- this.showbuyerinfo = true
1780
- } else {
1781
- this.printbill(sellid)
1782
- }
1783
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1784
- if (this.$refs.service_show.data.fields[i].label == '累计开票金额') {
1785
- console.log("计算累计开票金额")
1786
- this.$refs.service_show.data.fields[i].value = parseInt(this.$refs.service_show.data.fields[i].value) + this.datas.row.f_cumulative_invoicing
1787
- }
1788
- }
1789
- }
1790
- })
1791
- }
1792
- // 刷新列表数据
1793
- console.log("刷新一下")
1794
- this.$dispatch('selfsearch')
1795
- console.log("刷新完成")
1796
- } else {
1797
- await http.load('POST', 'rs/logic/saveentity', datas, {
1798
- resolveMsg: null,
1799
- rejectMsg: 'onetomany保存失败'
1800
- }).then((res) => {
1801
- // 刷新列表数据
1802
- this.$dispatch('selfsearch')
1803
- let temp = _this.$refs.service_show.model.rows[showadd_index][j]
1804
- temp.id = res.data.id
1805
- _this.$refs.service_show.model.rows[showadd_index][j] = temp
1806
- })
1807
- }
1808
- }
1809
- }
1810
- }
1811
- }
1812
- </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=='材料导入'" v-ref:material
6
+ :selectdata="selectdata"
7
+ :state="2"
8
+ :edit="true"></material-message>
9
+ <material-message v-if="selectdata.defname=='材料审核'" v-ref:material
10
+ :selectdata="selectdata"
11
+ :state="1"
12
+ :edit="true"></material-message>
13
+ <receive-batch v-if="selectdata.defname == '派工单'" :selectdata="selectdata" v-ref:receivebatch></receive-batch>
14
+ <project-settlement v-if="selectdata.defname == '工程结算'" :selectdata="selectdata"></project-settlement>
15
+ <!-- <installfee :infee="selectdata" :showfee='true' v-if="selectdata.defname == '通气条件确认'"></installfee>-->
16
+ <buyer-message v-ref:buyermessagev :selectdata="selectdata" :state="1" v-if="selectdata.defname == '收费'" ></buyer-message>
17
+ <!-- <installfee :infee="selectdata" v-if="selectdata.defname == '收费'"></installfee>-->
18
+ <service-view v-ref:service_show :data="show_data" v-if="showview" :is_show_datacheck="datacheck"></service-view>
19
+
20
+ <modal :show.sync="showbuyerinfo" v-ref:modal backdrop="false">
21
+ <header slot="modal-header" class="modal-header">
22
+ <button type="button" class="close" @click="closebuyerinfo"><span>&times;</span></button>
23
+ <h4 class="modal-title">打印电子发票,请请选择购货方信息</h4>
24
+ </header>
25
+ <article slot="modal-body" class="modal-body">
26
+ <div v-if="showbuyerinfo">
27
+ <div class="col-sm-12 span recordTable" style="margin-top: 10px;min-height: 350px">
28
+ <partial-view v-ref:single-load>
29
+ <data-grid :model="buyerinfo" v-ref:grid>
30
+ <template partial='head'>
31
+ <tr>
32
+ <th>序号</th>
33
+ <th>购货方名称</th>
34
+ <th>购货方纳税人识别号</th>
35
+ <th>购货方地址、电话</th>
36
+ <th>购货方开户行及账号</th>
37
+ <th>购货方电子邮箱</th>
38
+ <th>操作</th>
39
+ </tr>
40
+ </template>
41
+ <template partial='body'>
42
+ <td style="text-align: center">{{$index+1}}</td>
43
+ <td style="text-align: center">{{row.f_buyer_name}}</td>
44
+ <td style="text-align: center">{{row.f_buyer_identify}}</td>
45
+ <td style="text-align: center">{{row.f_buyer_addphone}}</td>
46
+ <td style="text-align: center">{{row.f_buyer_bank}}</td>
47
+ <td style="text-align: center">{{row.f_buyer_email}}</td>
48
+ <td style="text-align: center">
49
+ <button type="button" class="btn btn-success"
50
+ @click='$parent.$parent.$parent.$parent.confirmbuyerinfo(row)'>选择
51
+ </button>
52
+ </td>
53
+ </template>
54
+ </data-grid>
55
+ </partial-view>
56
+ </div>
57
+ </div>
58
+ </article>
59
+ <footer slot="modal-footer" class="modal-footer">
60
+ <button v-show="showbuyerinfo" type="button" class="btn btn-default" @click='closebuyerinfo'>取消</button>
61
+ </footer>
62
+ </modal>
63
+
64
+ <apply-accept-bill :show="acceptprint" :bill-url='acceptUrl' v-on:toggle="close" :data='row' :billdata="printData" v-ref:acceptbill @closeaccept="closeAccept"></apply-accept-bill>
65
+ <!--打印报表html-->
66
+ <!-- <div v-show="false">-->
67
+ <!-- <div class="row" style="display: flex;justify-content: center;" id='bill-fee'>-->
68
+ <!-- {{{bill}}}-->
69
+ <!-- </div>-->
70
+ <!-- <report-print id='bill-fee' top='15mm' left='5mm' width='90%' height='70%' :showbtn="false" preview="true"-->
71
+ <!-- v-ref:reportprint></report-print>-->
72
+ <!-- </div>-->
73
+
74
+
75
+ </template>
76
+ <script>
77
+ import Vue from 'vue'
78
+ import {HttpResetClass} from 'vue-client'
79
+ import * as Util from '../../../../Util'
80
+ // import AppData from 'stores/AppData'
81
+ // Date格式化
82
+ Date.prototype.Format = function (fmt) {
83
+ var o = {
84
+ "M+": this.getMonth() + 1, //月份
85
+ "d+": this.getDate(), //日
86
+ "H+": this.getHours(), //小时
87
+ "m+": this.getMinutes(), //分
88
+ "s+": this.getSeconds(), //秒
89
+ "q+": Math.floor((this.getMonth() + 3) / 3), //季度
90
+ "S": this.getMilliseconds() //毫秒
91
+ };
92
+ if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
93
+ for (var k in o)
94
+ if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
95
+ return fmt;
96
+ }
97
+
98
+ export default {
99
+ title: '报建流程业务控制层',
100
+ props: ['selectdata'],
101
+ data() {
102
+ return {
103
+ acceptprint: false,
104
+ acceptUrl: 'rs/report/printReceiptbill',
105
+ printData:{
106
+ f_user_name: '',
107
+ f_address: '',
108
+ f_user_phone:'',
109
+ f_work_type: '新报装',
110
+ f_news:'身份证'
111
+ },
112
+ data: null, // 数据库数据,json配置文件数据的数据集合
113
+ json_datas: null, // Json配置文件集合
114
+ showview: false, // 控制显示service-view组件
115
+ show_data: null, // 给view层显示的数据
116
+ department_search: [], // 当前部门下所有人
117
+ contract: null, // 单值表合同编号记录
118
+ technologist: [], // 技术人员 角色下的人
119
+ price: 0,
120
+ xiangmu:'',
121
+ xia:'',
122
+ cost: 0,
123
+ number: 0,
124
+ pgd: '',
125
+ showbuyerinfo: false, // 新增购货方信息模态框开关
126
+ selectsellid: null, //需要打票收费id
127
+ buyerinfo: {
128
+ id: '',
129
+ f_buyer_name: '',
130
+ f_buyer_identify: '',
131
+ f_buyer_addphone: '',
132
+ f_buyer_bank: '',
133
+ f_buyer_email: '',
134
+ rows: [] // 购货方信息
135
+ },
136
+ bill: '',
137
+ areaall:[]
138
+ }
139
+ },
140
+ methods: {
141
+ /*
142
+ ============================================收费临时使用
143
+ */
144
+ closeAccept () {
145
+ this.acceptprint = false
146
+ },
147
+ close () {
148
+ this.acceptprint = false
149
+ },
150
+ printok () {
151
+ this.$dispatch('success')
152
+ },
153
+ validateBill (val) {
154
+ this.validateOk = !val.isOk
155
+ this.billData.bill = val.bill
156
+ },
157
+ async printReceipt(model) {
158
+ console.log('打印回单了11111111111111111model', model)
159
+ this.acceptprint = true
160
+ this.acceptUrl = 'rs/report/printReceiptbill'
161
+ this.printData.f_work_type = `'${model.f_work_type}'`
162
+ this.printData.f_news = `'${model.f_news}'`
163
+ this.printData.f_user_name = `'${model.f_user_name}'`
164
+ this.printData.f_address = `'${model.f_address}'`
165
+ this.printData.f_user_phone = `'${model.f_phone}'`
166
+ },
167
+
168
+ async printbill(sellid) {
169
+ let result = await this.$resetpost('rs/report/applyCharge_bill', {data: {condition: `c.id = ${sellid}`}}, {
170
+ resolveMsg: null,
171
+ rejectMsg: "提取数据出错,请重试!"
172
+ })
173
+ this.bill = result.data
174
+ console.log('this.bill', this.bill)
175
+ this.$nextTick(() => {
176
+ this.$refs.reportprint.print()
177
+ })
178
+ },
179
+ confirmbuyerinfo(args) {
180
+ let drawbilldata = {
181
+ sellid: this.selectsellid,
182
+ buyerid: args.id,
183
+ operator: this.$login.f.name
184
+ }
185
+ this.closebuyerinfo()
186
+ this.$resetpost('rs/logic/applyDrawBill', {data: drawbilldata}, {resolveMsg: null, rejectMsg: "开发票失败"})
187
+ .then((res) => {
188
+ if (res.data.status === 200) {
189
+ this.$showAlert('申请开具增值税电子发票成功,请稍后到报建功能中【报建收费】中查看电子发票', 'success', 5000)
190
+ /*let n = 0
191
+ var id = setInterval(async ()=>{
192
+ if(n>=3){
193
+ this.$showMessage('电子票延迟,请稍后查看!')
194
+ clearInterval(id)
195
+ }
196
+ if (this.seeeticket(res.data) === 'success'){
197
+ clearInterval(id)
198
+ this.load()
199
+ }
200
+ n++
201
+ this.$showAlert('电子发票开票中,请稍后...', 'info',3000)
202
+ },3000)*/
203
+ } else {
204
+ this.$showAlert('电子发票开票失败,失败代码为:' + res.data.status, 'warning', 3000)
205
+ }
206
+ })
207
+ },
208
+ // 金额转大写
209
+ smalltoBIG(n) {
210
+ let fraction = ['', ''];
211
+ let digit = ['零', '壹', '贰', '叁', '', '伍', '', '柒', '捌', '玖'];
212
+ let unit = [['元', '万', '亿'], ['', '拾', '佰', '仟']];
213
+ let head = n < 0 ? '欠' : '';
214
+ n = Math.abs(n);
215
+
216
+ let s = '';
217
+
218
+ for (var i = 0; i < fraction.length; i++) {
219
+ s += (digit[Math.floor(n * 10 * Math.pow(10, i)) % 10] + fraction[i]).replace(/零./, '');
220
+ }
221
+ s = s || '整';
222
+ n = Math.floor(n);
223
+
224
+ for (var i = 0; i < unit[0].length && n > 0; i++) {
225
+ let p = '';
226
+ for (var j = 0; j < unit[1].length && n > 0; j++) {
227
+ p = digit[n % 10] + unit[1][j] + p;
228
+ n = Math.floor(n / 10);
229
+ }
230
+ s = p.replace(/(零.)*零$/, '').replace(/^$/, '零') + unit[0][i] + s;
231
+ }
232
+ return head + s.replace(/(零.)*零元/, '元').replace(/(零.)+/g, '零').replace(/^整$/, '零元整')
233
+ },
234
+ // 关闭模态框
235
+ closebuyerinfo() {
236
+ this.showbuyerinfo = false
237
+ this.selectsellid = null
238
+ },
239
+ //根据票据流水号查看票据
240
+ async seeeticket(val) {
241
+ console.log('该票据流水号为:', val.f_fpqqlsh)
242
+ var eticketData = await this.$resetpost('rs/sql/querySingleTable', {
243
+ data: {
244
+ items: 'f_bill_url,f_url_code',
245
+ tablename: 't_eticket',
246
+ condition: `f_serial_number=${val.f_fpqqlsh}`
247
+ }
248
+ }, {resolveMsg: null, rejectMsg: null})
249
+ console.log('eticketData:', eticketData)
250
+ var data = eticketData.data[0]
251
+ if (data.f_bill_url && data.f_bill_url != '') {
252
+ console.log(data)
253
+ var auth = data.f_bill_url.split("/")
254
+ console.log("截取", auth)
255
+ var authCode = auth[auth.length - 1]
256
+ var url = `https://${auth[2]}/ent-views/fpExtract/get_fapiao.html?pwd=${data.f_url_code}&authCode=${authCode}`
257
+ this.$showAlert('开票成功!', 'success', 500)
258
+ window.open(url)
259
+ return 'success'
260
+ }
261
+ return 'fail'
262
+ },
263
+ async loadbuyer() {
264
+ //获取购货方信息
265
+ let querybuyerdata = {
266
+ tablename: 't_buyer_info',
267
+ condition: `f_process_id = '${this.selectdata.f_process_id}' and f_apply_num = '${this.selectdata.f_apply_num}'`
268
+ }
269
+ let buyerinfos = await this.$resetpost('rs/sql/singleTable', {data: querybuyerdata}, {
270
+ resolveMsg: null,
271
+ rejectMsg: '获取购货方信息失败'
272
+ })
273
+ this.buyerinfo.rows = buyerinfos.data
274
+ },
275
+ /*
276
+ ============================================收费临时使用结束
277
+ */
278
+ // AOP后续特殊化处理
279
+ async special(model) {
280
+ if (model.button.button_name === '提交' && model.button.button_event && model.button.button_event === '分支流程异步处理') {
281
+ // 分支流程异步处理
282
+ let http = new HttpResetClass();
283
+ let res = await http.load('POST', 'rs/logic/branchsyncprocess', {
284
+ data: {
285
+ model: model,
286
+ loginUser: this.$login.f
287
+ }
288
+ }, {resolveMsg: null, rejectMsg: '分支流程异步处理保存失败'})
289
+ console.log("分支流程异步处理:", JSON.stringify(res.data))
290
+ }
291
+
292
+ if (this.data.distribute_async && model.button.button_name === '下发') {
293
+ // 同流程节点异步处理
294
+ let http = new HttpResetClass();
295
+ let res = await http.load('POST', 'rs/logic/syncprocess', {
296
+ data: {
297
+ model: model,
298
+ loginUser: this.$login.f
299
+ }
300
+ }, {resolveMsg: null, rejectMsg: '流程异步下发据保存失败'})
301
+ console.log("流程的异步处理:", JSON.stringify(res.data))
302
+ }
303
+ if (this.data.distribute_async && model.button.button_name === '完成') {
304
+ // 强制结束
305
+ let http = new HttpResetClass();
306
+ let res = await http.load('POST', 'rs/logic/stoprocess', {
307
+ data: {
308
+ model: model,
309
+ loginUser: this.$login.f
310
+ }
311
+ }, {resolveMsg: null, rejectMsg: '流程异步完成数据保存失败'})
312
+ console.log("流程的异步处理:", JSON.stringify(res.data))
313
+ }
314
+ },
315
+ // 组件初始化操作
316
+ refurbish(val) {
317
+ this.selectdata = val
318
+ this.json_datas = this.$workflow_vue
319
+ console.log("初始化jsonDataS==", this.json_datas)
320
+ let sum = 0
321
+ let jsonData = {}
322
+ if(!this.json_datas||!this.json_datas.activitys||this.json_datas.activitys.length==0){
323
+ this.$showMessage("网络故障,请刷新页面")
324
+ return
325
+ }
326
+ for (let i = 0; i < this.json_datas.activitys.length; i++) {
327
+ if (this.selectdata.defname == this.json_datas.activitys[i].title) {
328
+ jsonData = this.json_datas.activitys[i]
329
+ sum++
330
+ }
331
+ }
332
+ for (let j = 0; j < jsonData.fields.length; j++) {
333
+ jsonData.fields[j].value = ''
334
+ console.log("是否有default属性jsonData.fields[j]", jsonData.fields[j])
335
+ if (jsonData.fields[j].default) {
336
+ jsonData.fields[j].value = jsonData.fields[j].default
337
+ }
338
+ }
339
+ if (sum == 1) {
340
+ console.log("jsonData==", jsonData)
341
+ this.data = null
342
+ this.data = jsonData
343
+ this.initializtion()
344
+ } else if (sum == 0) {
345
+ this.$showMessage(`没有在JSON配置文件中找到活动名为:(${this.selectdata.defname})的节点配置`)
346
+ } else {
347
+ this.$showMessage(`在JSON配置文件中找到活动名为:(${this.selectdata.defname})的节点配置:${sum}个`)
348
+ }
349
+ },
350
+ //生成派工单号
351
+ createpgd() {
352
+ this.pgd = "BJ"
353
+ var d = new Date()
354
+ this.pgd+=d.getFullYear()
355
+ if(d.getMonth() + 1<10){
356
+ this.pgd+='0'+(d.getMonth() + 1)
357
+ }
358
+ else{
359
+ this.pgd+=(d.getMonth() + 1)
360
+ }
361
+ if(d.getDate() <10){
362
+ this.pgd+='0'+d.getDate()
363
+ }
364
+ else{
365
+ this.pgd+=d.getDate()
366
+ }
367
+ if(d.getHours() <10){
368
+ this.pgd+='0'+d.getHours()
369
+ }
370
+ else{
371
+ this.pgd+=d.getHours()
372
+ }
373
+ if(d.getMinutes() <10){
374
+ this.pgd+='0'+d.getMinutes()
375
+ }
376
+ else{
377
+ this.pgd+=d.getMinutes()
378
+ }
379
+ if(d.getSeconds() <10){
380
+ this.pgd+='0'+d.getSeconds()
381
+ }
382
+ else{
383
+ this.pgd+=d.getSeconds()
384
+ }
385
+ },
386
+
387
+
388
+
389
+ // AOP:进入vue组件前初始化内容
390
+ // json配置数据处理 比如下拉框的options
391
+ async initializtion() {
392
+ console.log("this.data.table", this.data.tables)
393
+ this.showview = false
394
+ // 有合同号不给合同表里插入数据
395
+ for(let i=0;i<this.data.tables.length;i++){
396
+ if('t_contract'==this.data.tables[i]&&this.selectdata.f_contract_number){
397
+ this.data.tables.splice(i,1)
398
+ }
399
+ }
400
+ // 下发人 options 处理,options初始化
401
+ if (this.selectdata.defname.indexOf('派单')>=0&&this.selectdata.actorexpression) {
402
+ let http = new HttpResetClass()
403
+ http.load('POST', 'rs/search', `{"source":"this.getParentByType($organization$).getChildByName($工程部门$).getChildByName($工程部门负责人$).getChildren()","userid":"${this.$login.f.id}"}`, {
404
+ resolveMsg: null,
405
+ rejectMsg: null
406
+ }).then((res)=>{
407
+
408
+
409
+ let jsonString = JSON.stringify(res.data)
410
+ let jsonArray = []
411
+ if (jsonString.startsWith("{")) {
412
+ jsonArray.push(res.data)
413
+ res.data = jsonArray
414
+ }
415
+ this.department_search = res.data
416
+ if (this.department_search&&this.showview) {
417
+ let array = []
418
+ for (let k = 0; k < this.department_search.length; k++) {
419
+ array.push({
420
+ label: this.department_search[k].name,
421
+ value: {id: this.department_search[k].id, name: this.department_search[k].name}
422
+ })
423
+ }
424
+ for(let x=0;x<this.data.buttons.length;x++){
425
+ if(this.data&&this.data.buttons[x].button_name=="下发"){
426
+ this.data.buttons[x].button_fields[0].options = array
427
+ }
428
+ if(this.show_data &&this.show_data.buttons[x].button_name=="下发"){
429
+ this.show_data.buttons[x].button_fields[0].options = array
430
+ }
431
+ }
432
+ }
433
+ })
434
+ }
435
+
436
+ //debugger
437
+
438
+ // selectdata 填充 data
439
+ this.data = Object.assign({}, this.data, this.selectdata)
440
+ // onetomany 数据获取
441
+ if (this.data.onetomany) {
442
+ console.log('判断是onetomany,this.data.onetomany的数据为=>' + JSON.stringify(this.data.onetomany))
443
+ for (let index = 0; index < this.data.onetomany.length; index++) {
444
+ let http = new HttpResetClass()
445
+ let data = {}
446
+ if (this.data.onetomany[index].tables[0] == 't_charge_record') {
447
+ data = {
448
+ tablename: this.data.onetomany[index].tables[0],
449
+ condition: `f_apply_num = '${this.selectdata.f_apply_num}' and f_process_id='${this.selectdata.f_process_id}' and f_charging_status != '作废'`
450
+ }
451
+ } else {
452
+ data = {
453
+ tablename: this.data.onetomany[index].tables[0],
454
+ condition: `f_process_id='${this.selectdata.f_process_id}'`
455
+ }
456
+ }
457
+ let res = await http.load('POST', 'rs/sql/singleTable', {data: data}, {
458
+ resolveMsg: null,
459
+ rejectMsg: 'onetomany查询失败'
460
+ })
461
+ // 初始化 onetomany
462
+ let rows = []
463
+ console.log('查询返回结果res.data=>' + JSON.stringify(res.data))
464
+ this.data.onetomany[index].rows = res.data
465
+ // console.log(JSON.stringify('this.data.onetomany[index].rows=>' + JSON.stringify(this.data.onetomany[index].rows)))
466
+
467
+ // 初始化onetomany中的fields
468
+ for (let j = 0; j < this.data.onetomany[index].fields.length; j++) {
469
+ // 如果配置类型为select,优先从参数列表获取options
470
+ if (this.data.onetomany[index].fields[j].type === 'select') {
471
+ let temp = Vue.$appdata.getParam(this.data.onetomany[index].fields[j].label)
472
+ if (temp && temp.length > 0) {
473
+ this.data.onetomany[index].fields[j].options = Vue.$appdata.getParam(this.data.onetomany[index].fields[j].label)
474
+ }
475
+ }
476
+ }
477
+ }
478
+ }
479
+ // 初始化 fields
480
+ for (let i = 0; i < this.data.fields.length; i++) {
481
+ // 如果selectdata有这些key,则把selectdata的value赋值给data的value
482
+ if (this.selectdata[this.data.fields[i].field]) {
483
+ if (String(this.selectdata[this.data.fields[i].field]).startsWith("{")) {
484
+ this.data.fields[i].value = JSON.parse(this.selectdata[this.data.fields[i].field])
485
+ } else {
486
+ this.data.fields[i].value = this.selectdata[this.data.fields[i].field]
487
+ }
488
+
489
+ }
490
+ // 如果配置类型为select,优先从参数列表获取options
491
+ if (this.data.fields[i].type === 'select') {
492
+ let temp = Vue.$appdata.getParam(this.data.fields[i].label)
493
+ if (temp && temp.length > 0) {
494
+ this.data.fields[i].options = Vue.$appdata.getParam(this.data.fields[i].label)
495
+ }
496
+ }
497
+
498
+ if (this.data.defname === '工程结算') {
499
+ var a = 0
500
+ var b = 0
501
+ var c = 0
502
+ for (let i = 0; i < this.data.fields.length; i++) {
503
+ if (this.data.fields[i].label === '最终核算成本金额') {
504
+ this.data.fields[i].value = (this.cost + this.number)
505
+ a = this.data.fields[i].value
506
+ }
507
+ if (this.data.fields[i].label === '合同总金额') {
508
+ b = this.data.fields[i].value
509
+ }
510
+ if (this.data.fields[i].label === '材料成本金额') {
511
+ this.data.fields[i].value = this.number
512
+ }
513
+ if (this.data.fields[i].label === '其他成本金额') {
514
+ this.data.fields[i].value = this.cost
515
+ }
516
+ }
517
+ c = b - a
518
+ for (let i = 0; i < this.data.fields.length; i++) {
519
+ if (this.data.fields[i].label === '工程盈利') {
520
+ this.data.fields[i].value = c
521
+ }
522
+ }
523
+ }
524
+ if (this.selectdata.defname.indexOf('派单')>=0) {
525
+ let money=0
526
+
527
+ for (let i = 0; i < this.data.fields.length; i++) {
528
+ if (this.data.fields[i].label === '派工单号') {
529
+ console.log("给派工单号赋值")
530
+ this.createpgd()
531
+ console.log(this.pgd)
532
+ this.data.fields[i].value = this.pgd
533
+ }
534
+ if (this.data.fields[i].label === '合同总金额') {
535
+ console.log('合同总金额===>'+this.data.fields[i].value )
536
+ money=this.data.fields[i].value
537
+ }
538
+ let dealmoney=0;
539
+ if (this.data.fields[i].label == '累计缴费金额') {
540
+ dealmoney=this.data.fields[i].value
541
+ console.log('累计缴费金额===>'+dealmoney )
542
+ }
543
+
544
+ if (this.data.fields[i ].label == '未结总金额') {
545
+ /// if(money=="" || dealmoney==""){
546
+ /// money=0;
547
+ /// dealmoney=0;
548
+ /// }
549
+ /// if(money==null || dealmoney==null){
550
+ /// money=0;
551
+ /// dealmoney=0;
552
+ /// }
553
+ ///
554
+ let othermoney = money-dealmoney;
555
+ console.log('jine'+othermoney)
556
+ this.data.fields[i].value=money-dealmoney
557
+ console.log('未结总金额'+this.data.fields[i].value )
558
+ }
559
+ }
560
+ }
561
+ if(this.data.defname=="派单"){
562
+ for (let i = 0; i < this.data.fields.length; i++) {
563
+ if (this.data.fields[i].label === '未结总金额') {
564
+ this.data.fields[i].value=0
565
+ console.log("派单"+this.data.fields[i].value)
566
+ }
567
+ }
568
+ }
569
+
570
+
571
+ if (this.selectdata.defname ==='报价审核') {
572
+ let unaccount=0
573
+ for (let i = 0; i < this.data.fields.length; i++) {
574
+ if (this.data.fields[i].label === '费用合计') {
575
+ console.log("算一下未结算金额")
576
+ unaccount=this.data.fields[i].value
577
+ }
578
+ if (this.data.fields[i].label === '未结总金额') {
579
+ this.data.fields[i].value=unaccount
580
+ }
581
+
582
+ }
583
+ }
584
+
585
+
586
+ if (this.data.defname === '收费') {
587
+ let account_money=0
588
+ let total_money=0
589
+ let bill_money=0
590
+ for (let i = 0; i < this.data.fields.length; i++) {
591
+ if (this.data.fields[i].label === '合同金额') {
592
+ total_money=this.data.fields[i].value
593
+ }
594
+ if (this.data.fields[i].label === '累计缴费金额') {
595
+ account_money=this.data.fields[i].value
596
+ }
597
+ if (this.data.fields[i].label === '未结总金额') {
598
+ this.data.fields[i].value=total_money-account_money
599
+ }
600
+ if (this.data.fields[i].label === '累计开票金额') {
601
+ bill_money=this.data.fields[i].value
602
+ }
603
+ if (this.data.fields[i].label === '未开票金额') {
604
+ this.data.fields[i].value=total_money-bill_money
605
+
606
+ }
607
+ }
608
+ }
609
+ // 特殊处理
610
+ //施工环节 如果是个人报建需要提交表具信息
611
+ if (this.data.defname === '施工') {
612
+ for (let i = 0; i < this.data.fields.length; i++) {
613
+ if (this.data.fields[i].label === '气表品牌'
614
+ || this.data.fields[i].label === '气表型号'
615
+ || this.data.fields[i].label === '气表厂家') {
616
+ if (this.data.f_apply_type === '个人报建') {
617
+ this.data.fields[i].hidden = false
618
+ this.data.fields[i].required = true
619
+ }
620
+ }
621
+ }
622
+ }
623
+
624
+ // 特殊处理
625
+ //施工环节 如果是个人报建需要提交表具信息
626
+ if (this.data.defname === '安装通气') {
627
+ for (let i = 0; i < this.data.fields.length; i++) {
628
+ if (this.data.fields[i].label === '气表品牌'
629
+ || this.data.fields[i].label === '气表型号'
630
+ || this.data.fields[i].label === '气表厂家') {
631
+ this.data.fields[i].required = true
632
+ this.data.fields[i].hidden = false
633
+ if(this.data.f_work_type=='改管'){
634
+ this.data.fields[i].required = false
635
+ }
636
+
637
+ }
638
+ if(this.data.fields[i].label === '验收结果'){
639
+ this.data.fields[i].required = true
640
+ }
641
+
642
+ }
643
+ }
644
+ if (this.data.defname === '设计报价') {
645
+ for (let i = 0; i < this.data.fields.length; i++) {
646
+ if (this.data.fields[i].label === '气表品牌'
647
+ || this.data.fields[i].label === '气表型号') {
648
+ this.data.fields[i].required = true
649
+ this.data.fields[i].hidden = false
650
+ if(this.data.f_work_type=='改管'){
651
+ this.data.fields[i].required = false
652
+ }
653
+
654
+ }
655
+
656
+ }
657
+ }
658
+ if (this.data.defname === '现场勘查定价') {
659
+ for (let i = 0; i < this.data.fields.length; i++) {
660
+ if (this.data.fields[i].label === '勘查结果') {
661
+ this.data.fields[i].required = true
662
+ }
663
+ }
664
+ }
665
+ //通气环节可以调出施工环节的表信息来修改
666
+ if (this.data.defname === '通气') {
667
+ for (let i = 0; i < this.data.fields.length; i++) {
668
+ if (this.data.fields[i].label === '气表品牌'
669
+ || this.data.fields[i].label === '气表型号'
670
+ || this.data.fields[i].label === '气表厂家') {
671
+ if (this.data.fields[i].value != null && this.data.fields[i].value != '') {
672
+ this.data.fields[i].hidden = false
673
+ this.data.fields[i].required = true
674
+ }
675
+ }
676
+ }
677
+ }
678
+ let array = this.$login.f.rolesnames.split(',')
679
+ if ((this.data.fields[i].label === '技术人员' || array.includes("工程技术部负责人"))&&(this.selectdata.defname=='勘察初设'||this.selectdata.defname=='任务分配'||this.selectdata.defname=='合同信息')) { //{"source":"this.getParentByType($organization$).getChildByName($技术人员$).getChildren()","userid":"296851"}
680
+ let http = new HttpResetClass()
681
+ let res = await http.load('POST', 'rs/search', `{"source":"this.getParentByType($organization$).getChildByName($工程技术部门$).getChildByName($技术人员$).getChildren()","userid":"${this.$login.f.id}"}`, {
682
+ resolveMsg: null,
683
+ rejectMsg:null // 'search查询技术人员失败,请联系管理员配置技术人员角色'
684
+ })
685
+ // console.log("search查询部门下所有人:", JSON.stringify(res.data))
686
+ this.technologist = res.data
687
+ if (this.technologist) {
688
+ let array = []
689
+ for (let k = 0; k < this.technologist.length; k++) {
690
+ array.push({
691
+ label: this.technologist[k].name,
692
+ value: {name: this.technologist[k].name, id: this.technologist[k].id}
693
+ })
694
+ }
695
+ if (!array.includes("工程技术部负责人")&&this.data.fields[i].label === '技术人员') {
696
+ this.data.fields[i].options = array
697
+ }
698
+
699
+ }
700
+ }
701
+ if (this.data.fields[i].label == '县/区') {
702
+ let area = await this.$resetpost('rs/sql/singleTable', {
703
+ data: {
704
+ // items: 'f_bill_url,f_url_code',
705
+ tablename: 't_pcd',
706
+ condition: `f_filialeids = '${this.$login.f.f_orgids}'`
707
+ }
708
+ }, {resolveMsg: null, rejectMsg: null})
709
+ let rs = []
710
+ for (let i = 0; i < area.data.length; i++) {
711
+ let temp = {
712
+ label: area.data[i].f_pcd,
713
+ value: area.data[i].f_pcd
714
+ }
715
+ rs.push(temp)
716
+ }
717
+ this.data.fields[i].options = [{label: '全部', value: ''}, ...rs]
718
+ }
719
+ let gasbrand_id=''
720
+ if (this.data.fields[i].label == '气表品牌') {
721
+ let meterbrand = await this.$resetpost('rs/sql/singleTable', {
722
+ data: {
723
+ items: 'f_meter_brand',
724
+ tablename: 't_gasbrand',
725
+ condition: `f_filialeids = '${this.$login.f.f_orgids}'`
726
+ }
727
+ }, {resolveMsg: null, rejectMsg: null})
728
+ let rs = []
729
+ for (let i = 0; i < meterbrand.data.length; i++) {
730
+ let temp = {
731
+ label: meterbrand.data[i].f_meter_brand,
732
+ value: meterbrand.data[i].f_meter_brand
733
+ }
734
+ rs.push(temp)
735
+ }
736
+ this.data.fields[i].options = [{label: '全部', value: ''}, ...rs]
737
+ }
738
+ if (this.data.fields[i].label == '气表型号') {
739
+ this.data.fields[i].options = [];
740
+ }
741
+ if (this.data.fields[i].label == '气价名称') {
742
+ let meterbrand = await this.$resetpost('rs/sql/singleTable', {
743
+ data: {
744
+ items: 'f_price_name',
745
+ tablename: 't_stairprice',
746
+ condition: `f_filialeids = '${this.$login.f.f_orgids}' and f_state= '有效' and getdate()>=f_perform_date and getdate()<=f_end_date `
747
+ }
748
+ }, {resolveMsg: null, rejectMsg: null})
749
+ let rs = []
750
+ for (let i = 0; i < meterbrand.data.length; i++) {
751
+ let temp = {
752
+ label: meterbrand.data[i].f_price_name,
753
+ value: meterbrand.data[i].f_price_name
754
+ }
755
+ rs.push(temp)
756
+ }
757
+ this.data.fields[i].options = [{label: '全部', value: ''}, ...rs]
758
+ }
759
+ if (this.data.fields[i].label == '合同类型') {
760
+ this.data.fields[i].value = '主合同'
761
+ }
762
+ if (this.data.fields[i].label == '合同业务办理人') {
763
+ if (this.selectdata.f_apply_kefu_employee) {
764
+ if (this.selectdata.f_apply_kefu_employee.startsWith("{") && this.selectdata.f_apply_kefu_employee.endsWith("}")) {
765
+ let temp = JSON.parse(this.selectdata.f_apply_kefu_employee)
766
+ this.data.fields[i].value = temp.name
767
+ } else {
768
+ this.data.fields[i].value = this.selectdata.f_apply_kefu_employee
769
+ }
770
+ } else {
771
+ if (this.selectdata.f_survey_name) {
772
+ if (this.selectdata.f_survey_name.startsWith("{") && this.selectdata.f_survey_name.endsWith("}")) {
773
+ let temp = JSON.parse(this.selectdata.f_survey_name)
774
+ this.data.fields[i].value = temp.name
775
+ } else {
776
+ this.data.fields[i].value = this.selectdata.f_survey_name
777
+ }
778
+ }
779
+ }
780
+ }
781
+ if (this.data.fields[i].label == '合同编号' && !this.selectdata[this.data.fields[i].field] && this.selectdata.defname == '合同审核') {
782
+ if (!this.$appdata.getSingleValue('所属公司编码')) {
783
+ this.$showMessage(`请先去参数管理设置: 所属公司编码`)
784
+ }
785
+ if (!this.$appdata.getSingleValue(this.data.fields[i].label)) {
786
+ this.$showMessage(`请先去参数管理设置: ${this.data.fields[i].label}`)
787
+ } else {
788
+ let http = new HttpResetClass()
789
+ //获取购货方信息
790
+ let data = {
791
+ tablename: 't_singlevalue',
792
+ condition: `name = '合同编号' and f_filialeids = '${this.$login.f.f_orgids}'`
793
+ }
794
+ let res = await http.load('POST','rs/sql/singleTable', {data: data}, {
795
+ resolveMsg: null,
796
+ rejectMsg: '获取合同编号失败'
797
+ }).then((res)=>{
798
+ let temp = res.data[0].value
799
+ this.contract = temp
800
+ while (temp.length < 4) {
801
+ temp = '0' + temp
802
+ }
803
+ let dt = new Date()
804
+ this.data.fields[i].value = this.$appdata.getSingleValue('所属公司编码') + dt.getFullYear() + ((dt.getMonth() + 1) < 10 ? '0' + (dt.getMonth() + 1) : dt.getMonth()) + temp
805
+ if(this.showview){
806
+ this.$refs.service_show.data.fields[i].value = this.$appdata.getSingleValue('所属公司编码') + dt.getFullYear() + ((dt.getMonth() + 1) < 10 ? '0' + (dt.getMonth() + 1) : dt.getMonth()) + temp
807
+ this.$refs.service_show.update()
808
+ }
809
+
810
+ })
811
+ // this.$refs.service_show.update()
812
+ }
813
+ }
814
+ }
815
+ // 初始化 buttons_fields
816
+ //debugger
817
+ for (let i = 0; i < this.data.buttons.length; i++) {
818
+ if (this.data.buttons[i].button_fields) {
819
+ for (let j = 0; j < this.data.buttons[i].button_fields.length; j++) {
820
+ // 如果selectdata有这些key,则把selectdata的value赋值给data的value
821
+ if (this.selectdata[this.data.buttons[i].button_fields[j].field]) {
822
+ this.data.buttons[i].button_fields[j].value = this.selectdata[this.data.buttons[i].button_fields[j].field]
823
+ }
824
+ // 如果配置类型为select,优先从参数列表获取options
825
+ if (this.data.buttons[i].button_fields[j].type === 'select' && this.$appdata.getParam(this.data.buttons[i].button_fields[j].label)) {
826
+ this.data.buttons[i].button_fields[j].options = this.$appdata.getParam(this.data.buttons[i].button_fields[j].label).trim()
827
+ }
828
+ // 下发特殊配置
829
+ if (this.data.buttons[i].button_name === '下发') {
830
+ if (this.data.buttons[i].button_fields.length === 1) {
831
+ // value初始化
832
+ // if(this.department_search){
833
+ if (this.selectdata[this.data.buttons[i].button_fields[0].field]) {
834
+ for (let k = 0; k < this.department_search.length; k++) {
835
+ // 将id转换为name
836
+ if (Number(this.department_search[k].id) === Number(this.selectdata[this.data.buttons[i].button_fields[0].field])) {
837
+ this.data.buttons[i].button_fields[0].value = {
838
+ id: this.department_search[k].id,
839
+ name: this.department_search[k].name
840
+ }
841
+ }
842
+ }
843
+ }
844
+
845
+ if (this.department_search) {
846
+ let array = []
847
+ for (let k = 0; k < this.department_search.length; k++) {
848
+ array.push({
849
+ label: this.department_search[k].name,
850
+ value: {id: this.department_search[k].id, name: this.department_search[k].name}
851
+ })
852
+ }
853
+ this.data.buttons[i].button_fields[0].options = array
854
+ }
855
+ let array = this.$login.f.rolesnames.split(',')
856
+ if (this.selectdata.defname == '任务分配' && array.includes("工程技术部负责人")) {
857
+ let array = []
858
+ for (let k = 0; k < this.technologist.length; k++) {
859
+ array.push({
860
+ label: this.technologist[k].name,
861
+ value: {id: this.technologist[k].id, name: this.technologist[k].name}
862
+ })
863
+ }
864
+ this.data.buttons[i].button_fields[0].options = array
865
+ }
866
+ } else {
867
+ this.$showMessage("下发按钮必须满足 当且仅当一个字段")
868
+ }
869
+ }
870
+ }
871
+ }
872
+
873
+ }
874
+ var count =0;
875
+ let money=0;
876
+ let dealmoney=0;
877
+ for (count = 0; count < this.data.fields.length; count++) {
878
+ if (this.selectdata.defname.indexOf('派单')>=0) {
879
+ if (this.data.fields[count].label === '合同总金额') {
880
+ console.log('合同总金额===>'+this.data.fields[count].value )
881
+ money=this.data.fields[count].value
882
+ }
883
+
884
+ if (this.data.fields[count].label == '累计缴费金额') {
885
+ dealmoney=this.data.fields[count].value
886
+ console.log('累计缴费金额===>'+dealmoney )
887
+ }
888
+
889
+ if (this.data.fields[count].label == '未结总金额') {
890
+ let othermoney = money-dealmoney;
891
+ console.log('jine'+othermoney)
892
+ this.data.fields[count].value=money-dealmoney
893
+ console.log('未结总金额'+this.data.fields[count].value )
894
+ }
895
+ }
896
+ }
897
+ //debugger
898
+ // 消除双向绑定,避免子组件(显示层)数据更改,父组件(控制层)也更改
899
+ let temp = JSON.parse(JSON.stringify(this.data))
900
+ // let temp = this.data
901
+ // 退回原因展示
902
+ if (this.selectdata.f_back_reason) {
903
+ temp['back_reason'] = this.selectdata.f_back_reason
904
+ }
905
+ this.show_data = temp
906
+ console.log("====="+this.show_data)
907
+ /**
908
+ * 新增需求: 个人报建非民用流程中小区名称需选填
909
+ */
910
+ let j=0;
911
+ if(this.show_data.defname=="现场勘查人员分配" && this.show_data.f_apply_type=="个人报建"){
912
+
913
+ for (j = 0; j < this.show_data.fields.length; j++) {
914
+ if (this.show_data.fields[j].label == '小区名称') {
915
+ this.show_data.fields[j].required=false
916
+ }
917
+ }
918
+ }
919
+ // 显示组件
920
+ // this.showview = false
921
+ // debugger
922
+ this.$nextTick(()=>{
923
+ this.showview = true
924
+ })
925
+ }
926
+ }
927
+ ,
928
+ events: {
929
+ 'get-cost'(val) {
930
+ this.cost = val
931
+
932
+ this.initializtion()
933
+ },
934
+ 'checkboxSelectControl'(index,index2){
935
+ console.log("chufa事件control");
936
+ console.log('this.$refs.service_show.data.fields[index]==>:'+JSON.stringify(this.$refs.service_show.data.fields[index]));
937
+ if(this.$refs.service_show.data.fields[index].label=="提交资料"){
938
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
939
+
940
+ if(this.$refs.service_show.data.fields[i].label=="用户提交资料"){
941
+ //if(this.$refs.service_show.data.fields[index].value == ""){
942
+ console.log("this.$refs.service_show.data.fields[index].items[index2].value==>"+JSON.stringify(this.$refs.service_show.data.fields[index].items[index2]))
943
+ //增加和删除框中的内容
944
+ if(this.$refs.service_show.data.fields[index].items[index2].value == false){
945
+ this.$refs.service_show.data.fields[i].value+=this.$refs.service_show.data.fields[index].items[index2].label+" ";
946
+ this.$refs.service_show.data.fields[index].items[index2].value=true;
947
+ }else{
948
+ let deleteValue = this.$refs.service_show.data.fields[index].items[index2].label;
949
+ let values =this.$refs.service_show.data.fields[i].value;
950
+ let result = values.split(" ").filter((item)=>{
951
+ return item!=deleteValue;
952
+ }).join(" ")
953
+ console.log(result);
954
+ this.$refs.service_show.data.fields[i].value =result;
955
+ this.$refs.service_show.data.fields[index].items[index2].value=false;
956
+ }
957
+ //}
958
+ }
959
+ }
960
+ }
961
+ },
962
+ 'get-number'(val) {
963
+ this.number = val
964
+
965
+ this.initializtion()
966
+ }
967
+ ,
968
+ 'get-pgd'(val) {
969
+ this.pgd = val
970
+ this.initializtion()
971
+ }
972
+ ,
973
+ // 任意select选中时触发事件,关联性操作
974
+ async 'select_cascade'(index) {
975
+
976
+
977
+
978
+
979
+ if (this.$refs.service_show.data.fields[index].label == '施工单位' ||
980
+ this.$refs.service_show.data.fields[index].label == '检测单位' ||
981
+ this.$refs.service_show.data.fields[index].label == '监理单位' ||
982
+ this.$refs.service_show.data.fields[index].label == '土建单位' ||
983
+ this.$refs.service_show.data.fields[index].label == '设计单位') {
984
+ this.$refs.service_show.update()
985
+ return
986
+ }
987
+ if (
988
+ this.$refs.service_show.data.fields[index].label === '最终核算成本金额' ||
989
+ this.$refs.service_show.data.fields[index].label === '合同总金额' ||
990
+ this.$refs.service_show.data.fields[index].label === '工程盈利'
991
+ ) {
992
+
993
+ var a = 0
994
+ var b = 0
995
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
996
+ // 控制设置级联
997
+ // 源select所选的值 this.$refs.service_show.data.activitys.fields[index].value
998
+ // xxx xx xxx
999
+ if (this.$refs.service_show.data.fields[i].label === '最终核算成本金额') {
1000
+ this.$refs.service_show.data.fields[i].value = (this.number + this.cost)
1001
+ a = this.$refs.service_show.data.fields[i].value
1002
+ }
1003
+
1004
+ if (this.$refs.service_show.data.fields[i].label === '合同总金额' && this.$refs.service_show.data.fields[i].value) {
1005
+ b = this.$refs.service_show.data.fields[i].value
1006
+ }
1007
+ }
1008
+ var c = b - a
1009
+ // 数据计算完毕得到工程结余
1010
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1011
+ if (this.$refs.service_show.data.fields[i].label === '工程盈利') {
1012
+ this.$refs.service_show.data.fields[i].value = c
1013
+ }
1014
+ }
1015
+ }
1016
+ //根据合同预算金额和累计缴费金额计算未结金额
1017
+ if (
1018
+ this.$refs.service_show.data.fields[index].label === '累计缴费金额' ||
1019
+ this.$refs.service_show.data.fields[index].label === '合同总金额') {
1020
+ let cumulativeMoney = 0
1021
+ let unaccountMoney = 0
1022
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1023
+
1024
+ if (this.$refs.service_show.data.fields[i].label === '合同总金额' && this.$refs.service_show.data.fields[i].value) {
1025
+ cumulativeMoney += parseInt(this.$refs.service_show.data.fields[i].value)
1026
+ }
1027
+ if (this.$refs.service_show.data.fields[i].label === '累计缴费金额' && this.$refs.service_show.data.fields[i].value) {
1028
+ unaccountMoney += parseInt(this.$refs.service_show.data.fields[i].value)
1029
+ }
1030
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1031
+ // if (this.$refs.service_show.data.fields[i].label === '未结总金额') {
1032
+ // //this.$refs.service_show.data.fields[i].value = cumulativeMoney - unaccountMoney
1033
+ // this.$refs.service_show.data.fields[i].value =0;
1034
+ //
1035
+ // }
1036
+ }
1037
+ }
1038
+ }
1039
+
1040
+
1041
+ //根据合同预算金额和累计开票金额计算未开票金额
1042
+
1043
+
1044
+ if (this.$refs.service_show.data.fields[index].label === '累计开票金额') {
1045
+ let residualInvoicing = this.$refs.service_show.data.fields[index].value
1046
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1047
+ if (this.$refs.service_show.data.fields[i].label === '未开票金额') {
1048
+ this.$refs.service_show.data.fields[i].value = Number(this.selectdata.f_contract_total_money) - Number(residualInvoicing)
1049
+ }
1050
+ }
1051
+ }
1052
+ //如果资料验收是否通过和工程验收是否通过为否的时候弹出原因填写框
1053
+ if (this.$refs.service_show.data.fields[index].label === '资料验收是否通过') {
1054
+ let res = this.$refs.service_show.data.fields[index].value
1055
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1056
+ if (this.$refs.service_show.data.fields[i].label === '资料验收不通过原因') {
1057
+ if (res === '否') {
1058
+ this.$refs.service_show.data.fields[i].hidden = false
1059
+ this.$refs.service_show.data.fields[i].required = true
1060
+ } else {
1061
+ this.$refs.service_show.data.fields[i].hidden = true
1062
+ this.$refs.service_show.data.fields[i].required = false
1063
+ }
1064
+ }
1065
+ }
1066
+ }
1067
+ if (this.$refs.service_show.data.fields[index].label === '工程验收是否通过') {
1068
+ let res = this.$refs.service_show.data.fields[index].value
1069
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1070
+ if (this.$refs.service_show.data.fields[i].label === '工程验收不通过原因') {
1071
+ if (res === '否') {
1072
+ this.$refs.service_show.data.fields[i].hidden = false
1073
+ this.$refs.service_show.data.fields[i].required = true
1074
+ } else {
1075
+ this.$refs.service_show.data.fields[i].hidden = true
1076
+ this.$refs.service_show.data.fields[i].required = false
1077
+ }
1078
+ }
1079
+ }
1080
+ }
1081
+ // }
1082
+
1083
+ //金额小写得到大写
1084
+ if (this.$refs.service_show.showadd_fields && this.$refs.service_show.showadd_fields.length > 0 && this.$refs.service_show.showadd_fields.fields[index].label === '收费金额') {
1085
+ if (this.$refs.service_show.showadd_fields[index].value || this.$refs.service_show.showadd_fields.fields[index].value) {
1086
+ var re = /^[0-9]+.?[0-9]*/
1087
+ let temp = this.$refs.service_show.showadd_fields[index].value
1088
+ if (temp == "" || isNaN(temp)) {
1089
+ this.$showMessage("请输入纯数字")
1090
+ this.$refs.service_show.showadd_fields[index].value = 0
1091
+ }
1092
+ }
1093
+ let temp = this.$refs.service_show.showadd_fields[index]
1094
+ let value = temp.value
1095
+ // let chargeMoney = this.$refs.service_show.showadd_fields[index].value
1096
+ for (let i = 0; i < this.$refs.service_show.showadd_fields.fields.length; i++) {
1097
+ if (this.$refs.service_show.showadd_fields.fields[i].label === '金额大写') {
1098
+ let te = {
1099
+ value: this.smalltoBIG(value)
1100
+ }
1101
+ this.$refs.service_show.showadd_fields[i] = te
1102
+ }
1103
+ }
1104
+ }
1105
+
1106
+
1107
+
1108
+ if (this.$refs.service_show.data.fields[index].label === '县/区') {
1109
+ let temp = this.$refs.service_show.data.fields[index].value
1110
+ console.log('==============================县/区:' + temp)
1111
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1112
+ // 控制设置级联
1113
+ // 源select所选的值 this.$refs.service_show.data.activitys.fields[index].value
1114
+ if (this.$refs.service_show.data.fields[i].label === '街道名称') {
1115
+ this.$refs.service_show.data.fields[i].value = ''
1116
+ let street = await this.$resetpost('rs/sql/singleTable', {
1117
+ data: {
1118
+ tablename: 't_street',
1119
+ condition: `f_filialeids = '${this.$login.f.f_orgids}' and f_pcd='${temp}'`
1120
+ }
1121
+ }, {resolveMsg: null, rejectMsg: null})
1122
+ let streetrs = []
1123
+ for (let i = 0; i < street.data.length; i++) {
1124
+ let temp = {
1125
+ label: street.data[i].f_street,
1126
+ value: street.data[i].f_street
1127
+ }
1128
+ streetrs.push(temp)
1129
+ }
1130
+
1131
+ this.$refs.service_show.data.fields[i].options = [{label: '全部', value: ''}, ...streetrs]
1132
+ //this.data.fields[i].options = [{label: '全部', value: ''}, ...streetrs]
1133
+ // console.log('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~option:', this.data.fields[i].options)
1134
+
1135
+ this.$refs.service_show.update()
1136
+ }
1137
+ }
1138
+ }
1139
+ if (this.$refs.service_show.data.fields[index].label === '气表品牌') {
1140
+ let temp = this.$refs.service_show.data.fields[index].value
1141
+ let meterbrand = await this.$resetpost('rs/sql/singleTable', {
1142
+ data: {
1143
+ //items: 'f_bill_url,f_url_code',
1144
+ tablename: 't_gasbrand',
1145
+ condition: `f_filialeids = '${this.$login.f.f_orgids}' and f_meter_brand='${temp}'`
1146
+ }
1147
+ }, {resolveMsg: null, rejectMsg: null})
1148
+ console.log(meterbrand)
1149
+ console.log(meterbrand.data)
1150
+ let idstring = '('
1151
+ idstring += meterbrand.data[0].id
1152
+ console.log("idstring第一个" + idstring)
1153
+ if (meterbrand.data.length > 1) {
1154
+ for (let i = 1; i < meterbrand.data.length; i++) {
1155
+ idstring += ',' + meterbrand.data[i].id
1156
+ }
1157
+ }
1158
+ idstring += ')'
1159
+ console.log("idstring" + idstring)
1160
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1161
+
1162
+ if (this.$refs.service_show.data.fields[i].label === '气表型号') {
1163
+ this.$refs.service_show.data.fields[i].value = ''
1164
+
1165
+
1166
+ let gasbrand = await this.$resetpost('rs/sql/singleTable', {
1167
+ data: {
1168
+ tablename: 't_gasmodel',
1169
+ condition: ` f_gasbrand_id in ${idstring}`
1170
+ }
1171
+ }, {resolveMsg: null, rejectMsg: null})
1172
+ let brandstr = []
1173
+ for (let i = 0; i < gasbrand.data.length; i++) {
1174
+ let brand = {
1175
+ label: gasbrand.data[i].f_meter_style,
1176
+ value: gasbrand.data[i].f_meter_style
1177
+ }
1178
+ brandstr.push(brand)
1179
+ }
1180
+
1181
+ this.$refs.service_show.data.fields[i].options = [{label: '全部', value: ''}, ...brandstr]
1182
+ //this.data.fields[i].options = [{label: '全部', value: ''}, ...streetrs]
1183
+ // console.log('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~option:', this.data.fields[i].options)
1184
+
1185
+ this.$refs.service_show.update()
1186
+ }
1187
+ }
1188
+ }
1189
+
1190
+
1191
+ if (this.$refs.service_show.data.fields[index].label === '气表型号') {
1192
+ let meterstyle= this.$refs.service_show.data.fields[index].value
1193
+ let meterbrand = ''
1194
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1195
+ if (this.$refs.service_show.data.fields[i].label === '气表品牌') {
1196
+ meterbrand = this.$refs.service_show.data.fields[i].value
1197
+ }}
1198
+
1199
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1200
+
1201
+ if (this.$refs.service_show.data.fields[i].label === '别名') {
1202
+ console.log("获取别名")
1203
+ this.$refs.service_show.data.fields[i].value = ''
1204
+
1205
+ let meterbrandalias = await this.$resetpost('rs/sql/getMeterBrand', {
1206
+ data: {
1207
+ condition: `f_filialeids = '${this.$login.f.f_orgids}' and f_meter_brand='${meterbrand}' and f_meter_style='${meterstyle}'`
1208
+ }
1209
+ }, {resolveMsg: null, rejectMsg: null})
1210
+
1211
+ let alias = []
1212
+ for (let i = 0; i < meterbrandalias.data.length; i++) {
1213
+ let brand = {
1214
+ label: meterbrandalias.data[i].f_alias,
1215
+ value: meterbrandalias.data[i].f_alias
1216
+ }
1217
+ alias.push(brand)
1218
+ }
1219
+
1220
+ this.$refs.service_show.data.fields[i].options = [{label: '全部', value: ''}, ...alias]
1221
+ //this.data.fields[i].options = [{label: '全部', value: ''}, ...streetrs]
1222
+ // console.log('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~option:', this.data.fields[i].options)
1223
+
1224
+ this.$refs.service_show.update()
1225
+
1226
+ }
1227
+ }
1228
+
1229
+ }
1230
+
1231
+
1232
+ if (this.$refs.service_show.data.fields[index].label === '证件类型') {
1233
+ let temp = this.$refs.service_show.data.fields[index].value
1234
+ console.log('==============================证件类型:' + temp)
1235
+ if (temp === '身份证') {
1236
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1237
+ if (this.$refs.service_show.data.fields[i].label === '证件号码') {
1238
+ this.$refs.service_show.data.fields[i].required = true
1239
+ }
1240
+ }
1241
+ } else {
1242
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1243
+ if (this.$refs.service_show.data.fields[i].label === '证件号码') {
1244
+ this.$refs.service_show.data.fields[i].required = false
1245
+ }
1246
+ }
1247
+ }
1248
+ }
1249
+
1250
+ if (this.$refs.service_show.data.fields[index].label === '是否设计出图') {
1251
+ let temp = this.$refs.service_show.data.fields[index].value
1252
+
1253
+ if (temp === '') {
1254
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1255
+ if (this.$refs.service_show.data.fields[i].label === '设计派工日期' ||
1256
+ this.$refs.service_show.data.fields[i].label === '设计人员'
1257
+ ) {
1258
+ this.$refs.service_show.data.fields[i].required = true
1259
+ }
1260
+ }
1261
+ } else {
1262
+ console.log("不设计出图,进入else")
1263
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1264
+ if (this.$refs.service_show.data.fields[i].label === '设计派工日期' || this.$refs.service_show.data.fields[i].label === '设计人员') {
1265
+
1266
+ this.$refs.service_show.data.fields[i].required = false
1267
+ }
1268
+ }
1269
+ }
1270
+ }
1271
+
1272
+ if (this.$refs.service_show.data.fields[index].label === '派工单号') {
1273
+ this.$refs.service_show.data.fields[index].value = this.pgd
1274
+ }
1275
+
1276
+
1277
+ if (this.$refs.service_show.data.fields[index].label === '街道名称') {
1278
+ let temp = this.$refs.service_show.data.fields[index].value
1279
+ console.log('=============================街道:' + temp)
1280
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1281
+ // 控制设置级联
1282
+ // 源select所选的值 this.$refs.service_show.data.activitys.fields[index].value
1283
+ if (this.$refs.service_show.data.fields[i].label === '小区名称') {
1284
+ this.$refs.service_show.data.fields[i].value = ''
1285
+
1286
+ let area = await this.$resetpost('rs/sql/singleTable', {
1287
+ data: {
1288
+ tablename: 't_area',
1289
+ condition: `f_filialeids = '${this.$login.f.f_orgids}' and f_street='${temp}'`
1290
+ }
1291
+ }, {resolveMsg: null, rejectMsg: null})
1292
+ let arears = []
1293
+ this.areaall=area.data;
1294
+ for (let i = 0; i < area.data.length; i++) {
1295
+ let temp = {
1296
+ label: area.data[i].f_residential_area,
1297
+ value: area.data[i].f_residential_area
1298
+ }
1299
+ arears.push(temp)
1300
+ }
1301
+ this.$refs.service_show.data.fields[i].options = [{label: '全部', value: ''}, ...arears]
1302
+ //this.data.fields[i].options = [{label: '全部', value: ''}, ...streetrs]
1303
+ console.log('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~option:', this.$refs.service_show.data.fields[i].options)
1304
+
1305
+ this.$refs.service_show.update()
1306
+
1307
+ }
1308
+ }
1309
+ }
1310
+
1311
+ if(this.$refs.service_show.data.fields[index].label === '小区名称'){
1312
+ for (let i = 0; i < this.areaall.length; i++) {
1313
+ console.log("aaaaaaaaaaaa")
1314
+ if(this.areaall[i].f_residential_area== this.$refs.service_show.data.fields[index].value){
1315
+ console.log("abbbbbbbbb")
1316
+ for (let j = 0; j < this.$refs.service_show.data.fields.length; j++) {
1317
+ if(this.$refs.service_show.data.fields[j].label === '小区地址'){
1318
+ console.log(this.areaall[i].f_area_address)
1319
+ this.$refs.service_show.data.fields[j].value=this.areaall[i].f_area_address
1320
+ }
1321
+ }
1322
+ }
1323
+ }
1324
+ }
1325
+ //控制尾款
1326
+ if (
1327
+ this.$refs.service_show.data.fields[index].label === '合同金额' ||
1328
+ this.$refs.service_show.data.fields[index].label === '首付' ||
1329
+ this.$refs.service_show.data.fields[index].label === '进度款' ||
1330
+ this.$refs.service_show.data.fields[index].label === '尾款'
1331
+ ) {
1332
+ console.log('即将计算合同金额')
1333
+ var cash = 0
1334
+ var downpayments = 0
1335
+ var tailmoney = 0
1336
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1337
+ // 控制设置级联
1338
+ // 源select所选的值 this.$refs.service_show.data.activitys.fields[index].value
1339
+ // xxx xx xxx
1340
+ if (this.$refs.service_show.data.fields[i].label === '合同金额' && this.$refs.service_show.data.fields[i].value) {
1341
+ cash = this.$refs.service_show.data.fields[i].value
1342
+ }
1343
+ if (this.$refs.service_show.data.fields[i].label === '首付' && this.$refs.service_show.data.fields[i].value) {
1344
+ downpayments = this.$refs.service_show.data.fields[i].value
1345
+ }
1346
+ if (this.$refs.service_show.data.fields[i].label === '进度款' && this.$refs.service_show.data.fields[i].value) {
1347
+ tailmoney = this.$refs.service_show.data.fields[i].value
1348
+ }
1349
+ }
1350
+ var a = cash - downpayments
1351
+ // 数据计算完毕得到尾款
1352
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1353
+ if (this.$refs.service_show.data.fields[i].label === '尾款') {
1354
+ if (cash === downpayments) {
1355
+ this.$refs.service_show.data.fields[i].value = 0
1356
+ } else {
1357
+ this.$refs.service_show.data.fields[i].value = (cash - downpayments - tailmoney)
1358
+ console.log('修改fields[i].value后的值=>' + this.$refs.service_show.data.fields[i].value)
1359
+ }
1360
+ }
1361
+ if (this.$refs.service_show.data.fields[i].label === '首付') {
1362
+ if (a < 0) {
1363
+ this.$showMessage("首付款数额过大")
1364
+ downpayments = 0
1365
+ this.$refs.service_show.data.fields[i].value = 0
1366
+ }
1367
+ }
1368
+
1369
+ if (this.$refs.service_show.data.fields[i].label === '进度款') {
1370
+
1371
+ if (cash === downpayments) {
1372
+ tailmoney = 0
1373
+ this.$refs.service_show.data.fields[i].value = 0
1374
+ this.$refs.service_show.data.fields[i].readonly = true
1375
+ } else {
1376
+ this.$refs.service_show.data.fields[i].readonly = false
1377
+ tailmoney = this.$refs.service_show.data.fields[i].value
1378
+ }
1379
+ if (tailmoney > a) {
1380
+ this.$showMessage("进度款数额过大")
1381
+ tailmoney = 0
1382
+ this.$refs.service_show.data.fields[i].value = 0
1383
+ }
1384
+ }
1385
+ }
1386
+ }
1387
+
1388
+
1389
+ // 合成地址
1390
+ if (
1391
+ this.$refs.service_show.data.fields[index].label === '县/区' ||
1392
+ this.$refs.service_show.data.fields[index].label === '街道名称' ||
1393
+ this.$refs.service_show.data.fields[index].label === '小区名称' ||
1394
+ this.$refs.service_show.data.fields[index].label === '楼号' ||
1395
+ this.$refs.service_show.data.fields[index].label === '单元号' ||
1396
+ this.$refs.service_show.data.fields[index].label === '楼层' ||
1397
+ this.$refs.service_show.data.fields[index].label === '门牌号'
1398
+ ) {
1399
+ console.log('即将合成地址')
1400
+ var address = ''
1401
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1402
+ // 控制设置级联
1403
+ // 源select所选的值 this.$refs.service_show.data.activitys.fields[index].value
1404
+ // xxx xx xxx
1405
+ if (this.$refs.service_show.data.fields[i].label === '县/区' && this.$refs.service_show.data.fields[i].value) {
1406
+ address += this.$refs.service_show.data.fields[i].value
1407
+ }
1408
+ if (this.$refs.service_show.data.fields[i].label === '街道名称' && this.$refs.service_show.data.fields[i].value) {
1409
+ address += this.$refs.service_show.data.fields[i].value
1410
+ }
1411
+ if (this.$refs.service_show.data.fields[i].label === '小区名称' && this.$refs.service_show.data.fields[i].value) {
1412
+ address += this.$refs.service_show.data.fields[i].value
1413
+ }
1414
+ if (this.$refs.service_show.data.fields[i].label === '楼号' && this.$refs.service_show.data.fields[i].value) {
1415
+ address += this.$refs.service_show.data.fields[i].value
1416
+ }
1417
+ if (this.$refs.service_show.data.fields[i].label === '单元号' && this.$refs.service_show.data.fields[i].value) {
1418
+ address += '-' +this.$refs.service_show.data.fields[i].value
1419
+ }
1420
+ if (this.$refs.service_show.data.fields[i].label === '楼层' && this.$refs.service_show.data.fields[i].value) {
1421
+ address += '-' +this.$refs.service_show.data.fields[i].value
1422
+ }
1423
+ if (this.$refs.service_show.data.fields[i].label === '门牌号' && this.$refs.service_show.data.fields[i].value) {
1424
+ address += '-' +this.$refs.service_show.data.fields[i].value
1425
+ }
1426
+
1427
+ }
1428
+ console.log('获取到的address=>' + address)
1429
+ // 数据获取完毕时放入地址text
1430
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1431
+ if (this.$refs.service_show.data.fields[i].label === '地址') {
1432
+ this.$refs.service_show.data.fields[i].value = address
1433
+ console.log('修改fields[i].value后的值=>' + this.$refs.service_show.data.fields[i].value)
1434
+ }
1435
+ }
1436
+ }
1437
+ // 开户费+材料费+人工费+设备安装费=合计
1438
+ if (
1439
+ this.$refs.service_show.data.fields[index].label === '工程安装费' ||
1440
+ this.$refs.service_show.data.fields[index].label === '材料费' ||
1441
+ this.$refs.service_show.data.fields[index].label === '人工费'
1442
+ ) {
1443
+ console.log('即将合成价格')
1444
+ let a1 = 0
1445
+ let b1 = 0
1446
+ let c1 = 0
1447
+ let fee = 0
1448
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1449
+ // 控制设置级联
1450
+ // 源select所选的值 this.$refs.service_show.data.activitys.fields[index].value
1451
+ // xxx xx xxx
1452
+ if (this.$refs.service_show.data.fields[i].label === '工程安装费' && this.$refs.service_show.data.fields[i].value) {
1453
+ a1 = this.$refs.service_show.data.fields[i].value
1454
+ }
1455
+ if (this.$refs.service_show.data.fields[i].label === '材料费' && this.$refs.service_show.data.fields[i].value) {
1456
+ b1= this.$refs.service_show.data.fields[i].value
1457
+ }
1458
+ if (this.$refs.service_show.data.fields[i].label === '人工费' && this.$refs.service_show.data.fields[i].value) {
1459
+ c1 = this.$refs.service_show.data.fields[i].value
1460
+ }
1461
+ fee=parseFloat(parseFloat(a1) + parseFloat(b1)+parseFloat(c1)).toFixed(2)
1462
+ // 数据获取完毕时放入地址text
1463
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1464
+ if (this.$refs.service_show.data.fields[i].label === '费用合计'||this.$refs.service_show.data.fields[i].label === '未结总金额') {
1465
+ this.$refs.service_show.data.fields[i].value =fee
1466
+ console.log('修改fields[i].value后的值=>' + this.$refs.service_show.data.fields[i].value)
1467
+ }
1468
+ }
1469
+ }
1470
+ }
1471
+ if (this.$refs.service_show.data.fields[index].label == '用户类型'){
1472
+ debugger
1473
+ if(this.$refs.service_show.data.fields[index].value == '非民用'){
1474
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1475
+ if (this.$refs.service_show.data.fields[i].label === '小区名称') {
1476
+ this.$refs.service_show.data.fields[i].required=false;
1477
+ }
1478
+ }
1479
+ }else{
1480
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1481
+ if (this.$refs.service_show.data.fields[i].label === '小区名称') {
1482
+ this.$refs.service_show.data.fields[i].required=true;
1483
+ }
1484
+ }
1485
+ }
1486
+ }
1487
+ },
1488
+ // onetomany模态框监听事件
1489
+ async 'select_cascade_modal'(i,j){
1490
+ if(this.data.onetomany[i].tables[0]=='t_apply_construct_balance'){
1491
+ if(this.data.onetomany[i].fields[j].label == '第三施工方'){
1492
+ for(let k =0;k<this.data.onetomany[i].fields.length;k++){
1493
+
1494
+ if(this.data.onetomany[i].fields[k].label.includes('当前累计结算比例')){
1495
+ let sum = 0
1496
+ for(let p =0;p<this.$refs.service_show.model.rows[i].length;p++){
1497
+ if(this.$refs.service_show.model.rows[i][p].f_construct_company == this.$refs.service_show.showadd_fields.fields[j].value){
1498
+ sum+=Number(this.$refs.service_show.showadd_fields.fields[k-2].value)
1499
+ sum+=Number(this.$refs.service_show.model.rows[i][p].f_balance_scale)
1500
+ }
1501
+ }
1502
+ if(this.$refs.service_show.model.rows[i].length==0){
1503
+ sum = Number(this.$refs.service_show.showadd_fields.fields[k-2].value)
1504
+ }
1505
+ this.$refs.service_show.update_showadd_fields_value(k,sum)
1506
+ }
1507
+ }
1508
+ }
1509
+ }
1510
+ },
1511
+ async 'onetomanyevent'(datas) {
1512
+ // console.log(`onetomany=======>${JSON.stringify(datas)}`)
1513
+
1514
+ for (let i = 0; i < datas.rows.length; i++) {
1515
+ datas.rows[i]['f_process_id'] = this.selectdata.f_process_id
1516
+ datas.rows[i]['f_apply_num'] = this.selectdata.f_apply_num
1517
+ datas.rows[i]['f_filiale'] = this.$login.f.f_fengongsi
1518
+ datas.rows[i]['f_parentname'] = this.$login.f.f_parentname
1519
+ datas.rows[i]['f_operator'] = this.$login.f.name
1520
+ }
1521
+ let http = new HttpResetClass()
1522
+ await http.load('POST', 'rs/logic/saveentity', datas, {resolveMsg: null, rejectMsg: 'search查询部门下所有人失败'})
1523
+ }
1524
+ ,
1525
+ // 获取view层button事件/
1526
+ async 'button'(model) {
1527
+ // console.log("button事件接收参数:", model)
1528
+ // 点击重置按钮就重置数据
1529
+ if (model.button.button_name === '重置') {
1530
+ this.refurbish()
1531
+ return
1532
+ }
1533
+ if (model.button.button_name === '打印回单') {
1534
+ this.printReceipt(model)
1535
+ return
1536
+ }
1537
+ var operate = ''
1538
+ // 判断当前按钮是否为特殊业务,即子流程提交或者分发
1539
+ if (model.button.button_name === '提交' && model.button.button_event && model.button.button_event === '子流程提交') {
1540
+ operate = '子流程提交'
1541
+ }
1542
+ if (model.button.button_name === '提交' && model.button.button_event && model.button.button_event === '合同信息') {
1543
+ model.f_budget_money = model.f_contract_money
1544
+ //未结算总金额=合计
1545
+ model.f_unaccounts_money = model.f_total_cost
1546
+ model.f_cumulative_money = 0
1547
+ model.f_cumulative_invoicing = 0
1548
+ model.f_additional_payment = 0
1549
+ model.f_residual_invoicing = model.f_contract_money
1550
+ }
1551
+ if (model.button.button_name === '下发') {
1552
+ if (model.button && model.button.button_event === '分发') {
1553
+ operate = '分发'
1554
+ }
1555
+ let array = this.$login.f.rolesnames.split(',')
1556
+ if (this.selectdata.defname == '任务分配' && array.includes("工程技术部负责人")) {
1557
+ model.f_survey_name = model.button.button_fields.f_apply_kefu_employee
1558
+ }
1559
+ }
1560
+
1561
+ if (model.button.button_name == '提交' && model.button.button_person && model.button.button_person.button_event === '获取之前被下发人' && model.button.button_person.button_person_field) {
1562
+ model.button.button_name = '下发'
1563
+ model.button.button_fields = {}
1564
+ console.log(model.button.button_person.button_person_field)
1565
+ console.log(this.selectdata[model.button.button_person.button_person_field])
1566
+ console.log(this.selectdata)
1567
+ if(this.selectdata[model.button.button_person.button_person_field].startsWith('{')){
1568
+ let temp= JSON.parse(this.selectdata[model.button.button_person.button_person_field])
1569
+ model.button.button_fields[model.button.button_person.button_person_field] = temp.id
1570
+ }else{
1571
+ model.button.button_fields[model.button.button_person.button_person_field] = this.selectdata[model.button.button_person.button_person_field]
1572
+ }
1573
+
1574
+ }
1575
+ if (model.button.button_name === '提交') {
1576
+ // for (let i = 0; i < this.show_data.fields.length; i++) {
1577
+ // if (this.show_data.fields[i].label === '收费项目') {
1578
+ // let yuanXiang = this.show_data.fields[i].value
1579
+ // if (yuanXiang != '' && yuanXiang != null) {
1580
+ // for (let i = 0; i < yuanXiang.length; i++) {
1581
+ // this.xia += yuanXiang[i] + '-'
1582
+ // }
1583
+ // let idx = this.xia.lastIndexOf("-");
1584
+ // this.xiangmu = this.xia.substring(0,idx)
1585
+ // }
1586
+ // model.f_charge_items = this.xiangmu
1587
+ // }
1588
+ // }
1589
+ var flag = false
1590
+ if (this.data.defname == '合同审核') {
1591
+ flag = true
1592
+ http = new HttpResetClass()
1593
+ let data = {
1594
+ tablename: 't_singlevalue',
1595
+ condition: `name = '合同编号' and f_filialeids = '${this.$login.f.f_orgids}'`
1596
+ }
1597
+ let res = await http.load('POST', 'rs/sql/singleTable', {data: data}, {
1598
+ resolveMsg: null,
1599
+ rejectMsg: "获取合同编号失败"
1600
+ })
1601
+ if (this.contract != res.data[0].value && !this.selectdata.f_contract_number) {
1602
+ this.$showMessage("合同编号已经被使用,请按F5刷新页面后重新登记")
1603
+ return
1604
+ }
1605
+ }
1606
+
1607
+ }
1608
+ console.log('本次点击button执行的操作是=>' + operate)
1609
+ model = Object.assign({}, this.selectdata, model)
1610
+ let http = new HttpResetClass()
1611
+ var url
1612
+ var requestData = {
1613
+ tables: this.data.tables,
1614
+ start_activity: this.$workflow_vue.start_activity,
1615
+ model: model,
1616
+ loginUser: this.$login.f
1617
+ }
1618
+ if (operate != '') {
1619
+ // 特殊操作走特殊logic业务处理
1620
+ url = 'rs/logic/SubprocessService'
1621
+ requestData = {
1622
+ tables: this.data.tables, model: model
1623
+ }
1624
+ } else if (model.button.button_name === '提交' && model.button.button_event && model.button.button_event === '分支流程异步合并处理') {
1625
+ url = 'rs/logic/branchsyncprocess'
1626
+ requestData = {
1627
+ tables: this.data.tables, model: model
1628
+ }
1629
+ } else {
1630
+ if(requestData.model.f_stair_price_name === ''|| requestData.model.f_stair_price_name === null|| requestData.model.f_stair_price_name === undefined){
1631
+ requestData.model.f_stair_price_name = this.selectdata.f_stair_price_name
1632
+ }
1633
+ console.log(requestData.model.f_stair_price_name)
1634
+ // 下发,提交,保存,退回通用业务后台处理logic
1635
+ url = 'rs/logic/ApplyProductService'
1636
+ requestData = {
1637
+ tables: this.data.tables, model: model
1638
+ }
1639
+ }
1640
+ requestData.start_activity = this.$workflow_vue.start_activity
1641
+ requestData.loginUser = this.$login.f
1642
+ requestData.workflow_xmlfilename = this.$workflow_vue.workflow_xmlfilename
1643
+ console.log('即将发送请求url=>' + url + ',参数=>' + JSON.stringify(requestData))
1644
+ let res = res = await http.load('POST', url, {data: requestData}, {resolveMsg: null, rejectMsg: '数据保存失败'})
1645
+ console.log("service处理完成返回数据:", JSON.stringify(res.data))
1646
+ if(res.data.msg=="地址重复,请修改后重新提交"){
1647
+ this.$showMessage(res.data.msg)
1648
+ }
1649
+ if (res.data.code == 200) {
1650
+ // flag 为合同编号更新标志
1651
+ if (flag) {
1652
+ let http = new HttpResetClass()
1653
+ let data = {
1654
+ tablename: 't_singlevalue',
1655
+ condition: `name = '合同编号' and f_filialeids = '${this.$login.f.f_orgids}'`,
1656
+ value: (Number(this.contract) + 1) + ''
1657
+ }
1658
+ await http.load('POST', 'rs/logic/updatesinglevalue', {data: data}, {
1659
+ resolveMsg: null,
1660
+ rejectMsg: "获取合同编号更新失败"
1661
+ })
1662
+ }
1663
+ this.showview = false
1664
+ // 特殊处理
1665
+ this.special(model)
1666
+ this.$dispatch('close')
1667
+ this.initializtion()
1668
+ } else {
1669
+ if (res.data.msg) {
1670
+ this.$showMessage(res.data.msg)
1671
+ }
1672
+ }
1673
+
1674
+
1675
+ /*
1676
+ if(this.selectdata.defname =='报装申请'|| this.selectdata.defname =='现场勘查'|| this.selectdata.defname =='验收'||this.selectdata.defname =='集体报装申请'||this.selectdata.defname =='现场勘查人员分配'||this.selectdata.defname =='安装通气' ){
1677
+ console.log("defname======================================",this.selectdata.defname)
1678
+ let http1 = new HttpResetClass();
1679
+ let sendtime = null;
1680
+ let finishtime = null;
1681
+ let f_department = null;
1682
+ let f_process_id = null;
1683
+ let data1 = {
1684
+ f_process_id: this.selectdata.f_process_id,
1685
+ defname : this.selectdata.defname
1686
+ }
1687
+ console.log("res1=======================================",data1)
1688
+ await http1.load('POST', 'rs/logic/getTime', {data:data1}).then((res) => {
1689
+ console.log("objk===>",res.data)
1690
+ sendtime=res.data.getUserid[0].sendtime;
1691
+ finishtime=res.data.getUserid[0].finishtime;
1692
+ f_department=res.data.resdata[0].name;
1693
+ console.log("objk===>")
1694
+ })
1695
+
1696
+ let data2 = {
1697
+ department:f_department,
1698
+ resourceCatalog:this.selectdata.defname,
1699
+ sqzt:model.f_user_name,
1700
+ code:model.f_idnumber,
1701
+ sqsj:sendtime,
1702
+ slsj:sendtime,
1703
+ bjsj:finishtime,
1704
+ blcb:0,
1705
+ sqclsl:0,
1706
+ sqclmc:'',
1707
+ gdlsh:'',
1708
+ sbdz:model.f_address,
1709
+ sldw:'鄂州市安泰天然气有限责任公司',
1710
+ sfyj:'',
1711
+ gxzq:'',
1712
+ type:this.selectdata.defname
1713
+ }
1714
+ console.log("====================================",data2)
1715
+ await http1.load('POST', 'rs/logic/getPost', {data:data2})
1716
+ }
1717
+ */
1718
+
1719
+
1720
+
1721
+ }
1722
+ ,
1723
+ async 'onetomanydelete'(i, j) {
1724
+ let http = new HttpResetClass()
1725
+ let data = {
1726
+ tables: this.show_data.onetomany[i].tables,
1727
+ row: this.$refs.service_show.model.rows[i][j]
1728
+ }
1729
+ await http.load('POST', 'rs/logic/applyDeleteValue', {data: data}, {
1730
+ resolveMsg: null,
1731
+ rejectMsg: 'onetomanydelete失败'
1732
+ }).then(() => {
1733
+ this.$dispatch('selfsearch')
1734
+ this.$refs.service_show.model.rows[i].splice(j, 1)
1735
+ })
1736
+ }
1737
+ ,
1738
+ //获取view层confirm事件
1739
+ async 'confirm'(tables, row, showadd_index, j) {
1740
+ var _this = this
1741
+ for (let i = 0; i < tables.length; i++) {
1742
+ let datas = {
1743
+ tables: tables,
1744
+ row: row
1745
+ }
1746
+ console.log("看看datas")
1747
+ console.log(datas)
1748
+ console.log("看看showadd_index")
1749
+ console.log(showadd_index)
1750
+ datas.row['f_process_id'] = this.selectdata.f_process_id
1751
+ datas.row['f_apply_num'] = this.selectdata.f_apply_num
1752
+ datas.row['f_filiale'] = this.selectdata.f_filiale
1753
+ let http = new HttpResetClass()
1754
+ let sellid = ''
1755
+ let billtype = datas.row['f_bill_style']
1756
+ if (tables[i] == 't_charge_record') {
1757
+ await this.loadbuyer()
1758
+ if (this.buyerinfo.rows.length < 1 && billtype === '增值税电子发票' && this.$appdata.getSingleValue('默认打印票据') === '是') {
1759
+ this.$showAlert('未找到购买方信息,请去报建功能"购买方信息"中完善购买方信息后再收费', 'info', 2000)
1760
+ this.$refs.service_show.model.rows[showadd_index].splice(j, 1)
1761
+ this.$refs.service_show.initializtion()
1762
+ return
1763
+ }
1764
+ datas.row.f_charging_status = '有效'
1765
+ datas.row.f_is_correct = '否'
1766
+ datas.row.f_charge_collectors = this.$login.f.name
1767
+ datas.row.f_amount_words=this.smalltoBIG(datas.row.f_charge_money)
1768
+ await http.load('POST', 'rs/logic/applycharge', datas, {
1769
+ resolveMsg: null,
1770
+ rejectMsg: '收费保存失败'
1771
+ }).then((res) => {
1772
+ sellid = JSON.parse(res.data.sellid).id
1773
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1774
+ //
1775
+ // if (this.$refs.service_show.data.fields[i].label == '累计缴费金额') {
1776
+ // this.$refs.service_show.data.fields[i].value = res.data.f_cumulative_money
1777
+ // }
1778
+ //
1779
+ // if (this.$refs.service_show.data.fields[i].label == '未结总金额') {
1780
+ // this.$refs.service_show.data.fields[i].value = res.data.f_unaccounts_money
1781
+ // }
1782
+
1783
+ }
1784
+ let temp = _this.$refs.service_show.model.rows[showadd_index][j]
1785
+ temp.id = sellid
1786
+ _this.$refs.service_show.model.rows[showadd_index][j] = temp
1787
+ })
1788
+ if (this.$appdata.getSingleValue('默认打印票据') && this.$appdata.getSingleValue('默认打印票据') === '是') {
1789
+ this.$showMessage('是否打票据', ['confirm', 'cancel']).then((res) => {
1790
+ if (res === 'confirm') {
1791
+ console.log('打印票据')
1792
+ if (billtype === '增值税电子发票') {
1793
+ this.selectsellid = sellid
1794
+ this.showbuyerinfo = true
1795
+ } else {
1796
+ this.printbill(sellid)
1797
+ }
1798
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1799
+ if (this.$refs.service_show.data.fields[i].label == '累计开票金额') {
1800
+ console.log("计算累计开票金额")
1801
+ this.$refs.service_show.data.fields[i].value = parseInt(this.$refs.service_show.data.fields[i].value) + this.datas.row.f_cumulative_invoicing
1802
+ }
1803
+ }
1804
+ }
1805
+ })
1806
+ }
1807
+ // 刷新列表数据
1808
+ console.log("刷新一下")
1809
+ this.$dispatch('selfsearch')
1810
+ console.log("刷新完成")
1811
+ } else {
1812
+ await http.load('POST', 'rs/logic/saveentity', datas, {
1813
+ resolveMsg: null,
1814
+ rejectMsg: 'onetomany保存失败'
1815
+ }).then((res) => {
1816
+ // 刷新列表数据
1817
+ this.$dispatch('selfsearch')
1818
+ let temp = _this.$refs.service_show.model.rows[showadd_index][j]
1819
+ temp.id = res.data.id
1820
+ _this.$refs.service_show.model.rows[showadd_index][j] = temp
1821
+ })
1822
+ }
1823
+ }
1824
+ }
1825
+ }
1826
+ }
1827
+ </script>