@fecp/mobile 1.0.37 → 1.0.39
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/mobile.css +4 -4
- package/es/packages/mobile/src/components/dataDisplay/table/Table.vue.mjs +44 -7
- package/es/packages/mobile/src/components/form/fieldCalendarPicker/FieldCalendarPicker.vue.mjs +17 -5
- package/es/packages/mobile/src/components/form/fieldCascaderPicker/fieldCascaderPicker.vue.mjs +17 -5
- package/es/packages/mobile/src/components/form/fieldCheckbox/FieldCheckbox.vue.mjs +35 -15
- package/es/packages/mobile/src/components/form/fieldDatePicker/FieldDatePicker.vue.mjs +17 -5
- package/es/packages/mobile/src/components/form/fieldPicker/FieldPicker.vue.mjs +17 -5
- package/es/packages/mobile/src/components/form/fieldRadio/FieldRadio.vue.mjs +54 -5
- package/es/packages/mobile/src/components/form/fieldTimePicker/FieldTimePicker.vue.mjs +17 -5
- package/es/packages/mobile/src/components/form/form/Form.vue.mjs +16 -0
- package/es/packages/mobile/src/components/form/formItem/FormItem.vue.mjs +29 -3
- package/es/packages/mobile/src/utils/dateUtil.mjs +30 -0
- package/es/packages/mobile/src/utils/formatterUtil.mjs +99 -0
- package/lib/mobile.css +4 -4
- package/lib/packages/mobile/src/components/dataDisplay/table/Table.vue.js +43 -6
- package/lib/packages/mobile/src/components/form/fieldCalendarPicker/FieldCalendarPicker.vue.js +17 -5
- package/lib/packages/mobile/src/components/form/fieldCascaderPicker/fieldCascaderPicker.vue.js +17 -5
- package/lib/packages/mobile/src/components/form/fieldCheckbox/FieldCheckbox.vue.js +34 -14
- package/lib/packages/mobile/src/components/form/fieldDatePicker/FieldDatePicker.vue.js +17 -5
- package/lib/packages/mobile/src/components/form/fieldPicker/FieldPicker.vue.js +17 -5
- package/lib/packages/mobile/src/components/form/fieldRadio/FieldRadio.vue.js +53 -4
- package/lib/packages/mobile/src/components/form/fieldTimePicker/FieldTimePicker.vue.js +17 -5
- package/lib/packages/mobile/src/components/form/form/Form.vue.js +16 -0
- package/lib/packages/mobile/src/components/form/formItem/FormItem.vue.js +29 -3
- package/lib/packages/mobile/src/utils/dateUtil.js +30 -0
- package/lib/packages/mobile/src/utils/formatterUtil.js +99 -0
- package/package.json +1 -1
|
@@ -1,12 +1,29 @@
|
|
|
1
|
-
import { computed, createBlock, openBlock, unref, mergeProps, isRef, withCtx,
|
|
1
|
+
import { computed, createBlock, openBlock, unref, mergeProps, isRef, withCtx, createElementBlock, toDisplayString } from "vue";
|
|
2
2
|
import { MobileField } from "../field/index.mjs";
|
|
3
3
|
import { MobileCheckboxGroup } from "../checkboxGroup/index.mjs";
|
|
4
|
+
const _hoisted_1 = { key: 1 };
|
|
4
5
|
const _sfc_main = {
|
|
5
6
|
__name: "FieldCheckbox",
|
|
6
7
|
props: {
|
|
7
8
|
modelValue: {
|
|
8
9
|
type: String,
|
|
9
10
|
default: ""
|
|
11
|
+
},
|
|
12
|
+
options: {
|
|
13
|
+
type: Array,
|
|
14
|
+
default: []
|
|
15
|
+
},
|
|
16
|
+
fieldNames: {
|
|
17
|
+
type: Object,
|
|
18
|
+
default: {
|
|
19
|
+
text: "text",
|
|
20
|
+
value: "value",
|
|
21
|
+
disabled: "disabled"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
readonly: {
|
|
25
|
+
type: Boolean,
|
|
26
|
+
default: false
|
|
10
27
|
}
|
|
11
28
|
},
|
|
12
29
|
emits: ["update:modelValue"],
|
|
@@ -19,37 +36,40 @@ const _sfc_main = {
|
|
|
19
36
|
if (Array.isArray(props.modelValue)) {
|
|
20
37
|
return props.modelValue;
|
|
21
38
|
} else {
|
|
22
|
-
return props.modelValue.split("
|
|
39
|
+
return props.modelValue.split("|");
|
|
23
40
|
}
|
|
24
41
|
} else {
|
|
25
42
|
return [];
|
|
26
43
|
}
|
|
27
44
|
},
|
|
28
45
|
set: (val) => {
|
|
29
|
-
emit("update:modelValue", val.join("
|
|
46
|
+
emit("update:modelValue", val.join("|"));
|
|
30
47
|
}
|
|
31
48
|
});
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
49
|
+
const fieldTextValue = computed(() => {
|
|
50
|
+
return compValue.value.map((value) => {
|
|
51
|
+
const option = props.options.find(
|
|
52
|
+
(opt) => opt[props.fieldNames.value] === value
|
|
53
|
+
);
|
|
54
|
+
return option ? option[props.fieldNames.text] : value;
|
|
55
|
+
}).join(", ");
|
|
39
56
|
});
|
|
40
57
|
return (_ctx, _cache) => {
|
|
41
58
|
return openBlock(), createBlock(unref(MobileField), mergeProps(_ctx.$attrs, {
|
|
42
|
-
|
|
43
|
-
|
|
59
|
+
readonly: __props.readonly,
|
|
60
|
+
modelValue: unref(fieldTextValue),
|
|
61
|
+
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => isRef(fieldTextValue) ? fieldTextValue.value = $event : null)
|
|
44
62
|
}), {
|
|
45
63
|
input: withCtx(() => [
|
|
46
|
-
|
|
64
|
+
!__props.readonly ? (openBlock(), createBlock(unref(MobileCheckboxGroup), mergeProps({ key: 0 }, _ctx.$attrs, {
|
|
65
|
+
options: __props.options,
|
|
66
|
+
fieldNames: __props.fieldNames,
|
|
47
67
|
modelValue: unref(compValue),
|
|
48
68
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(compValue) ? compValue.value = $event : null)
|
|
49
|
-
}), null, 16, ["modelValue"])
|
|
69
|
+
}), null, 16, ["options", "fieldNames", "modelValue"])) : (openBlock(), createElementBlock("span", _hoisted_1, toDisplayString(unref(fieldTextValue)), 1))
|
|
50
70
|
]),
|
|
51
71
|
_: 1
|
|
52
|
-
}, 16, ["modelValue"]);
|
|
72
|
+
}, 16, ["readonly", "modelValue"]);
|
|
53
73
|
};
|
|
54
74
|
}
|
|
55
75
|
};
|
|
@@ -42,7 +42,14 @@ const _sfc_main = {
|
|
|
42
42
|
type: String,
|
|
43
43
|
default: "1"
|
|
44
44
|
},
|
|
45
|
-
|
|
45
|
+
disabled: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
default: false
|
|
48
|
+
},
|
|
49
|
+
readonly: {
|
|
50
|
+
type: Boolean,
|
|
51
|
+
default: false
|
|
52
|
+
},
|
|
46
53
|
"is-link": false
|
|
47
54
|
},
|
|
48
55
|
emits: ["update:modelValue"],
|
|
@@ -116,9 +123,14 @@ const _sfc_main = {
|
|
|
116
123
|
return openBlock(), createBlock(unref(MobileField), mergeProps(_ctx.$attrs, {
|
|
117
124
|
modelValue: unref(fieldTextValue),
|
|
118
125
|
"onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => isRef(fieldTextValue) ? fieldTextValue.value = $event : null),
|
|
119
|
-
|
|
126
|
+
isLink: __props.readonly ? false : true,
|
|
120
127
|
readonly: "",
|
|
121
|
-
|
|
128
|
+
disabled: __props.disabled,
|
|
129
|
+
onClick: _cache[5] || (_cache[5] = () => {
|
|
130
|
+
if (!__props.readonly) {
|
|
131
|
+
showPicker.value = true;
|
|
132
|
+
}
|
|
133
|
+
})
|
|
122
134
|
}), createSlots({
|
|
123
135
|
default: withCtx(() => [
|
|
124
136
|
createVNode(_component_van_popup, {
|
|
@@ -143,7 +155,7 @@ const _sfc_main = {
|
|
|
143
155
|
]),
|
|
144
156
|
_: 2
|
|
145
157
|
}, [
|
|
146
|
-
unref(fieldTextValue) ? {
|
|
158
|
+
!__props.readonly && !__props.disabled && unref(fieldTextValue) ? {
|
|
147
159
|
name: "right-icon",
|
|
148
160
|
fn: withCtx(() => [
|
|
149
161
|
createVNode(_component_van_icon, {
|
|
@@ -154,7 +166,7 @@ const _sfc_main = {
|
|
|
154
166
|
]),
|
|
155
167
|
key: "0"
|
|
156
168
|
} : void 0
|
|
157
|
-
]), 1040, ["modelValue"]);
|
|
169
|
+
]), 1040, ["modelValue", "isLink", "disabled"]);
|
|
158
170
|
};
|
|
159
171
|
}
|
|
160
172
|
};
|
|
@@ -34,7 +34,14 @@ const _sfc_main = {
|
|
|
34
34
|
type: String,
|
|
35
35
|
default: ""
|
|
36
36
|
},
|
|
37
|
-
|
|
37
|
+
disabled: {
|
|
38
|
+
type: Boolean,
|
|
39
|
+
default: false
|
|
40
|
+
},
|
|
41
|
+
readonly: {
|
|
42
|
+
type: Boolean,
|
|
43
|
+
default: false
|
|
44
|
+
},
|
|
38
45
|
"is-link": false
|
|
39
46
|
},
|
|
40
47
|
emits: ["update:modelValue"],
|
|
@@ -77,9 +84,14 @@ const _sfc_main = {
|
|
|
77
84
|
return openBlock(), createBlock(unref(MobileField), mergeProps(_ctx.$attrs, {
|
|
78
85
|
modelValue: unref(fieldTextValue),
|
|
79
86
|
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => isRef(fieldTextValue) ? fieldTextValue.value = $event : null),
|
|
80
|
-
|
|
87
|
+
isLink: __props.readonly ? false : true,
|
|
81
88
|
readonly: "",
|
|
82
|
-
|
|
89
|
+
disabled: __props.disabled,
|
|
90
|
+
onClick: _cache[4] || (_cache[4] = () => {
|
|
91
|
+
if (!__props.readonly) {
|
|
92
|
+
showPicker.value = true;
|
|
93
|
+
}
|
|
94
|
+
})
|
|
83
95
|
}), createSlots({
|
|
84
96
|
default: withCtx(() => [
|
|
85
97
|
createVNode(_component_van_popup, {
|
|
@@ -103,7 +115,7 @@ const _sfc_main = {
|
|
|
103
115
|
]),
|
|
104
116
|
_: 2
|
|
105
117
|
}, [
|
|
106
|
-
unref(fieldTextValue) ? {
|
|
118
|
+
!__props.readonly && !__props.disabled && unref(fieldTextValue) ? {
|
|
107
119
|
name: "right-icon",
|
|
108
120
|
fn: withCtx(() => [
|
|
109
121
|
createVNode(_component_van_icon, {
|
|
@@ -114,7 +126,7 @@ const _sfc_main = {
|
|
|
114
126
|
]),
|
|
115
127
|
key: "0"
|
|
116
128
|
} : void 0
|
|
117
|
-
]), 1040, ["modelValue"]);
|
|
129
|
+
]), 1040, ["modelValue", "isLink", "disabled"]);
|
|
118
130
|
};
|
|
119
131
|
}
|
|
120
132
|
};
|
|
@@ -1,16 +1,65 @@
|
|
|
1
|
-
import { createBlock, openBlock, unref,
|
|
1
|
+
import { computed, createBlock, openBlock, unref, mergeProps, isRef, withCtx, createElementBlock, toDisplayString } from "vue";
|
|
2
2
|
import { MobileField } from "../field/index.mjs";
|
|
3
3
|
import { MobileRadioGroup } from "../radioGroup/index.mjs";
|
|
4
|
+
const _hoisted_1 = { key: 1 };
|
|
4
5
|
const _sfc_main = {
|
|
5
6
|
__name: "FieldRadio",
|
|
6
|
-
|
|
7
|
+
props: {
|
|
8
|
+
modelValue: {
|
|
9
|
+
type: String,
|
|
10
|
+
default: ""
|
|
11
|
+
},
|
|
12
|
+
options: {
|
|
13
|
+
type: Array,
|
|
14
|
+
default: []
|
|
15
|
+
},
|
|
16
|
+
fieldNames: {
|
|
17
|
+
type: Object,
|
|
18
|
+
default: {
|
|
19
|
+
text: "text",
|
|
20
|
+
value: "value",
|
|
21
|
+
disabled: "disabled"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
readonly: {
|
|
25
|
+
type: Boolean,
|
|
26
|
+
default: false
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
emits: ["update:modelValue"],
|
|
30
|
+
setup(__props, { emit: __emit }) {
|
|
31
|
+
const props = __props;
|
|
32
|
+
const emit = __emit;
|
|
33
|
+
const compValue = computed({
|
|
34
|
+
get: () => {
|
|
35
|
+
return props.modelValue;
|
|
36
|
+
},
|
|
37
|
+
set: (val) => {
|
|
38
|
+
emit("update:modelValue", val);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
const fieldTextValue = computed(() => {
|
|
42
|
+
const selectedOption = props.options.find(
|
|
43
|
+
(option) => option[props.fieldNames.value] === compValue.value
|
|
44
|
+
);
|
|
45
|
+
return selectedOption ? selectedOption[props.fieldNames.text] : "";
|
|
46
|
+
});
|
|
7
47
|
return (_ctx, _cache) => {
|
|
8
|
-
return openBlock(), createBlock(unref(MobileField),
|
|
48
|
+
return openBlock(), createBlock(unref(MobileField), mergeProps(_ctx.$attrs, {
|
|
49
|
+
readonly: __props.readonly,
|
|
50
|
+
modelValue: unref(fieldTextValue),
|
|
51
|
+
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => isRef(fieldTextValue) ? fieldTextValue.value = $event : null)
|
|
52
|
+
}), {
|
|
9
53
|
input: withCtx(() => [
|
|
10
|
-
|
|
54
|
+
!__props.readonly ? (openBlock(), createBlock(unref(MobileRadioGroup), mergeProps({ key: 0 }, _ctx.$attrs, {
|
|
55
|
+
options: __props.options,
|
|
56
|
+
fieldNames: __props.fieldNames,
|
|
57
|
+
modelValue: unref(compValue),
|
|
58
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(compValue) ? compValue.value = $event : null)
|
|
59
|
+
}), null, 16, ["options", "fieldNames", "modelValue"])) : (openBlock(), createElementBlock("span", _hoisted_1, toDisplayString(unref(fieldTextValue)), 1))
|
|
11
60
|
]),
|
|
12
61
|
_: 1
|
|
13
|
-
}, 16);
|
|
62
|
+
}, 16, ["readonly", "modelValue"]);
|
|
14
63
|
};
|
|
15
64
|
}
|
|
16
65
|
};
|
|
@@ -43,7 +43,14 @@ const _sfc_main = {
|
|
|
43
43
|
default: "hour,minute"
|
|
44
44
|
// default: ["hour", "minute", "second"],
|
|
45
45
|
},
|
|
46
|
-
|
|
46
|
+
disabled: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
default: false
|
|
49
|
+
},
|
|
50
|
+
readonly: {
|
|
51
|
+
type: Boolean,
|
|
52
|
+
default: false
|
|
53
|
+
},
|
|
47
54
|
"is-link": false
|
|
48
55
|
},
|
|
49
56
|
emits: ["update:modelValue"],
|
|
@@ -118,9 +125,14 @@ const _sfc_main = {
|
|
|
118
125
|
return openBlock(), createBlock(unref(MobileField), mergeProps(_ctx.$attrs, {
|
|
119
126
|
modelValue: unref(fieldTextValue),
|
|
120
127
|
"onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => isRef(fieldTextValue) ? fieldTextValue.value = $event : null),
|
|
121
|
-
|
|
128
|
+
isLink: __props.readonly ? false : true,
|
|
122
129
|
readonly: "",
|
|
123
|
-
|
|
130
|
+
disabled: __props.disabled,
|
|
131
|
+
onClick: _cache[5] || (_cache[5] = () => {
|
|
132
|
+
if (!__props.readonly) {
|
|
133
|
+
showPicker.value = true;
|
|
134
|
+
}
|
|
135
|
+
})
|
|
124
136
|
}), createSlots({
|
|
125
137
|
default: withCtx(() => [
|
|
126
138
|
createVNode(_component_van_popup, {
|
|
@@ -145,7 +157,7 @@ const _sfc_main = {
|
|
|
145
157
|
]),
|
|
146
158
|
_: 2
|
|
147
159
|
}, [
|
|
148
|
-
unref(fieldTextValue) ? {
|
|
160
|
+
!__props.readonly && !__props.disabled && unref(fieldTextValue) ? {
|
|
149
161
|
name: "right-icon",
|
|
150
162
|
fn: withCtx(() => [
|
|
151
163
|
createVNode(_component_van_icon, {
|
|
@@ -156,7 +168,7 @@ const _sfc_main = {
|
|
|
156
168
|
]),
|
|
157
169
|
key: "0"
|
|
158
170
|
} : void 0
|
|
159
|
-
]), 1040, ["modelValue"]);
|
|
171
|
+
]), 1040, ["modelValue", "isLink", "disabled"]);
|
|
160
172
|
};
|
|
161
173
|
}
|
|
162
174
|
};
|
|
@@ -10,6 +10,14 @@ const _sfc_main = {
|
|
|
10
10
|
type: Object,
|
|
11
11
|
default: {}
|
|
12
12
|
},
|
|
13
|
+
disabled: {
|
|
14
|
+
type: Boolean,
|
|
15
|
+
default: false
|
|
16
|
+
},
|
|
17
|
+
readonly: {
|
|
18
|
+
type: Boolean,
|
|
19
|
+
default: false
|
|
20
|
+
},
|
|
13
21
|
isCard: {
|
|
14
22
|
//卡片风格
|
|
15
23
|
type: Boolean,
|
|
@@ -29,6 +37,14 @@ const _sfc_main = {
|
|
|
29
37
|
}
|
|
30
38
|
});
|
|
31
39
|
provide("formData", formData);
|
|
40
|
+
provide(
|
|
41
|
+
"formDisabled",
|
|
42
|
+
computed(() => props.disabled)
|
|
43
|
+
);
|
|
44
|
+
provide(
|
|
45
|
+
"formReadonly",
|
|
46
|
+
computed(() => props.readonly)
|
|
47
|
+
);
|
|
32
48
|
return (_ctx, _cache) => {
|
|
33
49
|
const _component_van_cell_group = CellGroup;
|
|
34
50
|
const _component_van_form = Form;
|
|
@@ -6,7 +6,16 @@ const _sfc_main = {
|
|
|
6
6
|
fieldType: {
|
|
7
7
|
type: String,
|
|
8
8
|
default: "text"
|
|
9
|
-
}
|
|
9
|
+
},
|
|
10
|
+
disabled: {
|
|
11
|
+
type: Boolean,
|
|
12
|
+
default: false
|
|
13
|
+
},
|
|
14
|
+
readonly: {
|
|
15
|
+
type: Boolean,
|
|
16
|
+
default: false
|
|
17
|
+
},
|
|
18
|
+
placeholder: String
|
|
10
19
|
},
|
|
11
20
|
emits: ["update:modelValue"],
|
|
12
21
|
setup(__props, { emit: __emit }) {
|
|
@@ -32,6 +41,20 @@ const _sfc_main = {
|
|
|
32
41
|
}
|
|
33
42
|
});
|
|
34
43
|
const formData = inject("formData");
|
|
44
|
+
const formDisabled = inject("formDisabled");
|
|
45
|
+
const formReadonly = inject("formReadonly");
|
|
46
|
+
const formItemDisabled = computed(() => {
|
|
47
|
+
if (formDisabled.value) {
|
|
48
|
+
return formDisabled.value;
|
|
49
|
+
}
|
|
50
|
+
return props.disabled;
|
|
51
|
+
});
|
|
52
|
+
const formItemReadonly = computed(() => {
|
|
53
|
+
if (formReadonly.value) {
|
|
54
|
+
return formReadonly.value;
|
|
55
|
+
}
|
|
56
|
+
return props.readonly;
|
|
57
|
+
});
|
|
35
58
|
const attrs = useAttrs();
|
|
36
59
|
const emit = __emit;
|
|
37
60
|
const compValue = computed({
|
|
@@ -58,8 +81,11 @@ const _sfc_main = {
|
|
|
58
81
|
modelValue: unref(compValue),
|
|
59
82
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(compValue) ? compValue.value = $event : null),
|
|
60
83
|
rules: unref(rules),
|
|
61
|
-
required: "auto"
|
|
62
|
-
|
|
84
|
+
required: "auto",
|
|
85
|
+
disabled: unref(formItemDisabled),
|
|
86
|
+
readonly: unref(formItemReadonly),
|
|
87
|
+
placeholder: unref(formItemReadonly) ? "" : __props.placeholder
|
|
88
|
+
}), null, 16, ["modelValue", "rules", "disabled", "readonly", "placeholder"]);
|
|
63
89
|
};
|
|
64
90
|
}
|
|
65
91
|
};
|
|
@@ -25,6 +25,36 @@ const parseDateFormatter = (textFormatType, columnsType) => {
|
|
|
25
25
|
} else if (textFormatType == "3") {
|
|
26
26
|
return "YYYY年MM月DD日";
|
|
27
27
|
}
|
|
28
|
+
} else if (columnsTypeArr.length == 4) {
|
|
29
|
+
if (textFormatType == "0") {
|
|
30
|
+
return "YYYYMMDD HH";
|
|
31
|
+
} else if (textFormatType == "1") {
|
|
32
|
+
return "YYYY-MM-DD HH";
|
|
33
|
+
} else if (textFormatType == "2") {
|
|
34
|
+
return "YYYY/MM/DD HH";
|
|
35
|
+
} else if (textFormatType == "3") {
|
|
36
|
+
return "YYYY年MM月DD日 HH";
|
|
37
|
+
}
|
|
38
|
+
} else if (columnsTypeArr.length == 5) {
|
|
39
|
+
if (textFormatType == "0") {
|
|
40
|
+
return "YYYYMMDD HH:mm";
|
|
41
|
+
} else if (textFormatType == "1") {
|
|
42
|
+
return "YYYY-MM-DD HH:mm";
|
|
43
|
+
} else if (textFormatType == "2") {
|
|
44
|
+
return "YYYY/MM/DD HH:mm";
|
|
45
|
+
} else if (textFormatType == "3") {
|
|
46
|
+
return "YYYY年MM月DD日 HH:mm";
|
|
47
|
+
}
|
|
48
|
+
} else if (columnsTypeArr.length == 6) {
|
|
49
|
+
if (textFormatType == "0") {
|
|
50
|
+
return "YYYYMMDD HH:mm:ss";
|
|
51
|
+
} else if (textFormatType == "1") {
|
|
52
|
+
return "YYYY-MM-DD HH:mm:ss";
|
|
53
|
+
} else if (textFormatType == "2") {
|
|
54
|
+
return "YYYY/MM/DD HH:mm:ss";
|
|
55
|
+
} else if (textFormatType == "3") {
|
|
56
|
+
return "YYYY年MM月DD日 HH时mm分ss秒";
|
|
57
|
+
}
|
|
28
58
|
}
|
|
29
59
|
};
|
|
30
60
|
const parseTimeFormatter = (textFormatType, columnsType) => {
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import hooks from "../../../../node_modules/.pnpm/moment@2.30.1/node_modules/moment/dist/moment.mjs";
|
|
2
|
+
import { parseDateFormatter } from "./dateUtil.mjs";
|
|
3
|
+
import XEUtils from "../../../../_virtual/index.mjs";
|
|
4
|
+
const selectFormatter = (value, options) => {
|
|
5
|
+
const item = options.find((item2) => item2.value === value);
|
|
6
|
+
return item ? item.label : value;
|
|
7
|
+
};
|
|
8
|
+
const multipleFormatter = (value, options) => {
|
|
9
|
+
const values = value == null ? void 0 : value.split("|");
|
|
10
|
+
const labels = [];
|
|
11
|
+
values == null ? void 0 : values.forEach((val) => {
|
|
12
|
+
const option = options.find((opt) => opt.value == val);
|
|
13
|
+
if (option) {
|
|
14
|
+
labels.push(option.label);
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
return labels.join(", ");
|
|
18
|
+
};
|
|
19
|
+
const cascadeFormatter = (value, options) => {
|
|
20
|
+
const values = value == null ? void 0 : value.split("/");
|
|
21
|
+
const labels = [];
|
|
22
|
+
let currentOptions = options;
|
|
23
|
+
for (let i = 0; i < (values == null ? void 0 : values.length); i++) {
|
|
24
|
+
const currentValue = values[i];
|
|
25
|
+
const option = currentOptions.find((opt) => opt.value === currentValue);
|
|
26
|
+
if (option) {
|
|
27
|
+
labels.push(option.label);
|
|
28
|
+
if (option.children && i < values.length - 1) {
|
|
29
|
+
currentOptions = option.children;
|
|
30
|
+
}
|
|
31
|
+
} else {
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return labels.join("/");
|
|
36
|
+
};
|
|
37
|
+
const dateFormatter = (value, dateType, formatterType) => {
|
|
38
|
+
let dateValue;
|
|
39
|
+
if (!isNaN(value) && (value + "").length == 13) {
|
|
40
|
+
dateValue = hooks(Number(value));
|
|
41
|
+
} else {
|
|
42
|
+
dateValue = hooks(value, "YYYYMMDD");
|
|
43
|
+
}
|
|
44
|
+
const textFormat = parseDateFormatter(formatterType, dateType);
|
|
45
|
+
return dateValue.format(textFormat);
|
|
46
|
+
};
|
|
47
|
+
const textFormatter = (value, dataFormatter) => {
|
|
48
|
+
switch (dataFormatter) {
|
|
49
|
+
case "money(yuan)":
|
|
50
|
+
case "money(wan)":
|
|
51
|
+
case "money(yi)":
|
|
52
|
+
return moneyFormatter(value, dataFormatter);
|
|
53
|
+
case "bankCard":
|
|
54
|
+
return XEUtils.commafy(XEUtils.toValueString(value), {
|
|
55
|
+
spaceNumber: 4,
|
|
56
|
+
separator: " "
|
|
57
|
+
});
|
|
58
|
+
case "percent":
|
|
59
|
+
value = XEUtils.multiply(XEUtils.toNumber(value), 100);
|
|
60
|
+
value = XEUtils.toFixed(value, 2);
|
|
61
|
+
return value;
|
|
62
|
+
case "thousand":
|
|
63
|
+
value = XEUtils.multiply(XEUtils.toNumber(value), 1e3);
|
|
64
|
+
value = XEUtils.toFixed(value, 2);
|
|
65
|
+
return value;
|
|
66
|
+
case "tenThousand":
|
|
67
|
+
value = XEUtils.multiply(XEUtils.toNumber(value), 1e4);
|
|
68
|
+
value = XEUtils.toFixed(value, 2);
|
|
69
|
+
return value;
|
|
70
|
+
default:
|
|
71
|
+
return value;
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
const moneyFormatter = (value, dataFormatter) => {
|
|
75
|
+
let moneyValue;
|
|
76
|
+
switch (dataFormatter) {
|
|
77
|
+
case "money(yuan)":
|
|
78
|
+
moneyValue = XEUtils.toNumber(value);
|
|
79
|
+
break;
|
|
80
|
+
case "money(wan)":
|
|
81
|
+
moneyValue = XEUtils.divide(XEUtils.toNumber(value), 1e4);
|
|
82
|
+
break;
|
|
83
|
+
case "money(yi)":
|
|
84
|
+
moneyValue = XEUtils.divide(XEUtils.toNumber(value), 1e8);
|
|
85
|
+
break;
|
|
86
|
+
default:
|
|
87
|
+
moneyValue = XEUtils.toNumber(value);
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
return XEUtils.commafy(moneyValue, { digits: 2 });
|
|
91
|
+
};
|
|
92
|
+
export {
|
|
93
|
+
cascadeFormatter,
|
|
94
|
+
dateFormatter,
|
|
95
|
+
moneyFormatter,
|
|
96
|
+
multipleFormatter,
|
|
97
|
+
selectFormatter,
|
|
98
|
+
textFormatter
|
|
99
|
+
};
|