设备列表bug修改

This commit is contained in:
fengerli
2025-07-09 13:39:09 +08:00
parent d9de847fb1
commit 8a2978af6c
3 changed files with 22 additions and 20 deletions

View File

@ -297,6 +297,7 @@ const submitForm = () => {
const closeDialog = () => {
dialog.visible = false;
resetForm();
loadingIng.value = false;
};
/**

View File

@ -125,10 +125,10 @@
placement="top">
<el-button link type="primary" icon="UploadFilled" @click="handleWithdraw(scope.row)"></el-button>
</el-tooltip>
<el-button v-if="scope.row.bindingStatus == 1" :disabled="scope.row.deviceStatus === 0"
@click="handleUnbind(scope.row)">解绑</el-button>
<el-tooltip v-if="scope.row.bindingStatus == 1" :disabled="scope.row.deviceStatus === 0" content="解绑"
placement="top">
<el-button link type="primary" icon="UploadFilled" @click="handleUnbind(scope.row)"></el-button>
</el-tooltip>
</template>
</el-table-column>
</el-table>
@ -490,6 +490,7 @@ const handleUpdate = async (row?: deviceForm) => {
}
};
// 设备类型触发事件
let isProcessing = false; // 添加处理锁
const handleDeviceTypeChange = async (deviceTypeId: string | number) => {
// 重置规则和显示状态
rules.value.deviceMac = [];
@ -509,6 +510,8 @@ const handleDeviceTypeChange = async (deviceTypeId: string | number) => {
}
return;
}
if (isProcessing) return;
isProcessing = true;
// 新增或编辑时没有值,根据设备类型获取通讯方式
try {
userFormRef.value?.clearValidate(['deviceMac', 'deviceImei']);
@ -519,22 +522,19 @@ const handleDeviceTypeChange = async (deviceTypeId: string | number) => {
if (res.code === 0 && res.data) {
communicationModeInfo.value = res.data;
// 根据通讯方式确定显示哪个字段
if (res.data.communicationMode === '1') { // 蓝牙设备 - 显示MAC
if (res.data.communicationMode == '1') { // 蓝牙设备 - 显示MAC
showMacField.value = true;
showImeiField.value = false;
rules.value.deviceMac = [{ required: true, message: '请输入设备MAC', trigger: 'blur' }];
form.value.deviceImei = ''; // 清空IMEI
} else if (res.data.communicationMode === '0') { // 4G设备 - 显示IMEI
} else if (res.data.communicationMode == '0') { // 4G设备 - 显示IMEI
showMacField.value = false;
showImeiField.value = true;
rules.value.deviceImei = [{ required: true, message: '请输入设备IMEI', trigger: 'blur' }];
form.value.deviceMac = ''; // 清空MAC
}
} else {
proxy?.$modal.msgError(res.msg || '获取通讯方式失败');
}
} catch (error) {
proxy?.$modal.msgError('获取通讯方式失败');
} finally {
isProcessing = false;
}
};
@ -605,7 +605,6 @@ const submitForm = async () => {
}
});
if (res.code == 0) {
proxy?.$modal.msgSuccess('操作成功');
dialog.visible = false;
loadingIng.value = false;
@ -664,10 +663,12 @@ const getAllCustomerAll = () => {
// 分配客户
const assignRow = ref()
const handleAssign = (row: any) => {
console.log(row, 'eeeeee');
getAllCustomerAll()
assignDialogVisible.value = true
assignRow.value = row
assignCustomerId.value = row.customerId
assignCustomerId.value == !row.customerName ? row.customerId : ''
}
const handleAssignConfirm = () => {
if (!assignCustomerId.value) {
@ -690,8 +691,8 @@ const handleAssignConfirm = () => {
} else {
loadingIng.value = false;
}
}).catch(()=>{
loadingIng.value = false;
}).catch(() => {
loadingIng.value = false;
})
};
const importUpload = ref()
@ -759,7 +760,7 @@ const handleBatchAssignConfirm = () => {
return proxy?.$modal.msgError('请选择客户')
}
// 提取选中设备的 ID 数组
const selectedIds = ids.value.map((item:any) => item.id)
const selectedIds = ids.value.map((item: any) => item.id)
// 构造请求数据
const data = {
customerId: batchAssignCustomerId.value, // 目标客户ID
@ -771,8 +772,8 @@ const handleBatchAssignConfirm = () => {
getList();
return proxy?.$modal.msgSuccess(`分配成功`)
}
}).catch(()=>{
}).catch(() => {
})
};

View File

@ -35,8 +35,8 @@
</el-form-item>
<el-form-item style="width: 100%">
<el-button :loading="loading" size="large" type="primary" style="width: 100%" @click.prevent="handleLogin">
<span v-if="!loading">{{ proxy.$t('login.login') }}</span>
<span v-else>{{ proxy.$t('login.logging') }}</span>
<span v-if="!loading">登录</span>
<span v-else>登录</span>
</el-button>
<div v-if="register" style="float: right">
<router-link class="link-type" :to="'/register'">{{ proxy.$t('login.switchRegisterPage') }}</router-link>