askbot-dragon 0.7.56 → 0.7.59

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 (66) 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 -54
  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/AskIFrame.vue +15 -15
  20. package/src/components/ConversationContainer.vue +1182 -1185
  21. package/src/components/FileType.vue +86 -86
  22. package/src/components/Message.vue +27 -27
  23. package/src/components/actionSatisfaction.vue +107 -107
  24. package/src/components/actionSendToBot.vue +62 -62
  25. package/src/components/answerDissatisfaction.vue +62 -62
  26. package/src/components/answerRadio.vue +76 -76
  27. package/src/components/ask-components/DissatisfactionOptions.vue +57 -57
  28. package/src/components/ask-components/Msgloading.vue +37 -37
  29. package/src/components/ask-components/SatisfactionV2.vue +15 -15
  30. package/src/components/askVideo.vue +138 -138
  31. package/src/components/assetDetails.vue +370 -370
  32. package/src/components/assetMessage.vue +228 -228
  33. package/src/components/associationIntention.vue +121 -121
  34. package/src/components/botActionSatisfactor.vue +68 -68
  35. package/src/components/chatContent.vue +513 -513
  36. package/src/components/feedBack.vue +136 -136
  37. package/src/components/file/AliyunOssComponents.vue +108 -108
  38. package/src/components/formTemplate.vue +1969 -1949
  39. package/src/components/loadingProcess.vue +164 -164
  40. package/src/components/message/ActionAlertIframe.vue +112 -112
  41. package/src/components/message/ShopMessage.vue +164 -164
  42. package/src/components/message/TextMessage.vue +924 -924
  43. package/src/components/message/TicketMessage.vue +177 -177
  44. package/src/components/message/swiper/index.js +4 -4
  45. package/src/components/message/swiper/ticketSwiper.vue +502 -502
  46. package/src/components/message/swiper/ticketSwiperItem.vue +61 -61
  47. package/src/components/msgLoading.vue +231 -231
  48. package/src/components/recommend.vue +89 -89
  49. package/src/components/selector/hOption.vue +20 -20
  50. package/src/components/selector/hSelector.vue +199 -199
  51. package/src/components/selector/hWrapper.vue +216 -216
  52. package/src/components/source/BotMessage.vue +24 -24
  53. package/src/components/source/CustomMessage.vue +24 -24
  54. package/src/components/test.vue +260 -260
  55. package/src/components/utils/AliyunIssUtil.js +72 -72
  56. package/src/components/utils/ckeditor.js +123 -124
  57. package/src/components/utils/command.js +69 -0
  58. package/src/components/utils/editing.js +12 -0
  59. package/src/components/utils/format_date.js +18 -18
  60. package/src/components/utils/index.js +6 -6
  61. package/src/components/utils/math_utils.js +15 -15
  62. package/src/components/utils/plugin-image.js +12 -0
  63. package/src/components/utils/toolbar-ui.js +42 -0
  64. package/src/components/voiceComponent.vue +119 -119
  65. package/src/main.js +45 -44
  66. package/vue.config.js +34 -34
@@ -1,1950 +1,1970 @@
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="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
- :config="ckeditor.editorConfig"
231
- ></ckeditor>
232
- </div>
233
- </div>
234
- <div v-else-if="item.formField.type==='DATE_PICKER'" class="form-field-item-value">
235
- <van-field
236
- readonly
237
- clickable
238
- name="calendar"
239
- :value=dateValue[item.fieldId]
240
- :label=item.formField.name
241
- :placeholder="item.formField.extInfo&&item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请选择日期'"
242
- :required="item.required===true"
243
- @click="dateClick(item.fieldId)"
244
- :disabled="disableds"
245
- right-icon="van-icon van-icon-arrow van-cell__right-icon"
246
- />
247
- <van-calendar
248
- v-model="showCalendar"
249
- @confirm="onConfirmCalendar($event,dateId)"
250
- />
251
- </div>
252
- <div v-else-if="item.formField.type==='TIME_PICKER'&&(!item.formField.extInfo.mold||item.formField.extInfo.mold==='DATA_TIME')" class="form-field-item-value">
253
- <van-field
254
- readonly
255
- clickable
256
- name="datetimePicker"
257
- :required="item.required===true"
258
- :value=timeValue[item.fieldId]
259
- :label=item.formField.name
260
- :placeholder="item.formField.extInfo&&item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请选择时间'"
261
- @click="timeClick(item.fieldId,item)"
262
- :disabled="disableds"
263
- right-icon="van-icon van-icon-arrow van-cell__right-icon"
264
-
265
- />
266
- <van-popup v-model="showTimePicker" position="bottom">
267
- <van-datetime-picker
268
- v-model="currentDate"
269
- type="datetime"
270
- @confirm="onConfirm($event,timeId,item)"
271
- @cancel="showTimePicker = false"
272
- :min-date="minDate"
273
- :formatter="formatter"
274
- :max-date="maxDate"
275
- />
276
- </van-popup>
277
- </div>
278
- <div v-else-if="item.formField.type==='TIME_PICKER'&&item.formField.extInfo.mold==='DATA'" class="form-field-item-value">
279
- <van-field
280
- readonly
281
- clickable
282
- name="datetimePicker"
283
- :required="item.required===true"
284
- :value=timeValue[item.fieldId]
285
- :label=item.formField.name
286
- :placeholder="item.formField.extInfo&&item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请选择日期'"
287
- @click="timeClick(item.fieldId,item)"
288
- :disabled="disableds"
289
- right-icon="van-icon van-icon-arrow van-cell__right-icon"
290
-
291
- />
292
- <van-calendar v-model="showTimePickerd" :show-confirm="false" @confirm="onConfirm($event,timeId,item)" @cancel="showTimePickerd = false"/>
293
- </div>
294
- <div v-else-if="item.formField.type==='RADIO'" class="form-field-item-other">
295
- <van-field name="radio" :label="item.formField.name" :required="item.required===true" :disabled="disableds" v-if="item.formField.extInfo.option">
296
- <template #input style="display: flex;align-items: center">
297
- <van-radio-group v-model=item.value direction="horizontal" :disabled="disableds">
298
- <van-radio v-for="(items,index) in item.formField.extInfo.option" :name=items.value :key="index">{{items.label}}</van-radio>
299
- </van-radio-group>
300
- </template>
301
- </van-field>
302
- <van-field name="radio" :label="item.formField.name" :required="item.required===true" :disabled="disableds" v-if="item.formField.extInfo.options">
303
- <template #input style="display: flex;align-items: center" >
304
- <van-radio-group v-model=item.value direction="horizontal" :disabled="disableds">
305
- <van-radio v-for="(items,index) in item.formField.extInfo.options" :name=items.value :key="index">{{items.label}}</van-radio>
306
- </van-radio-group>
307
- </template>
308
- </van-field>
309
- </div>
310
- <div v-else-if="item.formField.type==='CHECKBOX'" class="form-field-item-other">
311
- <van-field name="checkbox" :label=item.formField.name :required="item.required===true" :disabled="disableds" v-if="item.formField.extInfo.option">
312
- <template #input style="display: flex;align-items: center" >
313
- <van-checkbox-group v-model=item.value ref="checkboxGroup" direction="horizontal" :disabled="disableds">
314
- <van-checkbox
315
- v-for="(items,index) in item.formField.extInfo.option"
316
- shape="square"
317
- :key="index"
318
- :name=items.value>
319
- {{items.label}}
320
- </van-checkbox>
321
- </van-checkbox-group>
322
- </template>
323
- </van-field>
324
- <van-field name="checkbox" :label=item.formField.name :required="item.required===true" :disabled="disableds" v-if="item.formField.extInfo.options">
325
- <template #input style="display: flex;align-items: center" >
326
- <van-checkbox-group v-model=item.value ref="checkboxGroup" direction="horizontal" :disabled="disableds">
327
- <van-checkbox
328
- v-for="(items,index) in item.formField.extInfo.options"
329
- shape="square"
330
- :key="index"
331
- :name=items.value>
332
- {{items.label}}
333
- </van-checkbox>
334
- </van-checkbox-group>
335
- </template>
336
- </van-field>
337
- </div>
338
- <div v-else-if="item.formField.type==='SELECT' || item.formField.type==='OPTION'" class="form-field-item-value">
339
- <van-field
340
- readonly
341
- clickable
342
- name="picker"
343
- :value=selectValues[item.fieldId]
344
- :label=item.formField.name
345
- :placeholder="item.formField.extInfo&&item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请选择'"
346
- @click="selectClick(item.fieldId)"
347
- :required="item.required===true"
348
- :disabled="disableds"
349
- v-if="item.fieldId!=='workorder_clientId'"
350
- right-icon="van-icon van-icon-arrow van-cell__right-icon"
351
- />
352
- <van-field
353
- readonly
354
- clickable
355
- name="picker"
356
- :value=selectValues[item.fieldId]
357
- label='报单人'
358
- :placeholder="item.formField.extInfo&&item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请选择'"
359
- @click="selectClick(item.fieldId)"
360
- :required="item.required===true"
361
- :disabled="disableds"
362
- v-if="item.fieldId==='workorder_clientId'"
363
- right-icon="van-icon van-icon-arrow van-cell__right-icon"
364
- />
365
- <van-popup v-model="showPicker" position="bottom">
366
- <van-picker
367
- show-toolbar
368
- :columns=selectValue
369
- @confirm="onConfirmSelect($event,selectId)"
370
- @cancel="showPicker = false"
371
- :key="selectKey"
372
-
373
- />
374
- </van-popup>
375
- </div>
376
- <div v-else-if="item.formField.type==='CASCADER'" class="form-field-item-value">
377
- <van-field
378
- readonly
379
- clickable
380
- name="area"
381
- :value=cascadeValue[item.fieldId]
382
- :label=item.formField.name
383
- :placeholder="item.formField.extInfo&&item.formField.extInfo.placeholder?item.formField.extInfo.placeholder:'请选择'"
384
- @click="pickerClick(item.fieldId)"
385
- :required="item.required===true"
386
- :disabled="disableds"
387
- right-icon="van-icon van-icon-arrow van-cell__right-icon"
388
- />
389
-
390
- <van-popup v-model="showArea" position="bottom">
391
- <van-picker v-if="pageShow"
392
- show-toolbar
393
- :columns="column"
394
- @cancel="onCancel"
395
- @confirm="onConfirms($event,pickerId,index)"
396
- @change="onChange"
397
- :item-height="45"
398
- :key="keyValue"
399
- />
400
- </van-popup>
401
- </div>
402
- <div v-else-if="item.formField.type === 'FILE'" class="form-field-item-value">
403
- <div @click="checkUpload(item.fieldId,item.formField.extInfo.limitNum)" class="form-field-item-file">
404
- <div class="fileName"><span style="color: red" v-if="item.required">*</span>{{item.formField.name}}</div>
405
- <van-uploader
406
- v-model="fileListList[item.fieldId]"
407
- :before-read="beforeRead"
408
- :max-count='item.formField.extInfo.limitNum!==undefined?item.formField.extInfo.limitNum:1'
409
- :after-read="afterRead"
410
- accept="image/*"
411
- :multiple=false
412
- >
413
- <div class="vant-upload--picture-card">
414
- <i class="el-icon-plus"></i>
415
- </div>
416
-
417
- </van-uploader>
418
- </div>
419
- </div>
420
- </div>
421
- <van-popup v-model="fileUpload" :close-on-click-overlay="false">
422
- <div style="background-color: black;height: 100px;width: 100px;display: flex;justify-content: center;align-items: center" >
423
- <van-loading type="spinner"/>
424
- </div>
425
- </van-popup>
426
- </div>
427
- <div class="bottom-link"></div>
428
- <div class="form-submit-btn" v-if="isCompany">
429
- <el-button style="border-color: #366aff;color: white;background-color: #366aff" round class="submitClass" size="small" @click="submitClick" :disabled="disableds">
430
- <i class="el-icon-check" v-if="!disableds"></i>
431
- {{submitValue}}
432
- </el-button>
433
- </div>
434
- <div class="form-submit-btn" v-else>
435
- <van-button round type="info" class="submitClass" @click="submitClick" :disabled="disableds">
436
- <i class="el-icon-check" v-if="!disableds"></i>
437
- {{submitValue}}
438
- </van-button>
439
- </div>
440
- </div>
441
- <el-dialog :visible.sync="dialogVisible">
442
- <img width="100%" :src="dialogImageUrl" alt="">
443
- </el-dialog>
444
-
445
- </div>
446
- </template>
447
-
448
- <script>
449
- let that
450
- import {multipartUpload,ossFileUrl} from "./utils/AliyunIssUtil";
451
- import {MyCustomUploadAdapterPlugin} from "./utils/ckeditor";
452
- import CKEDITOR from 'ckeditor'
453
- export default {
454
- name: "formTemplate",
455
- data() {
456
- return {
457
- isPhone: false,
458
- isCompany: false,
459
- checkboxGroup: [],
460
- currentDate: new Date(),
461
- timeValue: [],
462
- dateValue: [],
463
- showPicker: false,
464
- showTimePicker: false,
465
- showTimePickerd:false,
466
- showCalendar: false,
467
- radio: [],
468
- selectValue: [],
469
- pickerValue: [],
470
- showArea: false,
471
- dateTimeValue: [],
472
- dateTimeValue1: [],
473
- showDateTimePicker: false,
474
- showDateTimePicker1: false,
475
- pickerId: 0,
476
- dateId: 0,
477
- timeId: 0,
478
- selectId: 0,
479
- dateTimeId: 0,
480
- column: [
481
- {
482
- values: '', // 设置的页面初始值
483
- className: "column1"
484
- },
485
- {
486
- values: '',
487
- className: "column2",
488
- },
489
- {
490
- values: '',
491
- className: "column3",
492
- }
493
- ],
494
- pageShow: false, //省市区三级联动是否显示(因为是接口返回的数据,等三级数据渲染完毕之后,在显示三级联动)
495
- cityDates: '', //安联当前选中市的所有区所有数据
496
- data: [],//接口返回所有级联数据
497
- dateTimeRange: '',
498
- selectValues: [],
499
- cascadeValue: [],
500
- minDate: new Date(2020, 0, 1),
501
- maxDate: new Date(2025, 11, 31),
502
- disableds: false,
503
- submitValue: '提交',
504
- clickPicker: '',
505
- columns: [],
506
- copyForm: [],
507
- cascaderId:0,
508
- formShow:[],
509
-
510
- uploadAvatarParams: {
511
- token: "8c98087dfd2d48f856d8c95c09115def",
512
- },
513
- fileListList:[],
514
- keyValue:'',
515
- selectKey:'shuijiao',
516
- filedId:'',
517
- disabled:false,
518
- dialogVisible:false,
519
- dialogImageUrl:'',
520
- fileUpload:false,
521
- videoFlag:false,
522
- videoUploadPercent:false,
523
- fileType:['PICTURE','VIDEO','AUDIO'],
524
- loading:'',
525
- ossConfig: {
526
- region: "oss-cn-zhangjiakou",
527
- //云账号AccessKey有所有API访问权限,建议遵循阿里云安全最佳实践,创建并使用STS方式来进行API访问
528
- accessKeyId: "LTAI4G3QtdEdwkEbihBngAsK",
529
- accessKeySecret: "OwgdVfc5PeCkIgqIdug660xmiSPchn",
530
- // stsToken: '<Your securityToken(STS)>',
531
- bucket: "guoranopen-zjk",
532
- },
533
- hideUploadEdit:false,
534
- limitNum:1,
535
- ckeditor: {
536
- editor: CKEDITOR.ClassicEditor,
537
- editorConfig: {
538
- extraPlugins: [MyCustomUploadAdapterPlugin],
539
- toolbar: [
540
- 'imageUpload'
541
- ]
542
- },
543
- },
544
-
545
- }
546
- },
547
- props: {
548
- formList: {
549
- type: Object,
550
- default() {
551
- return {}
552
- }
553
- },
554
- type:String,
555
- disable:Boolean,
556
- submit:Boolean,
557
- usePropStyleType:{
558
- type:Boolean,
559
- default() {
560
- return false;
561
- }
562
- },
563
- propIsPhone: {
564
- type:Boolean,
565
- default() {
566
- return false;
567
- }
568
- },
569
- propIsCompany: {
570
- type:Boolean,
571
- default() {
572
- return false;
573
- }
574
- },
575
- uploadUrl: {
576
- type:String,
577
- default(){
578
- return '/open/media/file/upload'
579
- }
580
- }
581
- },
582
- computed:{
583
- acceptType:function () {
584
- return '.jpg,.jpeg,.png,.gif,.JPG,.JPEG,.PBG,.GIF'
585
- },
586
- formFieldRelation:function (){
587
- let arr = [];
588
- this.formShow.form.formFieldRelation.forEach(item=> {
589
- if (item.fieldId!=='workorder_name'&&item.display) {
590
- arr.push(item);
591
- }
592
- })
593
- return arr;
594
- }
595
-
596
- },
597
- mounted() {
598
- this.isMobile()
599
- },
600
- beforeCreate() {
601
- // 等待dom渲染完毕之后,再去显示 三级联动。
602
- that=this
603
- this.$nextTick(function () {
604
- this.pageShow = true;
605
- })
606
- },
607
- created() {
608
-
609
- if(this.disable===true)
610
- {
611
- this.disableds=true
612
- this.submitValue = '已提交'
613
- }
614
- else
615
- {
616
- this.disableds=false
617
- this.submitValue = '提交'
618
- }
619
- },
620
- beforeMount() {
621
- that.defaultClick()
622
- },
623
- methods: {
624
- beforeRead(file){
625
- console.debug('file',file)
626
- console.debug('fileType',!Array.isArray(file))
627
- if (!Array.isArray(file)){
628
- const isLte2M = file.size / 1024 / 1024 <= 8;
629
- const isSupportedFormat =file.type.indexOf('image')!==-1
630
- if (!isSupportedFormat){
631
- this.$message.error("只能上传图片格式");
632
- return false
633
- }
634
- if (!isLte2M&&isSupportedFormat) {
635
- this.$message.error("上传图片大小不能超过 8MB!");
636
- return false
637
- }
638
- return true
639
- }
640
- else{
641
- let length = 0
642
- if (this.fileListList[this.filedId]){
643
- length = this.fileListList[this.filedId].length
644
- }
645
- if (file.length<=this.limitNum-length){
646
- for (let i=0;i<file.length;i++){
647
- const isLte2M = file[i].size / 1024 / 1024 <= 8;
648
- const isSupportedFormat =file[i].type.indexOf('image')!==-1
649
- if (!isSupportedFormat){
650
- this.$message.error("只能上传图片格式");
651
- return false
652
- }
653
- if (!isLte2M&&isSupportedFormat) {
654
- this.$message.error("上传图片大小不能超过 8MB!");
655
- return false
656
- }
657
- return true
658
- }
659
- }
660
- else {
661
- let num = 1
662
- if (this.limitNum){
663
- num = this.limitNum
664
- }
665
- let messageText = '仅支持上传'+num+'张图片'
666
- this.$message.error(messageText);
667
- return false
668
- }
669
-
670
- }
671
-
672
- },
673
- //文件上传至服务器
674
- afterRead(file){
675
- this.fileUpload=true
676
- console.debug(file)
677
- console.debug(!Array.isArray(file))
678
- if (!Array.isArray(file)){
679
- this.uploadImgFun(file.content,file.file.name,file,file.file);
680
- }
681
- else {
682
- let num = 1
683
- if (this.limitNum){
684
- num = this.limitNum
685
- }
686
- if (file.length >num){
687
- this.$message.warning('仅支持上传'+num+'张图片')
688
- return false
689
- }
690
- else {
691
- for (let i = 0; i < file.length; i++){
692
- this.uploadImgFun(file[i].content,file[i].file.name,file[i],file[i].file);
693
- }
694
- }
695
- }
696
- },
697
- uploadImgFun(content,name,fileCon,file){
698
- console.log(fileCon)
699
- let imageData = {
700
- urls:[]
701
- }
702
- let imageInfo = {
703
- name:"",
704
- status:'',
705
- url:''
706
- }
707
- let res = multipartUpload(
708
- this.ossConfig,
709
- file,
710
- null,
711
- imageInfo
712
- );
713
- res.then((res) => {
714
- console.log("upload result:", res);
715
- // let filePath = res.name;
716
- imageData.urls.push({
717
- name:res.name,
718
- url:ossFileUrl(this.ossConfig, res.name),
719
- status:'success'
720
- })
721
- imageInfo.url = ossFileUrl(this.ossConfig, res.name)
722
- imageInfo.status='success'
723
- imageInfo.name=res.name
724
- for (let j=0;j<this.fileListList[this.filedId].length;j++){
725
- if (this.fileListList[this.filedId][j].content&&this.fileListList[this.filedId][j].content===content){
726
- this.fileListList[this.filedId][j].name=res.name
727
- this.fileListList[this.filedId][j].status='success'
728
- this.fileListList[this.filedId][j].url=imageInfo.url
729
- delete this.fileListList[this.filedId][j].content
730
- }
731
- }
732
- this.fileUpload=false
733
- }).catch((err) => {
734
- console.debug("upload err", err);
735
- });
736
-
737
- },
738
- dataURLtoFileFun (dataurl, filename) {
739
- // 将base64转换为文件,dataurl为base64字符串,filename为文件名(必须带后缀名,如.jpg,.png)
740
- let arr = dataurl.split(",");
741
- let mime = arr[0].match(/:(.*?);/)[1];
742
- let bstr = atob(arr[1]);
743
- let n = bstr.length;
744
- let u8arr = new Uint8Array(n);
745
- while (n--) {
746
- u8arr[n] = bstr.charCodeAt(n);
747
- }
748
- return new File([u8arr], filename, { type: mime });
749
- },
750
- //初始化默认值
751
- defaultClick() {
752
- for (let i = 0; i < this.formList.form.formFieldRelation.length; i++)
753
- {
754
- 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')
755
- {
756
- if(this.formList.form.formFieldRelation[i].formField.extInfo && !this.formList.form.formFieldRelation[i].formField.extInfo.option)
757
- {
758
- if(this.formList.form.formFieldRelation[i].formField.extInfo.exinfo)
759
- {
760
- for (let j=0;j<this.formList.form.formFieldRelation[i].formField.extInfo.exinfo.length;j++)
761
- {
762
- this.$set(this.formList.form.formFieldRelation[i].formField.extInfo.exinfo[j],'label',this.formList.form.formFieldRelation[i].formField.extInfo.exinfo[j].value)
763
- }
764
- this.$set(this.formList.form.formFieldRelation[i].formField.extInfo,'option',this.formList.form.formFieldRelation[i].formField.extInfo.exinfo)
765
- }
766
- if (this.formList.form.formFieldRelation[i].formField.extInfo.option){
767
- if (this.formList.form.formFieldRelation[i].formField.type === 'RADIO') {
768
- for (let j = 0; j < this.formList.form.formFieldRelation[i].formField.extInfo.option.length; j++) {
769
- if(!this.formList.form.formFieldRelation[i].formField.extInfo.option[j].value)
770
- {
771
- this.formList.form.formFieldRelation[i].formField.extInfo.option[j].value=this.formList.form.formFieldRelation[i].formField.extInfo.option[j].label
772
- }
773
- }
774
- if(!this.formList.form.formFieldRelation[i].value)
775
- {
776
- for (let j = 0; j < this.formList.form.formFieldRelation[i].formField.extInfo.option.length; j++) {
777
- if (this.formList.form.formFieldRelation[i].formField.extInfo.option[j]._default === 'true') {
778
- this.formList.form.formFieldRelation[i].value = this.formList.form.formFieldRelation[i].formField.extInfo.option[j].value
779
- }
780
- }
781
- }
782
- }
783
- if (this.formList.form.formFieldRelation[i].formField.type === 'CHECKBOX') {
784
- for (let j = 0; j < this.formList.form.formFieldRelation[i].formField.extInfo.option.length; j++) {
785
- if (!this.formList.form.formFieldRelation[i].formField.extInfo.option[j].value) {
786
- this.formList.form.formFieldRelation[i].formField.extInfo.option[j].value = this.formList.form.formFieldRelation[i].formField.extInfo.option[j].label
787
- }
788
- }
789
-
790
- if (!this.formList.form.formFieldRelation[i].value||this.formList.form.formFieldRelation[i].value.length === 0)
791
- {
792
- this.formList.form.formFieldRelation[i].value=[]
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]._default === 'true') {
795
- this.formList.form.formFieldRelation[i].value[0] = this.formList.form.formFieldRelation[i].formField.extInfo.option[j].value
796
- }
797
- }
798
- }
799
- }
800
- }
801
-
802
- }
803
- else {
804
- if (this.formList.form.formFieldRelation[i].formField.extInfo && this.formList.form.formFieldRelation[i].formField.extInfo.options){
805
- if (this.formList.form.formFieldRelation[i].formField.type === 'RADIO') {
806
- for (let j = 0; j < this.formList.form.formFieldRelation[i].formField.extInfo.options.length; j++) {
807
- if(!this.formList.form.formFieldRelation[i].formField.extInfo.options[j].value)
808
- {
809
- this.formList.form.formFieldRelation[i].formField.extInfo.options[j].value=this.formList.form.formFieldRelation[i].formField.extInfo.options[j].label
810
- }
811
- }
812
- if(!this.formList.form.formFieldRelation[i].value)
813
- {
814
- for (let j = 0; j < this.formList.form.formFieldRelation[i].formField.extInfo.option.length; j++) {
815
- if (this.formList.form.formFieldRelation[i].formField.extInfo.options[j]._default === 'true') {
816
- this.formList.form.formFieldRelation[i].value = this.formList.form.formFieldRelation[i].formField.extInfo.options[j].value
817
- }
818
- }
819
- }
820
- }
821
- if (this.formList.form.formFieldRelation[i].formField.type === 'CHECKBOX') {
822
- for (let j = 0; j < this.formList.form.formFieldRelation[i].formField.extInfo.options.length; j++) {
823
- if (this.formList.form.formFieldRelation[i].formField.extInfo.options[j].value === '') {
824
- this.formList.form.formFieldRelation[i].formField.extInfo.options[j].value = this.formList.form.formFieldRelation[i].formField.extInfo.options[j].label
825
- }
826
- }
827
-
828
- if (this.formList.form.formFieldRelation[i].value === null||this.formList.form.formFieldRelation[i].value.length === 0)
829
- {
830
- this.formList.form.formFieldRelation[i].value=[]
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]._default === 'true') {
833
- this.formList.form.formFieldRelation[i].value[0] = this.formList.form.formFieldRelation[i].formField.extInfo.options[j].value
834
- }
835
- }
836
- }
837
- }
838
- }
839
- }
840
-
841
- }
842
- if (this.formList.form.formFieldRelation[i].formField.type ==='FILE'){
843
- if (this.formList.form.formFieldRelation[i].value!==undefined){
844
- if (this.formList.form.formFieldRelation[i].value===null||this.formList.form.formFieldRelation[i].value===''){
845
- this.formList.form.formFieldRelation[i].value=[]
846
- }
847
- else {
848
- let valueList=[]
849
- let bool=false
850
- if(this.formList.form.formFieldRelation[i].value.length > 0) {
851
- for (let file=0;file<this.formList.form.formFieldRelation[i].value.length;file++) {
852
- let type = typeof (this.formList.form.formFieldRelation[i].value[file])
853
- if (type === "string") {
854
- bool = true
855
- valueList[file] = {}
856
- valueList[file].url = this.formList.form.formFieldRelation[i].value[file]
857
- }
858
- if (type === 'object'&&JSON.stringify(this.formList.form.formFieldRelation[i].value[file])!=='{}') {
859
- this.fileListList[this.formList.form.formFieldRelation[i].fieldId]=this.formList.form.formFieldRelation[i].value
860
- }
861
- else {
862
- this.fileListList[this.formList.form.formFieldRelation[i].fieldId]=[]
863
- }
864
- }
865
- if (bool){
866
- this.fileListList[this.formList.form.formFieldRelation[i].fieldId]=valueList
867
- }
868
- }
869
- }
870
- }
871
-
872
-
873
-
874
- }
875
-
876
- }
877
- let test = []
878
- for (let i = 0; i < this.formList.form.formFieldRelation.length; i++) {
879
- if (this.formList.form.formFieldRelation[i].formField.type === 'CASCADER') {
880
- test.push(this.formList.form.formFieldRelation[i])
881
- let cascader=''
882
- if(this.formList.form.formFieldRelation[i].value)
883
- {
884
- if(this.formList.form.formFieldRelation[i].value.length > 0)
885
- {
886
- for (let j = 0; j < this.formList.form.formFieldRelation[i].value.length; j++) {
887
- if (this.formList.form.formFieldRelation[i].value[j]) {
888
- cascader += this.formList.form.formFieldRelation[i].value[j] + '/'
889
- }
890
- }
891
- cascader = cascader.substr(0, cascader.length - 1)
892
-
893
- }
894
- this.cascadeValue[this.formList.form.formFieldRelation[i].fieldId]=cascader
895
- }
896
- else
897
- {
898
- this.formList.form.formFieldRelation[i].value=[]
899
- }
900
- }
901
- if (this.formList.form.formFieldRelation[i].formField.type === 'DATE_PICKER')
902
- {
903
- if(this.formList.form.formFieldRelation[i].value!==null && this.formList.form.formFieldRelation[i].value!=='' )
904
- {
905
-
906
- this.dateValue[this.formList.form.formFieldRelation[i].fieldId]=this.formatDate(this.formList.form.formFieldRelation[i].value)
907
- }
908
- }
909
- if (this.formList.form.formFieldRelation[i].formField.type === 'TIME_PICKER')
910
- {
911
- if(this.formList.form.formFieldRelation[i].value!==''&& this.formList.form.formFieldRelation[i].value!==null)
912
- {
913
- const dateTime = new Date(this.formList.form.formFieldRelation[i].value)
914
- this.timeValue[this.formList.form.formFieldRelation[i].fieldId]=this.addZero(dateTime.getHours()) + ':' + this.addZero(dateTime.getMinutes())
915
-
916
- }
917
- }
918
- if (this.formList.form.formFieldRelation[i].formField.type === 'SELECT' || this.formList.form.formFieldRelation[i].formField.type === 'OPTION') {
919
- if (this.formList.form.formFieldRelation[i].formField.extInfo && this.formList.form.formFieldRelation[i].formField.extInfo.option){
920
- for (let j = 0; j < this.formList.form.formFieldRelation[i].formField.extInfo.option.length; j++) {
921
- if (this.formList.form.formFieldRelation[i].formField.extInfo.option[j].value === '') {
922
- this.formList.form.formFieldRelation[i].formField.extInfo.option[j].value = this.formList.form.formFieldRelation[i].formField.extInfo.option[j].label
923
- }
924
- }
925
- if(this.formList.form.formFieldRelation[i].value)
926
- {
927
- for (let j=0;j<this.formList.form.formFieldRelation[i].formField.extInfo.option.length;j++)
928
- {
929
- if (this.formList.form.formFieldRelation[i].value === this.formList.form.formFieldRelation[i].formField.extInfo.option[j].value)
930
- {
931
- this.selectValues[this.formList.form.formFieldRelation[i].fieldId] =this.formList.form.formFieldRelation[i].formField.extInfo.option[j].label
932
- }
933
- }
934
- /*this.selectValues[this.formList.form.formFieldRelation[i].fieldId] = this.formList.form.formFieldRelation[i].value*/
935
-
936
- }
937
- else
938
- {
939
- for (let j = 0; j < this.formList.form.formFieldRelation[i].formField.extInfo.option.length; j++) {
940
- if (this.formList.form.formFieldRelation[i].formField.extInfo.option[j]._default === 'true') {
941
- this.selectValues[this.formList.form.formFieldRelation[i].fieldId] = this.formList.form.formFieldRelation[i].formField.extInfo.option[j].label
942
- this.formList.form.formFieldRelation[i].value=this.formList.form.formFieldRelation[i].formField.extInfo.option[j].value
943
- }
944
- }
945
- }
946
- }
947
- else {
948
- if(this.formList.form.formFieldRelation[i].formField.extInfo && this.formList.form.formFieldRelation[i].formField.extInfo.option) {
949
- for (let j = 0; j < this.formList.form.formFieldRelation[i].formField.extInfo.options.length; j++) {
950
- if (this.formList.form.formFieldRelation[i].formField.extInfo.options[j].value === '') {
951
- this.formList.form.formFieldRelation[i].formField.extInfo.options[j].value = this.formList.form.formFieldRelation[i].formField.extInfo.options[j].label
952
- }
953
- }
954
- }
955
- if(this.formList.form.formFieldRelation[i].value && this.formList.form.formFieldRelation[i].formField.extInfo && this.formList.form.formFieldRelation[i].formField.extInfo.option)
956
- {
957
- for (let j=0;j<this.formList.form.formFieldRelation[i].formField.extInfo.options.length;j++)
958
- {
959
- if (this.formList.form.formFieldRelation[i].value === this.formList.form.formFieldRelation[i].formField.extInfo.options[j].value)
960
- {
961
- this.selectValues[this.formList.form.formFieldRelation[i].fieldId] =this.formList.form.formFieldRelation[i].formField.extInfo.options[j].label
962
- }
963
- }
964
- /*this.selectValues[this.formList.form.formFieldRelation[i].fieldId] = this.formList.form.formFieldRelation[i].value*/
965
-
966
- }
967
- else
968
- {
969
- if(this.formList.form.formFieldRelation[i].formField.extInfo && this.formList.form.formFieldRelation[i].formField.extInfo.option) {
970
- for (let j = 0; j < this.formList.form.formFieldRelation[i].formField.extInfo.options.length; j++) {
971
- if (this.formList.form.formFieldRelation[i].formField.extInfo.options[j]._default === 'true') {
972
- this.selectValues[this.formList.form.formFieldRelation[i].fieldId] = this.formList.form.formFieldRelation[i].formField.extInfo.options[j].label
973
- this.formList.form.formFieldRelation[i].value=this.formList.form.formFieldRelation[i].formField.extInfo.options[j].value
974
- }
975
- }
976
- }
977
- }
978
- }
979
-
980
- }
981
- }
982
- this.formShow=this.formList
983
- },
984
- addZero(i) {
985
- if (i < 10) {
986
- i = "0" + i;
987
- }
988
- return i;
989
- },
990
- formatter(type, value) {
991
- // 格式化选择器日期
992
- if (type === "year") {
993
- return `${value}年`;
994
- } else if (type === "month") {
995
- return `${value}月`;
996
- } else if (type === "day") {
997
- return `${value}日`;
998
- } else if (type === "hour") {
999
- return `${value}时`;
1000
- } else if (type === "minute") {
1001
- return `${value}分`;
1002
- }
1003
- return value;
1004
- },
1005
-
1006
- isMobile() {
1007
- if (this.usePropStyleType === false){
1008
- 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);
1009
- if (flag) {
1010
- this.isPhone=true
1011
- }
1012
- else {
1013
- this.isCompany=true
1014
- }
1015
- }else {
1016
- this.isPhone=this.propIsPhone;
1017
- this.isCompany=this.propIsCompany;
1018
- }
1019
- },
1020
- //时间的选择器
1021
- onConfirm(value, id,item) {
1022
- for (let i = 0; i < this.formShow.form.formFieldRelation.length; i++) {
1023
- if (this.formShow.form.formFieldRelation[i].fieldId=== id) {
1024
- this.formShow.form.formFieldRelation[i].value = value
1025
- if (!item.formField.extInfo.mold||item.formField.extInfo.mold==='DATA_TIME'){
1026
- this.timeValue[id] =this.formatDate(value) +" "+ this.addZero(value.getHours()) + ':' + this.addZero(value.getMinutes())
1027
- this.showTimePicker = false;
1028
- }
1029
- else {
1030
- this.timeValue[id] =this.formatDate(value)
1031
- this.showTimePickerd = false;
1032
- }
1033
- break
1034
- }
1035
- }
1036
- },
1037
- //转换日期的函数
1038
- formatDate(date) {
1039
- const dateTime = new Date(date)
1040
- return `${dateTime.getFullYear()}-${dateTime.getMonth() + 1}-${dateTime.getDate()}`;
1041
- },
1042
- //日期的选择器
1043
- onConfirmCalendar(date, id) {
1044
- for (let i = 0; i < this.formShow.form.formFieldRelation.length; i++) {
1045
- if (this.formShow.form.formFieldRelation[i].fieldId === id) {
1046
- this.dateValue[id] = this.formatDate(date)
1047
- this.formShow.form.formFieldRelation[i].value = date
1048
- this.showCalendar = false;
1049
- break
1050
- }
1051
- }
1052
- },
1053
- //下拉的选择器
1054
- onConfirmSelect(value, id) {
1055
- for (let i = 0; i < this.formShow.form.formFieldRelation.length; i++) {
1056
- if (this.formShow.form.formFieldRelation[i].fieldId === id) {
1057
- this.selectValues[this.formShow.form.formFieldRelation[i].fieldId] = value
1058
- if (this.formShow.form.formFieldRelation[i].formField.extInfo.option){
1059
- for (let j = 0; j < this.formShow.form.formFieldRelation[i].formField.extInfo.option.length; j++) {
1060
- if(value ===this.formShow.form.formFieldRelation[i].formField.extInfo.option[j].label)
1061
- {
1062
- this.formShow.form.formFieldRelation[i].value = this.formShow.form.formFieldRelation[i].formField.extInfo.option[j].value
1063
- }
1064
- }
1065
- }
1066
- else {
1067
- for (let j = 0; j < this.formShow.form.formFieldRelation[i].formField.extInfo.options.length; j++) {
1068
- if(value ===this.formShow.form.formFieldRelation[i].formField.extInfo.options[j].label)
1069
- {
1070
- this.formShow.form.formFieldRelation[i].value = this.formShow.form.formFieldRelation[i].formField.extInfo.options[j].value
1071
- }
1072
- }
1073
- }
1074
-
1075
- this.showPicker = false;
1076
- break
1077
- }
1078
- }
1079
- },
1080
- //时间日期的选择器
1081
- /* onConfirmDateTime(date,id){
1082
- for (let i=0;i<this.formList.form.formFieldRelation.length;i++)
1083
- {
1084
-
1085
- if(this.formList.form.formFieldRelation[i].formField.id===id)
1086
- {
1087
- this.dateTimeValue[id]=this.addZero(date.getFullYear())+'-'+this.addZero(date.getMonth())+'-'+this.addZero(date.getDate())+' '+this.addZero(date.getHours())+':'+this.addZero(date.getMinutes())
1088
- this.formList.form.formFieldRelation[i].value[0]=date
1089
- this.showDateTimePicker = false;
1090
- break
1091
- }
1092
- }
1093
-
1094
- },
1095
- onConfirmDateTime1(date,id){
1096
- for (let i=0;i<this.formList.form.formFieldRelation.length;i++)
1097
- {
1098
- if(this.formList.form.formFieldRelation[i].formField.id===id)
1099
- {
1100
-
1101
- this.dateTimeValue1[id]=this.addZero(date.getFullYear())+'-'+this.addZero(date.getMonth())+'-'+this.addZero(date.getDate())+' '+this.addZero(date.getHours())+':'+this.addZero(date.getMinutes())
1102
- this.formList.form.formFieldRelation[i].value[1]=date
1103
- this.showDateTimePicker1 = false;
1104
- break
1105
- }
1106
- }
1107
- },*/
1108
- //提交按钮事件
1109
- submitClick() {
1110
-
1111
- for (let i=0;i<this.formShow.form.formFieldRelation.length;i++)
1112
- {
1113
- if(this.formShow.form.formFieldRelation[i].formField.type==='CASCADER')
1114
- {
1115
- 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:[]
1116
- cascader.forEach(item=>{
1117
- if(item.children!==undefined)
1118
- {
1119
- if(item.children.length===0)
1120
- delete item.children
1121
- else {
1122
- item.children.forEach(items=>{
1123
- if(items.children)
1124
- {
1125
- if(items.children.length===0)
1126
- delete items.children
1127
- }
1128
- })
1129
- }
1130
- }
1131
- })
1132
- }
1133
- if (this.fileListList[this.formShow.form.formFieldRelation[i].fieldId]!==undefined){
1134
- let value=[]
1135
-
1136
- this.fileListList[this.formShow.form.formFieldRelation[i].fieldId].forEach(item=>{
1137
- let file={}
1138
- file.name=item.name
1139
- file.url=item.url
1140
- value.push(file)
1141
- })
1142
- this.formShow.form.formFieldRelation[i].value=value
1143
- }
1144
-
1145
- 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')
1146
- {
1147
-
1148
- if(!this.formShow.form.formFieldRelation[i].value || (this.formShow.form.formFieldRelation[i].value&&this.formShow.form.formFieldRelation[i].value.length===0))
1149
- {
1150
- this.$message.error('请完善'+ this.formShow.form.formFieldRelation[i].formField.name)
1151
- return
1152
- }
1153
- }
1154
- }
1155
- this.$emit('submitClick',this.formShow)
1156
- this.disableds = true
1157
- this.submitValue = '已提交'
1158
- },
1159
- //日期的点击事件
1160
- dateClick(id) {
1161
- if(this.disableds === false)
1162
- {
1163
- for (let i = 0; i < this.formShow.form.formFieldRelation.length; i++) {
1164
- if (this.formShow.form.formFieldRelation[i].fieldId === id) {
1165
- this.dateId = id
1166
- this.showCalendar = true
1167
- break
1168
- }
1169
- }
1170
- }
1171
-
1172
- },
1173
- //时间的点击事件
1174
- timeClick(id,item) {
1175
- if(this.disableds === false){
1176
- for (let i = 0; i < this.formShow.form.formFieldRelation.length; i++) {
1177
- if (this.formShow.form.formFieldRelation[i].fieldId === id) {
1178
- this.timeId = id
1179
- if (!item.formField.extInfo.mold||item.formField.extInfo.mold==='DATA_TIME'){
1180
- this.showTimePicker = true
1181
- }
1182
- else {
1183
- this.showTimePickerd= true
1184
- }
1185
-
1186
- break
1187
- }
1188
-
1189
- }
1190
- }
1191
-
1192
- },
1193
- //下拉的点击事件
1194
- selectClick(id) {
1195
- if(this.disableds === false){
1196
- let selectOption
1197
- this.selectValue=[]
1198
- for (let i = 0; i < this.formShow.form.formFieldRelation.length; i++) {
1199
- if(this.formShow.form.formFieldRelation[i].formField.type==='SELECT' || this.formShow.form.formFieldRelation[i].formField.type==='OPTION')
1200
- {
1201
- if (this.formShow.form.formFieldRelation[i].fieldId === id) {
1202
- 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:[]
1203
- for (let j = 0; j < selectOption.length; j++) {
1204
- this.selectValue[j] = selectOption[j].label
1205
- }
1206
-
1207
- }
1208
- }
1209
- }
1210
- this.selectId = id
1211
- this.showPicker = true
1212
- }
1213
-
1214
- },
1215
- //级联的点击的事件
1216
- pickerClick(id) {
1217
- if(this.disableds === false)
1218
- {
1219
- if(this.pickerId!==id)
1220
- {
1221
- for (let i = 0; i < this.formShow.form.formFieldRelation.length; i++) {
1222
- if (this.formShow.form.formFieldRelation[i].fieldId === id) {
1223
- this.keyValue=''
1224
- if(this.formShow.form.formFieldRelation[i].value.length!==undefined)
1225
- {
1226
- for (let m=0;m<this.formShow.form.formFieldRelation[i].value.length;m++)
1227
- {
1228
- this.keyValue+=this.formShow.form.formFieldRelation[i].value[m]
1229
- }
1230
- }
1231
-
1232
- 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:[]
1233
- this.column[0].values = Object.values(this.data).map(function (e) {
1234
- return {text: e.value, code: e.value}
1235
- })
1236
- if (this.data[0].children !== undefined) {
1237
- this.column[1].values = Object.values(this.data[0].children).map(function (e) {
1238
- return {text: e.value, code: e.value}
1239
- })
1240
- if (this.data[0].children[0].children !== undefined) {
1241
- this.column[2].values = Object.values(this.data[0].children[0].children).map(function (e) {
1242
- return {text: e.value, code: e.value}
1243
- })
1244
- }
1245
- else {
1246
- this.$set(this.data[0].children[0], 'children', [])
1247
- this.column[2].values=Object.values(this.data[0].children[0].children).map(function (res) {
1248
- return {text: res.value, code: res.value};
1249
- })
1250
- }
1251
- }
1252
- }
1253
- }
1254
- }
1255
-
1256
- this.pickerId = id
1257
- this.showArea = true
1258
- }
1259
-
1260
-
1261
- },
1262
-
1263
- onChange(picker, values,index) {
1264
- // 这里我有可能渲染的有问题,导致回调每次都修改了当前列,其他值没有修改,当前列??(当前列什么鬼呀,什么垃圾啊???) 解释一下 ↓↓
1265
- // 因为vant的 van-picker 回调只会返回你修改的那一列,比如现在为 [北京,北京,东城区],你修改了省为[天津市,天津市,和平区],但是vant的change回调会得到[天津市,北京,东城区],后面两个在回调中没有修改,不知道我的渲染方法有问题还是什么问题。
1266
- // 所以我在这里判断change事件触发后,如果你修改了省份的话,回调里面省份会改变,但是市和区还是上一个省份的 市和区,这时我们执行回调修改省,市,区的时候,因为回调只有省改变了,市和区DOM改变了,但是回调里面没改变的问题(不晓得什么问题),这时我们去找省下面的 市,我们取回调的市名称,如果在省下面没有找到这个市,默认展示第一个市,区也默认展示第一个市下面的区,如果遍历市能查到,就去展示对应的市。
1267
- // 回调时修改第2列数据
1268
- if (index == 0){
1269
- picker.setColumnValues(2, []); // 防止突然选中第一个,第二个是更新的,但第三个联级不更新,我暂时强制清空
1270
- }
1271
- let ColumnIndexss=picker.getIndexes()
1272
- let testValue=''
1273
- this.$nextTick(()=>{
1274
- if(index == 0)
1275
- {
1276
- if(this.data[ColumnIndexss[0]].children.length > 0)
1277
- {
1278
- if(this.data[ColumnIndexss[0]].children[0]!==undefined)
1279
- {
1280
- testValue=this.data[ColumnIndexss[0]].children[0].value
1281
- picker.setColumnValues(2, this.county(this.data, testValue));
1282
- }
1283
- }
1284
- else
1285
- picker.setColumnValues(2, []);
1286
- }
1287
- if(index == 1)
1288
- {
1289
- if(this.data[ColumnIndexss[0]].children.length > 0)
1290
- {
1291
- if(this.data[ColumnIndexss[0]].children[ColumnIndexss[1]]!==undefined)
1292
- {
1293
- testValue=this.data[ColumnIndexss[0]].children[ColumnIndexss[1]].value
1294
- picker.setColumnValues(2, this.county(this.data, testValue));
1295
- }
1296
- }
1297
- else
1298
- picker.setColumnValues(2, []);
1299
- }
1300
- })
1301
-
1302
- picker.setColumnValues(1, this.cityDate(this.data, values[0].text));
1303
- // 回调时修改第3列数据
1304
-
1305
-
1306
- },
1307
- // 修改级联第二级 这里不再多说什么了根据自己的数据格式来
1308
- cityDate(data, province) {
1309
- var that = this;
1310
- data.forEach(function (res) {
1311
- if (res.value == province) {
1312
- that.cityDates = res;
1313
- }
1314
- });
1315
- if (that.cityDates.children !== undefined&&that.cityDates.children.length > 0) {
1316
- return that.cityDates.children.map(function (res) {
1317
- return {text: res.value, code: res.value};
1318
- })
1319
- } else {
1320
- this.$set(that.cityDates, 'children', [])
1321
- return that.cityDates.children.map(function (res) {
1322
- return {text: res.value, code: res.value};
1323
- })
1324
- }
1325
- // return 返回数据格式,因为我需要省市区code,所以我return的格式是对象,例:[{text:'北京市',code:'1'},{text:'河南省',code:'2'},...],如果你不需要code直接这样就可以 例['北京市','河南省',.....]
1326
- },
1327
- // 修改级联第三级 这里不再多说什么了根据自己的数据格式来
1328
- county(data, county) {
1329
- var that = this;
1330
- var countyDate = '';
1331
- // 因为vant的 van-picker 回调只会返回你修改的那一列,比如现在为 [北京,北京,东城区],你修改了省为[天津市,天津市,和平区],但是vant的change回调会得到[天津市,北京,东城区],后面两个在回调中没有修改,不知道我的渲染方法有问题还是什么问题。
1332
- // 所以我在这里判断change事件触发后,如果你修改了省份的话,回调里面省份会改变,但是市和区还是上一个省份的 市和区,这时我们执行回调修改省,市,区的时候,因为回调只有省改变了,市和区DOM改变了,但是回调里面没改变的问题(不晓得什么问题),这时我们去找省下面的 市,我们取回调的市名称,如果在省下面没有找到这个市,默认展示第一个市,区也默认展示第一个市下面的区,如果遍历市能查到,就去展示对应的市。
1333
- that.cityDates.children.forEach(function (res) {
1334
- if (res.value == county) {
1335
- countyDate = res;
1336
- }
1337
- });
1338
- // 这里如果没有找到对应的县
1339
- if (countyDate == '') {
1340
- if(that.cityDates.children.length > 0)
1341
- {
1342
- countyDate = that.cityDates.children[0];
1343
- }
1344
-
1345
- }
1346
- // return
1347
- if (countyDate.children === undefined) {
1348
- this.$set(countyDate, 'children', [])
1349
- return countyDate.children.map(function (res) {
1350
- return {text: res.value, code: res.value};
1351
- })
1352
- } else {
1353
- return countyDate.children.map(function (res) {
1354
- return {text: res.value, code: res.value};
1355
- })
1356
- }
1357
-
1358
- // return 返回数据格式,因为我需要省市区code,所以我return的格式是对象,例:[{text:'北京市',code:'1'},{text:'河南省',code:'2'},...],如果你不需要code直接这样就可以 例['北京市','河南省',.....]
1359
- },
1360
- //点击级联弹出框的确认按钮
1361
- onConfirms(val, id) {
1362
- let test = ''
1363
- for (let i = 0; i < val.length; i++) {
1364
- if (val[i] !== undefined) {
1365
- test += val[i].text + '/'
1366
- }
1367
- }
1368
- test = test.substr(0, test.length - 1)
1369
- for (let i = 0; i < this.formShow.form.formFieldRelation.length; i++) {
1370
- if (this.formShow.form.formFieldRelation[i].fieldId=== id) {
1371
- this.cascadeValue[id] = test
1372
- for (let j = 0; j < val.length; j++) {
1373
- if (val[j] !== undefined) {
1374
- this.formShow.form.formFieldRelation[i].value[j] = val[j].text
1375
- }
1376
- }
1377
- break
1378
- }
1379
- }
1380
- this.showArea = false;
1381
- sessionStorage.setItem('cascader',test)
1382
- },
1383
- onCancel() {
1384
- this.showArea = false;
1385
- },
1386
- aliyunOssRequest(data){
1387
-
1388
- this.loading = this.$loading({
1389
- lock: true,
1390
- text: 'Loading',
1391
- spinner: 'el-icon-loading',
1392
- background: 'rgba(0, 0, 0, 0.8)'
1393
- });
1394
- let file = data.file;
1395
- console.debug("upload file:", file);
1396
- let imgInfo = {
1397
- status:'',
1398
- url:'',
1399
- name:''
1400
- }
1401
- /* let imageData = {
1402
- id:cid,
1403
- cid:cid,
1404
- type: "IMAGE",
1405
- content: {
1406
- urls: [],
1407
- progress: 0,
1408
- },
1409
- };*/
1410
- let res = multipartUpload(
1411
- this.ossConfig,
1412
- file,
1413
- null,
1414
- imgInfo
1415
- );
1416
- res.then((res) => {
1417
- console.debug("upload result:", res);
1418
- // let filePath = res.name;
1419
- /* imageData.content.progress = 1;
1420
- imageData.content.urls.push(
1421
- ossFileUrl(this.ossConfig, res.name)
1422
- );
1423
- console.log('imageData',imageData)*/
1424
- imgInfo.url = ossFileUrl(this.ossConfig, res.name)
1425
- imgInfo.status='success'
1426
- if (data.file){
1427
- imgInfo.name = data.file.name
1428
- imgInfo.uid = data.file.uid
1429
- }
1430
- if (!this.fileListList[this.filedId])
1431
- {
1432
- this.fileListList[this.filedId] = []
1433
- }
1434
- this.fileListList[this.filedId].push(imgInfo)
1435
- this.loading.close()
1436
- }).catch((err) => {
1437
- console.debug("upload err", err);
1438
- });
1439
- },
1440
- successUpload(response,file,fileList){
1441
- if (!this.fileListList[this.filedId]){
1442
- this.fileListList[this.filedId] = []
1443
- }
1444
- for (let i=0;i<fileList.length;i++){
1445
- if (!this.fileListList[this.filedId][i]){
1446
- this.fileListList[this.filedId][i]={}
1447
- }
1448
- this.fileListList[this.filedId][i].url=fileList[i].url
1449
- this.fileListList[this.filedId][i].name=fileList[i].name
1450
- this.fileListList[this.filedId][i].status=fileList[i].status
1451
- }
1452
- },
1453
- uploadProgress(){
1454
- this.loading = this.$loading({
1455
- lock: true,
1456
- text: 'Loading',
1457
- spinner: 'el-icon-loading',
1458
- background: 'rgba(0, 0, 0, 0.7)'
1459
- });
1460
- },
1461
- handleRemove(file) {
1462
- if (this.fileListList[this.filedId]){
1463
- for (let i=0;i<this.fileListList[this.filedId].length;i++)
1464
- {
1465
- if (this.fileListList[this.filedId][i].uid){
1466
- if (this.fileListList[this.filedId][i].uid===file.uid){
1467
- this.fileListList[this.filedId].splice(i,1)
1468
- return
1469
- }
1470
- }
1471
- else if (this.fileListList[this.filedId][i].url===file.url){
1472
- this.fileListList[this.filedId].splice(i,1)
1473
- return
1474
- }
1475
- }
1476
-
1477
- }
1478
- /*let value=[]
1479
- for (let i=0;i<fileList.length;i++){
1480
- value[i]={}
1481
- value[i].name=fileList[i].name
1482
- if(fileList[i].response){
1483
- value[i].url=fileList[i].response.data
1484
- }
1485
- else {
1486
- value[i].url=fileList[i].url
1487
- }
1488
- }
1489
- for (let i=0;i<this.formShow.form.formFieldRelation.length;i++){
1490
- if (this.formShow.form.formFieldRelation[i].fieldId===this.filedId){
1491
- this.fileListList[this.filedId]=value
1492
- }
1493
- }*/
1494
- /*this.fileListList = [...this.fileListList]*/
1495
- },
1496
- handleEditChange(file,fileList){
1497
- this.hideUploadEdit=fileList.length >= this.limitNum
1498
- },
1499
-
1500
- onUploadProgress: function (progress, point, file, videoData) {
1501
- console.debug("upload video progress", progress, point);
1502
- if (progress === 1) {
1503
- // this.loadingIns.close();
1504
- videoData.content.url = ossFileUrl(this.ossConfig, point.name);
1505
- // this.chooseVideo({data:url},file);
1506
-
1507
- } else {
1508
- videoData.content.progress = progress;
1509
-
1510
- }
1511
- },
1512
- checkUpload(id,limitNum){
1513
- this.filedId=id
1514
- this.limitNum = limitNum
1515
-
1516
- },
1517
- beforeAvatarUpload(file){
1518
- const isLte2M = file.size / 1024 / 1024 <= 8;
1519
- const isSupportedFormat =file.type.indexOf('image')!==-1
1520
- if (!isSupportedFormat){
1521
- this.$message.error("只能上传图片格式");
1522
- return false
1523
- }
1524
- if (!isLte2M) {
1525
- this.$message.error("上传图片大小不能超过 8MB!");
1526
- return false
1527
- }
1528
- return true
1529
- },
1530
- exceedUpload(){
1531
- this.$message.warning('上传文件数量达到上限')
1532
- },
1533
-
1534
- handlePictureCardPreview(file) {
1535
- this.videoFlag = true;
1536
- this.videoUploadPercent = file.percentage.toFixed(0);
1537
- },
1538
- },
1539
- //时间日期范围的点击事件
1540
- /* dateTimeClick(id){
1541
- for (let i=0;i<this.formList.form.formFieldRelation.length;i++)
1542
- {
1543
- if(this.formList.form.formFieldRelation[i].formField.id===id)
1544
- {
1545
- this.dateTimeId=id
1546
- this.showDateTimePicker = true
1547
- break
1548
- }
1549
- }
1550
- },
1551
- dateTimeClick1(id){
1552
- if(this.dateTimeValue.length === 0)
1553
- {
1554
- this.$message.error('请先选择开始日期时间')
1555
- }
1556
- else
1557
- {
1558
- for (let i=0;i<this.formList.form.formFieldRelation.length;i++)
1559
- {
1560
- if(this.formList.form.formFieldRelation[i].formField.id===id)
1561
- {
1562
- this.dateTimeId=id
1563
- this.showDateTimePicker1 = true
1564
- break
1565
- }
1566
- }
1567
- }
1568
-
1569
- },*/
1570
-
1571
-
1572
-
1573
- }
1574
- </script>
1575
-
1576
- <style lang="less" scoped>
1577
- .notClick {
1578
- pointer-events: none;
1579
- }
1580
- .formClass{
1581
- /* border: 1px solid #ebebeb;*/
1582
- font-family: "Avenir", Helvetica, Arial, sans-serif;
1583
- border-radius: 15px;
1584
- .explanation{
1585
- display: flex;
1586
- padding: 4px;
1587
- .explanation-p{
1588
- color: #366aff;
1589
- font-size: 14px;
1590
- margin: 10px 4px;
1591
- .el-icon-info{
1592
- margin-right: 8px;
1593
- }
1594
- }
1595
- }
1596
- .explain-url{
1597
- a{
1598
- color:#366aff ;
1599
- }
1600
- }
1601
- .titleName{
1602
- font-size: 1em;
1603
- text-align: center;
1604
- padding-bottom: 10px;
1605
- display: flex;
1606
- align-items: center;
1607
- justify-content: center;
1608
- /* border-bottom: 1px solid #EEEEEE;*/
1609
- }
1610
- .title-link{
1611
- height: 1px;
1612
- background-color: #EEEEEE;
1613
- }
1614
- .bottom-link{
1615
- margin-top: 14px;
1616
- height: 1px;
1617
- background-color: #EEEEEE;
1618
- }
1619
- .form-submit-btn{
1620
- padding: 14px 16px 0 16px;
1621
- text-align: center;
1622
- }
1623
- /deep/.ck.ck-editor{
1624
- padding: 0 8px;
1625
- }
1626
- /deep/.ck.ck-toolbar{
1627
- border-color:#E0E6F7;
1628
- border-top-left-radius: 9px!important;
1629
- border-top-right-radius: 9px!important;
1630
- }
1631
- /deep/.ck.ck-editor__editable_inline{
1632
- border-color:#E0E6F7;
1633
- min-height: 150px!important;
1634
- border-bottom-left-radius: 9px!important;
1635
- border-bottom-right-radius: 9px!important;
1636
- }
1637
- }
1638
- .pcFormClass{
1639
- width: 400px;
1640
- margin: 0 auto;
1641
- .field-item{
1642
- padding: 8px 0;
1643
- .field-item-name{
1644
- padding-bottom: 8px;
1645
- color: #A9B3C6;
1646
- /* color: #000000;*/
1647
- }
1648
- }
1649
- /deep/.el-input__inner{
1650
- border-color: #E0E6F7!important;
1651
- background-color: transparent!important;
1652
- border-radius: 9px!important;
1653
- }
1654
- /deep/.el-textarea__inner{
1655
- border-color: #E0E6F7!important;
1656
- background-color: transparent!important;
1657
- border-radius: 9px!important;
1658
- padding: 9px 15px!important;
1659
- }
1660
- /deep/.el-upload--picture-card{
1661
- background-color: #FFFFFF;
1662
- border: 1px solid #E0E6F7;
1663
- border-radius: 10px;
1664
- width: 74px;
1665
- height: 74px;
1666
- vertical-align: top;
1667
- cursor: pointer;
1668
- text-align: center;
1669
- font-size:28px;
1670
- color:#366AFF;
1671
- display: flex;
1672
- align-items: center;
1673
- justify-content: center;
1674
- i{
1675
- color: #366AFF;
1676
- }
1677
- }
1678
- /deep/.el-select-dropdown__item.selected{
1679
- color: #366aff;
1680
- }
1681
- /deep/.el-upload-list--picture-card{
1682
- .el-upload-list__item{
1683
- width: 74px;
1684
- height: 74px;
1685
- border-radius: 10px;
1686
- }
1687
- }
1688
- /deep/.el-upload-list__item-name{
1689
- max-width: 180px;
1690
- }
1691
- .hide .el-upload--picture-card {
1692
- display: none!important;
1693
- }
1694
- }
1695
- /deep/.van-radio__icon--checked .van-icon{
1696
- background-color: #366aff!important;
1697
- border-color: #366aff!important;
1698
- }
1699
- /deep/.van-checkbox__icon--checked .van-icon{
1700
- background-color: #366aff!important;
1701
- border-color: #366aff!important;
1702
- }
1703
- /deep/.vant-upload--picture-card{
1704
- background-color: #ffffff;
1705
- border: 1px solid #E0E6F7;
1706
- border-radius: 10px;
1707
- width: 74px;
1708
- height: 74px;
1709
- vertical-align: top;
1710
- cursor: pointer;
1711
- text-align: center;
1712
- font-size:28px;
1713
- color:#8c939d;
1714
- display: flex;
1715
- align-items: center;
1716
- justify-content: center;
1717
- i{
1718
- color: #366aff;
1719
- }
1720
- }
1721
- /deep/.van-popup{
1722
- border-radius: 5px;
1723
- }
1724
- .remPhoneClassForm{
1725
- .mobileFormClass{
1726
- width: calc(100vw - 110px);
1727
- .form-field-item{
1728
- .form-field-item-value{
1729
- /deep/.van-cell{
1730
- flex-direction: column;
1731
- padding: 8px 16px;
1732
- }
1733
- /deep/.van-cell__value{
1734
- border: 1px solid #E0E6F7;
1735
- border-radius: 9px;
1736
- min-height: 40px;
1737
- padding: 0 10px;
1738
- }
1739
- /deep/.van-cell__right-icon{
1740
- color: #999999!important;
1741
- }
1742
- .form-field-item-file{
1743
- padding: 8px;
1744
- .fileName{
1745
- padding-bottom: 8px;
1746
- color: #A9B3C6;
1747
- /* color: #000000;*/
1748
- }
1749
- }
1750
- .workorder_description{
1751
- /* padding: 8px 16px;*/
1752
- padding: 8px 0;
1753
- /*font-size: 14px;*/
1754
- .field-name{
1755
- width: 100%;
1756
- text-align: left;
1757
- color: #A9B3C6;
1758
- /* color: #000000;*/
1759
- line-height: 1;
1760
- padding-bottom: 8px;
1761
- }
1762
- /*.required-name{
1763
- margin-left: -6px;
1764
- }*/
1765
-
1766
- /* /deep/.ck-content .image img{
1767
- max-width: 200px!important;
1768
- }*/
1769
- }
1770
- }
1771
- .form-field-item-other{
1772
- /deep/.van-cell{
1773
- flex-direction: column;
1774
- }
1775
- /deep/.van-cell__value{
1776
- min-height: 40px;
1777
- }
1778
- }
1779
- .explan-ation{
1780
- .explan-ation-div{
1781
- display: flex;
1782
- /* padding: 4px 16px;*/
1783
- padding: 4px;
1784
- }
1785
- .explan-ation-p{
1786
- color: #366aff;font-size: 14px;margin: 16px 4px;
1787
- }
1788
- }
1789
- }
1790
- .upload-phone-demo{
1791
- /deep/.el-upload--picture-card{
1792
- background-color: #fbfdff;
1793
- border: 1px dashed #c0ccda;
1794
- border-radius: 6px;
1795
- width: 74px;
1796
- height: 74px;
1797
- vertical-align: top;
1798
- cursor: pointer;
1799
- text-align: center;
1800
- font-size:28px;
1801
- color:#8c939d;
1802
- display: flex;
1803
- align-items: center;
1804
- justify-content: center;
1805
- }
1806
- /deep/.el-upload-list--picture-card .el-upload-list__item{
1807
- height: 76px;
1808
- width: 76px;
1809
- }
1810
- }
1811
- /deep/.van-image__img{
1812
- border-radius: 10px;
1813
- }
1814
- }
1815
- .submitClass{
1816
- min-width: 100px;
1817
- background-color: #366aff;
1818
- color: white!important;
1819
- height: 32px;
1820
- i{
1821
- padding-right: 8px;
1822
- font-weight: 600;
1823
- }
1824
- }
1825
- /deep/.van-radio-group--horizontal{
1826
- .van-radio{
1827
- min-width: 100px;
1828
- max-width: 260px;
1829
- flex: none;
1830
- }
1831
- .van-radio--horizontal{
1832
- padding: 0.3rem 0;
1833
- margin-right: 6px;
1834
- }
1835
- }
1836
- /deep/.van-checkbox-group--horizontal{
1837
- .van-checkbox{
1838
- min-width: 100px;
1839
- max-width: 260px;
1840
- flex: none;
1841
- }
1842
- .van-checkbox--horizontal{
1843
- padding: 0.3rem 0;
1844
- margin-right: 6px;
1845
- }
1846
- }
1847
- /deep/.van-button--info{
1848
- border:1px solid #366aff;
1849
- }
1850
- /deep/.van-field__label{
1851
- width: 100%;
1852
- text-align: left;
1853
- color: #A9B3C6!important;
1854
- /* color: #000000!important;*/
1855
- display: flex;
1856
- align-items: center;
1857
- line-height: 1;
1858
- padding-bottom: 8px;
1859
- font-size: 1em;
1860
- }
1861
-
1862
- /deep/.van-field__control{
1863
- min-height: 40px;
1864
- }
1865
- /deep/textarea{
1866
- padding: 7px 0;
1867
- }
1868
- /deep/.van-dropdown-menu__bar{
1869
- box-shadow: none!important;
1870
- }
1871
- /deep/.van-overlay{
1872
- background-color: rgba(0,0,0,.4);
1873
- }
1874
- }
1875
-
1876
- .remCompanyClassForm{
1877
- width: 100%;
1878
- font-size: 1em;
1879
- .submitClass{
1880
- min-width: 100px;
1881
- color: white!important;
1882
- background-color:#366aff;
1883
- border-color: #366aff;
1884
- i{
1885
- padding-right: 8px;
1886
- font-weight: 600;
1887
- }
1888
- }
1889
- /deep/.el-checkbox-group{
1890
- display: flex;
1891
- align-items: center;
1892
- flex-wrap: wrap;
1893
- .el-checkbox{
1894
- padding: 8px 0;
1895
- min-width:150px;
1896
- max-width: 280px;
1897
- flex: none;
1898
- display: flex;
1899
- overflow: hidden;
1900
- margin-right: 0;
1901
- display: flex;
1902
- align-items:center;
1903
- }
1904
- .el-checkbox__label{
1905
- font-size: 1em;
1906
- overflow: hidden;
1907
- text-overflow: ellipsis;
1908
- white-space: nowrap;
1909
- }
1910
- }
1911
-
1912
- /deep/.el-radio-group{
1913
- display: flex;
1914
- align-items: center;
1915
- flex-wrap: wrap;
1916
- .el-radio{
1917
- padding: 8px 0;
1918
- min-width:150px;
1919
- max-width: 280px;
1920
- flex: none;
1921
- display: flex;
1922
- overflow: hidden;
1923
- margin-right: 0;
1924
- }
1925
- .el-radio__label{
1926
- overflow: hidden;
1927
- text-overflow: ellipsis;
1928
- white-space: nowrap;
1929
- font-size: 1em;
1930
- }
1931
- }
1932
-
1933
- /deep/.el-radio__input.is-checked+.el-radio__label{
1934
- color: #366aff!important;
1935
- }
1936
- /deep/.el-radio__input.is-checked .el-radio__inner{
1937
- color: #366aff!important;
1938
- border-color: #366aff!important;
1939
- background: #366aff!important;
1940
- }
1941
- /deep/.el-checkbox__input.is-checked+.el-checkbox__label{
1942
- color: #366aff!important;
1943
- }
1944
- /deep/.el-checkbox__input.is-checked .el-checkbox__inner, .el-checkbox__input.is-indeterminate .el-checkbox__inner{
1945
- background-color: #366aff!important;
1946
- border-color: #366aff!important;
1947
- }
1948
- }
1949
-
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
+
1950
1970
  </style>