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; +};