apply-clients 3.0.4 → 3.0.5-4

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.
Files changed (64) hide show
  1. package/index.html +1 -1
  2. package/package.json +4 -3
  3. package/src/App.vue +126 -15
  4. package/src/apply.js +152 -134
  5. package/src/bootstrap/fonts/PingFangSC-Regular.ttf +0 -0
  6. package/src/bootstrap/less/bootstrap.less +1 -2
  7. package/src/bootstrap/less/standard.less +208 -0
  8. package/src/components/Util.js +4 -0
  9. package/src/components/app_apply/FieldExploration.vue +2 -2
  10. package/src/components/app_apply/Ventilation.vue +2 -2
  11. package/src/components/image/doc.jpg +0 -0
  12. package/src/components/image/excel.jpg +0 -0
  13. package/src/components/image/pdf.jpg +0 -0
  14. package/src/components/image//345/233/276/345/261/20212.png +0 -0
  15. package/src/components/image//345/233/276/345/261/20213.png +0 -0
  16. package/src/components/image//345/233/276/345/261/20216.png +0 -0
  17. package/src/components/image//345/244/232/350/276/271/345/275/2422.png +0 -0
  18. package/src/components/image//345/244/232/350/276/271/345/275/2422/346/213/267/350/264/235.png +0 -0
  19. package/src/components/image//346/244/255/345/234/2062.png +0 -0
  20. package/src/components/image//346/244/255/345/234/2065.png +0 -0
  21. package/src/components/image//346/244/255/345/234/2065/346/213/267/350/264/235.png +0 -0
  22. package/src/components/image//346/244/255/345/234/2065/346/213/267/350/264/2352.png +0 -0
  23. package/src/components/image//346/244/255/345/234/2065/346/213/267/350/264/2353.png +0 -0
  24. package/src/components/image//347/273/2044.png +0 -0
  25. package/src/components/image//347/273/2045.png +0 -0
  26. package/src/components/image//347/273/2046.png +0 -0
  27. package/src/components/image//350/257/235/345/212/241/347/273/237/350/256/241/346/225/260/346/215/256/345/261/225/347/244/272.png +0 -0
  28. package/src/components/product/Function/InstallFunction.vue +9 -5
  29. package/src/components/product/Function/InstallInfoSelect.vue +98 -69
  30. package/src/components/product/Function/Service/FunctionServiceControl.vue +47 -4
  31. package/src/components/product/Function/functions/AddContract.vue +161 -139
  32. package/src/components/product/Function/functions/BuyerMessage.vue +285 -137
  33. package/src/components/product/Function/functions/InstallFee.vue +1117 -912
  34. package/src/components/product/MaterialBatchList.vue +109 -0
  35. package/src/components/product/MaterialBatchManage.vue +34 -0
  36. package/src/components/product/Procedures/ProceduresDataGrid.vue +1022 -0
  37. package/src/components/product/Process/ExplorationSelect.vue +213 -73
  38. package/src/components/product/Process/ExplorationUser.vue +94 -39
  39. package/src/components/product/Process/MaterialUseList.vue +159 -0
  40. package/src/components/product/Process/ModifyUserFiles.vue +15 -5
  41. package/src/components/product/Process/ProcessInfo/history_control.vue +35 -6
  42. package/src/components/product/Process/Processes/ApplyUpload.vue +287 -0
  43. package/src/components/product/Process/Processes/CustomerCostPlan.vue +214 -0
  44. package/src/components/product/Process/Processes/CustomerMaterialMessage.vue +499 -210
  45. package/src/components/product/Process/Processes/CustomerRecordMessage.vue +949 -753
  46. package/src/components/product/Process/Processes/ProjectSettlement.vue +535 -24
  47. package/src/components/product/Process/Processes/ReceiveBatch.vue +301 -121
  48. package/src/components/product/Process/Processes/Service/ApplyChangeHistory.vue +105 -0
  49. package/src/components/product/Process/Processes/Service/ApplyChargeSearch.vue +27 -14
  50. package/src/components/product/Process/Processes/Service/ServiceControl.vue +2561 -1104
  51. package/src/components/product/Process/Processes/Upload.vue +532 -0
  52. package/src/components/product/Process/ShowBackReason.vue +1 -1
  53. package/src/components/product/ServiceView.vue +825 -583
  54. package/src/components/product/Statistics/ApplyStatisticsROOT.vue +27 -0
  55. package/src/components/product/Supervisory/Service/SupervisoryServiceControl.vue +212 -23
  56. package/src/components/product/Supervisory/SupervisoryControl.vue +79 -26
  57. package/src/components/product/Supervisory/SupervisoryList.vue +182 -41
  58. package/src/components/product/Supervisory/SupervisoryhCart.vue +4 -2
  59. package/src/components/product/VueUtils/Tree.vue +330 -0
  60. package/src/components/product/VueUtils/rightview/InstallCardList2.vue +29 -38
  61. package/src/stores/ApplyLoadParams.js +1 -1
  62. package/src/stores/PagedListLogic.js +173 -0
  63. package/.npmignore +0 -12
  64. package/yarn.lock +0 -9008
@@ -1,1104 +1,2561 @@
1
- <template>
2
- <show-back-reason v-if="selectdata.f_back_reason && selectdata.f_back_reason!=''"
3
- :data="show_data"></show-back-reason>
4
- <!--<gas-stop v-if="selectdata.defname == '停气碰口'"></gas-stop>-->
5
- <material-message v-if="selectdata.defname=='材料导入'||selectdata.defname=='材料审核'" v-ref:material
6
- :selectdata="selectdata"
7
- :edit="true"></material-message>
8
- <receive-batch v-if="selectdata.defname == '派工单'" :selectdata="selectdata"></receive-batch>
9
- <project-settlement v-if="selectdata.defname == '工程结算'" :selectdata="selectdata"></project-settlement>
10
- <installfee :infee="selectdata" :showfee='true' v-if="selectdata.defname == '通气条件确认'"></installfee>
11
- <service-view v-ref:service_show :data="show_data" v-if="showview" :is_show_datacheck="datacheck"></service-view>
12
-
13
- <modal :show.sync="showbuyerinfo" v-ref:modal backdrop="false">
14
- <header slot="modal-header" class="modal-header">
15
- <button type="button" class="close" @click="closebuyerinfo"><span>&times;</span></button>
16
- <h4 class="modal-title">打印电子发票,请请选择购货方信息</h4>
17
- </header>
18
- <article slot="modal-body" class="modal-body">
19
- <div v-if="showbuyerinfo">
20
- <div class="col-sm-12 span recordTable" style="margin-top: 10px;min-height: 350px">
21
- <partial-view v-ref:single-load>
22
- <data-grid :model="buyerinfo" v-ref:grid>
23
- <template partial='head'>
24
- <tr>
25
- <th>序号</th>
26
- <th>购货方名称</th>
27
- <th>购货方纳税人识别号</th>
28
- <th>购货方地址、电话</th>
29
- <th>购货方开户行及账号</th>
30
- <th>购货方电子邮箱</th>
31
- <th>操作</th>
32
- </tr>
33
- </template>
34
- <template partial='body'>
35
- <td style="text-align: center">{{$index+1}}</td>
36
- <td style="text-align: center">{{row.f_buyer_name}}</td>
37
- <td style="text-align: center">{{row.f_buyer_identify}}</td>
38
- <td style="text-align: center">{{row.f_buyer_addphone}}</td>
39
- <td style="text-align: center">{{row.f_buyer_bank}}</td>
40
- <td style="text-align: center">{{row.f_buyer_email}}</td>
41
- <td style="text-align: center" >
42
- <button type="button" class="btn btn-success" @click='$parent.$parent.$parent.$parent.confirmbuyerinfo(row)'>选择</button>
43
- </td>
44
- </template>
45
- </data-grid>
46
- </partial-view>
47
- </div>
48
- </div>
49
- </article>
50
- <footer slot="modal-footer" class="modal-footer">
51
- <button v-show="showbuyerinfo" type="button" class="btn btn-default" @click='closebuyerinfo'>取消</button>
52
- </footer>
53
- </modal>
54
-
55
- <!--打印报表html-->
56
- <div v-show="false">
57
- <div class="row" style="display: flex;justify-content: center;" id='bill-fee'>
58
- {{{bill}}}
59
- </div>
60
- <report-print id='bill-fee' top='15mm' left='5mm' width='90%' height='70%' :showbtn="false" preview="true" v-ref:reportprint></report-print>
61
- </div>
62
-
63
- </template>
64
- <script>
65
- import Vue from 'vue'
66
- import {HttpResetClass} from 'vue-client'
67
- import * as Util from '../../../../Util'
68
- // import AppData from 'stores/AppData'
69
- // Date格式化
70
- Date.prototype.Format = function (fmt) {
71
- var o = {
72
- "M+": this.getMonth() + 1, //月份
73
- "d+": this.getDate(), //日
74
- "H+": this.getHours(), //小时
75
- "m+": this.getMinutes(), //分
76
- "s+": this.getSeconds(), //秒
77
- "q+": Math.floor((this.getMonth() + 3) / 3), //季度
78
- "S": this.getMilliseconds() //毫秒
79
- };
80
- if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
81
- for (var k in o)
82
- if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
83
- return fmt;
84
- }
85
-
86
- export default {
87
- title: '报建流程业务控制层',
88
- props: ['selectdata'],
89
- data() {
90
- return {
91
- data: null, // 数据库数据,json配置文件数据的数据集合
92
- json_datas: null, // Json配置文件集合
93
- showview: false, // 控制显示service-view组件
94
- show_data: null, // 给view层显示的数据
95
- department_search: null, // 当前部门下所有人
96
- contract: null, // 单值表合同编号记录
97
- technologist:[], // 技术人员 角色下的人
98
- price:0,
99
- cost:0,
100
- number:0,
101
- pgd:'',
102
- showbuyerinfo: false, // 新增购货方信息模态框开关
103
- selectsellid: null, //需要打票收费id
104
- buyerinfo:{
105
- id:'',
106
- f_buyer_name: '',
107
- f_buyer_identify: '',
108
- f_buyer_addphone: '',
109
- f_buyer_bank: '',
110
- f_buyer_email: '',
111
- rows: [] // 购货方信息
112
- },
113
- bill: ''
114
- }
115
- },
116
- methods: {
117
- /*
118
- ============================================收费临时使用
119
- */
120
- async printbill (sellid) {
121
- let result = await this.$resetpost('rs/report/billReport',{data: {condition:`f_sell_id = ${sellid}`}}, {resolveMsg: null, rejectMsg: "提取数据出错,请重试!"})
122
- this.bill = result.data
123
- console.log('this.bill',this.bill)
124
- this.$nextTick(()=>{
125
- this.$refs.reportprint.print()
126
- })
127
- },
128
- confirmbuyerinfo (args) {
129
- let drawbilldata = {
130
- sellid : this.selectsellid,
131
- buyerid : args.id,
132
- operator: this.$login.f.name
133
- }
134
- this.closebuyerinfo()
135
- this.$resetpost('rs/logic/applyDrawBill', {data: drawbilldata}, {resolveMsg: null, rejectMsg: "开发票失败"})
136
- .then((res) => {
137
- if (res.data.status === 200){
138
- let n = 0
139
- var id = setInterval(async ()=>{
140
- if(n>=3){
141
- this.$showMessage('电子票延迟,请稍后查看!')
142
- clearInterval(id)
143
- }
144
- if (this.seeeticket(res.data) === 'success'){
145
- clearInterval(id)
146
- this.load()
147
- }
148
- n++
149
- this.$showAlert('电子发票开票中,请稍后...', 'info',3000)
150
- },3000)
151
- }else{
152
- this.$showAlert('电子发票开票失败,失败代码为:' + res.data.status , 'warning',3000)
153
- }
154
- })
155
- },
156
- // 金额转大写
157
- smalltoBIG(n) {
158
- let fraction = ['角', '分'];
159
- let digit = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖'];
160
- let unit = [['元', '万', '亿'], ['', '拾', '佰', '仟']];
161
- let head = n < 0 ? '欠' : '';
162
- n = Math.abs(n);
163
-
164
- let s = '';
165
-
166
- for (var i = 0; i < fraction.length; i++) {
167
- s += (digit[Math.floor(n * 10 * Math.pow(10, i)) % 10] + fraction[i]).replace(/零./, '');
168
- }
169
- s = s || '整';
170
- n = Math.floor(n);
171
-
172
- for (var i = 0; i < unit[0].length && n > 0; i++) {
173
- let p = '';
174
- for (var j = 0; j < unit[1].length && n > 0; j++) {
175
- p = digit[n % 10] + unit[1][j] + p;
176
- n = Math.floor(n / 10);
177
- }
178
- s = p.replace(/(零.)*零$/, '').replace(/^$/, '零') + unit[0][i] + s;
179
- }
180
- return head + s.replace(/(零.)*零元/, '元').replace(/(零.)+/g, '零').replace(/^整$/, '零元整')
181
- },
182
- // 关闭模态框
183
- closebuyerinfo() {
184
- this.showbuyerinfo = false
185
- this.selectsellid = null
186
- },
187
- //根据票据流水号查看票据
188
- async seeeticket(val) {
189
- console.log('该票据流水号为:',val.f_fpqqlsh)
190
- var eticketData = await this.$resetpost('rs/sql/querySingleTable', {data:{items: 'f_bill_url,f_url_code',tablename: 't_eticket', condition: `f_serial_number=${val.f_fpqqlsh}` }}, {resolveMsg: null, rejectMsg: null})
191
- console.log('eticketData:',eticketData)
192
- var data = eticketData.data[0]
193
- if(data.f_bill_url && data.f_bill_url != ''){
194
- console.log(data)
195
- var auth = data.f_bill_url.split("/")
196
- console.log("截取",auth)
197
- var authCode = auth[auth.length-1]
198
- var url = `https://${auth[2]}/ent-views/fpExtract/get_fapiao.html?pwd=${data.f_url_code}&authCode=${authCode}`
199
- this.$showAlert('开票成功!', 'success',500)
200
- window.open(url)
201
- return 'success'
202
- }
203
- return 'fail'
204
- },
205
- async loadbuyer(){
206
- //获取购货方信息
207
- let querybuyerdata = {
208
- tablename: 't_buyer_info',
209
- condition: `f_process_id = '${this.selectdata.f_process_id}' and f_apply_num = '${this.selectdata.f_apply_num}'`
210
- }
211
- let buyerinfos = await this.$resetpost('rs/sql/singleTable', {data: querybuyerdata}, {resolveMsg: null, rejectMsg: '获取购货方信息失败'})
212
- this.buyerinfo.rows = buyerinfos.data
213
- },
214
- /*
215
- ============================================收费临时使用结束
216
- */
217
- // 特殊化处理
218
- async special(model) {
219
- if (model.button.button_name === '提交' && model.button.button_event && model.button.button_event === '分支流程异步处理') {
220
- // 分支流程异步处理
221
- let http = new HttpResetClass();
222
- let res = await http.load('POST', 'rs/logic/branchsyncprocess', {
223
- data: {
224
- model: model,
225
- loginUser: this.$login.f
226
- }
227
- }, {resolveMsg: null, rejectMsg: '分支流程异步处理保存失败'})
228
- console.log("分支流程异步处理:", JSON.stringify(res.data))
229
- }
230
- if (this.data.distribute_async && model.button.button_name === '下发') {
231
- // 同流程节点异步处理
232
- let http = new HttpResetClass();
233
- let res = await http.load('POST', 'rs/logic/syncprocess', {
234
- data: {
235
- model: model,
236
- loginUser: this.$login.f
237
- }
238
- }, {resolveMsg: null, rejectMsg: '流程异步下发据保存失败'})
239
- console.log("流程的异步处理:", JSON.stringify(res.data))
240
- }
241
- if (this.data.distribute_async && model.button.button_name === '完成') {
242
- // 强制结束
243
- let http = new HttpResetClass();
244
- let res = await http.load('POST', 'rs/logic/stoprocess', {
245
- data: {
246
- model: model,
247
- loginUser: this.$login.f
248
- }
249
- }, {resolveMsg: null, rejectMsg: '流程异步完成数据保存失败'})
250
- console.log("流程的异步处理:", JSON.stringify(res.data))
251
- }
252
- },
253
- // 组件初始化操作
254
- refurbish(val) {
255
- this.selectdata = val
256
- this.json_datas = this.$workflow_vue
257
- let sum = 0
258
- let jsonData = {}
259
- for (let i = 0; i < this.json_datas.activitys.length; i++) {
260
- if (this.selectdata.defname == this.json_datas.activitys[i].title) {
261
- jsonData = this.json_datas.activitys[i]
262
- sum++
263
- }
264
- }
265
- for (let j = 0; j < jsonData.fields.length; j++) {
266
- jsonData.fields[j].value = ''
267
- if (jsonData.fields[j].default) {
268
- jsonData.fields[j].value = jsonData.fields[j].default
269
- }
270
- }
271
- if (sum == 1) {
272
- this.data = null
273
- this.data = jsonData
274
- this.initializtion()
275
- } else if (sum == 0) {
276
- this.$showMessage(`没有在JSON配置文件中找到活动名为:(${this.selectdata.defname})的节点配置`)
277
- } else {
278
- this.$showMessage(`在JSON配置文件中找到活动名为:(${this.selectdata.defname})的节点配置:${sum}个`)
279
- }
280
- },
281
- // json配置数据处理 比如下拉框的options
282
- async initializtion() {
283
- this.showview = false
284
- // 下发人 options 处理,options初始化
285
- if (this.selectdata.actorexpression) {
286
- let http = new HttpResetClass()
287
- let res = await http.load('POST', 'rs/search', this.selectdata.actorexpression, {
288
- resolveMsg: null,
289
- rejectMsg: 'search查询部门下所有人失败'
290
- })
291
- console.log("search查询部门下所有人:", JSON.stringify(res.data))
292
- let jsonString = JSON.stringify(res.data)
293
- let jsonArray = []
294
- if (jsonString.startsWith("{")) {
295
- jsonArray.push(res.data)
296
- res.data = jsonArray
297
- }
298
- this.department_search = res.data
299
- }
300
-
301
- // selectdata 填充 data
302
- this.data = Object.assign({}, this.data, this.selectdata)
303
- // onetomany 数据获取
304
- if (this.data.onetomany) {
305
- console.log('判断是onetomany,this.data.onetomany的数据为=>' + JSON.stringify(this.data.onetomany))
306
- for (let index = 0; index < this.data.onetomany.length; index++) {
307
- let http = new HttpResetClass()
308
- let data ={}
309
- if(this.data.onetomany[index].tables[0]=='t_charge_record'){
310
- data = {
311
- tablename: this.data.onetomany[index].tables[0],
312
- condition: `f_apply_num = '${this.selectdata.f_apply_num}' and f_process_id='${this.selectdata.f_process_id}' and f_charging_status != '作废'`
313
- }
314
- }else {
315
- data = {
316
- tablename: this.data.onetomany[index].tables[0],
317
- condition: `f_apply_num = '${this.selectdata.f_apply_num}' and f_process_id='${this.selectdata.f_process_id}'`
318
- }
319
- }
320
- let res = await http.load('POST', 'rs/sql/singleTable', {data: data}, {
321
- resolveMsg: null,
322
- rejectMsg: 'onetomany查询失败'
323
- })
324
- // 初始化 onetomany
325
- let rows = []
326
- console.log('查询返回结果res.data=>' + JSON.stringify(res.data))
327
- this.data.onetomany[index].rows = res.data
328
- console.log(JSON.stringify('this.data.onetomany[index].rows=>' + JSON.stringify(this.data.onetomany[index].rows)))
329
-
330
- // 初始化onetomany中的fields
331
- for(let j =0;j<this.data.onetomany[index].fields.length;j++){
332
- // 如果配置类型为select,优先从参数列表获取options
333
- if (this.data.onetomany[index].fields[j].type === 'select') {
334
- let temp = Vue.$appdata.getParam(this.data.onetomany[index].fields[j].label)
335
- if (temp && temp.length > 0) {
336
- this.data.onetomany[index].fields[j].options = Vue.$appdata.getParam(this.data.onetomany[index].fields[j].label)
337
- }
338
- }
339
- }
340
-
341
- }
342
- }
343
-
344
-
345
- // 初始化 fields
346
- for (let i = 0; i < this.data.fields.length; i++) {
347
- // 如果selectdata有这些key,则把selectdata的value赋值给data的value
348
- if (this.selectdata[this.data.fields[i].field]) {
349
- this.data.fields[i].value = this.selectdata[this.data.fields[i].field]
350
- }
351
- // 如果配置类型为select,优先从参数列表获取options
352
- if (this.data.fields[i].type === 'select') {
353
- let temp = Vue.$appdata.getParam(this.data.fields[i].label)
354
- if (temp && temp.length > 0) {
355
- this.data.fields[i].options = Vue.$appdata.getParam(this.data.fields[i].label)
356
- }
357
- }
358
- if (this.data.defname === '工程结算') {
359
- var a = 0
360
- var b = 0
361
- var c = 0
362
- for (let i = 0; i < this.data.fields.length; i++) {
363
- if (this.data.fields[i].label === '最终核算成本金额') {
364
- this.data.fields[i].value = (this.cost +this.number)
365
- a = this.data.fields[i].value
366
- }
367
- if (this.data.fields[i].label === '合同总金额') {
368
- b = this.data.fields[i].value
369
- }if (this.data.fields[i].label === '材料成本金额') {
370
- this.data.fields[i].value = this.number
371
- }if (this.data.fields[i].label === '其他成本金额') {
372
- this.data.fields[i].value = this.cost
373
- }
374
- }
375
- c=b-a
376
- for (let i = 0; i < this.data.fields.length; i++) {
377
- if (this.data.fields[i].label === '工程盈利') {
378
- this.data.fields[i].value = c
379
- }
380
- }
381
- }
382
- if (this.data.defname === '派工单') {
383
-
384
- for (let i = 0; i < this.data.fields.length; i++) {
385
- if (this.data.fields[i].label === '派工单号') {
386
- this.data.fields[i].value = this.pgd
387
-
388
- }
389
-
390
- }
391
-
392
- }
393
- // 特殊处理
394
- //施工环节 如果是个人报建需要提交表具信息
395
- if (this.data.defname === '施工') {
396
- for (let i = 0; i < this.data.fields.length; i++) {
397
- if (this.data.fields[i].label === '气表品牌'
398
- || this.data.fields[i].label === '气表型号'
399
- || this.data.fields[i].label === '气表厂家') {
400
- if (this.data.f_apply_type === '个人报建') {
401
- this.data.fields[i].hidden = false
402
- this.data.fields[i].required = true
403
- }
404
- }
405
- }
406
- }
407
- //通气环节可以调出施工环节的表信息来修改
408
- if (this.data.defname === '通气') {
409
- for (let i = 0; i < this.data.fields.length; i++) {
410
- if (this.data.fields[i].label === '气表品牌'
411
- || this.data.fields[i].label === '气表型号'
412
- || this.data.fields[i].label === '气表厂家') {
413
- if (this.data.fields[i].value != null && this.data.fields[i].value != '') {
414
- this.data.fields[i].hidden = false
415
- this.data.fields[i].required = true
416
- }
417
- }
418
- }
419
- }
420
- if(this.data.fields[i].label === '技术人员'){ //{"source":"this.getParentByType($organization$).getChildByName($技术人员$).getChildren()","userid":"296851"}
421
- let http = new HttpResetClass()
422
- let res = await http.load('POST', 'rs/search', `{"source":"this.getParentByType($organization$).getChildByName($技术人员$).getChildren()","userid":"${this.$login.f.id}"}`, {
423
- resolveMsg: null,
424
- rejectMsg: 'search查询部门下所有人失败'
425
- })
426
- console.log("search查询部门下所有人:", JSON.stringify(res.data))
427
- this.technologist = res.data
428
- if (this.technologist) {
429
- let array = []
430
- for (let k = 0; k < this.technologist.length; k++) {
431
- array.push({label: this.technologist[k].name, value: this.technologist[k].name})
432
- }
433
- this.data.fields[i].options = array
434
- }
435
- }
436
- if (this.data.fields[i].label == '县/区') {
437
- console.log('小区获取区县。。。。。' + JSON.stringify(this.$login.f.f_allArea))
438
- let rs = []
439
- for (let i = 0; i < this.$login.f.f_allArea.length; i++) {
440
- let temp = {
441
- label: this.$login.f.f_allArea[i].label,
442
- value: this.$login.f.f_allArea[i].label
443
- }
444
- rs.push(temp)
445
- }
446
- this.data.fields[i].options = [{label: '全部', value: ''}, ...rs]
447
- }
448
-
449
- if (this.data.fields[i].label == '合同类型') {
450
- this.data.fields[i].value == '主合同'
451
- }
452
-
453
- if (this.data.fields[i].label == '合同编号' && !this.selectdata[this.data.fields[i].field]) {
454
- if (!this.$appdata.getSingleValue(this.data.fields[i].label)) {
455
- this.$showMessage(`请先去参数管理设置: ${this.data.fields[i].label}`)
456
- } else {
457
- this.$appdata.load()
458
- let temp = this.$appdata.getSingleValue(this.data.fields[i].label)
459
- this.contract = temp
460
- while (temp.length < 4) {
461
- temp = '0' + temp
462
- }
463
- let dt = new Date()
464
- this.data.fields[i].value = dt.getFullYear() + ((dt.getMonth() + 1) < 10 ? '0' + (dt.getMonth() + 1) : dt.getMonth()) + temp
465
- }
466
- }
467
- }
468
- // 初始化 buttons_fields
469
- for (let i = 0; i < this.data.buttons.length; i++) {
470
- if (this.data.buttons[i].button_fields) {
471
- for (let j = 0; j < this.data.buttons[i].button_fields.length; j++) {
472
- // 如果selectdata有这些key,则把selectdata的value赋值给data的value
473
- if (this.selectdata[this.data.buttons[i].button_fields[j].field]) {
474
- this.data.buttons[i].button_fields[j].value = this.selectdata[this.data.buttons[i].button_fields[j].field]
475
- }
476
- // 如果配置类型为select,优先从参数列表获取options
477
- if (this.data.buttons[i].button_fields[j].type === 'select' && this.$appdata.getParam(this.data.buttons[i].button_fields[j].label)) {
478
- this.data.buttons[i].button_fields[j].options = this.$appdata.getParam(this.data.buttons[i].button_fields[j].label).trim()
479
- }
480
- // 下发特殊配置
481
- if (this.data.buttons[i].button_name === '下发') {
482
- if (this.data.buttons[i].button_fields.length === 1) {
483
- // value初始化
484
- // if(this.department_search){
485
- if (this.selectdata[this.data.buttons[i].button_fields[0].field]) {
486
- for (let k = 0; k < this.department_search.length; k++) {
487
- // 将id转换为name
488
- if (Number(this.department_search[k].id) === Number(this.selectdata[this.data.buttons[i].button_fields[0].field])) {
489
- this.data.buttons[i].button_fields[0].value = this.department_search[k].name
490
- }
491
- }
492
- }
493
-
494
- if (this.department_search) {
495
- let array = []
496
- for (let k = 0; k < this.department_search.length; k++) {
497
- array.push({label: this.department_search[k].name, value: this.department_search[k].name})
498
- }
499
- this.data.buttons[i].button_fields[0].options = array
500
- }
501
- } else {
502
- this.$showMessage("下发按钮必须满足 当且仅当一个字段")
503
- }
504
- }
505
- }
506
- }
507
-
508
- }
509
- // 消除双向绑定,避免子组件(显示层)数据更改,父组件(控制层)也更改
510
- let temp = JSON.parse(JSON.stringify(this.data))
511
- // 退回原因展示
512
- if (this.selectdata.f_back_reason) {
513
- temp['back_reason'] = this.selectdata.f_back_reason
514
- }
515
- this.show_data = temp
516
- this.showview = true
517
- }
518
- },
519
- events: {
520
- 'get-cost' (val) {
521
- this.cost = val
522
-
523
- this.initializtion()
524
- },
525
- 'get-number' (val) {
526
- this.number = val
527
-
528
- this.initializtion()
529
- },
530
- 'get-pgd' (val) {
531
- this.pgd = val
532
- this.initializtion()
533
- },
534
- // 任意select选中时触发事件,关联性操作
535
- async 'select_cascade'(index) {
536
- // this.$refs.service_show.data // 子业务显示组件
537
- // 级联操作示例:
538
- /*
539
- if(this.$refs.service_show.data.fields[index].label==='报建类型'){
540
- for(let i=0;i<this.$refs.service_show.data.fields.length;i++){
541
- // 控制设置级联
542
- // 源select所选的值 this.$refs.service_show.data.fields[index].value
543
- if(this.$refs.service_show.data.fields[i].label==='级联测试2'){
544
- this.$refs.service_show.data.fields[i].options=[
545
- {label:'级联选项1',value:'级联选项1'},{label:'级联选项2',value:'级联选项2'},{label:'级联选项3',value:'级联选项3'}
546
- ]
547
- }
548
- }
549
- }
550
- */
551
-
552
- if (
553
- this.$refs.service_show.data.fields[index].label === '最终核算成本金额' ||
554
- this.$refs.service_show.data.fields[index].label === '合同总金额' ||
555
- this.$refs.service_show.data.fields[index].label === '工程盈利'
556
- ) {
557
-
558
- var a=0
559
- var b=0
560
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
561
- // 控制设置级联
562
- // 源select所选的值 this.$refs.service_show.data.activitys.fields[index].value
563
- // xxx xx xxx
564
- if (this.$refs.service_show.data.fields[i].label === '最终核算成本金额' ) {
565
- this.$refs.service_show.data.fields[i].value = (this.number+this.cost)
566
- a=this.$refs.service_show.data.fields[i].value
567
- }
568
-
569
- if (this.$refs.service_show.data.fields[i].label === '合同总金额' && this.$refs.service_show.data.fields[i].value) {
570
- b = this.$refs.service_show.data.fields[i].value
571
- }
572
- }
573
- var c =b - a
574
- // 数据计算完毕得到工程结余
575
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
576
- if (this.$refs.service_show.data.fields[i].label === '工程盈利') {
577
- this.$refs.service_show.data.fields[i].value = c
578
- }
579
- }
580
- }
581
-
582
- if (this.$refs.service_show.showadd_fields && this.$refs.service_show.showadd_fields.length > 0 && this.$refs.service_show.showadd_fields[index].label === '收费金额') {
583
- let chargeMoney = this.$refs.service_show.showadd_fields[index].value
584
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
585
- if (this.$refs.service_show.data.fields[i].label === '未结总金额') {
586
- let cumulativeMoney = this.$refs.service_show.data.fields[i].value
587
- if (Number(chargeMoney) > Number(cumulativeMoney)) {
588
- this.$showMessage("收费金额不得大于未结总金额!")
589
- this.$refs.service_show.showadd_fields[index].value = null
590
- return
591
- } else {
592
-
593
- }
594
- }
595
- }
596
- }
597
-
598
- //根据合同预算金额和累计缴费金额计算未结金额
599
- if (this.$refs.service_show.data.fields[index]&&this.$refs.service_show.data.fields[index].label === '累计缴费金额') {
600
- let cumulativeMoney = this.$refs.service_show.data.fields[index].value
601
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
602
- if (this.$refs.service_show.data.fields[i].label === '未结总金额') {
603
- this.$refs.service_show.data.fields[i].value = Number(this.selectdata.f_contract_total_money) - Number(cumulativeMoney)
604
- }
605
- }
606
- }
607
- //根据合同预算金额和累计开票金额计算未开票金额
608
- if (this.$refs.service_show.data.fields[index].label === '累计开票金额') {
609
- let residualInvoicing = this.$refs.service_show.data.fields[index].value
610
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
611
- if (this.$refs.service_show.data.fields[i].label === '未开票金额') {
612
- this.$refs.service_show.data.fields[i].value = Number(this.selectdata.f_contract_total_money) - Number(residualInvoicing)
613
- }
614
- }
615
- }
616
- //如果资料验收是否通过和工程验收是否通过为否的时候弹出原因填写框
617
- if (this.$refs.service_show.data.fields[index].label === '资料验收是否通过') {
618
- let res = this.$refs.service_show.data.fields[index].value
619
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
620
- if (this.$refs.service_show.data.fields[i].label === '资料验收不通过原因') {
621
- if (res === '否') {
622
- this.$refs.service_show.data.fields[i].hidden = false
623
- this.$refs.service_show.data.fields[i].required = true
624
- } else {
625
- this.$refs.service_show.data.fields[i].hidden = true
626
- this.$refs.service_show.data.fields[i].required = false
627
- }
628
- }
629
- }
630
- }
631
- if (this.$refs.service_show.data.fields[index].label === '工程验收是否通过') {
632
- let res = this.$refs.service_show.data.fields[index].value
633
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
634
- if (this.$refs.service_show.data.fields[i].label === '工程验收不通过原因') {
635
- if (res === '否') {
636
- this.$refs.service_show.data.fields[i].hidden = false
637
- this.$refs.service_show.data.fields[i].required = true
638
- } else {
639
- this.$refs.service_show.data.fields[i].hidden = true
640
- this.$refs.service_show.data.fields[i].required = false
641
- }
642
- }
643
- }
644
- }
645
- //根据总户数和实际安装户数计算未安装户数
646
- if (this.$refs.service_show.data.fields[index].label === '实际安装户数') {
647
- let value = this.$refs.service_show.data.fields[index].value
648
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
649
- if (this.$refs.service_show.data.fields[i].label === '未安装户数') {
650
- this.$refs.service_show.data.fields[i].label === '未安装户数'
651
- this.$refs.service_show.data.fields[i].value = Number(this.selectdata.f_install_num) - Number(value)
652
- }
653
- }
654
- }
655
-
656
- //金额小写得到大写
657
- if (this.$refs.service_show.showadd_fields && this.$refs.service_show.showadd_fields.fields.length > 0 && this.$refs.service_show.showadd_fields.fields[index].label === '收费金额') {
658
- if(this.$refs.service_show.showadd_fields[index].value||this.$refs.service_show.showadd_fields.fields[index].value){
659
- var re = /^[0-9]+.?[0-9]*/
660
- let temp = this.$refs.service_show.showadd_fields[index].value
661
- if(temp==""|| isNaN(temp)){
662
- this.$showMessage("请输入纯数字")
663
- this.$refs.service_show.showadd_fields[index].value=0
664
- }
665
- }
666
- let temp = this.$refs.service_show.showadd_fields[index]
667
- let value = temp.value
668
- // let chargeMoney = this.$refs.service_show.showadd_fields[index].value
669
- for (let i = 0; i < this.$refs.service_show.showadd_fields.fields.length; i++) {
670
- if (this.$refs.service_show.showadd_fields.fields[i].label === '金额大写') {
671
- let te = {
672
- value:this.smalltoBIG(value)
673
- }
674
- this.$refs.service_show.showadd_fields[i] = te
675
- }
676
- }
677
- }
678
-
679
-
680
- if (this.$refs.service_show.data.fields[index].label === '县/区') {
681
- let temp = this.$refs.service_show.data.fields[index].value
682
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
683
- // 控制设置级联
684
- // 源select所选的值 this.$refs.service_show.data.activitys.fields[index].value
685
- if (this.$refs.service_show.data.fields[i].label === '片区') {
686
- this.$refs.service_show.data.fields[i].value = ''
687
- this.$refs.service_show.data.fields[i].options = []
688
- let rs = []
689
- console.log('小区片区。。。', temp)
690
- for (let j = 0; j < this.$login.f.f_allArea.length; j++) {
691
- if (this.$login.f.f_allArea[j].label === temp) {
692
- rs = this.$login.f.f_allArea[j].value
693
- }
694
- }
695
- console.log('获取小区片区=>' + JSON.stringify(rs))
696
- this.$refs.service_show.data.fields[i].options = [{label: '全部', value: ''}, ...rs]
697
- this.$refs.service_show.update()
698
- }
699
- }
700
- }
701
- //控制尾款
702
- if (
703
- this.$refs.service_show.data.fields[index].label === '合同金额' ||
704
- this.$refs.service_show.data.fields[index].label === '首付' ||
705
- this.$refs.service_show.data.fields[index].label === '进度款' ||
706
- this.$refs.service_show.data.fields[index].label === '尾款'
707
- ) {
708
- console.log('即将计算合同金额')
709
- var cash = 0
710
- var downpayments=0
711
- var tailmoney=0
712
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
713
- // 控制设置级联
714
- // 源select所选的值 this.$refs.service_show.data.activitys.fields[index].value
715
- // xxx xx xxx
716
- if (this.$refs.service_show.data.fields[i].label === '合同金额' && this.$refs.service_show.data.fields[i].value) {
717
- cash = this.$refs.service_show.data.fields[i].value
718
- }
719
- if (this.$refs.service_show.data.fields[i].label === '首付' && this.$refs.service_show.data.fields[i].value) {
720
- downpayments = this.$refs.service_show.data.fields[i].value
721
- }
722
- if (this.$refs.service_show.data.fields[i].label === '进度款' && this.$refs.service_show.data.fields[i].value) {
723
- tailmoney = this.$refs.service_show.data.fields[i].value
724
- }
725
- }
726
- var a =cash - downpayments
727
- // 数据计算完毕得到尾款
728
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
729
- if (this.$refs.service_show.data.fields[i].label === '尾款') {
730
- if (cash === downpayments ){
731
- this.$refs.service_show.data.fields[i].value = 0
732
- } else{
733
- this.$refs.service_show.data.fields[i].value = (cash - downpayments - tailmoney)
734
- console.log('修改fields[i].value后的值=>' + this.$refs.service_show.data.fields[i].value)
735
- }
736
- }
737
- if (this.$refs.service_show.data.fields[i].label === '首付') {
738
- if (a<0){
739
- this.$showMessage("首付款数额过大")
740
- downpayments = 0
741
- this.$refs.service_show.data.fields[i].value = 0
742
- }
743
- }
744
-
745
- if (this.$refs.service_show.data.fields[i].label === '进度款') {
746
-
747
- if (cash === downpayments ){
748
- tailmoney = 0
749
- this.$refs.service_show.data.fields[i].value = 0
750
- this.$refs.service_show.data.fields[i].readonly=true
751
- }else {
752
- this.$refs.service_show.data.fields[i].readonly=false
753
- tailmoney = this.$refs.service_show.data.fields[i].value
754
- }
755
- if (tailmoney>a){
756
- this.$showMessage("进度款数额过大")
757
- tailmoney = 0
758
- this.$refs.service_show.data.fields[i].value = 0
759
- }
760
- }
761
- }
762
- }
763
-
764
-
765
-
766
- // 合成地址
767
- if (
768
- this.$refs.service_show.data.fields[index].label === '小区名称/单位名称' ||
769
- this.$refs.service_show.data.fields[index].label === '楼号' ||
770
- this.$refs.service_show.data.fields[index].label === '单元号' ||
771
- this.$refs.service_show.data.fields[index].label === '楼层' ||
772
- this.$refs.service_show.data.fields[index].label === '门牌号'
773
- ) {
774
- console.log('即将合成地址')
775
- var address = ''
776
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
777
- // 控制设置级联
778
- // 源select所选的值 this.$refs.service_show.data.activitys.fields[index].value
779
- // xxx xx xxx
780
- if (this.$refs.service_show.data.fields[i].label === '小区名称/单位名称' && this.$refs.service_show.data.fields[i].value) {
781
- address += this.$refs.service_show.data.fields[i].value
782
- }
783
- if (this.$refs.service_show.data.fields[i].label === '楼号' && this.$refs.service_show.data.fields[i].value) {
784
- address += ' ' + this.$refs.service_show.data.fields[i].value
785
- }
786
- if (this.$refs.service_show.data.fields[i].label === '单元号' && this.$refs.service_show.data.fields[i].value) {
787
- address += '-' + this.$refs.service_show.data.fields[i].value
788
- }
789
- if (this.$refs.service_show.data.fields[i].label === '楼层' && this.$refs.service_show.data.fields[i].value) {
790
- address += '-' + this.$refs.service_show.data.fields[i].value
791
- }
792
- if (this.$refs.service_show.data.fields[i].label === '门牌号' && this.$refs.service_show.data.fields[i].value) {
793
- address += '-' + this.$refs.service_show.data.fields[i].value
794
- }
795
-
796
- }
797
- console.log('获取到的address=>' + address)
798
- // 数据获取完毕时放入地址text
799
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
800
- if (this.$refs.service_show.data.fields[i].label === '地址') {
801
- this.$refs.service_show.data.fields[i].value = address
802
- console.log('修改fields[i].value后的值=>' + this.$refs.service_show.data.fields[i].value)
803
- }
804
- }
805
- }
806
- // 开户费+材料费+人工费+设备安装费=合计
807
- if (this.$refs.service_show.data.fields[index].label === '开户费' ||
808
- this.$refs.service_show.data.fields[index].label === '材料费' ||
809
- this.$refs.service_show.data.fields[index].label === '人工费' ||
810
- this.$refs.service_show.data.fields[index].label === '设备安装费') {
811
- let fee = 0
812
- for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
813
- if (this.$refs.service_show.data.fields[index].label === '开户费' ||
814
- this.$refs.service_show.data.fields[index].label === '材料费' ||
815
- this.$refs.service_show.data.fields[index].label === '人工费' ||
816
- this.$refs.service_show.data.fields[index].label === '设备安装费') {
817
- fee += Number(this.$refs.service_show.data.fields[index].value)
818
- }
819
- if (this.$refs.service_show.data.fields[index].label === '合计') {
820
- this.$refs.service_show.data.fields[index].value = fee
821
- }
822
- }
823
-
824
- }
825
- },
826
- async 'onetomanyevent'(datas) {
827
- console.log(`onetomany=======>${JSON.stringify(datas)}`)
828
-
829
- for (let i = 0; i < datas.rows.length; i++) {
830
- datas.rows[i]['f_process_id'] = this.selectdata.f_process_id
831
- datas.rows[i]['f_apply_num'] = this.selectdata.f_apply_num
832
- datas.rows[i]['f_filiale'] = this.$login.f.f_fengongsi
833
- datas.rows[i]['f_parentname'] = this.$login.f.f_parentname
834
- datas.rows[i]['f_operator'] = this.$login.f.name
835
- }
836
- let http = new HttpResetClass()
837
- await http.load('POST', 'rs/logic/saveentity', datas, {resolveMsg: null, rejectMsg: 'search查询部门下所有人失败'})
838
- },
839
- // 获取view层button事件/
840
- async 'button'(model) {
841
- console.log("button事件接收参数:", model)
842
- // 点击重置按钮就重置数据
843
- if (model.button.button_name === '重置') {
844
- this.refurbish()
845
- return
846
- }
847
- var operate = ''
848
- // 判断当前按钮是否为特殊业务,即子流程提交或者分发
849
- if (model.button.button_name === '提交' && model.button.button_event && model.button.button_event === '子流程提交') {
850
- operate = '子流程提交'
851
- }
852
- if (model.button.button_name === '提交' && model.button.button_event && model.button.button_event === '合同信息') {
853
- model.f_budget_money = model.f_contract_money
854
- model.f_unaccounts_money = model.f_contract_money
855
- model.f_cumulative_money = 0
856
- model.f_cumulative_invoicing = 0
857
- model.f_additional_payment = 0
858
- model.f_residual_invoicing = model.f_contract_money
859
- }
860
- if (model.button.button_name === '下发') {
861
- if (model.button && model.button.button_event === '分发') {
862
- operate = '分发'
863
- }
864
- let person_name = model.button.button_fields[this.show_data.buttons[model.button.button_index].button_fields[0].field]
865
- for (let i = 0; i < this.department_search.length; i++) {
866
- // 找到人名为person_name 的人,然后把人名换成id
867
- if (this.department_search[i].name === person_name) {
868
- model.button.button_fields[this.show_data.buttons[model.button.button_index].button_fields[0].field] = this.department_search[i].id
869
- }
870
- }
871
- }
872
- if (model.button.button_name === '提交') {
873
- // ===================>青白江特殊流程开始,合并分支时请忽略这段代码 开始
874
- let http = new HttpResetClass()
875
- if (this.$refs.service_show.data.defname === '综合验收确认') {
876
- // http = new HttpResetClass()
877
- // let data = {
878
- // tablename: 't_files',
879
- // condition: `fusetype = '综合验收签字单' and f_blobid='${this.selectdata.f_process_id}'`
880
- // }
881
- // let res = await http.load('POST', 'rs/sql/singleTable', {data: data}, {
882
- // resolveMsg: null,
883
- // rejectMsg: "获取附件内容失败"
884
- // })
885
- // if (res.data.length <= 0) {
886
- // this.$showMessage("请先上传综合验收签字单!")
887
- // return
888
- // } else {
889
-
890
- // }
891
- }
892
- // 判断分流程
893
- if(this.$refs.service_show.data.defname === this.$workflow_vue.start_activity){
894
- let flag = ''
895
- let str = this.$appdata.getSingleValue("客户服务部")
896
- let str2 = this.$appdata.getSingleValue("工程技术部")
897
- let arr = str.split(",")
898
- let arr2 = str2.split(",")
899
- for(let i=0;i<arr.length;i++){
900
- if(arr[i] == model.f_apply_type){
901
- flag = '客户服务部'
902
- break
903
- }
904
- }
905
- for(let i=0;i<arr2.length;i++){
906
- if(arr2[i]== model.f_apply_type){
907
- flag = '工程技术部'
908
- break
909
- }
910
- }
911
- model.button.button_name = flag
912
- }
913
-
914
- // ===================>青白江特殊流程开始,合并分支时请忽略这段代码 结束
915
- // flag 为合同编号更新标志
916
- var flag = false
917
- if (model.f_contract_number) {
918
- flag = true
919
- http = new HttpResetClass()
920
- let data = {
921
- tablename: 't_singlevalue',
922
- condition: `name = '合同编号' and f_filialeids = '${this.$login.f.f_orgids}'`
923
- }
924
- let res = await http.load('POST', 'rs/sql/singleTable', {data: data}, {
925
- resolveMsg: null,
926
- rejectMsg: "获取合同编号失败"
927
- })
928
- // if (this.contract != res.data[0].value && !this.selectdata.f_contract_number) {
929
- // this.$showMessage("合同编号已经被使用,请按F5刷新页面后重新登记")
930
- // return
931
- // }
932
- }
933
-
934
- }
935
- // ===================>青白江特殊流程开始,合并分支时请忽略这段代码 开始
936
- if(model.button.button_name=='退回'&&(this.$refs.service_show.data.defname == '勘察初设'||this.$refs.service_show.data.defname == '任务分配')){
937
- let flag = ''
938
- let str = this.$appdata.getSingleValue("客户服务部")
939
- let str2 = this.$appdata.getSingleValue("工程技术部")
940
- let arr = str.split(",")
941
- let arr2 = str2.split(",")
942
- for(let i=0;i<arr.length;i++){
943
- if(arr[i] == model.f_apply_type){
944
- flag = '客户服务部'
945
- break
946
- }
947
- }
948
- for(let i=0;i<arr2.length;i++){
949
- if(arr2[i]== model.f_apply_type){
950
- flag = '工程技术部'
951
- break
952
- }
953
- }
954
- model.button.button_name = flag
955
- }
956
- // ===================>青白江特殊流程开始,合并分支时请忽略这段代码 结束
957
- console.log('本次点击button执行的操作是=>' + operate)
958
- model = Object.assign({}, this.selectdata, model)
959
- let http = new HttpResetClass()
960
- var url
961
- var requestData = {
962
- tables: this.data.tables,
963
- start_activity: this.$workflow_vue.start_activity,
964
- model: model,
965
- loginUser: this.$login.f
966
- }
967
- if (operate != '') {
968
- // 特殊操作走特殊logic业务处理
969
- url = 'rs/logic/SubprocessService'
970
- requestData = {
971
- tables: this.data.tables, model: model
972
- }
973
- } else if(model.button.button_name === '提交' && model.button.button_event && model.button.button_event === '分支流程异步合并处理'){
974
- url = 'rs/logic/branchsyncprocess'
975
- requestData = {
976
- tables: this.data.tables, model: model
977
- }
978
- } else{
979
- // 下发,提交,保存,退回通用业务后台处理logic
980
- url = 'rs/logic/ApplyProductService'
981
- requestData = {
982
- tables: this.data.tables, model: model
983
- }
984
- }
985
- requestData.start_activity = this.$workflow_vue.start_activity
986
- requestData.loginUser = this.$login.f
987
- requestData.workflow_xmlfilename = this.$workflow_vue.workflow_xmlfilename
988
- console.log('即将发送请求url=>' + url + ',参数=>' + JSON.stringify(requestData))
989
- let res = res = await http.load('POST', url, {data: requestData}, {resolveMsg: null, rejectMsg: '数据保存失败'})
990
- console.log("service处理完成返回数据:", JSON.stringify(res.data))
991
- if (res.data.code == 200) {
992
- // flag 为合同编号更新标志
993
- if (flag) {
994
- let http = new HttpResetClass()
995
- let data = {
996
- tablename: 't_singlevalue',
997
- condition: `name = '合同编号' and f_filialeids = '${this.$login.f.f_orgids}'`,
998
- value: (Number(this.contract) + 1) + ''
999
- }
1000
- await http.load('POST', 'rs/logic/updatesinglevalue', {data: data}, {
1001
- resolveMsg: null,
1002
- rejectMsg: "获取合同编号更新失败"
1003
- })
1004
- }
1005
- this.showview = false
1006
- // 特殊处理
1007
- this.special(model)
1008
- this.$dispatch('close')
1009
- this.initializtion()
1010
- } else {
1011
- if (res.data.msg) {
1012
- this.$showMessage(res.data.msg)
1013
- }
1014
- }
1015
- },
1016
- async 'onetomanydelete'(i, j) {
1017
- let http = new HttpResetClass()
1018
- let data = {
1019
- tables: this.show_data.onetomany[i].tables,
1020
- row: this.$refs.service_show.model.rows[i][j]
1021
- }
1022
- await http.load('POST', 'rs/logic/applyDeleteValue', {data: data}, {
1023
- resolveMsg: null,
1024
- rejectMsg: 'onetomanydelete失败'
1025
- }).then(() => {
1026
- this.$dispatch('selfsearch')
1027
- this.$refs.service_show.model.rows[i].splice(j, 1)
1028
- })
1029
- },
1030
- //获取view层confirm事件
1031
- async 'confirm'(tables, row,showadd_index,j) {
1032
- var _this = this
1033
- for (let i = 0; i < tables.length; i++) {
1034
- let datas = {
1035
- tables: tables,
1036
- row: row
1037
- }
1038
- datas.row['f_process_id'] = this.selectdata.f_process_id
1039
- datas.row['f_apply_num'] = this.selectdata.f_apply_num
1040
- datas.row['f_filiale'] = this.selectdata.f_filiale
1041
- let http = new HttpResetClass()
1042
- let sellid = ''
1043
- let billtype = datas.row['f_bill_style']
1044
- if (tables[i] == 't_charge_record') {
1045
- await this.loadbuyer()
1046
- if (this.buyerinfo.rows.length < 1 && billtype === '增值税电子发票' && this.$appdata.getSingleValue('默认打印票据') === '是'){
1047
- this.$showAlert('未找到购买方信息,请去报建功能"购买方信息"中完善购买方信息后再收费','info',2000)
1048
- this.$refs.service_show.initializtion()
1049
- return
1050
- }
1051
- datas.row.f_charging_status = '有效'
1052
- datas.row.f_is_correct = '否'
1053
- datas.row.f_charge_collectors = this.$login.f.name
1054
- await http.load('POST', 'rs/logic/applycharge', datas, {
1055
- resolveMsg: null,
1056
- rejectMsg: '收费保存失败'
1057
- }).then((res) => {
1058
- sellid = JSON.parse(res.data.sellid).id
1059
- /*for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1060
-
1061
- if (this.$refs.service_show.data.fields[i].label == '累计缴费金额') {
1062
- this.$refs.service_show.data.fields[i].value = res.data.f_cumulative_money
1063
- }
1064
-
1065
- if (this.$refs.service_show.data.fields[i].label == '未结总金额') {
1066
- this.$refs.service_show.data.fields[i].value = res.data.f_unaccounts_money
1067
- }
1068
- }*/
1069
- let temp = _this.$refs.service_show.model.rows[showadd_index][j]
1070
- temp.id = JSON.parse(res.data.id).id
1071
- _this.$refs.service_show.model.rows[showadd_index][j] = temp
1072
- })
1073
- if (this.$appdata.getSingleValue('默认打印票据') && this.$appdata.getSingleValue('默认打印票据') === '是') {
1074
- this.$showMessage('是否打票据', ['confirm', 'cancel']).then((res) => {
1075
- if (res === 'confirm') {
1076
- console.log('打印票据')
1077
- if (billtype === '增值税电子发票') {
1078
- this.selectsellid = sellid
1079
- this.showbuyerinfo = true
1080
- }else {
1081
- this.printbill(sellid)
1082
- }
1083
- }
1084
- })
1085
- }
1086
- // 刷新列表数据
1087
- this.$dispatch('selfsearch')
1088
- } else {
1089
- await http.load('POST', 'rs/logic/saveentity', datas, {
1090
- resolveMsg: null,
1091
- rejectMsg: 'onetomany保存失败'
1092
- }).then((res) => {
1093
- // 刷新列表数据
1094
- this.$dispatch('selfsearch')
1095
- let temp = _this.$refs.service_show.model.rows[showadd_index][j]
1096
- temp.id = res.data.id
1097
- _this.$refs.service_show.model.rows[showadd_index][j] = temp
1098
- })
1099
- }
1100
- }
1101
- }
1102
- }
1103
- }
1104
- </script>
1
+ <template>
2
+ <div class="auto">
3
+ <show-back-reason class="auto col-sm-7" v-if="selectdata.f_back_reason && selectdata.f_back_reason!=''"
4
+ :data="show_data"></show-back-reason>
5
+ <div class="auto col-sm-7" v-if="!(selectdata.f_back_reason && selectdata.f_back_reason!='')"></div>
6
+ <div class="auto col-sm-4">
7
+ <p v-show="changeHistoryData.length>0" class="text-right" href="#" @click="searchChangeHistory"><a href="#">点我查看修改历史</a>
8
+ </p>
9
+ </div>
10
+ </div>
11
+
12
+
13
+ <!--<gas-stop v-if="selectdata.defname == '停气碰口'"></gas-stop>-->
14
+ <material-message v-if="selectdata.defname=='材料导入'" v-ref:material
15
+ :selectdata="selectdata"
16
+ :state="2"
17
+ :edit="true"></material-message>
18
+ <material-message v-if="selectdata.defname=='材料审核'" v-ref:material
19
+ :selectdata="selectdata"
20
+ :state="1"
21
+ :edit="true"></material-message>
22
+ <receive-batch v-if="selectdata.defname == '派工单'" :selectdata="selectdata" :showprint="true"
23
+ v-ref:receivebatch></receive-batch>
24
+ <project-settlement v-if="selectdata.defname == '工程结算'" :selectdata="selectdata"></project-settlement>
25
+ <installfee :infee="selectdata" :showfee='true' v-if="selectdata.defname == '通气条件确认'"></installfee>
26
+ <buyer-message v-ref:buyermessagev :selectdata="selectdata" :state="1"
27
+ v-if="selectdata.defname == '收费'||selectdata.defname == '勘察初设'"></buyer-message>
28
+ <installfee :infee="selectdata" v-if="selectdata.defname == '收费'"></installfee>
29
+ <record-message v-if="selectdata.defname=='营收数据导入'" v-ref:record :selectdata="selectdata" :key="'tittle22'"
30
+ :edit="true">
31
+ </record-message>
32
+ <service-view v-ref:service_show :data="show_data" v-if="showview" :is_show_datacheck="datacheck"></service-view>
33
+
34
+ <modal :show.sync="showbuyerinfo" v-ref:modal backdrop="false">
35
+ <header slot="modal-header" class="modal-header">
36
+ <button type="button" class="close" @click="closebuyerinfo"><span>&times;</span></button>
37
+ <h4 class="modal-title">打印电子发票,请请选择购货方信息</h4>
38
+ </header>
39
+ <article slot="modal-body" class="modal-body">
40
+ <div v-if="showbuyerinfo">
41
+ <div class="col-sm-12 span recordTable" style="margin-top: 10px;min-height: 350px">
42
+ <partial-view v-ref:single-load>
43
+ <data-grid :model="buyerinfo" v-ref:grid>
44
+ <template partial='head'>
45
+ <tr>
46
+ <th>序号</th>
47
+ <th>购货方名称</th>
48
+ <th>购货方纳税人识别号</th>
49
+ <th>购货方地址、电话</th>
50
+ <th>购货方开户行及账号</th>
51
+ <th>购货方电子邮箱</th>
52
+ <th>操作</th>
53
+ </tr>
54
+ </template>
55
+ <template partial='body'>
56
+ <td style="text-align: center">{{$index+1}}</td>
57
+ <td style="text-align: center">{{row.f_buyer_name}}</td>
58
+ <td style="text-align: center">{{row.f_buyer_identify}}</td>
59
+ <td style="text-align: center">{{row.f_buyer_addphone}}</td>
60
+ <td style="text-align: center">{{row.f_buyer_bank}}</td>
61
+ <td style="text-align: center">{{row.f_buyer_email}}</td>
62
+ <td style="text-align: center">
63
+ <button type="button" class="btn btn-success"
64
+ @click='$parent.$parent.$parent.$parent.confirmbuyerinfo(row)'>选择
65
+ </button>
66
+ </td>
67
+ </template>
68
+ </data-grid>
69
+ </partial-view>
70
+ </div>
71
+ </div>
72
+ </article>
73
+ <footer slot="modal-footer" class="modal-footer">
74
+ <button v-show="showbuyerinfo" type="button" class="btn btn-default" @click='closebuyerinfo'>取消</button>
75
+ </footer>
76
+ </modal>
77
+ <modal :show.sync="showChangeHistoryInfo" v-ref:modal backdrop="false">
78
+ <header slot="modal-header" class="modal-header">
79
+ <button type="button" class="close" @click="closeChangeHistoryInfo"><span>&times;</span></button>
80
+ <h4 class="modal-title">更改历史</h4>
81
+ </header>
82
+ <article slot="modal-body" class="modal-body">
83
+ <div class="col-sm-12 span recordTable" style="margin-top: 10px;min-height: 350px">
84
+ <apply-change-history v-if="showChangeHistoryInfo" :history_data="changeHistoryData"></apply-change-history>
85
+ </div>
86
+ </article>
87
+ <footer slot="modal-footer" class="modal-footer">
88
+ </footer>
89
+ </modal>
90
+ <!--打印报表html-->
91
+ <div v-show="false">
92
+ <div class="row" style="display: flex;justify-content: center;" id='bill-fee3'>
93
+ {{{bill}}}
94
+ </div>
95
+ <report-print id='bill-fee3' top='15mm' left='5mm' width='90%' height='70%' :showbtn="false" preview="true"
96
+ v-ref:reportprint></report-print>
97
+ </div>
98
+
99
+ </template>
100
+ <script>
101
+ import Vue from 'vue'
102
+ import {HttpResetClass} from 'vue-client'
103
+ import * as Util from '../../../../Util'
104
+ // import AppData from 'stores/AppData'
105
+ // Date格式化
106
+ Date.prototype.Format = function (fmt) {
107
+ var o = {
108
+ "M+": this.getMonth() + 1, //月份
109
+ "d+": this.getDate(), //日
110
+ "H+": this.getHours(), //小时
111
+ "m+": this.getMinutes(), //分
112
+ "s+": this.getSeconds(), //秒
113
+ "q+": Math.floor((this.getMonth() + 3) / 3), //季度
114
+ "S": this.getMilliseconds() //毫秒
115
+ };
116
+ if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
117
+ for (var k in o)
118
+ if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
119
+ return fmt;
120
+ }
121
+
122
+ export default {
123
+ title: '报建流程业务控制层',
124
+ props: ['selectdata'],
125
+ data() {
126
+ return {
127
+ leijijiaofeijine:0, //累计缴费金额
128
+ tujiansum: 0,
129
+ anzhuangsum: 0,
130
+ showChangeHistoryInfo: false, // 历史数据模态框
131
+ changeHistoryData: [], // 修改历史数据处理
132
+ data: null, // 数据库数据,json配置文件数据的数据集合
133
+ json_datas: null, // Json配置文件集合
134
+ showview: false, // 控制显示service-view组件
135
+ show_data: null, // 给view层显示的数据
136
+ department_search: [], // 当前部门下所有人
137
+ contract: null, // 单值表合同编号记录
138
+ technologist: [], // 技术人员 角色下的人
139
+ price: 0,
140
+ cost: 0,
141
+ number: 0,
142
+ pgd: '',
143
+ showbuyerinfo: false, // 新增购货方信息模态框开关
144
+ selectsellid: null, //需要打票收费id
145
+ buyerinfo: {
146
+ id: '',
147
+ f_buyer_name: '',
148
+ f_buyer_identify: '',
149
+ f_buyer_addphone: '',
150
+ f_buyer_bank: '',
151
+ f_buyer_email: '',
152
+ rows: [] // 购货方信息
153
+ },
154
+ bill: ''
155
+ }
156
+ },
157
+ methods: {
158
+ /*
159
+ ============================================收费临时使用
160
+ */
161
+ // 判断部门
162
+ // checkParetment() {
163
+ // let flag = ''
164
+ // let str = this.$appdata.getSingleValue("客户服务部")
165
+ // let str2 = this.$appdata.getSingleValue("工程技术部")
166
+ // let arr = str.split(",")
167
+ // let arr2 = str2.split(",")
168
+ // for (let i = 0; i < arr.length; i++) {
169
+ // if (arr[i] == this.selectdata.f_apply_type) {
170
+ // flag = '客户服务部'
171
+ // break
172
+ // }
173
+ // }
174
+ // for (let i = 0; i < arr2.length; i++) {
175
+ // if (arr2[i] == this.selectdata.f_apply_type) {
176
+ // flag = '工程技术部'
177
+ // break
178
+ // }
179
+ // }
180
+ // return flag
181
+ // },
182
+ // 查看修改历史记录
183
+ searchChangeHistory() {
184
+ console.log("查看修改历史记录")
185
+ this.showChangeHistoryInfo = true
186
+ },
187
+ getmodel() {
188
+ return this.$refs.service_show.getmodel()
189
+ },
190
+ async printbill(sellid) {
191
+ let result = await this.$resetpost('rs/report/billReport', {data: {condition: `f_sell_id = ${sellid}`}}, {
192
+ resolveMsg: null,
193
+ rejectMsg: "提取数据出错,请重试!"
194
+ })
195
+ this.bill = result.data
196
+ console.log('this.bill', this.bill)
197
+ this.$nextTick(() => {
198
+ this.$refs.reportprint.print()
199
+ })
200
+ },
201
+ confirmbuyerinfo(args) {
202
+ let drawbilldata = {
203
+ sellid: this.selectsellid,
204
+ buyerid: args.id,
205
+ operator: this.$login.f.name
206
+ }
207
+ this.closebuyerinfo()
208
+ this.$resetpost('rs/logic/applyDrawBill', {data: drawbilldata}, {resolveMsg: null, rejectMsg: "开发票失败"})
209
+ .then((res) => {
210
+ if (res.data.status === 200) {
211
+ this.$showAlert('申请开具增值税电子发票成功,请稍后到报建功能中【报建收费】中查看电子发票', 'success', 5000)
212
+ /*let n = 0
213
+ var id = setInterval(async ()=>{
214
+ if(n>=3){
215
+ this.$showMessage('电子票延迟,请稍后查看!')
216
+ clearInterval(id)
217
+ }
218
+ if (this.seeeticket(res.data) === 'success'){
219
+ clearInterval(id)
220
+ this.load()
221
+ }
222
+ n++
223
+ this.$showAlert('电子发票开票中,请稍后...', 'info',3000)
224
+ },3000)*/
225
+ } else {
226
+ this.$showAlert('电子发票开票失败,失败代码为:' + res.data.status, 'warning', 3000)
227
+ }
228
+ })
229
+ },
230
+ // 金额转大写
231
+ smalltoBIG(n) {
232
+ let fraction = ['角', '分'];
233
+ let digit = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖'];
234
+ let unit = [['元', '万', '亿'], ['', '拾', '佰', '仟']];
235
+ let head = n < 0 ? '欠' : '';
236
+ n = Math.abs(n);
237
+
238
+ let s = '';
239
+
240
+ for (var i = 0; i < fraction.length; i++) {
241
+ s += (digit[Math.floor(n * 10 * Math.pow(10, i)) % 10] + fraction[i]).replace(/零./, '');
242
+ }
243
+ s = s || '整';
244
+ n = Math.floor(n);
245
+
246
+ for (var i = 0; i < unit[0].length && n > 0; i++) {
247
+ let p = '';
248
+ for (var j = 0; j < unit[1].length && n > 0; j++) {
249
+ p = digit[n % 10] + unit[1][j] + p;
250
+ n = Math.floor(n / 10);
251
+ }
252
+ s = p.replace(/(零.)*零$/, '').replace(/^$/, '零') + unit[0][i] + s;
253
+ }
254
+ return head + s.replace(/(零.)*零元/, '元').replace(/(零.)+/g, '零').replace(/^整$/, '零元整')
255
+ },
256
+ // 关闭模态框
257
+ closebuyerinfo() {
258
+ this.showbuyerinfo = false
259
+ this.selectsellid = null
260
+ },
261
+ // 关闭历史数据模态框
262
+ closeChangeHistoryInfo() {
263
+ this.showChangeHistoryInfo = false
264
+ },
265
+ //根据票据流水号查看票据
266
+ async seeeticket(val) {
267
+ console.log('该票据流水号为:', val.f_fpqqlsh)
268
+ var eticketData = await this.$resetpost('rs/sql/querySingleTable', {
269
+ data: {
270
+ items: 'f_bill_url,f_url_code',
271
+ tablename: 't_eticket',
272
+ condition: `f_serial_number=${val.f_fpqqlsh}`
273
+ }
274
+ }, {resolveMsg: null, rejectMsg: null})
275
+ console.log('eticketData:', eticketData)
276
+ var data = eticketData.data[0]
277
+ if (data.f_bill_url && data.f_bill_url != '') {
278
+ console.log(data)
279
+ var auth = data.f_bill_url.split("/")
280
+ console.log("截取", auth)
281
+ var authCode = auth[auth.length - 1]
282
+ var url = `https://${auth[2]}/ent-views/fpExtract/get_fapiao.html?pwd=${data.f_url_code}&authCode=${authCode}`
283
+ this.$showAlert('开票成功!', 'success', 500)
284
+ window.open(url)
285
+ return 'success'
286
+ }
287
+ return 'fail'
288
+ },
289
+ async loadbuyer() {
290
+ //获取购货方信息
291
+ let querybuyerdata = {
292
+ tablename: 't_buyer_info',
293
+ condition: `f_process_id = '${this.selectdata.f_process_id}' and f_apply_num = '${this.selectdata.f_apply_num}'`
294
+ }
295
+ let buyerinfos = await this.$resetpost('rs/sql/singleTable', {data: querybuyerdata}, {
296
+ resolveMsg: null,
297
+ rejectMsg: '获取购货方信息失败'
298
+ })
299
+ this.buyerinfo.rows = buyerinfos.data
300
+ },
301
+ /*
302
+ ============================================收费临时使用结束
303
+ */
304
+ // AOP后续特殊化处理
305
+ async special(model) {
306
+ if (model.button.button_name === '提交' && model.button.button_event && model.button.button_event === '分支流程异步处理') {
307
+ // 分支流程异步处理
308
+ let http = new HttpResetClass();
309
+ let res = await http.load('POST', 'rs/logic/branchsyncprocess', {
310
+ data: {
311
+ model: model,
312
+ loginUser: this.$login.f
313
+ }
314
+ }, {resolveMsg: null, rejectMsg: '分支流程异步处理保存失败'})
315
+ console.log("分支流程异步处理:", JSON.stringify(res.data))
316
+ }
317
+
318
+ if (this.data.distribute_async && model.button.button_name === '下发') {
319
+ // 同流程节点异步处理
320
+ let http = new HttpResetClass();
321
+ let res = await http.load('POST', 'rs/logic/syncprocess', {
322
+ data: {
323
+ model: model,
324
+ loginUser: this.$login.f
325
+ }
326
+ }, {resolveMsg: null, rejectMsg: '流程异步下发据保存失败'})
327
+ console.log("流程的异步处理:", JSON.stringify(res.data))
328
+ }
329
+ if (this.data.distribute_async && model.button.button_name === '完成') {
330
+ // 强制结束
331
+ let http = new HttpResetClass();
332
+ let res = await http.load('POST', 'rs/logic/stoprocess', {
333
+ data: {
334
+ model: model,
335
+ loginUser: this.$login.f
336
+ }
337
+ }, {resolveMsg: null, rejectMsg: '流程异步完成数据保存失败'})
338
+ console.log("流程的异步处理:", JSON.stringify(res.data))
339
+ }
340
+ },
341
+ hasChangeHistory() {
342
+ let http = new HttpResetClass()
343
+ let data = {
344
+ tablename: 't_apply_change_record',
345
+ condition: ` defname = '${this.selectdata.defname}' and f_process_id ='${this.selectdata.f_process_id}' and f_filiale = '${this.$login.f.f_fengongsi}'`
346
+ }
347
+ http.load('POST', 'rs/sql/singleTable', {data: data}, {resolveMsg: null, rejectMsg: "历史纪录"}).then((res) => {
348
+ this.changeHistoryData = []
349
+ this.changeHistoryData = res.data
350
+ })
351
+ },
352
+ // 组件初始化操作
353
+ refurbish(val) {
354
+ this.selectdata = val
355
+ this.json_datas = this.$workflow_vue
356
+ let sum = 0
357
+ let jsonData = {}
358
+ if (!this.json_datas || !this.json_datas.activitys || this.json_datas.activitys.length == 0) {
359
+ this.$showMessage("网络故障,请刷新页面")
360
+ return
361
+ }
362
+ for (let i = 0; i < this.json_datas.activitys.length; i++) {
363
+ if (this.selectdata.defname == this.json_datas.activitys[i].title) {
364
+ jsonData = this.json_datas.activitys[i]
365
+ sum++
366
+ }
367
+ }
368
+ for (let j = 0; j < jsonData.fields.length; j++) {
369
+ jsonData.fields[j].value = ''
370
+ if (jsonData.fields[j].default) {
371
+ jsonData.fields[j].value = jsonData.fields[j].default
372
+ }
373
+ }
374
+ if (sum == 1) {
375
+ this.data = null
376
+ this.data = jsonData
377
+ // 历史数据查询
378
+ this.hasChangeHistory()
379
+ // selectdata 填充 data
380
+ this.data = Object.assign({}, this.data, this.selectdata)
381
+
382
+ this.initializtion()
383
+ } else if (sum == 0) {
384
+ this.$showMessage(`没有在JSON配置文件中找到活动名为:(${this.selectdata.defname})的节点配置`)
385
+ } else {
386
+ this.$showMessage(`在JSON配置文件中找到活动名为:(${this.selectdata.defname})的节点配置:${sum}个`)
387
+ }
388
+ },
389
+ // AOP:进入vue组件前初始化内容
390
+ // json配置数据处理 比如下拉框的options
391
+ async initializtion() {
392
+ if(this.show_data&&this.show_data.f_process_id == this.data.f_process_id&&this.show_data.defname==this.selectdata.defname){
393
+ this.data = Object.assign({}, this.data, this.selectdata,this.show_data)
394
+ }
395
+ this.showview = false
396
+ // 如果selectdata有这些key,则把selectdata的value赋值给data的value
397
+ for(let i=0;i<this.data.fields.length;i++){
398
+ if (this.selectdata[this.data.fields[i].field]) {
399
+ if (String(this.selectdata[this.data.fields[i].field]).startsWith("{")) {
400
+ if(this.data.fields[i].field=='f_survey_name') {
401
+ let json = JSON.parse(this.selectdata[this.data.fields[i].field])
402
+ this.data.fields[i].value=json.name
403
+ this.selectdata.f_survey_id = json.id
404
+ }else{
405
+ this.data.fields[i].value = JSON.parse(this.selectdata[this.data.fields[i].field])
406
+ this.selectdata[this.data.fields[i].field] = JSON.parse(this.selectdata[this.data.fields[i].field])
407
+ }
408
+ } else {
409
+ this.data.fields[i].value = this.selectdata[this.data.fields[i].field]
410
+ }
411
+ }
412
+ }
413
+ // 有合同号不给合同表里插入数据
414
+ for (let i = 0; i < this.data.tables.length; i++) {
415
+ if ('t_contract' == this.data.tables[i] && this.selectdata.f_contract_number) {
416
+ this.data.tables.splice(i, 1)
417
+ }
418
+ }
419
+ // 下发人 options 处理,options初始化
420
+ if (this.data.source) {
421
+ let http = new HttpResetClass()
422
+ await http.load('POST', 'rs/search', `{"source":${this.data.source},"userid":"${this.$login.f.id}"}`, {
423
+ resolveMsg: null,
424
+ rejectMsg: null
425
+ }).then((res) => {
426
+ // console.log("search查询部门下所有人:", res.data)
427
+ let jsonString = JSON.stringify(res.data)
428
+ let jsonArray = []
429
+ if (jsonString.startsWith("{")) {
430
+ jsonArray.push(res.data)
431
+ res.data = jsonArray
432
+ }
433
+
434
+ this.department_search = res.data
435
+ if (this.department_search && this.showview) {
436
+ let array = []
437
+ for (let k = 0; k < this.department_search.length; k++) {
438
+ array.push({
439
+ label: this.department_search[k].name,
440
+ value: {id: this.department_search[k].id, name: this.department_search[k].name}
441
+ })
442
+ }
443
+ for (let x = 0; x < this.data.buttons.length; x++) {
444
+ if (this.data && this.data.buttons[x].button_name == "下发") {
445
+ this.data.buttons[x].button_fields[0].options = array
446
+ }
447
+ if (this.show_data && this.show_data.buttons[x].button_name == "下发") {
448
+ this.show_data.buttons[x].button_fields[0].options = array
449
+ }
450
+ }
451
+ }
452
+ })
453
+ }
454
+ // selectdata 填充 data
455
+ // this.data = Object.assign({}, this.data, this.selectdata)
456
+ // onetomany 数据获取
457
+ if (this.data.onetomany) {
458
+ console.log('判断是onetomany,this.data.onetomany的数据为=>' + JSON.stringify(this.data.onetomany))
459
+ for (let index = 0; index < this.data.onetomany.length; index++) {
460
+ let http = new HttpResetClass()
461
+ let data = {}
462
+ if (this.data.onetomany[index].tables[0] == 't_charge_record') {
463
+ data = {
464
+ tablename: this.data.onetomany[index].tables[0],
465
+ condition: `f_apply_num = '${this.selectdata.f_apply_num}' and f_process_id='${this.selectdata.f_process_id}' and f_charging_status != '无效'`
466
+ }
467
+ } else {
468
+ data = {
469
+ tablename: this.data.onetomany[index].tables[0],
470
+ condition: `f_apply_num = '${this.selectdata.f_apply_num}' and f_process_id='${this.selectdata.f_process_id}'`
471
+ }
472
+ }
473
+ let res = await http.load('POST', 'rs/sql/singleTable', {data: data}, {
474
+ resolveMsg: null,
475
+ rejectMsg: 'onetomany查询失败'
476
+ })
477
+ // 初始化 onetomany
478
+ let rows = []
479
+ console.log('查询返回结果res.data=>' + JSON.stringify(res.data))
480
+ this.data.onetomany[index].rows = res.data
481
+ // console.log(JSON.stringify('this.data.onetomany[index].rows=>' + JSON.stringify(this.data.onetomany[index].rows)))
482
+
483
+ // 初始化onetomany中的fields
484
+ for (let j = 0; j < this.data.onetomany[index].fields.length; j++) {
485
+ // 如果配置类型为select,优先从参数列表获取options
486
+ if (this.data.onetomany[index].fields[j].type === 'select') {
487
+ let temp = Vue.$appdata.getParam(this.data.onetomany[index].fields[j].label)
488
+ if (temp && temp.length > 0) {
489
+ this.data.onetomany[index].fields[j].options = Vue.$appdata.getParam(this.data.onetomany[index].fields[j].label)
490
+ }
491
+ }
492
+ }
493
+
494
+ }
495
+ }
496
+
497
+ // 如果配置类型为select,优先从参数列表获取options
498
+ for (let p = 0; p < this.data.fields.length; p++) {
499
+ if (this.data.fields[p].type === 'select') {
500
+ let temp = Vue.$appdata.getParam(this.data.fields[p].label)
501
+ // if(this.data.fields[p].disabled){
502
+ // this.data.fields[p].options = []
503
+ // }else
504
+ if (temp && temp.length > 0) {
505
+ if (this.data.fields[p].label) {
506
+ this.data.fields[p].options = Vue.$appdata.getParam(this.data.fields[p].label)
507
+ }
508
+ }
509
+ }
510
+ }
511
+ // 初始化 fields
512
+ for (let i = 0; i < this.data.fields.length; i++) {
513
+ // 下发人 options 处理,options初始化
514
+ if (this.data.fields[i].source) {
515
+ let http = new HttpResetClass()
516
+ await http.load('POST', 'rs/search', `{"source":${this.data.fields[i].source},"userid":"${this.$login.f.id}"}`, {
517
+ resolveMsg: null,
518
+ rejectMsg: null
519
+ }).then((res) => {
520
+ console.log("search查询部门下所有人:", res.data)
521
+ let array = []
522
+ for (let k = 0; k < res.data.length; k++) {
523
+ array.push({
524
+ label: res.data[k].name,
525
+ value: {id: res.data[k].id, name: res.data[k].name}
526
+ })
527
+ }
528
+ this.data.fields[i].options = array
529
+ })
530
+ }
531
+
532
+ /*
533
+ {
534
+ "label": "累计缴费金额",
535
+ "field": "f_cumulative_money",
536
+
537
+ },
538
+ {
539
+ "label": "未结总金额",
540
+ "field": "f_unaccounts_money",
541
+ },
542
+ {
543
+ "label": "累计开票金额"
544
+ "field": "f_cumulative_invoicing"
545
+ },
546
+ {
547
+ "label": "未开票金额",
548
+ "field": "f_residual_invoicing",
549
+ },
550
+ */
551
+ if(this.data.fields[i].label === '设计单位'){
552
+ if(this.selectdata.f_apply_type == '民用散户'||this.selectdata.f_apply_type == '民用整改'){
553
+ this.data.fields[i].required = false
554
+ }else{
555
+ this.data.fields[i].required = true
556
+ }
557
+ }
558
+ if(this.data.fields[i].label === '累计缴费金额'){
559
+ let http = new HttpResetClass()
560
+ let data = {
561
+ columnname: 'f_charge_money',
562
+ tablename: 't_charge_record',
563
+ condition: `f_charging_status='有效' and f_process_id = '${this.selectdata.f_process_id}'`
564
+ }
565
+ let res = await http.load('POST', 'rs/sql/getSum', {data: data}, {resolveMsg: null, rejectMsg: '获取缴费金额获取失败'})
566
+ if(res.data[0].f_charge_money){
567
+ this.data.fields[i].value = res.data[0].f_charge_money
568
+ }else {
569
+ this.data.fields[i].value = 0
570
+ }
571
+ this.leijijiaofeijine = res.data[0].f_charge_money
572
+ for (let k = 0; k < this.data.fields.length; k++) {
573
+ if(this.data.fields[k].label=='未结总金额'){
574
+ this.data.fields[k].value= Number(this.selectdata.f_contract_money) - this.data.fields[i].value
575
+ console.log(this.data.fields[k].label,this.data.fields[k].value)
576
+ }
577
+ }
578
+ console.log(this.data.fields[i].label,this.data.fields[i].value)
579
+ }
580
+ if(this.data.fields[i].label === '累计开票金额'){
581
+ let http = new HttpResetClass()
582
+ let data = {
583
+ columnname: 'f_charge_money',
584
+ tablename: 't_charge_record',
585
+ condition: `f_charging_status='有效' and f_process_id = '${this.selectdata.f_process_id}' and (f_invoice_num !='' or f_invoice_num is not null)`
586
+ }
587
+ let res = await http.load('POST', 'rs/sql/getSum', {data: data}, {resolveMsg: null, rejectMsg: '获取累计缴费金额获取失败'})
588
+ this.data.fields[i].value = res.data[0].f_charge_money
589
+ for (let k = 0; k < this.data.fields.length; k++) {
590
+ if(this.data.fields[k].label=='未开票金额'){
591
+ this.data.fields[k].value= Number(this.leijijiaofeijine) - res.data[0].f_charge_money
592
+ console.log(this.data.fields[k].label,this.data.fields[k].value)
593
+ console.log("this.data.fields1",this.data.fields)
594
+ }
595
+ }
596
+ console.log(this.data.fields[i].label,this.data.fields[i].value)
597
+ console.log("this.data.fields",this.data.fields)
598
+ }
599
+
600
+ if (this.data.fields[i].label === '气表品牌') {
601
+ if (!this.data.fields[i].value) {
602
+ let http = new HttpResetClass()
603
+ let data = {
604
+ columnname: 'f_meter_brand,id',
605
+ tablename: 't_gasbrand',
606
+ condition: ` 1=1 `
607
+ }
608
+ let res = await http.load('POST', 'rs/sql/getdistinct', {data: data}, {resolveMsg: null, rejectMsg: '获取气表品牌失败'})
609
+ this.data.fields[i].options=[]
610
+ for(let x=0;x<res.data.length;x++){
611
+ this.data.fields[i].options.push({label:res.data[x].f_meter_brand,value:{id:res.data[x].id,name:res.data[x].f_meter_brand}})
612
+ }
613
+ console.log("气表品牌",this.data.fields[i].options)
614
+ if (this.showview) {
615
+ this.$refs.service_show.update()
616
+ }
617
+ }
618
+ }
619
+
620
+ if (this.data.fields[i].label == '合同金额' || this.data.fields[i].label == '合同总金额') {
621
+ if (this.data.fields[i].value == null || this.data.fields[i].value == '') {
622
+ this.data.fields[i].value = "0"
623
+ }
624
+ }
625
+ if (this.data.fields[i].label == '技术人员'||this.data.fields[i].label == '设计人员') {
626
+ let buyerinfos = []
627
+ let numReg = /^[0-9]+$/
628
+ let numRe = new RegExp(numReg)
629
+ if (numRe.test(this.data.fields[i].value)) {
630
+ let querydata = {
631
+ tablename: 't_user',
632
+ condition: `id = ${this.data.fields[i].value}`
633
+ }
634
+ buyerinfos = await this.$resetpost('rs/sql/singleTable', {data: querydata}, {
635
+ resolveMsg: null,
636
+ rejectMsg: '获取人员失败'
637
+ })
638
+ this.data.fields[i].value = {
639
+ id: buyerinfos.data[0].id,
640
+ name: buyerinfos.data[0].name
641
+ }
642
+ }
643
+ }
644
+
645
+ if (this.data.defname === '工程结算') {
646
+ var a = 0
647
+ var b = 0
648
+ var c = 0
649
+ for (let i = 0; i < this.data.fields.length; i++) {
650
+ if (this.data.fields[i].label === '最终核算成本金额') {
651
+ this.data.fields[i].value = (this.cost + this.number + this.anzhuangsum + this.tujiansum)
652
+ a = this.data.fields[i].value
653
+ }
654
+ if (this.data.fields[i].label === '合同总金额') {
655
+ b = this.data.fields[i].value
656
+ }
657
+ if (this.data.fields[i].label === '材料成本金额') {
658
+ this.data.fields[i].value = this.number
659
+ }
660
+ if (this.data.fields[i].label === '安装人工成本') {
661
+ this.data.fields[i].value = this.anzhuangsum
662
+ }
663
+ if (this.data.fields[i].label === '土建人工成本') {
664
+ this.data.fields[i].value = this.tujiansum
665
+ }
666
+ if (this.data.fields[i].label === '其他成本金额') {
667
+ this.data.fields[i].value = this.cost
668
+ }
669
+ }
670
+ c = b - a
671
+ for (let i = 0; i < this.data.fields.length; i++) {
672
+ if (this.data.fields[i].label === '工程盈利') {
673
+ this.data.fields[i].value = c
674
+ }
675
+ }
676
+ }
677
+ if (this.data.defname === '派工单') {
678
+
679
+ for (let i = 0; i < this.data.fields.length; i++) {
680
+ if (this.data.fields[i].label === '派工单号') {
681
+ this.data.fields[i].value = this.pgd
682
+
683
+ }
684
+
685
+ }
686
+
687
+ }
688
+ // 特殊处理
689
+ //施工环节 如果是个人报建需要提交表具信息
690
+ // 如果安装表数为1,则显示是否有表选项
691
+ if (this.data.defname === '施工') {
692
+ for (let i = 0; i < this.data.fields.length; i++) {
693
+ if (this.data.fields[i].label == '是否有表') { //
694
+ if (this.data.f_apply_type === '管线整改' || this.data.f_apply_type === '商业预埋管线'|| this.data.f_apply_type === '商业新建管线') { //一定没有表
695
+ this.data.fields[i].value = '否'
696
+ this.selectdata.f_hasmeter = '否'
697
+ this.data.fields[i].hidden = true
698
+ this.data.fields[i].required = false
699
+ } else if (this.data.f_install_num == 1 && (this.data.f_apply_type === '民用整改' || this.data.f_apply_type === '非居整改' || this.data.f_apply_type === '内部投建'||(this.data.f_apply_type != '管线整改'&&this.data.f_apply_type.includes("整改")))) { // 民用整改,非居整改,内部投建可能不安装表
700
+ this.data.fields[i].hidden = false
701
+ this.data.fields[i].required = true
702
+ } else{
703
+ this.data.fields[i].hidden = false
704
+ this.data.fields[i].required = true
705
+ }
706
+ }
707
+ }
708
+ // 如果是民用散户默认 跳过 内验 和 外验
709
+ if(this.selectdata.f_apply_type == '民用散户'){
710
+ for (let i = 0; i < this.data.fields.length; i++) {
711
+ if (this.data.fields[i].label == '是否内验' || this.data.fields[i].label == '是否发起外验') { //this.data.f_install_num != 1&&
712
+ this.data.fields[i].value = '否'
713
+ this.data.fields[i].hidden = true
714
+ this.data.fields[i].required = false
715
+ }
716
+ }
717
+ }
718
+ }
719
+
720
+ // 只有工商用户才让显示 6方以上 还是 6方以下
721
+ if(this.data.fields[i].label == '6方以上'){
722
+ if(this.selectdata.f_apply_type == '工业'||this.selectdata.f_apply_type == '商业'){
723
+ this.data.fields[i].value = null
724
+ this.data.fields[i].hidden = false
725
+ this.data.fields[i].required = true
726
+ }
727
+ }
728
+
729
+ if(this.data.fields[i].label == '是否内验'){
730
+ // 工业,商业
731
+ if(this.selectdata.f_apply_type == '工业'||this.selectdata.f_apply_type == '商业'){
732
+ this.data.fields[i].value = '是'
733
+ this.data.fields[i].hidden = true
734
+ this.data.fields[i].required = false
735
+ }
736
+ // 如果是 民用成套户 或者 民用集体散户 是否内验 和 是否外验 都是是
737
+ if(this.selectdata.f_apply_type == '民用成套户'||this.selectdata.f_apply_type == '民用集体散户'||this.selectdata.f_apply_type == '民用集体户'){
738
+ this.data.fields[i].value = '是'
739
+ this.data.fields[i].hidden = true
740
+ this.data.fields[i].required = false
741
+ }
742
+ }
743
+
744
+
745
+ if(this.data.fields[i].label == '是否发起外验'){
746
+ // 如果是 民用成套户 或者 民用集体散户 是否内验 和 是否外验 都是是
747
+ if(this.selectdata.f_apply_type == '工业'||this.selectdata.f_apply_type == '商业'){
748
+ this.data.fields[i].hidden = true
749
+ }
750
+
751
+ // 如果是 民用成套户 或者 民用集体散户 是否内验 和 是否外验 都是是
752
+ if(this.selectdata.f_apply_type == '民用成套户'||this.selectdata.f_apply_type == '民用集体散户'||this.selectdata.f_apply_type == '民用集体户'){
753
+ this.data.fields[i].value = '是'
754
+ this.data.fields[i].hidden = true
755
+ this.data.fields[i].required = false
756
+ }
757
+ }
758
+
759
+
760
+ if (this.data.defname === '通气') {
761
+ for (let i = 0; i < this.data.fields.length; i++) {
762
+ if (this.data.fields[i].label == '是否有表' && !this.data.fields[i].value) { //this.data.f_install_num != 1&&
763
+ this.data.fields[i].value = '否'
764
+ this.data.fields[i].hidden = true
765
+ this.data.fields[i].required = false
766
+ }
767
+ }
768
+ }
769
+
770
+ if(this.data.fields[i].label === '是否装新表'){
771
+ for(let k=0;k<this.data.fields.length;k++){
772
+ if(this.data.fields[i].value == '是'){
773
+ if(this.data.fields[k].label=='用气性质'||
774
+ this.data.fields[k].label=='气价类型'||
775
+ this.data.fields[k].label=='气价名称'
776
+ ){
777
+ this.data.fields[k].required=true,
778
+ this.data.fields[k].hidden=false
779
+ }
780
+ }else{
781
+ if(this.data.fields[k].label=='用气性质'||
782
+ this.data.fields[k].label=='气价类型'||
783
+ this.data.fields[k].label=='气价名称'){
784
+ this.data.fields[k].required=false,
785
+ this.data.fields[k].hidden=true
786
+ }
787
+ }
788
+ }
789
+ }
790
+
791
+ //通气环节可以调出施工环节的表信息来修改
792
+ if (this.data.defname == '通气' || this.data.defname == '施工') {
793
+ console.log("是否有表", this.selectdata.f_hasmeter)
794
+ for (let i = 0; i < this.data.fields.length; i++) {
795
+ if (this.data.fields[i].label === '气表品牌'
796
+ || this.data.fields[i].label === '气表型号'
797
+ || this.data.fields[i].label === '表号'
798
+ || this.data.fields[i].label === '通气表号'
799
+ || this.data.fields[i].label === '左右表'
800
+ || this.data.fields[i].label === '气表厂家') {
801
+ if (this.data.f_install_num == 1 && this.selectdata.f_hasmeter && this.selectdata.f_hasmeter == '是') {
802
+ this.data.fields[i].hidden = false
803
+ this.data.fields[i].required = true
804
+ } else if ((this.data.f_install_num == 1 && this.selectdata.f_hasmeter && this.selectdata.f_hasmeter == '否')) {
805
+ this.data.fields[i].hidden = true
806
+ this.data.fields[i].required = false
807
+ }
808
+ if (this.data.fields[i].label === '表号') {
809
+ console.log("表号", this.data.fields[i].value)
810
+ }
811
+ } else if (this.data.fields[i].label === '气表品牌id' || this.data.fields[i].label === '气表型号id') {
812
+ this.data.fields[i].hidden = true
813
+ this.data.fields[i].required = false
814
+ }
815
+ }
816
+ }
817
+
818
+ let array = this.$login.f.rolesnames.split(',')
819
+ if ((this.data.fields[i].label === '技术人员' || array.includes("工程技术部负责人")) && (this.selectdata.defname == '报装申请' || this.selectdata.defname == '勘察初设' || this.selectdata.defname == '任务分配' || this.selectdata.defname == '合同信息')) { //{"source":"this.getParentByType($organization$).getChildByName($技术人员$).getChildren()","userid":"296851"}
820
+ let http = new HttpResetClass()
821
+ let res = await http.load('POST', 'rs/search', `{"source":"this.getParentByType($organization$).getChildByName($工程技术部门$).getChildByName($技术人员$).getChildren()","userid":"${this.$login.f.id}"}`, {
822
+ resolveMsg: null,
823
+ rejectMsg: null // 'search查询技术人员失败,请联系管理员配置技术人员角色'
824
+ })
825
+ // console.log("search查询部门下所有人:", JSON.stringify(res.data))
826
+ this.technologist = res.data
827
+ if (this.technologist) {
828
+ let array = []
829
+ for (let k = 0; k < this.technologist.length; k++) {
830
+ array.push({
831
+ label: this.technologist[k].name,
832
+ value: {name: this.technologist[k].name, id: this.technologist[k].id}
833
+ })
834
+ }
835
+ if (!array.includes("工程技术部负责人") && this.data.fields[i].label === '技术人员') {
836
+ this.data.fields[i].options = array
837
+ }
838
+
839
+ }
840
+ }
841
+ // if (this.data.fields[i].label == '县/区') {
842
+ // console.log('小区获取区县。。。。。' + JSON.stringify(this.$login.f.f_allArea))
843
+ // let rs = []
844
+ // for (let i = 0; i < this.$login.f.f_allArea.length; i++) {
845
+ // let temp = {
846
+ // label: this.$login.f.f_allArea[i].label,
847
+ // value: this.$login.f.f_allArea[i].label
848
+ // }
849
+ // rs.push(temp)
850
+ // }
851
+ // this.data.fields[i].options = [{label: '全部', value: ''}, ...rs]
852
+ // }
853
+
854
+ if (this.data.fields[i].label == '合同类型') {
855
+ this.data.fields[i].value = '主合同'
856
+ }
857
+ if (this.data.fields[i].label == '合同业务办理人') {
858
+ if (this.selectdata.f_apply_kefu_employee) {
859
+ if (this.selectdata.f_apply_kefu_employee.startsWith("{") && this.selectdata.f_apply_kefu_employee.endsWith("}")) {
860
+ let temp = JSON.parse(this.selectdata.f_apply_kefu_employee)
861
+ this.data.fields[i].value = temp.name
862
+ } else {
863
+ this.data.fields[i].value = this.selectdata.f_apply_kefu_employee
864
+ }
865
+ } else {
866
+ if (this.selectdata.f_survey_name) {
867
+ if (this.selectdata.f_survey_name.startsWith("{") && this.selectdata.f_survey_name.endsWith("}")) {
868
+ let temp = JSON.parse(this.selectdata.f_survey_name)
869
+ this.data.fields[i].value = temp.name
870
+ } else {
871
+ this.data.fields[i].value = this.selectdata.f_survey_name
872
+ }
873
+ }
874
+ }
875
+ }
876
+ if (this.data.fields[i].label == '合同编号' && !this.selectdata[this.data.fields[i].field] && this.selectdata.defname == '合同信息') {
877
+ if (!this.$appdata.getSingleValue('所属公司编码')) {
878
+ this.$showMessage(`请先去参数管理设置: 所属公司编码`)
879
+ }
880
+ if (!this.$appdata.getSingleValue('报装合同编号')){
881
+ this.$showMessage(`请先去参数管理设置: ${this.data.fields[i].label}`)
882
+ }
883
+ }
884
+ // if (this.data.fields[i].label == '合同编号' && !this.selectdata[this.data.fields[i].field] && this.selectdata.defname == '合同审核') {
885
+ // if (!this.$appdata.getSingleValue('所属公司编码')) {
886
+ // this.$showMessage(`请先去参数管理设置: 所属公司编码`)
887
+ // }
888
+ // if (!this.$appdata.getSingleValue(this.data.fields[i].label)) {
889
+ // this.$showMessage(`请先去参数管理设置: ${this.data.fields[i].label}`)
890
+ // } else {
891
+ // let http = new HttpResetClass()
892
+ // //获取购货方信息
893
+ // let data = {
894
+ // tablename: 't_singlevalue',
895
+ // condition: `name = '合同编号' and f_filialeids = '${this.$login.f.f_orgids}'`
896
+ // }
897
+ // let res = await http.load('POST', 'rs/sql/singleTable', {data: data}, {
898
+ // resolveMsg: null,
899
+ // rejectMsg: '获取合同编号失败'
900
+ // }).then((res) => {
901
+ // let temp = res.data[0].value
902
+ // this.contract = temp
903
+ // while (temp.length < 4) {
904
+ // temp = '0' + temp
905
+ // }
906
+ // let dt = new Date().Format("yyyyMM")
907
+ // this.data.fields[i].value = this.$appdata.getSingleValue('所属公司编码') + dt + temp
908
+ // if (this.showview) {
909
+ // this.$refs.service_show.data.fields[i].value = this.$appdata.getSingleValue('所属公司编码') + dt + temp
910
+ // this.$refs.service_show.update()
911
+ // }
912
+ //
913
+ // })
914
+ //
915
+ // // this.$refs.service_show.update()
916
+ // }
917
+ // }
918
+
919
+
920
+ }
921
+ // 初始化 buttons_fields
922
+ for (let i = 0; i < this.data.buttons.length; i++) {
923
+ if (this.data.buttons[i].button_fields) {
924
+ for (let j = 0; j < this.data.buttons[i].button_fields.length; j++) {
925
+ // 如果selectdata有这些key,则把selectdata的value赋值给data的value
926
+ if (this.selectdata[this.data.buttons[i].button_fields[j].field]) {
927
+ this.data.buttons[i].button_fields[j].value = this.selectdata[this.data.buttons[i].button_fields[j].field]
928
+ }
929
+ // 如果配置类型为select,优先从参数列表获取options
930
+ if (this.data.buttons[i].button_fields[j].type === 'select' && this.$appdata.getParam(this.data.buttons[i].button_fields[j].label)) {
931
+ this.data.buttons[i].button_fields[j].options = this.$appdata.getParam(this.data.buttons[i].button_fields[j].label).trim()
932
+ }
933
+ // 下发特殊配置
934
+ if (this.data.buttons[i].button_name === '下发') {
935
+ if (this.data.buttons[i].button_fields.length === 1) {
936
+ // value初始化
937
+ // if(this.department_search){
938
+ if (this.selectdata[this.data.buttons[i].button_fields[0].field]) {
939
+ for (let k = 0; k < this.department_search.length; k++) {
940
+ // 将id转换为name
941
+ if (Number(this.department_search[k].id) === Number(this.selectdata[this.data.buttons[i].button_fields[0].field])) {
942
+ this.data.buttons[i].button_fields[0].value = {
943
+ id: this.department_search[k].id,
944
+ name: this.department_search[k].name
945
+ }
946
+ }
947
+ }
948
+ }
949
+
950
+ if (this.department_search) {
951
+ let array = []
952
+ for (let k = 0; k < this.department_search.length; k++) {
953
+ array.push({
954
+ label: this.department_search[k].name,
955
+ value: {id: this.department_search[k].id, name: this.department_search[k].name}
956
+ })
957
+ }
958
+ this.data.buttons[i].button_fields[0].options = array
959
+ }
960
+ let array = this.$login.f.rolesnames.split(',')
961
+ if (this.selectdata.defname == '任务分配' && array.includes("工程技术部负责人")) {
962
+ let array = []
963
+ for (let k = 0; k < this.technologist.length; k++) {
964
+ array.push({
965
+ label: this.technologist[k].name,
966
+ value: {id: this.technologist[k].id, name: this.technologist[k].name}
967
+ })
968
+ }
969
+ this.data.buttons[i].button_fields[0].options = array
970
+ }
971
+ } else {
972
+ this.$showMessage("下发按钮必须满足 当且仅当一个字段")
973
+ }
974
+ }
975
+ }
976
+ }
977
+
978
+ }
979
+ // 消除双向绑定,避免子组件(显示层)数据更改,父组件(控制层)也更改
980
+ let temp = JSON.parse(JSON.stringify(this.data))
981
+ // let temp = this.data
982
+ // 退回原因展示
983
+ console.log("this.selectdata.f_back_reason:-----" + this.selectdata.f_back_reason)
984
+ if (this.selectdata.f_back_reason) {
985
+ temp['back_reason'] = this.selectdata.f_back_reason
986
+ }
987
+ this.show_data = temp
988
+ // 显示组件
989
+ // this.showview = false
990
+ this.$nextTick(() => {
991
+ this.showview = true
992
+ })
993
+ // console.log("fields",this.data.fields)
994
+ console.log("测试一----------")
995
+ if (this.selectdata.defname === '现场勘察') {
996
+ let http = new HttpResetClass()
997
+ // let condition = "f_filialeid = " + this.$login.f.orgid
998
+ let condition = "1 = 1"
999
+ let res = await http.load('POST','rs/sql/singleTable',{data:{tablename:'t_area',condition:condition}}, {resolveMsg: null, rejectMsg: null})
1000
+ for (let i = 0; i < this.show_data.fields.length; i++) {
1001
+ if (this.show_data.fields[i].label == '县/区') {
1002
+ let data = []
1003
+ let array = []
1004
+ data = res.data.map(item => {
1005
+ return item.f_area;
1006
+ })
1007
+ for (let q = 0; q < data.length; q++) {
1008
+ let arraydata = {
1009
+ 'label': data[q],
1010
+ 'value': data[q]
1011
+ }
1012
+ if (array.length != 0) {
1013
+ for (let w = 0; w < array.length; w++) {
1014
+ if (array[w].label == data[q]) {
1015
+ break
1016
+ }
1017
+ while (w == array.length - 1) {
1018
+ array.push(arraydata)
1019
+ break
1020
+ }
1021
+ }
1022
+ } else {
1023
+ array.push(arraydata)
1024
+ }
1025
+ }
1026
+ this.show_data.fields[i].options = array
1027
+ console.log("选择框数据:" + JSON.stringify(this.show_data.fields[i].options))
1028
+ }
1029
+ // if (this.$refs.service_show.data.fields[i].label == '街道') {
1030
+ // let data = []
1031
+ // let array = []
1032
+ // data = res.data.map(item => {
1033
+ // return item.f_street;
1034
+ // })
1035
+ // for (let q = 0; q < data.length; q++) {
1036
+ // let arraydata = {
1037
+ // 'label': data[q],
1038
+ // 'value': data[q]
1039
+ // }
1040
+ // if (array.length != 0) {
1041
+ // for (let w = 0; w < array.length; w++) {
1042
+ // if (array[w].label == data[q]) {
1043
+ // break
1044
+ // }
1045
+ // while (w == array.length - 1) {
1046
+ // array.push(arraydata)
1047
+ // break
1048
+ // }
1049
+ // }
1050
+ // } else {
1051
+ // array.push(arraydata)
1052
+ // }
1053
+ // }
1054
+ // this.$refs.service_show.data.fields[i].options = array
1055
+ // console.log("选择框数据:" + JSON.stringify(this.$refs.service_show.data.fields[i].options))
1056
+ // }
1057
+ // if (this.$refs.service_show.data.fields[i].label == '小区') {
1058
+ // let data = []
1059
+ // let array = []
1060
+ // data = res.data.map(item => {
1061
+ // return item.f_residential_area;
1062
+ // })
1063
+ // for (let q = 0; q < data.length; q++) {
1064
+ // let arraydata = {
1065
+ // 'label': data[q],
1066
+ // 'value': data[q]
1067
+ // }
1068
+ // if (array.length != 0) {
1069
+ // for (let w = 0; w < array.length; w++) {
1070
+ // if (array[w].label == data[q]) {
1071
+ // break
1072
+ // }
1073
+ // while (w == array.length - 1) {
1074
+ // array.push(arraydata)
1075
+ // break
1076
+ // }
1077
+ // }
1078
+ // } else {
1079
+ // array.push(arraydata)
1080
+ // }
1081
+ // }
1082
+ // this.$refs.service_show.data.fields[i].options = array
1083
+ // console.log("选择框数据:" + JSON.stringify(this.$refs.service_show.data.fields[i].options))
1084
+ // }
1085
+ }
1086
+ }
1087
+ },
1088
+
1089
+ dataChange(button_name) {
1090
+ let beforeData = this.data.fields
1091
+ let submitData = this.$refs.service_show.data.fields
1092
+ // 比较
1093
+ let f_before_change = []
1094
+ let f_change = []
1095
+ for (let i = 0; i < beforeData.length; i++) {
1096
+ if (beforeData[i].value != submitData[i].value) {
1097
+ f_before_change.push(beforeData[i])
1098
+ f_change.push(submitData[i])
1099
+ }
1100
+ }
1101
+ if (f_before_change.length == 0 && f_change.length == 0) {
1102
+ return
1103
+ }
1104
+ // 构建数据结构
1105
+ let data = {}
1106
+ data.f_before_change = f_before_change
1107
+ data.f_change = f_change
1108
+ data.f_process_id = this.data.f_process_id
1109
+ data.f_apply_num = this.data.f_apply_num
1110
+ data.actdefid = this.data.actdefid
1111
+ data.defname = this.data.defname
1112
+ data.f_filiale = this.$refs.service_show.model.f_filiale
1113
+ data.f_parentname = this.$refs.service_show.model.f_parentname
1114
+ data.f_operator = this.$refs.service_show.model.f_operator
1115
+ data.f_date = this.$refs.service_show.model.f_operate_date
1116
+ data.f_button_name = button_name
1117
+ delete data.id
1118
+ // let http = new HttpResetClass()
1119
+ // http.load('POST', 'rs/logic/saveChageData', {
1120
+ // data: data
1121
+ // }, {resolveMsg: null, rejectMsg: null})
1122
+ // if(false){
1123
+ //
1124
+ // }
1125
+ }
1126
+ }
1127
+ ,
1128
+ events: {
1129
+ refreshSum(number, cost, tujiansum, anzhuangsum) {
1130
+ this.number = number
1131
+ this.cost = cost
1132
+ this.tujiansum = tujiansum
1133
+ this.anzhuangsum = anzhuangsum
1134
+ this.initializtion()
1135
+ },
1136
+ 'get-cost'(val) {
1137
+ this.cost = val
1138
+
1139
+ this.initializtion()
1140
+ },
1141
+ 'anzhuang-sum'(val) {
1142
+ this.anzhuangsum = val
1143
+ this.initializtion()
1144
+ },
1145
+ 'tujian-sum'(val) {
1146
+ this.tujiansum = val
1147
+ this.initializtion()
1148
+ },
1149
+ 'get-number'(val) {
1150
+ this.number = val
1151
+
1152
+ this.initializtion()
1153
+ }
1154
+ ,
1155
+ 'get-pgd'(val) {
1156
+ this.pgd = val
1157
+ this.initializtion()
1158
+ }
1159
+ ,
1160
+ // 任意select选中时触发事件,关联性操作
1161
+ async 'select_cascade'(index) {
1162
+ // this.$refs.service_show.data // 子业务显示组件
1163
+ // 级联操作示例:
1164
+ /*
1165
+ if(this.$refs.service_show.data.fields[index].label==='报建类型'){
1166
+ for(let i=0;i<this.$refs.service_show.data.fields.length;i++){
1167
+ // 控制设置级联
1168
+ // 源select所选的值 this.$refs.service_show.data.fields[index].value
1169
+ if(this.$refs.service_show.data.fields[i].label==='级联测试2'){
1170
+ this.$refs.service_show.data.fields[i].options=[
1171
+ {label:'级联选项1',value:'级联选项1'},{label:'级联选项2',value:'级联选项2'},{label:'级联选项3',value:'级联选项3'}
1172
+ ]
1173
+ }
1174
+ }
1175
+ }
1176
+ */
1177
+ /*
1178
+ {
1179
+ "label": "用气性质",
1180
+ "type": "select",
1181
+ "bootstraped": "col-sm-4",
1182
+ "field": "f_gasproperties",
1183
+ "readonly": true,
1184
+ "disabled": false,
1185
+ "required": false,
1186
+ "hidden": true,
1187
+ "options": []
1188
+ },
1189
+ {
1190
+ "label": "气价类型",
1191
+ "type": "select",
1192
+ "bootstraped": "col-sm-4",
1193
+ "field": "f_price_type",
1194
+ "readonly": true,
1195
+ "disabled": false,
1196
+ "required": false,
1197
+ "hidden": true,
1198
+ "options": []
1199
+ },
1200
+ {
1201
+ "label": "气价名称",
1202
+ "type": "select",
1203
+ "bootstraped": "col-sm-4",
1204
+ "field": "f_price_name",
1205
+ "readonly": true,
1206
+ "disabled": false,
1207
+ "required": false,
1208
+ "hidden": true,
1209
+ "options": []
1210
+ },
1211
+ {
1212
+ "label": "气价id",
1213
+ "type": "number",
1214
+ "bootstraped": "col-sm-4",
1215
+ "field": "f_price_id",
1216
+ "readonly": true,
1217
+ "disabled": false,
1218
+ "required": false,
1219
+ "hidden": true
1220
+ },
1221
+ */
1222
+ if(this.$refs.service_show.data.fields[index].label === '是否装新表'){
1223
+ for(let i=0;i<this.$refs.service_show.data.fields.length;i++){
1224
+ if(this.$refs.service_show.data.fields[index].value == '是'){
1225
+ if(this.$refs.service_show.data.fields[i].label=='用气性质'||
1226
+ this.$refs.service_show.data.fields[i].label=='气价类型'||
1227
+ this.$refs.service_show.data.fields[i].label=='气价名称'
1228
+ ){
1229
+ this.$refs.service_show.data.fields[i].required=true,
1230
+ this.$refs.service_show.data.fields[i].hidden=false
1231
+ }
1232
+ }else{
1233
+ if(this.$refs.service_show.data.fields[i].label=='用气性质'||
1234
+ this.$refs.service_show.data.fields[i].label=='气价类型'||
1235
+ this.$refs.service_show.data.fields[i].label=='气价名称'){
1236
+ this.$refs.service_show.data.fields[i].required=false,
1237
+ this.$refs.service_show.data.fields[i].hidden=true
1238
+ }
1239
+ }
1240
+ }
1241
+ }
1242
+ if(this.$refs.service_show.data.fields[index].label === '是否装新表'&&this.$refs.service_show.data.fields[index].value=='是'){
1243
+ let usertype = ''
1244
+ for(let i=0;i<this.$refs.service_show.data.fields.length;i++){
1245
+ if(this.$refs.service_show.data.fields[i].label=='用户类型'){
1246
+ usertype = this.$refs.service_show.data.fields[i].value
1247
+ }
1248
+ if(this.$refs.service_show.data.fields[i].label=='用气性质'&&this.$refs.service_show.data.fields[index].value){
1249
+ this.$refs.service_show.data.fields[i].options=[]
1250
+ this.$refs.service_show.data.fields[i].value = ''
1251
+ this.$refs.service_show.data.fields[i].options= this.$appdata.getParam(usertype)
1252
+ }
1253
+ }
1254
+ }
1255
+
1256
+ if (this.$refs.service_show.data.fields[index].label === '用户类型') { //用气性质
1257
+ for(let i=0;i<this.$refs.service_show.data.fields.length;i++){
1258
+ if(this.$refs.service_show.data.fields[i].label=='用气性质'&&this.$refs.service_show.data.fields[index].value){
1259
+ this.$refs.service_show.data.fields[i].options=[]
1260
+ this.$refs.service_show.data.fields[i].value = ''
1261
+ this.$refs.service_show.data.fields[i].options= this.$appdata.getParam(this.$refs.service_show.data.fields[index].value.trim())
1262
+ }
1263
+ }
1264
+ }
1265
+
1266
+ if (this.$refs.service_show.data.fields[index].label === '技术人员') { //气价类型
1267
+ for(let i=0;i<this.$refs.service_show.data.fields.length;i++){
1268
+ if(this.$refs.service_show.data.fields[i].label=='技术人员id'&&this.$refs.service_show.data.fields[index].value){
1269
+ if(typeof this.$refs.service_show.data.fields[index].value=='object'){
1270
+ this.$refs.service_show.data.fields[i].value=this.$refs.service_show.data.fields[index].value.id
1271
+ }
1272
+ }
1273
+ }
1274
+ }
1275
+
1276
+
1277
+ if (this.$refs.service_show.data.fields[index].label === '用气性质') { //气价类型
1278
+ for(let i=0;i<this.$refs.service_show.data.fields.length;i++){
1279
+ if(this.$refs.service_show.data.fields[i].label=='气价类型'&&this.$refs.service_show.data.fields[index].value){
1280
+ this.$refs.service_show.data.fields[i].options=[]
1281
+ this.$refs.service_show.data.fields[i].value = ''
1282
+ this.$refs.service_show.data.fields[i].options= this.$appdata.getParam(this.$refs.service_show.data.fields[i].label)
1283
+ }
1284
+ }
1285
+ }
1286
+
1287
+ if (this.$refs.service_show.data.fields[index].label === '气价类型') {
1288
+ let gasproperties = ''
1289
+ for(let i=0;i<this.$refs.service_show.data.fields.length;i++){
1290
+ if(this.$refs.service_show.data.fields[i].label=='用气性质'){
1291
+ gasproperties= this.$refs.service_show.data.fields[i].value
1292
+ }
1293
+ if(this.$refs.service_show.data.fields[i].label=='气价名称'){
1294
+ this.$refs.service_show.data.fields[i].value=''
1295
+ }
1296
+
1297
+ }
1298
+
1299
+ let pricetype=this.$refs.service_show.data.fields[index].value
1300
+ let http = new HttpResetClass()
1301
+ let condition =`f_user_type = '${this.selectdata.f_user_type}' and f_filiale = '${this.$login.f.f_fengongsi}'
1302
+ and f_gasproperties = '${gasproperties}' and f_price_type = '${this.$refs.service_show.data.fields[index].value}'`
1303
+ let res = await http.load('POST', 'rs/logic/getRecordItem', {condition}, {resolveMsg: null, rejectMsg: null})
1304
+ console.log('获取的气价类型,',res)
1305
+ let house2 = []
1306
+ if (res.data.pricename) {
1307
+ for (let row of res.data.pricename){
1308
+ house2.push({label: row.f_price_name,value: {id:row.f_price_id,name:row.f_price_name}})
1309
+ }
1310
+ }
1311
+
1312
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1313
+ if (this.$refs.service_show.data.fields[i].label === '气价名称') {
1314
+ this.$refs.service_show.data.fields[i].options= house2
1315
+ }
1316
+ }
1317
+ }
1318
+
1319
+ if (this.$refs.service_show.data.fields[index].label === '气价名称') { //用气性质
1320
+ if(this.$refs.service_show.data.fields[index].value&&typeof this.$refs.service_show.data.fields[index].value =='object'){
1321
+ for(let i=0;i<this.$refs.service_show.data.fields.length;i++){
1322
+ if(this.$refs.service_show.data.fields[i].label=='气价id'){
1323
+ this.$refs.service_show.data.fields[i].value= Number(this.$refs.service_show.data.fields[index].value.id)
1324
+ }
1325
+ }
1326
+ this.$refs.service_show.data.fields[index].value= this.$refs.service_show.data.fields[index].value.name
1327
+ }
1328
+ }
1329
+
1330
+ if (this.$refs.service_show.data.fields[index].label === '报建类型') {
1331
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1332
+ if (this.$refs.service_show.data.fields[i].label == '用户类型') {
1333
+ if (this.$refs.service_show.data.fields[index].value.includes('民用')) {
1334
+ this.$refs.service_show.data.fields[i].value = '民用'
1335
+ } else {
1336
+ this.$refs.service_show.data.fields[i].value = '非民用'
1337
+ }
1338
+ this.$refs.service_show.update()
1339
+ return
1340
+ }
1341
+ }
1342
+ }
1343
+
1344
+ if (this.$refs.service_show.data.fields[index].label === '表号') {
1345
+ if(this.$refs.service_show.data.fields[index].value){
1346
+ let http = new HttpResetClass()
1347
+ let data = {
1348
+ columnname: ` uf.f_meternumber `,
1349
+ tablename: ' t_userfiles uf LEFT JOIN t_userinfo ui on ui.f_userinfo_id = uf.f_userinfo_id ',
1350
+ condition: `(f_user_state = '正常' or f_user_state = '报装') and uf.f_meternumber = '${this.$refs.service_show.data.fields[index].value}' and ui.f_process_id != '${this.selectdata.f_process_id}'`
1351
+ }
1352
+ let res = await http.load('POST', 'rs/sql/getdistinct', {data: data}, {
1353
+ resolveMsg: null,
1354
+ rejectMsg: "表号查询失败"
1355
+ })
1356
+ if(res.data.length>0){
1357
+ this.$showMessage("警告:表号已被使用!请查证")
1358
+ }
1359
+ }
1360
+ }
1361
+
1362
+ if (this.$refs.service_show.data.fields[index].label === '安装表数'&&this.$refs.service_show.data.fields[index].value==1) {
1363
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++){
1364
+ if (this.$refs.service_show.data.fields[i].label === '用户类型'){
1365
+ // =this.$refs.service_show.data.fields[i].value
1366
+ }
1367
+ }
1368
+ }
1369
+
1370
+ if (this.data.f_install_num == 1 && this.$refs.service_show.data.fields[index].label === '是否有表') {
1371
+ if (this.$refs.service_show.data.fields[index].value == "是") {
1372
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1373
+ if (this.$refs.service_show.data.fields[i].label === '气表品牌'
1374
+ || this.$refs.service_show.data.fields[i].label === '气表型号'
1375
+ || this.$refs.service_show.data.fields[i].label === '左右表'
1376
+ || this.$refs.service_show.data.fields[i].label === '表号'
1377
+ || this.$refs.service_show.data.fields[i].label === '气表厂家') {
1378
+ this.$refs.service_show.data.fields[i].hidden = false
1379
+ this.$refs.service_show.data.fields[i].required = true
1380
+ } else if (this.selectdata.defname == '通气' && this.$refs.service_show.data.fields[i].label === '通气表号') {
1381
+ this.$refs.service_show.data.fields[i].hidden = false
1382
+ this.$refs.service_show.data.fields[i].required = true
1383
+ }
1384
+ }
1385
+ } else {
1386
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1387
+ if (this.$refs.service_show.data.fields[i].label === '气表品牌'
1388
+ || this.$refs.service_show.data.fields[i].label === '气表型号'
1389
+ || this.$refs.service_show.data.fields[i].label === '表号'
1390
+ || this.$refs.service_show.data.fields[i].label === '左右表'
1391
+ || this.$refs.service_show.data.fields[i].label === '气表厂家') {
1392
+ this.$refs.service_show.data.fields[i].hidden = true
1393
+ this.$refs.service_show.data.fields[i].required = false
1394
+ } else if (this.selectdata.defname == '通气' && this.$refs.service_show.data.fields[i].label === '通气表号') {
1395
+ this.$refs.service_show.data.fields[i].hidden = true
1396
+ this.$refs.service_show.data.fields[i].required = false
1397
+ }
1398
+ }
1399
+ }
1400
+ }
1401
+ if (this.$refs.service_show.data.fields[index].label === '气表品牌') {
1402
+ // console.log("气表品牌>>>>>"+JSON.stringify(this.$refs.service_show.data.fields[index].value))
1403
+ let id = null
1404
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1405
+ if (this.$refs.service_show.data.fields[i].label == '气表型号') {
1406
+ this.$refs.service_show.data.fields[i].value = ''
1407
+ let temp = {}
1408
+ // console.log("this.$refs.service_show.data.fields[index].value",this.$refs.service_show.data.fields[index].value)
1409
+ if(typeof this.$refs.service_show.data.fields[index].value =='string'){
1410
+ for (let x = 0; x < Vue.ApplyGetSaleParam.gasbrands.length; x++) {
1411
+ if (Vue.ApplyGetSaleParam.gasbrands[x].label == this.$refs.service_show.data.fields[index].value) {
1412
+ temp = Vue.ApplyGetSaleParam.gasbrands[x].value.gasmodel
1413
+ id = Vue.ApplyGetSaleParam.gasbrands[x].value.id
1414
+ }
1415
+ }
1416
+ // let temp = this.$refs.service_show.data.fields[index].value.gasmodel
1417
+ this.$refs.service_show.data.fields[i].options = temp
1418
+ this.$refs.service_show.data.fields[index].value = typeof this.$refs.service_show.data.fields[index].value == 'string' ? this.$refs.service_show.data.fields[index].value : this.$refs.service_show.data.fields[index].value.f_meter_brand
1419
+ }else{
1420
+ id= Number(this.$refs.service_show.data.fields[index].value.id)
1421
+ let http = new HttpResetClass()
1422
+ let data = {
1423
+ columnname: 'f_meter_style,id',
1424
+ tablename: 't_gasmodel ',
1425
+ condition: ` f_gasbrand_id = ${this.$refs.service_show.data.fields[index].value.id} `
1426
+ }
1427
+ let res = await http.load('POST', 'rs/sql/getdistinct', {data: data}, {resolveMsg: null, rejectMsg: '获取气表型号失败'})
1428
+ this.$refs.service_show.data.fields[i].options=[]
1429
+ for(let x=0;x<res.data.length;x++){
1430
+ this.$refs.service_show.data.fields[i].options.push({label:res.data[x].f_meter_style,value:{id:res.data[x].id,name:res.data[x].f_meter_style}})
1431
+ }
1432
+ console.log("气表型号",this.$refs.service_show.data.fields[i].options)
1433
+ // for (let x = 0; x < Vue.ApplyGetSaleParam.gasbrands.length; x++) {
1434
+ // if (Vue.ApplyGetSaleParam.gasbrands[x].label == this.$refs.service_show.data.fields[index].value.f_meter_brand) {
1435
+ // temp = Vue.ApplyGetSaleParam.gasbrands[x].value.gasmodel
1436
+ // id = Vue.ApplyGetSaleParam.gasbrands[x].value.id
1437
+ // }
1438
+ // }
1439
+ // // let temp = this.$refs.service_show.data.fields[index].value.gasmodel
1440
+ // this.$refs.service_show.data.fields[i].options = temp
1441
+ // this.$refs.service_show.data.fields[index].value = typeof this.$refs.service_show.data.fields[index].value == 'string' ? this.$refs.service_show.data.fields[index].value : this.$refs.service_show.data.fields[index].value.f_meter_brand
1442
+ }
1443
+
1444
+
1445
+ // this.$refs.service_show.update()
1446
+ } else if (this.$refs.service_show.data.fields[i].label == '气表品牌id') {
1447
+ this.$refs.service_show.data.fields[i].value = id
1448
+ }
1449
+ }
1450
+ for(let i = 0; i < this.$refs.service_show.data.fields.length; i++){
1451
+ if (this.$refs.service_show.data.fields[i].label == '气表品牌id') {
1452
+ this.$refs.service_show.data.fields[i].value = id
1453
+ }
1454
+ }
1455
+ this.$refs.service_show.update()
1456
+ }
1457
+ if (this.$refs.service_show.data.fields[index].label === '气表型号') {
1458
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1459
+ if (this.$refs.service_show.data.fields[i].label == '气表型号id') {
1460
+ this.$refs.service_show.data.fields[i].value = Number(this.$refs.service_show.data.fields[index].value.id)
1461
+ // console.log("气表型号id:",this.$refs.service_show.data.fields[i].value)
1462
+ }else if(this.$refs.service_show.data.fields[i].label == '气表品牌'&&typeof this.$refs.service_show.data.fields[i].value =='object'){
1463
+ this.$refs.service_show.data.fields[i].value = this.$refs.service_show.data.fields[i].value.name
1464
+ }
1465
+ }
1466
+ this.$refs.service_show.data.fields[index].value = this.$refs.service_show.data.fields[index].value.name
1467
+ this.$refs.service_show.update()
1468
+ return
1469
+ }
1470
+
1471
+
1472
+ if (this.$refs.service_show.data.fields[index].label == '电话号码') {
1473
+ let phone = this.$refs.service_show.data.fields[index].value
1474
+ // 电话号码效验
1475
+ if (!(/^1[3456789]\d{9}$/.test(phone))) {
1476
+ this.$refs.service_show.data.fields[index].value = ""
1477
+ this.$showAlert('电话号码格式不正确,请重新输入。', 'info', 2000)
1478
+ }
1479
+ }
1480
+
1481
+ if (this.$refs.service_show.data.fields[index].label == '施工单位' ||
1482
+ this.$refs.service_show.data.fields[index].label == '检测单位' ||
1483
+ this.$refs.service_show.data.fields[index].label == '监理单位' ||
1484
+ this.$refs.service_show.data.fields[index].label == '土建单位' ||
1485
+ this.$refs.service_show.data.fields[index].label == '设计单位') {
1486
+ console.log(this.$refs.service_show.data.fields[index].label,this.$refs.service_show.data.fields[index].value)
1487
+ this.$refs.service_show.update()
1488
+ return
1489
+ }
1490
+
1491
+ if (
1492
+ this.$refs.service_show.data.fields[index].label === '最终核算成本金额' ||
1493
+ this.$refs.service_show.data.fields[index].label === '合同总金额' ||
1494
+ this.$refs.service_show.data.fields[index].label === '工程盈利'
1495
+ ) {
1496
+
1497
+ var a = 0
1498
+ var b = 0
1499
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1500
+ // 控制设置级联
1501
+ // 源select所选的值 this.$refs.service_show.data.activitys.fields[index].value
1502
+ // xxx xx xxx
1503
+ if (this.$refs.service_show.data.fields[i].label === '最终核算成本金额') {
1504
+ this.$refs.service_show.data.fields[i].value = (this.number + this.cost + this.anzhuangsum + this.tujiansum)
1505
+ a = this.$refs.service_show.data.fields[i].value
1506
+ }
1507
+
1508
+ if (this.$refs.service_show.data.fields[i].label === '合同总金额' && this.$refs.service_show.data.fields[i].value) {
1509
+ b = this.$refs.service_show.data.fields[i].value
1510
+ }
1511
+ }
1512
+ var c = b - a
1513
+ // 数据计算完毕得到工程结余
1514
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1515
+ if (this.$refs.service_show.data.fields[i].label === '工程盈利') {
1516
+ this.$refs.service_show.data.fields[i].value = c
1517
+ }
1518
+ }
1519
+ }
1520
+
1521
+ if (this.$refs.service_show.showadd_fields && this.$refs.service_show.showadd_fields.length > 0 && this.$refs.service_show.showadd_fields[index].label === '收费金额') {
1522
+ let chargeMoney = this.$refs.service_show.showadd_fields[index].value
1523
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1524
+ if (this.$refs.service_show.data.fields[i].label === '未结总金额') {
1525
+ let cumulativeMoney = this.$refs.service_show.data.fields[i].value
1526
+ if (Number(chargeMoney) > Number(cumulativeMoney)) {
1527
+ this.$showMessage("收费金额不得大于未结总金额!")
1528
+ this.$refs.service_show.showadd_fields[index].value = null
1529
+ return
1530
+ } else {
1531
+
1532
+ }
1533
+ }
1534
+ }
1535
+ }
1536
+
1537
+ //根据合同预算金额和累计缴费金额计算未结金额
1538
+ if (this.$refs.service_show.data.fields[index] && this.$refs.service_show.data.fields[index].label === '累计缴费金额') {
1539
+ let cumulativeMoney = this.$refs.service_show.data.fields[index].value
1540
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1541
+ if (this.$refs.service_show.data.fields[i].label === '未结总金额') {
1542
+ this.$refs.service_show.data.fields[i].value = Number(this.selectdata.f_contract_money) - Number(cumulativeMoney)
1543
+ }
1544
+ }
1545
+ }
1546
+ //根据合同预算金额和累计开票金额计算未开票金额
1547
+ if (this.$refs.service_show.data.fields[index].label === '累计开票金额') {
1548
+ let residualInvoicing = this.$refs.service_show.data.fields[index].value
1549
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1550
+ if (this.$refs.service_show.data.fields[i].label === '未开票金额') {
1551
+ this.$refs.service_show.data.fields[i].value = Number(this.selectdata.f_contract_total_money) - Number(residualInvoicing)
1552
+ }
1553
+ }
1554
+ }
1555
+ //如果资料验收是否通过和工程验收是否通过为否的时候弹出原因填写框
1556
+ if (this.$refs.service_show.data.fields[index].label === '资料验收是否通过') {
1557
+ let res = this.$refs.service_show.data.fields[index].value
1558
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1559
+ if (this.$refs.service_show.data.fields[i].label === '资料验收不通过原因') {
1560
+ if (res === '否') {
1561
+ this.$refs.service_show.data.fields[i].hidden = false
1562
+ this.$refs.service_show.data.fields[i].required = true
1563
+ } else {
1564
+ this.$refs.service_show.data.fields[i].hidden = true
1565
+ this.$refs.service_show.data.fields[i].required = false
1566
+ }
1567
+ }
1568
+ }
1569
+ }
1570
+ if (this.$refs.service_show.data.fields[index].label === '工程验收是否通过') {
1571
+ let res = this.$refs.service_show.data.fields[index].value
1572
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1573
+ if (this.$refs.service_show.data.fields[i].label === '工程验收不通过原因') {
1574
+ if (res === '否') {
1575
+ this.$refs.service_show.data.fields[i].hidden = false
1576
+ this.$refs.service_show.data.fields[i].required = true
1577
+ } else {
1578
+ this.$refs.service_show.data.fields[i].hidden = true
1579
+ this.$refs.service_show.data.fields[i].required = false
1580
+ }
1581
+ }
1582
+ }
1583
+ }
1584
+ //根据总户数和实际安装表数计算未安装表数
1585
+ // if (this.$refs.service_show.data.fields[index].label === '实际安装表数') {
1586
+ // let value = this.$refs.service_show.data.fields[index].value
1587
+ // for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1588
+ // if (this.$refs.service_show.data.fields[i].label === '未安装表数') {
1589
+ // this.$refs.service_show.data.fields[i].label === '未安装表数'
1590
+ // this.$refs.service_show.data.fields[i].value = Number(this.selectdata.f_install_num) - Number(value)
1591
+ // }
1592
+ // }
1593
+ // }
1594
+
1595
+ //金额小写得到大写
1596
+ if (this.$refs.service_show.showadd_fields && this.$refs.service_show.showadd_fields.length > 0 && this.$refs.service_show.showadd_fields.fields[index].label === '收费金额') {
1597
+ if (this.$refs.service_show.showadd_fields[index].value || this.$refs.service_show.showadd_fields.fields[index].value) {
1598
+ var re = /^[0-9]+.?[0-9]*/
1599
+ let temp = this.$refs.service_show.showadd_fields[index].value
1600
+ if (temp == "" || isNaN(temp)) {
1601
+ this.$showMessage("请输入纯数字")
1602
+ this.$refs.service_show.showadd_fields[index].value = 0
1603
+ }
1604
+ }
1605
+ let temp = this.$refs.service_show.showadd_fields[index]
1606
+ let value = temp.value
1607
+ // let chargeMoney = this.$refs.service_show.showadd_fields[index].value
1608
+ for (let i = 0; i < this.$refs.service_show.showadd_fields.fields.length; i++) {
1609
+ if (this.$refs.service_show.showadd_fields.fields[i].label === '金额大写') {
1610
+ let te = {
1611
+ value: this.smalltoBIG(value)
1612
+ }
1613
+ this.$refs.service_show.showadd_fields[i] = te
1614
+ }
1615
+ }
1616
+ }
1617
+
1618
+
1619
+ if (this.$refs.service_show.data.fields[index].label === '县/区') {
1620
+ let temp = this.$refs.service_show.data.fields[index].value
1621
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1622
+ // 控制设置级联
1623
+ // 源select所选的值 this.$refs.service_show.data.activitys.fields[index].value
1624
+ if (this.$refs.service_show.data.fields[i].label === '片区') {
1625
+ this.$refs.service_show.data.fields[i].value = ''
1626
+ this.$refs.service_show.data.fields[i].options = []
1627
+ let rs = []
1628
+ console.log('小区片区。。。', temp)
1629
+ for (let j = 0; j < this.$login.f.f_allArea.length; j++) {
1630
+ if (this.$login.f.f_allArea[j].label === temp) {
1631
+ rs = this.$login.f.f_allArea[j].value
1632
+ }
1633
+ }
1634
+ console.log('获取小区片区=>' + JSON.stringify(rs))
1635
+ this.$refs.service_show.data.fields[i].options = [{label: '全部', value: ''}, ...rs]
1636
+ this.$refs.service_show.update()
1637
+ }
1638
+ }
1639
+ }
1640
+ //控制尾款
1641
+ if (
1642
+ this.$refs.service_show.data.fields[index].label === '合同金额' ||
1643
+ this.$refs.service_show.data.fields[index].label === '首付' ||
1644
+ this.$refs.service_show.data.fields[index].label === '进度款' ||
1645
+ this.$refs.service_show.data.fields[index].label === '尾款'
1646
+ ) {
1647
+ console.log('即将计算合同金额')
1648
+ var cash = 0
1649
+ var downpayments = 0
1650
+ var tailmoney = 0
1651
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1652
+ // 控制设置级联
1653
+ // 源select所选的值 this.$refs.service_show.data.activitys.fields[index].value
1654
+ // xxx xx xxx
1655
+ if (this.$refs.service_show.data.fields[i].label === '合同金额' && this.$refs.service_show.data.fields[i].value) {
1656
+ cash = this.$refs.service_show.data.fields[i].value
1657
+ }
1658
+ if (this.$refs.service_show.data.fields[i].label === '首付' && this.$refs.service_show.data.fields[i].value) {
1659
+ downpayments = this.$refs.service_show.data.fields[i].value
1660
+ }
1661
+ if (this.$refs.service_show.data.fields[i].label === '进度款' && this.$refs.service_show.data.fields[i].value) {
1662
+ tailmoney = this.$refs.service_show.data.fields[i].value
1663
+ }
1664
+ }
1665
+ var a = cash - downpayments
1666
+ a= a.toFixed(2)
1667
+ // 数据计算完毕得到尾款
1668
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1669
+ if (this.$refs.service_show.data.fields[i].label === '尾款') {
1670
+ if (cash === downpayments) {
1671
+ this.$refs.service_show.data.fields[i].value = 0
1672
+ } else {
1673
+ this.$refs.service_show.data.fields[i].value = (cash - downpayments - tailmoney)
1674
+ this.$refs.service_show.data.fields[i].value=this.$refs.service_show.data.fields[i].value.toFixed(2)
1675
+ console.log('修改fields[i].value后的值=>' + this.$refs.service_show.data.fields[i].value)
1676
+ }
1677
+ }
1678
+ if (this.$refs.service_show.data.fields[i].label === '首付') {
1679
+ if (a < 0) {
1680
+ this.$showMessage("首付款数额过大")
1681
+ downpayments = 0
1682
+ this.$refs.service_show.data.fields[i].value = 0
1683
+ }
1684
+ }
1685
+
1686
+ if (this.$refs.service_show.data.fields[i].label === '进度款') {
1687
+
1688
+ if (cash === downpayments) {
1689
+ tailmoney = 0
1690
+ this.$refs.service_show.data.fields[i].value = 0
1691
+ this.$refs.service_show.data.fields[i].readonly = true
1692
+ } else {
1693
+ this.$refs.service_show.data.fields[i].readonly = false
1694
+ tailmoney = this.$refs.service_show.data.fields[i].value
1695
+ }
1696
+ if (tailmoney > a) {
1697
+ this.$showMessage("进度款数额过大")
1698
+ tailmoney = 0
1699
+ this.$refs.service_show.data.fields[i].value = 0
1700
+ }
1701
+ }
1702
+ }
1703
+ }
1704
+ //新增的功能逻辑-------------
1705
+ //报建状态的改变
1706
+ if (this.selectdata.defname != '完工') {
1707
+ this.selectdata.f_sub_state = '正在进行'
1708
+ }
1709
+ //所有选择框/输入框遍历
1710
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1711
+ //任何是否的选择框只要是否都不能提交
1712
+ if (this.selectdata.defname != '客户申请') {
1713
+ if (this.$refs.service_show.data.fields[i].value === '否') {
1714
+ this.$refs.service_show.disable_button = false
1715
+ console.log(this.$refs.service_show.data)
1716
+ this.$refs.service_show.data.buttons[1].button_name = '保存'
1717
+ this.$showMessage("当审核/确认为否时,无法提交")
1718
+ return
1719
+ }else {
1720
+ this.$refs.service_show.data.buttons[1].button_name = '提交'
1721
+ }
1722
+ }
1723
+ //时间到期提醒
1724
+ if (this.$refs.service_show.data.fields[i].label.includes("时间") || this.$refs.service_show.data.fields[i].label.includes("工期")) {
1725
+ let setTime = this.$refs.service_show.data.fields[i].value
1726
+ let nowTime = new Date().Format("yyyy-MM-dd HH:mm:ss")
1727
+ console.log("到期时间:" + setTime)
1728
+ console.log("现在时间:" + nowTime)
1729
+ if (nowTime >= setTime) {
1730
+ this.$showMessage("请注意,当前节点时间/工期已过期!")
1731
+ }
1732
+ }
1733
+ if (this.$refs.service_show.data.fields[i].label.includes("验收结果")) {
1734
+
1735
+ if (this.$refs.service_show.data.fields[i].value.length == 0 || this.$refs.service_show.data.fields[i].value == undefined || this.$refs.service_show.data.fields[i].value == null){
1736
+ this.$showMessage("验收结果未填写完毕,无法提交")
1737
+ this.$refs.service_show.data.buttons[1].button_name = '保存'
1738
+ }
1739
+
1740
+ }
1741
+ }
1742
+
1743
+
1744
+ // 合成地址
1745
+ if (
1746
+ this.$refs.service_show.data.fields[index].label === '县/区'
1747
+ ) {
1748
+ console.log('即将合成地址')
1749
+ var address = ''
1750
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1751
+ // 控制设置级联
1752
+ // 源select所选的值 this.$refs.service_show.data.activitys.fields[index].value
1753
+ // xxx xx xxx
1754
+ if (this.$refs.service_show.data.fields[i].label === '县/区' && this.$refs.service_show.data.fields[i].value) {
1755
+ address += this.$refs.service_show.data.fields[i].value
1756
+ }
1757
+ // if (this.$refs.service_show.data.fields[i].label === '乡镇' && this.$refs.service_show.data.fields[i].value) {
1758
+ // address += this.$refs.service_show.data.fields[i].value
1759
+ // }
1760
+ // if (this.$refs.service_show.data.fields[i].label === '街道名称' && this.$refs.service_show.data.fields[i].value) {
1761
+ // address += this.$refs.service_show.data.fields[i].value
1762
+ // }
1763
+ // if (this.$refs.service_show.data.fields[i].label === '小区/单位' && this.$refs.service_show.data.fields[i].value) {
1764
+ // address += this.$refs.service_show.data.fields[i].value
1765
+ // }
1766
+ // if (this.$refs.service_show.data.fields[i].label === '楼号' && this.$refs.service_show.data.fields[i].value) {
1767
+ // address += ' ' + this.$refs.service_show.data.fields[i].value
1768
+ // }
1769
+ // if (this.$refs.service_show.data.fields[i].label === '单元号' && this.$refs.service_show.data.fields[i].value) {
1770
+ // address += '-' + this.$refs.service_show.data.fields[i].value
1771
+ // }
1772
+ // if (this.$refs.service_show.data.fields[i].label === '楼层' && this.$refs.service_show.data.fields[i].value) {
1773
+ // address += '-' + this.$refs.service_show.data.fields[i].value
1774
+ // }
1775
+ // if (this.$refs.service_show.data.fields[i].label === '门牌号' && this.$refs.service_show.data.fields[i].value) {
1776
+ // address += '-' + this.$refs.service_show.data.fields[i].value
1777
+ // }
1778
+
1779
+ }
1780
+ console.log('获取到的address=>' + address)
1781
+ // 数据获取完毕时放入地址text
1782
+ // for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1783
+ // if (this.$refs.service_show.data.fields[i].label === '地址') {
1784
+ // this.$refs.service_show.data.fields[i].value = address
1785
+ // console.log('修改fields[i].value后的值=>' + this.$refs.service_show.data.fields[i].value)
1786
+ // }
1787
+ // }
1788
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1789
+ if (this.$refs.service_show.data.fields[i].label === '项目地址') {
1790
+ this.$refs.service_show.data.fields[i].value = address
1791
+ // console.log('修改fields[i].value后的值=>' + this.$refs.service_show.data.fields[i].value)
1792
+ }
1793
+ }
1794
+ }
1795
+ if (this.selectdata.defname == '现场勘察') {
1796
+ let projectAddress = ''
1797
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1798
+ if (this.$refs.service_show.data.fields[i].label === '项目地址') {
1799
+ projectAddress = this.$refs.service_show.data.fields[i].value
1800
+ }
1801
+ }
1802
+ for (let j = 0; j < this.$refs.service_show.data.fields.length; j++) {
1803
+ if (this.$refs.service_show.data.fields[j].label === '地址') {
1804
+ this.$refs.service_show.data.fields[j].value = projectAddress
1805
+ }
1806
+ }
1807
+
1808
+ }
1809
+
1810
+ // 开户费+材料费+人工费+设备安装费=合计
1811
+ if (this.$refs.service_show.data.fields[index].label === '开户费' ||
1812
+ this.$refs.service_show.data.fields[index].label === '材料费' ||
1813
+ this.$refs.service_show.data.fields[index].label === '人工费' ||
1814
+ this.$refs.service_show.data.fields[index].label === '设备安装费') {
1815
+ let fee = 0
1816
+ for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
1817
+ if (this.$refs.service_show.data.fields[index].label === '开户费' ||
1818
+ this.$refs.service_show.data.fields[index].label === '材料费' ||
1819
+ this.$refs.service_show.data.fields[index].label === '人工费' ||
1820
+ this.$refs.service_show.data.fields[index].label === '设备安装费') {
1821
+ fee += Number(this.$refs.service_show.data.fields[index].value)
1822
+ }
1823
+ if (this.$refs.service_show.data.fields[index].label === '合计') {
1824
+ this.$refs.service_show.data.fields[index].value = fee
1825
+ }
1826
+ }
1827
+
1828
+ }
1829
+ },
1830
+ error_check(index) {
1831
+ // 时间格式检测
1832
+ if (this.$refs.service_show.data.fields[index].type == 'datepicker') {
1833
+ let dateRe = new RegExp(/(([0-9]{3}[1-9]|[0-9]{2}[1-9][0-9]{1}|[0-9]{1}[1-9][0-9]{2}|[1-9][0-9]{3})-(((0[13578]|1[02])-(0[1-9]|[12][0-9]|3[01]))|((0[469]|11)-(0[1-9]|[12][0-9]|30))|(02-(0[1-9]|[1][0-9]|2[0-8]))))|((([0-9]{2})(0[48]|[2468][048]|[13579][26])|((0[48]|[2468][048]|[3579][26])00))-02-29)$/)
1834
+ let datetimeRe = new RegExp(/((([0-9]{3}[1-9]|[0-9]{2}[1-9][0-9]{1}|[0-9]{1}[1-9][0-9]{2}|[1-9][0-9]{3})-(((0[13578]|1[02])-(0[1-9]|[12][0-9]|3[01]))|((0[469]|11)-(0[1-9]|[12][0-9]|30))|(02-(0[1-9]|[1][0-9]|2[0-8]))))|((([0-9]{2})(0[48]|[2468][048]|[13579][26])|((0[48]|[2468][048]|[3579][26])00))-02-29))\s([0-1][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])$/)
1835
+ if (datetimeRe.test(this.$refs.service_show.data.fields[index].value) && this.$refs.service_show.data.fields[index].value.trim().length == 19 && this.$refs.service_show.data.fields[index].fullsize) {
1836
+ this.$refs.service_show.data.fields[index].error.flag = false
1837
+ } else if (dateRe.test(this.$refs.service_show.data.fields[index].value) && this.$refs.service_show.data.fields[index].value.trim().length == 10) {
1838
+ this.$refs.service_show.data.fields[index].error.flag = false
1839
+ } else {
1840
+ if (this.$refs.service_show.data.fields[index].fullsize) {
1841
+ this.$refs.service_show.data.fields[index].error = Object.assign({}, this.$refs.service_show.data.fields[index].error)
1842
+ this.$refs.service_show.data.fields[index].error.msg = this.$refs.service_show.data.fields[index].error.msg ? this.$refs.service_show.data.fields[index].error.msg : '时间格式如:2019-05-02 09:23:21'
1843
+ this.$showAlert(this.$refs.service_show.data.fields[index].label + '格式错误' + this.$refs.service_show.data.fields[index].error.msg, 'warning', 3000)
1844
+ this.$refs.service_show.data.fields[index].error.flag = true
1845
+ this.$refs.service_show.data.fields[index].value = ''
1846
+ } else {
1847
+ this.$refs.service_show.data.fields[index].error = Object.assign({}, this.$refs.service_show.data.fields[index].error)
1848
+ this.$refs.service_show.data.fields[index].error.msg = this.$refs.service_show.data.fields[index].error.msg ? this.$refs.service_show.data.fields[index].error.msg : '时间格式如:2019-05-02'
1849
+ this.$showAlert(this.$refs.service_show.data.fields[index].label + '格式错误' + this.$refs.service_show.data.fields[index].error.msg, 'warning', 3000)
1850
+ this.$refs.service_show.data.fields[index].error.flag = true
1851
+ this.$refs.service_show.data.fields[index].value = ''
1852
+ }
1853
+
1854
+ }
1855
+ }
1856
+ },
1857
+
1858
+ modal_error_check(i, j) {
1859
+ let err = {flag: false, msg: ''}
1860
+ this.$refs.service_show.showadd_fields.fields[j].error = this.$refs.service_show.showadd_fields.fields[j].error ? this.$refs.service_show.showadd_fields.fields[j].error : err
1861
+ // 时间格式检测
1862
+ if (this.$refs.service_show.showadd_fields.fields[j].type == 'datepicker') {
1863
+ let dateRe = new RegExp(/(([0-9]{3}[1-9]|[0-9]{2}[1-9][0-9]{1}|[0-9]{1}[1-9][0-9]{2}|[1-9][0-9]{3})-(((0[13578]|1[02])-(0[1-9]|[12][0-9]|3[01]))|((0[469]|11)-(0[1-9]|[12][0-9]|30))|(02-(0[1-9]|[1][0-9]|2[0-8]))))|((([0-9]{2})(0[48]|[2468][048]|[13579][26])|((0[48]|[2468][048]|[3579][26])00))-02-29)$/)
1864
+ let datetimeRe = new RegExp(/((([0-9]{3}[1-9]|[0-9]{2}[1-9][0-9]{1}|[0-9]{1}[1-9][0-9]{2}|[1-9][0-9]{3})-(((0[13578]|1[02])-(0[1-9]|[12][0-9]|3[01]))|((0[469]|11)-(0[1-9]|[12][0-9]|30))|(02-(0[1-9]|[1][0-9]|2[0-8]))))|((([0-9]{2})(0[48]|[2468][048]|[13579][26])|((0[48]|[2468][048]|[3579][26])00))-02-29))\s([0-1][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])$/)
1865
+ if (datetimeRe.test(this.$refs.service_show.showadd_fields.fields[j].value) && this.$refs.service_show.showadd_fields.fields[j].value.trim().length == 19) {
1866
+ this.$refs.service_show.showadd_fields.fields[j].error.flag = false
1867
+ } else if (dateRe.test(this.$refs.service_show.showadd_fields.fields[j].value) && this.$refs.service_show.showadd_fields.fields[j].value.trim().length == 10) {
1868
+ this.$refs.service_show.showadd_fields.fields[j].error.flag = false
1869
+ } else {
1870
+ this.$refs.service_show.showadd_fields.fields[j].error = Object.assign({}, this.$refs.service_show.showadd_fields.fields[j].error)
1871
+ this.$refs.service_show.showadd_fields.fields[j].error.msg = this.$refs.service_show.showadd_fields.fields[j].label + '时间格式如:2019-05-02'
1872
+ this.$showAlert(this.$refs.service_show.showadd_fields.fields[j].error.msg, 'warning', 3000)
1873
+ this.$refs.service_show.showadd_fields.fields[j].error.flag = true
1874
+ this.$refs.service_show.showadd_fields.fields[j].value = ''
1875
+ }
1876
+ if ((this.$refs.service_show.showadd_fields.fields[j].label == '停气碰口开始时间' || this.$refs.service_show.showadd_fields.fields[j].label == '停气碰口结束时间') &&
1877
+ (dateRe.test(this.$refs.service_show.showadd_fields.fields[j].value) && this.$refs.service_show.showadd_fields.fields[j].value.trim().length > 0)) {
1878
+ if (this.$refs.service_show.showadd_fields.fields[j].value > new Date().Format("yyyy-MM-dd HH:mm:ss")) {
1879
+ this.$refs.service_show.showadd_fields.fields[j].error.msg = this.$refs.service_show.showadd_fields.fields[j].label + '不能大于当前时间'
1880
+ this.$showAlert(this.$refs.service_show.showadd_fields.fields[j].label + '不能大于当前时间', 'warning', 3000)
1881
+ this.$refs.service_show.showadd_fields.fields[j].error.flag = true
1882
+ this.$refs.service_show.showadd_fields.fields[j].value = ''
1883
+ }
1884
+ }
1885
+ }
1886
+ },
1887
+ 'getmodel'() {
1888
+ return this.$refs.service_show.getmodel()
1889
+ },
1890
+ // onetomany模态框监听事件
1891
+ async 'select_cascade_modal'(i, j) {
1892
+ if (this.data.onetomany[i].tables[0] == 't_apply_construct_balance') {
1893
+ if (this.data.onetomany[i].fields[j].label == '第三施工方') {
1894
+ for (let k = 0; k < this.data.onetomany[i].fields.length; k++) {
1895
+
1896
+ if (this.data.onetomany[i].fields[k].label.includes('当前累计结算比例')) {
1897
+ let sum = 0
1898
+ for (let p = 0; p < this.$refs.service_show.model.rows[i].length; p++) {
1899
+ if (this.$refs.service_show.model.rows[i][p].f_construct_company == this.$refs.service_show.showadd_fields.fields[j].value) {
1900
+ sum += Number(this.$refs.service_show.showadd_fields.fields[k - 2].value)
1901
+ sum += Number(this.$refs.service_show.model.rows[i][p].f_balance_scale)
1902
+ }
1903
+ }
1904
+ if (this.$refs.service_show.model.rows[i].length == 0) {
1905
+ sum = Number(this.$refs.service_show.showadd_fields.fields[k - 2].value)
1906
+ }
1907
+ // this.$refs.service_show.showadd_fields.fields[k].value = sum
1908
+ this.$refs.service_show.update_showadd_fields_value(k, sum)
1909
+ }
1910
+ }
1911
+ }
1912
+ }
1913
+
1914
+ if (this.data.onetomany[i].tables[0] == 't_use_gas_param') {
1915
+ if (this.data.onetomany[i].fields[j].label == '单台用气量Nm³/h') {
1916
+ if (this.$refs.service_show.showadd_fields.fields[j-1].value){
1917
+ let a = Number.parseInt(this.$refs.service_show.showadd_fields.fields[j-1].value)*Number.parseInt(this.$refs.service_show.showadd_fields.fields[j].value)
1918
+ this.$refs.service_show.showadd_fields.fields[j+1].value = a
1919
+ }else {
1920
+ this.$showAlert('数量不能为空!!','warning', 3000)
1921
+ }
1922
+ }
1923
+ if (this.data.onetomany[i].fields[j].label == '数量') {
1924
+ if (this.$refs.service_show.showadd_fields.fields[j+1].value){
1925
+ let a = Number.parseInt(this.$refs.service_show.showadd_fields.fields[j].value)*Number.parseInt(this.$refs.service_show.showadd_fields.fields[j+1].value)
1926
+ this.$refs.service_show.showadd_fields.fields[j+2].value = a
1927
+ }
1928
+ }
1929
+ }
1930
+
1931
+ },
1932
+ async 'onetomanyevent'(datas) {
1933
+ // console.log(`onetomany=======>${JSON.stringify(datas)}`)
1934
+
1935
+ for (let i = 0; i < datas.rows.length; i++) {
1936
+ datas.rows[i]['f_process_id'] = this.selectdata.f_process_id
1937
+ datas.rows[i]['f_apply_num'] = this.selectdata.f_apply_num
1938
+ datas.rows[i]['f_filiale'] = this.$login.f.f_fengongsi
1939
+ datas.rows[i]['f_parentname'] = this.$login.f.f_parentname
1940
+ datas.rows[i]['f_operator'] = this.$login.f.name
1941
+ }
1942
+ let http = new HttpResetClass()
1943
+ await http.load('POST', 'rs/logic/saveentity', datas, {resolveMsg: null, rejectMsg: '保存onetomany实体失败'})
1944
+ }
1945
+ ,
1946
+ // 获取view层button事件/
1947
+ async 'button'(model) {
1948
+ // 终止报建
1949
+ if(
1950
+ ( model.button.button_name === '提交' || model.button.button_name === '移交') &&
1951
+ (model.f_approach_flag === '未通过' || model.f_flag_start === '未通过' || model.f_install_idea_ys === '未通过' || model.f_material_flag === '未通过')
1952
+ ){
1953
+ let val = this.$refs.service_show.data
1954
+ delete val.id
1955
+ val.f_operat_type = '终止报建'
1956
+ val.f_state = '有效'
1957
+ val.f_describe = this.$refs.service_show.data.f_user_name + '已终止报建'
1958
+ val.processid = model.f_process_id
1959
+ val.f_operator = this.$login.f.name
1960
+ val.f_department = this.$login.f.f_department
1961
+ val.f_stop_remarks=this.$refs.service_show.data.defname+'未通过'
1962
+ let data ={
1963
+ tablename:'t_stopapply',
1964
+ parameters:val
1965
+ }
1966
+
1967
+ this.$refs.service_show.data.applyid = this.selectdata.id
1968
+ await this.$resetpost('rs/logic/save', {data:data})
1969
+ await this.$resetpost('rs/logic/stopapply', {data: this.$refs.service_show.data})
1970
+ this.$dispatch('close')
1971
+ this.initializtion()
1972
+ return
1973
+ }
1974
+ // console.log("button事件接收参数:", model)
1975
+ // 点击重置按钮就重置数据
1976
+ if (model.button.button_name === '重置') {
1977
+ this.refurbish()
1978
+ return
1979
+ }
1980
+
1981
+ this.dataChange(model.button.button_name)// 调用修改记录方法
1982
+
1983
+ if (model.button.button_name === '提交' && this.selectdata.defname == '营收数据录入'){
1984
+ if(model.f_meternumber){
1985
+ let http = new HttpResetClass()
1986
+ let data = {
1987
+ columnname: ` uf.f_meternumber `,
1988
+ tablename: ' t_userfiles uf LEFT JOIN t_userinfo ui on ui.f_userinfo_id = uf.f_userinfo_id ',
1989
+ condition: `(f_user_state = '正常' or f_user_state = '报装') and uf.f_meternumber = '${model.f_meternumber}' and ui.f_process_id != '${this.selectdata.f_process_id}'`
1990
+ }
1991
+ let res = await http.load('POST', 'rs/sql/getdistinct', {data: data}, {
1992
+ resolveMsg: null,
1993
+ rejectMsg: "表号查询失败"
1994
+ })
1995
+ if(res.data.length>0){
1996
+ let check = await this.$showMessage(`警告:表号已被使用!点击“确定”将会继续建档`, ['confirm', 'cancel'])
1997
+ if (check == 'confirm') {
1998
+
1999
+ } else {
2000
+ this.$refs.service_show.disable_button = false
2001
+ return
2002
+ }
2003
+ }
2004
+ }
2005
+ }
2006
+
2007
+
2008
+ // 若户数为1则新增档案
2009
+ if (model.button.button_name === '提交' && this.selectdata.defname == '通气' && this.selectdata.f_install_num == 1 && !(this.selectdata.f_apply_type == '管线整改' || this.selectdata.f_apply_type == '商业预埋管线'||this.selectdata.f_apply_type == '商业新建管线')) { //商业新建管线
2010
+ if (model.f_gas_meternumber != model.f_meternumber) {
2011
+
2012
+ let check = await this.$showMessage(`通气表号和施工安装表号不一致,点击"确定"将以通气表号为准建立表档案`, ['confirm', 'cancel'])
2013
+ if (check == 'confirm') {
2014
+ model.f_gas_meternumber_back = model.f_meternumber
2015
+ model.f_meternumber = model.f_gas_meternumber
2016
+ } else {
2017
+ this.$refs.service_show.disable_button = false
2018
+ return
2019
+ }
2020
+ }
2021
+ }
2022
+ // 派工单环节,如果累计领用量为0,则不让提交
2023
+ if (model.button.button_name === '提交' && this.selectdata.defname == '派工单') {
2024
+ let http4 = new HttpResetClass()
2025
+ let model2 = Object.assign({}, this.selectdata, model)
2026
+ let ret = await http4.load('POST', 'rs/logic/getSumForMaterial', model2, {resolveMsg: null, rejectMsg: null})
2027
+ if (ret.data[0].sum == null || ret.data[0].sum == 0) {
2028
+ this.$showAlert('未领取材料,不能提交!', 'warning', 3000)
2029
+ this.$refs.service_show.disable_button = false
2030
+ return
2031
+ }
2032
+ }
2033
+ // 施工环节 如果为民用集体散户而且没有导入用户资料弹框提并终止提交
2034
+ if (model.button.button_name === '提交' && this.selectdata.defname == '施工' && model.f_install_num > 1&& this.selectdata.f_apply_type == '民用集体散户' && this.$parent.$parent.$parent.$refs.record && this.$parent.$parent.$parent.$refs.record.model.rows.length == 0) {
2035
+ this.$showAlert('请在档案信息管理便签页导入用户档案!', 'warning', 3000)
2036
+ this.$refs.service_show.disable_button = false
2037
+ return
2038
+ }
2039
+ // 如果为内部投建项目点击提交 也为跳过收费
2040
+ if (model.button.button_name === '提交' && this.selectdata.defname == '合同审核' && this.selectdata.f_apply_type == '内部投建') {
2041
+ model.button.button_name === '跳过收费'
2042
+ }
2043
+ // 派工单环节 如果为民用散户 或者 整改 跳过 工程交底
2044
+ // || this.selectdata.f_apply_type.includes('整改') // 11月21日,古蕾姐说整改需要工程交底
2045
+ if (model.button.button_name === '提交' && this.selectdata.defname == '派工单' && (this.selectdata.f_apply_type.includes('民用散户'))) {
2046
+ model.button.button_name = '跳过工程交底'
2047
+ }
2048
+ var operate = ''
2049
+ // 判断当前按钮是否为特殊业务,即子流程提交或者分发
2050
+ if (model.button.button_name === '提交' && model.button.button_event && model.button.button_event === '子流程提交') {
2051
+ operate = '子流程提交'
2052
+ }
2053
+ if (model.button.button_name === '提交' && model.button.button_event && model.button.button_event === '合同信息') {
2054
+ model.f_budget_money = model.f_contract_money
2055
+ model.f_unaccounts_money = model.f_contract_money
2056
+ model.f_cumulative_money = 0
2057
+ model.f_cumulative_invoicing = 0
2058
+ model.f_additional_payment = 0
2059
+ model.f_residual_invoicing = model.f_contract_money
2060
+ }
2061
+ if (model.button.button_name === '下发') {
2062
+ if (model.button && model.button.button_event === '分发') {
2063
+ operate = '分发'
2064
+ }
2065
+ let array = this.$login.f.rolesnames.split(',')
2066
+ if (this.selectdata.defname == '任务分配' && array.includes("工程技术部负责人")) {
2067
+ model.f_survey_name = model.button.button_fields.f_apply_kefu_employee
2068
+ let buyerinfos = []
2069
+ let numReg = /^[0-9]+$/
2070
+ let numRe = new RegExp(numReg)
2071
+ let querydata = {
2072
+ tablename: 't_user',
2073
+ condition: ""
2074
+ }
2075
+ if (model.f_survey_name != null && "object" == typeof model.f_survey_name) {
2076
+ // object类型 切不为空
2077
+ querydata.condition = `id = ${model.f_survey_name.id}`
2078
+ } else if (numReg.test(model.f_survey_name)) {
2079
+ // 数字类型
2080
+ querydata.condition = `id = ${model.f_survey_name}`
2081
+ } else {
2082
+ // 字符串类型
2083
+ querydata.condition = `name = '${model.f_survey_name}'`
2084
+ }
2085
+ buyerinfos = await this.$resetpost('rs/sql/singleTable', {data: querydata}, {
2086
+ resolveMsg: null,
2087
+ rejectMsg: '获取人员失败'
2088
+ })
2089
+ model.f_survey_name = {
2090
+ id: buyerinfos.data[0].id,
2091
+ name: buyerinfos.data[0].name
2092
+ }
2093
+ }
2094
+ // model.button.button_fields[this.show_data.buttons[model.button.button_index].button_fields[0].field]
2095
+ // for (let i = 0; i < this.department_search.length; i++) {
2096
+ // 找到人名为person_name 的人,然后把人名换成id
2097
+ // if (this.department_search[i].name === person_name) {
2098
+ // model.button.button_fields[this.show_data.buttons[model.button.button_index].button_fields[0].field] = this.department_search[i].id
2099
+ // }
2100
+ // }
2101
+ }
2102
+ if (model.button.button_name == '跳过收费' && this.selectdata.defname == '合同审核' && this.selectdata.f_apply_type.includes('民用') && this.selectdata.f_apply_type != '民用整改') {
2103
+ model.button.button_name = '提交'
2104
+ model.button.button_person = {
2105
+ button_event: "获取之前被下发人",
2106
+ button_person_field: "f_survey_name"
2107
+ }
2108
+ }
2109
+
2110
+
2111
+ if (model.button.button_name == '提交' && model.button.button_person && model.button.button_person.button_event === '获取之前被下发人' && model.button.button_person.button_person_field) {
2112
+ if ((this.selectdata.defname == '收费' || this.selectdata.defname == '合同审核') && this.selectdata.f_apply_type.includes('民用散户')) {
2113
+ model.button.button_person = {
2114
+ button_event: "获取之前被下发人",
2115
+ button_person_field: 'f_apply_kefu_employee'
2116
+ }
2117
+ model.button.button_fields['f_apply_kefu_employee'] = model.f_apply_kefu_employee
2118
+ }
2119
+ model.button.button_name = '下发'
2120
+ model.button.button_fields = {}
2121
+ let buyerinfos = []
2122
+ let numReg = /^[0-9]+$/
2123
+ let numRe = new RegExp(numReg)
2124
+ if (this.selectdata[model.button.button_person.button_person_field].startsWith('{')) {
2125
+ let temp = JSON.parse(this.selectdata[model.button.button_person.button_person_field])
2126
+ model.button.button_fields[model.button.button_person.button_person_field] = temp.id
2127
+ } else if (!numRe.test(this.selectdata[model.button.button_person.button_person_field])) {
2128
+ console.log('model.button.button_person.button_person_field========>',model.button.button_person.button_person_field)
2129
+ console.log('this.selectdata[model.button.button_person.button_person_field]========>',this.selectdata[model.button.button_person.button_person_field])
2130
+ let temp = this.selectdata[model.button.button_person.button_person_field]
2131
+ let querydata = {
2132
+ tablename: 't_user',
2133
+ condition: `name = '${temp}'`
2134
+ }
2135
+ console.log('querydata========>',querydata)
2136
+ let userinfo = await this.$resetpost('rs/sql/singleTable', {data: querydata}, {
2137
+ resolveMsg: null,
2138
+ rejectMsg: '获取人员失败'
2139
+ })
2140
+ console.log('userinfo========>',userinfo)
2141
+ if(userinfo.data&&userinfo.data.length!=0){
2142
+ model.button.button_fields[model.button.button_person.button_person_field] = {
2143
+ id: userinfo.data[0].id,
2144
+ name: userinfo.data[0].name
2145
+ }
2146
+ }
2147
+ } else {
2148
+ model.button.button_fields[model.button.button_person.button_person_field] = this.selectdata[model.button.button_person.button_person_field]
2149
+ }
2150
+ }
2151
+
2152
+ // if (model.button.button_name!='保存'&&model.button.button_name!='退回'&&(
2153
+ // this.selectdata.defname == '收费'
2154
+ // ) && (
2155
+ // this.selectdata.f_apply_type == '公用整改'
2156
+ // ||this.selectdata.f_apply_type == '工业整改'
2157
+ // ||this.selectdata.f_apply_type == '公用'
2158
+ // ||this.selectdata.f_apply_type == '工业'
2159
+ // ||this.selectdata.f_apply_type == '商业预埋管线'
2160
+ // )) {
2161
+ // model.button.button_name = '下发'
2162
+ // model.button.button_person = {
2163
+ // button_event: "获取之前被下发人",
2164
+ // button_person_field: "f_survey_name"
2165
+ // }
2166
+ // }else if(model.button.button_name!='保存'&&model.button.button_name!='退回'&&(
2167
+ // this.selectdata.defname == '勘察初设'
2168
+ // ) && (
2169
+ // this.selectdata.f_apply_type == '公用整改'
2170
+ // ||this.selectdata.f_apply_type == '工业整改'
2171
+ // ||this.selectdata.f_apply_type == '公用'
2172
+ // ||this.selectdata.f_apply_type == '工业'
2173
+ // ||this.selectdata.f_apply_type == '商业预埋管线'
2174
+ // )){
2175
+ // let act = {
2176
+ // tablename: 'activityins',
2177
+ // condition: `processid = '${this.selectdata.f_process_id}' and defname = '报装申请'`
2178
+ // }
2179
+ // let res = await this.$resetpost('rs/sql/singleTable', {data: act}, {
2180
+ // resolveMsg: null,
2181
+ // rejectMsg: '获取人员失败'
2182
+ // })
2183
+ //
2184
+ // let querydata = {
2185
+ // tablename: 't_user',
2186
+ // condition: `ename = '${res.data[0].userid}'`
2187
+ // }
2188
+ // let buyerinfos = await this.$resetpost('rs/sql/singleTable', {data: querydata}, {
2189
+ // resolveMsg: null,
2190
+ // rejectMsg: '获取人员失败'
2191
+ // })
2192
+ // model.f_apply_kefu_employee = {
2193
+ // id: buyerinfos.data[0].id,
2194
+ // name: buyerinfos.data[0].name
2195
+ // }
2196
+ // model.button.button_name = '下发'
2197
+ // model.button.button_person = {
2198
+ // button_event: "获取之前被下发人",
2199
+ // button_person_field: "f_apply_kefu_employee"
2200
+ // }
2201
+ // model.button.button_fields.f_apply_kefu_employee = model.f_apply_kefu_employee
2202
+ // }else if(model.button.button_name!='保存'&&model.button.button_name!='退回'&&this.checkParetment() == '客户服务部'&&( // 部门个人
2203
+ // this.selectdata.defname=="勘察初设"
2204
+ // )){
2205
+ // model.button.button_name = '下发'
2206
+ // model.button.button_person = {
2207
+ // button_event: "获取之前被下发人",
2208
+ // button_person_field: "f_apply_kefu_employee"
2209
+ // }
2210
+ // let numReg = /^[0-9]+$/
2211
+ // let numRe = new RegExp(numReg)
2212
+ // if (numRe.test(this.selectdata.f_apply_kefu_employee)) {
2213
+ // model.button.button_fields.f_apply_kefu_employee ={
2214
+ // id: this.selectdata.f_apply_kefu_employee,
2215
+ // name: this.selectdata.f_apply_kefu_employee
2216
+ // }
2217
+ // }else{
2218
+ // model.button.button_fields.f_apply_kefu_employee = JSON.parse(this.selectdata.f_apply_kefu_employee)
2219
+ // }
2220
+ // }else if(model.button.button_name!='保存'&&model.button.button_name!='退回'&&this.checkParetment() == '客户服务部'&&( // 技术人员
2221
+ // this.selectdata.defname=="派工单"||
2222
+ // this.selectdata.defname=="收费"||
2223
+ // this.selectdata.defname=="施工"||
2224
+ // this.selectdata.defname=="综合验收确认"
2225
+ // )){
2226
+ // model.button.button_name = '下发'
2227
+ // model.button.button_person = {
2228
+ // button_event: "获取之前被下发人",
2229
+ // button_person_field: "f_survey_name"
2230
+ // }
2231
+ // let numReg = /^[0-9]+$/
2232
+ // let numRe = new RegExp(numReg)
2233
+ // if (numRe.test(this.selectdata.f_survey_name)) {
2234
+ // model.button.button_fields.f_survey_name ={
2235
+ // id: this.selectdata.f_survey_name,
2236
+ // name: this.selectdata.f_survey_name
2237
+ // }
2238
+ // }else{
2239
+ // model.button.button_fields.f_survey_name = this.selectdata.f_survey_name
2240
+ // }
2241
+ // }
2242
+
2243
+ if (model.button.button_name === '提交') {
2244
+ // ===================>青白江特殊流程开始,合并分支时请忽略这段代码 开始
2245
+ // let http = new HttpResetClass()
2246
+ // if (this.$refs.service_show.data.defname === '通气') {
2247
+ // console.log('改变档案状态')
2248
+ // let param = {
2249
+ // f_process_id: model.f_process_id
2250
+ // }
2251
+ // let res = await http.load('POST', 'rs/logic/setUserstate', param, {
2252
+ // resolveMsg: null,
2253
+ // rejectMsg: null
2254
+ // })
2255
+ // }
2256
+ // if (this.$refs.service_show.data.defname === '综合验收确认') {
2257
+ // if (model.f_isdata_check == '否' || !model.f_isdata_check) {
2258
+ // this.$showMessage("资料验收未通过")
2259
+ // this.$refs.service_show.disable_button = false
2260
+ // return
2261
+ // }
2262
+ // if (model.f_isacceptance_pass == '否' || !model.f_isacceptance_pass) {
2263
+ // this.$showMessage("工程验收未通过")
2264
+ // this.$refs.service_show.disable_button = false
2265
+ // return
2266
+ // }
2267
+ // // http = new HttpResetClass()
2268
+ // // let data = {
2269
+ // // tablename: 't_files',
2270
+ // // condition: `fusetype = '综合验收签字单' and f_blobid='${this.selectdata.f_process_id}'`
2271
+ // // }
2272
+ // // let res = await http.load('POST', 'rs/sql/singleTable', {data: data}, {
2273
+ // // resolveMsg: null,
2274
+ // // rejectMsg: "获取附件内容失败"
2275
+ // // })
2276
+ // // if (res.data.length <= 0) {
2277
+ // // this.$showMessage("请先上传综合验收签字单!")
2278
+ // // return
2279
+ // // } else {
2280
+ //
2281
+ // // }
2282
+ // }
2283
+ // // 判断分流程
2284
+ // if (this.$refs.service_show.data.defname === this.$workflow_vue.start_activity) {
2285
+ // let flag = ''
2286
+ // let str = this.$appdata.getSingleValue("客户服务部")
2287
+ // let str2 = this.$appdata.getSingleValue("工程技术部")
2288
+ // let arr = str.split(",")
2289
+ // let arr2 = str2.split(",")
2290
+ // for (let i = 0; i < arr.length; i++) {
2291
+ // if (arr[i] == model.f_apply_type) {
2292
+ // flag = '客户服务部'
2293
+ // break
2294
+ // }
2295
+ // }
2296
+ // for (let i = 0; i < arr2.length; i++) {
2297
+ // if (arr2[i] == model.f_apply_type) {
2298
+ // flag = '工程技术部'
2299
+ // break
2300
+ // }
2301
+ // }
2302
+ // model.button.button_name = flag
2303
+ // }
2304
+
2305
+ // ===================>青白江特殊流程开始,合并分支时请忽略这段代码 结束
2306
+ // flag 为合同编号更新标志
2307
+ // var flag = false
2308
+ // if (this.data.defname == '合同审核') {
2309
+ // flag = true
2310
+ // http = new HttpResetClass()
2311
+ // let data = {
2312
+ // tablename: 't_singlevalue',
2313
+ // condition: `name = '合同编号' and f_filialeids = '${this.$login.f.f_orgids}'`
2314
+ // }
2315
+ // let res = await http.load('POST', 'rs/sql/singleTable', {data: data}, {
2316
+ // resolveMsg: null,
2317
+ // rejectMsg: "获取合同编号失败"
2318
+ // })
2319
+ // if (this.contract != res.data[0].value && !this.selectdata.f_contract_number) {
2320
+ // this.$showMessage("合同编号已经被使用,请按F5刷新页面后重新登记")
2321
+ // return
2322
+ // }
2323
+ // }
2324
+
2325
+ }
2326
+
2327
+ if (model.button.button_name === '提交' && this.$refs.service_show.data.defname === '综合验收确认') {
2328
+ if (model.f_isacceptance_pass != '是') {
2329
+ this.$showMessage('验收不通过,请执行退回操作。', 'info', 2000)
2330
+ model.f_isacceptance_pass = ''
2331
+ this.$refs.service_show.disable_button = false
2332
+ return
2333
+ }
2334
+ }
2335
+ if (model.button.button_name === '提交' && this.$refs.service_show.data.defname === '现场勘查') {
2336
+ if (model.f_install_num < 1) {
2337
+ this.$showAlert('安装表数不能小于1,请重新输入', 'info', 2000)
2338
+ model.f_install_num = ""
2339
+ this.$refs.service_show.disable_button = false
2340
+ return
2341
+ }
2342
+ }
2343
+ if (model.button.button_name === '提交' && this.$refs.service_show.data.defname === '派工单') {
2344
+ if (model.f_unaccounts_money > 0) {
2345
+ this.$showMessage("未结清工程款。")
2346
+ }
2347
+ }
2348
+ // ===================>青白江特殊流程开始,合并分支时请忽略这段代码 开始
2349
+ // if (model.button.button_name == '退回' && (this.$refs.service_show.data.defname == '勘察初设' || this.$refs.service_show.data.defname == '任务分配')) {
2350
+ // let flag = ''
2351
+ // let str = this.$appdata.getSingleValue("客户服务部")
2352
+ // let str2 = this.$appdata.getSingleValue("工程技术部")
2353
+ // let arr = str.split(",")
2354
+ // let arr2 = str2.split(",")
2355
+ // for (let i = 0; i < arr.length; i++) {
2356
+ // if (arr[i] == model.f_apply_type) {
2357
+ // flag = '客户服务部'
2358
+ // break
2359
+ // }
2360
+ // }
2361
+ // for (let i = 0; i < arr2.length; i++) {
2362
+ // if (arr2[i] == model.f_apply_type) {
2363
+ // flag = '工程技术部'
2364
+ // break
2365
+ // }
2366
+ // }
2367
+ // model.button.button_name = flag
2368
+ // // 如果为任务分配,而且报建类型没有改变,则为正常退回
2369
+ // if (this.$refs.service_show.data.defname == '任务分配') {
2370
+ // // 判断报建类型有没有变化
2371
+ // let beforeData = this.data.fields
2372
+ // let submitData = this.$refs.service_show.data.fields
2373
+ // // 比较
2374
+ // let f_before_change = []
2375
+ // let f_change = []
2376
+ // for (let i = 0; i < beforeData.length; i++) {
2377
+ // if (beforeData[i].field == 'f_apply_type' && beforeData[i].value == submitData[i].value) {
2378
+ // model.button.button_name = '退回'
2379
+ // break
2380
+ // }
2381
+ // }
2382
+ // }
2383
+ // }
2384
+ // if (this.selectdata.defname == '内验') {
2385
+ // // let http2 = new HttpResetClass()
2386
+ // // let data = {
2387
+ // // columnname: 'f_charge_money',
2388
+ // // tablename: 't_charge_record',
2389
+ // // condition: `f_charging_status='有效' and f_process_id = '${this.selectdata.f_process_id}'`
2390
+ // // }
2391
+ // // let res = await http2.load('POST', 'rs/sql/getSum', {data: data}, {
2392
+ // // resolveMsg: null,
2393
+ // // rejectMsg: "获取合同编号失败"
2394
+ // // })
2395
+ // // if ((Number(this.selectdata.f_contract_money) >= Number(res.data[0].f_charge_money))&&Number(res.data[0].f_charge_money)!=0) {
2396
+ // if (model.f_check_ngineering == '否') {
2397
+ // model.button.button_name = '停气碰口'
2398
+ // }
2399
+ // }
2400
+ // ===================>青白江特殊流程开始,合并分支时请忽略这段代码 结束
2401
+ if(model.button.button_name === '提交' && this.$refs.service_show.data.defname === '客户申请' && this.$refs.service_show.model.f_cell_type === '新小区' ){
2402
+ model.button.button_name ='跳过'
2403
+ }
2404
+ if(model.button.button_name === '提交' && this.$refs.service_show.data.defname === '下发开工通知(财务部)' && this.$refs.service_show.model.f_pay_flag === '已缴费' ){
2405
+ model.button.button_name ='跳过'
2406
+ }
2407
+ console.log('本次点击button执行的操作是=>' + operate)
2408
+ model = Object.assign({}, this.selectdata, model)
2409
+ let http = new HttpResetClass()
2410
+ var url
2411
+ var requestData = {
2412
+ tables: this.data.tables,
2413
+ start_activity: this.$workflow_vue.start_activity,
2414
+ model: model,
2415
+ loginUser: this.$login.f
2416
+ }
2417
+ if (operate != '') {
2418
+ // 特殊操作走特殊logic业务处理
2419
+ url = 'rs/logic/SubprocessService'
2420
+ requestData = {
2421
+ tables: this.data.tables, model: model
2422
+ }
2423
+ } else if (model.button.button_name === '提交' && model.button.button_event && model.button.button_event === '分支流程异步合并处理') {
2424
+ url = 'rs/logic/branchsyncprocess'
2425
+ requestData = {
2426
+ tables: this.data.tables, model: model
2427
+ }
2428
+ } else {
2429
+ // 下发,提交,保存,退回通用业务后台处理logic
2430
+
2431
+ url = 'rs/logic/ApplyProductService'
2432
+ // model = Object.assign(model,model.button.button_fields)
2433
+ // let model2 = JSON.parse(JSON.stringify(model))
2434
+ // let str = ''
2435
+ // if(model2.button.button_name == '下发'){
2436
+ // for (let key in model2.button.button_fields) {
2437
+ // if(typeof model2.button.button_fields[key] == 'object'){
2438
+ // str=str+`id*${String(model2.button.button_fields[key].id)}&name*${model2.button.button_fields[key].name}`
2439
+ // model2[key] = ''
2440
+ // model2[key] =str
2441
+ // }
2442
+ // }
2443
+ // }
2444
+ // model2.button=null
2445
+
2446
+ requestData = {
2447
+ tables: this.data.tables, model: model
2448
+ }
2449
+ }
2450
+ requestData.start_activity = this.$workflow_vue.start_activity
2451
+ requestData.loginUser = this.$login.f
2452
+ requestData.workflow_xmlfilename = this.$workflow_vue.workflow_xmlfilename
2453
+ requestData.employeetemplate = ''
2454
+ console.log('即将发送请求url=>' + url + ',参数=>' + JSON.stringify(requestData))
2455
+ let res = await http.load('POST', url, {data: requestData}, {resolveMsg: null, rejectMsg: '数据保存失败'})
2456
+ console.log("service处理完成返回数据:", JSON.stringify(res.data))
2457
+ if (res.data.code == 200) {
2458
+ model = res.data.model
2459
+ this.showview = false
2460
+ // 特殊处理
2461
+ this.special(model)
2462
+ this.$dispatch('close')
2463
+ this.initializtion()
2464
+ } else {
2465
+ if (res.data.msg) {
2466
+ this.$showMessage(res.data.msg)
2467
+ }
2468
+ }
2469
+ }
2470
+ ,
2471
+ async 'onetomanydelete'(i, j) {
2472
+ let http = new HttpResetClass()
2473
+ let data = {
2474
+ tables: this.show_data.onetomany[i].tables,
2475
+ row: this.$refs.service_show.model.rows[i][j]
2476
+ }
2477
+ await http.load('POST', 'rs/logic/applyDeleteValue', {data: data}, {
2478
+ resolveMsg: null,
2479
+ rejectMsg: 'onetomanydelete失败'
2480
+ }).then(() => {
2481
+ this.$dispatch('selfsearch')
2482
+ this.$refs.service_show.model.rows[i].splice(j, 1)
2483
+ })
2484
+ }
2485
+ ,
2486
+ //获取view层confirm事件
2487
+ async 'confirm'(tables, row, showadd_index, j) {
2488
+ var _this = this
2489
+ for (let i = 0; i < tables.length; i++) {
2490
+ let datas = {
2491
+ tables: tables,
2492
+ row: row
2493
+ }
2494
+ datas.row['f_process_id'] = this.selectdata.f_process_id
2495
+ datas.row['f_apply_num'] = this.selectdata.f_apply_num
2496
+ datas.row['f_filiale'] = this.selectdata.f_filiale
2497
+ let http = new HttpResetClass()
2498
+ let sellid = ''
2499
+ let billtype = datas.row['f_bill_style']
2500
+ if (tables[i] == 't_charge_record') {
2501
+ await this.loadbuyer()
2502
+ if (this.buyerinfo.rows.length < 1 && billtype === '增值税电子发票' && this.$appdata.getSingleValue('默认打印票据') === '是') {
2503
+ this.$showAlert('未找到购买方信息,请去报建功能"购买方信息"中完善购买方信息后再收费', 'info', 2000)
2504
+ this.$refs.service_show.model.rows[showadd_index].splice(j, 1)
2505
+ this.$refs.service_show.initializtion()
2506
+ return
2507
+ }
2508
+ datas.row.f_charging_status = '有效'
2509
+ datas.row.f_is_correct = '否'
2510
+ datas.row.f_charge_collectors = this.$login.f.name
2511
+ await http.load('POST', 'rs/logic/applycharge', datas, {
2512
+ resolveMsg: null,
2513
+ rejectMsg: '收费保存失败'
2514
+ }).then((res) => {
2515
+ sellid = JSON.parse(res.data.sellid).id
2516
+ /*for (let i = 0; i < this.$refs.service_show.data.fields.length; i++) {
2517
+
2518
+ if (this.$refs.service_show.data.fields[i].label == '累计缴费金额') {
2519
+ this.$refs.service_show.data.fields[i].value = res.data.f_cumulative_money
2520
+ }
2521
+
2522
+ if (this.$refs.service_show.data.fields[i].label == '未结总金额') {
2523
+ this.$refs.service_show.data.fields[i].value = res.data.f_unaccounts_money
2524
+ }
2525
+ }*/
2526
+ let temp = _this.$refs.service_show.model.rows[showadd_index][j]
2527
+ temp.id = sellid
2528
+ _this.$refs.service_show.model.rows[showadd_index][j] = temp
2529
+ })
2530
+ if (this.$appdata.getSingleValue('默认打印票据') && this.$appdata.getSingleValue('默认打印票据') === '是') {
2531
+ this.$showMessage('是否打票据', ['confirm', 'cancel']).then((res) => {
2532
+ if (res === 'confirm') {
2533
+ console.log('打印票据')
2534
+ if (billtype === '增值税电子发票') {
2535
+ this.selectsellid = sellid
2536
+ this.showbuyerinfo = true
2537
+ } else {
2538
+ this.printbill(sellid)
2539
+ }
2540
+ }
2541
+ })
2542
+ }
2543
+ // 刷新列表数据
2544
+ this.$dispatch('selfsearch')
2545
+ } else {
2546
+ await http.load('POST', 'rs/logic/saveentity', datas, {
2547
+ resolveMsg: null,
2548
+ rejectMsg: 'onetomany保存失败'
2549
+ }).then((res) => {
2550
+ // 刷新列表数据
2551
+ this.$dispatch('selfsearch')
2552
+ let temp = _this.$refs.service_show.model.rows[showadd_index][j]
2553
+ temp.id = res.data.id
2554
+ _this.$refs.service_show.model.rows[showadd_index][j] = temp
2555
+ })
2556
+ }
2557
+ }
2558
+ }
2559
+ }
2560
+ }
2561
+ </script>