diff --git a/apps/web-antd/src/views/iot/device/device/index.vue b/apps/web-antd/src/views/iot/device/device/index.vue index 153099e79..59ee900d3 100644 --- a/apps/web-antd/src/views/iot/device/device/index.vue +++ b/apps/web-antd/src/views/iot/device/device/index.vue @@ -63,17 +63,17 @@ const [DeviceImportFormModal, deviceImportFormModalApi] = useVbenModal({ destroyOnClose: true, }); -// 搜索参数 -const searchParams = ref({ +const queryParams = ref({ deviceName: '', nickname: '', productId: undefined as number | undefined, deviceType: undefined as number | undefined, status: undefined as number | undefined, groupId: undefined as number | undefined, -}); +}); // 搜索参数 // 获取字典选项 +// TODO @haohao:直接使用 getDictOptions 哈,不用包装方法; const getIntDictOptions = (dictType: string) => { return getDictOptions(dictType, 'number'); }; @@ -81,21 +81,22 @@ const getIntDictOptions = (dictType: string) => { /** 搜索 */ function handleSearch() { if (viewMode.value === 'list') { - gridApi.formApi.setValues(searchParams.value); + gridApi.formApi.setValues(queryParams.value); gridApi.query(); } else { - cardViewRef.value?.search(searchParams.value); + // todo @haohao:改成 query 方法,更统一; + cardViewRef.value?.search(queryParams.value); } } /** 重置 */ function handleReset() { - searchParams.value.deviceName = ''; - searchParams.value.nickname = ''; - searchParams.value.productId = undefined; - searchParams.value.deviceType = undefined; - searchParams.value.status = undefined; - searchParams.value.groupId = undefined; + queryParams.value.deviceName = ''; + queryParams.value.nickname = ''; + queryParams.value.productId = undefined; + queryParams.value.deviceType = undefined; + queryParams.value.status = undefined; + queryParams.value.groupId = undefined; handleSearch(); } @@ -110,7 +111,7 @@ function handleRefresh() { /** 导出表格 */ async function handleExport() { - const data = await exportDeviceExcel(searchParams.value); + const data = await exportDeviceExcel(queryParams.value); downloadFileFromBlobPart({ fileName: '物联网设备.xls', source: data }); } @@ -212,7 +213,7 @@ const [Grid, gridApi] = useVbenVxeGrid({ return await getDevicePage({ pageNo: page.currentPage, pageSize: page.pageSize, - ...searchParams.value, + ...queryParams.value, }); }, }, @@ -238,7 +239,7 @@ onMounted(async () => { // 处理 productId 参数 const { productId } = route.query; if (productId) { - searchParams.value.productId = Number(productId); + queryParams.value.productId = Number(productId); // 自动触发搜索 handleSearch(); } @@ -256,7 +257,7 @@ onMounted(async () => {