This commit is contained in:
parent
d8d884ecc1
commit
f4a1cc72d9
@ -1,21 +1,12 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { Recordable } from '@vben/types';
|
import type { Recordable } from '@vben/types';
|
||||||
|
|
||||||
import { computed, ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
|
|
||||||
import { useAccess } from '@vben/access';
|
|
||||||
import { useVbenModal, type VbenFormProps } from '@vben/common-ui';
|
import { useVbenModal, type VbenFormProps } from '@vben/common-ui';
|
||||||
import { getVxePopupContainer } from '@vben/utils';
|
import { getVxePopupContainer } from '@vben/utils';
|
||||||
|
|
||||||
import {
|
import { Modal, Popconfirm, Space } from 'ant-design-vue';
|
||||||
Dropdown,
|
|
||||||
Menu,
|
|
||||||
MenuItem,
|
|
||||||
type MenuProps,
|
|
||||||
Modal,
|
|
||||||
Popconfirm,
|
|
||||||
Space,
|
|
||||||
} from 'ant-design-vue';
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
tableCheckboxEvent,
|
tableCheckboxEvent,
|
||||||
@ -28,8 +19,6 @@ import {
|
|||||||
dictTypeRemove,
|
dictTypeRemove,
|
||||||
refreshDictTypeCache,
|
refreshDictTypeCache,
|
||||||
} from '#/api/system/dict/dict-type';
|
} from '#/api/system/dict/dict-type';
|
||||||
import { dictSyncTenant } from '#/api/system/tenant';
|
|
||||||
import { useTenantStore } from '#/store/tenant';
|
|
||||||
import { commonDownloadExcel } from '#/utils/file/download';
|
import { commonDownloadExcel } from '#/utils/file/download';
|
||||||
|
|
||||||
import { emitter } from '../mitt';
|
import { emitter } from '../mitt';
|
||||||
@ -131,35 +120,11 @@ function handleMultiDelete() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleMenuClick: MenuProps['onClick'] = (e) => {
|
|
||||||
switch (e.key) {
|
|
||||||
case '1': {
|
|
||||||
handleRefreshCache();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case '2': {
|
|
||||||
handleSyncTenantDict();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
async function handleRefreshCache() {
|
async function handleRefreshCache() {
|
||||||
await refreshDictTypeCache();
|
await refreshDictTypeCache();
|
||||||
await tableApi.query();
|
await tableApi.query();
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleSyncTenantDict() {
|
|
||||||
Modal.confirm({
|
|
||||||
title: '提示',
|
|
||||||
iconType: 'warning',
|
|
||||||
content: '确认同步租户字典?',
|
|
||||||
onOk: async () => {
|
|
||||||
await dictSyncTenant();
|
|
||||||
await tableApi.query();
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleDownloadExcel() {
|
function handleDownloadExcel() {
|
||||||
commonDownloadExcel(
|
commonDownloadExcel(
|
||||||
dictTypeExport,
|
dictTypeExport,
|
||||||
@ -167,15 +132,6 @@ function handleDownloadExcel() {
|
|||||||
tableApi.formApi.form.values,
|
tableApi.formApi.form.values,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const { hasAccessByRoles } = useAccess();
|
|
||||||
const tenantStore = useTenantStore();
|
|
||||||
/**
|
|
||||||
* 开启租户 & 超级管理员才可以同步租户字典
|
|
||||||
*/
|
|
||||||
const couldSyncTenantDict = computed(() => {
|
|
||||||
return tenantStore.tenantEnable && hasAccessByRoles(['superadmin']);
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@ -183,19 +139,12 @@ const couldSyncTenantDict = computed(() => {
|
|||||||
<BasicTable id="dict-type" table-title="字典类型列表">
|
<BasicTable id="dict-type" table-title="字典类型列表">
|
||||||
<template #toolbar-tools>
|
<template #toolbar-tools>
|
||||||
<Space>
|
<Space>
|
||||||
<Dropdown>
|
<a-button
|
||||||
<template #overlay>
|
v-access:code="['system:dict:edit']"
|
||||||
<Menu @click="handleMenuClick">
|
@click="handleRefreshCache"
|
||||||
<span v-access:code="['system:dict:edit']">
|
>
|
||||||
<MenuItem key="1">刷新字典缓存</MenuItem>
|
刷新缓存
|
||||||
</span>
|
</a-button>
|
||||||
<span v-if="couldSyncTenantDict">
|
|
||||||
<MenuItem key="2"> 同步租户字典 </MenuItem>
|
|
||||||
</span>
|
|
||||||
</Menu>
|
|
||||||
</template>
|
|
||||||
<a-button> 更多 </a-button>
|
|
||||||
</Dropdown>
|
|
||||||
<a-button
|
<a-button
|
||||||
v-access:code="['system:dict:export']"
|
v-access:code="['system:dict:export']"
|
||||||
@click="handleDownloadExcel"
|
@click="handleDownloadExcel"
|
||||||
|
@ -16,6 +16,7 @@ import {
|
|||||||
type VxeGridProps,
|
type VxeGridProps,
|
||||||
} from '#/adapter/vxe-table';
|
} from '#/adapter/vxe-table';
|
||||||
import {
|
import {
|
||||||
|
dictSyncTenant,
|
||||||
tenantExport,
|
tenantExport,
|
||||||
tenantList,
|
tenantList,
|
||||||
tenantRemove,
|
tenantRemove,
|
||||||
@ -140,6 +141,18 @@ const { hasAccessByCodes, hasAccessByRoles } = useAccess();
|
|||||||
const isSuperAdmin = computed(() => {
|
const isSuperAdmin = computed(() => {
|
||||||
return hasAccessByRoles(['superadmin']);
|
return hasAccessByRoles(['superadmin']);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function handleSyncTenantDict() {
|
||||||
|
Modal.confirm({
|
||||||
|
title: '提示',
|
||||||
|
iconType: 'warning',
|
||||||
|
content: '确认同步租户字典?',
|
||||||
|
onOk: async () => {
|
||||||
|
await dictSyncTenant();
|
||||||
|
await tableApi.query();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@ -147,6 +160,12 @@ const isSuperAdmin = computed(() => {
|
|||||||
<BasicTable table-title="租户列表">
|
<BasicTable table-title="租户列表">
|
||||||
<template #toolbar-tools>
|
<template #toolbar-tools>
|
||||||
<Space>
|
<Space>
|
||||||
|
<a-button
|
||||||
|
v-access:code="['system:tenant:edit']"
|
||||||
|
@click="handleSyncTenantDict"
|
||||||
|
>
|
||||||
|
同步租户字典
|
||||||
|
</a-button>
|
||||||
<a-button
|
<a-button
|
||||||
v-access:code="['system:tenant:export']"
|
v-access:code="['system:tenant:export']"
|
||||||
@click="handleDownloadExcel"
|
@click="handleDownloadExcel"
|
||||||
|
Loading…
Reference in New Issue
Block a user