Sfoglia il codice sorgente

添加饼图并打包轻良

yangg 8 mesi fa
parent
commit
235f58bc9f
59 ha cambiato i file con 337 aggiunte e 125 eliminazioni
  1. 0 0
      dist/index.html
  2. 0 0
      dist/static/css/app.55819186.css
  3. 0 0
      dist/static/css/chunk-050dfb95.775a21e3.css
  4. 0 0
      dist/static/css/chunk-10bfc27e.6044f932.css
  5. 1 0
      dist/static/css/chunk-11ff1a32.ae66b006.css
  6. 0 0
      dist/static/css/chunk-3d3efa1e.58b6579a.css
  7. 0 1
      dist/static/css/chunk-50c331cc.71210f15.css
  8. 0 0
      dist/static/css/chunk-567d7f88.94e5473b.css
  9. 0 0
      dist/static/css/chunk-647b97bd.50fc024e.css
  10. 0 0
      dist/static/css/chunk-712c0160.1d59ca2f.css
  11. 0 0
      dist/static/css/chunk-87faa9d8.3b7e1ecc.css
  12. 1 0
      dist/static/css/chunk-ec77a450.41449618.css
  13. 0 0
      dist/static/css/chunk-libs.8a906988.css
  14. 0 0
      dist/static/js/app.0998571e.js
  15. 0 0
      dist/static/js/app.dabf1927.js
  16. 1 1
      dist/static/js/chunk-050dfb95.18b393d6.js
  17. 0 0
      dist/static/js/chunk-0ec56e2a.55afe8c8.js
  18. 0 0
      dist/static/js/chunk-10bfc27e.e798ff81.js
  19. 1 0
      dist/static/js/chunk-11ff1a32.da4246f8.js
  20. 0 0
      dist/static/js/chunk-138f7583.c5a8883a.js
  21. 0 0
      dist/static/js/chunk-15506e7b.8417e95e.js
  22. 0 0
      dist/static/js/chunk-21725832.4e5d4ebd.js
  23. 0 0
      dist/static/js/chunk-2d0d3705.838b020d.js
  24. 0 0
      dist/static/js/chunk-35464144.06b6d76b.js
  25. 0 0
      dist/static/js/chunk-3bf9b75a.353a51e8.js
  26. 0 0
      dist/static/js/chunk-3d3efa1e.d5a3da78.js
  27. 0 0
      dist/static/js/chunk-44eee83d.a824e28a.js
  28. 0 0
      dist/static/js/chunk-4ac7f82e.05cbcffd.js
  29. 0 1
      dist/static/js/chunk-50c331cc.543f4f81.js
  30. 0 0
      dist/static/js/chunk-52f685c2.8e5b8e14.js
  31. 0 0
      dist/static/js/chunk-567d7f88.8000989e.js
  32. 0 0
      dist/static/js/chunk-57d45b95.d715599a.js
  33. 0 0
      dist/static/js/chunk-5a3bdf57.f96a054d.js
  34. 0 0
      dist/static/js/chunk-647b97bd.e3ffac00.js
  35. 0 0
      dist/static/js/chunk-6a80e4ca.5bc8e6ad.js
  36. 0 0
      dist/static/js/chunk-6ddf6871.2e1a7a38.js
  37. 0 0
      dist/static/js/chunk-712c0160.4836b10d.js
  38. 0 0
      dist/static/js/chunk-7a88741c.2e893504.js
  39. 0 0
      dist/static/js/chunk-7dbc1954.f1c0b808.js
  40. 0 0
      dist/static/js/chunk-87faa9d8.b88848df.js
  41. 0 0
      dist/static/js/chunk-8e8fa6da.ea062c6b.js
  42. 0 0
      dist/static/js/chunk-9235c1ae.2513ea0a.js
  43. 0 0
      dist/static/js/chunk-a577192a.c8743a89.js
  44. 0 0
      dist/static/js/chunk-a912d4ba.e28421c0.js
  45. 0 0
      dist/static/js/chunk-ad361d30.112fa738.js
  46. 0 0
      dist/static/js/chunk-c5d7799a.b8bef5a1.js
  47. 0 0
      dist/static/js/chunk-d09dbc1a.24b73683.js
  48. 0 0
      dist/static/js/chunk-d4c547ca.07306676.js
  49. 0 0
      dist/static/js/chunk-ec77a450.b7c6967a.js
  50. 0 0
      dist/static/js/chunk-libs.3f747fa8.js
  51. 0 0
      dist/static/js/chunk-libs.76f3ffd8.js
  52. 20 1
      src/api/knowledge.js
  53. 1 1
      src/components/webAi/js/ChatBox.js
  54. 2 0
      src/main.js
  55. 136 95
      src/views/dashboard/admin/components/BarChart.vue
  56. 94 1
      src/views/dashboard/admin/components/PieChart.vue
  57. 22 2
      src/views/dashboard/admin/components/recentFile.vue
  58. 51 16
      src/views/dashboard/admin/index.vue
  59. 7 6
      src/views/document/create.vue

File diff suppressed because it is too large
+ 0 - 0
dist/index.html


File diff suppressed because it is too large
+ 0 - 0
dist/static/css/app.55819186.css


+ 0 - 0
dist/static/css/chunk-7c02fbbc.775a21e3.css → dist/static/css/chunk-050dfb95.775a21e3.css


+ 0 - 0
dist/static/css/chunk-23d4d74d.e30e9787.css → dist/static/css/chunk-10bfc27e.6044f932.css


+ 1 - 0
dist/static/css/chunk-11ff1a32.ae66b006.css

@@ -0,0 +1 @@
+[data-v-69eb01f0] .chat-container .header{width:98%;margin:10px 20px}[data-v-69eb01f0] .messages{width:98%;margin-bottom:0;height:calc(100vh - 120px)}[data-v-69eb01f0] .input-container{max-width:1200px}[data-v-69eb01f0] .title{width:98%;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}

+ 0 - 0
dist/static/css/chunk-15506e7b.d40db7bc.css → dist/static/css/chunk-3d3efa1e.58b6579a.css


+ 0 - 1
dist/static/css/chunk-50c331cc.71210f15.css

@@ -1 +0,0 @@
-[data-v-1d6fd656] .chat-container .header{width:98%;margin:10px 20px}[data-v-1d6fd656] .messages{width:98%;margin-bottom:0;height:calc(100vh - 120px)}[data-v-1d6fd656] .input-container{max-width:1200px}[data-v-1d6fd656] .title{width:98%;margin:0 20px 15px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}

File diff suppressed because it is too large
+ 0 - 0
dist/static/css/chunk-567d7f88.94e5473b.css


File diff suppressed because it is too large
+ 0 - 0
dist/static/css/chunk-647b97bd.50fc024e.css


+ 0 - 0
dist/static/css/chunk-68925985.1d59ca2f.css → dist/static/css/chunk-712c0160.1d59ca2f.css


File diff suppressed because it is too large
+ 0 - 0
dist/static/css/chunk-87faa9d8.3b7e1ecc.css


+ 1 - 0
dist/static/css/chunk-ec77a450.41449618.css

@@ -0,0 +1 @@
+.midd-page[data-v-374fa465]{padding:20px}.el-icon-edit[data-v-374fa465]{font-size:14px;color:#409eff}

File diff suppressed because it is too large
+ 0 - 0
dist/static/css/chunk-libs.8a906988.css


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/app.0998571e.js


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/app.dabf1927.js


File diff suppressed because it is too large
+ 1 - 1
dist/static/js/chunk-050dfb95.18b393d6.js


+ 0 - 0
dist/static/js/chunk-0ec56e2a.287a460b.js → dist/static/js/chunk-0ec56e2a.55afe8c8.js


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/chunk-10bfc27e.e798ff81.js


+ 1 - 0
dist/static/js/chunk-11ff1a32.da4246f8.js

@@ -0,0 +1 @@
+(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-11ff1a32"],{"04f8":function(n,t,o){},"7f5f":function(n,t,o){"use strict";o("04f8")},c8cf:function(n,t,o){"use strict";o.r(t);var e=function(){var n=this,t=n.$createElement,o=n._self._c||t;return o("div",[o("ChatBox")],1)},a=[],c=o("c3b3"),f=o("ecd9"),i={components:{ChatBox:c["default"],LoginModal:f["default"]},data:function(){return{showLoginModal:!1}},mounted:function(){},methods:{checkAIData:function(){var n=localStorage.getItem("AIData");this.showLoginModal=!n},handleLoginSuccess:function(){this.showLoginModal=!1}}},u=i,s=(o("7f5f"),o("2877")),l=Object(s["a"])(u,e,a,!1,null,"69eb01f0",null);t["default"]=l.exports}}]);

+ 0 - 0
dist/static/js/chunk-138f7583.654f8592.js → dist/static/js/chunk-138f7583.c5a8883a.js


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/chunk-15506e7b.8417e95e.js


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/chunk-21725832.4e5d4ebd.js


+ 0 - 0
dist/static/js/chunk-2d0d3705.ccd423b1.js → dist/static/js/chunk-2d0d3705.838b020d.js


+ 0 - 0
dist/static/js/chunk-35464144.6adfa6c3.js → dist/static/js/chunk-35464144.06b6d76b.js


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/chunk-3bf9b75a.353a51e8.js


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/chunk-3d3efa1e.d5a3da78.js


+ 0 - 0
dist/static/js/chunk-44eee83d.845e1a51.js → dist/static/js/chunk-44eee83d.a824e28a.js


+ 0 - 0
dist/static/js/chunk-4ac7f82e.42c8f101.js → dist/static/js/chunk-4ac7f82e.05cbcffd.js


+ 0 - 1
dist/static/js/chunk-50c331cc.543f4f81.js

@@ -1 +0,0 @@
-(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-50c331cc"],{"3ec3":function(c,n,t){"use strict";t("dacc")},c8cf:function(c,n,t){"use strict";t.r(n);var o=function(){var c=this,n=c.$createElement,t=c._self._c||n;return t("div",[t("ChatBox")],1)},e=[],a=t("c3b3"),i=t("ecd9"),u={components:{ChatBox:a["default"],LoginModal:i["default"]},data:function(){return{showLoginModal:!1}},mounted:function(){},methods:{checkAIData:function(){var c=localStorage.getItem("AIData");this.showLoginModal=!c},handleLoginSuccess:function(){this.showLoginModal=!1}}},d=u,s=(t("3ec3"),t("2877")),l=Object(s["a"])(d,o,e,!1,null,"1d6fd656",null);n["default"]=l.exports},dacc:function(c,n,t){}}]);

+ 0 - 0
dist/static/js/chunk-52f685c2.a899992c.js → dist/static/js/chunk-52f685c2.8e5b8e14.js


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/chunk-567d7f88.8000989e.js


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/chunk-57d45b95.d715599a.js


+ 0 - 0
dist/static/js/chunk-5a3bdf57.424e83d5.js → dist/static/js/chunk-5a3bdf57.f96a054d.js


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/chunk-647b97bd.e3ffac00.js


+ 0 - 0
dist/static/js/chunk-6a80e4ca.596c71e2.js → dist/static/js/chunk-6a80e4ca.5bc8e6ad.js


+ 0 - 0
dist/static/js/chunk-6ddf6871.336936a2.js → dist/static/js/chunk-6ddf6871.2e1a7a38.js


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/chunk-712c0160.4836b10d.js


+ 0 - 0
dist/static/js/chunk-7a88741c.f824efa0.js → dist/static/js/chunk-7a88741c.2e893504.js


+ 0 - 0
dist/static/js/chunk-7dbc1954.fba606d9.js → dist/static/js/chunk-7dbc1954.f1c0b808.js


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/chunk-87faa9d8.b88848df.js


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/chunk-8e8fa6da.ea062c6b.js


+ 0 - 0
dist/static/js/chunk-9235c1ae.2214d4fa.js → dist/static/js/chunk-9235c1ae.2513ea0a.js


+ 0 - 0
dist/static/js/chunk-a577192a.0f4dc49f.js → dist/static/js/chunk-a577192a.c8743a89.js


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/chunk-a912d4ba.e28421c0.js


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/chunk-ad361d30.112fa738.js


+ 0 - 0
dist/static/js/chunk-c5d7799a.b6de2b10.js → dist/static/js/chunk-c5d7799a.b8bef5a1.js


+ 0 - 0
dist/static/js/chunk-d09dbc1a.bc74ad02.js → dist/static/js/chunk-d09dbc1a.24b73683.js


+ 0 - 0
dist/static/js/chunk-d4c547ca.9c0c89d3.js → dist/static/js/chunk-d4c547ca.07306676.js


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/chunk-ec77a450.b7c6967a.js


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/chunk-libs.3f747fa8.js


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/chunk-libs.76f3ffd8.js


+ 20 - 1
src/api/knowledge.js

@@ -245,4 +245,23 @@ export function configDelete(data) {
     method: 'post',
     data
   })
-} */
+} */
+
+  /* 获取首页知识库分类汇总 */
+
+  export function structure_count(data) {
+    return request({
+      url: '/knowledgebase/structure_count/',
+      method: 'post',
+      data
+    })
+  } 
+
+  /* 获取首页文档信息 */
+  export function concle_count(data) {
+    return request({
+      url: '/knowledgebase/concle_count/',
+      method: 'post',
+      data
+    })
+  } 

+ 1 - 1
src/components/webAi/js/ChatBox.js

@@ -718,7 +718,7 @@ newChat() {
         }
       }
       const chatId = this.getUuid();
-      const wsUrl ='http://120.46.190.49:8082/api/chatbot/chat'//this.wsUrl//'http://58.246.234.210:7860/api/v1/run/3ef7369e-b617-40d2-9e2e-54f3ee76ed2e?stream=false'
+      const wsUrl ='http://192.168.1.199:8082/api/chatbot/chat'//this.wsUrl//'http://58.246.234.210:7860/api/v1/run/3ef7369e-b617-40d2-9e2e-54f3ee76ed2e?stream=false'
       let message = this.userInput.trim();
       if (message) {
         // Markdown换行:在每个换行符之前添加两个空格

+ 2 - 0
src/main.js

@@ -88,7 +88,9 @@ requireComponent.keys().forEach(fileName => {
 
 })
 
+import DataV from '@jiaminghi/data-view'
 
+Vue.use(DataV)
 
 
 

+ 136 - 95
src/views/dashboard/admin/components/BarChart.vue

@@ -6,80 +6,47 @@
 import echarts from "echarts";
 require("echarts/theme/macarons");
 import resize from "./mixins/resize";
-import {
-  selectTypeList
-} from "@/api/knowledge";
+import { selectTypeList, structure_count } from "@/api/knowledge";
 
 export default {
   mixins: [resize],
   props: {
     className: {
       type: String,
-      default: "chart"
+      default: "chart",
     },
     width: {
       type: String,
-      default: "100%"
+      default: "100%",
     },
     height: {
       type: String,
-      default: "350px"
+      default: "350px",
+    },
+    kenValue: {
+      type: Object,
+      default: null,
     },
-    kenValue:{
-      type:Number,
-      default:null
-    }
   },
   data() {
     return {
       chart: null,
-      chartData: [
-        {
-          category: "Customer",
-          Document: 8,
-          Video: 77,
-          Audio: 22,
-          Image: 76,
-          Text: 11,
-          Other: 88
-        },
-        {
-          category: "Developer",
-          Document: 23,
-          Video: 52,
-          Audio: 80,
-          Image: 30,
-          Text: 22,
-          Other: 20
-        },
-        {
-          category: "Manager",
-          Document: 98,
-          Video: 65,
-          Audio: 18,
-          Image: 92,
-          Text: 71,
-          Other: 90
-        },
-        {
-          category: "Designer",
-          Document: 93,
-          Video: 33,
-          Audio: 98,
-          Image: 10,
-          Text: 36,
-          Other: 11
-        }
-      ],
-      dirList:[]
+      chartData: [],
+      dirList: [],
+      currentKenId: null, // 新增:用于跟踪当前选中的知识库ID
     };
   },
-  watch:{
-    kenValue:{
+  watch: {
+    kenValue: {
+      immediate: true,
       handler(val) {
-        this.init(val)
-      }
-    }
+        if (val && val.id !== this.currentKenId) {
+          this.currentKenId = val.id;
+          this.resetChart();
+          this.procData(val);
+        }
+      },
+    },
   },
   mounted() {
     this.$nextTick(() => {
@@ -96,33 +63,87 @@ export default {
   methods: {
     initChart() {
       this.chart = echarts.init(this.$el, "macarons");
+      // 初始化空的图表配置
+      this.updateChart([]);
+    },
+   /*  getColor(type) {
+      const colorMap = {
+        Document: "#FF7B7B",
+        Video: "#9D96F5",
+        Audio: "#4ADEDE",
+        Image: "#FFA400",
+        Text: "#5D7DFF",
+        Other: "#4ADEDE",
+      };
+      return colorMap[type];
+    }, */
+    /* 处理数据 */
+    resetChart() {
+      if (this.chart) {
+        this.chart.clear();
+      }
+      this.chartData = [];
+    },
+
+    procData(val) {
+      if (!val || !val.directories) {
+        /* console.error("Invalid input data"); */
+        return;
+      }
+
+      this.chartData = val.directories.map((dir) => ({
+        name: dir.name,
+        ...dir.file_type_stats,
+      }));
 
-      const categories = this.chartData.map(item => item.category);
-      const series = ["Document", "Video", "Audio", "Image", "Text", "Other"].map(type => ({
-        name: type,
+      if (val.other_files && val.other_files.file_type_stats) {
+        this.chartData.push({
+          name: "其他",
+          ...val.other_files.file_type_stats,
+        });
+      }
+      console.log(this.chartData);
+      this.$nextTick(() => {
+        this.updateChart(this.chartData);
+      });
+    },
+
+    updateChart(data) {
+      if (!this.chart) {
+        console.error("Chart is not initialized");
+        return;
+      }
+
+      const categories = data.map((item) => item.name);
+
+      // 获取所有存在的文件类型
+      const fileTypes = Array.from(
+        new Set(data.flatMap((item) => Object.keys(item)))
+      ).filter((key) => key !== "name");
+
+      const series = fileTypes.map((type) => ({
+        name: this.getFileTypeName(type),
         type: "bar",
-        barWidth: "10%",
-        data: this.chartData.map(item => item[type]),
-        itemStyle: { color: this.getColor(type) }
+        barWidth: "2%",
+        data: data.map((item) => item[type] || 0),
+        itemStyle: { color: this.getColor(type) },
       }));
 
       this.chart.setOption({
         tooltip: {
           trigger: "axis",
-          axisPointer: {
-            type: "shadow"
-          }
+          axisPointer: { type: "shadow" },
         },
         legend: {
-          data: ["Document", "Video", "Audio", "Image", "Text", "Other"],
-          bottom: 0
+          data: fileTypes.map(this.getFileTypeName),
+          bottom: 0,
         },
         grid: {
           left: "3%",
           right: "4%",
           bottom: "10%",
           top: "3%",
-          containLabel: true
+          containLabel: true,
         },
         xAxis: [
           {
@@ -132,45 +153,64 @@ export default {
             axisLine: { show: false },
             axisLabel: {
               interval: 0,
-              align: 'center',
+              align: "center",
               margin: 20,
-              fontSize: 14
-            },
-            axisTick: {
-              alignWithLabel: true
+              fontSize: 14,
             },
             splitLine: {
               show: true,
-              lineStyle: {
-                type: 'dashed',
-                color: '#ddd'
-              }
-            }
-          }
-        ],
-        yAxis: [
-          {
-            type: "value",
-            max: 100
-          }
+              lineStyle: { type: "dashed", color: "#ddd" },
+            },
+          },
         ],
-        series: series
+        yAxis: [{ type: "value" }],
+        series: series,
       });
     },
+
     getColor(type) {
       const colorMap = {
-        Document: "#FF7B7B",
-        Video: "#9D96F5",
-        Audio: "#4ADEDE",
-        Image: "#FFA400",
-        Text: "#5D7DFF",
-        Other: "#4ADEDE"
+        jpg: "#54a0ff",
+        png: "#9D96F5",
+        gif: "#4ADEDE",
+        mp4: "#FFA400",
+        mp3: "#5D7DFF",
+        pdf: "#FF6B6B",
+        doc: "#4ECDC4",
+        docx: "#4ECDC4",
+        xls: "#45B7D1",
+        xlsx: "#45B7D1",
+        ppt: "#FF8C42",
+        pptx: "#FF8C42",
+        txt: "#6AB04C",
+        other: "#95AFC0",
       };
-      return colorMap[type];
+      return colorMap[type] || "#95AFC0"; // 默认颜色
+    },
+
+    getFileTypeName(type) {
+      const typeMap = {
+        jpg: "JPG图片",
+        png: "PNG图片",
+        gif: "GIF图片",
+        mp4: "MP4视频",
+        mp3: "MP3音频",
+        pdf: "PDF文档",
+        doc: "Word文档",
+        docx: "Word文档",
+        xls: "Excel表格",
+        xlsx: "Excel表格",
+        ppt: "PPT演示",
+        pptx: "PPT演示",
+        txt: "文本文件",
+        other: "其他文件",
+      };
+      return typeMap[type] || type;
     },
+
     /* 获取知识库目录 */
-    init(val){
-      const tList={
+    init(val) {
+      /* const tList={
         page: 1,
         pageSize: 9999,
         kb_id: val,
@@ -179,8 +219,9 @@ export default {
         console.log(res);
         if(res.status!==200) return
         this.dirList=res.data.dataList
-      })
+      }) */
+      /* 获取汇总 */
     },
-  }
+  },
 };
 </script>

+ 94 - 1
src/views/dashboard/admin/components/PieChart.vue

@@ -79,7 +79,7 @@ export default {
 </script>
  -->
 
- <template>
+<!--  <template>
   <div class="pie-chart-container">
     <div class="pie-charts">
       <div v-for="(item, index) in data" :key="index" class="pie-chart-item">
@@ -98,8 +98,12 @@ export default {
 </template>
 
 <script>
+import DataV from '@jiaminghi/data-view'
 export default {
   name: 'PieChart',
+  components: {
+    dv: DataV,
+  },
   data() {
     return {
       data: [
@@ -194,4 +198,93 @@ export default {
   border-radius: 50%;
   margin-right: 5px;
 }
+</style> -->
+<template>
+  <div class="pie-chart-container">
+    <dv-charts v-if="option" :option="option" />
+    <div v-else>Loading chart...</div>
+  </div>
+</template>
+
+<script>
+import { concle_count } from "@/api/knowledge";
+export default {
+  name: "PieChart",
+  data() {
+    return {
+      option: null,
+      data: [
+        { name: "文档", value: 70 },
+        { name: "模版", value: 46 },
+        { name: "公式", value: 15 },
+        { name: "变量", value: 67 },
+        { name: "知识库文档", value: 23 },
+      ],
+      refreshInterval: null,
+    };
+  },
+  mounted() {
+    this.init();
+    this.refreshInterval = setInterval(() => {
+      this.init();
+    }, 30000);
+  },
+  beforeDestroy() {
+    // 组件销毁前清除定时器
+    if (this.refreshInterval) {
+      clearInterval(this.refreshInterval);
+    }
+  },
+  methods: {
+    initChart() {
+      const filteredData = this.data.filter((item) => item.value > 0);
+      this.option = {
+        series: [
+          {
+            type: "pie",
+            data: filteredData,
+            radius: "55%",
+            insideLabel: {
+              show: true,
+            },
+            outsideLabel: {
+              show: true,
+              formatter: "{name}",/*  {percent}% */
+            },
+          },
+        ],
+        color: [
+          "#FF9F43",
+          "#5E60CE",
+          "#FF6B6B",
+          "#54A0FF",
+          "#FF4DFF",
+          "#FF9F43",
+          "#1DD1A1",
+        ],
+      };
+    },
+    init() {
+      concle_count().then((res) => {
+        this.data[0].value = res.data.dc_document.non_templates;
+        this.data[1].value = res.data.dc_document.templates;
+        this.data[2].value = res.data.dc_formula;
+        this.data[3].value = res.data.dc_params;
+        this.data[4].value = res.data.kbm_document;
+        this.$nextTick(() => {
+          this.initChart();
+        });
+      });
+    },
+  },
+};
+</script>
+
+<style scoped>
+.pie-chart-container {
+  width: 100%;
+  height: 400px;
+  max-width: 800px;
+  margin: 0 auto;
+}
 </style>

+ 22 - 2
src/views/dashboard/admin/components/recentFile.vue

@@ -13,8 +13,19 @@
         </template> -->
       </el-table-column>
       <!-- <el-table-column prop="size" label="Size" width="120" /> -->
-      <el-table-column prop="create_time" label="创建时间"  sortable  align="center"/>
-      <el-table-column prop="status" label="文档状态" align="center" />
+      <el-table-column
+        prop="create_time"
+        label="创建时间"
+        sortable
+        align="center"
+      />
+      <el-table-column prop="status" label="文档状态" align="center">
+        <template slot-scope="{ row }">
+          <el-tag :type="getStatusType(row.status)">
+            {{ getStatusText(row.status) }}
+          </el-tag>
+        </template>
+      </el-table-column>
     </el-table>
   </div>
 </template>
@@ -35,6 +46,9 @@ export default {
       fileList: [],
     };
   },
+  mounted() {
+    this.init();
+  },
   methods: {
     getFileIcon(fileName) {
       const extension = fileName.split(".").pop().toLowerCase();
@@ -58,6 +72,12 @@ export default {
           return "el-icon-document";
       }
     },
+    getStatusType(status) {
+      return status === 5 ? "success" : "danger";
+    },
+    getStatusText(status) {
+      return status === 5 ? "启用" : "停用";
+    },
     init() {
       searchlistDoc(this.queryForm).then((res) => {
         // 假设 res.data.dataList 是包含所有文件信息的数组

+ 51 - 16
src/views/dashboard/admin/index.vue

@@ -9,7 +9,11 @@
           <div slot="header" class="clearfixs header_sel">
             <span>知识库构成</span>
             <div>
-              <el-select v-model="kenValue" placeholder="请选择">
+              <el-select
+                v-model="kenValue"
+                @change="kenChange"
+                placeholder="请选择"
+              >
                 <el-option
                   v-for="item in kenList"
                   :key="item.id"
@@ -20,7 +24,7 @@
               </el-select>
             </div>
           </div>
-          <BarChart :kenValue="kenValue" style="height: 350px"></BarChart>
+          <BarChart :kenValue="kenVal" style="height: 350px"></BarChart>
         </el-card>
       </el-col>
       <el-col :span="8">
@@ -28,7 +32,7 @@
           <div slot="header" class="clearfixs">
             <span>文件种类占比</span>
           </div>
-          <pie-chart style="height: 350px" />
+          <pie-chart style="height: 366px" />
         </el-card>
       </el-col>
     </el-row>
@@ -51,7 +55,7 @@
       </el-col>
     </el-row>
 
-  <!--   <transaction-table /> -->
+    <!--   <transaction-table /> -->
   </div>
 </template>
 
@@ -67,9 +71,7 @@ import TodoList from "./components/TodoList";
 import BoxCard from "./components/BoxCard";
 import TagCloud from "./components/tagCloud.vue";
 import RecentFile from "./components/recentFile.vue";
-import {
-  listBuckets,
-} from "@/api/knowledge";
+import { listBuckets, structure_count } from "@/api/knowledge";
 
 const lineChartData = {
   newVisitis: {
@@ -124,22 +126,52 @@ export default {
         "Marketing",
         "CEO",
       ],
-      kenList:[],
-      kenValue:0,
+      kenList: [],
+      kenValue: null,
+      kenVal: {},
+      refreshInterval: null,
     };
   },
-  mounted(){
-    this.init()
+  mounted() {
+    this.init();
+    this.startRefreshInterval();
+  },
+  beforeDestroy() {
+    this.stopRefreshInterval();
   },
   methods: {
+    /* 选择知识库 */
+    kenChange(val) {
+      this.kenVal = this.kenList.find((el) => el.id === val);
+    },
     handleSetLineChartData(type) {
       this.lineChartData = lineChartData[type];
     },
-    init(){
-      listBuckets({ user_id: this.$store.state.user.id }).then(res=>{
+    startRefreshInterval() {
+      this.refreshInterval = setInterval(() => {
+        this.refreshData();
+      }, 30000); // 30 seconds
+    },
+
+    stopRefreshInterval() {
+      if (this.refreshInterval) {
+        clearInterval(this.refreshInterval);
+      }
+    },
+
+    refreshData() {
+      structure_count().then((res) => {
         if (res.status !== 200) return;
-          this.kenList = res.data;
-      })
+        this.kenList = res.data;
+        if (this.kenList.length > 0) {
+          this.kenValue = this.kenList[0].id;
+          this.kenVal = this.kenList[0];
+        }
+      });
+    },
+
+    init() {
+      this.refreshData();
     },
   },
 };
@@ -164,7 +196,7 @@ export default {
       font-weight: 600;
     }
   }
-  .header_sel{
+  .header_sel {
     display: flex;
     align-items: center;
     justify-content: space-between;
@@ -175,6 +207,9 @@ export default {
     padding: 16px 16px 0;
     margin-bottom: 32px;
   }
+  ::v-deep .el-card__body {
+    padding-top: 0;
+  }
 }
 
 @media (max-width: 1024px) {

+ 7 - 6
src/views/document/create.vue

@@ -625,6 +625,7 @@ import draggable from "vuedraggable";
 import htmlDocx from "html-docx-js/dist/html-docx";
 import { searchFormula } from "@/api/formula";
 import axios from "axios";
+import settings from '@/settings'
 // import htmlDocx from "htmlDocx";
 export default {
   name: "create",
@@ -740,14 +741,14 @@ export default {
     this.isAdmin = this.userInfo ? this.userInfo.roleInfo.is_admin : 2;
     this.initArticleCategoryList();
     if (this.type !== "module" && this.type !== "document") {
-      document.title = "新建模版-轻良实业";
+      document.title = "新建模版-"+settings.title;
     }
     if (
       this.type !== "module" &&
       this.type !== "document" &&
       this.articleId !== undefined
     ) {
-      document.title = this.docAttr.title + "-轻良实业";
+      document.title = this.docAttr.title + settings.title;
     }
     this.$nextTick(() => {
       const arrows = document.querySelectorAll(".el-collapse-item__arrow");
@@ -1205,8 +1206,8 @@ export default {
 
         // 设置文档标题
         document.title = data.name
-          ? `${data.name}-轻良实业`
-          : "新建模块-轻良实业";
+          ? `${data.name}-${settings.title}`
+          : "新建模块-"+settings.title;
 
         // 解析属性
         data.attrs = JSON.parse(data.attrs);
@@ -1359,7 +1360,7 @@ export default {
         console.log("coms", updatedComs);
 
         if (this.type === "document" && this.articleId !== undefined) {
-          document.title = `${this.docAttr.title}-轻良实业`;
+          document.title = `${this.docAttr.title}-${settings.title}`;
         }
 
         this.uptadeSearch();
@@ -1478,7 +1479,7 @@ export default {
         console.log("组件", this.coms);
         console.log("模版", this.docAttr);
         if (this.articleId !== undefined) {
-          document.title = `${this.docAttr.title}-轻良实业`;
+          document.title = `${this.docAttr.title}-${settings.title}`;
         }
         this.uptadeSearch();
       } catch (error) {

Some files were not shown because too many files changed in this diff