修复设备列表bug
This commit is contained in:
@ -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
|
||||
})
|
||||
}
|
||||
// 撤回
|
||||
|
@ -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<any> => {
|
||||
const httpRequestImg = (parm): Promise<any> => {
|
||||
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(`分配成功`)
|
||||
|
Reference in New Issue
Block a user