From c8d4c65203fb67323f16760c014c3aa79ea7a0f6 Mon Sep 17 00:00:00 2001 From: zch Date: Mon, 1 Jun 2026 14:52:47 +0800 Subject: [PATCH] =?UTF-8?q?refactor(wcs):=20=E7=BB=9F=E4=B8=80=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E5=BC=82=E5=B8=B8=E5=A4=84=E7=90=86=E4=B8=8E=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E7=B1=BB=E5=9E=8B=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 替换页面内console.error为统一的$modal.msgError提示用户 2. 为列表查询添加try-finally确保loading状态正确关闭 3. 补全所有CRUD接口的AxiosPromise返回类型 4. 新增时间范围工具类统一秒级时间格式处理 5. 优化表单提交数据构建逻辑与表单校验规则 --- src/api/wcs/deviceHost/index.ts | 6 +-- src/api/wcs/deviceInfo/index.ts | 6 +-- src/api/wcs/deviceParam/index.ts | 6 +-- src/api/wcs/locationInfo/index.ts | 6 +-- src/api/wcs/materialInfo/index.ts | 6 +-- src/api/wcs/pathDetails/index.ts | 6 +-- src/api/wcs/pathInfo/index.ts | 6 +-- src/api/wcs/storeInfo/index.ts | 6 +-- src/api/wcs/taskDetail/index.ts | 9 +++-- src/api/wcs/taskQueue/index.ts | 6 +-- src/views/wcs/deviceHost/index.vue | 38 +++++++++++++++---- src/views/wcs/deviceInfo/index.vue | 35 ++++++++++++----- src/views/wcs/deviceParam/index.vue | 17 +++++---- src/views/wcs/locationInfo/index.vue | 19 ++++++---- src/views/wcs/materialInfo/index.vue | 13 ++++--- src/views/wcs/pathDetails/index.vue | 6 +-- src/views/wcs/pathInfo/index.vue | 15 +++++--- src/views/wcs/storeInfo/index.vue | 13 ++++--- src/views/wcs/taskDetail/index.vue | 2 +- src/views/wcs/taskQueue/index.vue | 2 +- ...createdTimeRange.ts => createTimeRange.ts} | 0 21 files changed, 138 insertions(+), 85 deletions(-) rename src/views/wcs/utils/{createdTimeRange.ts => createTimeRange.ts} (100%) diff --git a/src/api/wcs/deviceHost/index.ts b/src/api/wcs/deviceHost/index.ts index 8a7f4ce..5dfe4dc 100644 --- a/src/api/wcs/deviceHost/index.ts +++ b/src/api/wcs/deviceHost/index.ts @@ -80,7 +80,7 @@ export const existsDeviceHost = (query?: DeviceHostQuery): AxiosPromise * 新增设备主机 * @param data */ -export const addDeviceHost = (data: DeviceHostForm) => { +export const addDeviceHost = (data: DeviceHostForm): AxiosPromise => { return request({ url: '/wcs/deviceHost', method: 'post', @@ -92,7 +92,7 @@ export const addDeviceHost = (data: DeviceHostForm) => { * 修改设备主机 * @param data */ -export const updateDeviceHost = (data: DeviceHostForm) => { +export const updateDeviceHost = (data: DeviceHostForm): AxiosPromise => { return request({ url: '/wcs/deviceHost', method: 'put', @@ -104,7 +104,7 @@ export const updateDeviceHost = (data: DeviceHostForm) => { * 删除设备主机 * @param objId */ -export const delDeviceHost = (objId: DeviceHostId | DeviceHostIds) => { +export const delDeviceHost = (objId: DeviceHostId | DeviceHostIds): AxiosPromise => { return request({ url: '/wcs/deviceHost/' + objId, method: 'delete' diff --git a/src/api/wcs/deviceInfo/index.ts b/src/api/wcs/deviceInfo/index.ts index d47ae5c..405a39c 100644 --- a/src/api/wcs/deviceInfo/index.ts +++ b/src/api/wcs/deviceInfo/index.ts @@ -80,7 +80,7 @@ export const existsDeviceInfo = (query?: DeviceInfoQuery): AxiosPromise * 新增设备信息 * @param data */ -export const addDeviceInfo = (data: DeviceInfoForm) => { +export const addDeviceInfo = (data: DeviceInfoForm): AxiosPromise => { return request({ url: '/wcs/deviceInfo', method: 'post', @@ -92,7 +92,7 @@ export const addDeviceInfo = (data: DeviceInfoForm) => { * 修改设备信息 * @param data */ -export const updateDeviceInfo = (data: DeviceInfoForm) => { +export const updateDeviceInfo = (data: DeviceInfoForm): AxiosPromise => { return request({ url: '/wcs/deviceInfo', method: 'put', @@ -104,7 +104,7 @@ export const updateDeviceInfo = (data: DeviceInfoForm) => { * 删除设备信息 * @param objId */ -export const delDeviceInfo = (objId: DeviceInfoId | DeviceInfoIds) => { +export const delDeviceInfo = (objId: DeviceInfoId | DeviceInfoIds): AxiosPromise => { return request({ url: '/wcs/deviceInfo/' + objId, method: 'delete' diff --git a/src/api/wcs/deviceParam/index.ts b/src/api/wcs/deviceParam/index.ts index 81aec03..07f4ed7 100644 --- a/src/api/wcs/deviceParam/index.ts +++ b/src/api/wcs/deviceParam/index.ts @@ -67,7 +67,7 @@ export const existsDeviceParam = (query?: DeviceParamQuery): AxiosPromise { +export const addDeviceParam = (data: DeviceParamForm): AxiosPromise => { return request({ url: '/wcs/deviceParam', method: 'post', @@ -79,7 +79,7 @@ export const addDeviceParam = (data: DeviceParamForm) => { * 修改设备参数 * @param data */ -export const updateDeviceParam = (data: DeviceParamForm) => { +export const updateDeviceParam = (data: DeviceParamForm): AxiosPromise => { return request({ url: '/wcs/deviceParam', method: 'put', @@ -91,7 +91,7 @@ export const updateDeviceParam = (data: DeviceParamForm) => { * 删除设备参数 * @param objId */ -export const delDeviceParam = (objId: DeviceParamId | DeviceParamIds) => { +export const delDeviceParam = (objId: DeviceParamId | DeviceParamIds): AxiosPromise => { return request({ url: '/wcs/deviceParam/' + objId, method: 'delete' diff --git a/src/api/wcs/locationInfo/index.ts b/src/api/wcs/locationInfo/index.ts index 2420bf7..4e222ed 100644 --- a/src/api/wcs/locationInfo/index.ts +++ b/src/api/wcs/locationInfo/index.ts @@ -67,7 +67,7 @@ export const existsLocationInfo = (query?: LocationInfoQuery): AxiosPromise { +export const addLocationInfo = (data: LocationInfoForm): AxiosPromise => { return request({ url: '/wcs/locationInfo', method: 'post', @@ -79,7 +79,7 @@ export const addLocationInfo = (data: LocationInfoForm) => { * 修改库位信息 * @param data */ -export const updateLocationInfo = (data: LocationInfoForm) => { +export const updateLocationInfo = (data: LocationInfoForm): AxiosPromise => { return request({ url: '/wcs/locationInfo', method: 'put', @@ -91,7 +91,7 @@ export const updateLocationInfo = (data: LocationInfoForm) => { * 删除库位信息 * @param objId */ -export const delLocationInfo = (objId: LocationInfoId | LocationInfoIds) => { +export const delLocationInfo = (objId: LocationInfoId | LocationInfoIds): AxiosPromise => { return request({ url: '/wcs/locationInfo/' + objId, method: 'delete' diff --git a/src/api/wcs/materialInfo/index.ts b/src/api/wcs/materialInfo/index.ts index 6512e60..17dc1bc 100644 --- a/src/api/wcs/materialInfo/index.ts +++ b/src/api/wcs/materialInfo/index.ts @@ -80,7 +80,7 @@ export const existsMaterialInfo = (query?: MaterialInfoQuery): AxiosPromise { +export const addMaterialInfo = (data: MaterialInfoForm): AxiosPromise => { return request({ url: '/wcs/materialInfo', method: 'post', @@ -92,7 +92,7 @@ export const addMaterialInfo = (data: MaterialInfoForm) => { * 修改物料信息 * @param data */ -export const updateMaterialInfo = (data: MaterialInfoForm) => { +export const updateMaterialInfo = (data: MaterialInfoForm): AxiosPromise => { return request({ url: '/wcs/materialInfo', method: 'put', @@ -104,7 +104,7 @@ export const updateMaterialInfo = (data: MaterialInfoForm) => { * 删除物料信息 * @param objId */ -export const delMaterialInfo = (objId: MaterialInfoId | MaterialInfoIds) => { +export const delMaterialInfo = (objId: MaterialInfoId | MaterialInfoIds): AxiosPromise => { return request({ url: '/wcs/materialInfo/' + objId, method: 'delete' diff --git a/src/api/wcs/pathDetails/index.ts b/src/api/wcs/pathDetails/index.ts index d8f5d6b..a110640 100644 --- a/src/api/wcs/pathDetails/index.ts +++ b/src/api/wcs/pathDetails/index.ts @@ -67,7 +67,7 @@ export const existsPathDetails = (query?: PathDetailsQuery): AxiosPromise { +export const addPathDetails = (data: PathDetailsForm): AxiosPromise => { return request({ url: '/wcs/pathDetails', method: 'post', @@ -79,7 +79,7 @@ export const addPathDetails = (data: PathDetailsForm) => { * 修改路径明细 * @param data */ -export const updatePathDetails = (data: PathDetailsForm) => { +export const updatePathDetails = (data: PathDetailsForm): AxiosPromise => { return request({ url: '/wcs/pathDetails', method: 'put', @@ -91,7 +91,7 @@ export const updatePathDetails = (data: PathDetailsForm) => { * 删除路径明细 * @param objId */ -export const delPathDetails = (objId: PathDetailsId | PathDetailsIds) => { +export const delPathDetails = (objId: PathDetailsId | PathDetailsIds): AxiosPromise => { return request({ url: '/wcs/pathDetails/' + objId, method: 'delete' diff --git a/src/api/wcs/pathInfo/index.ts b/src/api/wcs/pathInfo/index.ts index 2ab2d27..8dc9306 100644 --- a/src/api/wcs/pathInfo/index.ts +++ b/src/api/wcs/pathInfo/index.ts @@ -80,7 +80,7 @@ export const existsPathInfo = (query?: PathInfoQuery): AxiosPromise => * 新增路径信息 * @param data */ -export const addPathInfo = (data: PathInfoForm) => { +export const addPathInfo = (data: PathInfoForm): AxiosPromise => { return request({ url: '/wcs/pathInfo', method: 'post', @@ -92,7 +92,7 @@ export const addPathInfo = (data: PathInfoForm) => { * 修改路径信息 * @param data */ -export const updatePathInfo = (data: PathInfoForm) => { +export const updatePathInfo = (data: PathInfoForm): AxiosPromise => { return request({ url: '/wcs/pathInfo', method: 'put', @@ -104,7 +104,7 @@ export const updatePathInfo = (data: PathInfoForm) => { * 删除路径信息 * @param objId */ -export const delPathInfo = (objId: PathInfoId | PathInfoIds) => { +export const delPathInfo = (objId: PathInfoId | PathInfoIds): AxiosPromise => { return request({ url: '/wcs/pathInfo/' + objId, method: 'delete' diff --git a/src/api/wcs/storeInfo/index.ts b/src/api/wcs/storeInfo/index.ts index 254df5b..f661f57 100644 --- a/src/api/wcs/storeInfo/index.ts +++ b/src/api/wcs/storeInfo/index.ts @@ -80,7 +80,7 @@ export const existsStoreInfo = (query?: StoreInfoQuery): AxiosPromise = * 新增仓库信息 * @param data */ -export const addStoreInfo = (data: StoreInfoForm) => { +export const addStoreInfo = (data: StoreInfoForm): AxiosPromise => { return request({ url: '/wcs/storeInfo', method: 'post', @@ -92,7 +92,7 @@ export const addStoreInfo = (data: StoreInfoForm) => { * 修改仓库信息 * @param data */ -export const updateStoreInfo = (data: StoreInfoForm) => { +export const updateStoreInfo = (data: StoreInfoForm): AxiosPromise => { return request({ url: '/wcs/storeInfo', method: 'put', @@ -104,7 +104,7 @@ export const updateStoreInfo = (data: StoreInfoForm) => { * 删除仓库信息 * @param objId */ -export const delStoreInfo = (objId: StoreInfoId | StoreInfoIds) => { +export const delStoreInfo = (objId: StoreInfoId | StoreInfoIds): AxiosPromise => { return request({ url: '/wcs/storeInfo/' + objId, method: 'delete' diff --git a/src/api/wcs/taskDetail/index.ts b/src/api/wcs/taskDetail/index.ts index c652717..0e3bbbb 100644 --- a/src/api/wcs/taskDetail/index.ts +++ b/src/api/wcs/taskDetail/index.ts @@ -1,6 +1,7 @@ import request from '@/utils/request'; import { AxiosPromise } from 'axios'; import { TaskDetailVO, TaskDetailForm, TaskDetailId, TaskDetailIds, TaskDetailQuery } from '@/api/wcs/taskDetail/types'; +import type { WcsDropdownQuery } from '@/api/wcs/types'; /** * 查询实时任务明细列表 @@ -43,7 +44,7 @@ export const getTaskDetailByIds = (ids: TaskDetailIds): AxiosPromise { +export const getTaskDetailList = (query?: WcsDropdownQuery): AxiosPromise => { return request({ url: '/wcs/taskDetail/getTaskDetailList', method: 'get', @@ -79,7 +80,7 @@ export const existsTaskDetail = (query?: TaskDetailQuery): AxiosPromise * 新增实时任务明细 * @param data */ -export const addTaskDetail = (data: TaskDetailForm) => { +export const addTaskDetail = (data: TaskDetailForm): AxiosPromise => { return request({ url: '/wcs/taskDetail', method: 'post', @@ -91,7 +92,7 @@ export const addTaskDetail = (data: TaskDetailForm) => { * 修改实时任务明细 * @param data */ -export const updateTaskDetail = (data: TaskDetailForm) => { +export const updateTaskDetail = (data: TaskDetailForm): AxiosPromise => { return request({ url: '/wcs/taskDetail', method: 'put', @@ -103,7 +104,7 @@ export const updateTaskDetail = (data: TaskDetailForm) => { * 删除实时任务明细 * @param objId */ -export const delTaskDetail = (objId: TaskDetailId | TaskDetailIds) => { +export const delTaskDetail = (objId: TaskDetailId | TaskDetailIds): AxiosPromise => { return request({ url: '/wcs/taskDetail/' + objId, method: 'delete' diff --git a/src/api/wcs/taskQueue/index.ts b/src/api/wcs/taskQueue/index.ts index 67cab13..fa29c27 100644 --- a/src/api/wcs/taskQueue/index.ts +++ b/src/api/wcs/taskQueue/index.ts @@ -80,7 +80,7 @@ export const existsTaskQueue = (query?: TaskQueueQuery): AxiosPromise = * 新增实时任务队列 * @param data */ -export const addTaskQueue = (data: TaskQueueForm) => { +export const addTaskQueue = (data: TaskQueueForm): AxiosPromise => { return request({ url: '/wcs/taskQueue', method: 'post', @@ -92,7 +92,7 @@ export const addTaskQueue = (data: TaskQueueForm) => { * 修改实时任务队列 * @param data */ -export const updateTaskQueue = (data: TaskQueueForm) => { +export const updateTaskQueue = (data: TaskQueueForm): AxiosPromise => { return request({ url: '/wcs/taskQueue', method: 'put', @@ -104,7 +104,7 @@ export const updateTaskQueue = (data: TaskQueueForm) => { * 删除实时任务队列 * @param objId */ -export const delTaskQueue = (objId: TaskQueueId | TaskQueueIds) => { +export const delTaskQueue = (objId: TaskQueueId | TaskQueueIds): AxiosPromise => { return request({ url: '/wcs/taskQueue/' + objId, method: 'delete' diff --git a/src/views/wcs/deviceHost/index.vue b/src/views/wcs/deviceHost/index.vue index 8b0318a..0f03c3f 100644 --- a/src/views/wcs/deviceHost/index.vue +++ b/src/views/wcs/deviceHost/index.vue @@ -182,6 +182,13 @@ const data = reactive>({ hostCode: [ { required: true, message: "主机编号不能为空", trigger: "blur" } ], + hostIp: [ + { + pattern: /^(25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)){3}$/, + message: "主机IP格式不正确", + trigger: "blur" + } + ], } }); @@ -189,10 +196,13 @@ const { queryParams, form, rules } = toRefs(data); const getList = async () => { loading.value = true; - const res = await listDeviceHost(queryParams.value); - deviceHostList.value = res.rows; - total.value = res.total; - loading.value = false; + try { + const res = await listDeviceHost(queryParams.value); + deviceHostList.value = res.rows; + total.value = res.total; + } finally { + loading.value = false; + } } const cancel = () => { @@ -236,14 +246,26 @@ const handleUpdate = async (row?: DeviceHostVO) => { dialog.title = "修改设备主机"; } +const buildSubmitData = (): DeviceHostForm => ({ + objId: form.value.objId, + hostCode: form.value.hostCode, + hostName: form.value.hostName, + hostIp: form.value.hostIp, + hostPort: form.value.hostPort, + hostPath: form.value.hostPath, + isFlag: form.value.isFlag, + remark: form.value.remark +}); + const submitForm = () => { deviceHostFormRef.value?.validate(async (valid: boolean) => { if (valid) { buttonLoading.value = true; - if (form.value.objId) { - await updateDeviceHost(form.value).finally(() => buttonLoading.value = false); + const submitData = buildSubmitData(); + if (submitData.objId) { + await updateDeviceHost(submitData).finally(() => buttonLoading.value = false); } else { - await addDeviceHost(form.value).finally(() => buttonLoading.value = false); + await addDeviceHost(submitData).finally(() => buttonLoading.value = false); } proxy?.$modal.msgSuccess("操作成功"); dialog.visible = false; @@ -261,7 +283,7 @@ const handleDelete = async (row?: DeviceHostVO) => { await getList(); } catch (e) { if (e !== 'cancel' && e !== 'close') { - console.error('删除设备主机失败', e); + proxy?.$modal.msgError("删除设备主机失败"); } } } diff --git a/src/views/wcs/deviceInfo/index.vue b/src/views/wcs/deviceInfo/index.vue index a80ebad..3007c71 100644 --- a/src/views/wcs/deviceInfo/index.vue +++ b/src/views/wcs/deviceInfo/index.vue @@ -211,10 +211,13 @@ const { queryParams, form, rules } = toRefs(data); const getList = async () => { loading.value = true; - const res = await listDeviceInfo(queryParams.value); - deviceInfoList.value = res.rows; - total.value = res.total; - loading.value = false; + try { + const res = await listDeviceInfo(queryParams.value); + deviceInfoList.value = res.rows; + total.value = res.total; + } finally { + loading.value = false; + } } const getHostList = async () => { @@ -222,8 +225,8 @@ const getHostList = async () => { // 下拉接口只需要筛选条件,不携带分页必填字段,避免为满足类型而使用 any。 const res = await getDeviceHostList({ params: {} }); hostList.value = res.data || []; - } catch (e) { - console.error('获取设备主机下拉列表失败', e); + } catch { + proxy?.$modal.msgError("获取设备主机下拉列表失败"); } } @@ -270,14 +273,26 @@ const handleUpdate = async (row?: DeviceInfoVO) => { dialog.title = "修改设备信息"; } +const buildSubmitData = (): DeviceInfoForm => ({ + objId: form.value.objId, + deviceCode: form.value.deviceCode, + deviceName: form.value.deviceName, + hostCode: form.value.hostCode, + deviceType: form.value.deviceType, + deviceStatus: form.value.deviceStatus, + isFlag: form.value.isFlag, + remark: form.value.remark +}); + const submitForm = () => { deviceInfoFormRef.value?.validate(async (valid: boolean) => { if (valid) { buttonLoading.value = true; - if (form.value.objId) { - await updateDeviceInfo(form.value).finally(() => buttonLoading.value = false); + const submitData = buildSubmitData(); + if (submitData.objId) { + await updateDeviceInfo(submitData).finally(() => buttonLoading.value = false); } else { - await addDeviceInfo(form.value).finally(() => buttonLoading.value = false); + await addDeviceInfo(submitData).finally(() => buttonLoading.value = false); } proxy?.$modal.msgSuccess("操作成功"); dialog.visible = false; @@ -295,7 +310,7 @@ const handleDelete = async (row?: DeviceInfoVO) => { await getList(); } catch (e) { if (e !== 'cancel' && e !== 'close') { - console.error('删除设备信息失败', e); + proxy?.$modal.msgError("删除设备信息失败"); } } } diff --git a/src/views/wcs/deviceParam/index.vue b/src/views/wcs/deviceParam/index.vue index 8dc3152..a13fdf0 100644 --- a/src/views/wcs/deviceParam/index.vue +++ b/src/views/wcs/deviceParam/index.vue @@ -219,10 +219,13 @@ const { queryParams, form, rules } = toRefs(data); const getList = async () => { loading.value = true; - const res = await listDeviceParam(queryParams.value); - deviceParamList.value = res.rows; - total.value = res.total; - loading.value = false; + try { + const res = await listDeviceParam(queryParams.value); + deviceParamList.value = res.rows; + total.value = res.total; + } finally { + loading.value = false; + } } const getDeviceList = async () => { @@ -230,8 +233,8 @@ const getDeviceList = async () => { // 下拉接口只需要筛选条件,不携带分页必填字段,避免为满足类型而使用 any。 const res = await getDeviceInfoList({ params: {} }); deviceList.value = res.data || []; - } catch (e) { - console.error('获取设备信息下拉列表失败', e); + } catch { + proxy?.$modal.msgError("获取设备信息下拉列表失败"); } } @@ -303,7 +306,7 @@ const handleDelete = async (row?: DeviceParamVO) => { await getList(); } catch (e) { if (e !== 'cancel' && e !== 'close') { - console.error('删除设备参数失败', e); + proxy?.$modal.msgError("删除设备参数失败"); } } } diff --git a/src/views/wcs/locationInfo/index.vue b/src/views/wcs/locationInfo/index.vue index f4955ee..5f88d0c 100644 --- a/src/views/wcs/locationInfo/index.vue +++ b/src/views/wcs/locationInfo/index.vue @@ -301,11 +301,14 @@ const { queryParams, form, rules } = toRefs(data); const getList = async () => { loading.value = true; - // 走 addDateRange 把日期范围塞到 params.beginTime/endTime,对齐后端 SysUser 的范围筛选契约。 - const res = await listLocationInfo(proxy?.addDateRange(queryParams.value, dateRange.value)); - locationInfoList.value = res.rows; - total.value = res.total; - loading.value = false; + try { + // 走 addDateRange 把日期范围塞到 params.beginTime/endTime,对齐后端 SysUser 的范围筛选契约。 + const res = await listLocationInfo(proxy?.addDateRange(queryParams.value, dateRange.value)); + locationInfoList.value = res.rows; + total.value = res.total; + } finally { + loading.value = false; + } } const getRefLists = async () => { @@ -318,8 +321,8 @@ const getRefLists = async () => { ]); storeList.value = storeRes.data || []; materialList.value = materialRes.data || []; - } catch (e) { - console.error('获取库位关联下拉列表失败', e); + } catch { + proxy?.$modal.msgError("获取库位关联下拉列表失败"); } } @@ -413,7 +416,7 @@ const handleDelete = async (row?: LocationInfoVO) => { await getList(); } catch (e) { if (e !== 'cancel' && e !== 'close') { - console.error('删除库位信息失败', e); + proxy?.$modal.msgError("删除库位信息失败"); } } } diff --git a/src/views/wcs/materialInfo/index.vue b/src/views/wcs/materialInfo/index.vue index 8b5ee8b..ac02177 100644 --- a/src/views/wcs/materialInfo/index.vue +++ b/src/views/wcs/materialInfo/index.vue @@ -185,10 +185,13 @@ const { queryParams, form, rules } = toRefs(data); const getList = async () => { loading.value = true; - const res = await listMaterialInfo(queryParams.value); - materialInfoList.value = res.rows; - total.value = res.total; - loading.value = false; + try { + const res = await listMaterialInfo(queryParams.value); + materialInfoList.value = res.rows; + total.value = res.total; + } finally { + loading.value = false; + } } const cancel = () => { @@ -257,7 +260,7 @@ const handleDelete = async (row?: MaterialInfoVO) => { await getList(); } catch (e) { if (e !== 'cancel' && e !== 'close') { - console.error('删除物料信息失败', e); + proxy?.$modal.msgError("删除物料信息失败"); } } } diff --git a/src/views/wcs/pathDetails/index.vue b/src/views/wcs/pathDetails/index.vue index ac86dbf..bb8e1f0 100644 --- a/src/views/wcs/pathDetails/index.vue +++ b/src/views/wcs/pathDetails/index.vue @@ -188,8 +188,8 @@ const loadPathList = async () => { // 下拉接口只按启用状态取可选路径,避免为补分页字段而使用 any。 const res = await getPathInfoList({ isFlag: 1, params: {} }); pathList.value = res.data || []; - } catch (e) { - console.error('获取路径信息下拉列表失败', e); + } catch { + proxy?.$modal.msgError('获取路径信息下拉列表失败'); } }; @@ -265,7 +265,7 @@ const handleDelete = async (row?: PathDetailsVO) => { await getList(); } catch (e) { if (e !== 'cancel' && e !== 'close') { - console.error('删除路径明细失败', e); + proxy?.$modal.msgError('删除路径明细失败'); } } }; diff --git a/src/views/wcs/pathInfo/index.vue b/src/views/wcs/pathInfo/index.vue index b5cffe6..0e8c809 100644 --- a/src/views/wcs/pathInfo/index.vue +++ b/src/views/wcs/pathInfo/index.vue @@ -221,11 +221,14 @@ const { queryParams, form, rules } = toRefs(data); const getList = async () => { loading.value = true; - // 走 addDateRange 把日期范围塞到 params.beginTime/endTime,对齐后端 SysUser 的范围筛选契约。 - const res = await listPathInfo(proxy?.addDateRange(queryParams.value, dateRange.value)); - pathInfoList.value = res.rows; - total.value = res.total; - loading.value = false; + try { + // 走 addDateRange 把日期范围塞到 params.beginTime/endTime,对齐后端 SysUser 的范围筛选契约。 + const res = await listPathInfo(proxy?.addDateRange(queryParams.value, dateRange.value)); + pathInfoList.value = res.rows; + total.value = res.total; + } finally { + loading.value = false; + } } const cancel = () => { @@ -334,7 +337,7 @@ const handleDelete = async (row?: PathInfoVO) => { await getList(); } catch (e) { if (e !== 'cancel' && e !== 'close') { - console.error('删除路径信息失败', e); + proxy?.$modal.msgError("删除路径信息失败"); } } } diff --git a/src/views/wcs/storeInfo/index.vue b/src/views/wcs/storeInfo/index.vue index c00778f..fc2481a 100644 --- a/src/views/wcs/storeInfo/index.vue +++ b/src/views/wcs/storeInfo/index.vue @@ -155,10 +155,13 @@ const { queryParams, form, rules } = toRefs(data); const getList = async () => { loading.value = true; - const res = await listStoreInfo(queryParams.value); - storeInfoList.value = res.rows; - total.value = res.total; - loading.value = false; + try { + const res = await listStoreInfo(queryParams.value); + storeInfoList.value = res.rows; + total.value = res.total; + } finally { + loading.value = false; + } } const cancel = () => { @@ -227,7 +230,7 @@ const handleDelete = async (row?: StoreInfoVO) => { await getList(); } catch (e) { if (e !== 'cancel' && e !== 'close') { - console.error('删除仓库信息失败', e); + proxy?.$modal.msgError("删除仓库信息失败"); } } } diff --git a/src/views/wcs/taskDetail/index.vue b/src/views/wcs/taskDetail/index.vue index 62b5d2e..70c9969 100644 --- a/src/views/wcs/taskDetail/index.vue +++ b/src/views/wcs/taskDetail/index.vue @@ -435,7 +435,7 @@ const handleDelete = async (row?: TaskDetailVO) => { await getList(); } catch (e) { if (e !== 'cancel' && e !== 'close') { - console.error('删除实时任务明细失败', e); + proxy?.$modal.msgError("删除实时任务明细失败"); } } } diff --git a/src/views/wcs/taskQueue/index.vue b/src/views/wcs/taskQueue/index.vue index 0e535ad..91339f5 100644 --- a/src/views/wcs/taskQueue/index.vue +++ b/src/views/wcs/taskQueue/index.vue @@ -599,7 +599,7 @@ const handleDelete = async (row?: TaskQueueVO) => { await getList(); } catch (e) { if (e !== 'cancel' && e !== 'close') { - console.error('删除实时任务队列失败', e); + proxy?.$modal.msgError("删除实时任务队列失败"); } } } diff --git a/src/views/wcs/utils/createdTimeRange.ts b/src/views/wcs/utils/createTimeRange.ts similarity index 100% rename from src/views/wcs/utils/createdTimeRange.ts rename to src/views/wcs/utils/createTimeRange.ts