apply-clients 3.3.74 → 3.3.78

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