Browse Source

更改样式

yangdr 1 tháng trước cách đây
mục cha
commit
ae893bd9fc

+ 43 - 44
src/components/LayoutHeader.vue

@@ -32,7 +32,7 @@
 </template>
 
 <script setup>
-import { ref, computed, onMounted, onBeforeUnmount,getCurrentInstance } 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, saveSessionVar } from '@/utils/session'
@@ -67,66 +67,65 @@ const fetchOrgList = async () => {
   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)
+  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)
+  // 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)
+  const res = await proxy.$http.post(`/open-platform/sys/changeSURO/${orgId}`)
+  console.log('切换机构结果:', res)
   saveSessionVar('org_id', orgId)
-   saveSessionVar("knowledageSystem", '');
-    saveSessionVar('routeList', '')
+  saveSessionVar("knowledageSystem", '');
+  saveSessionVar('routeList', '')
   // 可选:刷新页面或重新拉取权限/菜单等
   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))
+  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);
 
-    updateRouteList(routeList);
-    
   // 刷新页面
   window.location.href = '/kmplatform/home';
 }
 
 let editPassShow = ref(false)
 const currentPath = computed(() => {
-  console.log('当前路由:', route)
+  // console.log('当前路由:', route)
   let temp = ""
   for (let i = 0; i < routeList.length; i++) {
     for (let j = 0; j < route.matched.length; j++) {

+ 41 - 5
src/dialogs/OCRDialog.vue

@@ -11,9 +11,9 @@
         </el-select>
       </el-form-item>
       <el-form-item label="文件" :label-width="formLabelWidth">
-        <el-upload ref="upload" :action="'/api/file/upload/pdf/' + form.job_id" :mutiple="false" :limit="100"
+        <el-upload ref="upload" :action="'/api/file/upload/pdf/' + form.job_id" :multiple="true" :limit="10000"
           :on-preview="handlePreview" :on-remove="handleRemove" :on-success="handleSuccess" v-model:file-list="fileList"
-          :on-exceed="handleExceed" :auto-upload="false">
+          :on-exceed="handleExceed" :auto-upload="false" style="width: 100%;">
           <el-button @click.stop="knowledgeBase.visible = true" size="small" type="primary">知识库导入</el-button>
           <el-button slot="trigger" size="small" type="primary">上传文件</el-button>
 
@@ -21,10 +21,10 @@
         </el-upload>
       </el-form-item>
     </el-form>
-    <div slot="footer">
+    <footer slot="footer">
       <el-button type="primary" @click="handleConfirm">确 定</el-button>
       <el-button @click="dialogFormVisible = false">取 消</el-button>
-    </div>
+    </footer>
     <div class="knowledge-base" v-show="knowledgeBase.visible">
       <div class="topbar"><span @click="knowledgeBase.visible = false" class="close-knowledge-base"><el-icon>
             <Close />
@@ -140,7 +140,7 @@ const formLabelWidth = ref('120px')
 
 const paginationData = ref<any>({
   currentPage: 1,
-  pageSizes: [10, 50, 100, 200],
+  pageSizes: [10, 50, 100, 1000, 10000],
   disabled: false,
   total: 0,
   defaultPageSize: 10,
@@ -550,6 +550,42 @@ onMounted(() => {
 </script>
 
 <style lang="less" scoped>
+footer {
+  text-align: right;
+}
+
+:deep(.el-upload-list) {
+  max-height: 300px;
+  // width: auto;
+  overflow: auto;
+
+  /*定义滚动条高宽及背景
+ 高宽分别对应横竖滚动条的尺寸*/
+  &::-webkit-scrollbar {
+    width: 10px;
+    height: 10px;
+    background-color: #F5F5F5;
+    // display: none;
+  }
+
+  /*定义滚动条轨道
+ 内阴影+圆角*/
+  &::-webkit-scrollbar-track {
+    -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
+    border-radius: 10px;
+    background-color: #F5F5F5;
+  }
+
+  /*定义滑块
+ 内阴影+圆角*/
+  &::-webkit-scrollbar-thumb {
+    border-radius: 10px;
+    -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
+    background-color: #DDDEE0;
+  }
+
+}
+
 .knowledge-base {
   position: fixed;
   top: 50%;

+ 2 - 1
src/stores/menu.js

@@ -48,11 +48,12 @@ export const useMenuStore = defineStore('menu', () => {
         })
       }
     });
-
     return permissions
   })
+
   const updateRouteList = (newRoutes) => {
     routeList.value = newRoutes; // 更新路由列表
   };
+
   return { routeList, updateRouteList, operationPermissions }
 })

+ 14 - 9
src/views/KMPlatform/KnowledgeBase/KBM/KnowledgeBaseManagement.vue

@@ -38,14 +38,15 @@
             <span class="text">
               <div class="title" @click="toKMById(item.id)">{{ item.name }}</div>
               <div class="remark">
-                <template v-if=" typeof item.tags === 'string'">
-                 <el-tag type="info" effect="plain" hit>{{ item.tags }}</el-tag>
+                <template v-if="typeof item.tags === 'string'">
+                  <el-tag type="info" effect="plain" hit>{{ item.tags }}</el-tag>
 
                 </template>
                 <template v-else-if="Array.isArray(item.tags)">
-                  <el-tag style="margin-right: 5px;padding: 4px;" v-for="(tag, tagIndex) in item.tags" :key="tagIndex">{{ tag }}</el-tag>
+                  <el-tag style="margin-right: 5px;padding: 4px;" v-for="(tag, tagIndex) in item.tags"
+                    :key="tagIndex">{{ tag }}</el-tag>
                 </template>
-               
+
               </div>
             </span>
           </div>
@@ -100,7 +101,9 @@
           <el-table-column prop="file_count" label="文件上数量" min-width="120" />
           <el-table-column prop="tags" label="知识库标签">
             <template #default="{ row }">
-              <i style="white-space: nowrap;text-overflow: ellipsis;">{{ row.tags }}</i>
+              <i style="white-space: nowrap;text-overflow: ellipsis;">
+                {{ Array.isArray(row.tags) ? row.tags.join("、") : '' }}
+              </i>
             </template>
           </el-table-column>
           <el-table-column prop="created_at" label="知识库创建时间" min-width="150" />
@@ -177,6 +180,8 @@ import { confirmDelete } from "@/utils/confirmation"
 import EditKBDialog from "@/components/EditKBDialog.vue"
 import { api } from "@/utils/config.js"
 import { ElMessage, ElMessageBox } from "element-plus"
+import { useMenuStore } from "@/stores/menu.js"
+const { operationPermissions } = useMenuStore();
 const router = useRouter()
 const { proxy } = getCurrentInstance()
 let editKBDialogData = ref({ show: false, kb: {} })
@@ -261,8 +266,8 @@ function handleAddKBTags(index) {
     inputErrorMessage: '无效输入',
   })
     .then(async ({ value }) => {
-       let tags = []
-      if(item.tags) {
+      let tags = []
+      if (item.tags) {
         if (typeof item.tags === 'string') {
           tags = item.tags.split()
           tags.push(value)
@@ -270,10 +275,10 @@ function handleAddKBTags(index) {
           tags = [...item.tags]
           tags.push(value)
         }
-      }else {
+      } else {
         tags = value.split()
       }
-       
+
       const data = await proxy.$http.put(api.knowledgeBase + `/${item.id}`, {
         "name": item.name,
         "description": item.description,

+ 7 - 5
src/views/KMPlatform/KnowledgeBase/KM/KnowledgeManagement.vue

@@ -42,11 +42,11 @@
             </el-table-column>
             <el-table-column prop="knowledge_type" label="知识类型" />
             <el-table-column prop="version" label="版本" />
-            <el-table-column prop="author" label="作者(主编)" />
+            <el-table-column prop="author" label="作者(主编)" min-width="90" />
             <el-table-column prop="year" label="年份" min-width="70" />
             <el-table-column prop="creator" label="上传人" />
             <el-table-column prop="created_at" label="上传时间" width="170" />
-            <el-table-column prop="" label="状态">
+            <el-table-column prop="" label="状态" min-width="100">
               <template #default="{ row, $index }">
                 <div style="display:flex; align-items: center;gap: 10px;">
                   <span v-if="row.status">
@@ -65,10 +65,12 @@
                 </div>
               </template>
             </el-table-column>
-            <el-table-column prop="created_at" label="下载" width="70">
+            <el-table-column prop="created_at" label="下载" width="64">
               <template #default="{ row }">
-                <i class="document-download-icon" :disabled="row.status ? true : false"
-                  @click="handleDownloadFile(row.minio_url, row.file_name, row.status)"></i>
+                <div style="text-align: center;">
+                  <i class="document-download-icon" :disabled="row.status ? true : false"
+                    @click="handleDownloadFile(row.minio_url, row.file_name, row.status)"></i>
+                </div>
               </template>
             </el-table-column>
             <el-table-column fixed="right" label="操作">

+ 27 - 73
src/views/KMPlatform/Permission/AccountManage.vue

@@ -5,48 +5,26 @@
         创建账号
       </el-button>
     </div> -->
-    <el-table
-      border
-      :data="tableData"
-      style="
+    <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="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
-          >
+          <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>
+      <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">
@@ -55,12 +33,7 @@
         </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-option v-for="item in rolesData" :key="item.id" :label="item.name" :value="item.id" />
           </el-select>
         </el-form-item>
       </el-form>
@@ -71,35 +44,23 @@
         </div>
       </template>
     </el-dialog>
-    <el-dialog
-      v-model="orgRoleDialogVisible"
-      title="用户机构与角色管理"
-      width="70vw"
-    >
-      <el-button type="primary" @click="handleAddOrgRole" style="margin: 10px"
-        >新增机构角色</el-button
-      >
+    <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 ? '机构及下辖机构' : '' }}
+              {{ 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
-            >
+            <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>
@@ -107,24 +68,13 @@
       <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-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-option v-for="role in roleList" :key="role.id" :label="role.name" :value="role.id" />
             </el-select>
           </el-form-item>
           <el-form-item label="类型">
@@ -223,7 +173,7 @@ const handleEditOrgRole = (row) => {
 };
 // 删除机构角色
 const handleDeleteOrgRole = async (row) => {
-  await proxy.$http.post("/open-platform/userRoleOrgan/delete/"+ row.id);
+  await proxy.$http.post("/open-platform/userRoleOrgan/delete/" + row.id);
   fetchUserOrgRoles(currentUserId.value);
 };
 // 保存机构角色
@@ -247,7 +197,7 @@ const init = () => {
       },
     })
     .then((res) => {
-      console.log(res, "11");
+      // console.log(res, "11");
       if (res.records && res.records.length > 0) {
         res.records.forEach((item) => {
           tableData.value.push(item);
@@ -303,10 +253,14 @@ const submitChange = () => {
 
 <style lang="less" scoped>
 :deep(.el-table th) {
-  background-color: #eef6ff !important; /* 设置你想要的背景颜色 */
-  color: #333; /* 设置表头文字颜色 */
-  font-weight: bold; /* 设置表头文字加粗 */
+  background-color: #eef6ff !important;
+  /* 设置你想要的背景颜色 */
+  color: #333;
+  /* 设置表头文字颜色 */
+  font-weight: bold;
+  /* 设置表头文字加粗 */
 }
+
 .page {
   display: flex;
   justify-content: end;

+ 26 - 45
src/views/KMPlatform/Permission/RoleManage.vue

@@ -5,49 +5,26 @@
         创建账号
       </el-button>
     </div> -->
-    <el-table
-      border
-      :data="tableData"
-      style="
+    <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="name" label="角色名" width="280" align="center" />
-      <el-table-column
-        prop="description"
-        label="描述"
-        width="400"
-        align="center"
-      />
+      <el-table-column prop="description" label="描述" width="400" align="center" />
       <el-table-column fixed="right" label="操作" align="center">
         <template #default="scope">
-          <el-button link type="primary" @click="handleChange(scope.row)"
-            >编辑</el-button
-          >
+          <el-button link type="primary" @click="handleChange(scope.row)">编辑</el-button>
         </template>
       </el-table-column>
     </el-table>
-    <el-dialog
-      v-model="dialogFormVisible"
-      title="编辑角色"
-      width="500"
-      @close="handleClose"
-    >
+    <el-dialog v-model="dialogFormVisible" title="编辑角色" width="500" @close="handleClose">
       <div></div>
-      <el-tree
-        style="max-width: 600px"
-        :data="permissionData"
-        show-checkbox
-        node-key="id"
-        :default-checked-keys="currentCheckedKeys"
-        :props="defaultProps"
-        ref="tree"
-      />
+      <el-tree style="max-width: 600px" :data="permissionData" show-checkbox node-key="id"
+        :default-checked-keys="currentCheckedKeys" :props="defaultProps" ref="tree" />
       <template #footer>
         <div class="dialog-footer">
           <el-button @click="handleClose">取消</el-button>
@@ -81,7 +58,7 @@ const tree = ref(null);
 
 const init = () => {
   proxy.$http.get("/open-platform/user/roles").then((res) => {
-    console.log(res, "11");
+    // console.log(res, "11");
     if (res.records && res.records.length > 0) {
       tableData.value = res.records
     } else {
@@ -115,26 +92,30 @@ const handleClose = () => {
   });
 };
 const submitChange = () => {
-    form.permission_ids = tree.value.getCheckedKeys();
-    proxy.$http
-      .post("/open-platform/user/roles", form)
-      .then((res) => {
-        proxy.$message.success("修改成功");
-        dialogFormVisible.value = false;
-        init();
-      })
-      .catch((err) => {
-        proxy.$message.error("修改失败");
-      });
+  form.permission_ids = tree.value.getCheckedKeys();
+  proxy.$http
+    .post("/open-platform/user/roles", form)
+    .then((res) => {
+      proxy.$message.success("修改成功");
+      dialogFormVisible.value = false;
+      init();
+    })
+    .catch((err) => {
+      proxy.$message.error("修改失败");
+    });
 };
 </script>
 
 <style lang="less" scoped>
 :deep(.el-table th) {
-  background-color: #eef6ff !important; /* 设置你想要的背景颜色 */
-  color: #333; /* 设置表头文字颜色 */
-  font-weight: bold; /* 设置表头文字加粗 */
+  background-color: #eef6ff !important;
+  /* 设置你想要的背景颜色 */
+  color: #333;
+  /* 设置表头文字颜色 */
+  font-weight: bold;
+  /* 设置表头文字加粗 */
 }
+
 :deep(.el-table .el-table__cell) {
   padding: 10px 0 !important;
 }