From 34b929d352514573297bb9a6d4e2fa726744aa47 Mon Sep 17 00:00:00 2001
From: 疯狂的狮子Li <15040126243@163.com>
Date: 星期一, 26 八月 2024 17:56:35 +0800
Subject: [PATCH] add 增加 同步租户字典功能
---
src/views/system/dict/index.vue | 13 +++++++++++++
src/api/system/tenant/index.ts | 8 ++++++++
2 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/src/api/system/tenant/index.ts b/src/api/system/tenant/index.ts
index 4380dbe..7b7b93f 100644
--- a/src/api/system/tenant/index.ts
+++ b/src/api/system/tenant/index.ts
@@ -91,3 +91,11 @@
params: data
});
}
+
+// 鍚屾绉熸埛瀛楀吀
+export function syncTenantDict() {
+ return request({
+ url: '/system/tenant/syncTenantDict',
+ method: 'get',
+ });
+}
diff --git a/src/views/system/dict/index.vue b/src/views/system/dict/index.vue
index d44a04a..4ad70d0 100644
--- a/src/views/system/dict/index.vue
+++ b/src/views/system/dict/index.vue
@@ -49,6 +49,9 @@
<el-col :span="1.5">
<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-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>
</template>
@@ -109,11 +112,15 @@
<script setup name="Dict" lang="ts">
import useDictStore from '@/store/modules/dict';
+import useUserStore from "@/store/modules/user";
import { listType, getType, delType, addType, updateType, refreshCache } from '@/api/system/dict/type';
import { DictTypeForm, DictTypeQuery, DictTypeVO } from '@/api/system/dict/type/types';
+import { syncTenantDict } from "@/api/system/tenant";
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);
@@ -239,6 +246,12 @@
proxy?.$modal.msgSuccess('鍒锋柊鎴愬姛');
useDictStore().cleanDict();
};
+/**鍚屾绉熸埛瀛楀吀*/
+const handleSyncTenantDict = async () => {
+ await proxy?.$modal.confirm('纭瑕佸悓姝ユ墍鏈夌鎴峰瓧鍏稿悧锛�');
+ let res = await syncTenantDict();
+ proxy?.$modal.msgSuccess(res.msg);
+};
onMounted(() => {
getList();
--
Gitblit v1.9.3