askbot-dragon 0.6.18 → 0.6.19

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