!78 FIX:#ICBNYK 点击代码配置,会发送多次获取字典请求

Merge pull request !78 from 一点点/master
This commit is contained in:
1024创新实验室
2025-06-19 12:07:46 +00:00
committed by Gitee
4 changed files with 45 additions and 9 deletions

View File

@@ -54,17 +54,27 @@
type: Number,
default: null,
},
dictList: {
type: Array,
default: null,
},
});
// -------------------------- 查询 字典数据 --------------------------
const dictList = ref([]);
const dictList = ref(props.dictList || []);
async function queryDict() {
if (props.dictList) {
dictList.value = props.dictList;
return;
}
let response = await dictApi.getAllDict();
dictList.value = response.data;
}
onMounted(queryDict);
if (!props.dictList) {
queryDict();
}
// -------------------------- 选中 相关、事件 --------------------------
const emit = defineEmits(['update:value', 'change']);

View File

@@ -68,7 +68,7 @@
</template>
<template v-if="column.dataIndex === 'dict'">
<DictCodeSelect ref="dictRef" v-model:value="record.dict" />
<DictCodeSelect ref="dictRef" v-model:value="record.dict" :dict-list="dictList" />
</template>
<template v-if="column.dataIndex === 'enumName'">
@@ -84,8 +84,16 @@
import DictCodeSelect from '/@/components/support/dict-code-select/index.vue';
import { convertUpperCamel, convertLowerCamel } from '/@/utils/str-util';
import _ from 'lodash';
import { dictApi } from '/@/api/support/dict-api';
const dictRef = ref();
const dictList = ref([]);
async function loadDictList() {
const response = await dictApi.getAllDict();
dictList.value = response.data;
}
loadDictList();
function refreshDict() {
dictRef.value.queryDict();
}
@@ -231,4 +239,4 @@
});
</script>
<style lang="less" scoped></style>
<style lang="less" scoped></style>