apply-clients 3.0.5-21 → 3.0.5-23

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