vue2
<el-form-item label="设备状态" prop="statustypeid">
<el-select
v-model="queryParams.statustypeid"
placeholder="请选择设备状态"
clearable
>
<el-option
v-for="dict in Options.statustypeidOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="Number(dict.dictValue)"
/>
</el-select>
</el-form-item>
mare_scoke 字典表名称
created() {
this.getList();
// 满意度字典表转换
this.getDicts("mare_scoke").then(response => {
this.statForamt = response.data;
});
this.getDicts("deviceStatus").then(response => {
this.Options.statustypeidOptions = response.data;
});
},
methods:{
// 满意度字典表转换
satisFormat(row) {
return this.selectDictLabel(this.statForamt, row.satisfied);
},
vue3
import { getDicts } from "@/api/system/dict/data";
const { safe_level } = proxy.useDict("safe_level");
let weaknessVal = {};
let weaknessLab = {};
["safe_level"].map((item) => {
getDicts(item)
.then((res) => {
res.data.map((itm) => {
console.log("itm", itm);
weaknessVal[item + itm.dictValue] = itm.dictLabel;
weaknessLab[itm.dictLabel] = itm.dictValue;
});
})
.then(() => {
getList();
});
});
/** 查询列表 */
function getList() {
loading.value = true;
tableList.value = [{}];
getDataAssetList(queryParams.value, currId.value).then((response) => {
tableList.value = response.rows;
tableList.value.map((item) => {
item.confidentialType = weaknessVal["safe_level" + item.confidentialType];
});
total.value = response.total;
loading.value = false;
if (route.query.fileIden) {
handleUpdate(tableList.value[0]);
}
});
}
function submitForm() {
proxy.$refs["formRef"].validate((valid) => {
if (valid) {
form.value.confidentialType = weaknessLab[form.value.confidentialType];
if (form.value.id != undefined) {
// if (form.value.confidentialType == "敏感信息") {
// form.value.confidentialType = 1;
// } else if (form.value.confidentialType == "核心商密") {
// form.value.confidentialType = 2;
// } else if (form.value.confidentialType == "普通商密") {
// form.value.confidentialType = 3;
// } else if (form.value.confidentialType == "内部") {
// form.value.confidentialType = 4;
// } else if (form.value.confidentialType == "公开") {
// form.value.confidentialType = 5;
// }
updateDataAsset(form.value).then((response) => {
if (response.code == 200) {
proxy.$modal.msgSuccess("修改成功");
open.value = false;
getList();
}
});
} else {