From a195b3e325560e43b1e16d154c71c89c42a765fa Mon Sep 17 00:00:00 2001 From: fengerli <528575642@qq.com> Date: Thu, 17 Jul 2025 16:56:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=AE=BE=E5=A4=87=E5=88=97?= =?UTF-8?q?=E8=A1=A8bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/equipmentManagement/device/index.ts | 7 ++--- .../equipmentManagement/devices/index.vue | 31 ++++++++++--------- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/src/api/equipmentManagement/device/index.ts b/src/api/equipmentManagement/device/index.ts index 0867d05..b960f67 100644 --- a/src/api/equipmentManagement/device/index.ts +++ b/src/api/equipmentManagement/device/index.ts @@ -72,12 +72,11 @@ export const userAllCustomerAll = () => { } // 解绑 - -export const deviceUnbind = (data:any) => { +export const deviceUnbind = (params:any) => { return request({ url: '/api/device/unbind', - method: 'post', - data + method: 'GET', + params }) } // 撤回 diff --git a/src/views/equipmentManagement/devices/index.vue b/src/views/equipmentManagement/devices/index.vue index fd7b37d..340cc03 100644 --- a/src/views/equipmentManagement/devices/index.vue +++ b/src/views/equipmentManagement/devices/index.vue @@ -405,12 +405,15 @@ const handleUnbind = (row) => { cancelButtonText: '取消', type: 'warning' }).then(() => { - api.deviceUnbind(row).then(res => { - if (res.code === 0) { - proxy?.$modal.msgSuccess('解绑成功') + let data = { + id: row.id + } + api.deviceUnbind(data).then(res => { + if (res.code ==200) { + proxy?.$modal.msgSuccess(res.msg) getList(); // 初始化列表数据 } else { - proxy?.$modal.msgError(res.msg || '解绑失败') + proxy?.$modal.msgError(res.msg) } }) }).catch(() => { @@ -425,7 +428,7 @@ const handleWithdraw = (row: any) => { type: 'warning' }).then(() => { api.withdrawDevice([row.id]).then(res => { - if (res.code === 0) { + if (res.code === 200) { proxy?.$modal.msgSuccess('撤回成功') getList(); // 初始化列表数据 } else { @@ -531,7 +534,7 @@ const handleDeviceTypeChange = async (deviceTypeId: string | number) => { return; } const res = await api.getCommunicationMode({ id: deviceTypeId }); - if (res.code === 0 && res.data) { + if (res.code ==200 && res.data) { communicationModeInfo.value = res.data; // 根据通讯方式确定显示哪个字段 if (res.data.communicationMode == '1') { // 蓝牙设备 - 显示MAC @@ -551,7 +554,7 @@ const handleDeviceTypeChange = async (deviceTypeId: string | number) => { }; // 覆盖默认的上传行为,可以自定义上传的实现 -const httpRequestImg = (parm): Promise => { +const httpRequestImg = (parm): Promise => { return Promise.resolve(); }; const beforeUpload = (file) => { @@ -622,7 +625,7 @@ const submitForm = async () => { 'Content-Type': 'multipart/form-data' } }); - if (res.code == 0) { + if (res.code == 200) { proxy?.$modal.msgSuccess('操作成功'); dialog.visible = false; loadingIng.value = false; @@ -663,7 +666,7 @@ const resetForm = () => { // 设备类型 const getDeviceType = () => { api.deviceTypeAll().then(res => { - if (res.code == 0) { + if (res.code == 200) { deviceTypeOptions.value = res.data } }).catch(err => { @@ -673,7 +676,7 @@ const getDeviceType = () => { // 客户下拉框 const getAllCustomerAll = () => { api.userAllCustomerAll().then(res => { - if (res.code == 0) { + if (res.code == 200) { customerList.value = res.data } }) @@ -699,7 +702,7 @@ const handleAssignConfirm = () => { deviceIds: [assignRow.value.id] } api.deviceAssignCustomer(data).then((res) => { - if (res.code == 0) { + if (res.code == 200) { loadingIng.value = false; const customer = customerList.value.find(c => c.id === assignCustomerId.value) const customerName = customer ? customer.nickName : `ID: ${assignCustomerId.value}` @@ -733,7 +736,7 @@ const handleBatchImport = () => { const downloadTemplate = () => { // 这里可用 window.open 或 a 标签下载模板 const link = document.createElement('a'); - link.href = 'http://fuyuanshen.com:81/images/excel/equipmenttemplate.xlsx'; + link.href = 'http://120.79.224.186:9000/fys/Equipmentimporttemplate/EquipmentImportTemplate.xlsx'; link.download = '设备数据导入模板.xlsx'; // 可选:指定下载文件名 link.style.display = 'none'; // 隐藏标签 document.body.appendChild(link); @@ -751,7 +754,7 @@ const beforeImportUpload = (file: any) => { //添加tokenf方法head_upload 直接返回 getBearerToken() const head_upload = () => getBearerToken(); const handleImportSuccess = (response: any) => { - if (response.code === 0) { + if (response.code ==200) { importResult.value.isShow = true if (response.data) { importResult.value.succeed = response.data.successCount || 0 @@ -785,7 +788,7 @@ const handleBatchAssignConfirm = () => { deviceIds: selectedIds // 选中的设备ID数组 } api.deviceAssignCustomer(data).then((res) => { - if (res.code == 0) { + if (res.code == 200) { batchAssignDialogVisible.value = false getList(); return proxy?.$modal.msgSuccess(`分配成功`)