diff --git a/src/components/ClockSignalSourceDialog.vue b/src/components/ClockSignalSourceDialog.vue index bbf878e..0e98e0b 100644 --- a/src/components/ClockSignalSourceDialog.vue +++ b/src/components/ClockSignalSourceDialog.vue @@ -452,6 +452,7 @@ import GlobalData from "src/common/GlobalData"; import { useQuasar, date as DateHelper } from "quasar"; import { useI18n } from "vue-i18n"; import ClockWindowParamEntity from "src/entities/ClockWindowParamEntity"; +import { Protocol } from "src/entities/WSProtocol"; export default defineComponent({ name: "ComponentClockSignalSourceDialog", @@ -463,7 +464,8 @@ export default defineComponent({ let $t = useI18n(); const now = Date.now(); - const date_format_options = ref([ + + const date_formats_en_ = [ { label: DateHelper.formatDate(now, "YYYY/MM/DD"), value: "yyyy/MM/dd", @@ -472,22 +474,70 @@ export default defineComponent({ label: DateHelper.formatDate(now, "YYYY-MM-DD"), value: "yyyy-MM-dd", }, + { + label: DateHelper.formatDate(now, "DD/MM/YYYY"), + value: "dd/MM/yyyy", + }, + { + label: DateHelper.formatDate(now, "DD-MM-YYYY"), + value: "dd-MM-yyyy", + }, + ]; + + const date_formats_zh_ = [ { label: DateHelper.formatDate(now, "YYYY年MM月DD日"), value: "yyyy年MM月dd日", }, - ]); + { + label: DateHelper.formatDate(now, "DD日MM月YYYY年"), + value: "dd日MM月yyyy年", + }, + ]; - const time_format_options = ref([ + const time_formats_en_ = [ { label: DateHelper.formatDate(now, "HH:mm:ss"), value: "hh:mm:ss", }, + ]; + + const time_formats_zh_ = [ { label: DateHelper.formatDate(now, "HH时mm分ss秒"), value: "hh时mm分ss秒", }, - ]); + ]; + + const date_format_options: Ref> = ref([]); + + const time_format_options: Ref> = ref([]); + + const refresh_formats = () => { + date_format_options.value = []; + + time_format_options.value = []; + + if ( + ($store.state.device_attribute & Protocol.EDeviceAttribute.CustomISV) == + 0 + ) { + date_format_options.value = [...date_formats_en_, ...date_formats_zh_]; + time_format_options.value = [...time_formats_en_, ...time_formats_zh_]; + } else { + date_format_options.value = date_formats_en_; + time_format_options.value = time_formats_en_; + } + }; + + refresh_formats(); + + watch( + () => $store.state.device_attribute, + (value) => { + refresh_formats(); + } + ); let show_dialog = ref(false); let loading = ref(false);