1
0
forked from dyf/dyf-vue-ui

设备列表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 = () => { const closeDialog = () => {
dialog.visible = false; dialog.visible = false;
resetForm(); resetForm();
loadingIng.value = false;
}; };
/** /**

View File

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

View File

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