租户字典同步方法命名修正

This commit is contained in:
抓蛙师 2024-08-26 11:18:44 +08:00
parent d124fdf5ca
commit 0b7ea880fa
3 changed files with 16 additions and 10 deletions

View File

@ -62,9 +62,9 @@ export function optionselect(): AxiosPromise<DictTypeVO[]> {
}
// 同步租户字典
export function asyncTenantDict(tenantId?: string) {
export function syncTenantDict(tenantId?: string | number) {
return request({
url: '/system/dict/type/asyncTenantDict',
url: '/system/dict/type/syncTenantDict',
method: 'get',
params: { tenantId }
});

View File

@ -50,7 +50,7 @@
<el-button v-hasPermi="['system:dict:remove']" type="danger" plain icon="Refresh" @click="handleRefreshCache">刷新缓存</el-button>
</el-col>
<el-col :span="1.5">
<el-button v-hasRole="['superadmin']" type="success" plain icon="Refresh" @click="handleAsyncTenantDict">同步租户字典</el-button>
<el-button v-if="userId === 1" type="success" plain icon="Refresh" @click="handleSyncTenantDict">同步租户字典</el-button>
</el-col>
<right-toolbar v-model:showSearch="showSearch" @query-table="getList"></right-toolbar>
</el-row>
@ -112,11 +112,14 @@
<script setup name="Dict" lang="ts">
import useDictStore from '@/store/modules/dict';
import { listType, getType, delType, addType, updateType, refreshCache ,asyncTenantDict} from '@/api/system/dict/type';
import { listType, getType, delType, addType, updateType, refreshCache , syncTenantDict} from '@/api/system/dict/type';
import { DictTypeForm, DictTypeQuery, DictTypeVO } from '@/api/system/dict/type/types';
import useUserStore from '@/store/modules/user';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const userStore = useUserStore();
const userId = ref(userStore.userId);
const typeList = ref<DictTypeVO[]>([]);
const loading = ref(true);
const showSearch = ref(true);
@ -243,9 +246,9 @@ const handleRefreshCache = async () => {
useDictStore().cleanDict();
};
/**同步租户字典*/
const handleAsyncTenantDict = async () => {
const handleSyncTenantDict = async () => {
await proxy?.$modal.confirm('确认要同步所有租户字典吗?');
let res = await asyncTenantDict();
let res = await syncTenantDict();
proxy?.$modal.msgSuccess(res.msg);
};
onMounted(() => {

View File

@ -76,7 +76,7 @@
</el-button>
</el-tooltip>
<el-tooltip content="同步字典" placement="top">
<el-button v-hasRole="['superadmin']" link type="primary" icon="Refresh" @click="handleAsyncTenantDict(scope.row)"></el-button>
<el-button v-if="userId === 1" link type="primary" icon="Refresh" @click="handleSyncTenantDict(scope.row)"></el-button>
</el-tooltip>
<el-tooltip content="删除" placement="top">
<el-button v-hasPermi="['system:tenant:remove']" link type="primary" icon="Delete" @click="handleDelete(scope.row)"></el-button>
@ -148,10 +148,13 @@ import { listTenant, getTenant, delTenant, addTenant, updateTenant, changeTenant
import { selectTenantPackage } from '@/api/system/tenantPackage';
import { TenantForm, TenantQuery, TenantVO } from '@/api/system/tenant/types';
import { TenantPkgVO } from '@/api/system/tenantPackage/types';
import { asyncTenantDict } from '@/api/system/dict/type';
import { syncTenantDict } from '@/api/system/dict/type';
import useUserStore from '@/store/modules/user';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const userStore = useUserStore();
const userId = ref(userStore.userId);
const tenantList = ref<TenantVO[]>([]);
const packageList = ref<TenantPkgVO[]>([]);
const buttonLoading = ref(false);
@ -336,11 +339,11 @@ const handleSyncTenantPackage = async (row: TenantVO) => {
};
/**同步租户字典*/
const handleAsyncTenantDict = async (row: TenantVO) => {
const handleSyncTenantDict = async (row: TenantVO) => {
try {
await proxy?.$modal.confirm('是否确认同步租户套餐租户编号为"' + row.tenantId + '"的字典数据吗?');
loading.value = true;
await asyncTenantDict(row.tenantId);
await syncTenantDict(row.tenantId);
await getList();
proxy?.$modal.msgSuccess('同步成功');
} catch {