yangdr il y a 1 mois
Parent
commit
417df0e70d

+ 2 - 1
.env.development

@@ -1,3 +1,4 @@
 NODE_ENV = development
-VITE_API_URL = http://173.18.12.205:8005
+# # VITE_API_URL = http://173.18.12.205:8005
+VITE_API_URL = http://192.18.1.242:8000
 # VITE_API_URL = http://192.18.1.235:8000

+ 77 - 13
src/components/LayoutHeader.vue

@@ -1,9 +1,6 @@
 <template>
   <div class="layout-header">
     <div class="logo"></div>
-    <!-- <div style="display: flex;align-items: center;margin-right: 10px;">
-      <span class="knowledge-graph-icon" @click="router.push({ path: '/home' })"></span>
-    </div> -->
     <div class="menu">
       <el-menu :default-active="currentPath" ref="menuRef" class="el-menu-demo" mode="horizontal">
         <el-menu-item :index="item.path" v-for="item in routeList" :key="item.name"
@@ -11,6 +8,13 @@
           }}</el-menu-item>
       </el-menu>
     </div>
+    <!-- 机构切换下拉 -->
+    <div style="align-self: center; margin-right: 16px;">
+      <el-select v-model="currentOrg" placeholder="请选择机构" style="width: 160px" @change="changeOrg">
+        <el-option v-for="org in orgList" :key="org.id" :label="org.organ_name" :value="org.id" />
+      </el-select>
+    </div>
+    <!-- 用户下拉 -->
     <div style="align-self: center;">
       <el-dropdown style="margin-top:10px">
         <div style="font-size:medium;font-weight: bold; color:#000">{{ user.full_name }}</div>
@@ -28,17 +32,19 @@
 </template>
 
 <script setup>
-import { ref, computed, onMounted, onBeforeUnmount } from 'vue'
+import { ref, computed, onMounted, onBeforeUnmount,getCurrentInstance } from 'vue'
 import { useMenuStore } from "@/stores/menu.js"
 import { useRoute, useRouter } from "vue-router";
-import { getSessionVar, clearSessionVar } from '@/utils/session'
+import { getSessionVar, clearSessionVar, saveSessionVar } from '@/utils/session'
 import EditPasswordDialog from "@/components/EditPasswordDialog.vue"
+import { knowledgeGraphAddr } from "@/utils/config"
+const { updateRouteList } = useMenuStore();
+const { proxy } = getCurrentInstance()
 const route = useRoute()
 const router = useRouter()
 let timer
 
 const menuRef = ref()
-// console.log('route', route)
 const { routeList } = useMenuStore()
 const user = ref({
   id: "0",
@@ -50,6 +56,70 @@ user.value = {
   full_name: getSessionVar('full_name') || 'John Doe',
   username: getSessionVar('username') || 'johndoe',
 }
+
+// 机构相关
+const orgList = ref([])
+const currentOrg = ref(getSessionVar('org_id') || '') // 当前机构id
+
+// 获取机构列表
+const fetchOrgList = async () => {
+  // 假设接口返回 { records: [{id, name}, ...] }
+  const { records } = await proxy.$http.get('/open-platform/sys/loadSURO')
+  orgList.value = records
+  // 默认选中第一个
+  const res =  await proxy.$http.get('/open-platform/sys/currSURO')
+  console.log('当前机构11:', res)
+    currentOrg.value = res
+    saveSessionVar('org_id', res)
+
+  console.log('机构列表:', orgList.value)
+  console.log('当前机构:', currentOrg.value)
+}
+
+// 切换机构
+const changeOrg = async (orgId) => {
+  // 可调用后端切换机构接口
+ const res =  await proxy.$http.post(`/open-platform/sys/changeSURO/${orgId}`)
+ console.log('切换机构结果:', res)
+  saveSessionVar('org_id', orgId)
+  // 可选:刷新页面或重新拉取权限/菜单等
+  updateRouteList([]);
+  let knowledageSystem = '';
+    let routeList = [{
+      path: '/kmplatform/home',
+      name: 'kmplatform-home',
+      title: "主页",
+      children: []
+    }]
+    res.records[0].menu_permissions.sort((a, b) => {
+      return a.id - b.id;
+    });
+    res.records[0].menu_permissions.forEach((item) => {
+      if (item.menu_name == "知识更新管理") {
+        knowledageSystem = 'true';
+        routeList.push({
+          path: knowledgeGraphAddr,
+          name: '',
+          title: item.name,
+          children: item.children,
+        });
+      } else if (item.menu_route) {
+        routeList.push({
+          path: item.menu_route,
+          name: item.menu_route.split("/")[2],
+          title: item.name,
+          children: item.children,
+        });
+      }
+    });
+    console.log("knowledageSystem", knowledageSystem);
+    saveSessionVar("knowledageSystem", knowledageSystem);
+    saveSessionVar('routeList', JSON.stringify(routeList))
+
+    updateRouteList(routeList);
+  // window.location.reload()
+}
+
 let editPassShow = ref(false)
 const currentPath = computed(() => {
   let temp = ""
@@ -65,20 +135,16 @@ const currentPath = computed(() => {
   return temp
 })
 const handleLogout = () => {
-  // 跳转到登录页面
   router.push({ path: '/login' });
   clearSessionVar()
 }
 
-// 判断是否为外部链接的方法
 const isExternalLink = (path) => {
   return /^https?/g.test(path);
 };
 
-
 function handleMenuClick(path) {
   if (/^https?/g.test(path)) {
-    // path = 'http://localhost:8081/home.html'
     const newWindow = window.open(path, '_blank');
     timer = setInterval(() => {
       newWindow?.postMessage({ type: 'login', username: getSessionVar("full_name"), userID: getSessionVar("user_id") }, "*")
@@ -92,20 +158,18 @@ function handleMenuClick(path) {
 function handleLogin(event) {
   const { type, status } = event.data
   if (type === 'login' && status === 'ok') {
-    // alert('登录成功')
     clearInterval(timer)
   }
 }
 onMounted(() => {
   window.addEventListener('message', handleLogin);
+  fetchOrgList()
 })
 
 onBeforeUnmount(() => {
   window.removeEventListener('message', handleLogin);
   clearInterval(timer)
 })
-
-// console.log(menu.menu)
 </script>
 
 <style lang="less" scoped>

+ 8 - 0
src/router/index.ts

@@ -166,6 +166,14 @@ const router = createRouter({
               },
               component: AccountManage,
             },
+            {
+              path: "Organizational",
+              name: "kgb-Organizational",
+              meta: {
+                title: "账号管理",
+              },
+              component: () => import("@/views/KMPlatform/Permission/Organizational.vue"),
+            },
           ],
         },
       ],

+ 0 - 1
src/views/KMPlatform/KnowledgeBase/KM/KnowledgeManagement.vue

@@ -168,7 +168,6 @@ async function checkLinkValidity(index, url) {
 }
 // 定义处理关闭查看器的方法
 const handleCloseViewer = () => {
-
   viewFileData.value.show = false;
 };
 // 修改状态

+ 280 - 103
src/views/KMPlatform/Permission/AccountManage.vue

@@ -5,123 +5,300 @@
         创建账号
       </el-button>
     </div> -->
-    <el-table border   :data="tableData" style="width: 80%;font-size: 20px;overflow: hidden;border-radius: 4px;margin: 20px 0 0 50px;">
-    <el-table-column prop="id" label="ID" width="180" align="center" />
-    <el-table-column prop="username" label="用户名" width="180"   align="center"/>
-    <el-table-column prop="full_name" label="全名" width="300"  align="center"/>
-    <el-table-column prop="email" label="邮箱" width="400"  align="center"/>
-        <el-table-column fixed="right" label="操作"  align="center">
-      <template #default="scope">
-        <el-button link type="primary" @click="handleEdit(scope.row)">编辑</el-button>
-      </template>
-    </el-table-column>
-  </el-table>
-  <div class="page">
-    <el-pagination
-      v-if="total > 0"
-      :page-sizes="[10, 20, 30, 40, 100]"
-      :page-size="page.pageSize"
-       :total="total"
-       @current-change="handleCurrentChange"
-      layout="total, prev, pager, next, jumper"></el-pagination>
-  </div>
+    <el-table
+      border
+      :data="tableData"
+      style="
+        width: 80%;
+        font-size: 20px;
+        overflow: hidden;
+        border-radius: 4px;
+        margin: 20px 0 0 50px;
+      "
+    >
+      <el-table-column prop="id" label="ID" width="180" align="center" />
+      <el-table-column
+        prop="username"
+        label="用户名"
+        width="180"
+        align="center"
+      />
+      <el-table-column
+        prop="full_name"
+        label="全名"
+        width="300"
+        align="center"
+      />
+      <el-table-column prop="email" label="邮箱" width="400" align="center" />
+      <el-table-column fixed="right" label="操作" align="center">
+        <template #default="scope">
+          <el-button link type="primary" @click="handleEdit(scope.row)"
+            >编辑</el-button
+          >
+        </template>
+      </el-table-column>
+    </el-table>
+    <div class="page">
+      <el-pagination
+        v-if="total > 0"
+        :page-sizes="[10, 20, 30, 40, 100]"
+        :page-size="page.pageSize"
+        :total="total"
+        @current-change="handleCurrentChange"
+        layout="total, prev, pager, next, jumper"
+      ></el-pagination>
+    </div>
     <el-dialog v-model="dialogFormVisible" title="编辑账号" width="500">
-    <el-form :model="form">
-      <el-form-item label="用户名" >
-        <el-input v-model="form.username" disabled />
-      </el-form-item>
-      <el-form-item label="角色" >
-        <el-select v-model="form.role_ids" placeholder="Please select a zone">
-          <el-option v-for="item in rolesData" :key="item.id" :label="item.name" :value="item.id" />
-        </el-select>
-      </el-form-item>
-    </el-form>
-    <template #footer>
-      <div class="dialog-footer">
-        <el-button @click="dialogFormVisible = false">取消</el-button>
-        <el-button type="primary" @click="submitChange">
-          确认
-        </el-button>
-      </div>
-    </template>
-  </el-dialog>
+      <el-form :model="form">
+        <el-form-item label="用户名">
+          <el-input v-model="form.username" disabled />
+        </el-form-item>
+        <el-form-item label="角色">
+          <el-select v-model="form.role_ids" placeholder="Please select a zone">
+            <el-option
+              v-for="item in rolesData"
+              :key="item.id"
+              :label="item.name"
+              :value="item.id"
+            />
+          </el-select>
+        </el-form-item>
+      </el-form>
+      <template #footer>
+        <div class="dialog-footer">
+          <el-button @click="dialogFormVisible = false">取消</el-button>
+          <el-button type="primary" @click="submitChange"> 确认 </el-button>
+        </div>
+      </template>
+    </el-dialog>
+    <el-dialog
+      v-model="orgRoleDialogVisible"
+      title="用户机构与角色管理"
+      width="70vw"
+    >
+      <el-button type="primary" @click="handleAddOrgRole" style="margin: 10px"
+        >新增机构角色</el-button
+      >
+      <el-table :data="orgRoleTable" style="width: 100%">
+        <el-table-column prop="organ_name" label="机构" />
+        <el-table-column prop="role_name" label="角色" />
+        <el-table-column prop="data_type" label="类型">
+          <template #default="scope">
+            <span>
+              {{ scope.row.data_type === 1 ? '个人' : scope.row.data_type === 2 ? '本机构' : scope.row.data_type === 3 ? '机构及下辖机构' : '' }}
+            </span>
+          </template>
+        </el-table-column>
+        <el-table-column label="操作" width="180">
+          <template #default="scope">
+            <el-button size="small" @click="handleEditOrgRole(scope.row)"
+              >编辑</el-button
+            >
+            <el-button
+              size="small"
+              type="danger"
+              @click="handleDeleteOrgRole(scope.row)"
+              >删除</el-button
+            >
+          </template>
+        </el-table-column>
+      </el-table>
+
+      <el-dialog v-model="isEditOrgRole" :title="EditOrgRoleTittle" width="700">
+        <el-form :model="orgRoleForm" label-width="80px">
+          <el-form-item label="机构">
+            <el-tree-select
+              v-model="orgRoleForm.organ_id"
+              :data="orgList"
+              :props="{ label: 'name', value: 'id', children: 'children' }"
+              placeholder="请选择机构"
+              clearable
+              check-strictly
+              style="width: 100%"
+            />
+          </el-form-item>
+          <el-form-item label="角色">
+            <el-select v-model="orgRoleForm.role_id" placeholder="请选择角色">
+              <el-option
+                v-for="role in roleList"
+                :key="role.id"
+                :label="role.name"
+                :value="role.id"
+              />
+            </el-select>
+          </el-form-item>
+          <el-form-item label="类型">
+            <el-select v-model="orgRoleForm.data_type" placeholder="请选择类型">
+              <el-option :value="1" label="个人" />
+              <el-option :value="2" label="本机构" />
+              <el-option :value="3" label="机构及下辖机构" />
+            </el-select>
+          </el-form-item>
+        </el-form>
+        <template #footer>
+          <el-button @click="isEditOrgRole = false">取消</el-button>
+          <el-button type="primary" @click="handleSaveOrgRole">保存</el-button>
+        </template>
+      </el-dialog>
+    </el-dialog>
   </div>
 </template>
 
 <script setup>
-import { ref, reactive,getCurrentInstance } from 'vue'
-const { proxy } = getCurrentInstance()
-let tableData = ref([])
-let total = ref(0)
-let dialogFormVisible = ref(false)
-let rolesData = ref([])
+import { ref, reactive, getCurrentInstance } from "vue";
+const { proxy } = getCurrentInstance();
+let tableData = ref([]);
+let total = ref(0);
+let dialogFormVisible = ref(false);
+let rolesData = ref([]);
 let page = reactive({
-  userName:'',
+  userName: "",
   pageNo: 1,
-  pageSize: 10
-})
+  pageSize: 10,
+});
 let form = reactive({
-  username: '',
-  user_id:0,
-  role_ids: '',
-})
-const init = () => {
-  proxy.$http.get('/open-platform/user/users',{
-        params: {
-          ...page,
-        }
-      })
-      .then((res) => {
-        console.log(res,'11')
-       if(res.records && res.records.length > 0) {
-          res.records.forEach(item => {
-            tableData.value.push(item)
-          })
-        } else {
-          tableData.value = []
-        }
-        total.value = res.total
+  username: "",
+  user_id: 0,
+  role_ids: "",
+});
+// 新增:机构角色管理相关
+const orgRoleDialogVisible = ref(false);
+const orgRoleTable = ref([]);
+const orgRoleForm = reactive({
+  id: null,
+  organ_id: null,
+  org_name: "",
+  role_id: null,
+  role_name: "",
+  data_type: null, // 新增
+});
+let tablePage = reactive({
+  page: 1,
+  page_size: 100,
+});
+const orgList = ref([]);
+const roleList = ref([]);
+const isEditOrgRole = ref(false);
+const EditOrgRoleTittle = ref("");
+const currentUserId = ref(''); // 当前用户ID
 
-      })
-}
-init()
-const handleCurrentChange = (val) => {
-  page.pageNo = val
-  tableData.value = []
-  init()
-}
-const getRolesList = () => {
-  proxy.$http.get('/open-platform/user/roles')
+// 获取当前用户的机构和角色
+const fetchUserOrgRoles = async (userId) => {
+  // 假设接口返回 [{id, org_id, org_name, role_id, role_name}]
+  const { records } = await proxy.$http.post(
+    `/open-platform/userRoleOrgan/data-list`,
+    { user_id: userId, ...tablePage }
+  );
+  console.log(records, "获取用户机构角色数据");
+  orgRoleTable.value = records || [];
+};
+// 获取所有机构
+const fetchOrgList = async () => {
+  const { records } = await proxy.$http.get("/open-platform/organ/loadData");
+  orgList.value = records || [];
+};
+// 获取所有角色
+const fetchRoleList = async () => {
+  const { records } = await proxy.$http.get("/open-platform/user/roles");
+  roleList.value = records || [];
+};
+
+// 新增机构角色
+const handleAddOrgRole = () => {
+  EditOrgRoleTittle.value = "新增机构角色";
+  isEditOrgRole.value = true;
+  Object.assign(orgRoleForm, {
+    id: null,
+    organ_id: null,
+    org_name: "",
+    role_id: null,
+    role_name: "",
+    data_type: null, // 新增
+  });
+};
+const handleEditOrgRole = (row) => {
+  EditOrgRoleTittle.value = "编辑机构角色";
+  isEditOrgRole.value = true;
+  Object.assign(orgRoleForm, row);
+};
+// 删除机构角色
+const handleDeleteOrgRole = async (row) => {
+  await proxy.$http.post("/open-platform/userRoleOrgan/delete/"+ row.id);
+  fetchUserOrgRoles(currentUserId.value);
+};
+// 保存机构角色
+const handleSaveOrgRole = async () => {
+  orgRoleForm.user_id = currentUserId.value; // 设置当前用户ID
+  if (orgRoleForm.id) {
+    // 编辑
+    await proxy.$http.post("/open-platform/userRoleOrgan/update", orgRoleForm);
+  } else {
+    await proxy.$http.post("/open-platform/userRoleOrgan/insert", orgRoleForm);
+  }
+  isEditOrgRole.value = false;
+  fetchUserOrgRoles(currentUserId.value);
+};
+
+const init = () => {
+  proxy.$http
+    .get("/open-platform/user/users", {
+      params: {
+        ...page,
+      },
+    })
     .then((res) => {
+      console.log(res, "11");
       if (res.records && res.records.length > 0) {
-        rolesData.value = res.records
+        res.records.forEach((item) => {
+          tableData.value.push(item);
+        });
       } else {
-        rolesData.value = []
+        tableData.value = [];
       }
-    })
-}
-getRolesList()
+      total.value = res.total;
+    });
+};
+init();
+const handleCurrentChange = (val) => {
+  page.pageNo = val;
+  tableData.value = [];
+  init();
+};
+const getRolesList = () => {
+  proxy.$http.get("/open-platform/user/roles").then((res) => {
+    if (res.records && res.records.length > 0) {
+      rolesData.value = res.records;
+    } else {
+      rolesData.value = [];
+    }
+  });
+};
+getRolesList();
 const handleEdit = (row) => {
-  dialogFormVisible.value = true
-  form.username = row.username
-  form.user_id = row.id
-  form.role_ids = row.role_ids ? row.role_ids[0] : ''
-}
+  // dialogFormVisible.value = true
+  // form.username = row.username
+  // form.user_id = row.id
+  // form.role_ids = row.role_ids ? row.role_ids[0] : ''
+  currentUserId.value = row.id; // 保存当前用户ID
+  // 新增:获取并展示机构角色
+  fetchUserOrgRoles(row.id);
+  fetchOrgList();
+  fetchRoleList();
+  orgRoleDialogVisible.value = true;
+};
 const submitChange = () => {
-  form.role_ids = form.role_ids ? [form.role_ids] : []
-  proxy.$http.post('/open-platform/user/users/roles', form)
-    .then((res) => {
-      if (res.code === 200) {
-        proxy.$message.success('修改成功')
-        dialogFormVisible.value = false
-        tableData.value = []
-        init()
-      } else {
-        proxy.$message.error(res.message || '修改失败')
-      }
-    })
-}
-
+  form.role_ids = form.role_ids ? [form.role_ids] : [];
+  proxy.$http.post("/open-platform/user/users/roles", form).then((res) => {
+    if (res.code === 200) {
+      proxy.$message.success("修改成功");
+      dialogFormVisible.value = false;
+      tableData.value = [];
+      init();
+    } else {
+      proxy.$message.error(res.message || "修改失败");
+    }
+  });
+};
 </script>
 
 <style lang="less" scoped>
@@ -136,4 +313,4 @@ const submitChange = () => {
   margin-top: 20px;
   padding-right: 10%;
 }
-</style>
+</style>

+ 195 - 0
src/views/KMPlatform/Permission/Organizational.vue

@@ -0,0 +1,195 @@
+<template>
+    <el-card>
+        <el-row justify="space-between" align="middle" class="mb-2">
+            <el-col>
+                <el-button type="primary" @click="openAddDialog">新增机构</el-button>
+            </el-col>
+        </el-row>
+        <el-table :data="orgList" style="width: 100%"  row-key="id" :tree-props="{ children: 'children', hasChildren: 'hasChildren' }">
+            <el-table-column prop="name" label="机构名称" />
+            <el-table-column prop="manager" label="管理员" />
+            <el-table-column prop="phone" label="管理员电话" />
+            <el-table-column label="操作" width="180">
+                <template #default="scope">
+                    <el-button size="small" @click="openEditDialog(scope.row)">编辑</el-button>
+                    <el-button size="small" type="danger" @click="handleDelete(scope.row)">删除</el-button>
+                </template>
+            </el-table-column>
+        </el-table>
+
+        <!-- 新增/编辑机构对话框 -->
+        <el-dialog :title="dialogTitle" v-model="dialogVisible" @close="resetForm">
+            <el-form :model="form" :rules="rules" ref="formRef" label-width="100px">
+                <el-form-item label="机构名称" prop="name">
+                    <el-input v-model="form.name" />
+                </el-form-item>
+                <el-form-item label="父级机构" prop="parent_id">
+                    <el-tree-select
+                        v-model="form.parent_id"
+                        :data="orgList"
+                        :props="{ label: 'name', value: 'id', children: 'children' }"
+                        placeholder="不选则为一级机构"
+                        clearable
+                        check-strictly
+                        style="width: 100%;"
+                    />
+                </el-form-item>
+                <el-form-item label="负责人" prop="manager">
+                    <el-input v-model="form.manager" />
+                </el-form-item>
+                <el-form-item label="联系电话" prop="phone">
+                    <el-input v-model="form.phone" />
+                </el-form-item>
+                <!-- <el-form-item label="管理员账号" prop="adminAccount">
+                    <el-select v-model="form.adminAccount" placeholder="请选择管理员账号" filterable>
+                        <el-option
+                            v-for="user in adminList"
+                            :key="user.id"
+                            :label="`${user.username} (${user.email})`"
+                            :value="user.id"
+                        />
+                    </el-select>
+                </el-form-item> -->
+            </el-form>
+            <template #footer>
+                <el-button @click="handleCancel">取消</el-button>
+                <el-button type="primary" @click="handleSubmit">确定</el-button>
+            </template>
+        </el-dialog>
+    </el-card>
+</template>
+
+<script setup>
+import { ref, reactive, onMounted,getCurrentInstance } from 'vue'
+import { ElMessage, ElMessageBox } from 'element-plus'
+const { proxy } = getCurrentInstance()
+
+// 模拟接口
+const fetchOrgList = async () => {
+  const {records} = await proxy.$http.get('/open-platform/organ/loadData')
+  orgList.value =  records
+}
+const fetchAdminList = async () => {
+     const {records} = await proxy.$http.get('/open-platform/user/users',{
+        params: {
+        userName:'',
+        pageNo: 1,
+        pageSize: 100,
+        }
+      })
+    return records
+}
+
+
+// 真实接口请替换上面两个函数
+
+const orgList = ref([])
+const adminList = ref([])
+
+const dialogVisible = ref(false)
+const dialogTitle = ref('新增机构')
+const formRef = ref()
+const form = reactive({
+    id: null,
+    name: '',
+    manager: '',
+    phone: '',
+    parent_id: null,
+})
+const rules = {
+    name: [{ required: true, message: '请输入机构名称', trigger: 'blur' }],
+    // adminAccount: [{ required: true, message: '请选择管理员账号', trigger: 'change' }]
+}
+
+const defaultForm = {
+    id: null,
+    name: '',
+    manager: '',
+    phone: '',
+    parent_id: null,
+}
+
+function resetForm() {
+    Object.assign(form, defaultForm)
+    formRef.value && formRef.value.clearValidate()
+}
+
+function handleCancel() {
+    dialogVisible.value = false
+    resetForm()
+}
+
+const openAddDialog = () => {
+    dialogTitle.value = '新增机构'
+    Object.assign(form, { id: null, name: '', adminAccount: '' })
+    dialogVisible.value = true
+}
+const openEditDialog = (row) => {
+    dialogTitle.value = '编辑机构'
+    Object.assign(form, row)
+    dialogVisible.value = true
+}
+const handleSubmit = () => {
+    formRef.value.validate(async (valid) => {
+        if (!valid) return
+        console.log('提交的表单数据:', form)
+        // const admin = adminList.value.find(u => u.account === form.adminAccount)
+        if (form.id) {
+            // 编辑
+           proxy.$http.post('/open-platform/organ/update', form)
+            .then((res) => {
+                if (res.code === 200) {
+                   fetchOrgList()
+                    ElMessage.success('编辑成功')
+                } else {
+                    ElMessage.error('编辑失败')
+                }
+            })
+            .catch(() => {
+                ElMessage.error('编辑失败')
+            })
+        } else {
+            // 新增
+           proxy.$http.post('/open-platform/organ/insert', form)
+            .then((res) => {
+                if (res.code === 200) {
+                   fetchOrgList()
+                    ElMessage.success('新增成功')
+                } else {
+                    ElMessage.error('新增失败')
+                }
+            })
+            .catch(() => {
+                ElMessage.error('新增失败')
+            })
+        }
+        dialogVisible.value = false
+    })
+}
+const handleDelete = (row) => {
+    ElMessageBox.confirm('确定删除该机构吗?', '提示', { type: 'warning' })
+        .then(() => {
+           proxy.$http.post('/open-platform/organ/delete/' + row.id, )
+            .then((res) => {
+                if (res.code === 200) {
+                    fetchOrgList()
+                    ElMessage.success('删除成功')
+                } else {
+                    ElMessage.error('删除失败')
+                }
+            })
+            .catch(() => {
+                ElMessage.error('删除失败')
+            })
+        })
+}
+
+onMounted(async () => {
+    fetchOrgList()
+    adminList.value = await fetchAdminList()
+})
+</script>
+
+<style scoped>
+.mb-2 { margin-bottom: 16px; }
+</style>

+ 5 - 0
src/views/KMPlatform/Permission/permission.vue

@@ -34,6 +34,11 @@ let menuList = ref([
     name: "kgb-AccountManage",
     title: "账号管理",
   },
+  {
+    path: "/kmplatform/kgpermission/Organizational",
+    name: "kgb-Organizational",
+    title: "机构管理",
+  }
 ]);
 
 function handleMenuClick(data) {