apply-clients 3.1.37 → 3.1.40

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,714 +1,718 @@
1
- <template>
2
- <div class="select-overspread" style="background-color: #ffffff;margin: 20px">
3
- <validator name="v">
4
- <form class="form-horizontal">
5
- <div class="form-group">
6
- <div v-for="(index,item) in data.fields" style="">
7
- <!--input-->
8
- <div :style="item.style ? item.style+';height: 40px;margin-bottom: 20px':'height: 40px;margin-bottom: 20px'"
9
- v-if="item.type==='input' || item.type==='number'||item.type === 'tel'||item.type === 'email'"
10
- v-show="!item.hidden"
11
- :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']">
12
- <label :style="item.label_style ? item.label_style : ''"
13
- :class="item.label_bootstraped ? item.label_bootstraped+' control-label-justify control-label' : 'control-label-justify control-label col-sm-6'">{{item.label}}</label>
14
- <div :style="item.value_style? item.value_style:''"
15
- :class="item.value_bootstraped?item.value_bootstraped:item.value_style?'':'col-sm-6'">
16
- <input class="form-control input_view" style=""
17
- :type="item.type"
18
- v-model="data.fields[index].value"
19
- :placeholder="item.placeholder"
20
- :value="data.fields[index].value"
21
- :readonly="item.readonly"
22
- :disabled="item.disabled"
23
- @change="check(index)"
24
- @blur="check(index)"
25
- @input="oninput(index)"
26
- />
27
- <span
28
- v-if="data.fields[index].error&&data.fields[index].error.msg&&data.fields[index].error.flag"
29
- style="color: red">{{data.fields[index].error.msg}}</span>
30
- </div>
31
- </div>
32
- <!--时间datepicker-->
33
- <div :style="item.style ? item.style+';height: 40px;margin-bottom: 20px':'height: 40px;margin-bottom: 20px'"
34
- v-if="item.type==='datepicker'"
35
- v-show="!item.hidden"
36
- :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']">
37
- <label
38
- :class="item.label_bootstraped ? item.label_bootstraped+' control-label-justify control-label' : 'control-label control-label-justify col-sm-6'">{{item.label}}</label>
39
- <div :class="item.value_bootstraped?item.value_bootstraped:'col-sm-6'">
40
- <datepicker
41
- @change="check(index)"
42
- @blur="check(index)"
43
- :placeholder="item.placeholder"
44
- :value.sync="data.fields[index].value"
45
- :format="'yyyy-MM-dd'"
46
- v-model="data.fields[index].value"
47
- :readonly="item.readonly"
48
- :disabled="item.disabled"
49
- :show-reset-button="reset">
50
- </datepicker>
51
- </div>
52
- <span
53
- v-if="showadd_fields.fields[index].error&&showadd_fields.fields[index].error.msg&&showadd_fields.fields[index].error.flag"
54
- style="color: red">{{showadd_fields.fields[index].error.msg}}</span>
55
- </div>
56
-
57
- <!--textarea-->
58
- <div :style="item.style ? item.style+';height: 40px;margin-bottom: 20px':'height: 40px;margin-bottom: 20px'"
59
- v-if="item.type==='textarea'" v-show="!item.hidden"
60
- :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']">
61
- <label :style="item.label_style ? item.label_style : ''"
62
- :class="item.label_bootstraped ? item.label_bootstraped + ' control-label-justify control-label' : 'control-label-justify control-label col-sm-3'">{{item.label}}</label>
63
- <div :style="item.value_style ? item.value_style:''"
64
- :class="item.value_bootstraped ? item.value_bootstraped : 'col-sm-10'">
65
- <textarea
66
- :readonly="item.readonly"
67
- :disabled="item.disabled"
68
- class="form-control input_view"
69
- style="width: 100%"
70
- :rows="item.rows"
71
- v-model="data.fields[index].value"
72
- :value="data.fields[index].value"
73
- @change="check(index)"
74
- @blur="check(index)"
75
- @input="oninput(index)"
76
- >
77
- </textarea>
78
- </div>
79
- </div>
80
-
81
- <!--radio-->
82
- <div :style="item.style ? item.style+';height: 40px;margin-bottom: 20px':'height: 40px;margin-bottom: 20px'"
83
- v-if="item.type==='radio'"
84
- :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']">
85
- <label v-if="item.label"
86
- :class="item.label_bootstraped?item.label_bootstraped+' control-label-justify control-label':'control-label-justify control-label col-sm-2'">{{item.label}}</label>
87
- <div
88
- :class="item.value_bootstraped?item.value_bootstraped:item.items.length%2 == 0?'col-sm-5': 'col-sm-3'"
89
- v-for="(index2,row) in item.items">
90
- <label for="row.label"
91
- :class="item.items.length%2 == 0?'col-sm-3 control-label': 'col-sm-2 control-label'">{{row.label}}</label>
92
- <input @blur="check(index)"
93
- :class="item.items.length%2 == 0?'col-sm-3 control-label': 'col-sm-2 control-label'"
94
- :readonly="item.readonly" :disabled="item.disabled" style="margin-top: 10px" type="radio"
95
- :name="index" :id="row.label" v-bind:value="data.fields[index].items[index2].value"
96
- v-model="data.fields[index].value">
97
- </div>
98
- </div>
99
-
100
- <!--select-->
101
- <div :style="item.style ? item.style+';height: 40px;margin-bottom: 20px':'height: 40px;margin-bottom: 20px'"
102
- 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
- <v-select
107
- :class="item.value_bootstraped ? item.value_bootstraped + ' select select_list' : 'col-sm-6 select select_list'"
108
- @blur="blur(index)"
109
- @change="check(index)"
110
- :readonly="item.readonly" :disable="item.disabled" :value.sync="data.fields[index].value"
111
- v-model="data.fields[index].value"
112
- :options='data.fields[index].options'
113
- search="true"
114
- width="50%"
115
- value-single="value-single"
116
- :valueSingle="true" ></v-select>
117
- <!-- <input-select-->
118
- <!-- :class="item.value_bootstraped ? item.value_bootstraped + ' select select_list' : 'col-sm-6 select select_list'"-->
119
- <!-- @blur="blur(index)"-->
120
- <!-- @change="check(index)"-->
121
- <!-- :readonly="item.readonly" :disable="item.disabled" :value.sync="data.fields[index].value"-->
122
- <!-- v-model="data.fields[index].value"-->
123
- <!-- :options='data.fields[index].options'-->
124
- <!-- :valueSingle="true"></input-select>-->
125
-
126
- </div>
127
-
128
- <!--checkbox-->
129
- <div :style="item.style ? item.style+';height: 40px;margin-bottom: 20px':'height: 40px;margin-bottom: 20px'"
130
- v-if="item.type==='checkbox'"
131
- :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']">
132
- <label v-if="item.label"
133
- :class="item.label_bootstraped?item.label_bootstraped+' control-label ':'control-label col-sm-2'">{{item.label}}</label>
134
- <div style="margin-top: 6px"
135
- :class="item.value_bootstraped?item.value_bootstraped:'control-label col-sm-2'"
136
- v-for="(index2,row) in item.items">
137
- <label class="font-size form-group col-sm-6">{{row.label}}</label>
138
- <input :readonly="item.readonly" :disabled="item.disabled" type="checkbox" class="col-sm-6"
139
- :id="row.label" v-model="data.fields[index].items[index2].value">
140
- </div>
141
- </div>
142
- </div>
143
- </div>
144
- <!-- onetomany -->
145
- <div class="" v-for="(i,item) in data.onetomany">
146
- <!-- <div v-show="!item.hidden && item.title && !item.titleHidden" style="text-align: center;background-color: #00A3F0;padding-top: 10px">-->
147
- <!-- <label style="margin: 0px;padding: 0px">-->
148
- <!-- {{item.title}}-->
149
- <!-- </label>-->
150
-
151
- <!-- </div>-->
152
- <table v-show="!item.hidden" class="table table-bordered table-striped table-hover">
153
- <tr>
154
- <th>序号</th>
155
- <th v-for="field in item.fields">
156
- <nobr>{{field.label}}</nobr>
157
- </th>
158
- <th>
159
- <button type="button" @click="add(i)" class="btn btn-info"
160
- v-if="!item.nopower && showprint && !item.addHidden">
161
- <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
162
- </button>
163
- </th>
164
- </tr>
165
- <tr v-for="(j,row) in item.rows">
166
- <td style="text-align: center">{{$index+1}}</td>
167
- <td v-for="key in item.fields" style="text-align: center">
168
- {{row[key.field]}}
169
- </td>
170
- <td style="text-align: center">
171
- <span @click="update(i,j)" v-if="!item.nopower && showprint && !item.updateHidden" class="glyphicon glyphicon-wrench" aria-hidden="true"></span>
172
- <span @click="delete(i,j)" v-if="!item.nopower && showprint && !item.deleteHidden" style="margin-left: 10px" class="glyphicon glyphicon-trash" aria-hidden="true"></span>
173
- <!-- <a href="#" @click="update(i,j)" v-if="!item.nopower && showprint && !item.updateHidden">修改</a>-->
174
- <!-- <a href="#" @click="delete(i,j)" v-if="!item.nopower && showprint && !item.deleteHidden">删除</a>-->
175
- </td>
176
- </tr>
177
- </table>
178
- </div>
179
-
180
- <slot></slot>
181
- <apply-charge-management v-ref:apply_charge :data="data" v-if="data.defname == '报建缴费' || data.defname == '收费审核' || data.defname == '确认尾款'"></apply-charge-management>
182
- <!--公司等属性-->
183
- <div class="col-sm-12 form-group text-center" style="padding-top:8px">
184
- <div class="col-sm-3 form-group center-block">
185
- <label class="col-sm-5">所属公司:</label>
186
- <div class="col-sm-6" style="text-align: left">
187
- {{model.f_filiale}}
188
- </div>
189
- </div>
190
- <div class="col-sm-3 form-group center-block">
191
- <label class="col-sm-5">部门:</label>
192
- <div class="col-sm-6" style="text-align: left">
193
- {{model.f_parentname}}
194
- </div>
195
- </div>
196
- <div class="col-sm-3 form-group center-block">
197
- <label class="col-sm-5">操作人:</label>
198
- <div class="col-sm-6 " style="text-align: left">
199
- {{model.f_operator}}
200
- </div>
201
- </div>
202
- <div class="col-sm-3 form-group center-block">
203
- <label class="col-sm-5">操作日期:</label>
204
- <div class="col-sm-6" style="text-align: left">
205
- {{model.f_operate_date}}
206
- </div>
207
- </div>
208
- </div>
209
-
210
- </form>
211
- </validator>
212
- <!-- 按钮组 -->
213
- <div class="from-group col-sm-12" style="margin-top: 20px;height: 100px">
214
- <center>
215
- <!-- 按钮组 -->
216
- <button v-for="(index,button) in data.buttons"
217
- :disabled="(button.button_name==='提交'||button.button_name==='下发')&&disable_button" type="button"
218
- @click="clicked(index,button)"
219
- :class="(button.button_name==='提交'||button.button_name==='下发')&&disable_button?'btn btn-default':'btn btn-primary'"
220
- style="min-width:100px; margin-right:50px;">
221
- {{button.button_name}}
222
- </button>
223
- </center>
224
- </div>
225
-
226
- <!-- onetomany模态框 -->
227
- <modal v-if="show" :show.sync="show" backdrop="false" :large="modalSize === 'large' ? true : false" :small="modalSize === 'small' ? true : false">
228
- <header slot="modal-header" class="modal-header">
229
- <button type="button" class="close" @click="closemodal(modeltitle)"><span>&times;</span></button>
230
- <span class="modal-title"><font
231
- size="3">{{modeltitle}}</font></span>
232
- </header>
233
- <article slot="modal-body" class="modal-body clearfix">
234
- <div
235
- :class="[item.required&&!(item.value) ? 'has-error' : '',item.bootstraped?item.bootstraped:'col-sm-12']"
236
- v-for="(index,item) in data.onetomany[onetomany_index].fields">
237
- <label v-show="!item.hidden" :class="item.label_bootstraped ? item.label_bootstraped + ' control-label' : 'control-label col-sm-3'" style="margin-top: 10px">{{item.label}}:</label>
238
- <div :class="item.value_bootstraped ? item.value_bootstraped : 'col-sm-7'" v-show="!item.hidden">
239
- <!--时间datepicker-->
240
- <datepicker
241
- v-if="item.type=='datepicker'"
242
- @change="check_modal(index)"
243
- @blur="check_modal(index)"
244
- :placeholder="item.placeholder"
245
- :value.sync="data.onetomany[onetomany_index].fields[index].value"
246
- :format="'yyyy-MM-dd'"
247
- v-model="data.onetomany[onetomany_index].fields[index].value"
248
- :readonly="item.readonly"
249
- :disabled="item.disabled"
250
- :show-reset-button="reset">
251
- </datepicker>
252
- <!--select-->
253
- <input-select
254
- @change="check_modal(index)"
255
- v-if="item.type=='select'"
256
- @blur="check_modal(index)"
257
- :value.sync="data.onetomany[onetomany_index].fields[index].value"
258
- v-model="data.onetomany[onetomany_index].fields[index].value"
259
- :options='data.onetomany[onetomany_index].fields[index].options'>
260
- </input-select>
261
- <!-- input -->
262
- <input v-if="item.type==='input' || item.type==='number'||item.type === 'tel'||item.type === 'email'"
263
- class="form-control"
264
- :type="item.type"
265
- v-model="data.onetomany[onetomany_index].fields[index].value"
266
- :placeholder="item.placeholder"
267
- :value="data.onetomany[onetomany_index].fields[index].value"
268
- :readonly="item.readonly"
269
- :disabled="item.disabled"
270
- @change="check_modal(index)"
271
- @blur="check_modal(index)"
272
- @input="oninput_modal(index)"
273
- />
274
- </div>
275
- </div>
276
- </article>
277
- <footer slot="modal-footer" class="modal-footer">
278
- <button :class="disable_button_onetomany?'btn btn-default':'btn btn-primary'"
279
- :disabled="disable_button_onetomany" type="button" @click="confirm_modal(modeltitle)">
280
- 确认
281
- </button>
282
- </footer>
283
- </modal>
284
-
285
- <!-- 按钮模态框 -->
286
- <modal v-if="showbutmodal" :show.sync="showbutmodal" v-ref:modal backdrop="false">
287
- <header slot="modal-header" class="modal-header">
288
- <button type="button" class="close" @click="closemodal('but')"><span>&times;</span></button>
289
- <h4 class="modal-title">{{model.button.button_name}}</h4>
290
- </header>
291
- <article slot="modal-body" class="modal-body">
292
- <div class="col-sm-12" v-for="(index,button) in data.buttons[model.button.button_index].button_fields">
293
- <label class="control-label col-sm-3" style="margin-top: 10px">{{button.label}}:</label>
294
- <div class="col-sm-7">
295
- <!--select-->
296
- <input-select v-if="button.type=='select'"
297
- :value.sync="data.buttons[model.button.button_index].button_fields[index].value"
298
- v-model="data.buttons[model.button.button_index].button_fields[index].value"
299
- :options='button.options'></input-select>
300
- <!-- input -->
301
- <input v-else type="text" class="form-control"
302
- v-model="data.buttons[model.button.button_index].button_fields[index].value"/>
303
- </div>
304
- </div>
305
- </article>
306
- <footer slot="modal-footer" style="border-top:none" class="modal-footer">
307
- <button type="button" class="btn btn-primary" :disabled="disable_button_but" @click='confirm_but_modal()'>确认</button>
308
- </footer>
309
- </modal>
310
- </div>
311
- </template>
312
- <script>
313
- import Vue from 'vue'
314
- // Date格式化
315
- Date.prototype.Format = function (fmt) {
316
- var o = {
317
- 'M+': this.getMonth() + 1, // 月份
318
- 'd+': this.getDate(), // 日
319
- 'H+': this.getHours(), // 小时
320
- 'm+': this.getMinutes(), // 分
321
- 's+': this.getSeconds(), // 秒
322
- 'q+': Math.floor((this.getMonth() + 3) / 3), // 季度
323
- 'S': this.getMilliseconds() // 毫秒
324
- }
325
- if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + '').substr(4 - RegExp.$1.length))
326
- for (var k in o) {
327
- if (new RegExp('(' + k + ')').test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length)))
328
- }
329
- return fmt
330
- }
331
-
332
- export default {
333
- title: '报建业务通用组件',
334
- props: {
335
- data: {
336
- type: Object
337
- },
338
- showprint: {
339
- type: Boolean,
340
- default: true
341
- }
342
- },
343
- data () {
344
- return {
345
- model: {}, // 公司等属性
346
- disable_button: true, // 控制按钮禁用
347
- show: false, // 控制onetomany模态框
348
- disable_button_onetomany: true, // 控制onetomany模态框按钮
349
- onetomany_index: null, // 当前选择的下标
350
- update_onetomany_index: null, // 当前需要修改的下标
351
- modeltitle: null, // 模态框标题
352
- modalSize: null, // 模态框大小
353
- showbutmodal: false,
354
- }
355
- },
356
- watch: {
357
- deep: true
358
- },
359
- computed: {
360
-
361
- },
362
- created () {
363
- // 初始化数据
364
- this.initializtion()
365
- },
366
- methods: {
367
- // 按钮模态框确定
368
- confirm_but_modal() {
369
- this.data.buttons[this.model.button.button_index].button_fields.forEach(item => {
370
- this.model.button.button_fields[item.field] = item.value
371
- })
372
- this.showbutmodal = false
373
- this.disable_button_but = true
374
- this.$dispatch('button', this.model)
375
- },
376
- // 点击按钮组按钮
377
- async clicked(index, button) {
378
- this.disable_button = true
379
- // 组织model.fields数据
380
- this.data.fields.forEach(item => {
381
- // checkbox特殊处理
382
- if (item.type === 'checkbox') {
383
- for (let j = 0; j < item.items.length; j++) {
384
- this.model[item.items[j].field] = item.items[j].value
385
- }
386
- } else {
387
- this.model[item.field] = item.value
388
- }
389
- })
390
- this.model.f_process_id = this.data.f_process_id
391
-
392
- // 初始化model.button数据
393
- let buttondatas = {
394
- button_fields: {}
395
- }
396
- buttondatas.button_name = button.button_name
397
- buttondatas.button_index = index
398
- if (button.button_fields) {
399
- button.button_fields.forEach(item => {
400
- buttondatas.button_fields[item.field] = item.value
401
- })
402
- }
403
- this.model.button = buttondatas
404
-
405
- if (button.button_name === '退回') {
406
- this.showbutmodal = true
407
- } else if (button.button_name === '下发') {
408
- this.showbutmodal = true
409
- } else {
410
- this.$dispatch('button', this.model)
411
- }
412
- },
413
-
414
- // 初始化数据
415
- initializtion () {
416
- // 是否禁用按钮
417
- this.disableButton()
418
-
419
- // datepicker 没有值给当时值
420
- this.data.fields.forEach(item => {
421
- if (item.type === 'datepicker' && !item.value) {
422
- item.value = new Date().Format('yyyy-MM-dd')
423
- }
424
- })
425
-
426
- // 公司等属性初始化
427
- if (this.data.filiale) {
428
- this.model.f_filiale = this.data.filiale
429
- } else {
430
- this.model.f_filiale = this.$login.f.orgs
431
- }
432
- if (this.data.f_parentname) {
433
- this.model.f_parentname = this.data.f_parentname
434
- } else {
435
- this.model.f_parentname = this.$login.f.f_department_name
436
- }
437
- if (this.data.operate_date) {
438
- this.model.f_operate_date = this.data.operate_date
439
- } else {
440
- this.model.f_operate_date = new Date().Format('yyyy-MM-dd')
441
- }
442
- if (this.data.operator) {
443
- this.model.f_operator = this.data.operator
444
- } else {
445
- this.model.f_operator = this.$login.f.name
446
- }
447
- },
448
- // 是否禁用按钮
449
- disableButton () {
450
- let fields = this.data.fields
451
-
452
- let flag = false
453
- fields.forEach(item => {
454
- if (item.type !== 'checkbox' && item.required && !item.value) {
455
- flag = true
456
- }
457
- // 任何选择框只要是否都不能提交
458
- if (item.type === 'select' && item.value === '否') {
459
- flag = true
460
- }
461
- })
462
-
463
- let count = 0
464
- fields.forEach(item => {
465
- if (item.type !== 'checkbox' && !item.required) {
466
- count++
467
- }
468
- })
469
- if (count === 0) {
470
- flag = false
471
- }
472
-
473
- this.disable_button = flag
474
- },
475
- // 监听失去焦点
476
- check (index) {
477
- // 是否禁用按钮
478
- this.disableButton()
479
-
480
- this.$dispatch('check', index)
481
- // 如果有错误信息提示走错误信息判断处理
482
-
483
- if (this.data.fields[index].error || this.data.fields[index].type === 'datepicker') {
484
- this.$dispatch('error_check', index)
485
- }
486
- },
487
- oninput (index) {
488
- // 是否禁用按钮
489
- this.disableButton()
490
-
491
- this.$dispatch('oninput', index)
492
-
493
- // 如果有错误信息提示走错误信息判断处理
494
- if (this.data.fields[index].error || this.data.fields[index].type === 'datepicker') {
495
- this.$dispatch('error_check', index)
496
- }
497
- },
498
-
499
- // 模态框确认按钮
500
- confirm_modal (title) {
501
- console.log("来了没有1")
502
- if (title === '新增') {
503
- console.log("来了没有2")
504
- if (this.data.onetomany[this.onetomany_index].addEvent === 'default' || !this.data.onetomany[this.onetomany_index].addEvent) {
505
- console.log("来了没有3:" + this.onetomany_index)
506
- this.$dispatch('onetomanyadd', this.onetomany_index)
507
- } else {
508
- console.log("来了没有4")
509
- this.$dispatch(this.data.onetomany[this.onetomany_index].addEvent, this.onetomany_index)
510
- }
511
- } else {
512
- if (this.data.onetomany[this.onetomany_index].updateEvent === 'default' || !this.data.onetomany[this.onetomany_index].updateEvent) {
513
- this.$dispatch('onetomanyupdate', this.onetomany_index, this.update_onetomany_index)
514
- } else {
515
- this.$dispatch(this.data.onetomany[this.onetomany_index].updateEvent, this.onetomany_index, this.update_onetomany_index)
516
- }
517
- }
518
-
519
- this.closemodal()
520
- },
521
- // 删除
522
- delete (i, j) {
523
- this.$showMessage('您确定要删除这条记录吗?', ['confirm']).then((res) => {
524
- if (res === 'confirm') {
525
- console.log("删除记录1")
526
- console.log("删除记录1 + :" + this.data.onetomany[i].deleteEvent)
527
-
528
- if (this.data.onetomany[i].deleteEvent === 'default' || !this.data.onetomany[i].deleteEvent) {
529
- this.$dispatch('onetomanydelete', i, j)
530
- } else {
531
- this.$dispatch(this.data.onetomany[i].deleteEvent, i, j)
532
- }
533
- }
534
- })
535
- },
536
- // 修改
537
- update (i, j) {
538
- let onetomany = this.data.onetomany[i]
539
- let item = this.data.onetomany[i].rows[j]
540
- let count = 0
541
- for (let k = 0; k < onetomany.fields.length; k++) {
542
- // 防止初始化的时候没有value
543
- Vue.set(this.data.onetomany[i].fields[k], 'value', item[this.data.onetomany[i].fields[k].field])
544
-
545
- if (onetomany.fields[j].required) {
546
- count++
547
- }
548
- }
549
- if (count === 0) {
550
- this.disable_button_onetomany = false
551
- }
552
- this.modeltitle = '修改'
553
- this.modalSize = this.data.onetomany[i].modalSize
554
- this.onetomany_index = i
555
- this.update_onetomany_index = j
556
- this.show = true
557
- },
558
- // 添加
559
- add (index) {
560
- console.log("index是否有值:" + index)
561
- let count = 0
562
- this.data.onetomany[index].fields.forEach(item => {
563
- if (item.type === 'datepicker') {
564
- item.value = new Date().Format('yyyy-MM-dd')
565
- }
566
- if (item.required) {
567
- count++
568
- }
569
- })
570
-
571
- if (count === 0) {
572
- this.disable_button_onetomany = false
573
- }
574
- this.modeltitle = '新增'
575
- this.modalSize = this.data.onetomany[index].modalSize
576
- this.onetomany_index = index
577
- this.show = true
578
- },
579
- // 关闭模态框
580
- closemodal (val) {
581
- if (val === 'but'){
582
- this.disableButton()
583
- this.showbutmodal = false
584
- return
585
- }
586
- this.data.onetomany[this.onetomany_index].fields.forEach(item => {
587
- item.value = ''
588
- })
589
- this.show = false
590
- this.disable_button_onetomany = true
591
- this.onetomany_index = null
592
- this.update_onetomany_index = null
593
- this.modeltitle = null
594
- this.modalSize = null
595
- },
596
-
597
- // 是否禁用模态框按钮
598
- disableModalButton () {
599
- let fields = this.data.onetomany[this.onetomany_index].fields
600
-
601
- let flag = false
602
- fields.forEach(item => {
603
- if (item.type !== 'checkbox' && item.required && !item.value) {
604
- flag = true
605
- }
606
- })
607
-
608
- let count = 0
609
- fields.forEach(item => {
610
- if (item.type !== 'checkbox' && !item.required) {
611
- count++
612
- }
613
- })
614
-
615
- if (count === 0) {
616
- flag = false
617
- }
618
- this.disable_button_onetomany = flag
619
- },
620
- // 监听模态框属性失去焦点
621
- check_modal (index) {
622
- this.disableModalButton()
623
- this.$dispatch('check_modal', index)
624
- },
625
- // input输入属性值发生变化监听
626
- oninput_modal (index) {
627
- console.log('@input="oninput_modal(index)"')
628
- this.disableModalButton()
629
- this.$dispatch('oninput_modal', index)
630
- }
631
-
632
- },
633
- events: {
634
-
635
- }
636
- }
637
- </script>
638
- <style>
639
- .datepicker{
640
- width: 100%!important;
641
- }
642
- .datepicker-input{
643
- background-color: #ffffff!important;
644
- width: 100%!important;
645
- }
646
- .datepicker-input:disabled{
647
- border: 1px solid #DDD!important;
648
- color: #ACA899!important;
649
- width: 100%!important;
650
- }
651
- </style>
652
- <style scoped>
653
- th{
654
- font-size: 15px !important;
655
- text-align: center !important;
656
- background-color: #dfedfb!important;
657
- color: #666666 !important;
658
- font-family: PINGFANG-BOLD !important;
659
- font-weight: normal!important;
660
- }
661
- /*清除model中的浮动*/
662
- .clearfix:after,.clearfix:before{
663
- display: table;
664
- }
665
- .clearfix:after{
666
- clear: both;
667
- }
668
-
669
- .input_view{
670
- padding: 8px;
671
- background-color: #ffffff;
672
- border-radius: 2px;
673
- border: solid 1px #c7c7c7!important;
674
- color: #333333!important;
675
- font-size: 15px!important;
676
- }
677
-
678
- .input_view[readonly]{
679
- border: 1px solid #DDD!important;
680
- /*background-color: #F5F5F5;*/
681
- color:#ACA899!important;
682
- }
683
- .input_view:disabled{
684
- border: 1px solid #DDD!important;
685
- /*background-color: #F5F5F5;*/
686
- color:#ACA899!important;
687
- }
688
-
689
- .control-label-justify {
690
- display: inline-block;
691
- vertical-align: top;
692
- width: 110px;
693
- text-align: justify;
694
- font-family: PingFang-SC-Bold;
695
- }
696
-
697
- .control-label-justify::after {
698
- content: "";
699
- display: inline-block;
700
- width: 70px;
701
- overflow: hidden;
702
- height: 0;
703
- }
704
-
705
- input::-webkit-outer-spin-button,
706
- input::-webkit-inner-spin-button {
707
- -webkit-appearance: none;
708
- }
709
-
710
- input[type="number"] {
711
- -moz-appearance: textfield;
712
- }
713
-
714
- </style>
1
+ <template>
2
+ <div class="select-overspread" style="background-color: #ffffff;margin: 20px">
3
+ <validator name="v">
4
+ <form class="form-horizontal">
5
+ <div class="form-group">
6
+ <div v-for="(index,item) in data.fields" style="">
7
+ <!--input-->
8
+ <div :style="item.style ? item.style+';height: 40px;margin-bottom: 20px':'height: 40px;margin-bottom: 20px'"
9
+ v-if="item.type==='input' || item.type==='number'||item.type === 'tel'||item.type === 'email'"
10
+ v-show="!item.hidden"
11
+ :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']">
12
+ <label :style="item.label_style ? item.label_style : ''"
13
+ :class="item.label_bootstraped ? item.label_bootstraped+' control-label-justify control-label' : 'control-label-justify control-label col-sm-6'">{{item.label}}</label>
14
+ <div :style="item.value_style? item.value_style:''"
15
+ :class="item.value_bootstraped?item.value_bootstraped:item.value_style?'':'col-sm-6'">
16
+ <input class="form-control input_view" style=""
17
+ :type="item.type"
18
+ v-model="data.fields[index].value"
19
+ :placeholder="item.placeholder"
20
+ :value="data.fields[index].value"
21
+ :readonly="item.readonly"
22
+ :disabled="item.disabled"
23
+ @change="check(index)"
24
+ @blur="check(index)"
25
+ @input="oninput(index)"
26
+ />
27
+ <span
28
+ v-if="data.fields[index].error&&data.fields[index].error.msg&&data.fields[index].error.flag"
29
+ style="color: red">{{data.fields[index].error.msg}}</span>
30
+ </div>
31
+ </div>
32
+ <!--时间datepicker-->
33
+ <div :style="item.style ? item.style+';height: 40px;margin-bottom: 20px':'height: 40px;margin-bottom: 20px'"
34
+ v-if="item.type==='datepicker'"
35
+ v-show="!item.hidden"
36
+ :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']">
37
+ <label
38
+ :class="item.label_bootstraped ? item.label_bootstraped+' control-label-justify control-label' : 'control-label control-label-justify col-sm-6'">{{item.label}}</label>
39
+ <div :class="item.value_bootstraped?item.value_bootstraped:'col-sm-6'">
40
+ <datepicker
41
+ @change="check(index)"
42
+ @blur="check(index)"
43
+ :placeholder="item.placeholder"
44
+ :value.sync="data.fields[index].value"
45
+ :format="'yyyy-MM-dd'"
46
+ v-model="data.fields[index].value"
47
+ :readonly="item.readonly"
48
+ :disabled="item.disabled"
49
+ :show-reset-button="reset">
50
+ </datepicker>
51
+ </div>
52
+ <span
53
+ v-if="showadd_fields.fields[index].error&&showadd_fields.fields[index].error.msg&&showadd_fields.fields[index].error.flag"
54
+ style="color: red">{{showadd_fields.fields[index].error.msg}}</span>
55
+ </div>
56
+
57
+ <!--textarea-->
58
+ <div :style="item.style ? item.style+';height: 40px;margin-bottom: 20px':'height: 40px;margin-bottom: 20px'"
59
+ v-if="item.type==='textarea'" v-show="!item.hidden"
60
+ :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']">
61
+ <label :style="item.label_style ? item.label_style : ''"
62
+ :class="item.label_bootstraped ? item.label_bootstraped + ' control-label-justify control-label' : 'control-label-justify control-label col-sm-3'">{{item.label}}</label>
63
+ <div :style="item.value_style ? item.value_style:''"
64
+ :class="item.value_bootstraped ? item.value_bootstraped : 'col-sm-10'">
65
+ <textarea
66
+ :readonly="item.readonly"
67
+ :disabled="item.disabled"
68
+ class="form-control input_view"
69
+ style="width: 100%"
70
+ :rows="item.rows"
71
+ v-model="data.fields[index].value"
72
+ :value="data.fields[index].value"
73
+ @change="check(index)"
74
+ @blur="check(index)"
75
+ @input="oninput(index)"
76
+ >
77
+ </textarea>
78
+ </div>
79
+ </div>
80
+
81
+ <!--radio-->
82
+ <div :style="item.style ? item.style+';height: 40px;margin-bottom: 20px':'height: 40px;margin-bottom: 20px'"
83
+ v-if="item.type==='radio'"
84
+ :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']">
85
+ <label v-if="item.label"
86
+ :class="item.label_bootstraped?item.label_bootstraped+' control-label-justify control-label':'control-label-justify control-label col-sm-2'">{{item.label}}</label>
87
+ <div
88
+ :class="item.value_bootstraped?item.value_bootstraped:item.items.length%2 == 0?'col-sm-5': 'col-sm-3'"
89
+ v-for="(index2,row) in item.items">
90
+ <label for="row.label"
91
+ :class="item.items.length%2 == 0?'col-sm-3 control-label': 'col-sm-2 control-label'">{{row.label}}</label>
92
+ <input @blur="check(index)"
93
+ :class="item.items.length%2 == 0?'col-sm-3 control-label': 'col-sm-2 control-label'"
94
+ :readonly="item.readonly" :disabled="item.disabled" style="margin-top: 10px" type="radio"
95
+ :name="index" :id="row.label" v-bind:value="data.fields[index].items[index2].value"
96
+ v-model="data.fields[index].value">
97
+ </div>
98
+ </div>
99
+
100
+ <!--select-->
101
+ <div :style="item.style ? item.style+';height: 40px;margin-bottom: 20px':'height: 40px;margin-bottom: 20px'"
102
+ 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
+ <v-select
107
+ :class="item.value_bootstraped ? item.value_bootstraped + ' select select_list' : 'col-sm-6 select select_list'"
108
+ @blur="blur(index)"
109
+ @change="check(index)"
110
+ :readonly="item.readonly" :disable="item.disabled" :value.sync="data.fields[index].value"
111
+ v-model="data.fields[index].value"
112
+ :options='data.fields[index].options'
113
+ search="true"
114
+ width="50%"
115
+ value-single="value-single"
116
+ :valueSingle="true" ></v-select>
117
+ <!-- <input-select-->
118
+ <!-- :class="item.value_bootstraped ? item.value_bootstraped + ' select select_list' : 'col-sm-6 select select_list'"-->
119
+ <!-- @blur="blur(index)"-->
120
+ <!-- @change="check(index)"-->
121
+ <!-- :readonly="item.readonly" :disable="item.disabled" :value.sync="data.fields[index].value"-->
122
+ <!-- v-model="data.fields[index].value"-->
123
+ <!-- :options='data.fields[index].options'-->
124
+ <!-- :valueSingle="true"></input-select>-->
125
+
126
+ </div>
127
+
128
+ <!--checkbox-->
129
+ <div :style="item.style ? item.style+';height: 40px;margin-bottom: 20px':'height: 40px;margin-bottom: 20px'"
130
+ v-if="item.type==='checkbox'"
131
+ :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']">
132
+ <label v-if="item.label"
133
+ :class="item.label_bootstraped?item.label_bootstraped+' control-label ':'control-label col-sm-2'">{{item.label}}</label>
134
+ <div style="margin-top: 6px"
135
+ :class="item.value_bootstraped?item.value_bootstraped:'control-label col-sm-2'"
136
+ v-for="(index2,row) in item.items">
137
+ <label class="font-size form-group col-sm-6">{{row.label}}</label>
138
+ <input :readonly="item.readonly" :disabled="item.disabled" type="checkbox" class="col-sm-6"
139
+ :id="row.label" v-model="data.fields[index].items[index2].value">
140
+ </div>
141
+ </div>
142
+ </div>
143
+ </div>
144
+ <!-- onetomany -->
145
+ <div class="" v-for="(i,item) in data.onetomany">
146
+ <!-- <div v-show="!item.hidden && item.title && !item.titleHidden" style="text-align: center;background-color: #00A3F0;padding-top: 10px">-->
147
+ <!-- <label style="margin: 0px;padding: 0px">-->
148
+ <!-- {{item.title}}-->
149
+ <!-- </label>-->
150
+
151
+ <!-- </div>-->
152
+ <table v-show="!item.hidden" class="table table-bordered table-striped table-hover">
153
+ <tr>
154
+ <th>序号</th>
155
+ <th v-for="field in item.fields">
156
+ <nobr>{{field.label}}</nobr>
157
+ </th>
158
+ <th>
159
+ <button type="button" @click="add(i)" class="btn btn-info"
160
+ v-if="!item.nopower && showprint && !item.addHidden">
161
+ <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
162
+ </button>
163
+ </th>
164
+ </tr>
165
+ <tr v-for="(j,row) in item.rows">
166
+ <td style="text-align: center">{{$index+1}}</td>
167
+ <td v-for="key in item.fields" style="text-align: center">
168
+ {{row[key.field]}}
169
+ </td>
170
+ <td style="text-align: center">
171
+ <span @click="update(i,j)" v-if="!item.nopower && showprint && !item.updateHidden" class="glyphicon glyphicon-wrench" aria-hidden="true"></span>
172
+ <span @click="delete(i,j)" v-if="!item.nopower && showprint && !item.deleteHidden" style="margin-left: 10px" class="glyphicon glyphicon-trash" aria-hidden="true"></span>
173
+ <!-- <a href="#" @click="update(i,j)" v-if="!item.nopower && showprint && !item.updateHidden">修改</a>-->
174
+ <!-- <a href="#" @click="delete(i,j)" v-if="!item.nopower && showprint && !item.deleteHidden">删除</a>-->
175
+ </td>
176
+ </tr>
177
+ </table>
178
+ </div>
179
+
180
+ <slot></slot>
181
+ <apply-charge-management v-ref:apply_charge :mark="mark" :data="data" v-if="data.defname == '报建缴费' || data.defname == '收费审核' || data.defname == '确认尾款'"></apply-charge-management>
182
+ <!--公司等属性-->
183
+ <div class="col-sm-12 form-group text-center" style="padding-top:8px">
184
+ <div class="col-sm-3 form-group center-block">
185
+ <label class="col-sm-5">所属公司:</label>
186
+ <div class="col-sm-6" style="text-align: left">
187
+ {{model.f_filiale}}
188
+ </div>
189
+ </div>
190
+ <div class="col-sm-3 form-group center-block">
191
+ <label class="col-sm-5">部门:</label>
192
+ <div class="col-sm-6" style="text-align: left">
193
+ {{model.f_parentname}}
194
+ </div>
195
+ </div>
196
+ <div class="col-sm-3 form-group center-block">
197
+ <label class="col-sm-5">操作人:</label>
198
+ <div class="col-sm-6 " style="text-align: left">
199
+ {{model.f_operator}}
200
+ </div>
201
+ </div>
202
+ <div class="col-sm-3 form-group center-block">
203
+ <label class="col-sm-5">操作日期:</label>
204
+ <div class="col-sm-6" style="text-align: left">
205
+ {{model.f_operate_date}}
206
+ </div>
207
+ </div>
208
+ </div>
209
+
210
+ </form>
211
+ </validator>
212
+ <!-- 按钮组 -->
213
+ <div class="from-group col-sm-12" style="margin-top: 20px;height: 100px">
214
+ <center>
215
+ <!-- 按钮组 -->
216
+ <button v-for="(index,button) in data.buttons"
217
+ :disabled="(button.button_name==='提交'||button.button_name==='下发')&&disable_button" type="button"
218
+ @click="clicked(index,button)"
219
+ :class="(button.button_name==='提交'||button.button_name==='下发')&&disable_button?'btn btn-default':'btn btn-primary'"
220
+ style="min-width:100px; margin-right:50px;">
221
+ {{button.button_name}}
222
+ </button>
223
+ </center>
224
+ </div>
225
+
226
+ <!-- onetomany模态框 -->
227
+ <modal v-if="show" :show.sync="show" backdrop="false" :large="modalSize === 'large' ? true : false" :small="modalSize === 'small' ? true : false">
228
+ <header slot="modal-header" class="modal-header">
229
+ <button type="button" class="close" @click="closemodal(modeltitle)"><span>&times;</span></button>
230
+ <span class="modal-title"><font
231
+ size="3">{{modeltitle}}</font></span>
232
+ </header>
233
+ <article slot="modal-body" class="modal-body clearfix">
234
+ <div
235
+ :class="[item.required&&!(item.value) ? 'has-error' : '',item.bootstraped?item.bootstraped:'col-sm-12']"
236
+ v-for="(index,item) in data.onetomany[onetomany_index].fields">
237
+ <label v-show="!item.hidden" :class="item.label_bootstraped ? item.label_bootstraped + ' control-label' : 'control-label col-sm-3'" style="margin-top: 10px">{{item.label}}:</label>
238
+ <div :class="item.value_bootstraped ? item.value_bootstraped : 'col-sm-7'" v-show="!item.hidden">
239
+ <!--时间datepicker-->
240
+ <datepicker
241
+ v-if="item.type=='datepicker'"
242
+ @change="check_modal(index)"
243
+ @blur="check_modal(index)"
244
+ :placeholder="item.placeholder"
245
+ :value.sync="data.onetomany[onetomany_index].fields[index].value"
246
+ :format="'yyyy-MM-dd'"
247
+ v-model="data.onetomany[onetomany_index].fields[index].value"
248
+ :readonly="item.readonly"
249
+ :disabled="item.disabled"
250
+ :show-reset-button="reset">
251
+ </datepicker>
252
+ <!--select-->
253
+ <input-select
254
+ @change="check_modal(index)"
255
+ v-if="item.type=='select'"
256
+ @blur="check_modal(index)"
257
+ :value.sync="data.onetomany[onetomany_index].fields[index].value"
258
+ v-model="data.onetomany[onetomany_index].fields[index].value"
259
+ :options='data.onetomany[onetomany_index].fields[index].options'>
260
+ </input-select>
261
+ <!-- input -->
262
+ <input v-if="item.type==='input' || item.type==='number'||item.type === 'tel'||item.type === 'email'"
263
+ class="form-control"
264
+ :type="item.type"
265
+ v-model="data.onetomany[onetomany_index].fields[index].value"
266
+ :placeholder="item.placeholder"
267
+ :value="data.onetomany[onetomany_index].fields[index].value"
268
+ :readonly="item.readonly"
269
+ :disabled="item.disabled"
270
+ @change="check_modal(index)"
271
+ @blur="check_modal(index)"
272
+ @input="oninput_modal(index)"
273
+ />
274
+ </div>
275
+ </div>
276
+ </article>
277
+ <footer slot="modal-footer" class="modal-footer">
278
+ <button :class="disable_button_onetomany?'btn btn-default':'btn btn-primary'"
279
+ :disabled="disable_button_onetomany" type="button" @click="confirm_modal(modeltitle)">
280
+ 确认
281
+ </button>
282
+ </footer>
283
+ </modal>
284
+
285
+ <!-- 按钮模态框 -->
286
+ <modal v-if="showbutmodal" :show.sync="showbutmodal" v-ref:modal backdrop="false">
287
+ <header slot="modal-header" class="modal-header">
288
+ <button type="button" class="close" @click="closemodal('but')"><span>&times;</span></button>
289
+ <h4 class="modal-title">{{model.button.button_name}}</h4>
290
+ </header>
291
+ <article slot="modal-body" class="modal-body">
292
+ <div class="col-sm-12" v-for="(index,button) in data.buttons[model.button.button_index].button_fields">
293
+ <label class="control-label col-sm-3" style="margin-top: 10px">{{button.label}}:</label>
294
+ <div class="col-sm-7">
295
+ <!--select-->
296
+ <input-select v-if="button.type=='select'"
297
+ :value.sync="data.buttons[model.button.button_index].button_fields[index].value"
298
+ v-model="data.buttons[model.button.button_index].button_fields[index].value"
299
+ :options='button.options'></input-select>
300
+ <!-- input -->
301
+ <input v-else type="text" class="form-control"
302
+ v-model="data.buttons[model.button.button_index].button_fields[index].value"/>
303
+ </div>
304
+ </div>
305
+ </article>
306
+ <footer slot="modal-footer" style="border-top:none" class="modal-footer">
307
+ <button type="button" class="btn btn-primary" :disabled="disable_button_but" @click='confirm_but_modal()'>确认</button>
308
+ </footer>
309
+ </modal>
310
+ </div>
311
+ </template>
312
+ <script>
313
+ import Vue from 'vue'
314
+ // Date格式化
315
+ Date.prototype.Format = function (fmt) {
316
+ var o = {
317
+ 'M+': this.getMonth() + 1, // 月份
318
+ 'd+': this.getDate(), // 日
319
+ 'H+': this.getHours(), // 小时
320
+ 'm+': this.getMinutes(), // 分
321
+ 's+': this.getSeconds(), // 秒
322
+ 'q+': Math.floor((this.getMonth() + 3) / 3), // 季度
323
+ 'S': this.getMilliseconds() // 毫秒
324
+ }
325
+ if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + '').substr(4 - RegExp.$1.length))
326
+ for (var k in o) {
327
+ if (new RegExp('(' + k + ')').test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length)))
328
+ }
329
+ return fmt
330
+ }
331
+
332
+ export default {
333
+ title: '报建业务通用组件',
334
+ props: {
335
+ data: {
336
+ type: Object
337
+ },
338
+ mark: {
339
+ type: Number,
340
+ default: 0
341
+ },
342
+ showprint: {
343
+ type: Boolean,
344
+ default: true
345
+ }
346
+ },
347
+ data () {
348
+ return {
349
+ model: {}, // 公司等属性
350
+ disable_button: true, // 控制按钮禁用
351
+ show: false, // 控制onetomany模态框
352
+ disable_button_onetomany: true, // 控制onetomany模态框按钮
353
+ onetomany_index: null, // 当前选择的下标
354
+ update_onetomany_index: null, // 当前需要修改的下标
355
+ modeltitle: null, // 模态框标题
356
+ modalSize: null, // 模态框大小
357
+ showbutmodal: false,
358
+ }
359
+ },
360
+ watch: {
361
+ deep: true
362
+ },
363
+ computed: {
364
+
365
+ },
366
+ created () {
367
+ // 初始化数据
368
+ this.initializtion()
369
+ },
370
+ methods: {
371
+ // 按钮模态框确定
372
+ confirm_but_modal() {
373
+ this.data.buttons[this.model.button.button_index].button_fields.forEach(item => {
374
+ this.model.button.button_fields[item.field] = item.value
375
+ })
376
+ this.showbutmodal = false
377
+ this.disable_button_but = true
378
+ this.$dispatch('button', this.model)
379
+ },
380
+ // 点击按钮组按钮
381
+ async clicked(index, button) {
382
+ this.disable_button = true
383
+ // 组织model.fields数据
384
+ this.data.fields.forEach(item => {
385
+ // checkbox特殊处理
386
+ if (item.type === 'checkbox') {
387
+ for (let j = 0; j < item.items.length; j++) {
388
+ this.model[item.items[j].field] = item.items[j].value
389
+ }
390
+ } else {
391
+ this.model[item.field] = item.value
392
+ }
393
+ })
394
+ this.model.f_process_id = this.data.f_process_id
395
+
396
+ // 初始化model.button数据
397
+ let buttondatas = {
398
+ button_fields: {}
399
+ }
400
+ buttondatas.button_name = button.button_name
401
+ buttondatas.button_index = index
402
+ if (button.button_fields) {
403
+ button.button_fields.forEach(item => {
404
+ buttondatas.button_fields[item.field] = item.value
405
+ })
406
+ }
407
+ this.model.button = buttondatas
408
+
409
+ if (button.button_name === '退回') {
410
+ this.showbutmodal = true
411
+ } else if (button.button_name === '下发') {
412
+ this.showbutmodal = true
413
+ } else {
414
+ this.$dispatch('button', this.model)
415
+ }
416
+ },
417
+
418
+ // 初始化数据
419
+ initializtion () {
420
+ // 是否禁用按钮
421
+ this.disableButton()
422
+
423
+ // datepicker 没有值给当时值
424
+ this.data.fields.forEach(item => {
425
+ if (item.type === 'datepicker' && !item.value) {
426
+ item.value = new Date().Format('yyyy-MM-dd')
427
+ }
428
+ })
429
+
430
+ // 公司等属性初始化
431
+ if (this.data.filiale) {
432
+ this.model.f_filiale = this.data.filiale
433
+ } else {
434
+ this.model.f_filiale = this.$login.f.orgs
435
+ }
436
+ if (this.data.f_parentname) {
437
+ this.model.f_parentname = this.data.f_parentname
438
+ } else {
439
+ this.model.f_parentname = this.$login.f.f_department_name
440
+ }
441
+ if (this.data.operate_date) {
442
+ this.model.f_operate_date = this.data.operate_date
443
+ } else {
444
+ this.model.f_operate_date = new Date().Format('yyyy-MM-dd')
445
+ }
446
+ if (this.data.operator) {
447
+ this.model.f_operator = this.data.operator
448
+ } else {
449
+ this.model.f_operator = this.$login.f.name
450
+ }
451
+ },
452
+ // 是否禁用按钮
453
+ disableButton () {
454
+ let fields = this.data.fields
455
+
456
+ let flag = false
457
+ fields.forEach(item => {
458
+ if (item.type !== 'checkbox' && item.required && !item.value) {
459
+ flag = true
460
+ }
461
+ // 任何选择框只要是否都不能提交
462
+ if (item.type === 'select' && item.value === '否') {
463
+ flag = true
464
+ }
465
+ })
466
+
467
+ let count = 0
468
+ fields.forEach(item => {
469
+ if (item.type !== 'checkbox' && !item.required) {
470
+ count++
471
+ }
472
+ })
473
+ if (count === 0) {
474
+ flag = false
475
+ }
476
+
477
+ this.disable_button = flag
478
+ },
479
+ // 监听失去焦点
480
+ check (index) {
481
+ // 是否禁用按钮
482
+ this.disableButton()
483
+
484
+ this.$dispatch('check', index)
485
+ // 如果有错误信息提示走错误信息判断处理
486
+
487
+ if (this.data.fields[index].error || this.data.fields[index].type === 'datepicker') {
488
+ this.$dispatch('error_check', index)
489
+ }
490
+ },
491
+ oninput (index) {
492
+ // 是否禁用按钮
493
+ this.disableButton()
494
+
495
+ this.$dispatch('oninput', index)
496
+
497
+ // 如果有错误信息提示走错误信息判断处理
498
+ if (this.data.fields[index].error || this.data.fields[index].type === 'datepicker') {
499
+ this.$dispatch('error_check', index)
500
+ }
501
+ },
502
+
503
+ // 模态框确认按钮
504
+ confirm_modal (title) {
505
+ console.log("来了没有1")
506
+ if (title === '新增') {
507
+ console.log("来了没有2")
508
+ if (this.data.onetomany[this.onetomany_index].addEvent === 'default' || !this.data.onetomany[this.onetomany_index].addEvent) {
509
+ console.log("来了没有3:" + this.onetomany_index)
510
+ this.$dispatch('onetomanyadd', this.onetomany_index)
511
+ } else {
512
+ console.log("来了没有4")
513
+ this.$dispatch(this.data.onetomany[this.onetomany_index].addEvent, this.onetomany_index)
514
+ }
515
+ } else {
516
+ if (this.data.onetomany[this.onetomany_index].updateEvent === 'default' || !this.data.onetomany[this.onetomany_index].updateEvent) {
517
+ this.$dispatch('onetomanyupdate', this.onetomany_index, this.update_onetomany_index)
518
+ } else {
519
+ this.$dispatch(this.data.onetomany[this.onetomany_index].updateEvent, this.onetomany_index, this.update_onetomany_index)
520
+ }
521
+ }
522
+
523
+ this.closemodal()
524
+ },
525
+ // 删除
526
+ delete (i, j) {
527
+ this.$showMessage('您确定要删除这条记录吗?', ['confirm']).then((res) => {
528
+ if (res === 'confirm') {
529
+ console.log("删除记录1")
530
+ console.log("删除记录1 + :" + this.data.onetomany[i].deleteEvent)
531
+
532
+ if (this.data.onetomany[i].deleteEvent === 'default' || !this.data.onetomany[i].deleteEvent) {
533
+ this.$dispatch('onetomanydelete', i, j)
534
+ } else {
535
+ this.$dispatch(this.data.onetomany[i].deleteEvent, i, j)
536
+ }
537
+ }
538
+ })
539
+ },
540
+ // 修改
541
+ update (i, j) {
542
+ let onetomany = this.data.onetomany[i]
543
+ let item = this.data.onetomany[i].rows[j]
544
+ let count = 0
545
+ for (let k = 0; k < onetomany.fields.length; k++) {
546
+ // 防止初始化的时候没有value
547
+ Vue.set(this.data.onetomany[i].fields[k], 'value', item[this.data.onetomany[i].fields[k].field])
548
+
549
+ if (onetomany.fields[j].required) {
550
+ count++
551
+ }
552
+ }
553
+ if (count === 0) {
554
+ this.disable_button_onetomany = false
555
+ }
556
+ this.modeltitle = '修改'
557
+ this.modalSize = this.data.onetomany[i].modalSize
558
+ this.onetomany_index = i
559
+ this.update_onetomany_index = j
560
+ this.show = true
561
+ },
562
+ // 添加
563
+ add (index) {
564
+ console.log("index是否有值:" + index)
565
+ let count = 0
566
+ this.data.onetomany[index].fields.forEach(item => {
567
+ if (item.type === 'datepicker') {
568
+ item.value = new Date().Format('yyyy-MM-dd')
569
+ }
570
+ if (item.required) {
571
+ count++
572
+ }
573
+ })
574
+
575
+ if (count === 0) {
576
+ this.disable_button_onetomany = false
577
+ }
578
+ this.modeltitle = '新增'
579
+ this.modalSize = this.data.onetomany[index].modalSize
580
+ this.onetomany_index = index
581
+ this.show = true
582
+ },
583
+ // 关闭模态框
584
+ closemodal (val) {
585
+ if (val === 'but'){
586
+ this.disableButton()
587
+ this.showbutmodal = false
588
+ return
589
+ }
590
+ this.data.onetomany[this.onetomany_index].fields.forEach(item => {
591
+ item.value = ''
592
+ })
593
+ this.show = false
594
+ this.disable_button_onetomany = true
595
+ this.onetomany_index = null
596
+ this.update_onetomany_index = null
597
+ this.modeltitle = null
598
+ this.modalSize = null
599
+ },
600
+
601
+ // 是否禁用模态框按钮
602
+ disableModalButton () {
603
+ let fields = this.data.onetomany[this.onetomany_index].fields
604
+
605
+ let flag = false
606
+ fields.forEach(item => {
607
+ if (item.type !== 'checkbox' && item.required && !item.value) {
608
+ flag = true
609
+ }
610
+ })
611
+
612
+ let count = 0
613
+ fields.forEach(item => {
614
+ if (item.type !== 'checkbox' && !item.required) {
615
+ count++
616
+ }
617
+ })
618
+
619
+ if (count === 0) {
620
+ flag = false
621
+ }
622
+ this.disable_button_onetomany = flag
623
+ },
624
+ // 监听模态框属性失去焦点
625
+ check_modal (index) {
626
+ this.disableModalButton()
627
+ this.$dispatch('check_modal', index)
628
+ },
629
+ // input输入属性值发生变化监听
630
+ oninput_modal (index) {
631
+ console.log('@input="oninput_modal(index)"')
632
+ this.disableModalButton()
633
+ this.$dispatch('oninput_modal', index)
634
+ }
635
+
636
+ },
637
+ events: {
638
+
639
+ }
640
+ }
641
+ </script>
642
+ <style>
643
+ .datepicker{
644
+ width: 100%!important;
645
+ }
646
+ .datepicker-input{
647
+ background-color: #ffffff!important;
648
+ width: 100%!important;
649
+ }
650
+ .datepicker-input:disabled{
651
+ border: 1px solid #DDD!important;
652
+ color: #ACA899!important;
653
+ width: 100%!important;
654
+ }
655
+ </style>
656
+ <style scoped>
657
+ th{
658
+ font-size: 15px !important;
659
+ text-align: center !important;
660
+ background-color: #dfedfb!important;
661
+ color: #666666 !important;
662
+ font-family: PINGFANG-BOLD !important;
663
+ font-weight: normal!important;
664
+ }
665
+ /*清除model中的浮动*/
666
+ .clearfix:after,.clearfix:before{
667
+ display: table;
668
+ }
669
+ .clearfix:after{
670
+ clear: both;
671
+ }
672
+
673
+ .input_view{
674
+ padding: 8px;
675
+ background-color: #ffffff;
676
+ border-radius: 2px;
677
+ border: solid 1px #c7c7c7!important;
678
+ color: #333333!important;
679
+ font-size: 15px!important;
680
+ }
681
+
682
+ .input_view[readonly]{
683
+ border: 1px solid #DDD!important;
684
+ /*background-color: #F5F5F5;*/
685
+ color:#ACA899!important;
686
+ }
687
+ .input_view:disabled{
688
+ border: 1px solid #DDD!important;
689
+ /*background-color: #F5F5F5;*/
690
+ color:#ACA899!important;
691
+ }
692
+
693
+ .control-label-justify {
694
+ display: inline-block;
695
+ vertical-align: top;
696
+ width: 110px;
697
+ text-align: justify;
698
+ font-family: PingFang-SC-Bold;
699
+ }
700
+
701
+ .control-label-justify::after {
702
+ content: "";
703
+ display: inline-block;
704
+ width: 70px;
705
+ overflow: hidden;
706
+ height: 0;
707
+ }
708
+
709
+ input::-webkit-outer-spin-button,
710
+ input::-webkit-inner-spin-button {
711
+ -webkit-appearance: none;
712
+ }
713
+
714
+ input[type="number"] {
715
+ -moz-appearance: textfield;
716
+ }
717
+
718
+ </style>