apply-clients 3.3.103 → 3.3.106

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,732 +1,732 @@
1
- <template>
2
- <div class="form-horizontal select-overspread">
3
- <validator name='v' @valid="$emit('valid')" @invalid="$emit('invalid')">
4
- <form>
5
- <div v-for="(index,item) in data.fields">
6
- <!--input-->
7
- <div :style="item.style ? item.style : ''"
8
- v-if="(item.type==='input' || item.type==='number'||item.type === 'tel'||item.type === 'email') && !item.hidden && (item.device === 'app' || !item.device) && (item.label != '证件号码')&&(item.label != '身份证') && (item.label != '用户电话')"
9
- :class="[item.required && !(item.value) ? 'apply-has-error' : '', item.bootstraped ? item.bootstraped + ' form-group app-input':'col-xs-12 form-group app-input']">
10
- <label class="control-label-justify">{{item.label}}</label>
11
- <div :style="item.value_style ? item.value_style:''"
12
- :class="item.value_bootstraped ? item.value_bootstraped : 'col-xs-8'">
13
- <input class="" style="width: 100%"
14
- :type="item.type"
15
- v-model="data.fields[index].value"
16
- :placeholder="item.placeholder"
17
- :value="data.fields[index].value"
18
- :readonly="item.readonly"
19
- :disabled="item.disabled"
20
- @change="onchange(index)"
21
- @blur="onblur(index)"
22
- @input="oninput(index)"
23
- />
24
- </div>
25
- </div>
26
-
27
- <div :style="item.style ? item.style : ''"
28
- v-if="(data.fields[index-1].value ==='营业执照'||data.fields[index-1].value ==='军官证')&& (item.label === '证件号码')"
29
- :class="[item.required && !(item.value) ? 'apply-has-error' : '', item.bootstraped ? item.bootstraped + ' form-group app-input':'col-xs-12 form-group app-input']">
30
- <label class="control-label-justify">{{item.label}}</label>
31
- <div :style="item.value_style ? item.value_style:''"
32
- :class="item.value_bootstraped ? item.value_bootstraped : 'col-xs-8'">
33
- <input class="" style="width: 100%"
34
- :type="item.type"
35
- v-model="data.fields[index].value"
36
- :placeholder="item.placeholder"
37
- :value="data.fields[index].value"
38
- :readonly="item.readonly"
39
- :disabled="item.disabled"
40
- @change="onchange(index)"
41
- @blur="onblur(index)"
42
- @input="oninput(index)"
43
- />
44
- </div>
45
- </div>
46
-
47
-
48
- <!--input身份证验证-->
49
- <div :style="item.style ? item.style : ''"
50
- v-if="(item.label==='身份证') || (item.label === '证件号码' && data.fields[index-1].value ==='身份证')"
51
- :class="[$v.f_idnumber2.identityCardValid ? 'apply-has-error' : '',item.bootstraped ? item.bootstraped + ' form-group app-input':'col-xs-12 form-group app-input']">
52
- <label class="control-label-justify">{{item.label}}</label>
53
- <div :style="item.value_style ? item.value_style:''"
54
- :class="item.value_bootstraped ? item.value_bootstraped : 'col-xs-8'">
55
- <input class="" style="width: 100%"
56
- :type="item.type"
57
- maxlength="18"
58
- v-model="data.fields[index].value"
59
- :placeholder="item.placeholder"
60
- :value="data.fields[index].value"
61
- onKeypress="return(/[\d\.]/.test(String.fromCharCode(event.keyCode)))"
62
- :readonly="item.readonly"
63
- v-validate:f_idnumber2='{identityCardValid: true}'
64
- @change="onchange(index)"
65
- @blur="onblur(index)"
66
- @input="oninput(index)"
67
- />
68
- </div>
69
- </div>
70
-
71
-
72
- <!--input手机号验证-->
73
- <div :style="item.style ? item.style : ''"
74
- v-if="item.label === '用户电话'"
75
- :class="[$v.f_user_phone.minlength || $v.f_user_phone.maxlength ? 'apply-has-error' : '',item.bootstraped ? item.bootstraped + ' form-group app-input':'col-xs-12 form-group app-input']">
76
- <label class="control-label-justify">{{item.label}}</label>
77
- <div :style="item.value_style ? item.value_style:''"
78
- :class="item.value_bootstraped ? item.value_bootstraped : 'col-xs-8'">
79
- <input class="" style="width: 100%"
80
- maxlength="18"
81
- type="number"
82
- onKeypress="return(/[\d\.]/.test(String.fromCharCode(event.keyCode)))"
83
- oninput="if(value.length > 11) value=value.slice(0,11)"
84
- v-validate:f_user_phone="{minlength: 7, maxlength: 11 }"
85
- v-model="data.fields[index].value"
86
- :placeholder="item.placeholder"
87
- :value="data.fields[index].value"
88
- :readonly="item.readonly"
89
- @change="onchange(index)"
90
- @blur="onblur(index)"
91
- @input="oninput(index)"
92
- />
93
- </div>
94
- </div>
95
-
96
- <!--select-->
97
- <div :style="item.style ? item.style : ''"
98
- v-if="item.type==='select' && !item.hidden && (item.device === 'app' || !item.device)"
99
- :class="[item.required && !(item.value) ? 'apply-has-error' : '', item.bootstraped ? item.bootstraped + ' form-group app-input':'col-xs-12 form-group app-input']">
100
- <label class="control-label-justify">{{item.label}}</label>
101
- <div :style="item.value_style ? item.value_style:''"
102
- :class="item.value_bootstraped ? item.value_bootstraped : 'col-xs-8'">
103
- <v-select
104
- class="select" width="100%" align="right"
105
- :placeholder="item.placeholder"
106
- :search="item.search"
107
- close-on-select value-single
108
- @select-search="selectSearch($arguments,index)"
109
- :options="data.fields[index].options"
110
- v-model="data.fields[index].value"
111
- :value.sync="data.fields[index].value"
112
- @blur="onblur(index)"
113
- @change="onchange(index)"
114
- :readonly="item.readonly"
115
- :disabled="item.disabled"
116
- ></v-select>
117
- </div>
118
- </div>
119
-
120
- <!--时间datepicker-->
121
- <div :style="item.style ? item.style : ''"
122
- v-if="item.type==='datepicker' && !item.hidden && (item.device === 'app' || !item.device)"
123
- :class="[item.required && !(item.value) ? 'apply-has-error' : '', item.bootstraped ? item.bootstraped+' form-group app-input':'col-xs-12 form-group app-input']">
124
- <label class="control-label-justify">{{item.label}}</label>
125
- <div class="form-group" :style="item.value_style ? item.value_style:''"
126
- :class="item.value_bootstraped ? item.value_bootstraped : 'col-xs-8'">
127
- <datepicker
128
- @change="onchange(index)"
129
- @blur="onblur(index)"
130
- :placeholder="item.placeholder"
131
- :value.sync="data.fields[index].value"
132
- :format="item.format ? item.format : 'yyyy-MM-dd'"
133
- v-model="data.fields[index].value"
134
- :readonly="item.readonly"
135
- :disabled="item.disabled"
136
- :show-reset-button="true">
137
- </datepicker>
138
- </div>
139
- </div>
140
-
141
- <!--textarea-->
142
- <div :style="item.style ? item.style : ''"
143
- v-if="item.type==='textarea' && !item.hidden && (item.device === 'app' || !item.device)"
144
- :class="[item.required && !(item.value) ? 'apply-has-error' : '', item.bootstraped?item.bootstraped+' form-group app-input':'col-xs-12 form-group app-input']">
145
- <label class="control-label-justify">{{item.label}}</label>
146
- <div :style="item.value_style ? item.value_style:''"
147
- :class="item.value_bootstraped ? item.value_bootstraped : 'col-xs-8'">
148
- <textarea
149
- :readonly="item.readonly"
150
- :disabled="item.disabled"
151
- class="" rows="1"
152
- style="width: 100%;height: 100%"
153
- v-model="data.fields[index].value"
154
- :value="data.fields[index].value"
155
- @change="onchange(index)"
156
- @blur="onblur(index)"
157
- @input="oninput(index)"
158
- ></textarea>
159
- </div>
160
- </div>
161
-
162
- <!--checkbox-->
163
- <div :style="item.style ? item.style : ''"
164
- v-if="item.type==='checkbox' && !item.hidden && (item.device === 'app' || !item.device)"
165
- :class="[item.required && item.value.length === 0 ? 'apply-has-error' : '',item.bootstraped?item.bootstraped+' form-group app-input':'col-xs-12 form-group app-input']">
166
- <label class="control-label-justify">{{item.label}}</label>
167
- <div :style="item.value_style ? item.value_style:''"
168
- :class="item.value_bootstraped ? item.value_bootstraped : 'col-xs-8'">
169
- <label class="" v-for="(index2,row) in item.options">
170
- <input type="checkbox" class=""
171
- :readonly="data.fields[index].readonly"
172
- :disabled="data.fields[index].disabled"
173
- v-model="data.fields[index].value"
174
- :value="data.fields[index].options[index2].value"
175
- @change="onchange(index)"
176
- @blur="onblur(index)">
177
- {{row.label}}
178
- </label>
179
- </div>
180
- </div>
181
- </div>
182
- <div class="col-sm-12 col-xs-12" id="test11">
183
- <accordion one-at-a-time="true">
184
- <panel v-for="(i,item) in data.onetomany" :header="item.title" :is-open="false" type="primary">
185
- <app-onetomany :onetomany="item" :index="i" :selectdata="data"></app-onetomany>
186
- </panel>
187
- <panel v-for="(i,item) in data.components" :header="item.title" :is-open="false" type="primary" v-if="item.device === 'app' || !item.device">
188
- <component :is="item.name" :selectdata="data" :mark="item.mark"></component>
189
- </panel>
190
- </accordion>
191
- </div>
192
-
193
- <!--自定义组件-->
194
- <slot>
195
-
196
- </slot>
197
-
198
- <!-- 按钮组 -->
199
- <div class="text-center">
200
- <button v-for="(index,button) in data.buttons"
201
- :disabled="button.disabled && disable_button"
202
- style="min-width:100px"
203
- :class="button.disabled && disable_button ? 'btn btn-default button_spacing' : 'btn btn-primary button_spacing'"
204
- v-if="!button.hidden && button.button_name !=='提交'&& button.button_name !=='确认'"
205
- @click.prevent="click_but(button)"
206
- >
207
- {{button.button_name}}
208
- </button>
209
- <button v-for="(index,button) in data.buttons"
210
- :disabled="(button.disabled && disable_button) || (!$v.valid)"
211
- style="min-width:100px"
212
- :class="button.disabled && disable_button || (!$v.valid) ? 'btn btn-default button_spacing' : 'btn btn-primary button_spacing'"
213
- v-if="!button.hidden && (button.button_name ==='提交'||button.button_name ==='确认')"
214
- @click.prevent="click_but(button)"
215
- >
216
- {{button.button_name}}
217
- </button>
218
- </div>
219
-
220
- <!-- 按钮模态框 -->
221
- <modal v-if="showButModal" :show.sync="showButModal" backdrop="false" large>
222
- <header slot="modal-header" class="modal-header">
223
- <button type="button" class="close" @click="closeModal()"><span>&times;</span></button>
224
- <span class="modal-title"><font
225
- size="3">{{data.button.button_name}}</font></span>
226
- </header>
227
- <article slot="modal-body" class="modal-body clearfix">
228
- <div class="form-group" >
229
- <div v-for="(index,item) in data.button.button_fields">
230
- <div :style="item.style ? item.style : ''" :class="[item.required && !(item.value) ? 'has-error' : '', item.bootstraped ? item.bootstraped + ' form-group' : 'form-group']"
231
- v-if="(item.type==='input' || item.type==='number'||item.type === 'tel'||item.type === 'email') && !item.hidden && (item.device === 'pc' || !item.device)">
232
- <label :style="item.label_style ? item.label_style : ''"
233
- :class="item.label_bootstraped ? item.label_bootstraped + ' control-label-justify control-label' : 'control-label-justify control-label'">{{item.label}}</label>
234
- <div :style="item.value_style ? item.value_style : ''"
235
- :class="item.value_bootstraped ? item.value_bootstraped : 'col-xs-8'">
236
- <input class="form-control input_view"
237
- :placeholder="item.placeholder"
238
- :type="item.type"
239
- v-model="item.value"
240
- :value="item.value"
241
- :readonly="item.readonly"
242
- :disabled="item.disabled"
243
- @change="onbutchange(index)"
244
- @blur="onbutblur(index)"
245
- @input="onbutinput(index)"
246
- />
247
- </div>
248
- </div>
249
-
250
- <!--时间datepicker-->
251
- <div :style="item.style ? item.style : ''" :class="[item.required && !(item.value) ? 'has-error' : '', item.bootstraped ? item.bootstraped + ' form-group':'form-group']"
252
- v-if="item.type==='datepicker' && !item.hidden && (item.device === 'pc' || !item.device)">
253
- <label :style="item.label_style ? item.label_style : ''"
254
- :class="item.label_bootstraped ? item.label_bootstraped + ' control-label-justify control-label' : 'control-label-justify control-label'">{{item.label}}</label>
255
- <div :style="item.value_style ? item.value_style : ''"
256
- :class="item.value_bootstraped ? item.value_bootstraped : 'col-xs-8'">
257
- <datepicker
258
- :placeholder="item.placeholder"
259
- :value.sync="item.value"
260
- v-model="item.value"
261
- :readonly="item.readonly"
262
- :disabled="item.disabled"
263
- :format="item.format ? item.format : 'yyyy-MM-dd'"
264
- :show-reset-button="true"
265
- @change="onbutchange(index)"
266
- @blur="onbutblur(index)"
267
- ></datepicker>
268
- </div>
269
- </div>
270
-
271
- <!--select-->
272
- <div :style="item.style ? item.style : ''" :class="[item.required && !(item.value) ? 'has-error' : '', item.bootstraped ? item.bootstraped + ' form-group':'form-group']"
273
- v-if="item.type==='select' && !item.hidden && (item.device === 'pc' || !item.device)">
274
- <label :style="item.label_style ? item.label_style : ''"
275
- :class="item.label_bootstraped ? item.label_bootstraped + ' control-label-justify control-label' : 'control-label-justify control-label'">{{item.label}}</label>
276
- <div :style="item.value_style ? item.value_style : ''"
277
- :class="item.value_bootstraped ? item.value_bootstraped : 'col-xs-8'">
278
- <input-select
279
- class="select select_list"
280
- :value.sync="item.value"
281
- v-model="item.value"
282
- :options='item.options'
283
- :readonly="item.readonly"
284
- :disable="item.disabled"
285
- :valueSingle="true"
286
- @blur="onbutblur(index)"
287
- @change="onbutchange(index)"
288
- ></input-select>
289
- </div>
290
- </div>
291
-
292
- <!--textarea-->
293
- <div :style="item.style ? item.style : ''" :class="[item.required && !(item.value) ? 'has-error' : '', item.bootstraped ? item.bootstraped + ' form-group':'form-group']"
294
- v-if="item.type==='textarea' && !item.hidden && (item.device === 'pc' || !item.device)">
295
- <label :style="item.label_style ? item.label_style : ''"
296
- :class="item.label_bootstraped ? item.label_bootstraped + ' control-label-justify control-label' : 'control-label-justify control-label'">{{item.label}}</label>
297
- <div :style="item.value_style ? item.value_style : ''"
298
- :class="item.value_bootstraped ? item.value_bootstraped : 'col-xs-8'">
299
- <textarea
300
- class="form-control input_view"
301
- style="width: 100%;height: 100%"
302
- v-model="item.value"
303
- :value="item.value"
304
- :rows="item.rows"
305
- :readonly="item.readonly"
306
- :disabled="item.disabled"
307
- @change="onbutchange(index)"
308
- @blur="onbutblur(index)"
309
- @input="onbutinput(index)"
310
- ></textarea>
311
- </div>
312
- </div>
313
- </div>
314
- </div>
315
- </article>
316
- <footer slot="modal-footer" class="modal-footer">
317
- <button :class="disable_modal_button ? 'btn btn-default':'btn btn-primary'"
318
- :disabled="disable_modal_button" type="button" @click="confirmModal()">
319
- 确认
320
- </button>
321
- </footer>
322
- </modal>
323
- </form>
324
- </div>
325
- </template>
326
- <script>
327
- import Vue from 'vue'
328
- import {isEmpty} from "../Util";
329
- // Date格式化
330
- Date.prototype.Format = function (fmt) {
331
- var o = {
332
- 'M+': this.getMonth() + 1, // 月份
333
- 'd+': this.getDate(), // 日
334
- 'H+': this.getHours(), // 小时
335
- 'm+': this.getMinutes(), // 分
336
- 's+': this.getSeconds(), // 秒
337
- 'q+': Math.floor((this.getMonth() + 3) / 3), // 季度
338
- 'S': this.getMilliseconds() // 毫秒
339
- }
340
- if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + '').substr(4 - RegExp.$1.length))
341
- for (var k in o) {
342
- if (new RegExp('(' + k + ')').test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length)))
343
- }
344
- return fmt
345
- }
346
-
347
- export default {
348
- title: '报建业务通用组件',
349
- props: {
350
- data: {
351
- type: Object
352
- },
353
- showprint: {
354
- type: Boolean,
355
- default: true
356
- }
357
- },
358
- data () {
359
- return {
360
- model: {}, // 公司等属性
361
- disable_button: true, // 控制按钮禁用
362
- disable_modal_button: true, // 控制按钮禁用
363
- showButModal: false,
364
- areaData:{
365
- sjvalue:'',
366
- xianvalue:'',
367
- sqvalue:'',
368
- }
369
- }
370
- },
371
- watch: {
372
- deep: true
373
- },
374
- computed: {
375
-
376
- },
377
- created () {
378
- // 初始化数据
379
- this.initializtion()
380
- if (this.data.readyEvent) {
381
- this.$dispatch(this.data.readyEvent)
382
- }
383
- this.$dispatch('initializtionView')
384
- },
385
- methods: {
386
- // 初始化数据
387
- initializtion () {
388
- for (const item of this.data.fields) {
389
- this.data[item.field] = item.value
390
- }
391
- // 是否禁用按钮
392
- this.disableButton()
393
- },
394
- async getSelectShijiValue(sjvalue,sjlable) {
395
-
396
- this.areaData.sjvalue = sjvalue
397
- console.log("这是父级接收的市级值:",sjvalue,sjlable)
398
- this.data.areaData = this.areaData
399
- console.log(this.areaData)
400
- // 是否禁用按钮
401
- this.disableButton()
402
- },
403
- async getSelectXianValue(xianvalue,xianlable) {
404
-
405
- this.areaData.xianvalue = xianvalue
406
- this.data.areaData = this.areaData
407
- console.log("这是父级接收的县级值:",xianvalue,xianlable)
408
- console.log(this.areaData)
409
-
410
- // 是否禁用按钮
411
- this.disableButton()
412
- },
413
- async getSelectShequValue(sqvalue,sqlable) {
414
- this.areaData.sqvalue = sqvalue
415
- this.data.areaData = this.areaData
416
- console.log(this.areaData)
417
- console.log("这是父级接收的社区值:",sqvalue,sqlable)
418
-
419
- // 是否禁用按钮
420
- this.disableButton()
421
- },
422
- // 是否禁用按钮
423
- disableButton () {
424
- let flag = false
425
-
426
- for (const field of this.data.fields) {
427
- if (field.required && !field.value && !field.hidden && field.value !== 0) {
428
- flag = true
429
- }
430
-
431
- // 任何选择框只要是否都不能提交
432
- if (field.type === 'select' && field.value === '否' && field.value_no_disable) {
433
- flag = true
434
- }
435
-
436
- if (field.type === 'checkbox' && field.required && field.value.length === 0) {
437
- flag = true
438
- }
439
- }
440
-
441
- //区域下拉框必选 流程模式为报警器报建
442
- if (this.data.f_apply_type === '报警器报建' && this.data.defname === '工程施工' && this.data.title === '工程施工' && this.data.f_sub_state !='完工'){
443
- if (!flag){
444
- if (this.areaData.sjvalue ==null || this.areaData.sjvalue.length ==0 || this.areaData.sqvalue == null || this.areaData.sqvalue.length ==0
445
- || this.areaData.xianvalue == null || this.areaData.xianvalue == 0){
446
- console.log("区域为空禁止提交:",this.areaData)
447
- flag = true
448
- }
449
- }
450
- }
451
-
452
- this.disable_button = flag
453
- },
454
- // 失去焦点且值最终发生变化触发
455
- async onchange (index) {
456
- // 是否禁用按钮
457
- this.disableButton()
458
-
459
- if (!isEmpty(this.data.fields[index].value)) {
460
- // 前缀、后缀
461
- if (this.data.fields[index].prefix) {
462
- this.data.fields[index].value = this.data.fields[index].prefix + this.data.fields[index].value
463
- }
464
- if (this.data.fields[index].suffix) {
465
- this.data.fields[index].value = this.data.fields[index].value + this.data.fields[index].suffix
466
- }
467
- }
468
-
469
- // data赋值
470
- this.data[this.data.fields[index].field] = this.data.fields[index].value
471
-
472
- if (this.data.fields[index].type === 'datepicker') {
473
- this.check_datepicker(index)
474
- }
475
-
476
- if (this.data.fields[index].onchange) {
477
- this.$dispatch(this.data.fields[index].onchange, index)
478
- }
479
- this.$dispatch('onchange', index)
480
-
481
-
482
- },
483
- // 失去焦点触发,无论值是否发生变化
484
- onblur (index) {
485
- this.disableButton()
486
-
487
- if (this.data.fields[index].onblur) {
488
- this.$dispatch(this.data.fields[index].onblur, index)
489
- }
490
-
491
- this.$dispatch('onblur', index)
492
- },
493
- oninput (index) {
494
- // 是否禁用按钮
495
- this.disableButton()
496
-
497
- if (this.data.fields[index].oninput) {
498
- this.$dispatch(this.data.fields[index].oninput, index)
499
- }
500
- this.$dispatch('oninput', index)
501
- },
502
- // 点击按钮组按钮
503
- async click_but (button) {
504
- //报警器区域地址
505
- this.data.areaData = this.areaData
506
-
507
- if (this.data.defname === '通气点火') {
508
-
509
- this.$showMessage(`请确认表号是否正确`).then((res) => {
510
-
511
-
512
- this.disable_button = true
513
-
514
- this.data.fields.forEach(item => {
515
- this.data[item.field] = item.value
516
- })
517
-
518
- this.data.button = button
519
-
520
- if (button.button_fields && button.button_fields.length > 0) {
521
- this.showButModal = true
522
- return
523
- }
524
-
525
- if (this.data.button.event) {
526
- this.$dispatch(this.data.button.event)
527
- } else {
528
- this.$dispatch('button')
529
- }
530
-
531
- })
532
-
533
- }
534
- else{
535
- this.disable_button = true
536
-
537
- this.data.fields.forEach(item => {
538
- this.data[item.field] = item.value
539
- })
540
-
541
- this.data.button = button
542
-
543
- if (button.button_fields && button.button_fields.length > 0) {
544
- this.showButModal = true
545
- return
546
- }
547
-
548
- if (this.data.button.event) {
549
- this.$dispatch(this.data.button.event)
550
- } else {
551
- this.$dispatch('button')
552
- }
553
- }
554
-
555
- },
556
- confirmModal () {
557
- this.closeModal()
558
-
559
- this.data.button.button_fields.forEach(item => {
560
- this.data.button[item.field] = item.value
561
- })
562
-
563
- if (this.data.button.event) {
564
- this.$dispatch(this.data.button.event)
565
- } else {
566
- this.$dispatch('button')
567
- }
568
- },
569
- // 关闭模态框
570
- closeModal () {
571
- this.showButModal = false
572
- this.disable_modal_button = true
573
- },
574
- onbutchange (index) {
575
- // 是否禁用按钮
576
- this.disableModalButton()
577
-
578
- if (this.data.button.button_fields[index].onchange) {
579
- this.$dispatch(this.data.button.button_fields[index].onchange, index)
580
- } else {
581
- this.$dispatch('onbutchange', index)
582
- }
583
-
584
- },
585
- onbutblur (index) {
586
- this.disableModalButton()
587
-
588
- if (this.data.button.button_fields[index].onblur) {
589
- this.$dispatch(this.data.button.button_fields[index].onblur, index)
590
- } else {
591
- this.$dispatch('onbutblur', index)
592
- }
593
- },
594
- onbutinput (index) {
595
- // 是否禁用按钮
596
- this.disableModalButton()
597
-
598
- if (this.data.button.button_fields[index].oninput) {
599
- this.$dispatch(this.data.button.button_fields[index].oninput, index)
600
- } else {
601
- this.$dispatch('onbutinput', index)
602
- }
603
- },
604
- disableModalButton () {
605
- let flag = false
606
-
607
-
608
- for (const item of this.data.button.button_fields) {
609
- if (item.required && !item.value) {
610
- if (item.value === 0) {
611
- flag = false
612
- } else {
613
- flag = true
614
- }
615
- }
616
- }
617
-
618
- this.disable_modal_button = flag
619
- },
620
- check_datepicker (index) {
621
- // 时间格式检测
622
- if (!isEmpty(this.data.fields[index].value)) {
623
-
624
- let dateReg = /^[1-9]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/
625
- let timeReg = /^(20|21|22|23|[0-1]\d):[0-5]\d:[0-5]\d$/
626
- 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$/
627
- if (this.data.fields[index].format) {
628
- if (this.data.fields[index].format === 'yyyy-MM-dd') {
629
- if (!dateReg.test(this.data.fields[index].value)) {
630
- this.data.fields[index].value = ''
631
- this.$showAlert(this.data.fields[index].label + '格式错误如:2021-01-01', 'warning', 2000)
632
- }
633
- }
634
- if (this.data.fields[index].format === 'HH:mm:ss') {
635
- if (!timeReg.test(this.data.fields[index].value)) {
636
- this.data.fields[index].value = ''
637
- this.$showAlert(this.data.fields[index].label + '格式错误如:00:00:00', 'warning', 2000)
638
- }
639
- }
640
- if (this.data.fields[index].format === 'yyyy-MM-dd HH:mm:ss') {
641
- if (!datetimeReg.test(this.data.fields[index].value)) {
642
- this.data.fields[index].value = ''
643
- this.$showAlert(this.data.fields[index].label + '格式错误如:2021-01-01 00:00:00', 'warning', 2000)
644
- }
645
- }
646
- } else {
647
- if (!dateReg.test(this.data.fields[index].value)) {
648
- this.data.fields[index].value = ''
649
- this.$showAlert(this.data.fields[index].label + '格式错误如:2021-01-01', 'warning', 2000)
650
- }
651
- }
652
- }
653
- },
654
- selectSearch(event, index) {
655
- if (this.data.fields[index].selectSearch) {
656
- this.$dispatch(this.data.fields[index].selectSearch, event[0], index)
657
- }
658
- this.$dispatch('selectSearch', event[0], index)
659
- }
660
- },
661
- events: {
662
- }
663
- }
664
- </script>
665
- <style scoped>
666
- .control-label-justify {
667
- width: 30%;
668
- text-align: justify;
669
- text-align-last: justify;
670
- font-family: PingFang-SC-Bold;
671
- float: left;
672
- }
673
- .button_spacing{margin: 0px 0px 0px 10px;}
674
- </style>
675
- <style lang="less">
676
- .apply-has-error {
677
- border-bottom: 1px solid #a94442;
678
- }
679
- .app-input {
680
- label {
681
- float: left;
682
- }
683
- .select {
684
- button {
685
- border: none;
686
- outline: none;
687
- text-align: left;
688
- .btn-placeholder {
689
- color: #ACA899
690
- }
691
- }
692
- }
693
- .datepicker {
694
- .form-control:focus {
695
- border: none!important;
696
- outline: none!important;
697
- -webkit-box-shadow: none;
698
- box-shadow: none;
699
- }
700
- }
701
- textarea {
702
- padding: 8px 10px;
703
- border: none;
704
- outline: none;
705
- margin: 0px;
706
- }
707
- input[readonly]{
708
- color: #ACA899!important;
709
- background: #FFFFFF;
710
- border: none;
711
- outline: none;
712
- }
713
- input:disabled{
714
- color: #ACA899!important;
715
- background: #FFFFFF;
716
- border: none;
717
- outline: none;
718
- }
719
- textarea[readonly]{
720
- color: #ACA899!important;
721
- background: #FFFFFF;
722
- border: none;
723
- outline: none;
724
- }
725
- textarea:disabled{
726
- color: #ACA899!important;
727
- background: #FFFFFF;
728
- border: none;
729
- outline: none;
730
- }
731
- }
732
- </style>
1
+ <template>
2
+ <div class="form-horizontal select-overspread">
3
+ <validator name='v' @valid="$emit('valid')" @invalid="$emit('invalid')">
4
+ <form>
5
+ <div v-for="(index,item) in data.fields">
6
+ <!--input-->
7
+ <div :style="item.style ? item.style : ''"
8
+ v-if="(item.type==='input' || item.type==='number'||item.type === 'tel'||item.type === 'email') && !item.hidden && (item.device === 'app' || !item.device) && (item.label != '证件号码')&&(item.label != '身份证') && (item.label != '用户电话')"
9
+ :class="[item.required && !(item.value) ? 'apply-has-error' : '', item.bootstraped ? item.bootstraped + ' form-group app-input':'col-xs-12 form-group app-input']">
10
+ <label class="control-label-justify">{{item.label}}</label>
11
+ <div :style="item.value_style ? item.value_style:''"
12
+ :class="item.value_bootstraped ? item.value_bootstraped : 'col-xs-8'">
13
+ <input class="" style="width: 100%"
14
+ :type="item.type"
15
+ v-model="data.fields[index].value"
16
+ :placeholder="item.placeholder"
17
+ :value="data.fields[index].value"
18
+ :readonly="item.readonly"
19
+ :disabled="item.disabled"
20
+ @change="onchange(index)"
21
+ @blur="onblur(index)"
22
+ @input="oninput(index)"
23
+ />
24
+ </div>
25
+ </div>
26
+
27
+ <div :style="item.style ? item.style : ''"
28
+ v-if="(data.fields[index-1].value ==='营业执照'||data.fields[index-1].value ==='军官证')&& (item.label === '证件号码')"
29
+ :class="[item.required && !(item.value) ? 'apply-has-error' : '', item.bootstraped ? item.bootstraped + ' form-group app-input':'col-xs-12 form-group app-input']">
30
+ <label class="control-label-justify">{{item.label}}</label>
31
+ <div :style="item.value_style ? item.value_style:''"
32
+ :class="item.value_bootstraped ? item.value_bootstraped : 'col-xs-8'">
33
+ <input class="" style="width: 100%"
34
+ :type="item.type"
35
+ v-model="data.fields[index].value"
36
+ :placeholder="item.placeholder"
37
+ :value="data.fields[index].value"
38
+ :readonly="item.readonly"
39
+ :disabled="item.disabled"
40
+ @change="onchange(index)"
41
+ @blur="onblur(index)"
42
+ @input="oninput(index)"
43
+ />
44
+ </div>
45
+ </div>
46
+
47
+
48
+ <!--input身份证验证-->
49
+ <div :style="item.style ? item.style : ''"
50
+ v-if="(item.label==='身份证') || (item.label === '证件号码' && data.fields[index-1].value ==='身份证')"
51
+ :class="[$v.f_idnumber2.identityCardValid ? 'apply-has-error' : '',item.bootstraped ? item.bootstraped + ' form-group app-input':'col-xs-12 form-group app-input']">
52
+ <label class="control-label-justify">{{item.label}}</label>
53
+ <div :style="item.value_style ? item.value_style:''"
54
+ :class="item.value_bootstraped ? item.value_bootstraped : 'col-xs-8'">
55
+ <input class="" style="width: 100%"
56
+ :type="item.type"
57
+ maxlength="18"
58
+ v-model="data.fields[index].value"
59
+ :placeholder="item.placeholder"
60
+ :value="data.fields[index].value"
61
+ onKeypress="return(/[\d\.]/.test(String.fromCharCode(event.keyCode)))"
62
+ :readonly="item.readonly"
63
+ v-validate:f_idnumber2='{identityCardValid: true}'
64
+ @change="onchange(index)"
65
+ @blur="onblur(index)"
66
+ @input="oninput(index)"
67
+ />
68
+ </div>
69
+ </div>
70
+
71
+
72
+ <!--input手机号验证-->
73
+ <div :style="item.style ? item.style : ''"
74
+ v-if="item.label === '用户电话'"
75
+ :class="[$v.f_user_phone.minlength || $v.f_user_phone.maxlength ? 'apply-has-error' : '',item.bootstraped ? item.bootstraped + ' form-group app-input':'col-xs-12 form-group app-input']">
76
+ <label class="control-label-justify">{{item.label}}</label>
77
+ <div :style="item.value_style ? item.value_style:''"
78
+ :class="item.value_bootstraped ? item.value_bootstraped : 'col-xs-8'">
79
+ <input class="" style="width: 100%"
80
+ maxlength="18"
81
+ type="number"
82
+ onKeypress="return(/[\d\.]/.test(String.fromCharCode(event.keyCode)))"
83
+ oninput="if(value.length > 11) value=value.slice(0,11)"
84
+ v-validate:f_user_phone="{minlength: 7, maxlength: 11 }"
85
+ v-model="data.fields[index].value"
86
+ :placeholder="item.placeholder"
87
+ :value="data.fields[index].value"
88
+ :readonly="item.readonly"
89
+ @change="onchange(index)"
90
+ @blur="onblur(index)"
91
+ @input="oninput(index)"
92
+ />
93
+ </div>
94
+ </div>
95
+
96
+ <!--select-->
97
+ <div :style="item.style ? item.style : ''"
98
+ v-if="item.type==='select' && !item.hidden && (item.device === 'app' || !item.device)"
99
+ :class="[item.required && !(item.value) ? 'apply-has-error' : '', item.bootstraped ? item.bootstraped + ' form-group app-input':'col-xs-12 form-group app-input']">
100
+ <label class="control-label-justify">{{item.label}}</label>
101
+ <div :style="item.value_style ? item.value_style:''"
102
+ :class="item.value_bootstraped ? item.value_bootstraped : 'col-xs-8'">
103
+ <v-select
104
+ class="select" width="100%" align="right"
105
+ :placeholder="item.placeholder"
106
+ :search="item.search"
107
+ close-on-select value-single
108
+ @select-search="selectSearch($arguments,index)"
109
+ :options="data.fields[index].options"
110
+ v-model="data.fields[index].value"
111
+ :value.sync="data.fields[index].value"
112
+ @blur="onblur(index)"
113
+ @change="onchange(index)"
114
+ :readonly="item.readonly"
115
+ :disabled="item.disabled"
116
+ ></v-select>
117
+ </div>
118
+ </div>
119
+
120
+ <!--时间datepicker-->
121
+ <div :style="item.style ? item.style : ''"
122
+ v-if="item.type==='datepicker' && !item.hidden && (item.device === 'app' || !item.device)"
123
+ :class="[item.required && !(item.value) ? 'apply-has-error' : '', item.bootstraped ? item.bootstraped+' form-group app-input':'col-xs-12 form-group app-input']">
124
+ <label class="control-label-justify">{{item.label}}</label>
125
+ <div class="form-group" :style="item.value_style ? item.value_style:''"
126
+ :class="item.value_bootstraped ? item.value_bootstraped : 'col-xs-8'">
127
+ <datepicker
128
+ @change="onchange(index)"
129
+ @blur="onblur(index)"
130
+ :placeholder="item.placeholder"
131
+ :value.sync="data.fields[index].value"
132
+ :format="item.format ? item.format : 'yyyy-MM-dd'"
133
+ v-model="data.fields[index].value"
134
+ :readonly="item.readonly"
135
+ :disabled="item.disabled"
136
+ :show-reset-button="true">
137
+ </datepicker>
138
+ </div>
139
+ </div>
140
+
141
+ <!--textarea-->
142
+ <div :style="item.style ? item.style : ''"
143
+ v-if="item.type==='textarea' && !item.hidden && (item.device === 'app' || !item.device)"
144
+ :class="[item.required && !(item.value) ? 'apply-has-error' : '', item.bootstraped?item.bootstraped+' form-group app-input':'col-xs-12 form-group app-input']">
145
+ <label class="control-label-justify">{{item.label}}</label>
146
+ <div :style="item.value_style ? item.value_style:''"
147
+ :class="item.value_bootstraped ? item.value_bootstraped : 'col-xs-8'">
148
+ <textarea
149
+ :readonly="item.readonly"
150
+ :disabled="item.disabled"
151
+ class="" rows="1"
152
+ style="width: 100%;height: 100%"
153
+ v-model="data.fields[index].value"
154
+ :value="data.fields[index].value"
155
+ @change="onchange(index)"
156
+ @blur="onblur(index)"
157
+ @input="oninput(index)"
158
+ ></textarea>
159
+ </div>
160
+ </div>
161
+
162
+ <!--checkbox-->
163
+ <div :style="item.style ? item.style : ''"
164
+ v-if="item.type==='checkbox' && !item.hidden && (item.device === 'app' || !item.device)"
165
+ :class="[item.required && item.value.length === 0 ? 'apply-has-error' : '',item.bootstraped?item.bootstraped+' form-group app-input':'col-xs-12 form-group app-input']">
166
+ <label class="control-label-justify">{{item.label}}</label>
167
+ <div :style="item.value_style ? item.value_style:''"
168
+ :class="item.value_bootstraped ? item.value_bootstraped : 'col-xs-8'">
169
+ <label class="" v-for="(index2,row) in item.options">
170
+ <input type="checkbox" class=""
171
+ :readonly="data.fields[index].readonly"
172
+ :disabled="data.fields[index].disabled"
173
+ v-model="data.fields[index].value"
174
+ :value="data.fields[index].options[index2].value"
175
+ @change="onchange(index)"
176
+ @blur="onblur(index)">
177
+ {{row.label}}
178
+ </label>
179
+ </div>
180
+ </div>
181
+ </div>
182
+ <div class="col-sm-12 col-xs-12" id="test11">
183
+ <accordion one-at-a-time="true">
184
+ <panel v-for="(i,item) in data.onetomany" :header="item.title" :is-open="false" type="primary">
185
+ <app-onetomany :onetomany="item" :index="i" :selectdata="data"></app-onetomany>
186
+ </panel>
187
+ <panel v-for="(i,item) in data.components" :header="item.title" :is-open="false" type="primary" v-if="item.device === 'app' || !item.device">
188
+ <component :is="item.name" :selectdata="data" :mark="item.mark"></component>
189
+ </panel>
190
+ </accordion>
191
+ </div>
192
+
193
+ <!--自定义组件-->
194
+ <slot>
195
+
196
+ </slot>
197
+
198
+ <!-- 按钮组 -->
199
+ <div class="text-center">
200
+ <button v-for="(index,button) in data.buttons"
201
+ :disabled="button.disabled && disable_button"
202
+ style="min-width:100px"
203
+ :class="button.disabled && disable_button ? 'btn btn-default button_spacing' : 'btn btn-primary button_spacing'"
204
+ v-if="!button.hidden && button.button_name !=='提交'&& button.button_name !=='确认'"
205
+ @click.prevent="click_but(button)"
206
+ >
207
+ {{button.button_name}}
208
+ </button>
209
+ <button v-for="(index,button) in data.buttons"
210
+ :disabled="(button.disabled && disable_button) || (!$v.valid)"
211
+ style="min-width:100px"
212
+ :class="button.disabled && disable_button || (!$v.valid) ? 'btn btn-default button_spacing' : 'btn btn-primary button_spacing'"
213
+ v-if="!button.hidden && (button.button_name ==='提交'||button.button_name ==='确认')"
214
+ @click.prevent="click_but(button)"
215
+ >
216
+ {{button.button_name}}
217
+ </button>
218
+ </div>
219
+
220
+ <!-- 按钮模态框 -->
221
+ <modal v-if="showButModal" :show.sync="showButModal" backdrop="false" large>
222
+ <header slot="modal-header" class="modal-header">
223
+ <button type="button" class="close" @click="closeModal()"><span>&times;</span></button>
224
+ <span class="modal-title"><font
225
+ size="3">{{data.button.button_name}}</font></span>
226
+ </header>
227
+ <article slot="modal-body" class="modal-body clearfix">
228
+ <div class="form-group" >
229
+ <div v-for="(index,item) in data.button.button_fields">
230
+ <div :style="item.style ? item.style : ''" :class="[item.required && !(item.value) ? 'has-error' : '', item.bootstraped ? item.bootstraped + ' form-group' : 'form-group']"
231
+ v-if="(item.type==='input' || item.type==='number'||item.type === 'tel'||item.type === 'email') && !item.hidden && (item.device === 'pc' || !item.device)">
232
+ <label :style="item.label_style ? item.label_style : ''"
233
+ :class="item.label_bootstraped ? item.label_bootstraped + ' control-label-justify control-label' : 'control-label-justify control-label'">{{item.label}}</label>
234
+ <div :style="item.value_style ? item.value_style : ''"
235
+ :class="item.value_bootstraped ? item.value_bootstraped : 'col-xs-8'">
236
+ <input class="form-control input_view"
237
+ :placeholder="item.placeholder"
238
+ :type="item.type"
239
+ v-model="item.value"
240
+ :value="item.value"
241
+ :readonly="item.readonly"
242
+ :disabled="item.disabled"
243
+ @change="onbutchange(index)"
244
+ @blur="onbutblur(index)"
245
+ @input="onbutinput(index)"
246
+ />
247
+ </div>
248
+ </div>
249
+
250
+ <!--时间datepicker-->
251
+ <div :style="item.style ? item.style : ''" :class="[item.required && !(item.value) ? 'has-error' : '', item.bootstraped ? item.bootstraped + ' form-group':'form-group']"
252
+ v-if="item.type==='datepicker' && !item.hidden && (item.device === 'pc' || !item.device)">
253
+ <label :style="item.label_style ? item.label_style : ''"
254
+ :class="item.label_bootstraped ? item.label_bootstraped + ' control-label-justify control-label' : 'control-label-justify control-label'">{{item.label}}</label>
255
+ <div :style="item.value_style ? item.value_style : ''"
256
+ :class="item.value_bootstraped ? item.value_bootstraped : 'col-xs-8'">
257
+ <datepicker
258
+ :placeholder="item.placeholder"
259
+ :value.sync="item.value"
260
+ v-model="item.value"
261
+ :readonly="item.readonly"
262
+ :disabled="item.disabled"
263
+ :format="item.format ? item.format : 'yyyy-MM-dd'"
264
+ :show-reset-button="true"
265
+ @change="onbutchange(index)"
266
+ @blur="onbutblur(index)"
267
+ ></datepicker>
268
+ </div>
269
+ </div>
270
+
271
+ <!--select-->
272
+ <div :style="item.style ? item.style : ''" :class="[item.required && !(item.value) ? 'has-error' : '', item.bootstraped ? item.bootstraped + ' form-group':'form-group']"
273
+ v-if="item.type==='select' && !item.hidden && (item.device === 'pc' || !item.device)">
274
+ <label :style="item.label_style ? item.label_style : ''"
275
+ :class="item.label_bootstraped ? item.label_bootstraped + ' control-label-justify control-label' : 'control-label-justify control-label'">{{item.label}}</label>
276
+ <div :style="item.value_style ? item.value_style : ''"
277
+ :class="item.value_bootstraped ? item.value_bootstraped : 'col-xs-8'">
278
+ <input-select
279
+ class="select select_list"
280
+ :value.sync="item.value"
281
+ v-model="item.value"
282
+ :options='item.options'
283
+ :readonly="item.readonly"
284
+ :disable="item.disabled"
285
+ :valueSingle="true"
286
+ @blur="onbutblur(index)"
287
+ @change="onbutchange(index)"
288
+ ></input-select>
289
+ </div>
290
+ </div>
291
+
292
+ <!--textarea-->
293
+ <div :style="item.style ? item.style : ''" :class="[item.required && !(item.value) ? 'has-error' : '', item.bootstraped ? item.bootstraped + ' form-group':'form-group']"
294
+ v-if="item.type==='textarea' && !item.hidden && (item.device === 'pc' || !item.device)">
295
+ <label :style="item.label_style ? item.label_style : ''"
296
+ :class="item.label_bootstraped ? item.label_bootstraped + ' control-label-justify control-label' : 'control-label-justify control-label'">{{item.label}}</label>
297
+ <div :style="item.value_style ? item.value_style : ''"
298
+ :class="item.value_bootstraped ? item.value_bootstraped : 'col-xs-8'">
299
+ <textarea
300
+ class="form-control input_view"
301
+ style="width: 100%;height: 100%"
302
+ v-model="item.value"
303
+ :value="item.value"
304
+ :rows="item.rows"
305
+ :readonly="item.readonly"
306
+ :disabled="item.disabled"
307
+ @change="onbutchange(index)"
308
+ @blur="onbutblur(index)"
309
+ @input="onbutinput(index)"
310
+ ></textarea>
311
+ </div>
312
+ </div>
313
+ </div>
314
+ </div>
315
+ </article>
316
+ <footer slot="modal-footer" class="modal-footer">
317
+ <button :class="disable_modal_button ? 'btn btn-default':'btn btn-primary'"
318
+ :disabled="disable_modal_button" type="button" @click="confirmModal()">
319
+ 确认
320
+ </button>
321
+ </footer>
322
+ </modal>
323
+ </form>
324
+ </div>
325
+ </template>
326
+ <script>
327
+ import Vue from 'vue'
328
+ import {isEmpty} from "../Util";
329
+ // Date格式化
330
+ Date.prototype.Format = function (fmt) {
331
+ var o = {
332
+ 'M+': this.getMonth() + 1, // 月份
333
+ 'd+': this.getDate(), // 日
334
+ 'H+': this.getHours(), // 小时
335
+ 'm+': this.getMinutes(), // 分
336
+ 's+': this.getSeconds(), // 秒
337
+ 'q+': Math.floor((this.getMonth() + 3) / 3), // 季度
338
+ 'S': this.getMilliseconds() // 毫秒
339
+ }
340
+ if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + '').substr(4 - RegExp.$1.length))
341
+ for (var k in o) {
342
+ if (new RegExp('(' + k + ')').test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length)))
343
+ }
344
+ return fmt
345
+ }
346
+
347
+ export default {
348
+ title: '报建业务通用组件',
349
+ props: {
350
+ data: {
351
+ type: Object
352
+ },
353
+ showprint: {
354
+ type: Boolean,
355
+ default: true
356
+ }
357
+ },
358
+ data () {
359
+ return {
360
+ model: {}, // 公司等属性
361
+ disable_button: true, // 控制按钮禁用
362
+ disable_modal_button: true, // 控制按钮禁用
363
+ showButModal: false,
364
+ areaData:{
365
+ sjvalue:'',
366
+ xianvalue:'',
367
+ sqvalue:'',
368
+ }
369
+ }
370
+ },
371
+ watch: {
372
+ deep: true
373
+ },
374
+ computed: {
375
+
376
+ },
377
+ created () {
378
+ // 初始化数据
379
+ this.initializtion()
380
+ if (this.data.readyEvent) {
381
+ this.$dispatch(this.data.readyEvent)
382
+ }
383
+ this.$dispatch('initializtionView')
384
+ },
385
+ methods: {
386
+ // 初始化数据
387
+ initializtion () {
388
+ for (const item of this.data.fields) {
389
+ this.data[item.field] = item.value
390
+ }
391
+ // 是否禁用按钮
392
+ this.disableButton()
393
+ },
394
+ async getSelectShijiValue(sjvalue,sjlable) {
395
+
396
+ this.areaData.sjvalue = sjvalue
397
+ console.log("这是父级接收的市级值:",sjvalue,sjlable)
398
+ this.data.areaData = this.areaData
399
+ console.log(this.areaData)
400
+ // 是否禁用按钮
401
+ this.disableButton()
402
+ },
403
+ async getSelectXianValue(xianvalue,xianlable) {
404
+
405
+ this.areaData.xianvalue = xianvalue
406
+ this.data.areaData = this.areaData
407
+ console.log("这是父级接收的县级值:",xianvalue,xianlable)
408
+ console.log(this.areaData)
409
+
410
+ // 是否禁用按钮
411
+ this.disableButton()
412
+ },
413
+ async getSelectShequValue(sqvalue,sqlable) {
414
+ this.areaData.sqvalue = sqvalue
415
+ this.data.areaData = this.areaData
416
+ console.log(this.areaData)
417
+ console.log("这是父级接收的社区值:",sqvalue,sqlable)
418
+
419
+ // 是否禁用按钮
420
+ this.disableButton()
421
+ },
422
+ // 是否禁用按钮
423
+ disableButton () {
424
+ let flag = false
425
+
426
+ for (const field of this.data.fields) {
427
+ if (field.required && !field.value && !field.hidden && field.value !== 0) {
428
+ flag = true
429
+ }
430
+
431
+ // 任何选择框只要是否都不能提交
432
+ if (field.type === 'select' && field.value === '否' && field.value_no_disable) {
433
+ flag = true
434
+ }
435
+
436
+ if (field.type === 'checkbox' && field.required && field.value.length === 0) {
437
+ flag = true
438
+ }
439
+ }
440
+
441
+ //区域下拉框必选 流程模式为报警器报建
442
+ if (this.data.f_apply_type === '报警器报建' && this.data.defname === '工程施工' && this.data.title === '工程施工' && this.data.f_sub_state !='完工'){
443
+ if (!flag){
444
+ if (this.areaData.sjvalue ==null || this.areaData.sjvalue.length ==0 || this.areaData.sqvalue == null || this.areaData.sqvalue.length ==0
445
+ || this.areaData.xianvalue == null || this.areaData.xianvalue == 0){
446
+ console.log("区域为空禁止提交:",this.areaData)
447
+ flag = true
448
+ }
449
+ }
450
+ }
451
+
452
+ this.disable_button = flag
453
+ },
454
+ // 失去焦点且值最终发生变化触发
455
+ async onchange (index) {
456
+ // 是否禁用按钮
457
+ this.disableButton()
458
+
459
+ if (!isEmpty(this.data.fields[index].value)) {
460
+ // 前缀、后缀
461
+ if (this.data.fields[index].prefix) {
462
+ this.data.fields[index].value = this.data.fields[index].prefix + this.data.fields[index].value
463
+ }
464
+ if (this.data.fields[index].suffix) {
465
+ this.data.fields[index].value = this.data.fields[index].value + this.data.fields[index].suffix
466
+ }
467
+ }
468
+
469
+ // data赋值
470
+ this.data[this.data.fields[index].field] = this.data.fields[index].value
471
+
472
+ if (this.data.fields[index].type === 'datepicker') {
473
+ this.check_datepicker(index)
474
+ }
475
+
476
+ if (this.data.fields[index].onchange) {
477
+ this.$dispatch(this.data.fields[index].onchange, index)
478
+ }
479
+ this.$dispatch('onchange', index)
480
+
481
+
482
+ },
483
+ // 失去焦点触发,无论值是否发生变化
484
+ onblur (index) {
485
+ this.disableButton()
486
+
487
+ if (this.data.fields[index].onblur) {
488
+ this.$dispatch(this.data.fields[index].onblur, index)
489
+ }
490
+
491
+ this.$dispatch('onblur', index)
492
+ },
493
+ oninput (index) {
494
+ // 是否禁用按钮
495
+ this.disableButton()
496
+
497
+ if (this.data.fields[index].oninput) {
498
+ this.$dispatch(this.data.fields[index].oninput, index)
499
+ }
500
+ this.$dispatch('oninput', index)
501
+ },
502
+ // 点击按钮组按钮
503
+ async click_but (button) {
504
+ //报警器区域地址
505
+ this.data.areaData = this.areaData
506
+
507
+ if (this.data.defname === '通气点火') {
508
+
509
+ this.$showMessage(`请确认表号是否正确`).then((res) => {
510
+
511
+
512
+ this.disable_button = true
513
+
514
+ this.data.fields.forEach(item => {
515
+ this.data[item.field] = item.value
516
+ })
517
+
518
+ this.data.button = button
519
+
520
+ if (button.button_fields && button.button_fields.length > 0) {
521
+ this.showButModal = true
522
+ return
523
+ }
524
+
525
+ if (this.data.button.event) {
526
+ this.$dispatch(this.data.button.event)
527
+ } else {
528
+ this.$dispatch('button')
529
+ }
530
+
531
+ })
532
+
533
+ }
534
+ else{
535
+ this.disable_button = true
536
+
537
+ this.data.fields.forEach(item => {
538
+ this.data[item.field] = item.value
539
+ })
540
+
541
+ this.data.button = button
542
+
543
+ if (button.button_fields && button.button_fields.length > 0) {
544
+ this.showButModal = true
545
+ return
546
+ }
547
+
548
+ if (this.data.button.event) {
549
+ this.$dispatch(this.data.button.event)
550
+ } else {
551
+ this.$dispatch('button')
552
+ }
553
+ }
554
+
555
+ },
556
+ confirmModal () {
557
+ this.closeModal()
558
+
559
+ this.data.button.button_fields.forEach(item => {
560
+ this.data.button[item.field] = item.value
561
+ })
562
+
563
+ if (this.data.button.event) {
564
+ this.$dispatch(this.data.button.event)
565
+ } else {
566
+ this.$dispatch('button')
567
+ }
568
+ },
569
+ // 关闭模态框
570
+ closeModal () {
571
+ this.showButModal = false
572
+ this.disable_modal_button = true
573
+ },
574
+ onbutchange (index) {
575
+ // 是否禁用按钮
576
+ this.disableModalButton()
577
+
578
+ if (this.data.button.button_fields[index].onchange) {
579
+ this.$dispatch(this.data.button.button_fields[index].onchange, index)
580
+ } else {
581
+ this.$dispatch('onbutchange', index)
582
+ }
583
+
584
+ },
585
+ onbutblur (index) {
586
+ this.disableModalButton()
587
+
588
+ if (this.data.button.button_fields[index].onblur) {
589
+ this.$dispatch(this.data.button.button_fields[index].onblur, index)
590
+ } else {
591
+ this.$dispatch('onbutblur', index)
592
+ }
593
+ },
594
+ onbutinput (index) {
595
+ // 是否禁用按钮
596
+ this.disableModalButton()
597
+
598
+ if (this.data.button.button_fields[index].oninput) {
599
+ this.$dispatch(this.data.button.button_fields[index].oninput, index)
600
+ } else {
601
+ this.$dispatch('onbutinput', index)
602
+ }
603
+ },
604
+ disableModalButton () {
605
+ let flag = false
606
+
607
+
608
+ for (const item of this.data.button.button_fields) {
609
+ if (item.required && !item.value) {
610
+ if (item.value === 0) {
611
+ flag = false
612
+ } else {
613
+ flag = true
614
+ }
615
+ }
616
+ }
617
+
618
+ this.disable_modal_button = flag
619
+ },
620
+ check_datepicker (index) {
621
+ // 时间格式检测
622
+ if (!isEmpty(this.data.fields[index].value)) {
623
+
624
+ let dateReg = /^[1-9]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/
625
+ let timeReg = /^(20|21|22|23|[0-1]\d):[0-5]\d:[0-5]\d$/
626
+ 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$/
627
+ if (this.data.fields[index].format) {
628
+ if (this.data.fields[index].format === 'yyyy-MM-dd') {
629
+ if (!dateReg.test(this.data.fields[index].value)) {
630
+ this.data.fields[index].value = ''
631
+ this.$showAlert(this.data.fields[index].label + '格式错误如:2021-01-01', 'warning', 2000)
632
+ }
633
+ }
634
+ if (this.data.fields[index].format === 'HH:mm:ss') {
635
+ if (!timeReg.test(this.data.fields[index].value)) {
636
+ this.data.fields[index].value = ''
637
+ this.$showAlert(this.data.fields[index].label + '格式错误如:00:00:00', 'warning', 2000)
638
+ }
639
+ }
640
+ if (this.data.fields[index].format === 'yyyy-MM-dd HH:mm:ss') {
641
+ if (!datetimeReg.test(this.data.fields[index].value)) {
642
+ this.data.fields[index].value = ''
643
+ this.$showAlert(this.data.fields[index].label + '格式错误如:2021-01-01 00:00:00', 'warning', 2000)
644
+ }
645
+ }
646
+ } else {
647
+ if (!dateReg.test(this.data.fields[index].value)) {
648
+ this.data.fields[index].value = ''
649
+ this.$showAlert(this.data.fields[index].label + '格式错误如:2021-01-01', 'warning', 2000)
650
+ }
651
+ }
652
+ }
653
+ },
654
+ selectSearch(event, index) {
655
+ if (this.data.fields[index].selectSearch) {
656
+ this.$dispatch(this.data.fields[index].selectSearch, event[0], index)
657
+ }
658
+ this.$dispatch('selectSearch', event[0], index)
659
+ }
660
+ },
661
+ events: {
662
+ }
663
+ }
664
+ </script>
665
+ <style scoped>
666
+ .control-label-justify {
667
+ width: 30%;
668
+ text-align: justify;
669
+ text-align-last: justify;
670
+ font-family: PingFang-SC-Bold;
671
+ float: left;
672
+ }
673
+ .button_spacing{margin: 0px 0px 0px 10px;}
674
+ </style>
675
+ <style lang="less">
676
+ .apply-has-error {
677
+ border-bottom: 1px solid #a94442;
678
+ }
679
+ .app-input {
680
+ label {
681
+ float: left;
682
+ }
683
+ .select {
684
+ button {
685
+ border: none;
686
+ outline: none;
687
+ text-align: left;
688
+ .btn-placeholder {
689
+ color: #ACA899
690
+ }
691
+ }
692
+ }
693
+ .datepicker {
694
+ .form-control:focus {
695
+ border: none!important;
696
+ outline: none!important;
697
+ -webkit-box-shadow: none;
698
+ box-shadow: none;
699
+ }
700
+ }
701
+ textarea {
702
+ padding: 8px 10px;
703
+ border: none;
704
+ outline: none;
705
+ margin: 0px;
706
+ }
707
+ input[readonly]{
708
+ color: #ACA899!important;
709
+ background: #FFFFFF;
710
+ border: none;
711
+ outline: none;
712
+ }
713
+ input:disabled{
714
+ color: #ACA899!important;
715
+ background: #FFFFFF;
716
+ border: none;
717
+ outline: none;
718
+ }
719
+ textarea[readonly]{
720
+ color: #ACA899!important;
721
+ background: #FFFFFF;
722
+ border: none;
723
+ outline: none;
724
+ }
725
+ textarea:disabled{
726
+ color: #ACA899!important;
727
+ background: #FFFFFF;
728
+ border: none;
729
+ outline: none;
730
+ }
731
+ }
732
+ </style>