cnhis-design-vue 3.1.12-beta.1 → 3.1.12-beta.4
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/index.d.ts +1 -0
- package/es/packages/big-table/src/BigTable.vue.d.ts +2 -4
- package/es/packages/big-table/src/BigTable.vue_vue_type_script_setup_true_lang.js +9 -6
- package/es/packages/big-table/src/bigTableEmits.js +2 -1
- package/es/packages/form-render/index.d.ts +60 -51
- package/es/packages/form-render/src/FormRender.vue.d.ts +61 -52
- package/es/packages/form-render/src/FormRender.vue_vue_type_script_setup_true_lang.js +2 -3
- package/es/packages/form-render/src/components/renderer/cascader.js +4 -3
- package/es/packages/form-render/src/components/renderer/radio.d.ts +2 -0
- package/es/packages/form-render/src/components/renderer/radio.js +5 -4
- 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/useFormValidator.js +1 -7
- package/es/packages/form-render/src/hooks/useInitialData.js +1 -1
- 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/fieldItem.d.ts +2 -2
- 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 +16 -4
- package/es/packages/index.css +11 -0
- 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-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 +16 -9
- package/es/packages/scale-view/src/hooks/scaleview-init.js +8 -2
- package/es/packages/scale-view/src/utils/judge-types.js +2 -1
- package/es/packages/scale-view/style/index.css +11 -0
- package/package.json +3 -3
|
@@ -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);
|
|
@@ -6,13 +6,7 @@ function useFormValidator() {
|
|
|
6
6
|
["mobile", ({ validate }) => ({ format: "phone", message: validate == null ? void 0 : validate.message })],
|
|
7
7
|
["integer", ({ validate }) => ({ format: "integer", message: validate == null ? void 0 : validate.message })],
|
|
8
8
|
["number", ({ validate }) => ({ format: "number", message: validate == null ? void 0 : validate.message })],
|
|
9
|
-
[
|
|
10
|
-
"id_card",
|
|
11
|
-
({ validate }) => ({
|
|
12
|
-
pattern: /^\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}))$/,
|
|
13
|
-
message: (validate == null ? void 0 : validate.message) || "\u8BF7\u8F93\u5165\u5408\u6CD5\u7684\u8EAB\u4EFD\u8BC1\u53F7"
|
|
14
|
-
})
|
|
15
|
-
],
|
|
9
|
+
["id_card", ({ validate }) => ({ format: "idcard", message: validate == null ? void 0 : validate.message })],
|
|
16
10
|
[
|
|
17
11
|
"regular",
|
|
18
12
|
(field) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
function useInitialData() {
|
|
2
2
|
function assignInitialData(initialData, fieldList) {
|
|
3
3
|
return Object.assign({}, initialData, fieldList == null ? void 0 : fieldList.reduce((fin, cur) => {
|
|
4
|
-
cur.default_val && (fin[cur.val_key] = cur.default_val);
|
|
4
|
+
cur.default_val != void 0 && (fin[cur.val_key] = cur.default_val);
|
|
5
5
|
return fin;
|
|
6
6
|
}, {}));
|
|
7
7
|
}
|
|
@@ -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
|
|
@@ -13,7 +13,7 @@ export declare type ValidateItem = Partial<{
|
|
|
13
13
|
}>;
|
|
14
14
|
interface OptionItem {
|
|
15
15
|
text: string;
|
|
16
|
-
value:
|
|
16
|
+
value: any;
|
|
17
17
|
children?: OptionItem[];
|
|
18
18
|
}
|
|
19
19
|
export interface Ievent {
|
|
@@ -30,7 +30,7 @@ export declare type FieldItem = {
|
|
|
30
30
|
is_null: string;
|
|
31
31
|
name: string;
|
|
32
32
|
alias: string;
|
|
33
|
-
default_val:
|
|
33
|
+
default_val: any;
|
|
34
34
|
is_empty: string;
|
|
35
35
|
group: string;
|
|
36
36
|
hide_title: string;
|
|
@@ -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);
|
|
@@ -78,10 +90,10 @@ function traverseSchema(schema, handler) {
|
|
|
78
90
|
}
|
|
79
91
|
}
|
|
80
92
|
function uuidGenerator() {
|
|
81
|
-
return "
|
|
93
|
+
return "key" + "xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
|
|
82
94
|
const r = Math.random() * 16 | 0, v = c == "x" ? r : r & 3 | 8;
|
|
83
95
|
return v.toString(16);
|
|
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;
|
|
@@ -2113,6 +2123,7 @@ body > .vxe-table--tooltip-wrapper {
|
|
|
2113
2123
|
.c-scale-collection.prompt-message .prompt-message-content {
|
|
2114
2124
|
line-height: 16px;
|
|
2115
2125
|
font-size: 14px;
|
|
2126
|
+
word-break: break-all;
|
|
2116
2127
|
}
|
|
2117
2128
|
.c-time-range {
|
|
2118
2129
|
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", {
|
|
@@ -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,
|
|
@@ -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;
|