apply-clients 3.2.51 → 3.2.53

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,665 +1,747 @@
1
- <template>
2
-
3
- <div class="auto clearfix">
4
- <show-back-reason :selectdata="show_data"></show-back-reason>
5
- </div>
6
-
7
- <service-view v-ref:serviceview :data="show_data" v-if="showview"></service-view>
8
-
9
- </template>
10
- <script>
11
- import Vue from 'vue'
12
- import {HttpResetClass} from 'vue-client'
13
- import {getNowDate,isEmpty} from '../../../../Util'
14
- // Date格式化
15
- Date.prototype.Format = function (fmt) {
16
- var o = {
17
- 'M+': this.getMonth() + 1, // 月份
18
- 'd+': this.getDate(), //
19
- 'H+': this.getHours(), // 小时
20
- 'm+': this.getMinutes(), //
21
- 's+': this.getSeconds(), //
22
- 'q+': Math.floor((this.getMonth() + 3) / 3), // 季度
23
- 'S': this.getMilliseconds() // 毫秒
24
- }
25
- if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + '').substr(4 - RegExp.$1.length))
26
- for (var k in o) {
27
- if (new RegExp('(' + k + ')').test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length)))
28
- }
29
- return fmt
30
- }
31
- export default {
32
- title: '报建流程业务控制层',
33
- props: ['selectdata'],
34
- data() {
35
- return {
36
- data: null, // 数据库数据,json配置文件数据的数据集合
37
- json_datas: null, // Json配置文件集合
38
- showview: false, // 控制显示service-view组件
39
- show_data: null // view层显示的数据
40
- }
41
- },
42
- created () {
43
- this.refurbish()
44
- },
45
- methods: {
46
- // 组件初始化操作
47
- refurbish() {
48
- this.json_datas = this.$workflow_vue
49
- let sum = 0
50
- let jsonData = {}
51
- if (!this.json_datas || !this.json_datas.activitys || this.json_datas.activitys.length === 0) {
52
- this.$showMessage("网络故障,请刷新页面")
53
- return
54
- }
55
- this.json_datas.activitys.forEach(item => {
56
- if (this.selectdata.defname === item.title) {
57
- jsonData = item // 拿到当前节点的json配置信息
58
- sum++ // 节点名一样的个数
59
- }
60
- })
61
-
62
- if (sum === 0) {
63
- this.$showMessage(`没有在JSON配置文件中找到活动名为:(${this.selectdata.defname})的节点配置`)
64
- return
65
- }
66
-
67
- if (sum === 1) {
68
- this.data = null
69
- this.data = jsonData
70
- this.data = Object.assign({}, this.data, this.selectdata)
71
-
72
- this.initializeJSON()
73
- return
74
- }
75
-
76
- this.$showMessage(`在JSON配置文件中找到活动名为:(${this.selectdata.defname})的节点配置:${sum}个`)
77
- },
78
- // json配置数据处理
79
- async initializeJSON() {
80
- // 有默认值,value就给默认值,没有就是null
81
- this.data.fields.forEach(item => {
82
- if (!item.value) {
83
- if (item.value === 0) {
84
- item.value = 0
85
- } else {
86
- item.value = null
87
- }
88
- }
89
- if ((item.default || item.default == 0) && item.type !== 'datepicker' ) {
90
- item.value = item.default
91
- }
92
- if (this.selectdata[item.field]) {
93
- // 将json字符串格式化赋值给value
94
- if (String(this.selectdata[item.field]).startsWith("{")) {
95
- item.value = JSON.parse(this.selectdata[item.field])
96
- this.selectdata[item.field] = JSON.parse(this.selectdata[item.field])
97
- } else {
98
- item.value = this.selectdata[item.field]
99
- }
100
- } else {
101
- if (this.selectdata[item.field] === 0) {
102
- item.value = 0
103
- }
104
- }
105
- // datepicker 没有值给当时值
106
- if (item.type === 'datepicker' && !item.value && item.default) {
107
-
108
- item.value = new Date().Format(item.format || 'yyyy-MM-dd HH:mm:ss')
109
- }
110
-
111
- // 如果配置类型为select,优先从参数列表获取options
112
- if (item.type === 'select') {
113
- let temp = null
114
-
115
- temp = this.$appdata.getParam(item.label)
116
-
117
- if (temp && temp.length > 0 && item.label) {
118
- item.options = temp
119
- } else {
120
- if (item.paramLabel) {
121
- temp = this.$appdata.getParam(item.paramLabel)
122
- if (temp && temp.length > 0) {
123
- item.options = temp
124
- }
125
- }
126
- }
127
- }
128
- })
129
-
130
- // 控制组件
131
- if (this.data.components) {
132
- this.data.components.forEach(item => {
133
- item.mark = 0
134
- })
135
- }
136
-
137
- // 初始化 fields 可对数据进行特殊处理
138
- this.initializeFields()
139
-
140
- // 初始化 buttons_fields
141
- for (let i = 0; i < this.data.buttons.length; i++) {
142
- // 下发按钮相关配置
143
- if (this.data.buttons[i].button_name === '下发') {
144
- if (this.data.buttons[i].button_fields && this.data.buttons[i].button_fields.length === 1) {
145
- if (this.data.buttons[i].source){
146
- let http = new HttpResetClass()
147
- let res = await http.load('POST', 'rs/search', {
148
- source: this.data.buttons[i].source,
149
- userid: this.$login.f.id
150
- }, {resolveMsg: null, rejectMsg: null})
151
-
152
- let options = []
153
- for (let i = 0; i < res.data.length; i++) {
154
- options.push(
155
- {
156
- "label": res.data[i].name,
157
- "value": res.data[i].id
158
- }
159
- )
160
- }
161
- this.data.buttons[i].button_fields[0]['options'] = options
162
- } else {
163
- this.$showMessage("请配置获取人员表达式")
164
- }
165
- } else {
166
- this.$showMessage("下发按钮必须满足 当且仅当一个字段")
167
- }
168
- }
169
- if (this.data.buttons[i].button_fields) {
170
- this.data.buttons[i].button_fields.forEach(x => {
171
- // 如果配置类型为select,优先从参数列表获取options
172
- if (x.type === 'select' && this.$appdata.getParam(x.label)) {
173
- x.options = this.$appdata.getParam(x.label).trim()
174
- }
175
- })
176
- }
177
- }
178
-
179
- // onetomany 数据获取
180
- if (this.data.onetomany) {
181
- for (let index = 0; index < this.data.onetomany.length; index++) {
182
- let res = null
183
- if (!this.data.onetomany[index].queryEvent || this.data.onetomany[index].queryEvent === 'default'){
184
- let http = new HttpResetClass()
185
- let data = {
186
- tablename: this.data.onetomany[index].tables[0],
187
- condition: `${this.data.onetomany[index].condition ? this.data.onetomany[index].condition : '1=1'} and f_process_id = '${this.selectdata.f_process_id}'`
188
- }
189
- res = await http.load('POST', 'rs/sql/singleTable', {data: data}, {
190
- resolveMsg: null,
191
- rejectMsg: 'onetomany查询失败'
192
- })
193
- } else {
194
- res = await this[this.data.onetomany[index].queryEvent]()
195
- }
196
-
197
- // 初始化 onetomany
198
- this.data.onetomany[index].rows = res.data
199
-
200
- // 初始化onetomany中的fields
201
- for (let j = 0; j < this.data.onetomany[index].fields.length; j++) {
202
- if (!this.data.onetomany[index].fields[j].value) {
203
- if (this.data.onetomany[index].fields[j].value === 0) {
204
- this.data.onetomany[index].fields[j].value = 0
205
- } else {
206
- this.data.onetomany[index].fields[j].value = null
207
- }
208
- }
209
- if (this.data.onetomany[index].fields[j].default || this.data.onetomany[index].fields[j].default === 0) {
210
- this.data.onetomany[index].fields[j].value = this.data.onetomany[index].fields[j].default
211
- }
212
- // 如果配置类型为select,优先从参数列表获取options
213
- if (this.data.onetomany[index].fields[j].type === 'select') {
214
- if (this.data.onetomany[index].fields[j].paramLabel) {
215
- this.data.onetomany[index].fields[j].options = this.$appdata.getParam(this.data.onetomany[index].fields[j].paramLabel)
216
- } else {
217
- this.data.onetomany[index].fields[j].options = this.$appdata.getParam(this.data.onetomany[index].fields[j].label)
218
- }
219
- }
220
- }
221
- }
222
- }
223
-
224
- // 消除双向绑定,避免子组件(显示层)数据更改,父组件(控制层)也更改
225
- let temp = JSON.parse(JSON.stringify(this.data))
226
-
227
- this.show_data = temp
228
- this.$nextTick(() => {
229
- this.showview = true
230
- })
231
- },
232
- // 初始化fields值
233
- initializeFields() {
234
-
235
- },
236
- // 金额转大写
237
- smalltoBIG(n) {
238
- let fraction = ['角', '分'];
239
- let digit = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖'];
240
- let unit = [['元', '万', '亿'], ['', '拾', '佰', '仟']];
241
- let head = n < 0 ? '欠' : '';
242
- n = Math.abs(n);
243
-
244
- let s = '';
245
-
246
- for (var i = 0; i < fraction.length; i++) {
247
- s += (digit[Math.floor(n * 10 * Math.pow(10, i)) % 10] + fraction[i]).replace(/零./, '');
248
- }
249
- s = s || '整';
250
- n = Math.floor(n);
251
-
252
- for (var i = 0; i < unit[0].length && n > 0; i++) {
253
- let p = '';
254
- for (var j = 0; j < unit[1].length && n > 0; j++) {
255
- p = digit[n % 10] + unit[1][j] + p;
256
- n = Math.floor(n / 10);
257
- }
258
- s = p.replace(/(零.)*零$/, '').replace(/^$/, '零') + unit[0][i] + s;
259
- }
260
- return head + s.replace(/(零.)*零元/, '元').replace(/(零.)+/g, '零').replace(/^整$/, '零元整')
261
- },
262
- getLableValue(label) {
263
- for (const item of this.show_data.fields) {
264
- if (item.label === label && item.type !== 'number') {
265
- return item.value || ''
266
- }
267
- if (item.label === label && item.type === 'number') {
268
- return item.value || 0
269
- }
270
- }
271
- },
272
- setLabelValue(label, value) {
273
- for (const item of this.show_data.fields) {
274
- if (item.label === label) {
275
- item.value = value
276
- }
277
- }
278
- },
279
- async buttonBefore(model) {
280
- return model
281
- },
282
- async checkDuplicate(index) {
283
- let http = new HttpResetClass()
284
- let data = {
285
- tablename: 't_apply',
286
- condition: `${this.show_data.fields[index].field} = '${this.show_data.fields[index].value}'`
287
- }
288
- let res = await http.load('POST', 'rs/sql/singleTable', {data: data}, {
289
- resolveMsg: null,
290
- rejectMsg: `${this.show_data.fields[index].label}查询失败`
291
- })
292
- if (res.data.length > 0) {
293
- this.show_data.fields[index].value = null
294
- throw `${this.show_data.fields[index].label}已存在!!!`
295
- }
296
- }
297
- },
298
- events: {
299
- //工程前期限制事件
300
- async 'limit'(){
301
- debugger
302
- let rolename=this.$login.f.f_role_name
303
- debugger
304
- if(rolename.includes('工程前期申报内容填写权限')) {
305
- for (const item of this.show_data.fields) {
306
- if (item.label === '申报单编码' || item.label === '申报单完成时间') {
307
- item.disabled = false
308
- }
309
- }
310
- }
311
- },
312
- async 'addPEWelding'(index) {
313
- let data = {
314
- f_process_id : this.show_data.f_process_id,
315
- f_type: 'PE焊接',
316
- f_operator: this.$login.f.name,
317
- f_operation_date: new Date().Format('yyyy-MM-dd'),
318
- f_filiale: this.$login.f.orgs,
319
- f_filialeid: this.$login.f.orgid,
320
- f_orgid: this.$login.f.orgid,
321
- f_orgname: this.$login.f.orgs
322
- }
323
- this.show_data.onetomany[index].fields.forEach(item => {
324
- data[item.field] = item.value
325
- })
326
- let res = await this.$resetpost(
327
- `rs/entity/t_acceptance`,
328
- data
329
- )
330
- this.$dispatch('breakControl', this.show_data)
331
- },
332
- async 'addIndoorCheckpoint'(index) {
333
- let data = {
334
- f_process_id : this.show_data.f_process_id,
335
- f_type: '户内验点',
336
- f_operator: this.$login.f.name,
337
- f_operation_date: new Date().Format('yyyy-MM-dd'),
338
- f_filiale: this.$login.f.orgs,
339
- f_filialeid: this.$login.f.orgid,
340
- f_orgid: this.$login.f.orgid,
341
- f_orgname: this.$login.f.orgs
342
- }
343
- this.show_data.onetomany[index].fields.forEach(item => {
344
- data[item.field] = item.value
345
- })
346
- let res = await this.$resetpost(
347
- `rs/entity/t_acceptance`,
348
- data
349
- )
350
- this.$dispatch('breakControl', this.show_data)
351
- },
352
- async 'addCourtyardAcceptance'(index) {
353
- let data = {
354
- f_process_id : this.show_data.f_process_id,
355
- f_type: '庭院验收',
356
- f_operator: this.$login.f.name,
357
- f_operation_date: new Date().Format('yyyy-MM-dd'),
358
- f_filiale: this.$login.f.orgs,
359
- f_filialeid: this.$login.f.orgid,
360
- f_orgid: this.$login.f.orgid,
361
- f_orgname: this.$login.f.orgs
362
- }
363
- this.show_data.onetomany[index].fields.forEach(item => {
364
- data[item.field] = item.value
365
- })
366
- let res = await this.$resetpost(
367
- `rs/entity/t_acceptance`,
368
- data
369
- )
370
- this.$dispatch('breakControl', this.show_data)
371
- },
372
- async 'addPipeFittings'(index) {
373
-
374
- let data = {
375
- f_process_id : this.show_data.f_process_id,
376
- defname: this.show_data.defname,
377
- f_operator: this.$login.f.name,
378
- f_operation_date: new Date().Format('yyyy-MM-dd'),
379
- f_filiale: this.$login.f.orgs,
380
- f_filialeid: this.$login.f.orgid,
381
- f_orgid: this.$login.f.orgid,
382
- f_orgname: this.$login.f.orgs
383
- }
384
- this.show_data.onetomany[index].fields.forEach(item => {
385
- data[item.field] = item.value
386
- })
387
- let res = await this.$resetpost(
388
- `rs/entity/t_pipe_fittings`,
389
- data
390
- )
391
- this.$dispatch('breakControl', this.show_data)
392
- },
393
- 'openAddModel'(index) {
394
- },
395
- // 获取view层button事件
396
- async 'button'(model) {
397
- // 修改提交数据
398
- model = Object.assign({}, this.selectdata, model)
399
- // 点击重置按钮就重置数据
400
- if (model.button.button_name === '重置') {
401
- this.$dispatch('breakControl', this.data)
402
- return
403
- }
404
-
405
- // 提交前置
406
- try {
407
- model = await this.buttonBefore(model)
408
- } catch (e) {
409
- this.$showAlert(e, 'warning', 3000)
410
- return
411
- }
412
-
413
- let http = new HttpResetClass()
414
- let requestData = {
415
- tables: this.data.tables,
416
- start_activity: this.$workflow_vue.start_activity,
417
- model: model,
418
- loginUser: this.$login.f,
419
- workflow_xmlfilename: this.$workflow_vue.workflow_xmlfilename
420
- }
421
- // 下发,提交,保存,退回通用业务后台处理logic
422
- let url = 'rs/logic/ApplyProductService'
423
- let res = await http.load('POST', url, {data: requestData}, {resolveMsg: null, rejectMsg: '数据保存失败'})
424
-
425
- if (res.data.code == 200) {
426
- this.$dispatch('search')
427
- } else {
428
- if (res.data.msg) {
429
- this.$showMessage(res.data.msg)
430
- }
431
- }
432
- },
433
- async 'initializtionView'() {
434
- if (this.show_data.f_apply_type === '主体项目' && this.show_data.defname === '工程前期') {
435
- if (this.show_data.f_project_type === '支线') {
436
- for (const item of this.show_data.fields) {
437
- if (
438
- item.label === '会签完毕时间'
439
- ) {
440
- item.hidden = true
441
- item.required = false
442
- }
443
- }
444
- } else {
445
- for (const item of this.show_data.fields) {
446
- if (
447
- item.label === '领开挖证时间'
448
- ) {
449
- item.hidden = true
450
- item.required = false
451
- }
452
- }
453
- }
454
- }
455
-
456
- if (this.show_data.f_apply_type === '主体项目' && this.show_data.defname === '结算') {
457
- if (this.show_data.f_project_type === '支线') {
458
- for (const item of this.show_data.fields) {
459
- if (
460
- item.label === '预付款' ||
461
- item.label === '预付款占比' ||
462
- item.label === '预付款时间'
463
- ) {
464
- item.hidden = true
465
- item.required = false
466
- }
467
- }
468
- }
469
- }
470
- },
471
- // 失去焦点出触发事件
472
- async 'onchange'(index) {
473
-
474
- // cea号重复提醒
475
- if(this.show_data.defname==='信息录入'){
476
- if (this.show_data.fields[index].label==='CEA号'){
477
- const cea=this.getLableValue('CEA号')
478
- if(cea){
479
- let pcdText =`and f_cea_number = '${cea}'`
480
- new HttpResetClass().load("POST", `${this.$androidUtil.getProxyUrl()}/rs/sql/singleTable`, {data:{items:"*",tablename:"t_apply",condition:` f_sub_state != '终止' ${pcdText} `}}, {resolveMsg: null, rejectMsg: null}).then((res)=>{
481
- console.log('请求发送完成!!!!!'+JSON.stringify(res))
482
- if(res.data.length>0){
483
- this.$showAlert('该cea已经存在!!!', 'warning', 3000)
484
- }
485
- })
486
-
487
- }
488
- }
489
- }
490
-
491
- if (this.show_data.defname === '编制合同') {
492
- if (this.show_data.fields[index].label==='室外安装费'|| this.show_data.fields[index].label==='室外甲供材'|| this.show_data.fields[index].label==='室外设备费'||this.show_data.fields[index].label==='室内安装费'|| this.show_data.fields[index].label==='室内甲供材'|| this.show_data.fields[index].label==='室内设备费') {
493
-
494
- let a1 = this.getLableValue('室外安装费')
495
- let b1 = this.getLableValue('室外甲供材')
496
- let c1=this.getLableValue('室外设备费')
497
- let a2 = this.getLableValue('室内安装费')
498
- let b2 = this.getLableValue('室内甲供材')
499
- let c2=this.getLableValue('室内设备费')
500
- if(this.show_data.f_project_type!='支线'&&this.show_data.f_project_type!='主体'){
501
- this.setLabelValue('合同总造价', parseFloat(parseFloat(a1) + parseFloat(b1) + parseFloat(c1)+ parseFloat(a2)+ parseFloat(b2)+ parseFloat(c2)).toFixed(2))
502
- this.setLabelValue('安装费总和',parseFloat(parseFloat(a1)+ parseFloat(a2)).toFixed(2))
503
- }
504
- console.log('----------------------------------------')
505
- }
506
- if(this.show_data.fields[index].label==='室外安装费'|| this.show_data.fields[index].label==='室外甲供材'|| this.show_data.fields[index].label==='室外设备费'){
507
- let a1 = this.getLableValue('室外安装费')
508
- let b1 = this.getLableValue('室外甲供材')
509
- let c1=this.getLableValue('室外设备费')
510
-
511
- this.setLabelValue('室外税金', parseFloat(parseFloat(a1) * 0.03).toFixed(2))
512
- this.setLabelValue('室外造价', parseFloat(parseFloat(a1) + parseFloat(b1) + parseFloat(c1)).toFixed(2))
513
- }
514
- if(this.show_data.fields[index].label==='室内安装费'|| this.show_data.fields[index].label==='室内甲供材'|| this.show_data.fields[index].label==='室内设备费'){
515
- let a2 = this.getLableValue('室内安装费')
516
- let b2 = this.getLableValue('室内甲供材')
517
- let c2=this.getLableValue('室内设备费')
518
- this.setLabelValue('室内税金', parseFloat(parseFloat(a2) * 0.03).toFixed(2))
519
- this.setLabelValue('室内造价',parseFloat(parseFloat(a2) + parseFloat(b2) + parseFloat(c2)).toFixed(2))
520
- }
521
-
522
- }
523
-
524
- console.log('失去焦点')
525
- if (
526
- this.show_data.fields[index].label === '合同编号' ||
527
- this.show_data.fields[index].label === '工程编号'
528
- ) {
529
- try {
530
- await this.checkDuplicate(index)
531
- } catch (e) {
532
- this.$showAlert(e, 'warning', 3000)
533
- }
534
- }
535
-
536
- // 号码检测
537
- if (this.show_data.fields[index].label === '电话号码') {
538
- let phone = this.show_data.fields[index].value
539
- // 电话号码效验
540
- if (!(/^1[3456789]\d{9}$/.test(phone))) {
541
- this.show_data.fields[index].value = ""
542
- this.$showAlert('电话号码格式不正确,请重新输入。', 'info', 2000)
543
- }
544
- }
545
- //时间提醒
546
- // if (this.show_data.fields[index].label.includes("时间") || this.show_data.fields[index].type === 'datepicker') {
547
- // let setTime = this.show_data.fields[index].value
548
- // let nowTime = new Date().Format("yyyy-MM-dd HH:mm:ss")
549
- // if (nowTime >= setTime) {
550
- // this.$showMessage("请注意,当前节点时间/工期已过期!")
551
- // }
552
- // }
553
- },
554
- // input值发生变化
555
- async 'oninput'(index) {
556
-
557
- },
558
- // 错误事件
559
- error_check(index) {
560
- // 时间格式检测
561
- if (this.show_data.fields[index].type === 'datepicker' && !isEmpty(this.show_data.fields[index].value)) {
562
-
563
- let dateReg = /^[1-9]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/
564
- let timeReg = /^(20|21|22|23|[0-1]\d):[0-5]\d:[0-5]\d$/
565
- let datetimeReg = /^[1-9]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])\s+(20|21|22|23|[0-1]\d):[0-5]\d:[0-5]\d$/
566
- if (this.show_data.fields[index].format) {
567
- if (this.show_data.fields[index].format === 'yyyy-MM-dd') {
568
- if (!dateReg.test(this.show_data.fields[index].value)) {
569
- this.show_data.fields[index].value = ''
570
- this.$showAlert(this.show_data.fields[index].label + '格式错误如:2021-01-01', 'warning', 2000)
571
- }
572
- }
573
- if (this.show_data.fields[index].format === 'HH:mm:ss') {
574
- if (!timeReg.test(this.show_data.fields[index].value)) {
575
- this.show_data.fields[index].value = ''
576
- this.$showAlert(this.show_data.fields[index].label + '格式错误如:00:00:00', 'warning', 2000)
577
- }
578
- }
579
- if (this.show_data.fields[index].format === 'yyyy-MM-dd HH:mm:ss') {
580
- if (!datetimeReg.test(this.show_data.fields[index].value)) {
581
- this.show_data.fields[index].value = ''
582
- this.$showAlert(this.show_data.fields[index].label + '格式错误如:2021-01-01 00:00:00', 'warning', 2000)
583
- }
584
- }
585
- } else {
586
- if (!dateReg.test(this.show_data.fields[index].value)) {
587
- this.show_data.fields[index].value = ''
588
- this.$showAlert(this.show_data.fields[index].label + '格式错误如:2021-01-01', 'warning', 2000)
589
- }
590
- }
591
- }
592
- },
593
- // onetomany模态框默认监听监听事件
594
- async 'onetomanydelete'(i, j) {
595
- console.log('默认删除')
596
- let http = new HttpResetClass()
597
- let data = {
598
- table: this.show_data.onetomany[i].tables[0],
599
- row: this.show_data.onetomany[i].rows[j]
600
- }
601
- let res = await http.load('POST', 'rs/logic/onetomanyDefaultDeleteEvent', {data: data}, {
602
- resolveMsg: null,
603
- rejectMsg: '删除失败'
604
- })
605
-
606
- if (res.data <= 0){
607
- this.$showMessage('删除失败')
608
- return
609
- }
610
-
611
- this.$dispatch('breakControl', this.show_data)
612
- },
613
- async 'onetomanyadd'(index) {
614
-
615
- let data = {
616
- f_process_id : this.show_data.f_process_id,
617
- f_operator: this.$login.f.name,
618
- f_operation_date: new Date().Format('yyyy-MM-dd'),
619
- f_filiale: this.$login.f.orgs,
620
- f_filialeid: this.$login.f.orgid,
621
- f_orgid: this.$login.f.orgid,
622
- f_orgname: this.$login.f.orgs
623
- }
624
- this.show_data.onetomany[index].fields.forEach(item => {
625
- data[item.field] = item.value
626
- })
627
- let res = await this.$resetpost(
628
- `rs/entity/${this.show_data.onetomany[index].tables[0]}`,
629
- data
630
- )
631
- this.$dispatch('breakControl', this.show_data)
632
- },
633
- async 'onetomanyupdate'(i, j) {
634
- let onetomany = this.show_data.onetomany[i]
635
- let data = onetomany.rows[j]
636
-
637
- onetomany.fields.forEach(item => {
638
- data[item.field] = item.value
639
- })
640
- let res = await this.$resetpost(
641
- `rs/entity/${this.show_data.onetomany[i].tables[0]}`,
642
- data
643
- )
644
-
645
- this.$dispatch('breakControl', this.show_data)
646
- },
647
- // onetomany模态框监听事件
648
- async 'onchange_modal'(index, i) {
649
- },
650
- async 'oninput_modal'(index, i) {
651
- }
652
- },
653
- watch: {
654
- }
655
- }
656
- </script>
657
- <style scoped>
658
- /*清除model中的浮动*/
659
- .clearfix:after,.clearfix:before{
660
- display: table;
661
- }
662
- .clearfix:after{
663
- clear: both;
664
- }
665
- </style>
1
+ <template>
2
+
3
+ <div class="auto clearfix">
4
+ <show-back-reason :selectdata="show_data"></show-back-reason>
5
+ </div>
6
+
7
+ <service-view v-ref:serviceview :data="show_data" v-if="showview"></service-view>
8
+
9
+ </template>
10
+ <script>
11
+ import Vue from 'vue'
12
+ import {HttpResetClass} from 'vue-client'
13
+ import {getNowDate,isEmpty} from '../../../../Util'
14
+ import {number} from "echarts/lib/export";
15
+ // Date格式化
16
+ Date.prototype.Format = function (fmt) {
17
+ var o = {
18
+ 'M+': this.getMonth() + 1, // 月份
19
+ 'd+': this.getDate(), //
20
+ 'H+': this.getHours(), // 小时
21
+ 'm+': this.getMinutes(), //
22
+ 's+': this.getSeconds(), //
23
+ 'q+': Math.floor((this.getMonth() + 3) / 3), // 季度
24
+ 'S': this.getMilliseconds() // 毫秒
25
+ }
26
+ if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + '').substr(4 - RegExp.$1.length))
27
+ for (var k in o) {
28
+ if (new RegExp('(' + k + ')').test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length)))
29
+ }
30
+ return fmt
31
+ }
32
+ export default {
33
+ title: '报建流程业务控制层',
34
+ props: ['selectdata'],
35
+ data() {
36
+ return {
37
+ data: null, // 数据库数据,json配置文件数据的数据集合
38
+ json_datas: null, // Json配置文件集合
39
+ showview: false, // 控制显示service-view组件
40
+ show_data: null // 给view层显示的数据
41
+ }
42
+ },
43
+ created () {
44
+ this.refurbish()
45
+ },
46
+ methods: {
47
+ // 组件初始化操作
48
+ refurbish() {
49
+ this.json_datas = this.$workflow_vue
50
+ let sum = 0
51
+ let jsonData = {}
52
+ if (!this.json_datas || !this.json_datas.activitys || this.json_datas.activitys.length === 0) {
53
+ this.$showMessage("网络故障,请刷新页面")
54
+ return
55
+ }
56
+ this.json_datas.activitys.forEach(item => {
57
+ if (this.selectdata.defname === item.title) {
58
+ jsonData = item // 拿到当前节点的json配置信息
59
+ sum++ // 节点名一样的个数
60
+ }
61
+ })
62
+
63
+ if (sum === 0) {
64
+ this.$showMessage(`没有在JSON配置文件中找到活动名为:(${this.selectdata.defname})的节点配置`)
65
+ return
66
+ }
67
+
68
+ if (sum === 1) {
69
+ this.data = null
70
+ this.data = jsonData
71
+ this.data = Object.assign({}, this.data, this.selectdata)
72
+
73
+ this.initializeJSON()
74
+ return
75
+ }
76
+
77
+ this.$showMessage(`在JSON配置文件中找到活动名为:(${this.selectdata.defname})的节点配置:${sum}个`)
78
+ },
79
+ // json配置数据处理
80
+ async initializeJSON() {
81
+ // 有默认值,value就给默认值,没有就是null
82
+ for (const item of this.data.fields) {
83
+ if (!item.value) {
84
+ if (item.value === 0) {
85
+ item.value = 0
86
+ } else {
87
+ item.value = null
88
+ }
89
+ }
90
+ if ((item.default || item.default == 0) && item.type !== 'datepicker' ) {
91
+ item.value = item.default
92
+ }
93
+ if (this.selectdata[item.field]) {
94
+ // 将json字符串格式化赋值给value
95
+ if (String(this.selectdata[item.field]).startsWith("{")) {
96
+ item.value = JSON.parse(this.selectdata[item.field])
97
+ this.selectdata[item.field] = JSON.parse(this.selectdata[item.field])
98
+ } else {
99
+ item.value = this.selectdata[item.field]
100
+ }
101
+ } else {
102
+ if (this.selectdata[item.field] === 0) {
103
+ item.value = 0
104
+ }
105
+ }
106
+ // datepicker 没有值给当时值
107
+ if (item.type === 'datepicker' && !item.value && item.default) {
108
+
109
+ item.value = new Date().Format(item.format || 'yyyy-MM-dd HH:mm:ss')
110
+ }
111
+
112
+ // 如果配置类型为select,优先从参数列表获取options
113
+ if (item.type === 'select') {
114
+ let temp = null
115
+
116
+ temp = this.$appdata.getParam(item.label)
117
+
118
+ if (temp && temp.length > 0 && item.label) {
119
+ item.options = temp
120
+ } else {
121
+ if (item.paramLabel) {
122
+ temp = this.$appdata.getParam(item.paramLabel)
123
+ if (temp && temp.length > 0) {
124
+ item.options = temp
125
+ }
126
+ }
127
+ }
128
+ }
129
+ if (item.ready) {
130
+ await this[item.ready]()
131
+ }
132
+ }
133
+
134
+ // 控制组件
135
+ if (this.data.components) {
136
+ this.data.components.forEach(item => {
137
+ item.mark = 0
138
+ })
139
+ }
140
+
141
+ // 初始化 fields 可对数据进行特殊处理
142
+ this.initializeFields()
143
+
144
+ // 初始化 buttons_fields
145
+ for (let i = 0; i < this.data.buttons.length; i++) {
146
+ // 下发按钮相关配置
147
+ if (this.data.buttons[i].button_name === '下发') {
148
+ if (this.data.buttons[i].button_fields && this.data.buttons[i].button_fields.length === 1) {
149
+ if (this.data.buttons[i].source){
150
+ let http = new HttpResetClass()
151
+ let res = await http.load('POST', 'rs/search', {
152
+ source: this.data.buttons[i].source,
153
+ userid: this.$login.f.id
154
+ }, {resolveMsg: null, rejectMsg: null})
155
+
156
+ let options = []
157
+ for (let i = 0; i < res.data.length; i++) {
158
+ options.push(
159
+ {
160
+ "label": res.data[i].name,
161
+ "value": res.data[i].id
162
+ }
163
+ )
164
+ }
165
+ this.data.buttons[i].button_fields[0]['options'] = options
166
+ } else {
167
+ this.$showMessage("请配置获取人员表达式")
168
+ }
169
+ } else {
170
+ this.$showMessage("下发按钮必须满足 当且仅当一个字段")
171
+ }
172
+ }
173
+ if (this.data.buttons[i].button_fields) {
174
+ this.data.buttons[i].button_fields.forEach(x => {
175
+ // 如果配置类型为select,优先从参数列表获取options
176
+ if (x.type === 'select' && this.$appdata.getParam(x.label)) {
177
+ x.options = this.$appdata.getParam(x.label).trim()
178
+ }
179
+ })
180
+ }
181
+ }
182
+
183
+ // onetomany 数据获取
184
+ if (this.data.onetomany) {
185
+ for (let index = 0; index < this.data.onetomany.length; index++) {
186
+ let res = null
187
+ if (!this.data.onetomany[index].queryEvent || this.data.onetomany[index].queryEvent === 'default'){
188
+ let http = new HttpResetClass()
189
+ let data = {
190
+ tablename: this.data.onetomany[index].tables[0],
191
+ condition: `${this.data.onetomany[index].condition ? this.data.onetomany[index].condition : '1=1'} and f_process_id = '${this.selectdata.f_process_id}'`
192
+ }
193
+ res = await http.load('POST', 'rs/sql/singleTable', {data: data}, {
194
+ resolveMsg: null,
195
+ rejectMsg: 'onetomany查询失败'
196
+ })
197
+ } else {
198
+ res = await this[this.data.onetomany[index].queryEvent]()
199
+ }
200
+
201
+ // 初始化 onetomany
202
+ this.data.onetomany[index].rows = res.data
203
+
204
+ // 初始化onetomany中的fields
205
+ for (let j = 0; j < this.data.onetomany[index].fields.length; j++) {
206
+ if (!this.data.onetomany[index].fields[j].value) {
207
+ if (this.data.onetomany[index].fields[j].value === 0) {
208
+ this.data.onetomany[index].fields[j].value = 0
209
+ } else {
210
+ this.data.onetomany[index].fields[j].value = null
211
+ }
212
+ }
213
+ if (this.data.onetomany[index].fields[j].default || this.data.onetomany[index].fields[j].default === 0) {
214
+ this.data.onetomany[index].fields[j].value = this.data.onetomany[index].fields[j].default
215
+ }
216
+ // 如果配置类型为select,优先从参数列表获取options
217
+ if (this.data.onetomany[index].fields[j].type === 'select') {
218
+ if (this.data.onetomany[index].fields[j].paramLabel) {
219
+ this.data.onetomany[index].fields[j].options = this.$appdata.getParam(this.data.onetomany[index].fields[j].paramLabel)
220
+ } else {
221
+ this.data.onetomany[index].fields[j].options = this.$appdata.getParam(this.data.onetomany[index].fields[j].label)
222
+ }
223
+ }
224
+ }
225
+ }
226
+ }
227
+
228
+ // 消除双向绑定,避免子组件(显示层)数据更改,父组件(控制层)也更改
229
+ let temp = JSON.parse(JSON.stringify(this.data))
230
+
231
+ this.show_data = temp
232
+ this.$nextTick(() => {
233
+ this.showview = true
234
+ })
235
+ },
236
+ // 初始化fields值
237
+ initializeFields() {
238
+
239
+ },
240
+ // 金额转大写
241
+ smalltoBIG(n) {
242
+ let fraction = ['角', '分'];
243
+ let digit = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖'];
244
+ let unit = [['', '万', '亿'], ['', '拾', '佰', '仟']];
245
+ let head = n < 0 ? '欠' : '';
246
+ n = Math.abs(n);
247
+
248
+ let s = '';
249
+
250
+ for (var i = 0; i < fraction.length; i++) {
251
+ s += (digit[Math.floor(n * 10 * Math.pow(10, i)) % 10] + fraction[i]).replace(/零./, '');
252
+ }
253
+ s = s || '';
254
+ n = Math.floor(n);
255
+
256
+ for (var i = 0; i < unit[0].length && n > 0; i++) {
257
+ let p = '';
258
+ for (var j = 0; j < unit[1].length && n > 0; j++) {
259
+ p = digit[n % 10] + unit[1][j] + p;
260
+ n = Math.floor(n / 10);
261
+ }
262
+ s = p.replace(/(零.)*零$/, '').replace(/^$/, '零') + unit[0][i] + s;
263
+ }
264
+ return head + s.replace(/(零.)*零元/, '元').replace(/(零.)+/g, '零').replace(/^整$/, '零元整')
265
+ },
266
+ getLableValue(label) {
267
+ for (const item of this.show_data.fields) {
268
+ if (item.label === label && item.type !== 'number') {
269
+ return item.value || ''
270
+ }
271
+ if (item.label === label && item.type === 'number') {
272
+ return item.value || 0
273
+ }
274
+ }
275
+ },
276
+ setLabelValue(label, value) {
277
+ for (const item of this.show_data.fields) {
278
+ if (item.label === label) {
279
+ item.value = value
280
+ }
281
+ }
282
+ },
283
+ async buttonBefore(model) {
284
+ return model
285
+ },
286
+ async checkDuplicate(index) {
287
+ let http = new HttpResetClass()
288
+ let data = {
289
+ tablename: 't_apply',
290
+ condition: `${this.show_data.fields[index].field} = '${this.show_data.fields[index].value}'`
291
+ }
292
+ let res = await http.load('POST', 'rs/sql/singleTable', {data: data}, {
293
+ resolveMsg: null,
294
+ rejectMsg: `${this.show_data.fields[index].label}查询失败`
295
+ })
296
+ if (res.data.length > 0) {
297
+ this.show_data.fields[index].value = null
298
+ throw `${this.show_data.fields[index].label}已存在!!!`
299
+ }
300
+ },
301
+ async getCompletionTime() {
302
+ let startDate = null; // 开工日期
303
+ let duration = 0; // 工期
304
+ let resumeDate = null; // 复工日期
305
+ let stopDate = null; // 停工日期
306
+ // 提取所需字段值
307
+ this.data.fields.forEach(item => {
308
+ switch (item.label) {
309
+ case '开工日期':
310
+ startDate = this.getLableValue('开工日期');
311
+ break;
312
+ case '工期':
313
+ duration = parseInt(this.getLableValue('工期')) || 0;
314
+ break;
315
+ case '复工日期':
316
+ resumeDate = this.getLableValue('复工日期');
317
+ break;
318
+ case '停工日期':
319
+ stopDate = this.getLableValue('停工日期');
320
+ break;
321
+ }
322
+ });
323
+ // 校验必要字段是否存在
324
+ if (!startDate) {
325
+ console.warn('缺少【开工日期】字段,无法计算竣工日期');
326
+ return;
327
+ }
328
+ // 计算停工天数
329
+ let stopDays = 0;
330
+ if (resumeDate && stopDate) {
331
+ stopDays = this.getDaysBetween(resumeDate, stopDate);
332
+ }
333
+ // 总工期 = 原工期 + 停工天数
334
+ const totalDuration = duration + stopDays;
335
+ // 计算竣工日期 = 开工日期 + 总工期
336
+ const completionDate = this.addDaysToDate(startDate, totalDuration);
337
+ // 设置到表单项(可选)
338
+ this.setLabelValue('竣工日期', completionDate);
339
+ console.log('计算完成,竣工日期为:', completionDate);
340
+ return completionDate;
341
+ },
342
+
343
+ /**
344
+ * 计算两个日期之间的天数差
345
+ * @param {string} date1 - 第一个日期(格式:yyyy-MM-dd)
346
+ * @param {string} date2 - 第二个日期(格式:yyyy-MM-dd)
347
+ * @returns {number} - 天数差
348
+ */
349
+ getDaysBetween(date1, date2) {
350
+ const start = new Date(date1);
351
+ const end = new Date(date2);
352
+ const diffTime = Math.abs(end - start);
353
+ return Math.ceil(diffTime / (1000 * 60 * 60 * 24));
354
+ },
355
+
356
+ /**
357
+ * 给指定日期增加天数,返回格式为 yyyy-MM-dd 的字符串
358
+ * @param {string} dateString - 原始日期(格式:yyyy-MM-dd)
359
+ * @param {number} days - 要加的天数
360
+ * @returns {string} - 新日期字符串
361
+ */
362
+ addDaysToDate(dateString, days) {
363
+ const date = new Date(dateString);
364
+ date.setDate(date.getDate() + days);
365
+ const year = date.getFullYear();
366
+ const month = String(date.getMonth() + 1).padStart(2, '0');
367
+ const day = String(date.getDate()).padStart(2, '0');
368
+ return `${year}-${month}-${day}`;
369
+ }
370
+ },
371
+ events: {
372
+ //工程前期限制事件
373
+ async 'limit'(){
374
+ let rolename=this.$login.f.f_role_name
375
+ if(rolename.includes('工程前期申报内容填写权限')) {
376
+ for (const item of this.show_data.fields) {
377
+ if (item.label === '申报单编码' || item.label === '申报单完成时间') {
378
+ item.disabled = false
379
+ }
380
+ }
381
+ }
382
+ },
383
+ async 'addPEWelding'(index) {
384
+ let data = {
385
+ f_process_id : this.show_data.f_process_id,
386
+ f_type: 'PE焊接',
387
+ f_operator: this.$login.f.name,
388
+ f_operation_date: new Date().Format('yyyy-MM-dd'),
389
+ f_filiale: this.$login.f.orgs,
390
+ f_filialeid: this.$login.f.orgid,
391
+ f_orgid: this.$login.f.orgid,
392
+ f_orgname: this.$login.f.orgs
393
+ }
394
+ this.show_data.onetomany[index].fields.forEach(item => {
395
+ data[item.field] = item.value
396
+ })
397
+ let res = await this.$resetpost(
398
+ `rs/entity/t_acceptance`,
399
+ data
400
+ )
401
+ this.$dispatch('breakControl', this.show_data)
402
+ },
403
+ async 'addIndoorCheckpoint'(index) {
404
+ let data = {
405
+ f_process_id : this.show_data.f_process_id,
406
+ f_type: '户内验点',
407
+ f_operator: this.$login.f.name,
408
+ f_operation_date: new Date().Format('yyyy-MM-dd'),
409
+ f_filiale: this.$login.f.orgs,
410
+ f_filialeid: this.$login.f.orgid,
411
+ f_orgid: this.$login.f.orgid,
412
+ f_orgname: this.$login.f.orgs
413
+ }
414
+ this.show_data.onetomany[index].fields.forEach(item => {
415
+ data[item.field] = item.value
416
+ })
417
+ let res = await this.$resetpost(
418
+ `rs/entity/t_acceptance`,
419
+ data
420
+ )
421
+ this.$dispatch('breakControl', this.show_data)
422
+ },
423
+ async 'addCourtyardAcceptance'(index) {
424
+ let data = {
425
+ f_process_id : this.show_data.f_process_id,
426
+ f_type: '庭院验收',
427
+ f_operator: this.$login.f.name,
428
+ f_operation_date: new Date().Format('yyyy-MM-dd'),
429
+ f_filiale: this.$login.f.orgs,
430
+ f_filialeid: this.$login.f.orgid,
431
+ f_orgid: this.$login.f.orgid,
432
+ f_orgname: this.$login.f.orgs
433
+ }
434
+ this.show_data.onetomany[index].fields.forEach(item => {
435
+ data[item.field] = item.value
436
+ })
437
+ let res = await this.$resetpost(
438
+ `rs/entity/t_acceptance`,
439
+ data
440
+ )
441
+ this.$dispatch('breakControl', this.show_data)
442
+ },
443
+ async 'addPipeFittings'(index) {
444
+
445
+ let data = {
446
+ f_process_id : this.show_data.f_process_id,
447
+ defname: this.show_data.defname,
448
+ f_operator: this.$login.f.name,
449
+ f_operation_date: new Date().Format('yyyy-MM-dd'),
450
+ f_filiale: this.$login.f.orgs,
451
+ f_filialeid: this.$login.f.orgid,
452
+ f_orgid: this.$login.f.orgid,
453
+ f_orgname: this.$login.f.orgs
454
+ }
455
+ this.show_data.onetomany[index].fields.forEach(item => {
456
+ data[item.field] = item.value
457
+ })
458
+ let res = await this.$resetpost(
459
+ `rs/entity/t_pipe_fittings`,
460
+ data
461
+ )
462
+ this.$dispatch('breakControl', this.show_data)
463
+ },
464
+ 'openAddModel'(index) {
465
+ },
466
+ // 获取view层button事件
467
+ async 'button'(model) {
468
+ // 修改提交数据
469
+ model = Object.assign({}, this.selectdata, model)
470
+ // 点击重置按钮就重置数据
471
+ if (model.button.button_name === '重置') {
472
+ this.$dispatch('breakControl', this.data)
473
+ return
474
+ }
475
+ if (model.button.button_name === '停工') {
476
+ //获取系统当前时间
477
+ model.f_stop_work_time = new Date().Format('yyyy-MM-dd')
478
+ //将按钮改为保存
479
+ model.button.button_name = '保存'
480
+ }
481
+ if (model.button.button_name === '复工') {
482
+ //获取系统当前时间
483
+ model.f_start_work_time = new Date().Format('yyyy-MM-dd')
484
+ //将按钮改为保存
485
+ model.button.button_name = '保存'
486
+ }
487
+ // 提交前置
488
+ try {
489
+ model = await this.buttonBefore(model)
490
+ } catch (e) {
491
+ this.$showAlert(e, 'warning', 3000)
492
+ return
493
+ }
494
+
495
+ let http = new HttpResetClass()
496
+ let requestData = {
497
+ tables: this.data.tables,
498
+ start_activity: this.$workflow_vue.start_activity,
499
+ model: model,
500
+ loginUser: this.$login.f,
501
+ workflow_xmlfilename: this.$workflow_vue.workflow_xmlfilename
502
+ }
503
+ // 下发,提交,保存,退回通用业务后台处理logic
504
+ let url = 'rs/logic/ApplyProductService'
505
+ let res = await http.load('POST', url, {data: requestData}, {resolveMsg: null, rejectMsg: '数据保存失败'})
506
+
507
+ if (res.data.code == 200) {
508
+ this.$dispatch('search')
509
+ } else {
510
+ if (res.data.msg) {
511
+ this.$showMessage(res.data.msg)
512
+ }
513
+ }
514
+ },
515
+ async 'initializtionView'() {
516
+ if (this.show_data.f_apply_type === '主体项目' && this.show_data.defname === '工程前期') {
517
+ if (this.show_data.f_project_type === '支线') {
518
+ for (const item of this.show_data.fields) {
519
+ if (
520
+ item.label === '会签完毕时间'
521
+ ) {
522
+ item.hidden = true
523
+ item.required = false
524
+ }
525
+ }
526
+ } else {
527
+ for (const item of this.show_data.fields) {
528
+ if (
529
+ item.label === '领开挖证时间'
530
+ ) {
531
+ item.hidden = true
532
+ item.required = false
533
+ }
534
+ }
535
+ }
536
+ }
537
+
538
+ if (this.show_data.f_apply_type === '主体项目' && this.show_data.defname === '结算') {
539
+ if (this.show_data.f_project_type === '支线') {
540
+ for (const item of this.show_data.fields) {
541
+ if (
542
+ item.label === '预付款' ||
543
+ item.label === '预付款占比' ||
544
+ item.label === '预付款时间'
545
+ ) {
546
+ item.hidden = true
547
+ item.required = false
548
+ }
549
+ }
550
+ }
551
+ }
552
+ },
553
+ // 失去焦点出触发事件
554
+ async 'onchange'(index) {
555
+
556
+ // cea号重复提醒
557
+ if(this.show_data.defname==='信息录入'){
558
+ if (this.show_data.fields[index].label==='CEA号'){
559
+ const cea=this.getLableValue('CEA号')
560
+ if(cea){
561
+ let pcdText =`and f_cea_number = '${cea}'`
562
+ new HttpResetClass().load("POST", `${this.$androidUtil.getProxyUrl()}/rs/sql/singleTable`, {data:{items:"*",tablename:"t_apply",condition:` f_sub_state != '终止' ${pcdText} `}}, {resolveMsg: null, rejectMsg: null}).then((res)=>{
563
+ console.log('请求发送完成!!!!!'+JSON.stringify(res))
564
+ if(res.data.length>0){
565
+ this.$showAlert('该cea已经存在!!!', 'warning', 3000)
566
+ }
567
+ })
568
+
569
+ }
570
+ }
571
+ }
572
+
573
+ if (this.show_data.defname === '编制合同') {
574
+ if (this.show_data.fields[index].label==='室外安装费'|| this.show_data.fields[index].label==='室外甲供材'|| this.show_data.fields[index].label==='室外设备费'||this.show_data.fields[index].label==='室内安装费'|| this.show_data.fields[index].label==='室内甲供材'|| this.show_data.fields[index].label==='室内设备费') {
575
+
576
+ let a1 = this.getLableValue('室外安装费')
577
+ let b1 = this.getLableValue('室外甲供材')
578
+ let c1=this.getLableValue('室外设备费')
579
+ let a2 = this.getLableValue('室内安装费')
580
+ let b2 = this.getLableValue('室内甲供材')
581
+ let c2=this.getLableValue('室内设备费')
582
+ if(this.show_data.f_project_type!='支线'&&this.show_data.f_project_type!='主体'){
583
+ this.setLabelValue('合同总造价', parseFloat(parseFloat(a1) + parseFloat(b1) + parseFloat(c1)+ parseFloat(a2)+ parseFloat(b2)+ parseFloat(c2)).toFixed(2))
584
+ this.setLabelValue('安装费总和',parseFloat(parseFloat(a1)+ parseFloat(a2)).toFixed(2))
585
+ }
586
+ console.log('----------------------------------------')
587
+ }
588
+ if(this.show_data.fields[index].label==='室外安装费'|| this.show_data.fields[index].label==='室外甲供材'|| this.show_data.fields[index].label==='室外设备费'){
589
+ let a1 = this.getLableValue('室外安装费')
590
+ let b1 = this.getLableValue('室外甲供材')
591
+ let c1=this.getLableValue('室外设备费')
592
+
593
+ this.setLabelValue('室外税金', parseFloat(parseFloat(a1) * 0.03).toFixed(2))
594
+ this.setLabelValue('室外造价', parseFloat(parseFloat(a1) + parseFloat(b1) + parseFloat(c1)).toFixed(2))
595
+ }
596
+ if(this.show_data.fields[index].label==='室内安装费'|| this.show_data.fields[index].label==='室内甲供材'|| this.show_data.fields[index].label==='室内设备费'){
597
+ let a2 = this.getLableValue('室内安装费')
598
+ let b2 = this.getLableValue('室内甲供材')
599
+ let c2=this.getLableValue('室内设备费')
600
+ this.setLabelValue('室内税金', parseFloat(parseFloat(a2) * 0.03).toFixed(2))
601
+ this.setLabelValue('室内造价',parseFloat(parseFloat(a2) + parseFloat(b2) + parseFloat(c2)).toFixed(2))
602
+ }
603
+
604
+ }
605
+
606
+ console.log('失去焦点')
607
+ if (
608
+ this.show_data.fields[index].label === '合同编号' ||
609
+ this.show_data.fields[index].label === '工程编号'
610
+ ) {
611
+ try {
612
+ await this.checkDuplicate(index)
613
+ } catch (e) {
614
+ this.$showAlert(e, 'warning', 3000)
615
+ }
616
+ }
617
+
618
+ // 号码检测
619
+ if (this.show_data.fields[index].label === '电话号码') {
620
+ let phone = this.show_data.fields[index].value
621
+ // 电话号码效验
622
+ if (!(/^1[3456789]\d{9}$/.test(phone))) {
623
+ this.show_data.fields[index].value = ""
624
+ this.$showAlert('电话号码格式不正确,请重新输入。', 'info', 2000)
625
+ }
626
+ }
627
+ //时间提醒
628
+ // if (this.show_data.fields[index].label.includes("时间") || this.show_data.fields[index].type === 'datepicker') {
629
+ // let setTime = this.show_data.fields[index].value
630
+ // let nowTime = new Date().Format("yyyy-MM-dd HH:mm:ss")
631
+ // if (nowTime >= setTime) {
632
+ // this.$showMessage("请注意,当前节点时间/工期已过期!")
633
+ // }
634
+ // }
635
+ },
636
+ // input值发生变化
637
+ async 'oninput'(index) {
638
+
639
+ },
640
+ // 错误事件
641
+ error_check(index) {
642
+ // 时间格式检测
643
+ if (this.show_data.fields[index].type === 'datepicker' && !isEmpty(this.show_data.fields[index].value)) {
644
+
645
+ let dateReg = /^[1-9]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/
646
+ let timeReg = /^(20|21|22|23|[0-1]\d):[0-5]\d:[0-5]\d$/
647
+ let datetimeReg = /^[1-9]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])\s+(20|21|22|23|[0-1]\d):[0-5]\d:[0-5]\d$/
648
+ if (this.show_data.fields[index].format) {
649
+ if (this.show_data.fields[index].format === 'yyyy-MM-dd') {
650
+ if (!dateReg.test(this.show_data.fields[index].value)) {
651
+ this.show_data.fields[index].value = ''
652
+ this.$showAlert(this.show_data.fields[index].label + '格式错误如:2021-01-01', 'warning', 2000)
653
+ }
654
+ }
655
+ if (this.show_data.fields[index].format === 'HH:mm:ss') {
656
+ if (!timeReg.test(this.show_data.fields[index].value)) {
657
+ this.show_data.fields[index].value = ''
658
+ this.$showAlert(this.show_data.fields[index].label + '格式错误如:00:00:00', 'warning', 2000)
659
+ }
660
+ }
661
+ if (this.show_data.fields[index].format === 'yyyy-MM-dd HH:mm:ss') {
662
+ if (!datetimeReg.test(this.show_data.fields[index].value)) {
663
+ this.show_data.fields[index].value = ''
664
+ this.$showAlert(this.show_data.fields[index].label + '格式错误如:2021-01-01 00:00:00', 'warning', 2000)
665
+ }
666
+ }
667
+ } else {
668
+ if (!dateReg.test(this.show_data.fields[index].value)) {
669
+ this.show_data.fields[index].value = ''
670
+ this.$showAlert(this.show_data.fields[index].label + '格式错误如:2021-01-01', 'warning', 2000)
671
+ }
672
+ }
673
+ }
674
+ },
675
+ // onetomany模态框默认监听监听事件
676
+ async 'onetomanydelete'(i, j) {
677
+ console.log('默认删除')
678
+ let http = new HttpResetClass()
679
+ let data = {
680
+ table: this.show_data.onetomany[i].tables[0],
681
+ row: this.show_data.onetomany[i].rows[j]
682
+ }
683
+ let res = await http.load('POST', 'rs/logic/onetomanyDefaultDeleteEvent', {data: data}, {
684
+ resolveMsg: null,
685
+ rejectMsg: '删除失败'
686
+ })
687
+
688
+ if (res.data <= 0){
689
+ this.$showMessage('删除失败')
690
+ return
691
+ }
692
+
693
+ this.$dispatch('breakControl', this.show_data)
694
+ },
695
+ async 'onetomanyadd'(index) {
696
+
697
+ let data = {
698
+ f_process_id : this.show_data.f_process_id,
699
+ f_operator: this.$login.f.name,
700
+ f_operation_date: new Date().Format('yyyy-MM-dd'),
701
+ f_filiale: this.$login.f.orgs,
702
+ f_filialeid: this.$login.f.orgid,
703
+ f_orgid: this.$login.f.orgid,
704
+ f_orgname: this.$login.f.orgs
705
+ }
706
+ this.show_data.onetomany[index].fields.forEach(item => {
707
+ data[item.field] = item.value
708
+ })
709
+ let res = await this.$resetpost(
710
+ `rs/entity/${this.show_data.onetomany[index].tables[0]}`,
711
+ data
712
+ )
713
+ this.$dispatch('breakControl', this.show_data)
714
+ },
715
+ async 'onetomanyupdate'(i, j) {
716
+ let onetomany = this.show_data.onetomany[i]
717
+ let data = onetomany.rows[j]
718
+
719
+ onetomany.fields.forEach(item => {
720
+ data[item.field] = item.value
721
+ })
722
+ let res = await this.$resetpost(
723
+ `rs/entity/${this.show_data.onetomany[i].tables[0]}`,
724
+ data
725
+ )
726
+
727
+ this.$dispatch('breakControl', this.show_data)
728
+ },
729
+ // onetomany模态框监听事件
730
+ async 'onchange_modal'(index, i) {
731
+ },
732
+ async 'oninput_modal'(index, i) {
733
+ }
734
+ },
735
+ watch: {
736
+ }
737
+ }
738
+ </script>
739
+ <style scoped>
740
+ /*清除model中的浮动*/
741
+ .clearfix:after,.clearfix:before{
742
+ display: table;
743
+ }
744
+ .clearfix:after{
745
+ clear: both;
746
+ }
747
+ </style>