apply-clients 3.0.4 → 3.0.5-4

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