askbot-dragon 1.7.0-beta → 1.7.11-beta

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 (87) hide show
  1. package/README.md +27 -27
  2. package/babel.config.js +6 -6
  3. package/dragon.iml +7 -7
  4. package/package.json +56 -56
  5. package/public/index.html +72 -72
  6. package/src/App.vue +31 -31
  7. package/src/api/index.js +1 -1
  8. package/src/api/mock.http +2 -2
  9. package/src/api/requestUrl.js +185 -185
  10. package/src/assets/js/AliyunlssUtil.js +92 -92
  11. package/src/assets/js/Base64Util.js +22 -22
  12. package/src/assets/js/common.js +252 -252
  13. package/src/assets/js/hammer.js +100 -100
  14. package/src/assets/js/script.js +36 -36
  15. package/src/assets/less/common.css +6773 -6773
  16. package/src/assets/less/converSationContainer/common.less +199 -199
  17. package/src/assets/less/converSationContainer/converSatonContainer.less +493 -493
  18. package/src/assets/less/iconfont.css +37 -37
  19. package/src/assets/less/ticketMessage.less +294 -294
  20. package/src/components/ActionAlertIframe.vue +177 -177
  21. package/src/components/AiGuide.vue +471 -471
  22. package/src/components/AnswerDocknowledge.vue +1071 -1071
  23. package/src/components/AnswerVoice.vue +285 -285
  24. package/src/components/AskIFrame.vue +15 -15
  25. package/src/components/ConversationContainer.vue +4948 -4948
  26. package/src/components/FileType.vue +86 -86
  27. package/src/components/Message.vue +27 -27
  28. package/src/components/MyEditor.vue +351 -351
  29. package/src/components/actionSatisfaction.vue +110 -110
  30. package/src/components/actionSendToBot.vue +62 -62
  31. package/src/components/answerDissatisfaction.vue +62 -62
  32. package/src/components/answerRadio.vue +204 -204
  33. package/src/components/ask-components/DissatisfactionOptions.vue +57 -57
  34. package/src/components/ask-components/Msgloading.vue +37 -37
  35. package/src/components/ask-components/SatisfactionV2.vue +15 -15
  36. package/src/components/askVideo.vue +162 -162
  37. package/src/components/assetDetails.vue +378 -378
  38. package/src/components/assetMessage.vue +228 -228
  39. package/src/components/associationIntention.vue +381 -381
  40. package/src/components/attachmentPreview.vue +90 -90
  41. package/src/components/botActionSatisfactor.vue +68 -68
  42. package/src/components/chatContent.vue +513 -513
  43. package/src/components/feedBack.vue +136 -136
  44. package/src/components/fielListView.vue +351 -351
  45. package/src/components/file/AliyunOssComponents.vue +108 -108
  46. package/src/components/formTemplate.vue +3577 -3577
  47. package/src/components/intelligentSummary.vue +231 -231
  48. package/src/components/kkview.vue +1138 -1138
  49. package/src/components/loadingProcess.vue +164 -164
  50. package/src/components/message/ActionAlertIframe.vue +112 -112
  51. package/src/components/message/ShopMessage.vue +164 -164
  52. package/src/components/message/TextMessage.vue +929 -929
  53. package/src/components/message/TicketMessage.vue +201 -201
  54. package/src/components/message/swiper/index.js +4 -4
  55. package/src/components/message/swiper/ticketSwiper.vue +503 -503
  56. package/src/components/message/swiper/ticketSwiperItem.vue +61 -61
  57. package/src/components/msgLoading.vue +231 -231
  58. package/src/components/myPopup.vue +70 -70
  59. package/src/components/newPdfPosition.vue +877 -877
  60. package/src/components/pdfPosition.vue +1508 -1508
  61. package/src/components/popup.vue +227 -227
  62. package/src/components/previewDoc.vue +252 -252
  63. package/src/components/previewPdf.vue +804 -804
  64. package/src/components/receiverMessagePlatform.vue +65 -65
  65. package/src/components/recommend.vue +80 -80
  66. package/src/components/selector/hOption.vue +20 -20
  67. package/src/components/selector/hSelector.vue +199 -199
  68. package/src/components/selector/hWrapper.vue +216 -216
  69. package/src/components/senderMessagePlatform.vue +53 -53
  70. package/src/components/source/BotMessage.vue +24 -24
  71. package/src/components/source/CustomMessage.vue +24 -24
  72. package/src/components/test.vue +260 -260
  73. package/src/components/tree.vue +294 -294
  74. package/src/components/utils/AliyunIssUtil.js +81 -81
  75. package/src/components/utils/ckeditor.js +174 -174
  76. package/src/components/utils/format_date.js +25 -25
  77. package/src/components/utils/index.js +6 -6
  78. package/src/components/utils/math_utils.js +29 -29
  79. package/src/components/voiceComponent.vue +119 -119
  80. package/src/components/welcomeKnowledgeFile.vue +347 -347
  81. package/src/components/welcomeLlmCard.vue +140 -140
  82. package/src/components/welcomeSuggest.vue +97 -97
  83. package/src/locales/cn.json +71 -71
  84. package/src/locales/en.json +72 -72
  85. package/src/locales/jp.json +72 -72
  86. package/src/main.js +74 -74
  87. package/vue.config.js +54 -54
@@ -1,929 +1,929 @@
1
- <!-- 消息记录容器 -->
2
- <template>
3
- <div class="media-body">
4
- <div class="textMessage" id="textMessage" :class="{remPhoneClass:isPhone,remCompanyClass:isCompany}">
5
- <div style="display: flex;height: auto;line-height: 2;" @mousemove="clickClick" class="htmlClass">
6
- <div v-html="text.template" id="html" :class="{notClickClass:disableds === true}">
7
- {{text.template}}
8
- </div>
9
- </div>
10
- <div id="submit">
11
- <el-button plain size="small" @click="submitClick" :disabled="disableds" >{{submitValue}}</el-button>
12
- </div>
13
- <div v-if="isCompany">
14
- <div v-if="single === true" class="editMessage">
15
- <el-input v-model="input" :placeholder="$t('common.inputPlaceholder')" class="inputClass" @input="testClick" @blur="inputBlur"></el-input>
16
- <!-- <span @click="quedingClick" style="display: flex;align-items: center"><i class="el-icon-success" style="color: #4C61E1;font-size: 32px;cursor: pointer"></i></span>
17
- --> </div>
18
- <div v-if="date" class="editMessage">
19
- <el-date-picker
20
- v-model="dateValue"
21
- type="date"
22
- :placeholder="$t('common.selectDate')"
23
- style="width: 100%;margin: 10px 0 10px 0"
24
- :clearable=false
25
- @change="dataclick"
26
-
27
- >
28
- </el-date-picker>
29
- <!-- <span @click="quedingClick" style="display: flex;align-items: center"><i class="el-icon-success" style="color: #4C61E1;font-size: 32px;cursor: pointer"></i></span>
30
- --> </div>
31
- <div v-if="time" class="editMessage">
32
- <el-time-picker
33
- v-model="timeValue"
34
- :placeholder="$t('common.selectTime')"
35
- style="margin: 10px 0 10px 0;width: 100%"
36
- :clearable=false
37
- @change="dataclick"
38
- >
39
- </el-time-picker>
40
- <!-- <span @click="quedingClick" style="display: flex;align-items: center"><i class="el-icon-success" style="color: #4C61E1;font-size: 32px;cursor: pointer"></i></span>
41
- --> </div>
42
- <div v-if="dateTime" class="editMessage">
43
- <el-date-picker
44
- v-model="dateTimeValue"
45
- type="datetime"
46
- :placeholder="$t('common.selectDateTime')"
47
- style="width: 100%;margin: 10px 0 10px 0"
48
- @change="dataclick"
49
- >
50
- </el-date-picker>
51
- <!-- <span @click="quedingClick(bianliangId)" style="display:flex;align-items:center;"><i class="el-icon-success" style="color: #4C61E1;font-size: 32px;cursor: pointer"></i></span>
52
- --> </div>
53
- <!--<div v-if="dateRange" style="border-top: 1px dashed #ebebeb;">
54
- <el-date-picker
55
- v-model="dateRangeValue"
56
- type="daterange"
57
- range-separator="至"
58
- start-placeholder="开始日期"
59
- end-placeholder="结束日期"
60
- style="margin: 10px 16px;width: 80%"
61
- >
62
- </el-date-picker>
63
- <span @click="quedingClick(bianliangId)" ><i class="el-icon-success" style="color: #409eff;font-size: 32px;text-align: center;vertical-align: middle;cursor: pointer"></i></span>
64
- </div>
65
- <div v-if="timeRange" style="border-top: 1px dashed #ebebeb;">
66
- <el-time-picker
67
- is-range
68
- v-model="timeRangeValue"
69
- range-separator="至"
70
- start-placeholder="开始时间"
71
- end-placeholder="结束时间"
72
- placeholder="选择时间范围"
73
- style="margin: 10px 16px;width: 80%"
74
- >
75
- </el-time-picker>
76
- <span @click="quedingClick(bianliangId)" ><i class="el-icon-success" style="color: #409eff;font-size: 32px;text-align: center;vertical-align: middle;cursor: pointer"></i></span>
77
-
78
- </div>
79
- <div v-if="dateTimeRange" style="border-top: 1px dashed #ebebeb;">
80
- <el-date-picker
81
- v-model="dateTimeValue"
82
- type="datetimerange"
83
- range-separator="至"
84
- start-placeholder="开始日期"
85
- end-placeholder="结束日期"
86
- style="width: 80%;margin: 10px 16px"
87
-
88
- >
89
- </el-date-picker>
90
- <span @click="quedingClick(bianliangId)" ><i class="el-icon-success" style="color: #409eff;font-size: 32px;text-align: center;vertical-align: middle;cursor: pointer"></i></span>
91
- </div>-->
92
- </div>
93
- <div v-if="isPhone">
94
- <div v-if="single" class="editMessage">
95
- <el-input v-model="input" :placeholder="$t('common.inputPlaceholder')" class="inputClass" @input="testClick" @blur="inputBlur"></el-input>
96
- <!-- <span @click="quedingClick" style="display: flex;align-items: center"><i class="el-icon-success" style="color: #4C61E1;font-size: 32px;cursor: pointer"></i></span>
97
- --> </div>
98
- <div v-if="date">
99
- <van-calendar v-model="show" @confirm="onConfirm" :default-date="defaultDate"/>
100
- <!-- <el-date-picker
101
- v-model="dateValue"
102
- type="date"
103
- placeholder="选择日期"
104
- style="width: 80%;margin: 10px 10px 10px 0"
105
- :editable=false
106
- >
107
- </el-date-picker>
108
- <span @click="quedingClick" style="display: flex;align-items: center"><i class="el-icon-success" style="color: #4C61E1;font-size: 32px;cursor: pointer"></i></span>
109
- --></div>
110
-
111
- <div v-if="time">
112
- <van-popup v-model="showTimePicker" position="bottom">
113
- <van-datetime-picker
114
- v-model="timeValue"
115
- type="datetime"
116
- :title="$t('common.selectTime')"
117
- :min-date="minDate"
118
- :formatter="formatter"
119
- @cancel="showTimePicker = false"
120
- @confirm="onConfirmTime"
121
- />
122
- </van-popup>
123
- <!-- <el-time-picker
124
- v-model="timeValue"
125
- placeholder="任意时间点"
126
- style="margin: 10px 10px 10px 0;width: 80%"
127
- :editable=false
128
- >
129
- </el-time-picker>
130
- <span @click="quedingClick" style="display: flex;align-items: center"><i class="el-icon-success" style="color: #4C61E1;font-size: 32px;cursor: pointer"></i></span>
131
- --> </div>
132
- <div v-if="dateTime">
133
- <van-popup v-model="showDateTimePicker" position="bottom">
134
- <van-datetime-picker
135
- v-model="dateTimeValue"
136
- type="datetime"
137
- :title="$t('common.selectDateTime')"
138
- :min-date="minDate"
139
- :formatter="formatter"
140
- @cancel="showDateTimePicker = false"
141
- @confirm="onConfirmDateTime"
142
- />
143
- </van-popup>
144
- <!-- <el-date-picker
145
- v-model="dateTimeValue"
146
- type="datetime"
147
- placeholder="选择日期时间"
148
- style="width: 80%;margin: 10px 10px 10px 0"
149
- :editable=false
150
-
151
- >
152
- </el-date-picker>
153
- <span @click="quedingClick(bianliangId)" style="display: flex;align-items: center"><i class="el-icon-success" style="color: #4C61E1;font-size: 32px;cursor: pointer"></i></span>
154
- --></div>
155
- <!-- <div v-if="dateRange" style="border-top: 1px dashed #ebebeb;display: flex">
156
- &lt;!&ndash;<el-date-picker
157
- v-model="dateRangeValue"
158
- type="daterange"
159
- range-separator="至"
160
- start-placeholder="开始日期"
161
- end-placeholder="结束日期"
162
- style="margin: 10px 16px;width: 80%"
163
- :editable=false
164
-
165
- >
166
- </el-date-picker>&ndash;&gt;
167
- <div style="width: 90%">
168
- <van-cell title="选择日期区间" :value="dateRangeValue" @click="show = true" />
169
- <van-calendar v-model="show" type="range" @confirm="onConfirm" />
170
- </div>
171
- <span @click="quedingClick(bianliangId)" ><i class="el-icon-success" style="color: #409eff;font-size: 32px;text-align: center;vertical-align: middle;cursor: pointer"></i></span>
172
-
173
-
174
-
175
- </div>
176
- <div v-if="timeRange" style="border-top: 1px dashed #ebebeb;">
177
- <el-time-picker
178
- is-range
179
- v-model="timeRangeValue"
180
- range-separator="至"
181
- start-placeholder="开始时间"
182
- end-placeholder="结束时间"
183
- placeholder="选择时间范围"
184
- style="margin: 10px 16px;width: 80%"
185
-
186
- :editable=false
187
- >
188
- </el-time-picker>
189
- <span @click="quedingClick(bianliangId)" ><i class="el-icon-success" style="color: #409eff;font-size: 32px;text-align: center;vertical-align: middle;cursor: pointer"></i></span>
190
-
191
- </div>
192
- <div v-if="dateTimeRange" style="border-top: 1px dashed #ebebeb;display: flex">
193
- &lt;!&ndash; <el-date-picker
194
- v-model="dateTimeValue"
195
- type="datetimerange"
196
- range-separator="至"
197
- start-placeholder="开始日期"
198
- end-placeholder="结束日期"
199
- style="width: 80%;margin: 10px 16px"
200
- :editable=false
201
-
202
-
203
- >
204
- </el-date-picker>&ndash;&gt;
205
- <div style="width: 90%">
206
- <van-field
207
- readonly
208
- clickable
209
- name="datetimePicker"
210
- :value=dateTimeValue[0]
211
- label='选择时间'
212
- placeholder="点击选择开始日期时间"
213
- @click="showDateTimePicker=true"
214
- />
215
- <van-popup v-model="showDateTimePicker" position="bottom">
216
- <van-datetime-picker
217
- v-model="currentDate"
218
- type="datetime"
219
- title="选择开始日期时间"
220
- @confirm="onConfirmDateTime($event)"
221
- @cancel="showDateTimePicker = false"
222
- :min-date="minDate"
223
- :formatter="formatter"
224
- />
225
- </van-popup>
226
- <van-field
227
- readonly
228
- clickable
229
- name="datetimePicker"
230
- :value=dateTimeValue1[0]
231
- label=" "
232
- placeholder="点击选择结束日期时间"
233
- @click="showDateTimePicker1=true"
234
- />
235
- <van-popup v-model="showDateTimePicker1" position="bottom">
236
- <van-datetime-picker
237
- v-model="currentDate"
238
- type="datetime"
239
- title="选择结束日期时间"
240
- @confirm="onConfirmDateTime1($event)"
241
- @cancel="showDateTimePicker1 = false"
242
- :min-date="minDate"
243
- :formatter="formatter"
244
- />
245
- </van-popup>
246
- </div>
247
-
248
- <span @click="quedingClick(bianliangId)" ><i class="el-icon-success" style="color: #409eff;font-size: 32px;text-align: center;vertical-align: middle;cursor: pointer"></i></span>
249
- </div>-->
250
- </div>
251
- </div>
252
- </div>
253
- </template>
254
-
255
- <script>
256
- /*import $ from 'jquery'*/
257
- export default {
258
- name: 'TextMessage',
259
- data(){
260
- return{
261
- show:false,
262
- single:false,
263
- date:false,
264
- time:false,
265
- dateTime:false,
266
- dateRange:false,
267
- timeRange:false,
268
- input:'',
269
- bianliangId:'',
270
- dateValue:'',
271
- message:[{content:'王亚欣',type:'SINGLE',value:'',id:1},{content:['2020-11-18T07:25:16.000+0000','2020-11-21T07:25:16.000+0000'],type:'DATE-RANGE',value:'',id:2},{content:'2020-11-18T07:25:16.000+0000',type:'TIME',value:'',id:3},{content:'2020-11-18T07:25:16.000+0000',type:'DATE',value:'',id:4},{content:['2020-11-18T07:25:16.000+0000','2020-11-21T07:25:16.000+0000'],type:'DATERANGE',value:'',id:5},{content:['2020-11-18T08:25:16.000+0000','2020-11-21T07:25:16.000+0000'],type:'TIMERANGE',value:'',id:6},],
272
- isPhone:false,
273
- isCompany:false,
274
- dateTimeValue:'',
275
- timeValue:'',
276
- dateRangeValue:'',
277
- dateRangeValues:'',
278
- timeRangeValue:[],
279
- dateTimeValue1:[],
280
- test:0,
281
- currentDate:new Date(),
282
- minDate: new Date(2020, 0, 1),
283
- showDateTimePicker1:false,
284
- showDateTimePicker:false,
285
- values:[],
286
- checkValue:'',
287
- disableds:false,
288
- submitValue:'确认',
289
- dateInnerText:'',
290
- defaultDate:'',
291
- showTimePicker:false,
292
-
293
- }
294
- },
295
- props:{
296
- text:{
297
- type:Object,
298
- default(){
299
- return {}
300
- }
301
- },
302
- type:String,
303
- disable:Boolean,
304
- submit:Boolean,
305
- language:{
306
- type:String,
307
- default:"cn"
308
- }
309
- },
310
- mounted() {
311
- this.isMobile()
312
- let span=this.$el
313
- let defaults=span.getElementsByClassName('ask-component-placeholder-span')
314
- for (let i=0;i<defaults.length;i++)
315
- {
316
- this.values.push({})
317
- this.values[i]['key']=defaults[i].getAttribute('data')
318
- this.values[i]['value']=defaults[i].innerText
319
- this.values[i]['type']=defaults[i].getAttribute('type')
320
- }
321
- let text=this.$el
322
- let test=text.getElementsByClassName('ask-component-placeholder-span')
323
- let cpntain=text.getElementsByClassName('ask-component-placeholder-container')
324
- let icon=text.getElementsByClassName('arsenalkebianji')
325
- for (let i=0;i<icon.length;i++)
326
- {
327
- icon[i].style.color='#366aff'
328
- }
329
- for (let i=0;i<cpntain.length;i++)
330
- {
331
- if(this.type)
332
- {
333
- cpntain[i].style.paddingRight=0.2+'rem'
334
- cpntain[i].style.paddingLeft=0.2+'rem'
335
- }
336
- else
337
- {
338
- cpntain[i].style.paddingRight=4+'px'
339
- cpntain[i].style.paddingLeft=4+'px'
340
- }
341
-
342
- }
343
- for (let i=0;i<test.length;i++)
344
- {
345
- if(test[i].getAttribute('type')==='DATE_PICKER')
346
- {
347
- let date=Number(test[i].innerText)*1000
348
- test[i].innerText=new Date(date).Format("MM-dd")
349
- }
350
- if(test[i].getAttribute('type')==='TIME_PICKER')
351
- {
352
- let time=Number(test[i].innerText)*1000
353
- test[i].innerText=new Date(time).Format("hh:mm")
354
- }
355
- if(test[i].getAttribute('type') === 'DATE_TIME_PICKER'){
356
- let time=Number(test[i].innerText)*1000
357
- test[i].innerText=new Date(time).Format("yyyy-MM-dd hh:mm")
358
- }
359
- }
360
- },
361
- beforeMount() {
362
- this.$i18n.locale = this.language;
363
- if(this.disable===true)
364
- {
365
- this.disableds=true
366
-
367
- }
368
- else
369
- {
370
- this.disableds=false
371
-
372
- }
373
- if(this.submit===true)
374
- {
375
- this.submitValue=this.$t('common.confirmed')
376
- }
377
- else
378
- {
379
- this.submitValue=this.$t('common.confirm')
380
- }
381
- },
382
- methods:{
383
- dataclick(){
384
- if(this.checkValue.getAttribute('type') === 'DATE_PICKER')
385
- {
386
- for (let i=0;i<this.values.length;i++)
387
- {
388
- if(this.values[i].key === this.checkValue.getAttribute('data'))
389
- {
390
- if(this.dateValue!=='')
391
- {
392
- this.checkValue.innerText=new Date(this.dateValue).Format('MM-dd')
393
- this.values[i].value=new Date(this.dateValue).getTime()
394
- }
395
- else
396
- {
397
- this.values[i].value=this.checkValue.innerText
398
- }
399
- }
400
- }
401
- }
402
- if(this.checkValue.getAttribute('type') === 'TIME_PICKER')
403
- {
404
- for (let i=0;i<this.values.length;i++)
405
- {
406
- if(this.values[i].key === this.checkValue.getAttribute('data') )
407
- {
408
- if(this.timeValue!=='')
409
- {
410
-
411
- this.checkValue.innerText=new Date(this.timeValue).Format('hh:mm')
412
- this.values[i].value=new Date(this.timeValue).getTime()
413
- }
414
- else
415
- {
416
- this.values[i].value=this.checkValue.innerText
417
- }
418
- }
419
- }
420
- }
421
- if(this.checkValue.getAttribute('type') === 'DATE_TIME_PICKER')
422
- {
423
- for (let i=0;i<this.values.length;i++)
424
- {
425
- if(this.values[i].key === this.checkValue.getAttribute('data') )
426
- {
427
- if(this.dateTimeValue!=='')
428
- {
429
-
430
- this.checkValue.innerText=new Date(this.dateTimeValue).Format('yyyy-MM-dd hh:mm')
431
- this.values[i].value=new Date(this.dateTimeValue).getTime()
432
- }
433
- else
434
- {
435
- this.values[i].value=this.checkValue.innerText
436
- }
437
- }
438
- }
439
- }
440
- },
441
- clickClick(e){
442
- if(e.target.onclick!==null)
443
- {
444
- let that=this
445
- window._askEditValue=that._askEditValue;
446
- }
447
- },
448
- _askEditValue(a,b){
449
- let type=b.getAttribute('type')
450
- this.checkValue=b
451
- if(type === 'INPUT')
452
- {
453
- this.single=true
454
- this.date=false
455
- this.time=false
456
- this.dateTime=false
457
- this.input= b.innerText
458
- }
459
- if(type === 'DATE_PICKER')
460
- {
461
- this.single=false
462
- this.date=true
463
- this.time=false
464
- this.dateTime=false
465
- this.show=true
466
- for (let i=0;i<this.values.length;i++)
467
- {
468
- if(b.getAttribute('data') === this.values[i].key)
469
- {
470
- if(typeof this.values[i].value == 'string')
471
- {
472
- this.dateInnerText=Number(this.values[i].value)*1000
473
- }
474
- else
475
- {
476
- this.dateInnerText=Number(this.values[i].value)
477
- }
478
- this.dateValue=new Date(this.dateInnerText).Format("yyyy:MM-dd")
479
- this.defaultDate=new Date(this.dateInnerText)
480
- }
481
- return
482
- }
483
-
484
- }
485
- if(type === 'TIME_PICKER')
486
- {
487
- this.single=false
488
- this.date=false
489
- this.time=true
490
- this.dateTime=false
491
- this.showTimePicker=true
492
- for (let i=0;i<this.values.length;i++)
493
- {
494
- if(b.getAttribute('data') === this.values[i].key)
495
- {
496
- let time
497
- if(typeof this.values[i].value == 'string'){
498
- time=Number(this.values[i].value)*1000
499
- }
500
- else
501
- {
502
- time=Number(this.values[i].value)
503
- }
504
- if(this.isPhone ===true)
505
- {
506
- this.timeValue=new Date(time)
507
- }
508
- else
509
- {
510
- this.timeValue=new Date(time).Format("yyyy-MM-dd hh:mm")
511
- }
512
- }
513
- }
514
- }
515
- if(type === 'DATE_TIME_PICKER')
516
- {
517
- this.single=false
518
- this.date=false
519
- this.time=false
520
- this.dateTime=true
521
- this.showDateTimePicker=true
522
- for (let i=0;i<this.values.length;i++)
523
- {
524
- if(b.getAttribute('data') === this.values[i].key)
525
- {
526
- let time
527
- if(typeof this.values[i].value == 'string'){
528
- time=Number(this.values[i].value)*1000
529
- }
530
- else
531
- {
532
- time=Number(this.values[i].value)
533
- }
534
- if(this.isPhone===true)
535
- {
536
- this.dateTimeValue=new Date(time)
537
- }
538
- else
539
- {
540
- this.dateTimeValue=new Date(time).Format("yyyy-MM-dd hh:mm:ss")
541
- }
542
- }
543
- }
544
- }
545
-
546
- },
547
- formatter(type, value) {
548
- // 格式化选择器日期
549
- if (type === "year") {
550
- return `${value}年`;
551
- } else if (type === "month") {
552
- return `${value}月`;
553
- } else if (type === "day") {
554
- return `${value}日`;
555
- } else if (type === "hour") {
556
- return `${value}时`;
557
- } else if (type === "minute") {
558
- return `${value}分`;
559
- }
560
- return value;
561
- },
562
- //提交按钮
563
- submitClick(){
564
- this.single=false
565
- this.date=false
566
- this.time=false
567
- this.dateTime=false
568
- let infomation={}
569
- let obj = {}
570
- this.values.map(item => {
571
- obj[item.key] = item
572
- })
573
- let result = Object.values(obj)
574
- let text=this.$el
575
- let test=text.getElementsByClassName('ask-component-placeholder-span')
576
- for (let i=0;i<test.length;i++)
577
- {
578
- if(test[i].getAttribute('type')==='DATE_PICKER')
579
- {
580
- if(test[i].getAttribute('data')===result[i].key)
581
- {
582
- if(typeof result[i].value =='number'){
583
- result[i].value/=1000
584
- let resu=String(result[i].value)
585
- result[i].value=resu
586
- }
587
- }
588
- }
589
- if(test[i].getAttribute('type')==='TIME_PICKER')
590
- {
591
- if(test[i].getAttribute('data')===result[i].key)
592
- {
593
- if(typeof result[i].value =='number')
594
- {
595
- result[i].value/=1000
596
- let resu=String(result[i].value)
597
- result[i].value=resu
598
- }
599
- }
600
- }
601
- if(test[i].getAttribute('type')==='DATE_TIME_PICKER')
602
- {
603
- if(test[i].getAttribute('data')===result[i].key)
604
- {
605
- if(typeof result[i].value =='number')
606
- {
607
- result[i].value/=1000
608
- let resu=String(result[i].value)
609
- result[i].value=resu
610
- }
611
- }
612
- }
613
- }
614
- infomation['values']=result
615
- infomation['goToAction']=this.text.goToAction
616
- let innerhtml=this.$el
617
- infomation['template']=innerhtml.querySelector('#html').innerHTML
618
- infomation['apiKey']=this.text.apiKey
619
- this.$emit('submitClick',infomation,this.text.apiKey)
620
- this.submitValue=this.$t('common.confirmed')
621
- this.disableds=true
622
- },
623
- addZero(i){
624
- if (i<10) {
625
- i="0" + i;
626
- }
627
- return i;
628
- },
629
- formatDate(date) {
630
- if(typeof date == 'object')
631
- {
632
- const dateTime = new Date(date[0])
633
- const dateTime1=new Date(date[1])
634
- return `${dateTime.getMonth() + 1}月${dateTime.getDate()}日 ${this.addZero(dateTime.getHours())} : ${this.addZero(dateTime.getMinutes())} - ${dateTime1.getMonth() + 1}月${dateTime1.getDate()}日 ${this.addZero(dateTime1.getHours())} : ${this.addZero(dateTime1.getMinutes())}`;
635
- }
636
- else
637
- {
638
- const dateTime = new Date(date)
639
- return `${dateTime.getMonth() + 1}月${dateTime.getDate()}日`;
640
- }
641
-
642
- },
643
- //格式成时间
644
- formatDate1(date){
645
- const dateTime = new Date(date)
646
- return `${this.addZero(dateTime.getHours())}:${this.addZero(dateTime.getMinutes())}`;
647
- },
648
- //格式成日期
649
- formatDate2(date){
650
- const dateTime = new Date(date)
651
- return `${dateTime.getMonth() + 1} - ${dateTime.getDate()}`;
652
- },
653
- //日期范围
654
- formatDate3(date){
655
- const dateTime = new Date(date[0])
656
- const dateTime1=new Date(date[1])
657
- return `${dateTime.getMonth() + 1}月 ${dateTime.getDate()}日 - ${dateTime1.getMonth() + 1}月 ${dateTime1.getDate()}日`;
658
- },
659
- //时间范围
660
- formatDate4(date){
661
- const dateTime = new Date(date[0])
662
- const dateTime1=new Date(date[1])
663
- return `${dateTime.getHours()}: ${dateTime.getMinutes()} - ${dateTime1.getHours()}: ${dateTime1.getMinutes()}`;
664
- },
665
- testClick(value){
666
- if(this.checkValue.getAttribute('type') === 'INPUT')
667
- {
668
- for (let i=0;i<this.values.length;i++)
669
- {
670
- if(this.values[i].key === this.checkValue.getAttribute('data') )
671
- {
672
- this.checkValue.innerText=value
673
- this.values[i].value=this.checkValue.innerText
674
- }
675
- }
676
- }
677
- },
678
- inputBlur(){
679
- console.debug('inputBlur')
680
- this.single=false
681
- },
682
- quedingClick(){
683
- if(this.checkValue.getAttribute('type') === 'INPUT')
684
- {
685
- for (let i=0;i<this.values.length;i++)
686
- {
687
- if(this.values[i].key === this.checkValue.getAttribute('data') )
688
- {
689
- if(this.input!=='')
690
- {
691
- this.checkValue.innerText=this.input
692
- }
693
- this.values[i].value=this.checkValue.innerText
694
- }
695
- }
696
- this.single = false
697
- this.input=''
698
- }
699
- if(this.checkValue.getAttribute('type') === 'DATE_PICKER')
700
-
701
- {
702
- for (let i=0;i<this.values.length;i++)
703
- {
704
- if(this.values[i].key === this.checkValue.getAttribute('data'))
705
- {
706
- if(this.dateValue!=='')
707
- {
708
- this.checkValue.innerText=new Date(this.dateValue).Format('MM-dd')
709
- this.values[i].value=new Date(this.dateValue).getTime()
710
- }
711
- else
712
- {
713
- this.values[i].value=this.checkValue.innerText
714
- }
715
- }
716
- }
717
- this.date = false
718
- this.dateValue=''
719
- }
720
- if(this.checkValue.getAttribute('type') === 'TIME_PICKER')
721
- {
722
- for (let i=0;i<this.values.length;i++)
723
- {
724
- if(this.values[i].key === this.checkValue.getAttribute('data') )
725
- {
726
- if(this.timeValue!=='')
727
- {
728
-
729
- this.checkValue.innerText=new Date(this.timeValue).Format('hh:mm')
730
- this.values[i].value=new Date(this.timeValue).getTime()
731
- }
732
- else
733
- {
734
- this.values[i].value=this.checkValue.innerText
735
- }
736
- }
737
- }
738
- this.time = false
739
- this.timeValue=''
740
- }
741
- if(this.checkValue.getAttribute('type') === 'DATE_TIME_PICKER')
742
- {
743
- for (let i=0;i<this.values.length;i++)
744
- {
745
- if(this.values[i].key === this.checkValue.getAttribute('data') )
746
- {
747
- if(this.dateTimeValue!=='')
748
- {
749
-
750
- this.checkValue.innerText=new Date(this.dateTimeValue).Format('yyyy-MM-dd hh:mm')
751
- this.values[i].value=new Date(this.dateTimeValue).getTime()
752
- }
753
- else
754
- {
755
- this.values[i].value=this.checkValue.innerText
756
- }
757
- }
758
- }
759
- this.dateTime = false
760
- this.dateTimeValue=''
761
- }
762
-
763
- },
764
- isMobile() {
765
- 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);
766
- if (flag) {
767
- this.isPhone=true
768
- }
769
- else
770
- {
771
- this.isCompany=true
772
-
773
- }
774
- },
775
- onConfirmDateTime(){
776
- if(this.checkValue.getAttribute('type') === 'DATE_TIME_PICKER')
777
- {
778
- for (let i=0;i<this.values.length;i++)
779
- {
780
- if(this.values[i].key === this.checkValue.getAttribute('data') )
781
- {
782
- if(this.dateTimeValue!=='')
783
- {
784
-
785
- this.checkValue.innerText=new Date(this.dateTimeValue).Format('yyyy-MM-dd hh:mm')
786
- this.values[i].value=new Date(this.dateTimeValue).getTime()
787
- }
788
- else
789
- {
790
- this.values[i].value=this.checkValue.innerText
791
- }
792
- }
793
- }
794
- }
795
- this.showDateTimePicker = false;
796
- },
797
-
798
- onConfirm(date) {
799
- this.show = false;
800
- if(this.checkValue.getAttribute('type') === 'DATE_PICKER')
801
-
802
- {
803
- for (let i=0;i<this.values.length;i++)
804
- {
805
- if(this.values[i].key === this.checkValue.getAttribute('data'))
806
- {
807
- if(date!=='')
808
- {
809
- this.checkValue.innerText=new Date(date).Format('MM-dd')
810
- this.values[i].value=new Date(date).getTime()
811
- }
812
- else
813
- {
814
- this.values[i].value=this.checkValue.innerText
815
- }
816
- }
817
- }
818
- this.date = false
819
- this.dateValue=''
820
- }
821
-
822
- },
823
- onConfirmTime(){
824
- this.showTimePicker=false
825
- if(this.checkValue.getAttribute('type') === 'TIME_PICKER')
826
- {
827
- for (let i=0;i<this.values.length;i++)
828
- {
829
- if(this.values[i].key === this.checkValue.getAttribute('data') )
830
- {
831
- if(this.timeValue!=='')
832
- {
833
-
834
- this.checkValue.innerText=new Date(this.timeValue).Format('hh:mm')
835
- this.values[i].value=new Date(this.timeValue).getTime()
836
- }
837
- else
838
- {
839
- this.values[i].value=this.checkValue.innerText
840
- }
841
- }
842
- }
843
- }
844
- }
845
- }
846
- }
847
- </script>
848
-
849
-
850
- <style lang="less">
851
- @import "../../assets/less/common.css";
852
- #textMessage{
853
- min-width: 200px;
854
- .editMessage{
855
- display: flex;
856
- justify-content: space-between;
857
- margin-top: 10px;
858
- border-top: 1px dashed #ebebeb;
859
- }
860
- #submit{
861
- margin-top: 10px;
862
- display: flex;
863
- align-items: center;
864
- justify-content: center;
865
- .el-button{
866
- border: 1px solid #BBCDFF;
867
- border-radius: 14px;
868
- background-color: white;
869
- color: #366aff;
870
- font-weight: 400;
871
- }
872
- .el-button--small{
873
- padding: 9px 30px;
874
- font-size: 1em;
875
- }
876
- }
877
- #html{
878
- p{
879
- color:#A9B3C6;
880
- }
881
- .ask-component-placeholder-icon{
882
- padding-left: 12px;
883
- color: #366aff;
884
- font-size: 18px;
885
- }
886
- .ask-component-placeholder-span{
887
- color: #616161!important;
888
- }
889
- }
890
- }
891
- .remPhoneClass{
892
- margin: 0 auto;
893
- /*width: 80vw;*/
894
- .inputClass{
895
- margin-top: 8px;
896
- width: 100%;
897
- .el-input__inner{
898
- border-radius: 9px;
899
- }
900
- }
901
- .htmlClass{
902
- padding: 4px 0;
903
- }
904
-
905
- }
906
- .remCompanyClass{
907
-
908
- margin: 0 auto;
909
- /*width: 300px;*/
910
- .inputClass{
911
- padding: 10px 0 10px 0;
912
- width: 100%;
913
- .el-input__inner{
914
- border-radius: 9px;
915
- }
916
- }
917
-
918
-
919
- }
920
- .van-cell::after{
921
- content: none!important;
922
- }
923
- i{
924
- cursor: pointer;
925
- }
926
- .notClickClass{
927
- pointer-events: none;
928
- }
929
- </style>
1
+ <!-- 消息记录容器 -->
2
+ <template>
3
+ <div class="media-body">
4
+ <div class="textMessage" id="textMessage" :class="{remPhoneClass:isPhone,remCompanyClass:isCompany}">
5
+ <div style="display: flex;height: auto;line-height: 2;" @mousemove="clickClick" class="htmlClass">
6
+ <div v-html="text.template" id="html" :class="{notClickClass:disableds === true}">
7
+ {{text.template}}
8
+ </div>
9
+ </div>
10
+ <div id="submit">
11
+ <el-button plain size="small" @click="submitClick" :disabled="disableds" >{{submitValue}}</el-button>
12
+ </div>
13
+ <div v-if="isCompany">
14
+ <div v-if="single === true" class="editMessage">
15
+ <el-input v-model="input" :placeholder="$t('common.inputPlaceholder')" class="inputClass" @input="testClick" @blur="inputBlur"></el-input>
16
+ <!-- <span @click="quedingClick" style="display: flex;align-items: center"><i class="el-icon-success" style="color: #4C61E1;font-size: 32px;cursor: pointer"></i></span>
17
+ --> </div>
18
+ <div v-if="date" class="editMessage">
19
+ <el-date-picker
20
+ v-model="dateValue"
21
+ type="date"
22
+ :placeholder="$t('common.selectDate')"
23
+ style="width: 100%;margin: 10px 0 10px 0"
24
+ :clearable=false
25
+ @change="dataclick"
26
+
27
+ >
28
+ </el-date-picker>
29
+ <!-- <span @click="quedingClick" style="display: flex;align-items: center"><i class="el-icon-success" style="color: #4C61E1;font-size: 32px;cursor: pointer"></i></span>
30
+ --> </div>
31
+ <div v-if="time" class="editMessage">
32
+ <el-time-picker
33
+ v-model="timeValue"
34
+ :placeholder="$t('common.selectTime')"
35
+ style="margin: 10px 0 10px 0;width: 100%"
36
+ :clearable=false
37
+ @change="dataclick"
38
+ >
39
+ </el-time-picker>
40
+ <!-- <span @click="quedingClick" style="display: flex;align-items: center"><i class="el-icon-success" style="color: #4C61E1;font-size: 32px;cursor: pointer"></i></span>
41
+ --> </div>
42
+ <div v-if="dateTime" class="editMessage">
43
+ <el-date-picker
44
+ v-model="dateTimeValue"
45
+ type="datetime"
46
+ :placeholder="$t('common.selectDateTime')"
47
+ style="width: 100%;margin: 10px 0 10px 0"
48
+ @change="dataclick"
49
+ >
50
+ </el-date-picker>
51
+ <!-- <span @click="quedingClick(bianliangId)" style="display:flex;align-items:center;"><i class="el-icon-success" style="color: #4C61E1;font-size: 32px;cursor: pointer"></i></span>
52
+ --> </div>
53
+ <!--<div v-if="dateRange" style="border-top: 1px dashed #ebebeb;">
54
+ <el-date-picker
55
+ v-model="dateRangeValue"
56
+ type="daterange"
57
+ range-separator="至"
58
+ start-placeholder="开始日期"
59
+ end-placeholder="结束日期"
60
+ style="margin: 10px 16px;width: 80%"
61
+ >
62
+ </el-date-picker>
63
+ <span @click="quedingClick(bianliangId)" ><i class="el-icon-success" style="color: #409eff;font-size: 32px;text-align: center;vertical-align: middle;cursor: pointer"></i></span>
64
+ </div>
65
+ <div v-if="timeRange" style="border-top: 1px dashed #ebebeb;">
66
+ <el-time-picker
67
+ is-range
68
+ v-model="timeRangeValue"
69
+ range-separator="至"
70
+ start-placeholder="开始时间"
71
+ end-placeholder="结束时间"
72
+ placeholder="选择时间范围"
73
+ style="margin: 10px 16px;width: 80%"
74
+ >
75
+ </el-time-picker>
76
+ <span @click="quedingClick(bianliangId)" ><i class="el-icon-success" style="color: #409eff;font-size: 32px;text-align: center;vertical-align: middle;cursor: pointer"></i></span>
77
+
78
+ </div>
79
+ <div v-if="dateTimeRange" style="border-top: 1px dashed #ebebeb;">
80
+ <el-date-picker
81
+ v-model="dateTimeValue"
82
+ type="datetimerange"
83
+ range-separator="至"
84
+ start-placeholder="开始日期"
85
+ end-placeholder="结束日期"
86
+ style="width: 80%;margin: 10px 16px"
87
+
88
+ >
89
+ </el-date-picker>
90
+ <span @click="quedingClick(bianliangId)" ><i class="el-icon-success" style="color: #409eff;font-size: 32px;text-align: center;vertical-align: middle;cursor: pointer"></i></span>
91
+ </div>-->
92
+ </div>
93
+ <div v-if="isPhone">
94
+ <div v-if="single" class="editMessage">
95
+ <el-input v-model="input" :placeholder="$t('common.inputPlaceholder')" class="inputClass" @input="testClick" @blur="inputBlur"></el-input>
96
+ <!-- <span @click="quedingClick" style="display: flex;align-items: center"><i class="el-icon-success" style="color: #4C61E1;font-size: 32px;cursor: pointer"></i></span>
97
+ --> </div>
98
+ <div v-if="date">
99
+ <van-calendar v-model="show" @confirm="onConfirm" :default-date="defaultDate"/>
100
+ <!-- <el-date-picker
101
+ v-model="dateValue"
102
+ type="date"
103
+ placeholder="选择日期"
104
+ style="width: 80%;margin: 10px 10px 10px 0"
105
+ :editable=false
106
+ >
107
+ </el-date-picker>
108
+ <span @click="quedingClick" style="display: flex;align-items: center"><i class="el-icon-success" style="color: #4C61E1;font-size: 32px;cursor: pointer"></i></span>
109
+ --></div>
110
+
111
+ <div v-if="time">
112
+ <van-popup v-model="showTimePicker" position="bottom">
113
+ <van-datetime-picker
114
+ v-model="timeValue"
115
+ type="datetime"
116
+ :title="$t('common.selectTime')"
117
+ :min-date="minDate"
118
+ :formatter="formatter"
119
+ @cancel="showTimePicker = false"
120
+ @confirm="onConfirmTime"
121
+ />
122
+ </van-popup>
123
+ <!-- <el-time-picker
124
+ v-model="timeValue"
125
+ placeholder="任意时间点"
126
+ style="margin: 10px 10px 10px 0;width: 80%"
127
+ :editable=false
128
+ >
129
+ </el-time-picker>
130
+ <span @click="quedingClick" style="display: flex;align-items: center"><i class="el-icon-success" style="color: #4C61E1;font-size: 32px;cursor: pointer"></i></span>
131
+ --> </div>
132
+ <div v-if="dateTime">
133
+ <van-popup v-model="showDateTimePicker" position="bottom">
134
+ <van-datetime-picker
135
+ v-model="dateTimeValue"
136
+ type="datetime"
137
+ :title="$t('common.selectDateTime')"
138
+ :min-date="minDate"
139
+ :formatter="formatter"
140
+ @cancel="showDateTimePicker = false"
141
+ @confirm="onConfirmDateTime"
142
+ />
143
+ </van-popup>
144
+ <!-- <el-date-picker
145
+ v-model="dateTimeValue"
146
+ type="datetime"
147
+ placeholder="选择日期时间"
148
+ style="width: 80%;margin: 10px 10px 10px 0"
149
+ :editable=false
150
+
151
+ >
152
+ </el-date-picker>
153
+ <span @click="quedingClick(bianliangId)" style="display: flex;align-items: center"><i class="el-icon-success" style="color: #4C61E1;font-size: 32px;cursor: pointer"></i></span>
154
+ --></div>
155
+ <!-- <div v-if="dateRange" style="border-top: 1px dashed #ebebeb;display: flex">
156
+ &lt;!&ndash;<el-date-picker
157
+ v-model="dateRangeValue"
158
+ type="daterange"
159
+ range-separator="至"
160
+ start-placeholder="开始日期"
161
+ end-placeholder="结束日期"
162
+ style="margin: 10px 16px;width: 80%"
163
+ :editable=false
164
+
165
+ >
166
+ </el-date-picker>&ndash;&gt;
167
+ <div style="width: 90%">
168
+ <van-cell title="选择日期区间" :value="dateRangeValue" @click="show = true" />
169
+ <van-calendar v-model="show" type="range" @confirm="onConfirm" />
170
+ </div>
171
+ <span @click="quedingClick(bianliangId)" ><i class="el-icon-success" style="color: #409eff;font-size: 32px;text-align: center;vertical-align: middle;cursor: pointer"></i></span>
172
+
173
+
174
+
175
+ </div>
176
+ <div v-if="timeRange" style="border-top: 1px dashed #ebebeb;">
177
+ <el-time-picker
178
+ is-range
179
+ v-model="timeRangeValue"
180
+ range-separator="至"
181
+ start-placeholder="开始时间"
182
+ end-placeholder="结束时间"
183
+ placeholder="选择时间范围"
184
+ style="margin: 10px 16px;width: 80%"
185
+
186
+ :editable=false
187
+ >
188
+ </el-time-picker>
189
+ <span @click="quedingClick(bianliangId)" ><i class="el-icon-success" style="color: #409eff;font-size: 32px;text-align: center;vertical-align: middle;cursor: pointer"></i></span>
190
+
191
+ </div>
192
+ <div v-if="dateTimeRange" style="border-top: 1px dashed #ebebeb;display: flex">
193
+ &lt;!&ndash; <el-date-picker
194
+ v-model="dateTimeValue"
195
+ type="datetimerange"
196
+ range-separator="至"
197
+ start-placeholder="开始日期"
198
+ end-placeholder="结束日期"
199
+ style="width: 80%;margin: 10px 16px"
200
+ :editable=false
201
+
202
+
203
+ >
204
+ </el-date-picker>&ndash;&gt;
205
+ <div style="width: 90%">
206
+ <van-field
207
+ readonly
208
+ clickable
209
+ name="datetimePicker"
210
+ :value=dateTimeValue[0]
211
+ label='选择时间'
212
+ placeholder="点击选择开始日期时间"
213
+ @click="showDateTimePicker=true"
214
+ />
215
+ <van-popup v-model="showDateTimePicker" position="bottom">
216
+ <van-datetime-picker
217
+ v-model="currentDate"
218
+ type="datetime"
219
+ title="选择开始日期时间"
220
+ @confirm="onConfirmDateTime($event)"
221
+ @cancel="showDateTimePicker = false"
222
+ :min-date="minDate"
223
+ :formatter="formatter"
224
+ />
225
+ </van-popup>
226
+ <van-field
227
+ readonly
228
+ clickable
229
+ name="datetimePicker"
230
+ :value=dateTimeValue1[0]
231
+ label=" "
232
+ placeholder="点击选择结束日期时间"
233
+ @click="showDateTimePicker1=true"
234
+ />
235
+ <van-popup v-model="showDateTimePicker1" position="bottom">
236
+ <van-datetime-picker
237
+ v-model="currentDate"
238
+ type="datetime"
239
+ title="选择结束日期时间"
240
+ @confirm="onConfirmDateTime1($event)"
241
+ @cancel="showDateTimePicker1 = false"
242
+ :min-date="minDate"
243
+ :formatter="formatter"
244
+ />
245
+ </van-popup>
246
+ </div>
247
+
248
+ <span @click="quedingClick(bianliangId)" ><i class="el-icon-success" style="color: #409eff;font-size: 32px;text-align: center;vertical-align: middle;cursor: pointer"></i></span>
249
+ </div>-->
250
+ </div>
251
+ </div>
252
+ </div>
253
+ </template>
254
+
255
+ <script>
256
+ /*import $ from 'jquery'*/
257
+ export default {
258
+ name: 'TextMessage',
259
+ data(){
260
+ return{
261
+ show:false,
262
+ single:false,
263
+ date:false,
264
+ time:false,
265
+ dateTime:false,
266
+ dateRange:false,
267
+ timeRange:false,
268
+ input:'',
269
+ bianliangId:'',
270
+ dateValue:'',
271
+ message:[{content:'王亚欣',type:'SINGLE',value:'',id:1},{content:['2020-11-18T07:25:16.000+0000','2020-11-21T07:25:16.000+0000'],type:'DATE-RANGE',value:'',id:2},{content:'2020-11-18T07:25:16.000+0000',type:'TIME',value:'',id:3},{content:'2020-11-18T07:25:16.000+0000',type:'DATE',value:'',id:4},{content:['2020-11-18T07:25:16.000+0000','2020-11-21T07:25:16.000+0000'],type:'DATERANGE',value:'',id:5},{content:['2020-11-18T08:25:16.000+0000','2020-11-21T07:25:16.000+0000'],type:'TIMERANGE',value:'',id:6},],
272
+ isPhone:false,
273
+ isCompany:false,
274
+ dateTimeValue:'',
275
+ timeValue:'',
276
+ dateRangeValue:'',
277
+ dateRangeValues:'',
278
+ timeRangeValue:[],
279
+ dateTimeValue1:[],
280
+ test:0,
281
+ currentDate:new Date(),
282
+ minDate: new Date(2020, 0, 1),
283
+ showDateTimePicker1:false,
284
+ showDateTimePicker:false,
285
+ values:[],
286
+ checkValue:'',
287
+ disableds:false,
288
+ submitValue:'确认',
289
+ dateInnerText:'',
290
+ defaultDate:'',
291
+ showTimePicker:false,
292
+
293
+ }
294
+ },
295
+ props:{
296
+ text:{
297
+ type:Object,
298
+ default(){
299
+ return {}
300
+ }
301
+ },
302
+ type:String,
303
+ disable:Boolean,
304
+ submit:Boolean,
305
+ language:{
306
+ type:String,
307
+ default:"cn"
308
+ }
309
+ },
310
+ mounted() {
311
+ this.isMobile()
312
+ let span=this.$el
313
+ let defaults=span.getElementsByClassName('ask-component-placeholder-span')
314
+ for (let i=0;i<defaults.length;i++)
315
+ {
316
+ this.values.push({})
317
+ this.values[i]['key']=defaults[i].getAttribute('data')
318
+ this.values[i]['value']=defaults[i].innerText
319
+ this.values[i]['type']=defaults[i].getAttribute('type')
320
+ }
321
+ let text=this.$el
322
+ let test=text.getElementsByClassName('ask-component-placeholder-span')
323
+ let cpntain=text.getElementsByClassName('ask-component-placeholder-container')
324
+ let icon=text.getElementsByClassName('arsenalkebianji')
325
+ for (let i=0;i<icon.length;i++)
326
+ {
327
+ icon[i].style.color='#366aff'
328
+ }
329
+ for (let i=0;i<cpntain.length;i++)
330
+ {
331
+ if(this.type)
332
+ {
333
+ cpntain[i].style.paddingRight=0.2+'rem'
334
+ cpntain[i].style.paddingLeft=0.2+'rem'
335
+ }
336
+ else
337
+ {
338
+ cpntain[i].style.paddingRight=4+'px'
339
+ cpntain[i].style.paddingLeft=4+'px'
340
+ }
341
+
342
+ }
343
+ for (let i=0;i<test.length;i++)
344
+ {
345
+ if(test[i].getAttribute('type')==='DATE_PICKER')
346
+ {
347
+ let date=Number(test[i].innerText)*1000
348
+ test[i].innerText=new Date(date).Format("MM-dd")
349
+ }
350
+ if(test[i].getAttribute('type')==='TIME_PICKER')
351
+ {
352
+ let time=Number(test[i].innerText)*1000
353
+ test[i].innerText=new Date(time).Format("hh:mm")
354
+ }
355
+ if(test[i].getAttribute('type') === 'DATE_TIME_PICKER'){
356
+ let time=Number(test[i].innerText)*1000
357
+ test[i].innerText=new Date(time).Format("yyyy-MM-dd hh:mm")
358
+ }
359
+ }
360
+ },
361
+ beforeMount() {
362
+ this.$i18n.locale = this.language;
363
+ if(this.disable===true)
364
+ {
365
+ this.disableds=true
366
+
367
+ }
368
+ else
369
+ {
370
+ this.disableds=false
371
+
372
+ }
373
+ if(this.submit===true)
374
+ {
375
+ this.submitValue=this.$t('common.confirmed')
376
+ }
377
+ else
378
+ {
379
+ this.submitValue=this.$t('common.confirm')
380
+ }
381
+ },
382
+ methods:{
383
+ dataclick(){
384
+ if(this.checkValue.getAttribute('type') === 'DATE_PICKER')
385
+ {
386
+ for (let i=0;i<this.values.length;i++)
387
+ {
388
+ if(this.values[i].key === this.checkValue.getAttribute('data'))
389
+ {
390
+ if(this.dateValue!=='')
391
+ {
392
+ this.checkValue.innerText=new Date(this.dateValue).Format('MM-dd')
393
+ this.values[i].value=new Date(this.dateValue).getTime()
394
+ }
395
+ else
396
+ {
397
+ this.values[i].value=this.checkValue.innerText
398
+ }
399
+ }
400
+ }
401
+ }
402
+ if(this.checkValue.getAttribute('type') === 'TIME_PICKER')
403
+ {
404
+ for (let i=0;i<this.values.length;i++)
405
+ {
406
+ if(this.values[i].key === this.checkValue.getAttribute('data') )
407
+ {
408
+ if(this.timeValue!=='')
409
+ {
410
+
411
+ this.checkValue.innerText=new Date(this.timeValue).Format('hh:mm')
412
+ this.values[i].value=new Date(this.timeValue).getTime()
413
+ }
414
+ else
415
+ {
416
+ this.values[i].value=this.checkValue.innerText
417
+ }
418
+ }
419
+ }
420
+ }
421
+ if(this.checkValue.getAttribute('type') === 'DATE_TIME_PICKER')
422
+ {
423
+ for (let i=0;i<this.values.length;i++)
424
+ {
425
+ if(this.values[i].key === this.checkValue.getAttribute('data') )
426
+ {
427
+ if(this.dateTimeValue!=='')
428
+ {
429
+
430
+ this.checkValue.innerText=new Date(this.dateTimeValue).Format('yyyy-MM-dd hh:mm')
431
+ this.values[i].value=new Date(this.dateTimeValue).getTime()
432
+ }
433
+ else
434
+ {
435
+ this.values[i].value=this.checkValue.innerText
436
+ }
437
+ }
438
+ }
439
+ }
440
+ },
441
+ clickClick(e){
442
+ if(e.target.onclick!==null)
443
+ {
444
+ let that=this
445
+ window._askEditValue=that._askEditValue;
446
+ }
447
+ },
448
+ _askEditValue(a,b){
449
+ let type=b.getAttribute('type')
450
+ this.checkValue=b
451
+ if(type === 'INPUT')
452
+ {
453
+ this.single=true
454
+ this.date=false
455
+ this.time=false
456
+ this.dateTime=false
457
+ this.input= b.innerText
458
+ }
459
+ if(type === 'DATE_PICKER')
460
+ {
461
+ this.single=false
462
+ this.date=true
463
+ this.time=false
464
+ this.dateTime=false
465
+ this.show=true
466
+ for (let i=0;i<this.values.length;i++)
467
+ {
468
+ if(b.getAttribute('data') === this.values[i].key)
469
+ {
470
+ if(typeof this.values[i].value == 'string')
471
+ {
472
+ this.dateInnerText=Number(this.values[i].value)*1000
473
+ }
474
+ else
475
+ {
476
+ this.dateInnerText=Number(this.values[i].value)
477
+ }
478
+ this.dateValue=new Date(this.dateInnerText).Format("yyyy:MM-dd")
479
+ this.defaultDate=new Date(this.dateInnerText)
480
+ }
481
+ return
482
+ }
483
+
484
+ }
485
+ if(type === 'TIME_PICKER')
486
+ {
487
+ this.single=false
488
+ this.date=false
489
+ this.time=true
490
+ this.dateTime=false
491
+ this.showTimePicker=true
492
+ for (let i=0;i<this.values.length;i++)
493
+ {
494
+ if(b.getAttribute('data') === this.values[i].key)
495
+ {
496
+ let time
497
+ if(typeof this.values[i].value == 'string'){
498
+ time=Number(this.values[i].value)*1000
499
+ }
500
+ else
501
+ {
502
+ time=Number(this.values[i].value)
503
+ }
504
+ if(this.isPhone ===true)
505
+ {
506
+ this.timeValue=new Date(time)
507
+ }
508
+ else
509
+ {
510
+ this.timeValue=new Date(time).Format("yyyy-MM-dd hh:mm")
511
+ }
512
+ }
513
+ }
514
+ }
515
+ if(type === 'DATE_TIME_PICKER')
516
+ {
517
+ this.single=false
518
+ this.date=false
519
+ this.time=false
520
+ this.dateTime=true
521
+ this.showDateTimePicker=true
522
+ for (let i=0;i<this.values.length;i++)
523
+ {
524
+ if(b.getAttribute('data') === this.values[i].key)
525
+ {
526
+ let time
527
+ if(typeof this.values[i].value == 'string'){
528
+ time=Number(this.values[i].value)*1000
529
+ }
530
+ else
531
+ {
532
+ time=Number(this.values[i].value)
533
+ }
534
+ if(this.isPhone===true)
535
+ {
536
+ this.dateTimeValue=new Date(time)
537
+ }
538
+ else
539
+ {
540
+ this.dateTimeValue=new Date(time).Format("yyyy-MM-dd hh:mm:ss")
541
+ }
542
+ }
543
+ }
544
+ }
545
+
546
+ },
547
+ formatter(type, value) {
548
+ // 格式化选择器日期
549
+ if (type === "year") {
550
+ return `${value}年`;
551
+ } else if (type === "month") {
552
+ return `${value}月`;
553
+ } else if (type === "day") {
554
+ return `${value}日`;
555
+ } else if (type === "hour") {
556
+ return `${value}时`;
557
+ } else if (type === "minute") {
558
+ return `${value}分`;
559
+ }
560
+ return value;
561
+ },
562
+ //提交按钮
563
+ submitClick(){
564
+ this.single=false
565
+ this.date=false
566
+ this.time=false
567
+ this.dateTime=false
568
+ let infomation={}
569
+ let obj = {}
570
+ this.values.map(item => {
571
+ obj[item.key] = item
572
+ })
573
+ let result = Object.values(obj)
574
+ let text=this.$el
575
+ let test=text.getElementsByClassName('ask-component-placeholder-span')
576
+ for (let i=0;i<test.length;i++)
577
+ {
578
+ if(test[i].getAttribute('type')==='DATE_PICKER')
579
+ {
580
+ if(test[i].getAttribute('data')===result[i].key)
581
+ {
582
+ if(typeof result[i].value =='number'){
583
+ result[i].value/=1000
584
+ let resu=String(result[i].value)
585
+ result[i].value=resu
586
+ }
587
+ }
588
+ }
589
+ if(test[i].getAttribute('type')==='TIME_PICKER')
590
+ {
591
+ if(test[i].getAttribute('data')===result[i].key)
592
+ {
593
+ if(typeof result[i].value =='number')
594
+ {
595
+ result[i].value/=1000
596
+ let resu=String(result[i].value)
597
+ result[i].value=resu
598
+ }
599
+ }
600
+ }
601
+ if(test[i].getAttribute('type')==='DATE_TIME_PICKER')
602
+ {
603
+ if(test[i].getAttribute('data')===result[i].key)
604
+ {
605
+ if(typeof result[i].value =='number')
606
+ {
607
+ result[i].value/=1000
608
+ let resu=String(result[i].value)
609
+ result[i].value=resu
610
+ }
611
+ }
612
+ }
613
+ }
614
+ infomation['values']=result
615
+ infomation['goToAction']=this.text.goToAction
616
+ let innerhtml=this.$el
617
+ infomation['template']=innerhtml.querySelector('#html').innerHTML
618
+ infomation['apiKey']=this.text.apiKey
619
+ this.$emit('submitClick',infomation,this.text.apiKey)
620
+ this.submitValue=this.$t('common.confirmed')
621
+ this.disableds=true
622
+ },
623
+ addZero(i){
624
+ if (i<10) {
625
+ i="0" + i;
626
+ }
627
+ return i;
628
+ },
629
+ formatDate(date) {
630
+ if(typeof date == 'object')
631
+ {
632
+ const dateTime = new Date(date[0])
633
+ const dateTime1=new Date(date[1])
634
+ return `${dateTime.getMonth() + 1}月${dateTime.getDate()}日 ${this.addZero(dateTime.getHours())} : ${this.addZero(dateTime.getMinutes())} - ${dateTime1.getMonth() + 1}月${dateTime1.getDate()}日 ${this.addZero(dateTime1.getHours())} : ${this.addZero(dateTime1.getMinutes())}`;
635
+ }
636
+ else
637
+ {
638
+ const dateTime = new Date(date)
639
+ return `${dateTime.getMonth() + 1}月${dateTime.getDate()}日`;
640
+ }
641
+
642
+ },
643
+ //格式成时间
644
+ formatDate1(date){
645
+ const dateTime = new Date(date)
646
+ return `${this.addZero(dateTime.getHours())}:${this.addZero(dateTime.getMinutes())}`;
647
+ },
648
+ //格式成日期
649
+ formatDate2(date){
650
+ const dateTime = new Date(date)
651
+ return `${dateTime.getMonth() + 1} - ${dateTime.getDate()}`;
652
+ },
653
+ //日期范围
654
+ formatDate3(date){
655
+ const dateTime = new Date(date[0])
656
+ const dateTime1=new Date(date[1])
657
+ return `${dateTime.getMonth() + 1}月 ${dateTime.getDate()}日 - ${dateTime1.getMonth() + 1}月 ${dateTime1.getDate()}日`;
658
+ },
659
+ //时间范围
660
+ formatDate4(date){
661
+ const dateTime = new Date(date[0])
662
+ const dateTime1=new Date(date[1])
663
+ return `${dateTime.getHours()}: ${dateTime.getMinutes()} - ${dateTime1.getHours()}: ${dateTime1.getMinutes()}`;
664
+ },
665
+ testClick(value){
666
+ if(this.checkValue.getAttribute('type') === 'INPUT')
667
+ {
668
+ for (let i=0;i<this.values.length;i++)
669
+ {
670
+ if(this.values[i].key === this.checkValue.getAttribute('data') )
671
+ {
672
+ this.checkValue.innerText=value
673
+ this.values[i].value=this.checkValue.innerText
674
+ }
675
+ }
676
+ }
677
+ },
678
+ inputBlur(){
679
+ console.debug('inputBlur')
680
+ this.single=false
681
+ },
682
+ quedingClick(){
683
+ if(this.checkValue.getAttribute('type') === 'INPUT')
684
+ {
685
+ for (let i=0;i<this.values.length;i++)
686
+ {
687
+ if(this.values[i].key === this.checkValue.getAttribute('data') )
688
+ {
689
+ if(this.input!=='')
690
+ {
691
+ this.checkValue.innerText=this.input
692
+ }
693
+ this.values[i].value=this.checkValue.innerText
694
+ }
695
+ }
696
+ this.single = false
697
+ this.input=''
698
+ }
699
+ if(this.checkValue.getAttribute('type') === 'DATE_PICKER')
700
+
701
+ {
702
+ for (let i=0;i<this.values.length;i++)
703
+ {
704
+ if(this.values[i].key === this.checkValue.getAttribute('data'))
705
+ {
706
+ if(this.dateValue!=='')
707
+ {
708
+ this.checkValue.innerText=new Date(this.dateValue).Format('MM-dd')
709
+ this.values[i].value=new Date(this.dateValue).getTime()
710
+ }
711
+ else
712
+ {
713
+ this.values[i].value=this.checkValue.innerText
714
+ }
715
+ }
716
+ }
717
+ this.date = false
718
+ this.dateValue=''
719
+ }
720
+ if(this.checkValue.getAttribute('type') === 'TIME_PICKER')
721
+ {
722
+ for (let i=0;i<this.values.length;i++)
723
+ {
724
+ if(this.values[i].key === this.checkValue.getAttribute('data') )
725
+ {
726
+ if(this.timeValue!=='')
727
+ {
728
+
729
+ this.checkValue.innerText=new Date(this.timeValue).Format('hh:mm')
730
+ this.values[i].value=new Date(this.timeValue).getTime()
731
+ }
732
+ else
733
+ {
734
+ this.values[i].value=this.checkValue.innerText
735
+ }
736
+ }
737
+ }
738
+ this.time = false
739
+ this.timeValue=''
740
+ }
741
+ if(this.checkValue.getAttribute('type') === 'DATE_TIME_PICKER')
742
+ {
743
+ for (let i=0;i<this.values.length;i++)
744
+ {
745
+ if(this.values[i].key === this.checkValue.getAttribute('data') )
746
+ {
747
+ if(this.dateTimeValue!=='')
748
+ {
749
+
750
+ this.checkValue.innerText=new Date(this.dateTimeValue).Format('yyyy-MM-dd hh:mm')
751
+ this.values[i].value=new Date(this.dateTimeValue).getTime()
752
+ }
753
+ else
754
+ {
755
+ this.values[i].value=this.checkValue.innerText
756
+ }
757
+ }
758
+ }
759
+ this.dateTime = false
760
+ this.dateTimeValue=''
761
+ }
762
+
763
+ },
764
+ isMobile() {
765
+ 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);
766
+ if (flag) {
767
+ this.isPhone=true
768
+ }
769
+ else
770
+ {
771
+ this.isCompany=true
772
+
773
+ }
774
+ },
775
+ onConfirmDateTime(){
776
+ if(this.checkValue.getAttribute('type') === 'DATE_TIME_PICKER')
777
+ {
778
+ for (let i=0;i<this.values.length;i++)
779
+ {
780
+ if(this.values[i].key === this.checkValue.getAttribute('data') )
781
+ {
782
+ if(this.dateTimeValue!=='')
783
+ {
784
+
785
+ this.checkValue.innerText=new Date(this.dateTimeValue).Format('yyyy-MM-dd hh:mm')
786
+ this.values[i].value=new Date(this.dateTimeValue).getTime()
787
+ }
788
+ else
789
+ {
790
+ this.values[i].value=this.checkValue.innerText
791
+ }
792
+ }
793
+ }
794
+ }
795
+ this.showDateTimePicker = false;
796
+ },
797
+
798
+ onConfirm(date) {
799
+ this.show = false;
800
+ if(this.checkValue.getAttribute('type') === 'DATE_PICKER')
801
+
802
+ {
803
+ for (let i=0;i<this.values.length;i++)
804
+ {
805
+ if(this.values[i].key === this.checkValue.getAttribute('data'))
806
+ {
807
+ if(date!=='')
808
+ {
809
+ this.checkValue.innerText=new Date(date).Format('MM-dd')
810
+ this.values[i].value=new Date(date).getTime()
811
+ }
812
+ else
813
+ {
814
+ this.values[i].value=this.checkValue.innerText
815
+ }
816
+ }
817
+ }
818
+ this.date = false
819
+ this.dateValue=''
820
+ }
821
+
822
+ },
823
+ onConfirmTime(){
824
+ this.showTimePicker=false
825
+ if(this.checkValue.getAttribute('type') === 'TIME_PICKER')
826
+ {
827
+ for (let i=0;i<this.values.length;i++)
828
+ {
829
+ if(this.values[i].key === this.checkValue.getAttribute('data') )
830
+ {
831
+ if(this.timeValue!=='')
832
+ {
833
+
834
+ this.checkValue.innerText=new Date(this.timeValue).Format('hh:mm')
835
+ this.values[i].value=new Date(this.timeValue).getTime()
836
+ }
837
+ else
838
+ {
839
+ this.values[i].value=this.checkValue.innerText
840
+ }
841
+ }
842
+ }
843
+ }
844
+ }
845
+ }
846
+ }
847
+ </script>
848
+
849
+
850
+ <style lang="less">
851
+ @import "../../assets/less/common.css";
852
+ #textMessage{
853
+ min-width: 200px;
854
+ .editMessage{
855
+ display: flex;
856
+ justify-content: space-between;
857
+ margin-top: 10px;
858
+ border-top: 1px dashed #ebebeb;
859
+ }
860
+ #submit{
861
+ margin-top: 10px;
862
+ display: flex;
863
+ align-items: center;
864
+ justify-content: center;
865
+ .el-button{
866
+ border: 1px solid #BBCDFF;
867
+ border-radius: 14px;
868
+ background-color: white;
869
+ color: #366aff;
870
+ font-weight: 400;
871
+ }
872
+ .el-button--small{
873
+ padding: 9px 30px;
874
+ font-size: 1em;
875
+ }
876
+ }
877
+ #html{
878
+ p{
879
+ color:#A9B3C6;
880
+ }
881
+ .ask-component-placeholder-icon{
882
+ padding-left: 12px;
883
+ color: #366aff;
884
+ font-size: 18px;
885
+ }
886
+ .ask-component-placeholder-span{
887
+ color: #616161!important;
888
+ }
889
+ }
890
+ }
891
+ .remPhoneClass{
892
+ margin: 0 auto;
893
+ /*width: 80vw;*/
894
+ .inputClass{
895
+ margin-top: 8px;
896
+ width: 100%;
897
+ .el-input__inner{
898
+ border-radius: 9px;
899
+ }
900
+ }
901
+ .htmlClass{
902
+ padding: 4px 0;
903
+ }
904
+
905
+ }
906
+ .remCompanyClass{
907
+
908
+ margin: 0 auto;
909
+ /*width: 300px;*/
910
+ .inputClass{
911
+ padding: 10px 0 10px 0;
912
+ width: 100%;
913
+ .el-input__inner{
914
+ border-radius: 9px;
915
+ }
916
+ }
917
+
918
+
919
+ }
920
+ .van-cell::after{
921
+ content: none!important;
922
+ }
923
+ i{
924
+ cursor: pointer;
925
+ }
926
+ .notClickClass{
927
+ pointer-events: none;
928
+ }
929
+ </style>