Răsfoiți Sursa

添加知识库描述及文件数量,公式详细信息不刷新

yangg 9 luni în urmă
părinte
comite
6a1fe1a346

+ 1 - 1
.env.development

@@ -2,5 +2,5 @@
 ENV = 'development'
 port = 8080
 # base api
-VUE_APP_BASE_API = 'http://120.46.190.49:8084'
+VUE_APP_BASE_API = 'http://192.168.1.178:8084'
 #192.168.1.178

+ 44 - 0
dist/ckeditor/config.js

@@ -43,4 +43,48 @@ config.contentsCss = '/public/ckeditor/custom-ckeditor.css';
 
  // 设置工具栏位置在编辑区域上方
  config.toolbarLocation = 'top';
+
+
+ // 设置正确的上传URL
+ var uploadUrl = 'http://58.246.234.210:8084/upload/file';
+
+ // 设置图片上传的参数名为 'file'
+ config.imageUploadParam = 'file';
+
+ // 设置文件浏览器上传URL和方法
+ config.filebrowserUploadUrl = uploadUrl;
+ config.filebrowserImageUploadUrl = uploadUrl;
+/*  config.filebrowserUploadMethod = 'form'; */
+
+ /* // 确保 'image' 插件被加载
+ config.extraPlugins = (config.extraPlugins ? config.extraPlugins + ',image' : 'image');
+
+ // 配置图片上传
+ config.uploadUrl = uploadUrl;
+
+ // 自定义文件上传处理
+ config.uploadFile = function( file, successCallback, failureCallback ) {
+	 var xhr = new XMLHttpRequest();
+	 var fd = new FormData();
+	 
+	 fd.append('file', file);  // 使用 'file' 作为参数名
+
+	 xhr.open('POST', uploadUrl, true);
+	 xhr.onload = function() {
+		 if (xhr.status === 200) {
+			 var response = JSON.parse(xhr.responseText);
+			 successCallback(response.url);
+		 } else {
+			 console.error('Server responded with:', xhr.status, xhr.statusText);
+			 console.error('Response text:', xhr.responseText);
+			 failureCallback('Upload failed: ' + xhr.status + ' ' + xhr.statusText);
+		 }
+	 };
+	 xhr.onerror = function() {
+		 console.error('Network error occurred');
+		 failureCallback('Network error occurred');
+	 };
+	 xhr.send(fd);
+ }; */
+
 };

Fișier diff suprimat deoarece este prea mare
+ 0 - 0
dist/index.html


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
dist/static/css/app.03c13ba5.css


+ 0 - 1
dist/static/css/chunk-2043d8d9.1fa507b0.css

@@ -1 +0,0 @@
-.ledge_box .data-search[data-v-26c5e21c]{padding:20px 10px 0 10px}.ledge_box .data-list[data-v-26c5e21c]{padding:10px;min-height:200px;position:relative}.ledge_box .data-list .time[data-v-26c5e21c]{font-size:13px;color:#999}.ledge_box .data-list .bottom[data-v-26c5e21c]{margin-top:13px;line-height:12px}.ledge_box .data-list .button[data-v-26c5e21c]{padding:0;float:right}.ledge_box .data-list .image[data-v-26c5e21c]{width:100%;display:block}.ledge_box .data-list .clearfix[data-v-26c5e21c]:after,.ledge_box .data-list .clearfix[data-v-26c5e21c]:before{display:table;content:""}.ledge_box .data-list .clearfix[data-v-26c5e21c]:after{clear:both}.ledge_box .data-list .card_box[data-v-26c5e21c]{padding:20px}.ledge_box .data-list .card_box .header[data-v-26c5e21c]{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-26c5e21c]{margin-bottom:30px}.ledge_box .data-list .card-col .card_box[data-v-26c5e21c]{height:235px}.ledge_box .data-list .card-col .card_box .box_content[data-v-26c5e21c]{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-26c5e21c]{font-size:24px;line-height:32px;font-weight:600;cursor:pointer;color:rgba(0,0,0,.8784313725490196);word-break:break-all}.ledge_box .data-list .card-col .card_box .box_content .footer[data-v-26c5e21c]{font-size:12px;font-weight:600;color:rgba(0,0,0,.6509803921568628);vertical-align:middle}

+ 0 - 0
dist/static/css/chunk-61c59648.68741a84.css → dist/static/css/chunk-32179550.68741a84.css


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
dist/static/css/chunk-68925985.1d59ca2f.css


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
dist/static/css/chunk-6a7726bb.d20e8206.css


BIN
dist/static/img/aiBgimg.b3b964bd.png


BIN
dist/static/img/aiBgimg.cfd7462d.jpg


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
dist/static/js/app.6eba7a26.js


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
dist/static/js/app.d92fd988.js


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
dist/static/js/chunk-2043d8d9.f4f4b29d.js


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
dist/static/js/chunk-32179550.1c0d6318.js


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
dist/static/js/chunk-61c59648.f6b04b6d.js


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
dist/static/js/chunk-6a7726bb.35923be1.js


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
dist/static/js/chunk-b4ab3520.6489345d.js


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
dist/static/js/chunk-e1ce3178.10750586.js


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
dist/static/js/chunk-e1ce3178.98641299.js


+ 44 - 0
public/ckeditor/config.js

@@ -43,4 +43,48 @@ config.contentsCss = '/public/ckeditor/custom-ckeditor.css';
 
  // 设置工具栏位置在编辑区域上方
  config.toolbarLocation = 'top';
+
+
+ // 设置正确的上传URL
+ var uploadUrl = 'http://58.246.234.210:8084/upload/file';
+
+ // 设置图片上传的参数名为 'file'
+ config.imageUploadParam = 'file';
+
+ // 设置文件浏览器上传URL和方法
+ config.filebrowserUploadUrl = uploadUrl;
+ config.filebrowserImageUploadUrl = uploadUrl;
+/*  config.filebrowserUploadMethod = 'form'; */
+
+ /* // 确保 'image' 插件被加载
+ config.extraPlugins = (config.extraPlugins ? config.extraPlugins + ',image' : 'image');
+
+ // 配置图片上传
+ config.uploadUrl = uploadUrl;
+
+ // 自定义文件上传处理
+ config.uploadFile = function( file, successCallback, failureCallback ) {
+	 var xhr = new XMLHttpRequest();
+	 var fd = new FormData();
+	 
+	 fd.append('file', file);  // 使用 'file' 作为参数名
+
+	 xhr.open('POST', uploadUrl, true);
+	 xhr.onload = function() {
+		 if (xhr.status === 200) {
+			 var response = JSON.parse(xhr.responseText);
+			 successCallback(response.url);
+		 } else {
+			 console.error('Server responded with:', xhr.status, xhr.statusText);
+			 console.error('Response text:', xhr.responseText);
+			 failureCallback('Upload failed: ' + xhr.status + ' ' + xhr.statusText);
+		 }
+	 };
+	 xhr.onerror = function() {
+		 console.error('Network error occurred');
+		 failureCallback('Network error occurred');
+	 };
+	 xhr.send(fd);
+ }; */
+
 };

+ 9 - 0
src/api/knowledge.js

@@ -18,6 +18,15 @@ export function createBucket(data) {
   })
 }
 
+/* 编辑知识库  */
+export function updateKbm(data) {
+  return request({
+    url: '/kbm/updateKbm',
+    method: 'post',
+    data
+  })
+}
+
 /* 删除知识库  kbm/deleteBucket*/
 export function deleteBucket(data) {
   return request({

BIN
src/assets/images/aiBgimg.jpg


Fișier diff suprimat deoarece este prea mare
+ 0 - 0
src/icons/svg/file.svg


+ 7 - 0
src/styles/element-ui.scss

@@ -104,6 +104,9 @@
 .el-button--danger:hover{
   background-color: #d54c3a !important;
 }
+.el-button--danger:focus{
+  background-color: #d54c3a !important;
+}
 .el-button--success{
   background-color: #3cbade;
   border-color: #3cbade;
@@ -112,6 +115,10 @@
   background-color: #339ebd;
   border-color: #339ebd;
 }
+.el-button--success:focus{
+  background-color: #339ebd;
+  border-color: #339ebd;
+}
 
 .el-pagination.is-background .el-pager li:not(.disabled).active{
   background-color: #339ebd !important;

+ 37 - 47
src/views/document/com/components/Formula/dataInfo.vue

@@ -202,26 +202,18 @@ export default {
   },
   watch: {
     id: {
-      handler(v) {
-        let _this = this;
-        if (v == null) return;
-        if (v == 0) {
-          this.dataForm = {
-            id: 0,
-            name: "",
-            formula: "",
-            intro: "",
-            status: "",
-            use_status: 5,
-            params: "[]",
-            point: 0,
-          };
-          return;
+      handler(newVal, oldVal) {
+        if (newVal == null) return;
+        if (newVal == 0) {
+          this.resetForm();
+        } else {
+          // 添加条件以确保在id相同但需要重新获取数据时也能触发
+          if (newVal !== oldVal || this.dataForm.id !== newVal) {
+            this.getInfo(newVal);
+          }
         }
-        _this.getInfo(v);
       },
       immediate: true,
-      deep: true,
     },
     list: {
       handler(newValue, oldValue) {
@@ -310,40 +302,38 @@ export default {
       // 更新 dataForm.formula 的值
       this.dataForm.formula = value;
     },
-    //保存更新
+    resetForm() {
+      this.dataForm = {
+        id: 0,
+        name: "",
+        formula: "",
+        intro: "",
+        status: 5,
+        use_status: 5,
+        params: "[]",
+        point: 0,
+      };
+    },
+
     btnSave(e) {
       let _this = this;
 
-      if (_this.dataForm.id > 0) {
-        updateFormula(_this.dataForm).then((res) => {
-          _this.dataForm = {
-            status: 5,
-            use_status: 5,
-            params: "[]",
-            id: 0,
-            name: "",
-            formula: "",
-            intro: "",
-            point: 0,
-          };
-          _this.$message.success("公式更新成功");
-        });
-      } else {
-        createFormula(_this.dataForm).then((res) => {
-          _this.dataForm = {
-            status: 5,
-            use_status: 5,
-            params: "[]",
-            id: 0,
-            name: "",
-            formula: "",
-            intro: "",
-            point: 0,
-          };
-          _this.$message.success("公式创建的成功");
+      const saveAction = _this.dataForm.id > 0 ? updateFormula : createFormula;
+
+      saveAction(_this.dataForm)
+        .then((res) => {
+          _this.$message.success(
+            _this.dataForm.id > 0 ? "公式更新成功" : "公式创建成功"
+          );
+          _this.$emit("onClose", true); // Pass a boolean to indicate successful save
+
+          // 添加这行来强制重新获取数据
+          _this.getInfo(_this.dataForm.id);
+        })
+        .catch((error) => {
+          console.error("保存失败:", error);
+          _this.$message.error("保存失败,请重试");
         });
-      }
-      _this.$emit("onClose");
     },
 
     //产品详情

+ 97 - 64
src/views/knowledgeMenu/index.scss

@@ -1,73 +1,106 @@
 .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;
-          }
+  .data-search{
+      padding:20px 10px 0px 10px;
+  }
+  .data-list{
+      padding: 10px;
+      min-height: 200px; // 确保在没有内容时也有足够的高度显示加载动画
+      position: relative; // 为加载动画提供定位上下文
+      .time {
+          font-size: 13px;
+          color: #999;
+        }
         
-          .button {
-            padding: 0;
-            float: right;
-          }
+        .bottom {
+          margin-top: 13px;
+          line-height: 12px;
+        }
+      
+        .button {
+          padding: 0;
+          float: right;
+        }
+      
+        .image {
+          width: 100%;
+          display: block;
+        }
+      
+        .clearfix:before,
+        .clearfix:after {
+            display: table;
+            content: "";
+        }
         
-          .image {
-            width: 100%;
-            display: block;
-          }
-        
-          .clearfix:before,
-          .clearfix:after {
-              display: table;
-              content: "";
-          }
-          
-          .clearfix:after {
-              clear: both
+        .clearfix:after {
+            clear: both
+        }
+        .card_box{
+          padding: 20px;
+          .header{
+              display: flex;
+              justify-content: space-between;
+              align-items: center;
           }
+        }
+        .card-col{
+          border-radius: 10px;
+          margin-bottom: 30px;
           .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{
+            border-radius: 10px;
+              height:330px;
+              .box_content{
+                  display: flex;
+                  flex-direction: column;
+                  justify-content: space-between;
+                  height: 100%;
+                  .content{
+                      margin-top: 20px;
+                      font-size: 32px;
+                      line-height: 32px;
+                      font-weight: 600;
+                      cursor: pointer;
+                      color: #000000e0;
+                      word-break: break-all;
+                      .content_info{
+                        font-size: 14px;
+                        line-height: 16px;
+                        font-weight: 400;
+                        height: 32px;
+                        margin: 30px 0 10px;
+                        overflow: hidden;
+                        text-overflow: ellipsis;
+                        display: -webkit-box;
+                        -webkit-line-clamp: 2;
+                        -webkit-box-orient: vertical;
+                      }
+                      .content_file{
+                        font-size: 14px;
+                        line-height: 16px;
+                        font-weight: 400;
+                        display: flex;
+                        .file{
+                          width: 60px;
+                          display: flex;
+                          flex-direction: column;
+                          align-items: center;                      
+                          margin-right: 10px;
+                          p{
+                            margin: 0;
+                          }
+                        }
+                      }
+                  }
+                  .footer{
                     display: flex;
-                    flex-direction: column;
                     justify-content: space-between;
-                    height: 100%;
-                    .content{
-                        font-size: 24px;
-                        line-height: 32px;
-                        font-weight: 600;
-                        cursor: pointer;
-                        color: #000000e0;
-                        word-break: break-all;
-                    }
-                    .footer{
-                        font-size: 12px;
-                        font-weight: 600;
-                        color: #000000a6;
-                        vertical-align: middle;
-                    }
-                }
-            }
+                      font-size: 14px;
+                      font-weight: 600;
+                      color: #000000a6;
+                      vertical-align: middle;
+                  }
+              }
           }
-    }
+        }
+  }
 }

+ 98 - 15
src/views/knowledgeMenu/knowledgeList.vue

@@ -34,10 +34,10 @@
     <div class="data-list" v-loading="loading" element-loading-text="加载中...">
       <el-row>
         <el-col
-          :span="4"
+          :span="5"
           v-for="(item, index) in buckList"
           :key="index"
-          :offset="index > 0 && index % 5 !== 0 ? 1 : 0"
+          :offset="index > 0 && index % 4 !== 0 ? 1 : 0"
           class="card-col"
         >
           <el-card :body-style="{ padding: '0px' }" shadow="never">
@@ -51,7 +51,16 @@
                     />
                   </div>
                   <el-popover placement="bottom" trigger="hover">
-                    <el-button type="danger" icon="el-icon-delete" @click="delect(item)"
+                    <el-button
+                      type="success"
+                      icon="el-icon-edit"
+                      @click="editInfo(item)"
+                      >编辑</el-button
+                    >
+                    <el-button
+                      type="danger"
+                      icon="el-icon-delete"
+                      @click="delect(item)"
                       >删除</el-button
                     >
                     <div class="header_right" slot="reference">
@@ -63,15 +72,42 @@
                   </el-popover>
                 </div>
                 <div class="content">
-                  {{ item.name }}
+                  <p style="margin: 0">{{ item.name }}</p>
+                  <div class="content_info">{{ item.description }}</div><!--  -->
+                  <div class="content_file">
+                    <div class="file">
+                      <svg-icon
+                      icon-class="file"
+                      style="width: 40px; height: 40px; filter: grayscale(100%)"
+                    />
+                    <p>WORD</p>
+                    <p>{{ item.word_count }}</p>
+                    </div>
+                    <div class="file">
+                      <svg-icon
+                      icon-class="file"
+                      style="width: 40px; height: 40px; filter: grayscale(100%)"
+                    />
+                    <p>EXCEL</p>
+                    <p>{{ item.excel_count }}</p>
+                    </div>
+                    <div class="file">
+                      <svg-icon
+                      icon-class="file"
+                      style="width: 40px; height: 40px; filter: grayscale(100%)"
+                    />
+                    <p>PDF</p>
+                    <p>{{ item.pdf_count }}</p>
+                    </div>
+                  </div>
                 </div>
                 <div class="footer">
                   <div class="file">
-                    <svg-icon
+                    <!-- <svg-icon
                       icon-class="word"
                       style="width: 18px; height: 18px; filter: grayscale(100%)"
                     />
-                    {{ item.doc_num }}
+                    {{ item.doc_num }} -->
                   </div>
                   <div class="date">
                     <svg-icon
@@ -89,7 +125,7 @@
     </div>
     <!-- 创建弹窗 -->
     <el-dialog
-      title="创建知识库"
+      :title="dialogTitle"
       :visible.sync="dialogVisible"
       width="30%"
       :before-close="handleClose"
@@ -101,6 +137,16 @@
             placeholder="请输入内容"
           ></el-input>
         </el-form-item>
+        <el-form-item label="描述:" prop="description">
+          <el-input
+            show-word-limit
+            type="textarea"
+            :rows="5"
+            maxlength="250"
+            v-model="creatForm.description"
+            placeholder="请输入描述内容"
+          ></el-input>
+        </el-form-item>
       </el-form>
       <span slot="footer" class="dialog-footer">
         <el-button @click="handleClose">取 消</el-button>
@@ -111,7 +157,12 @@
 </template>
   
 <script>
-import { listBuckets, createBucket, deleteBucket } from "@/api/knowledge";
+import {
+  listBuckets,
+  createBucket,
+  deleteBucket,
+  updateKbm,
+} from "@/api/knowledge";
 import { mapGetters } from "vuex";
 
 export default {
@@ -136,9 +187,13 @@ export default {
       buckList: [],
       visible: false,
       dialogVisible: false,
+      dialogTitle: "创建知识库",
       creatForm: {
+        id: null,
         bucket_name: "",
-      }, //知识库名称
+        description: "",
+        user_id: null,
+      },//知识库名称
       creatRules: {
         bucket_name: [
           { required: true, message: "请输入知识库名称", trigger: "blur" },
@@ -155,14 +210,32 @@ export default {
     this.onSubmit();
   },
   methods: {
-    /* 搜索创建模块 */
+    editInfo(item) {
+      this.dialogTitle = "编辑知识库";
+      this.creatForm = {
+        id: item.id,
+        bucket_name: item.name,
+        description: item.description,
+        user_id: this.$store.state.user.id,
+      };
+      this.dialogVisible = true;
+    },
+    /* 创建知识库 */
     onCreate(e) {
+      this.dialogTitle = "创建知识库";
       this.creatForm = {
+        id: null,
         bucket_name: "",
+        description: "",
         user_id: this.$store.state.user.id,
       };
       this.dialogVisible = true;
     },
+    /* 关闭弹窗 */
+    handleClose() {
+      this.$refs.creatRef.resetFields();
+      this.dialogVisible = false;
+    },
     onClose(e) {
       this.dialogVisible = false;
       this.onSubmit();
@@ -206,22 +279,26 @@ export default {
         });
     },
     /* 关闭弹窗 */
-    handleClose(done) {
+  /*   handleClose(done) {
       this.creatForm = {};
       done();
-    },
+    }, */
     /* 创建知识库 */
     submitBuck() {
       this.$refs.creatRef.validate((valid) => {
         if (valid) {
-          createBucket(this.creatForm).then((res) => {
+          const action = this.creatForm.id ? updateKbm : createBucket;
+          const successMessage = this.creatForm.id ? "修改成功" : "创建成功";
+          this.creatForm.id ? this.creatForm.name=this.creatForm.bucket_name :this.creatForm.bucket_name=this.creatForm.bucket_name ;
+          action(this.creatForm).then((res) => {
             if (res.status !== 200) return;
             this.dialogVisible = false;
+            this.$message.success(successMessage);
             this.onSubmit();
-            this.creatForm = {};
+            this.$refs.creatRef.resetFields();
           });
         } else {
-          this.$message.error("请填写知识库名称");
+          this.$message.error("请填写必填项");
         }
       });
     },
@@ -237,6 +314,12 @@ export default {
 };
 </script>
   <style lang="scss" scoped>
+::v-deep .el-card {
+  border-radius: 10px;
+}
+::v-deep .el-col-offset-1 {
+  margin-left: 2%;
+}
 @import "./index.scss";
 </style>
   

+ 3 - 2
src/views/login/index.scss

@@ -49,8 +49,9 @@ $light_gray:#eee;
 
 .login-container {
  
-  background-image: url("../../assets/images/aiBgimg.png");
-  background-size: contain;
+  background-image: url("../../assets/images/aiBgimg.jpg");
+  background-size: 60% 100%;
+  background-repeat: no-repeat;
   min-height: 100%;
   width: 100%;
  /*  background-color: $bg; */

Unele fișiere nu au fost afișate deoarece prea multe fișiere au fost modificate în acest diff