askbot-dragon 0.7.89 → 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.
Files changed (70) hide show
  1. package/README.md +27 -27
  2. package/babel.config.js +5 -5
  3. package/dragon.iml +7 -7
  4. package/package.json +55 -55
  5. package/public/index.html +30 -30
  6. package/src/App.vue +31 -31
  7. package/src/api/index.js +1 -1
  8. package/src/api/mock.http +2 -2
  9. package/src/api/requestUrl.js +185 -185
  10. package/src/assets/js/AliyunlssUtil.js +92 -92
  11. package/src/assets/js/Base64Util.js +22 -22
  12. package/src/assets/js/script.js +36 -36
  13. package/src/assets/less/common.css +6773 -6773
  14. package/src/assets/less/converSationContainer/common.less +191 -191
  15. package/src/assets/less/converSationContainer/converSatonContainer.less +493 -493
  16. package/src/assets/less/iconfont.css +37 -37
  17. package/src/assets/less/ticketMessage.less +211 -211
  18. package/src/components/ActionAlertIframe.vue +112 -112
  19. package/src/components/AiGuide.vue +467 -467
  20. package/src/components/AskIFrame.vue +15 -15
  21. package/src/components/ConversationContainer.vue +2110 -1318
  22. package/src/components/FileType.vue +86 -86
  23. package/src/components/Message.vue +27 -27
  24. package/src/components/actionSatisfaction.vue +107 -107
  25. package/src/components/actionSendToBot.vue +62 -62
  26. package/src/components/answerDissatisfaction.vue +62 -62
  27. package/src/components/answerRadio.vue +76 -76
  28. package/src/components/ask-components/DissatisfactionOptions.vue +57 -57
  29. package/src/components/ask-components/Msgloading.vue +37 -37
  30. package/src/components/ask-components/SatisfactionV2.vue +15 -15
  31. package/src/components/askVideo.vue +138 -138
  32. package/src/components/assetDetails.vue +370 -370
  33. package/src/components/assetMessage.vue +228 -228
  34. package/src/components/associationIntention.vue +229 -229
  35. package/src/components/botActionSatisfactor.vue +68 -68
  36. package/src/components/chatContent.vue +513 -513
  37. package/src/components/feedBack.vue +136 -136
  38. package/src/components/file/AliyunOssComponents.vue +108 -108
  39. package/src/components/formTemplate.vue +2524 -1969
  40. package/src/components/loadingProcess.vue +164 -164
  41. package/src/components/message/ActionAlertIframe.vue +112 -112
  42. package/src/components/message/ShopMessage.vue +164 -164
  43. package/src/components/message/TextMessage.vue +924 -924
  44. package/src/components/message/TicketMessage.vue +177 -177
  45. package/src/components/message/swiper/index.js +4 -4
  46. package/src/components/message/swiper/ticketSwiper.vue +502 -502
  47. package/src/components/message/swiper/ticketSwiperItem.vue +61 -61
  48. package/src/components/msgLoading.vue +231 -231
  49. package/src/components/myPopup.vue +71 -0
  50. package/src/components/popup.vue +184 -0
  51. package/src/components/recommend.vue +89 -89
  52. package/src/components/selector/hOption.vue +20 -20
  53. package/src/components/selector/hSelector.vue +199 -199
  54. package/src/components/selector/hWrapper.vue +216 -216
  55. package/src/components/source/BotMessage.vue +24 -24
  56. package/src/components/source/CustomMessage.vue +24 -24
  57. package/src/components/test.vue +260 -260
  58. package/src/components/tree.vue +159 -0
  59. package/src/components/utils/AliyunIssUtil.js +72 -72
  60. package/src/components/utils/ckeditor.js +123 -123
  61. package/src/components/utils/command.js +68 -68
  62. package/src/components/utils/editing.js +11 -11
  63. package/src/components/utils/format_date.js +25 -18
  64. package/src/components/utils/index.js +6 -6
  65. package/src/components/utils/math_utils.js +15 -15
  66. package/src/components/utils/plugin-image.js +11 -11
  67. package/src/components/utils/toolbar-ui.js +41 -41
  68. package/src/components/voiceComponent.vue +119 -119
  69. package/src/main.js +45 -45
  70. package/vue.config.js +43 -34
@@ -1,1970 +1,2525 @@
1
- <template>
2
- <div class="media-body">
3
- <div class="formClass" :class="isPhone?'remPhoneClassForm':'remCompanyClassForm'" v-if="formShow.form">
4
- <div class="titleName" >
5
- {{formShow.form.name}}
6
- </div>
7
- <div class="title-link"></div>
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">
15
- <span v-if="item.fieldId!=='workorder_description'&&item.fieldId!=='workorder_clientId'">{{item.formField.name}}</span>
16
- <span v-if="item.fieldId==='workorder_description'">问题描述</span>
17
- <span v-if="item.fieldId==='workorder_clientId'">报单人</span>
18
- <span style="color: red;padding-left: 5px" v-if="item.required===true">*</span>
19
- </div>
20
- <el-input v-model=item.value
21
- :placeholder="item.formField.extInfo&&item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请输入'"
22
- :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
- ></el-input>
25
- <div v-if="item.formField.type==='EXPLANATION'">
26
- <div class="explanation">
27
- <p class="explanation-p">
28
- <span class="el-icon-info"></span>
29
- {{item.formField.extInfo.descriptionText}}
30
- </p>
31
- </div>
32
- </div>
33
- <div v-if="item.formField.type==='EXPLAIN'">
34
- <div class="explanation">
35
- <p class="explanation-p">
36
- <span class="el-icon-info"></span>
37
- <span v-if="item.formField.extInfo.url" class="explain-url"><a :href="item.formField.extInfo.url" target="_blank">{{item.value}}</a></span>
38
- <span v-else>{{item.value}}</span>
39
- </p>
40
- </div>
41
- </div>
42
- <el-input type="textarea" :rows="2" v-model=item.value
43
- :placeholder="item.formField.extInfo&&item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请输入'"
44
- :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
- ></el-input>
47
- <ckeditor
48
- :editor="ckeditor.editor"
49
- v-model="item.value"
50
- :config="ckeditor.editorConfig"
51
- v-else-if="item.display&&item.fieldId==='workorder_description'"
52
- ></ckeditor>
53
- <el-date-picker
54
- v-model=item.value
55
- type="date"
56
- :placeholder="item.formField.extInfo&&item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请选择日期'"
57
- style="width: 100%"
58
- v-if="item.formField.type==='DATE_PICKER'"
59
- >
60
- </el-date-picker>
61
- <el-time-picker
62
- v-model=item.value
63
- :placeholder="item.formField.extInfo&&item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请选择时间'"
64
- style="width: 100%"
65
- v-if="item.formField.type==='TIME_PICKER' && !item.formField.extInfo.mold"
66
- >
67
- </el-time-picker>
68
- <el-date-picker
69
- v-model=item.value
70
- type="date"
71
- style="width: 100%"
72
- :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
- >
75
- </el-date-picker>
76
- <el-date-picker
77
- v-model=item.value
78
- :placeholder="item.formField.extInfo&&item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请选择日期时间'"
79
- clearable
80
- style="width: 100%"
81
- type="datetime"
82
- v-if="item.formField.type==='TIME_PICKER' &&item.formField.extInfo.mold==='DATA_TIME'"
83
- >
84
- </el-date-picker>
85
- <div v-if="item.formField.type==='RADIO' &&item.formField.extInfo.options">
86
- <el-radio-group v-model=item.value style="text-align:left">
87
- <el-radio v-for="(items,index) in item.formField.extInfo.options" :label=items.value :key="index">{{items.label}}</el-radio>
88
- </el-radio-group>
89
- </div>
90
- <div v-if="item.formField.type==='RADIO' &&item.formField.extInfo.option">
91
- <el-radio-group v-model=item.value style="text-align:left">
92
- <el-radio v-for="(items,index) in item.formField.extInfo.option" :label=items.value :key="index">{{items.label}}</el-radio>
93
- </el-radio-group>
94
- </div>
95
- <div v-if="item.formField.type==='CHECKBOX' && item.formField.extInfo.option">
96
- <el-checkbox-group v-model=item.value style="text-align:left">
97
- <el-checkbox
98
- v-for="(items,index) in item.formField.extInfo.option"
99
- :label=items.value
100
- :key="index"
101
- >{{items.label}}</el-checkbox>
102
- </el-checkbox-group>
103
- </div>
104
- <div v-if="item.formField.type==='CHECKBOX' && item.formField.extInfo.options">
105
- <el-checkbox-group v-model=item.value style="text-align:left">
106
- <el-checkbox
107
- v-for="(items,index) in item.formField.extInfo.options"
108
- :label=items.value
109
- :key="index"
110
- >{{items.label}}</el-checkbox>
111
- </el-checkbox-group>
112
- </div>
113
- <div v-if="item.formField.type==='SELECT' || item.formField.type==='OPTION'" >
114
- <el-select
115
- v-model=item.value
116
- :placeholder="item.formField.extInfo&&item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请选择'"
117
- style="width: 100%"
118
- filterable
119
- v-if="item.formField.extInfo && item.formField.extInfo.option"
120
- >
121
- <el-option
122
- v-for="(items,index) in item.formField.extInfo.option"
123
- :key="index"
124
- :label="items.label"
125
- :value="items.value">
126
- </el-option>
127
- </el-select>
128
- <el-select
129
- v-model=item.value
130
- :placeholder="item.formField.extInfo&&item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请选择'"
131
- style="width: 100%"
132
- filterable
133
- v-else-if="item.formField.extInfo && item.formField.extInfo.options"
134
- >
135
- <el-option
136
- v-for="(items,index) in item.formField.extInfo.options"
137
- :key="index"
138
- :label="items.label"
139
- :value="items.value">
140
- </el-option>
141
- </el-select>
142
- </div>
143
- <div v-if="item.formField.type==='CASCADER'">
144
- <el-cascader
145
- v-model=item.value
146
- :options=item.formField.extInfo.cascade
147
- style="width: 100%;"
148
- :placeholder="item.formField.extInfo&&item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请选择时间'"
149
- v-if="item.formField.extInfo.cascade"
150
- ></el-cascader>
151
- <el-cascader
152
- v-model=item.value
153
- :options=item.formField.extInfo.cascadeDown[0].options
154
- style="width: 100%;"
155
- :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;">
161
- <el-upload
162
- class="upload-demo"
163
- ref="upload"
164
- list-type="picture-card"
165
- accept="image/*"
166
- name="file"
167
- action="/open/media/file/upload"
168
- :multiple="item.formField.extInfo&&item.formField.extInfo.limitNum&&item.formField.extInfo.limitNum>1?true:false"
169
- :file-list="fileListList[item.fieldId]"
170
- :limit=item.formField.extInfo.limitNum?Number(item.formField.extInfo.limitNum):1
171
- :before-upload="beforeAvatarUpload"
172
- :on-exceed="exceedUpload"
173
- :on-remove="handleRemove"
174
- :http-request="aliyunOssRequest"
175
- :on-change="handleEditChange"
176
- :on-success="successUpload"
177
- >
178
- <i class="el-icon-plus"></i>
179
- </el-upload>
180
- </div>
181
- </div>
182
- </div>
183
- </div>
184
- </div>
185
- <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"
188
- class="form-field-item"
189
- >
190
- <div v-if="item.formField.type==='INPUT'" class="form-field-item-value">
191
- <van-field v-model=item.value
192
- :label=item.formField.name
193
- :required="item.required===true"
194
- :disabled="disableds"
195
- :placeholder="item.formField.extInfo&&item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请输入'"
196
- :maxlength="item.formField.extInfo&&item.formField.extInfo.maxNum?item.formField.extInfo.maxNum*1:1000"
197
- />
198
- </div>
199
- <div v-else-if="item.formField.type==='EXPLANATION'||item.formField.type==='EXPLAIN'" class="explan-ation">
200
- <div class="explanation">
201
- <p class="explanation-p" v-if="item.formField.type==='EXPLANATION'">
202
- <span class="el-icon-info"></span>
203
- {{item.formField.extInfo.descriptionText}}
204
- </p>
205
- <p v-else class="explanation-p">
206
- <span class="el-icon-info"></span>
207
- <span v-if="item.formField.extInfo.url" class="explain-url"><a :href="item.formField.extInfo.url" target="_blank">{{item.value}}</a></span>
208
- <span v-else>{{item.value}}</span>
209
- </p>
210
- </div>
211
- </div>
212
- <div v-else-if="item.formField.type==='TEXTAREA'" class="form-field-item-value">
213
- <van-field v-model=item.value
214
- :label=item.formField.name
215
- :required="item.required===true"
216
- type="textarea"
217
- :disabled="disableds"
218
- :placeholder="item.formField.extInfo&&item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请输入'"
219
- :maxlength="item.formField.extInfo&&item.formField.extInfo.maxNum?item.formField.extInfo.maxNum*1:1000"
220
- v-if="item.fieldId!=='workorder_description'"
221
- />
222
- <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>
225
- {{item.formField.name}}
226
- </div>
227
- <ckeditor
228
- :editor="ckeditor.editor"
229
- v-model="item.value"
230
- @onReady="onReady"
231
- :config="ckeditor.editorConfig"
232
- ></ckeditor>
233
- </div>
234
- </div>
235
- <div v-else-if="item.formField.type==='DATE_PICKER'" class="form-field-item-value">
236
- <van-field
237
- readonly
238
- clickable
239
- name="calendar"
240
- :value=dateValue[item.fieldId]
241
- :label=item.formField.name
242
- :placeholder="item.formField.extInfo&&item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请选择日期'"
243
- :required="item.required===true"
244
- @click="dateClick(item.fieldId)"
245
- :disabled="disableds"
246
- right-icon="van-icon van-icon-arrow van-cell__right-icon"
247
- />
248
- <van-calendar
249
- v-model="showCalendar"
250
- @confirm="onConfirmCalendar($event,dateId)"
251
- />
252
- </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">
254
- <van-field
255
- readonly
256
- clickable
257
- name="datetimePicker"
258
- :required="item.required===true"
259
- :value=timeValue[item.fieldId]
260
- :label=item.formField.name
261
- :placeholder="item.formField.extInfo&&item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请选择时间'"
262
- @click="timeClick(item.fieldId,item)"
263
- :disabled="disableds"
264
- right-icon="van-icon van-icon-arrow van-cell__right-icon"
265
-
266
- />
267
- <van-popup v-model="showTimePicker" position="bottom">
268
- <van-datetime-picker
269
- v-model="currentDate"
270
- type="datetime"
271
- @confirm="onConfirm($event,timeId,item)"
272
- @cancel="showTimePicker = false"
273
- :min-date="minDate"
274
- :formatter="formatter"
275
- :max-date="maxDate"
276
- />
277
- </van-popup>
278
- </div>
279
- <div v-else-if="item.formField.type==='TIME_PICKER'&&item.formField.extInfo.mold==='DATA'" class="form-field-item-value">
280
- <van-field
281
- readonly
282
- clickable
283
- name="datetimePicker"
284
- :required="item.required===true"
285
- :value=timeValue[item.fieldId]
286
- :label=item.formField.name
287
- :placeholder="item.formField.extInfo&&item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请选择日期'"
288
- @click="timeClick(item.fieldId,item)"
289
- :disabled="disableds"
290
- right-icon="van-icon van-icon-arrow van-cell__right-icon"
291
-
292
- />
293
- <van-calendar v-model="showTimePickerd" :show-confirm="false" @confirm="onConfirm($event,timeId,item)" @cancel="showTimePickerd = false"/>
294
- </div>
295
- <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">
297
- <template #input style="display: flex;align-items: center">
298
- <van-radio-group v-model=item.value direction="horizontal" :disabled="disableds">
299
- <van-radio v-for="(items,index) in item.formField.extInfo.option" :name=items.value :key="index">{{items.label}}</van-radio>
300
- </van-radio-group>
301
- </template>
302
- </van-field>
303
- <van-field name="radio" :label="item.formField.name" :required="item.required===true" :disabled="disableds" v-if="item.formField.extInfo.options">
304
- <template #input style="display: flex;align-items: center" >
305
- <van-radio-group v-model=item.value direction="horizontal" :disabled="disableds">
306
- <van-radio v-for="(items,index) in item.formField.extInfo.options" :name=items.value :key="index">{{items.label}}</van-radio>
307
- </van-radio-group>
308
- </template>
309
- </van-field>
310
- </div>
311
- <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">
313
- <template #input style="display: flex;align-items: center" >
314
- <van-checkbox-group v-model=item.value ref="checkboxGroup" direction="horizontal" :disabled="disableds">
315
- <van-checkbox
316
- v-for="(items,index) in item.formField.extInfo.option"
317
- shape="square"
318
- :key="index"
319
- :name=items.value>
320
- {{items.label}}
321
- </van-checkbox>
322
- </van-checkbox-group>
323
- </template>
324
- </van-field>
325
- <van-field name="checkbox" :label=item.formField.name :required="item.required===true" :disabled="disableds" v-if="item.formField.extInfo.options">
326
- <template #input style="display: flex;align-items: center" >
327
- <van-checkbox-group v-model=item.value ref="checkboxGroup" direction="horizontal" :disabled="disableds">
328
- <van-checkbox
329
- v-for="(items,index) in item.formField.extInfo.options"
330
- shape="square"
331
- :key="index"
332
- :name=items.value>
333
- {{items.label}}
334
- </van-checkbox>
335
- </van-checkbox-group>
336
- </template>
337
- </van-field>
338
- </div>
339
- <div v-else-if="item.formField.type==='SELECT' || item.formField.type==='OPTION'" class="form-field-item-value">
340
- <van-field
341
- readonly
342
- clickable
343
- name="picker"
344
- :value=selectValues[item.fieldId]
345
- :label=item.formField.name
346
- :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"
350
- @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"
363
- :disabled="disableds"
364
- @click-right-icon.stop="SelectClear(item.fieldId)"
365
- v-if="item.fieldId==='workorder_clientId'"
366
- :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
- />
377
- </van-popup>
378
- </div>
379
- <div v-else-if="item.formField.type==='CASCADER'" class="form-field-item-value">
380
- <van-field
381
- readonly
382
- clickable
383
- name="area"
384
- :value=cascadeValue[item.fieldId]
385
- :label=item.formField.name
386
- :placeholder="item.formField.extInfo&&item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请选择'"
387
- @click="pickerClick(item.fieldId)"
388
- :required="item.required===true"
389
- :disabled="disableds"
390
- right-icon="van-icon van-icon-arrow van-cell__right-icon"
391
- />
392
-
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
- />
403
- </van-popup>
404
- </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>
408
- <van-uploader
409
- v-model="fileListList[item.fieldId]"
410
- :before-read="beforeRead"
411
- :max-count='item.formField.extInfo&&item.formField.extInfo.limitNum?item.formField.extInfo.limitNum:1'
412
- :after-read="afterRead"
413
- accept="image/*"
414
- :multiple="item.formField.extInfo&&item.formField.extInfo.limitNum&&item.formField.extInfo.limitNum>1?true:false"
415
- >
416
- <div class="vant-upload--picture-card">
417
- <i class="el-icon-plus"></i>
418
- </div>
419
-
420
- </van-uploader>
421
- </div>
422
- </div>
423
- </div>
424
- <van-popup v-model="fileUpload" :close-on-click-overlay="false">
425
- <div style="background-color: black;height: 100px;width: 100px;display: flex;justify-content: center;align-items: center" >
426
- <van-loading type="spinner"/>
427
- </div>
428
- </van-popup>
429
- </div>
430
- <div class="bottom-link"></div>
431
- <div class="form-submit-btn" v-if="isCompany">
432
- <el-button style="border-color: #366aff;color: white;background-color: #366aff" round class="submitClass" size="small" @click="submitClick" :disabled="disableds">
433
- <i class="el-icon-check" v-if="!disableds"></i>
434
- {{submitValue}}
435
- </el-button>
436
- </div>
437
- <div class="form-submit-btn" v-else>
438
- <van-button round type="info" class="submitClass" @click="submitClick" :disabled="disableds">
439
- <i class="el-icon-check" v-if="!disableds"></i>
440
- {{submitValue}}
441
- </van-button>
442
- </div>
443
- </div>
444
- <el-dialog :visible.sync="dialogVisible">
445
- <img width="100%" :src="dialogImageUrl" alt="">
446
- </el-dialog>
447
-
448
- </div>
449
- </template>
450
-
451
- <script>
452
- /* eslint-disable */
453
- let that
454
- import {multipartUpload,ossFileUrl} from "./utils/AliyunIssUtil";
455
- import {MyCustomUploadAdapterPlugin} from "./utils/ckeditor";
456
- import MyimageUpload from './utils/plugin-image'
457
- import CKEDITOR from 'ckeditor'
458
-
459
- export default {
460
- name: "formTemplate",
461
- data() {
462
- return {
463
- isPhone: false,
464
- isCompany: false,
465
- checkboxGroup: [],
466
- currentDate: new Date(),
467
- timeValue: [],
468
- dateValue: [],
469
- showPicker: false,
470
- showTimePicker: false,
471
- showTimePickerd:false,
472
- showCalendar: false,
473
- radio: [],
474
- selectValue: [],
475
- pickerValue: [],
476
- showArea: false,
477
- dateTimeValue: [],
478
- dateTimeValue1: [],
479
- showDateTimePicker: false,
480
- showDateTimePicker1: false,
481
- pickerId: 0,
482
- dateId: 0,
483
- timeId: 0,
484
- selectId: 0,
485
- dateTimeId: 0,
486
- column: [
487
- {
488
- values: '', // 设置的页面初始值
489
- className: "column1"
490
- },
491
- {
492
- values: '',
493
- className: "column2",
494
- },
495
- {
496
- values: '',
497
- className: "column3",
498
- }
499
- ],
500
- pageShow: false, //省市区三级联动是否显示(因为是接口返回的数据,等三级数据渲染完毕之后,在显示三级联动)
501
- cityDates: '', //安联当前选中市的所有区所有数据
502
- data: [],//接口返回所有级联数据
503
- dateTimeRange: '',
504
- selectValues: [],
505
- cascadeValue: [],
506
- minDate: new Date(2020, 0, 1),
507
- maxDate: new Date(2025, 11, 31),
508
- disableds: false,
509
- submitValue: '提交',
510
- clickPicker: '',
511
- columns: [],
512
- copyForm: [],
513
- cascaderId:0,
514
- formShow:[],
515
-
516
- uploadAvatarParams: {
517
- token: "8c98087dfd2d48f856d8c95c09115def",
518
- },
519
- fileListList:[],
520
- keyValue:'',
521
- selectKey:'shuijiao',
522
- filedId:'',
523
- disabled:false,
524
- dialogVisible:false,
525
- dialogImageUrl:'',
526
- fileUpload:false,
527
- videoFlag:false,
528
- videoUploadPercent:false,
529
- fileType:['PICTURE','VIDEO','AUDIO'],
530
- loading:'',
531
- ossConfig: {
532
- region: "oss-cn-zhangjiakou",
533
- //云账号AccessKey有所有API访问权限,建议遵循阿里云安全最佳实践,创建并使用STS方式来进行API访问
534
- accessKeyId: "LTAI4G3QtdEdwkEbihBngAsK",
535
- accessKeySecret: "OwgdVfc5PeCkIgqIdug660xmiSPchn",
536
- // stsToken: '<Your securityToken(STS)>',
537
- bucket: "guoranopen-zjk",
538
- },
539
- hideUploadEdit:false,
540
- limitNum:1,
541
- ckeditor: {
542
- editor: CKEDITOR.ClassicEditor,
543
- editorConfig: {
544
- extraPlugins: [MyimageUpload,MyCustomUploadAdapterPlugin],
545
- toolbar: [
546
- 'MyimageUpload'
547
- ]
548
- },
549
- },
550
-
551
- }
552
- },
553
- props: {
554
- formList: {
555
- type: Object,
556
- default() {
557
- return {}
558
- }
559
- },
560
- type:String,
561
- disable:Boolean,
562
- submit:Boolean,
563
- usePropStyleType:{
564
- type:Boolean,
565
- default() {
566
- return false;
567
- }
568
- },
569
- propIsPhone: {
570
- type:Boolean,
571
- default() {
572
- return false;
573
- }
574
- },
575
- propIsCompany: {
576
- type:Boolean,
577
- default() {
578
- return false;
579
- }
580
- },
581
- uploadUrl: {
582
- type:String,
583
- default(){
584
- return '/open/media/file/upload'
585
- }
586
- }
587
- },
588
- computed:{
589
- acceptType:function () {
590
- return '.jpg,.jpeg,.png,.gif,.JPG,.JPEG,.PBG,.GIF'
591
- },
592
- formFieldRelation:function (){
593
- let arr = [];
594
- this.formShow.form.formFieldRelation.forEach(item=> {
595
- if (item.fieldId!=='workorder_name'&&item.display) {
596
- arr.push(item);
597
- }
598
- })
599
- return arr;
600
- }
601
-
602
- },
603
- mounted() {
604
- this.isMobile()
605
- },
606
- beforeCreate() {
607
- // 等待dom渲染完毕之后,再去显示 三级联动。
608
- that=this
609
- this.$nextTick(function () {
610
- this.pageShow = true;
611
- })
612
- },
613
- created() {
614
- if(this.disable===true)
615
- {
616
- this.disableds=true
617
- this.submitValue = '已提交'
618
- }
619
- else
620
- {
621
- this.disableds=false
622
- this.submitValue = '提交'
623
- }
624
- },
625
- beforeMount() {
626
- that.defaultClick()
627
- },
628
- methods: {
629
- onReady(){
630
-
631
-
632
- },
633
- beforeRead(file){
634
- console.debug('file',file)
635
- console.debug('fileType',!Array.isArray(file))
636
- if (!Array.isArray(file)){
637
- const isLte2M = file.size / 1024 / 1024 <= 8;
638
- const isSupportedFormat =file.type.indexOf('image')!==-1
639
- if (!isSupportedFormat){
640
- this.$message.error("只能上传图片格式");
641
- return false
642
- }
643
- if (!isLte2M&&isSupportedFormat) {
644
- this.$message.error("上传图片大小不能超过 8MB!");
645
- return false
646
- }
647
- return true
648
- }
649
- else{
650
- let length = 0
651
- if (this.fileListList[this.filedId]){
652
- length = this.fileListList[this.filedId].length
653
- }
654
- if (file.length<=this.limitNum-length){
655
- for (let i=0;i<file.length;i++){
656
- const isLte2M = file[i].size / 1024 / 1024 <= 8;
657
- const isSupportedFormat =file[i].type.indexOf('image')!==-1
658
- if (!isSupportedFormat){
659
- this.$message.error("只能上传图片格式");
660
- return false
661
- }
662
- if (!isLte2M&&isSupportedFormat) {
663
- this.$message.error("上传图片大小不能超过 8MB!");
664
- return false
665
- }
666
- return true
667
- }
668
- }
669
- else {
670
- let num = 1
671
- if (this.limitNum){
672
- num = this.limitNum
673
- }
674
- let messageText = '仅支持上传'+num+'张图片'
675
- this.$message.error(messageText);
676
- return false
677
- }
678
-
679
- }
680
-
681
- },
682
- //文件上传至服务器
683
- afterRead(file){
684
- this.fileUpload=true
685
- console.debug(file)
686
- console.debug(!Array.isArray(file))
687
- if (!Array.isArray(file)){
688
- this.uploadImgFun(file.content,file.file.name,file,file.file);
689
- }
690
- else {
691
- let num = 1
692
- if (this.limitNum){
693
- num = this.limitNum
694
- }
695
- if (file.length >num){
696
- this.$message.warning('仅支持上传'+num+'张图片')
697
- return false
698
- }
699
- else {
700
- for (let i = 0; i < file.length; i++){
701
- this.uploadImgFun(file[i].content,file[i].file.name,file[i],file[i].file);
702
- }
703
- }
704
- }
705
- },
706
- uploadImgFun(content,name,fileCon,file){
707
- console.log(fileCon)
708
- let imageData = {
709
- urls:[]
710
- }
711
- let imageInfo = {
712
- name:"",
713
- status:'',
714
- url:''
715
- }
716
- let res = multipartUpload(
717
- this.ossConfig,
718
- file,
719
- null,
720
- imageInfo
721
- );
722
- res.then((res) => {
723
- console.log("upload result:", res);
724
- // let filePath = res.name;
725
- imageData.urls.push({
726
- name:res.name,
727
- url:ossFileUrl(this.ossConfig, res.name),
728
- status:'success'
729
- })
730
- imageInfo.url = ossFileUrl(this.ossConfig, res.name)
731
- imageInfo.status='success'
732
- imageInfo.name=res.name
733
- for (let j=0;j<this.fileListList[this.filedId].length;j++){
734
- if (this.fileListList[this.filedId][j].content&&this.fileListList[this.filedId][j].content===content){
735
- this.fileListList[this.filedId][j].name=res.name
736
- this.fileListList[this.filedId][j].status='success'
737
- this.fileListList[this.filedId][j].url=imageInfo.url
738
- delete this.fileListList[this.filedId][j].content
739
- }
740
- }
741
- this.fileUpload=false
742
- }).catch((err) => {
743
- console.debug("upload err", err);
744
- });
745
-
746
- },
747
- dataURLtoFileFun (dataurl, filename) {
748
- // 将base64转换为文件,dataurl为base64字符串,filename为文件名(必须带后缀名,如.jpg,.png)
749
- let arr = dataurl.split(",");
750
- let mime = arr[0].match(/:(.*?);/)[1];
751
- let bstr = atob(arr[1]);
752
- let n = bstr.length;
753
- let u8arr = new Uint8Array(n);
754
- while (n--) {
755
- u8arr[n] = bstr.charCodeAt(n);
756
- }
757
- return new File([u8arr], filename, { type: mime });
758
- },
759
- //初始化默认值
760
- defaultClick() {
761
- for (let i = 0; i < this.formList.form.formFieldRelation.length; i++)
762
- {
763
- 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')
764
- {
765
- if(this.formList.form.formFieldRelation[i].formField.extInfo && !this.formList.form.formFieldRelation[i].formField.extInfo.option)
766
- {
767
- if(this.formList.form.formFieldRelation[i].formField.extInfo.exinfo)
768
- {
769
- for (let j=0;j<this.formList.form.formFieldRelation[i].formField.extInfo.exinfo.length;j++)
770
- {
771
- this.$set(this.formList.form.formFieldRelation[i].formField.extInfo.exinfo[j],'label',this.formList.form.formFieldRelation[i].formField.extInfo.exinfo[j].value)
772
- }
773
- this.$set(this.formList.form.formFieldRelation[i].formField.extInfo,'option',this.formList.form.formFieldRelation[i].formField.extInfo.exinfo)
774
- }
775
- if (this.formList.form.formFieldRelation[i].formField.extInfo.option){
776
- if (this.formList.form.formFieldRelation[i].formField.type === 'RADIO') {
777
- for (let j = 0; j < this.formList.form.formFieldRelation[i].formField.extInfo.option.length; j++) {
778
- if(!this.formList.form.formFieldRelation[i].formField.extInfo.option[j].value)
779
- {
780
- this.formList.form.formFieldRelation[i].formField.extInfo.option[j].value=this.formList.form.formFieldRelation[i].formField.extInfo.option[j].label
781
- }
782
- }
783
- if(!this.formList.form.formFieldRelation[i].value)
784
- {
785
- for (let j = 0; j < this.formList.form.formFieldRelation[i].formField.extInfo.option.length; j++) {
786
- if (this.formList.form.formFieldRelation[i].formField.extInfo.option[j]._default === 'true') {
787
- this.formList.form.formFieldRelation[i].value = this.formList.form.formFieldRelation[i].formField.extInfo.option[j].value
788
- }
789
- }
790
- }
791
- }
792
- if (this.formList.form.formFieldRelation[i].formField.type === 'CHECKBOX') {
793
- for (let j = 0; j < this.formList.form.formFieldRelation[i].formField.extInfo.option.length; j++) {
794
- if (!this.formList.form.formFieldRelation[i].formField.extInfo.option[j].value) {
795
- this.formList.form.formFieldRelation[i].formField.extInfo.option[j].value = this.formList.form.formFieldRelation[i].formField.extInfo.option[j].label
796
- }
797
- }
798
-
799
- if (!this.formList.form.formFieldRelation[i].value||this.formList.form.formFieldRelation[i].value.length === 0)
800
- {
801
- this.formList.form.formFieldRelation[i].value=[]
802
- for (let j = 0; j < this.formList.form.formFieldRelation[i].formField.extInfo.option.length; j++) {
803
- if (this.formList.form.formFieldRelation[i].formField.extInfo.option[j]._default === 'true') {
804
- this.formList.form.formFieldRelation[i].value[0] = this.formList.form.formFieldRelation[i].formField.extInfo.option[j].value
805
- }
806
- }
807
- }
808
- }
809
- }
810
-
811
- }
812
- else {
813
- if (this.formList.form.formFieldRelation[i].formField.extInfo && this.formList.form.formFieldRelation[i].formField.extInfo.options){
814
- if (this.formList.form.formFieldRelation[i].formField.type === 'RADIO') {
815
- for (let j = 0; j < this.formList.form.formFieldRelation[i].formField.extInfo.options.length; j++) {
816
- if(!this.formList.form.formFieldRelation[i].formField.extInfo.options[j].value)
817
- {
818
- this.formList.form.formFieldRelation[i].formField.extInfo.options[j].value=this.formList.form.formFieldRelation[i].formField.extInfo.options[j].label
819
- }
820
- }
821
- if(!this.formList.form.formFieldRelation[i].value)
822
- {
823
- for (let j = 0; j < this.formList.form.formFieldRelation[i].formField.extInfo.option.length; j++) {
824
- if (this.formList.form.formFieldRelation[i].formField.extInfo.options[j]._default === 'true') {
825
- this.formList.form.formFieldRelation[i].value = this.formList.form.formFieldRelation[i].formField.extInfo.options[j].value
826
- }
827
- }
828
- }
829
- }
830
- if (this.formList.form.formFieldRelation[i].formField.type === 'CHECKBOX') {
831
- for (let j = 0; j < this.formList.form.formFieldRelation[i].formField.extInfo.options.length; j++) {
832
- if (this.formList.form.formFieldRelation[i].formField.extInfo.options[j].value === '') {
833
- this.formList.form.formFieldRelation[i].formField.extInfo.options[j].value = this.formList.form.formFieldRelation[i].formField.extInfo.options[j].label
834
- }
835
- }
836
-
837
- if (this.formList.form.formFieldRelation[i].value === null||this.formList.form.formFieldRelation[i].value.length === 0)
838
- {
839
- this.formList.form.formFieldRelation[i].value=[]
840
- for (let j = 0; j < this.formList.form.formFieldRelation[i].formField.extInfo.options.length; j++) {
841
- if (this.formList.form.formFieldRelation[i].formField.extInfo.options[j]._default === 'true') {
842
- this.formList.form.formFieldRelation[i].value[0] = this.formList.form.formFieldRelation[i].formField.extInfo.options[j].value
843
- }
844
- }
845
- }
846
- }
847
- }
848
- }
849
-
850
- }
851
- if (this.formList.form.formFieldRelation[i].formField.type ==='FILE'){
852
- if (this.formList.form.formFieldRelation[i].value!==undefined){
853
- if (this.formList.form.formFieldRelation[i].value===null||this.formList.form.formFieldRelation[i].value===''){
854
- this.formList.form.formFieldRelation[i].value=[]
855
- }
856
- else {
857
- let valueList=[]
858
- let bool=false
859
- if(this.formList.form.formFieldRelation[i].value.length > 0) {
860
- for (let file=0;file<this.formList.form.formFieldRelation[i].value.length;file++) {
861
- let type = typeof (this.formList.form.formFieldRelation[i].value[file])
862
- if (type === "string") {
863
- bool = true
864
- valueList[file] = {}
865
- valueList[file].url = this.formList.form.formFieldRelation[i].value[file]
866
- }
867
- if (type === 'object'&&JSON.stringify(this.formList.form.formFieldRelation[i].value[file])!=='{}') {
868
- this.fileListList[this.formList.form.formFieldRelation[i].fieldId]=this.formList.form.formFieldRelation[i].value
869
- }
870
- else {
871
- this.fileListList[this.formList.form.formFieldRelation[i].fieldId]=[]
872
- }
873
- }
874
- if (bool){
875
- this.fileListList[this.formList.form.formFieldRelation[i].fieldId]=valueList
876
- }
877
- }
878
- }
879
- }
880
-
881
-
882
-
883
- }
884
-
885
- }
886
- let test = []
887
- for (let i = 0; i < this.formList.form.formFieldRelation.length; i++) {
888
- if (this.formList.form.formFieldRelation[i].formField.type === 'CASCADER') {
889
- test.push(this.formList.form.formFieldRelation[i])
890
- let cascader=''
891
- if(this.formList.form.formFieldRelation[i].value)
892
- {
893
- if(this.formList.form.formFieldRelation[i].value.length > 0)
894
- {
895
- for (let j = 0; j < this.formList.form.formFieldRelation[i].value.length; j++) {
896
- if (this.formList.form.formFieldRelation[i].value[j]) {
897
- cascader += this.formList.form.formFieldRelation[i].value[j] + '/'
898
- }
899
- }
900
- cascader = cascader.substr(0, cascader.length - 1)
901
-
902
- }
903
- this.cascadeValue[this.formList.form.formFieldRelation[i].fieldId]=cascader
904
- }
905
- else
906
- {
907
- this.formList.form.formFieldRelation[i].value=[]
908
- }
909
- }
910
- if (this.formList.form.formFieldRelation[i].formField.type === 'DATE_PICKER')
911
- {
912
- if(this.formList.form.formFieldRelation[i].value!==null && this.formList.form.formFieldRelation[i].value!=='' )
913
- {
914
-
915
- this.dateValue[this.formList.form.formFieldRelation[i].fieldId]=this.formatDate(this.formList.form.formFieldRelation[i].value)
916
- }
917
- }
918
- if (this.formList.form.formFieldRelation[i].formField.type === 'TIME_PICKER')
919
- {
920
- if(this.formList.form.formFieldRelation[i].value!==''&& this.formList.form.formFieldRelation[i].value!==null)
921
- {
922
- const dateTime = new Date(this.formList.form.formFieldRelation[i].value)
923
- this.timeValue[this.formList.form.formFieldRelation[i].fieldId]=this.addZero(dateTime.getHours()) + ':' + this.addZero(dateTime.getMinutes())
924
-
925
- }
926
- }
927
- if (this.formList.form.formFieldRelation[i].formField.type === 'SELECT' || this.formList.form.formFieldRelation[i].formField.type === 'OPTION') {
928
- if (this.formList.form.formFieldRelation[i].formField.extInfo && this.formList.form.formFieldRelation[i].formField.extInfo.option){
929
- for (let j = 0; j < this.formList.form.formFieldRelation[i].formField.extInfo.option.length; j++) {
930
- if (this.formList.form.formFieldRelation[i].formField.extInfo.option[j].value === '') {
931
- this.formList.form.formFieldRelation[i].formField.extInfo.option[j].value = this.formList.form.formFieldRelation[i].formField.extInfo.option[j].label
932
- }
933
- }
934
- if(this.formList.form.formFieldRelation[i].value)
935
- {
936
- for (let j=0;j<this.formList.form.formFieldRelation[i].formField.extInfo.option.length;j++)
937
- {
938
- if (this.formList.form.formFieldRelation[i].value === this.formList.form.formFieldRelation[i].formField.extInfo.option[j].value)
939
- {
940
- this.selectValues[this.formList.form.formFieldRelation[i].fieldId] =this.formList.form.formFieldRelation[i].formField.extInfo.option[j].label
941
- }
942
- }
943
- /*this.selectValues[this.formList.form.formFieldRelation[i].fieldId] = this.formList.form.formFieldRelation[i].value*/
944
-
945
- }
946
- else
947
- {
948
- for (let j = 0; j < this.formList.form.formFieldRelation[i].formField.extInfo.option.length; j++) {
949
- if (this.formList.form.formFieldRelation[i].formField.extInfo.option[j]._default === 'true') {
950
- this.selectValues[this.formList.form.formFieldRelation[i].fieldId] = this.formList.form.formFieldRelation[i].formField.extInfo.option[j].label
951
- this.formList.form.formFieldRelation[i].value=this.formList.form.formFieldRelation[i].formField.extInfo.option[j].value
952
- }
953
- }
954
- }
955
- }
956
- else {
957
- if(this.formList.form.formFieldRelation[i].formField.extInfo && this.formList.form.formFieldRelation[i].formField.extInfo.option) {
958
- for (let j = 0; j < this.formList.form.formFieldRelation[i].formField.extInfo.options.length; j++) {
959
- if (this.formList.form.formFieldRelation[i].formField.extInfo.options[j].value === '') {
960
- this.formList.form.formFieldRelation[i].formField.extInfo.options[j].value = this.formList.form.formFieldRelation[i].formField.extInfo.options[j].label
961
- }
962
- }
963
- }
964
- if(this.formList.form.formFieldRelation[i].value && this.formList.form.formFieldRelation[i].formField.extInfo && this.formList.form.formFieldRelation[i].formField.extInfo.option)
965
- {
966
- for (let j=0;j<this.formList.form.formFieldRelation[i].formField.extInfo.options.length;j++)
967
- {
968
- if (this.formList.form.formFieldRelation[i].value === this.formList.form.formFieldRelation[i].formField.extInfo.options[j].value)
969
- {
970
- this.selectValues[this.formList.form.formFieldRelation[i].fieldId] =this.formList.form.formFieldRelation[i].formField.extInfo.options[j].label
971
- }
972
- }
973
- /*this.selectValues[this.formList.form.formFieldRelation[i].fieldId] = this.formList.form.formFieldRelation[i].value*/
974
-
975
- }
976
- else
977
- {
978
- if(this.formList.form.formFieldRelation[i].formField.extInfo && this.formList.form.formFieldRelation[i].formField.extInfo.option) {
979
- for (let j = 0; j < this.formList.form.formFieldRelation[i].formField.extInfo.options.length; j++) {
980
- if (this.formList.form.formFieldRelation[i].formField.extInfo.options[j]._default === 'true') {
981
- this.selectValues[this.formList.form.formFieldRelation[i].fieldId] = this.formList.form.formFieldRelation[i].formField.extInfo.options[j].label
982
- this.formList.form.formFieldRelation[i].value=this.formList.form.formFieldRelation[i].formField.extInfo.options[j].value
983
- }
984
- }
985
- }
986
- }
987
- }
988
-
989
- }
990
- }
991
- this.formShow=this.formList
992
- },
993
- addZero(i) {
994
- if (i < 10) {
995
- i = "0" + i;
996
- }
997
- return i;
998
- },
999
- formatter(type, value) {
1000
- // 格式化选择器日期
1001
- if (type === "year") {
1002
- return `${value}年`;
1003
- } else if (type === "month") {
1004
- return `${value}月`;
1005
- } else if (type === "day") {
1006
- return `${value}日`;
1007
- } else if (type === "hour") {
1008
- return `${value}时`;
1009
- } else if (type === "minute") {
1010
- return `${value}分`;
1011
- }
1012
- return value;
1013
- },
1014
-
1015
- isMobile() {
1016
- if (this.usePropStyleType === false){
1017
- let flag = navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i);
1018
- if (flag) {
1019
- this.isPhone=true
1020
- }
1021
- else {
1022
- this.isCompany=true
1023
- }
1024
- }else {
1025
- this.isPhone=this.propIsPhone;
1026
- this.isCompany=this.propIsCompany;
1027
- }
1028
- },
1029
- //时间的选择器
1030
- onConfirm(value, id,item) {
1031
- for (let i = 0; i < this.formShow.form.formFieldRelation.length; i++) {
1032
- if (this.formShow.form.formFieldRelation[i].fieldId=== id) {
1033
- this.formShow.form.formFieldRelation[i].value = value
1034
- if (!item.formField.extInfo.mold||item.formField.extInfo.mold==='DATA_TIME'){
1035
- this.timeValue[id] =this.formatDate(value) +" "+ this.addZero(value.getHours()) + ':' + this.addZero(value.getMinutes())
1036
- this.showTimePicker = false;
1037
- }
1038
- else {
1039
- this.timeValue[id] =this.formatDate(value)
1040
- this.showTimePickerd = false;
1041
- }
1042
- break
1043
- }
1044
- }
1045
- },
1046
- //转换日期的函数
1047
- formatDate(date) {
1048
- const dateTime = new Date(date)
1049
- return `${dateTime.getFullYear()}-${dateTime.getMonth() + 1}-${dateTime.getDate()}`;
1050
- },
1051
- //日期的选择器
1052
- onConfirmCalendar(date, id) {
1053
- for (let i = 0; i < this.formShow.form.formFieldRelation.length; i++) {
1054
- if (this.formShow.form.formFieldRelation[i].fieldId === id) {
1055
- this.dateValue[id] = this.formatDate(date)
1056
- this.formShow.form.formFieldRelation[i].value = date
1057
- this.showCalendar = false;
1058
- break
1059
- }
1060
- }
1061
- },
1062
- //下拉的选择器
1063
- onConfirmSelect(value, id) {
1064
- for (let i = 0; i < this.formShow.form.formFieldRelation.length; i++) {
1065
- if (this.formShow.form.formFieldRelation[i].fieldId === id) {
1066
- this.selectValues[this.formShow.form.formFieldRelation[i].fieldId] = value
1067
- if (this.formShow.form.formFieldRelation[i].formField.extInfo.option){
1068
- for (let j = 0; j < this.formShow.form.formFieldRelation[i].formField.extInfo.option.length; j++) {
1069
- if(value ===this.formShow.form.formFieldRelation[i].formField.extInfo.option[j].label)
1070
- {
1071
- this.formShow.form.formFieldRelation[i].value = this.formShow.form.formFieldRelation[i].formField.extInfo.option[j].value
1072
- }
1073
- }
1074
- }
1075
- else {
1076
- for (let j = 0; j < this.formShow.form.formFieldRelation[i].formField.extInfo.options.length; j++) {
1077
- if(value ===this.formShow.form.formFieldRelation[i].formField.extInfo.options[j].label)
1078
- {
1079
- this.formShow.form.formFieldRelation[i].value = this.formShow.form.formFieldRelation[i].formField.extInfo.options[j].value
1080
- }
1081
- }
1082
- }
1083
-
1084
- this.showPicker = false;
1085
- break
1086
- }
1087
- }
1088
- },
1089
- //时间日期的选择器
1090
- /* onConfirmDateTime(date,id){
1091
- for (let i=0;i<this.formList.form.formFieldRelation.length;i++)
1092
- {
1093
-
1094
- if(this.formList.form.formFieldRelation[i].formField.id===id)
1095
- {
1096
- this.dateTimeValue[id]=this.addZero(date.getFullYear())+'-'+this.addZero(date.getMonth())+'-'+this.addZero(date.getDate())+' '+this.addZero(date.getHours())+':'+this.addZero(date.getMinutes())
1097
- this.formList.form.formFieldRelation[i].value[0]=date
1098
- this.showDateTimePicker = false;
1099
- break
1100
- }
1101
- }
1102
-
1103
- },
1104
- onConfirmDateTime1(date,id){
1105
- for (let i=0;i<this.formList.form.formFieldRelation.length;i++)
1106
- {
1107
- if(this.formList.form.formFieldRelation[i].formField.id===id)
1108
- {
1109
-
1110
- this.dateTimeValue1[id]=this.addZero(date.getFullYear())+'-'+this.addZero(date.getMonth())+'-'+this.addZero(date.getDate())+' '+this.addZero(date.getHours())+':'+this.addZero(date.getMinutes())
1111
- this.formList.form.formFieldRelation[i].value[1]=date
1112
- this.showDateTimePicker1 = false;
1113
- break
1114
- }
1115
- }
1116
- },*/
1117
- //提交按钮事件
1118
- submitClick() {
1119
-
1120
- for (let i=0;i<this.formShow.form.formFieldRelation.length;i++)
1121
- {
1122
- if(this.formShow.form.formFieldRelation[i].formField.type==='CASCADER')
1123
- {
1124
- let cascader = this.formShow.form.formFieldRelation[i].formField.extInfo.cascade?this.formShow.form.formFieldRelation[i].formField.extInfo.cascade:this.formShow.form.formFieldRelation[i].formField.extInfo.cascadeDown[0].options?this.formShow.form.formFieldRelation[i].formField.extInfo.cascadeDown[0].options:[]
1125
- cascader.forEach(item=>{
1126
- if(item.children!==undefined)
1127
- {
1128
- if(item.children.length===0)
1129
- delete item.children
1130
- else {
1131
- item.children.forEach(items=>{
1132
- if(items.children)
1133
- {
1134
- if(items.children.length===0)
1135
- delete items.children
1136
- }
1137
- })
1138
- }
1139
- }
1140
- })
1141
- }
1142
- if (this.fileListList[this.formShow.form.formFieldRelation[i].fieldId]!==undefined){
1143
- let value=[]
1144
-
1145
- this.fileListList[this.formShow.form.formFieldRelation[i].fieldId].forEach(item=>{
1146
- let file={}
1147
- file.name=item.name
1148
- file.url=item.url
1149
- value.push(file)
1150
- })
1151
- this.formShow.form.formFieldRelation[i].value=value
1152
- }
1153
-
1154
- 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')
1155
- {
1156
-
1157
- if(!this.formShow.form.formFieldRelation[i].value || (this.formShow.form.formFieldRelation[i].value&&this.formShow.form.formFieldRelation[i].value.length===0))
1158
- {
1159
- this.$message.error('请完善'+ this.formShow.form.formFieldRelation[i].formField.name)
1160
- return
1161
- }
1162
- }
1163
- }
1164
- this.$emit('submitClick',this.formShow)
1165
- this.disableds = true
1166
- this.submitValue = '已提交'
1167
- },
1168
- //日期的点击事件
1169
- dateClick(id) {
1170
- if(this.disableds === false)
1171
- {
1172
- for (let i = 0; i < this.formShow.form.formFieldRelation.length; i++) {
1173
- if (this.formShow.form.formFieldRelation[i].fieldId === id) {
1174
- this.dateId = id
1175
- this.showCalendar = true
1176
- break
1177
- }
1178
- }
1179
- }
1180
-
1181
- },
1182
- //时间的点击事件
1183
- timeClick(id,item) {
1184
- if(this.disableds === false){
1185
- for (let i = 0; i < this.formShow.form.formFieldRelation.length; i++) {
1186
- if (this.formShow.form.formFieldRelation[i].fieldId === id) {
1187
- this.timeId = id
1188
- if (!item.formField.extInfo.mold||item.formField.extInfo.mold==='DATA_TIME'){
1189
- this.showTimePicker = true
1190
- }
1191
- else {
1192
- this.showTimePickerd= true
1193
- }
1194
-
1195
- break
1196
- }
1197
-
1198
- }
1199
- }
1200
-
1201
- },
1202
- //下拉的点击事件
1203
- selectClick(id) {
1204
- if(this.disableds === false){
1205
- let selectOption
1206
- this.selectValue=[]
1207
- for (let i = 0; i < this.formShow.form.formFieldRelation.length; i++) {
1208
- if(this.formShow.form.formFieldRelation[i].formField.type==='SELECT' || this.formShow.form.formFieldRelation[i].formField.type==='OPTION')
1209
- {
1210
- if (this.formShow.form.formFieldRelation[i].fieldId === id) {
1211
- selectOption = this.formShow.form.formFieldRelation[i].formField.extInfo.option?this.formShow.form.formFieldRelation[i].formField.extInfo.option:this.formShow.form.formFieldRelation[i].formField.extInfo.options?this.formShow.form.formFieldRelation[i].formField.extInfo.options:[]
1212
- for (let j = 0; j < selectOption.length; j++) {
1213
- this.selectValue[j] = selectOption[j].label
1214
- }
1215
-
1216
- }
1217
- }
1218
- }
1219
- this.selectId = id
1220
- this.showPicker = true
1221
- }
1222
-
1223
- },
1224
- SelectClear(fieldId) {
1225
- if(this.disableds === false){
1226
- let i = this.formShow.form.formFieldRelation.findIndex(item => { console.log(item.fieldId); return item.fieldId == fieldId })
1227
- this.selectValues[this.formShow.form.formFieldRelation[i].fieldId] = ''
1228
- this.$forceUpdate()
1229
- }
1230
- },
1231
- //级联的点击的事件
1232
- pickerClick(id) {
1233
- if(this.disableds === false)
1234
- {
1235
- if(this.pickerId!==id)
1236
- {
1237
- for (let i = 0; i < this.formShow.form.formFieldRelation.length; i++) {
1238
- if (this.formShow.form.formFieldRelation[i].fieldId === id) {
1239
- this.keyValue=''
1240
- if(this.formShow.form.formFieldRelation[i].value.length!==undefined)
1241
- {
1242
- for (let m=0;m<this.formShow.form.formFieldRelation[i].value.length;m++)
1243
- {
1244
- this.keyValue+=this.formShow.form.formFieldRelation[i].value[m]
1245
- }
1246
- }
1247
-
1248
- this.data = this.formShow.form.formFieldRelation[i].formField.extInfo.cascade?this.formShow.form.formFieldRelation[i].formField.extInfo.cascade:this.formShow.form.formFieldRelation[i].formField.extInfo.cascadeDown?this.formShow.form.formFieldRelation[i].formField.extInfo.cascadeDown[0].options:[]
1249
- this.column[0].values = Object.values(this.data).map(function (e) {
1250
- return {text: e.value, code: e.value}
1251
- })
1252
- if (this.data[0].children !== undefined) {
1253
- this.column[1].values = Object.values(this.data[0].children).map(function (e) {
1254
- return {text: e.value, code: e.value}
1255
- })
1256
- if (this.data[0].children[0].children !== undefined) {
1257
- this.column[2].values = Object.values(this.data[0].children[0].children).map(function (e) {
1258
- return {text: e.value, code: e.value}
1259
- })
1260
- }
1261
- else {
1262
- this.$set(this.data[0].children[0], 'children', [])
1263
- this.column[2].values=Object.values(this.data[0].children[0].children).map(function (res) {
1264
- return {text: res.value, code: res.value};
1265
- })
1266
- }
1267
- }
1268
- }
1269
- }
1270
- }
1271
-
1272
- this.pickerId = id
1273
- this.showArea = true
1274
- }
1275
-
1276
-
1277
- },
1278
-
1279
- onChange(picker, values,index) {
1280
- // 这里我有可能渲染的有问题,导致回调每次都修改了当前列,其他值没有修改,当前列??(当前列什么鬼呀,什么垃圾啊???) 解释一下 ↓↓
1281
- // 因为vant的 van-picker 回调只会返回你修改的那一列,比如现在为 [北京,北京,东城区],你修改了省为[天津市,天津市,和平区],但是vant的change回调会得到[天津市,北京,东城区],后面两个在回调中没有修改,不知道我的渲染方法有问题还是什么问题。
1282
- // 所以我在这里判断change事件触发后,如果你修改了省份的话,回调里面省份会改变,但是市和区还是上一个省份的 市和区,这时我们执行回调修改省,市,区的时候,因为回调只有省改变了,市和区DOM改变了,但是回调里面没改变的问题(不晓得什么问题),这时我们去找省下面的 市,我们取回调的市名称,如果在省下面没有找到这个市,默认展示第一个市,区也默认展示第一个市下面的区,如果遍历市能查到,就去展示对应的市。
1283
- // 回调时修改第2列数据
1284
- if (index == 0){
1285
- picker.setColumnValues(2, []); // 防止突然选中第一个,第二个是更新的,但第三个联级不更新,我暂时强制清空
1286
- }
1287
- let ColumnIndexss=picker.getIndexes()
1288
- let testValue=''
1289
- this.$nextTick(()=>{
1290
- if(index == 0)
1291
- {
1292
- if(this.data[ColumnIndexss[0]].children.length > 0)
1293
- {
1294
- if(this.data[ColumnIndexss[0]].children[0]!==undefined)
1295
- {
1296
- testValue=this.data[ColumnIndexss[0]].children[0].value
1297
- picker.setColumnValues(2, this.county(this.data, testValue));
1298
- }
1299
- }
1300
- else
1301
- picker.setColumnValues(2, []);
1302
- }
1303
- if(index == 1)
1304
- {
1305
- if(this.data[ColumnIndexss[0]].children.length > 0)
1306
- {
1307
- if(this.data[ColumnIndexss[0]].children[ColumnIndexss[1]]!==undefined)
1308
- {
1309
- testValue=this.data[ColumnIndexss[0]].children[ColumnIndexss[1]].value
1310
- picker.setColumnValues(2, this.county(this.data, testValue));
1311
- }
1312
- }
1313
- else
1314
- picker.setColumnValues(2, []);
1315
- }
1316
- })
1317
-
1318
- picker.setColumnValues(1, this.cityDate(this.data, values[0].text));
1319
- // 回调时修改第3列数据
1320
-
1321
-
1322
- },
1323
- // 修改级联第二级 这里不再多说什么了根据自己的数据格式来
1324
- cityDate(data, province) {
1325
- var that = this;
1326
- data.forEach(function (res) {
1327
- if (res.value == province) {
1328
- that.cityDates = res;
1329
- }
1330
- });
1331
- if (that.cityDates.children !== undefined&&that.cityDates.children.length > 0) {
1332
- return that.cityDates.children.map(function (res) {
1333
- return {text: res.value, code: res.value};
1334
- })
1335
- } else {
1336
- this.$set(that.cityDates, 'children', [])
1337
- return that.cityDates.children.map(function (res) {
1338
- return {text: res.value, code: res.value};
1339
- })
1340
- }
1341
- // return 返回数据格式,因为我需要省市区code,所以我return的格式是对象,例:[{text:'北京市',code:'1'},{text:'河南省',code:'2'},...],如果你不需要code直接这样就可以 例['北京市','河南省',.....]
1342
- },
1343
- // 修改级联第三级 这里不再多说什么了根据自己的数据格式来
1344
- county(data, county) {
1345
- var that = this;
1346
- var countyDate = '';
1347
- // 因为vant的 van-picker 回调只会返回你修改的那一列,比如现在为 [北京,北京,东城区],你修改了省为[天津市,天津市,和平区],但是vant的change回调会得到[天津市,北京,东城区],后面两个在回调中没有修改,不知道我的渲染方法有问题还是什么问题。
1348
- // 所以我在这里判断change事件触发后,如果你修改了省份的话,回调里面省份会改变,但是市和区还是上一个省份的 市和区,这时我们执行回调修改省,市,区的时候,因为回调只有省改变了,市和区DOM改变了,但是回调里面没改变的问题(不晓得什么问题),这时我们去找省下面的 市,我们取回调的市名称,如果在省下面没有找到这个市,默认展示第一个市,区也默认展示第一个市下面的区,如果遍历市能查到,就去展示对应的市。
1349
- that.cityDates.children.forEach(function (res) {
1350
- if (res.value == county) {
1351
- countyDate = res;
1352
- }
1353
- });
1354
- // 这里如果没有找到对应的县
1355
- if (countyDate == '') {
1356
- if(that.cityDates.children.length > 0)
1357
- {
1358
- countyDate = that.cityDates.children[0];
1359
- }
1360
-
1361
- }
1362
- // return 县
1363
- if (countyDate.children === undefined) {
1364
- this.$set(countyDate, 'children', [])
1365
- return countyDate.children.map(function (res) {
1366
- return {text: res.value, code: res.value};
1367
- })
1368
- } else {
1369
- return countyDate.children.map(function (res) {
1370
- return {text: res.value, code: res.value};
1371
- })
1372
- }
1373
-
1374
- // return 返回数据格式,因为我需要省市区code,所以我return的格式是对象,例:[{text:'北京市',code:'1'},{text:'河南省',code:'2'},...],如果你不需要code直接这样就可以 例['北京市','河南省',.....]
1375
- },
1376
- //点击级联弹出框的确认按钮
1377
- onConfirms(val, id) {
1378
- let test = ''
1379
- for (let i = 0; i < val.length; i++) {
1380
- if (val[i] !== undefined) {
1381
- test += val[i].text + '/'
1382
- }
1383
- }
1384
- test = test.substr(0, test.length - 1)
1385
- for (let i = 0; i < this.formShow.form.formFieldRelation.length; i++) {
1386
- if (this.formShow.form.formFieldRelation[i].fieldId=== id) {
1387
- this.cascadeValue[id] = test
1388
- for (let j = 0; j < val.length; j++) {
1389
- if (val[j] !== undefined) {
1390
- this.formShow.form.formFieldRelation[i].value[j] = val[j].text
1391
- }
1392
- }
1393
- break
1394
- }
1395
- }
1396
- this.showArea = false;
1397
- sessionStorage.setItem('cascader',test)
1398
- },
1399
- onCancel() {
1400
- this.showArea = false;
1401
- },
1402
- aliyunOssRequest(data){
1403
-
1404
- this.loading = this.$loading({
1405
- lock: true,
1406
- text: 'Loading',
1407
- spinner: 'el-icon-loading',
1408
- background: 'rgba(0, 0, 0, 0.8)'
1409
- });
1410
- let file = data.file;
1411
- console.debug("upload file:", file);
1412
- let imgInfo = {
1413
- status:'',
1414
- url:'',
1415
- name:''
1416
- }
1417
- /* let imageData = {
1418
- id:cid,
1419
- cid:cid,
1420
- type: "IMAGE",
1421
- content: {
1422
- urls: [],
1423
- progress: 0,
1424
- },
1425
- };*/
1426
- let res = multipartUpload(
1427
- this.ossConfig,
1428
- file,
1429
- null,
1430
- imgInfo
1431
- );
1432
- res.then((res) => {
1433
- console.debug("upload result:", res);
1434
- // let filePath = res.name;
1435
- /* imageData.content.progress = 1;
1436
- imageData.content.urls.push(
1437
- ossFileUrl(this.ossConfig, res.name)
1438
- );
1439
- console.log('imageData',imageData)*/
1440
- imgInfo.url = ossFileUrl(this.ossConfig, res.name)
1441
- imgInfo.status='success'
1442
- if (data.file){
1443
- imgInfo.name = data.file.name
1444
- imgInfo.uid = data.file.uid
1445
- }
1446
- if (!this.fileListList[this.filedId])
1447
- {
1448
- this.fileListList[this.filedId] = []
1449
- }
1450
- this.fileListList[this.filedId].push(imgInfo)
1451
- this.loading.close()
1452
- }).catch((err) => {
1453
- console.debug("upload err", err);
1454
- });
1455
- },
1456
- successUpload(response,file,fileList){
1457
- if (!this.fileListList[this.filedId]){
1458
- this.fileListList[this.filedId] = []
1459
- }
1460
- for (let i=0;i<fileList.length;i++){
1461
- if (!this.fileListList[this.filedId][i]){
1462
- this.fileListList[this.filedId][i]={}
1463
- }
1464
- this.fileListList[this.filedId][i].url=fileList[i].url
1465
- this.fileListList[this.filedId][i].name=fileList[i].name
1466
- this.fileListList[this.filedId][i].status=fileList[i].status
1467
- }
1468
- },
1469
- uploadProgress(){
1470
- this.loading = this.$loading({
1471
- lock: true,
1472
- text: 'Loading',
1473
- spinner: 'el-icon-loading',
1474
- background: 'rgba(0, 0, 0, 0.7)'
1475
- });
1476
- },
1477
- handleRemove(file) {
1478
- if (this.fileListList[this.filedId]){
1479
- for (let i=0;i<this.fileListList[this.filedId].length;i++)
1480
- {
1481
- if (this.fileListList[this.filedId][i].uid){
1482
- if (this.fileListList[this.filedId][i].uid===file.uid){
1483
- this.fileListList[this.filedId].splice(i,1)
1484
- return
1485
- }
1486
- }
1487
- else if (this.fileListList[this.filedId][i].url===file.url){
1488
- this.fileListList[this.filedId].splice(i,1)
1489
- return
1490
- }
1491
- }
1492
-
1493
- }
1494
- /*let value=[]
1495
- for (let i=0;i<fileList.length;i++){
1496
- value[i]={}
1497
- value[i].name=fileList[i].name
1498
- if(fileList[i].response){
1499
- value[i].url=fileList[i].response.data
1500
- }
1501
- else {
1502
- value[i].url=fileList[i].url
1503
- }
1504
- }
1505
- for (let i=0;i<this.formShow.form.formFieldRelation.length;i++){
1506
- if (this.formShow.form.formFieldRelation[i].fieldId===this.filedId){
1507
- this.fileListList[this.filedId]=value
1508
- }
1509
- }*/
1510
- /*this.fileListList = [...this.fileListList]*/
1511
- },
1512
- handleEditChange(file,fileList){
1513
- this.hideUploadEdit=fileList.length >= this.limitNum
1514
- },
1515
-
1516
- onUploadProgress: function (progress, point, file, videoData) {
1517
- console.debug("upload video progress", progress, point);
1518
- if (progress === 1) {
1519
- // this.loadingIns.close();
1520
- videoData.content.url = ossFileUrl(this.ossConfig, point.name);
1521
- // this.chooseVideo({data:url},file);
1522
-
1523
- } else {
1524
- videoData.content.progress = progress;
1525
-
1526
- }
1527
- },
1528
- checkUpload(id,limitNum){
1529
- this.filedId=id
1530
- this.limitNum = limitNum
1531
-
1532
- },
1533
- beforeAvatarUpload(file){
1534
- const isLte2M = file.size / 1024 / 1024 <= 8;
1535
- const isSupportedFormat =file.type.indexOf('image')!==-1
1536
- if (!isSupportedFormat){
1537
- this.$message.error("只能上传图片格式");
1538
- return false
1539
- }
1540
- if (!isLte2M) {
1541
- this.$message.error("上传图片大小不能超过 8MB!");
1542
- return false
1543
- }
1544
- return true
1545
- },
1546
- exceedUpload(){
1547
- this.$message.warning('上传文件数量达到上限')
1548
- },
1549
-
1550
- handlePictureCardPreview(file) {
1551
- this.videoFlag = true;
1552
- this.videoUploadPercent = file.percentage.toFixed(0);
1553
- },
1554
- },
1555
- //时间日期范围的点击事件
1556
- /* dateTimeClick(id){
1557
- for (let i=0;i<this.formList.form.formFieldRelation.length;i++)
1558
- {
1559
- if(this.formList.form.formFieldRelation[i].formField.id===id)
1560
- {
1561
- this.dateTimeId=id
1562
- this.showDateTimePicker = true
1563
- break
1564
- }
1565
- }
1566
- },
1567
- dateTimeClick1(id){
1568
- if(this.dateTimeValue.length === 0)
1569
- {
1570
- this.$message.error('请先选择开始日期时间')
1571
- }
1572
- else
1573
- {
1574
- for (let i=0;i<this.formList.form.formFieldRelation.length;i++)
1575
- {
1576
- if(this.formList.form.formFieldRelation[i].formField.id===id)
1577
- {
1578
- this.dateTimeId=id
1579
- this.showDateTimePicker1 = true
1580
- break
1581
- }
1582
- }
1583
- }
1584
-
1585
- },*/
1586
-
1587
-
1588
-
1589
- }
1590
- </script>
1591
-
1592
- <style lang="less" scoped>
1593
- .notClick {
1594
- pointer-events: none;
1595
- }
1596
- .formClass{
1597
- /* border: 1px solid #ebebeb;*/
1598
- font-family: "Avenir", Helvetica, Arial, sans-serif;
1599
- border-radius: 15px;
1600
- .explanation{
1601
- display: flex;
1602
- padding: 4px;
1603
- .explanation-p{
1604
- color: #366aff;
1605
- font-size: 14px;
1606
- margin: 10px 4px;
1607
- .el-icon-info{
1608
- margin-right: 8px;
1609
- }
1610
- }
1611
- }
1612
- .explain-url{
1613
- a{
1614
- color:#366aff ;
1615
- }
1616
- }
1617
- .titleName{
1618
- font-size: 1em;
1619
- text-align: center;
1620
- padding-bottom: 10px;
1621
- display: flex;
1622
- align-items: center;
1623
- justify-content: center;
1624
- /* border-bottom: 1px solid #EEEEEE;*/
1625
- }
1626
- .title-link{
1627
- height: 1px;
1628
- background-color: #EEEEEE;
1629
- }
1630
- .bottom-link{
1631
- margin-top: 14px;
1632
- height: 1px;
1633
- background-color: #EEEEEE;
1634
- }
1635
- .form-submit-btn{
1636
- padding: 14px 16px 0 16px;
1637
- text-align: center;
1638
- }
1639
- /deep/.ck.ck-editor{
1640
- padding: 0 8px;
1641
- }
1642
- /deep/.ck.ck-toolbar{
1643
- border-color:#E0E6F7;
1644
- border-top-left-radius: 9px!important;
1645
- border-top-right-radius: 9px!important;
1646
- }
1647
- /deep/.ck.ck-editor__editable_inline{
1648
- border-color:#E0E6F7;
1649
- min-height: 150px!important;
1650
- border-bottom-left-radius: 9px!important;
1651
- border-bottom-right-radius: 9px!important;
1652
- }
1653
- }
1654
- .pcFormClass{
1655
- width: 400px;
1656
- margin: 0 auto;
1657
- .field-item{
1658
- padding: 8px 0;
1659
- .field-item-name{
1660
- padding-bottom: 8px;
1661
- color: #A9B3C6;
1662
- /* color: #000000;*/
1663
- }
1664
- }
1665
- /deep/.el-input__inner{
1666
- border-color: #E0E6F7!important;
1667
- background-color: transparent!important;
1668
- border-radius: 9px!important;
1669
- }
1670
- /deep/.el-textarea__inner{
1671
- border-color: #E0E6F7!important;
1672
- background-color: transparent!important;
1673
- border-radius: 9px!important;
1674
- padding: 9px 15px!important;
1675
- }
1676
- /deep/.el-upload--picture-card{
1677
- background-color: #FFFFFF;
1678
- border: 1px solid #E0E6F7;
1679
- border-radius: 10px;
1680
- width: 74px;
1681
- height: 74px;
1682
- vertical-align: top;
1683
- cursor: pointer;
1684
- text-align: center;
1685
- font-size:28px;
1686
- color:#366AFF;
1687
- display: flex;
1688
- align-items: center;
1689
- justify-content: center;
1690
- i{
1691
- color: #366AFF;
1692
- }
1693
- }
1694
- /deep/.el-select-dropdown__item.selected{
1695
- color: #366aff;
1696
- }
1697
- /deep/.el-upload-list--picture-card{
1698
- .el-upload-list__item{
1699
- width: 74px;
1700
- height: 74px;
1701
- border-radius: 10px;
1702
- }
1703
- }
1704
- /deep/.el-upload-list__item-name{
1705
- max-width: 180px;
1706
- }
1707
- .hide .el-upload--picture-card {
1708
- display: none!important;
1709
- }
1710
- }
1711
- /deep/.van-radio__icon--checked .van-icon{
1712
- background-color: #366aff!important;
1713
- border-color: #366aff!important;
1714
- }
1715
- /deep/.van-checkbox__icon--checked .van-icon{
1716
- background-color: #366aff!important;
1717
- border-color: #366aff!important;
1718
- }
1719
- /deep/.vant-upload--picture-card{
1720
- background-color: #ffffff;
1721
- border: 1px solid #E0E6F7;
1722
- border-radius: 10px;
1723
- width: 74px;
1724
- height: 74px;
1725
- vertical-align: top;
1726
- cursor: pointer;
1727
- text-align: center;
1728
- font-size:28px;
1729
- color:#8c939d;
1730
- display: flex;
1731
- align-items: center;
1732
- justify-content: center;
1733
- i{
1734
- color: #366aff;
1735
- }
1736
- }
1737
- /deep/.van-popup{
1738
- border-radius: 5px;
1739
- }
1740
- .remPhoneClassForm{
1741
- .mobileFormClass{
1742
- width: calc(100vw - 110px);
1743
- .form-field-item{
1744
- .form-field-item-value{
1745
- /deep/.van-cell{
1746
- flex-direction: column;
1747
- padding: 8px 16px;
1748
- }
1749
- /deep/.van-cell__value{
1750
- border: 1px solid #E0E6F7;
1751
- border-radius: 9px;
1752
- min-height: 40px;
1753
- padding: 0 10px;
1754
- }
1755
- /deep/.van-cell__right-icon{
1756
- color: #999999!important;
1757
- }
1758
- .form-field-item-file{
1759
- padding: 8px;
1760
- .fileName{
1761
- padding-bottom: 8px;
1762
- color: #A9B3C6;
1763
- /* color: #000000;*/
1764
- }
1765
- }
1766
- .workorder_description{
1767
- /* padding: 8px 16px;*/
1768
- padding: 8px 0;
1769
- /*font-size: 14px;*/
1770
- .field-name{
1771
- width: 100%;
1772
- text-align: left;
1773
- color: #A9B3C6;
1774
- /* color: #000000;*/
1775
- line-height: 1;
1776
- padding-bottom: 8px;
1777
- }
1778
- /*.required-name{
1779
- margin-left: -6px;
1780
- }*/
1781
-
1782
- /* /deep/.ck-content .image img{
1783
- max-width: 200px!important;
1784
- }*/
1785
- }
1786
- }
1787
- .form-field-item-other{
1788
- /deep/.van-cell{
1789
- flex-direction: column;
1790
- }
1791
- /deep/.van-cell__value{
1792
- min-height: 40px;
1793
- }
1794
- }
1795
- .explan-ation{
1796
- .explan-ation-div{
1797
- display: flex;
1798
- /* padding: 4px 16px;*/
1799
- padding: 4px;
1800
- }
1801
- .explan-ation-p{
1802
- color: #366aff;font-size: 14px;margin: 16px 4px;
1803
- }
1804
- }
1805
- }
1806
- .upload-phone-demo{
1807
- /deep/.el-upload--picture-card{
1808
- background-color: #fbfdff;
1809
- border: 1px dashed #c0ccda;
1810
- border-radius: 6px;
1811
- width: 74px;
1812
- height: 74px;
1813
- vertical-align: top;
1814
- cursor: pointer;
1815
- text-align: center;
1816
- font-size:28px;
1817
- color:#8c939d;
1818
- display: flex;
1819
- align-items: center;
1820
- justify-content: center;
1821
- }
1822
- /deep/.el-upload-list--picture-card .el-upload-list__item{
1823
- height: 76px;
1824
- width: 76px;
1825
- }
1826
- }
1827
- /deep/.van-image__img{
1828
- border-radius: 10px;
1829
- }
1830
- }
1831
- .submitClass{
1832
- min-width: 100px;
1833
- background-color: #366aff;
1834
- color: white!important;
1835
- height: 32px;
1836
- i{
1837
- padding-right: 8px;
1838
- font-weight: 600;
1839
- }
1840
- }
1841
- /deep/.van-radio-group--horizontal{
1842
- .van-radio{
1843
- min-width: 100px;
1844
- max-width: 260px;
1845
- flex: none;
1846
- }
1847
- .van-radio--horizontal{
1848
- padding: 0.3rem 0;
1849
- margin-right: 6px;
1850
- }
1851
- }
1852
- /deep/.van-checkbox-group--horizontal{
1853
- .van-checkbox{
1854
- min-width: 100px;
1855
- max-width: 260px;
1856
- flex: none;
1857
- }
1858
- .van-checkbox--horizontal{
1859
- padding: 0.3rem 0;
1860
- margin-right: 6px;
1861
- }
1862
- }
1863
- /deep/.van-button--info{
1864
- border:1px solid #366aff;
1865
- }
1866
- /deep/.van-field__label{
1867
- width: 100%;
1868
- text-align: left;
1869
- color: #A9B3C6!important;
1870
- /* color: #000000!important;*/
1871
- display: flex;
1872
- align-items: center;
1873
- line-height: 1;
1874
- padding-bottom: 8px;
1875
- font-size: 1em;
1876
- }
1877
-
1878
- /deep/.van-field__control{
1879
- min-height: 40px;
1880
- }
1881
- /deep/textarea{
1882
- padding: 7px 0;
1883
- }
1884
- /deep/.van-dropdown-menu__bar{
1885
- box-shadow: none!important;
1886
- }
1887
- /deep/.van-overlay{
1888
- background-color: rgba(0,0,0,.4);
1889
- }
1890
- }
1891
-
1892
- .remCompanyClassForm{
1893
- width: 100%;
1894
- font-size: 1em;
1895
- .submitClass{
1896
- min-width: 100px;
1897
- color: white!important;
1898
- background-color:#366aff;
1899
- border-color: #366aff;
1900
- i{
1901
- padding-right: 8px;
1902
- font-weight: 600;
1903
- }
1904
- }
1905
- /deep/.el-checkbox-group{
1906
- display: flex;
1907
- align-items: center;
1908
- flex-wrap: wrap;
1909
- .el-checkbox{
1910
- padding: 8px 0;
1911
- min-width:150px;
1912
- max-width: 280px;
1913
- flex: none;
1914
- display: flex;
1915
- overflow: hidden;
1916
- margin-right: 0;
1917
- display: flex;
1918
- align-items:center;
1919
- }
1920
- .el-checkbox__label{
1921
- font-size: 1em;
1922
- overflow: hidden;
1923
- text-overflow: ellipsis;
1924
- white-space: nowrap;
1925
- }
1926
- }
1927
-
1928
- /deep/.el-radio-group{
1929
- display: flex;
1930
- align-items: center;
1931
- flex-wrap: wrap;
1932
- .el-radio{
1933
- padding: 8px 0;
1934
- min-width:150px;
1935
- max-width: 280px;
1936
- flex: none;
1937
- display: flex;
1938
- overflow: hidden;
1939
- margin-right: 0;
1940
- }
1941
- .el-radio__label{
1942
- overflow: hidden;
1943
- text-overflow: ellipsis;
1944
- white-space: nowrap;
1945
- font-size: 1em;
1946
- }
1947
- }
1948
-
1949
- /deep/.el-radio__input.is-checked+.el-radio__label{
1950
- color: #366aff!important;
1951
- }
1952
- /deep/.el-radio__input.is-checked .el-radio__inner{
1953
- color: #366aff!important;
1954
- border-color: #366aff!important;
1955
- background: #366aff!important;
1956
- }
1957
- /deep/.el-checkbox__input.is-checked+.el-checkbox__label{
1958
- color: #366aff!important;
1959
- }
1960
- /deep/.el-checkbox__input.is-checked .el-checkbox__inner, .el-checkbox__input.is-indeterminate .el-checkbox__inner{
1961
- background-color: #366aff!important;
1962
- border-color: #366aff!important;
1963
- }
1964
- /deep/.ck .ck-icon {
1965
- width: 14px !important;
1966
- height: 14px !important;
1967
- }
1968
- }
1969
-
1
+ <template>
2
+ <div class="media-body">
3
+ <div class="formClass" :class="isPhone?'remPhoneClassForm':'remCompanyClassForm'" v-if="formShow.form">
4
+ <div class="titleName" >
5
+ {{formShow.form.name}}
6
+ </div>
7
+ <div class="title-link"></div>
8
+ <div class="pcFormClass" v-if="isCompany">
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
+ <span v-if="item.fieldId!=='workorder_description'&&item.fieldId!=='workorder_clientId'">{{item.formField.name}}</span>
16
+ <span v-if="item.fieldId==='workorder_description'">问题描述</span>
17
+ <span v-if="item.fieldId==='workorder_clientId'">报单人</span>
18
+ <span style="color: red;padding-left: 5px" v-if="item.required || isRequiredFn(item.formField)">*</span>
19
+ </div>
20
+ <!-- item.value -->
21
+ <el-input v-model="item.value"
22
+ :placeholder="item.formField.extInfo&&item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请输入'"
23
+ :maxlength="item.formField.extInfo&&item.formField.extInfo.maxNum?item.formField.extInfo.maxNum*1:1000"
24
+ v-else-if="item.formField.type==='INPUT'&&item.fieldId!=='workorder_name'"
25
+ ></el-input>
26
+ <template v-else-if="item.formField.type==='EXPLANATION'">
27
+ <div class="explanation">
28
+ <p class="explanation-p">
29
+ <span class="el-icon-info"></span>
30
+ {{item.formField.extInfo.descriptionText}}
31
+ </p>
32
+ </div>
33
+ </template>
34
+ <template v-else-if="item.formField.type==='EXPLAIN'">
35
+ <div class="explanation">
36
+ <p class="explanation-p">
37
+ <span class="el-icon-info"></span>
38
+ <span v-if="item.formField.extInfo.url" class="explain-url"><a :href="item.formField.extInfo.url" target="_blank">{{item.value}}</a></span>
39
+ <span v-else>{{item.value}}</span>
40
+ </p>
41
+ </div>
42
+ </template>
43
+ <el-input type="textarea" :rows="2" v-model="fieldValus[item.fieldId]"
44
+ :placeholder="item.formField.extInfo&&item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请输入'"
45
+ :maxlength="item.formField.extInfo&&item.formField.extInfo.maxNum?item.formField.extInfo.maxNum*1:1000"
46
+ v-if="item.formField.type==='TEXTAREA'&& item.fieldId!=='workorder_description'"
47
+ ></el-input>
48
+ <ckeditor
49
+ :editor="ckeditor.editor"
50
+ v-model="item.value"
51
+ :config="ckeditor.editorConfig"
52
+ v-else-if="item.fieldId==='workorder_description'"
53
+ ></ckeditor>
54
+ <el-date-picker
55
+ v-model=item.value
56
+ type="date"
57
+ :placeholder="item.formField.extInfo&&item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请选择日期'"
58
+ style="width: 100%"
59
+ v-else-if="item.formField.type==='DATE_PICKER'"
60
+ >
61
+ </el-date-picker>
62
+ <el-time-picker
63
+ v-model=item.value
64
+ :placeholder="item.formField.extInfo&&item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请选择时间'"
65
+ style="width: 100%"
66
+ v-else-if="item.formField.type==='TIME_PICKER' && (!item.formField.extInfo.mold || item.formField.extInfo.mold == 'TIME' || getMoldTime(item.formField) == 'TIME')"
67
+ >
68
+ </el-time-picker>
69
+ <el-date-picker
70
+ v-model=item.value
71
+ type="date"
72
+ style="width: 100%"
73
+ :placeholder="item.formField.extInfo&&item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请选择日期'"
74
+ v-else-if="item.formField.type==='TIME_PICKER' && (item.formField.extInfo.mold==='DATA' || item.formField.extInfo.mold==='DATE' || getMoldTime(item.formField) == 'DATE')"
75
+ >
76
+ </el-date-picker>
77
+ <el-date-picker
78
+ v-model=item.value
79
+ :placeholder="item.formField.extInfo&&item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请选择日期时间'"
80
+ clearable
81
+ style="width: 100%"
82
+ type="datetime"
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')"
84
+ >
85
+ </el-date-picker>
86
+ <div v-else-if="item.formField.type==='RADIO' &&item.formField.extInfo.options">
87
+ <el-radio-group v-model=item.value style="text-align:left">
88
+ <el-radio v-for="(items,index) in item.formField.extInfo.options" :label=items.value :key="index">{{items.label}}</el-radio>
89
+ </el-radio-group>
90
+ </div>
91
+ <div v-else-if="item.formField.type==='RADIO' &&item.formField.extInfo.option">
92
+ <el-radio-group v-model=item.value style="text-align:left">
93
+ <el-radio v-for="(items,index) in item.formField.extInfo.option" :label=items.value :key="index">{{items.label}}</el-radio>
94
+ </el-radio-group>
95
+ </div>
96
+ <div v-else-if="item.formField.type==='CHECKBOX' && item.formField.extInfo.option">
97
+ <el-checkbox-group v-model=item.value style="text-align:left">
98
+ <el-checkbox
99
+ v-for="(items,index) in item.formField.extInfo.option"
100
+ :label=items.value
101
+ :key="index"
102
+ >{{items.label}}</el-checkbox>
103
+ </el-checkbox-group>
104
+ </div>
105
+ <div v-else-if="item.formField.type==='CHECKBOX' && item.formField.extInfo.options">
106
+ <el-checkbox-group v-model=item.value style="text-align:left">
107
+ <el-checkbox
108
+ v-for="(items,index) in item.formField.extInfo.options"
109
+ :label=items.value
110
+ :key="index"
111
+ >{{items.label}}</el-checkbox>
112
+ </el-checkbox-group>
113
+ </div>
114
+ <div v-else-if="item.formField.type==='SELECT' || item.formField.type==='OPTION'" >
115
+ <!-- <el-select
116
+ v-model=item.value
117
+ :placeholder="item.formField.extInfo&&item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请选择'"
118
+ style="width: 100%"
119
+ filterable
120
+ v-if="item.formField.extInfo && item.formField.extInfo.option"
121
+ >
122
+ <el-option
123
+ v-for="(items,index) in item.formField.extInfo.option"
124
+ :key="index"
125
+ :label="items.label"
126
+ :value="items.value">
127
+ </el-option>
128
+ </el-select>
129
+ <el-select
130
+ v-model=item.value
131
+ :placeholder="item.formField.extInfo&&item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请选择'"
132
+ style="width: 100%"
133
+ filterable
134
+ v-else-if="item.formField.extInfo && item.formField.extInfo.options"
135
+ >
136
+ <el-option
137
+ v-for="(items,index) in item.formField.extInfo.options"
138
+ :key="index"
139
+ :label="items.label"
140
+ :value="items.value">
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>
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>
168
+ </div>
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
179
+ v-model=item.value
180
+ :options=item.formField.extInfo.cascade
181
+ style="width: 100%;"
182
+ :placeholder="item.formField.extInfo&&item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请选择'"
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]'"
191
+ ></el-cascader>
192
+ <el-cascader
193
+ v-model=item.value
194
+ :options=setOptions(item.formField.extInfo)
195
+ style="width: 100%;"
196
+ :placeholder="item.formField.extInfo&&item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请选择'"
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;">
202
+ <el-upload
203
+ class="upload-demo"
204
+ ref="upload"
205
+ :list-type="item.formField.type === 'IMAGE'?'picture-card':''"
206
+ :accept="acceptFieldType(item.formField.type)"
207
+ name="file"
208
+ action="/open/media/file/upload"
209
+ :multiple="item.formField.extInfo&&item.formField.extInfo.limitNum&&item.formField.extInfo.limitNum>1?true:false"
210
+ :file-list="fileListList[item.fieldId]"
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)})"
213
+ :on-exceed="exceedUpload"
214
+ :on-remove="handleRemove"
215
+ :http-request="aliyunOssRequest"
216
+ :on-change="handleEditChange"
217
+ :on-success="successUpload"
218
+ >
219
+ <i class="el-icon-plus"></i>
220
+ <!-- <el-button size="small" type="primary" v-else class="uploadBtn">点击上传</el-button>-->
221
+ </el-upload>
222
+ </div>
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>
248
+ </div>
249
+ </div>
250
+ </div>
251
+ <div class="mobileFormClass" v-else style="padding: 10px 0;" :class="{notClick:disableds === true}">
252
+ <div v-for="(item) in formFieldRelation"
253
+ :key="item.fieldId"
254
+ class="form-field-item"
255
+ >
256
+ <div v-if="item.formField.type==='INPUT'" class="form-field-item-value">
257
+ <van-field v-model=item.value
258
+ :label=item.formField.name
259
+ :required="item.required || isRequiredFn(item.formField)"
260
+ :disabled="disableds"
261
+ :placeholder="item.formField.extInfo&&item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请输入'"
262
+ :maxlength="item.formField.extInfo&&item.formField.extInfo.maxNum?item.formField.extInfo.maxNum*1:1000"
263
+ />
264
+ </div>
265
+ <div v-else-if="item.formField.type==='EXPLANATION'||item.formField.type==='EXPLAIN'" class="explan-ation">
266
+ <div class="explanation">
267
+ <p class="explanation-p" v-if="item.formField.type==='EXPLANATION'">
268
+ <span class="el-icon-info"></span>
269
+ {{item.formField.extInfo.descriptionText}}
270
+ </p>
271
+ <p v-else class="explanation-p">
272
+ <span class="el-icon-info"></span>
273
+ <span v-if="item.formField.extInfo.url" class="explain-url"><a :href="item.formField.extInfo.url" target="_blank">{{item.value}}</a></span>
274
+ <span v-else>{{item.value}}</span>
275
+ </p>
276
+ </div>
277
+ </div>
278
+ <div v-else-if="item.formField.type==='TEXTAREA'" class="form-field-item-value">
279
+ <van-field v-model=item.value
280
+ :label=item.formField.name
281
+ :required="item.required || isRequiredFn(item.formField)"
282
+ type="textarea"
283
+ :disabled="disableds"
284
+ :placeholder="item.formField.extInfo&&item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请输入'"
285
+ :maxlength="item.formField.extInfo&&item.formField.extInfo.maxNum?item.formField.extInfo.maxNum*1:1000"
286
+ v-if="item.fieldId!=='workorder_description'"
287
+ />
288
+ <div v-if="item.fieldId==='workorder_description'" class="workorder_description">
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>
291
+ {{item.formField.name}}
292
+ </div>
293
+ <ckeditor
294
+ :editor="ckeditor.editor"
295
+ v-model="item.value"
296
+ @onReady="onReady"
297
+ :config="ckeditor.editorConfig"
298
+ ></ckeditor>
299
+ </div>
300
+ </div>
301
+ <div v-else-if="item.formField.type==='DATE_PICKER'" class="form-field-item-value">
302
+ <van-field
303
+ readonly
304
+ clickable
305
+ name="calendar"
306
+ :value=dateValue[item.fieldId]
307
+ :label=item.formField.name
308
+ :placeholder="item.formField.extInfo&&item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请选择日期'"
309
+ :required="item.required || isRequiredFn(item.formField)"
310
+ @click="dateClick(item.fieldId)"
311
+ :disabled="disableds"
312
+ right-icon="van-icon van-icon-arrow van-cell__right-icon"
313
+ />
314
+ <van-calendar
315
+ v-model="showCalendar"
316
+ @confirm="onConfirmCalendar($event,item)"
317
+ />
318
+ </div>
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">
320
+ <van-field
321
+ readonly
322
+ clickable
323
+ name="datetimePicker"
324
+ :required="item.required || isRequiredFn(item.formField)"
325
+ :value=timeValue[item.fieldId]
326
+ :label=item.formField.name
327
+ :placeholder="item.formField.extInfo&&item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请选择'"
328
+ @click="timeClick(item.fieldId,item,'DATE_TIME')"
329
+ :disabled="disableds"
330
+ right-icon="van-icon van-icon-arrow van-cell__right-icon"
331
+
332
+ />
333
+ <van-popup v-model="dateTimePicker" position="bottom">
334
+ <van-datetime-picker
335
+ v-model="currentDate"
336
+ type="datetime"
337
+ @confirm="onConfirm($event,item.fieldId,item,'DATE_TIME')"
338
+ @cancel="dateTimePicker = false"
339
+ :min-date="minDate"
340
+ :formatter="formatter"
341
+ :max-date="maxDate"
342
+ />
343
+ </van-popup>
344
+ </div>
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">
372
+ <van-field
373
+ readonly
374
+ clickable
375
+ name="datetimePicker"
376
+ :required="item.required || isRequiredFn(item.formField)"
377
+ :value=timeValue[item.fieldId]
378
+ :label=item.formField.name
379
+ :placeholder="item.formField.extInfo&&item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请选择'"
380
+ @click="timeClick(item.fieldId,item,'DATE')"
381
+ :disabled="disableds"
382
+ right-icon="van-icon van-icon-arrow van-cell__right-icon"
383
+
384
+ />
385
+ <van-calendar v-model="datePicker" :show-confirm="false" @confirm="onConfirm($event,item.fieldId,item,'DATE')" @cancel="datePicker = false"/>
386
+ </div>
387
+ <div v-else-if="item.formField.type==='RADIO'" class="form-field-item-other">
388
+ <van-field name="radio" :label="item.formField.name" :required="item.required || isRequiredFn(item.formField)" :disabled="disableds" v-if="item.formField.extInfo.option">
389
+ <template #input style="display: flex;align-items: center">
390
+ <van-radio-group v-model=item.value direction="horizontal" :disabled="disableds">
391
+ <van-radio v-for="(items,index) in item.formField.extInfo.option" :name=items.value :key="index">{{items.label}}</van-radio>
392
+ </van-radio-group>
393
+ </template>
394
+ </van-field>
395
+ <van-field name="radio" :label="item.formField.name" :required="item.required || isRequiredFn(item.formField)" :disabled="disableds" v-if="item.formField.extInfo.options">
396
+ <template #input style="display: flex;align-items: center" >
397
+ <van-radio-group v-model=item.value direction="horizontal" :disabled="disableds">
398
+ <van-radio v-for="(items,index) in item.formField.extInfo.options" :name=items.value :key="index">{{items.label}}</van-radio>
399
+ </van-radio-group>
400
+ </template>
401
+ </van-field>
402
+ </div>
403
+ <div v-else-if="item.formField.type==='CHECKBOX'" class="form-field-item-other">
404
+ <van-field name="checkbox" :label=item.formField.name :required="item.required || isRequiredFn(item.formField)" :disabled="disableds" v-if="item.formField.extInfo.option">
405
+ <template #input style="display: flex;align-items: center" >
406
+ <van-checkbox-group v-model=item.value ref="checkboxGroup" direction="horizontal" :disabled="disableds">
407
+ <van-checkbox
408
+ v-for="(items,index) in item.formField.extInfo.option"
409
+ shape="square"
410
+ :key="index"
411
+ :name=items.value>
412
+ {{items.label}}
413
+ </van-checkbox>
414
+ </van-checkbox-group>
415
+ </template>
416
+ </van-field>
417
+ <van-field name="checkbox" :label=item.formField.name :required="item.required || isRequiredFn(item.formField)" :disabled="disableds" v-if="item.formField.extInfo.options">
418
+ <template #input style="display: flex;align-items: center" >
419
+ <van-checkbox-group v-model=item.value ref="checkboxGroup" direction="horizontal" :disabled="disableds">
420
+ <van-checkbox
421
+ v-for="(items,index) in item.formField.extInfo.options"
422
+ shape="square"
423
+ :key="index"
424
+ :name=items.value>
425
+ {{items.label}}
426
+ </van-checkbox>
427
+ </van-checkbox-group>
428
+ </template>
429
+ </van-field>
430
+ </div>
431
+ <div v-else-if="item.formField.type==='SELECT' || item.formField.type==='OPTION'" class="form-field-item-value">
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
489
+ readonly
490
+ clickable
491
+ :value="Array.isArray(selectValues[item.fieldId])?selectValues[item.fieldId].join(','):selectValues[item.fieldId]"
492
+ :label="item.formField.name"
493
+ name="picker"
494
+ :placeholder="item.formField.extInfo&&item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请选择'"
495
+ @click="selectClick(item.fieldId,'ref',item)"
496
+ @click-right-icon.stop="SelectClear(item.fieldId)"
497
+ :required="item.required || isRequiredFn(item.formField)"
498
+ :disabled="disableds"
499
+ :right-icon="selectValues[item.fieldId]? 'close' : 'van-icon van-icon-arrow van-cell__right-icon'"
500
+ />
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>
517
+ <div v-else-if="item.formField.type==='CASCADER'" class="form-field-item-value">
518
+ <van-field
519
+ readonly
520
+ clickable
521
+ name="area"
522
+ :value="checkDatas[item.fieldId] && Array.isArray(checkDatas[item.fieldId])?checkDatas[item.fieldId].map(e=>e.label).join(','):''"
523
+ :label=item.formField.name
524
+ :placeholder="item.formField.extInfo&&item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请选择'"
525
+ @click="openDrawer(item,'cascader')"
526
+ :required="item.required || isRequiredFn(item.formField)"
527
+ :disabled="disableds"
528
+ right-icon="van-icon van-icon-arrow van-cell__right-icon"
529
+ />
530
+
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>
537
+ </van-popup>
538
+ </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>
542
+ <van-uploader
543
+ v-model="fileListList[item.fieldId]"
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)'
546
+ :after-read="afterRead"
547
+ :accept="acceptFieldType(item.formField.type)"
548
+ :multiple="item.formField.extInfo&&item.formField.extInfo.limitNum&&item.formField.extInfo.limitNum>1?true:false"
549
+ >
550
+ <div class="vant-upload--picture-card">
551
+ <i class="el-icon-plus"></i>
552
+ </div>
553
+ </van-uploader>
554
+ </div>
555
+ </div>
556
+ </div>
557
+ <van-popup v-model="fileUpload" :close-on-click-overlay="false">
558
+ <div style="background-color: black;height: 100px;width: 100px;display: flex;justify-content: center;align-items: center" >
559
+ <van-loading type="spinner"/>
560
+ </div>
561
+ </van-popup>
562
+ </div>
563
+ <div class="bottom-link"></div>
564
+ <div class="form-submit-btn" v-if="isCompany">
565
+ <el-button style="border-color: #366aff;color: white;background-color: #366aff" round class="submitClass" size="small" @click="submitClick" :disabled="disableds">
566
+ <i class="el-icon-check" v-if="!disableds"></i>
567
+ {{submitValue}}
568
+ </el-button>
569
+ </div>
570
+ <div class="form-submit-btn" v-else>
571
+ <van-button round type="info" class="submitClass" @click="submitClick" :disabled="disableds">
572
+ <i class="el-icon-check" v-if="!disableds"></i>
573
+ {{submitValue}}
574
+ </van-button>
575
+ </div>
576
+ </div>
577
+ <el-dialog :visible.sync="dialogVisible">
578
+ <img width="100%" :src="dialogImageUrl" alt="">
579
+ </el-dialog>
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>
611
+ </div>
612
+ </template>
613
+
614
+ <script>
615
+ /* eslint-disable */
616
+ import { forMatTime } from "./utils/format_date";
617
+
618
+ let that
619
+ import {multipartUpload,ossFileUrl} from "./utils/AliyunIssUtil";
620
+ import {MyCustomUploadAdapterPlugin} from "./utils/ckeditor";
621
+ import MyimageUpload from './utils/plugin-image'
622
+ import CKEDITOR from 'ckeditor'
623
+
624
+ import myPopup from "./myPopup.vue";
625
+ import Tree from '../components/tree'
626
+ import selectPopup from '../components/popup'
627
+ export default {
628
+ name: "formTemplate",
629
+ data() {
630
+ return {
631
+ isPhone: false,
632
+ isCompany: false,
633
+ checkboxGroup: [],
634
+ currentDate: new Date(),
635
+ currentTime:"",
636
+ timePicker:false,
637
+ timeValue: [],
638
+ dateValue: [],
639
+ showPicker: false,
640
+ selectPicker:false,
641
+ dateTimePicker: false,
642
+ datePicker:false,
643
+ showCalendar: false,
644
+ radio: [],
645
+ selectValue: [],
646
+ pickerValue: [],
647
+ showArea: false,
648
+ dateTimeValue: [],
649
+ dateTimeValue1: [],
650
+ showDateTimePicker: false,
651
+ showDateTimePicker1: false,
652
+ pickerId: 0,
653
+ dateId: 0,
654
+ timeId: 0,
655
+ selectId: 0,
656
+ dateTimeId: 0,
657
+ column: [
658
+ {
659
+ values: '', // 设置的页面初始值
660
+ className: "column1"
661
+ },
662
+ {
663
+ values: '',
664
+ className: "column2",
665
+ },
666
+ {
667
+ values: '',
668
+ className: "column3",
669
+ }
670
+ ],
671
+ pageShow: false, //省市区三级联动是否显示(因为是接口返回的数据,等三级数据渲染完毕之后,在显示三级联动)
672
+ cityDates: '', //安联当前选中市的所有区所有数据
673
+ data: [],//接口返回所有级联数据
674
+ dateTimeRange: '',
675
+ selectValues: [],
676
+ cascadeValue: [],
677
+ minDate: new Date(2020, 0, 1),
678
+ maxDate: new Date(2025, 11, 31),
679
+ disableds: false,
680
+ submitValue: '提交',
681
+ clickPicker: '',
682
+ columns: [],
683
+ copyForm: [],
684
+ cascaderId:0,
685
+ formShow:[],
686
+ uploadAvatarParams: {
687
+ token: "8c98087dfd2d48f856d8c95c09115def",
688
+ },
689
+ fileListList:[],
690
+ keyValue:'',
691
+ selectKey:'',
692
+ filedId:'',
693
+ disabled:false,
694
+ dialogVisible:false,
695
+ dialogImageUrl:'',
696
+ fileUpload:false,
697
+ videoFlag:false,
698
+ videoUploadPercent:false,
699
+ fileType:['PICTURE','VIDEO','AUDIO'],
700
+ loading:'',
701
+ ossConfig: {
702
+ region: "oss-cn-zhangjiakou",
703
+ //云账号AccessKey有所有API访问权限,建议遵循阿里云安全最佳实践,创建并使用STS方式来进行API访问
704
+ accessKeyId: "LTAI4G3QtdEdwkEbihBngAsK",
705
+ accessKeySecret: "OwgdVfc5PeCkIgqIdug660xmiSPchn",
706
+ // stsToken: '<Your securityToken(STS)>',
707
+ bucket: "guoranopen-zjk",
708
+ },
709
+ hideUploadEdit:false,
710
+ limitNum:1,
711
+ ckeditor: {
712
+ editor: CKEDITOR.ClassicEditor,
713
+ editorConfig: {
714
+ extraPlugins: [MyimageUpload,MyCustomUploadAdapterPlugin],
715
+ toolbar: [
716
+ 'MyimageUpload'
717
+ ]
718
+ },
719
+ },
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:{}
734
+ }
735
+ },
736
+ props: {
737
+ formList: {
738
+ type: Object,
739
+ default() {
740
+ return {}
741
+ }
742
+ },
743
+ type:String,
744
+ disable:Boolean,
745
+ submit:Boolean,
746
+ usePropStyleType:{
747
+ type:Boolean,
748
+ default() {
749
+ return false;
750
+ }
751
+ },
752
+ propIsPhone: {
753
+ type:Boolean,
754
+ default() {
755
+ return false;
756
+ }
757
+ },
758
+ propIsCompany: {
759
+ type:Boolean,
760
+ default() {
761
+ return false;
762
+ }
763
+ },
764
+ uploadUrl: {
765
+ type:String,
766
+ default(){
767
+ return '/open/media/file/upload'
768
+ }
769
+ }
770
+ },
771
+ computed:{
772
+ acceptType:function () {
773
+ return '.jpg,.jpeg,.png,.gif,.JPG,.JPEG,.PBG,.GIF'
774
+ },
775
+ formFieldRelation:function () {
776
+ let arr = [];
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') {
781
+ arr.push(item);
782
+ }
783
+ })
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
+ }
822
+ }
823
+ },
824
+ components:{
825
+ myPopup,
826
+ Tree,
827
+ selectPopup
828
+ },
829
+ mounted() {
830
+ this.isMobile()
831
+ },
832
+ beforeCreate() {
833
+ // 等待dom渲染完毕之后,再去显示 三级联动。
834
+ that=this
835
+ this.$nextTick(function () {
836
+ this.pageShow = true;
837
+ })
838
+ },
839
+ created() {
840
+ if(this.disable===true)
841
+ {
842
+ this.disableds=true
843
+ this.submitValue = '已提交'
844
+ }
845
+ else
846
+ {
847
+ this.disableds=false
848
+ this.submitValue = '提交'
849
+ }
850
+ },
851
+ beforeMount() {
852
+ that.defaultClick()
853
+ },
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
+ },
879
+ setOptions(extInfo){
880
+ let options = []
881
+ console.debug('cascadeDown',extInfo)
882
+ if (extInfo.cascadeDown.options){
883
+ options = extInfo.cascadeDown.options
884
+ return options
885
+ }
886
+ else if (extInfo.cascadeDown[0]){
887
+ options = extInfo.cascadeDown[0].options
888
+ }
889
+ return options
890
+ },
891
+ onReady(){
892
+
893
+
894
+ },
895
+ beforeRead(file,type){
896
+ console.debug('file',file)
897
+ console.debug('fileType',!Array.isArray(file))
898
+ if (!Array.isArray(file)){
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
911
+ }
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
932
+ }
933
+ }
934
+ else{
935
+ let length = 0
936
+ if (this.fileListList[this.filedId]){
937
+ length = this.fileListList[this.filedId].length
938
+ }
939
+ if (file.length<=this.limitNum-length){
940
+ for (let i=0;i<file.length;i++){
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
953
+ }
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
974
+ }
975
+ }
976
+ }
977
+ else {
978
+ let num = 1
979
+ if (this.limitNum){
980
+ num = this.limitNum
981
+ }
982
+ let messageText = '仅支持上传'+num+'个'
983
+ this.$message.error(messageText);
984
+ return false
985
+ }
986
+
987
+ }
988
+
989
+ },
990
+ //文件上传至服务器
991
+ afterRead(file){
992
+ this.fileUpload=true
993
+ console.debug(file)
994
+ console.debug(!Array.isArray(file))
995
+ if (!Array.isArray(file)){
996
+ this.uploadImgFun(file.content,file.file.name,file,file.file);
997
+ }
998
+ else {
999
+ let num = 1
1000
+ if (this.limitNum){
1001
+ num = this.limitNum
1002
+ }
1003
+ if (file.length >num){
1004
+ this.$message.warning('仅支持上传'+num+'张图片')
1005
+ return false
1006
+ }
1007
+ else {
1008
+ for (let i = 0; i < file.length; i++){
1009
+ this.uploadImgFun(file[i].content,file[i].file.name,file[i],file[i].file);
1010
+ }
1011
+ }
1012
+ }
1013
+ },
1014
+ uploadImgFun(content,name,fileCon,file){
1015
+ console.log(fileCon)
1016
+ let imageData = {
1017
+ urls:[]
1018
+ }
1019
+ let imageInfo = {
1020
+ name:"",
1021
+ status:'',
1022
+ url:''
1023
+ }
1024
+ let res = multipartUpload(
1025
+ this.ossConfig,
1026
+ file,
1027
+ null,
1028
+ imageInfo
1029
+ );
1030
+ res.then((res) => {
1031
+ console.log("upload result:", res);
1032
+ // let filePath = res.name;
1033
+ imageData.urls.push({
1034
+ name:res.name,
1035
+ url:ossFileUrl(this.ossConfig, res.name),
1036
+ status:'success'
1037
+ })
1038
+ imageInfo.url = ossFileUrl(this.ossConfig, res.name)
1039
+ imageInfo.status='success'
1040
+ imageInfo.name=res.name
1041
+ for (let j=0;j<this.fileListList[this.filedId].length;j++){
1042
+ if (this.fileListList[this.filedId][j].content&&this.fileListList[this.filedId][j].content===content){
1043
+ this.fileListList[this.filedId][j].name=res.name
1044
+ this.fileListList[this.filedId][j].status='success'
1045
+ this.fileListList[this.filedId][j].url=imageInfo.url
1046
+ delete this.fileListList[this.filedId][j].content
1047
+ }
1048
+ }
1049
+ this.fileUpload=false
1050
+ }).catch((err) => {
1051
+ console.debug("upload err", err);
1052
+ });
1053
+
1054
+ },
1055
+ dataURLtoFileFun (dataurl, filename) {
1056
+ // 将base64转换为文件,dataurl为base64字符串,filename为文件名(必须带后缀名,如.jpg,.png)
1057
+ let arr = dataurl.split(",");
1058
+ let mime = arr[0].match(/:(.*?);/)[1];
1059
+ let bstr = atob(arr[1]);
1060
+ let n = bstr.length;
1061
+ let u8arr = new Uint8Array(n);
1062
+ while (n--) {
1063
+ u8arr[n] = bstr.charCodeAt(n);
1064
+ }
1065
+ return new File([u8arr], filename, { type: mime });
1066
+ },
1067
+ //初始化默认值
1068
+ defaultClick() {
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)
1077
+ }
1078
+ this.$set(extInfo,'option',extInfo.exinfo)
1079
+ }
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
1085
+ }
1086
+ }
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
1091
+ }
1092
+ }
1093
+ }
1094
+ }
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
1099
+ }
1100
+ }
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
1106
+ }
1107
+ }
1108
+ }
1109
+ }
1110
+ }
1111
+ }
1112
+ else {
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)
1117
+ {
1118
+ extInfo.options[j].value=extInfo.options[j].label
1119
+ }
1120
+ }
1121
+ if(!this.formList.form.formFieldRelation[i].value)
1122
+ {
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
1126
+ }
1127
+ }
1128
+ }
1129
+ }
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
1134
+ }
1135
+ }
1136
+
1137
+ if (!this.formList.form.formFieldRelation[i].value ||this.formList.form.formFieldRelation[i].value.length === 0)
1138
+ {
1139
+ this.formList.form.formFieldRelation[i].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
1143
+ }
1144
+ }
1145
+ }
1146
+ }
1147
+ }
1148
+ }
1149
+
1150
+ }
1151
+ if (type ==='FILE'){
1152
+ if (this.formList.form.formFieldRelation[i].value!==undefined){
1153
+ if (this.formList.form.formFieldRelation[i].value===null||this.formList.form.formFieldRelation[i].value===''){
1154
+ this.formList.form.formFieldRelation[i].value=[]
1155
+ }
1156
+ else {
1157
+ let valueList=[]
1158
+ let bool=false
1159
+ if(this.formList.form.formFieldRelation[i].value.length > 0) {
1160
+ for (let file=0;file<this.formList.form.formFieldRelation[i].value.length;file++) {
1161
+ let type = typeof (this.formList.form.formFieldRelation[i].value[file])
1162
+ if (type === "string") {
1163
+ bool = true
1164
+ valueList[file] = {}
1165
+ valueList[file].url = this.formList.form.formFieldRelation[i].value[file]
1166
+ }
1167
+ if (type === 'object'&&JSON.stringify(this.formList.form.formFieldRelation[i].value[file])!=='{}') {
1168
+ this.fileListList[this.formList.form.formFieldRelation[i].fieldId]=this.formList.form.formFieldRelation[i].value
1169
+ }
1170
+ else {
1171
+ this.fileListList[this.formList.form.formFieldRelation[i].fieldId]=[]
1172
+ }
1173
+ }
1174
+ if (bool){
1175
+ this.fileListList[this.formList.form.formFieldRelation[i].fieldId]=valueList
1176
+ }
1177
+ }
1178
+ }
1179
+ }
1180
+
1181
+
1182
+
1183
+ }
1184
+ }
1185
+ for (let i = 0; i < this.formList.form.formFieldRelation.length; i++) {
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:[];
1194
+ }
1195
+
1196
+ }
1197
+ if (type === 'DATE_PICKER') {
1198
+ if(this.formList.form.formFieldRelation[i].value!==null && this.formList.form.formFieldRelation[i].value!=='' ) {
1199
+ this.dateValue[this.formList.form.formFieldRelation[i].fieldId]=this.formatDate(this.formList.form.formFieldRelation[i].value)
1200
+ }
1201
+ }
1202
+ if (type === 'TIME_PICKER') {
1203
+ if(this.formList.form.formFieldRelation[i].value!==''&& this.formList.form.formFieldRelation[i].value!==null)
1204
+ {
1205
+ const dateTime = new Date(this.formList.form.formFieldRelation[i].value)
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
+ }
1221
+ }
1222
+ }
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
1228
+ }
1229
+ }
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
1234
+ }
1235
+ }
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
1241
+ }
1242
+ }
1243
+ }
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
1249
+ }
1250
+ }
1251
+ }
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
1256
+ }
1257
+ }
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
1264
+ }
1265
+ }
1266
+ }
1267
+ }
1268
+ }
1269
+ }
1270
+ }
1271
+ this.formShow = this.formList
1272
+ },
1273
+ addZero(i) {
1274
+ if (i < 10) {
1275
+ i = "0" + i;
1276
+ }
1277
+ return i;
1278
+ },
1279
+ formatter(type, value) {
1280
+ // 格式化选择器日期
1281
+ if (type === "year") {
1282
+ return `${value}年`;
1283
+ } else if (type === "month") {
1284
+ return `${value}月`;
1285
+ } else if (type === "day") {
1286
+ return `${value}日`;
1287
+ } else if (type === "hour") {
1288
+ return `${value}时`;
1289
+ } else if (type === "minute") {
1290
+ return `${value}分`;
1291
+ }
1292
+ return value;
1293
+ },
1294
+
1295
+ isMobile() {
1296
+ if (this.usePropStyleType === false){
1297
+ let flag = navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i);
1298
+ if (flag) {
1299
+ this.isPhone=true
1300
+ }
1301
+ else {
1302
+ this.isCompany=true
1303
+ }
1304
+ }else {
1305
+ this.isPhone=this.propIsPhone;
1306
+ this.isCompany=this.propIsCompany;
1307
+ }
1308
+ },
1309
+ //时间的选择器
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++) {
1329
+ if (this.formShow.form.formFieldRelation[i].fieldId=== id) {
1330
+ this.formShow.form.formFieldRelation[i].value = value
1331
+ if (!item.formField.extInfo.mold||item.formField.extInfo.mold==='DATA_TIME'){
1332
+ this.timeValue[id] =this.formatDate(value) +" "+ this.addZero(value.getHours()) + ':' + this.addZero(value.getMinutes())
1333
+ this.dateTimePicker = false;
1334
+ }
1335
+ else {
1336
+ this.timeValue[id] =this.formatDate(value)
1337
+ this.datePicker = false;
1338
+ }
1339
+ break
1340
+ }
1341
+ }*/
1342
+ },
1343
+ //转换日期的函数
1344
+ formatDate(date) {
1345
+ const dateTime = new Date(date)
1346
+ return `${dateTime.getFullYear()}-${dateTime.getMonth() + 1}-${dateTime.getDate()}`;
1347
+ },
1348
+ //日期的选择器
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++) {
1355
+ if (this.formShow.form.formFieldRelation[i].fieldId === id) {
1356
+ this.dateValue[id] = this.formatDate(date)
1357
+ this.formShow.form.formFieldRelation[i].value = date
1358
+ this.showCalendar = false;
1359
+ break
1360
+ }
1361
+ }*/
1362
+ },
1363
+ //下拉的选择器
1364
+ onConfirmSelect(value, item) {
1365
+ console.log('value',value,this.selectDetail)
1366
+ this.selectValues[this.selectDetail.fieldId] = value;
1367
+ for (let i = 0; i < this.formShow.form.formFieldRelation.length; i++) {
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){
1376
+ for (let j = 0; j < this.formShow.form.formFieldRelation[i].formField.extInfo.option.length; j++) {
1377
+ if(value ===this.formShow.form.formFieldRelation[i].formField.extInfo.option[j].label)
1378
+ {
1379
+ this.formShow.form.formFieldRelation[i].value = this.formShow.form.formFieldRelation[i].formField.extInfo.option[j].value
1380
+ }
1381
+ }
1382
+ }
1383
+ else {
1384
+ for (let j = 0; j < this.formShow.form.formFieldRelation[i].formField.extInfo.options.length; j++) {
1385
+ if(value ===this.formShow.form.formFieldRelation[i].formField.extInfo.options[j].label)
1386
+ {
1387
+ this.formShow.form.formFieldRelation[i].value = this.formShow.form.formFieldRelation[i].formField.extInfo.options[j].value
1388
+ }
1389
+ }
1390
+ }*/
1391
+ this.showPicker = false;
1392
+ break
1393
+ }
1394
+ }
1395
+ },
1396
+ //提交按钮事件
1397
+ submitClick() {
1398
+
1399
+ for (let i=0;i<this.formShow.form.formFieldRelation.length;i++)
1400
+ {
1401
+ if(this.formShow.form.formFieldRelation[i].formField.type==='CASCADER')
1402
+ {
1403
+ let cascader = []
1404
+ if (this.formShow.form.formFieldRelation[i].formField.extInfo.cascade){
1405
+ cascader = this.formShow.form.formFieldRelation[i].formField.extInfo.cascade
1406
+ }
1407
+ else if (this.formShow.form.formFieldRelation[i].formField.extInfo.cascadeDown.options){
1408
+ cascader = this.formShow.form.formFieldRelation[i].formField.extInfo.cascadeDown.options
1409
+ }
1410
+ else if (this.formShow.form.formFieldRelation[i].formField.extInfo.cascadeDown[0]){
1411
+ cascader = this.formShow.form.formFieldRelation[i].formField.extInfo.cascadeDown[0].options
1412
+ }
1413
+ cascader.forEach(item=>{
1414
+ if(item.children!==undefined){
1415
+ if(item.children.length===0) {
1416
+ delete item.children
1417
+ } else {
1418
+ item.children.forEach(items=>{
1419
+ if(items.children){
1420
+ if(items.children.length===0) {
1421
+ delete items.children
1422
+ }
1423
+ }
1424
+ })
1425
+ }
1426
+ }
1427
+ })
1428
+ }
1429
+ if (this.fileListList[this.formShow.form.formFieldRelation[i].fieldId]!== undefined) {
1430
+ let value=[]
1431
+ this.fileListList[this.formShow.form.formFieldRelation[i].fieldId].forEach(item=>{
1432
+ let file = {}
1433
+ file.name = item.name
1434
+ file.url = item.url
1435
+ value.push(file)
1436
+ })
1437
+ this.formShow.form.formFieldRelation[i].value=value
1438
+ }
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') {
1443
+ let value = this.formShow.form.formFieldRelation[i].value && this.formShow.form.formFieldRelation[i].value.includes('\n')?this.formShow.form.formFieldRelation[i].value:'';
1444
+ let strVal = '';
1445
+ if(value){
1446
+ strVal = value.replace(/\n/g,'');
1447
+ }
1448
+ let bool = this.formShow.form.formFieldRelation[i].value && this.formShow.form.formFieldRelation[i].value.includes('\n') && !strVal
1449
+ if(!this.formShow.form.formFieldRelation[i].value || bool|| (this.formShow.form.formFieldRelation[i].value&&this.formShow.form.formFieldRelation[i].value.length===0)) {
1450
+ this.$message.error('请完善'+ this.formShow.form.formFieldRelation[i].formField.name)
1451
+ return
1452
+ }
1453
+ }
1454
+ }
1455
+ this.$emit('submitClick',this.formShow)
1456
+ this.disableds = true
1457
+ this.submitValue = '已提交'
1458
+ },
1459
+ //日期的点击事件
1460
+ dateClick(id) {
1461
+ if(this.disableds === false)
1462
+ {
1463
+ for (let i = 0; i < this.formShow.form.formFieldRelation.length; i++) {
1464
+ if (this.formShow.form.formFieldRelation[i].fieldId === id) {
1465
+ this.dateId = id
1466
+ this.showCalendar = true
1467
+ break
1468
+ }
1469
+ }
1470
+ }
1471
+
1472
+ },
1473
+ //时间的点击事件
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
1487
+ }
1488
+ },
1489
+ //下拉的点击事件
1490
+ selectClick(id,type,item) {
1491
+ console.debug('111')
1492
+ if (this.disableds){
1493
+ return
1494
+ }
1495
+ this.selectDetail = item
1496
+ if(type == 'client') {
1497
+ let selectOption
1498
+ this.selectValue=[]
1499
+ for (let i = 0; i < this.formShow.form.formFieldRelation.length; i++) {
1500
+ if(this.formShow.form.formFieldRelation[i].formField.type==='SELECT' || this.formShow.form.formFieldRelation[i].formField.type==='OPTION')
1501
+ {
1502
+ if (this.formShow.form.formFieldRelation[i].fieldId === id) {
1503
+ selectOption = this.formShow.form.formFieldRelation[i].formField.extInfo.option?this.formShow.form.formFieldRelation[i].formField.extInfo.option:this.formShow.form.formFieldRelation[i].formField.extInfo.options?this.formShow.form.formFieldRelation[i].formField.extInfo.options:[]
1504
+ for (let j = 0; j < selectOption.length; j++) {
1505
+ this.selectValue[j] = selectOption[j].label
1506
+ }
1507
+
1508
+ }
1509
+ }
1510
+ }
1511
+ this.selectId = id
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;
1520
+ }
1521
+ },
1522
+ SelectClear(fieldId) {
1523
+ if(this.disableds === false){
1524
+ let i = this.formShow.form.formFieldRelation.findIndex(item => { console.log(item.fieldId); return item.fieldId == fieldId })
1525
+ this.selectValues[this.formShow.form.formFieldRelation[i].fieldId] = ''
1526
+ this.$forceUpdate()
1527
+ }
1528
+ },
1529
+ //级联的点击的事件
1530
+ pickerClick(id) {
1531
+ if(this.disableds === false)
1532
+ {
1533
+ if(this.pickerId!==id)
1534
+ {
1535
+ for (let i = 0; i < this.formShow.form.formFieldRelation.length; i++) {
1536
+ if (this.formShow.form.formFieldRelation[i].fieldId === id) {
1537
+ this.keyValue=''
1538
+ if(this.formShow.form.formFieldRelation[i].value.length!==undefined)
1539
+ {
1540
+ for (let m=0;m<this.formShow.form.formFieldRelation[i].value.length;m++)
1541
+ {
1542
+ this.keyValue+=this.formShow.form.formFieldRelation[i].value[m]
1543
+ }
1544
+ }
1545
+ this.data = []
1546
+ if (this.formShow.form.formFieldRelation[i].formField.extInfo.cascade){
1547
+ this.data = this.formShow.form.formFieldRelation[i].formField.extInfo.cascade
1548
+ }
1549
+ else if (this.formShow.form.formFieldRelation[i].formField.extInfo.cascadeDown.options){
1550
+ this.data = this.formShow.form.formFieldRelation[i].formField.extInfo.cascadeDown.options
1551
+ }
1552
+ else if (this.formShow.form.formFieldRelation[i].formField.extInfo.cascadeDown[0]){
1553
+ this.data = this.formShow.form.formFieldRelation[i].formField.extInfo.cascadeDown[0].options
1554
+ }
1555
+ this.column[0].values = Object.values(this.data).map(function (e) {
1556
+ return {text: e.value, code: e.value}
1557
+ })
1558
+ if (this.data[0].children !== undefined) {
1559
+ this.column[1].values = Object.values(this.data[0].children).map(function (e) {
1560
+ return {text: e.value, code: e.value}
1561
+ })
1562
+ if (this.data[0].children[0].children !== undefined) {
1563
+ this.column[2].values = Object.values(this.data[0].children[0].children).map(function (e) {
1564
+ return {text: e.value, code: e.value}
1565
+ })
1566
+ }
1567
+ else {
1568
+ this.$set(this.data[0].children[0], 'children', [])
1569
+ this.column[2].values=Object.values(this.data[0].children[0].children).map(function (res) {
1570
+ return {text: res.value, code: res.value};
1571
+ })
1572
+ }
1573
+ }
1574
+ }
1575
+ }
1576
+ }
1577
+
1578
+ this.pickerId = id
1579
+ this.showArea = true
1580
+ }
1581
+
1582
+
1583
+ },
1584
+ onChange(picker, values,index) {
1585
+ // 这里我有可能渲染的有问题,导致回调每次都修改了当前列,其他值没有修改,当前列??(当前列什么鬼呀,什么垃圾啊???) 解释一下 ↓↓
1586
+ // 因为vant的 van-picker 回调只会返回你修改的那一列,比如现在为 [北京,北京,东城区],你修改了省为[天津市,天津市,和平区],但是vant的change回调会得到[天津市,北京,东城区],后面两个在回调中没有修改,不知道我的渲染方法有问题还是什么问题。
1587
+ // 所以我在这里判断change事件触发后,如果你修改了省份的话,回调里面省份会改变,但是市和区还是上一个省份的 市和区,这时我们执行回调修改省,市,区的时候,因为回调只有省改变了,市和区DOM改变了,但是回调里面没改变的问题(不晓得什么问题),这时我们去找省下面的 市,我们取回调的市名称,如果在省下面没有找到这个市,默认展示第一个市,区也默认展示第一个市下面的区,如果遍历市能查到,就去展示对应的市。
1588
+ // 回调时修改第2列数据
1589
+ if (index == 0){
1590
+ picker.setColumnValues(2, []); // 防止突然选中第一个,第二个是更新的,但第三个联级不更新,我暂时强制清空
1591
+ }
1592
+ let ColumnIndexss=picker.getIndexes()
1593
+ let testValue=''
1594
+ this.$nextTick(()=>{
1595
+ if(index == 0)
1596
+ {
1597
+ if(this.data[ColumnIndexss[0]].children.length > 0)
1598
+ {
1599
+ if(this.data[ColumnIndexss[0]].children[0]!==undefined)
1600
+ {
1601
+ testValue=this.data[ColumnIndexss[0]].children[0].value
1602
+ picker.setColumnValues(2, this.county(this.data, testValue));
1603
+ }
1604
+ }
1605
+ else
1606
+ picker.setColumnValues(2, []);
1607
+ }
1608
+ if(index == 1)
1609
+ {
1610
+ if(this.data[ColumnIndexss[0]].children.length > 0)
1611
+ {
1612
+ if(this.data[ColumnIndexss[0]].children[ColumnIndexss[1]]!==undefined)
1613
+ {
1614
+ testValue=this.data[ColumnIndexss[0]].children[ColumnIndexss[1]].value
1615
+ picker.setColumnValues(2, this.county(this.data, testValue));
1616
+ }
1617
+ }
1618
+ else
1619
+ picker.setColumnValues(2, []);
1620
+ }
1621
+ })
1622
+
1623
+ picker.setColumnValues(1, this.cityDate(this.data, values[0].text));
1624
+ // 回调时修改第3列数据
1625
+
1626
+
1627
+ },
1628
+ // 修改级联第二级 这里不再多说什么了根据自己的数据格式来
1629
+ cityDate(data, province) {
1630
+ var that = this;
1631
+ data.forEach(function (res) {
1632
+ if (res.value == province) {
1633
+ that.cityDates = res;
1634
+ }
1635
+ });
1636
+ if (that.cityDates.children !== undefined&&that.cityDates.children.length > 0) {
1637
+ return that.cityDates.children.map(function (res) {
1638
+ return {text: res.value, code: res.value};
1639
+ })
1640
+ } else {
1641
+ this.$set(that.cityDates, 'children', [])
1642
+ return that.cityDates.children.map(function (res) {
1643
+ return {text: res.value, code: res.value};
1644
+ })
1645
+ }
1646
+ // return 返回数据格式,因为我需要省市区code,所以我return的格式是对象,例:[{text:'北京市',code:'1'},{text:'河南省',code:'2'},...],如果你不需要code直接这样就可以 例['北京市','河南省',.....]
1647
+ },
1648
+ // 修改级联第三级 这里不再多说什么了根据自己的数据格式来
1649
+ county(data, county) {
1650
+ var that = this;
1651
+ var countyDate = '';
1652
+ // 因为vant的 van-picker 回调只会返回你修改的那一列,比如现在为 [北京,北京,东城区],你修改了省为[天津市,天津市,和平区],但是vant的change回调会得到[天津市,北京,东城区],后面两个在回调中没有修改,不知道我的渲染方法有问题还是什么问题。
1653
+ // 所以我在这里判断change事件触发后,如果你修改了省份的话,回调里面省份会改变,但是市和区还是上一个省份的 市和区,这时我们执行回调修改省,市,区的时候,因为回调只有省改变了,市和区DOM改变了,但是回调里面没改变的问题(不晓得什么问题),这时我们去找省下面的 市,我们取回调的市名称,如果在省下面没有找到这个市,默认展示第一个市,区也默认展示第一个市下面的区,如果遍历市能查到,就去展示对应的市。
1654
+ that.cityDates.children.forEach(function (res) {
1655
+ if (res.value == county) {
1656
+ countyDate = res;
1657
+ }
1658
+ });
1659
+ // 这里如果没有找到对应的县
1660
+ if (countyDate == '') {
1661
+ if(that.cityDates.children.length > 0)
1662
+ {
1663
+ countyDate = that.cityDates.children[0];
1664
+ }
1665
+
1666
+ }
1667
+ // return 县
1668
+ if (countyDate.children === undefined) {
1669
+ this.$set(countyDate, 'children', [])
1670
+ return countyDate.children.map(function (res) {
1671
+ return {text: res.value, code: res.value};
1672
+ })
1673
+ } else {
1674
+ return countyDate.children.map(function (res) {
1675
+ return {text: res.value, code: res.value};
1676
+ })
1677
+ }
1678
+
1679
+ // return 返回数据格式,因为我需要省市区code,所以我return的格式是对象,例:[{text:'北京市',code:'1'},{text:'河南省',code:'2'},...],如果你不需要code直接这样就可以 例['北京市','河南省',.....]
1680
+ },
1681
+ //点击级联弹出框的确认按钮
1682
+ onConfirms(val, id) {
1683
+ let test = ''
1684
+ for (let i = 0; i < val.length; i++) {
1685
+ if (val[i] !== undefined) {
1686
+ test += val[i].text + '/'
1687
+ }
1688
+ }
1689
+ test = test.substr(0, test.length - 1)
1690
+ for (let i = 0; i < this.formShow.form.formFieldRelation.length; i++) {
1691
+ if (this.formShow.form.formFieldRelation[i].fieldId=== id) {
1692
+ this.cascadeValue[id] = test
1693
+ for (let j = 0; j < val.length; j++) {
1694
+ if (val[j] !== undefined) {
1695
+ this.formShow.form.formFieldRelation[i].value[j] = val[j].text
1696
+ }
1697
+ }
1698
+ break
1699
+ }
1700
+ }
1701
+ this.showArea = false;
1702
+ sessionStorage.setItem('cascader',test)
1703
+ },
1704
+ onCancel() {
1705
+ this.showArea = false;
1706
+ },
1707
+ aliyunOssRequest(data){
1708
+
1709
+ this.loading = this.$loading({
1710
+ lock: true,
1711
+ text: 'Loading',
1712
+ spinner: 'el-icon-loading',
1713
+ background: 'rgba(0, 0, 0, 0.8)'
1714
+ });
1715
+ let file = data.file;
1716
+ console.debug("upload file:", file);
1717
+ let imgInfo = {
1718
+ status:'',
1719
+ url:'',
1720
+ name:''
1721
+ }
1722
+ /* let imageData = {
1723
+ id:cid,
1724
+ cid:cid,
1725
+ type: "IMAGE",
1726
+ content: {
1727
+ urls: [],
1728
+ progress: 0,
1729
+ },
1730
+ };*/
1731
+ let res = multipartUpload(
1732
+ this.ossConfig,
1733
+ file,
1734
+ null,
1735
+ imgInfo
1736
+ );
1737
+ res.then((res) => {
1738
+ console.debug("upload result:", res);
1739
+ // let filePath = res.name;
1740
+ /* imageData.content.progress = 1;
1741
+ imageData.content.urls.push(
1742
+ ossFileUrl(this.ossConfig, res.name)
1743
+ );
1744
+ console.log('imageData',imageData)*/
1745
+ imgInfo.url = ossFileUrl(this.ossConfig, res.name)
1746
+ imgInfo.status='success'
1747
+ if (data.file){
1748
+ imgInfo.name = data.file.name
1749
+ imgInfo.uid = data.file.uid
1750
+ }
1751
+ if (!this.fileListList[this.filedId])
1752
+ {
1753
+ this.fileListList[this.filedId] = []
1754
+ }
1755
+ this.fileListList[this.filedId].push(imgInfo)
1756
+ this.loading.close()
1757
+ }).catch((err) => {
1758
+ console.debug("upload err", err);
1759
+ });
1760
+ },
1761
+ successUpload(response,file,fileList){
1762
+ if (!this.fileListList[this.filedId]){
1763
+ this.fileListList[this.filedId] = []
1764
+ }
1765
+ for (let i=0;i<fileList.length;i++){
1766
+ if (!this.fileListList[this.filedId][i]){
1767
+ this.fileListList[this.filedId][i]={}
1768
+ }
1769
+ this.fileListList[this.filedId][i].url=fileList[i].url
1770
+ this.fileListList[this.filedId][i].name=fileList[i].name
1771
+ this.fileListList[this.filedId][i].status=fileList[i].status
1772
+ }
1773
+ },
1774
+ uploadProgress(){
1775
+ this.loading = this.$loading({
1776
+ lock: true,
1777
+ text: 'Loading',
1778
+ spinner: 'el-icon-loading',
1779
+ background: 'rgba(0, 0, 0, 0.7)'
1780
+ });
1781
+ },
1782
+ handleRemove(file) {
1783
+ if (this.fileListList[this.filedId]){
1784
+ for (let i=0;i<this.fileListList[this.filedId].length;i++)
1785
+ {
1786
+ if (this.fileListList[this.filedId][i].uid){
1787
+ if (this.fileListList[this.filedId][i].uid===file.uid){
1788
+ this.fileListList[this.filedId].splice(i,1)
1789
+ return
1790
+ }
1791
+ }
1792
+ else if (this.fileListList[this.filedId][i].url===file.url){
1793
+ this.fileListList[this.filedId].splice(i,1)
1794
+ return
1795
+ }
1796
+ }
1797
+
1798
+ }
1799
+ },
1800
+ handleEditChange(file,fileList){
1801
+ this.hideUploadEdit=fileList.length >= this.limitNum
1802
+ },
1803
+ onUploadProgress: function (progress, point, file, videoData) {
1804
+ console.debug("upload video progress", progress, point);
1805
+ if (progress === 1) {
1806
+ // this.loadingIns.close();
1807
+ videoData.content.url = ossFileUrl(this.ossConfig, point.name);
1808
+ // this.chooseVideo({data:url},file);
1809
+
1810
+ } else {
1811
+ videoData.content.progress = progress;
1812
+
1813
+ }
1814
+ },
1815
+ checkUpload(id,extInfo){
1816
+ this.filedId=id
1817
+ this.limitNum = extInfo.limitNum?extInfo.limitNum:(extInfo.limit?extInfo.limit:1)
1818
+
1819
+ },
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
1833
+ }
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
1854
+ }
1855
+
1856
+ },
1857
+ exceedUpload(){
1858
+ this.$message({
1859
+ message:"上传文件数量达到上限",
1860
+ duration:2000,
1861
+ type:'warning'
1862
+ })
1863
+ },
1864
+
1865
+ handlePictureCardPreview(file) {
1866
+ this.videoFlag = true;
1867
+ this.videoUploadPercent = file.percentage.toFixed(0);
1868
+ },
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)
1887
+ }
1888
+ }
1889
+ },
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
+ })
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
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
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
+ }
2061
+
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
+ }
2084
+
2085
+
2086
+
2087
+ }
2088
+ </script>
2089
+
2090
+ <style lang="less" scoped>
2091
+ .notClick {
2092
+ pointer-events: none;
2093
+ }
2094
+ .formClass{
2095
+ /* border: 1px solid #ebebeb;*/
2096
+ font-family: "Avenir", Helvetica, Arial, sans-serif;
2097
+ border-radius: 15px;
2098
+ .explanation{
2099
+ display: flex;
2100
+ padding: 4px;
2101
+ .explanation-p{
2102
+ color: #366aff;
2103
+ font-size: 14px;
2104
+ margin: 10px 4px;
2105
+ .el-icon-info{
2106
+ margin-right: 8px;
2107
+ }
2108
+ }
2109
+ }
2110
+ .explain-url{
2111
+ a{
2112
+ color:#366aff ;
2113
+ }
2114
+ }
2115
+ .titleName{
2116
+ font-size: 1em;
2117
+ text-align: center;
2118
+ padding-bottom: 10px;
2119
+ display: flex;
2120
+ align-items: center;
2121
+ justify-content: center;
2122
+ /* border-bottom: 1px solid #EEEEEE;*/
2123
+ }
2124
+ .title-link{
2125
+ height: 1px;
2126
+ background-color: #EEEEEE;
2127
+ }
2128
+ .bottom-link{
2129
+ margin-top: 14px;
2130
+ height: 1px;
2131
+ background-color: #EEEEEE;
2132
+ }
2133
+ .form-submit-btn{
2134
+ padding: 14px 16px 0 16px;
2135
+ text-align: center;
2136
+ }
2137
+ /deep/.ck.ck-editor{
2138
+ padding: 0 8px;
2139
+ }
2140
+ /deep/.ck.ck-toolbar{
2141
+ border-color:#E0E6F7;
2142
+ border-top-left-radius: 9px!important;
2143
+ border-top-right-radius: 9px!important;
2144
+ }
2145
+ /deep/.ck.ck-editor__editable_inline{
2146
+ border-color:#E0E6F7;
2147
+ min-height: 150px!important;
2148
+ border-bottom-left-radius: 9px!important;
2149
+ border-bottom-right-radius: 9px!important;
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
+ }
2179
+ }
2180
+ .pcFormClass{
2181
+ width: 400px;
2182
+ margin: 0 auto;
2183
+ .field-item{
2184
+ padding: 8px 0;
2185
+ .field-item-name{
2186
+ padding-bottom: 8px;
2187
+ color: #A9B3C6;
2188
+ /* color: #000000;*/
2189
+ }
2190
+ }
2191
+ /deep/.el-input__inner{
2192
+ border-color: #E0E6F7!important;
2193
+ background-color: transparent!important;
2194
+ border-radius: 9px!important;
2195
+ }
2196
+ /deep/.el-textarea__inner{
2197
+ border-color: #E0E6F7!important;
2198
+ background-color: transparent!important;
2199
+ border-radius: 9px!important;
2200
+ padding: 9px 15px!important;
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
+ }
2227
+ /deep/.el-upload--picture-card{
2228
+ background-color: #FFFFFF;
2229
+ border: 1px solid #E0E6F7;
2230
+ border-radius: 10px;
2231
+ width: 74px;
2232
+ height: 74px;
2233
+ vertical-align: top;
2234
+ cursor: pointer;
2235
+ text-align: center;
2236
+ font-size:28px;
2237
+ color:#366AFF;
2238
+ display: flex;
2239
+ align-items: center;
2240
+ justify-content: center;
2241
+ i{
2242
+ color: #366AFF;
2243
+ }
2244
+ }
2245
+ /deep/.el-select-dropdown__item.selected{
2246
+ color: #366aff;
2247
+ }
2248
+ /deep/.el-upload-list--picture-card{
2249
+ .el-upload-list__item{
2250
+ width: 74px;
2251
+ height: 74px;
2252
+ border-radius: 10px;
2253
+ }
2254
+ }
2255
+ /deep/.el-upload-list__item-name{
2256
+ max-width: 180px;
2257
+ }
2258
+ .hide .el-upload--picture-card {
2259
+ display: none!important;
2260
+ }
2261
+ }
2262
+ /deep/.van-radio__icon--checked .van-icon{
2263
+ background-color: #366aff!important;
2264
+ border-color: #366aff!important;
2265
+ }
2266
+ /deep/.van-checkbox__icon--checked .van-icon{
2267
+ background-color: #366aff!important;
2268
+ border-color: #366aff!important;
2269
+ }
2270
+ /deep/.vant-upload--picture-card{
2271
+ background-color: #ffffff;
2272
+ border: 1px solid #E0E6F7;
2273
+ border-radius: 10px;
2274
+ width: 74px;
2275
+ height: 74px;
2276
+ vertical-align: top;
2277
+ cursor: pointer;
2278
+ text-align: center;
2279
+ font-size:28px;
2280
+ color:#8c939d;
2281
+ display: flex;
2282
+ align-items: center;
2283
+ justify-content: center;
2284
+ i{
2285
+ color: #366aff;
2286
+ }
2287
+ }
2288
+ /deep/.van-popup{
2289
+ border-radius: 5px;
2290
+ }
2291
+ .remPhoneClassForm{
2292
+ .mobileFormClass{
2293
+ width: calc(100vw - 110px);
2294
+ background-color: white;
2295
+ .form-field-item{
2296
+ .form-field-item-value{
2297
+ /deep/.van-cell{
2298
+ flex-direction: column;
2299
+ padding: 8px 16px;
2300
+ }
2301
+ /deep/.van-cell__value{
2302
+ border: 1px solid #E0E6F7;
2303
+ border-radius: 9px;
2304
+ min-height: 40px;
2305
+ padding: 0 10px;
2306
+ }
2307
+ /deep/.van-cell__right-icon{
2308
+ color: #999999!important;
2309
+ }
2310
+ .form-field-item-file{
2311
+ padding: 10px 16px;
2312
+ .fileName{
2313
+ padding-bottom: 8px;
2314
+ color: #A9B3C6;
2315
+ /* color: #000000;*/
2316
+ }
2317
+ }
2318
+ .workorder_description{
2319
+ /* padding: 8px 16px;*/
2320
+ padding: 8px 0;
2321
+ /*font-size: 14px;*/
2322
+ .field-name{
2323
+ width: 100%;
2324
+ text-align: left;
2325
+ color: #A9B3C6;
2326
+ /* color: #000000;*/
2327
+ line-height: 1;
2328
+ padding-bottom: 8px;
2329
+ }
2330
+ /*.required-name{
2331
+ margin-left: -6px;
2332
+ }*/
2333
+
2334
+ /* /deep/.ck-content .image img{
2335
+ max-width: 200px!important;
2336
+ }*/
2337
+ }
2338
+ }
2339
+ .form-field-item-other{
2340
+ /deep/.van-cell{
2341
+ flex-direction: column;
2342
+ }
2343
+ /deep/.van-cell__value{
2344
+ min-height: 40px;
2345
+ }
2346
+ }
2347
+ .explan-ation{
2348
+ .explan-ation-div{
2349
+ display: flex;
2350
+ /* padding: 4px 16px;*/
2351
+ padding: 4px;
2352
+ }
2353
+ .explan-ation-p{
2354
+ color: #366aff;font-size: 14px;margin: 16px 4px;
2355
+ }
2356
+ }
2357
+ }
2358
+ .upload-phone-demo{
2359
+ /deep/.el-upload--picture-card{
2360
+ background-color: #fbfdff;
2361
+ border: 1px dashed #c0ccda;
2362
+ border-radius: 6px;
2363
+ width: 74px;
2364
+ height: 74px;
2365
+ vertical-align: top;
2366
+ cursor: pointer;
2367
+ text-align: center;
2368
+ font-size:28px;
2369
+ color:#8c939d;
2370
+ display: flex;
2371
+ align-items: center;
2372
+ justify-content: center;
2373
+ }
2374
+ /deep/.el-upload-list--picture-card .el-upload-list__item{
2375
+ height: 76px;
2376
+ width: 76px;
2377
+ }
2378
+ }
2379
+ /deep/.van-image__img{
2380
+ border-radius: 10px;
2381
+ }
2382
+ }
2383
+ .submitClass{
2384
+ min-width: 100px;
2385
+ background-color: #366aff;
2386
+ color: white!important;
2387
+ height: 32px;
2388
+ i{
2389
+ padding-right: 8px;
2390
+ font-weight: 600;
2391
+ }
2392
+ }
2393
+ /deep/.van-radio-group--horizontal{
2394
+ .van-radio{
2395
+ min-width: 100px;
2396
+ max-width: 260px;
2397
+ flex: none;
2398
+ }
2399
+ .van-radio--horizontal{
2400
+ padding: 0.3rem 0;
2401
+ margin-right: 6px;
2402
+ }
2403
+ }
2404
+ /deep/.van-checkbox-group--horizontal{
2405
+ .van-checkbox{
2406
+ min-width: 100px;
2407
+ max-width: 260px;
2408
+ flex: none;
2409
+ }
2410
+ .van-checkbox--horizontal{
2411
+ padding: 0.3rem 0;
2412
+ margin-right: 6px;
2413
+ }
2414
+ }
2415
+ /deep/.van-button--info{
2416
+ border:1px solid #366aff;
2417
+ }
2418
+ /deep/.van-field__label{
2419
+ width: 100%;
2420
+ text-align: left;
2421
+ color: #A9B3C6!important;
2422
+ /* color: #000000!important;*/
2423
+ display: flex;
2424
+ align-items: center;
2425
+ line-height: 1;
2426
+ padding-bottom: 8px;
2427
+ font-size: 1em;
2428
+ }
2429
+
2430
+ /deep/.van-field__control{
2431
+ min-height: 40px;
2432
+ }
2433
+ /deep/textarea{
2434
+ padding: 7px 0;
2435
+ }
2436
+ /deep/.van-dropdown-menu__bar{
2437
+ box-shadow: none!important;
2438
+ }
2439
+ /deep/.van-overlay{
2440
+ background-color: rgba(0,0,0,.4);
2441
+ }
2442
+ }
2443
+
2444
+ .remCompanyClassForm{
2445
+ width: 100%;
2446
+ font-size: 1em;
2447
+ .submitClass{
2448
+ min-width: 100px;
2449
+ color: white!important;
2450
+ background-color:#366aff;
2451
+ border-color: #366aff;
2452
+ i{
2453
+ padding-right: 8px;
2454
+ font-weight: 600;
2455
+ }
2456
+ }
2457
+ /deep/.el-checkbox-group{
2458
+ display: flex;
2459
+ align-items: center;
2460
+ flex-wrap: wrap;
2461
+ .el-checkbox{
2462
+ padding: 8px 0;
2463
+ min-width:150px;
2464
+ max-width: 280px;
2465
+ flex: none;
2466
+ display: flex;
2467
+ overflow: hidden;
2468
+ margin-right: 0;
2469
+ display: flex;
2470
+ align-items:center;
2471
+ }
2472
+ .el-checkbox__label{
2473
+ font-size: 1em;
2474
+ overflow: hidden;
2475
+ text-overflow: ellipsis;
2476
+ white-space: nowrap;
2477
+ }
2478
+ }
2479
+
2480
+ /deep/.el-radio-group{
2481
+ display: flex;
2482
+ align-items: center;
2483
+ flex-wrap: wrap;
2484
+ .el-radio{
2485
+ padding: 8px 0;
2486
+ min-width:150px;
2487
+ max-width: 280px;
2488
+ flex: none;
2489
+ display: flex;
2490
+ overflow: hidden;
2491
+ margin-right: 0;
2492
+ }
2493
+ .el-radio__label{
2494
+ overflow: hidden;
2495
+ text-overflow: ellipsis;
2496
+ white-space: nowrap;
2497
+ font-size: 1em;
2498
+ }
2499
+ }
2500
+
2501
+ /deep/.el-radio__input.is-checked+.el-radio__label{
2502
+ color: #366aff!important;
2503
+ }
2504
+ /deep/.el-radio__input.is-checked .el-radio__inner{
2505
+ color: #366aff!important;
2506
+ border-color: #366aff!important;
2507
+ background: #366aff!important;
2508
+ }
2509
+ /deep/.el-checkbox__input.is-checked+.el-checkbox__label{
2510
+ color: #366aff!important;
2511
+ }
2512
+ /deep/.el-checkbox__input.is-checked .el-checkbox__inner, .el-checkbox__input.is-indeterminate .el-checkbox__inner{
2513
+ background-color: #366aff!important;
2514
+ border-color: #366aff!important;
2515
+ }
2516
+ /deep/.ck .ck-icon {
2517
+ width: 14px !important;
2518
+ height: 14px !important;
2519
+ }
2520
+ }
2521
+ .drawer-container{
2522
+ height: 100%;
2523
+ overflow: hidden;
2524
+ }
1970
2525
  </style>