添加了为超级管理员动态加载租户选项的功能

This commit is contained in:
高子兴 2024-07-06 01:53:47 +08:00
parent 0d27ec1139
commit 2fb294878f

View File

@ -87,6 +87,8 @@ const props = defineProps({
const containerStyle = ref('form-container') const containerStyle = ref('form-container')
const emit = defineEmits(['setNewsDialogInvisible']); const emit = defineEmits(['setNewsDialogInvisible']);
const options = ref([])
const setNewsDialogInvisible = (changed) => { const setNewsDialogInvisible = (changed) => {
emit('setNewsDialogInvisible', changed); emit('setNewsDialogInvisible', changed);
}; };
@ -204,6 +206,18 @@ const fetchNewsDetail = async () => {
fileList.value.push({url: res.data.imagePath}); fileList.value.push({url: res.data.imagePath});
} }
const fetchOptions = async () => {
const params = {
token: token.value,
}
try{
const res = await axios.get('/api/tenant/getTenantOptions',{params});
options.value = res.data.options;
} catch (e) {
await ElMessageBox.alert(e.response.data.message);
}
}
onMounted(() => { onMounted(() => {
token.value = store.getters['authentication/token']; token.value = store.getters['authentication/token'];
form.value.token = token.value; form.value.token = token.value;
@ -231,6 +245,8 @@ onMounted(() => {
fetchNewsDetail(); fetchNewsDetail();
} }
fetchOptions()
config.value = { config.value = {
toolbar: { toolbar: {
items: [ items: [
@ -489,9 +505,12 @@ onMounted(() => {
</ElFormItem> </ElFormItem>
<ElFormItem label="选择租户" required> <ElFormItem label="选择租户" required>
<ElSelect v-model="form.tenant" placeholder="请选择" class="dynamic-width-select"> <ElSelect v-model="form.tenant" placeholder="请选择" class="dynamic-width-select">
<ElOption label="Option 1" value="option1"></ElOption> <ElOption
<ElOption label="Option 2" value="option2"></ElOption> v-for="option in options"
<ElOption label="Option 3" value="option3"></ElOption> :key="option"
:label="option"
:value="option"
></ElOption>
</ElSelect> </ElSelect>
</ElFormItem> </ElFormItem>
<ElFormItem> <ElFormItem>