修复设备列表bug
This commit is contained in:
@ -72,12 +72,11 @@ export const userAllCustomerAll = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 解绑
|
// 解绑
|
||||||
|
export const deviceUnbind = (params:any) => {
|
||||||
export const deviceUnbind = (data:any) => {
|
|
||||||
return request({
|
return request({
|
||||||
url: '/api/device/unbind',
|
url: '/api/device/unbind',
|
||||||
method: 'post',
|
method: 'GET',
|
||||||
data
|
params
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 撤回
|
// 撤回
|
||||||
|
@ -405,12 +405,15 @@ const handleUnbind = (row) => {
|
|||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
api.deviceUnbind(row).then(res => {
|
let data = {
|
||||||
if (res.code === 0) {
|
id: row.id
|
||||||
proxy?.$modal.msgSuccess('解绑成功')
|
}
|
||||||
|
api.deviceUnbind(data).then(res => {
|
||||||
|
if (res.code ==200) {
|
||||||
|
proxy?.$modal.msgSuccess(res.msg)
|
||||||
getList(); // 初始化列表数据
|
getList(); // 初始化列表数据
|
||||||
} else {
|
} else {
|
||||||
proxy?.$modal.msgError(res.msg || '解绑失败')
|
proxy?.$modal.msgError(res.msg)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
@ -425,7 +428,7 @@ const handleWithdraw = (row: any) => {
|
|||||||
type: 'warning'
|
type: 'warning'
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
api.withdrawDevice([row.id]).then(res => {
|
api.withdrawDevice([row.id]).then(res => {
|
||||||
if (res.code === 0) {
|
if (res.code === 200) {
|
||||||
proxy?.$modal.msgSuccess('撤回成功')
|
proxy?.$modal.msgSuccess('撤回成功')
|
||||||
getList(); // 初始化列表数据
|
getList(); // 初始化列表数据
|
||||||
} else {
|
} else {
|
||||||
@ -531,7 +534,7 @@ const handleDeviceTypeChange = async (deviceTypeId: string | number) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const res = await api.getCommunicationMode({ id: deviceTypeId });
|
const res = await api.getCommunicationMode({ id: deviceTypeId });
|
||||||
if (res.code === 0 && res.data) {
|
if (res.code ==200 && res.data) {
|
||||||
communicationModeInfo.value = res.data;
|
communicationModeInfo.value = res.data;
|
||||||
// 根据通讯方式确定显示哪个字段
|
// 根据通讯方式确定显示哪个字段
|
||||||
if (res.data.communicationMode == '1') { // 蓝牙设备 - 显示MAC
|
if (res.data.communicationMode == '1') { // 蓝牙设备 - 显示MAC
|
||||||
@ -622,7 +625,7 @@ const submitForm = async () => {
|
|||||||
'Content-Type': 'multipart/form-data'
|
'Content-Type': 'multipart/form-data'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (res.code == 0) {
|
if (res.code == 200) {
|
||||||
proxy?.$modal.msgSuccess('操作成功');
|
proxy?.$modal.msgSuccess('操作成功');
|
||||||
dialog.visible = false;
|
dialog.visible = false;
|
||||||
loadingIng.value = false;
|
loadingIng.value = false;
|
||||||
@ -663,7 +666,7 @@ const resetForm = () => {
|
|||||||
// 设备类型
|
// 设备类型
|
||||||
const getDeviceType = () => {
|
const getDeviceType = () => {
|
||||||
api.deviceTypeAll().then(res => {
|
api.deviceTypeAll().then(res => {
|
||||||
if (res.code == 0) {
|
if (res.code == 200) {
|
||||||
deviceTypeOptions.value = res.data
|
deviceTypeOptions.value = res.data
|
||||||
}
|
}
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
@ -673,7 +676,7 @@ const getDeviceType = () => {
|
|||||||
// 客户下拉框
|
// 客户下拉框
|
||||||
const getAllCustomerAll = () => {
|
const getAllCustomerAll = () => {
|
||||||
api.userAllCustomerAll().then(res => {
|
api.userAllCustomerAll().then(res => {
|
||||||
if (res.code == 0) {
|
if (res.code == 200) {
|
||||||
customerList.value = res.data
|
customerList.value = res.data
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -699,7 +702,7 @@ const handleAssignConfirm = () => {
|
|||||||
deviceIds: [assignRow.value.id]
|
deviceIds: [assignRow.value.id]
|
||||||
}
|
}
|
||||||
api.deviceAssignCustomer(data).then((res) => {
|
api.deviceAssignCustomer(data).then((res) => {
|
||||||
if (res.code == 0) {
|
if (res.code == 200) {
|
||||||
loadingIng.value = false;
|
loadingIng.value = false;
|
||||||
const customer = customerList.value.find(c => c.id === assignCustomerId.value)
|
const customer = customerList.value.find(c => c.id === assignCustomerId.value)
|
||||||
const customerName = customer ? customer.nickName : `ID: ${assignCustomerId.value}`
|
const customerName = customer ? customer.nickName : `ID: ${assignCustomerId.value}`
|
||||||
@ -733,7 +736,7 @@ const handleBatchImport = () => {
|
|||||||
const downloadTemplate = () => {
|
const downloadTemplate = () => {
|
||||||
// 这里可用 window.open 或 a 标签下载模板
|
// 这里可用 window.open 或 a 标签下载模板
|
||||||
const link = document.createElement('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.download = '设备数据导入模板.xlsx'; // 可选:指定下载文件名
|
||||||
link.style.display = 'none'; // 隐藏标签
|
link.style.display = 'none'; // 隐藏标签
|
||||||
document.body.appendChild(link);
|
document.body.appendChild(link);
|
||||||
@ -751,7 +754,7 @@ const beforeImportUpload = (file: any) => {
|
|||||||
//添加tokenf方法head_upload 直接返回 getBearerToken()
|
//添加tokenf方法head_upload 直接返回 getBearerToken()
|
||||||
const head_upload = () => getBearerToken();
|
const head_upload = () => getBearerToken();
|
||||||
const handleImportSuccess = (response: any) => {
|
const handleImportSuccess = (response: any) => {
|
||||||
if (response.code === 0) {
|
if (response.code ==200) {
|
||||||
importResult.value.isShow = true
|
importResult.value.isShow = true
|
||||||
if (response.data) {
|
if (response.data) {
|
||||||
importResult.value.succeed = response.data.successCount || 0
|
importResult.value.succeed = response.data.successCount || 0
|
||||||
@ -785,7 +788,7 @@ const handleBatchAssignConfirm = () => {
|
|||||||
deviceIds: selectedIds // 选中的设备ID数组
|
deviceIds: selectedIds // 选中的设备ID数组
|
||||||
}
|
}
|
||||||
api.deviceAssignCustomer(data).then((res) => {
|
api.deviceAssignCustomer(data).then((res) => {
|
||||||
if (res.code == 0) {
|
if (res.code == 200) {
|
||||||
batchAssignDialogVisible.value = false
|
batchAssignDialogVisible.value = false
|
||||||
getList();
|
getList();
|
||||||
return proxy?.$modal.msgSuccess(`分配成功`)
|
return proxy?.$modal.msgSuccess(`分配成功`)
|
||||||
|
Reference in New Issue
Block a user