apply-clients 5.0.35-50 → 5.0.35-53

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