update:字典前端增删改查

This commit is contained in:
hrz
2025-05-01 16:57:58 +08:00
parent e1f54b30dc
commit 76f47bce37
28 changed files with 1653 additions and 222 deletions
@@ -100,7 +100,6 @@
import Api from '@/apis/api';
import AddDeviceDialog from "@/components/AddDeviceDialog.vue";
import HeaderBar from "@/components/HeaderBar.vue";
import { FIRMWARE_TYPES } from "@/utils";
export default {
components: { HeaderBar, AddDeviceDialog },
@@ -118,6 +117,7 @@ export default {
deviceList: [],
loading: false,
userApi: null,
firmwareTypes: [],
};
},
computed: {
@@ -163,7 +163,19 @@ export default {
this.fetchBindDevices(agentId);
}
},
created() {
this.getFirmwareTypes()
},
methods: {
async getFirmwareTypes() {
try {
const res = await Api.dict.getDictDataByType('FIRMWARE_TYPE')
this.firmwareTypes = res.data
} catch (error) {
console.error('获取固件类型失败:', error)
this.$message.error(error.message || '获取固件类型失败')
}
},
handlePageSizeChange(val) {
this.pageSize = val;
this.currentPage = 1;
@@ -317,8 +329,8 @@ export default {
return "";
},
getFirmwareTypeName(type) {
const firmwareType = FIRMWARE_TYPES.find(item => item.key === type);
return firmwareType ? firmwareType.name : type;
const firmwareType = this.firmwareTypes.find(item => item.key === type)
return firmwareType ? firmwareType.name : type
},
handleOtaSwitchChange(row) {
Api.device.enableOtaUpgrade(row.device_id, row.otaSwitch ? 1 : 0, ({ data }) => {