Bläddra i källkod

修改导航栏图标及添加新的文档目录方式

yangg 8 månader sedan
förälder
incheckning
d8a0e1d792
59 ändrade filer med 713 tillägg och 178 borttagningar
  1. 0 0
      dist/index.html
  2. 0 0
      dist/static/css/app.d80fbb88.css
  3. 1 0
      dist/static/css/chunk-048e3da4.680f8f1c.css
  4. 0 0
      dist/static/css/chunk-5c6eee35.5e1eb2f5.css
  5. 0 1
      dist/static/css/chunk-d9ef2ea8.ca62898c.css
  6. 0 0
      dist/static/css/chunk-def78608.c1b0ee2b.css
  7. 0 0
      dist/static/js/app.9f513d7e.js
  8. 0 0
      dist/static/js/app.e8706178.js
  9. 0 0
      dist/static/js/chunk-01f26467.2aacedbb.js
  10. 0 0
      dist/static/js/chunk-022fc394.341f561c.js
  11. 0 0
      dist/static/js/chunk-048e3da4.dbf953dd.js
  12. 0 0
      dist/static/js/chunk-04ba33be.ed4f0e8d.js
  13. 0 0
      dist/static/js/chunk-09f78c22.fe0059e3.js
  14. 0 0
      dist/static/js/chunk-0a1f2758.13a763e7.js
  15. 0 0
      dist/static/js/chunk-0ec56e2a.7dd43bdb.js
  16. 0 0
      dist/static/js/chunk-10bfc27e.22203d9f.js
  17. 0 0
      dist/static/js/chunk-11ff1a32.8826a9db.js
  18. 0 0
      dist/static/js/chunk-138f7583.8e34047a.js
  19. 0 0
      dist/static/js/chunk-254ac533.30f5dec3.js
  20. 0 0
      dist/static/js/chunk-276e7119.2b5512a9.js
  21. 0 0
      dist/static/js/chunk-293ff8b0.cf41af87.js
  22. 0 0
      dist/static/js/chunk-2d0d3705.eff0d350.js
  23. 0 0
      dist/static/js/chunk-35464144.6682967e.js
  24. 0 0
      dist/static/js/chunk-386d37cb.d794a615.js
  25. 0 0
      dist/static/js/chunk-3d8a6649.8b554330.js
  26. 0 0
      dist/static/js/chunk-44eee83d.2b2237a9.js
  27. 0 0
      dist/static/js/chunk-4ac7f82e.63c45bb6.js
  28. 0 0
      dist/static/js/chunk-52f685c2.826bce96.js
  29. 0 0
      dist/static/js/chunk-5a3bdf57.64103f8a.js
  30. 0 0
      dist/static/js/chunk-5bc2c8fb.ed74d8da.js
  31. 0 0
      dist/static/js/chunk-5c6eee35.50ee6563.js
  32. 0 0
      dist/static/js/chunk-6111b966.3a35e3d4.js
  33. 0 0
      dist/static/js/chunk-632c3578.5d0f633e.js
  34. 0 0
      dist/static/js/chunk-683feb49.490e12ab.js
  35. 0 0
      dist/static/js/chunk-6a80e4ca.b6f04299.js
  36. 0 0
      dist/static/js/chunk-6ddf6871.43e70104.js
  37. 0 0
      dist/static/js/chunk-708604c0.2bde8970.js
  38. 0 0
      dist/static/js/chunk-708c45dc.cb1b9e42.js
  39. 0 0
      dist/static/js/chunk-727cb4e9.75151a3c.js
  40. 0 0
      dist/static/js/chunk-77a58a9f.b132b26c.js
  41. 0 0
      dist/static/js/chunk-77bc8fb9.da1cc9dc.js
  42. 0 0
      dist/static/js/chunk-7a88741c.1e9e85c2.js
  43. 0 0
      dist/static/js/chunk-9235c1ae.32a7f7e3.js
  44. 0 0
      dist/static/js/chunk-94c1ef28.60421ed5.js
  45. 0 0
      dist/static/js/chunk-b9d5d1c4.ed2702ab.js
  46. 0 0
      dist/static/js/chunk-be07077e.c8334d05.js
  47. 0 0
      dist/static/js/chunk-d9ef2ea8.d46e5bce.js
  48. 0 0
      dist/static/js/chunk-def78608.adafde64.js
  49. 0 0
      dist/static/js/chunk-ec55d346.945622de.js
  50. 0 0
      dist/static/js/chunk-libs.0503faa9.js
  51. 1 0
      package.json
  52. 10 0
      src/api/knowledge.js
  53. 52 11
      src/layout/components/Sidebar/Item.vue
  54. 11 0
      src/main.js
  55. 7 7
      src/router/index.js
  56. 468 133
      src/views/appConfig/index.vue
  57. 69 13
      src/views/document/com/components/sourceEs/index.vue
  58. 16 6
      src/views/document/com/editor.vue
  59. 78 7
      src/views/document/create.vue

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
dist/index.html


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
dist/static/css/app.d80fbb88.css


+ 1 - 0
dist/static/css/chunk-048e3da4.680f8f1c.css

@@ -0,0 +1 @@
+.header[data-v-67e46fa8]{margin-left:20px}.header h2[data-v-67e46fa8]{margin-bottom:0}.center[data-v-67e46fa8]{margin:10px}.center[data-v-67e46fa8] .el-form--inline .el-form-item{display:block}.center[data-v-67e46fa8] .el-input-number--medium{width:150px}.footer[data-v-67e46fa8]{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:end;-ms-flex-pack:end;justify-content:flex-end;margin:0 100px 20px}[data-v-67e46fa8] .avatar-uploader .el-upload{border:1px dashed #d9d9d9;border-radius:6px;cursor:pointer;position:relative;overflow:hidden}.avatar-uploader .el-upload[data-v-67e46fa8]:hover{border-color:#409eff}.avatar-uploader-icon[data-v-67e46fa8]{font-size:28px;color:#8c939d;width:100px;height:100px;line-height:100px;text-align:center}.avatar[data-v-67e46fa8]{width:100px;height:100px;display:block}.hint[data-v-67e46fa8]{font-size:12px;color:#c0c4cc}

+ 0 - 0
dist/static/css/chunk-b9d5d1c4.5e1eb2f5.css → dist/static/css/chunk-5c6eee35.5e1eb2f5.css


+ 0 - 1
dist/static/css/chunk-d9ef2ea8.ca62898c.css

@@ -1 +0,0 @@
-.header[data-v-af168464]{margin-left:20px}.header h2[data-v-af168464]{margin-bottom:0}.center[data-v-af168464]{margin:10px}.center[data-v-af168464] .el-form--inline .el-form-item{display:block}.center[data-v-af168464] .el-input-number--medium{width:150px}.footer[data-v-af168464]{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:end;-ms-flex-pack:end;justify-content:flex-end;margin:0 100px 20px}[data-v-af168464] .avatar-uploader .el-upload{border:1px dashed #d9d9d9;border-radius:6px;cursor:pointer;position:relative;overflow:hidden}.avatar-uploader .el-upload[data-v-af168464]:hover{border-color:#409eff}.avatar-uploader-icon[data-v-af168464]{font-size:28px;color:#8c939d;width:100px;height:100px;line-height:100px;text-align:center}.avatar[data-v-af168464]{width:100px;height:100px;display:block}.hint[data-v-af168464]{font-size:12px;color:#c0c4cc}

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
dist/static/css/chunk-def78608.c1b0ee2b.css


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
dist/static/js/app.9f513d7e.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
dist/static/js/app.e8706178.js


+ 0 - 0
dist/static/js/chunk-01f26467.149420dd.js → dist/static/js/chunk-01f26467.2aacedbb.js


+ 0 - 0
dist/static/js/chunk-022fc394.205936ff.js → dist/static/js/chunk-022fc394.341f561c.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
dist/static/js/chunk-048e3da4.dbf953dd.js


+ 0 - 0
dist/static/js/chunk-04ba33be.f6b73bba.js → dist/static/js/chunk-04ba33be.ed4f0e8d.js


+ 0 - 0
dist/static/js/chunk-09f78c22.e375255e.js → dist/static/js/chunk-09f78c22.fe0059e3.js


+ 0 - 0
dist/static/js/chunk-0a1f2758.66738697.js → dist/static/js/chunk-0a1f2758.13a763e7.js


+ 0 - 0
dist/static/js/chunk-0ec56e2a.21536c30.js → dist/static/js/chunk-0ec56e2a.7dd43bdb.js


+ 0 - 0
dist/static/js/chunk-10bfc27e.889b7ca2.js → dist/static/js/chunk-10bfc27e.22203d9f.js


+ 0 - 0
dist/static/js/chunk-11ff1a32.7aac27ab.js → dist/static/js/chunk-11ff1a32.8826a9db.js


+ 0 - 0
dist/static/js/chunk-138f7583.d7e12a33.js → dist/static/js/chunk-138f7583.8e34047a.js


+ 0 - 0
dist/static/js/chunk-254ac533.941f6a78.js → dist/static/js/chunk-254ac533.30f5dec3.js


+ 0 - 0
dist/static/js/chunk-276e7119.73419d07.js → dist/static/js/chunk-276e7119.2b5512a9.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
dist/static/js/chunk-293ff8b0.cf41af87.js


+ 0 - 0
dist/static/js/chunk-2d0d3705.05bfe8f1.js → dist/static/js/chunk-2d0d3705.eff0d350.js


+ 0 - 0
dist/static/js/chunk-35464144.71c42830.js → dist/static/js/chunk-35464144.6682967e.js


+ 0 - 0
dist/static/js/chunk-386d37cb.012c24c5.js → dist/static/js/chunk-386d37cb.d794a615.js


+ 0 - 0
dist/static/js/chunk-3d8a6649.3df84389.js → dist/static/js/chunk-3d8a6649.8b554330.js


+ 0 - 0
dist/static/js/chunk-44eee83d.d95ed6ec.js → dist/static/js/chunk-44eee83d.2b2237a9.js


+ 0 - 0
dist/static/js/chunk-4ac7f82e.d3ae498c.js → dist/static/js/chunk-4ac7f82e.63c45bb6.js


+ 0 - 0
dist/static/js/chunk-52f685c2.a7d5332e.js → dist/static/js/chunk-52f685c2.826bce96.js


+ 0 - 0
dist/static/js/chunk-5a3bdf57.315dbfee.js → dist/static/js/chunk-5a3bdf57.64103f8a.js


+ 0 - 0
dist/static/js/chunk-5bc2c8fb.da2b669c.js → dist/static/js/chunk-5bc2c8fb.ed74d8da.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
dist/static/js/chunk-5c6eee35.50ee6563.js


+ 0 - 0
dist/static/js/chunk-6111b966.594749ca.js → dist/static/js/chunk-6111b966.3a35e3d4.js


+ 0 - 0
dist/static/js/chunk-632c3578.4fe16f8d.js → dist/static/js/chunk-632c3578.5d0f633e.js


+ 0 - 0
dist/static/js/chunk-683feb49.f15a4691.js → dist/static/js/chunk-683feb49.490e12ab.js


+ 0 - 0
dist/static/js/chunk-6a80e4ca.e806e11e.js → dist/static/js/chunk-6a80e4ca.b6f04299.js


+ 0 - 0
dist/static/js/chunk-6ddf6871.10b5aa48.js → dist/static/js/chunk-6ddf6871.43e70104.js


+ 0 - 0
dist/static/js/chunk-708604c0.f21fb729.js → dist/static/js/chunk-708604c0.2bde8970.js


+ 0 - 0
dist/static/js/chunk-708c45dc.e98e89b6.js → dist/static/js/chunk-708c45dc.cb1b9e42.js


+ 0 - 0
dist/static/js/chunk-727cb4e9.cef6e336.js → dist/static/js/chunk-727cb4e9.75151a3c.js


+ 0 - 0
dist/static/js/chunk-77a58a9f.b7849931.js → dist/static/js/chunk-77a58a9f.b132b26c.js


+ 0 - 0
dist/static/js/chunk-77bc8fb9.777fcd92.js → dist/static/js/chunk-77bc8fb9.da1cc9dc.js


+ 0 - 0
dist/static/js/chunk-7a88741c.f949857f.js → dist/static/js/chunk-7a88741c.1e9e85c2.js


+ 0 - 0
dist/static/js/chunk-9235c1ae.ff5eeec8.js → dist/static/js/chunk-9235c1ae.32a7f7e3.js


+ 0 - 0
dist/static/js/chunk-94c1ef28.1b7d20c7.js → dist/static/js/chunk-94c1ef28.60421ed5.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
dist/static/js/chunk-b9d5d1c4.ed2702ab.js


+ 0 - 0
dist/static/js/chunk-be07077e.0ba86d4d.js → dist/static/js/chunk-be07077e.c8334d05.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
dist/static/js/chunk-d9ef2ea8.d46e5bce.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
dist/static/js/chunk-def78608.adafde64.js


+ 0 - 0
dist/static/js/chunk-ec55d346.a6293acf.js → dist/static/js/chunk-ec55d346.945622de.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
dist/static/js/chunk-libs.0503faa9.js


+ 1 - 0
package.json

@@ -34,6 +34,7 @@
     "dropzone": "5.5.1",
     "echarts": "4.2.1",
     "element-ui": "^2.15.6",
+    "feather-icons": "^4.29.2",
     "file-saver": "^2.0.5",
     "fuse.js": "3.4.4",
     "handsontable": "^14.1.0",

+ 10 - 0
src/api/knowledge.js

@@ -654,4 +654,14 @@ export function update_items(data) {
     method: 'post',
     data
   })
+}
+
+/* 模糊查找文档 documents/search */
+
+export function vague_search(data) {
+  return request({
+    url: 'documents/search',
+    method: 'post',
+    data
+  })
 }

+ 52 - 11
src/layout/components/Sidebar/Item.vue

@@ -1,35 +1,43 @@
 <script>
 export default {
-  name: 'MenuItem',
+  name: "MenuItem",
   functional: true,
   props: {
     icon: {
       type: String,
-      default: ''
+      default: "",
     },
     title: {
       type: String,
-      default: ''
-    }
+      default: "",
+    },
   },
   render(h, context) {
-    const { icon, title } = context.props
-    const vnodes = []
-
+    const { icon, title } = context.props;
+    const vnodes = [];
+    /* 
     if (icon) {
       if (icon.includes('el-icon')) {
         vnodes.push(<i class={[icon, 'sub-el-icon']} />)
       } else {
         vnodes.push(<svg-icon icon-class={icon}/>)
       }
+    } */
+    if (icon) {
+      if (icon.includes("el-icon")) {
+        vnodes.push(<i class={[icon, "sub-el-icon"]} />);
+      } else {
+        // 添加自定义类名以控制图标大小
+        vnodes.push(<i data-feather={icon} class="feather-icon"></i>);
+      }
     }
 
     if (title) {
-      vnodes.push(<span slot='title'>{(title)}</span>)
+      vnodes.push(<span slot="title">{title}</span>);
     }
-    return vnodes
-  }
-}
+    return vnodes;
+  },
+};
 </script>
 
 <style scoped>
@@ -38,4 +46,37 @@ export default {
   width: 1em;
   height: 1em;
 }
+/* 修改 feather 图标样式 */
+[data-feather] {
+  width: 1em;
+  height: 1em;
+  margin-right: 5px;
+  stroke: currentColor;
+}
+/* 自定义 feather 图标样式 */
+.feather-icon {
+  display: inline-block;
+  width: 16px !important; /* 使用 !important 确保覆盖 feather 默认样式 */
+  height: 16px !important;
+  margin-right: 8px;
+  stroke: currentColor;
+  stroke-width: 2;
+  stroke-linecap: round;
+  stroke-linejoin: round;
+  fill: none;
+}
+
+/* 如果需要在悬停时改变大小 */
+/* .feather-icon:hover {
+  width: 18px !important;
+  height: 18px !important;
+} */
+
+/* 如果需要响应式大小 */
+@media screen and (min-width: 768px) {
+  .feather-icon {
+    width: 20px !important;
+    height: 20px !important;
+  }
+}
 </style>

+ 11 - 0
src/main.js

@@ -92,6 +92,17 @@ import DataV from '@jiaminghi/data-view'
 
 Vue.use(DataV)
 
+import feather from 'feather-icons';
+
+// 在 mounted 钩子中初始化 Feather Icons
+Vue.mixin({
+  mounted() {
+    feather.replace();
+  },
+  updated() {
+    feather.replace();
+  }
+});
 
 
 new Vue({

+ 7 - 7
src/router/index.js

@@ -80,7 +80,7 @@ export const constantRoutes = [
         component: () => import('@/views/dashboard/index'),
         name: 'Dashboard',
 
-        meta: { title: '用户首页', icon: 'dashboards', affix: true }
+        meta: { title: '用户首页', icon:'home', affix: true }//'dashboards'
       }
     ]
   },
@@ -164,7 +164,7 @@ export const asyncRoutes = [
     type:1,
     meta: {
       title: '项目管理',
-      icon: 'paizhao-01-20',
+      icon: 'briefcase',//'paizhao-01-20',
       roles: ['admin']
     },
     children: [
@@ -188,7 +188,7 @@ export const asyncRoutes = [
     type:4,
     meta: {
       title: '客户管理',
-      icon: 'kehus',
+      icon: 'users',//kehus
       roles: ['admin']
     },
     children: [
@@ -243,7 +243,7 @@ export const asyncRoutes = [
     type:10,
     meta: {
       title: '文档管理',
-      icon: 'wendangs'
+      icon: 'file-text'//'wendangs'
     },
     children: [
       {
@@ -293,7 +293,7 @@ export const asyncRoutes = [
     type:32,
     meta: {
       title: '知识库',
-      icon: 'zhisk',
+      icon: 'book-open',//zhisk
       roles: ['admin']
     },
     children: [
@@ -387,7 +387,7 @@ export const asyncRoutes = [
     type:37,
     meta: {
       title: '小程序管理',
-      icon: 'applets',
+      icon: 'smartphone',//applets
       roles: ['admin']
     },
     children: [
@@ -411,7 +411,7 @@ export const asyncRoutes = [
     type:21,
     meta: {
       title: '系统设置',
-      icon: '系统设置',
+      icon: 'settings',//系统设置
       roles: ['admin']
     },
     children: [

+ 468 - 133
src/views/appConfig/index.vue

@@ -87,6 +87,13 @@
         </el-row>
         <el-row :gutter="24">
           <el-col :span="12">
+            <el-form-item label="文档/目录:" prop="">
+              <el-radio v-model="radio" label="1">目录</el-radio>
+              <el-radio v-model="radio" label="2">文档</el-radio>
+            </el-form-item>
+            <!--  --></el-col
+          >
+          <el-col :span="12" v-if="radio == '1'">
             <el-form-item label="文档目录:" prop="document_directories">
               <el-select
                 v-model="AIform.document_directories"
@@ -103,9 +110,11 @@
                   :value="dir.id"
                   :key="index"
                 ></el-option>
-              </el-select> </el-form-item
-          ></el-col>
-          <el-col :span="12">
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <!-- Show document selection for both cases -->
+          <el-col :span="12" v-else>
             <el-form-item label="文  档:" prop="documents">
               <el-select
                 v-model="AIform.documents"
@@ -115,6 +124,9 @@
                 :disabled="isDocumentSelectDisabled"
                 clearable
                 filterable
+                remote
+                :remote-method="remoteSearch"
+                :loading="loading"
                 @change="handleDocumentChange"
               >
                 <el-option label="全部" value="all"></el-option>
@@ -527,17 +539,18 @@
         </el-row>
         <el-row :gutter="24">
           <el-col :span="12">
+            <el-form-item label="文档/目录:" prop="">
+              <el-radio v-model="editForm.radio" label="1">目录</el-radio>
+              <el-radio v-model="editForm.radio" label="2">文档</el-radio>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12" v-if="editForm.radio == '1'">
             <el-form-item label="文档目录:" prop="document_directories">
               <el-select
                 v-model="editForm.document_directories"
                 placeholder="请选择文档目录"
                 style="width: 55%"
-                :disabled="
-                  !(
-                    editForm.knowledge_base_names &&
-                    editForm.knowledge_base_names.length
-                  )
-                "
+                :disabled="!editForm.knowledge_base_names.length"
                 @change="handleEditDirectoryChange"
                 clearable
                 filterable
@@ -551,16 +564,19 @@
               </el-select>
             </el-form-item>
           </el-col>
-          <el-col :span="12">
+          <el-col :span="12" v-else>
             <el-form-item label="文  档:" prop="documents">
               <el-select
                 v-model="editForm.documents"
                 multiple
                 placeholder="请选择文档"
                 style="width: 55%"
-                :disabled="editForm.document_directories == ''"
+                :disabled="!editForm.knowledge_base_names.length"
                 clearable
                 filterable
+                remote
+                :remote-method="remoteEditSearch"
+                :loading="editLoading"
                 @change="handleEditDocumentChange"
               >
                 <el-option label="全部" value="all"></el-option>
@@ -976,6 +992,16 @@
         </el-row>
         <el-row :gutter="24">
           <el-col :span="12">
+            <el-form-item label="文档/目录:" prop="">
+              <el-radio v-model="viewForm.radio" label="1" disabled
+                >目录</el-radio
+              >
+              <el-radio v-model="viewForm.radio" label="2" disabled
+                >文档</el-radio
+              >
+            </el-form-item>
+          </el-col>
+          <el-col :span="12" v-if="viewForm.radio == '1'">
             <el-form-item label="文档目录:" prop="document_directories">
               <el-select
                 v-model="viewForm.document_directories"
@@ -995,7 +1021,7 @@
               </el-select>
             </el-form-item>
           </el-col>
-          <el-col :span="12">
+          <el-col :span="12" v-else>
             <el-form-item label="文  档:" prop="documents">
               <el-select
                 v-model="viewForm.documents"
@@ -1373,6 +1399,7 @@ import {
   application_types,
   set_default,
   configurationInfo,
+  vague_search,
 } from "@/api/knowledge";
 export default {
   /*组件参数 接收来自父组件的数据*/
@@ -1508,6 +1535,9 @@ export default {
         application_type: "",
         is_default: false,
         generate_new_api_key: true,
+        radio: "1",
+        tempDocuments: [], // 用于临时存储文档数据
+        tempDirectories: [], // 用于临时存储目录数据
       },
       editDirectoryList: [],
       editDocumentList: [],
@@ -1542,11 +1572,15 @@ export default {
         is_default: false,
         generate_new_api_key: true,
         aiagent_icon: "",
+        radio: "1",
       },
       params: {
         token: "",
       },
       uploadUrl: "",
+      radio: "1",
+      loading: false, // 添加loading状态
+      editLoading: false,
     };
   },
 
@@ -1573,15 +1607,46 @@ export default {
       }
     },
     isDocumentSelectDisabled() {
-      return (
-        !this.AIform.knowledge_base_names.length ||
-        this.AIform.document_directories == ""
-      );
+      // Modify the disabled logic based on radio selection
+      if (this.radio === "1") {
+        return (
+          !this.AIform.knowledge_base_names.length ||
+          this.AIform.document_directories == ""
+        );
+      } else {
+        return !this.AIform.knowledge_base_names.length;
+      }
     },
   },
 
   /*侦听器*/
-  watch: {},
+  watch: {
+    "editForm.radio": {
+      handler(newVal, oldVal) {
+        if (newVal === "1") {
+          // 切换到目录模式
+          // 保存当前文档选择
+          this.editForm.tempDocuments = [...(this.editForm.documents || [])];
+          // 恢复之前的目录选择
+          if (this.editForm.tempDirectories.length > 0) {
+            this.editForm.document_directories = [
+              ...this.editForm.tempDirectories,
+            ];
+          }
+        } else {
+          // 切换到文档模式
+          // 保存当前目录选择
+          this.editForm.tempDirectories = [
+            ...(this.editForm.document_directories || []),
+          ];
+          // 恢复之前的文档选择
+          if (this.editForm.tempDocuments.length > 0) {
+            this.editForm.documents = [...this.editForm.tempDocuments];
+          }
+        }
+      },
+    },
+  },
 
   /*
    * el 被新创建的 vm.$ el 替换,并挂载到实例上去之后调用该钩子。
@@ -1608,20 +1673,157 @@ export default {
 
   /*组件方法*/
   methods: {
+    // 编辑模式的远程搜索方法
+    remoteEditSearch(query) {
+      if (query !== "") {
+        this.editLoading = true;
+        // 构建搜索参数
+        const searchParams = {
+          kb_id: this.editForm.knowledge_base_names, // 当前选中的知识库ID
+          keyword: query, // 搜索关键词
+          limit: 10, // 限制返回数量
+        };
+
+        // 如果是目录模式且选择了目录,添加目录ID
+        if (this.editForm.radio === "1" && this.editForm.document_directories) {
+          searchParams.doc_type_id = this.editForm.document_directories;
+        }
+
+        // 调用模糊搜索接口
+        vague_search(searchParams)
+          .then((response) => {
+            this.editDocumentList = response.data.items || [];
+          })
+          .catch((error) => {
+            console.error("搜索文档失败:", error);
+            this.$message.error("搜索文档失败");
+          })
+          .finally(() => {
+            this.editLoading = false;
+          });
+      } else {
+        // 当搜索词为空时,恢复原始文档列表
+        if (this.editForm.radio === "1") {
+          // 目录模式:加载选中目录的文档
+          if (this.editForm.document_directories) {
+            this.loadEditDocumentList(this.editForm.document_directories);
+          }
+        } else {
+          // 文档模式:加载所有文档
+          if (this.editForm.knowledge_base_names.length > 0) {
+            this.loadAllEditDocuments(this.editForm.knowledge_base_names[0]);
+          }
+        }
+      }
+    },
+    // 添加加载所有文档的方法
+    loadAllEditDocuments(kbId) {
+      this.editLoading = true;
+      let queryForm = {
+        page: 1,
+        pageSize: 9999,
+        bucket_id: kbId,
+        doc_type_id: "",
+      };
+
+      getBucketContents(queryForm)
+        .then((res) => {
+          this.editDocumentList = res.data.documents;
+        })
+        .finally(() => {
+          this.editLoading = false;
+        });
+    },
+    // 远程搜索方法
+    remoteSearch(query) {
+      if (query !== "") {
+        this.loading = true;
+        // 构建搜索参数
+        const searchParams = {
+          kb_id: this.AIform.knowledge_base_names, // 当前选中的知识库ID
+          keyword: query, // 搜索关键词
+          limit: 10, // 限制返回数量
+        };
+
+        // 如果是目录模式且选择了目录,添加目录ID
+        if (this.radio === "1" && this.AIform.document_directories) {
+          searchParams.doc_type_id = this.AIform.document_directories;
+        }
+
+        // 调用模糊搜索接口
+        vague_search(searchParams)
+          .then((response) => {
+            this.documentList = response.data.items || [];
+          })
+          .catch((error) => {
+            console.error("搜索文档失败:", error);
+            this.$message.error("搜索文档失败");
+          })
+          .finally(() => {
+            this.loading = false;
+          });
+      } else {
+        // 当搜索词为空时,恢复原始文档列表
+        if (this.radio === "1") {
+          // 目录模式:加载选中目录的文档
+          if (this.AIform.document_directories) {
+            this.loadDocumentList(this.AIform.document_directories);
+          }
+        } else {
+          // 文档模式:加载所有文档
+          if (this.AIform.knowledge_base_names.length > 0) {
+            this.loadAllDocuments(this.AIform.knowledge_base_names[0]);
+          }
+        }
+      }
+    },
+    // 修改加载所有文档的方法,添加loading状态
+    loadAllDocuments(kbId) {
+      this.loading = true;
+      let queryForm = {
+        page: 1,
+        pageSize: 9999,
+        bucket_id: kbId,
+        doc_type_id: "",
+      };
+
+      getBucketContents(queryForm)
+        .then((res) => {
+          this.documentList = res.data.documents;
+        })
+        .finally(() => {
+          this.loading = false;
+        });
+    },
+
     /* 编辑 */
     /* 上传图标 */
     onUploadEditSuccess(e) {
       this.editForm.aiagent_icon = e.data.fileUrl;
     },
+    // 修改文档选择处理方法
     handleEditDocumentChange(selectedValues) {
       if (selectedValues.includes("all")) {
         // 如果选择了"全部",则清空其他选项
         this.editForm.documents = ["all"];
       } else {
-        // 如果没有选择"全部",则限制最多选择10个文档
-        if (selectedValues.length > 10) {
-          this.editForm.documents = selectedValues.slice(0, 10);
+        // 获取当前选中的文档ID列表
+        const currentSelectedIds = new Set(selectedValues);
+
+        // 保留原有未删除的文档
+        const originalDocs = this.editForm.tempDocuments.filter(
+          (doc) => !doc.startsWith("temp_") && !currentSelectedIds.has(doc)
+        );
+
+        // 合并原有文档和新选择的文档
+        const allDocs = [...originalDocs, ...selectedValues];
+
+        // 如果总数超过10个,保留最新的文档
+        if (allDocs.length > 10) {
+          this.editForm.documents = allDocs.slice(-10);
           this.$message.warning("最多只能选择10个文档");
+        } else {
+          this.editForm.documents = allDocs;
         }
       }
     },
@@ -1630,8 +1832,10 @@ export default {
       this.$refs.editFormRef.validate(async (valid) => {
         if (valid) {
           try {
+            // 深拷贝表单数据
             const convertedForm = { ...this.editForm };
-            // 处理 role_permissions
+
+            // 处理 role_permissions 和 custom_variables
             const parsedPermissions = this.validateAndParseJSON(
               "role_permissions",
               "角色权限格式无效"
@@ -1639,38 +1843,87 @@ export default {
             if (!parsedPermissions) return;
             convertedForm.role_permissions = parsedPermissions;
 
-            // 处理 custom_variables
             const parsedVariables = this.validateAndParseJSON(
               "custom_variables",
               "自定义变量格式无效"
             );
             if (!parsedVariables) return;
             convertedForm.custom_variables = parsedVariables;
-            // 转换知识库、文档目录和文档的ID为名称
-            /*  convertedForm.knowledge_base_names = this.safeGetNamesByIds(this.editForm.knowledge_base_names, this.kneList); */
-            /*  convertedForm.documents = this.safeGetNamesByIds(this.editForm.documents, this.editDocumentList); */
-            // 处理文档选择
-            if (
-              convertedForm.documents.includes("all") ||
-              convertedForm.documents.length === 0
-            ) {
-              convertedForm.documents = []; // 全选或未选择时传空数组给后台
+
+            // 根据 radio 值处理文档和目录数据
+            if (convertedForm.radio === "1") {
+              // 目录模式:只提交目录数据,清空文档数据
+              convertedForm.documents = [];
+              // 如果选择了目录,则使用新选择的目录
+              if (this.editForm.document_directories) {
+                convertedForm.document_directories = this.safeGetNamesByIds(
+                  [this.editForm.document_directories],
+                  this.editDirectoryList
+                );
+              } else {
+                // 如果没有选择新目录,保留原有目录
+                convertedForm.document_directories =
+                  this.editForm.tempDirectories;
+              }
             } else {
-              convertedForm.documents = this.safeGetNamesByIds(
-                convertedForm.documents,
-                this.editDocumentList
-              );
-            }
-            convertedForm.document_directories = this.safeGetNamesByIds(
-              this.editForm.document_directories,
-              this.editDirectoryList
-            );
-            if (convertedForm.document_directories.length === 0) {
-              convertedForm.document_directories = ["全部"];
+              // 文档模式:只提交文档数据,清空目录数据
+              convertedForm.document_directories = [];
+
+              // 处理文档选择
+              if (convertedForm.documents.includes("all")) {
+                convertedForm.documents = ["全部"]; // 全选时传 "全部"
+              } else {
+                // 获取当前选中的文档ID列表
+                const currentSelectedIds = new Set(convertedForm.documents);
+
+                // 获取原有未删除的文档
+                const originalDocs = this.editForm.tempDocuments.filter(
+                  (doc) =>
+                    !doc.startsWith("temp_") && !currentSelectedIds.has(doc)
+                );
+
+                // 合并原有文档和新选择的文档
+                const allSelectedDocs = new Set([
+                  ...originalDocs,
+                  ...convertedForm.documents,
+                ]);
+
+                // 转换文档 ID 为名称
+                convertedForm.documents = Array.from(allSelectedDocs)
+                  .map((docId) => {
+                    // 如果是原有文档名称,直接使用
+                    if (typeof docId === "string" && !docId.match(/^[0-9]+$/)) {
+                      return docId;
+                    }
+                    // 否则查找文档名称
+                    const doc = this.editDocumentList.find(
+                      (d) => d.id === docId
+                    );
+                    return doc ? doc.name : null;
+                  })
+                  .filter((name) => name !== null); // 过滤掉未找到的文档
+
+                // 如果文档数量超过限制,保留前10个
+                if (convertedForm.documents.length > 10) {
+                  convertedForm.documents = convertedForm.documents.slice(
+                    0,
+                    10
+                  );
+                  this.$message.warning(
+                    "已超出最大文档数量限制,仅保留前10个文档"
+                  );
+                }
+              }
             }
 
+            // 删除不需要提交的临时数据和radio值
+            delete convertedForm.tempDocuments;
+            delete convertedForm.tempDirectories;
+            delete convertedForm.radio;
+
             console.log("Converted form for edit:", convertedForm);
 
+            // 发送请求
             const response = await axios.post(
               `${process.env.VUE_APP_BASE_API}/chatbot/configuration/update/`,
               convertedForm,
@@ -1685,9 +1938,7 @@ export default {
               this.$message.success("应用更新成功");
               this.$router.push({
                 path: "/knowledge/chatPage/index",
-              }); //跳转到聊天应用页面
-              /* this.editDialogVisible = false; */
-              /* this.fetchApplicationList(); */
+              });
             } else {
               this.$message.error(response.data.message || "应用更新失败");
             }
@@ -1702,19 +1953,26 @@ export default {
       });
     },
     handleEditKnowledgeBaseChange(val) {
-      // 重置目录和文档选择
-      this.editForm.document_directories = [];
-      this.editForm.documents = [];
-      this.editDocumentList = [];
-      // 加载新选择的知识库对应的目录列表
-      this.loadEditDirectoryList(val);
+      if (val && val.length > 0) {
+        // 只在有选择知识库时重置
+        if (this.editForm.radio === "1") {
+          this.editForm.document_directories = [];
+          this.editForm.documents = [];
+        } else {
+          this.editForm.documents = [];
+          // 加载初始文档列表
+          this.loadAllEditDocuments(val[0]);
+        }
+        this.editDocumentList = [];
+        this.loadEditDirectoryList(val);
+      }
     },
     handleEditDirectoryChange(val) {
-      // 重置文档选择
-      this.editForm.documents = [];
-
-      // 加载选中目录对应的文档列表
-      this.loadEditDocumentList(val);
+      if (this.editForm.radio === "1") {
+        // 只在目录模式下清空文档选择
+        this.editForm.documents = [];
+        this.loadEditDocumentList(val);
+      }
     },
     /* 知识库选择监听 */
     async loadEditDirectoryList(val) {
@@ -1930,9 +2188,9 @@ export default {
               this.AIform.document_directories,
               this.directoryList
             );
-            if (convertedForm.document_directories.length === 0) {
+            /* if (convertedForm.document_directories.length === 0) {
               convertedForm.document_directories = ["全部"];
-            }
+            } */
 
             console.log("Converted form:", convertedForm);
 
@@ -2059,17 +2317,23 @@ export default {
       // 这里需要调用后端 API 来获取文档列表
       this.loadDocumentList(val);
     },
+    // 修改原有的加载文档列表方法,添加loading状态
     loadDocumentList(val) {
-      const id = this.directoryList.find((el) => el.id == val);
+      this.loading = true;
       let queryForm = {
         page: 1,
         pageSize: 9999,
-        bucket_id: val == "001" ? this.bucket_id : id.kb_id, //this.bucket_id,
-        doc_type_id: val == "001" ? "" : val,
+        bucket_id: this.bucket_id,
+        doc_type_id: val === "001" ? "" : val,
       };
-      getBucketContents(queryForm).then((res) => {
-        this.documentList = res.data.documents;
-      });
+
+      getBucketContents(queryForm)
+        .then((res) => {
+          this.documentList = res.data.documents;
+        })
+        .finally(() => {
+          this.loading = false;
+        });
     },
     /* 获取列表 */
     init() {
@@ -2095,24 +2359,67 @@ export default {
         this.appTypeList = res.data.application_types;
       });
     },
-    /* 编辑查看 */
+    /* 编辑 */
+    // 修改 initEdit 方法
     async initEdit() {
-      // 深拷贝以避免直接修改原对象
-      this.editForm = JSON.parse(JSON.stringify(this.$route.query.card));
+      try {
+        // 深拷贝以避免直接修改原对象
+        this.editForm = JSON.parse(JSON.stringify(this.$route.query.card));
 
-      // 处理 role_permissions 和 custom_variables
-      this.handleJsonFields();
+        // 确保必要的属性都被初始化
+        this.editForm = {
+          ...this.editForm,
+          document_directories: this.editForm.document_directories || [],
+          documents: this.editForm.documents || [],
+          radio: "1", // 默认值
+        };
 
-      // 并行加载知识库目录列表
-      const directoryListPromise = this.loadEditDirectoryList(
-        this.editForm.knowledge_base_names
-      );
+        // 处理 role_permissions 和 custom_variables
+        this.handleJsonFields();
 
-      // 等待目录列表加载完成
-      await directoryListPromise;
+        // 设置 radio 的值
+        if (Array.isArray(this.editForm.document_directories)) {
+          if (this.editForm.document_directories.length === 0) {
+            this.editForm.radio = "2";
+          }
+        } else {
+          this.editForm.radio = "2";
+        }
 
-      // 处理目录和文档选择
-      this.handleDirectoryAndDocumentSelection();
+        if (Array.isArray(this.editForm.documents)) {
+          if (
+            this.editForm.documents.length === 0 &&
+            this.editForm.radio !== "2"
+          ) {
+            this.editForm.radio = "1";
+          }
+        }
+        // 初始化临时存储,保存原始数据
+        this.editForm.tempDocuments = Array.isArray(this.editForm.documents)
+          ? [...this.editForm.documents]
+          : [];
+        this.editForm.tempDirectories = Array.isArray(
+          this.editForm.document_directories
+        )
+          ? [...this.editForm.document_directories]
+          : [];
+        // 并行加载知识库目录列表
+        if (
+          this.editForm.knowledge_base_names &&
+          this.editForm.knowledge_base_names.length > 0
+        ) {
+          const directoryListPromise = this.loadEditDirectoryList(
+            this.editForm.knowledge_base_names
+          );
+          await directoryListPromise;
+        }
+
+        // 处理目录和文档选择
+        await this.handleDirectoryAndDocumentSelection();
+      } catch (error) {
+        console.error("Error in initEdit:", error);
+        this.$message.error("初始化编辑表单时出错");
+      }
     },
 
     async handleDirectoryAndDocumentSelection() {
@@ -2191,69 +2498,97 @@ export default {
         this.editForm.custom_variables = "";
       }
     },
-    /* 查看 */
+    // 同样修改 initView 方法
     initView() {
-      // 根据 card 的数据填充 viewForm
-      this.viewForm = JSON.parse(JSON.stringify(this.$route.query.card)); // 深拷贝以避免直接修改原对象
-
-      // 处理 knowledge_base_names
-      this.viewForm.knowledge_base_names =
-        this.viewForm.knowledge_base_names.map((name) => {
-          const kb = this.kneList.find((kb) => kb.name === name);
-          return kb ? kb.id : name; // 如果找不到对应的知识库,保留原名称
-        });
+      try {
+        // 根据 card 的数据填充 viewForm
+        this.viewForm = JSON.parse(JSON.stringify(this.$route.query.card));
 
-      // 处理 role_permissions
-      if (this.viewForm.role_permissions) {
-        if (typeof this.viewForm.role_permissions !== "string") {
-          try {
-            this.viewForm.role_permissions = JSON.stringify(
-              this.viewForm.role_permissions
-            );
-          } catch (error) {
-            console.error("Error stringifying role_permissions:", error);
-            this.viewForm.role_permissions = "";
+        // 确保必要的属性都被初始化
+        this.viewForm = {
+          ...this.viewForm,
+          document_directories: this.viewForm.document_directories || [],
+          documents: this.viewForm.documents || [],
+          radio: "1", // 默认值
+        };
+
+        // 设置 radio 的值
+        if (Array.isArray(this.viewForm.document_directories)) {
+          if (this.viewForm.document_directories.length === 0) {
+            this.viewForm.radio = "2";
           }
+        } else {
+          this.viewForm.radio = "2";
         }
-      } else {
-        this.viewForm.role_permissions = "";
-      }
 
-      // 处理 custom_variables
-      if (this.viewForm.custom_variables) {
-        this.viewForm.custom_variables = JSON.stringify(
-          this.viewForm.custom_variables
-        );
-      } else {
-        this.viewForm.custom_variables = "";
-      }
+        if (Array.isArray(this.viewForm.documents)) {
+          if (
+            this.viewForm.documents.length === 0 &&
+            this.viewForm.radio !== "2"
+          ) {
+            this.viewForm.radio = "1";
+          }
+        }
 
-      // 处理文档选择
-      if (
-        !this.viewForm.documents ||
-        this.viewForm.documents.length === 0 ||
-        this.viewForm.documents.includes("全部")
-      ) {
-        this.viewForm.documents = ["全部"];
-      } else {
-        // 将文档名称转换为ID(如果需要的话)
-        this.viewForm.documents = this.viewForm.documents.map((docName) => {
-          const doc = this.editDocumentList.find((d) => d.name === docName);
-          return doc ? doc.id : docName;
-        });
+        // 处理 knowledge_base_names
+        if (
+          this.viewForm.knowledge_base_names &&
+          Array.isArray(this.viewForm.knowledge_base_names)
+        ) {
+          this.viewForm.knowledge_base_names =
+            this.viewForm.knowledge_base_names.map((name) => {
+              const kb = this.kneList.find((kb) => kb.name === name);
+              return kb ? kb.id : name;
+            });
+        } else {
+          this.viewForm.knowledge_base_names = [];
+        }
+
+        // 处理 role_permissions 和 custom_variables
+        if (this.viewForm.role_permissions) {
+          if (typeof this.viewForm.role_permissions !== "string") {
+            try {
+              this.viewForm.role_permissions = JSON.stringify(
+                this.viewForm.role_permissions
+              );
+            } catch (error) {
+              console.error("Error stringifying role_permissions:", error);
+              this.viewForm.role_permissions = "";
+            }
+          }
+        } else {
+          this.viewForm.role_permissions = "";
+        }
+
+        if (this.viewForm.custom_variables) {
+          this.viewForm.custom_variables = JSON.stringify(
+            this.viewForm.custom_variables
+          );
+        } else {
+          this.viewForm.custom_variables = "";
+        }
+
+        // 处理文档选择
+        if (
+          !this.viewForm.documents ||
+          !Array.isArray(this.viewForm.documents) ||
+          this.viewForm.documents.length === 0 ||
+          this.viewForm.documents.includes("全部")
+        ) {
+          this.viewForm.documents = ["全部"];
+        }
+
+        // 加载知识库对应的目录列表
+        if (
+          this.viewForm.knowledge_base_names &&
+          this.viewForm.knowledge_base_names.length > 0
+        ) {
+          this.loadEditDirectoryList(this.viewForm.knowledge_base_names);
+        }
+      } catch (error) {
+        console.error("Error in initView:", error);
+        this.$message.error("初始化查看表单时出错");
       }
-      /* // 处理文档选择
-       if (this.editForm.documents.length === 0 || this.editForm.documents.includes('全部')) {
-        this.editForm.documents = ['all'];
-      } else {
-        // 将文档名称转换为ID
-        this.editForm.documents = this.editForm.documents.map(docName => {
-          const doc = this.editDocumentList.find(d => d.name === docName);
-          return doc ? doc.id : docName;
-        });
-      } */
-      // 加载知识库对应的目录列表
-      this.loadEditDirectoryList(this.viewForm.knowledge_base_names);
     },
   },
 };

+ 69 - 13
src/views/document/com/components/sourceEs/index.vue

@@ -82,25 +82,81 @@ export default {
       // 去重
       this.matchResults = [...new Set(allMatches)];
     }, */
-    searchEx() {
+    /*  searchEx() {
       let allMatches = [];
 
-      // 从所有模板内容中提取匹配的代码
       this.TemList.forEach((el) => {
-        // 使用正则表达式匹配 [字母数字-字母数字-数字-数字] 格式的内容
-        const matches = el.content.match(
-          /\[[A-Z0-9]+-[A-Z0-9]+-[0-9]+-[0-9]+\]/g
-        );
+        // 匹配特定格式的编号
+        const pattern = /[【\[][A-Z0-9]+-[A-Z0-9]+-[0-9]+-[0-9]+[】\]]/g;
+        const matches = el.content.match(pattern);
+
         if (matches) {
-          allMatches = [...allMatches, ...matches];
+          matches.forEach((match) => {
+            // 检查是否符合 FT8-RP-00-XXX 格式
+            if (match.includes("FT8-RP-00-")) {
+              allMatches.push(match);
+            }
+          });
         }
       });
-      // 去重后存储结果
+
+      this.matchResults = [...new Set(allMatches)];
+      console.log("匹配结果:", this.matchResults);
+    }, */
+    searchEx() {
+      let allMatches = [];
+
+      this.TemList.forEach((el) => {
+        // 创建临时 div 来解析 HTML 内容
+        const tempDiv = document.createElement("div");
+        tempDiv.innerHTML = el.content;
+        const plainText = tempDiv.textContent || tempDiv.innerText;
+
+        // 分别匹配中文括号和英文括号
+        const patterns = [
+          /【([A-Z]{1,4}[0-9]{0,2})-([A-Z]{1,4}[0-9]{0,2})-([0-9]{2})-([0-9]{2,3})】/g,
+          /\[([A-Z]{1,4}[0-9]{0,2})-([A-Z]{1,4}[0-9]{0,2})-([0-9]{2})-([0-9]{2,3})\]/g,
+        ];
+
+        patterns.forEach((pattern) => {
+          let match;
+          while ((match = pattern.exec(plainText)) !== null) {
+            const fullMatch = match[0];
+            const segments = [match[1], match[2], match[3], match[4]];
+
+            // 验证每个段落的格式
+            const isValid = segments.every((segment) => segment.length > 0);
+
+            if (isValid) {
+              allMatches.push(fullMatch);
+            }
+          }
+        });
+      });
+
       this.matchResults = [...new Set(allMatches)];
+      console.log("匹配结果:", this.matchResults);
 
-      // 如果需要立即按类型分类,可以添加:
-      const categorized = this.categorizeByType(this.matchResults);
-      console.log("分类结果:", categorized);
+      // 调试用:打印每个匹配的详细信息
+      this.matchResults.forEach((match) => {
+        console.log("找到匹配:", match);
+        // 根据括号类型选择不同的切片方式
+        const content = match.startsWith("【")
+          ? match.slice(1, -1)
+          : match.slice(1, -1);
+        const parts = content.split("-");
+        console.log("分段:", parts);
+      });
+    },
+
+    // 更新 escapeRegExp 方法以支持两种括号类型
+    escapeRegExp(string) {
+      const isChinese = string.startsWith("【");
+      const content = isChinese
+        ? string.replace(/^【|】$/g, "")
+        : string.replace(/^\[|\]$/g, "");
+      const escaped = content.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&");
+      return isChinese ? `\\【${escaped}\\】` : `\\[${escaped}\\]`;
     },
 
     // 新增分类方法
@@ -317,12 +373,12 @@ export default {
     },
     // 辅助方法:转义正则表达式特殊字符
     // 修改 escapeRegExp 方法
-    escapeRegExp(string) {
+    /*   escapeRegExp(string) {
       // 先去掉首尾的方括号,然后转义特殊字符
       const content = string.replace(/^\[|\]$/g, "");
       const escaped = content.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&");
       return "\\[" + escaped + "\\]";
-    },
+    }, */
     /* 检索当前模版的所有内容 */
     /*  searchEx() {
       console.log("TemList", this.TemList);

+ 16 - 6
src/views/document/com/editor.vue

@@ -27,7 +27,7 @@
             <div style="padding: 10px 0">
               <el-form label-position="left" class="inline-form">
                 <el-row :gutter="24" style="margin-left: 0; margin-right: 0">
-                  <el-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
+                  <el-col :xs="24" :sm="24" :md="12" :lg="4" :xl="4">
                     <el-form-item label="模块分类:">
                       <!-- 此处需要处理为只有admin账号可编辑 -->
                       <!--  <el-cascader
@@ -61,7 +61,7 @@
                       }}</span>
                     </el-form-item>
                   </el-col>
-                  <el-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
+                  <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
                     <el-form-item label="模块名称:">
                       <!--  <el-input
                         v-if="showCategoryName(it)"
@@ -69,9 +69,19 @@
                         v-model="it.name"
                         placeholder="请填写模块名称"
                       />v-else -->
-                      <span @click="enableName(it)" style="cursor: pointer">{{
-                        it.name
-                      }}</span>
+                      <div
+                       :title="it.name"
+                        @click="enableName(it)"
+                        style="
+                          cursor: pointer;
+                          max-width: 400px; 
+                          white-space: nowrap; 
+                          overflow: hidden; 
+                          text-overflow: ellipsis; 
+                        "
+                      >
+                        {{ it.name }}
+                      </div>
                     </el-form-item>
                   </el-col>
                   <!-- <el-col :span="6">
@@ -266,7 +276,7 @@ export default {
         if (JSON.stringify(this.comList) !== JSON.stringify(newComList)) {
           this.comList = newComList;
         } */
-         console.log("val", val);
+        console.log("val", val);
         this.comList = JSON.parse(JSON.stringify(val));
         console.log("comList", this.comList);
         /*   console.log("val", val);

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

@@ -114,7 +114,17 @@
                     data-type="article"
                     class="sub-menus"
                   >
-                    <div @click="onLoadArticle(it.id)" style="cursor: pointer">
+                    <div
+                      @click="onLoadArticle(it.id)"
+                      :title="it.title"
+                      style="
+                        cursor: pointer;
+                        white-space: nowrap;
+                        overflow: hidden; /* 隐藏超出部分 */
+                        text-overflow: ellipsis; /* 显示省略号 */
+                        max-width: 100%;
+                      "
+                    >
                       {{ it.title }}
                     </div>
                   </div>
@@ -132,7 +142,17 @@
                     data-type="article"
                     class="sub-menus"
                   >
-                    <div @click="onTemplateInfo(it.id)" style="cursor: pointer">
+                    <div
+                      @click="onTemplateInfo(it.id)"
+                      :title="it.title"
+                      style="
+                        cursor: pointer;
+                        white-space: nowrap;
+                        overflow: hidden; /* 隐藏超出部分 */
+                        text-overflow: ellipsis; /* 显示省略号 */
+                        width: 100%;
+                      "
+                    >
                       {{ it.title }}
                     </div>
                   </div>
@@ -301,7 +321,16 @@
                                         ) in fiveChild.dataList"
                                         :key="fiveIndex"
                                       >
-                                        <div style="cursor: move">
+                                        <div
+                                          :title="fiveIts.name"
+                                          style="
+                                            cursor: move;
+                                            white-space: nowrap;
+                                            overflow: hidden; /* 隐藏超出部分 */
+                                            text-overflow: ellipsis; /* 显示省略号 */
+                                            width: 100%;
+                                          "
+                                        >
                                           {{ fiveIts.name }}
                                         </div>
                                       </div>
@@ -325,7 +354,16 @@
                                     ) in greatGrandChild.dataList"
                                     :key="index"
                                   >
-                                    <div style="cursor: move">
+                                    <div
+                                      :title="its.name"
+                                      style="
+                                        cursor: move;
+                                        white-space: nowrap;
+                                        overflow: hidden; /* 隐藏超出部分 */
+                                        text-overflow: ellipsis; /* 显示省略号 */
+                                        width: 100%;
+                                      "
+                                    >
                                       {{ its.name }}
                                     </div>
                                   </div>
@@ -347,7 +385,18 @@
                                 v-for="(it, index) in grandChild.dataList"
                                 :key="index"
                               >
-                                <div style="cursor: move">{{ it.name }}</div>
+                                <div
+                                  :title="it.name"
+                                  style="
+                                    cursor: move;
+                                    white-space: nowrap;
+                                    overflow: hidden; /* 隐藏超出部分 */
+                                    text-overflow: ellipsis; /* 显示省略号 */
+                                    width: 100%;
+                                  "
+                                >
+                                  {{ it.name }}
+                                </div>
                               </div>
                             </transition-group>
                           </draggable>
@@ -367,7 +416,18 @@
                             v-for="(it, index) in child.dataList"
                             :key="index"
                           >
-                            <div style="cursor: move">{{ it.name }}</div>
+                            <div
+                              :title="it.name"
+                              style="
+                                cursor: move;
+                                white-space: nowrap;
+                                overflow: hidden; /* 隐藏超出部分 */
+                                text-overflow: ellipsis; /* 显示省略号 */
+                                width: 100%;
+                              "
+                            >
+                              {{ it.name }}
+                            </div>
                           </div>
                         </transition-group>
                       </draggable>
@@ -387,7 +447,18 @@
                         v-for="(it, index) in item.dataList"
                         :key="index"
                       >
-                        <div style="cursor: move">{{ it.name }}</div>
+                        <div
+                          :title="it.name"
+                          style="
+                            cursor: move;
+                            white-space: nowrap;
+                            overflow: hidden; /* 隐藏超出部分 */
+                            text-overflow: ellipsis; /* 显示省略号 */
+                            width: 100%;
+                          "
+                        >
+                          {{ it.name }}
+                        </div>
                       </div>
                     </transition-group>
                   </draggable>

Vissa filer visades inte eftersom för många filer har ändrats