apply-clients 5.0.35-ezhou-7 → 5.0.35-ezhou-9

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,809 +1,809 @@
1
- <template>
2
- <div class="auto select-overspread" v-if="refresh">
3
- <!--<div class="panel panel-info" v-if="!data.titlevisible">-->
4
- <!--<div class="panel-heading">-->
5
- <!--<h3 class="panel-title">-->
6
- <!--<span >{{data.title}}</span>-->
7
- <!--<span v-if="data.back_reason" style="color: red;font-family: 微软雅黑;font-weight: bold"> 请注意被退回原因为:{{data.back_reason}}</span>-->
8
- <!--</h3>-->
9
- <!--</div>-->
10
- <!--</div>-->
11
- <validator name="v">
12
- <form class="form-horizontal">
13
- <div class="col-sm-12 form-group form-group1">
14
- <div v-for="(index,item) in data.fields">
15
- <!--input-->
16
- <div :style="item.style+';height: 34px;'"
17
- v-if="item.type==='input' || item.type==='number'||item.type === 'tel'||item.type === 'email'"
18
- v-show="!item.hidden"
19
- :class="[data.fields[index].required&&!(data.fields[index].value) ? 'has-error' : '',data.fields[index].bootstraped?data.fields[index].bootstraped+' form-group':'col-sm-4 form-group form-group1']">
20
- <label :style="item.label_style? item.label_style:''+';width:85px;'"
21
- :class="item.label_bootstraped?item.label_bootstraped+' control-label-justify control-label':item.label_style?'':'control-label-justify control-label col-sm-6'">{{item.label}}</label>
22
- <div :style="item.value_style? item.value_style:''"
23
- :class="item.value_bootstraped?item.value_bootstraped:item.value_style?'':'col-sm-6'">
24
- <input class="form-control" style="background-color: #f7fbff;"
25
- :type="item.type"
26
- v-model="data.fields[index].value"
27
- :placeholder="item.placeholder"
28
- :value="data.fields[index].value"
29
- :readonly="item.readonly"
30
- :disabled="item.disabled"
31
- @change="select_change(index),disabled_check(data.fields[index].required,data.fields[index].value)"
32
- @blur="select_change(index),check_disable"
33
- />
34
- </div>
35
- </div>
36
- <!--时间datepicker-->
37
- <div :style="item.style? item.style+';height: 34px;':'height: 34px;'" v-if="item.type==='datepicker'"
38
- v-show="!item.hidden"
39
- :class="[data.fields[index].required&&!(data.fields[index].value) ? 'has-error' : '',data.fields[index].bootstraped?data.fields[index].bootstraped+' form-group':'col-sm-4 form-group form-group1']">
40
- <label style="width:85px"
41
- :class="item.label_bootstraped?item.label_bootstraped+' control-label-justify control-label':'control-label control-label-justify col-sm-6'">{{item.label}}</label>
42
- <div :class="item.value_bootstraped?item.value_bootstraped:'col-sm-6'">
43
- <datepicker
44
- :placeholder="item.placeholder"
45
- :value.sync="data.fields[index].value"
46
- :format="'yyyy-MM-dd HH:mm:ss'"
47
- v-model="data.fields[index].value"
48
- :readonly=true
49
- :disabled="item.disabled"
50
- @blur="check_disable"
51
- :show-reset-button="reset">
52
- </datepicker>
53
- </div>
54
- </div>
55
-
56
- <!--textarea-->
57
- <div :style="item.style? item.style:'height: 34px;'" v-if="item.type==='textarea'" v-show="!item.hidden"
58
- :class="[data.fields[index].required&&!(data.fields[index].value) ? 'has-error' : '',data.fields[index].bootstraped?data.fields[index].bootstraped+' form-group':'col-sm-12 form-group']">
59
- <label :style="item.label_style? item.label_style:''"
60
- :class="item.label_bootstraped?item.label_bootstraped+' control-label-justify control-label':item.label_style?'':'control-label-justify control-label col-sm-3'">{{item.label}}</label>
61
- <div :style="item.value_style? item.value_style:''"
62
- :class="item.value_bootstraped?item.value_bootstraped:item.value_style?'':'col-sm-10'">
63
- <textarea
64
- :readonly="item.readonly"
65
- :disabled="item.disabled"
66
- class="form-control"
67
- style="background-color: #f7fbff;margin-top: 7px"
68
- :rows="item.rows"
69
- v-model="data.fields[index].value"
70
- @change="disabled_check(data.fields[index].required,data.fields[index].value)"
71
- @blur="check_disable"
72
- >
73
- </textarea>
74
- </div>
75
- </div>
76
-
77
- <!--radio-->
78
- <div v-if="item.type==='radio'"
79
- :class="[data.fields[index].required&&!(data.fields[index].value) ? 'has-error' : '',data.fields[index].bootstraped?data.fields[index].bootstraped+' form-group':'col-sm-12 form-group']">
80
- <label v-if="item.label"
81
- :class="item.label_bootstraped?item.label_bootstraped+' control-label-justify control-label':'control-label-justify control-label col-sm-2'">{{item.label}}</label>
82
- <div
83
- :class="item.value_bootstraped?item.value_bootstraped:item.items.length%2 == 0?'col-sm-5': 'col-sm-3'"
84
- v-for="(index2,row) in item.items">
85
- <label for="row.label"
86
- :class="item.items.length%2 == 0?'col-sm-3 control-label': 'col-sm-2 control-label'">{{row.label}}</label>
87
- <input @blur="check_disable"
88
- :class="item.items.length%2 == 0?'col-sm-3 control-label': 'col-sm-2 control-label'"
89
- :readonly="item.readonly" :disabled="item.disabled" style="margin-top: 10px" type="radio"
90
- :name="index" :id="row.label" v-bind:value="data.fields[index].items[index2].value"
91
- v-model="data.fields[index].value">
92
- </div>
93
- </div>
94
-
95
- <!--select-->
96
- <div style="height: 34px" v-if="item.type==='select'" v-show="!item.hidden"
97
- :class="[data.fields[index].required&&!(data.fields[index].value) ? 'has-error' : '',data.fields[index].bootstraped?data.fields[index].bootstraped+' form-group ':'col-sm-4 form-group']">
98
- <label style="width:85px;"
99
- :class="item.label_bootstraped?item.label_bootstraped+' control-label control-label-justify':'control-label-justify control-label col-sm-6'">{{item.label}}</label>
100
- <input-select :class="item.value_bootstraped?item.value_bootstraped:'col-sm-6'" @blur="check_disable"
101
- @change="select_change(index),disabled_check(data.fields[index].required,data.fields[index].value)"
102
- :readonly="item.readonly" :disabled="item.disabled" :value.sync="data.fields[index].value"
103
- v-model="data.fields[index].value"
104
- :search="true"
105
- :options='data.fields[index].options' :valueSingle="true"></input-select>
106
-
107
- </div>
108
-
109
-
110
- <!--checkbox-->
111
- <div v-if="item.type==='checkbox'"
112
- :class="[data.fields[index].required&&!(data.fields[index].value) ? 'has-error' : '',data.fields[index].bootstraped?data.fields[index].bootstraped+' form-group':'col-sm-12 form-group']">
113
- <label v-if="item.label"
114
- :class="item.label_bootstraped?item.label_bootstraped+' control-label ':'control-label col-sm-2'">{{item.label}}</label>
115
- <div style="margin-top: 6px"
116
- :class="item.value_bootstraped?item.value_bootstraped:'control-label col-sm-2'"
117
- v-for="(index2,row) in item.items">
118
- <label class="font-size form-group col-sm-6">{{row.label}}</label>
119
- <input :readonly="item.readonly" :disabled="item.disabled" type="checkbox" class="col-sm-6"
120
- :id="row.label" v-model="data.fields[index].items[index2].value" @click="checkboxSelect(index,index2)" >
121
- </div>
122
- </div>
123
- </div>
124
- <!-- onetomany -->
125
- <div class="col-sm-12" v-for="(i,datagrid) in data.onetomany">
126
- <table v-show="!datagrid.hidden" class="table table-bordered table-striped table-hover" style="margin-top: 80px">
127
- <tr style="background-color: #00A3F0">
128
- <th style="text-align: center;border-color: #00A3F0"><font color="white">序号</font></th>
129
- <th v-for="labels in datagrid.fields" style="text-align: center;border-color: #00A3F0">
130
- <nobr><font color="white">{{labels.label}}</font></nobr>
131
- </th>
132
- <th style="text-align: center;border-color: #00A3F0;padding: 0px">
133
- <button type="button" @click="$dispatch('add',i)" class="btn btn-warning"
134
- v-if="!data.onetomany[i].nopower">
135
- +
136
- </button>
137
- </th>
138
- </tr>
139
- <tr v-for="(j,row) in model.rows[i]">
140
- <td style="text-align: center">{{$index+1}}</td>
141
- <td v-for="key in surBodyData[i]" style="text-align: center">
142
- {{row[key]}}
143
- </td>
144
- <td style="text-align: center">
145
- <a href="#" @click="delete(i,j)" v-if="!data.onetomany[i].nopower">删除</a>
146
- </td>
147
- </tr>
148
- </table>
149
- </div>
150
- <div v-for="(i,item) in data.components" >
151
- <component v-if="item.device === 'pc' || !item.device" :is="item.name" :selectdata="data" :mark="item.mark"></component>
152
- </div>
153
- </div>
154
- <div class="col-sm-12 form-group text-center" style="padding-top:20px">
155
- <div class="form-group col-sm-3 center-block">
156
- <label class=" col-sm-4 control-label control-label-justify">所属公司:</label>
157
- <div class="col-sm-8">
158
- <input class="form-control" type="text" v-model="model.f_filiale" disabled>
159
- </div>
160
- </div>
161
- <div class="col-sm-2 form-group center-block">
162
- <label class="control-label control-label-justify col-sm-6">部门:</label>
163
- <div class="col-sm-6">
164
- <input type="text" class="form-control" disabled v-model="model.f_parentname"/>
165
- </div>
166
- </div>
167
- <div class="col-sm-2 form-group center-block">
168
- <label class="control-label control-label-justify col-sm-6">操作人:</label>
169
- <div class="col-sm-6 ">
170
- <input type="text" class="form-control" disabled v-model="model.f_operator"/>
171
- </div>
172
- </div>
173
- <div class="col-sm-4 form-group center-block">
174
- <label class="control-label control-label-justify col-sm-6">操作日期:</label>
175
- <div class="col-sm-6">
176
- <input type="text" class="form-control" disabled v-model="model.f_operate_date"/>
177
- </div>
178
- </div>
179
- </div>
180
- </form>
181
- </validator>
182
- <div class="from-group col-sm-11">
183
- <center>
184
- <!-- 按钮组 -->
185
- <button v-for="(index,button) in data.buttons"
186
- :disabled="(button.button_name==='提交'||button.button_name==='下发'||button.button_name==='打印回单')&&disable_button" type="button"
187
- @click="clicked(index,button)"
188
- :class="(button.button_name==='提交'||button.button_name==='下发'||button.button_name==='打印回单')&&disable_button?'btn btn-default':'btn btn-primary'"
189
- style="width:80px; margin-left:50px;">
190
- {{button.button_name}}
191
- </button>
192
- </center>
193
- </div>
194
- <!-- 按钮模态框 -->
195
- <modal v-if="showmodal" :show.sync="showmodal" v-ref:modal backdrop="false">
196
- <header slot="modal-header" class="modal-header">
197
- <button type="button" class="close" @click="closemodal"><span>&times;</span></button>
198
- <h4 class="modal-title">{{model.button.button_name}}</h4>
199
- </header>
200
- <article slot="modal-body" class="modal-body">
201
- <div class="col-sm-12" v-for="(index,button_field) in data.buttons[model.button.button_index].button_fields">
202
- <label class="control-label col-sm-3" style="margin-top: 10px">{{button_field.label}}:</label>
203
- <div class="col-sm-7">
204
- <!--select-->
205
- <input-select v-if="button_field.type=='select'"
206
- :value.sync="data.buttons[model.button.button_index].button_fields[index].value"
207
- v-model="data.buttons[model.button.button_index].button_fields[index].value"
208
- :options='button_field.options'></input-select>
209
- <!-- input -->
210
- <input v-else type="text" class="form-control"
211
- v-model="data.buttons[model.button.button_index].button_fields[index].value"/>
212
- </div>
213
- </div>
214
- </article>
215
- <footer slot="modal-footer" style="border-top:none" class="modal-footer">
216
- <button v-show="showmodal" type="button" class="btn btn-primary" @click='acknowledge'>确认</button>
217
- </footer>
218
- </modal>
219
-
220
-
221
- <!-- onetomany新增模态框 -->
222
- <div class="auto"
223
- style="background-color:white;max-width: 700px;max-hight:500px;z-index:9999;box-shadow: 0px 0px 100px 10px grey;position: fixed;margin-left: 20%;"
224
- v-if="showadd">
225
-
226
- <div class="auto">
227
-
228
- <div style="padding-top: 15px;padding-left: 15px;padding-right: 15px;">
229
- <button type="button" class="close" @click="closemodal(modeltitle)"><span>&times;</span></button>
230
- <span class="modal-title" style="border-bottom: 1px solid #e5e5e5;"><font
231
- size="3">{{modeltitle}}</font></span>
232
- </div>
233
-            
234
- <div style="padding-top: 15px;border-top: 0px solid #e5e5e5;border-bottom: 0px solid #e5e5e5;">
235
- <div class="col-sm-12" v-for="(index,showadd_field) in showadd_fields.fields" v-if="refresh_modal">
236
- <label v-show="!showadd_field.hidden" class="control-label col-sm-3" style="margin-top: 10px">{{showadd_field.label}}:</label>
237
- <div class="col-sm-7" v-show="!showadd_field.hidden">
238
- <!--时间datepicker-->
239
- <div v-if="showadd_field.type=='datepicker'"
240
- :class="[showadd_fields[index].required&&!(showadd_fields.fields[index].value) ? 'has-error' : '']">
241
- <div>
242
- <datepicker
243
- :placeholder="showadd_field.placeholder"
244
- :value.sync="showadd_fields.fields[index].value"
245
- :format="'yyyy-MM-dd HH:mm:ss'"
246
- v-model="showadd_fields.fields[index].value"
247
- :readonly=true
248
- :disabled="showadd_fields.fields[index].disabled"
249
- @blur="check_disable"
250
- :show-reset-button="reset">
251
- </datepicker>
252
- </div>
253
- </div>
254
- <!--select-->
255
- <input-select
256
- @change="select_change_modal(index),disabled_check_modal(showadd_fields.fields[index].required,showadd_fields.fields[index].value)"
257
- v-if="showadd_field.type=='select'"
258
- @blur="check_disable_modal,disabled_check_modal(showadd_fields.fields[index].required,showadd_fields.fields[index].value)"
259
- :mouseout="check_disable_modal,disabled_check_modal(showadd_fields.fields[index].required,showadd_fields.fields[index].value)"
260
- :value.sync="showadd_fields.fields[index].value"
261
- v-model="showadd_fields.fields[index].value"
262
- :options='showadd_fields.fields[index].options'>
263
- </input-select>
264
- <!-- input -->
265
- <input :type="showadd_field.type"
266
- @change="select_change_modal(index),check_disable_modal,disabled_check_modal(showadd_fields.fields[index].required,showadd_fields.fields[index].value)"
267
- v-if="(showadd_field.type=='input'||showadd_field.type=='number')&&!showadd_field.hidden"
268
- @blur="check_disable_modal,disabled_check_modal(showadd_fields.fields[index].required,showadd_fields.fields[index].value)"
269
- :mouseout="check_disable_modal,disabled_check_modal(showadd_fields.fields[index].required,showadd_fields.fields[index].value)"
270
- :readonly="showadd_field.readonly" class="form-control"
271
- v-model="showadd_fields.fields[index].value"
272
- :value.sync="showadd_fields[index].value"/>
273
- <span
274
- v-if="showadd_fields.fields[index].error&&showadd_fields.fields[index].error.msg&&showadd_fields.fields[index].error.flag"
275
- style="color: red">{{showadd_fields.fields[index].error.msg}}</span>
276
- </div>
277
- </div>
278
- </div>
279
-
280
- <div style="padding-top: 15px;padding-left: 15px;padding-right: 15px;text-align: right;">
281
- <button :class="disable_button_modal?'btn btn-default':'btn btn-primary'" v-show="showadd"
282
- :disabled="disable_button_modal" type="button" @click="acknowledge(modeltitle)">
283
- 确认
284
- </button>
285
- </div>
286
-
287
- </div>
288
-  
289
- </div>
290
-
291
- </div>
292
- </template>
293
- <script>
294
- import Vue from 'vue'
295
- // Date格式化
296
- Date.prototype.Format = function (fmt) {
297
- var o = {
298
- "M+": this.getMonth() + 1, //月份
299
- "d+": this.getDate(), //日
300
- "H+": this.getHours(), //小时
301
- "m+": this.getMinutes(), //分
302
- "s+": this.getSeconds(), //秒
303
- "q+": Math.floor((this.getMonth() + 3) / 3), //季度
304
- "S": this.getMilliseconds() //毫秒
305
- };
306
- if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
307
- for (var k in o)
308
- if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
309
- return fmt;
310
- }
311
-
312
- export default {
313
- title: '报建业务通用组件',
314
- props: ['data'],
315
- data() {
316
- return {
317
- data: {
318
- onetomany: {
319
- fields: []
320
- }
321
- },
322
- surBodyData: [],
323
- refresh: true, // 控制重新渲染
324
- model: {
325
- rows: [],
326
- button: {
327
- button_name: null,
328
- button_index: null
329
- },
330
- f_filiale: null,
331
- f_parentname: null,
332
- f_operate_date: null,
333
- f_operator: null
334
- },
335
- showadd: false, // onetomany 新增模态框
336
- showadd_fields: [], // onetomany 新增模态框的字段配置
337
- // data: null,
338
- modeltitle: '',
339
- tempid: null,
340
- showadd_index: null,
341
- showmodal: false,
342
- disable_button: true,
343
- disable_button_modal: true,
344
- refresh_modal: true
345
- }
346
- },
347
- created() {
348
- // 初始化数据
349
- this.initializtion()
350
- },
351
- events: {
352
- async 'add'(index) {
353
- let templet = new Object()
354
- templet = this.data.onetomany[index]
355
- let count = 0
356
- for (let j = 0; j < templet.fields.length; j++) {
357
- templet.fields[j].value = ''
358
- if (templet.fields[j].type == 'datepicker') {
359
- templet.fields[j].value = new Date().Format("yyyy-MM-dd HH:mm:ss")
360
- }
361
- if (templet.fields[j].required) {
362
- count++
363
- }
364
- }
365
- if (count == 0) {
366
- this.disable_button_modal = false
367
- }
368
- this.modeltitle = '新增'
369
- this.showadd_fields = templet
370
- this.showadd_index = index
371
- this.showadd = true
372
- }
373
- },
374
- methods: {
375
- // 获取组件中的数据
376
- getmodel() {
377
- // 组织model.fields数据
378
- let modeldatas = {}
379
- for (let i = 0; i < this.data.fields.length; i++) {
380
- // checkbox特殊处理
381
- if (this.data.fields[i].type === 'checkbox') {
382
- for (let j = 0; j < this.data.fields[i].items.length; j++) {
383
- modeldatas[this.data.fields[i].items[j].field] = this.data.fields[i].items[j].value
384
- }
385
- } else {
386
- modeldatas[this.data.fields[i].field] = this.data.fields[i].value
387
- }
388
- }
389
- modeldatas.f_process_id = this.data.f_process_id
390
- modeldatas.f_filiale = this.model.f_filiale
391
- modeldatas.f_parentname = this.model.f_parentname
392
- modeldatas.f_operator = this.model.f_operator
393
- modeldatas.f_operate_date = this.model.f_operate_date
394
- return modeldatas
395
- },
396
- // 修改
397
- revise(index, index2) {
398
- this.showadd_fields = []
399
- let templet = new Object()
400
- templet = this.data.onetomany[index]
401
- for (let j = 0; j < templet.fields.length; j++) {
402
- if (templet.fields[j].type == 'input') {
403
- templet[j] = {}
404
- templet[j].value = this.model.rows[index][index2][templet.fields[j].field]
405
- templet.fields[j].value = this.model.rows[index][index2][templet.fields[j].field]
406
- } else {
407
- templet.fields[j].value = this.model.rows[index][index2][templet.fields[j].field]
408
- if (templet.fields[j].type == 'datepicker') {
409
- templet.fields[j].value = new Date().Format("yyyy-MM-dd HH:mm:ss")
410
- }
411
- }
412
- }
413
- this.tempid = this.model.rows[index][index2].id
414
- this.modeltitle = '修改'
415
- this.showadd_fields = templet
416
- this.showadd_index = index
417
- this.showadd = true
418
- },
419
- // 检测模态框按钮的disable
420
- disabled_check_modal(required, value) {
421
- if (required && value) {
422
- this.disable_button_modal = false
423
-
424
- let fields = this.showadd_fields.fields
425
- let flag = false
426
- for (let i = 0; i < fields.length; i++) {
427
- if (fields[i].type !== 'checkbox' && fields[i].required && !fields[i].value) {
428
- flag = true
429
- }
430
- }
431
- this.disable_button_modal = flag
432
- }
433
- },
434
- // 检测模态框按钮的disable,反向检查
435
- check_disable_modal() {
436
- let fields = this.showadd_fields.fields
437
- let flag = false
438
- for (let i = 0; i < fields.length; i++) {
439
- if (fields[i].type !== 'checkbox' && fields[i].required && !fields[i].value) {
440
- flag = true
441
- }
442
- }
443
- let count = 0
444
- for (let i = 0; i < fields.length; i++) {
445
- if (fields[i].type !== 'checkbox' && !fields[i].required) {
446
- count++
447
- }
448
- }
449
- if (count == 0) {
450
- flag = false
451
- }
452
- this.disable_button_modal = flag
453
- },
454
- checkboxSelect(index,index1){
455
- console.log("chufa事件");
456
- this.$dispatch('checkboxSelectControl', index, index1)
457
- },
458
- // 模态框级联操作预留
459
- select_change_modal(index) {
460
- if (this.showadd_fields.fields[index].value) {
461
- this.showadd_fields[index] = {}
462
- this.showadd_fields[index].value = this.showadd_fields.fields[index].value
463
- } else if (this.showadd_fields[index] && this.showadd_fields[index].value) {
464
- this.showadd_fields.fields[index].value = this.showadd_fields[index].value
465
- }
466
- this.refresh_modal = false
467
- this.$nextTick(() => {
468
- this.refresh_modal = true
469
- })
470
- this.$dispatch('select_cascade_modal', this.showadd_index, index)
471
- // if(this.showadd_fields.fields[index].label=='购货方纳税人识别号'){
472
- // if(this.showadd_fields.fields[index].value.length!=15&&this.showadd_fields.fields[index].value.length!=18&&this.showadd_fields.fields[index].value.length!=20){
473
- // this.$showMessage("购货方纳税人识别号必须为15位,18位或者20位")
474
- // this.showadd_fields.fields[index].value = ''
475
- // }
476
- // }
477
- },
478
- // 更新showadd模态框
479
- update_showadd_fields_value(index, value) {
480
- this.showadd_fields.fields[index].value = value
481
- this.showadd_fields[index] = {}
482
- this.showadd_fields[index].value = value
483
- },
484
- // 清理showadd模态框
485
- clear_showadd_fields_value(index) {
486
- this.showadd_fields.fields[index].value = ''
487
- this.showadd_fields[index].value = ''
488
- },
489
- // 删除
490
- delete(i, j) {
491
- this.$showMessage("您确定要删除这条记录吗?", ['confirm']).then((res) => {
492
- if (res == 'confirm') {
493
- this.$dispatch('onetomanydelete', i, j)
494
- }
495
- })
496
- },
497
- // 强制刷新
498
- update() {
499
- this.refresh = false
500
- this.$nextTick(() => {
501
- this.refresh = true
502
- })
503
- this.initializtion()
504
- },
505
- // 初始化数据
506
- initializtion() {
507
- if(this.data.f_apply_type='集体报建' && this.data.f_user_type=='非民用' && this.data.defname=='验收'){
508
- for(let j=0;j< this.data.fields.length;j++) {
509
- this.data.fields[j].required = false
510
- }
511
- }
512
-
513
- let fields = this.data.fields
514
- let flag = false
515
- for (let i = 0; i < fields.length; i++) {
516
- if (fields[i].type !== 'checkbox' && fields[i].required && !fields[i].value) {
517
- flag = true
518
- }
519
- }
520
- let count = 0
521
- for (let i = 0; i < fields.length; i++) {
522
- if (fields[i].type !== 'checkbox' && !fields[i].required) {
523
- count++
524
- }
525
- }
526
- if (count = 0) {
527
- flag = false
528
- }
529
- this.disable_button = flag
530
-
531
- this.model.rows = []
532
- this.surBodyData = []
533
- if (this.data.onetomany && this.data.onetomany.length > 0) {
534
- for (let i = 0; i < this.data.onetomany.length; i++) {
535
- let temp = []
536
- for (let j = 0; j < this.data.onetomany[i].fields.length; j++) {
537
- temp.push(this.data.onetomany[i].fields[j].field)
538
- }
539
- this.surBodyData.push(temp)
540
- }
541
- for (let i = 0; i < this.data.onetomany.length; i++) {
542
- if (this.data.onetomany[i].rows) {
543
- this.model.rows.push(this.data.onetomany[i].rows)
544
- }
545
- }
546
-
547
- }
548
- // datepicker 没有值给当时值
549
- if (this.data.fields && this.data.fields.length > 0) {
550
- for (let i = 0; i < this.data.fields.length; i++) {
551
- if (this.data.fields[i].type === 'datepicker' && !this.data.fields[i].value) {
552
- this.data.fields[i].value = new Date().Format("yyyy-MM-dd HH:mm:ss")
553
- }
554
- }
555
- } else {
556
- this.disable_button = false
557
- }
558
- if (this.data.filiale) {
559
- this.model.f_filiale = this.data.filiale
560
- } else {
561
- this.model.f_filiale = this.$login.f.f_fengongsi
562
- }
563
- if (this.data.f_parentname) {
564
- this.model.f_parentname = this.data.f_parentname
565
- } else {
566
- this.model.f_parentname = this.$login.f.f_parentname
567
- }
568
- if (this.data.operate_date) {
569
- this.model.f_operate_date = this.data.operate_date
570
- } else {
571
- this.model.f_operate_date = new Date().Format("yyyy-MM-dd HH:mm:ss")
572
- }
573
- if (this.data.operator) {
574
- this.model.f_operator = this.data.operator
575
- } else {
576
- this.model.f_operator = this.$login.f.name
577
- }
578
- },
579
- // 模态框点击确定按钮
580
- acknowledge(val) {
581
- if (val == '新增') {
582
- let temp = {}
583
- for (let i = 0; i < this.showadd_fields.fields.length; i++) {
584
- if (this.showadd_fields.fields[i].value) {
585
- temp[this.showadd_fields.fields[i].field] = this.showadd_fields.fields[i].value
586
- } else if (this.showadd_fields && this.showadd_fields[i] && this.showadd_fields[i].value) {
587
- temp[this.showadd_fields.fields[i].field] = this.showadd_fields[i].value
588
- }
589
- }
590
- this.model.rows[this.showadd_index].push(temp)
591
- this.$dispatch('confirm', this.data.onetomany[this.showadd_index].tables, temp, this.showadd_index, this.model.rows[this.showadd_index].length - 1)
592
- this.showadd_fields = null
593
- this.showadd_index = null
594
- this.closemodal(val)
595
- } else {
596
- for (let i = 0; i < this.data.buttons[this.model.button.button_index].button_fields.length; i++) {
597
- this.model.button.button_fields[this.data.buttons[this.model.button.button_index].button_fields[i].field] = this.data.buttons[this.model.button.button_index].button_fields[i].value
598
- }
599
- this.showmodal = false
600
- this.$dispatch('button', this.model)
601
- }
602
- },
603
- // 关闭模态框
604
- closemodal(val) {
605
- if (this.showadd_fields && this.showadd_fields.fields && this.showadd_fields.fields.length) {
606
- for (let i = 0; i < this.showadd_fields.fields.length; i++) {
607
- if (this.showadd_fields[i] && this.showadd_fields[i].value) {
608
- this.showadd_fields[i].value = ''
609
- }
610
- if (this.showadd_fields.fields[i] && this.showadd_fields.fields[i].value) {
611
- this.showadd_fields.fields[i].value = ''
612
- }
613
- }
614
- }
615
-
616
- if (val != '新增' || val != '修改' || val != '删除') {
617
- this.disable_button = false
618
- }
619
- this.showmodal = false
620
- if (val == '新增') {
621
- this.showadd = false
622
- }
623
- this.showadd_fields = null
624
- this.disable_button_modal = true
625
- this.modeltitle = null
626
- this.tempid = null
627
- },
628
- // 点击按钮
629
- clicked(index, button) {
630
-
631
- // onetomany 处理
632
- // if(this.data.onetomany&&this.data.onetomany.fields.length>0){
633
- // let temp = {}
634
- // temp['tables'] = this.data.onetomany.tables
635
- // temp['rows'] = this.model.rows
636
- // this.$dispatch('onetomanyevent',temp)
637
- // }
638
- this.disable_button=false;
639
- this.$parent.$parent.$parent.$parent.$refs.queryuser.button_name="查询"
640
- if(button.button_name !='打印回单')
641
- this.disable_button = true
642
- console.log(`点击了按钮index:${index}+button:${JSON.stringify(button)}`);
643
- // 组织model.fields数据
644
- let modeldatas = {}
645
- for (let i = 0; i < this.data.fields.length; i++) {
646
- // checkbox特殊处理
647
- if (this.data.fields[i].type === 'checkbox') {
648
- for (let j = 0; j < this.data.fields[i].items.length; j++) {
649
- modeldatas[this.data.fields[i].items[j].field] = this.data.fields[i].items[j].value
650
- }
651
- } else {
652
- modeldatas[this.data.fields[i].field] = this.data.fields[i].value
653
- }
654
- }
655
- modeldatas.f_process_id = this.data.f_process_id
656
- modeldatas.f_filiale = this.model.f_filiale
657
- modeldatas.f_parentname = this.model.f_parentname
658
- modeldatas.f_operator = this.model.f_operator
659
- modeldatas.f_operate_date = this.model.f_operate_date
660
- this.model = null
661
- this.model = modeldatas
662
- // 初始化model.button数据
663
- let buttondatas = {
664
- button_fields: {}
665
- }
666
- if (button.button_event) {
667
- buttondatas.button_event = button.button_event
668
- }
669
- if (button.button_node) {
670
- buttondatas.button_node = button.button_node
671
- }
672
- if (button.button_person) {
673
- buttondatas.button_person = button.button_person
674
- }
675
- buttondatas.button_name = button.button_name
676
- buttondatas.button_index = index
677
- if (button.button_fields) {
678
- for (let i = 0; i < button.button_fields.length; i++) {
679
- buttondatas.button_fields[button.button_fields[i].field] = button.button_fields[i].value
680
- }
681
- }
682
- this.model.button = buttondatas
683
- if (button.button_name === '退回') {
684
- this.showmodal = true
685
- } else if (button.button_name === '下发') {
686
- this.showmodal = true
687
- } else {
688
- this.$dispatch('button', this.model)
689
- }
690
- },
691
- // 级联操作预留
692
- select_change(index) {
693
- this.$dispatch('select_cascade', index)
694
- },
695
- // 检测按钮的disable
696
- disabled_check(required, value) {
697
- if (required && value) {
698
- this.disable_button = false
699
-
700
- let fields = this.data.fields
701
- let flag = false
702
- for (let i = 0; i < fields.length; i++) {
703
- if (fields[i].type !== 'checkbox' && fields[i].required && !fields[i].value) {
704
- flag = true
705
- }
706
- }
707
- this.disable_button = flag
708
- }
709
- }
710
- },
711
- watch: {
712
- 'data.operate_date'() {
713
- if (this.data.filiale) {
714
- this.model.f_filiale = this.data.filiale
715
- } else {
716
- this.model.f_filiale = this.$login.f.f_fengongsi
717
- }
718
- if (this.data.f_parentname) {
719
- this.model.f_parentname = this.data.f_parentname
720
- } else {
721
- this.model.f_parentname = this.$login.f.f_parentname
722
- }
723
- if (this.data.operate_date) {
724
- this.model.f_operate_date = this.data.operate_date
725
- } else {
726
- this.model.f_operate_date = new Date().Format("yyyy-MM-dd HH:mm:ss")
727
- }
728
- if (this.data.operator) {
729
- this.model.f_operator = this.data.operator
730
- } else {
731
- this.model.f_operator = this.$login.f.name
732
- }
733
- },
734
- 'data.fields'() {
735
- this.refresh = false
736
- this.$nextTick(() => {
737
- this.refresh = true
738
- })
739
- this.initializtion()
740
- },
741
- deep: true
742
- },
743
- computed: {
744
- // 输入后按钮检测
745
- check_disable: function () {
746
- let fields = this.data.fields
747
- let flag = false
748
- for (let i = 0; i < fields.length; i++) {
749
- if (fields[i].type !== 'checkbox' && fields[i].required && !fields[i].value) {
750
- flag = true
751
- }
752
- }
753
- let count = 0
754
- for (let i = 0; i < fields.length; i++) {
755
- if (fields[i].type !== 'checkbox' && !fields[i].required) {
756
- count++
757
- }
758
- }
759
- if (count == 0) {
760
- flag = false
761
- }
762
- this.disable_button = flag
763
- },
764
- refreshed() {
765
- let fields = this.data.fields
766
- this.data.fields = fields
767
- }
768
- }
769
- }
770
- </script>
771
- <style scoped>
772
- th {
773
-
774
- }
775
-
776
- .control-label-justify {
777
- display: inline-block;
778
- vertical-align: top;
779
- width: 70px;
780
- text-align: justify;
781
- font-family: PingFang-SC-Bold;
782
- }
783
- .component-style{
784
- top: 42px;
785
- }
786
- .control-label-justify::after {
787
- content: "";
788
- display: inline-block;
789
- width: 70px;
790
- overflow: hidden;
791
- height: 0;
792
- }
793
-
794
- input::-webkit-outer-spin-button,
795
- input::-webkit-inner-spin-button {
796
- -webkit-appearance: none;
797
- }
798
-
799
- input[type="number"] {
800
- -moz-appearance: textfield;
801
- }
802
-
803
- tr {
804
- height: 34px;
805
- }
806
- .form-group{
807
- margin-top:20px;
808
- }
809
- </style>
1
+ <template>
2
+ <div class="auto select-overspread" v-if="refresh">
3
+ <!--<div class="panel panel-info" v-if="!data.titlevisible">-->
4
+ <!--<div class="panel-heading">-->
5
+ <!--<h3 class="panel-title">-->
6
+ <!--<span >{{data.title}}</span>-->
7
+ <!--<span v-if="data.back_reason" style="color: red;font-family: 微软雅黑;font-weight: bold"> 请注意被退回原因为:{{data.back_reason}}</span>-->
8
+ <!--</h3>-->
9
+ <!--</div>-->
10
+ <!--</div>-->
11
+ <validator name="v">
12
+ <form class="form-horizontal">
13
+ <div class="col-sm-12 form-group form-group1">
14
+ <div v-for="(index,item) in data.fields">
15
+ <!--input-->
16
+ <div :style="item.style+';height: 34px;'"
17
+ v-if="item.type==='input' || item.type==='number'||item.type === 'tel'||item.type === 'email'"
18
+ v-show="!item.hidden"
19
+ :class="[data.fields[index].required&&!(data.fields[index].value) ? 'has-error' : '',data.fields[index].bootstraped?data.fields[index].bootstraped+' form-group':'col-sm-4 form-group form-group1']">
20
+ <label :style="item.label_style? item.label_style:''+';width:85px;'"
21
+ :class="item.label_bootstraped?item.label_bootstraped+' control-label-justify control-label':item.label_style?'':'control-label-justify control-label col-sm-6'">{{item.label}}</label>
22
+ <div :style="item.value_style? item.value_style:''"
23
+ :class="item.value_bootstraped?item.value_bootstraped:item.value_style?'':'col-sm-6'">
24
+ <input class="form-control" style="background-color: #f7fbff;"
25
+ :type="item.type"
26
+ v-model="data.fields[index].value"
27
+ :placeholder="item.placeholder"
28
+ :value="data.fields[index].value"
29
+ :readonly="item.readonly"
30
+ :disabled="item.disabled"
31
+ @change="select_change(index),disabled_check(data.fields[index].required,data.fields[index].value)"
32
+ @blur="select_change(index),check_disable"
33
+ />
34
+ </div>
35
+ </div>
36
+ <!--时间datepicker-->
37
+ <div :style="item.style? item.style+';height: 34px;':'height: 34px;'" v-if="item.type==='datepicker'"
38
+ v-show="!item.hidden"
39
+ :class="[data.fields[index].required&&!(data.fields[index].value) ? 'has-error' : '',data.fields[index].bootstraped?data.fields[index].bootstraped+' form-group':'col-sm-4 form-group form-group1']">
40
+ <label style="width:85px"
41
+ :class="item.label_bootstraped?item.label_bootstraped+' control-label-justify control-label':'control-label control-label-justify col-sm-6'">{{item.label}}</label>
42
+ <div :class="item.value_bootstraped?item.value_bootstraped:'col-sm-6'">
43
+ <datepicker
44
+ :placeholder="item.placeholder"
45
+ :value.sync="data.fields[index].value"
46
+ :format="'yyyy-MM-dd HH:mm:ss'"
47
+ v-model="data.fields[index].value"
48
+ :readonly=true
49
+ :disabled="item.disabled"
50
+ @blur="check_disable"
51
+ :show-reset-button="reset">
52
+ </datepicker>
53
+ </div>
54
+ </div>
55
+
56
+ <!--textarea-->
57
+ <div :style="item.style? item.style:'height: 34px;'" v-if="item.type==='textarea'" v-show="!item.hidden"
58
+ :class="[data.fields[index].required&&!(data.fields[index].value) ? 'has-error' : '',data.fields[index].bootstraped?data.fields[index].bootstraped+' form-group':'col-sm-12 form-group']">
59
+ <label :style="item.label_style? item.label_style:''"
60
+ :class="item.label_bootstraped?item.label_bootstraped+' control-label-justify control-label':item.label_style?'':'control-label-justify control-label col-sm-3'">{{item.label}}</label>
61
+ <div :style="item.value_style? item.value_style:''"
62
+ :class="item.value_bootstraped?item.value_bootstraped:item.value_style?'':'col-sm-10'">
63
+ <textarea
64
+ :readonly="item.readonly"
65
+ :disabled="item.disabled"
66
+ class="form-control"
67
+ style="background-color: #f7fbff;margin-top: 7px"
68
+ :rows="item.rows"
69
+ v-model="data.fields[index].value"
70
+ @change="disabled_check(data.fields[index].required,data.fields[index].value)"
71
+ @blur="check_disable"
72
+ >
73
+ </textarea>
74
+ </div>
75
+ </div>
76
+
77
+ <!--radio-->
78
+ <div v-if="item.type==='radio'"
79
+ :class="[data.fields[index].required&&!(data.fields[index].value) ? 'has-error' : '',data.fields[index].bootstraped?data.fields[index].bootstraped+' form-group':'col-sm-12 form-group']">
80
+ <label v-if="item.label"
81
+ :class="item.label_bootstraped?item.label_bootstraped+' control-label-justify control-label':'control-label-justify control-label col-sm-2'">{{item.label}}</label>
82
+ <div
83
+ :class="item.value_bootstraped?item.value_bootstraped:item.items.length%2 == 0?'col-sm-5': 'col-sm-3'"
84
+ v-for="(index2,row) in item.items">
85
+ <label for="row.label"
86
+ :class="item.items.length%2 == 0?'col-sm-3 control-label': 'col-sm-2 control-label'">{{row.label}}</label>
87
+ <input @blur="check_disable"
88
+ :class="item.items.length%2 == 0?'col-sm-3 control-label': 'col-sm-2 control-label'"
89
+ :readonly="item.readonly" :disabled="item.disabled" style="margin-top: 10px" type="radio"
90
+ :name="index" :id="row.label" v-bind:value="data.fields[index].items[index2].value"
91
+ v-model="data.fields[index].value">
92
+ </div>
93
+ </div>
94
+
95
+ <!--select-->
96
+ <div style="height: 34px" v-if="item.type==='select'" v-show="!item.hidden"
97
+ :class="[data.fields[index].required&&!(data.fields[index].value) ? 'has-error' : '',data.fields[index].bootstraped?data.fields[index].bootstraped+' form-group ':'col-sm-4 form-group']">
98
+ <label style="width:85px;"
99
+ :class="item.label_bootstraped?item.label_bootstraped+' control-label control-label-justify':'control-label-justify control-label col-sm-6'">{{item.label}}</label>
100
+ <input-select :class="item.value_bootstraped?item.value_bootstraped:'col-sm-6'" @blur="check_disable"
101
+ @change="select_change(index),disabled_check(data.fields[index].required,data.fields[index].value)"
102
+ :readonly="item.readonly" :disabled="item.disabled" :value.sync="data.fields[index].value"
103
+ v-model="data.fields[index].value"
104
+ :search="true"
105
+ :options='data.fields[index].options' :valueSingle="true"></input-select>
106
+
107
+ </div>
108
+
109
+
110
+ <!--checkbox-->
111
+ <div v-if="item.type==='checkbox'"
112
+ :class="[data.fields[index].required&&!(data.fields[index].value) ? 'has-error' : '',data.fields[index].bootstraped?data.fields[index].bootstraped+' form-group':'col-sm-12 form-group']">
113
+ <label v-if="item.label"
114
+ :class="item.label_bootstraped?item.label_bootstraped+' control-label ':'control-label col-sm-2'">{{item.label}}</label>
115
+ <div style="margin-top: 6px"
116
+ :class="item.value_bootstraped?item.value_bootstraped:'control-label col-sm-2'"
117
+ v-for="(index2,row) in item.items">
118
+ <label class="font-size form-group col-sm-6">{{row.label}}</label>
119
+ <input :readonly="item.readonly" :disabled="item.disabled" type="checkbox" class="col-sm-6"
120
+ :id="row.label" v-model="data.fields[index].items[index2].value" @click="checkboxSelect(index,index2)" >
121
+ </div>
122
+ </div>
123
+ </div>
124
+ <!-- onetomany -->
125
+ <div class="col-sm-12" v-for="(i,datagrid) in data.onetomany">
126
+ <table v-show="!datagrid.hidden" class="table table-bordered table-striped table-hover" style="margin-top: 80px">
127
+ <tr style="background-color: #00A3F0">
128
+ <th style="text-align: center;border-color: #00A3F0"><font color="white">序号</font></th>
129
+ <th v-for="labels in datagrid.fields" style="text-align: center;border-color: #00A3F0">
130
+ <nobr><font color="white">{{labels.label}}</font></nobr>
131
+ </th>
132
+ <th style="text-align: center;border-color: #00A3F0;padding: 0px">
133
+ <button type="button" @click="$dispatch('add',i)" class="btn btn-warning"
134
+ v-if="!data.onetomany[i].nopower">
135
+ +
136
+ </button>
137
+ </th>
138
+ </tr>
139
+ <tr v-for="(j,row) in model.rows[i]">
140
+ <td style="text-align: center">{{$index+1}}</td>
141
+ <td v-for="key in surBodyData[i]" style="text-align: center">
142
+ {{row[key]}}
143
+ </td>
144
+ <td style="text-align: center">
145
+ <a href="#" @click="delete(i,j)" v-if="!data.onetomany[i].nopower">删除</a>
146
+ </td>
147
+ </tr>
148
+ </table>
149
+ </div>
150
+ <div v-for="(i,item) in data.components" >
151
+ <component v-if="item.device === 'pc' || !item.device" :is="item.name" :selectdata="data" :mark="item.mark"></component>
152
+ </div>
153
+ </div>
154
+ <div class="col-sm-12 form-group text-center" style="padding-top:20px">
155
+ <div class="form-group col-sm-3 center-block">
156
+ <label class=" col-sm-4 control-label control-label-justify">所属公司:</label>
157
+ <div class="col-sm-8">
158
+ <input class="form-control" type="text" v-model="model.f_filiale" disabled>
159
+ </div>
160
+ </div>
161
+ <div class="col-sm-2 form-group center-block">
162
+ <label class="control-label control-label-justify col-sm-6">部门:</label>
163
+ <div class="col-sm-6">
164
+ <input type="text" class="form-control" disabled v-model="model.f_parentname"/>
165
+ </div>
166
+ </div>
167
+ <div class="col-sm-2 form-group center-block">
168
+ <label class="control-label control-label-justify col-sm-6">操作人:</label>
169
+ <div class="col-sm-6 ">
170
+ <input type="text" class="form-control" disabled v-model="model.f_operator"/>
171
+ </div>
172
+ </div>
173
+ <div class="col-sm-4 form-group center-block">
174
+ <label class="control-label control-label-justify col-sm-6">操作日期:</label>
175
+ <div class="col-sm-6">
176
+ <input type="text" class="form-control" disabled v-model="model.f_operate_date"/>
177
+ </div>
178
+ </div>
179
+ </div>
180
+ </form>
181
+ </validator>
182
+ <div class="from-group col-sm-11">
183
+ <center>
184
+ <!-- 按钮组 -->
185
+ <button v-for="(index,button) in data.buttons"
186
+ :disabled="(button.button_name==='提交'||button.button_name==='下发'||button.button_name==='打印回单')&&disable_button" type="button"
187
+ @click="clicked(index,button)"
188
+ :class="(button.button_name==='提交'||button.button_name==='下发'||button.button_name==='打印回单')&&disable_button?'btn btn-default':'btn btn-primary'"
189
+ style="width:80px; margin-left:50px;">
190
+ {{button.button_name}}
191
+ </button>
192
+ </center>
193
+ </div>
194
+ <!-- 按钮模态框 -->
195
+ <modal v-if="showmodal" :show.sync="showmodal" v-ref:modal backdrop="false">
196
+ <header slot="modal-header" class="modal-header">
197
+ <button type="button" class="close" @click="closemodal"><span>&times;</span></button>
198
+ <h4 class="modal-title">{{model.button.button_name}}</h4>
199
+ </header>
200
+ <article slot="modal-body" class="modal-body">
201
+ <div class="col-sm-12" v-for="(index,button_field) in data.buttons[model.button.button_index].button_fields">
202
+ <label class="control-label col-sm-3" style="margin-top: 10px">{{button_field.label}}:</label>
203
+ <div class="col-sm-7">
204
+ <!--select-->
205
+ <input-select v-if="button_field.type=='select'"
206
+ :value.sync="data.buttons[model.button.button_index].button_fields[index].value"
207
+ v-model="data.buttons[model.button.button_index].button_fields[index].value"
208
+ :options='button_field.options'></input-select>
209
+ <!-- input -->
210
+ <input v-else type="text" class="form-control"
211
+ v-model="data.buttons[model.button.button_index].button_fields[index].value"/>
212
+ </div>
213
+ </div>
214
+ </article>
215
+ <footer slot="modal-footer" style="border-top:none" class="modal-footer">
216
+ <button v-show="showmodal" type="button" class="btn btn-primary" @click='acknowledge'>确认</button>
217
+ </footer>
218
+ </modal>
219
+
220
+
221
+ <!-- onetomany新增模态框 -->
222
+ <div class="auto"
223
+ style="background-color:white;max-width: 700px;max-hight:500px;z-index:9999;box-shadow: 0px 0px 100px 10px grey;position: fixed;margin-left: 20%;"
224
+ v-if="showadd">
225
+
226
+ <div class="auto">
227
+
228
+ <div style="padding-top: 15px;padding-left: 15px;padding-right: 15px;">
229
+ <button type="button" class="close" @click="closemodal(modeltitle)"><span>&times;</span></button>
230
+ <span class="modal-title" style="border-bottom: 1px solid #e5e5e5;"><font
231
+ size="3">{{modeltitle}}</font></span>
232
+ </div>
233
+            
234
+ <div style="padding-top: 15px;border-top: 0px solid #e5e5e5;border-bottom: 0px solid #e5e5e5;">
235
+ <div class="col-sm-12" v-for="(index,showadd_field) in showadd_fields.fields" v-if="refresh_modal">
236
+ <label v-show="!showadd_field.hidden" class="control-label col-sm-3" style="margin-top: 10px">{{showadd_field.label}}:</label>
237
+ <div class="col-sm-7" v-show="!showadd_field.hidden">
238
+ <!--时间datepicker-->
239
+ <div v-if="showadd_field.type=='datepicker'"
240
+ :class="[showadd_fields[index].required&&!(showadd_fields.fields[index].value) ? 'has-error' : '']">
241
+ <div>
242
+ <datepicker
243
+ :placeholder="showadd_field.placeholder"
244
+ :value.sync="showadd_fields.fields[index].value"
245
+ :format="'yyyy-MM-dd HH:mm:ss'"
246
+ v-model="showadd_fields.fields[index].value"
247
+ :readonly=true
248
+ :disabled="showadd_fields.fields[index].disabled"
249
+ @blur="check_disable"
250
+ :show-reset-button="reset">
251
+ </datepicker>
252
+ </div>
253
+ </div>
254
+ <!--select-->
255
+ <input-select
256
+ @change="select_change_modal(index),disabled_check_modal(showadd_fields.fields[index].required,showadd_fields.fields[index].value)"
257
+ v-if="showadd_field.type=='select'"
258
+ @blur="check_disable_modal,disabled_check_modal(showadd_fields.fields[index].required,showadd_fields.fields[index].value)"
259
+ :mouseout="check_disable_modal,disabled_check_modal(showadd_fields.fields[index].required,showadd_fields.fields[index].value)"
260
+ :value.sync="showadd_fields.fields[index].value"
261
+ v-model="showadd_fields.fields[index].value"
262
+ :options='showadd_fields.fields[index].options'>
263
+ </input-select>
264
+ <!-- input -->
265
+ <input :type="showadd_field.type"
266
+ @change="select_change_modal(index),check_disable_modal,disabled_check_modal(showadd_fields.fields[index].required,showadd_fields.fields[index].value)"
267
+ v-if="(showadd_field.type=='input'||showadd_field.type=='number')&&!showadd_field.hidden"
268
+ @blur="check_disable_modal,disabled_check_modal(showadd_fields.fields[index].required,showadd_fields.fields[index].value)"
269
+ :mouseout="check_disable_modal,disabled_check_modal(showadd_fields.fields[index].required,showadd_fields.fields[index].value)"
270
+ :readonly="showadd_field.readonly" class="form-control"
271
+ v-model="showadd_fields.fields[index].value"
272
+ :value.sync="showadd_fields[index].value"/>
273
+ <span
274
+ v-if="showadd_fields.fields[index].error&&showadd_fields.fields[index].error.msg&&showadd_fields.fields[index].error.flag"
275
+ style="color: red">{{showadd_fields.fields[index].error.msg}}</span>
276
+ </div>
277
+ </div>
278
+ </div>
279
+
280
+ <div style="padding-top: 15px;padding-left: 15px;padding-right: 15px;text-align: right;">
281
+ <button :class="disable_button_modal?'btn btn-default':'btn btn-primary'" v-show="showadd"
282
+ :disabled="disable_button_modal" type="button" @click="acknowledge(modeltitle)">
283
+ 确认
284
+ </button>
285
+ </div>
286
+
287
+ </div>
288
+  
289
+ </div>
290
+
291
+ </div>
292
+ </template>
293
+ <script>
294
+ import Vue from 'vue'
295
+ // Date格式化
296
+ Date.prototype.Format = function (fmt) {
297
+ var o = {
298
+ "M+": this.getMonth() + 1, //月份
299
+ "d+": this.getDate(), //日
300
+ "H+": this.getHours(), //小时
301
+ "m+": this.getMinutes(), //分
302
+ "s+": this.getSeconds(), //秒
303
+ "q+": Math.floor((this.getMonth() + 3) / 3), //季度
304
+ "S": this.getMilliseconds() //毫秒
305
+ };
306
+ if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
307
+ for (var k in o)
308
+ if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
309
+ return fmt;
310
+ }
311
+
312
+ export default {
313
+ title: '报建业务通用组件',
314
+ props: ['data'],
315
+ data() {
316
+ return {
317
+ data: {
318
+ onetomany: {
319
+ fields: []
320
+ }
321
+ },
322
+ surBodyData: [],
323
+ refresh: true, // 控制重新渲染
324
+ model: {
325
+ rows: [],
326
+ button: {
327
+ button_name: null,
328
+ button_index: null
329
+ },
330
+ f_filiale: null,
331
+ f_parentname: null,
332
+ f_operate_date: null,
333
+ f_operator: null
334
+ },
335
+ showadd: false, // onetomany 新增模态框
336
+ showadd_fields: [], // onetomany 新增模态框的字段配置
337
+ // data: null,
338
+ modeltitle: '',
339
+ tempid: null,
340
+ showadd_index: null,
341
+ showmodal: false,
342
+ disable_button: true,
343
+ disable_button_modal: true,
344
+ refresh_modal: true
345
+ }
346
+ },
347
+ created() {
348
+ // 初始化数据
349
+ this.initializtion()
350
+ },
351
+ events: {
352
+ async 'add'(index) {
353
+ let templet = new Object()
354
+ templet = this.data.onetomany[index]
355
+ let count = 0
356
+ for (let j = 0; j < templet.fields.length; j++) {
357
+ templet.fields[j].value = ''
358
+ if (templet.fields[j].type == 'datepicker') {
359
+ templet.fields[j].value = new Date().Format("yyyy-MM-dd HH:mm:ss")
360
+ }
361
+ if (templet.fields[j].required) {
362
+ count++
363
+ }
364
+ }
365
+ if (count == 0) {
366
+ this.disable_button_modal = false
367
+ }
368
+ this.modeltitle = '新增'
369
+ this.showadd_fields = templet
370
+ this.showadd_index = index
371
+ this.showadd = true
372
+ }
373
+ },
374
+ methods: {
375
+ // 获取组件中的数据
376
+ getmodel() {
377
+ // 组织model.fields数据
378
+ let modeldatas = {}
379
+ for (let i = 0; i < this.data.fields.length; i++) {
380
+ // checkbox特殊处理
381
+ if (this.data.fields[i].type === 'checkbox') {
382
+ for (let j = 0; j < this.data.fields[i].items.length; j++) {
383
+ modeldatas[this.data.fields[i].items[j].field] = this.data.fields[i].items[j].value
384
+ }
385
+ } else {
386
+ modeldatas[this.data.fields[i].field] = this.data.fields[i].value
387
+ }
388
+ }
389
+ modeldatas.f_process_id = this.data.f_process_id
390
+ modeldatas.f_filiale = this.model.f_filiale
391
+ modeldatas.f_parentname = this.model.f_parentname
392
+ modeldatas.f_operator = this.model.f_operator
393
+ modeldatas.f_operate_date = this.model.f_operate_date
394
+ return modeldatas
395
+ },
396
+ // 修改
397
+ revise(index, index2) {
398
+ this.showadd_fields = []
399
+ let templet = new Object()
400
+ templet = this.data.onetomany[index]
401
+ for (let j = 0; j < templet.fields.length; j++) {
402
+ if (templet.fields[j].type == 'input') {
403
+ templet[j] = {}
404
+ templet[j].value = this.model.rows[index][index2][templet.fields[j].field]
405
+ templet.fields[j].value = this.model.rows[index][index2][templet.fields[j].field]
406
+ } else {
407
+ templet.fields[j].value = this.model.rows[index][index2][templet.fields[j].field]
408
+ if (templet.fields[j].type == 'datepicker') {
409
+ templet.fields[j].value = new Date().Format("yyyy-MM-dd HH:mm:ss")
410
+ }
411
+ }
412
+ }
413
+ this.tempid = this.model.rows[index][index2].id
414
+ this.modeltitle = '修改'
415
+ this.showadd_fields = templet
416
+ this.showadd_index = index
417
+ this.showadd = true
418
+ },
419
+ // 检测模态框按钮的disable
420
+ disabled_check_modal(required, value) {
421
+ if (required && value) {
422
+ this.disable_button_modal = false
423
+
424
+ let fields = this.showadd_fields.fields
425
+ let flag = false
426
+ for (let i = 0; i < fields.length; i++) {
427
+ if (fields[i].type !== 'checkbox' && fields[i].required && !fields[i].value) {
428
+ flag = true
429
+ }
430
+ }
431
+ this.disable_button_modal = flag
432
+ }
433
+ },
434
+ // 检测模态框按钮的disable,反向检查
435
+ check_disable_modal() {
436
+ let fields = this.showadd_fields.fields
437
+ let flag = false
438
+ for (let i = 0; i < fields.length; i++) {
439
+ if (fields[i].type !== 'checkbox' && fields[i].required && !fields[i].value) {
440
+ flag = true
441
+ }
442
+ }
443
+ let count = 0
444
+ for (let i = 0; i < fields.length; i++) {
445
+ if (fields[i].type !== 'checkbox' && !fields[i].required) {
446
+ count++
447
+ }
448
+ }
449
+ if (count == 0) {
450
+ flag = false
451
+ }
452
+ this.disable_button_modal = flag
453
+ },
454
+ checkboxSelect(index,index1){
455
+ console.log("chufa事件");
456
+ this.$dispatch('checkboxSelectControl', index, index1)
457
+ },
458
+ // 模态框级联操作预留
459
+ select_change_modal(index) {
460
+ if (this.showadd_fields.fields[index].value) {
461
+ this.showadd_fields[index] = {}
462
+ this.showadd_fields[index].value = this.showadd_fields.fields[index].value
463
+ } else if (this.showadd_fields[index] && this.showadd_fields[index].value) {
464
+ this.showadd_fields.fields[index].value = this.showadd_fields[index].value
465
+ }
466
+ this.refresh_modal = false
467
+ this.$nextTick(() => {
468
+ this.refresh_modal = true
469
+ })
470
+ this.$dispatch('select_cascade_modal', this.showadd_index, index)
471
+ // if(this.showadd_fields.fields[index].label=='购货方纳税人识别号'){
472
+ // if(this.showadd_fields.fields[index].value.length!=15&&this.showadd_fields.fields[index].value.length!=18&&this.showadd_fields.fields[index].value.length!=20){
473
+ // this.$showMessage("购货方纳税人识别号必须为15位,18位或者20位")
474
+ // this.showadd_fields.fields[index].value = ''
475
+ // }
476
+ // }
477
+ },
478
+ // 更新showadd模态框
479
+ update_showadd_fields_value(index, value) {
480
+ this.showadd_fields.fields[index].value = value
481
+ this.showadd_fields[index] = {}
482
+ this.showadd_fields[index].value = value
483
+ },
484
+ // 清理showadd模态框
485
+ clear_showadd_fields_value(index) {
486
+ this.showadd_fields.fields[index].value = ''
487
+ this.showadd_fields[index].value = ''
488
+ },
489
+ // 删除
490
+ delete(i, j) {
491
+ this.$showMessage("您确定要删除这条记录吗?", ['confirm']).then((res) => {
492
+ if (res == 'confirm') {
493
+ this.$dispatch('onetomanydelete', i, j)
494
+ }
495
+ })
496
+ },
497
+ // 强制刷新
498
+ update() {
499
+ this.refresh = false
500
+ this.$nextTick(() => {
501
+ this.refresh = true
502
+ })
503
+ this.initializtion()
504
+ },
505
+ // 初始化数据
506
+ initializtion() {
507
+ if(this.data.f_apply_type='集体报建' && this.data.f_user_type=='非民用' && this.data.defname=='验收'){
508
+ for(let j=0;j< this.data.fields.length;j++) {
509
+ this.data.fields[j].required = false
510
+ }
511
+ }
512
+
513
+ let fields = this.data.fields
514
+ let flag = false
515
+ for (let i = 0; i < fields.length; i++) {
516
+ if (fields[i].type !== 'checkbox' && fields[i].required && !fields[i].value) {
517
+ flag = true
518
+ }
519
+ }
520
+ let count = 0
521
+ for (let i = 0; i < fields.length; i++) {
522
+ if (fields[i].type !== 'checkbox' && !fields[i].required) {
523
+ count++
524
+ }
525
+ }
526
+ if (count = 0) {
527
+ flag = false
528
+ }
529
+ this.disable_button = flag
530
+
531
+ this.model.rows = []
532
+ this.surBodyData = []
533
+ if (this.data.onetomany && this.data.onetomany.length > 0) {
534
+ for (let i = 0; i < this.data.onetomany.length; i++) {
535
+ let temp = []
536
+ for (let j = 0; j < this.data.onetomany[i].fields.length; j++) {
537
+ temp.push(this.data.onetomany[i].fields[j].field)
538
+ }
539
+ this.surBodyData.push(temp)
540
+ }
541
+ for (let i = 0; i < this.data.onetomany.length; i++) {
542
+ if (this.data.onetomany[i].rows) {
543
+ this.model.rows.push(this.data.onetomany[i].rows)
544
+ }
545
+ }
546
+
547
+ }
548
+ // datepicker 没有值给当时值
549
+ if (this.data.fields && this.data.fields.length > 0) {
550
+ for (let i = 0; i < this.data.fields.length; i++) {
551
+ if (this.data.fields[i].type === 'datepicker' && !this.data.fields[i].value) {
552
+ this.data.fields[i].value = new Date().Format("yyyy-MM-dd HH:mm:ss")
553
+ }
554
+ }
555
+ } else {
556
+ this.disable_button = false
557
+ }
558
+ if (this.data.filiale) {
559
+ this.model.f_filiale = this.data.filiale
560
+ } else {
561
+ this.model.f_filiale = this.$login.f.f_fengongsi
562
+ }
563
+ if (this.data.f_parentname) {
564
+ this.model.f_parentname = this.data.f_parentname
565
+ } else {
566
+ this.model.f_parentname = this.$login.f.f_parentname
567
+ }
568
+ if (this.data.operate_date) {
569
+ this.model.f_operate_date = this.data.operate_date
570
+ } else {
571
+ this.model.f_operate_date = new Date().Format("yyyy-MM-dd HH:mm:ss")
572
+ }
573
+ if (this.data.operator) {
574
+ this.model.f_operator = this.data.operator
575
+ } else {
576
+ this.model.f_operator = this.$login.f.name
577
+ }
578
+ },
579
+ // 模态框点击确定按钮
580
+ acknowledge(val) {
581
+ if (val == '新增') {
582
+ let temp = {}
583
+ for (let i = 0; i < this.showadd_fields.fields.length; i++) {
584
+ if (this.showadd_fields.fields[i].value) {
585
+ temp[this.showadd_fields.fields[i].field] = this.showadd_fields.fields[i].value
586
+ } else if (this.showadd_fields && this.showadd_fields[i] && this.showadd_fields[i].value) {
587
+ temp[this.showadd_fields.fields[i].field] = this.showadd_fields[i].value
588
+ }
589
+ }
590
+ this.model.rows[this.showadd_index].push(temp)
591
+ this.$dispatch('confirm', this.data.onetomany[this.showadd_index].tables, temp, this.showadd_index, this.model.rows[this.showadd_index].length - 1)
592
+ this.showadd_fields = null
593
+ this.showadd_index = null
594
+ this.closemodal(val)
595
+ } else {
596
+ for (let i = 0; i < this.data.buttons[this.model.button.button_index].button_fields.length; i++) {
597
+ this.model.button.button_fields[this.data.buttons[this.model.button.button_index].button_fields[i].field] = this.data.buttons[this.model.button.button_index].button_fields[i].value
598
+ }
599
+ this.showmodal = false
600
+ this.$dispatch('button', this.model)
601
+ }
602
+ },
603
+ // 关闭模态框
604
+ closemodal(val) {
605
+ if (this.showadd_fields && this.showadd_fields.fields && this.showadd_fields.fields.length) {
606
+ for (let i = 0; i < this.showadd_fields.fields.length; i++) {
607
+ if (this.showadd_fields[i] && this.showadd_fields[i].value) {
608
+ this.showadd_fields[i].value = ''
609
+ }
610
+ if (this.showadd_fields.fields[i] && this.showadd_fields.fields[i].value) {
611
+ this.showadd_fields.fields[i].value = ''
612
+ }
613
+ }
614
+ }
615
+
616
+ if (val != '新增' || val != '修改' || val != '删除') {
617
+ this.disable_button = false
618
+ }
619
+ this.showmodal = false
620
+ if (val == '新增') {
621
+ this.showadd = false
622
+ }
623
+ this.showadd_fields = null
624
+ this.disable_button_modal = true
625
+ this.modeltitle = null
626
+ this.tempid = null
627
+ },
628
+ // 点击按钮
629
+ clicked(index, button) {
630
+
631
+ // onetomany 处理
632
+ // if(this.data.onetomany&&this.data.onetomany.fields.length>0){
633
+ // let temp = {}
634
+ // temp['tables'] = this.data.onetomany.tables
635
+ // temp['rows'] = this.model.rows
636
+ // this.$dispatch('onetomanyevent',temp)
637
+ // }
638
+ this.disable_button=false;
639
+ this.$parent.$parent.$parent.$parent.$refs.queryuser.button_name="查询"
640
+ if(button.button_name !='打印回单')
641
+ this.disable_button = true
642
+ console.log(`点击了按钮index:${index}+button:${JSON.stringify(button)}`);
643
+ // 组织model.fields数据
644
+ let modeldatas = {}
645
+ for (let i = 0; i < this.data.fields.length; i++) {
646
+ // checkbox特殊处理
647
+ if (this.data.fields[i].type === 'checkbox') {
648
+ for (let j = 0; j < this.data.fields[i].items.length; j++) {
649
+ modeldatas[this.data.fields[i].items[j].field] = this.data.fields[i].items[j].value
650
+ }
651
+ } else {
652
+ modeldatas[this.data.fields[i].field] = this.data.fields[i].value
653
+ }
654
+ }
655
+ modeldatas.f_process_id = this.data.f_process_id
656
+ modeldatas.f_filiale = this.model.f_filiale
657
+ modeldatas.f_parentname = this.model.f_parentname
658
+ modeldatas.f_operator = this.model.f_operator
659
+ modeldatas.f_operate_date = this.model.f_operate_date
660
+ this.model = null
661
+ this.model = modeldatas
662
+ // 初始化model.button数据
663
+ let buttondatas = {
664
+ button_fields: {}
665
+ }
666
+ if (button.button_event) {
667
+ buttondatas.button_event = button.button_event
668
+ }
669
+ if (button.button_node) {
670
+ buttondatas.button_node = button.button_node
671
+ }
672
+ if (button.button_person) {
673
+ buttondatas.button_person = button.button_person
674
+ }
675
+ buttondatas.button_name = button.button_name
676
+ buttondatas.button_index = index
677
+ if (button.button_fields) {
678
+ for (let i = 0; i < button.button_fields.length; i++) {
679
+ buttondatas.button_fields[button.button_fields[i].field] = button.button_fields[i].value
680
+ }
681
+ }
682
+ this.model.button = buttondatas
683
+ if (button.button_name === '退回') {
684
+ this.showmodal = true
685
+ } else if (button.button_name === '下发') {
686
+ this.showmodal = true
687
+ } else {
688
+ this.$dispatch('button', this.model)
689
+ }
690
+ },
691
+ // 级联操作预留
692
+ select_change(index) {
693
+ this.$dispatch('select_cascade', index)
694
+ },
695
+ // 检测按钮的disable
696
+ disabled_check(required, value) {
697
+ if (required && value) {
698
+ this.disable_button = false
699
+
700
+ let fields = this.data.fields
701
+ let flag = false
702
+ for (let i = 0; i < fields.length; i++) {
703
+ if (fields[i].type !== 'checkbox' && fields[i].required && !fields[i].value) {
704
+ flag = true
705
+ }
706
+ }
707
+ this.disable_button = flag
708
+ }
709
+ }
710
+ },
711
+ watch: {
712
+ 'data.operate_date'() {
713
+ if (this.data.filiale) {
714
+ this.model.f_filiale = this.data.filiale
715
+ } else {
716
+ this.model.f_filiale = this.$login.f.f_fengongsi
717
+ }
718
+ if (this.data.f_parentname) {
719
+ this.model.f_parentname = this.data.f_parentname
720
+ } else {
721
+ this.model.f_parentname = this.$login.f.f_parentname
722
+ }
723
+ if (this.data.operate_date) {
724
+ this.model.f_operate_date = this.data.operate_date
725
+ } else {
726
+ this.model.f_operate_date = new Date().Format("yyyy-MM-dd HH:mm:ss")
727
+ }
728
+ if (this.data.operator) {
729
+ this.model.f_operator = this.data.operator
730
+ } else {
731
+ this.model.f_operator = this.$login.f.name
732
+ }
733
+ },
734
+ 'data.fields'() {
735
+ this.refresh = false
736
+ this.$nextTick(() => {
737
+ this.refresh = true
738
+ })
739
+ this.initializtion()
740
+ },
741
+ deep: true
742
+ },
743
+ computed: {
744
+ // 输入后按钮检测
745
+ check_disable: function () {
746
+ let fields = this.data.fields
747
+ let flag = false
748
+ for (let i = 0; i < fields.length; i++) {
749
+ if (fields[i].type !== 'checkbox' && fields[i].required && !fields[i].value) {
750
+ flag = true
751
+ }
752
+ }
753
+ let count = 0
754
+ for (let i = 0; i < fields.length; i++) {
755
+ if (fields[i].type !== 'checkbox' && !fields[i].required) {
756
+ count++
757
+ }
758
+ }
759
+ if (count == 0) {
760
+ flag = false
761
+ }
762
+ this.disable_button = flag
763
+ },
764
+ refreshed() {
765
+ let fields = this.data.fields
766
+ this.data.fields = fields
767
+ }
768
+ }
769
+ }
770
+ </script>
771
+ <style scoped>
772
+ th {
773
+
774
+ }
775
+
776
+ .control-label-justify {
777
+ display: inline-block;
778
+ vertical-align: top;
779
+ width: 70px;
780
+ text-align: justify;
781
+ font-family: PingFang-SC-Bold;
782
+ }
783
+ .component-style{
784
+ top: 42px;
785
+ }
786
+ .control-label-justify::after {
787
+ content: "";
788
+ display: inline-block;
789
+ width: 70px;
790
+ overflow: hidden;
791
+ height: 0;
792
+ }
793
+
794
+ input::-webkit-outer-spin-button,
795
+ input::-webkit-inner-spin-button {
796
+ -webkit-appearance: none;
797
+ }
798
+
799
+ input[type="number"] {
800
+ -moz-appearance: textfield;
801
+ }
802
+
803
+ tr {
804
+ height: 34px;
805
+ }
806
+ .form-group{
807
+ margin-top:20px;
808
+ }
809
+ </style>