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