refactor(EditCom, device, station): 优化逻辑处理和错误提示

- 在 `EditCom.vue` 中,修改了 `workModeIdSelect` 监听器的条件判断,确保只有在旧值存在且新旧值不同时才清空 `policy_id`。
- 判断调用 `getRoleIdList` 方法。
- 在多个异步方法(如 `userConfirm`, `roleConfirm`, `stationConfirm`, `deviceConfirm`)中统一了成功与失败的消息提示,并移除了原有的错误日志打印。
- 场站管理对状态和策略id进行修改。
- 对 `station.vue` 进行了格式调整,改进了 `forEach` 循环内的逻辑处理。
```
This commit is contained in:
zhoumengru
2025-09-18 16:58:35 +08:00
parent 7217ff1b73
commit cec5cdc19a
3 changed files with 46 additions and 30 deletions

View File

@@ -18,7 +18,9 @@
<span>{{}}</span>
</template>
<template #work_mode="record">
<span>{{ workModeList.find((item) => record.work_mode == item.value)?.label || '' }}</span>
<span>{{
workModeList.find((item) => record.work_mode == item.value)?.label || ''
}}</span>
</template>
<template #policy_id="record">
<span>{{ policyList.find((item) => record.policy_id == item.value)?.label || '' }}</span>
@@ -28,7 +30,13 @@
</template>
</ComTable>
</div>
<a-modal v-model:open="formModal" width="750px" style="top: 80px" :footer="null" :destroy-on-close="true">
<a-modal
v-model:open="formModal"
width="750px"
style="top: 80px"
:footer="null"
:destroy-on-close="true"
>
<!-- action:edit add -->
<EditCom
ref="EditCom"
@@ -62,7 +70,7 @@ export default {
props: {},
data() {
return {
tableData:[],
tableData: [],
tableOption: {
select: false
},
@@ -238,20 +246,18 @@ export default {
stationOptions.forEach((e, index) => {
e.list.forEach((i) => {
if (i.key == 'work_mode') {
switch (row[i.key]) {
case '1':
case '5':
e.ruleForm[i.key] =row[i.key]
e.ruleForm['policy_id'] = row ? row['policy_id'] : ''
if (row[i.key] == 1 || row[i.key] == 5) {
stationOptions[0].list[stationOptions[0].list.length - 1].type = 'select'
break
default:
e.ruleForm[i.key] =row[i.key]
e.ruleForm[i.key] = row[i.key]
e.ruleForm['policy_id'] = row ? row['policy_id'] : ''
} else {
e.ruleForm[i.key] = row[i.key]
stationOptions[0].list[stationOptions[0].list.length - 1].type = 'unshow'
break
}
} else if (i.key == 'status') {
e.ruleForm.status = row ? Boolean(Number(row.status)) : ''
} else {
e.ruleForm[i.key] = row ? row[i.key] : ''
}
@@ -271,7 +277,7 @@ export default {
.station {
height: 100%;
padding: 0 20px;
padding: 0 20px;
.content-table {
height: calc(100% - 92px);
}