瀏覽代碼

添加知识库,调整模板接口

yangg 10 月之前
父節點
當前提交
74cc69881b
共有 48 個文件被更改,包括 1085 次插入40 次删除
  1. 0 0
      dist/index.html
  2. 0 0
      dist/static/css/chunk-55bb6aee.7131743c.css
  3. 0 0
      dist/static/css/chunk-55efc996.e30e9787.css
  4. 0 0
      dist/static/css/chunk-6caebfaa.7131743c.css
  5. 1 0
      dist/static/css/chunk-73894ea4.ed7eb474.css
  6. 1 0
      dist/static/css/chunk-d78b9348.7131743c.css
  7. 0 0
      dist/static/css/chunk-fc73c52a.97a8613a.css
  8. 0 0
      dist/static/js/app.48f2d593.js
  9. 0 0
      dist/static/js/app.8bd632ce.js
  10. 0 0
      dist/static/js/chunk-06dc419e.759b8c84.js
  11. 0 0
      dist/static/js/chunk-06dc419e.85d66413.js
  12. 0 0
      dist/static/js/chunk-07c440fa.34fa1b89.js
  13. 0 0
      dist/static/js/chunk-07c440fa.648f1ffe.js
  14. 0 1
      dist/static/js/chunk-2d208495.9454d5b0.js
  15. 0 0
      dist/static/js/chunk-3d9675b3.afccaaf4.js
  16. 0 0
      dist/static/js/chunk-3d9675b3.da57090f.js
  17. 0 0
      dist/static/js/chunk-55bb6aee.b0d83672.js
  18. 0 0
      dist/static/js/chunk-55efc996.945110f1.js
  19. 0 0
      dist/static/js/chunk-6caebfaa.5a7f26e7.js
  20. 0 0
      dist/static/js/chunk-73894ea4.ceaed2f0.js
  21. 0 0
      dist/static/js/chunk-882f79f4.2553d758.js
  22. 0 0
      dist/static/js/chunk-88964510.164b63fb.js
  23. 0 0
      dist/static/js/chunk-98cfdede.2c833a22.js
  24. 0 0
      dist/static/js/chunk-a676d172.a5fd4ba0.js
  25. 0 0
      dist/static/js/chunk-a676d172.e95628fe.js
  26. 0 0
      dist/static/js/chunk-ce93e8ec.cb7e7423.js
  27. 0 0
      dist/static/js/chunk-d78b9348.56b3a6bb.js
  28. 0 0
      dist/static/js/chunk-dbd30552.25cc47cf.js
  29. 0 0
      dist/static/js/chunk-fc73c52a.decd9590.js
  30. 8 0
      src/api/document.js
  31. 68 0
      src/api/knowledge.js
  32. 8 1
      src/api/template.js
  33. 1 0
      src/icons/svg/date.svg
  34. 1 0
      src/icons/svg/sand.svg
  35. 1 0
      src/icons/svg/word.svg
  36. 14 7
      src/router/index.js
  37. 2 2
      src/views/document/components/dataList.vue
  38. 3 3
      src/views/document/create.vue
  39. 2 2
      src/views/document/temList/components/dataList.vue
  40. 55 0
      src/views/knowledgeMenu/category/components/dataList.scss
  41. 307 0
      src/views/knowledgeMenu/category/components/dataList.vue
  42. 3 0
      src/views/knowledgeMenu/category/components/dataSearch.scss
  43. 250 0
      src/views/knowledgeMenu/category/components/dataSearch.vue
  44. 3 0
      src/views/knowledgeMenu/category/components/index.js
  45. 61 0
      src/views/knowledgeMenu/category/knowledgeSet.vue
  46. 72 0
      src/views/knowledgeMenu/index.scss
  47. 222 22
      src/views/knowledgeMenu/knowledgeList.vue
  48. 2 2
      src/views/template/components/dataList.vue

文件差異過大導致無法顯示
+ 0 - 0
dist/index.html


+ 0 - 0
dist/static/css/chunk-38eed32f.7131743c.css → dist/static/css/chunk-55bb6aee.7131743c.css


+ 0 - 0
dist/static/css/chunk-dbd30552.e30e9787.css → dist/static/css/chunk-55efc996.e30e9787.css


+ 0 - 0
dist/static/css/chunk-ce93e8ec.7131743c.css → dist/static/css/chunk-6caebfaa.7131743c.css


+ 1 - 0
dist/static/css/chunk-73894ea4.ed7eb474.css

@@ -0,0 +1 @@
+.ledge_box .data-search[data-v-0f4ea960]{padding:20px 10px 0 10px}.ledge_box .data-list[data-v-0f4ea960]{padding:10px;min-height:200px;position:relative}.ledge_box .data-list .time[data-v-0f4ea960]{font-size:13px;color:#999}.ledge_box .data-list .bottom[data-v-0f4ea960]{margin-top:13px;line-height:12px}.ledge_box .data-list .button[data-v-0f4ea960]{padding:0;float:right}.ledge_box .data-list .image[data-v-0f4ea960]{width:100%;display:block}.ledge_box .data-list .clearfix[data-v-0f4ea960]:after,.ledge_box .data-list .clearfix[data-v-0f4ea960]:before{display:table;content:""}.ledge_box .data-list .clearfix[data-v-0f4ea960]:after{clear:both}.ledge_box .data-list .card_box[data-v-0f4ea960]{padding:20px}.ledge_box .data-list .card_box .header[data-v-0f4ea960]{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.ledge_box .data-list .card-col[data-v-0f4ea960]{margin-bottom:30px}.ledge_box .data-list .card-col .card_box[data-v-0f4ea960]{height:235px}.ledge_box .data-list .card-col .card_box .box_content[data-v-0f4ea960]{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;height:100%}.ledge_box .data-list .card-col .card_box .box_content .content[data-v-0f4ea960]{font-size:24px;line-height:32px;font-weight:600;color:rgba(0,0,0,.8784313725490196);word-break:break-all}.ledge_box .data-list .card-col .card_box .box_content .footer[data-v-0f4ea960]{font-size:12px;font-weight:600;color:rgba(0,0,0,.6509803921568628);vertical-align:middle}

+ 1 - 0
dist/static/css/chunk-d78b9348.7131743c.css

@@ -0,0 +1 @@
+.data-search{padding:20px 10px 0 10px}.data-list .btns,.data-list .page-info{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row}.data-list .page-info{margin-top:10px}.data-list .page-info .opt{width:50%;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.data-list .page-info .opt .pick{width:100px}.data-list .page-info .opt .section{margin-left:10px}.data-list .page-info .page-data{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;-webkit-box-align:center;-ms-flex-align:center;align-items:center;width:100%}.data-list .page-info .page-data .page-item{width:100%}.data-list .page-info .page-data .page-opt{width:100%;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:end;-ms-flex-pack:end;justify-content:flex-end}.project-search{padding:30px;font-size:12px}

+ 0 - 0
dist/static/css/chunk-98cfdede.97a8613a.css → dist/static/css/chunk-fc73c52a.97a8613a.css


文件差異過大導致無法顯示
+ 0 - 0
dist/static/js/app.48f2d593.js


文件差異過大導致無法顯示
+ 0 - 0
dist/static/js/app.8bd632ce.js


文件差異過大導致無法顯示
+ 0 - 0
dist/static/js/chunk-06dc419e.759b8c84.js


文件差異過大導致無法顯示
+ 0 - 0
dist/static/js/chunk-06dc419e.85d66413.js


文件差異過大導致無法顯示
+ 0 - 0
dist/static/js/chunk-07c440fa.34fa1b89.js


文件差異過大導致無法顯示
+ 0 - 0
dist/static/js/chunk-07c440fa.648f1ffe.js


+ 0 - 1
dist/static/js/chunk-2d208495.9454d5b0.js

@@ -1 +0,0 @@
-(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d208495"],{a3c0:function(a,e,n){"use strict";n.r(e);var t=function(){var a=this,e=a.$createElement,n=a._self._c||e;return n("div",{staticClass:"dashboard-container"})},r=[],o=n("5530"),d=(n("caad"),n("2532"),n("2f62")),s={name:"Dashboard",components:{adminDashboard:adminDashboard,editorDashboard:editorDashboard},data:function(){return{currentRole:"adminDashboard"}},computed:Object(o["a"])({},Object(d["b"])(["roles"])),created:function(){this.roles.includes("admin")||(this.currentRole="editorDashboard")}},c=s,i=n("2877"),u=Object(i["a"])(c,t,r,!1,null,null,null);e["default"]=u.exports}}]);

文件差異過大導致無法顯示
+ 0 - 0
dist/static/js/chunk-3d9675b3.afccaaf4.js


文件差異過大導致無法顯示
+ 0 - 0
dist/static/js/chunk-3d9675b3.da57090f.js


文件差異過大導致無法顯示
+ 0 - 0
dist/static/js/chunk-55bb6aee.b0d83672.js


文件差異過大導致無法顯示
+ 0 - 0
dist/static/js/chunk-55efc996.945110f1.js


文件差異過大導致無法顯示
+ 0 - 0
dist/static/js/chunk-6caebfaa.5a7f26e7.js


文件差異過大導致無法顯示
+ 0 - 0
dist/static/js/chunk-73894ea4.ceaed2f0.js


文件差異過大導致無法顯示
+ 0 - 0
dist/static/js/chunk-882f79f4.2553d758.js


文件差異過大導致無法顯示
+ 0 - 0
dist/static/js/chunk-88964510.164b63fb.js


文件差異過大導致無法顯示
+ 0 - 0
dist/static/js/chunk-98cfdede.2c833a22.js


文件差異過大導致無法顯示
+ 0 - 0
dist/static/js/chunk-a676d172.a5fd4ba0.js


文件差異過大導致無法顯示
+ 0 - 0
dist/static/js/chunk-a676d172.e95628fe.js


文件差異過大導致無法顯示
+ 0 - 0
dist/static/js/chunk-ce93e8ec.cb7e7423.js


文件差異過大導致無法顯示
+ 0 - 0
dist/static/js/chunk-d78b9348.56b3a6bb.js


文件差異過大導致無法顯示
+ 0 - 0
dist/static/js/chunk-dbd30552.25cc47cf.js


文件差異過大導致無法顯示
+ 0 - 0
dist/static/js/chunk-fc73c52a.decd9590.js


+ 8 - 0
src/api/document.js

@@ -1,5 +1,13 @@
 import request from '@/utils/request'
 
+/* 无data   /document/pageDocument */
+export function pageDocument(data) {
+  return request({
+    url: '/document/pageDocument',
+    method: 'post',
+    data
+  })
+}
 
 export function searchDocument(data) {
   return request({

+ 68 - 0
src/api/knowledge.js

@@ -0,0 +1,68 @@
+import request from '@/utils/request'
+
+/* 查询知识库列表 */
+export function listBuckets(data) {
+  return request({
+    url: '/minio/listBuckets',
+    method: 'post',
+    data
+  })
+}
+
+/* 新增知识库 */
+export function createBucket(data) {
+  return request({
+    url: '/minio/createBucket',
+    method: 'post',
+    data
+  })
+}
+
+/* 获取指定的内部信息 /minio/getBucketContents */
+
+export function getBucketContents(data) {
+  return request({
+    url: '/minio/getBucketContents',
+    method: 'post',
+    data
+  })
+}
+
+/* 删除内部文件 */
+
+export function deleteFile(data) {
+  return request({
+    url: '/minio/deleteFile',
+    method: 'post',
+    data
+  })
+}
+
+/* 下载  */
+
+export function nameGetUrl(data) {
+  return request({
+    url: '/minio/nameGetUrl',
+    method: 'post',
+    data
+  })
+}
+
+/* 上传 */
+
+export function postUpload(data) {
+  return request({
+    url: '/minio/post',
+    method: 'post',
+    data
+  })
+}
+
+/* 修改文档名称 /minio/renameFile */
+export function renameFile(data) {
+  return request({
+    url: '/minio/renameFile',
+    method: 'post',
+    data
+  })
+}

+ 8 - 1
src/api/template.js

@@ -59,7 +59,14 @@ export function deleteTemplateCategory(data) {
 }
 
 
-
+/* 模块列表 /template/pageTemplate*/
+export function pageTemplate(data) {
+  return request({
+    url: '/template/pageTemplate',
+    method: 'post',
+    data
+  })
+}
 
 export function searchTemplate(data) {
   return request({

+ 1 - 0
src/icons/svg/date.svg

@@ -0,0 +1 @@
+<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1724299094346" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="8773" xmlns:xlink="http://www.w3.org/1999/xlink" width="24" height="24"><path d="M833 128c0-53-43-96-96-96h-16c-53 0-96 43-96 96H400c0-53-43-96-96-96h-16c-53 0-96 43-96 96H64c-35.3 0-64 28.7-64 64v736c0 35.3 28.7 64 64 64h896c35.3 0 64-28.7 64-64V192c0-35.3-28.7-64-64-64H833zM729 96c22.1 0 40 17.9 40 40v80c0 22.1-17.9 40-40 40s-40-17.9-40-40v-80c0-22.1 17.9-40 40-40z m-433 0c22.1 0 40 17.9 40 40v80c0 22.1-17.9 40-40 40s-40-17.9-40-40v-80c0-22.1 17.9-40 40-40z m632 832H96c-17.7 0-32-14.3-32-32V448h896v448c0 17.7-14.3 32-32 32z m32-544H64V224c0-17.7 14.3-32 32-32h96v32c0 53 43 96 96 96h16c53 0 96-43 96-96v-32h225v24c0 57.4 46.6 104 104 104s104-46.6 104-104v-24h95c17.7 0 32 14.3 32 32v160z" p-id="8774" fill="#bfbfbf"></path></svg>

+ 1 - 0
src/icons/svg/sand.svg

@@ -0,0 +1 @@
+<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1724295032956" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5888" width="24" height="24" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M80 512m-80 0a80 80 0 1 0 160 0 80 80 0 1 0-160 0Z" p-id="5889"></path><path d="M512 512m-80 0a80 80 0 1 0 160 0 80 80 0 1 0-160 0Z" p-id="5890"></path><path d="M944 512m-80 0a80 80 0 1 0 160 0 80 80 0 1 0-160 0Z" p-id="5891"></path></svg>

+ 1 - 0
src/icons/svg/word.svg

@@ -0,0 +1 @@
+<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1724299073234" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7661" xmlns:xlink="http://www.w3.org/1999/xlink" width="24" height="24"><path d="M469.5 463h-150c-16.6 0-30-13.4-30-30s13.4-30 30-30h150c16.6 0 30 13.4 30 30s-13.4 30-30 30zM700 583H320c-16.6 0-30-13.4-30-30s13.4-30 30-30h380c16.6 0 30 13.4 30 30s-13.4 30-30 30zM700 703H320c-16.6 0-30-13.4-30-30s13.4-30 30-30h380c16.6 0 30 13.4 30 30s-13.4 30-30 30z" fill="#bfbfbf" p-id="7662"></path><path d="M536.1 173l246.1 246.1c5.6 5.6 8.8 13.3 8.8 21.2V823c0 16.6-13.4 30-30 30H261c-16.6 0-30-13.4-30-30V203c0-16.6 13.4-30 30-30h275.1m24.9-60H231c-33.1 0-60 26.9-60 60v680c0 33.1 26.9 60 60 60h560c33.1 0 60-26.9 60-60V403L561 113z" fill="#bfbfbf" p-id="7663"></path><path d="M621 257.9l85.1 85.1H621v-85.1M561 113v260c0 16.6 13.4 30 30 30h260L561 113z" fill="#bfbfbf" p-id="7664"></path></svg>

+ 14 - 7
src/router/index.js

@@ -297,20 +297,27 @@ export const asyncRoutes = [
     ]
   },
   {
-    path: '/knowledgeMenu',
+    path: '/knowledge',
     component: Layout,
     type:32,
     meta: {
-      title: '知识库管理',
-      icon: '',
+      title: '知识库',
+      icon: 'subject',
       roles: ['admin']
     },
     children: [
       {
-        path: 'knowledgeMenuList',
-        component: () => import('@/views/knowledgeMenu/knowledgeList'),
-        name: 'knowledgeMenuList',
-        meta: { title: '知识库管理',  noCache: true,roles: ['admin'] }
+        path: 'knowledgeMenu/index',
+        component: () => import('@/views/knowledgeMenu/knowledgeList.vue'),
+        name: 'KBM\n',
+        meta: { title: '知识库管理', noCache: true,roles: ['admin'] }
+      },
+      {
+        path: 'category/knowledgeSet',
+        component: () => import('@/views/knowledgeMenu/category/knowledgeSet'),
+        name: 'KBM\n_setting',
+        hidden:true,
+        meta: { title: '知识库配置',  noCache: true ,roles: ['admin']}
       }
     ]
   },

+ 2 - 2
src/views/document/components/dataList.vue

@@ -81,7 +81,7 @@
 </template>
 
 <script>
-import { searchDocument, deleteDocument } from "@/api/document";
+import { pageDocument, deleteDocument } from "@/api/document";
 export default {
   props: {
     queryForm: {
@@ -199,7 +199,7 @@ export default {
     search() {
       let _this = this;
       _this.loading = true; // Set loading to true before API call
-      searchDocument(_this.queryForm)
+      pageDocument(_this.queryForm)
         .then((res) => {
           if (!res) {
             _this.loading = false; // Set loading to false if no response

+ 3 - 3
src/views/document/create.vue

@@ -314,7 +314,7 @@
 <script>
 import { findData } from "@/api/sourceData";
 import utils from "@/utils/fun"; // 方法类
-import { searchDocument } from "@/api/document";
+import { searchDocument,pageDocument } from "@/api/document";
 import menus from "./com/menus";
 import editor from "./com/editor";
 import Attribute from "./com/components/Attribute";
@@ -827,6 +827,7 @@ export default {
     //加载文档信息
     onLoadArticle(e) {
       let _this = this;
+      console.log(e);
       _this.docAttr = {
         id: e.id,
         category_id: e.category_id * 1,
@@ -839,9 +840,8 @@ export default {
         linkProject: e.linkProject,
         projects: e.projects,
       };
-
       _this.coms = JSON.parse(e.data);
-      console.log(_this.coms);
+      
       this.uptadeSearch();
     },
     /* 加载模版信息 */

+ 2 - 2
src/views/document/temList/components/dataList.vue

@@ -75,7 +75,7 @@
 </template>
 
 <script>
-import { searchDocument, deleteDocument } from "@/api/document";
+import { pageDocument, deleteDocument } from "@/api/document";
 export default {
   props: {
     queryForm: {
@@ -193,7 +193,7 @@ export default {
     search() {
       let _this = this;
       _this.loading = true; // Set loading to true before API call
-      searchDocument(_this.queryForm)
+      pageDocument(_this.queryForm)
         .then((res) => {
           if (!res) return;
           _this.dataList = res.data.dataList.filter(

+ 55 - 0
src/views/knowledgeMenu/category/components/dataList.scss

@@ -0,0 +1,55 @@
+
+.data-list{
+
+
+  .btns{
+    display:flex;
+    flex-direction: row;
+  }
+
+
+
+
+  .page-info{
+    display:flex;
+    flex-direction: row;
+    margin-top:10px;
+    .opt{
+      width:50%;
+      display:flex;
+      flex-direction:row;
+      justify-content: flex-start;
+      align-items: center;
+
+      .pick{
+        width:100px;
+
+      }
+      .section{
+        margin-left:10px;
+      }
+    }
+
+    .page-data{
+
+      display:flex;
+      flex-direction: row;
+      justify-content: space-between;
+      align-items: center;
+      width:100%;
+      .page-item{
+          width:100%;
+          // border:1px solid red;
+      }
+      .page-opt{
+        width:100%;
+        // border:1px solid red;
+        display: flex;
+        justify-content: flex-end;
+      }
+    }
+
+
+  }
+
+}

+ 307 - 0
src/views/knowledgeMenu/category/components/dataList.vue

@@ -0,0 +1,307 @@
+<template>
+  <div class="data-list" v-loading="loading" element-loading-text="加载中...">
+    <el-table
+      :data="dataList"
+      style="width: 100%"
+      header-row-class-name="headerBg"
+      empty-text="没有模板信息"
+    >
+      <el-table-column prop="id" label="ID" align="center" width="80" />
+      <el-table-column prop="object_name" label="文件名称" align="center" />
+      <el-table-column prop="size" label="分块数" align="center" />
+      <el-table-column prop="last_modified" label="上传时间" align="center" />
+      <el-table-column prop="" label="解析方法" align="center" />
+      <el-table-column prop="createTime" label="启用" align="center" />
+      <el-table-column prop="status" label="解析状态" align="center">
+        <template #default="scope">
+          <div v-if="scope.row.status == 5">启用</div>
+          <div v-if="scope.row.status == 6">停用</div>
+        </template>
+      </el-table-column>
+      <el-table-column label="操作" align="center" width="300"><!-- editWidth() -->
+        <template #default="scope">
+          <div class="btns">
+            <el-button
+              type="primary"
+              size="small"
+              v-if="allowEdit"
+              @click="btnEdit(scope.row.object_name)"
+              ><svg-icon icon-class="edit" />修改文件名</el-button
+            >
+            <el-button
+              type="primary"
+              size="small"
+              v-if="allowEdit"
+              @click="btnDown(scope.row.object_name)"
+              ><svg-icon icon-class="edit" />下载</el-button
+            >
+            <el-button
+              type="danger"
+              size="small"
+              v-if="allowDelete"
+              @click="btnDelete(scope.row.object_name)"
+              ><svg-icon icon-class="delete" />删除</el-button
+            >
+          </div>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <div class="page-info">
+      <el-pagination
+        :currentPage="queryForm.page"
+        :page-size="queryForm.pageSize"
+        :total="recordCount"
+        :page-count="pageTotal"
+        background
+        layout="prev, pager, next"
+        @current-change="ChangePage"
+      >
+      </el-pagination>
+    </div>
+    <el-dialog
+      title="修改名称"
+      :visible.sync="dialogVisible"
+      width="30%"
+      :before-close="handleClose"
+    >
+      <el-form :model="wordForm" ref="wordRef" :rules="wordRules">
+        <el-form-item label="文件名称:" prop="new_name">
+          <el-input
+            v-model="wordForm.new_name"
+            placeholder="请输入文件名称"
+          ></el-input>
+        </el-form-item>
+      </el-form>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="handleClose">取 消</el-button>
+        <el-button type="primary" @click="submitBuck">确 定</el-button>
+      </span>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { getBucketContents, deleteFile, nameGetUrl,renameFile } from "@/api/knowledge";
+export default {
+  props: {
+    queryForm: {
+      type: Object,
+      default: () => {
+        return {
+          page: 1,
+          pageSize: 10,
+          bucket_name: "",
+        };
+      },
+    },
+    allowEdit: {
+      type: Boolean,
+      default: false,
+    },
+    allowDelete: {
+      type: Boolean,
+      default: false,
+    },
+  },
+  watch: {
+    queryForm: {
+      handler: function (val) {
+        this.search();
+      },
+      // immediate: true,//立即执行
+      deep: true,
+    },
+  },
+  data() {
+    // 自定义验证函数
+    const validateBucketName = (rule, value, callback) => {
+      const regex = /^[a-z0-9-]{3,63}$/;
+      if (!regex.test(value)) {
+        callback(
+          new Error(
+            "名称必须在 3-63 个字符之间,只能包含小写字母、数字和连字符"
+          )
+        );
+      } else {
+        callback();
+      }
+    };
+    return {
+      loading: false,
+      dialogVisible: false, //控制产品审核
+      currentDataId: 0,
+      recordCount: 0,
+      pageTotal: 1,
+      dataList: [],
+      currentData: {},
+      dialogVisible: false,
+      wordForm: {
+        bucket_name: this.$route.query.bucket_name,
+        object_name: "",
+        new_name: "",
+      },
+      wordRules: {
+        new_name: [
+          { required: true, message: "请输入文件名称", trigger: "blur" },
+          { validator: validateBucketName, trigger: "blur" },
+        ],
+      },
+    };
+  },
+  mounted() {
+    this.search();
+  },
+  methods: {
+    editWidth() {
+      if (this.allowDelete && this.allowEdit) {
+        return 200;
+      }
+      if (this.allowDelete || this.allowEdit) {
+        return 120;
+      }
+      return 100;
+    },
+
+    onFocusVal(e) {
+      let _this = this;
+      _this.currentDataId = e.target.dataset.id;
+    },
+
+    onChangeVal(e) {
+      let _this = this;
+      let par = {
+        id: _this.currentDataId,
+        val: e,
+      };
+    },
+
+    btnDelete(e) {
+      let _this = this;
+      let par = {
+        bucket_name: this.$route.query.bucket_name,
+        object_name: e,
+      };
+      _this
+        .$confirm("您是否确认删除该记录?", "提示", {
+          confirmButtonText: "确认",
+          cancelButtonText: "取消",
+          type: "warning",
+        })
+        .then((res) => {
+          deleteFile(par).then((res) => {
+            _this.search();
+          });
+        })
+        .catch(() => {});
+    },
+
+    searchData() {
+      let _this = this;
+      _this.dialogVisible = false;
+      _this.search();
+    },
+    /* 关闭 */
+    handleClose(done) {
+      done();
+    },
+    /* 修改文件名 */
+    btnEdit(e) {
+      this.wordForm.object_name = e;
+      this.dialogVisible = true;
+    },
+    /* 提交 */
+    submitBuck() {
+      this.$refs.wordRef.validate((valid) => {
+        if (valid) {
+          renameFile(this.wordForm).then((res) => {
+            if (res.status !== 200) return;
+            this.search()
+            this.dialogVisible = false;
+            this.wordForm = {};
+          });
+        } else {
+          this.$message.error("请填写文档名称");
+        }
+      });
+    },
+
+    //编辑
+    btnDown(e) {
+      nameGetUrl({
+        bucket_name: this.$route.query.bucket_name,
+        object_name: e,
+      })
+        .then((res) => {
+          if (res.status !== 200) {
+            this.$message.error("获取下载链接失败");
+            return;
+          }
+
+          // 使用 fetch 来获取文件内容
+          fetch(res.data.url)
+            .then((response) => response.blob())
+            .then((blob) => {
+              // 创建一个 Blob URL
+              const url = window.URL.createObjectURL(blob);
+
+              // 创建一个隐藏的a标签
+              const link = document.createElement("a");
+              link.href = url;
+              link.download = e;
+
+              // 添加到body并触发点击
+              document.body.appendChild(link);
+              link.click();
+
+              // 清理
+              setTimeout(() => {
+                document.body.removeChild(link);
+                window.URL.revokeObjectURL(url);
+              }, 100);
+            })
+            .catch((error) => {
+              console.error("下载出错:", error);
+              this.$message.error("下载失败,请稍后重试");
+            });
+        })
+        .catch((error) => {
+          console.error("获取下载链接出错:", error);
+          this.$message.error("获取下载链接失败,请稍后重试");
+        });
+    },
+
+    handleClose() {
+      let _this = this;
+      _this.currentData = {};
+      _this.dialogVisible = false;
+    },
+
+    //搜索
+    search() {
+      let _this = this;
+      _this.loading = true; // Set loading to true before API call
+      getBucketContents(_this.queryForm)
+        .then((res) => {
+          if (res.status !== 200) return;
+          _this.dataList = res.data.files;
+          _this.pageTotal = res.data.total_count;
+          _this.loading = false; // Set loading to false after data is processed
+        })
+        .catch(() => {
+          _this.loading = false; // Set loading to false if there's an error
+        });
+    },
+    //修改分页
+    ChangePage(e) {
+      let _this = this;
+      _this.queryForm.page = e;
+      _this.search();
+    },
+  },
+};
+</script>
+
+<style lang="scss">
+@import "./dataList.scss";
+</style>

+ 3 - 0
src/views/knowledgeMenu/category/components/dataSearch.scss

@@ -0,0 +1,3 @@
+.data-search{ 
+  padding:20px 10px 0px 10px;
+}

+ 250 - 0
src/views/knowledgeMenu/category/components/dataSearch.vue

@@ -0,0 +1,250 @@
+<template>
+  <div class="data-search">
+    <el-form :inline="true" :model="queryForm" class="demo-form-inline">
+      <el-form-item label="文件名:">
+        <el-input
+          v-model="queryForm.object_name"
+          placeholder="请填写文件名"
+        ></el-input>
+      </el-form-item>
+
+      <!--  <el-form-item label="所属分类:">
+          <el-select v-model="queryForm.category_id" clearable class="m-2" placeholder="请选择分类" size="large">
+              <el-option
+                v-for="item in categoryList"
+                :key="item.id"
+                :label="item.name"
+                :value="item.id"
+              />
+            </el-select>
+        </el-form-item>
+        <el-form-item label="文档状态:">
+          <el-select v-model="queryForm.status" class="m-2" placeholder="请选择文档状态" size="large">
+              <el-option
+                v-for="item in statusOptions"
+                :key="item.value"
+                :label="item.label"
+                :value="item.value"
+              />
+            </el-select>
+        </el-form-item> -->
+
+      <el-form-item>
+        <el-button type="primary" @click="onSubmit">
+          <svg-icon icon-class="search" /> 搜索</el-button
+        >
+      </el-form-item>
+      <el-form-item>
+        <el-popover placement="bottom" trigger="click">
+          <el-button @click="addDocument">本地文件</el-button>
+          <el-button @click="newFile">新建空文件</el-button>
+          <el-button
+            type="primary"
+            class="el-icon-circle-plus-outline"
+            slot="reference"
+          >
+            新增文件</el-button
+          >
+        </el-popover>
+      </el-form-item>
+    </el-form>
+    <el-dialog
+      title="创建知识库"
+      :visible.sync="dialogVisible"
+      width="30%"
+      :before-close="handleClose"
+    >
+      <el-form :model="creatForm" ref="creatRef" :rules="creatRules">
+        <el-form-item label="文件名称:" prop="bucket_name">
+          <el-input
+            v-model="creatForm.bucket_name"
+            placeholder="请输入文件名称"
+          ></el-input>
+        </el-form-item>
+      </el-form>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="handleClose">取 消</el-button>
+        <el-button type="primary" @click="submitBuck">确 定</el-button>
+      </span>
+    </el-dialog>
+    <el-dialog
+      title="上传文件"
+      :visible.sync="uploadVisible"
+      width="30%"
+      :before-close="handleUploadClose"
+    >
+      <el-form :model="uploadForm" ref="uploadRef" :rules="uploadRules">
+        <el-form-item>
+          <el-upload
+            class="upload-demo"
+            drag
+            :action="url + '/minio/post'"
+            :data="{ bucket_name: queryForm.bucket_name }"
+            multiple
+            :on-change="handleFileChange"
+            :file-list="fileList"
+            :on-success="handleAvatarSuccess"
+          >
+            <i class="el-icon-upload"></i>
+            <div class="el-upload__text">
+              将文件拖到此处,或<em>点击上传</em>
+            </div>
+            <div class="el-upload__tip" slot="tip">
+              只能上传jpg/png文件,且不超过500kb
+            </div>
+          </el-upload>
+        </el-form-item>
+      </el-form>
+      <!--  <span slot="footer" class="dialog-footer">
+        <el-button @click="handleUploadClose">取 消</el-button>
+        <el-button type="primary" @click="submitUpload">确 定</el-button>
+      </span> -->
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { getBucketContents, postUpload } from "@/api/knowledge";
+export default {
+  props: {
+    queryForm: {
+      type: Object,
+      default: () => {
+        return {
+          page: 1,
+          pageSize: 10,
+          bucket_name: "",
+          object_name: "",
+        };
+      },
+    },
+  },
+  data() {
+    // 自定义验证函数
+    const validateBucketName = (rule, value, callback) => {
+      const regex = /^[a-z0-9-]{3,63}$/;
+      if (!regex.test(value)) {
+        callback(
+          new Error(
+            "名称必须在 3-63 个字符之间,只能包含小写字母、数字和连字符"
+          )
+        );
+      } else {
+        callback();
+      }
+    };
+    return {
+      statusOptions: [
+        {
+          value: "",
+          label: "请选择状态",
+        },
+        {
+          value: 5,
+          label: "启用",
+        },
+        {
+          value: 6,
+          label: "停用",
+        },
+      ],
+      dialogVisible: false,
+      categoryList: [],
+      creatForm: {
+        bucket_name: "",
+      }, //知识库名称
+      creatRules: {
+        bucket_name: [
+          { required: true, message: "请输入知识库名称", trigger: "blur" },
+          { validator: validateBucketName, trigger: "blur" },
+        ],
+      },
+      uploadVisible: false,
+      uploadRules: {},
+      uploadForm: {},
+      fileList: [],
+      url: "",
+    };
+  },
+  mounted() {
+    this.url = process.env.VUE_APP_BASE_API;
+    this.queryForm.bucket_name = this.$route.query.bucket_name;
+  },
+  methods: {
+    onCreate(e) {
+      this.dialogVisible = true;
+    },
+    //搜索
+    onSubmit() {
+      this.$emit("bindSetQuery", this.$props.queryForm);
+    },
+    /* 创建模版 */
+    addDocument() {
+      this.uploadVisible = true;
+    },
+    /* 新建空文件 */
+    newFile() {},
+    /* 关闭 */
+    handleClose(done) {
+      done();
+    },
+    /* 提交 */
+    submitBuck() {
+      this.$refs.creatRef.validate((valid) => {
+        if (valid) {
+          createBucket(this.creatForm).then((res) => {
+            if (res.status !== 200) return;
+            this.dialogVisible = false;
+            this.onSubmit();
+            this.creatForm = {};
+          });
+        } else {
+          this.$message.error("请填写知识库名称");
+        }
+      });
+    },
+    /* 上传关闭 */
+    handleUploadClose(done) {
+      done();
+    },
+    /*  */
+    handleFileChange(file, fileList) {
+      console.log(file);
+      this.fileList = fileList.map((f) => f.raw);
+    },
+
+    handleRemove(file, fileList) {
+      this.fileList = fileList;
+    },
+    handleAvatarSuccess(res, file) {
+      this.$emit("bindSetQuery", this.$props.queryForm);
+    },
+
+    submitUpload() {
+      // Here you can implement the logic to upload the files
+      console.log("Files to upload:", this.fileList);
+      // After successful upload, you may want to close the dialog and clear the file list
+      this.uploadVisible = false;
+      this.fileList = [];
+    },
+
+    handleUploadClose() {
+      this.uploadVisible = false;
+      this.fileList = [];
+    },
+    submitUpload() {
+      this.fileList.map((el) => {
+        postUpload({ bucket_name: this.queryForm.bucket_name, file: el }).then(
+          (res) => {
+            console.log(res);
+          }
+        );
+      });
+    },
+  },
+};
+</script>
+
+<style lang="scss">
+@import "./dataSearch.scss";
+</style>

+ 3 - 0
src/views/knowledgeMenu/category/components/index.js

@@ -0,0 +1,3 @@
+export { default as dataSearch } from './dataSearch'
+export { default as dataList } from './dataList'
+ 

+ 61 - 0
src/views/knowledgeMenu/category/knowledgeSet.vue

@@ -0,0 +1,61 @@
+<template>
+    <div class="project-search">
+      <dataSearch @bindSetQuery="setQuery"></dataSearch>
+      <dataList
+        :queryForm="queryForm"
+        :allowEdit="checkAuth('/document/update')"
+        :allowDelete="checkAuth('/document/delete')"
+      ></dataList>
+    </div>
+  </template>
+    
+    <script>
+  import { mapGetters } from "vuex";
+  import { dataSearch, dataList } from "./components";
+  export default {
+    components: {
+      dataSearch,
+      dataList,
+    },
+    computed: {
+      ...mapGetters(["roleInfo", "authList"]),
+    },
+  
+    data() {
+      return {
+        queryForm: {
+          page: 1,
+          pageSize: 10,
+          bucket_name:''
+        },
+      };
+    },
+    mounted(){
+      this.queryForm.bucket_name=this.$route.query.bucket_name
+    },
+    methods: {
+      checkAuth(path) {
+        if (this.roleInfo.is_admin == 1) {
+          return true;
+        }
+        /* let auth=this.authList.filter(o=>o.type==999 && o.path==path);
+            if(auth.length>0){
+              return true;
+            } */
+        return true;
+      },
+  
+      setQuery(e) {
+        this.queryForm = e;
+      },
+    },
+  };
+  </script>
+    
+    <style lang="scss">
+  .project-search {
+    padding: 30px;
+    font-size: 12px;
+  }
+  </style>
+    

+ 72 - 0
src/views/knowledgeMenu/index.scss

@@ -0,0 +1,72 @@
+.ledge_box{
+    .data-search{
+        padding:20px 10px 0px 10px;
+    }
+    .data-list{
+        padding: 10px;
+        min-height: 200px; // 确保在没有内容时也有足够的高度显示加载动画
+        position: relative; // 为加载动画提供定位上下文
+        .time {
+            font-size: 13px;
+            color: #999;
+          }
+          
+          .bottom {
+            margin-top: 13px;
+            line-height: 12px;
+          }
+        
+          .button {
+            padding: 0;
+            float: right;
+          }
+        
+          .image {
+            width: 100%;
+            display: block;
+          }
+        
+          .clearfix:before,
+          .clearfix:after {
+              display: table;
+              content: "";
+          }
+          
+          .clearfix:after {
+              clear: both
+          }
+          .card_box{
+            padding: 20px;
+            .header{
+                display: flex;
+                justify-content: space-between;
+                align-items: center;
+            }
+          }
+          .card-col{
+            margin-bottom: 30px;
+            .card_box{
+                height: 235px;
+                .box_content{
+                    display: flex;
+                    flex-direction: column;
+                    justify-content: space-between;
+                    height: 100%;
+                    .content{
+                        font-size: 24px;
+                        line-height: 32px;
+                        font-weight: 600;
+                        color: #000000e0;
+                        word-break: break-all;
+                    }
+                    .footer{
+                        font-size: 12px;
+                        font-weight: 600;
+                        color: #000000a6;
+                        vertical-align: middle;
+                    }
+                }
+            }
+          }
+    }
+}

+ 222 - 22
src/views/knowledgeMenu/knowledgeList.vue

@@ -1,31 +1,231 @@
 <template>
-    <div class="dashboard-container">
-      
+  <div class="ledge_box">
+    <!-- 搜索创建dom块 -->
+    <div class="data-search">
+      <el-form :inline="true" :model="queryForm" class="demo-form-inline">
+        <!--  <el-form-item label="角色名称:">
+          <el-input v-model="queryForm.name" placeholder="角色名称"></el-input>
+        </el-form-item>
+        <el-form-item label="角色状态:">
+          <el-select
+            v-model="queryForm.status"
+            class="m-2"
+            placeholder="请选择角色状态"
+            size="large"
+          >
+            <el-option
+              v-for="item in statusOptions"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value"
+            />
+          </el-select>
+        </el-form-item> -->
+        <el-form-item>
+          <!--  <el-button type="primary" @click="onSubmit">
+            <svg-icon icon-class="search" /> 搜索</el-button> -->
+          <el-button type="success" @click="onCreate">
+            <svg-icon icon-class="edit" />创建知识库</el-button
+          >
+        </el-form-item>
+      </el-form>
     </div>
-  </template>
+    <!-- 卡片模块 -->
+    <div class="data-list" v-loading="loading" element-loading-text="加载中...">
+      <el-row >
+        <el-col
+          :span="4"
+          v-for="(item, index) in buckList"
+          :key="index"
+          :offset="index > 0 && index % 5 !== 0 ? 1 : 0"
+          class="card-col"
+        >
+          <el-card :body-style="{ padding: '0px' }" shadow="never">
+            <div class="card_box">
+              <div class="box_content"  @click="getInfo(item)">
+                <div class="header">
+                  <div class="header_left">
+                    <svg-icon
+                      icon-class="header"
+                      style="width: 34px; height: 34px"
+                    />
+                  </div>
+                  <el-popover placement="bottom" trigger="hover">
+                    <!-- <p style="cursor: pointer;">删除 <svg-icon icon-class="drash"></svg-icon></p> -->
+                    <el-button icon="el-icon-delete" @click="delect(item)"
+                      >删除</el-button
+                    >
+                    <div class="header_right" slot="reference">
+                      <svg-icon
+                        icon-class="sand"
+                        style="width: 24px; height: 30px"
+                      />
+                    </div>
+                  </el-popover>
+                </div>
+                <div class="content">
+                  {{ item.bucket_name }}
+                </div>
+                <div class="footer">
+                  <div class="file">
+                    <svg-icon
+                      icon-class="word"
+                      style="width: 18px; height: 18px; filter: grayscale(100%)"
+                    />
+                    {{ item.file_count }}
+                  </div>
+                  <div class="date">
+                    <svg-icon
+                      icon-class="date"
+                      style="width: 18px; height: 18px; filter: grayscale(100%)"
+                    />
+                    {{ item.creation_date }}
+                  </div>
+                </div>
+              </div>
+            </div>
+          </el-card>
+        </el-col>
+      </el-row>
+    </div>
+    <!-- 创建弹窗 -->
+    <el-dialog
+      title="创建知识库"
+      :visible.sync="dialogVisible"
+      width="30%"
+      :before-close="handleClose"
+    >
+      <el-form :model="creatForm" ref="creatRef" :rules="creatRules">
+        <el-form-item label="知识库名称:" prop="bucket_name">
+          <el-input
+            v-model="creatForm.bucket_name"
+            placeholder="请输入内容"
+          ></el-input>
+        </el-form-item>
+      </el-form>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="handleClose">取 消</el-button>
+        <el-button type="primary" @click="submitBuck">确 定</el-button>
+      </span>
+    </el-dialog>
+  </div>
+</template>
   
-  <script>
-  import { mapGetters } from 'vuex'
+<script>
+import { listBuckets, createBucket } from "@/api/knowledge";
+import { mapGetters } from "vuex";
 
-  
-  export default {
-    name: 'Dashboard',
-    components: { adminDashboard, editorDashboard },
-    data() {
-      return {
-        currentRole: 'adminDashboard'
+export default {
+  name: "Dashboard",
+  data() {
+    // 自定义验证函数
+    const validateBucketName = (rule, value, callback) => {
+      const regex = /^[a-z0-9-]{3,63}$/;
+      if (!regex.test(value)) {
+        callback(new Error('名称必须在 3-63 个字符之间,只能包含小写字母、数字和连字符'));
+      } else {
+        callback();
       }
+    };
+    return {
+      loading: true,
+      queryForm: {},
+      buckList: [],
+      visible: false,
+      dialogVisible: false,
+      creatForm: {
+        bucket_name: "",
+      }, //知识库名称
+      creatRules: {
+        bucket_name: [
+          { required: true, message: "请输入知识库名称", trigger: "blur" },
+          { validator: validateBucketName, trigger: 'blur' }
+        ],
+      },
+    };
+  },
+  computed: {
+    ...mapGetters(["roles"]),
+  },
+  created() {},
+  mounted() {
+    this.onSubmit();
+  },
+  methods: {
+    /* 搜索创建模块 */
+    onCreate(e) {
+      this.creatForm = {
+        bucket_name:''
+      };
+      this.dialogVisible = true;
     },
-    computed: {
-      ...mapGetters([
-        'roles'
-      ])
+    onClose(e) {
+      this.dialogVisible = false;
+      this.onSubmit();
     },
-    created() {
-      if (!this.roles.includes('admin')) {
-        this.currentRole = 'editorDashboard'
-      }
+    //搜索
+    onSubmit() {
+      this.loading = true;
+      listBuckets({})
+        .then((res) => {
+          if (res.status !== 200) return;
+          res.data.map((el) => {
+            el.visible = false;
+          });
+          this.buckList = res.data;
+        })
+        .finally(() => {
+          this.loading = false;
+        });
+    },
+    /* 删除 */
+    delect(val) {
+      this.$confirm("此操作将永久删除该文件, 是否继续?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(() => {
+          this.$message({
+            type: "success",
+            message: "删除成功!",
+          });
+        })
+        .catch(() => {
+          this.$message({
+            type: "info",
+            message: "已取消删除",
+          });
+        });
+    },
+    /* 关闭弹窗 */
+    handleClose(done) {
+      this.creatForm = {};
+      done();
+    },
+    /* 创建知识库 */
+    submitBuck() {
+      this.$refs.creatRef.validate((valid) => {
+        if (valid) {
+          createBucket(this.creatForm).then((res) => {
+            if (res.status !== 200) return;
+            this.dialogVisible = false;
+            this.onSubmit();
+            this.creatForm = {};
+          });
+        } else {
+          this.$message.error("请填写知识库名称");
+        }
+      });
+    },
+    /* 跳转到详细页面 */
+    getInfo(item){
+      this.$router.push({path:'/knowledge/category/knowledgeSet',query:{bucket_name:item.bucket_name}});
     }
-  }
-  </script>
+  },
+};
+</script>
+  <style lang="scss" scoped>
+@import "./index.scss";
+</style>
   

+ 2 - 2
src/views/template/components/dataList.vue

@@ -49,7 +49,7 @@
 <script>
   import { mapGetters } from 'vuex'
 
-  import{deleteTemplate,searchTemplate} from'@/api/template';
+  import{deleteTemplate,pageTemplate} from'@/api/template';
   import dataInfo from './dataInfo.vue';
   import elDragDialog from '@/directive/el-drag-dialog'
   export default{
@@ -158,7 +158,7 @@
       //搜索
       search(){
         let _this=this;
-        searchTemplate(_this.queryForm).then(res=>{
+        pageTemplate(_this.queryForm).then(res=>{
           if(!res)return;
           _this.dataList=res.data.dataList;
           _this.recordCount=res.data.totalRecord;

部分文件因文件數量過多而無法顯示