apply-clients 3.0.2 → 3.0.5-2

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