apply-clients 5.0.35-23 → 5.0.35-27

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