apply-clients 4.1.66 → 4.1.70

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