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