mirror of
https://gitee.com/lab1024/smart-admin.git
synced 2025-11-09 20:23:50 +08:00
!78 FIX:#ICBNYK 点击代码配置,会发送多次获取字典请求
Merge pull request !78 from 一点点/master
This commit is contained in:
@@ -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']);
|
||||
|
||||
@@ -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>
|
||||
Reference in New Issue
Block a user