apply-clients 3.1.59 → 3.1.60

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,728 +1,730 @@
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
- if (this.data.readyEvent) {
370
- this.$dispatch(this.data.readyEvent)
371
- }
372
- },
373
- methods: {
374
- // 按钮模态框确定
375
- confirm_but_modal() {
376
- this.data.buttons[this.model.button.button_index].button_fields.forEach(item => {
377
- this.model.button.button_fields[item.field] = item.value
378
- })
379
- this.showbutmodal = false
380
- this.disable_button_but = true
381
- this.$dispatch('button', this.model)
382
- },
383
- // 点击按钮组按钮
384
- async clicked(index, button) {
385
- this.disable_button = true
386
- // 组织model.fields数据
387
- this.data.fields.forEach(item => {
388
- // checkbox特殊处理
389
- if (item.type === 'checkbox') {
390
- for (let j = 0; j < item.items.length; j++) {
391
- this.model[item.items[j].field] = item.items[j].value
392
- }
393
- } else {
394
- this.model[item.field] = item.value
395
- }
396
- })
397
- this.model.f_process_id = this.data.f_process_id
398
-
399
- // 初始化model.button数据
400
- let buttondatas = {
401
- button_fields: {}
402
- }
403
- buttondatas.button_name = button.button_name
404
- buttondatas.button_index = index
405
- if (button.before){
406
- buttondatas.before = button.before
407
- }
408
- if (button.button_fields) {
409
- button.button_fields.forEach(item => {
410
- buttondatas.button_fields[item.field] = item.value
411
- })
412
- }
413
- this.model.button = buttondatas
414
-
415
- if (button.button_name === '退回') {
416
- this.showbutmodal = true
417
- } else if (button.button_name === '下发') {
418
- this.showbutmodal = true
419
- } else {
420
- this.$dispatch('button', this.model)
421
- }
422
- },
423
-
424
- // 初始化数据
425
- initializtion () {
426
- // 是否禁用按钮
427
- this.disableButton()
428
-
429
- // datepicker 没有值给当时值
430
- this.data.fields.forEach(item => {
431
- if (item.type === 'datepicker' && !item.value) {
432
- item.value = new Date().Format('yyyy-MM-dd')
433
- }
434
- })
435
-
436
- // 公司等属性初始化
437
- if (this.data.filiale) {
438
- this.model.f_filiale = this.data.filiale
439
- } else {
440
- this.model.f_filiale = this.$login.f.orgs
441
- }
442
- if (this.data.f_parentname) {
443
- this.model.f_parentname = this.data.f_parentname
444
- } else {
445
- this.model.f_parentname = this.$login.f.f_department_name
446
- }
447
- if (this.data.operate_date) {
448
- this.model.f_operate_date = this.data.operate_date
449
- } else {
450
- this.model.f_operate_date = new Date().Format('yyyy-MM-dd')
451
- }
452
- if (this.data.operator) {
453
- this.model.f_operator = this.data.operator
454
- } else {
455
- this.model.f_operator = this.$login.f.name
456
- }
457
- },
458
- // 是否禁用按钮
459
- disableButton () {
460
- let fields = this.data.fields
461
-
462
- let flag = false
463
- fields.forEach(item => {
464
- if (item.type !== 'checkbox' && item.required && !item.value) {
465
- flag = true
466
- }
467
- // 任何选择框只要是否都不能提交
468
- if (item.type === 'select' && item.value === '否') {
469
- flag = true
470
- }
471
- })
472
-
473
- let count = 0
474
- fields.forEach(item => {
475
- if (item.type !== 'checkbox' && !item.required) {
476
- count++
477
- }
478
- })
479
- if (count === 0) {
480
- flag = false
481
- }
482
-
483
- this.disable_button = flag
484
- },
485
- // 监听失去焦点
486
- check (index) {
487
- // 是否禁用按钮
488
- this.disableButton()
489
- if (this.data.fields[index].onchange) {
490
- console.log("当前onchange",this.data.fields[index].onchange)
491
- this.$dispatch(this.data.fields[index].onchange, index)
492
- }
493
-
494
- this.$dispatch('check', index)
495
- // 如果有错误信息提示走错误信息判断处理
496
-
497
- if (this.data.fields[index].error || this.data.fields[index].type === 'datepicker') {
498
- this.$dispatch('error_check', index)
499
- }
500
- },
501
- oninput (index) {
502
- // 是否禁用按钮
503
- this.disableButton()
504
-
505
- this.$dispatch('oninput', index)
506
-
507
- // 如果有错误信息提示走错误信息判断处理
508
- if (this.data.fields[index].error || this.data.fields[index].type === 'datepicker') {
509
- this.$dispatch('error_check', index)
510
- }
511
- },
512
-
513
- // 模态框确认按钮
514
- confirm_modal (title) {
515
- console.log("来了没有1")
516
- if (title === '新增') {
517
- console.log("来了没有2")
518
- if (this.data.onetomany[this.onetomany_index].addEvent === 'default' || !this.data.onetomany[this.onetomany_index].addEvent) {
519
- console.log("来了没有3:" + this.onetomany_index)
520
- this.$dispatch('onetomanyadd', this.onetomany_index)
521
- } else {
522
- console.log("来了没有4")
523
- this.$dispatch(this.data.onetomany[this.onetomany_index].addEvent, this.onetomany_index)
524
- }
525
- } else {
526
- if (this.data.onetomany[this.onetomany_index].updateEvent === 'default' || !this.data.onetomany[this.onetomany_index].updateEvent) {
527
- this.$dispatch('onetomanyupdate', this.onetomany_index, this.update_onetomany_index)
528
- } else {
529
- this.$dispatch(this.data.onetomany[this.onetomany_index].updateEvent, this.onetomany_index, this.update_onetomany_index)
530
- }
531
- }
532
-
533
- this.closemodal()
534
- },
535
- // 删除
536
- delete (i, j) {
537
- this.$showMessage('您确定要删除这条记录吗?', ['confirm']).then((res) => {
538
- if (res === 'confirm') {
539
- console.log("删除记录1")
540
- console.log("删除记录1 + :" + this.data.onetomany[i].deleteEvent)
541
-
542
- if (this.data.onetomany[i].deleteEvent === 'default' || !this.data.onetomany[i].deleteEvent) {
543
- this.$dispatch('onetomanydelete', i, j)
544
- } else {
545
- this.$dispatch(this.data.onetomany[i].deleteEvent, i, j)
546
- }
547
- }
548
- })
549
- },
550
- // 修改
551
- update (i, j) {
552
- let onetomany = this.data.onetomany[i]
553
- let item = this.data.onetomany[i].rows[j]
554
- let count = 0
555
- for (let k = 0; k < onetomany.fields.length; k++) {
556
- // 防止初始化的时候没有value
557
- Vue.set(this.data.onetomany[i].fields[k], 'value', item[this.data.onetomany[i].fields[k].field])
558
-
559
- if (onetomany.fields[j].required) {
560
- count++
561
- }
562
- }
563
- if (count === 0) {
564
- this.disable_button_onetomany = false
565
- }
566
- this.modeltitle = '修改'
567
- this.modalSize = this.data.onetomany[i].modalSize
568
- this.onetomany_index = i
569
- this.update_onetomany_index = j
570
- this.show = true
571
- },
572
- // 添加
573
- add (index) {
574
- console.log("index是否有值:" + index)
575
- let count = 0
576
- this.data.onetomany[index].fields.forEach(item => {
577
- if (item.type === 'datepicker') {
578
- item.value = new Date().Format('yyyy-MM-dd')
579
- }
580
- if (item.required) {
581
- count++
582
- }
583
- })
584
-
585
- if (count === 0) {
586
- this.disable_button_onetomany = false
587
- }
588
- this.modeltitle = '新增'
589
- this.modalSize = this.data.onetomany[index].modalSize
590
- this.onetomany_index = index
591
- this.show = true
592
- },
593
- // 关闭模态框
594
- closemodal (val) {
595
- if (val === 'but'){
596
- this.disableButton()
597
- this.showbutmodal = false
598
- return
599
- }
600
- this.data.onetomany[this.onetomany_index].fields.forEach(item => {
601
- item.value = ''
602
- })
603
- this.show = false
604
- this.disable_button_onetomany = true
605
- this.onetomany_index = null
606
- this.update_onetomany_index = null
607
- this.modeltitle = null
608
- this.modalSize = null
609
- },
610
-
611
- // 是否禁用模态框按钮
612
- disableModalButton () {
613
- let fields = this.data.onetomany[this.onetomany_index].fields
614
-
615
- let flag = false
616
- fields.forEach(item => {
617
- if (item.type !== 'checkbox' && item.required && !item.value) {
618
- flag = true
619
- }
620
- })
621
-
622
- let count = 0
623
- fields.forEach(item => {
624
- if (item.type !== 'checkbox' && !item.required) {
625
- count++
626
- }
627
- })
628
-
629
- if (count === 0) {
630
- flag = false
631
- }
632
- this.disable_button_onetomany = flag
633
- },
634
- // 监听模态框属性失去焦点
635
- check_modal (index) {
636
- this.disableModalButton()
637
- this.$dispatch('check_modal', index)
638
- },
639
- // input输入属性值发生变化监听
640
- oninput_modal (index) {
641
- console.log('@input="oninput_modal(index)"')
642
- this.disableModalButton()
643
- this.$dispatch('oninput_modal', index)
644
- }
645
-
646
- },
647
- events: {
648
-
649
- }
650
- }
651
- </script>
652
- <style>
653
- .datepicker{
654
- width: 100%!important;
655
- }
656
- .datepicker-input{
657
- background-color: #ffffff!important;
658
- width: 100%!important;
659
- }
660
- .datepicker-input:disabled{
661
- border: 1px solid #DDD!important;
662
- color: #ACA899!important;
663
- width: 100%!important;
664
- }
665
- </style>
666
- <style scoped>
667
- th{
668
- font-size: 15px !important;
669
- text-align: center !important;
670
- background-color: #dfedfb!important;
671
- color: #666666 !important;
672
- font-family: PINGFANG-BOLD !important;
673
- font-weight: normal!important;
674
- }
675
- /*清除model中的浮动*/
676
- .clearfix:after,.clearfix:before{
677
- display: table;
678
- }
679
- .clearfix:after{
680
- clear: both;
681
- }
682
-
683
- .input_view{
684
- padding: 8px;
685
- background-color: #ffffff;
686
- border-radius: 2px;
687
- border: solid 1px #c7c7c7!important;
688
- color: #333333!important;
689
- font-size: 15px!important;
690
- }
691
-
692
- .input_view[readonly]{
693
- border: 1px solid #DDD!important;
694
- /*background-color: #F5F5F5;*/
695
- color:#ACA899!important;
696
- }
697
- .input_view:disabled{
698
- border: 1px solid #DDD!important;
699
- /*background-color: #F5F5F5;*/
700
- color:#ACA899!important;
701
- }
702
-
703
- .control-label-justify {
704
- display: inline-block;
705
- vertical-align: top;
706
- width: 110px;
707
- text-align: justify;
708
- font-family: PingFang-SC-Bold;
709
- }
710
-
711
- .control-label-justify::after {
712
- content: "";
713
- display: inline-block;
714
- width: 70px;
715
- overflow: hidden;
716
- height: 0;
717
- }
718
-
719
- input::-webkit-outer-spin-button,
720
- input::-webkit-inner-spin-button {
721
- -webkit-appearance: none;
722
- }
723
-
724
- input[type="number"] {
725
- -moz-appearance: textfield;
726
- }
727
-
728
- </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
+ v-show="!button.hidden"
218
+ :id=index
219
+ :disabled="(button.button_name==='提交'||button.button_name==='下发'||button.button_name==='退费')&&disable_button" type="button"
220
+ @click="clicked(index,button)"
221
+ :class="(button.button_name==='提交'||button.button_name==='下发'||button.button_name==='退费')&&disable_button?'btn btn-default':'btn btn-primary'"
222
+ style="min-width:100px; margin-right:50px;">
223
+ {{button.button_name}}
224
+ </button>
225
+ </center>
226
+ </div>
227
+
228
+ <!-- onetomany模态框 -->
229
+ <modal v-if="show" :show.sync="show" backdrop="false" :large="modalSize === 'large' ? true : false" :small="modalSize === 'small' ? true : false">
230
+ <header slot="modal-header" class="modal-header">
231
+ <button type="button" class="close" @click="closemodal(modeltitle)"><span>&times;</span></button>
232
+ <span class="modal-title"><font
233
+ size="3">{{modeltitle}}</font></span>
234
+ </header>
235
+ <article slot="modal-body" class="modal-body clearfix">
236
+ <div
237
+ :class="[item.required&&!(item.value) ? 'has-error' : '',item.bootstraped?item.bootstraped:'col-sm-12']"
238
+ v-for="(index,item) in data.onetomany[onetomany_index].fields">
239
+ <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>
240
+ <div :class="item.value_bootstraped ? item.value_bootstraped : 'col-sm-7'" v-show="!item.hidden">
241
+ <!--时间datepicker-->
242
+ <datepicker
243
+ v-if="item.type=='datepicker'"
244
+ @change="check_modal(index)"
245
+ @blur="check_modal(index)"
246
+ :placeholder="item.placeholder"
247
+ :value.sync="data.onetomany[onetomany_index].fields[index].value"
248
+ :format="'yyyy-MM-dd'"
249
+ v-model="data.onetomany[onetomany_index].fields[index].value"
250
+ :readonly="item.readonly"
251
+ :disabled="item.disabled"
252
+ :show-reset-button="reset">
253
+ </datepicker>
254
+ <!--select-->
255
+ <input-select
256
+ @change="check_modal(index)"
257
+ v-if="item.type=='select'"
258
+ @blur="check_modal(index)"
259
+ :value.sync="data.onetomany[onetomany_index].fields[index].value"
260
+ v-model="data.onetomany[onetomany_index].fields[index].value"
261
+ :options='data.onetomany[onetomany_index].fields[index].options'>
262
+ </input-select>
263
+ <!-- input -->
264
+ <input v-if="item.type==='input' || item.type==='number'||item.type === 'tel'||item.type === 'email'"
265
+ class="form-control"
266
+ :type="item.type"
267
+ v-model="data.onetomany[onetomany_index].fields[index].value"
268
+ :placeholder="item.placeholder"
269
+ :value="data.onetomany[onetomany_index].fields[index].value"
270
+ :readonly="item.readonly"
271
+ :disabled="item.disabled"
272
+ @change="check_modal(index)"
273
+ @blur="check_modal(index)"
274
+ @input="oninput_modal(index)"
275
+ />
276
+ </div>
277
+ </div>
278
+ </article>
279
+ <footer slot="modal-footer" class="modal-footer">
280
+ <button :class="disable_button_onetomany?'btn btn-default':'btn btn-primary'"
281
+ :disabled="disable_button_onetomany" type="button" @click="confirm_modal(modeltitle)">
282
+ 确认
283
+ </button>
284
+ </footer>
285
+ </modal>
286
+
287
+ <!-- 按钮模态框 -->
288
+ <modal v-if="showbutmodal" :show.sync="showbutmodal" v-ref:modal backdrop="false">
289
+ <header slot="modal-header" class="modal-header">
290
+ <button type="button" class="close" @click="closemodal('but')"><span>&times;</span></button>
291
+ <h4 class="modal-title">{{model.button.button_name}}</h4>
292
+ </header>
293
+ <article slot="modal-body" class="modal-body">
294
+ <div class="col-sm-12" v-for="(index,button) in data.buttons[model.button.button_index].button_fields">
295
+ <label class="control-label col-sm-3" style="margin-top: 10px">{{button.label}}:</label>
296
+ <div class="col-sm-7">
297
+ <!--select-->
298
+ <input-select v-if="button.type=='select'"
299
+ :value.sync="data.buttons[model.button.button_index].button_fields[index].value"
300
+ v-model="data.buttons[model.button.button_index].button_fields[index].value"
301
+ :options='button.options'></input-select>
302
+ <!-- input -->
303
+ <input v-else type="text" class="form-control"
304
+ v-model="data.buttons[model.button.button_index].button_fields[index].value"/>
305
+ </div>
306
+ </div>
307
+ </article>
308
+ <footer slot="modal-footer" style="border-top:none" class="modal-footer">
309
+ <button type="button" class="btn btn-primary" :disabled="disable_button_but" @click='confirm_but_modal()'>确认</button>
310
+ </footer>
311
+ </modal>
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
+ }
331
+ return fmt
332
+ }
333
+
334
+ export default {
335
+ title: '报建业务通用组件',
336
+ props: {
337
+ data: {
338
+ type: Object
339
+ },
340
+ mark: {
341
+ type: Number,
342
+ default: 0
343
+ },
344
+ showprint: {
345
+ type: Boolean,
346
+ default: true
347
+ }
348
+ },
349
+ data () {
350
+ return {
351
+ model: {}, // 公司等属性
352
+ disable_button: true, // 控制按钮禁用
353
+ show: false, // 控制onetomany模态框
354
+ disable_button_onetomany: true, // 控制onetomany模态框按钮
355
+ onetomany_index: null, // 当前选择的下标
356
+ update_onetomany_index: null, // 当前需要修改的下标
357
+ modeltitle: null, // 模态框标题
358
+ modalSize: null, // 模态框大小
359
+ showbutmodal: false,
360
+ }
361
+ },
362
+ watch: {
363
+ deep: true
364
+ },
365
+ computed: {
366
+
367
+ },
368
+ created () {
369
+ // 初始化数据
370
+ this.initializtion()
371
+ if (this.data.readyEvent) {
372
+ this.$dispatch(this.data.readyEvent)
373
+ }
374
+ },
375
+ methods: {
376
+ // 按钮模态框确定
377
+ confirm_but_modal() {
378
+ this.data.buttons[this.model.button.button_index].button_fields.forEach(item => {
379
+ this.model.button.button_fields[item.field] = item.value
380
+ })
381
+ this.showbutmodal = false
382
+ this.disable_button_but = true
383
+ this.$dispatch('button', this.model)
384
+ },
385
+ // 点击按钮组按钮
386
+ async clicked(index, button) {
387
+ this.disable_button = true
388
+ // 组织model.fields数据
389
+ this.data.fields.forEach(item => {
390
+ // checkbox特殊处理
391
+ if (item.type === 'checkbox') {
392
+ for (let j = 0; j < item.items.length; j++) {
393
+ this.model[item.items[j].field] = item.items[j].value
394
+ }
395
+ } else {
396
+ this.model[item.field] = item.value
397
+ }
398
+ })
399
+ this.model.f_process_id = this.data.f_process_id
400
+
401
+ // 初始化model.button数据
402
+ let buttondatas = {
403
+ button_fields: {}
404
+ }
405
+ buttondatas.button_name = button.button_name
406
+ buttondatas.button_index = index
407
+ if (button.before){
408
+ buttondatas.before = button.before
409
+ }
410
+ if (button.button_fields) {
411
+ button.button_fields.forEach(item => {
412
+ buttondatas.button_fields[item.field] = item.value
413
+ })
414
+ }
415
+ this.model.button = buttondatas
416
+
417
+ if (button.button_name === '退回') {
418
+ this.showbutmodal = true
419
+ } else if (button.button_name === '下发') {
420
+ this.showbutmodal = true
421
+ } else {
422
+ this.$dispatch('button', this.model)
423
+ }
424
+ },
425
+
426
+ // 初始化数据
427
+ initializtion () {
428
+ // 是否禁用按钮
429
+ this.disableButton()
430
+
431
+ // datepicker 没有值给当时值
432
+ this.data.fields.forEach(item => {
433
+ if (item.type === 'datepicker' && !item.value) {
434
+ item.value = new Date().Format('yyyy-MM-dd')
435
+ }
436
+ })
437
+
438
+ // 公司等属性初始化
439
+ if (this.data.filiale) {
440
+ this.model.f_filiale = this.data.filiale
441
+ } else {
442
+ this.model.f_filiale = this.$login.f.orgs
443
+ }
444
+ if (this.data.f_parentname) {
445
+ this.model.f_parentname = this.data.f_parentname
446
+ } else {
447
+ this.model.f_parentname = this.$login.f.f_department_name
448
+ }
449
+ if (this.data.operate_date) {
450
+ this.model.f_operate_date = this.data.operate_date
451
+ } else {
452
+ this.model.f_operate_date = new Date().Format('yyyy-MM-dd')
453
+ }
454
+ if (this.data.operator) {
455
+ this.model.f_operator = this.data.operator
456
+ } else {
457
+ this.model.f_operator = this.$login.f.name
458
+ }
459
+ },
460
+ // 是否禁用按钮
461
+ disableButton () {
462
+ let fields = this.data.fields
463
+
464
+ let flag = false
465
+ fields.forEach(item => {
466
+ if (item.type !== 'checkbox' && item.required && !item.value) {
467
+ flag = true
468
+ }
469
+ // 任何选择框只要是否都不能提交
470
+ // if (item.type === 'select' && item.value === '否') {
471
+ // flag = true
472
+ // }
473
+ })
474
+
475
+ let count = 0
476
+ fields.forEach(item => {
477
+ if (item.type !== 'checkbox' && !item.required) {
478
+ count++
479
+ }
480
+ })
481
+ if (count === 0) {
482
+ flag = false
483
+ }
484
+
485
+ this.disable_button = flag
486
+ },
487
+ // 监听失去焦点
488
+ check (index) {
489
+ // 是否禁用按钮
490
+ this.disableButton()
491
+ if (this.data.fields[index].onchange) {
492
+ console.log("当前onchange",this.data.fields[index].onchange)
493
+ this.$dispatch(this.data.fields[index].onchange, index)
494
+ }
495
+
496
+ this.$dispatch('check', index)
497
+ // 如果有错误信息提示走错误信息判断处理
498
+
499
+ if (this.data.fields[index].error || this.data.fields[index].type === 'datepicker') {
500
+ this.$dispatch('error_check', index)
501
+ }
502
+ },
503
+ oninput (index) {
504
+ // 是否禁用按钮
505
+ this.disableButton()
506
+
507
+ this.$dispatch('oninput', index)
508
+
509
+ // 如果有错误信息提示走错误信息判断处理
510
+ if (this.data.fields[index].error || this.data.fields[index].type === 'datepicker') {
511
+ this.$dispatch('error_check', index)
512
+ }
513
+ },
514
+
515
+ // 模态框确认按钮
516
+ confirm_modal (title) {
517
+ console.log("来了没有1")
518
+ if (title === '新增') {
519
+ console.log("来了没有2")
520
+ if (this.data.onetomany[this.onetomany_index].addEvent === 'default' || !this.data.onetomany[this.onetomany_index].addEvent) {
521
+ console.log("来了没有3:" + this.onetomany_index)
522
+ this.$dispatch('onetomanyadd', this.onetomany_index)
523
+ } else {
524
+ console.log("来了没有4")
525
+ this.$dispatch(this.data.onetomany[this.onetomany_index].addEvent, this.onetomany_index)
526
+ }
527
+ } else {
528
+ if (this.data.onetomany[this.onetomany_index].updateEvent === 'default' || !this.data.onetomany[this.onetomany_index].updateEvent) {
529
+ this.$dispatch('onetomanyupdate', this.onetomany_index, this.update_onetomany_index)
530
+ } else {
531
+ this.$dispatch(this.data.onetomany[this.onetomany_index].updateEvent, this.onetomany_index, this.update_onetomany_index)
532
+ }
533
+ }
534
+
535
+ this.closemodal()
536
+ },
537
+ // 删除
538
+ delete (i, j) {
539
+ this.$showMessage('您确定要删除这条记录吗?', ['confirm']).then((res) => {
540
+ if (res === 'confirm') {
541
+ console.log("删除记录1")
542
+ console.log("删除记录1 + :" + this.data.onetomany[i].deleteEvent)
543
+
544
+ if (this.data.onetomany[i].deleteEvent === 'default' || !this.data.onetomany[i].deleteEvent) {
545
+ this.$dispatch('onetomanydelete', i, j)
546
+ } else {
547
+ this.$dispatch(this.data.onetomany[i].deleteEvent, i, j)
548
+ }
549
+ }
550
+ })
551
+ },
552
+ // 修改
553
+ update (i, j) {
554
+ let onetomany = this.data.onetomany[i]
555
+ let item = this.data.onetomany[i].rows[j]
556
+ let count = 0
557
+ for (let k = 0; k < onetomany.fields.length; k++) {
558
+ // 防止初始化的时候没有value
559
+ Vue.set(this.data.onetomany[i].fields[k], 'value', item[this.data.onetomany[i].fields[k].field])
560
+
561
+ if (onetomany.fields[j].required) {
562
+ count++
563
+ }
564
+ }
565
+ if (count === 0) {
566
+ this.disable_button_onetomany = false
567
+ }
568
+ this.modeltitle = '修改'
569
+ this.modalSize = this.data.onetomany[i].modalSize
570
+ this.onetomany_index = i
571
+ this.update_onetomany_index = j
572
+ this.show = true
573
+ },
574
+ // 添加
575
+ add (index) {
576
+ console.log("index是否有值:" + index)
577
+ let count = 0
578
+ this.data.onetomany[index].fields.forEach(item => {
579
+ if (item.type === 'datepicker') {
580
+ item.value = new Date().Format('yyyy-MM-dd')
581
+ }
582
+ if (item.required) {
583
+ count++
584
+ }
585
+ })
586
+
587
+ if (count === 0) {
588
+ this.disable_button_onetomany = false
589
+ }
590
+ this.modeltitle = '新增'
591
+ this.modalSize = this.data.onetomany[index].modalSize
592
+ this.onetomany_index = index
593
+ this.show = true
594
+ },
595
+ // 关闭模态框
596
+ closemodal (val) {
597
+ if (val === 'but'){
598
+ this.disableButton()
599
+ this.showbutmodal = false
600
+ return
601
+ }
602
+ this.data.onetomany[this.onetomany_index].fields.forEach(item => {
603
+ item.value = ''
604
+ })
605
+ this.show = false
606
+ this.disable_button_onetomany = true
607
+ this.onetomany_index = null
608
+ this.update_onetomany_index = null
609
+ this.modeltitle = null
610
+ this.modalSize = null
611
+ },
612
+
613
+ // 是否禁用模态框按钮
614
+ disableModalButton () {
615
+ let fields = this.data.onetomany[this.onetomany_index].fields
616
+
617
+ let flag = false
618
+ fields.forEach(item => {
619
+ if (item.type !== 'checkbox' && item.required && !item.value) {
620
+ flag = true
621
+ }
622
+ })
623
+
624
+ let count = 0
625
+ fields.forEach(item => {
626
+ if (item.type !== 'checkbox' && !item.required) {
627
+ count++
628
+ }
629
+ })
630
+
631
+ if (count === 0) {
632
+ flag = false
633
+ }
634
+ this.disable_button_onetomany = flag
635
+ },
636
+ // 监听模态框属性失去焦点
637
+ check_modal (index) {
638
+ this.disableModalButton()
639
+ this.$dispatch('check_modal', index)
640
+ },
641
+ // input输入属性值发生变化监听
642
+ oninput_modal (index) {
643
+ console.log('@input="oninput_modal(index)"')
644
+ this.disableModalButton()
645
+ this.$dispatch('oninput_modal', index)
646
+ }
647
+
648
+ },
649
+ events: {
650
+
651
+ }
652
+ }
653
+ </script>
654
+ <style>
655
+ .datepicker{
656
+ width: 100%!important;
657
+ }
658
+ .datepicker-input{
659
+ background-color: #ffffff!important;
660
+ width: 100%!important;
661
+ }
662
+ .datepicker-input:disabled{
663
+ border: 1px solid #DDD!important;
664
+ color: #ACA899!important;
665
+ width: 100%!important;
666
+ }
667
+ </style>
668
+ <style scoped>
669
+ th{
670
+ font-size: 15px !important;
671
+ text-align: center !important;
672
+ background-color: #dfedfb!important;
673
+ color: #666666 !important;
674
+ font-family: PINGFANG-BOLD !important;
675
+ font-weight: normal!important;
676
+ }
677
+ /*清除model中的浮动*/
678
+ .clearfix:after,.clearfix:before{
679
+ display: table;
680
+ }
681
+ .clearfix:after{
682
+ clear: both;
683
+ }
684
+
685
+ .input_view{
686
+ padding: 8px;
687
+ background-color: #ffffff;
688
+ border-radius: 2px;
689
+ border: solid 1px #c7c7c7!important;
690
+ color: #333333!important;
691
+ font-size: 15px!important;
692
+ }
693
+
694
+ .input_view[readonly]{
695
+ border: 1px solid #DDD!important;
696
+ /*background-color: #F5F5F5;*/
697
+ color:#ACA899!important;
698
+ }
699
+ .input_view:disabled{
700
+ border: 1px solid #DDD!important;
701
+ /*background-color: #F5F5F5;*/
702
+ color:#ACA899!important;
703
+ }
704
+
705
+ .control-label-justify {
706
+ display: inline-block;
707
+ vertical-align: top;
708
+ width: 110px;
709
+ text-align: justify;
710
+ font-family: PingFang-SC-Bold;
711
+ }
712
+
713
+ .control-label-justify::after {
714
+ content: "";
715
+ display: inline-block;
716
+ width: 70px;
717
+ overflow: hidden;
718
+ height: 0;
719
+ }
720
+
721
+ input::-webkit-outer-spin-button,
722
+ input::-webkit-inner-spin-button {
723
+ -webkit-appearance: none;
724
+ }
725
+
726
+ input[type="number"] {
727
+ -moz-appearance: textfield;
728
+ }
729
+
730
+ </style>