From ec29e6d110e6992acf50d1932ba59ed2c9e97b15 Mon Sep 17 00:00:00 2001 From: fhysy <1149505133@qq.com> Date: Thu, 9 Oct 2025 16:51:23 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E8=A1=A8=E6=A0=BC=E7=BB=84=E4=BB=B6=E5=8F=8A?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E9=9B=86=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增设备选择组件,支持设备多选与单选 - 在 demo/test/detail.vue 页面集成设备选择功能 - 修复设备列表页面设备 KEY 显示字段错误问题 --- .../device-select/device-select-table.vue | 281 ++++++++++++++++++ apps/web-antd/src/views/demo/test/detail.vue | 81 ++++- .../src/views/device/device/index.vue | 2 +- 3 files changed, 362 insertions(+), 2 deletions(-) create mode 100644 apps/web-antd/src/components/device-select/device-select-table.vue diff --git a/apps/web-antd/src/components/device-select/device-select-table.vue b/apps/web-antd/src/components/device-select/device-select-table.vue new file mode 100644 index 0000000..efdb97f --- /dev/null +++ b/apps/web-antd/src/components/device-select/device-select-table.vue @@ -0,0 +1,281 @@ + + + diff --git a/apps/web-antd/src/views/demo/test/detail.vue b/apps/web-antd/src/views/demo/test/detail.vue index c3d93c3..0694471 100644 --- a/apps/web-antd/src/views/demo/test/detail.vue +++ b/apps/web-antd/src/views/demo/test/detail.vue @@ -6,6 +6,13 @@ import { defineAsyncComponent, ref } from 'vue'; import { Modal } from 'ant-design-vue'; import 'shiyzhangcron/dist/style.css'; +// 简化的设备类型,仅用于本页面 v-model 类型提示 +type DeviceLite = { + deviceKey?: string; + deviceName?: string; + id: number | string; + productObj?: { productName?: string }; +}; const CronPickerModal = defineAsyncComponent( () => import('../../../components/CronPickerModal/index.vue'), @@ -14,15 +21,22 @@ const CronPickerModal = defineAsyncComponent( const ProductSelectTable = defineAsyncComponent( () => import('../../../components/product-select/product-select-table.vue'), ); +const DeviceSelectTable = defineAsyncComponent( + () => import('../../../components/device-select/device-select-table.vue'), +); const easyCronInnerValue = ref('* * * * * ? *'); const cronModalVisible = ref(false); const productSelectModalVisible = ref(false); +const deviceSelectModalVisible = ref(false); // 产品选择相关 const selectedProducts = ref([]); const isMultiple = ref(false); +// 设备选择相关(默认多选) +const selectedDevices = ref([]); + const openCronModal = () => { cronModalVisible.value = true; }; @@ -54,6 +68,10 @@ const openProductSelectModal = () => { productSelectModalVisible.value = true; }; +const openDeviceSelectModal = () => { + deviceSelectModalVisible.value = true; +}; + const okProductSelectModal = () => { if (selectedProducts.value.length === 0) { Modal.error({ @@ -65,9 +83,24 @@ const okProductSelectModal = () => { } }; +const okDeviceSelectModal = () => { + if (selectedDevices.value.length === 0) { + Modal.error({ + title: '请选择设备', + }); + } else { + console.log('已选择的设备:', selectedDevices.value); + deviceSelectModalVisible.value = false; + } +}; + const closeProductSelectModal = () => { productSelectModalVisible.value = false; }; + +const closeDeviceSelectModal = () => { + deviceSelectModalVisible.value = false; +};