From 9de2c874f096d6cef26930b8963facbcd250d37c Mon Sep 17 00:00:00 2001 From: sjl <1716605279@qq.com> Date: Thu, 7 Nov 2024 10:24:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=B6=E9=97=B4=E6=8E=A7=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/api/device/interface/index.ts | 3 +- frontend/src/components/TimeControl/index.vue | 8 ++-- .../machine/device/components/devicePopup.vue | 37 ++++++++++--------- frontend/src/views/machine/device/index.vue | 6 +-- 4 files changed, 29 insertions(+), 25 deletions(-) diff --git a/frontend/src/api/device/interface/index.ts b/frontend/src/api/device/interface/index.ts index 1b969e7..c348fc1 100644 --- a/frontend/src/api/device/interface/index.ts +++ b/frontend/src/api/device/interface/index.ts @@ -28,9 +28,10 @@ export namespace Device { createId: string; //出厂编号 hardwareVersion: string; //固件版本 softwareVersion: string; //软件版本 + protocol:string; //通讯协议 ip: string; //IP地址 port: number; //端口号 - encryption: string; //装置是否为加密版本 + encryption: number; //装置是否为加密版本 series?: string| null; //装置识别码(3ds加密) devKey?: string| null; //装置秘钥(3ds加密) sampleID?: string| null; //样品编号 diff --git a/frontend/src/components/TimeControl/index.vue b/frontend/src/components/TimeControl/index.vue index 174c2e3..357d8c7 100644 --- a/frontend/src/components/TimeControl/index.vue +++ b/frontend/src/components/TimeControl/index.vue @@ -85,16 +85,16 @@ const props = defineProps({ }, default: { type: String, - default: '日', + default: '月', }, }) // 定义事件 const emit = defineEmits<{ - (e: 'update-dates', startDate: Date, endDate: Date): void; + (e: 'update-dates', startDate: string, endDate: string): void; }>() const timeUnit = ref(props.default) // 默认选择 -const startDate = ref(new Date()) // 起始日期 +const startDate = ref(new Date(0)) // 起始日期 const endDate = ref(new Date()) // 结束日期 const isNextDisabled = ref(false) // 控制下一周期按钮的禁用状态 const today = ref(new Date()) // 当前日期 @@ -109,7 +109,7 @@ const timeUnits = ref( // 发出日期变化事件 const emitDateChange = () => { emit('update-dates', formatDate(startDate.value), formatDate(endDate.value)) - //console.log('emitDateChange', startDate.value, endDate.value); + console.log('emitDateChange', startDate.value, endDate.value) } // 在组件挂载时更新日期范围 diff --git a/frontend/src/views/machine/device/components/devicePopup.vue b/frontend/src/views/machine/device/components/devicePopup.vue index 04cba2c..55ab986 100644 --- a/frontend/src/views/machine/device/components/devicePopup.vue +++ b/frontend/src/views/machine/device/components/devicePopup.vue @@ -54,7 +54,11 @@ - + @@ -75,22 +79,21 @@ - - + + - + - @@ -101,13 +104,9 @@ - - + + + @@ -154,7 +153,8 @@ import { computed, type Ref, ref } from 'vue'; import { useDictStore } from '@/stores/modules/dict' import { CirclePlus, Delete } from '@element-plus/icons-vue' - import { el } from 'element-plus/es/locale'; + // 使用 dayjs 库格式化 + import dayjs from 'dayjs'; const dictStore = useDictStore() // 定义弹出组件元信息 const dialogFormRef = ref() @@ -175,9 +175,10 @@ createId: '', hardwareVersion: '', softwareVersion: '', + protocol: '', ip: '', port: 0, - encryption: '', + encryption: 1, reCheckNum:0, state: 1, }) @@ -200,9 +201,10 @@ createId: '', hardwareVersion: '', softwareVersion: '', + protocol: '', ip: '', port: 0, - encryption: '', + encryption: 1, reCheckNum:0, state: 1, } @@ -244,6 +246,7 @@ try { dialogFormRef.value?.validate(async (valid: boolean) => { if (valid) { + formContent.value.createDate = dayjs(formContent.value.createDate).format('YYYY-MM-DD HH:mm:ss'); if (formContent.value.id) { updatePqDev(formContent.value).then(result => { if(result.code != 'A0000'){ @@ -276,7 +279,7 @@ titleType.value = sign dialogVisible.value = true if (data.id) { - data.createDate = data.createDate.replace('T', ' ') + formContent.value = { ...data } } else { resetFormContent() diff --git a/frontend/src/views/machine/device/index.vue b/frontend/src/views/machine/device/index.vue index 99d6a12..4fd363a 100644 --- a/frontend/src/views/machine/device/index.vue +++ b/frontend/src/views/machine/device/index.vue @@ -51,8 +51,8 @@ const devicePopup = ref() const getTableList = (params: any) => { let newParams = JSON.parse(JSON.stringify(params)) - newParams.createTimeEnd = endDate.value - newParams.createTimeStart = startDate.value + newParams.searchEndTime = endDate.value + newParams.searchBeginTime = startDate.value return getPqDevList(newParams) } @@ -105,7 +105,7 @@ const columns = reactive[]>([