From 41e5e90990ae2f8141d4fc5ba6c6baafab3ff92f Mon Sep 17 00:00:00 2001 From: fangxiang Date: Thu, 7 Jul 2022 16:18:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E9=9C=B8=E5=AE=9A=E5=88=B6=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E6=97=B6=E9=92=9F=E4=BF=A1=E5=8F=B7=E6=BA=90=E6=97=B6?= =?UTF-8?q?=E9=9A=90=E8=97=8F=E4=B8=AD=E6=96=87=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ClockSignalSourceDialog.vue | 58 ++++++++++++++++++++-- 1 file changed, 54 insertions(+), 4 deletions(-) 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);