@fecp/mobile 1.0.22 → 1.0.25
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/packages/mobile/src/components/form/fieldCheckbox/FieldCheckbox.vue.mjs +0 -1
- package/es/packages/mobile/src/components/form/fieldDatePicker/FieldDatePicker.vue.mjs +52 -17
- package/es/packages/mobile/src/components/form/fieldPicker/FieldPicker.vue.mjs +3 -3
- package/es/packages/mobile/src/components/form/fieldRadio/FieldRadio.vue.mjs +0 -1
- package/es/packages/mobile/src/components/form/fieldTimePicker/FieldTimePicker.vue.mjs +54 -17
- package/es/packages/mobile/src/utils/dateUtil.mjs +54 -0
- package/lib/packages/mobile/src/components/form/fieldCheckbox/FieldCheckbox.vue.js +0 -1
- package/lib/packages/mobile/src/components/form/fieldDatePicker/FieldDatePicker.vue.js +52 -17
- package/lib/packages/mobile/src/components/form/fieldPicker/FieldPicker.vue.js +3 -3
- package/lib/packages/mobile/src/components/form/fieldRadio/FieldRadio.vue.js +0 -1
- package/lib/packages/mobile/src/components/form/fieldTimePicker/FieldTimePicker.vue.js +54 -17
- package/lib/packages/mobile/src/utils/dateUtil.js +54 -0
- package/package.json +1 -1
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
import { ref, computed, watch, createBlock, openBlock, unref, mergeProps, isRef, withCtx, createVNode } from "vue";
|
|
15
15
|
import { MobileField } from "../field/index.mjs";
|
|
16
16
|
import hooks from "../../../../../../node_modules/.pnpm/moment@2.30.1/node_modules/moment/dist/moment.mjs";
|
|
17
|
+
import { parseDateFormatter } from "../../../utils/dateUtil.mjs";
|
|
17
18
|
import { DatePicker } from "../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/date-picker/index.mjs";
|
|
18
19
|
import { Popup } from "../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/popup/index.mjs";
|
|
19
20
|
const _sfc_main = {
|
|
@@ -23,17 +24,22 @@ const _sfc_main = {
|
|
|
23
24
|
type: String,
|
|
24
25
|
default: ""
|
|
25
26
|
},
|
|
26
|
-
textFormat: {
|
|
27
|
+
// textFormat: {
|
|
28
|
+
// type: String,
|
|
29
|
+
// default: "YYYY-MM-DD",
|
|
30
|
+
// },
|
|
31
|
+
// valueFormat: {
|
|
32
|
+
// type: String,
|
|
33
|
+
// default: "YYYYMMDD",
|
|
34
|
+
// },
|
|
35
|
+
dateColumnsType: {
|
|
27
36
|
type: String,
|
|
28
|
-
default: "
|
|
37
|
+
default: "year,month,day"
|
|
29
38
|
},
|
|
30
|
-
|
|
39
|
+
dateTextFormat: {
|
|
40
|
+
//0:YYYYMMDD;1: YYYY-MM-DD;2:YYYY/MM/DD;3:YYYY年MM月DD日
|
|
31
41
|
type: String,
|
|
32
|
-
default: "
|
|
33
|
-
},
|
|
34
|
-
dateColumnsType: {
|
|
35
|
-
type: Array,
|
|
36
|
-
default: ["year", "month", "day"]
|
|
42
|
+
default: "1"
|
|
37
43
|
},
|
|
38
44
|
readonly: false,
|
|
39
45
|
"is-link": false
|
|
@@ -44,24 +50,52 @@ const _sfc_main = {
|
|
|
44
50
|
const fieldTextValue = ref("");
|
|
45
51
|
const showPicker = ref(false);
|
|
46
52
|
const emit = __emit;
|
|
53
|
+
let textFormat = parseDateFormatter(
|
|
54
|
+
props.dateTextFormat,
|
|
55
|
+
props.dateColumnsType
|
|
56
|
+
);
|
|
57
|
+
let valueFormat = parseDateFormatter("0", props.dateColumnsType);
|
|
47
58
|
const pickerValue = computed(() => {
|
|
59
|
+
let date;
|
|
48
60
|
if (!props.modelValue) {
|
|
49
|
-
|
|
50
|
-
|
|
61
|
+
date = hooks();
|
|
62
|
+
} else {
|
|
63
|
+
date = hooks(props.modelValue, valueFormat);
|
|
64
|
+
}
|
|
65
|
+
const year = date.year();
|
|
66
|
+
const month = date.month() + 1;
|
|
67
|
+
const day = date.date();
|
|
68
|
+
let value = [];
|
|
69
|
+
const columnsTypeArr = props.dateColumnsType.split(",");
|
|
70
|
+
if (columnsTypeArr.length == 1) {
|
|
71
|
+
value = [year];
|
|
72
|
+
} else if (columnsTypeArr.length == 2) {
|
|
73
|
+
value = [year, month];
|
|
74
|
+
} else if (columnsTypeArr.length == 3) {
|
|
75
|
+
value = [year, month, day];
|
|
51
76
|
}
|
|
52
|
-
const date = hooks(props.modelValue, props.valueFormat);
|
|
53
|
-
const value = [date.year(), date.month() + 1, date.date()];
|
|
54
77
|
return value;
|
|
55
78
|
});
|
|
79
|
+
const columnsType = computed(() => {
|
|
80
|
+
return props.dateColumnsType.split(",");
|
|
81
|
+
});
|
|
82
|
+
const formatter = (type, option) => {
|
|
83
|
+
if (type === "year") {
|
|
84
|
+
option.text += "年";
|
|
85
|
+
} else if (type === "month") {
|
|
86
|
+
option.text += "月";
|
|
87
|
+
} else if (type === "day") {
|
|
88
|
+
option.text += "日";
|
|
89
|
+
}
|
|
90
|
+
return option;
|
|
91
|
+
};
|
|
56
92
|
watch(
|
|
57
93
|
() => props.modelValue,
|
|
58
94
|
(value) => {
|
|
59
95
|
if (!value) {
|
|
60
96
|
return;
|
|
61
97
|
}
|
|
62
|
-
fieldTextValue.value = hooks(value,
|
|
63
|
-
props.textFormat
|
|
64
|
-
);
|
|
98
|
+
fieldTextValue.value = hooks(value, valueFormat).format(textFormat);
|
|
65
99
|
},
|
|
66
100
|
{ immediate: true }
|
|
67
101
|
);
|
|
@@ -69,7 +103,7 @@ const _sfc_main = {
|
|
|
69
103
|
const val = hooks(
|
|
70
104
|
`${selectedValues[0]}${selectedValues[1]}${selectedValues[2]}`,
|
|
71
105
|
"YYYYMMDD"
|
|
72
|
-
).format(
|
|
106
|
+
).format(valueFormat);
|
|
73
107
|
emit("update:modelValue", val);
|
|
74
108
|
showPicker.value = false;
|
|
75
109
|
};
|
|
@@ -96,7 +130,8 @@ const _sfc_main = {
|
|
|
96
130
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(pickerValue) ? pickerValue.value = $event : null),
|
|
97
131
|
readonly: false,
|
|
98
132
|
onConfirm,
|
|
99
|
-
columnsType:
|
|
133
|
+
columnsType: unref(columnsType),
|
|
134
|
+
formatter,
|
|
100
135
|
onCancel: _cache[1] || (_cache[1] = ($event) => showPicker.value = false)
|
|
101
136
|
}), null, 16, ["modelValue", "columnsType"])
|
|
102
137
|
]),
|
|
@@ -18,7 +18,7 @@ import { Popup } from "../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.
|
|
|
18
18
|
const _sfc_main = {
|
|
19
19
|
__name: "FieldPicker",
|
|
20
20
|
props: {
|
|
21
|
-
|
|
21
|
+
pickerOptions: {
|
|
22
22
|
type: Array,
|
|
23
23
|
default: []
|
|
24
24
|
},
|
|
@@ -57,7 +57,7 @@ const _sfc_main = {
|
|
|
57
57
|
if (!value) {
|
|
58
58
|
return;
|
|
59
59
|
}
|
|
60
|
-
const optionItem = props.
|
|
60
|
+
const optionItem = props.pickerOptions.find(
|
|
61
61
|
(item) => item[props.treeOptionsFieldNames.value] == value
|
|
62
62
|
);
|
|
63
63
|
fieldTextValue.value = optionItem == null ? void 0 : optionItem[props.treeOptionsFieldNames.text];
|
|
@@ -87,7 +87,7 @@ const _sfc_main = {
|
|
|
87
87
|
}, {
|
|
88
88
|
default: withCtx(() => [
|
|
89
89
|
createVNode(_component_van_picker, mergeProps(_ctx.$attrs, {
|
|
90
|
-
columns: __props.
|
|
90
|
+
columns: __props.pickerOptions,
|
|
91
91
|
"columns-field-names": __props.treeOptionsFieldNames,
|
|
92
92
|
"model-value": unref(pickerValue),
|
|
93
93
|
readonly: false,
|
|
@@ -4,7 +4,6 @@ import { MobileRadioGroup } from "../radioGroup/index.mjs";
|
|
|
4
4
|
const _sfc_main = {
|
|
5
5
|
__name: "FieldRadio",
|
|
6
6
|
setup(__props) {
|
|
7
|
-
debugger;
|
|
8
7
|
return (_ctx, _cache) => {
|
|
9
8
|
return openBlock(), createBlock(unref(MobileField), normalizeProps(guardReactiveProps(_ctx.$attrs)), {
|
|
10
9
|
input: withCtx(() => [
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
import { ref, computed, watch, createBlock, openBlock, unref, mergeProps, isRef, withCtx, createVNode } from "vue";
|
|
15
15
|
import { MobileField } from "../field/index.mjs";
|
|
16
16
|
import hooks from "../../../../../../node_modules/.pnpm/moment@2.30.1/node_modules/moment/dist/moment.mjs";
|
|
17
|
+
import { parseTimeFormatter } from "../../../utils/dateUtil.mjs";
|
|
17
18
|
import { TimePicker } from "../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/time-picker/index.mjs";
|
|
18
19
|
import { Popup } from "../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/popup/index.mjs";
|
|
19
20
|
const _sfc_main = {
|
|
@@ -23,17 +24,23 @@ const _sfc_main = {
|
|
|
23
24
|
type: String,
|
|
24
25
|
default: ""
|
|
25
26
|
},
|
|
26
|
-
textFormat: {
|
|
27
|
+
// textFormat: {
|
|
28
|
+
// type: String,
|
|
29
|
+
// default: "HH:mm:ss",
|
|
30
|
+
// },
|
|
31
|
+
// valueFormat: {
|
|
32
|
+
// type: String,
|
|
33
|
+
// default: "HH:mm:ss",
|
|
34
|
+
// },
|
|
35
|
+
timeTextFormat: {
|
|
36
|
+
//0:HH:mm:ss;1: HH时mm分ss秒
|
|
27
37
|
type: String,
|
|
28
|
-
default: "
|
|
29
|
-
},
|
|
30
|
-
valueFormat: {
|
|
31
|
-
type: String,
|
|
32
|
-
default: "HH:mm:ss"
|
|
38
|
+
default: "0"
|
|
33
39
|
},
|
|
34
40
|
timeColumnsType: {
|
|
35
|
-
type:
|
|
36
|
-
default:
|
|
41
|
+
type: String,
|
|
42
|
+
default: "hour,minute"
|
|
43
|
+
// default: ["hour", "minute", "second"],
|
|
37
44
|
},
|
|
38
45
|
readonly: false,
|
|
39
46
|
"is-link": false
|
|
@@ -44,24 +51,53 @@ const _sfc_main = {
|
|
|
44
51
|
const fieldTextValue = ref("");
|
|
45
52
|
const showPicker = ref(false);
|
|
46
53
|
const emit = __emit;
|
|
54
|
+
let textFormat = parseTimeFormatter(
|
|
55
|
+
props.timeTextFormat,
|
|
56
|
+
props.timeColumnsType
|
|
57
|
+
);
|
|
58
|
+
let valueFormat = parseTimeFormatter("0", props.timeColumnsType);
|
|
47
59
|
const pickerValue = computed(() => {
|
|
60
|
+
let date;
|
|
48
61
|
if (!props.modelValue) {
|
|
49
|
-
|
|
50
|
-
|
|
62
|
+
date = hooks();
|
|
63
|
+
} else {
|
|
64
|
+
date = hooks(props.modelValue, props.valueFormat);
|
|
65
|
+
}
|
|
66
|
+
const hours = date.hours();
|
|
67
|
+
const minutes = date.minutes();
|
|
68
|
+
const seconds = date.seconds();
|
|
69
|
+
let value = [];
|
|
70
|
+
const columnsTypeArr = props.timeColumnsType.split(",");
|
|
71
|
+
if (columnsTypeArr.length == 1) {
|
|
72
|
+
value = [hours];
|
|
73
|
+
} else if (columnsTypeArr.length == 2) {
|
|
74
|
+
value = [hours, minutes];
|
|
75
|
+
} else if (columnsTypeArr.length == 3) {
|
|
76
|
+
value = [hours, minutes, seconds];
|
|
51
77
|
}
|
|
52
|
-
const date = hooks(props.modelValue, props.valueFormat);
|
|
53
|
-
const value = [date.hours(), date.minutes(), date.seconds()];
|
|
54
78
|
return value;
|
|
55
79
|
});
|
|
80
|
+
const columnsType = computed(() => {
|
|
81
|
+
return props.timeColumnsType.split(",");
|
|
82
|
+
});
|
|
83
|
+
const formatter = (type, option) => {
|
|
84
|
+
console.log(type);
|
|
85
|
+
if (type === "hour") {
|
|
86
|
+
option.text += "时";
|
|
87
|
+
} else if (type === "minute") {
|
|
88
|
+
option.text += "分";
|
|
89
|
+
} else if (type === "second") {
|
|
90
|
+
option.text += "秒";
|
|
91
|
+
}
|
|
92
|
+
return option;
|
|
93
|
+
};
|
|
56
94
|
watch(
|
|
57
95
|
() => props.modelValue,
|
|
58
96
|
(value) => {
|
|
59
97
|
if (!value) {
|
|
60
98
|
return;
|
|
61
99
|
}
|
|
62
|
-
fieldTextValue.value = hooks(value,
|
|
63
|
-
props.textFormat
|
|
64
|
-
);
|
|
100
|
+
fieldTextValue.value = hooks(value, valueFormat).format(textFormat);
|
|
65
101
|
},
|
|
66
102
|
{ immediate: true }
|
|
67
103
|
);
|
|
@@ -69,7 +105,7 @@ const _sfc_main = {
|
|
|
69
105
|
const val = hooks(
|
|
70
106
|
`${selectedValues[0]}${selectedValues[1]}${selectedValues[2]}`,
|
|
71
107
|
"HH:mm:ss"
|
|
72
|
-
).format(
|
|
108
|
+
).format(valueFormat);
|
|
73
109
|
emit("update:modelValue", val);
|
|
74
110
|
showPicker.value = false;
|
|
75
111
|
};
|
|
@@ -95,7 +131,8 @@ const _sfc_main = {
|
|
|
95
131
|
modelValue: unref(pickerValue),
|
|
96
132
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(pickerValue) ? pickerValue.value = $event : null),
|
|
97
133
|
readonly: false,
|
|
98
|
-
columnsType:
|
|
134
|
+
columnsType: unref(columnsType),
|
|
135
|
+
formatter,
|
|
99
136
|
onConfirm,
|
|
100
137
|
onCancel: _cache[1] || (_cache[1] = ($event) => showPicker.value = false)
|
|
101
138
|
}), null, 16, ["modelValue", "columnsType"])
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
const parseDateFormatter = (textFormatType, columnsType) => {
|
|
2
|
+
const columnsTypeArr = columnsType.split(",");
|
|
3
|
+
if (columnsTypeArr.length == 1) {
|
|
4
|
+
if (textFormatType == "3") {
|
|
5
|
+
return "YYYY年";
|
|
6
|
+
}
|
|
7
|
+
return "YYYY";
|
|
8
|
+
} else if (columnsTypeArr.length == 2) {
|
|
9
|
+
if (textFormatType == "0") {
|
|
10
|
+
return "YYYYMM";
|
|
11
|
+
} else if (textFormatType == "1") {
|
|
12
|
+
return "YYYY-MM";
|
|
13
|
+
} else if (textFormatType == "2") {
|
|
14
|
+
return "YYYY/MM";
|
|
15
|
+
} else if (textFormatType == "3") {
|
|
16
|
+
return "YYYY年MM月";
|
|
17
|
+
}
|
|
18
|
+
} else if (columnsTypeArr.length == 3) {
|
|
19
|
+
if (textFormatType == "0") {
|
|
20
|
+
return "YYYYMMDD";
|
|
21
|
+
} else if (textFormatType == "1") {
|
|
22
|
+
return "YYYY-MM-DD";
|
|
23
|
+
} else if (textFormatType == "2") {
|
|
24
|
+
return "YYYY/MM/DD";
|
|
25
|
+
} else if (textFormatType == "3") {
|
|
26
|
+
return "YYYY年MM月DD日";
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
const parseTimeFormatter = (textFormatType, columnsType) => {
|
|
31
|
+
const columnsTypeArr = columnsType.split(",");
|
|
32
|
+
if (columnsTypeArr.length == 1) {
|
|
33
|
+
if (textFormatType == "1") {
|
|
34
|
+
return "HH时";
|
|
35
|
+
}
|
|
36
|
+
return "HH";
|
|
37
|
+
} else if (columnsTypeArr.length == 2) {
|
|
38
|
+
if (textFormatType == "0") {
|
|
39
|
+
return "HH:mm";
|
|
40
|
+
} else if (textFormatType == "1") {
|
|
41
|
+
return "HH时mm分";
|
|
42
|
+
}
|
|
43
|
+
} else if (columnsTypeArr.length == 3) {
|
|
44
|
+
if (textFormatType == "0") {
|
|
45
|
+
return "HH:mm:ss";
|
|
46
|
+
} else if (textFormatType == "1") {
|
|
47
|
+
return "HH时mm分ss秒";
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
export {
|
|
52
|
+
parseDateFormatter,
|
|
53
|
+
parseTimeFormatter
|
|
54
|
+
};
|
|
@@ -16,6 +16,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
16
16
|
const vue = require("vue");
|
|
17
17
|
const index = require("../field/index.js");
|
|
18
18
|
const moment = require("../../../../../../node_modules/.pnpm/moment@2.30.1/node_modules/moment/dist/moment.js");
|
|
19
|
+
const dateUtil = require("../../../utils/dateUtil.js");
|
|
19
20
|
const index$2 = require("../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/date-picker/index.js");
|
|
20
21
|
const index$1 = require("../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/popup/index.js");
|
|
21
22
|
const _sfc_main = {
|
|
@@ -25,17 +26,22 @@ const _sfc_main = {
|
|
|
25
26
|
type: String,
|
|
26
27
|
default: ""
|
|
27
28
|
},
|
|
28
|
-
textFormat: {
|
|
29
|
+
// textFormat: {
|
|
30
|
+
// type: String,
|
|
31
|
+
// default: "YYYY-MM-DD",
|
|
32
|
+
// },
|
|
33
|
+
// valueFormat: {
|
|
34
|
+
// type: String,
|
|
35
|
+
// default: "YYYYMMDD",
|
|
36
|
+
// },
|
|
37
|
+
dateColumnsType: {
|
|
29
38
|
type: String,
|
|
30
|
-
default: "
|
|
39
|
+
default: "year,month,day"
|
|
31
40
|
},
|
|
32
|
-
|
|
41
|
+
dateTextFormat: {
|
|
42
|
+
//0:YYYYMMDD;1: YYYY-MM-DD;2:YYYY/MM/DD;3:YYYY年MM月DD日
|
|
33
43
|
type: String,
|
|
34
|
-
default: "
|
|
35
|
-
},
|
|
36
|
-
dateColumnsType: {
|
|
37
|
-
type: Array,
|
|
38
|
-
default: ["year", "month", "day"]
|
|
44
|
+
default: "1"
|
|
39
45
|
},
|
|
40
46
|
readonly: false,
|
|
41
47
|
"is-link": false
|
|
@@ -46,24 +52,52 @@ const _sfc_main = {
|
|
|
46
52
|
const fieldTextValue = vue.ref("");
|
|
47
53
|
const showPicker = vue.ref(false);
|
|
48
54
|
const emit = __emit;
|
|
55
|
+
let textFormat = dateUtil.parseDateFormatter(
|
|
56
|
+
props.dateTextFormat,
|
|
57
|
+
props.dateColumnsType
|
|
58
|
+
);
|
|
59
|
+
let valueFormat = dateUtil.parseDateFormatter("0", props.dateColumnsType);
|
|
49
60
|
const pickerValue = vue.computed(() => {
|
|
61
|
+
let date;
|
|
50
62
|
if (!props.modelValue) {
|
|
51
|
-
|
|
52
|
-
|
|
63
|
+
date = moment.default();
|
|
64
|
+
} else {
|
|
65
|
+
date = moment.default(props.modelValue, valueFormat);
|
|
66
|
+
}
|
|
67
|
+
const year = date.year();
|
|
68
|
+
const month = date.month() + 1;
|
|
69
|
+
const day = date.date();
|
|
70
|
+
let value = [];
|
|
71
|
+
const columnsTypeArr = props.dateColumnsType.split(",");
|
|
72
|
+
if (columnsTypeArr.length == 1) {
|
|
73
|
+
value = [year];
|
|
74
|
+
} else if (columnsTypeArr.length == 2) {
|
|
75
|
+
value = [year, month];
|
|
76
|
+
} else if (columnsTypeArr.length == 3) {
|
|
77
|
+
value = [year, month, day];
|
|
53
78
|
}
|
|
54
|
-
const date = moment.default(props.modelValue, props.valueFormat);
|
|
55
|
-
const value = [date.year(), date.month() + 1, date.date()];
|
|
56
79
|
return value;
|
|
57
80
|
});
|
|
81
|
+
const columnsType = vue.computed(() => {
|
|
82
|
+
return props.dateColumnsType.split(",");
|
|
83
|
+
});
|
|
84
|
+
const formatter = (type, option) => {
|
|
85
|
+
if (type === "year") {
|
|
86
|
+
option.text += "年";
|
|
87
|
+
} else if (type === "month") {
|
|
88
|
+
option.text += "月";
|
|
89
|
+
} else if (type === "day") {
|
|
90
|
+
option.text += "日";
|
|
91
|
+
}
|
|
92
|
+
return option;
|
|
93
|
+
};
|
|
58
94
|
vue.watch(
|
|
59
95
|
() => props.modelValue,
|
|
60
96
|
(value) => {
|
|
61
97
|
if (!value) {
|
|
62
98
|
return;
|
|
63
99
|
}
|
|
64
|
-
fieldTextValue.value = moment.default(value,
|
|
65
|
-
props.textFormat
|
|
66
|
-
);
|
|
100
|
+
fieldTextValue.value = moment.default(value, valueFormat).format(textFormat);
|
|
67
101
|
},
|
|
68
102
|
{ immediate: true }
|
|
69
103
|
);
|
|
@@ -71,7 +105,7 @@ const _sfc_main = {
|
|
|
71
105
|
const val = moment.default(
|
|
72
106
|
`${selectedValues[0]}${selectedValues[1]}${selectedValues[2]}`,
|
|
73
107
|
"YYYYMMDD"
|
|
74
|
-
).format(
|
|
108
|
+
).format(valueFormat);
|
|
75
109
|
emit("update:modelValue", val);
|
|
76
110
|
showPicker.value = false;
|
|
77
111
|
};
|
|
@@ -98,7 +132,8 @@ const _sfc_main = {
|
|
|
98
132
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.isRef(pickerValue) ? pickerValue.value = $event : null),
|
|
99
133
|
readonly: false,
|
|
100
134
|
onConfirm,
|
|
101
|
-
columnsType:
|
|
135
|
+
columnsType: vue.unref(columnsType),
|
|
136
|
+
formatter,
|
|
102
137
|
onCancel: _cache[1] || (_cache[1] = ($event) => showPicker.value = false)
|
|
103
138
|
}), null, 16, ["modelValue", "columnsType"])
|
|
104
139
|
]),
|
|
@@ -20,7 +20,7 @@ const index$1 = require("../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.
|
|
|
20
20
|
const _sfc_main = {
|
|
21
21
|
__name: "FieldPicker",
|
|
22
22
|
props: {
|
|
23
|
-
|
|
23
|
+
pickerOptions: {
|
|
24
24
|
type: Array,
|
|
25
25
|
default: []
|
|
26
26
|
},
|
|
@@ -59,7 +59,7 @@ const _sfc_main = {
|
|
|
59
59
|
if (!value) {
|
|
60
60
|
return;
|
|
61
61
|
}
|
|
62
|
-
const optionItem = props.
|
|
62
|
+
const optionItem = props.pickerOptions.find(
|
|
63
63
|
(item) => item[props.treeOptionsFieldNames.value] == value
|
|
64
64
|
);
|
|
65
65
|
fieldTextValue.value = optionItem == null ? void 0 : optionItem[props.treeOptionsFieldNames.text];
|
|
@@ -89,7 +89,7 @@ const _sfc_main = {
|
|
|
89
89
|
}, {
|
|
90
90
|
default: vue.withCtx(() => [
|
|
91
91
|
vue.createVNode(_component_van_picker, vue.mergeProps(_ctx.$attrs, {
|
|
92
|
-
columns: __props.
|
|
92
|
+
columns: __props.pickerOptions,
|
|
93
93
|
"columns-field-names": __props.treeOptionsFieldNames,
|
|
94
94
|
"model-value": vue.unref(pickerValue),
|
|
95
95
|
readonly: false,
|
|
@@ -6,7 +6,6 @@ const index$1 = require("../radioGroup/index.js");
|
|
|
6
6
|
const _sfc_main = {
|
|
7
7
|
__name: "FieldRadio",
|
|
8
8
|
setup(__props) {
|
|
9
|
-
debugger;
|
|
10
9
|
return (_ctx, _cache) => {
|
|
11
10
|
return vue.openBlock(), vue.createBlock(vue.unref(index.MobileField), vue.normalizeProps(vue.guardReactiveProps(_ctx.$attrs)), {
|
|
12
11
|
input: vue.withCtx(() => [
|
|
@@ -16,6 +16,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
16
16
|
const vue = require("vue");
|
|
17
17
|
const index = require("../field/index.js");
|
|
18
18
|
const moment = require("../../../../../../node_modules/.pnpm/moment@2.30.1/node_modules/moment/dist/moment.js");
|
|
19
|
+
const dateUtil = require("../../../utils/dateUtil.js");
|
|
19
20
|
const index$2 = require("../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/time-picker/index.js");
|
|
20
21
|
const index$1 = require("../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/popup/index.js");
|
|
21
22
|
const _sfc_main = {
|
|
@@ -25,17 +26,23 @@ const _sfc_main = {
|
|
|
25
26
|
type: String,
|
|
26
27
|
default: ""
|
|
27
28
|
},
|
|
28
|
-
textFormat: {
|
|
29
|
+
// textFormat: {
|
|
30
|
+
// type: String,
|
|
31
|
+
// default: "HH:mm:ss",
|
|
32
|
+
// },
|
|
33
|
+
// valueFormat: {
|
|
34
|
+
// type: String,
|
|
35
|
+
// default: "HH:mm:ss",
|
|
36
|
+
// },
|
|
37
|
+
timeTextFormat: {
|
|
38
|
+
//0:HH:mm:ss;1: HH时mm分ss秒
|
|
29
39
|
type: String,
|
|
30
|
-
default: "
|
|
31
|
-
},
|
|
32
|
-
valueFormat: {
|
|
33
|
-
type: String,
|
|
34
|
-
default: "HH:mm:ss"
|
|
40
|
+
default: "0"
|
|
35
41
|
},
|
|
36
42
|
timeColumnsType: {
|
|
37
|
-
type:
|
|
38
|
-
default:
|
|
43
|
+
type: String,
|
|
44
|
+
default: "hour,minute"
|
|
45
|
+
// default: ["hour", "minute", "second"],
|
|
39
46
|
},
|
|
40
47
|
readonly: false,
|
|
41
48
|
"is-link": false
|
|
@@ -46,24 +53,53 @@ const _sfc_main = {
|
|
|
46
53
|
const fieldTextValue = vue.ref("");
|
|
47
54
|
const showPicker = vue.ref(false);
|
|
48
55
|
const emit = __emit;
|
|
56
|
+
let textFormat = dateUtil.parseTimeFormatter(
|
|
57
|
+
props.timeTextFormat,
|
|
58
|
+
props.timeColumnsType
|
|
59
|
+
);
|
|
60
|
+
let valueFormat = dateUtil.parseTimeFormatter("0", props.timeColumnsType);
|
|
49
61
|
const pickerValue = vue.computed(() => {
|
|
62
|
+
let date;
|
|
50
63
|
if (!props.modelValue) {
|
|
51
|
-
|
|
52
|
-
|
|
64
|
+
date = moment.default();
|
|
65
|
+
} else {
|
|
66
|
+
date = moment.default(props.modelValue, props.valueFormat);
|
|
67
|
+
}
|
|
68
|
+
const hours = date.hours();
|
|
69
|
+
const minutes = date.minutes();
|
|
70
|
+
const seconds = date.seconds();
|
|
71
|
+
let value = [];
|
|
72
|
+
const columnsTypeArr = props.timeColumnsType.split(",");
|
|
73
|
+
if (columnsTypeArr.length == 1) {
|
|
74
|
+
value = [hours];
|
|
75
|
+
} else if (columnsTypeArr.length == 2) {
|
|
76
|
+
value = [hours, minutes];
|
|
77
|
+
} else if (columnsTypeArr.length == 3) {
|
|
78
|
+
value = [hours, minutes, seconds];
|
|
53
79
|
}
|
|
54
|
-
const date = moment.default(props.modelValue, props.valueFormat);
|
|
55
|
-
const value = [date.hours(), date.minutes(), date.seconds()];
|
|
56
80
|
return value;
|
|
57
81
|
});
|
|
82
|
+
const columnsType = vue.computed(() => {
|
|
83
|
+
return props.timeColumnsType.split(",");
|
|
84
|
+
});
|
|
85
|
+
const formatter = (type, option) => {
|
|
86
|
+
console.log(type);
|
|
87
|
+
if (type === "hour") {
|
|
88
|
+
option.text += "时";
|
|
89
|
+
} else if (type === "minute") {
|
|
90
|
+
option.text += "分";
|
|
91
|
+
} else if (type === "second") {
|
|
92
|
+
option.text += "秒";
|
|
93
|
+
}
|
|
94
|
+
return option;
|
|
95
|
+
};
|
|
58
96
|
vue.watch(
|
|
59
97
|
() => props.modelValue,
|
|
60
98
|
(value) => {
|
|
61
99
|
if (!value) {
|
|
62
100
|
return;
|
|
63
101
|
}
|
|
64
|
-
fieldTextValue.value = moment.default(value,
|
|
65
|
-
props.textFormat
|
|
66
|
-
);
|
|
102
|
+
fieldTextValue.value = moment.default(value, valueFormat).format(textFormat);
|
|
67
103
|
},
|
|
68
104
|
{ immediate: true }
|
|
69
105
|
);
|
|
@@ -71,7 +107,7 @@ const _sfc_main = {
|
|
|
71
107
|
const val = moment.default(
|
|
72
108
|
`${selectedValues[0]}${selectedValues[1]}${selectedValues[2]}`,
|
|
73
109
|
"HH:mm:ss"
|
|
74
|
-
).format(
|
|
110
|
+
).format(valueFormat);
|
|
75
111
|
emit("update:modelValue", val);
|
|
76
112
|
showPicker.value = false;
|
|
77
113
|
};
|
|
@@ -97,7 +133,8 @@ const _sfc_main = {
|
|
|
97
133
|
modelValue: vue.unref(pickerValue),
|
|
98
134
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.isRef(pickerValue) ? pickerValue.value = $event : null),
|
|
99
135
|
readonly: false,
|
|
100
|
-
columnsType:
|
|
136
|
+
columnsType: vue.unref(columnsType),
|
|
137
|
+
formatter,
|
|
101
138
|
onConfirm,
|
|
102
139
|
onCancel: _cache[1] || (_cache[1] = ($event) => showPicker.value = false)
|
|
103
140
|
}), null, 16, ["modelValue", "columnsType"])
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const parseDateFormatter = (textFormatType, columnsType) => {
|
|
4
|
+
const columnsTypeArr = columnsType.split(",");
|
|
5
|
+
if (columnsTypeArr.length == 1) {
|
|
6
|
+
if (textFormatType == "3") {
|
|
7
|
+
return "YYYY年";
|
|
8
|
+
}
|
|
9
|
+
return "YYYY";
|
|
10
|
+
} else if (columnsTypeArr.length == 2) {
|
|
11
|
+
if (textFormatType == "0") {
|
|
12
|
+
return "YYYYMM";
|
|
13
|
+
} else if (textFormatType == "1") {
|
|
14
|
+
return "YYYY-MM";
|
|
15
|
+
} else if (textFormatType == "2") {
|
|
16
|
+
return "YYYY/MM";
|
|
17
|
+
} else if (textFormatType == "3") {
|
|
18
|
+
return "YYYY年MM月";
|
|
19
|
+
}
|
|
20
|
+
} else if (columnsTypeArr.length == 3) {
|
|
21
|
+
if (textFormatType == "0") {
|
|
22
|
+
return "YYYYMMDD";
|
|
23
|
+
} else if (textFormatType == "1") {
|
|
24
|
+
return "YYYY-MM-DD";
|
|
25
|
+
} else if (textFormatType == "2") {
|
|
26
|
+
return "YYYY/MM/DD";
|
|
27
|
+
} else if (textFormatType == "3") {
|
|
28
|
+
return "YYYY年MM月DD日";
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
const parseTimeFormatter = (textFormatType, columnsType) => {
|
|
33
|
+
const columnsTypeArr = columnsType.split(",");
|
|
34
|
+
if (columnsTypeArr.length == 1) {
|
|
35
|
+
if (textFormatType == "1") {
|
|
36
|
+
return "HH时";
|
|
37
|
+
}
|
|
38
|
+
return "HH";
|
|
39
|
+
} else if (columnsTypeArr.length == 2) {
|
|
40
|
+
if (textFormatType == "0") {
|
|
41
|
+
return "HH:mm";
|
|
42
|
+
} else if (textFormatType == "1") {
|
|
43
|
+
return "HH时mm分";
|
|
44
|
+
}
|
|
45
|
+
} else if (columnsTypeArr.length == 3) {
|
|
46
|
+
if (textFormatType == "0") {
|
|
47
|
+
return "HH:mm:ss";
|
|
48
|
+
} else if (textFormatType == "1") {
|
|
49
|
+
return "HH时mm分ss秒";
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
exports.parseDateFormatter = parseDateFormatter;
|
|
54
|
+
exports.parseTimeFormatter = parseTimeFormatter;
|