兰宝车间质量管理系统-前端
疯狂的狮子Li
2024-08-26 34b929d352514573297bb9a6d4e2fa726744aa47
add 增加 同步租户字典功能
已修改2个文件
21 ■■■■■ 文件已修改
src/api/system/tenant/index.ts 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/system/dict/index.vue 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/system/tenant/index.ts
@@ -91,3 +91,11 @@
    params: data
  });
}
// 同步租户字典
export function syncTenantDict() {
  return request({
    url: '/system/tenant/syncTenantDict',
    method: 'get',
  });
}
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();