cnhis-design-vue 3.1.12-beta.2 → 3.1.12-beta.5
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/es/node_modules/date-fns/esm/differenceInCalendarYears/index.js +33 -0
- package/es/node_modules/date-fns/esm/differenceInYears/index.js +43 -0
- package/es/packages/big-table/src/bigTableState.js +1 -1
- package/es/packages/form-render/index.d.ts +9 -0
- package/es/packages/form-render/src/FormRender.vue.d.ts +10 -1
- package/es/packages/form-render/src/FormRender.vue_vue_type_script_setup_true_lang.js +1 -0
- package/es/packages/form-render/src/components/renderer/cascader.js +4 -3
- package/es/packages/form-render/src/constants/index.d.ts +9 -0
- package/es/packages/form-render/src/constants/index.js +11 -1
- package/es/packages/form-render/src/hooks/useAnchor.js +2 -2
- package/es/packages/form-render/src/hooks/useBusinessBinding.d.ts +7 -2
- package/es/packages/form-render/src/hooks/useBusinessBinding.js +40 -13
- package/es/packages/form-render/src/hooks/useFieldListAdaptor.js +17 -6
- package/es/packages/form-render/src/hooks/useFormContext.js +3 -2
- package/es/packages/form-render/src/hooks/usePresetScope.d.ts +6 -0
- package/es/packages/form-render/src/hooks/usePresetScope.js +21 -0
- package/es/packages/form-render/src/hooks/useTypeNormalize.js +4 -1
- package/es/packages/form-render/src/types/index.d.ts +9 -1
- package/es/packages/form-render/src/utils/index.d.ts +3 -1
- package/es/packages/form-render/src/utils/index.js +15 -3
- package/es/packages/index.css +11 -2
- package/es/packages/scale-view/index.d.ts +4 -0
- package/es/packages/scale-view/src/ScaleView.vue.d.ts +4 -0
- package/es/packages/scale-view/src/ScaleView.vue_vue_type_script_setup_true_lang.js +11 -10
- package/es/packages/scale-view/src/components/EvaluateCountdown.vue.d.ts +4 -0
- package/es/packages/scale-view/src/components/EvaluateCountdown.vue_vue_type_script_setup_true_lang.js +7 -2
- package/es/packages/scale-view/src/components/formitem/r-collection.d.ts +1 -1
- package/es/packages/scale-view/src/components/formitem/r-collection.js +2 -4
- package/es/packages/scale-view/src/components/formitem/r-input.js +0 -2
- package/es/packages/scale-view/src/components/formitem/r-select.js +56 -2
- package/es/packages/scale-view/src/hooks/scaleview-computed.js +17 -10
- package/es/packages/scale-view/src/hooks/scaleview-init.js +11 -3
- package/es/packages/scale-view/src/hooks/use-component.d.ts +5 -5
- package/es/packages/scale-view/src/utils/judge-types.js +2 -1
- package/es/packages/scale-view/style/index.css +11 -2
- package/package.json +1 -1
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import toDate from '../toDate/index.js';
|
|
2
|
+
import requiredArgs from '../_lib/requiredArgs/index.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @name differenceInCalendarYears
|
|
6
|
+
* @category Year Helpers
|
|
7
|
+
* @summary Get the number of calendar years between the given dates.
|
|
8
|
+
*
|
|
9
|
+
* @description
|
|
10
|
+
* Get the number of calendar years between the given dates.
|
|
11
|
+
*
|
|
12
|
+
* @param {Date|Number} dateLeft - the later date
|
|
13
|
+
* @param {Date|Number} dateRight - the earlier date
|
|
14
|
+
* @returns {Number} the number of calendar years
|
|
15
|
+
* @throws {TypeError} 2 arguments required
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* // How many calendar years are between 31 December 2013 and 11 February 2015?
|
|
19
|
+
* const result = differenceInCalendarYears(
|
|
20
|
+
* new Date(2015, 1, 11),
|
|
21
|
+
* new Date(2013, 11, 31)
|
|
22
|
+
* )
|
|
23
|
+
* //=> 2
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
function differenceInCalendarYears(dirtyDateLeft, dirtyDateRight) {
|
|
27
|
+
requiredArgs(2, arguments);
|
|
28
|
+
var dateLeft = toDate(dirtyDateLeft);
|
|
29
|
+
var dateRight = toDate(dirtyDateRight);
|
|
30
|
+
return dateLeft.getFullYear() - dateRight.getFullYear();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { differenceInCalendarYears as default };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import toDate from '../toDate/index.js';
|
|
2
|
+
import differenceInCalendarYears from '../differenceInCalendarYears/index.js';
|
|
3
|
+
import compareAsc from '../compareAsc/index.js';
|
|
4
|
+
import requiredArgs from '../_lib/requiredArgs/index.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @name differenceInYears
|
|
8
|
+
* @category Year Helpers
|
|
9
|
+
* @summary Get the number of full years between the given dates.
|
|
10
|
+
*
|
|
11
|
+
* @description
|
|
12
|
+
* Get the number of full years between the given dates.
|
|
13
|
+
*
|
|
14
|
+
* @param {Date|Number} dateLeft - the later date
|
|
15
|
+
* @param {Date|Number} dateRight - the earlier date
|
|
16
|
+
* @returns {Number} the number of full years
|
|
17
|
+
* @throws {TypeError} 2 arguments required
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* // How many full years are between 31 December 2013 and 11 February 2015?
|
|
21
|
+
* const result = differenceInYears(new Date(2015, 1, 11), new Date(2013, 11, 31))
|
|
22
|
+
* //=> 1
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
function differenceInYears(dirtyDateLeft, dirtyDateRight) {
|
|
26
|
+
requiredArgs(2, arguments);
|
|
27
|
+
var dateLeft = toDate(dirtyDateLeft);
|
|
28
|
+
var dateRight = toDate(dirtyDateRight);
|
|
29
|
+
var sign = compareAsc(dateLeft, dateRight);
|
|
30
|
+
var difference = Math.abs(differenceInCalendarYears(dateLeft, dateRight)); // Set both dates to a valid leap year for accurate comparison when dealing
|
|
31
|
+
// with leap days
|
|
32
|
+
|
|
33
|
+
dateLeft.setFullYear(1584);
|
|
34
|
+
dateRight.setFullYear(1584); // Math.abs(diff in full years - diff in calendar years) === 1 if last calendar year is not full
|
|
35
|
+
// If so, result must be decreased by 1 in absolute value
|
|
36
|
+
|
|
37
|
+
var isLastYearNotFull = compareAsc(dateLeft, dateRight) === -sign;
|
|
38
|
+
var result = sign * (difference - Number(isLastYearNotFull)); // Prevent negative zero
|
|
39
|
+
|
|
40
|
+
return result === 0 ? 0 : result;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export { differenceInYears as default };
|
|
@@ -92,6 +92,9 @@ declare const FormRender: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
92
92
|
type: import("vue").PropType<Record<string, import("vue").Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions> | import("vue").FunctionalComponent<{}, {}>>>;
|
|
93
93
|
default: () => {};
|
|
94
94
|
};
|
|
95
|
+
businessFilter: {
|
|
96
|
+
type: import("vue").PropType<import("./src/types").FormBusinessFilter>;
|
|
97
|
+
};
|
|
95
98
|
scope: {
|
|
96
99
|
type: import("vue").PropType<import("../../../es/src/types").AnyObject>;
|
|
97
100
|
default: () => {};
|
|
@@ -194,6 +197,9 @@ declare const FormRender: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
194
197
|
type: import("vue").PropType<Record<string, import("vue").Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions> | import("vue").FunctionalComponent<{}, {}>>>;
|
|
195
198
|
default: () => {};
|
|
196
199
|
};
|
|
200
|
+
businessFilter: {
|
|
201
|
+
type: import("vue").PropType<import("./src/types").FormBusinessFilter>;
|
|
202
|
+
};
|
|
197
203
|
scope: {
|
|
198
204
|
type: import("vue").PropType<import("../../../es/src/types").AnyObject>;
|
|
199
205
|
default: () => {};
|
|
@@ -1383,6 +1389,9 @@ declare const FormRender: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
1383
1389
|
type: import("vue").PropType<Record<string, import("vue").Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions> | import("vue").FunctionalComponent<{}, {}>>>;
|
|
1384
1390
|
default: () => {};
|
|
1385
1391
|
};
|
|
1392
|
+
businessFilter: {
|
|
1393
|
+
type: import("vue").PropType<import("./src/types").FormBusinessFilter>;
|
|
1394
|
+
};
|
|
1386
1395
|
scope: {
|
|
1387
1396
|
type: import("vue").PropType<import("../../../es/src/types").AnyObject>;
|
|
1388
1397
|
default: () => {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="lodash" />
|
|
2
2
|
import { AnyObject } from '../../../../es/src/types';
|
|
3
3
|
import { Component, FunctionalComponent, PropType } from 'vue';
|
|
4
|
-
import { FieldItem, FieldVisitor } from './types';
|
|
4
|
+
import { FieldItem, FieldVisitor, FormBusinessFilter } from './types';
|
|
5
5
|
declare const _default: import("vue").DefineComponent<{
|
|
6
6
|
fieldList: {
|
|
7
7
|
type: PropType<FieldItem[]>;
|
|
@@ -92,6 +92,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
92
92
|
type: PropType<Record<string, Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions> | FunctionalComponent<{}, {}>>>;
|
|
93
93
|
default: () => {};
|
|
94
94
|
};
|
|
95
|
+
businessFilter: {
|
|
96
|
+
type: PropType<FormBusinessFilter>;
|
|
97
|
+
};
|
|
95
98
|
scope: {
|
|
96
99
|
type: PropType<AnyObject>;
|
|
97
100
|
default: () => {};
|
|
@@ -194,6 +197,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
194
197
|
type: PropType<Record<string, Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions> | FunctionalComponent<{}, {}>>>;
|
|
195
198
|
default: () => {};
|
|
196
199
|
};
|
|
200
|
+
businessFilter: {
|
|
201
|
+
type: PropType<FormBusinessFilter>;
|
|
202
|
+
};
|
|
197
203
|
scope: {
|
|
198
204
|
type: PropType<AnyObject>;
|
|
199
205
|
default: () => {};
|
|
@@ -1383,6 +1389,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
1383
1389
|
type: PropType<Record<string, Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions> | FunctionalComponent<{}, {}>>>;
|
|
1384
1390
|
default: () => {};
|
|
1385
1391
|
};
|
|
1392
|
+
businessFilter: {
|
|
1393
|
+
type: PropType<FormBusinessFilter>;
|
|
1394
|
+
};
|
|
1386
1395
|
scope: {
|
|
1387
1396
|
type: PropType<AnyObject>;
|
|
1388
1397
|
default: () => {};
|
|
@@ -57,7 +57,7 @@ const script = defineComponent({
|
|
|
57
57
|
}
|
|
58
58
|
arrayed(config.dependKey).forEach((key) => {
|
|
59
59
|
if (isString(key)) {
|
|
60
|
-
params[key] = option[
|
|
60
|
+
params[key] = option[valueKey.value];
|
|
61
61
|
} else if (isObject(key)) {
|
|
62
62
|
params[key.paramName] = option[key.paramValue];
|
|
63
63
|
}
|
|
@@ -80,12 +80,13 @@ const script = defineComponent({
|
|
|
80
80
|
currentOption = currentOption.parent;
|
|
81
81
|
}
|
|
82
82
|
updateValue(null, null, result2);
|
|
83
|
+
show.value = false;
|
|
83
84
|
return;
|
|
84
85
|
}
|
|
85
86
|
const result = data.reduce((res, d) => {
|
|
86
87
|
res.push({
|
|
87
|
-
[
|
|
88
|
-
[
|
|
88
|
+
[labelKey.value]: d[labelKey.value],
|
|
89
|
+
[valueKey.value]: d[valueKey.value],
|
|
89
90
|
depth: parentDepth + 1,
|
|
90
91
|
parent: option,
|
|
91
92
|
isLeaf: parentDepth + 2 >= props.deep
|
|
@@ -13,6 +13,7 @@ export declare enum FIELD_BUSINESS_TYPE {
|
|
|
13
13
|
PASSWORD = "password",
|
|
14
14
|
ID_CARD = "id_card",
|
|
15
15
|
AGE = "age",
|
|
16
|
+
AGE_UNIT = "age_unit",
|
|
16
17
|
MOBILE = "mobile",
|
|
17
18
|
TELEPHONE = "telephone",
|
|
18
19
|
EMAIL = "email",
|
|
@@ -28,3 +29,11 @@ export declare enum FIELD_SEX_VALUE {
|
|
|
28
29
|
MALE = "1",
|
|
29
30
|
FEMALE = "2"
|
|
30
31
|
}
|
|
32
|
+
export declare enum FIELD_AGE_UNIT {
|
|
33
|
+
DAY = "D",
|
|
34
|
+
MONTH = "M",
|
|
35
|
+
YEAR = "Y",
|
|
36
|
+
HOUR = "H",
|
|
37
|
+
WEEK = "W",
|
|
38
|
+
MINUTE = "N"
|
|
39
|
+
}
|
|
@@ -9,6 +9,7 @@ var FIELD_BUSINESS_TYPE = /* @__PURE__ */ ((FIELD_BUSINESS_TYPE2) => {
|
|
|
9
9
|
FIELD_BUSINESS_TYPE2["PASSWORD"] = "password";
|
|
10
10
|
FIELD_BUSINESS_TYPE2["ID_CARD"] = "id_card";
|
|
11
11
|
FIELD_BUSINESS_TYPE2["AGE"] = "age";
|
|
12
|
+
FIELD_BUSINESS_TYPE2["AGE_UNIT"] = "age_unit";
|
|
12
13
|
FIELD_BUSINESS_TYPE2["MOBILE"] = "mobile";
|
|
13
14
|
FIELD_BUSINESS_TYPE2["TELEPHONE"] = "telephone";
|
|
14
15
|
FIELD_BUSINESS_TYPE2["EMAIL"] = "email";
|
|
@@ -26,5 +27,14 @@ var FIELD_SEX_VALUE = /* @__PURE__ */ ((FIELD_SEX_VALUE2) => {
|
|
|
26
27
|
FIELD_SEX_VALUE2["FEMALE"] = "2";
|
|
27
28
|
return FIELD_SEX_VALUE2;
|
|
28
29
|
})(FIELD_SEX_VALUE || {});
|
|
30
|
+
var FIELD_AGE_UNIT = /* @__PURE__ */ ((FIELD_AGE_UNIT2) => {
|
|
31
|
+
FIELD_AGE_UNIT2["DAY"] = "D";
|
|
32
|
+
FIELD_AGE_UNIT2["MONTH"] = "M";
|
|
33
|
+
FIELD_AGE_UNIT2["YEAR"] = "Y";
|
|
34
|
+
FIELD_AGE_UNIT2["HOUR"] = "H";
|
|
35
|
+
FIELD_AGE_UNIT2["WEEK"] = "W";
|
|
36
|
+
FIELD_AGE_UNIT2["MINUTE"] = "N";
|
|
37
|
+
return FIELD_AGE_UNIT2;
|
|
38
|
+
})(FIELD_AGE_UNIT || {});
|
|
29
39
|
|
|
30
|
-
export { FIELD_BUSINESS_TYPE, FIELD_SEX_VALUE, FormItemLineBarDepKeyPrepend, InjectAsyncQueue, InjectionBusinessCollector, InjectionChangeContextCollector, InjectionFormItemDepsCollector, InjectionFormUUID, InjectionSchemaField };
|
|
40
|
+
export { FIELD_AGE_UNIT, FIELD_BUSINESS_TYPE, FIELD_SEX_VALUE, FormItemLineBarDepKeyPrepend, InjectAsyncQueue, InjectionBusinessCollector, InjectionChangeContextCollector, InjectionFormItemDepsCollector, InjectionFormUUID, InjectionSchemaField };
|
|
@@ -57,9 +57,9 @@ function useAnchor(props, collector) {
|
|
|
57
57
|
}) || anchorIdList.value[anchorIdList.value.length - 1];
|
|
58
58
|
__currentAnchor.value = (_a = result == null ? void 0 : result.name) != null ? _a : "";
|
|
59
59
|
}, 300);
|
|
60
|
-
watch(anchorIdList, (
|
|
60
|
+
watch(anchorIdList, (_anchorIdList) => {
|
|
61
61
|
var _a, _b;
|
|
62
|
-
__currentAnchor.value = (_b = (_a =
|
|
62
|
+
__currentAnchor.value = (_b = (_a = _anchorIdList[0]) == null ? void 0 : _a.name) != null ? _b : "";
|
|
63
63
|
}, { deep: true, immediate: true });
|
|
64
64
|
const currentAnchor = computed({
|
|
65
65
|
get() {
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
import { Form } from '@formily/core';
|
|
2
|
+
import { FormBusinessFilter } from '../../../../../es/packages/form-render';
|
|
2
3
|
import { FIELD_BUSINESS_TYPE } from '../constants';
|
|
3
4
|
export declare class BusinessCollector {
|
|
4
5
|
private readonly typeCollector;
|
|
5
6
|
private readonly fieldNameCollector;
|
|
7
|
+
private readonly valueFilter;
|
|
8
|
+
constructor(valueFilter?: FormBusinessFilter);
|
|
6
9
|
collect(type: FIELD_BUSINESS_TYPE, fieldName: string): void;
|
|
7
10
|
getField(type: FIELD_BUSINESS_TYPE): string[];
|
|
8
11
|
getType(fieldName: string): FIELD_BUSINESS_TYPE | undefined;
|
|
9
|
-
|
|
12
|
+
private setAge;
|
|
13
|
+
private handlerIdCardType;
|
|
14
|
+
private handlerBirthdayType;
|
|
10
15
|
handlerMap: Map<FIELD_BUSINESS_TYPE, (formModel: Form, value: unknown) => void>;
|
|
11
16
|
trigger(formModel: Form, fieldName: string, value: unknown): void;
|
|
12
17
|
}
|
|
13
18
|
export declare function useBusinessBinding(): {
|
|
14
|
-
create: () => BusinessCollector;
|
|
19
|
+
create: (valueFilter?: FormBusinessFilter) => BusinessCollector;
|
|
15
20
|
};
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { isString } from '@vueuse/core';
|
|
2
|
-
import { FIELD_BUSINESS_TYPE } from '../constants/index.js';
|
|
3
|
-
import { isIdCard, parseIdCard } from '../utils/index.js';
|
|
2
|
+
import { FIELD_BUSINESS_TYPE, FIELD_AGE_UNIT } from '../constants/index.js';
|
|
3
|
+
import { isIdCard, parseIdCard, parseBirthday } from '../utils/index.js';
|
|
4
4
|
|
|
5
5
|
class BusinessCollector {
|
|
6
|
-
constructor() {
|
|
6
|
+
constructor(valueFilter = ({ value }) => value) {
|
|
7
7
|
this.typeCollector = /* @__PURE__ */ new Map();
|
|
8
8
|
this.fieldNameCollector = /* @__PURE__ */ new Map();
|
|
9
9
|
this.handlerMap = /* @__PURE__ */ new Map([
|
|
10
|
-
[FIELD_BUSINESS_TYPE.ID_CARD, this.handlerIdCardType.bind(this)]
|
|
10
|
+
[FIELD_BUSINESS_TYPE.ID_CARD, this.handlerIdCardType.bind(this)],
|
|
11
|
+
[FIELD_BUSINESS_TYPE.BIRTHDAY, this.handlerBirthdayType.bind(this)]
|
|
11
12
|
]);
|
|
13
|
+
this.valueFilter = valueFilter;
|
|
12
14
|
}
|
|
13
15
|
collect(type, fieldName) {
|
|
14
16
|
const set = this.typeCollector.get(type) || /* @__PURE__ */ new Set();
|
|
@@ -22,29 +24,54 @@ class BusinessCollector {
|
|
|
22
24
|
getType(fieldName) {
|
|
23
25
|
return this.fieldNameCollector.get(fieldName);
|
|
24
26
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
setAge(formModel, context) {
|
|
28
|
+
const value = context.day < 30 ? { ageUnit: FIELD_AGE_UNIT.DAY, age: context.day } : context.day < 365 ? { ageUnit: FIELD_AGE_UNIT.MONTH, age: context.month } : { ageUnit: FIELD_AGE_UNIT.YEAR, age: context.year };
|
|
29
|
+
const ageUnitFields = this.getField(FIELD_BUSINESS_TYPE.AGE_UNIT);
|
|
30
|
+
ageUnitFields.forEach((field) => {
|
|
31
|
+
formModel.setFieldState(field, (state) => {
|
|
32
|
+
state.value = this.valueFilter({
|
|
33
|
+
fieldKey: field,
|
|
34
|
+
value: value.ageUnit,
|
|
35
|
+
context,
|
|
36
|
+
type: FIELD_BUSINESS_TYPE.AGE_UNIT
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
});
|
|
29
40
|
const ageFields = this.getField(FIELD_BUSINESS_TYPE.AGE);
|
|
30
41
|
ageFields.forEach((field) => {
|
|
31
42
|
formModel.setFieldState(field, (state) => {
|
|
32
|
-
state.value =
|
|
43
|
+
state.value = this.valueFilter({
|
|
44
|
+
fieldKey: field,
|
|
45
|
+
value: ageUnitFields.length ? value.age : context.year,
|
|
46
|
+
context,
|
|
47
|
+
type: FIELD_BUSINESS_TYPE.AGE
|
|
48
|
+
});
|
|
33
49
|
});
|
|
34
50
|
});
|
|
51
|
+
}
|
|
52
|
+
handlerIdCardType(formModel, value) {
|
|
53
|
+
if (!value || !isString(value) || !isIdCard(value))
|
|
54
|
+
return;
|
|
55
|
+
const info = parseIdCard(value);
|
|
56
|
+
this.setAge(formModel, info);
|
|
35
57
|
const sexFields = this.getField(FIELD_BUSINESS_TYPE.SEX);
|
|
36
58
|
sexFields.forEach((field) => {
|
|
37
59
|
formModel.setFieldState(field, (state) => {
|
|
38
|
-
state.value = info.sex;
|
|
60
|
+
state.value = this.valueFilter({ fieldKey: field, value: info.sex, type: FIELD_BUSINESS_TYPE.SEX });
|
|
39
61
|
});
|
|
40
62
|
});
|
|
41
63
|
const birthdayFields = this.getField(FIELD_BUSINESS_TYPE.BIRTHDAY);
|
|
42
64
|
birthdayFields.forEach((field) => {
|
|
43
65
|
formModel.setFieldState(field, (state) => {
|
|
44
|
-
state.value = info.birthday;
|
|
66
|
+
state.value = this.valueFilter({ fieldKey: field, value: info.birthday, type: FIELD_BUSINESS_TYPE.BIRTHDAY });
|
|
45
67
|
});
|
|
46
68
|
});
|
|
47
69
|
}
|
|
70
|
+
handlerBirthdayType(formModel, value) {
|
|
71
|
+
if (!isString(value))
|
|
72
|
+
return;
|
|
73
|
+
this.setAge(formModel, parseBirthday(value));
|
|
74
|
+
}
|
|
48
75
|
trigger(formModel, fieldName, value) {
|
|
49
76
|
const type = this.getType(fieldName);
|
|
50
77
|
if (!type || !this.handlerMap.has(type))
|
|
@@ -53,8 +80,8 @@ class BusinessCollector {
|
|
|
53
80
|
}
|
|
54
81
|
}
|
|
55
82
|
function useBusinessBinding() {
|
|
56
|
-
function create() {
|
|
57
|
-
return new BusinessCollector();
|
|
83
|
+
function create(valueFilter) {
|
|
84
|
+
return new BusinessCollector(valueFilter);
|
|
58
85
|
}
|
|
59
86
|
return { create };
|
|
60
87
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { pick } from 'lodash-es';
|
|
1
|
+
import { isArray, pick } from 'lodash-es';
|
|
2
2
|
import { arrayed, transformDateFormat } from '../utils/index.js';
|
|
3
3
|
import { useFormValidator, useTypeNormalize } from '../../../../packages/form-render';
|
|
4
4
|
import { isObject } from '@vueuse/core';
|
|
@@ -17,7 +17,11 @@ function useFieldListAdaptor(collector, uuid) {
|
|
|
17
17
|
id: `${uuid}-${item.val_key}`
|
|
18
18
|
},
|
|
19
19
|
"x-component": item.html_type,
|
|
20
|
-
"x-component-props": {
|
|
20
|
+
"x-component-props": {
|
|
21
|
+
placeholder: item.placeholder,
|
|
22
|
+
clearable: item.is_empty === "1",
|
|
23
|
+
...item.componentProps || {}
|
|
24
|
+
},
|
|
21
25
|
"x-display": item.is_show === "0" ? "hidden" : "visible",
|
|
22
26
|
"x-pattern": item.is_edit === "0" ? "disabled" : "editable"
|
|
23
27
|
};
|
|
@@ -169,6 +173,7 @@ function useFieldListAdaptor(collector, uuid) {
|
|
|
169
173
|
}));
|
|
170
174
|
return {
|
|
171
175
|
type: "void",
|
|
176
|
+
name: fieldList.map((f) => f.val_key).join("-"),
|
|
172
177
|
title: item.alias || item.name,
|
|
173
178
|
"x-component": "INPUT_GROUP",
|
|
174
179
|
"x-component-props": { span: item.elem_width },
|
|
@@ -184,16 +189,22 @@ function useFieldListAdaptor(collector, uuid) {
|
|
|
184
189
|
const obj_type = (_a = cur.validate) == null ? void 0 : _a.obj_type;
|
|
185
190
|
obj_type && collector.collect(obj_type, cur.val_key);
|
|
186
191
|
if (cur.html_type === "LINEBAR") {
|
|
187
|
-
fin[cur
|
|
188
|
-
prevLinebar = fin[cur
|
|
192
|
+
fin[createFieldName(cur)] = createLinebarSchema(cur);
|
|
193
|
+
prevLinebar = fin[createFieldName(cur)].properties = {};
|
|
189
194
|
} else if (prevLinebar) {
|
|
190
|
-
prevLinebar[cur
|
|
195
|
+
prevLinebar[createFieldName(cur)] = createWidgetSchema(cur);
|
|
191
196
|
} else {
|
|
192
197
|
prevLinebar = null;
|
|
193
|
-
fin[cur
|
|
198
|
+
fin[createFieldName(cur)] = createWidgetSchema(cur);
|
|
194
199
|
}
|
|
195
200
|
return fin;
|
|
196
201
|
}, {});
|
|
202
|
+
function createFieldName(fieldItem) {
|
|
203
|
+
if (isArray(fieldItem.suffixConfig)) {
|
|
204
|
+
return [fieldItem.val_key, fieldItem.suffixConfig.map((f) => f.val_key)].join("-");
|
|
205
|
+
}
|
|
206
|
+
return fieldItem.val_key;
|
|
207
|
+
}
|
|
197
208
|
}
|
|
198
209
|
return { schemaAdaptor };
|
|
199
210
|
}
|
|
@@ -2,6 +2,7 @@ import { provide } from 'vue';
|
|
|
2
2
|
import { createSchemaField } from '@formily/vue';
|
|
3
3
|
import { useAsyncQueue, useBusinessBinding, useChangeContext, useFormItemDeps } from '../../../../packages/form-render';
|
|
4
4
|
import * as components from '../../../../packages/form-render/src/components/renderer';
|
|
5
|
+
import { usePresetScope } from '../../../../packages/form-render/src/hooks/usePresetScope';
|
|
5
6
|
import { injectOrProvide, uuidGenerator } from '../../../../packages/form-render/src/utils';
|
|
6
7
|
import { InjectAsyncQueue, InjectionSchemaField, InjectionBusinessCollector, InjectionChangeContextCollector, InjectionFormItemDepsCollector, InjectionFormUUID } from '../../../../packages/form-render/src/constants';
|
|
7
8
|
|
|
@@ -12,9 +13,9 @@ function useFormContext(props) {
|
|
|
12
13
|
...components,
|
|
13
14
|
...props.components
|
|
14
15
|
},
|
|
15
|
-
scope: props.scope
|
|
16
|
+
scope: Object.assign({}, usePresetScope(), props.scope)
|
|
16
17
|
}).SchemaField);
|
|
17
|
-
const businessCollector = useBusinessBinding().create();
|
|
18
|
+
const businessCollector = useBusinessBinding().create(props.businessFilter);
|
|
18
19
|
provide(InjectionBusinessCollector, businessCollector);
|
|
19
20
|
const changeContextCollector = useChangeContext().create();
|
|
20
21
|
provide(InjectionChangeContextCollector, changeContextCollector);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { isString } from 'lodash-es';
|
|
2
|
+
import { isIdCard, isMobile } from '../../../../packages/form-render/src/utils';
|
|
3
|
+
|
|
4
|
+
function usePresetScope() {
|
|
5
|
+
return {
|
|
6
|
+
isIdCard(value) {
|
|
7
|
+
return isString(value) && isIdCard(value);
|
|
8
|
+
},
|
|
9
|
+
isMobile(value) {
|
|
10
|
+
return isString(value) && isMobile(value);
|
|
11
|
+
},
|
|
12
|
+
isEmail(value) {
|
|
13
|
+
return isString(value) && /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/.test(value);
|
|
14
|
+
},
|
|
15
|
+
isNumber(value) {
|
|
16
|
+
return isString(value) && /\d+/.test(value);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { usePresetScope };
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import { FIELD_BUSINESS_TYPE } from '../../../../packages/form-render/src/constants';
|
|
2
|
+
|
|
1
3
|
function useTypeNormalize() {
|
|
2
4
|
function normalizeAgeField(item) {
|
|
3
|
-
item.html_type = "
|
|
5
|
+
item.html_type = "INPUT_NUMBER";
|
|
4
6
|
item.suffixConfig = [
|
|
5
7
|
{
|
|
8
|
+
validate: { obj_type: FIELD_BUSINESS_TYPE.AGE_UNIT },
|
|
6
9
|
val_key: item.val_key_unit,
|
|
7
10
|
html_type: "SELECT",
|
|
8
11
|
option: item.option
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AnyObject } from '../../../../../es/src/types';
|
|
2
2
|
import { DataField, Field } from '@formily/core';
|
|
3
|
+
import { FIELD_BUSINESS_TYPE } from '../../../../../es/packages/form-render/src/constants';
|
|
3
4
|
import { FieldItem } from '../types';
|
|
4
5
|
import { AsyncQueue } from '../hooks';
|
|
5
6
|
export * from './fieldItem';
|
|
@@ -18,7 +19,8 @@ export interface FormAsyncQueueItem {
|
|
|
18
19
|
params?: AnyObject;
|
|
19
20
|
}
|
|
20
21
|
export declare type FormAsyncQueue = AsyncQueue<FormAsyncQueueItem, any, AnyObject[]>;
|
|
21
|
-
export declare type
|
|
22
|
+
export declare type AgeContext = Record<'age' | 'day' | 'month' | 'year', number>;
|
|
23
|
+
export declare type IdCardParseInfo = Record<'sex' | 'birthday', string> & AgeContext;
|
|
22
24
|
export declare type FormRenderExpose = {
|
|
23
25
|
validate(path?: string): Promise<void>;
|
|
24
26
|
getFormValues(): AnyObject;
|
|
@@ -35,3 +37,9 @@ export declare type FormChangePayload = {
|
|
|
35
37
|
fieldInstance: DataField;
|
|
36
38
|
context: FormChangeContext;
|
|
37
39
|
};
|
|
40
|
+
export declare type FormBusinessFilter = (payload: {
|
|
41
|
+
fieldKey: string;
|
|
42
|
+
value: unknown;
|
|
43
|
+
type: FIELD_BUSINESS_TYPE;
|
|
44
|
+
context?: any;
|
|
45
|
+
}) => unknown;
|
|
@@ -2,7 +2,7 @@ import { AnyObject } from '../../../../../es/src/types';
|
|
|
2
2
|
import { ISchema } from '@formily/json-schema/esm/types';
|
|
3
3
|
import { GeneralField } from '@formily/core';
|
|
4
4
|
import { InjectionKey } from 'vue';
|
|
5
|
-
import { IdCardParseInfo } from '../types';
|
|
5
|
+
import { AgeContext, IdCardParseInfo } from '../types';
|
|
6
6
|
export declare function formRenderLog(message: string, type?: keyof Console): void;
|
|
7
7
|
export declare function arrayed<T>(maybeArray: T): T extends Array<any> ? T : [T];
|
|
8
8
|
export declare function assignUpdateValue(props: AnyObject, field: GeneralField): {
|
|
@@ -10,6 +10,8 @@ export declare function assignUpdateValue(props: AnyObject, field: GeneralField)
|
|
|
10
10
|
};
|
|
11
11
|
export declare function transformDateFormat(format: string): "date" | "datetime";
|
|
12
12
|
export declare function isIdCard(idCardNo: string): boolean;
|
|
13
|
+
export declare function isMobile(mobile: string): boolean;
|
|
14
|
+
export declare function parseBirthday(birthday: string): AgeContext;
|
|
13
15
|
export declare function parseIdCard(idCardNo: string): IdCardParseInfo;
|
|
14
16
|
export declare function injectOrProvide<T>(key: InjectionKey<T>, creator: () => T): T;
|
|
15
17
|
export declare function generateUrlParams(field: GeneralField, dependKeys?: string | string[]): AnyObject;
|
|
@@ -3,6 +3,7 @@ import { FIELD_SEX_VALUE } from '../constants/index.js';
|
|
|
3
3
|
import { isField } from '@formily/core';
|
|
4
4
|
import differenceInDays from '../../../../node_modules/date-fns/esm/differenceInDays/index.js';
|
|
5
5
|
import differenceInMonths from '../../../../node_modules/date-fns/esm/differenceInMonths/index.js';
|
|
6
|
+
import differenceInYears from '../../../../node_modules/date-fns/esm/differenceInYears/index.js';
|
|
6
7
|
import '../../../../node_modules/date-fns/esm/parse/_lib/parsers/index.js';
|
|
7
8
|
import { inject, provide } from 'vue';
|
|
8
9
|
|
|
@@ -31,6 +32,18 @@ function transformDateFormat(format) {
|
|
|
31
32
|
function isIdCard(idCardNo) {
|
|
32
33
|
return /^\d{6}(((19|20)\d{2}(0[1-9]|1[0-2])(0[1-9]|[1-2]\d|3[0-1])\d{3}(\d|x|X))|(\d{2}(0[1-9]|1[0-2])(0[1-9]|[1-2]\d|3[0-1])\d{3}))$/.test(idCardNo);
|
|
33
34
|
}
|
|
35
|
+
function isMobile(mobile) {
|
|
36
|
+
return /^1(3\d|4[5-9]|5[0-35-9]|6[2567]|7[0-8]|8\d|9[0-35-9])\d{8}$/.test(mobile);
|
|
37
|
+
}
|
|
38
|
+
function parseBirthday(birthday) {
|
|
39
|
+
const result = {};
|
|
40
|
+
const d = new Date();
|
|
41
|
+
const birthDate = new Date(birthday);
|
|
42
|
+
result.day = differenceInDays(d, birthDate);
|
|
43
|
+
result.month = differenceInMonths(d, birthDate);
|
|
44
|
+
result.age = result.year = differenceInYears(d, birthDate);
|
|
45
|
+
return result;
|
|
46
|
+
}
|
|
34
47
|
function parseIdCard(idCardNo) {
|
|
35
48
|
const parseInner = (certificateNo, idxSexStart, birthYearSpan) => {
|
|
36
49
|
const res = {};
|
|
@@ -42,9 +55,8 @@ function parseIdCard(idCardNo) {
|
|
|
42
55
|
res.birthday = year + "-" + month + "-" + day;
|
|
43
56
|
const d = new Date();
|
|
44
57
|
const monthFloor = d.getMonth() + 1 < parseInt(month, 10) || d.getMonth() + 1 == parseInt(month, 10) && d.getDate() < parseInt(day, 10) ? 1 : 0;
|
|
58
|
+
Object.assign(res, parseBirthday(res.birthday));
|
|
45
59
|
res.age = res.year = d.getFullYear() - parseInt(year, 10) - monthFloor;
|
|
46
|
-
res.day = differenceInDays(d, new Date(res.birthday));
|
|
47
|
-
res.month = differenceInMonths(d, new Date(res.birthday));
|
|
48
60
|
return res;
|
|
49
61
|
};
|
|
50
62
|
return parseInner(idCardNo, idCardNo.length == 15 ? 14 : 16, idCardNo.length == 15 ? 2 : 4);
|
|
@@ -84,4 +96,4 @@ function uuidGenerator() {
|
|
|
84
96
|
});
|
|
85
97
|
}
|
|
86
98
|
|
|
87
|
-
export { arrayed, assignUpdateValue, formRenderLog, generateUrlParams, injectOrProvide, isIdCard, parseIdCard, transformDateFormat, traverseSchema, uuidGenerator };
|
|
99
|
+
export { arrayed, assignUpdateValue, formRenderLog, generateUrlParams, injectOrProvide, isIdCard, isMobile, parseBirthday, parseIdCard, transformDateFormat, traverseSchema, uuidGenerator };
|
package/es/packages/index.css
CHANGED
|
@@ -1669,6 +1669,7 @@ body > .vxe-table--tooltip-wrapper {
|
|
|
1669
1669
|
cursor: pointer;
|
|
1670
1670
|
}
|
|
1671
1671
|
.c-scale .linebar-div {
|
|
1672
|
+
width: 100%;
|
|
1672
1673
|
text-align: center;
|
|
1673
1674
|
margin-top: 24px;
|
|
1674
1675
|
}
|
|
@@ -1687,6 +1688,12 @@ body > .vxe-table--tooltip-wrapper {
|
|
|
1687
1688
|
.main {
|
|
1688
1689
|
box-sizing: border-box;
|
|
1689
1690
|
}
|
|
1691
|
+
.main .n-form-item.n-form-item--top-labelled .n-form-item-label {
|
|
1692
|
+
display: block;
|
|
1693
|
+
}
|
|
1694
|
+
.main .n-form-item .n-form-item-blank {
|
|
1695
|
+
display: block;
|
|
1696
|
+
}
|
|
1690
1697
|
.main .scale-label-required {
|
|
1691
1698
|
font-weight: 700;
|
|
1692
1699
|
}
|
|
@@ -1694,6 +1701,9 @@ body > .vxe-table--tooltip-wrapper {
|
|
|
1694
1701
|
color: #e02828;
|
|
1695
1702
|
font-weight: 700;
|
|
1696
1703
|
}
|
|
1704
|
+
.main .score-i {
|
|
1705
|
+
word-break: keep-all;
|
|
1706
|
+
}
|
|
1697
1707
|
.main .evalute-label {
|
|
1698
1708
|
display: inline-block;
|
|
1699
1709
|
height: 20px;
|
|
@@ -1754,8 +1764,6 @@ body > .vxe-table--tooltip-wrapper {
|
|
|
1754
1764
|
}
|
|
1755
1765
|
.n-dialog.n-modal.c-evatip-dialog-wrap .n-base-icon {
|
|
1756
1766
|
position: absolute;
|
|
1757
|
-
right: 16px;
|
|
1758
|
-
top: 16px;
|
|
1759
1767
|
margin: 0;
|
|
1760
1768
|
color: #666666;
|
|
1761
1769
|
}
|
|
@@ -2113,6 +2121,7 @@ body > .vxe-table--tooltip-wrapper {
|
|
|
2113
2121
|
.c-scale-collection.prompt-message .prompt-message-content {
|
|
2114
2122
|
line-height: 16px;
|
|
2115
2123
|
font-size: 14px;
|
|
2124
|
+
word-break: break-all;
|
|
2116
2125
|
}
|
|
2117
2126
|
.c-time-range {
|
|
2118
2127
|
display: flex;
|
|
@@ -503,6 +503,10 @@ declare const CScaleView: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
503
503
|
init: () => void;
|
|
504
504
|
checkType: (val: any) => string;
|
|
505
505
|
diffAnswered: (form: any) => void;
|
|
506
|
+
getCountdownObj: () => {
|
|
507
|
+
setAnswered: number;
|
|
508
|
+
totalLen: number;
|
|
509
|
+
};
|
|
506
510
|
SvgIcon: import("vue").DefineComponent<{
|
|
507
511
|
iconClass: {
|
|
508
512
|
type: StringConstructor;
|
|
@@ -503,6 +503,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
503
503
|
init: () => void;
|
|
504
504
|
checkType: (val: any) => string;
|
|
505
505
|
diffAnswered: (form: any) => void;
|
|
506
|
+
getCountdownObj: () => {
|
|
507
|
+
setAnswered: number;
|
|
508
|
+
totalLen: number;
|
|
509
|
+
};
|
|
506
510
|
SvgIcon: import("vue").DefineComponent<{
|
|
507
511
|
iconClass: {
|
|
508
512
|
type: StringConstructor;
|
|
@@ -140,7 +140,7 @@ var script = /* @__PURE__ */ defineComponent({
|
|
|
140
140
|
return;
|
|
141
141
|
}
|
|
142
142
|
let key = "getSubjectAnswer";
|
|
143
|
-
const fn = ((_a =
|
|
143
|
+
const fn = ((_a = props.scaleApiConfig) == null ? void 0 : _a[key]) || null;
|
|
144
144
|
if (!fn || typeof fn !== "function") {
|
|
145
145
|
message.error(`${key} Is not a function`);
|
|
146
146
|
return;
|
|
@@ -228,6 +228,7 @@ var script = /* @__PURE__ */ defineComponent({
|
|
|
228
228
|
};
|
|
229
229
|
};
|
|
230
230
|
const onSubmit = () => {
|
|
231
|
+
var _a;
|
|
231
232
|
let hasEvaluate = state.formArray.find((item) => isEvaluation(item.type));
|
|
232
233
|
if (!hasEvaluate) {
|
|
233
234
|
confirmSubmit("\u786E\u8BA4\u8981\u63D0\u4EA4\u5417\uFF1F");
|
|
@@ -242,15 +243,15 @@ var script = /* @__PURE__ */ defineComponent({
|
|
|
242
243
|
emit("submitNoRequest");
|
|
243
244
|
return;
|
|
244
245
|
}
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
246
|
+
let message2 = "\u786E\u5B9A\u8981\u63D0\u524D\u7ED3\u675F\u6D4B\u8BC4\u5417\uFF1F";
|
|
247
|
+
if (showEvaluateCoundownPage.value && ((_a = countdownDom.value) == null ? void 0 : _a.getCountdownObj)) {
|
|
248
|
+
const evaCountdownObj = countdownDom.value.getCountdownObj();
|
|
249
|
+
const { setAnswered, totalLen } = evaCountdownObj;
|
|
250
|
+
if (setAnswered < totalLen) {
|
|
251
|
+
message2 = "\u5B58\u5728\u672A\u4F5C\u7B54\u7684\u9898\u76EE\uFF0C\u786E\u5B9A\u8981\u63D0\u524D\u7ED3\u675F\u6D4B\u8BC4\u5417\uFF1F";
|
|
252
|
+
} else {
|
|
253
|
+
!(state == null ? void 0 : state.showEvaluateCountdown) && (message2 = "\u786E\u8BA4\u8981\u7ED3\u675F\u6D4B\u8BC4\u5417\uFF1F");
|
|
254
|
+
}
|
|
254
255
|
}
|
|
255
256
|
confirmSubmit(message2);
|
|
256
257
|
};
|
|
@@ -71,6 +71,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
71
71
|
init: () => void;
|
|
72
72
|
checkType: (val: any) => string;
|
|
73
73
|
diffAnswered: (form: any) => void;
|
|
74
|
+
getCountdownObj: () => {
|
|
75
|
+
setAnswered: number;
|
|
76
|
+
totalLen: number;
|
|
77
|
+
};
|
|
74
78
|
SvgIcon: import("vue").DefineComponent<{
|
|
75
79
|
iconClass: {
|
|
76
80
|
type: StringConstructor;
|
|
@@ -75,9 +75,14 @@ var script = /* @__PURE__ */ defineComponent({
|
|
|
75
75
|
console.log(val, "\u89E6\u53D1\u4FEE\u6539\u5566\u5566\u5566");
|
|
76
76
|
diffAnswered(val);
|
|
77
77
|
}, { immediate: true, deep: true });
|
|
78
|
+
const getCountdownObj = () => {
|
|
79
|
+
return {
|
|
80
|
+
setAnswered: state.setAnswered,
|
|
81
|
+
totalLen: evaluateState.totalLen
|
|
82
|
+
};
|
|
83
|
+
};
|
|
78
84
|
expose({
|
|
79
|
-
|
|
80
|
-
totalLen: evaluateState.totalLen
|
|
85
|
+
getCountdownObj
|
|
81
86
|
});
|
|
82
87
|
return (_ctx, _cache) => {
|
|
83
88
|
return openBlock(), createElementBlock("div", {
|
|
@@ -11,7 +11,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
11
11
|
type: BooleanConstructor;
|
|
12
12
|
default: boolean;
|
|
13
13
|
};
|
|
14
|
-
}, () => JSX.Element
|
|
14
|
+
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, never[], never, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
15
15
|
form: {
|
|
16
16
|
type: ObjectConstructor;
|
|
17
17
|
default: () => {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, computed, createVNode, resolveComponent, createTextVNode } from 'vue';
|
|
1
|
+
import { defineComponent, computed, createVNode, withDirectives, vShow, resolveComponent, createTextVNode } from 'vue';
|
|
2
2
|
import { NDivider, NIcon } from 'naive-ui';
|
|
3
3
|
import { AlertCircleOutline } from '@vicons/ionicons5';
|
|
4
4
|
|
|
@@ -59,11 +59,9 @@ var RCollection = defineComponent({
|
|
|
59
59
|
}, [describe])]);
|
|
60
60
|
};
|
|
61
61
|
const renderLinebar = () => {
|
|
62
|
-
if (!props.item.title)
|
|
63
|
-
return null;
|
|
64
62
|
return createVNode("div", {
|
|
65
63
|
"class": "linebar-div"
|
|
66
|
-
}, [createVNode("span", null, [props.item.title]), createVNode(resolveComponent("n-divider"), null, null)]);
|
|
64
|
+
}, [withDirectives(createVNode("span", null, [props.item.title]), [[vShow, props.item.title]]), createVNode(resolveComponent("n-divider"), null, null)]);
|
|
67
65
|
};
|
|
68
66
|
const renderPrompt = () => {
|
|
69
67
|
return createVNode("div", {
|
|
@@ -59,6 +59,58 @@ var scriptSelect = defineComponent({
|
|
|
59
59
|
var _a, _b;
|
|
60
60
|
return !!((_b = (_a = props.item) == null ? void 0 : _a.setting) == null ? void 0 : _b.isMultiple);
|
|
61
61
|
});
|
|
62
|
+
const isDynamic2Static = computed(() => {
|
|
63
|
+
let {
|
|
64
|
+
targetSource = {},
|
|
65
|
+
options = [],
|
|
66
|
+
optionType
|
|
67
|
+
} = props.item || {};
|
|
68
|
+
if (targetSource.target_id && (options.length || optionType == 3))
|
|
69
|
+
return true;
|
|
70
|
+
return false;
|
|
71
|
+
});
|
|
72
|
+
const columnKey = computed(() => {
|
|
73
|
+
var _a;
|
|
74
|
+
let {
|
|
75
|
+
target_id,
|
|
76
|
+
values
|
|
77
|
+
} = ((_a = props.item) == null ? void 0 : _a.targetSource) || {};
|
|
78
|
+
if (!target_id || !values)
|
|
79
|
+
return "value";
|
|
80
|
+
if (isDynamic2Static.value)
|
|
81
|
+
return values || "value";
|
|
82
|
+
return values;
|
|
83
|
+
});
|
|
84
|
+
const labelKey = computed(() => {
|
|
85
|
+
var _a;
|
|
86
|
+
let {
|
|
87
|
+
target_id,
|
|
88
|
+
showField
|
|
89
|
+
} = ((_a = props.item) == null ? void 0 : _a.targetSource) || {};
|
|
90
|
+
if (!target_id || !showField)
|
|
91
|
+
return "label";
|
|
92
|
+
if (isDynamic2Static.value)
|
|
93
|
+
return showField || "label";
|
|
94
|
+
return showField;
|
|
95
|
+
});
|
|
96
|
+
const handleDynamic2StaticOptions = (options) => {
|
|
97
|
+
if (!options || !options.length)
|
|
98
|
+
return [];
|
|
99
|
+
return options.map((item) => {
|
|
100
|
+
if ("cascadeData" in item) {
|
|
101
|
+
Object.assign(item, {
|
|
102
|
+
...item.cascadeData
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
if (!(columnKey.value in item)) {
|
|
106
|
+
item[columnKey.value] = item.value || item.label;
|
|
107
|
+
}
|
|
108
|
+
if (!(labelKey.value in item)) {
|
|
109
|
+
item[labelKey.value] = item.label;
|
|
110
|
+
}
|
|
111
|
+
return item;
|
|
112
|
+
});
|
|
113
|
+
};
|
|
62
114
|
const initSelectOptions = async () => {
|
|
63
115
|
const {
|
|
64
116
|
targetSource,
|
|
@@ -69,8 +121,8 @@ var scriptSelect = defineComponent({
|
|
|
69
121
|
state.showField = "label";
|
|
70
122
|
if (!(targetSource == null ? void 0 : targetSource.target_id))
|
|
71
123
|
return;
|
|
72
|
-
if (
|
|
73
|
-
state.curOptions = options;
|
|
124
|
+
if (isDynamic2Static.value) {
|
|
125
|
+
state.curOptions = handleDynamic2StaticOptions(options);
|
|
74
126
|
return;
|
|
75
127
|
}
|
|
76
128
|
try {
|
|
@@ -134,6 +186,8 @@ var scriptSelect = defineComponent({
|
|
|
134
186
|
"onUpdate:value": [($event) => props.form[props.item.val_key] = $event, handleSelectChange],
|
|
135
187
|
"filterable": true,
|
|
136
188
|
"placeholder": "\u8BF7\u9009\u62E9",
|
|
189
|
+
"value-field": columnKey.value,
|
|
190
|
+
"label-field": labelKey.value,
|
|
137
191
|
"multiple": isMultiple.value,
|
|
138
192
|
"disabled": props.isLock,
|
|
139
193
|
"loading": state.fetching,
|
|
@@ -32,7 +32,7 @@ const ScaleViewComputed = (props, state, config) => {
|
|
|
32
32
|
XS: "extrasmall"
|
|
33
33
|
};
|
|
34
34
|
fontSize = keyValue[fontSize];
|
|
35
|
-
const scale = fontSize &&
|
|
35
|
+
const scale = fontSize && (props == null ? void 0 : props.fontSizeObj[fontSize]) || 1;
|
|
36
36
|
const size = 1e4;
|
|
37
37
|
const value = Math.floor(100 / scale * size) / size;
|
|
38
38
|
return {
|
|
@@ -58,7 +58,7 @@ const ScaleViewComputed = (props, state, config) => {
|
|
|
58
58
|
if (!isEvaluation(type))
|
|
59
59
|
return tempTile;
|
|
60
60
|
let score = handleEvaluationScore(item);
|
|
61
|
-
return `${tempTile} <span style="color:#2d7aff;">${score}</span>`;
|
|
61
|
+
return `${tempTile} <span style="color:#2d7aff;" class="score-i">${score}</span>`;
|
|
62
62
|
});
|
|
63
63
|
const hasScore = computed(() => {
|
|
64
64
|
let { config: config2 } = state;
|
|
@@ -91,7 +91,9 @@ const ScaleViewComputed = (props, state, config) => {
|
|
|
91
91
|
return state.paramsEvaluate && Object.keys(state.paramsEvaluate).length;
|
|
92
92
|
});
|
|
93
93
|
const hasDefault = computed(() => {
|
|
94
|
-
let hash = window.location.
|
|
94
|
+
let hash = window.location.search;
|
|
95
|
+
if (!hash)
|
|
96
|
+
return;
|
|
95
97
|
let defaultVariable = ["evaname", "evadesc", "evast", "evadur", "evaan"];
|
|
96
98
|
let hasDefaultItem = defaultVariable.find((item) => hash.includes(item));
|
|
97
99
|
return state.paramsEvaluate || hasDefaultItem;
|
|
@@ -118,7 +120,12 @@ const ScaleViewComputed = (props, state, config) => {
|
|
|
118
120
|
const showAnswerParse = computed(() => (item) => {
|
|
119
121
|
var _a;
|
|
120
122
|
let { evaluateAnswer, checkAnswerMode, evaluateStartTime, evaluateTime } = ((_a = state.config) == null ? void 0 : _a.evaluateResultSetting) || {};
|
|
121
|
-
let arr = [
|
|
123
|
+
let arr = [
|
|
124
|
+
"EVALUATE_RADIO_BLOCK",
|
|
125
|
+
"EVALUATE_CHECKBOX_BLOCK",
|
|
126
|
+
"EVALUATE_SELECT",
|
|
127
|
+
"EVALUATE_INPUT"
|
|
128
|
+
];
|
|
122
129
|
let maxScore = (item == null ? void 0 : item.scoreConfigs) || 0;
|
|
123
130
|
let isShow = evaluateAnswer && state.isFinished && arr.includes(item.type) && maxScore;
|
|
124
131
|
if (!evaluateStartTime || !evaluateTime || checkAnswerMode && checkAnswerMode == 1) {
|
|
@@ -172,12 +179,12 @@ const ScaleViewComputed = (props, state, config) => {
|
|
|
172
179
|
};
|
|
173
180
|
});
|
|
174
181
|
const comProsMap = {
|
|
175
|
-
RSelectCom: selectProps.value,
|
|
176
|
-
RCascaderCom: cascaderProps.value,
|
|
177
|
-
RUploadCom: uploadProps.value,
|
|
178
|
-
RMapCom: mapProps.value,
|
|
179
|
-
RVodChunkUploadCom: vodChunkUploadProps.value,
|
|
180
|
-
CSelectLabelCom: selectLabelProps.value
|
|
182
|
+
"RSelectCom": selectProps.value,
|
|
183
|
+
"RCascaderCom": cascaderProps.value,
|
|
184
|
+
"RUploadCom": uploadProps.value,
|
|
185
|
+
"RMapCom": mapProps.value,
|
|
186
|
+
"RVodChunkUploadCom": vodChunkUploadProps.value,
|
|
187
|
+
"CSelectLabelCom": selectLabelProps.value
|
|
181
188
|
};
|
|
182
189
|
const propsConfig = computed(() => (item, index) => {
|
|
183
190
|
var _a;
|
|
@@ -10,7 +10,12 @@ import { useDialog } from 'naive-ui';
|
|
|
10
10
|
const ScaleViewInit = (props, state, emit, config) => {
|
|
11
11
|
const dialog = useDialog();
|
|
12
12
|
const { setNoData } = useNoData();
|
|
13
|
-
const {
|
|
13
|
+
const {
|
|
14
|
+
hasEvaluateResultSetting,
|
|
15
|
+
hasparamsEvaluate,
|
|
16
|
+
hasDefault,
|
|
17
|
+
formKey
|
|
18
|
+
} = ScaleViewComputed(props, state, config);
|
|
14
19
|
const { formatRules } = ScaleViewValidate(props, state, config);
|
|
15
20
|
const { nextLogicEvent } = useEvent(props, state);
|
|
16
21
|
const setEvaluateStartTime = (evaluateResultSetting) => {
|
|
@@ -189,8 +194,12 @@ const ScaleViewInit = (props, state, emit, config) => {
|
|
|
189
194
|
item.relationLogic = relationLogicObj;
|
|
190
195
|
};
|
|
191
196
|
const handleFrontAddress = (list) => {
|
|
197
|
+
var _a, _b;
|
|
192
198
|
if (!list || !list.length)
|
|
193
199
|
return;
|
|
200
|
+
let query = handleQueryParams();
|
|
201
|
+
if ((props == null ? void 0 : props.noBtn) || (query == null ? void 0 : query.noBtn))
|
|
202
|
+
return;
|
|
194
203
|
let matchItem = list.find((item) => item.type === "FRONT_ADDRESS");
|
|
195
204
|
if (!matchItem || !Object.keys(matchItem).length)
|
|
196
205
|
return;
|
|
@@ -200,8 +209,7 @@ const ScaleViewInit = (props, state, emit, config) => {
|
|
|
200
209
|
}
|
|
201
210
|
if (!setting || !Object.keys(setting).length)
|
|
202
211
|
return;
|
|
203
|
-
|
|
204
|
-
if ((query == null ? void 0 : query.redirect) == 1)
|
|
212
|
+
if ((query == null ? void 0 : query.redirect) == 1 || ((_a = props.params) == null ? void 0 : _a.redirect) == 1 || query.isEdit == 3 || ((_b = props.params) == null ? void 0 : _b.isEdit) == 3)
|
|
205
213
|
return;
|
|
206
214
|
let { frontAddress } = setting;
|
|
207
215
|
if (frontAddress) {
|
|
@@ -13,7 +13,7 @@ export declare const componentMap: {
|
|
|
13
13
|
type: BooleanConstructor;
|
|
14
14
|
default: boolean;
|
|
15
15
|
};
|
|
16
|
-
}, () => JSX.Element
|
|
16
|
+
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, never[], never, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
17
17
|
form: {
|
|
18
18
|
type: ObjectConstructor;
|
|
19
19
|
default: () => {};
|
|
@@ -44,7 +44,7 @@ export declare const componentMap: {
|
|
|
44
44
|
type: BooleanConstructor;
|
|
45
45
|
default: boolean;
|
|
46
46
|
};
|
|
47
|
-
}, () => JSX.Element
|
|
47
|
+
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, never[], never, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
48
48
|
form: {
|
|
49
49
|
type: ObjectConstructor;
|
|
50
50
|
default: () => {};
|
|
@@ -10190,7 +10190,7 @@ export declare const componentMap: {
|
|
|
10190
10190
|
type: BooleanConstructor;
|
|
10191
10191
|
default: boolean;
|
|
10192
10192
|
};
|
|
10193
|
-
}, () => JSX.Element
|
|
10193
|
+
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, never[], never, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
10194
10194
|
form: {
|
|
10195
10195
|
type: ObjectConstructor;
|
|
10196
10196
|
default: () => {};
|
|
@@ -10221,7 +10221,7 @@ export declare const componentMap: {
|
|
|
10221
10221
|
type: BooleanConstructor;
|
|
10222
10222
|
default: boolean;
|
|
10223
10223
|
};
|
|
10224
|
-
}, () => JSX.Element
|
|
10224
|
+
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, never[], never, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
10225
10225
|
form: {
|
|
10226
10226
|
type: ObjectConstructor;
|
|
10227
10227
|
default: () => {};
|
|
@@ -10252,7 +10252,7 @@ export declare const componentMap: {
|
|
|
10252
10252
|
type: BooleanConstructor;
|
|
10253
10253
|
default: boolean;
|
|
10254
10254
|
};
|
|
10255
|
-
}, () => JSX.Element
|
|
10255
|
+
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, never[], never, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
10256
10256
|
form: {
|
|
10257
10257
|
type: ObjectConstructor;
|
|
10258
10258
|
default: () => {};
|
|
@@ -12,9 +12,10 @@ const isEvaluation = (e) => {
|
|
|
12
12
|
};
|
|
13
13
|
const handleQueryParams = () => {
|
|
14
14
|
let params = {};
|
|
15
|
-
let hash = window.location.
|
|
15
|
+
let hash = window.location.search.split("?")[1];
|
|
16
16
|
if (!hash)
|
|
17
17
|
return {};
|
|
18
|
+
hash = hash.replace(/\+/g, "%20");
|
|
18
19
|
for (let [key, value] of new URLSearchParams(hash).entries()) {
|
|
19
20
|
params[key] = decodeURIComponent(value);
|
|
20
21
|
}
|
|
@@ -166,6 +166,7 @@
|
|
|
166
166
|
cursor: pointer;
|
|
167
167
|
}
|
|
168
168
|
.c-scale .linebar-div {
|
|
169
|
+
width: 100%;
|
|
169
170
|
text-align: center;
|
|
170
171
|
margin-top: 24px;
|
|
171
172
|
}
|
|
@@ -184,6 +185,12 @@
|
|
|
184
185
|
.main {
|
|
185
186
|
box-sizing: border-box;
|
|
186
187
|
}
|
|
188
|
+
.main .n-form-item.n-form-item--top-labelled .n-form-item-label {
|
|
189
|
+
display: block;
|
|
190
|
+
}
|
|
191
|
+
.main .n-form-item .n-form-item-blank {
|
|
192
|
+
display: block;
|
|
193
|
+
}
|
|
187
194
|
.main .scale-label-required {
|
|
188
195
|
font-weight: 700;
|
|
189
196
|
}
|
|
@@ -191,6 +198,9 @@
|
|
|
191
198
|
color: #e02828;
|
|
192
199
|
font-weight: 700;
|
|
193
200
|
}
|
|
201
|
+
.main .score-i {
|
|
202
|
+
word-break: keep-all;
|
|
203
|
+
}
|
|
194
204
|
.main .evalute-label {
|
|
195
205
|
display: inline-block;
|
|
196
206
|
height: 20px;
|
|
@@ -251,8 +261,6 @@
|
|
|
251
261
|
}
|
|
252
262
|
.n-dialog.n-modal.c-evatip-dialog-wrap .n-base-icon {
|
|
253
263
|
position: absolute;
|
|
254
|
-
right: 16px;
|
|
255
|
-
top: 16px;
|
|
256
264
|
margin: 0;
|
|
257
265
|
color: #666666;
|
|
258
266
|
}
|
|
@@ -610,6 +618,7 @@
|
|
|
610
618
|
.c-scale-collection.prompt-message .prompt-message-content {
|
|
611
619
|
line-height: 16px;
|
|
612
620
|
font-size: 14px;
|
|
621
|
+
word-break: break-all;
|
|
613
622
|
}
|
|
614
623
|
.c-time-range {
|
|
615
624
|
display: flex;
|