cnhis-design-vue 2.0.10 → 2.0.13
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.
- package/CHANGELOG.md +33 -5
- package/es/age/index.js +2 -2
- package/es/big-table/index.js +23 -23
- package/es/button/index.js +2 -2
- package/es/captcha/index.js +3 -3
- package/es/checkbox/index.js +1 -1
- package/es/color-picker/index.js +1 -1
- package/es/drag-layout/index.js +3 -3
- package/es/editor/index.js +1 -1
- package/es/fabric-chart/index.js +66 -35
- package/es/form-table/index.js +17 -17
- package/es/index/index.js +876 -660
- package/es/index/style.css +1 -1
- package/es/input/index.js +1 -1
- package/es/map/index.js +1 -1
- package/es/multi-chat/index.js +91 -76
- package/es/multi-chat/style.css +1 -1
- package/es/multi-chat-client/index.js +57 -43
- package/es/multi-chat-client/style.css +1 -1
- package/es/multi-chat-history/index.js +4 -4
- package/es/multi-chat-record/index.js +4 -4
- package/es/multi-chat-setting/index.js +166 -95
- package/es/multi-chat-setting/style.css +1 -1
- package/es/multi-chat-sip/index.js +1 -1
- package/es/radio/index.js +1 -1
- package/es/scale-view/index.js +406 -337
- package/es/scale-view/style.css +1 -1
- package/es/select/index.js +3 -3
- package/es/select-label/index.js +3 -3
- package/es/select-person/index.js +76 -39
- package/es/select-person/style.css +1 -1
- package/es/table-filter/index.js +21 -21
- package/es/tag/index.js +1 -1
- package/es/utils/index.js +24 -2
- package/es/verification-code/index.js +2 -2
- package/package.json +1 -1
- package/packages/fabric-chart/src/fabric-chart/FabricPolylines.vue +2 -2
- package/packages/fabric-chart/src/fabric-chart/FabricTextGroup.vue +8 -7
- package/packages/fabric-chart/src/mixins/draw.js +18 -0
- package/packages/multi-chat/chat/chatFooter.vue +11 -2
- package/packages/multi-chat/chat/index.vue +3 -2
- package/packages/multi-chat/chat/scrollList.vue +3 -1
- package/packages/multi-chat/setting/baseInfo/index.vue +55 -1
- package/packages/multi-chat/store/getters.js +3 -0
- package/packages/multi-chat/store/mutation.js +3 -0
- package/packages/multi-chat/store/state.js +1 -0
- package/packages/scale-view/formitem/r-choice.vue +110 -95
- package/packages/scale-view/scaleView.vue +334 -369
- package/packages/select-person/select-person.vue +26 -12
- package/src/utils/index.js +15 -0
|
@@ -18,17 +18,17 @@
|
|
|
18
18
|
></evaluatePage>
|
|
19
19
|
<template v-else>
|
|
20
20
|
<evaluateCountdown
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
21
|
+
v-if="showEvaluateCoundownPage"
|
|
22
|
+
ref="evaluateCountdown"
|
|
23
|
+
:formArray="formArray"
|
|
24
|
+
:evaluateResultConfig="config.evaluateResultConfig"
|
|
25
|
+
:evaluateResultSetting="config.evaluateResultSetting"
|
|
26
|
+
:form="form"
|
|
27
|
+
:isFinished="isFinished"
|
|
28
|
+
:currentTime="currentTime"
|
|
29
|
+
:showEvaluateCountdown="showEvaluateCountdown"
|
|
30
|
+
@closeEvaluateCountdown="closeEvaluateCountdown"
|
|
31
|
+
></evaluateCountdown>
|
|
32
32
|
<div
|
|
33
33
|
class="scale-container"
|
|
34
34
|
:class="{ 'scale-container-nopadding': handlePageClass }"
|
|
@@ -36,18 +36,24 @@
|
|
|
36
36
|
>
|
|
37
37
|
<div class="totalScore-warp" v-if="hasScore">
|
|
38
38
|
<div>
|
|
39
|
-
|
|
39
|
+
测评总分:
|
|
40
|
+
<span>{{ maxScore }}分</span>
|
|
40
41
|
</div>
|
|
41
42
|
<div>
|
|
42
|
-
|
|
43
|
+
测评分数:
|
|
44
|
+
<span :style="{ color: getEvaResColor }">{{ config.totalScore }}分</span>
|
|
43
45
|
</div>
|
|
44
46
|
<template v-if="hasEvaluateSetting">
|
|
45
47
|
<div>
|
|
46
48
|
测评结果:
|
|
47
|
-
<span
|
|
49
|
+
<span
|
|
50
|
+
class="score-result"
|
|
51
|
+
:style="{ color: getEvaResColor }"
|
|
52
|
+
>{{ config.evaluateResult }}</span>
|
|
48
53
|
</div>
|
|
49
54
|
<div>
|
|
50
|
-
|
|
55
|
+
结果说明:
|
|
56
|
+
<span>{{ config.evaluateResultExplain }}</span>
|
|
51
57
|
</div>
|
|
52
58
|
</template>
|
|
53
59
|
</div>
|
|
@@ -130,9 +136,10 @@
|
|
|
130
136
|
v-html="handleShowQuestionNumber(item)"
|
|
131
137
|
></span>
|
|
132
138
|
<span class="required-text" v-if="isFormBoldOpen(item)">(必填)</span>
|
|
133
|
-
<span
|
|
134
|
-
|
|
135
|
-
|
|
139
|
+
<span
|
|
140
|
+
class="evalute-label"
|
|
141
|
+
v-if="showEvaluateLabel(item)"
|
|
142
|
+
>{{ showEvaluateLabel(item) }}</span>
|
|
136
143
|
<template v-if="showEvatip(item)">
|
|
137
144
|
<span class="evalute-tip" @click="showEvaTipModal(item)">
|
|
138
145
|
<svg-icon icon-class="a-xitongtubiaotishi" />查看提示
|
|
@@ -260,52 +267,42 @@
|
|
|
260
267
|
</div>
|
|
261
268
|
</template>
|
|
262
269
|
<script>
|
|
263
|
-
import {
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
Spin,
|
|
270
|
-
FormModel,
|
|
271
|
-
Divider,
|
|
272
|
-
Button
|
|
273
|
-
} from "ant-design-vue";
|
|
274
|
-
import create from "@/core/create";
|
|
275
|
-
import { MyChoice, MyInput, MyAddress, MyUpload, MyTime, MyPrompt } from "./formitem";
|
|
276
|
-
import MapComp from "../map/src/popup-map";
|
|
277
|
-
import labelForm from "~/select-label/select-label";
|
|
278
|
-
import vodChunkUpload from "~/upload/chunk-upload/vod-chunk-upload.vue";
|
|
270
|
+
import { Icon, Checkbox, Tree, Tooltip, Input, Spin, FormModel, Divider, Button } from 'ant-design-vue';
|
|
271
|
+
import create from '@/core/create';
|
|
272
|
+
import { MyChoice, MyInput, MyAddress, MyUpload, MyTime, MyPrompt } from './formitem';
|
|
273
|
+
import MapComp from '../map/src/popup-map';
|
|
274
|
+
import labelForm from '~/select-label/select-label';
|
|
275
|
+
import vodChunkUpload from '~/upload/chunk-upload/vod-chunk-upload.vue';
|
|
279
276
|
// import { EventBus } from "@/common/utils/eventBus.js";
|
|
280
|
-
import { judgeTypes } from
|
|
281
|
-
import NoDataJs from
|
|
277
|
+
import { judgeTypes } from './mixin/judgeTypes';
|
|
278
|
+
import NoDataJs from './mixin/NoData';
|
|
282
279
|
// import { mapGetters } from "vuex";
|
|
283
|
-
import moment from
|
|
284
|
-
import utils from
|
|
285
|
-
import evaluatePage from
|
|
286
|
-
import evaluateCountdown from
|
|
287
|
-
import answerParse from
|
|
280
|
+
import moment from 'moment';
|
|
281
|
+
import utils from '@/utils/utils-map';
|
|
282
|
+
import evaluatePage from './evaluatePage.vue';
|
|
283
|
+
import evaluateCountdown from './evaluateCountdown.vue';
|
|
284
|
+
import answerParse from './answerParse.vue';
|
|
288
285
|
import vexutils from '@/utils/vexutils';
|
|
289
286
|
import NoData from './NoData.vue';
|
|
290
287
|
export default create({
|
|
291
|
-
name:
|
|
288
|
+
name: 'scale-view',
|
|
292
289
|
mixins: [judgeTypes, NoDataJs],
|
|
293
290
|
props: {
|
|
294
291
|
ids: {
|
|
295
292
|
type: Object,
|
|
296
293
|
default: () => {
|
|
297
|
-
return { guage_id:
|
|
294
|
+
return { guage_id: '', db_id: undefined };
|
|
298
295
|
}
|
|
299
296
|
},
|
|
300
297
|
params: { default: () => ({}), type: Object },
|
|
301
298
|
guageData: { type: Object, default: () => ({}) },
|
|
302
299
|
noBtn: { type: Boolean, default: false },
|
|
303
300
|
hideBtn: { type: Boolean, default: false },
|
|
304
|
-
source: { type: String, default:
|
|
301
|
+
source: { type: String, default: '' },
|
|
305
302
|
isLock: { type: Boolean, default: false },
|
|
306
303
|
type: {
|
|
307
304
|
type: String,
|
|
308
|
-
default:
|
|
305
|
+
default: ''
|
|
309
306
|
},
|
|
310
307
|
styleSetting: {
|
|
311
308
|
type: Object,
|
|
@@ -321,7 +318,7 @@ export default create({
|
|
|
321
318
|
extrasmall: 0.9
|
|
322
319
|
})
|
|
323
320
|
},
|
|
324
|
-
openType: { type: String, default:
|
|
321
|
+
openType: { type: String, default: '' },
|
|
325
322
|
scaleApiConfig: {
|
|
326
323
|
type: Object,
|
|
327
324
|
default: () => ({})
|
|
@@ -364,14 +361,10 @@ export default create({
|
|
|
364
361
|
};
|
|
365
362
|
},
|
|
366
363
|
isFormBoldOpen() {
|
|
367
|
-
return function(item) {
|
|
364
|
+
return function (item) {
|
|
368
365
|
let res = item.required;
|
|
369
366
|
// 量表未登录时 判断 url中是否有 formBoldOpen
|
|
370
|
-
if (
|
|
371
|
-
!this.styleSetting ||
|
|
372
|
-
!Object.keys(this.styleSetting).length ||
|
|
373
|
-
!("formBoldOpen" in this.styleSetting)
|
|
374
|
-
) {
|
|
367
|
+
if (!this.styleSetting || !Object.keys(this.styleSetting).length || !('formBoldOpen' in this.styleSetting)) {
|
|
375
368
|
return res && this.queryformBoldOpen;
|
|
376
369
|
}
|
|
377
370
|
return res && this.styleSetting.formBoldOpen;
|
|
@@ -379,11 +372,11 @@ export default create({
|
|
|
379
372
|
},
|
|
380
373
|
scaleStyle() {
|
|
381
374
|
let fontSize = this.fontSize;
|
|
382
|
-
if (!fontSize || fontSize ===
|
|
375
|
+
if (!fontSize || fontSize === 'S') return null;
|
|
383
376
|
const keyValue = {
|
|
384
|
-
L:
|
|
385
|
-
M:
|
|
386
|
-
XS:
|
|
377
|
+
L: 'large',
|
|
378
|
+
M: 'medium',
|
|
379
|
+
XS: 'extrasmall'
|
|
387
380
|
};
|
|
388
381
|
fontSize = keyValue[fontSize];
|
|
389
382
|
const scale = (fontSize && this.fontSizeObj[fontSize]) || 1;
|
|
@@ -396,7 +389,7 @@ export default create({
|
|
|
396
389
|
};
|
|
397
390
|
},
|
|
398
391
|
handlePageClass() {
|
|
399
|
-
if (this.type ==
|
|
392
|
+
if (this.type == 'customList' && !this.noBtn) return false;
|
|
400
393
|
if (!this.noBtn && !this.hideBtn) return false;
|
|
401
394
|
return true;
|
|
402
395
|
},
|
|
@@ -404,14 +397,11 @@ export default create({
|
|
|
404
397
|
return item => this.showEvent(item);
|
|
405
398
|
},
|
|
406
399
|
handleShowQuestionNumber() {
|
|
407
|
-
return function(item) {
|
|
400
|
+
return function (item) {
|
|
408
401
|
let { type } = item || {};
|
|
409
|
-
let tempTile =
|
|
410
|
-
this.config?.autoQuestionNumber === false
|
|
411
|
-
? item.showTitle
|
|
412
|
-
: `${item.softcode}、${item.showTitle}`;
|
|
402
|
+
let tempTile = this.config?.autoQuestionNumber === false ? item.showTitle : `${item.softcode}、${item.showTitle}`;
|
|
413
403
|
if (!this.isEvaluation(type)) return tempTile;
|
|
414
|
-
|
|
404
|
+
|
|
415
405
|
let score = this.handleEvaluationScore(item);
|
|
416
406
|
return `${tempTile} <span style="color:#2d7aff;">${score}</span>`;
|
|
417
407
|
// if (this.noBtn) {
|
|
@@ -431,7 +421,7 @@ export default create({
|
|
|
431
421
|
hasScore() {
|
|
432
422
|
let { config } = this;
|
|
433
423
|
if (!config || !Object.keys(config).length) return false;
|
|
434
|
-
if (
|
|
424
|
+
if ('totalScore' in config) return true;
|
|
435
425
|
return false;
|
|
436
426
|
},
|
|
437
427
|
// 预览按钮打开的量表页面
|
|
@@ -442,11 +432,11 @@ export default create({
|
|
|
442
432
|
hasEvaluateSetting() {
|
|
443
433
|
let { config } = this;
|
|
444
434
|
if (!config || !Object.keys(config).length) return false;
|
|
445
|
-
if (
|
|
435
|
+
if ('evaluateResult' in config && config.evaluateResult) return true;
|
|
446
436
|
return false;
|
|
447
437
|
},
|
|
448
438
|
getTimeValue() {
|
|
449
|
-
return function(item) {
|
|
439
|
+
return function (item) {
|
|
450
440
|
let value = this.form[this.formKey(item)];
|
|
451
441
|
return value;
|
|
452
442
|
};
|
|
@@ -457,25 +447,11 @@ export default create({
|
|
|
457
447
|
// 有evaluateResultSetting || url中含有固定参数
|
|
458
448
|
// 倒计时未结束
|
|
459
449
|
// 未填写过
|
|
460
|
-
return
|
|
461
|
-
!this.isPreviewScale &&
|
|
462
|
-
this.showEvaluatePage &&
|
|
463
|
-
this.showEvaluateSettingWrap &&
|
|
464
|
-
!this.isFinished &&
|
|
465
|
-
!this.noBtn &&
|
|
466
|
-
!this.hideBtn
|
|
467
|
-
);
|
|
450
|
+
return !this.isPreviewScale && this.showEvaluatePage && this.showEvaluateSettingWrap && !this.isFinished && !this.noBtn && !this.hideBtn;
|
|
468
451
|
},
|
|
469
452
|
// 是否展示倒计时
|
|
470
453
|
showEvaluateCoundownPage() {
|
|
471
|
-
return
|
|
472
|
-
!this.isPreviewScale &&
|
|
473
|
-
!this.showEvaluateEntry &&
|
|
474
|
-
this.showEvaluateCountdownWrap &&
|
|
475
|
-
!this.isFinished &&
|
|
476
|
-
!this.noBtn &&
|
|
477
|
-
!this.hideBtn
|
|
478
|
-
);
|
|
454
|
+
return !this.isPreviewScale && !this.showEvaluateEntry && this.showEvaluateCountdownWrap && !this.isFinished && !this.noBtn && !this.hideBtn;
|
|
479
455
|
},
|
|
480
456
|
// 是否设置 evaluateResultSetting
|
|
481
457
|
hasEvaluateResultSetting() {
|
|
@@ -494,7 +470,7 @@ export default create({
|
|
|
494
470
|
// url中是否有默认值
|
|
495
471
|
hasDefault() {
|
|
496
472
|
let hash = window.location.hash;
|
|
497
|
-
let defaultVariable = [
|
|
473
|
+
let defaultVariable = ['evaname', 'evadesc', 'evast', 'evadur', 'evaan'];
|
|
498
474
|
let hasDefault = defaultVariable.find(item => hash.includes(item));
|
|
499
475
|
return this.paramsEvaluate || hasDefault;
|
|
500
476
|
},
|
|
@@ -515,56 +491,43 @@ export default create({
|
|
|
515
491
|
return this.hideBtn || this.isLock || this.isFinished;
|
|
516
492
|
},
|
|
517
493
|
showEvaluateLabel() {
|
|
518
|
-
return function(item) {
|
|
494
|
+
return function (item) {
|
|
519
495
|
let obj = {
|
|
520
|
-
EVALUATE_RADIO_BLOCK:
|
|
521
|
-
EVALUATE_CHECKBOX_BLOCK:
|
|
496
|
+
EVALUATE_RADIO_BLOCK: '单选题',
|
|
497
|
+
EVALUATE_CHECKBOX_BLOCK: '多选题'
|
|
522
498
|
};
|
|
523
499
|
return obj[item.type];
|
|
524
500
|
};
|
|
525
501
|
},
|
|
526
502
|
showAnswerParse() {
|
|
527
|
-
return function(item) {
|
|
528
|
-
let { evaluateAnswer, checkAnswerMode, evaluateStartTime, evaluateTime } =
|
|
529
|
-
|
|
530
|
-
let arr = [
|
|
531
|
-
"EVALUATE_RADIO_BLOCK",
|
|
532
|
-
"EVALUATE_CHECKBOX_BLOCK",
|
|
533
|
-
"EVALUATE_SELECT",
|
|
534
|
-
"EVALUATE_INPUT"
|
|
535
|
-
];
|
|
503
|
+
return function (item) {
|
|
504
|
+
let { evaluateAnswer, checkAnswerMode, evaluateStartTime, evaluateTime } = this.config?.evaluateResultSetting || {};
|
|
505
|
+
let arr = ['EVALUATE_RADIO_BLOCK', 'EVALUATE_CHECKBOX_BLOCK', 'EVALUATE_SELECT', 'EVALUATE_INPUT'];
|
|
536
506
|
let maxScore = item?.scoreConfigs || 0;
|
|
537
507
|
let isShow = evaluateAnswer && this.isFinished && arr.includes(item.type) && maxScore;
|
|
538
|
-
if (
|
|
539
|
-
!evaluateStartTime ||
|
|
540
|
-
!evaluateTime ||
|
|
541
|
-
(checkAnswerMode && checkAnswerMode == 1)
|
|
542
|
-
)
|
|
543
|
-
return isShow;
|
|
508
|
+
if (!evaluateStartTime || !evaluateTime || (checkAnswerMode && checkAnswerMode == 1)) return isShow;
|
|
544
509
|
if (!vexutils.isValidDate(new Date(evaluateStartTime))) return isShow;
|
|
545
510
|
// 答案解析时间 考试时间结束后
|
|
546
|
-
let endTime = moment(evaluateStartTime).add(evaluateTime,
|
|
547
|
-
let isRang = endTime.diff(moment(),
|
|
511
|
+
let endTime = moment(evaluateStartTime).add(evaluateTime, 'minutes');
|
|
512
|
+
let isRang = endTime.diff(moment(), 'seconds', true);
|
|
548
513
|
return isShow && isRang <= 0;
|
|
549
514
|
};
|
|
550
515
|
},
|
|
551
516
|
tipMsg() {
|
|
552
|
-
return this.type ===
|
|
517
|
+
return this.type === 'customList' ? '保存' : '提交';
|
|
553
518
|
},
|
|
554
519
|
formKey() {
|
|
555
|
-
return function(item) {
|
|
520
|
+
return function (item) {
|
|
556
521
|
return item.databaseTitle || item.title;
|
|
557
522
|
};
|
|
558
523
|
},
|
|
559
524
|
getEvaResColor() {
|
|
560
525
|
let { evaluateResultConfig = [], totalScore } = this.config || {};
|
|
561
526
|
totalScore = +totalScore || 0;
|
|
562
|
-
if (!evaluateResultConfig?.length || !totalScore) return
|
|
563
|
-
let matchItem = evaluateResultConfig.find(
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
if (!matchItem) return "#2474FF";
|
|
567
|
-
return matchItem.color || "#2474FF";
|
|
527
|
+
if (!evaluateResultConfig?.length || !totalScore) return '#2474FF';
|
|
528
|
+
let matchItem = evaluateResultConfig.find(item => item.startScore <= totalScore && totalScore <= item.endScore);
|
|
529
|
+
if (!matchItem) return '#2474FF';
|
|
530
|
+
return matchItem.color || '#2474FF';
|
|
568
531
|
}
|
|
569
532
|
},
|
|
570
533
|
watch: {
|
|
@@ -603,29 +566,22 @@ export default create({
|
|
|
603
566
|
},
|
|
604
567
|
data() {
|
|
605
568
|
return {
|
|
606
|
-
other:
|
|
569
|
+
other: '',
|
|
607
570
|
form: {},
|
|
608
571
|
submitForm: {},
|
|
609
572
|
rules: {},
|
|
610
573
|
config: {},
|
|
611
574
|
formArray: [],
|
|
612
575
|
mapVisible: false,
|
|
613
|
-
mapLocation:
|
|
576
|
+
mapLocation: '',
|
|
614
577
|
labelSelectedList: [],
|
|
615
578
|
defaultFormArray: [],
|
|
616
|
-
fontSize:
|
|
617
|
-
filterArr: [
|
|
618
|
-
"SUCCESS_TIP",
|
|
619
|
-
"CALLBACK_INTERFACE",
|
|
620
|
-
"SPREAD_PARAMS",
|
|
621
|
-
"REDIRECT",
|
|
622
|
-
"FRONT_ADDRESS",
|
|
623
|
-
"RETURN_PATH"
|
|
624
|
-
],
|
|
579
|
+
fontSize: '',
|
|
580
|
+
filterArr: ['SUCCESS_TIP', 'CALLBACK_INTERFACE', 'SPREAD_PARAMS', 'REDIRECT', 'FRONT_ADDRESS', 'RETURN_PATH'],
|
|
625
581
|
spinning: true,
|
|
626
582
|
indicator: <a-icon type="loading" style="font-size: 24px" spin />,
|
|
627
583
|
totalScore: undefined,
|
|
628
|
-
shareId:
|
|
584
|
+
shareId: '',
|
|
629
585
|
currentTime: moment(),
|
|
630
586
|
showEvaluatePage: false,
|
|
631
587
|
showEvaluateSettingWrap: true,
|
|
@@ -678,26 +634,26 @@ export default create({
|
|
|
678
634
|
if (data.isNotFilled) {
|
|
679
635
|
this.spinning = false;
|
|
680
636
|
this.hasFrontAddress = false;
|
|
681
|
-
this.setNoData(true, '未查询到量表填写记录')
|
|
637
|
+
this.setNoData(true, '未查询到量表填写记录');
|
|
682
638
|
return;
|
|
683
639
|
}
|
|
684
640
|
if (data.isLackCustomer) {
|
|
685
641
|
let _this = this;
|
|
686
642
|
// 校验用户环境
|
|
687
643
|
this.$info({
|
|
688
|
-
title:
|
|
689
|
-
content:
|
|
644
|
+
title: '已设置填写次数限制',
|
|
645
|
+
content: '请在包含用户信息的环境中打开此量表',
|
|
690
646
|
onOk() {
|
|
691
|
-
_this.$emit(
|
|
647
|
+
_this.$emit('onCloseSetting');
|
|
692
648
|
}
|
|
693
649
|
});
|
|
694
650
|
}
|
|
695
651
|
this.config = map;
|
|
696
652
|
|
|
697
|
-
if (
|
|
653
|
+
if ('evaluateResultConfig' in map && utils.isJSON(map.evaluateResultConfig)) {
|
|
698
654
|
this.config.evaluateResultConfig = JSON.parse(map.evaluateResultConfig);
|
|
699
655
|
}
|
|
700
|
-
if (
|
|
656
|
+
if ('evaluateResultSetting' in map && utils.isJSON(map.evaluateResultSetting)) {
|
|
701
657
|
this.config.evaluateResultSetting = JSON.parse(map.evaluateResultSetting);
|
|
702
658
|
// 随机测评
|
|
703
659
|
if (this.config?.randomId && this.config.evaluateResultSetting) {
|
|
@@ -728,7 +684,7 @@ export default create({
|
|
|
728
684
|
},
|
|
729
685
|
handleFrontAddress(list) {
|
|
730
686
|
if (!list || !list.length) return;
|
|
731
|
-
let matchItem = list.find(item => item.type ===
|
|
687
|
+
let matchItem = list.find(item => item.type === 'FRONT_ADDRESS');
|
|
732
688
|
if (!matchItem || !Object.keys(matchItem).length) return;
|
|
733
689
|
let setting;
|
|
734
690
|
if (matchItem.setting && utils.isJSON(matchItem.setting)) {
|
|
@@ -741,16 +697,16 @@ export default create({
|
|
|
741
697
|
let { frontAddress } = setting;
|
|
742
698
|
if (frontAddress) {
|
|
743
699
|
let urlHref = window.location.href;
|
|
744
|
-
let preStr =
|
|
745
|
-
if (frontAddress.includes(
|
|
746
|
-
preStr =
|
|
700
|
+
let preStr = '?';
|
|
701
|
+
if (frontAddress.includes('?')) {
|
|
702
|
+
preStr = '&';
|
|
747
703
|
}
|
|
748
704
|
let curUrl = `${frontAddress}${preStr}redirect_url=${encodeURIComponent(urlHref)}`;
|
|
749
705
|
return curUrl;
|
|
750
706
|
}
|
|
751
707
|
},
|
|
752
708
|
handleBtnParamsEvaluate(params) {
|
|
753
|
-
let defaultVariable = [
|
|
709
|
+
let defaultVariable = ['evaname', 'evadesc', 'evast', 'evadur', 'evaan'];
|
|
754
710
|
let res = {};
|
|
755
711
|
for (let key in params) {
|
|
756
712
|
let value = params[key];
|
|
@@ -772,49 +728,48 @@ export default create({
|
|
|
772
728
|
query = this.paramsEvaluate;
|
|
773
729
|
}
|
|
774
730
|
let obj = {
|
|
775
|
-
evaluateName:
|
|
776
|
-
evaluateExplain:
|
|
777
|
-
evaluateStartTime:
|
|
778
|
-
evaluateTime:
|
|
779
|
-
evaluateAnswer:
|
|
731
|
+
evaluateName: 'evaname',
|
|
732
|
+
evaluateExplain: 'evadesc',
|
|
733
|
+
evaluateStartTime: 'evast',
|
|
734
|
+
evaluateTime: 'evadur',
|
|
735
|
+
evaluateAnswer: 'evaan'
|
|
780
736
|
};
|
|
781
737
|
for (let key in evaluateResultSetting) {
|
|
782
738
|
let value = evaluateResultSetting[key];
|
|
783
|
-
let isParseKey =
|
|
784
|
-
value && key != "evaluateAnswer" && typeof value === "string" && value.includes("${");
|
|
739
|
+
let isParseKey = value && key != 'evaluateAnswer' && typeof value === 'string' && value.includes('${');
|
|
785
740
|
if (isParseKey) {
|
|
786
741
|
let parseValue = value.replace(/\$\{([^}]+)\}/g, (_v, $1) => {
|
|
787
742
|
let param;
|
|
788
|
-
if ($1.startsWith(
|
|
789
|
-
param = query[$1.split(
|
|
743
|
+
if ($1.startsWith('form.')) {
|
|
744
|
+
param = query[$1.split('.')[1]];
|
|
790
745
|
}
|
|
791
|
-
return param ||
|
|
746
|
+
return param || '';
|
|
792
747
|
});
|
|
793
748
|
this.$set(evaluateResultSetting, key, parseValue);
|
|
794
749
|
} else {
|
|
795
750
|
let val = query[obj[key]];
|
|
796
|
-
if (key ==
|
|
797
|
-
val = val ===
|
|
751
|
+
if (key == 'evaluateAnswer') {
|
|
752
|
+
val = val === 'true' || val == 1 ? true : false;
|
|
798
753
|
}
|
|
799
754
|
query[obj[key]] && this.$set(evaluateResultSetting, key, val);
|
|
800
755
|
}
|
|
801
756
|
}
|
|
802
757
|
// 部分evaluateResultSetting 但是却有url
|
|
803
758
|
if (this.hasDefault) {
|
|
804
|
-
let defaultVariable = [
|
|
759
|
+
let defaultVariable = ['evaname', 'evadesc', 'evast', 'evadur', 'evaan'];
|
|
805
760
|
let defObj = {
|
|
806
|
-
evaname:
|
|
807
|
-
evadesc:
|
|
808
|
-
evast:
|
|
809
|
-
evadur:
|
|
810
|
-
evaan:
|
|
761
|
+
evaname: 'evaluateName',
|
|
762
|
+
evadesc: 'evaluateExplain',
|
|
763
|
+
evast: 'evaluateStartTime',
|
|
764
|
+
evadur: 'evaluateTime',
|
|
765
|
+
evaan: 'evaluateAnswer'
|
|
811
766
|
};
|
|
812
767
|
defaultVariable.forEach(item => {
|
|
813
768
|
let key = defObj[item];
|
|
814
769
|
if (!evaluateResultSetting[key]) {
|
|
815
770
|
let val = query[item];
|
|
816
|
-
if (item ==
|
|
817
|
-
val = val ===
|
|
771
|
+
if (item == 'evaan') {
|
|
772
|
+
val = val === 'true' || val == 1 ? true : false;
|
|
818
773
|
}
|
|
819
774
|
query[item] && this.$set(evaluateResultSetting, key, val);
|
|
820
775
|
}
|
|
@@ -824,7 +779,7 @@ export default create({
|
|
|
824
779
|
},
|
|
825
780
|
handleQueryParams() {
|
|
826
781
|
let params = {};
|
|
827
|
-
for (let [key, value] of new URLSearchParams(window.location.hash.split(
|
|
782
|
+
for (let [key, value] of new URLSearchParams(window.location.hash.split('?')[1]).entries()) {
|
|
828
783
|
params[key] = decodeURIComponent(value);
|
|
829
784
|
}
|
|
830
785
|
return params;
|
|
@@ -837,8 +792,8 @@ export default create({
|
|
|
837
792
|
// 无默认值 不显示考试入口页面
|
|
838
793
|
if (!this.hasDefault) return false;
|
|
839
794
|
// 有默认值 显示考试入口页面
|
|
840
|
-
if (!(
|
|
841
|
-
this.$set(this.config,
|
|
795
|
+
if (!('evaluateResultSetting' in this.config)) {
|
|
796
|
+
this.$set(this.config, 'evaluateResultSetting', {});
|
|
842
797
|
}
|
|
843
798
|
this.setDefaultEvaluate(this.config.evaluateResultSetting);
|
|
844
799
|
this.showEvaluatePage = true;
|
|
@@ -870,20 +825,20 @@ export default create({
|
|
|
870
825
|
query = this.paramsEvaluate;
|
|
871
826
|
}
|
|
872
827
|
if (query.evaname) {
|
|
873
|
-
this.$set(evaluateResultSetting,
|
|
828
|
+
this.$set(evaluateResultSetting, 'evaluateName', query.evaname);
|
|
874
829
|
}
|
|
875
830
|
if (query.evadesc) {
|
|
876
|
-
this.$set(evaluateResultSetting,
|
|
831
|
+
this.$set(evaluateResultSetting, 'evaluateExplain', query.evadesc);
|
|
877
832
|
}
|
|
878
833
|
if (query.evast) {
|
|
879
|
-
this.$set(evaluateResultSetting,
|
|
834
|
+
this.$set(evaluateResultSetting, 'evaluateStartTime', query.evast);
|
|
880
835
|
}
|
|
881
836
|
if (query.evadur) {
|
|
882
|
-
this.$set(evaluateResultSetting,
|
|
837
|
+
this.$set(evaluateResultSetting, 'evaluateTime', query.evadur);
|
|
883
838
|
}
|
|
884
839
|
if (query.evaan) {
|
|
885
|
-
let evaan = query.evaan ===
|
|
886
|
-
this.$set(evaluateResultSetting,
|
|
840
|
+
let evaan = query.evaan === 'true' || query.evaan == 1 ? true : false;
|
|
841
|
+
this.$set(evaluateResultSetting, 'evaluateAnswer', evaan);
|
|
887
842
|
}
|
|
888
843
|
|
|
889
844
|
this.setEvaluateStartTime(evaluateResultSetting);
|
|
@@ -892,10 +847,7 @@ export default create({
|
|
|
892
847
|
setEvaluateStartTime(evaluateResultSetting) {
|
|
893
848
|
let evaluateStartTime = evaluateResultSetting?.evaluateStartTime;
|
|
894
849
|
if (!evaluateStartTime) return;
|
|
895
|
-
if (
|
|
896
|
-
!vexutils.isValidDate(new Date(evaluateStartTime)) &&
|
|
897
|
-
vexutils.isValidDate(new Date(Number(evaluateStartTime)))
|
|
898
|
-
) {
|
|
850
|
+
if (!vexutils.isValidDate(new Date(evaluateStartTime)) && vexutils.isValidDate(new Date(Number(evaluateStartTime)))) {
|
|
899
851
|
evaluateResultSetting.evaluateStartTime = Number(evaluateStartTime);
|
|
900
852
|
}
|
|
901
853
|
},
|
|
@@ -913,7 +865,7 @@ export default create({
|
|
|
913
865
|
if (item.setting?.defValType == 3) {
|
|
914
866
|
let urlKey = item.setting?.outDefaultValue?.urlKey;
|
|
915
867
|
if (urlKey) {
|
|
916
|
-
let list = urlKey.split(
|
|
868
|
+
let list = urlKey.split(',');
|
|
917
869
|
if (list.length > 1) {
|
|
918
870
|
let val = list
|
|
919
871
|
.map(l => {
|
|
@@ -927,24 +879,24 @@ export default create({
|
|
|
927
879
|
let val = this.getQueryVariable(list[0]);
|
|
928
880
|
if (val) {
|
|
929
881
|
val = decodeURIComponent(val);
|
|
930
|
-
defValue = item.type ==
|
|
882
|
+
defValue = item.type == 'CHECKBOX_BLOCK' ? val.split() : val;
|
|
931
883
|
}
|
|
932
884
|
}
|
|
933
885
|
}
|
|
934
886
|
}
|
|
935
887
|
}
|
|
936
888
|
switch (type) {
|
|
937
|
-
case
|
|
938
|
-
formData[key] = defValue ||
|
|
889
|
+
case 'LOCATION':
|
|
890
|
+
formData[key] = defValue || '';
|
|
939
891
|
break;
|
|
940
|
-
case
|
|
892
|
+
case 'SEARCH_CASCADE':
|
|
941
893
|
formData[key] = defValue || [];
|
|
942
894
|
break;
|
|
943
|
-
case
|
|
944
|
-
formData[key] = defValue ||
|
|
895
|
+
case 'ADDRESS':
|
|
896
|
+
formData[key] = defValue || '';
|
|
945
897
|
this.defaultAddress = defValue || {};
|
|
946
898
|
break;
|
|
947
|
-
case
|
|
899
|
+
case 'LABEL':
|
|
948
900
|
formData[key] = defValue || {};
|
|
949
901
|
if (vexutils.isObject(defValue)) {
|
|
950
902
|
this.labelSelectedList = defValue?.labels || [];
|
|
@@ -954,20 +906,20 @@ export default create({
|
|
|
954
906
|
this.labelSelectedList = [];
|
|
955
907
|
}
|
|
956
908
|
break;
|
|
957
|
-
case
|
|
909
|
+
case 'TITLE':
|
|
958
910
|
formData[key] = item.title;
|
|
959
911
|
break;
|
|
960
|
-
case
|
|
961
|
-
formData[key] = item.setting?.imgUrl ||
|
|
912
|
+
case 'IMGCARD':
|
|
913
|
+
formData[key] = item.setting?.imgUrl || '';
|
|
962
914
|
break;
|
|
963
|
-
case
|
|
964
|
-
case
|
|
915
|
+
case 'UPFILE':
|
|
916
|
+
case 'UPPICTURE':
|
|
965
917
|
formData[key] = defValue || [];
|
|
966
918
|
break;
|
|
967
919
|
// 自定义列表特殊处理
|
|
968
|
-
case
|
|
969
|
-
if (defValue && !Array.isArray(defValue) && this.type ===
|
|
970
|
-
formData[key] = defValue.split(
|
|
920
|
+
case 'CHECKBOX_BLOCK':
|
|
921
|
+
if (defValue && !Array.isArray(defValue) && this.type === 'customList') {
|
|
922
|
+
formData[key] = defValue.split(',').filter(ii => !!ii);
|
|
971
923
|
} else {
|
|
972
924
|
val = defValue || item.setting.defaultValue;
|
|
973
925
|
if (vexutils.isJSON(val)) {
|
|
@@ -991,9 +943,9 @@ export default create({
|
|
|
991
943
|
compileSpreadParams(spreadParams) {
|
|
992
944
|
return spreadParams.domains.map(v => {
|
|
993
945
|
let obj = {};
|
|
994
|
-
if (v.valueType ==
|
|
946
|
+
if (v.valueType == '1') {
|
|
995
947
|
obj[v.name] = v.value;
|
|
996
|
-
} else if (v.valueType ==
|
|
948
|
+
} else if (v.valueType == '2') {
|
|
997
949
|
obj[v.name] = this.getQueryVariable(v.value);
|
|
998
950
|
}
|
|
999
951
|
return obj;
|
|
@@ -1002,7 +954,7 @@ export default create({
|
|
|
1002
954
|
// 获取url链接参数
|
|
1003
955
|
getQueryVariable(variable) {
|
|
1004
956
|
let query = {};
|
|
1005
|
-
if (this.source ==
|
|
957
|
+
if (this.source == 'layout') {
|
|
1006
958
|
// 按钮传参
|
|
1007
959
|
query = this.params;
|
|
1008
960
|
} else {
|
|
@@ -1016,36 +968,35 @@ export default create({
|
|
|
1016
968
|
let i = 1;
|
|
1017
969
|
const results = list.map(item => {
|
|
1018
970
|
const key = this.formKey(item);
|
|
1019
|
-
let title = (key ||
|
|
1020
|
-
this.$set(item,
|
|
971
|
+
let title = (key || '').replace(/\n/g, '');
|
|
972
|
+
this.$set(item, 'showTitle', item.title);
|
|
1021
973
|
// 表单校验rule prop如果有 . 会报错, 替换成 ~-~
|
|
1022
|
-
if (title.includes(
|
|
1023
|
-
let newTitle = title.replace(/\./g,
|
|
1024
|
-
this.$set(item,
|
|
974
|
+
if (title.includes('.')) {
|
|
975
|
+
let newTitle = title.replace(/\./g, '~-~');
|
|
976
|
+
this.$set(item, 'title', newTitle);
|
|
1025
977
|
}
|
|
1026
|
-
this.$set(item,
|
|
978
|
+
this.$set(item, 'isShow', true);
|
|
1027
979
|
Object.keys(item).forEach(key => {
|
|
1028
980
|
if (utils.isJSON(item[key])) {
|
|
1029
|
-
if (item.type !=
|
|
981
|
+
if (item.type != 'LOCATION') {
|
|
1030
982
|
item[key] = JSON.parse(item[key]);
|
|
1031
983
|
}
|
|
1032
984
|
}
|
|
1033
985
|
});
|
|
1034
|
-
const notIndexArr = [
|
|
986
|
+
const notIndexArr = ['LINEBAR', 'TITLE', 'PROMPT', 'IMGCARD', 'RICH_TEXT'];
|
|
1035
987
|
if (notIndexArr.indexOf(item.type) < 0 && !item.hide) {
|
|
1036
|
-
this.$set(item,
|
|
988
|
+
this.$set(item, 'softcode', i++);
|
|
1037
989
|
}
|
|
1038
990
|
|
|
1039
|
-
|
|
1040
991
|
// "RADIO_BLOCK", "CHECKBOX_BLOCK" 将取值value改为key
|
|
1041
992
|
if (this.isChoice(item.type)) {
|
|
1042
993
|
this.handleFormatOptions(item.options, item.type);
|
|
1043
|
-
if (item.type !=
|
|
994
|
+
if (item.type != 'SEARCH_CASCADE') {
|
|
1044
995
|
if (item.dbValue) {
|
|
1045
|
-
this.nextLogicEvent(item.dbValue, item, results);
|
|
996
|
+
this.nextLogicEvent(item.dbValue, item, results, true);
|
|
1046
997
|
} else {
|
|
1047
998
|
if (item.setting.defaultValue) {
|
|
1048
|
-
this.nextLogicEvent(item.setting.defaultValue, item, results);
|
|
999
|
+
this.nextLogicEvent(item.setting.defaultValue, item, results, true);
|
|
1049
1000
|
}
|
|
1050
1001
|
}
|
|
1051
1002
|
}
|
|
@@ -1054,22 +1005,15 @@ export default create({
|
|
|
1054
1005
|
});
|
|
1055
1006
|
return results.map(item => {
|
|
1056
1007
|
// 题目关联
|
|
1057
|
-
let relationLogicObj = utils.isString(item.relationLogic)
|
|
1058
|
-
? JSON.parse(item.relationLogic)
|
|
1059
|
-
: item.relationLogic;
|
|
1008
|
+
let relationLogicObj = utils.isString(item.relationLogic) ? JSON.parse(item.relationLogic) : item.relationLogic;
|
|
1060
1009
|
this.handleRelationLogic(list, relationLogicObj);
|
|
1061
1010
|
|
|
1062
1011
|
// 跳题逻辑
|
|
1063
1012
|
this.handLenextLogic(item);
|
|
1064
|
-
|
|
1013
|
+
|
|
1065
1014
|
// 自定义列表特殊处理
|
|
1066
|
-
if (
|
|
1067
|
-
item.
|
|
1068
|
-
item.dbValue &&
|
|
1069
|
-
!Array.isArray(item.dbValue) &&
|
|
1070
|
-
this.type === "customList"
|
|
1071
|
-
) {
|
|
1072
|
-
item.dbValue = item.dbValue.split(",").filter(ii => !!ii);
|
|
1015
|
+
if (item.type === 'CHECKBOX_BLOCK' && item.dbValue && !Array.isArray(item.dbValue) && this.type === 'customList') {
|
|
1016
|
+
item.dbValue = item.dbValue.split(',').filter(ii => !!ii);
|
|
1073
1017
|
}
|
|
1074
1018
|
return item;
|
|
1075
1019
|
});
|
|
@@ -1123,7 +1067,7 @@ export default create({
|
|
|
1123
1067
|
return matchOption.key;
|
|
1124
1068
|
},
|
|
1125
1069
|
isRadioOrCheckBox(options, type) {
|
|
1126
|
-
let typeArr = [
|
|
1070
|
+
let typeArr = ['RADIO_BLOCK', 'CHECKBOX_BLOCK'];
|
|
1127
1071
|
if (!typeArr.includes(type)) return;
|
|
1128
1072
|
if (!options) return;
|
|
1129
1073
|
if (options && utils.isJSON(options)) {
|
|
@@ -1137,7 +1081,7 @@ export default create({
|
|
|
1137
1081
|
if (!isChoice) return;
|
|
1138
1082
|
|
|
1139
1083
|
options.forEach((item, i) => {
|
|
1140
|
-
if (item.key !==
|
|
1084
|
+
if (item.key !== 'other') {
|
|
1141
1085
|
item.key = i + 1;
|
|
1142
1086
|
}
|
|
1143
1087
|
if (item.prefix || item.suffix) {
|
|
@@ -1151,89 +1095,89 @@ export default create({
|
|
|
1151
1095
|
formArray.forEach(item => {
|
|
1152
1096
|
let newTitle = this.formKey(item);
|
|
1153
1097
|
// 表单校验rule prop如果有 . 会报错, 替换成 ~-~
|
|
1154
|
-
if (newTitle.includes(
|
|
1155
|
-
newTitle = newTitle.replace(/\./g,
|
|
1098
|
+
if (newTitle.includes('.')) {
|
|
1099
|
+
newTitle = newTitle.replace(/\./g, '~-~');
|
|
1156
1100
|
}
|
|
1157
|
-
rules[newTitle] = [{ required: item.required, message:
|
|
1158
|
-
if (item.type ==
|
|
1101
|
+
rules[newTitle] = [{ required: item.required, message: '必填', trigger: 'change' }];
|
|
1102
|
+
if (item.type == 'MOBILE' && item.validation) {
|
|
1159
1103
|
rules[newTitle].push({
|
|
1160
1104
|
pattern: /^1[3456789]\d{9}$/,
|
|
1161
|
-
message:
|
|
1162
|
-
trigger:
|
|
1105
|
+
message: '格式错误',
|
|
1106
|
+
trigger: 'blur'
|
|
1163
1107
|
});
|
|
1164
|
-
} else if (item.type ==
|
|
1108
|
+
} else if (item.type == 'ID_CARD' && item.validation) {
|
|
1165
1109
|
rules[newTitle].push({
|
|
1166
1110
|
pattern: /^\d{6}(((19|20)\d{2}(0[1-9]|1[0-2])(0[1-9]|[1-2][0-9]|3[0-1])\d{3}([0-9]|x|X))|(\d{2}(0[1-9]|1[0-2])(0[1-9]|[1-2][0-9]|3[0-1])\d{3}))$/,
|
|
1167
|
-
message:
|
|
1168
|
-
trigger:
|
|
1111
|
+
message: '格式错误',
|
|
1112
|
+
trigger: 'blur'
|
|
1169
1113
|
});
|
|
1170
|
-
} else if (item.type ==
|
|
1114
|
+
} else if (item.type == 'ADDRESS' && item.required) {
|
|
1171
1115
|
if (this.handleAddressType(item)) {
|
|
1172
1116
|
rules[newTitle].push({
|
|
1173
1117
|
validator: this.checkAdress,
|
|
1174
|
-
trigger:
|
|
1118
|
+
trigger: 'change'
|
|
1175
1119
|
});
|
|
1176
1120
|
}
|
|
1177
|
-
} else if (item.type ==
|
|
1121
|
+
} else if (item.type == 'LABEL' && item.required) {
|
|
1178
1122
|
rules[newTitle].push({
|
|
1179
1123
|
validator: this.checkLabel,
|
|
1180
|
-
trigger:
|
|
1124
|
+
trigger: 'change'
|
|
1181
1125
|
});
|
|
1182
|
-
} else if (item.type ==
|
|
1126
|
+
} else if (item.type == 'DATETIME' && this.type == 'customList') {
|
|
1183
1127
|
// 自定义列表特殊处理日期时间 最大值
|
|
1184
1128
|
// dateMaxType 1当前日期时间 2指定日期时间 3其他日期时间字段
|
|
1185
1129
|
let dateMaxType = this.handleDateMaxType(item);
|
|
1186
1130
|
if (!dateMaxType) return;
|
|
1187
1131
|
let obj = {
|
|
1188
|
-
1:
|
|
1189
|
-
2:
|
|
1190
|
-
3:
|
|
1132
|
+
1: 'checkDateMaxCur',
|
|
1133
|
+
2: 'checkDateMaxSet',
|
|
1134
|
+
3: 'checkDateMaxOther'
|
|
1191
1135
|
};
|
|
1192
1136
|
let methodName = obj[dateMaxType];
|
|
1193
1137
|
rules[newTitle].push({
|
|
1194
1138
|
validator: (rule, value, callback) => this[methodName](rule, value, callback, item),
|
|
1195
|
-
trigger:
|
|
1139
|
+
trigger: 'change'
|
|
1196
1140
|
});
|
|
1197
|
-
} else if (item.type ===
|
|
1141
|
+
} else if (item.type === 'RADIO_BLOCK') {
|
|
1198
1142
|
this.choiceComObj[this.formKey(item)] = {};
|
|
1199
1143
|
rules[newTitle].push({
|
|
1200
1144
|
validator: (rule, value, callback) => this.checkRadio(rule, value, callback, item),
|
|
1201
|
-
trigger:
|
|
1145
|
+
trigger: 'change'
|
|
1202
1146
|
});
|
|
1203
|
-
} else if (item.type ===
|
|
1147
|
+
} else if (item.type === 'CHECKBOX_BLOCK') {
|
|
1204
1148
|
this.choiceComObj[this.formKey(item)] = {};
|
|
1205
1149
|
rules[newTitle].push({
|
|
1206
1150
|
validator: (rule, value, callback) => this.checkCheckbox(rule, value, callback, item),
|
|
1207
|
-
trigger:
|
|
1151
|
+
trigger: 'change'
|
|
1208
1152
|
});
|
|
1209
1153
|
}
|
|
1210
1154
|
});
|
|
1211
1155
|
return rules;
|
|
1212
1156
|
},
|
|
1213
1157
|
handleAddressType(item) {
|
|
1214
|
-
let setObj = { addressType:
|
|
1158
|
+
let setObj = { addressType: 'province-city-district-address' };
|
|
1215
1159
|
if (utils.isJSON(item.setting)) {
|
|
1216
1160
|
setObj = JSON.parse(item.setting);
|
|
1217
1161
|
} else {
|
|
1218
1162
|
setObj = item.setting;
|
|
1219
1163
|
}
|
|
1220
|
-
let isAdress = setObj.addressType.includes(
|
|
1164
|
+
let isAdress = setObj.addressType.includes('address');
|
|
1221
1165
|
return isAdress;
|
|
1222
1166
|
},
|
|
1223
1167
|
checkAdress(rule, value, callback) {
|
|
1224
1168
|
let { address } = value || {};
|
|
1225
1169
|
if (!address) {
|
|
1226
|
-
return callback(new Error(
|
|
1170
|
+
return callback(new Error('必填'));
|
|
1227
1171
|
}
|
|
1228
1172
|
callback();
|
|
1229
1173
|
},
|
|
1230
1174
|
checkLabel(rule, value, callback) {
|
|
1231
1175
|
if (!value || !Object.keys(value).length) {
|
|
1232
|
-
return callback(new Error(
|
|
1176
|
+
return callback(new Error('必填'));
|
|
1233
1177
|
}
|
|
1234
1178
|
let { labelStr, labels = [] } = value;
|
|
1235
1179
|
if (!labelStr || !labels.length) {
|
|
1236
|
-
return callback(new Error(
|
|
1180
|
+
return callback(new Error('必填'));
|
|
1237
1181
|
}
|
|
1238
1182
|
callback();
|
|
1239
1183
|
},
|
|
@@ -1250,12 +1194,12 @@ export default create({
|
|
|
1250
1194
|
let { dateType } = item.setting;
|
|
1251
1195
|
if (!dateType) return callback();
|
|
1252
1196
|
let dateMaxValue = this.currentTime;
|
|
1253
|
-
if (dateType ==
|
|
1254
|
-
dateMaxValue = this.currentTime.format(
|
|
1197
|
+
if (dateType == 'time') {
|
|
1198
|
+
dateMaxValue = this.currentTime.format('HH:mm:ss');
|
|
1255
1199
|
}
|
|
1256
1200
|
let isMax = this.handleMax(dateType, value, dateMaxValue);
|
|
1257
1201
|
if (!isMax) {
|
|
1258
|
-
return callback(new Error(
|
|
1202
|
+
return callback(new Error('最大不能超过当前日期时间'));
|
|
1259
1203
|
}
|
|
1260
1204
|
callback();
|
|
1261
1205
|
},
|
|
@@ -1266,7 +1210,7 @@ export default create({
|
|
|
1266
1210
|
if (!dateMaxValue || !dateType) return callback();
|
|
1267
1211
|
let isMax = this.handleMax(dateType, value, dateMaxValue);
|
|
1268
1212
|
if (!isMax) {
|
|
1269
|
-
return callback(new Error(
|
|
1213
|
+
return callback(new Error('最大不能超过指定日期时间'));
|
|
1270
1214
|
}
|
|
1271
1215
|
callback();
|
|
1272
1216
|
},
|
|
@@ -1288,7 +1232,7 @@ export default create({
|
|
|
1288
1232
|
checkRadio(rule, value, callback, item) {
|
|
1289
1233
|
if (!value) return callback();
|
|
1290
1234
|
let { options } = item;
|
|
1291
|
-
if (!options.length || value ===
|
|
1235
|
+
if (!options.length || value === 'other') return callback();
|
|
1292
1236
|
const key = this.formKey(item);
|
|
1293
1237
|
let { optionsPreSuffixObj = {} } = this.choiceComObj[key] || {};
|
|
1294
1238
|
let matchItem = options.find((o, i) => {
|
|
@@ -1317,7 +1261,7 @@ export default create({
|
|
|
1317
1261
|
let { optionsPreSuffixObj = {} } = this.choiceComObj[key] || {};
|
|
1318
1262
|
for (; i < len; i++) {
|
|
1319
1263
|
v = value[i];
|
|
1320
|
-
if (v ===
|
|
1264
|
+
if (v === 'other') continue;
|
|
1321
1265
|
let matchItem = options.find((o, j) => {
|
|
1322
1266
|
if (j + 1 === v) {
|
|
1323
1267
|
return true;
|
|
@@ -1336,13 +1280,13 @@ export default create({
|
|
|
1336
1280
|
callback();
|
|
1337
1281
|
},
|
|
1338
1282
|
handleMax(dateType, value, dateMaxValue) {
|
|
1339
|
-
let curValue =
|
|
1340
|
-
let tempValue =
|
|
1341
|
-
if (dateType ==
|
|
1342
|
-
let curYMD = this.currentTime.format(
|
|
1283
|
+
let curValue = '';
|
|
1284
|
+
let tempValue = '';
|
|
1285
|
+
if (dateType == 'time') {
|
|
1286
|
+
let curYMD = this.currentTime.format('YYYY MM DD ');
|
|
1343
1287
|
curValue = moment(curYMD + dateMaxValue).valueOf();
|
|
1344
1288
|
tempValue = moment(curYMD + value).valueOf();
|
|
1345
|
-
} else if (dateType ==
|
|
1289
|
+
} else if (dateType == 'date') {
|
|
1346
1290
|
curValue = moment(dateMaxValue).valueOf();
|
|
1347
1291
|
tempValue = moment(value).valueOf();
|
|
1348
1292
|
} else {
|
|
@@ -1359,7 +1303,7 @@ export default create({
|
|
|
1359
1303
|
const valObj = JSON.parse(val);
|
|
1360
1304
|
return valObj.address || valObj.name;
|
|
1361
1305
|
}
|
|
1362
|
-
return
|
|
1306
|
+
return '';
|
|
1363
1307
|
},
|
|
1364
1308
|
handleSelectLocation(e, item) {
|
|
1365
1309
|
const { locationProp, isInit } = e;
|
|
@@ -1369,24 +1313,24 @@ export default create({
|
|
|
1369
1313
|
this.mapVisible = isInit || false;
|
|
1370
1314
|
},
|
|
1371
1315
|
isInput(type) {
|
|
1372
|
-
return type ==
|
|
1316
|
+
return type == 'INPUT' || type == 'ID_CARD' || type == 'MOBILE' || type == 'EVALUATE_INPUT';
|
|
1373
1317
|
},
|
|
1374
1318
|
isChoice(type) {
|
|
1375
1319
|
return (
|
|
1376
|
-
type ==
|
|
1377
|
-
type ==
|
|
1378
|
-
type ==
|
|
1379
|
-
type ==
|
|
1380
|
-
type ==
|
|
1381
|
-
type ==
|
|
1382
|
-
type ==
|
|
1320
|
+
type == 'SELECT' ||
|
|
1321
|
+
type == 'RADIO_BLOCK' ||
|
|
1322
|
+
type == 'CHECKBOX_BLOCK' ||
|
|
1323
|
+
type == 'SEARCH_CASCADE' ||
|
|
1324
|
+
type == 'EVALUATE_RADIO_BLOCK' ||
|
|
1325
|
+
type == 'EVALUATE_CHECKBOX_BLOCK' ||
|
|
1326
|
+
type == 'EVALUATE_SELECT'
|
|
1383
1327
|
);
|
|
1384
1328
|
},
|
|
1385
1329
|
isTime(type) {
|
|
1386
|
-
return type ==
|
|
1330
|
+
return type == 'DATE' || type == 'TIME' || type == 'DATETIME';
|
|
1387
1331
|
},
|
|
1388
1332
|
isUpload(type) {
|
|
1389
|
-
return type ==
|
|
1333
|
+
return type == 'UPFILE' || type == 'UPPICTURE';
|
|
1390
1334
|
},
|
|
1391
1335
|
writeGuage(showCountdown) {
|
|
1392
1336
|
this.showEvaluateSettingWrap = false;
|
|
@@ -1399,26 +1343,25 @@ export default create({
|
|
|
1399
1343
|
this.banSubmit = true;
|
|
1400
1344
|
this.submitMethod();
|
|
1401
1345
|
this.$warning({
|
|
1402
|
-
title:
|
|
1403
|
-
content:
|
|
1404
|
-
okText:
|
|
1405
|
-
onOk: () => {
|
|
1406
|
-
}
|
|
1346
|
+
title: '温馨提示',
|
|
1347
|
+
content: '测评时间到了,结束测评!',
|
|
1348
|
+
okText: '确定',
|
|
1349
|
+
onOk: () => {}
|
|
1407
1350
|
});
|
|
1408
1351
|
},
|
|
1409
|
-
async showEvaTipModal(item){
|
|
1352
|
+
async showEvaTipModal(item) {
|
|
1410
1353
|
if (this.evatipMap[item.id]) {
|
|
1411
1354
|
this.evatipConfirm(this.evatipMap[item.id]);
|
|
1412
1355
|
return;
|
|
1413
1356
|
}
|
|
1414
|
-
let key = 'getSubjectAnswer'
|
|
1357
|
+
let key = 'getSubjectAnswer';
|
|
1415
1358
|
const fn = this.scaleApiConfig?.[key] || null;
|
|
1416
|
-
if(!fn || typeof fn !== 'function') {
|
|
1417
|
-
this.$message.error(`${key} Is not a function`)
|
|
1418
|
-
return
|
|
1359
|
+
if (!fn || typeof fn !== 'function') {
|
|
1360
|
+
this.$message.error(`${key} Is not a function`);
|
|
1361
|
+
return;
|
|
1419
1362
|
}
|
|
1420
|
-
let obj = await fn(item.id)
|
|
1421
|
-
if(!obj) return;
|
|
1363
|
+
let obj = await fn(item.id);
|
|
1364
|
+
if (!obj) return;
|
|
1422
1365
|
if (!this.evatipMap[item.id]) {
|
|
1423
1366
|
this.evatipMap[item.id] = obj;
|
|
1424
1367
|
this.evatipConfirm(obj);
|
|
@@ -1437,19 +1380,19 @@ export default create({
|
|
|
1437
1380
|
</div>
|
|
1438
1381
|
);
|
|
1439
1382
|
this.$confirm({
|
|
1440
|
-
title:
|
|
1383
|
+
title: '提示',
|
|
1441
1384
|
icon: () => null,
|
|
1442
1385
|
content,
|
|
1443
|
-
okText:
|
|
1444
|
-
cancelText:
|
|
1386
|
+
okText: '确定',
|
|
1387
|
+
cancelText: '关闭',
|
|
1445
1388
|
onOk() {},
|
|
1446
1389
|
onCancel() {},
|
|
1447
|
-
class:
|
|
1390
|
+
class: 'evatip-modal-wrap'
|
|
1448
1391
|
});
|
|
1449
1392
|
},
|
|
1450
1393
|
// 选择组件
|
|
1451
1394
|
handleChoice(choiceValue, formItem) {
|
|
1452
|
-
let { value =
|
|
1395
|
+
let { value = '', list = [] } = choiceValue;
|
|
1453
1396
|
this.nextLogicEvent(value, formItem, this.formArray);
|
|
1454
1397
|
this.handleDynamicDataRelation(list, formItem, this.formArray);
|
|
1455
1398
|
},
|
|
@@ -1465,38 +1408,84 @@ export default create({
|
|
|
1465
1408
|
const key = this.formKey(matchEle);
|
|
1466
1409
|
if (matchEle) {
|
|
1467
1410
|
if (!list.length) {
|
|
1468
|
-
this.form[key] =
|
|
1411
|
+
this.form[key] = '';
|
|
1469
1412
|
} else {
|
|
1470
|
-
let relationFieldList = list.map(v => v[item.relationField] ||
|
|
1471
|
-
this.form[key] = relationFieldList.join(
|
|
1413
|
+
let relationFieldList = list.map(v => v[item.relationField] || '/') || '';
|
|
1414
|
+
this.form[key] = relationFieldList.join(',');
|
|
1472
1415
|
}
|
|
1473
1416
|
}
|
|
1474
1417
|
});
|
|
1475
1418
|
},
|
|
1419
|
+
// 设置的logic condition 最大next_subject
|
|
1420
|
+
handleLogicMaxNext(condition = []) {
|
|
1421
|
+
const arr = condition.map(({ next_subject }) => (next_subject == 'end' ? 9999 : +(next_subject || 9999)));
|
|
1422
|
+
const max = Math.max.call(null, ...arr);
|
|
1423
|
+
return max;
|
|
1424
|
+
},
|
|
1425
|
+
// 当前formItem 下一个触发logicCodition item 的seq
|
|
1426
|
+
handleLogicList(formItem, formArray) {
|
|
1427
|
+
const { seq } = formItem;
|
|
1428
|
+
let list = formArray.map(item => {
|
|
1429
|
+
if (item.seq > seq && item.isShow && item.__isLogic__) return item;
|
|
1430
|
+
return false;
|
|
1431
|
+
});
|
|
1432
|
+
let nextItemMax = 0;
|
|
1433
|
+
let i = 0,
|
|
1434
|
+
len = list.length,
|
|
1435
|
+
item;
|
|
1436
|
+
for (; i < len; i++) {
|
|
1437
|
+
item = list[i];
|
|
1438
|
+
let curVal = this.form[this.formKey(item)];
|
|
1439
|
+
if (!curVal) continue;
|
|
1440
|
+
if (Array.isArray(curVal)) {
|
|
1441
|
+
if (!curVal.length) continue;
|
|
1442
|
+
}
|
|
1443
|
+
const { nextLogic, seq, __isLogic__, __lastSeq__ } = item;
|
|
1444
|
+
if (!nextLogic.next_logic_is || !nextLogic.condition.length) continue;
|
|
1445
|
+
if (__lastSeq__) {
|
|
1446
|
+
nextItemMax = __lastSeq__;
|
|
1447
|
+
break;
|
|
1448
|
+
}
|
|
1449
|
+
}
|
|
1450
|
+
return nextItemMax;
|
|
1451
|
+
},
|
|
1476
1452
|
// 跳题逻辑
|
|
1477
|
-
nextLogicEvent(choiceValue, formItem, formArray = []) {
|
|
1453
|
+
nextLogicEvent(choiceValue, formItem, formArray = [], isInit) {
|
|
1478
1454
|
const { nextLogic, seq } = formItem;
|
|
1479
|
-
if(!nextLogic) return;
|
|
1480
|
-
if (nextLogic.next_logic_is) {
|
|
1455
|
+
if (!nextLogic) return;
|
|
1456
|
+
if (nextLogic.next_logic_is && nextLogic.condition.length) {
|
|
1457
|
+
let nextMax = 9999,
|
|
1458
|
+
nextItemMax = 0;
|
|
1459
|
+
if (!isInit) {
|
|
1460
|
+
nextMax = this.handleLogicMaxNext(nextLogic.condition);
|
|
1461
|
+
nextItemMax = this.handleLogicList(formItem, formArray);
|
|
1462
|
+
}
|
|
1481
1463
|
nextLogic.condition.some(con => {
|
|
1482
1464
|
const { value, next_subject } = con;
|
|
1483
|
-
const lastSeq = next_subject ==
|
|
1484
|
-
if (
|
|
1465
|
+
const lastSeq = next_subject == 'end' ? 9999 : next_subject;
|
|
1466
|
+
if (nextItemMax && nextItemMax > seq && nextItemMax < nextMax) {
|
|
1467
|
+
nextMax = nextItemMax;
|
|
1468
|
+
}
|
|
1469
|
+
if (nextLogic.next_logic == 'condition') {
|
|
1485
1470
|
let hasValue = false;
|
|
1486
1471
|
if (Array.isArray(choiceValue)) {
|
|
1487
1472
|
hasValue = choiceValue.includes(value);
|
|
1488
1473
|
} else {
|
|
1489
1474
|
hasValue = choiceValue === value;
|
|
1490
1475
|
}
|
|
1476
|
+
|
|
1477
|
+
formItem.__isLogic__ = hasValue;
|
|
1478
|
+
formItem.__lastSeq__ = seq + 1;
|
|
1479
|
+
|
|
1491
1480
|
if (hasValue) {
|
|
1492
1481
|
formArray.forEach(item => {
|
|
1493
1482
|
if (item.seq > seq && item.seq < lastSeq) {
|
|
1494
1483
|
item.isShow = false;
|
|
1495
1484
|
// 跳过时 清空已填内容
|
|
1496
1485
|
const key = this.formKey(item);
|
|
1497
|
-
this.form[key] && (this.form[key] =
|
|
1498
|
-
} else {
|
|
1499
|
-
item
|
|
1486
|
+
this.form[key] && (this.form[key] = '');
|
|
1487
|
+
} else if (item.seq >= lastSeq && item.seq < nextMax) {
|
|
1488
|
+
this.$set(item, 'isShow', true);
|
|
1500
1489
|
}
|
|
1501
1490
|
});
|
|
1502
1491
|
return true;
|
|
@@ -1507,15 +1496,19 @@ export default create({
|
|
|
1507
1496
|
}
|
|
1508
1497
|
});
|
|
1509
1498
|
}
|
|
1510
|
-
} else if (nextLogic.next_logic ==
|
|
1499
|
+
} else if (nextLogic.next_logic == 'uncondition') {
|
|
1500
|
+
let res = utils.isEmpty(choiceValue);
|
|
1501
|
+
|
|
1502
|
+
formItem.__isLogic__ = !res;
|
|
1503
|
+
formItem.__lastSeq__ = seq + 1;
|
|
1504
|
+
|
|
1511
1505
|
formArray.forEach(item => {
|
|
1512
1506
|
const key = this.formKey(item);
|
|
1513
1507
|
if (item.seq > seq && item.seq < lastSeq) {
|
|
1514
|
-
let res = utils.isEmpty(choiceValue);
|
|
1515
1508
|
item.isShow = res;
|
|
1516
1509
|
// 跳过时 清空已填内容
|
|
1517
1510
|
if (!res) {
|
|
1518
|
-
this.form[key] && (this.form[key] =
|
|
1511
|
+
this.form[key] && (this.form[key] = '');
|
|
1519
1512
|
}
|
|
1520
1513
|
}
|
|
1521
1514
|
});
|
|
@@ -1534,15 +1527,10 @@ export default create({
|
|
|
1534
1527
|
if (formItem.setting && utils.isJSON(formItem.setting)) {
|
|
1535
1528
|
setting = JSON.parse(formItem.setting);
|
|
1536
1529
|
}
|
|
1537
|
-
relationLogicObj = utils.isString(setting.callbackCondition)
|
|
1538
|
-
|
|
1539
|
-
: setting.callbackCondition;
|
|
1540
|
-
if (!relationLogicObj || !relationLogicObj.condition || !relationLogicObj.condition.length)
|
|
1541
|
-
return true;
|
|
1530
|
+
relationLogicObj = utils.isString(setting.callbackCondition) ? JSON.parse(setting.callbackCondition) : setting.callbackCondition;
|
|
1531
|
+
if (!relationLogicObj || !relationLogicObj.condition || !relationLogicObj.condition.length) return true;
|
|
1542
1532
|
} else {
|
|
1543
|
-
relationLogicObj = utils.isString(formItem.relationLogic)
|
|
1544
|
-
? JSON.parse(formItem.relationLogic)
|
|
1545
|
-
: formItem.relationLogic;
|
|
1533
|
+
relationLogicObj = utils.isString(formItem.relationLogic) ? JSON.parse(formItem.relationLogic) : formItem.relationLogic;
|
|
1546
1534
|
}
|
|
1547
1535
|
if (!relationLogicObj || !Object.keys(relationLogicObj).length) return true;
|
|
1548
1536
|
const { relation_logic_is, condition, relation_logic } = relationLogicObj;
|
|
@@ -1555,9 +1543,9 @@ export default create({
|
|
|
1555
1543
|
return c.value.includes(form[key]);
|
|
1556
1544
|
}
|
|
1557
1545
|
});
|
|
1558
|
-
if (relation_logic ==
|
|
1546
|
+
if (relation_logic == 'OR') {
|
|
1559
1547
|
formItem.isShow = results.some(el => el);
|
|
1560
|
-
} else if (relation_logic ==
|
|
1548
|
+
} else if (relation_logic == 'AND') {
|
|
1561
1549
|
formItem.isShow = results.every(el => el);
|
|
1562
1550
|
} else {
|
|
1563
1551
|
formItem.isShow = results[0];
|
|
@@ -1569,14 +1557,14 @@ export default create({
|
|
|
1569
1557
|
radioChange(val, item, obj) {
|
|
1570
1558
|
const key = this.formKey(item);
|
|
1571
1559
|
this.form[key] = val;
|
|
1572
|
-
item.type ===
|
|
1560
|
+
item.type === 'RADIO_BLOCK' && this.$set(this.choiceComObj, key, obj);
|
|
1573
1561
|
this.nextLogicEvent(val, item, this.formArray);
|
|
1574
1562
|
},
|
|
1575
1563
|
// 多选组件回调
|
|
1576
1564
|
checkboxChange(val, item, obj) {
|
|
1577
1565
|
const key = this.formKey(item);
|
|
1578
1566
|
this.form[key] = val;
|
|
1579
|
-
item.type ===
|
|
1567
|
+
item.type === 'CHECKBOX_BLOCK' && this.$set(this.choiceComObj, key, obj);
|
|
1580
1568
|
this.nextLogicEvent(val, item, this.formArray);
|
|
1581
1569
|
},
|
|
1582
1570
|
// 标签组件回调
|
|
@@ -1586,13 +1574,13 @@ export default create({
|
|
|
1586
1574
|
},
|
|
1587
1575
|
// 视频组件回调
|
|
1588
1576
|
vodFileList(list, item) {
|
|
1589
|
-
|
|
1577
|
+
const key = this.formKey(item);
|
|
1590
1578
|
this.form[key] = list;
|
|
1591
1579
|
},
|
|
1592
1580
|
handleGetLabelSubmit(labelSelectedList) {
|
|
1593
1581
|
if (!labelSelectedList || !labelSelectedList.length)
|
|
1594
1582
|
return {
|
|
1595
|
-
labelStr:
|
|
1583
|
+
labelStr: '',
|
|
1596
1584
|
labels: []
|
|
1597
1585
|
};
|
|
1598
1586
|
const selectedList = labelSelectedList || [];
|
|
@@ -1605,7 +1593,7 @@ export default create({
|
|
|
1605
1593
|
});
|
|
1606
1594
|
this.labelSelectedList = selectedList;
|
|
1607
1595
|
return {
|
|
1608
|
-
labelStr: labelStrList.join(
|
|
1596
|
+
labelStr: labelStrList.join(','),
|
|
1609
1597
|
labels: labels
|
|
1610
1598
|
};
|
|
1611
1599
|
},
|
|
@@ -1630,51 +1618,48 @@ export default create({
|
|
|
1630
1618
|
// 不包含测评组件,点击提交,弹出二次确认对话框,确认要提交吗?
|
|
1631
1619
|
let hasEvaluate = this.formArray.find(item => this.isEvaluation(item.type));
|
|
1632
1620
|
if (!hasEvaluate) {
|
|
1633
|
-
this.confirmSubmit(
|
|
1621
|
+
this.confirmSubmit('确认要提交吗?');
|
|
1634
1622
|
return;
|
|
1635
1623
|
}
|
|
1636
1624
|
|
|
1637
1625
|
// 包含测评组件,不包含考试时长,点击提交,弹出二次确认对话框,确认要结束测评吗?
|
|
1638
1626
|
// 判断有无测评配置 并且在测评时间内
|
|
1639
1627
|
let { evaluateResultSetting } = this.config;
|
|
1640
|
-
if (
|
|
1641
|
-
|
|
1642
|
-
(!Object.keys(evaluateResultSetting).length && !this.showEvaluateEntry)
|
|
1643
|
-
) {
|
|
1644
|
-
this.confirmSubmit("确认要结束测评吗?");
|
|
1628
|
+
if (!evaluateResultSetting || (!Object.keys(evaluateResultSetting).length && !this.showEvaluateEntry)) {
|
|
1629
|
+
this.confirmSubmit('确认要结束测评吗?');
|
|
1645
1630
|
return;
|
|
1646
1631
|
}
|
|
1647
1632
|
|
|
1648
1633
|
// 表单内嵌量表, 没有开始答题, 不需要调用保存接口
|
|
1649
|
-
if (this.openType ==
|
|
1650
|
-
this.$emit(
|
|
1634
|
+
if (this.openType == 'formIframe' && this.showEvaluateEntry) {
|
|
1635
|
+
this.$emit('submitNoRequest');
|
|
1651
1636
|
return;
|
|
1652
1637
|
}
|
|
1653
1638
|
|
|
1654
1639
|
// 无倒计时
|
|
1655
1640
|
let countdownDom = this.$refs.evaluateCountdown;
|
|
1656
|
-
if(!countdownDom?.showEvaluateCountdown) {
|
|
1657
|
-
this.confirmSubmit(
|
|
1641
|
+
if (!countdownDom?.showEvaluateCountdown) {
|
|
1642
|
+
this.confirmSubmit('确认要结束测评吗?');
|
|
1658
1643
|
return;
|
|
1659
1644
|
}
|
|
1660
1645
|
|
|
1661
1646
|
// 在倒计时内
|
|
1662
|
-
let message =
|
|
1647
|
+
let message = '确认要提前结束测评吗?';
|
|
1663
1648
|
let setAnswered = this.$refs.evaluateCountdown?.setAnswered;
|
|
1664
1649
|
let totalLen = this.$refs.evaluateCountdown?.totalLen;
|
|
1665
1650
|
// 存在未解答题目
|
|
1666
1651
|
if (setAnswered < totalLen) {
|
|
1667
|
-
message =
|
|
1652
|
+
message = '存在未解答的题目,确定要提前结束吗?';
|
|
1668
1653
|
}
|
|
1669
1654
|
this.confirmSubmit(message);
|
|
1670
1655
|
},
|
|
1671
1656
|
confirmSubmit(message) {
|
|
1672
1657
|
let _this = this;
|
|
1673
1658
|
this.$confirm({
|
|
1674
|
-
title:
|
|
1659
|
+
title: '温馨提示',
|
|
1675
1660
|
content: message,
|
|
1676
|
-
okText:
|
|
1677
|
-
cancelText:
|
|
1661
|
+
okText: '确定',
|
|
1662
|
+
cancelText: '取消',
|
|
1678
1663
|
onOk: () => {
|
|
1679
1664
|
_this.onSubmitForm();
|
|
1680
1665
|
},
|
|
@@ -1682,9 +1667,9 @@ export default create({
|
|
|
1682
1667
|
});
|
|
1683
1668
|
},
|
|
1684
1669
|
onSubmitForm() {
|
|
1685
|
-
this.$refs[
|
|
1670
|
+
this.$refs['ruleForm'].validate((valid, keys) => {
|
|
1686
1671
|
if (valid) {
|
|
1687
|
-
|
|
1672
|
+
this.submitMethod();
|
|
1688
1673
|
} else {
|
|
1689
1674
|
if (Object.keys(keys).length > 0) {
|
|
1690
1675
|
let key = Object.keys(keys)[0];
|
|
@@ -1701,28 +1686,22 @@ export default create({
|
|
|
1701
1686
|
});
|
|
1702
1687
|
},
|
|
1703
1688
|
submitMethod() {
|
|
1704
|
-
const hasSpreadParams = this.defaultFormArray.find(v => v.type ===
|
|
1689
|
+
const hasSpreadParams = this.defaultFormArray.find(v => v.type === 'SPREAD_PARAMS');
|
|
1705
1690
|
if (hasSpreadParams) {
|
|
1706
1691
|
if (utils.isJSON(hasSpreadParams.setting)) {
|
|
1707
1692
|
hasSpreadParams.setting = JSON.parse(hasSpreadParams.setting);
|
|
1708
1693
|
}
|
|
1709
1694
|
let spreadKey = this.formKey(hasSpreadParams);
|
|
1710
|
-
this.submitForm[spreadKey] = this.compileSpreadParams(
|
|
1711
|
-
hasSpreadParams.setting.spreadParams
|
|
1712
|
-
);
|
|
1695
|
+
this.submitForm[spreadKey] = this.compileSpreadParams(hasSpreadParams.setting.spreadParams);
|
|
1713
1696
|
}
|
|
1714
1697
|
// 自定义列表新增时多选特殊处理
|
|
1715
|
-
let checkBoxKey = this.defaultFormArray.find(ii => ii.type ==
|
|
1716
|
-
if (
|
|
1717
|
-
checkBoxKey
|
|
1718
|
-
Array.isArray(this.form[checkBoxKey.title]) &&
|
|
1719
|
-
this.type === "customList"
|
|
1720
|
-
) {
|
|
1721
|
-
this.form[checkBoxKey.title] = this.form[checkBoxKey.title].join(",");
|
|
1698
|
+
let checkBoxKey = this.defaultFormArray.find(ii => ii.type == 'CHECKBOX_BLOCK');
|
|
1699
|
+
if (checkBoxKey && Array.isArray(this.form[checkBoxKey.title]) && this.type === 'customList') {
|
|
1700
|
+
this.form[checkBoxKey.title] = this.form[checkBoxKey.title].join(',');
|
|
1722
1701
|
}
|
|
1723
1702
|
const scoreJson = this.handleScoreJson();
|
|
1724
1703
|
let params;
|
|
1725
|
-
if (this.type ===
|
|
1704
|
+
if (this.type === 'customList') {
|
|
1726
1705
|
params = {
|
|
1727
1706
|
definedListId: this.ids.guage_id,
|
|
1728
1707
|
dbId: this.ids.db_id,
|
|
@@ -1739,12 +1718,10 @@ export default create({
|
|
|
1739
1718
|
if (this.shareId) {
|
|
1740
1719
|
params.shareId = this.shareId;
|
|
1741
1720
|
}
|
|
1742
|
-
const tipSetting = this.defaultFormArray.find(item => item.type ===
|
|
1721
|
+
const tipSetting = this.defaultFormArray.find(item => item.type === 'SUCCESS_TIP');
|
|
1743
1722
|
if (tipSetting) {
|
|
1744
1723
|
// 提交保存成功提示设置
|
|
1745
|
-
const tip = utils.isJSON(tipSetting.setting)
|
|
1746
|
-
? JSON.parse(tipSetting.setting)
|
|
1747
|
-
: tipSetting.setting;
|
|
1724
|
+
const tip = utils.isJSON(tipSetting.setting) ? JSON.parse(tipSetting.setting) : tipSetting.setting;
|
|
1748
1725
|
params.tipSetting = JSON.stringify({
|
|
1749
1726
|
tipMode: tip.tipMode,
|
|
1750
1727
|
tipType: tip.tipType,
|
|
@@ -1752,7 +1729,7 @@ export default create({
|
|
|
1752
1729
|
tipApi: tip.tipApi
|
|
1753
1730
|
});
|
|
1754
1731
|
}
|
|
1755
|
-
let hasCallbackItem = this.defaultFormArray.find(v => v.type ===
|
|
1732
|
+
let hasCallbackItem = this.defaultFormArray.find(v => v.type === 'CALLBACK_INTERFACE');
|
|
1756
1733
|
let isCallback = false;
|
|
1757
1734
|
if (hasCallbackItem) {
|
|
1758
1735
|
isCallback = this.showEvent(hasCallbackItem, true);
|
|
@@ -1761,8 +1738,7 @@ export default create({
|
|
|
1761
1738
|
* NOTE:
|
|
1762
1739
|
* 提交数据往外推
|
|
1763
1740
|
*/
|
|
1764
|
-
this.$emit(
|
|
1765
|
-
|
|
1741
|
+
this.$emit('onSubmit', params, hasCallbackItem, isCallback);
|
|
1766
1742
|
},
|
|
1767
1743
|
handleScoreJson() {
|
|
1768
1744
|
let tempObj = Object.assign({}, this.form, this.submitForm);
|
|
@@ -1774,50 +1750,39 @@ export default create({
|
|
|
1774
1750
|
if (key && itemTemp) {
|
|
1775
1751
|
let keyTemp;
|
|
1776
1752
|
if (itemTemp && itemTemp.databaseTitle) keyTemp = itemTemp.databaseTitle;
|
|
1777
|
-
if (
|
|
1778
|
-
|
|
1779
|
-
itemTemp &&
|
|
1780
|
-
itemTemp.setting &&
|
|
1781
|
-
itemTemp.setting.startToStop != 1 &&
|
|
1782
|
-
curValue &&
|
|
1783
|
-
itemTemp.type == "DATETIME"
|
|
1784
|
-
) {
|
|
1785
|
-
if (itemTemp.setting && itemTemp.setting.dateType == "time" && curValue)
|
|
1786
|
-
curValue = moment().format("YYYY-MM-DD ") + curValue;
|
|
1787
|
-
if (itemTemp.setting && itemTemp.setting.dateType == "date" && curValue)
|
|
1788
|
-
curValue =
|
|
1789
|
-
moment(curValue).format("YYYY-MM-DD ") + moment().format("HH:mm:ss");
|
|
1753
|
+
if (this.type == 'customList' && itemTemp && itemTemp.setting && itemTemp.setting.startToStop != 1 && curValue && itemTemp.type == 'DATETIME') {
|
|
1754
|
+
if (itemTemp.setting && itemTemp.setting.dateType == 'time' && curValue) curValue = moment().format('YYYY-MM-DD ') + curValue;
|
|
1755
|
+
if (itemTemp.setting && itemTemp.setting.dateType == 'date' && curValue) curValue = moment(curValue).format('YYYY-MM-DD ') + moment().format('HH:mm:ss');
|
|
1790
1756
|
}
|
|
1791
1757
|
|
|
1792
1758
|
// 处理choice选项 将key替换为value
|
|
1793
|
-
let isChoice = [
|
|
1759
|
+
let isChoice = ['RADIO_BLOCK', 'CHECKBOX_BLOCK'].includes(itemTemp.type);
|
|
1794
1760
|
if (isChoice) {
|
|
1795
1761
|
let { options } = itemTemp;
|
|
1796
1762
|
let obj = this.choiceComObj[key];
|
|
1797
|
-
if (itemTemp.type ===
|
|
1763
|
+
if (itemTemp.type === 'RADIO_BLOCK' && curValue) {
|
|
1798
1764
|
curValue = this.handleChoiceItem(curValue, options, obj);
|
|
1799
1765
|
}
|
|
1800
|
-
if (itemTemp.type ===
|
|
1766
|
+
if (itemTemp.type === 'CHECKBOX_BLOCK' && curValue?.length) {
|
|
1801
1767
|
let resArr = this.handleCheckboxParams(curValue, options, obj);
|
|
1802
1768
|
curValue = resArr;
|
|
1803
1769
|
}
|
|
1804
1770
|
}
|
|
1805
1771
|
|
|
1806
|
-
if (key.includes(
|
|
1807
|
-
let newKey = keyTemp ? keyTemp.replace(/~-~/g,
|
|
1772
|
+
if (key.includes('~-~')) {
|
|
1773
|
+
let newKey = keyTemp ? keyTemp.replace(/~-~/g, '.') : key.replace(/~-~/g, '.');
|
|
1808
1774
|
res[newKey] = curValue;
|
|
1809
1775
|
} else {
|
|
1810
1776
|
res[keyTemp || key] = !curValue ? null : curValue;
|
|
1811
1777
|
}
|
|
1812
|
-
|
|
1813
1778
|
} else {
|
|
1814
1779
|
res[key] = curValue;
|
|
1815
1780
|
}
|
|
1816
1781
|
}
|
|
1817
|
-
console.log(
|
|
1782
|
+
console.log('res', res);
|
|
1818
1783
|
return res;
|
|
1819
1784
|
},
|
|
1820
|
-
|
|
1785
|
+
handleCheckboxParams(value, options, obj) {
|
|
1821
1786
|
let res = [];
|
|
1822
1787
|
let i = 0,
|
|
1823
1788
|
len = value.length,
|
|
@@ -1841,8 +1806,8 @@ export default create({
|
|
|
1841
1806
|
},
|
|
1842
1807
|
handleChoiceItem(value, options, obj) {
|
|
1843
1808
|
let { othersText, optionsPreSuffixObj = {} } = obj || {};
|
|
1844
|
-
if (value ===
|
|
1845
|
-
return othersText ||
|
|
1809
|
+
if (value === 'other') {
|
|
1810
|
+
return othersText || '其他';
|
|
1846
1811
|
}
|
|
1847
1812
|
let matchItem = options.find((o, i) => {
|
|
1848
1813
|
if (i + 1 === value) {
|
|
@@ -1850,9 +1815,9 @@ export default create({
|
|
|
1850
1815
|
}
|
|
1851
1816
|
return false;
|
|
1852
1817
|
});
|
|
1853
|
-
if(!matchItem) return;
|
|
1818
|
+
if (!matchItem) return;
|
|
1854
1819
|
if (!matchItem.prefix && !matchItem.suffix) return matchItem.value;
|
|
1855
|
-
let resValue = optionsPreSuffixObj[value] ||
|
|
1820
|
+
let resValue = optionsPreSuffixObj[value] || '';
|
|
1856
1821
|
if (matchItem.prefix) {
|
|
1857
1822
|
resValue = matchItem.prefix + resValue;
|
|
1858
1823
|
} else {
|
|
@@ -1864,7 +1829,7 @@ export default create({
|
|
|
1864
1829
|
this.$refs.ruleForm.resetFields();
|
|
1865
1830
|
},
|
|
1866
1831
|
cancel() {
|
|
1867
|
-
this.$emit(
|
|
1832
|
+
this.$emit('onCloseSetting');
|
|
1868
1833
|
},
|
|
1869
1834
|
handleEvaluationScore(ele) {
|
|
1870
1835
|
let { minScore = 0, maxScore = 0, scoreType } = ele.scoreConfigs || {};
|