apply-clients 5.0.35-64 → 5.0.35-67

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