askbot-dragon 0.7.92 → 0.7.93

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.
@@ -6,31 +6,32 @@
6
6
  </div>
7
7
  <div class="title-link"></div>
8
8
  <div class="pcFormClass" v-if="isCompany">
9
- <div v-for="(item) in formShow.form.formFieldRelation"
10
- :key="item.formField.id"
11
- :class="{notClick:disableds === true}"
12
- >
13
- <div v-if="item.formField.type!=='CHAT_RECORD'&&item.formField.type!=='CHANNEL'&&item.display&&item.fieldId!=='workorder_name'" class="field-item">
14
- <div v-if="item.display&&item.fieldId!=='workorder_name'&&item.formField.type!=='EXPLANATION'&&item.formField.type!=='EXPLAIN'" class="field-item-name">
9
+ <div v-for="(item) in formFieldRelation"
10
+ :key="item.fieldId"
11
+ :class="{notClick:disableds === true}"
12
+ >
13
+ <div class="field-item">
14
+ <div v-if="item.fieldId !== 'workorder_name' && item.formField.type !== 'EXPLANATION' && item.formField.type !== 'EXPLAIN' " class="field-item-name">
15
15
  <span v-if="item.fieldId!=='workorder_description'&&item.fieldId!=='workorder_clientId'">{{item.formField.name}}</span>
16
16
  <span v-if="item.fieldId==='workorder_description'">问题描述</span>
17
17
  <span v-if="item.fieldId==='workorder_clientId'">报单人</span>
18
- <span style="color: red;padding-left: 5px" v-if="item.required===true">*</span>
18
+ <span style="color: red;padding-left: 5px" v-if="item.required || isRequiredFn(item.formField)">*</span>
19
19
  </div>
20
- <el-input v-model=item.value
20
+ <!-- item.value -->
21
+ <el-input v-model="item.value"
21
22
  :placeholder="item.formField.extInfo&&item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请输入'"
22
23
  :maxlength="item.formField.extInfo&&item.formField.extInfo.maxNum?item.formField.extInfo.maxNum*1:1000"
23
- v-if="item.formField.type==='INPUT'&&item.fieldId!=='workorder_name'"
24
+ v-else-if="item.formField.type==='INPUT'&&item.fieldId!=='workorder_name'"
24
25
  ></el-input>
25
- <div v-if="item.formField.type==='EXPLANATION'">
26
+ <template v-else-if="item.formField.type==='EXPLANATION'">
26
27
  <div class="explanation">
27
28
  <p class="explanation-p">
28
29
  <span class="el-icon-info"></span>
29
30
  {{item.formField.extInfo.descriptionText}}
30
31
  </p>
31
32
  </div>
32
- </div>
33
- <div v-if="item.formField.type==='EXPLAIN'">
33
+ </template>
34
+ <template v-else-if="item.formField.type==='EXPLAIN'">
34
35
  <div class="explanation">
35
36
  <p class="explanation-p">
36
37
  <span class="el-icon-info"></span>
@@ -38,31 +39,31 @@
38
39
  <span v-else>{{item.value}}</span>
39
40
  </p>
40
41
  </div>
41
- </div>
42
- <el-input type="textarea" :rows="2" v-model=item.value
42
+ </template>
43
+ <el-input type="textarea" :rows="2" v-model="fieldValus[item.fieldId]"
43
44
  :placeholder="item.formField.extInfo&&item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请输入'"
44
45
  :maxlength="item.formField.extInfo&&item.formField.extInfo.maxNum?item.formField.extInfo.maxNum*1:1000"
45
- v-if="item.formField.type==='TEXTAREA'&& item.display&&item.fieldId!=='workorder_description'"
46
+ v-if="item.formField.type==='TEXTAREA'&& item.fieldId!=='workorder_description'"
46
47
  ></el-input>
47
48
  <ckeditor
48
49
  :editor="ckeditor.editor"
49
50
  v-model="item.value"
50
51
  :config="ckeditor.editorConfig"
51
- v-else-if="item.display&&item.fieldId==='workorder_description'"
52
+ v-else-if="item.fieldId==='workorder_description'"
52
53
  ></ckeditor>
53
54
  <el-date-picker
54
55
  v-model=item.value
55
56
  type="date"
56
57
  :placeholder="item.formField.extInfo&&item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请选择日期'"
57
58
  style="width: 100%"
58
- v-if="item.formField.type==='DATE_PICKER'"
59
+ v-else-if="item.formField.type==='DATE_PICKER'"
59
60
  >
60
61
  </el-date-picker>
61
62
  <el-time-picker
62
63
  v-model=item.value
63
64
  :placeholder="item.formField.extInfo&&item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请选择时间'"
64
65
  style="width: 100%"
65
- v-if="item.formField.type==='TIME_PICKER' && !item.formField.extInfo.mold"
66
+ v-else-if="item.formField.type==='TIME_PICKER' && (!item.formField.extInfo.mold || item.formField.extInfo.mold == 'TIME' || getMoldTime(item.formField) == 'TIME')"
66
67
  >
67
68
  </el-time-picker>
68
69
  <el-date-picker
@@ -70,7 +71,7 @@
70
71
  type="date"
71
72
  style="width: 100%"
72
73
  :placeholder="item.formField.extInfo&&item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请选择日期'"
73
- v-if="item.formField.type==='TIME_PICKER' &&item.formField.extInfo.mold==='DATA'"
74
+ v-else-if="item.formField.type==='TIME_PICKER' && (item.formField.extInfo.mold==='DATA' || item.formField.extInfo.mold==='DATE' || getMoldTime(item.formField) == 'DATE')"
74
75
  >
75
76
  </el-date-picker>
76
77
  <el-date-picker
@@ -79,20 +80,20 @@
79
80
  clearable
80
81
  style="width: 100%"
81
82
  type="datetime"
82
- v-if="item.formField.type==='TIME_PICKER' &&item.formField.extInfo.mold==='DATA_TIME'"
83
+ v-else-if="item.formField.type==='TIME_PICKER' && (item.formField.extInfo.mold==='DATA_TIME' || item.formField.extInfo.mold==='DATE_TIME' || getMoldTime(item.formField) == 'DATE_TIME')"
83
84
  >
84
85
  </el-date-picker>
85
- <div v-if="item.formField.type==='RADIO' &&item.formField.extInfo.options">
86
+ <div v-else-if="item.formField.type==='RADIO' &&item.formField.extInfo.options">
86
87
  <el-radio-group v-model=item.value style="text-align:left">
87
88
  <el-radio v-for="(items,index) in item.formField.extInfo.options" :label=items.value :key="index">{{items.label}}</el-radio>
88
89
  </el-radio-group>
89
90
  </div>
90
- <div v-if="item.formField.type==='RADIO' &&item.formField.extInfo.option">
91
+ <div v-else-if="item.formField.type==='RADIO' &&item.formField.extInfo.option">
91
92
  <el-radio-group v-model=item.value style="text-align:left">
92
93
  <el-radio v-for="(items,index) in item.formField.extInfo.option" :label=items.value :key="index">{{items.label}}</el-radio>
93
94
  </el-radio-group>
94
95
  </div>
95
- <div v-if="item.formField.type==='CHECKBOX' && item.formField.extInfo.option">
96
+ <div v-else-if="item.formField.type==='CHECKBOX' && item.formField.extInfo.option">
96
97
  <el-checkbox-group v-model=item.value style="text-align:left">
97
98
  <el-checkbox
98
99
  v-for="(items,index) in item.formField.extInfo.option"
@@ -101,7 +102,7 @@
101
102
  >{{items.label}}</el-checkbox>
102
103
  </el-checkbox-group>
103
104
  </div>
104
- <div v-if="item.formField.type==='CHECKBOX' && item.formField.extInfo.options">
105
+ <div v-else-if="item.formField.type==='CHECKBOX' && item.formField.extInfo.options">
105
106
  <el-checkbox-group v-model=item.value style="text-align:left">
106
107
  <el-checkbox
107
108
  v-for="(items,index) in item.formField.extInfo.options"
@@ -110,8 +111,8 @@
110
111
  >{{items.label}}</el-checkbox>
111
112
  </el-checkbox-group>
112
113
  </div>
113
- <div v-if="item.formField.type==='SELECT' || item.formField.type==='OPTION'" >
114
- <el-select
114
+ <div v-else-if="item.formField.type==='SELECT' || item.formField.type==='OPTION'" >
115
+ <!-- <el-select
115
116
  v-model=item.value
116
117
  :placeholder="item.formField.extInfo&&item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请选择'"
117
118
  style="width: 100%"
@@ -138,59 +139,124 @@
138
139
  :label="items.label"
139
140
  :value="items.value">
140
141
  </el-option>
142
+ </el-select>-->
143
+ <el-select
144
+ v-model=item.value
145
+ :placeholder="item.formField.extInfo&&item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请选择'"
146
+ style="width: 100%"
147
+ filterable
148
+ v-if="item.formField.extInfo && item.formField.extInfo.option"
149
+ >
150
+ <el-option
151
+ v-for="(items,index) in item.formField.extInfo.option"
152
+ :key="index"
153
+ :label="items.label"
154
+ :value="items.value">
155
+ </el-option>
141
156
  </el-select>
157
+ <div class="cascader-input" v-else @click="openDrawer(item,'select')">
158
+ <template v-if="item.value && (!Array.isArray(item.value) || (Array.isArray(item.value) && item.value.length))">
159
+ <template v-if="Array.isArray(item.value)">
160
+ <span v-for="(select,selectIndex) in item.value" :key="selectIndex">
161
+ {{selectIndex==0?select:','+select}}
162
+ </span>
163
+ </template>
164
+ <template v-else>{{item.value}}</template>
165
+ </template>
166
+ <span v-else>{{item.formField.extInfo&&item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请选择'}}</span>
167
+ </div>
142
168
  </div>
143
- <div v-if="item.formField.type==='CASCADER'">
144
- <el-cascader
169
+ <template v-else-if="item.formField.type==='CASCADER'">
170
+ <div class="cascader-input" @click="openDrawer(item,'pc_cascader')">
171
+ <template v-if="checkDatas[item.fieldId] && (Array.isArray(checkDatas[item.fieldId]) && checkDatas[item.fieldId].length > 0)">
172
+ <span v-for="(cas,casIndex) in checkDatas[item.fieldId]" :key="casIndex">
173
+ {{casIndex==0?cas.label:'/'+cas.label}}
174
+ </span>
175
+ </template>
176
+ <span v-else>{{item.formField.extInfo&&item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请选择'}}</span>
177
+ </div>
178
+ <!-- <el-cascader
145
179
  v-model=item.value
146
180
  :options=item.formField.extInfo.cascade
147
181
  style="width: 100%;"
148
182
  :placeholder="item.formField.extInfo&&item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请选择'"
149
183
  v-if="item.formField.extInfo.cascade"
184
+ ></el-cascader>
185
+ <el-cascader
186
+ v-model=item.value
187
+ :options="item.formField.extInfo.cascadeDown.options"
188
+ style="width: 100%;"
189
+ :placeholder="item.formField.extInfo&&item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请选择时间'"
190
+ v-else-if="Object.prototype.toString.call(item.formField.extInfo.cascadeDown) === '[object Object]'"
150
191
  ></el-cascader>
151
192
  <el-cascader
152
193
  v-model=item.value
153
194
  :options=setOptions(item.formField.extInfo)
154
195
  style="width: 100%;"
155
196
  :placeholder="item.formField.extInfo&&item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请选择'"
156
- v-else-if="item.formField.extInfo.cascadeDown"
157
- ></el-cascader>
158
- </div>
159
- <div v-if="item.formField.type==='FILE'">
160
- <div @click="checkUpload(item.fieldId,item.formField.extInfo.limitNum)" @mouseover="checkUpload(item.fieldId,item.formField.extInfo.limitNum)" style="flex: 0.75;display:flex;align-items: center;">
197
+ v-else-if="item.formField.extInfo.cascadeDown.length != 0"
198
+ ></el-cascader>-->
199
+ </template>
200
+ <div v-else-if="item.formField.type==='FILE' || item.formField.type === 'IMAGE' || item.formField.type === 'ATTACHMENT' || item.formField.type === 'VIDEO'">
201
+ <div @click="checkUpload(item.fieldId,item.formField.extInfo)" @mouseover="checkUpload(item.fieldId,item.formField.extInfo)" style="flex: 0.75;display:flex;align-items: center;">
161
202
  <el-upload
162
203
  class="upload-demo"
163
204
  ref="upload"
164
- list-type="picture-card"
165
- accept="image/*"
205
+ :list-type="item.formField.type === 'IMAGE'?'picture-card':''"
206
+ :accept="acceptFieldType(item.formField.type)"
166
207
  name="file"
167
208
  action="/open/media/file/upload"
168
209
  :multiple="item.formField.extInfo&&item.formField.extInfo.limitNum&&item.formField.extInfo.limitNum>1?true:false"
169
210
  :file-list="fileListList[item.fieldId]"
170
- :limit=item.formField.extInfo.limitNum?Number(item.formField.extInfo.limitNum):1
171
- :before-upload="beforeAvatarUpload"
211
+ :limit="item.formField.extInfo.limitNum?Number(item.formField.extInfo.limitNum):(item.formField.extInfo.limit ? Number(item.formField.extInfo.limit) : 1)"
212
+ :before-upload="(file=>{return beforeAvatarUpload(file,item.formField.type)})"
172
213
  :on-exceed="exceedUpload"
173
214
  :on-remove="handleRemove"
174
215
  :http-request="aliyunOssRequest"
175
216
  :on-change="handleEditChange"
176
217
  :on-success="successUpload"
177
218
  >
178
- <i class="el-icon-plus"></i>
219
+ <i class="el-icon-plus"></i>
220
+ <!-- <el-button size="small" type="primary" v-else class="uploadBtn">点击上传</el-button>-->
179
221
  </el-upload>
180
222
  </div>
181
223
  </div>
224
+ <div v-else-if="item.formField.type == 'REF_TEMPLATE' || item.formField.type == 'REF'">
225
+ <el-select
226
+ v-model=item.value
227
+ :placeholder="item.formField.extInfo&&item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请选择'"
228
+ style="width: 100%"
229
+ filterable
230
+ :multiple="item.formField.extInfo && item.formField.extInfo.selectType == '多选'"
231
+ @visible-change="(visible) =>{ return refTemplateVisibleChange(visible,item) }"
232
+ >
233
+ <template v-for="(items,index) in refTemplateList[item.fieldId]">
234
+ <el-option
235
+ v-if="refTemplateList[item.fieldId]"
236
+ :key="index"
237
+ :label="items.label"
238
+ :value="items.value">
239
+ </el-option>
240
+ </template>
241
+ <div
242
+ @click="lodeMore(item)"
243
+ style="widht:100%;height:30px;display:flex;align-items: center;justify-content: center;color:#606266">
244
+ 加载更多
245
+ </div>
246
+ </el-select>
247
+ </div>
182
248
  </div>
183
249
  </div>
184
250
  </div>
185
251
  <div class="mobileFormClass" v-else style="padding: 10px 0;" :class="{notClick:disableds === true}">
186
- <div v-for="(item,index) in formFieldRelation"
187
- :key="item.formField.id"
252
+ <div v-for="(item) in formFieldRelation"
253
+ :key="item.fieldId"
188
254
  class="form-field-item"
189
- >
255
+ >
190
256
  <div v-if="item.formField.type==='INPUT'" class="form-field-item-value">
191
257
  <van-field v-model=item.value
192
258
  :label=item.formField.name
193
- :required="item.required===true"
259
+ :required="item.required || isRequiredFn(item.formField)"
194
260
  :disabled="disableds"
195
261
  :placeholder="item.formField.extInfo&&item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请输入'"
196
262
  :maxlength="item.formField.extInfo&&item.formField.extInfo.maxNum?item.formField.extInfo.maxNum*1:1000"
@@ -212,7 +278,7 @@
212
278
  <div v-else-if="item.formField.type==='TEXTAREA'" class="form-field-item-value">
213
279
  <van-field v-model=item.value
214
280
  :label=item.formField.name
215
- :required="item.required===true"
281
+ :required="item.required || isRequiredFn(item.formField)"
216
282
  type="textarea"
217
283
  :disabled="disableds"
218
284
  :placeholder="item.formField.extInfo&&item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请输入'"
@@ -220,8 +286,8 @@
220
286
  v-if="item.fieldId!=='workorder_description'"
221
287
  />
222
288
  <div v-if="item.fieldId==='workorder_description'" class="workorder_description">
223
- <div class="field-name" :class="item.required?'required-name':''">
224
- <span v-if="item.required" style="color: red">*</span>
289
+ <div class="field-name" :class="item.required || isRequiredFn(item.formField)?'required-name':''">
290
+ <span v-if="item.required || isRequiredFn(item.formField)" style="color: red">*</span>
225
291
  {{item.formField.name}}
226
292
  </div>
227
293
  <ckeditor
@@ -240,67 +306,93 @@
240
306
  :value=dateValue[item.fieldId]
241
307
  :label=item.formField.name
242
308
  :placeholder="item.formField.extInfo&&item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请选择日期'"
243
- :required="item.required===true"
309
+ :required="item.required || isRequiredFn(item.formField)"
244
310
  @click="dateClick(item.fieldId)"
245
311
  :disabled="disableds"
246
312
  right-icon="van-icon van-icon-arrow van-cell__right-icon"
247
313
  />
248
314
  <van-calendar
249
315
  v-model="showCalendar"
250
- @confirm="onConfirmCalendar($event,dateId)"
316
+ @confirm="onConfirmCalendar($event,item)"
251
317
  />
252
318
  </div>
253
- <div v-else-if="item.formField.type==='TIME_PICKER'&&(!item.formField.extInfo.mold||item.formField.extInfo.mold==='DATA_TIME')" class="form-field-item-value">
319
+ <div v-else-if="item.formField.type==='TIME_PICKER'&&(!item.formField.extInfo.mold||item.formField.extInfo.mold==='DATA_TIME' || item.formField.extInfo.mold==='DATE_TIME' || getMoldTime(item.formField) == 'DATE_TIME')" class="form-field-item-value">
254
320
  <van-field
255
321
  readonly
256
322
  clickable
257
323
  name="datetimePicker"
258
- :required="item.required===true"
324
+ :required="item.required || isRequiredFn(item.formField)"
259
325
  :value=timeValue[item.fieldId]
260
326
  :label=item.formField.name
261
- :placeholder="item.formField.extInfo&&item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请选择时间'"
262
- @click="timeClick(item.fieldId,item)"
327
+ :placeholder="item.formField.extInfo&&item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请选择'"
328
+ @click="timeClick(item.fieldId,item,'DATE_TIME')"
263
329
  :disabled="disableds"
264
330
  right-icon="van-icon van-icon-arrow van-cell__right-icon"
265
331
 
266
332
  />
267
- <van-popup v-model="showTimePicker" position="bottom">
333
+ <van-popup v-model="dateTimePicker" position="bottom">
268
334
  <van-datetime-picker
269
335
  v-model="currentDate"
270
336
  type="datetime"
271
- @confirm="onConfirm($event,timeId,item)"
272
- @cancel="showTimePicker = false"
337
+ @confirm="onConfirm($event,item.fieldId,item,'DATE_TIME')"
338
+ @cancel="dateTimePicker = false"
273
339
  :min-date="minDate"
274
340
  :formatter="formatter"
275
341
  :max-date="maxDate"
276
342
  />
277
343
  </van-popup>
278
344
  </div>
279
- <div v-else-if="item.formField.type==='TIME_PICKER'&&item.formField.extInfo.mold==='DATA'" class="form-field-item-value">
345
+ <div v-else-if="item.formField.type==='TIME_PICKER'&&(!item.formField.extInfo.mold || item.formField.extInfo.mold==='TIME' || getMoldTime(item.formField) == 'TIME')" class="form-field-item-value">
346
+ <van-field
347
+ readonly
348
+ clickable
349
+ name="datetimePicker"
350
+ :required="item.required || isRequiredFn(item.formField)"
351
+ :value=timeValue[item.fieldId]
352
+ :label=item.formField.name
353
+ :placeholder="item.formField.extInfo&&item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请选择'"
354
+ @click="timeClick(item.fieldId,item,'TIME')"
355
+ :disabled="disableds"
356
+ right-icon="van-icon van-icon-arrow van-cell__right-icon"
357
+
358
+ />
359
+ <van-popup v-model="timePicker" position="bottom">
360
+ <van-datetime-picker
361
+ v-model="currentTime"
362
+ type="time"
363
+ title="选择时间"
364
+ :min-hour="0"
365
+ :max-hour="23"
366
+ @confirm="onConfirm($event,item.fieldId,item,'TIME')"
367
+ @cancel="timePicker = false"
368
+ />
369
+ </van-popup>
370
+ </div>
371
+ <div v-else-if="item.formField.type==='TIME_PICKER'&&(item.formField.extInfo.mold==='DATA' || item.formField.extInfo.mold==='DATE' || getMoldTime(item.formField) == 'DATE')" class="form-field-item-value">
280
372
  <van-field
281
373
  readonly
282
374
  clickable
283
375
  name="datetimePicker"
284
- :required="item.required===true"
376
+ :required="item.required || isRequiredFn(item.formField)"
285
377
  :value=timeValue[item.fieldId]
286
378
  :label=item.formField.name
287
- :placeholder="item.formField.extInfo&&item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请选择日期'"
288
- @click="timeClick(item.fieldId,item)"
379
+ :placeholder="item.formField.extInfo&&item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请选择'"
380
+ @click="timeClick(item.fieldId,item,'DATE')"
289
381
  :disabled="disableds"
290
382
  right-icon="van-icon van-icon-arrow van-cell__right-icon"
291
383
 
292
384
  />
293
- <van-calendar v-model="showTimePickerd" :show-confirm="false" @confirm="onConfirm($event,timeId,item)" @cancel="showTimePickerd = false"/>
385
+ <van-calendar v-model="datePicker" :show-confirm="false" @confirm="onConfirm($event,item.fieldId,item,'DATE')" @cancel="datePicker = false"/>
294
386
  </div>
295
387
  <div v-else-if="item.formField.type==='RADIO'" class="form-field-item-other">
296
- <van-field name="radio" :label="item.formField.name" :required="item.required===true" :disabled="disableds" v-if="item.formField.extInfo.option">
388
+ <van-field name="radio" :label="item.formField.name" :required="item.required || isRequiredFn(item.formField)" :disabled="disableds" v-if="item.formField.extInfo.option">
297
389
  <template #input style="display: flex;align-items: center">
298
390
  <van-radio-group v-model=item.value direction="horizontal" :disabled="disableds">
299
391
  <van-radio v-for="(items,index) in item.formField.extInfo.option" :name=items.value :key="index">{{items.label}}</van-radio>
300
392
  </van-radio-group>
301
393
  </template>
302
394
  </van-field>
303
- <van-field name="radio" :label="item.formField.name" :required="item.required===true" :disabled="disableds" v-if="item.formField.extInfo.options">
395
+ <van-field name="radio" :label="item.formField.name" :required="item.required || isRequiredFn(item.formField)" :disabled="disableds" v-if="item.formField.extInfo.options">
304
396
  <template #input style="display: flex;align-items: center" >
305
397
  <van-radio-group v-model=item.value direction="horizontal" :disabled="disableds">
306
398
  <van-radio v-for="(items,index) in item.formField.extInfo.options" :name=items.value :key="index">{{items.label}}</van-radio>
@@ -309,7 +401,7 @@
309
401
  </van-field>
310
402
  </div>
311
403
  <div v-else-if="item.formField.type==='CHECKBOX'" class="form-field-item-other">
312
- <van-field name="checkbox" :label=item.formField.name :required="item.required===true" :disabled="disableds" v-if="item.formField.extInfo.option">
404
+ <van-field name="checkbox" :label=item.formField.name :required="item.required || isRequiredFn(item.formField)" :disabled="disableds" v-if="item.formField.extInfo.option">
313
405
  <template #input style="display: flex;align-items: center" >
314
406
  <van-checkbox-group v-model=item.value ref="checkboxGroup" direction="horizontal" :disabled="disableds">
315
407
  <van-checkbox
@@ -322,7 +414,7 @@
322
414
  </van-checkbox-group>
323
415
  </template>
324
416
  </van-field>
325
- <van-field name="checkbox" :label=item.formField.name :required="item.required===true" :disabled="disableds" v-if="item.formField.extInfo.options">
417
+ <van-field name="checkbox" :label=item.formField.name :required="item.required || isRequiredFn(item.formField)" :disabled="disableds" v-if="item.formField.extInfo.options">
326
418
  <template #input style="display: flex;align-items: center" >
327
419
  <van-checkbox-group v-model=item.value ref="checkboxGroup" direction="horizontal" :disabled="disableds">
328
420
  <van-checkbox
@@ -337,86 +429,127 @@
337
429
  </van-field>
338
430
  </div>
339
431
  <div v-else-if="item.formField.type==='SELECT' || item.formField.type==='OPTION'" class="form-field-item-value">
340
- <van-field
432
+ <template v-if="item.fieldId==='workorder_clientId' || item.fieldId === 'workorder_statusId' || item.fieldId === 'workorder_priority'">
433
+ <van-field
434
+ readonly
435
+ clickable
436
+ name="picker"
437
+ :value=selectValues[item.fieldId]
438
+ :label="item.fieldId==='workorder_clientId'?'报单人':item.formField.name"
439
+ :placeholder="item.formField.extInfo&&item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请选择'"
440
+ @click="selectClick(item.fieldId,'client',item)"
441
+ :required="item.required || isRequiredFn(item.formField)"
442
+ :disabled="disableds"
443
+ @click-right-icon.stop="SelectClear(item.fieldId)"
444
+ :right-icon="selectValues[item.fieldId]? 'close' : 'van-icon van-icon-arrow van-cell__right-icon'"
445
+ />
446
+ <van-popup v-model="showPicker" position="bottom">
447
+ <van-picker
448
+ show-toolbar
449
+ :columns=selectValue
450
+ @confirm="onConfirmSelect($event,item)"
451
+ @cancel="showPicker = false"
452
+ :key="selectKey"
453
+
454
+ />
455
+ </van-popup>
456
+ </template>
457
+ <template v-else>
458
+ <van-field
459
+ readonly
460
+ clickable
461
+ name="picker"
462
+ :value="Array.isArray(item.value)?item.value.join(','):item.value"
463
+ :label=item.formField.name
464
+ :placeholder="item.formField.extInfo&&item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请选择'"
465
+ @click="selectClick(item.fieldId,'select',item)"
466
+ :required="item.required || isRequiredFn(item.formField)"
467
+ :disabled="disableds"
468
+ @click-right-icon.stop="SelectClear(item.fieldId)"
469
+ :right-icon="selectValues[item.fieldId]? 'close' : 'van-icon van-icon-arrow van-cell__right-icon'"
470
+ />
471
+ <van-popup v-model="selectPicker" position="bottom" :style="{ height: '300px' }">
472
+ <select-popup
473
+ :options="item.formField.extInfo.option?item.formField.extInfo.option:item.formField.extInfo.options"
474
+ :defaultValue="defaultValue"
475
+ @onConfim="confirmSelect"
476
+ @onclose= "selectPicker = false"
477
+ :multiple="item.formField.extInfo && item.formField.extInfo.selectType ==='多选'?true:false"
478
+ ref="selectPopup"
479
+ :props="{
480
+ value:'value',
481
+ label:'label'
482
+ }"
483
+ ></select-popup>
484
+ </van-popup>
485
+ </template>
486
+ </div>
487
+ <div v-if="item.formField.type === 'REF_TEMPLATE' || item.formField.type === 'REF'" class="form-field-item-value">
488
+ <van-field
341
489
  readonly
342
490
  clickable
491
+ :value="Array.isArray(selectValues[item.fieldId])?selectValues[item.fieldId].join(','):selectValues[item.fieldId]"
492
+ :label="item.formField.name"
343
493
  name="picker"
344
- :value=selectValues[item.fieldId]
345
- :label=item.formField.name
346
494
  :placeholder="item.formField.extInfo&&item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请选择'"
347
- @click="selectClick(item.fieldId)"
348
- :required="item.required===true"
349
- :disabled="disableds"
495
+ @click="selectClick(item.fieldId,'ref',item)"
350
496
  @click-right-icon.stop="SelectClear(item.fieldId)"
351
- v-if="item.fieldId!=='workorder_clientId'"
352
- :right-icon="selectValues[item.fieldId]? 'close' : 'van-icon van-icon-arrow van-cell__right-icon'"
353
- />
354
- <van-field
355
- readonly
356
- clickable
357
- name="picker"
358
- :value=selectValues[item.fieldId]
359
- label='报单人'
360
- :placeholder="item.formField.extInfo&&item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请选择'"
361
- @click="selectClick(item.fieldId)"
362
- :required="item.required===true"
497
+ :required="item.required || isRequiredFn(item.formField)"
363
498
  :disabled="disableds"
364
- @click-right-icon.stop="SelectClear(item.fieldId)"
365
- v-if="item.fieldId==='workorder_clientId'"
366
499
  :right-icon="selectValues[item.fieldId]? 'close' : 'van-icon van-icon-arrow van-cell__right-icon'"
367
- />
368
- <van-popup v-model="showPicker" position="bottom">
369
- <van-picker
370
- show-toolbar
371
- :columns=selectValue
372
- @confirm="onConfirmSelect($event,selectId)"
373
- @cancel="showPicker = false"
374
- :key="selectKey"
375
-
376
500
  />
377
- </van-popup>
378
- </div>
501
+ <van-popup v-model="refShowPicker" position="bottom" :style="{ height: '300px' }">
502
+ <select-popup
503
+ :options="refTemplateList[item.fieldId]"
504
+ :defaultValue="defaultValue"
505
+ @onConfim="confirmRefSelect"
506
+ @onclose= "refShowPicker = false"
507
+ :multiple="detailField.formField.extInfo && detailField.formField.extInfo.selectType ==='多选'?true:false"
508
+ ref="selectPopup"
509
+ :props="{
510
+ value:'id',
511
+ label:'name'
512
+ }"
513
+ >
514
+ </select-popup>
515
+ </van-popup>
516
+ </div>
379
517
  <div v-else-if="item.formField.type==='CASCADER'" class="form-field-item-value">
380
518
  <van-field
381
519
  readonly
382
520
  clickable
383
521
  name="area"
384
- :value=cascadeValue[item.fieldId]
522
+ :value="checkDatas[item.fieldId] && Array.isArray(checkDatas[item.fieldId])?checkDatas[item.fieldId].map(e=>e.label).join(','):''"
385
523
  :label=item.formField.name
386
524
  :placeholder="item.formField.extInfo&&item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请选择'"
387
- @click="pickerClick(item.fieldId)"
388
- :required="item.required===true"
525
+ @click="openDrawer(item,'cascader')"
526
+ :required="item.required || isRequiredFn(item.formField)"
389
527
  :disabled="disableds"
390
528
  right-icon="van-icon van-icon-arrow van-cell__right-icon"
391
529
  />
392
530
 
393
- <van-popup v-model="showArea" position="bottom">
394
- <van-picker v-if="pageShow"
395
- show-toolbar
396
- :columns="column"
397
- @cancel="onCancel"
398
- @confirm="onConfirms($event,pickerId,index)"
399
- @change="onChange"
400
- :item-height="45"
401
- :key="keyValue"
402
- />
531
+ <van-popup v-model="showArea" position="bottom" :style="{ height: '400px' }">
532
+ <tree ref="drawerTree"
533
+ :dataOptions="item.formField"
534
+ @saveData="saveData"
535
+ @cancelBtn="showArea = false"
536
+ ></tree>
403
537
  </van-popup>
404
538
  </div>
405
- <div v-else-if="item.formField.type === 'FILE'" class="form-field-item-value">
406
- <div @click="checkUpload(item.fieldId,item.formField.extInfo.limitNum)" class="form-field-item-file">
407
- <div class="fileName"><span style="color: red" v-if="item.required">*</span>{{item.formField.name}}</div>
539
+ <div v-else-if="item.formField.type === 'FILE' || item.formField.type === 'IMAGE' || item.formField.type === 'ATTACHMENT' || item.formField.type === 'VIDEO'" class="form-field-item-value">
540
+ <div @click="checkUpload(item.fieldId,item.formField.extInfo)" class="form-field-item-file">
541
+ <div class="fileName"><span style="color: red" v-if="item.required || isRequiredFn(item.formField)">*</span>{{item.formField.name}}</div>
408
542
  <van-uploader
409
543
  v-model="fileListList[item.fieldId]"
410
- :before-read="beforeRead"
411
- :max-count='item.formField.extInfo&&item.formField.extInfo.limitNum?item.formField.extInfo.limitNum:1'
544
+ :before-read="(file=>{return beforeRead(file,item.formField.type)})"
545
+ :max-count='item.formField.extInfo&&item.formField.extInfo.limitNum ? item.formField.extInfo.limitNum : (item.formField.extInfo.limit ? item.formField.extInfo.limit : 1)'
412
546
  :after-read="afterRead"
413
- accept="image/*"
547
+ :accept="acceptFieldType(item.formField.type)"
414
548
  :multiple="item.formField.extInfo&&item.formField.extInfo.limitNum&&item.formField.extInfo.limitNum>1?true:false"
415
549
  >
416
550
  <div class="vant-upload--picture-card">
417
551
  <i class="el-icon-plus"></i>
418
552
  </div>
419
-
420
553
  </van-uploader>
421
554
  </div>
422
555
  </div>
@@ -444,18 +577,53 @@
444
577
  <el-dialog :visible.sync="dialogVisible">
445
578
  <img width="100%" :src="dialogImageUrl" alt="">
446
579
  </el-dialog>
447
-
580
+ <el-drawer
581
+ :withHeader="false"
582
+ :visible.sync="drawer"
583
+ size="60%"
584
+ direction="btt">
585
+ <div class="drawer-container">
586
+ <tree ref="drawerTree"
587
+ :dataOptions="detailField.formField"
588
+ @saveData="saveData"
589
+ @cancelBtn="drawer = false"
590
+ ></tree>
591
+ </div>
592
+ </el-drawer>
593
+ <el-drawer
594
+ :withHeader="false"
595
+ :visible.sync="selectPopUp"
596
+ size="40%"
597
+ direction="btt"
598
+ >
599
+ <select-popup
600
+ :options="options"
601
+ :defaultValue="defaultValue"
602
+ @onConfim="confirmSelect"
603
+ :multiple="detailField.formField.extInfo && detailField.formField.extInfo.selectType ==='多选'?true:false"
604
+ ref="selectPopup"
605
+ :props="{
606
+ value:'label',
607
+ label:'value'
608
+ }"
609
+ ></select-popup>
610
+ </el-drawer>
448
611
  </div>
449
612
  </template>
450
613
 
451
614
  <script>
452
615
  /* eslint-disable */
616
+ import { forMatTime } from "./utils/format_date";
617
+
453
618
  let that
454
619
  import {multipartUpload,ossFileUrl} from "./utils/AliyunIssUtil";
455
620
  import {MyCustomUploadAdapterPlugin} from "./utils/ckeditor";
456
621
  import MyimageUpload from './utils/plugin-image'
457
622
  import CKEDITOR from 'ckeditor'
458
623
 
624
+ import myPopup from "./myPopup.vue";
625
+ import Tree from '../components/tree'
626
+ import selectPopup from '../components/popup'
459
627
  export default {
460
628
  name: "formTemplate",
461
629
  data() {
@@ -464,11 +632,14 @@ export default {
464
632
  isCompany: false,
465
633
  checkboxGroup: [],
466
634
  currentDate: new Date(),
635
+ currentTime:"",
636
+ timePicker:false,
467
637
  timeValue: [],
468
638
  dateValue: [],
469
639
  showPicker: false,
470
- showTimePicker: false,
471
- showTimePickerd:false,
640
+ selectPicker:false,
641
+ dateTimePicker: false,
642
+ datePicker:false,
472
643
  showCalendar: false,
473
644
  radio: [],
474
645
  selectValue: [],
@@ -512,13 +683,12 @@ export default {
512
683
  copyForm: [],
513
684
  cascaderId:0,
514
685
  formShow:[],
515
-
516
686
  uploadAvatarParams: {
517
687
  token: "8c98087dfd2d48f856d8c95c09115def",
518
688
  },
519
689
  fileListList:[],
520
690
  keyValue:'',
521
- selectKey:'shuijiao',
691
+ selectKey:'',
522
692
  filedId:'',
523
693
  disabled:false,
524
694
  dialogVisible:false,
@@ -547,7 +717,20 @@ export default {
547
717
  ]
548
718
  },
549
719
  },
550
-
720
+ refShowPicker:false,
721
+ refTemplateList:{},
722
+ refList:{},
723
+ dataQuery:{},
724
+ drawer:false,
725
+ detailField:{
726
+ formField:{}
727
+ },
728
+ checkDatas:[],
729
+ selectPopUp:false,
730
+ options:[],
731
+ defaultValue:[],
732
+ timeDetailData:{},
733
+ selectDetail:{}
551
734
  }
552
735
  },
553
736
  props: {
@@ -589,16 +772,59 @@ export default {
589
772
  acceptType:function () {
590
773
  return '.jpg,.jpeg,.png,.gif,.JPG,.JPEG,.PBG,.GIF'
591
774
  },
592
- formFieldRelation:function (){
775
+ formFieldRelation:function () {
593
776
  let arr = [];
594
- this.formShow.form.formFieldRelation.forEach(item=> {
595
- if (item.fieldId!=='workorder_name'&&item.display) {
777
+ let formList = []
778
+ formList = this.formShow.form && this.formShow.form.formFieldRelation
779
+ formList.forEach(item=> {
780
+ if (item.fieldId !=='workorder_name' && item.display && item.formField.type!=='CHAT_RECORD' && item.formField.type!=='CHANNEL') {
596
781
  arr.push(item);
597
782
  }
598
783
  })
599
- return arr;
784
+ arr.forEach(item=>{
785
+ this.$set(item,'relationDisplay',this.relationSet(item.formField,'dependentFieldId'))
786
+ if(item.formField.type === 'CHECKBOX'){
787
+ if(!item.value){
788
+ item.value = []
789
+ }
790
+ if(item.formField.defaultValue && (!item.value || !item.value.length)){
791
+ item.value = item.formField.defaultValue
792
+ }
793
+ }
794
+ if (item.formField.type === 'EXPLAIN'){
795
+ if (!item.value){
796
+ item.value = item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:''
797
+ }
798
+ }
799
+ })
800
+ let newArr = arr.filter(item=>item.relationDisplay)
801
+ console.debug('arr',arr,newArr)
802
+ return newArr;
803
+ },
804
+ acceptFieldType(){
805
+ return (type)=>{
806
+ console.debug('type',type)
807
+ if (type == 'FILE'){
808
+ return '*'
809
+ } else if( type == 'IMAGE') {
810
+ return 'image/*'
811
+ } else if(type == 'VIDEO') {
812
+ return 'video/*'
813
+ } else {
814
+ return '*'
815
+ }
816
+ }
817
+ },
818
+ isRequiredFn(){
819
+ return function(field) {
820
+ return this.relationSet(field,'requiredDependentFieldId')
821
+ }
600
822
  }
601
-
823
+ },
824
+ components:{
825
+ myPopup,
826
+ Tree,
827
+ selectPopup
602
828
  },
603
829
  mounted() {
604
830
  this.isMobile()
@@ -626,6 +852,30 @@ export default {
626
852
  that.defaultClick()
627
853
  },
628
854
  methods: {
855
+ getMoldTime(){
856
+ let otherTime = {}
857
+ this.formList.form && this.formList.form.formFieldRelation.forEach(item=>{
858
+ if ((item.formField.type==='TIME_PICKER' || item.formField.type==='TIME_PICKER_RANGE') && item.formField.extInfo.mold==='OTHER'){
859
+ let pattern = item.formField.extInfo.pattern
860
+ let yearVal = pattern.indexOf('YEAR')!==-1
861
+ let monthVal = pattern.indexOf('MONTH')!==-1
862
+ let dayVal = pattern.indexOf('DAY')!==-1
863
+ let hourVal = pattern.indexOf('HOUR')!==-1
864
+ let minuteVal = pattern.indexOf('MINUTE')!==-1
865
+ let secondVal = pattern.indexOf('SECOND')!==-1
866
+ if ((yearVal||monthVal||dayVal)&&(!hourVal&&!minuteVal&&!secondVal)){
867
+ otherTime[item.fieldId]='DATE'
868
+ }
869
+ else if ((yearVal||monthVal||dayVal)&&(hourVal||minuteVal||secondVal)){
870
+ otherTime[item.fieldId]='DATE_TIME'
871
+ }
872
+ else if ((hourVal||minuteVal||secondVal)&&(!yearVal&&!monthVal&&!dayVal)){
873
+ otherTime[item.fieldId]='TIME'
874
+ }
875
+ }
876
+ })
877
+ return otherTime
878
+ },
629
879
  setOptions(extInfo){
630
880
  let options = []
631
881
  console.debug('cascadeDown',extInfo)
@@ -639,24 +889,47 @@ export default {
639
889
  return options
640
890
  },
641
891
  onReady(){
642
-
643
-
892
+
893
+
644
894
  },
645
- beforeRead(file){
895
+ beforeRead(file,type){
646
896
  console.debug('file',file)
647
897
  console.debug('fileType',!Array.isArray(file))
648
898
  if (!Array.isArray(file)){
649
- const isLte2M = file.size / 1024 / 1024 <= 8;
650
- const isSupportedFormat =file.type.indexOf('image')!==-1
651
- if (!isSupportedFormat){
652
- this.$message.error("只能上传图片格式");
653
- return false
899
+ if (type === 'IMAGE'){
900
+ const isLte2M = file.size / 1024 / 1024 <= 8;
901
+ const isSupportedFormat =file.type.indexOf('image')!==-1
902
+ if (!isSupportedFormat){
903
+ this.$message.error("只能上传图片格式");
904
+ return false
905
+ }
906
+ if (!isLte2M&&isSupportedFormat) {
907
+ this.$message.error("上传图片大小不能超过 8MB!");
908
+ return false
909
+ }
910
+ return true
654
911
  }
655
- if (!isLte2M&&isSupportedFormat) {
656
- this.$message.error("上传图片大小不能超过 8MB!");
657
- return false
912
+ else if (type === 'VIDEO'){
913
+ const isLte2M = file.size / 1024 / 1024 <= 100;
914
+ const isSupportedFormat =file.type.indexOf('video')!==-1
915
+ if (!isSupportedFormat){
916
+ this.$message.error("只能上传视频格式");
917
+ return false
918
+ }
919
+ if (!isLte2M&&isSupportedFormat) {
920
+ this.$message.error("上传视频大小不能超过100MB!");
921
+ return false
922
+ }
923
+ return true
924
+ }
925
+ else if (type === 'FILE' || type === 'ATTACHMENT'){
926
+ const isLte2M = file.size / 1024 / 1024 <= 100;
927
+ if (!isLte2M) {
928
+ this.$message.error("上传附件大小不能超过100MB!");
929
+ return false
930
+ }
931
+ return true
658
932
  }
659
- return true
660
933
  }
661
934
  else{
662
935
  let length = 0
@@ -665,17 +938,40 @@ export default {
665
938
  }
666
939
  if (file.length<=this.limitNum-length){
667
940
  for (let i=0;i<file.length;i++){
668
- const isLte2M = file[i].size / 1024 / 1024 <= 8;
669
- const isSupportedFormat =file[i].type.indexOf('image')!==-1
670
- if (!isSupportedFormat){
671
- this.$message.error("只能上传图片格式");
672
- return false
941
+ if (type === 'IMAGE'){
942
+ const isLte2M = file.size / 1024 / 1024 <= 8;
943
+ const isSupportedFormat =file.type.indexOf('image')!==-1
944
+ if (!isSupportedFormat){
945
+ this.$message.error("只能上传图片格式");
946
+ return false
947
+ }
948
+ if (!isLte2M&&isSupportedFormat) {
949
+ this.$message.error("上传图片大小不能超过 8MB!");
950
+ return false
951
+ }
952
+ return true
673
953
  }
674
- if (!isLte2M&&isSupportedFormat) {
675
- this.$message.error("上传图片大小不能超过 8MB!");
676
- return false
954
+ else if (type === 'VIDEO'){
955
+ const isLte2M = file.size / 1024 / 1024 <= 100;
956
+ const isSupportedFormat =file.type.indexOf('video')!==-1
957
+ if (!isSupportedFormat){
958
+ this.$message.error("只能上传视频格式");
959
+ return false
960
+ }
961
+ if (!isLte2M&&isSupportedFormat) {
962
+ this.$message.error("上传视频大小不能超过100MB!");
963
+ return false
964
+ }
965
+ return true
966
+ }
967
+ else if (type === 'FILE' || type === 'ATTACHMENT'){
968
+ const isLte2M = file.size / 1024 / 1024 <= 100;
969
+ if (!isLte2M) {
970
+ this.$message.error("上传附件大小不能超过100MB!");
971
+ return false
972
+ }
973
+ return true
677
974
  }
678
- return true
679
975
  }
680
976
  }
681
977
  else {
@@ -683,7 +979,7 @@ export default {
683
979
  if (this.limitNum){
684
980
  num = this.limitNum
685
981
  }
686
- let messageText = '仅支持上传'+num+'张图片'
982
+ let messageText = '仅支持上传'+num+''
687
983
  this.$message.error(messageText);
688
984
  return false
689
985
  }
@@ -770,88 +1066,80 @@ export default {
770
1066
  },
771
1067
  //初始化默认值
772
1068
  defaultClick() {
773
- for (let i = 0; i < this.formList.form.formFieldRelation.length; i++)
774
- {
775
- if(this.formList.form.formFieldRelation[i].formField.type ==='SELECT'||this.formList.form.formFieldRelation[i].formField.type ==='CHECKBOX' ||this.formList.form.formFieldRelation[i].formField.type==='RADIO' ||this.formList.form.formFieldRelation[i].formField.type==='OPTION')
776
- {
777
- if(this.formList.form.formFieldRelation[i].formField.extInfo && !this.formList.form.formFieldRelation[i].formField.extInfo.option)
778
- {
779
- if(this.formList.form.formFieldRelation[i].formField.extInfo.exinfo)
780
- {
781
- for (let j=0;j<this.formList.form.formFieldRelation[i].formField.extInfo.exinfo.length;j++)
782
- {
783
- this.$set(this.formList.form.formFieldRelation[i].formField.extInfo.exinfo[j],'label',this.formList.form.formFieldRelation[i].formField.extInfo.exinfo[j].value)
1069
+ for (let i = 0; i < this.formList.form.formFieldRelation.length; i++){
1070
+ let type = this.formList.form.formFieldRelation[i].formField.type
1071
+ let extInfo = this.formList.form.formFieldRelation[i].formField.extInfo
1072
+ if(type ==='SELECT' || type === 'CHECKBOX' || type === 'RADIO' || type === 'OPTION') {
1073
+ if(extInfo && !extInfo.option){
1074
+ if(extInfo.exinfo){
1075
+ for (let j=0; j < extInfo.exinfo.length; j++){
1076
+ this.$set(extInfo.exinfo[j],'label',extInfo.exinfo[j].value)
784
1077
  }
785
- this.$set(this.formList.form.formFieldRelation[i].formField.extInfo,'option',this.formList.form.formFieldRelation[i].formField.extInfo.exinfo)
1078
+ this.$set(extInfo,'option',extInfo.exinfo)
786
1079
  }
787
- if (this.formList.form.formFieldRelation[i].formField.extInfo.option){
788
- if (this.formList.form.formFieldRelation[i].formField.type === 'RADIO') {
789
- for (let j = 0; j < this.formList.form.formFieldRelation[i].formField.extInfo.option.length; j++) {
790
- if(!this.formList.form.formFieldRelation[i].formField.extInfo.option[j].value)
791
- {
792
- this.formList.form.formFieldRelation[i].formField.extInfo.option[j].value=this.formList.form.formFieldRelation[i].formField.extInfo.option[j].label
1080
+ if (extInfo.option){
1081
+ if (type === 'RADIO') {
1082
+ for (let j = 0; j < extInfo.option.length; j++) {
1083
+ if(!extInfo.option[j].value) {
1084
+ extInfo.option[j].value=extInfo.option[j].label
793
1085
  }
794
1086
  }
795
- if(!this.formList.form.formFieldRelation[i].value)
796
- {
797
- for (let j = 0; j < this.formList.form.formFieldRelation[i].formField.extInfo.option.length; j++) {
798
- if (this.formList.form.formFieldRelation[i].formField.extInfo.option[j]._default === 'true') {
799
- this.formList.form.formFieldRelation[i].value = this.formList.form.formFieldRelation[i].formField.extInfo.option[j].value
1087
+ if(!this.formList.form.formFieldRelation[i].value){
1088
+ for (let j = 0; j < extInfo.option.length; j++) {
1089
+ if (extInfo.option[j]._default === 'true') {
1090
+ this.formList.form.formFieldRelation[i].value = extInfo.option[j].value
800
1091
  }
801
1092
  }
802
1093
  }
803
1094
  }
804
- if (this.formList.form.formFieldRelation[i].formField.type === 'CHECKBOX') {
805
- for (let j = 0; j < this.formList.form.formFieldRelation[i].formField.extInfo.option.length; j++) {
806
- if (!this.formList.form.formFieldRelation[i].formField.extInfo.option[j].value) {
807
- this.formList.form.formFieldRelation[i].formField.extInfo.option[j].value = this.formList.form.formFieldRelation[i].formField.extInfo.option[j].label
1095
+ if (type === 'CHECKBOX') {
1096
+ for (let j = 0; j < extInfo.option.length; j++) {
1097
+ if (!extInfo.option[j].value) {
1098
+ extInfo.option[j].value = extInfo.option[j].label
808
1099
  }
809
1100
  }
810
-
811
- if (!this.formList.form.formFieldRelation[i].value||this.formList.form.formFieldRelation[i].value.length === 0)
812
- {
813
- this.formList.form.formFieldRelation[i].value=[]
814
- for (let j = 0; j < this.formList.form.formFieldRelation[i].formField.extInfo.option.length; j++) {
815
- if (this.formList.form.formFieldRelation[i].formField.extInfo.option[j]._default === 'true') {
816
- this.formList.form.formFieldRelation[i].value[0] = this.formList.form.formFieldRelation[i].formField.extInfo.option[j].value
1101
+ if (!this.formList.form.formFieldRelation[i].value || this.formList.form.formFieldRelation[i].value.length === 0){
1102
+ this.formList.form.formFieldRelation[i].value = []
1103
+ for (let j = 0; j < extInfo.option.length; j++) {
1104
+ if (extInfo.option[j]._default === 'true') {
1105
+ this.formList.form.formFieldRelation[i].value[0] = extInfo.option[j].value
817
1106
  }
818
1107
  }
819
1108
  }
820
1109
  }
821
1110
  }
822
-
823
1111
  }
824
1112
  else {
825
- if (this.formList.form.formFieldRelation[i].formField.extInfo && this.formList.form.formFieldRelation[i].formField.extInfo.options){
826
- if (this.formList.form.formFieldRelation[i].formField.type === 'RADIO') {
827
- for (let j = 0; j < this.formList.form.formFieldRelation[i].formField.extInfo.options.length; j++) {
828
- if(!this.formList.form.formFieldRelation[i].formField.extInfo.options[j].value)
1113
+ if (extInfo && extInfo.options) {
1114
+ if (type === 'RADIO') {
1115
+ for (let j = 0; j < extInfo.options.length; j++) {
1116
+ if(!extInfo.options[j].value)
829
1117
  {
830
- this.formList.form.formFieldRelation[i].formField.extInfo.options[j].value=this.formList.form.formFieldRelation[i].formField.extInfo.options[j].label
1118
+ extInfo.options[j].value=extInfo.options[j].label
831
1119
  }
832
1120
  }
833
1121
  if(!this.formList.form.formFieldRelation[i].value)
834
1122
  {
835
- for (let j = 0; j < this.formList.form.formFieldRelation[i].formField.extInfo.option.length; j++) {
836
- if (this.formList.form.formFieldRelation[i].formField.extInfo.options[j]._default === 'true') {
837
- this.formList.form.formFieldRelation[i].value = this.formList.form.formFieldRelation[i].formField.extInfo.options[j].value
1123
+ for (let j = 0; j < extInfo.option.length; j++) {
1124
+ if (extInfo.options[j]._default === 'true') {
1125
+ this.formList.form.formFieldRelation[i].value = extInfo.options[j].value
838
1126
  }
839
1127
  }
840
1128
  }
841
1129
  }
842
- if (this.formList.form.formFieldRelation[i].formField.type === 'CHECKBOX') {
843
- for (let j = 0; j < this.formList.form.formFieldRelation[i].formField.extInfo.options.length; j++) {
844
- if (this.formList.form.formFieldRelation[i].formField.extInfo.options[j].value === '') {
845
- this.formList.form.formFieldRelation[i].formField.extInfo.options[j].value = this.formList.form.formFieldRelation[i].formField.extInfo.options[j].label
1130
+ if (type === 'CHECKBOX') {
1131
+ for (let j = 0; j < extInfo.options.length; j++) {
1132
+ if (extInfo.options[j].value === '') {
1133
+ extInfo.options[j].value = extInfo.options[j].label
846
1134
  }
847
1135
  }
848
1136
 
849
- if (this.formList.form.formFieldRelation[i].value === null||this.formList.form.formFieldRelation[i].value.length === 0)
1137
+ if (!this.formList.form.formFieldRelation[i].value ||this.formList.form.formFieldRelation[i].value.length === 0)
850
1138
  {
851
1139
  this.formList.form.formFieldRelation[i].value=[]
852
- for (let j = 0; j < this.formList.form.formFieldRelation[i].formField.extInfo.options.length; j++) {
853
- if (this.formList.form.formFieldRelation[i].formField.extInfo.options[j]._default === 'true') {
854
- this.formList.form.formFieldRelation[i].value[0] = this.formList.form.formFieldRelation[i].formField.extInfo.options[j].value
1140
+ for (let j = 0; j < extInfo.options.length; j++) {
1141
+ if (extInfo.options[j]._default === 'true') {
1142
+ this.formList.form.formFieldRelation[i].value[0] = extInfo.options[j].value
855
1143
  }
856
1144
  }
857
1145
  }
@@ -860,7 +1148,7 @@ export default {
860
1148
  }
861
1149
 
862
1150
  }
863
- if (this.formList.form.formFieldRelation[i].formField.type ==='FILE'){
1151
+ if (type ==='FILE'){
864
1152
  if (this.formList.form.formFieldRelation[i].value!==undefined){
865
1153
  if (this.formList.form.formFieldRelation[i].value===null||this.formList.form.formFieldRelation[i].value===''){
866
1154
  this.formList.form.formFieldRelation[i].value=[]
@@ -893,114 +1181,94 @@ export default {
893
1181
 
894
1182
 
895
1183
  }
896
-
897
1184
  }
898
- let test = []
899
1185
  for (let i = 0; i < this.formList.form.formFieldRelation.length; i++) {
900
- if (this.formList.form.formFieldRelation[i].formField.type === 'CASCADER') {
901
- test.push(this.formList.form.formFieldRelation[i])
902
- let cascader=''
903
- if(this.formList.form.formFieldRelation[i].value)
904
- {
905
- if(this.formList.form.formFieldRelation[i].value.length > 0)
906
- {
907
- for (let j = 0; j < this.formList.form.formFieldRelation[i].value.length; j++) {
908
- if (this.formList.form.formFieldRelation[i].value[j]) {
909
- cascader += this.formList.form.formFieldRelation[i].value[j] + '/'
910
- }
911
- }
912
- cascader = cascader.substr(0, cascader.length - 1)
913
-
914
- }
915
- this.cascadeValue[this.formList.form.formFieldRelation[i].fieldId]=cascader
1186
+ let type = this.formList.form.formFieldRelation[i].formField.type
1187
+ let extInfo = this.formList.form.formFieldRelation[i].formField.extInfo
1188
+ if (type === 'CASCADER') {
1189
+ let fieldValue = this.formList.form.formFieldRelation[i].formField.extInfo.fieldValue?this.formList.form.formFieldRelation[i].formField.extInfo.fieldValue:[]
1190
+ this.checkDatas[this.formList.form.formFieldRelation[i].fieldId] = fieldValue
1191
+ if (this.formList.form.formFieldRelation[i].value){
1192
+ this.formList.form.formFieldRelation[i].value = this.formList.form.formFieldRelation[i].formField.defaultValue?
1193
+ this.formList.form.formFieldRelation[i].formField.defaultValue:[];
916
1194
  }
917
- else
918
- {
919
- this.formList.form.formFieldRelation[i].value=[]
920
- }
921
- }
922
- if (this.formList.form.formFieldRelation[i].formField.type === 'DATE_PICKER')
923
- {
924
- if(this.formList.form.formFieldRelation[i].value!==null && this.formList.form.formFieldRelation[i].value!=='' )
925
- {
926
1195
 
1196
+ }
1197
+ if (type === 'DATE_PICKER') {
1198
+ if(this.formList.form.formFieldRelation[i].value!==null && this.formList.form.formFieldRelation[i].value!=='' ) {
927
1199
  this.dateValue[this.formList.form.formFieldRelation[i].fieldId]=this.formatDate(this.formList.form.formFieldRelation[i].value)
928
1200
  }
929
1201
  }
930
- if (this.formList.form.formFieldRelation[i].formField.type === 'TIME_PICKER')
931
- {
1202
+ if (type === 'TIME_PICKER') {
932
1203
  if(this.formList.form.formFieldRelation[i].value!==''&& this.formList.form.formFieldRelation[i].value!==null)
933
1204
  {
934
1205
  const dateTime = new Date(this.formList.form.formFieldRelation[i].value)
935
- this.timeValue[this.formList.form.formFieldRelation[i].fieldId]=this.addZero(dateTime.getHours()) + ':' + this.addZero(dateTime.getMinutes())
936
-
1206
+ if (!this.formList.form.formFieldRelation[i].formField.extInfo.mold ||
1207
+ this.formList.form.formFieldRelation[i].formField.extInfo.mold == 'TIME' ||
1208
+ this.getMoldTime(this.formList.form.formFieldRelation[i].formField.formField) == 'TIME'){
1209
+ this.timeValue[this.formList.form.formFieldRelation[i].fieldId]=dateTime.Format('hh:mm')
1210
+ }
1211
+ else if (this.formList.form.formFieldRelation[i].formField.extInfo.mold == 'DATA_TIME' ||
1212
+ this.formList.form.formFieldRelation[i].formField.extInfo.mold == 'DATE_TIME' ||
1213
+ this.getMoldTime(this.formList.form.formFieldRelation[i].formField.formField) == 'DATE_TIME'){
1214
+ this.timeValue[this.formList.form.formFieldRelation[i].fieldId] = dateTime.Format('yyyy-MM-dd hh:mm')
1215
+ }
1216
+ else if (this.formList.form.formFieldRelation[i].formField.extInfo.mold == 'DATA' ||
1217
+ this.formList.form.formFieldRelation[i].formField.extInfo.mold == 'DATE' ||
1218
+ this.getMoldTime(this.formList.form.formFieldRelation[i].formField.formField) == 'DATE'){
1219
+ this.timeValue[this.formList.form.formFieldRelation[i].fieldId] = dateTime.Format('yyyy-MM-dd')
1220
+ }
937
1221
  }
938
1222
  }
939
- if (this.formList.form.formFieldRelation[i].formField.type === 'SELECT' || this.formList.form.formFieldRelation[i].formField.type === 'OPTION') {
940
- if (this.formList.form.formFieldRelation[i].formField.extInfo && this.formList.form.formFieldRelation[i].formField.extInfo.option){
941
- for (let j = 0; j < this.formList.form.formFieldRelation[i].formField.extInfo.option.length; j++) {
942
- if (this.formList.form.formFieldRelation[i].formField.extInfo.option[j].value === '') {
943
- this.formList.form.formFieldRelation[i].formField.extInfo.option[j].value = this.formList.form.formFieldRelation[i].formField.extInfo.option[j].label
1223
+ if (type === 'SELECT' || type === 'OPTION') {
1224
+ if (extInfo && extInfo.option){
1225
+ for (let j = 0; j < extInfo.option.length; j++) {
1226
+ if (extInfo.option[j].value === '') {
1227
+ extInfo.option[j].value = extInfo.option[j].label
944
1228
  }
945
1229
  }
946
- if(this.formList.form.formFieldRelation[i].value)
947
- {
948
- for (let j=0;j<this.formList.form.formFieldRelation[i].formField.extInfo.option.length;j++)
949
- {
950
- if (this.formList.form.formFieldRelation[i].value === this.formList.form.formFieldRelation[i].formField.extInfo.option[j].value)
951
- {
952
- this.selectValues[this.formList.form.formFieldRelation[i].fieldId] =this.formList.form.formFieldRelation[i].formField.extInfo.option[j].label
1230
+ if(this.formList.form.formFieldRelation[i].value) {
1231
+ for (let j = 0; j < extInfo.option.length; j++) {
1232
+ if (this.formList.form.formFieldRelation[i].value === extInfo.option[j].value) {
1233
+ this.selectValues[this.formList.form.formFieldRelation[i].fieldId] = extInfo.option[j].label
953
1234
  }
954
1235
  }
955
- /*this.selectValues[this.formList.form.formFieldRelation[i].fieldId] = this.formList.form.formFieldRelation[i].value*/
956
-
957
- }
958
- else
959
- {
960
- for (let j = 0; j < this.formList.form.formFieldRelation[i].formField.extInfo.option.length; j++) {
961
- if (this.formList.form.formFieldRelation[i].formField.extInfo.option[j]._default === 'true') {
962
- this.selectValues[this.formList.form.formFieldRelation[i].fieldId] = this.formList.form.formFieldRelation[i].formField.extInfo.option[j].label
963
- this.formList.form.formFieldRelation[i].value=this.formList.form.formFieldRelation[i].formField.extInfo.option[j].value
1236
+ } else {
1237
+ for (let j = 0; j < extInfo.option.length; j++) {
1238
+ if (extInfo.option[j]._default === 'true') {
1239
+ this.selectValues[this.formList.form.formFieldRelation[i].fieldId] = extInfo.option[j].label
1240
+ this.formList.form.formFieldRelation[i].value=extInfo.option[j].value
964
1241
  }
965
1242
  }
966
1243
  }
967
- }
968
- else {
969
- if(this.formList.form.formFieldRelation[i].formField.extInfo && this.formList.form.formFieldRelation[i].formField.extInfo.option) {
970
- for (let j = 0; j < this.formList.form.formFieldRelation[i].formField.extInfo.options.length; j++) {
971
- if (this.formList.form.formFieldRelation[i].formField.extInfo.options[j].value === '') {
972
- this.formList.form.formFieldRelation[i].formField.extInfo.options[j].value = this.formList.form.formFieldRelation[i].formField.extInfo.options[j].label
1244
+ } else {
1245
+ if(extInfo && extInfo.option) {
1246
+ for (let j = 0; j < extInfo.options.length; j++) {
1247
+ if (extInfo.options[j].value === '') {
1248
+ extInfo.options[j].value = extInfo.options[j].label
973
1249
  }
974
1250
  }
975
1251
  }
976
- if(this.formList.form.formFieldRelation[i].value && this.formList.form.formFieldRelation[i].formField.extInfo && this.formList.form.formFieldRelation[i].formField.extInfo.option)
977
- {
978
- for (let j=0;j<this.formList.form.formFieldRelation[i].formField.extInfo.options.length;j++)
979
- {
980
- if (this.formList.form.formFieldRelation[i].value === this.formList.form.formFieldRelation[i].formField.extInfo.options[j].value)
981
- {
982
- this.selectValues[this.formList.form.formFieldRelation[i].fieldId] =this.formList.form.formFieldRelation[i].formField.extInfo.options[j].label
983
- }
1252
+ if(this.formList.form.formFieldRelation[i].value && extInfo && extInfo.option) {
1253
+ for (let j=0;j<extInfo.options.length;j++) {
1254
+ if (this.formList.form.formFieldRelation[i].value === extInfo.options[j].value) {
1255
+ this.selectValues[this.formList.form.formFieldRelation[i].fieldId] =extInfo.options[j].label
984
1256
  }
985
- /*this.selectValues[this.formList.form.formFieldRelation[i].fieldId] = this.formList.form.formFieldRelation[i].value*/
986
-
987
1257
  }
988
- else
989
- {
990
- if(this.formList.form.formFieldRelation[i].formField.extInfo && this.formList.form.formFieldRelation[i].formField.extInfo.option) {
991
- for (let j = 0; j < this.formList.form.formFieldRelation[i].formField.extInfo.options.length; j++) {
992
- if (this.formList.form.formFieldRelation[i].formField.extInfo.options[j]._default === 'true') {
993
- this.selectValues[this.formList.form.formFieldRelation[i].fieldId] = this.formList.form.formFieldRelation[i].formField.extInfo.options[j].label
994
- this.formList.form.formFieldRelation[i].value=this.formList.form.formFieldRelation[i].formField.extInfo.options[j].value
995
- }
1258
+ } else {
1259
+ if(extInfo && extInfo.option) {
1260
+ for (let j = 0; j < extInfo.options.length; j++) {
1261
+ if (extInfo.options[j]._default === 'true') {
1262
+ this.selectValues[this.formList.form.formFieldRelation[i].fieldId] = extInfo.options[j].label
1263
+ this.formList.form.formFieldRelation[i].value=extInfo.options[j].value
996
1264
  }
997
1265
  }
998
1266
  }
1267
+ }
999
1268
  }
1000
-
1001
1269
  }
1002
1270
  }
1003
- this.formShow=this.formList
1271
+ this.formShow = this.formList
1004
1272
  },
1005
1273
  addZero(i) {
1006
1274
  if (i < 10) {
@@ -1039,21 +1307,38 @@ export default {
1039
1307
  }
1040
1308
  },
1041
1309
  //时间的选择器
1042
- onConfirm(value, id,item) {
1043
- for (let i = 0; i < this.formShow.form.formFieldRelation.length; i++) {
1310
+ onConfirm(value, id,item,type) {
1311
+ console.debug('value',value)
1312
+ if (type == 'DATE'){
1313
+ this.datePicker = false
1314
+ this.timeDetailData.value = value;
1315
+ this.timeValue[id] =this.formatDate(value);
1316
+ }
1317
+ else if (type == 'TIME'){
1318
+ this.timePicker = false;
1319
+ this.timeValue[id] = value;
1320
+ console.debug('timeDetailData',this.timeDetailData)
1321
+ this.timeDetailData.value = forMatTime(value)
1322
+ }
1323
+ else if (type == 'DATE_TIME'){
1324
+ this.dateTimePicker = false;
1325
+ this.timeDetailData.value = value
1326
+ this.timeValue[id] =this.formatDate(value) +" "+ this.addZero(value.getHours()) + ':' + this.addZero(value.getMinutes())
1327
+ }
1328
+ /*for (let i = 0; i < this.formShow.form.formFieldRelation.length; i++) {
1044
1329
  if (this.formShow.form.formFieldRelation[i].fieldId=== id) {
1045
1330
  this.formShow.form.formFieldRelation[i].value = value
1046
1331
  if (!item.formField.extInfo.mold||item.formField.extInfo.mold==='DATA_TIME'){
1047
1332
  this.timeValue[id] =this.formatDate(value) +" "+ this.addZero(value.getHours()) + ':' + this.addZero(value.getMinutes())
1048
- this.showTimePicker = false;
1333
+ this.dateTimePicker = false;
1049
1334
  }
1050
1335
  else {
1051
1336
  this.timeValue[id] =this.formatDate(value)
1052
- this.showTimePickerd = false;
1337
+ this.datePicker = false;
1053
1338
  }
1054
1339
  break
1055
1340
  }
1056
- }
1341
+ }*/
1057
1342
  },
1058
1343
  //转换日期的函数
1059
1344
  formatDate(date) {
@@ -1061,22 +1346,33 @@ export default {
1061
1346
  return `${dateTime.getFullYear()}-${dateTime.getMonth() + 1}-${dateTime.getDate()}`;
1062
1347
  },
1063
1348
  //日期的选择器
1064
- onConfirmCalendar(date, id) {
1065
- for (let i = 0; i < this.formShow.form.formFieldRelation.length; i++) {
1349
+ onConfirmCalendar(date, item) {
1350
+ fieldId
1351
+ this.dateValue[item.fieldId] = this.formatDate(date);
1352
+ item.value = date;
1353
+ this.showCalendar = false;
1354
+ /* for (let i = 0; i < this.formShow.form.formFieldRelation.length; i++) {
1066
1355
  if (this.formShow.form.formFieldRelation[i].fieldId === id) {
1067
1356
  this.dateValue[id] = this.formatDate(date)
1068
1357
  this.formShow.form.formFieldRelation[i].value = date
1069
1358
  this.showCalendar = false;
1070
1359
  break
1071
1360
  }
1072
- }
1361
+ }*/
1073
1362
  },
1074
1363
  //下拉的选择器
1075
- onConfirmSelect(value, id) {
1364
+ onConfirmSelect(value, item) {
1365
+ console.log('value',value,this.selectDetail)
1366
+ this.selectValues[this.selectDetail.fieldId] = value;
1076
1367
  for (let i = 0; i < this.formShow.form.formFieldRelation.length; i++) {
1077
- if (this.formShow.form.formFieldRelation[i].fieldId === id) {
1078
- this.selectValues[this.formShow.form.formFieldRelation[i].fieldId] = value
1079
- if (this.formShow.form.formFieldRelation[i].formField.extInfo.option){
1368
+ if (this.formShow.form.formFieldRelation[i].fieldId === this.selectDetail.fieldId) {
1369
+ let options = this.formShow.form.formFieldRelation[i].formField.extInfo.option?this.formShow.form.formFieldRelation[i].formField.extInfo.option:this.formShow.form.formFieldRelation[i].formField.extInfo.options;
1370
+ for (let j=0;j<options.length;j++){
1371
+ if (value == options[j].label){
1372
+ this.selectDetail.value = options[j].value
1373
+ }
1374
+ }
1375
+ /*if (this.formShow.form.formFieldRelation[i].formField.extInfo.option){
1080
1376
  for (let j = 0; j < this.formShow.form.formFieldRelation[i].formField.extInfo.option.length; j++) {
1081
1377
  if(value ===this.formShow.form.formFieldRelation[i].formField.extInfo.option[j].label)
1082
1378
  {
@@ -1091,41 +1387,12 @@ export default {
1091
1387
  this.formShow.form.formFieldRelation[i].value = this.formShow.form.formFieldRelation[i].formField.extInfo.options[j].value
1092
1388
  }
1093
1389
  }
1094
- }
1095
-
1390
+ }*/
1096
1391
  this.showPicker = false;
1097
1392
  break
1098
1393
  }
1099
1394
  }
1100
1395
  },
1101
- //时间日期的选择器
1102
- /* onConfirmDateTime(date,id){
1103
- for (let i=0;i<this.formList.form.formFieldRelation.length;i++)
1104
- {
1105
-
1106
- if(this.formList.form.formFieldRelation[i].formField.id===id)
1107
- {
1108
- this.dateTimeValue[id]=this.addZero(date.getFullYear())+'-'+this.addZero(date.getMonth())+'-'+this.addZero(date.getDate())+' '+this.addZero(date.getHours())+':'+this.addZero(date.getMinutes())
1109
- this.formList.form.formFieldRelation[i].value[0]=date
1110
- this.showDateTimePicker = false;
1111
- break
1112
- }
1113
- }
1114
-
1115
- },
1116
- onConfirmDateTime1(date,id){
1117
- for (let i=0;i<this.formList.form.formFieldRelation.length;i++)
1118
- {
1119
- if(this.formList.form.formFieldRelation[i].formField.id===id)
1120
- {
1121
-
1122
- this.dateTimeValue1[id]=this.addZero(date.getFullYear())+'-'+this.addZero(date.getMonth())+'-'+this.addZero(date.getDate())+' '+this.addZero(date.getHours())+':'+this.addZero(date.getMinutes())
1123
- this.formList.form.formFieldRelation[i].value[1]=date
1124
- this.showDateTimePicker1 = false;
1125
- break
1126
- }
1127
- }
1128
- },*/
1129
1396
  //提交按钮事件
1130
1397
  submitClick() {
1131
1398
 
@@ -1144,44 +1411,42 @@ export default {
1144
1411
  cascader = this.formShow.form.formFieldRelation[i].formField.extInfo.cascadeDown[0].options
1145
1412
  }
1146
1413
  cascader.forEach(item=>{
1147
- if(item.children!==undefined)
1148
- {
1149
- if(item.children.length===0)
1414
+ if(item.children!==undefined){
1415
+ if(item.children.length===0) {
1150
1416
  delete item.children
1151
- else {
1417
+ } else {
1152
1418
  item.children.forEach(items=>{
1153
- if(items.children)
1154
- {
1155
- if(items.children.length===0)
1419
+ if(items.children){
1420
+ if(items.children.length===0) {
1156
1421
  delete items.children
1422
+ }
1157
1423
  }
1158
1424
  })
1159
1425
  }
1160
1426
  }
1161
1427
  })
1162
1428
  }
1163
- if (this.fileListList[this.formShow.form.formFieldRelation[i].fieldId]!==undefined){
1429
+ if (this.fileListList[this.formShow.form.formFieldRelation[i].fieldId]!== undefined) {
1164
1430
  let value=[]
1165
-
1166
1431
  this.fileListList[this.formShow.form.formFieldRelation[i].fieldId].forEach(item=>{
1167
- let file={}
1168
- file.name=item.name
1169
- file.url=item.url
1432
+ let file = {}
1433
+ file.name = item.name
1434
+ file.url = item.url
1170
1435
  value.push(file)
1171
1436
  })
1172
1437
  this.formShow.form.formFieldRelation[i].value=value
1173
1438
  }
1174
-
1175
- if(this.formShow.form.formFieldRelation[i].display===true && this.formShow.form.formFieldRelation[i].required === true&&this.formShow.form.formFieldRelation[i].fieldId!=='workorder_name'&& this.formShow.form.formFieldRelation[i].formField.type !== 'EXPLANATION')
1176
- {
1439
+ if(this.formShow.form.formFieldRelation[i].display &&
1440
+ (this.formShow.form.formFieldRelation[i].required || this.isRequiredFn(this.formShow.form.formFieldRelation[i].formField)) &&
1441
+ this.formShow.form.formFieldRelation[i].fieldId!=='workorder_name'&&
1442
+ this.formShow.form.formFieldRelation[i].formField.type !== 'EXPLANATION') {
1177
1443
  let value = this.formShow.form.formFieldRelation[i].value && this.formShow.form.formFieldRelation[i].value.includes('\n')?this.formShow.form.formFieldRelation[i].value:'';
1178
1444
  let strVal = '';
1179
- if (value){
1445
+ if(value){
1180
1446
  strVal = value.replace(/\n/g,'');
1181
1447
  }
1182
1448
  let bool = this.formShow.form.formFieldRelation[i].value && this.formShow.form.formFieldRelation[i].value.includes('\n') && !strVal
1183
- if(!this.formShow.form.formFieldRelation[i].value || bool || (this.formShow.form.formFieldRelation[i].value && this.formShow.form.formFieldRelation[i].value.length===0))
1184
- {
1449
+ if(!this.formShow.form.formFieldRelation[i].value || bool|| (this.formShow.form.formFieldRelation[i].value&&this.formShow.form.formFieldRelation[i].value.length===0)) {
1185
1450
  this.$message.error('请完善'+ this.formShow.form.formFieldRelation[i].formField.name)
1186
1451
  return
1187
1452
  }
@@ -1206,28 +1471,29 @@ export default {
1206
1471
 
1207
1472
  },
1208
1473
  //时间的点击事件
1209
- timeClick(id,item) {
1210
- if(this.disableds === false){
1211
- for (let i = 0; i < this.formShow.form.formFieldRelation.length; i++) {
1212
- if (this.formShow.form.formFieldRelation[i].fieldId === id) {
1213
- this.timeId = id
1214
- if (!item.formField.extInfo.mold||item.formField.extInfo.mold==='DATA_TIME'){
1215
- this.showTimePicker = true
1216
- }
1217
- else {
1218
- this.showTimePickerd= true
1219
- }
1220
-
1221
- break
1222
- }
1223
-
1224
- }
1474
+ timeClick(id,item,type) {
1475
+ if (this.disableds){
1476
+ return
1477
+ }
1478
+ this.timeDetailData = item
1479
+ if (type == 'DATE'){
1480
+ this.datePicker = true
1481
+ }
1482
+ else if (type == 'TIME'){
1483
+ this.timePicker = true
1484
+ }
1485
+ else if (type == 'DATE_TIME'){
1486
+ this.dateTimePicker = true
1225
1487
  }
1226
-
1227
1488
  },
1228
1489
  //下拉的点击事件
1229
- selectClick(id) {
1230
- if(this.disableds === false){
1490
+ selectClick(id,type,item) {
1491
+ console.debug('111')
1492
+ if (this.disableds){
1493
+ return
1494
+ }
1495
+ this.selectDetail = item
1496
+ if(type == 'client') {
1231
1497
  let selectOption
1232
1498
  this.selectValue=[]
1233
1499
  for (let i = 0; i < this.formShow.form.formFieldRelation.length; i++) {
@@ -1244,8 +1510,14 @@ export default {
1244
1510
  }
1245
1511
  this.selectId = id
1246
1512
  this.showPicker = true
1513
+ } else if (type == 'ref'){
1514
+ this.refShowPicker = true
1515
+ } else if (type == 'select'){
1516
+ this.selectPicker = true;
1517
+ }
1518
+ if (item){
1519
+ this.detailField = item;
1247
1520
  }
1248
-
1249
1521
  },
1250
1522
  SelectClear(fieldId) {
1251
1523
  if(this.disableds === false){
@@ -1309,7 +1581,6 @@ export default {
1309
1581
 
1310
1582
 
1311
1583
  },
1312
-
1313
1584
  onChange(picker, values,index) {
1314
1585
  // 这里我有可能渲染的有问题,导致回调每次都修改了当前列,其他值没有修改,当前列??(当前列什么鬼呀,什么垃圾啊???) 解释一下 ↓↓
1315
1586
  // 因为vant的 van-picker 回调只会返回你修改的那一列,比如现在为 [北京,北京,东城区],你修改了省为[天津市,天津市,和平区],但是vant的change回调会得到[天津市,北京,东城区],后面两个在回调中没有修改,不知道我的渲染方法有问题还是什么问题。
@@ -1525,28 +1796,10 @@ export default {
1525
1796
  }
1526
1797
 
1527
1798
  }
1528
- /*let value=[]
1529
- for (let i=0;i<fileList.length;i++){
1530
- value[i]={}
1531
- value[i].name=fileList[i].name
1532
- if(fileList[i].response){
1533
- value[i].url=fileList[i].response.data
1534
- }
1535
- else {
1536
- value[i].url=fileList[i].url
1537
- }
1538
- }
1539
- for (let i=0;i<this.formShow.form.formFieldRelation.length;i++){
1540
- if (this.formShow.form.formFieldRelation[i].fieldId===this.filedId){
1541
- this.fileListList[this.filedId]=value
1542
- }
1543
- }*/
1544
- /*this.fileListList = [...this.fileListList]*/
1545
1799
  },
1546
1800
  handleEditChange(file,fileList){
1547
1801
  this.hideUploadEdit=fileList.length >= this.limitNum
1548
1802
  },
1549
-
1550
1803
  onUploadProgress: function (progress, point, file, videoData) {
1551
1804
  console.debug("upload video progress", progress, point);
1552
1805
  if (progress === 1) {
@@ -1559,64 +1812,275 @@ export default {
1559
1812
 
1560
1813
  }
1561
1814
  },
1562
- checkUpload(id,limitNum){
1815
+ checkUpload(id,extInfo){
1563
1816
  this.filedId=id
1564
- this.limitNum = limitNum
1817
+ this.limitNum = extInfo.limitNum?extInfo.limitNum:(extInfo.limit?extInfo.limit:1)
1565
1818
 
1566
1819
  },
1567
- beforeAvatarUpload(file){
1568
- const isLte2M = file.size / 1024 / 1024 <= 8;
1569
- const isSupportedFormat =file.type.indexOf('image')!==-1
1570
- if (!isSupportedFormat){
1571
- this.$message.error("只能上传图片格式");
1572
- return false
1820
+ beforeAvatarUpload(file,type){
1821
+ if (type === 'IMAGE'){
1822
+ const isLte2M = file.size / 1024 / 1024 <= 8;
1823
+ const isSupportedFormat =file.type.indexOf('image')!==-1
1824
+ if (!isSupportedFormat){
1825
+ this.$message.error("只能上传图片格式");
1826
+ return false
1827
+ }
1828
+ if (!isLte2M) {
1829
+ this.$message.error("上传图片大小不能超过 8MB!");
1830
+ return false
1831
+ }
1832
+ return true
1573
1833
  }
1574
- if (!isLte2M) {
1575
- this.$message.error("上传图片大小不能超过 8MB!");
1576
- return false
1834
+ else if (type === 'VIDEO'){
1835
+ const isLte2M = file.size / 1024 / 1024 <= 100;
1836
+ const isSupportedFormat =file.type.indexOf('video')!==-1
1837
+ if (!isSupportedFormat){
1838
+ this.$message.error("只能上传视频格式");
1839
+ return false
1840
+ }
1841
+ if (!isLte2M&&isSupportedFormat) {
1842
+ this.$message.error("上传视频大小不能超过100MB!");
1843
+ return false
1844
+ }
1845
+ return true
1846
+ }
1847
+ else if (type === 'FILE' || type === 'ATTACHMENT'){
1848
+ const isLte2M = file.size / 1024 / 1024 <= 100;
1849
+ if (!isLte2M) {
1850
+ this.$message.error("上传附件大小不能超过100MB!");
1851
+ return false
1852
+ }
1853
+ return true
1577
1854
  }
1578
- return true
1855
+
1579
1856
  },
1580
1857
  exceedUpload(){
1581
- this.$message.warning('上传文件数量达到上限')
1858
+ this.$message({
1859
+ message:"上传文件数量达到上限",
1860
+ duration:2000,
1861
+ type:'warning'
1862
+ })
1582
1863
  },
1583
1864
 
1584
1865
  handlePictureCardPreview(file) {
1585
1866
  this.videoFlag = true;
1586
1867
  this.videoUploadPercent = file.percentage.toFixed(0);
1587
1868
  },
1588
- },
1589
- //时间日期范围的点击事件
1590
- /* dateTimeClick(id){
1591
- for (let i=0;i<this.formList.form.formFieldRelation.length;i++)
1592
- {
1593
- if(this.formList.form.formFieldRelation[i].formField.id===id)
1594
- {
1595
- this.dateTimeId=id
1596
- this.showDateTimePicker = true
1597
- break
1869
+ refTemplateVisibleChange(visible,field) {
1870
+ let fields = field.formField.type === 'REF' ? field.formField.extInfo.ref.field : field.formField.extInfo.ref.vars
1871
+ if (visible) {
1872
+ if (
1873
+ !this.refTemplateList[field.fieldId] || this.dataQuery[field.fieldId].hasNextPage
1874
+ ) {
1875
+ this.$set(this.refTemplateList, field.fieldId, [])
1876
+ !this.dataQuery[field.fieldId] && this.$set(this.dataQuery,field.fieldId, {
1877
+ filterId: '',
1878
+ keywords: '',
1879
+ pageInfo: {
1880
+ pageNo: 1,
1881
+ pageSize: 20
1882
+ },
1883
+ sortInfos: [],
1884
+ templateId: ''
1885
+ })
1886
+ this.getTemplateList(field.formField.extInfo.ref.source, fields, field)
1598
1887
  }
1599
1888
  }
1600
1889
  },
1601
- dateTimeClick1(id){
1602
- if(this.dateTimeValue.length === 0)
1603
- {
1604
- this.$message.error('请先选择开始日期时间')
1605
- }
1606
- else
1607
- {
1608
- for (let i=0;i<this.formList.form.formFieldRelation.length;i++)
1609
- {
1610
- if(this.formList.form.formFieldRelation[i].formField.id===id)
1611
- {
1612
- this.dateTimeId=id
1613
- this.showDateTimePicker1 = true
1614
- break
1890
+ getTemplateList(templateId, fieldId, field) {
1891
+ let url = '/order-api/data-template/data/page'
1892
+ this.dataQuery[field.fieldId].templateId = templateId
1893
+ // let dataQuery = {
1894
+ // filterId: '',
1895
+ // keywords: '',
1896
+ // pageInfo: {
1897
+ // pageNo: 1,
1898
+ // pageSize: 20
1899
+ // },
1900
+ // sortInfos: [],
1901
+ // templateId: templateId
1902
+ // }
1903
+ this.$http.post(url, this.dataQuery[field.fieldId]).then(res => {
1904
+ if (res.data.code === '0') {
1905
+ let list = res.data.data.data
1906
+ this.dataQuery[field.fieldId].hasNextPage = res.data.data.hasNextPage
1907
+ // this.isHasNext[field.id] = res.data.data.hasNextPage
1908
+ let templateList = []
1909
+ templateList = list.map(res => {
1910
+ let info = {}
1911
+ for (let key in res.fieldValues) {
1912
+ if (Array.isArray(fieldId)) {
1913
+ let vals = ''
1914
+ let values = ''
1915
+ fieldId.forEach(val => {
1916
+ vals += val
1917
+ if (res.fieldValues[val]) {
1918
+ values += res.fieldValues[val]
1919
+ }
1920
+ })
1921
+ info[vals] = values
1922
+ info.id = res.id
1923
+ info.name = values
1924
+ } else {
1925
+ if (fieldId === key) {
1926
+ info[key] = res.fieldValues[key]
1927
+ info.id = res.id
1928
+ info.name = res.fieldValues[key]
1929
+ }
1930
+ }
1931
+ }
1932
+ return info
1933
+ })
1934
+ this.$nextTick(() =>{
1935
+ this.$set(this.refTemplateList,field.fieldId,[
1936
+ ...this.refTemplateList[field.fieldId],
1937
+ ...templateList
1938
+ ])
1939
+ })
1940
+ }
1941
+ })
1942
+ },
1943
+ lodeMore(item) {
1944
+ this.dataQuery[item.fieldId].pageInfo.pageNo += 1
1945
+ this.refTemplateVisibleChange(true,item)
1946
+ },
1947
+ //打开级联/下拉抽屉选择
1948
+ openDrawer(field,type){
1949
+ this.detailField = field;
1950
+ console.debug('type',type)
1951
+ if (type == 'cascader' || type === 'pc_cascader'){
1952
+ if (type == 'cascader'){
1953
+ this.showArea = true;
1954
+ }
1955
+ else {
1956
+ this.drawer = true;
1957
+ }
1958
+ this.$nextTick(()=>{
1959
+ let arr = this.checkDatas[field.fieldId]?this.checkDatas[field.fieldId]:[]
1960
+ console.debug('drawerTree',this.$refs.drawerTree)
1961
+ let drawerTree = this.$refs.drawerTree
1962
+ if (drawerTree){
1963
+ drawerTree.forEach(item=>{
1964
+ item.$refs.dataTree.setCheckedNodes (arr);
1965
+ item.checked = this.checkDatas[field.fieldId] && this.checkDatas[field.fieldId][0]?this.checkDatas[field.fieldId][0].value:'';
1966
+ })
1615
1967
  }
1968
+
1969
+ })
1970
+ }
1971
+ else if (type === 'select'){
1972
+ this.options = field.formField.extInfo.option?field.formField.extInfo.option:field.formField.extInfo.options;
1973
+ this.selectPopUp = true;
1974
+ if (!this.detailField.value){
1975
+ return
1976
+ }
1977
+ if (Array.isArray(this.detailField.value)){
1978
+ this.defaultValue = this.detailField.value
1616
1979
  }
1980
+ else {
1981
+ this.defaultValue = [this.detailField.value]
1982
+ }
1983
+ console.debug('selectPopUp',this.selectPopUp,this.options)
1984
+ }
1985
+ },
1986
+ //保存级联数据
1987
+ saveData(checkList,checkDatas){
1988
+ this.$set(this.detailField,'value',checkList);
1989
+ this.checkDatas[this.detailField.fieldId] = checkDatas;
1990
+ this.$set(this.detailField.formField.extInfo,'fieldValue',this.checkDatas)
1991
+ this.$forceUpdate();
1992
+ this.showArea = false;
1993
+ this.drawer = false;
1994
+ },
1995
+ //保存所选下拉值
1996
+ confirmSelect(option, list){
1997
+ console.debug('option',option,list)
1998
+ this.detailField.value = list;
1999
+ this.selectPopUp = false
2000
+ this.selectPicker = false
2001
+ },
2002
+ //保存ref类型值
2003
+ confirmRefSelect(option, list){
2004
+ console.debug('options',option,list)
2005
+ if (!option || !list){
2006
+ this.refShowPicker = false;
2007
+ return
1617
2008
  }
2009
+ this.detailField.value = list;
2010
+ let val = option?option.map(item=>{
2011
+ return item.name
2012
+ }):[]
2013
+ this.selectValue[this.detailField.fieldId] = val;
2014
+ this.refShowPicker = false;
2015
+ },
2016
+ // 一个重复的方法 兼容 状态优先级 的关联控件,
2017
+ relationSet(field,list) {
2018
+ let flag = false
2019
+ console.debug('field',field,field.extInfo && field.extInfo[list])
2020
+ // 如果在extInfo下有该字段,表示已被关联,否则根据 类型去判断 retrun true 或者false
2021
+ if(field.extInfo && field.extInfo[list] && Object.keys(field.extInfo[list]).length !== 0) {
2022
+ for (const key in field.extInfo[list]) {
2023
+ const element = field.extInfo[list][key];
2024
+ let orderFieldValue = ""
2025
+ for (let i=0;i<this.formShow.form.formFieldRelation.length;i++){
2026
+ if (key === this.formShow.form.formFieldRelation[i].fieldId || key === this.formShow.form.formFieldRelation[i].formField.workOrderFieldId){
2027
+ orderFieldValue = this.formShow.form.formFieldRelation[i].value
2028
+ break
2029
+ }
2030
+ }
2031
+ console.debug('orderFieldValue',orderFieldValue)
2032
+ if(orderFieldValue) {
2033
+ if(Array.isArray(orderFieldValue)) {
2034
+ if(Array.isArray(element)) {
2035
+ for (let index = 0; index < element.length; index++) {
2036
+ flag = orderFieldValue.some(item =>{ return item == element[index] })
2037
+ if(flag) {
2038
+ return flag
2039
+ }
2040
+ }
2041
+ } else {
2042
+ flag = orderFieldValue.some(item =>{ return item == element })
2043
+ if(flag) {
2044
+ return flag
2045
+ }
2046
+ }
2047
+ } else {
2048
+ if(Array.isArray(element)) {
2049
+ for (let index = 0; index < element.length; index++) {
2050
+ flag = element[index] == orderFieldValue
2051
+ if(flag) {
2052
+ return flag
2053
+ }
2054
+ }
2055
+ } else {
2056
+ flag = element == orderFieldValue
2057
+ if(flag) {
2058
+ return flag
2059
+ }
2060
+ }
1618
2061
 
1619
- },*/
2062
+ }
2063
+ }
2064
+ else if(list == 'dependentFieldId') {
2065
+ return flag = false
2066
+ }
2067
+ }
2068
+ } else if(list == 'dependentFieldId') {
2069
+ return flag = true
2070
+ } else if(list == 'requiredDependentFieldId') {
2071
+ return flag = false
2072
+ }
2073
+ return flag
2074
+ },
2075
+ },
2076
+ watch:{
2077
+ formFieldValus:{
2078
+ handler(value){
2079
+ console.log(value);
2080
+ },
2081
+ deep:true
2082
+ }
2083
+ }
1620
2084
 
1621
2085
 
1622
2086
 
@@ -1684,6 +2148,34 @@ export default {
1684
2148
  border-bottom-left-radius: 9px!important;
1685
2149
  border-bottom-right-radius: 9px!important;
1686
2150
  }
2151
+ .cascader-class{
2152
+ padding: 10px 16px;
2153
+ }
2154
+ .cascader-input{
2155
+ -webkit-appearance: none;
2156
+ background-image: none;
2157
+ border: 1px solid #E0E6F7;
2158
+ -webkit-box-sizing: border-box;
2159
+ box-sizing: border-box;
2160
+ color: #606266;
2161
+ display: inline-block;
2162
+ height: 40px;
2163
+ line-height: 40px;
2164
+ outline: 0;
2165
+ padding: 0 15px;
2166
+ -webkit-transition: border-color .2s cubic-bezier(.645,.045,.355,1);
2167
+ transition: border-color .2s cubic-bezier(.645,.045,.355,1);
2168
+ width: 100%;
2169
+ background-color: transparent!important;
2170
+ border-radius: 9px!important;
2171
+ cursor: pointer;
2172
+ font-size: 14px;
2173
+ }
2174
+ .cascader-name{
2175
+ color: #A9B3C6;
2176
+ font-size: 1em;
2177
+ padding-bottom: 8px;
2178
+ }
1687
2179
  }
1688
2180
  .pcFormClass{
1689
2181
  width: 400px;
@@ -1707,6 +2199,31 @@ export default {
1707
2199
  border-radius: 9px!important;
1708
2200
  padding: 9px 15px!important;
1709
2201
  }
2202
+ .upload-demo{
2203
+ background-color: #FFFFFF;
2204
+ border: 1px solid #E0E6F7;
2205
+ border-radius: 10px;
2206
+ width: 74px;
2207
+ height: 74px;
2208
+ vertical-align: top;
2209
+ cursor: pointer;
2210
+ text-align: center;
2211
+ font-size:28px;
2212
+ color:#366AFF;
2213
+ display: -webkit-box;
2214
+ align-items: center;
2215
+ justify-content: center;
2216
+ i{
2217
+ color: #366AFF;
2218
+ }
2219
+ /deep/.el-upload{
2220
+ height: 100%;
2221
+ width: 100%;
2222
+ display: flex;
2223
+ align-items: center;
2224
+ justify-content: center;
2225
+ }
2226
+ }
1710
2227
  /deep/.el-upload--picture-card{
1711
2228
  background-color: #FFFFFF;
1712
2229
  border: 1px solid #E0E6F7;
@@ -1774,6 +2291,7 @@ export default {
1774
2291
  .remPhoneClassForm{
1775
2292
  .mobileFormClass{
1776
2293
  width: calc(100vw - 110px);
2294
+ background-color: white;
1777
2295
  .form-field-item{
1778
2296
  .form-field-item-value{
1779
2297
  /deep/.van-cell{
@@ -1790,7 +2308,7 @@ export default {
1790
2308
  color: #999999!important;
1791
2309
  }
1792
2310
  .form-field-item-file{
1793
- padding: 8px;
2311
+ padding: 10px 16px;
1794
2312
  .fileName{
1795
2313
  padding-bottom: 8px;
1796
2314
  color: #A9B3C6;
@@ -2000,5 +2518,8 @@ export default {
2000
2518
  height: 14px !important;
2001
2519
  }
2002
2520
  }
2003
-
2521
+ .drawer-container{
2522
+ height: 100%;
2523
+ overflow: hidden;
2524
+ }
2004
2525
  </style>