Prechádzať zdrojové kódy

处理bug,优化部分页面并打包

yangg 10 mesiacov pred
rodič
commit
7d8dd5545d
68 zmenil súbory, kde vykonal 1293 pridanie a 540 odobranie
  1. 1 1
      .env.development
  2. 0 0
      dist/index.html
  3. 0 0
      dist/static/css/app.ef51d095.css
  4. 0 0
      dist/static/css/chunk-0d5b56aa.641e9b71.css
  5. 0 0
      dist/static/css/chunk-2234fa65.7131743c.css
  6. 0 0
      dist/static/css/chunk-24067204.775a21e3.css
  7. 0 0
      dist/static/css/chunk-3834b15c.e30e9787.css
  8. 0 0
      dist/static/css/chunk-551d786c.7131743c.css
  9. 0 0
      dist/static/css/chunk-5ea048a8.a820ab87.css
  10. 0 0
      dist/static/css/chunk-6887eea4.91dce10a.css
  11. 0 0
      dist/static/css/chunk-6a2a74ef.e30e9787.css
  12. 0 1
      dist/static/css/chunk-6f812974.e30e9787.css
  13. 0 0
      dist/static/css/chunk-81c5f682.a12d40e0.css
  14. 0 0
      dist/static/css/chunk-81c5f682.e9b0ec9a.css
  15. 0 0
      dist/static/css/chunk-882f79f4.6f8877c6.css
  16. 0 0
      dist/static/css/chunk-88964510.e30e9787.css
  17. BIN
      dist/static/img/logo.6943e121.png
  18. 0 0
      dist/static/js/app.b6e8d384.js
  19. 0 0
      dist/static/js/app.e134e78c.js
  20. 0 0
      dist/static/js/chunk-05cbf9fe.9ae4f646.js
  21. 0 0
      dist/static/js/chunk-0d5b56aa.6563ef66.js
  22. 0 0
      dist/static/js/chunk-1ca9cd02.59126495.js
  23. 0 0
      dist/static/js/chunk-2234fa65.44b6a854.js
  24. 0 0
      dist/static/js/chunk-24067204.e996c129.js
  25. 0 0
      dist/static/js/chunk-3834b15c.d5c7200c.js
  26. 0 0
      dist/static/js/chunk-4c810402.f6fecff9.js
  27. 0 0
      dist/static/js/chunk-4ff485a4.8a808b11.js
  28. 0 0
      dist/static/js/chunk-5045afd2.b7291cbc.js
  29. 0 0
      dist/static/js/chunk-551d786c.68fcee43.js
  30. 0 0
      dist/static/js/chunk-5ea048a8.1356e809.js
  31. 0 0
      dist/static/js/chunk-6887eea4.0e5b85f2.js
  32. 0 0
      dist/static/js/chunk-6a2a74ef.31bffac1.js
  33. 0 0
      dist/static/js/chunk-6f812974.283def1a.js
  34. 0 0
      dist/static/js/chunk-78a82ed8.ce97cdeb.js
  35. 0 0
      dist/static/js/chunk-85f7b51a.451b0848.js
  36. 0 0
      dist/static/js/chunk-882f79f4.9182835f.js
  37. 0 0
      dist/static/js/chunk-88964510.4ce37822.js
  38. 0 0
      dist/static/js/chunk-b439df4a.428b354a.js
  39. 7 1
      src/api/AdminAuth.js
  40. 8 1
      src/api/template.js
  41. BIN
      src/assets/images/logo.png
  42. BIN
      src/assets/images/logo1.png
  43. 2 2
      src/layout/components/Sidebar/Logo.vue
  44. 2 2
      src/router/index.js
  45. 6 6
      src/views/auth/components/dataList.vue
  46. 1 1
      src/views/dashboard/admin/components/PanelGroup.vue
  47. 2 2
      src/views/dashboard/admin/components/TransactionTable.vue
  48. 4 4
      src/views/dataCenter/category/components/dataSearch.vue
  49. 32 1
      src/views/dataCenter/components/dataList.vue
  50. 64 20
      src/views/document/com/components/Attribute/index.vue
  51. 373 110
      src/views/document/com/components/Formula/dataInfo.vue
  52. 8 2
      src/views/document/com/components/Formula/index.vue
  53. 1 0
      src/views/document/com/components/SourceData/index.vue
  54. 42 27
      src/views/document/com/components/TextArea/index.vue
  55. 21 3
      src/views/document/com/components/Variable/dataInfo.vue
  56. 224 167
      src/views/document/com/components/Variable/index.vue
  57. 12 6
      src/views/document/com/menus.vue
  58. 33 2
      src/views/document/com/view.vue
  59. 9 1
      src/views/document/components/dataList.vue
  60. 2 2
      src/views/document/create.scss
  61. 142 41
      src/views/document/create.vue
  62. 2 2
      src/views/document/temList/components/dataList.vue
  63. 1 1
      src/views/login/index.scss
  64. 119 2
      src/views/role/components/dataInfo.vue
  65. 148 119
      src/views/template/category/components/dataInfo.vue
  66. 25 11
      src/views/template/category/components/dataList.vue
  67. 1 1
      src/views/template/components/dataList.vue
  68. 1 1
      src/views/template/components/dataSearch.vue

+ 1 - 1
.env.development

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

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 0 - 0
dist/index.html


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 0 - 0
dist/static/css/app.ef51d095.css


+ 0 - 0
dist/static/css/chunk-5045afd2.641e9b71.css → dist/static/css/chunk-0d5b56aa.641e9b71.css


+ 0 - 0
dist/static/css/chunk-05cbf9fe.7131743c.css → dist/static/css/chunk-2234fa65.7131743c.css


+ 0 - 0
dist/static/css/chunk-be124c14.775a21e3.css → dist/static/css/chunk-24067204.775a21e3.css


+ 0 - 0
dist/static/css/chunk-1ca9cd02.e30e9787.css → dist/static/css/chunk-3834b15c.e30e9787.css


+ 0 - 0
dist/static/css/chunk-796d0180.7131743c.css → dist/static/css/chunk-551d786c.7131743c.css


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 0 - 0
dist/static/css/chunk-5ea048a8.a820ab87.css


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 0 - 0
dist/static/css/chunk-6887eea4.91dce10a.css


+ 0 - 0
dist/static/css/chunk-4c810402.e30e9787.css → dist/static/css/chunk-6a2a74ef.e30e9787.css


+ 0 - 1
dist/static/css/chunk-6f812974.e30e9787.css

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

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 0 - 0
dist/static/css/chunk-81c5f682.a12d40e0.css


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 0 - 0
dist/static/css/chunk-81c5f682.e9b0ec9a.css


+ 0 - 0
dist/static/css/chunk-b439df4a.6f8877c6.css → dist/static/css/chunk-882f79f4.6f8877c6.css


+ 0 - 0
dist/static/css/chunk-4ff485a4.6044f932.css → dist/static/css/chunk-88964510.e30e9787.css


BIN
dist/static/img/logo.6943e121.png


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 0 - 0
dist/static/js/app.b6e8d384.js


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 0 - 0
dist/static/js/app.e134e78c.js


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 0 - 0
dist/static/js/chunk-05cbf9fe.9ae4f646.js


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 0 - 0
dist/static/js/chunk-0d5b56aa.6563ef66.js


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 0 - 0
dist/static/js/chunk-1ca9cd02.59126495.js


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 0 - 0
dist/static/js/chunk-2234fa65.44b6a854.js


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 0 - 0
dist/static/js/chunk-24067204.e996c129.js


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 0 - 0
dist/static/js/chunk-3834b15c.d5c7200c.js


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 0 - 0
dist/static/js/chunk-4c810402.f6fecff9.js


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 0 - 0
dist/static/js/chunk-4ff485a4.8a808b11.js


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 0 - 0
dist/static/js/chunk-5045afd2.b7291cbc.js


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 0 - 0
dist/static/js/chunk-551d786c.68fcee43.js


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 0 - 0
dist/static/js/chunk-5ea048a8.1356e809.js


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 0 - 0
dist/static/js/chunk-6887eea4.0e5b85f2.js


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 0 - 0
dist/static/js/chunk-6a2a74ef.31bffac1.js


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 0 - 0
dist/static/js/chunk-6f812974.283def1a.js


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 0 - 0
dist/static/js/chunk-78a82ed8.ce97cdeb.js


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 0 - 0
dist/static/js/chunk-85f7b51a.451b0848.js


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 0 - 0
dist/static/js/chunk-882f79f4.9182835f.js


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 0 - 0
dist/static/js/chunk-88964510.4ce37822.js


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 0 - 0
dist/static/js/chunk-b439df4a.428b354a.js


+ 7 - 1
src/api/AdminAuth.js

@@ -58,6 +58,12 @@ export function deleteAdminAuth(data) {
 }
 }
 
 
 
 
-
+export function searchAdminPage(data) {
+  return request({
+    url: '/admin/auth/listpage',
+    method: 'post',
+    data
+  })
+}
 
 
 
 

+ 8 - 1
src/api/template.js

@@ -113,6 +113,13 @@ export function updateTemplate(data) {
 }
 }
 
 
 
 
+/*template/category/allList  */
 
 
 
 
-
+export function getAllList(data) {
+  return request({
+    url: '/template/category/allList',
+    method: 'post',
+    data
+  })
+}

BIN
src/assets/images/logo.png


BIN
src/assets/images/logo1.png


+ 2 - 2
src/layout/components/Sidebar/Logo.vue

@@ -2,11 +2,11 @@
   <div class="sidebar-logo-container" :class="{'collapse':collapse}">
   <div class="sidebar-logo-container" :class="{'collapse':collapse}">
     <transition name="sidebarLogoFade">
     <transition name="sidebarLogoFade">
       <router-link v-if="collapse" key="collapse" class="sidebar-logo-link" to="/">
       <router-link v-if="collapse" key="collapse" class="sidebar-logo-link" to="/">
-        <img v-if="logo" :src="logo" class="sidebar-logo">
+        <img v-if="logo" src="@/assets/images/logo.png" class="sidebar-logo">
         <h1 v-else class="sidebar-title">{{ title }} </h1>
         <h1 v-else class="sidebar-title">{{ title }} </h1>
       </router-link>
       </router-link>
       <router-link v-else key="expand" class="sidebar-logo-link" to="/">
       <router-link v-else key="expand" class="sidebar-logo-link" to="/">
-        <img v-if="logo" :src="logo" class="sidebar-logo">
+        <img v-if="logo" src="@/assets/images/logo.png" class="sidebar-logo">
         <h1 class="sidebar-title">{{ title }} </h1>
         <h1 class="sidebar-title">{{ title }} </h1>
       </router-link>
       </router-link>
     </transition>
     </transition>

+ 2 - 2
src/router/index.js

@@ -332,12 +332,12 @@ export const asyncRoutes = [
         hidden:true,
         hidden:true,
         meta: { title: '修改角色',  noCache: true,roles: ['admin'] }
         meta: { title: '修改角色',  noCache: true,roles: ['admin'] }
       },
       },
-      {
+      /* {
         path: 'auth/index',
         path: 'auth/index',
         component: () => import('@/views/auth/search'),
         component: () => import('@/views/auth/search'),
         name: 'auth',
         name: 'auth',
         meta: { title: '权限配置',  noCache: true,roles: ['admin'] }
         meta: { title: '权限配置',  noCache: true,roles: ['admin'] }
-      },
+      }, */
       // {
       // {
       //   path: 'flow/index',
       //   path: 'flow/index',
       //   component: () => import('@/views/flow/search'),
       //   component: () => import('@/views/flow/search'),

+ 6 - 6
src/views/auth/components/dataList.vue

@@ -20,7 +20,7 @@
                 <div v-if="scope.row.type==999">操作权限</div>
                 <div v-if="scope.row.type==999">操作权限</div>
             </template>
             </template>
         </el-table-column>
         </el-table-column>
-        <el-table-column prop="createTime" label="创建时间" align="center" width="150"/>
+        <el-table-column prop="create_time" label="创建时间" align="center" width="150"/>
         <el-table-column prop="status" label="角色状态" align="center" width="150">
         <el-table-column prop="status" label="角色状态" align="center" width="150">
             <template #default="scope">
             <template #default="scope">
                 <div v-if="scope.row.status==5">启用</div>
                 <div v-if="scope.row.status==5">启用</div>
@@ -63,7 +63,7 @@
 </template>
 </template>
 
 
 <script>
 <script>
-  import{searchAdminAuth,deleteAdminAuth} from'@/api/AdminAuth';
+  import{searchAdminPage,deleteAdminAuth} from'@/api/AdminAuth';
   import dataInfo from './dataInfo.vue';
   import dataInfo from './dataInfo.vue';
   import elDragDialog from '@/directive/el-drag-dialog'
   import elDragDialog from '@/directive/el-drag-dialog'
   export default{
   export default{
@@ -162,11 +162,11 @@
       //搜索
       //搜索
       search(){
       search(){
         let _this=this;
         let _this=this;
-        searchAdminAuth(_this.queryForm).then(res=>{
+        searchAdminPage(_this.queryForm).then(res=>{
           if(!res)return;
           if(!res)return;
-          _this.dataList=res.data.dataList;
-          _this.recordCount=res.data.totalRecord;
-          _this.pageTotal=res.data.totalPage;
+          _this.dataList=res.data.data;
+          _this.recordCount=res.data.page;
+          _this.pageTotal=res.data.total;
         })
         })
       },
       },
       //修改分页
       //修改分页

+ 1 - 1
src/views/dashboard/admin/components/PanelGroup.vue

@@ -33,7 +33,7 @@
         </div>
         </div>
         <div class="card-panel-description">
         <div class="card-panel-description">
           <div class="card-panel-text">
           <div class="card-panel-text">
-            组件数量
+            模块数量
           </div>
           </div>
           <count-to :start-val="0" :end-val="2" :duration="3200" class="card-panel-num" />
           <count-to :start-val="0" :end-val="2" :duration="3200" class="card-panel-num" />
         </div>
         </div>

+ 2 - 2
src/views/dashboard/admin/components/TransactionTable.vue

@@ -2,12 +2,12 @@
   <el-table :data="list" style="width: 100%;padding-top: 15px;">
   <el-table :data="list" style="width: 100%;padding-top: 15px;">
     <el-table-column label="文档名称" min-width="200">
     <el-table-column label="文档名称" min-width="200">
       <template slot-scope="scope">
       <template slot-scope="scope">
-         文档001
+         {{scope.row.title}}
       </template>
       </template>
     </el-table-column>
     </el-table-column>
     <el-table-column label="时间" min-width="150">
     <el-table-column label="时间" min-width="150">
       <template slot-scope="scope">
       <template slot-scope="scope">
-         2023-10-11
+        {{scope.row.createTime}}
       </template>
       </template>
     </el-table-column>
     </el-table-column>
 
 

+ 4 - 4
src/views/dataCenter/category/components/dataSearch.vue

@@ -6,11 +6,11 @@
           <el-input v-model="queryForm.name" placeholder="请选择分类名称"></el-input>
           <el-input v-model="queryForm.name" placeholder="请选择分类名称"></el-input>
         </el-form-item>
         </el-form-item>
         <el-form-item label="分类状态:">
         <el-form-item label="分类状态:">
-          <el-select v-model="queryForm.status" class="m-2" placeholder="请选择分类状态" size="large">
+          <el-select v-model="queryForm.status" class="m-2" placeholder="请选择分类状态" size="large" clearable>
               <el-option
               <el-option
-                v-for="item in statusOptions"
-                :key="item.value"
-                :label="item.name"
+                v-for="(item,index) in statusOptions"
+                :key="index"
+                :label="item.label"
                 :value="item.value"
                 :value="item.value"
               />
               />
             </el-select>
             </el-select>

+ 32 - 1
src/views/dataCenter/components/dataList.vue

@@ -7,7 +7,11 @@
         <el-table-column prop="code" label="编码" align="center" min-width="120"/>
         <el-table-column prop="code" label="编码" align="center" min-width="120"/>
         <el-table-column prop="name" label="名称" align="center" min-width="200"/>
         <el-table-column prop="name" label="名称" align="center" min-width="200"/>
 
 
-        <el-table-column prop="category.name" label="所属分类" align="center" min-width="150"/>
+        <el-table-column prop="category.name" label="所属分类" align="center" min-width="150">
+          <template #default="scope">
+            {{categoryName(scope.row.category_id)  }}
+          </template>
+        </el-table-column>
         <el-table-column prop="createTime" label="创建时间" align="center" min-width="150"/>
         <el-table-column prop="createTime" label="创建时间" align="center" min-width="150"/>
         <el-table-column prop="status" label="分类状态" align="center" min-width="180">
         <el-table-column prop="status" label="分类状态" align="center" min-width="180">
           <template #default="scope">
           <template #default="scope">
@@ -57,6 +61,12 @@
 
 
 <script>
 <script>
   import{searchSourceData,deleteSourceData} from'@/api/sourceData';
   import{searchSourceData,deleteSourceData} from'@/api/sourceData';
+  import {
+  searchSourceDataCategory,
+  createSourceData,
+  updateSourceData,
+  getSourceData,
+} from "@/api/sourceData";
   import dataInfo from './dataInfo.vue';
   import dataInfo from './dataInfo.vue';
   import dataView from './dataView.vue';
   import dataView from './dataView.vue';
   import elDragDialog from '@/directive/el-drag-dialog'
   import elDragDialog from '@/directive/el-drag-dialog'
@@ -111,13 +121,34 @@
         dataList:[],
         dataList:[],
         currentData:{},
         currentData:{},
         loading: false, // Add loading state
         loading: false, // Add loading state
+        categoryList:[]
       }
       }
     },
     },
     mounted() {
     mounted() {
       this.search();
       this.search();
       this.authority()
       this.authority()
+      this.initCategory()
     },
     },
     methods:{
     methods:{
+      /* 获取分类名称 */
+      categoryName(e){
+        return this.categoryList.find(el => el.id === e)?.name;
+      },
+      initCategory() {
+      let _this = this;
+      searchSourceDataCategory({ page: 1, pageSize: 9999, status: 5 }).then(
+        (res) => {
+          if (res.status != 200) return;
+          _this.categoryList = res.data.sourcecategories.map((res) => {
+            return {
+              id: res.id,
+              value: res.id,
+              name: res.name,
+            };
+          });
+        }
+      );
+    },
       authority(){
       authority(){
         console.log(this.$store.state.user.roleInfo.id);
         console.log(this.$store.state.user.roleInfo.id);
       },
       },

+ 64 - 20
src/views/document/com/components/Attribute/index.vue

@@ -2,34 +2,37 @@
   <div class="editor-attribute" v-if="com != null">
   <div class="editor-attribute" v-if="com != null">
     <el-form>
     <el-form>
       <el-form-item label="模块分类:">
       <el-form-item label="模块分类:">
-        <el-select
+        <!--  <el-select
           v-model="com.category_id"
           v-model="com.category_id"
           placeholder="请选择模块分类"
           placeholder="请选择模块分类"
           size="large"
           size="large"
           style="width: 100%"
           style="width: 100%"
-          ><!-- @change="onChangeCategory" -->
+          >
           <el-option
           <el-option
             v-for="item in categoryList"
             v-for="item in categoryList"
             :key="item.id"
             :key="item.id"
             :label="item.name"
             :label="item.name"
             :value="item.id"
             :value="item.id"
           />
           />
-        </el-select>
-        <!-- <el-cascader
-              v-model="com.category_id"
-              :options="categoryList"
-              :props="props"
-              @change="onChangeCategory"
-              placeholder="请选择模块分类"
-            /> -->
+        </el-select> -->
+        <!-- @change="onChangeCategory" -->
+        <el-cascader
+          v-model="com.category_id"
+          :options="categoryList"
+          clearable
+          :props="props"
+          :show-all-levels="false"
+          @change="onChangeCategory"
+          placeholder="请选择模块分类"
+        />
       </el-form-item>
       </el-form-item>
-      <el-form-item label="模块引用名:">
+     <!--  <el-form-item label="模块引用名:">
         <el-input
         <el-input
           v-model="com.code"
           v-model="com.code"
           class="input-item"
           class="input-item"
           placeholder="请填写模块引用名"
           placeholder="请填写模块引用名"
         />
         />
-      </el-form-item>
+      </el-form-item> -->
       <el-form-item label="模块名称:">
       <el-form-item label="模块名称:">
         <el-input
         <el-input
           v-model="com.name"
           v-model="com.name"
@@ -59,7 +62,7 @@
           >
           >
         </div>
         </div>
       </el-form-item>
       </el-form-item>
-       <!-- 文本开始-->
+      <!-- 文本开始-->
       <!-- <template v-for="(sub, subIndex) in com.attrs">
       <!-- <template v-for="(sub, subIndex) in com.attrs">
        
        
         <template v-if="com.type == 'TextArea'">
         <template v-if="com.type == 'TextArea'">
@@ -113,7 +116,12 @@
 import headerSetting from "./headerSetting";
 import headerSetting from "./headerSetting";
 import elDragDialog from "@/directive/el-drag-dialog";
 import elDragDialog from "@/directive/el-drag-dialog";
 
 
-import { getAllCategory, createTemplate, updateTemplate } from "@/api/template";
+import {
+  getAllCategory,
+  createTemplate,
+  updateTemplate,
+  getAllList,
+} from "@/api/template";
 import { searchSourceDataCategory } from "@/api/sourceData";
 import { searchSourceDataCategory } from "@/api/sourceData";
 import { searchDocumentCategory } from "@/api/document";
 import { searchDocumentCategory } from "@/api/document";
 import { searchTemplateCategory, searchTemplate } from "@/api/template";
 import { searchTemplateCategory, searchTemplate } from "@/api/template";
@@ -145,6 +153,7 @@ export default {
         value: "id",
         value: "id",
         label: "name",
         label: "name",
         children: "children",
         children: "children",
+        checkStrictly: true,
       },
       },
     };
     };
   },
   },
@@ -172,9 +181,10 @@ export default {
       this.onSaveTemplate();
       this.onSaveTemplate();
     },
     },
 
 
-    onChangeCategory(e) {
+    onChangeCategory(value) {
       let _this = this;
       let _this = this;
-      _this.com.category_id = e[1];
+      /* _this.com.category_id = e[1]; */
+      this.com.category_id = value[value.length - 1];
     },
     },
 
 
     onSaveTemplate(e) {
     onSaveTemplate(e) {
@@ -182,8 +192,9 @@ export default {
       /* e.category_id='1' */
       /* e.category_id='1' */
       let data = JSON.parse(JSON.stringify(e));
       let data = JSON.parse(JSON.stringify(e));
       data.attrs = JSON.stringify(data.attrs);
       data.attrs = JSON.stringify(data.attrs);
+      data.code=data.name
       data.status = 5;
       data.status = 5;
-      delete data.category;
+      data.category_id = this.com.category_id;
       if (data.id == undefined || this.saveAs) {
       if (data.id == undefined || this.saveAs) {
         createTemplate(data).then((res) => {
         createTemplate(data).then((res) => {
           if (res.status != 200) return;
           if (res.status != 200) return;
@@ -209,22 +220,55 @@ export default {
             
             
           })
           })
       }, */
       }, */
+    processDataForCascader(data) {
+      console.log("Raw data:", data); // 调试原始数据
+      const idMap = new Map();
+      const rootItems = [];
+
+      // First pass: create a map of all items
+      data.forEach((item) => {
+        const processedItem = { ...item, children: [] };
+        idMap.set(item.id, processedItem);
+      });
+
+      // Second pass: build the tree structure
+      data.forEach((item) => {
+        if (item.parent_id === "0" || item.parent_id === 0) {
+          rootItems.push(idMap.get(item.id));
+        } else {
+          const parent = idMap.get(parseInt(item.parent_id));
+          if (parent) {
+            parent.children.push(idMap.get(item.id));
+          } else {
+            console.warn(
+              `Parent with id ${item.parent_id} not found for item:`,
+              item
+            );
+            rootItems.push(idMap.get(item.id)); // 如果找不到父项,作为根项添加
+          }
+        }
+      });
+
+      console.log("Processed data:", rootItems); // 调试处理后的数据
+      return rootItems;
+    },
     //获取模板分类信息
     //获取模板分类信息
     async initCategoryList() {
     async initCategoryList() {
       let _this = this;
       let _this = this;
-      let res = await searchTemplateCategory({
+      let res = await getAllList();
+      this.categoryList = this.processDataForCascader(res.data);
+      /* let res = await searchTemplateCategory({
         page: 1,
         page: 1,
         pageSize: 99,
         pageSize: 99,
         status: 5,
         status: 5,
       });
       });
       if (res.status != 200) return;
       if (res.status != 200) return;
-      /* _this.categoryList = res.data.dataList; */
       _this.categoryList = res.data.dataList || [];
       _this.categoryList = res.data.dataList || [];
       for (var i = 0; i < _this.categoryList.length; i++) {
       for (var i = 0; i < _this.categoryList.length; i++) {
         _this.categoryList[i].dataList = await _this.getTemplateList(
         _this.categoryList[i].dataList = await _this.getTemplateList(
           _this.categoryList[i].id
           _this.categoryList[i].id
         );
         );
-      }
+      } */
     },
     },
 
 
     onModify(index, subIndex, headerIndex) {
     onModify(index, subIndex, headerIndex) {

+ 373 - 110
src/views/document/com/components/Formula/dataInfo.vue

@@ -2,154 +2,417 @@
   <div class="data-info">
   <div class="data-info">
     <el-card>
     <el-card>
       <el-form :model="dataForm" label-width="120px">
       <el-form :model="dataForm" label-width="120px">
-
         <el-form-item label="公式名称:">
         <el-form-item label="公式名称:">
           <el-input v-model="dataForm.name"></el-input>
           <el-input v-model="dataForm.name"></el-input>
         </el-form-item>
         </el-form-item>
 
 
         <el-form-item label="公式:">
         <el-form-item label="公式:">
           <el-input type="textarea" v-model="dataForm.formula"></el-input>
           <el-input type="textarea" v-model="dataForm.formula"></el-input>
+          <div style="display: flex; justify-content: flex-end">
+            <el-button style="margin-top: 10px" @click="InsertTableData"
+              >插入表格数据</el-button
+            >
+            <el-button style="margin-top: 10px" @click="InsertModule"
+              >插入模块变量</el-button
+            >
+          </div>
           <div class="intro">
           <div class="intro">
             公式说明:
             公式说明:
-            <div>格式一:[T][模块引用名][属性引用名]    <span>*</span>其中 [T]表示的是模块引用。</div>
-            <div>格式二:[R][表名][Sheet名称][row,col]   <span>*</span>其中 [R]表示引用的是原始数据。 其中row,col表示excel表中的行、列序号</div>
+            <div>
+              格式一:[T][模块引用名][属性引用名] <span>*</span>其中
+              [T]表示的是模块引用。
+            </div>
+            <div>
+              格式二:[R][表名][Sheet名称][row,col] <span>*</span>其中
+              [R]表示引用的是原始数据。 其中row,col表示excel表中的行、列序号
+            </div>
             <div>目前仅支持+、-、*、/ 四种计算符合</div>
             <div>目前仅支持+、-、*、/ 四种计算符合</div>
             <div>示例 [T][模块01][attr01]+[T][模块01][attr02]</div>
             <div>示例 [T][模块01][attr01]+[T][模块01][attr02]</div>
           </div>
           </div>
         </el-form-item>
         </el-form-item>
         <el-form-item label="介绍:">
         <el-form-item label="介绍:">
-            <el-input type="textarea" v-model="dataForm.intro"></el-input>
+          <el-input type="textarea" v-model="dataForm.intro"></el-input>
         </el-form-item>
         </el-form-item>
 
 
         <el-form-item label="公式状态:">
         <el-form-item label="公式状态:">
-          <el-select v-model="dataForm.status"  placeholder="请选择状态" size="large" style="width:100%;">
-              <el-option
-                v-for="item in statusOptions"
-                :key="item.value"
-                :label="item.label"
-                :value="item.value"
-              />
-            </el-select>
+          <el-select
+            v-model="dataForm.status"
+            placeholder="请选择状态"
+            size="large"
+            style="width: 100%"
+          >
+            <el-option
+              v-for="item in statusOptions"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value"
+            />
+          </el-select>
         </el-form-item>
         </el-form-item>
       </el-form>
       </el-form>
     </el-card>
     </el-card>
-    <div style="text-align:right; margin-top:20px;">
-        <el-button type="warning" @click="btnSave">确认保存</el-button>
+    <div style="text-align: right; margin-top: 20px">
+      <el-button type="warning" @click="btnSave">确认保存</el-button>
     </div>
     </div>
+    <el-dialog
+      :visible.sync="variablesVisible"
+      append-to-body
+      width="300"
+      custom-class="prod-verify"
+      :title="title"
+    >
+      <el-form :model="insertForm" :rules="insertRules" ref="insertRef">
+        <el-form-item label="模块名称:">
+          <el-select
+            v-model="insertForm.moduleName"
+            placeholder="请选择模块"
+            size="large"
+            style="width: 100%"
+            @change="changeModule"
+          >
+            <el-option
+              v-for="(item, index) in list"
+              :key="`${item.id}-${index}`"
+              :label="item.name"
+              :value="item.attrs"
+            />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="属性名称:" prop="Variable">
+          <el-select
+            v-model="insertForm.Variable"
+            placeholder="请选择属性"
+            size="large"
+            style="width: 100%"
+          >
+            <el-option
+              v-for="(item, index) in attrList"
+              :key="`${item.id}-${index}`"
+              :label="item.name"
+              :value="item.id"
+            />
+          </el-select>
+        </el-form-item>
+      </el-form>
+      <span slot="footer" class="dialog-footer">
+        <el-button type="warning" @click="btnInster">确认插入</el-button>
+      </span>
+    </el-dialog>
+    <el-dialog
+      :visible.sync="tableDataVisible"
+      append-to-body
+      width="400"
+      custom-class="prod-verify"
+      title="插入表格数据"
+    >
+      <div class="com-formual">
+        <el-form>
+          <el-form-item>
+            <el-select
+              v-model="tableCode"
+              placeholder="请选择状态"
+              @change="onChangeTab"
+              size="large"
+              style="width: 100%"
+            >
+              <el-option
+                v-for="(item, index) in tableList"
+                :key="item.id"
+                :label="item.name"
+                :value="index"
+              />
+            </el-select>
+          </el-form-item>
+          <el-form-item style="min-height: 500px" v-if="fileLoadStatus">
+            <div
+              id="luckysheets"
+              ref="luckysheets"
+              style="width: 100%; height: 500px"
+            ></div>
+          </el-form-item>
+        </el-form>
+      </div>
+    </el-dialog>
+    <el-dialog
+      :visible.sync="showConfirm"
+      title="数据确认"
+      width="500"
+      align-center
+      :append-to-body="true"
+    >
+      <div>当前工作表:{{ position.sheet }}</div>
+      <div>当前取值:{{ position.value }}</div>
+      <template #footer>
+        <div class="dialog-footer">
+          <el-button @click="showConfirm = false">关闭</el-button>
+          <el-button type="primary" @click="onConfirm">确认插入</el-button>
+        </div>
+      </template>
+    </el-dialog>
   </div>
   </div>
 </template>
 </template>
 
 
 <script>
 <script>
-  import {createFormula,updateFormula,getFormulaInfo} from'@/api/formula';
-  export default{
-    emits:['onClose'],
-    props:{
-      id:{
-        type:Number,
-        default:0
+import { createFormula, updateFormula, getFormulaInfo } from "@/api/formula";
+import { searchSourceData, deleteSourceData } from "@/api/sourceData";
+import LuckyExcel from "luckyexcel";
+export default {
+  emits: ["onClose"],
+  props: {
+    id: {
+      type: Number,
+      default: 0,
+    },
+    list: {
+      type: Array,
+      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: "[]",
+          };
+          return;
+        }
+        _this.getInfo(v);
       },
       },
+      immediate: true,
+      deep: true,
     },
     },
-    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:"[]"
-                };
-                return;
-            }
-            _this.getInfo(v);
-        },
-        immediate: true,
-        deep: true
-      }
+    list: {
+      handler(value) {
+        console.log(value);
+      },
+      immediate: true,
+      deep: true,
     },
     },
-    data(){
-      return{
-        activeName:'base',
-        currentCategory:[],
-        allCategories:[],
-
-        dataForm:{
-           id:0,
-           name:'',
-           formula:'',
-           intro:"",
-           status:'',
-           use_status:5,
-           params:"[]"
+  },
+  data() {
+    return {
+      activeName: "base",
+      currentCategory: [],
+      allCategories: [],
+
+      dataForm: {
+        id: 0,
+        name: "",
+        formula: "",
+        intro: "",
+        status: "",
+        use_status: 5,
+        params: "[]",
+      },
+      statusOptions: [
+        {
+          value: "",
+          label: "请选择状态",
+        },
+        {
+          value: 5,
+          label: "使用中",
         },
         },
-        statusOptions:[
-         {
-           value:'',
-           label:"请选择状态"
-         },
-         {
-           value:5,
-           label:'使用中'
-         },
-         {
-           value:6,
-           label:"已停用"
-         },
+        {
+          value: 6,
+          label: "已停用",
+        },
+      ],
+      variablesVisible: false,
+      title: "",
+      insertForm: {
+        moduleName: "",
+        Variable: "",
+      },
+      attrList: [],
+      insertRules: {
+        Variable: [
+          { required: true, message: "请选择变量", trigger: "change" },
         ],
         ],
+      },
+      tableDataVisible: false,
+      tableCode: "",
+      tableList: [],
+      showConfirm: false,
+      fileLoadStatus: false,
+      position: {
+        tb: "",
+        c: 0,
+        r: 0,
+        sheet: "",
+        value: "",
+      },
+    };
+  },
+
+  mounted() {
+    let _this = this;
+    this.initTableList();
+  },
+  methods: {
+    //保存更新
+    btnSave(e) {
+      let _this = this;
+
+      if (_this.dataForm.id > 0) {
+        updateFormula(_this.dataForm).then((res) => {
+          _this.dataForm={}
+          _this.$alter("公式更新成功");
+        });
+      } else {
+        createFormula(_this.dataForm).then((res) => {
+          _this.dataForm={}
+          _this.$alter("公式创建的成功");
+        });
       }
       }
+      _this.$emit("onClose");
     },
     },
 
 
-    mounted() {
-      let _this=this;
+    //产品详情
+    getInfo(id) {
+      let _this = this;
+      let par = {
+        id: id,
+      };
+      getFormulaInfo(par).then((res) => {
+        if (!res) return;
+        if (res.status != 200) return;
+        _this.dataForm = res.data;
+      });
+    },
+
+    onChangeStatus(e) {
+      this.dataForm.status = e;
+    },
+    //修改分类信息
+    onChangeCategory(e) {
+      let _this = this;
+      _this.dataForm.categoryId = e;
     },
     },
-    methods:{
-      //保存更新
-      btnSave(e){
-          let _this=this;
-
-          if(_this.dataForm.id>0){
-            updateFormula(_this.dataForm).then(res=>{
-              _this.$alter("公式更新成功")
-            })
-          }else{
-            createFormula(_this.dataForm).then(res=>{
-              _this.$alter("公式创建的成功")
-            })
+    /* 插入模块变量 */
+    InsertModule() {
+      this.variablesVisible = true;
+      this.title = "插入模块变量";
+    },
+    /* 模块名称 */
+    changeModule(value) {
+      this.attrList = value;
+    },
+    /* 插入变量 */
+    btnInster() {
+      this.$refs.insertRef.validate((valid) => {
+        if (valid) {
+          const selectedModule = this.list.find(
+            (module) => module.attrs === this.insertForm.moduleName
+          );
+          if (selectedModule) {
+            const moduleName = selectedModule.name;
+            const variableName = this.attrList.find(
+              (attr) => attr.id === this.insertForm.Variable
+            )?.name;
+
+            if (variableName) {
+              const insertText = `[T][${moduleName}][${variableName}]`;
+              this.dataForm.formula += insertText;
+              this.variablesVisible = false; // 关闭对话框
+              this.$message.success("变量插入成功");
+            } else {
+              this.$message.error("无法找到选中的变量");
+            }
+          } else {
+            this.$message.error("无法找到选中的模块");
           }
           }
-          _this.$emit("onClose")
-      },
+        } else {
+          /* this.$message.error("请选择变量!"); */
+          return false;
+        }
+      });
+    },
+    /* 插入表格数据 */
+    InsertTableData() {
+      this.tableDataVisible = true;
+    },
 
 
-      //产品详情
-      getInfo(id){
-          let _this=this;
-          let par={
-            id:id,
-          };
-          getFormulaInfo(par).then(res=>{
-              if(!res)return;
-              if(res.status!=200)return;
-              _this.dataForm=res.data;
-          })
-      },
+    onConfirm(e) {
+      this.showConfirm = false;
+      const insertText = `[R][${this.position.tb}][${this.position.sheet}][${
+        this.position.r + 1
+      },${this.position.c + 1}]`;
+      this.dataForm.formula += insertText;
+      this.tableDataVisible = false;
+      this.$message.success("表格数据插入成功");
+    },
 
 
-      onChangeStatus(e){
-          this.dataForm.status=e;
-      },
-      //修改分类信息
-      onChangeCategory(e){
-         let _this=this;
-         _this.dataForm.categoryId=e;
-      },
+    onChangeTab(e) {
+      let _this = this;
+      let item = _this.tableList[e];
+      _this.fileLoadStatus = true;
 
 
-    }
-  }
+      item.sourceData = JSON.parse(item.source_data);
+      console.log(item.sourceData.exportJson.sheets);
+
+      _this.position.tb = item.code;
+      _this.$nextTick(() => {
+        luckysheet.destroy();
+        luckysheet.create({
+          container: "luckysheets",
+          data: item.sourceData.exportJson.sheets,
+          lang: "zh",
+          showinfobar: false, // 是否显示顶部信息栏
+          showstatisticBar: false, // 是否显示底部计数栏
+          sheetBottomConfig: false, // sheet页下方的添加行按钮和回到顶部按钮配置
+          allowEdit: false, // 是否允许前台编辑
+          enableAddRow: false, // 是否允许增加行
+          enableAddCol: false, // 是否允许增加列
+          sheetFormulaBar: false, // 是否显示公式栏
+          enableAddBackTop: false, // 返回头部按钮
+          showsheetbar: true, // 是否显示底部sheet页按钮
+          enableAddRow: false, //允许添加行
+          showsheetbarConfig: {
+            add: false,
+            menu: false,
+          },
+          hook: {
+            cellMousedown: function (cell, position, sheetFile, ctx) {
+              _this.position.sheet = sheetFile.name;
+              _this.position.r = position.r;
+              _this.position.c = position.c;
+
+              if (cell.v) {
+                _this.position.value = cell.v;
+              } else {
+                _this.position.value = "";
+                cell.ct.s.map((res) => {
+                  _this.position.value += res.v;
+                });
+              }
+              _this.showConfirm = true;
+            },
+          },
+        });
+      });
+    },
+
+    initTableList() {
+      let _this = this;
+      searchSourceData({ page: 1, pageSize: 999, status: 5 }).then((res) => {
+        if (res.status != 200) return;
+        _this.tableList = res.data.dataList;
+      });
+    },
+  },
+};
 </script>
 </script>
 
 
 <style lang="scss">
 <style lang="scss">
- @import './dataInfo.scss'
+@import "./dataInfo.scss";
 </style>
 </style>

+ 8 - 2
src/views/document/com/components/Formula/index.vue

@@ -42,8 +42,8 @@
           </div>
           </div>
 
 
 
 
-    <el-dialog  :visible.sync="dialogVisible" append-to-body v-el-drag-dialog  width="300" custom-class="prod-verify" :title="title">
-        <dataInfo :id="dataId" @onClose="onClose"></dataInfo>
+    <el-dialog  :visible.sync="dialogVisible" append-to-body v-el-drag-dialog :close-on-click-modal="false"  width="300" custom-class="prod-verify" :title="title">
+        <dataInfo :id="dataId" @onClose="onClose" :list="comList"></dataInfo>
     </el-dialog>
     </el-dialog>
 
 
 
 
@@ -63,6 +63,12 @@
     components:{
     components:{
       dataInfo,
       dataInfo,
     },
     },
+    props:{
+      comList:{
+        type:Array,
+        default:[]
+      }
+    },
     data(){
     data(){
       return{
       return{
           dataId:0,
           dataId:0,

+ 1 - 0
src/views/document/com/components/SourceData/index.vue

@@ -21,6 +21,7 @@
 
 
           <el-dialog
           <el-dialog
               :visible.sync="showConfirm"
               :visible.sync="showConfirm"
+              :close-on-click-modal="false"
               title="数据确认"
               title="数据确认"
               width="500"
               width="500"
               align-center
               align-center

+ 42 - 27
src/views/document/com/components/TextArea/index.vue

@@ -126,6 +126,7 @@ export default {
       editor: null,
       editor: null,
       loading: false,
       loading: false,
       progress: 0,
       progress: 0,
+      isEditing:false
     };
     };
   },
   },
   mounted() {},
   mounted() {},
@@ -384,8 +385,14 @@ export default {
       }
       }
       return formual;
       return formual;
     },
     },
+    onFocus() {
+      this.isEditing = true;
+    },
+
+    onBlur() {
+      this.isEditing = false;
+    },
 
 
-    //获取远程数据
     async getRemoteData(code, sheet, row, col) {
     async getRemoteData(code, sheet, row, col) {
       let _this = this;
       let _this = this;
       let result = 0;
       let result = 0;
@@ -396,34 +403,42 @@ export default {
         col: col,
         col: col,
       };
       };
 
 
-      // Start the progress bar
-      this.loading = true;
-      this.progress = 0;
+      if (!this.isEditing) {
+        this.loading = true;
+        this.progress = 0;
+
+        try {
+          const updateProgress = setInterval(() => {
+            if (this.progress < 90) {
+              this.progress += 10;
+            }
+          }, 100);
 
 
-      try {
-        // Simulate progress updates
-        const updateProgress = setInterval(() => {
-          if (this.progress < 90) {
-            this.progress += 10;
+          let res = await findData(par);
+          if (res.status == 200) {
+            result = res.data.result;
           }
           }
-        }, 100);
 
 
-        let res = await findData(par);
-        if (res.status == 200) {
-          result = res.data.result;
+          this.progress = 100;
+          clearInterval(updateProgress);
+        } catch (error) {
+          console.error("Error fetching remote data:", error);
+        } finally {
+          setTimeout(() => {
+            this.loading = false;
+            this.progress = 0;
+          }, 1000);
+        }
+      } else {
+        // 如果正在编辑,直接获取数据而不显示进度条
+        try {
+          let res = await findData(par);
+          if (res.status == 200) {
+            result = res.data.result;
+          }
+        } catch (error) {
+          console.error("Error fetching remote data:", error);
         }
         }
-
-        // Complete the progress
-        this.progress = 100;
-        clearInterval(updateProgress);
-      } catch (error) {
-        console.error("Error fetching remote data:", error);
-      } finally {
-        // Hide the progress bar after a short delay
-        setTimeout(() => {
-          this.loading = false;
-          this.progress = 0;
-        }, 1000);
       }
       }
 
 
       return result;
       return result;
@@ -471,7 +486,7 @@ export default {
       this.$emit("onUpdate", this.currentIndex, e);
       this.$emit("onUpdate", this.currentIndex, e);
     },
     },
 
 
-    onFocus(e) {
+    /* onFocus(e) {
       // var range = e.editor.getSelection().getRanges()[0];
       // var range = e.editor.getSelection().getRanges()[0];
       // range.collapse( true );
       // range.collapse( true );
       // range.setStartAt( e.editor.editable(), CKEDITOR.POSITION_AFTER_START );
       // range.setStartAt( e.editor.editable(), CKEDITOR.POSITION_AFTER_START );
@@ -480,7 +495,7 @@ export default {
     onBlur(e) {
     onBlur(e) {
       // console.log(' onBlur e',e);
       // console.log(' onBlur e',e);
       // this.$emit("onUploadAttr",this.dataIndex,this.dataAttr);
       // this.$emit("onUploadAttr",this.dataIndex,this.dataAttr);
-    },
+    }, */
   },
   },
 };
 };
 </script>
 </script>

+ 21 - 3
src/views/document/com/components/Variable/dataInfo.vue

@@ -1,10 +1,10 @@
 <template>
 <template>
   <div class="data-info">
   <div class="data-info">
     <el-card>
     <el-card>
-      <el-form :model="dataForm" label-width="120px">
-        <el-form-item label="编码:">
+      <el-form :model="dataForm" ref="dataFormRef" label-width="120px">
+      <!--   <el-form-item label="编码:">
           <el-input v-model="dataForm.code"></el-input>
           <el-input v-model="dataForm.code"></el-input>
-        </el-form-item>
+        </el-form-item> -->
         <el-form-item label="名称 :">
         <el-form-item label="名称 :">
           <el-input v-model="dataForm.name"></el-input>
           <el-input v-model="dataForm.name"></el-input>
         </el-form-item>
         </el-form-item>
@@ -58,6 +58,7 @@
 
 
 <script>
 <script>
 import { createParams, updateParams, getParamsInfo } from "@/api/params";
 import { createParams, updateParams, getParamsInfo } from "@/api/params";
+import { status } from "nprogress";
 export default {
 export default {
   emits: ["onClose"],
   emits: ["onClose"],
   props: {
   props: {
@@ -145,6 +146,12 @@ export default {
     let _this = this;
     let _this = this;
   },
   },
   methods: {
   methods: {
+    resetForm() {
+      // 重置所有表单字段
+      this.dataForm = { type: 1, value_type: 1,status:5}; // 或者设置为初始值
+      // 如果使用 el-form,可以调用其 resetFields 方法
+      this.$refs.dataFormRef.resetFields();
+    },
     //保存更新
     //保存更新
     btnSave(e) {
     btnSave(e) {
       let _this = this;
       let _this = this;
@@ -152,15 +159,26 @@ export default {
       if (_this.dataForm.value_type == 1) {
       if (_this.dataForm.value_type == 1) {
         _this.dataForm.value_item = _this.dataForm.value;
         _this.dataForm.value_item = _this.dataForm.value;
       }
       }
+      _this.dataForm.code=_this.dataForm.name
       if (_this.dataForm.id > 0) {
       if (_this.dataForm.id > 0) {
         updateParams(_this.dataForm).then((res) => {
         updateParams(_this.dataForm).then((res) => {
           if (res.status != 200) return;
           if (res.status != 200) return;
+          _this.dataForm = {
+            type: 1,
+            value_type: 1,
+            status:5
+          };
           _this.$alert("信息更新成功");
           _this.$alert("信息更新成功");
           _this.$emit("onClose");
           _this.$emit("onClose");
         });
         });
       } else {
       } else {
         createParams(_this.dataForm).then((res) => {
         createParams(_this.dataForm).then((res) => {
           if (res.status != 200) return;
           if (res.status != 200) return;
+          _this.dataForm = {
+            type: 1,
+            value_type: 1,
+            status:5
+          };
           _this.$alert("信息创建成功");
           _this.$alert("信息创建成功");
           _this.$emit("onClose");
           _this.$emit("onClose");
         });
         });

+ 224 - 167
src/views/document/com/components/Variable/index.vue

@@ -1,7 +1,12 @@
 <template>
 <template>
   <div class="com-formual">
   <div class="com-formual">
-        <el-form :inline="true" :model="queryForm"  v-if="type==1" class="demo-form-inline">
-         <!-- <el-form-item label="类型:">
+    <el-form
+      :inline="true"
+      :model="queryForm"
+      v-if="type == 1"
+      class="demo-form-inline"
+    >
+      <!-- <el-form-item label="类型:">
             <el-select v-model="queryForm.type"  placeholder="请选择状态" size="large" style="width:100%;">
             <el-select v-model="queryForm.type"  placeholder="请选择状态" size="large" style="width:100%;">
                 <el-option
                 <el-option
                   v-for="item in typeList"
                   v-for="item in typeList"
@@ -11,192 +16,244 @@
                 />
                 />
               </el-select>
               </el-select>
           </el-form-item> -->
           </el-form-item> -->
-            <el-form-item label="变名称:">
-              <el-input v-model="queryForm.name" placeholder="请填写变量名称"></el-input>
-            </el-form-item>
-            <el-form-item>
-              <el-button type="primary" @click="onBtnSearch">  <svg-icon icon-class="search"/> 搜索</el-button>
-              <el-button type="primary" @click="onBtnCreate">  <svg-icon icon-class="plus"/> 新增变量</el-button>
-            </el-form-item>
-          </el-form>
-          <el-table :data="dataList" style="width: 100%"   header-row-class-name="headerBg" empty-text="没有数据信息">
-            <el-table-column prop="id" label="ID" align="center" width="80"/>
-            <el-table-column prop="code" label="编码" align="left" width="150"/>
-            <el-table-column prop="name" label="名称" align="left" width="150"/>
-            <el-table-column prop="value" label="取值" v-if="type==1" show-overflow-tooltip	 align="left" min-width="150"/>
-            <el-table-column prop="intro" label="介绍" show-overflow-tooltip	 align="left" min-width="150"/>
-            <el-table-column label="操作" align="center" :width="type==1?250:100">
-              <template #default="scope">
-                <div class="btns">
-                  <el-button type="primary" size="mini" @click="btnPicked(scope.row)"><svg-icon icon-class="confirm"/>使用</el-button>
-                  <el-button type="primary" size="mini" @click="btnOnEdit(scope.row.id)" v-if="type==1"><svg-icon icon-class="edit"/>编辑</el-button>
-                   <el-button type="danger" size="mini"  @click="btnOnDelete(scope.row.id)"  v-if="type==1"><svg-icon icon-class="delete" />删除</el-button>
-                </div>
-              </template>
-            </el-table-column>
-          </el-table>
-
-
-
-          <div class="page-info">
-          	<el-pagination
-          	v-model:currentPage="queryForm.page"
-          	:page-size="queryForm.pageSize"
-          	:total="recordCount"
-          	:page-count="pageTotal"
-          	 background
-          	 layout="prev, pager, next"
-          	 @current-change="ChangePage"
-          	 >
-          	 </el-pagination>
+      <el-form-item label="变名称:">
+        <el-input
+          v-model="queryForm.name"
+          placeholder="请填写变量名称"
+        ></el-input>
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" @click="onBtnSearch">
+          <svg-icon icon-class="search" /> 搜索</el-button
+        >
+        <el-button type="primary" @click="onBtnCreate">
+          <svg-icon icon-class="plus" /> 新增变量</el-button
+        >
+      </el-form-item>
+    </el-form>
+    <el-table
+      :data="dataList"
+      style="width: 100%"
+      header-row-class-name="headerBg"
+      empty-text="没有数据信息"
+    >
+      <el-table-column prop="id" label="ID" align="center" width="80" />
+      <el-table-column prop="code" label="编码" align="left" width="150" />
+      <el-table-column prop="name" label="名称" align="left" width="150" />
+      <el-table-column
+        prop="value"
+        label="取值"
+        v-if="type == 1"
+        show-overflow-tooltip
+        align="left"
+        min-width="150"
+      />
+      <!-- <el-table-column prop="intro" label="介绍" show-overflow-tooltip	 align="left" min-width="150"/> -->
+      <el-table-column
+        label="操作"
+        align="center"
+        :width="type == 1 ? 250 : 100"
+        fixed="right"
+      >
+        <template #default="scope">
+          <div class="btns">
+            <el-button type="primary" size="mini" @click="btnPicked(scope.row)"
+              ><svg-icon icon-class="confirm" />使用</el-button
+            >
+            <el-button
+              type="primary"
+              size="mini"
+              @click="btnOnEdit(scope.row.id)"
+              v-if="type == 1"
+              ><svg-icon icon-class="edit" />编辑</el-button
+            >
+            <el-button
+              type="danger"
+              size="mini"
+              @click="btnOnDelete(scope.row.id)"
+              v-if="type == 1"
+              ><svg-icon icon-class="delete" />删除</el-button
+            >
           </div>
           </div>
+        </template>
+      </el-table-column>
+    </el-table>
 
 
+    <div class="page-info">
+      <el-pagination
+        v-model:currentPage="queryForm.page"
+        :page-size="queryForm.pageSize"
+        :total="recordCount"
+        :page-count="pageTotal"
+        background
+        layout="prev, pager, next"
+        @current-change="ChangePage"
+      >
+      </el-pagination>
+    </div>
 
 
-
-          <el-dialog  :visible.sync="dialogVisible" append-to-body v-el-drag-dialog  width="300" custom-class="prod-verify" :title="title">
-              <dataInfo :id="dataId" :type="type" @onClose="onClose"></dataInfo>
-          </el-dialog>
-
-
+    <el-dialog
+      :visible.sync="dialogVisible"
+      append-to-body
+      v-el-drag-dialog
+      width="300"
+      custom-class="prod-verify"
+      :title="title"
+      @closed="handleDialogClosed"
+    >
+      <dataInfo
+        ref="dataInfoRef"
+        :id="dataId"
+        :type="type"
+        @onClose="onClose"
+      ></dataInfo>
+    </el-dialog>
   </div>
   </div>
 </template>
 </template>
 
 
 <script>
 <script>
-  import{searchParams,deleteParams} from'@/api/params';
-  import elDragDialog from '@/directive/el-drag-dialog'
-  import dataInfo from "./dataInfo";
+import { searchParams, deleteParams } from "@/api/params";
+import elDragDialog from "@/directive/el-drag-dialog";
+import dataInfo from "./dataInfo";
 
 
-  export default{
-    name:"searchParams",
-    emits:['onPicked',"onData"],
-    directives: { elDragDialog },
-    components:{
-      dataInfo,
+export default {
+  name: "searchParams",
+  emits: ["onPicked", "onData"],
+  directives: { elDragDialog },
+  components: {
+    dataInfo,
+  },
+  props: {
+    type: {
+      type: Number,
+      default: 1,
     },
     },
-    props:{
-       type:{
-         type:Number,
-         default:1,
-       }
+  },
+  watch: {
+    type: {
+      handler(val) {
+        this.queryForm.type = val;
+        this.onBtnSearch();
+      },
+      immediate: true,
+      deep: true,
     },
     },
-    watch:{
-      type:{
-        handler(val){
-          this.queryForm.type=val;
-          this.onBtnSearch();
-        },
-        immediate: true,
-        deep: true
+    dataList: {
+      handler(newVal, oldVal) {
+        newVal.forEach((item, index) => {
+          if (JSON.stringify(item) !== JSON.stringify(oldVal[index])) {
+            this.$emit("onData", item);
+          }
+        });
+        // Add any additional logic you need here
       },
       },
-      dataList: {
-        handler(newVal, oldVal) {
-          newVal.forEach((item, index) => {
-            if (JSON.stringify(item) !== JSON.stringify(oldVal[index])) {
-              this.$emit('onData',item)
-            }
-          });
-          // Add any additional logic you need here
-        },
-        deep: true
-      }
-      /* onData */
+      deep: true,
     },
     },
-    data(){
-      return{
-          dataId:0,
-          dialogVisible:false,
-          title:"创建变量",
-          queryForm:{
-            page:1,
-            pageSize:10,
-            name:'',
-            status:5,
-            type:1,
-          },
-          typeList:[
-            {
-              value:1,
-              name:'变量',
-            },
-            {
-              value:2,
-              name:'常量',
-            }
-          ],
-          recordCount:0,
-          pageTotal:1,
-          dataList:[],
+    /* onData */
+  },
+  data() {
+    return {
+      dataId: 0,
+      dialogVisible: false,
+      title: "创建变量",
+      queryForm: {
+        page: 1,
+        pageSize: 10,
+        name: "",
+        status: 5,
+        type: 1,
+      },
+      typeList: [
+        {
+          value: 1,
+          name: "变量",
+        },
+        {
+          value: 2,
+          name: "常量",
+        },
+      ],
+      recordCount: 0,
+      pageTotal: 1,
+      dataList: [],
+    };
+  },
+  mounted() {
+    // this.onBtnSearch();
+  },
+  methods: {
+    handleDialogClosed() {
+      // 清空 dataInfo 组件内的表单
+      if (this.$refs.dataInfoRef) {
+        this.$refs.dataInfoRef.resetForm(); // 假设 dataInfo 组件有一个 resetForm 方法
       }
       }
     },
     },
-    mounted(){
-      // this.onBtnSearch();
+    onClose(e) {
+      let _this = this;
+      _this.dialogVisible = false;
+      _this.onBtnSearch();
     },
     },
-    methods:{
-
-      onClose(e){
-         let _this=this;
-         _this.dialogVisible=false;
-         _this.onBtnSearch();
-      },
 
 
-      btnOnDelete(e){
-        let _this=this;
-        let par={
-          id:e,
-        }
-        _this.$confirm("您是否确认删除该记录?","提示",{
-          confirmButtonText: '确认',
-          cancelButtonText: '取消',
-          type: 'warning',
-        }).then((res)=>{
-             deleteParams(par).then(res=>{
-               _this.search();
-             })
-        }).catch(()=>{
+    btnOnDelete(e) {
+      let _this = this;
+      let par = {
+        id: e,
+      };
+      _this
+        .$confirm("您是否确认删除该记录?", "提示", {
+          confirmButtonText: "确认",
+          cancelButtonText: "取消",
+          type: "warning",
         })
         })
-      },
+        .then((res) => {
+          deleteParams(par).then((res) => {
+            _this.search();
+          });
+        })
+        .catch(() => {});
+    },
 
 
-      onBtnCreate(e){
-        let _this=this;
-        _this.dataId=0;
-        _this.title="创建变量";
-        _this.dialogVisible=true;
-      },
+    onBtnCreate(e) {
+      let _this = this;
+      _this.dataId = 0;
+      _this.title = "创建变量";
+      _this.dialogVisible = true;
+    },
 
 
-      btnOnEdit(id){
-        this.title="修改变量";
-        this.dataId=id;
-        this.dialogVisible=true;
-      },
+    btnOnEdit(id) {
+      this.title = "修改变量";
+      this.dataId = id;
+      this.dialogVisible = true;
+    },
 
 
-      onBtnSearch(e){
-        let _this=this;
-        _this.queryForm.page=1;
-        _this.search();
-      },
-      btnPicked(e){
-        this.$emit("onPicked",e);
-      },
-     //搜索
-     search(){
-       let _this=this;
-       searchParams(_this.queryForm).then(res=>{
-         if(!res)return;
-         _this.dataList=res.data.dataList;
-        _this.recordCount=res.data.totalRecord;
-        _this.pageTotal=res.data.pageTotal;
-       })
-     },
-     //修改分页
-     ChangePage(e){
-     	let _this=this;
-     	_this.queryForm.page=e;
-     	_this.search();
-     },
-    }
-  }
+    onBtnSearch(e) {
+      let _this = this;
+      _this.queryForm.page = 1;
+      _this.search();
+    },
+    btnPicked(e) {
+      this.$emit("onPicked", e);
+    },
+    //搜索
+    search() {
+      let _this = this;
+      searchParams(_this.queryForm).then((res) => {
+        if (!res) return;
+        _this.dataList = res.data.dataList;
+        _this.recordCount = res.data.totalRecord;
+        _this.pageTotal = res.data.pageTotal;
+      });
+    },
+    //修改分页
+    ChangePage(e) {
+      let _this = this;
+      _this.queryForm.page = e;
+      _this.search();
+    },
+  },
+};
 </script>
 </script>
 
 
 <style lang="scss">
 <style lang="scss">
-@import './index.scss';
+@import "./index.scss";
 </style>
 </style>

+ 12 - 6
src/views/document/com/menus.vue

@@ -17,25 +17,25 @@
       </div>
       </div>
 
 
 
 
-      <el-dialog  :visible.sync="showFormula" append-to-body v-el-drag-dialog  width="300" custom-class="prod-verify" title="选择公式">
-          <Formula @onPicked="onPickedFormula"></Formula>
+      <el-dialog  :visible.sync="showFormula" append-to-body v-el-drag-dialog  width="300" :close-on-click-modal="false" custom-class="prod-verify" title="选择公式">
+          <Formula @onPicked="onPickedFormula" :comList="comArr"></Formula>
       </el-dialog>
       </el-dialog>
 
 
-      <el-dialog  :visible.sync="showVariable" append-to-body v-el-drag-dialog  width="800px" custom-class="prod-verify" :title="insertTitle">
+      <el-dialog  :visible.sync="showVariable" append-to-body v-el-drag-dialog  width="800px" :close-on-click-modal="false" custom-class="prod-verify" :title="insertTitle">
           <Variable :type="type" @onPicked="onPickedVariable" @onData="btnbianl"></Variable>
           <Variable :type="type" @onPicked="onPickedVariable" @onData="btnbianl"></Variable>
       </el-dialog>
       </el-dialog>
 
 
 
 
-      <el-dialog  :visible.sync="showSourceData" append-to-body v-el-drag-dialog  width="300" custom-class="prod-verify" title="选择源数据">
+      <el-dialog  :visible.sync="showSourceData" append-to-body v-el-drag-dialog  width="300" :close-on-click-modal="false" custom-class="prod-verify" title="选择源数据">
           <sourceData  @onPicked="onPickedTab"></sourceData>
           <sourceData  @onPicked="onPickedTab"></sourceData>
       </el-dialog>
       </el-dialog>
       <!-- 插入ai -->
       <!-- 插入ai -->
-      <el-dialog  :visible.sync="showSourceAi" append-to-body v-el-drag-dialog  width="300" custom-class="prod-verify" title="选择AI">
+      <el-dialog  :visible.sync="showSourceAi" append-to-body v-el-drag-dialog  width="300" :close-on-click-modal="false" custom-class="prod-verify" title="选择AI">
           <sourceAi  @onPicked="onPickedAi"></sourceAi>
           <sourceAi  @onPicked="onPickedAi"></sourceAi>
       </el-dialog>
       </el-dialog>
 
 
        <!-- ai -->
        <!-- ai -->
-       <el-dialog  :visible.sync="showSourceEs" append-to-body v-el-drag-dialog  width="300" custom-class="prod-verify" title="AI随笔">
+       <el-dialog  :visible.sync="showSourceEs" append-to-body v-el-drag-dialog  width="300":close-on-click-modal="false" custom-class="prod-verify" title="AI随笔">
           <sourceEs  @onPicked="onPickedAi"></sourceEs>
           <sourceEs  @onPicked="onPickedAi"></sourceEs>
       </el-dialog>
       </el-dialog>
 
 
@@ -57,6 +57,12 @@
       Formula,Variable,sourceData,sourceAi,sourceEs
       Formula,Variable,sourceData,sourceAi,sourceEs
     },
     },
     directives: { elDragDialog },
     directives: { elDragDialog },
+    props:{
+      comArr:{
+        type:Array,
+        default:[]
+      }
+    },
     data(){
     data(){
       return{
       return{
         showFormula:false,
         showFormula:false,

+ 33 - 2
src/views/document/com/view.vue

@@ -74,12 +74,22 @@ export default {
       this.content = this.comList.map((item) => item.content).join("");
       this.content = this.comList.map((item) => item.content).join("");
       console.log(this.content);
       console.log(this.content);
     },
     },
-
     onExport() {
     onExport() {
-      let contentData = `<!DOCTYPE html><html><head><meta charset="UTF-8"></head><body><p class="header1"></p> ${this.$refs.content.innerHTML} </body></html>`;
+      // Clone the content element to avoid modifying the original DOM
+      let contentClone = this.$refs.content.cloneNode(true);
+
+      // Replace all input elements with their values
+      contentClone.querySelectorAll('input[type="text"]').forEach((input) => {
+        const span = document.createElement("span");
+        span.textContent = input.value;
+        input.parentNode.replaceChild(span, input);
+      });
+      console.log(contentClone);
+      let contentData = `<!DOCTYPE html><html><head><meta charset="UTF-8"></head><body><p class="header1"></p> ${contentClone.innerHTML} </body></html>`;
       contentData = contentData
       contentData = contentData
         .replaceAll("<table ", `<table style="border-collapse: collapse;" `)
         .replaceAll("<table ", `<table style="border-collapse: collapse;" `)
         .replaceAll("<td>", `<td style="border: 1px solid black;">`);
         .replaceAll("<td>", `<td style="border: 1px solid black;">`);
+
       exportDocument({ content: contentData, title: this.docAttr.title }).then(
       exportDocument({ content: contentData, title: this.docAttr.title }).then(
         (res) => {
         (res) => {
           if (res.status != 200) {
           if (res.status != 200) {
@@ -95,6 +105,27 @@ export default {
         }
         }
       );
       );
     },
     },
+
+    /* onExport() {
+      let contentData = `<!DOCTYPE html><html><head><meta charset="UTF-8"></head><body><p class="header1"></p> ${this.$refs.content.innerHTML} </body></html>`;
+      contentData = contentData
+        .replaceAll("<table ", `<table style="border-collapse: collapse;" `)
+        .replaceAll("<td>", `<td style="border: 1px solid black;">`);
+      exportDocument({ content: contentData, title: this.docAttr.title }).then(
+        (res) => {
+          if (res.status != 200) {
+            this.$alert(res.errMsg);
+            return;
+          }
+          let a = document.createElement("a");
+          a.href = res.data.file_path; // Use the file_path from the response
+          a.download = res.data.file_name; // Set the download attribute to the file_name
+          document.body.appendChild(a);
+          a.click();
+          document.body.removeChild(a);
+        }
+      );
+    }, */
   },
   },
 };
 };
 </script>
 </script>

+ 9 - 1
src/views/document/components/dataList.vue

@@ -13,6 +13,12 @@
         align="left"
         align="left"
         min-width="180"
         min-width="180"
       />
       />
+      <el-table-column
+        prop="user_name"
+        label="创建人"
+        align="center"
+        width="150"
+      />
       <el-table-column
       <el-table-column
         prop="category.name"
         prop="category.name"
         label="所属分类"
         label="所属分类"
@@ -193,7 +199,9 @@ export default {
       let _this = this;
       let _this = this;
       searchDocument(_this.queryForm).then((res) => {
       searchDocument(_this.queryForm).then((res) => {
         if (!res) return;
         if (!res) return;
-        _this.dataList = res.data.dataList;
+       /*  res.data.dataList.filter(el => el.is_template == 0)
+        console.log(res.data.dataList); */
+        _this.dataList = res.data.dataList.filter(el => el.is_template == 0);
         _this.recordCount = res.data.totalRecord;
         _this.recordCount = res.data.totalRecord;
         _this.pageTotal = res.data.pageTotal;
         _this.pageTotal = res.data.pageTotal;
       });
       });

+ 2 - 2
src/views/document/create.scss

@@ -103,7 +103,7 @@
       }
       }
     }
     }
     .editor-main{
     .editor-main{
-      width:1150px;
+      width:65%;
       margin:auto;
       margin:auto;
       overflow: hidden;
       overflow: hidden;
       overflow-y: auto;
       overflow-y: auto;
@@ -113,7 +113,7 @@
         top:60px;
         top:60px;
         background:#FFF;
         background:#FFF;
         z-index:999;
         z-index:999;
-        width: 1025px;
+        width: 58.5%;
       }
       }
 
 
       .editor-box{
       .editor-box{

+ 142 - 41
src/views/document/create.vue

@@ -11,15 +11,23 @@
         </div>
         </div>
       </div>
       </div>
       <div class="right">
       <div class="right">
+        <el-button type="primary" size="mini" @click="onSaveAs"
+          >保存文档</el-button
+        ><!-- v-if="docAttr.id > 0" -->
         <el-button
         <el-button
           type="primary"
           type="primary"
           size="mini"
           size="mini"
-          @click="onSaveAs"
-          v-if="docAttr.id > 0"
-          >另存为</el-button
+          @click="onSave"
+          v-if="docAttr.is_template == 0 && docAttr.id > 0"
+          >更新文档</el-button
+        >
+        <el-button
+          type="primary"
+          size="mini"
+          v-if="$store.state.user.name == 'admin'"
+          @click="onSaveUpload"
+          >保存并更新模版</el-button
         >
         >
-        <el-button type="primary" size="mini" @click="onSave">保存文档</el-button>
-        <el-button type="primary" size="mini" v-if="$store.state.user.name=='admin'">保存并更新模版</el-button>
         <el-button type="primary" size="mini" @click="onOpenView"
         <el-button type="primary" size="mini" @click="onOpenView"
           >预览导出
           >预览导出
         </el-button>
         </el-button>
@@ -54,14 +62,14 @@
               </el-collapse-item>
               </el-collapse-item>
               <el-collapse-item title="模版列表" name="-2" v-if="showView == 0">
               <el-collapse-item title="模版列表" name="-2" v-if="showView == 0">
                 <div
                 <div
-                  v-for="(it, index) in articleList"
+                  v-for="(it, index) in templateList"
                   draggable
                   draggable
                   :key="it.id"
                   :key="it.id"
                   :data-index="index"
                   :data-index="index"
                   data-type="article"
                   data-type="article"
                   class="sub-menus"
                   class="sub-menus"
                 >
                 >
-                  <div @click="onLoadArticle(it)">{{ it.title }}</div>
+                  <div @click="onTemplateInfo(it)">{{ it.title }}</div>
                 </div>
                 </div>
               </el-collapse-item>
               </el-collapse-item>
 
 
@@ -97,9 +105,13 @@
                   :title="item.name"
                   :title="item.name"
                   :name="item.id"
                   :name="item.id"
                 >
                 >
-                  <el-collapse v-model="nestedActiveNames">
+                  <el-collapse
+                    v-model="item.activeChildren"
+                    @change="handleItemVal"
+                    v-show="item.children"
+                  >
                     <el-collapse-item
                     <el-collapse-item
-                      v-for="(child, childIndex) in childrenList"
+                      v-for="(child, childIndex) in item.children"
                       :key="childIndex"
                       :key="childIndex"
                       :title="child.name"
                       :title="child.name"
                       :name="child.id"
                       :name="child.id"
@@ -110,7 +122,6 @@
                           group: { name: 'itxst', pull: 'clone' },
                           group: { name: 'itxst', pull: 'clone' },
                           sort: true,
                           sort: true,
                         }"
                         }"
-                        animation="300"
                       >
                       >
                         <transition-group>
                         <transition-group>
                           <div
                           <div
@@ -130,7 +141,6 @@
                       group: { name: 'itxst', pull: 'clone' },
                       group: { name: 'itxst', pull: 'clone' },
                       sort: true,
                       sort: true,
                     }"
                     }"
-                    animation="300"
                   >
                   >
                     <transition-group>
                     <transition-group>
                       <div
                       <div
@@ -167,7 +177,11 @@
 
 
       <div class="editor-main">
       <div class="editor-main">
         <div class="menus-box">
         <div class="menus-box">
-          <menus @onEvents="onInsert" @onVariable="uptadeVariable"></menus>
+          <menus
+            @onEvents="onInsert"
+            @onVariable="uptadeVariable"
+            :comArr="coms"
+          ></menus>
         </div>
         </div>
         <div class="editor-box" ref="tabHtml" v-loading="loading">
         <div class="editor-box" ref="tabHtml" v-loading="loading">
           <editor
           <editor
@@ -234,16 +248,23 @@
         </template>
         </template>
         <!-- comIndex != 9999 && comIndex != 9998 && comIndex != 9997 AttributeIndex==1-->
         <!-- comIndex != 9999 && comIndex != 9998 && comIndex != 9997 AttributeIndex==1-->
         <template
         <template
-          v-if="comIndex != 9999 && comIndex != 9998 && catalogIndex != 9997 &&AttributeIndex != 1"
+          v-if="
+            comIndex != 9999 &&
+            comIndex != 9998 &&
+            catalogIndex != 9997 &&
+            AttributeIndex != 1
+          "
         >
         >
           <Attribute
           <Attribute
             :com="coms[comIndex]"
             :com="coms[comIndex]"
             @onRefresh="initCategoryList"
             @onRefresh="initCategoryList"
           ></Attribute>
           ></Attribute>
         </template>
         </template>
-        <template  v-if="AttributeIndex == 1">
-          <attributeVar :com="coms[comIndex]"
-          @onRefresh="initCategoryList"></attributeVar>
+        <template v-if="AttributeIndex == 1">
+          <attributeVar
+            :com="coms[comIndex]"
+            @onRefresh="initCategoryList"
+          ></attributeVar>
         </template>
         </template>
         <!-- <Directory :coms="coms" /> -->
         <!-- <Directory :coms="coms" /> -->
       </div>
       </div>
@@ -251,6 +272,7 @@
 
 
     <el-dialog
     <el-dialog
       :visible.sync="showViewForm"
       :visible.sync="showViewForm"
+      :close-on-click-modal="false"
       append-to-body
       append-to-body
       v-el-drag-dialog
       v-el-drag-dialog
       width="850px"
       width="850px"
@@ -264,6 +286,7 @@
       :visible.sync="showProductAttr"
       :visible.sync="showProductAttr"
       append-to-body
       append-to-body
       v-el-drag-dialog
       v-el-drag-dialog
+      :close-on-click-modal="false"
       width="850px"
       width="850px"
       custom-class="prod-verify"
       custom-class="prod-verify"
       title="插入产品属性"
       title="插入产品属性"
@@ -282,7 +305,7 @@ import { searchDocument } from "@/api/document";
 import menus from "./com/menus";
 import menus from "./com/menus";
 import editor from "./com/editor";
 import editor from "./com/editor";
 import Attribute from "./com/components/Attribute";
 import Attribute from "./com/components/Attribute";
-import attributeVar from './com/components/Attribute/attributeVar/index.vue'
+import attributeVar from "./com/components/Attribute/attributeVar/index.vue";
 import ProductAttr from "./com/components/ProductAttr";
 import ProductAttr from "./com/components/ProductAttr";
 import {
 import {
   searchTemplateCategory,
   searchTemplateCategory,
@@ -318,7 +341,7 @@ export default {
     ProductAttr,
     ProductAttr,
     Directory,
     Directory,
     draggable,
     draggable,
-    attributeVar
+    attributeVar,
   },
   },
   directives: {
   directives: {
     elDragDialog,
     elDragDialog,
@@ -328,6 +351,7 @@ export default {
       activeNames: "-1",
       activeNames: "-1",
       nestedActiveNames: [],
       nestedActiveNames: [],
       articleList: [],
       articleList: [],
+      templateList: [],
       categoryList: [],
       categoryList: [],
       //组件相关
       //组件相关
       coms: [],
       coms: [],
@@ -358,10 +382,10 @@ export default {
       articleId: 0,
       articleId: 0,
       loading: false, // 增加 loading 状态
       loading: false, // 增加 loading 状态
       showView: 0, //查看 文档/模块
       showView: 0, //查看 文档/模块
-      childrenList: [],
+      childrenList: "",
       value: [],
       value: [],
       AttributeIndex: 0,
       AttributeIndex: 0,
-      catalogIndex:0,//目录信息
+      catalogIndex: 0, //目录信息
     };
     };
   },
   },
   watch: {
   watch: {
@@ -397,18 +421,30 @@ export default {
   },
   },
 
 
   methods: {
   methods: {
+    handleItemVal(value) {
+      this.$forceUpdate();
+    },
     async handleItemClick(item) {
     async handleItemClick(item) {
-      if (item == "-1") return;
-      await searchTemplateCategory({ parent_id: item }).then((res) => {
-        if (res.status != 200 && res.data.length == 0) return;
-        this.childrenList = res.data;
-        for (var i = 0; i < this.childrenList.length; i++) {
-          this.childrenList[i].dataList = this.getTemplateList(
-            this.childrenList[i].id
-          );
+      const category = this.categoryList.find((cat) => cat.id === item);
+      if (!category) return;
+
+      if (!category.children) {
+        try {
+          const res = await searchTemplateCategory({ parent_id: item });
+          if (res.status != 200 || res.data.length == 0) return;
+          category.children = res.data;
+          for (let i = 0; i < category.children.length; i++) {
+            category.children[i].dataList = await this.getTemplateList(
+              category.children[i].id
+            );
+          }
+        } catch (error) {
+          console.error("Error fetching template categories:", error);
         }
         }
-      });
-      // Add your custom logic here
+      }
+
+      // 触发视图更新
+      this.$set(category, "activeChildren", category.activeChildren || []);
     },
     },
     /* 切换标签 */
     /* 切换标签 */
     viewDocument() {
     viewDocument() {
@@ -418,12 +454,12 @@ export default {
       this.showView = 1;
       this.showView = 1;
     },
     },
     /* 更新变量 */
     /* 更新变量 */
-    uptadeVariable(value){
+    uptadeVariable(value) {
       for (const item of this.coms) {
       for (const item of this.coms) {
         for (const el of item.attrs) {
         for (const el of item.attrs) {
           if (el.type === "variable") {
           if (el.type === "variable") {
-            if(el.data.id==value.id){
-              el.content=value.value
+            if (el.data.id == value.id) {
+              el.content = value.value;
             }
             }
           }
           }
         }
         }
@@ -434,7 +470,7 @@ export default {
       for (const item of this.coms) {
       for (const item of this.coms) {
         for (const el of item.attrs) {
         for (const el of item.attrs) {
           if (el.type === "ai") {
           if (el.type === "ai") {
-           // await this.retrieval(el);
+            // await this.retrieval(el);
           }
           }
         }
         }
       }
       }
@@ -562,6 +598,27 @@ export default {
         title: e.title,
         title: e.title,
         content: "",
         content: "",
         status: e.status,
         status: e.status,
+        is_template: e.is_template,
+        linkProduct: e.linkProduct,
+        links: e.links,
+        linkProject: e.linkProject,
+        projects: e.projects,
+      };
+
+      _this.coms = JSON.parse(e.data);
+      console.log(_this.coms);
+      this.uptadeSearch();
+    },
+    /* 加载模版信息 */
+    onTemplateInfo(e) {
+      let _this = this;
+      _this.docAttr = {
+        id: e.id,
+        category_id: e.category_id * 1,
+        title: e.title,
+        content: "",
+        status: e.status,
+        is_template: e.is_template,
         linkProduct: e.linkProduct,
         linkProduct: e.linkProduct,
         links: e.links,
         links: e.links,
         linkProject: e.linkProject,
         linkProject: e.linkProject,
@@ -574,8 +631,8 @@ export default {
       this.coms.splice(index, 1);
       this.coms.splice(index, 1);
     },
     },
     /* 目录信息 */
     /* 目录信息 */
-    onCatalogIndex(e){
-      this.catalogIndex=e
+    onCatalogIndex(e) {
+      this.catalogIndex = e;
       if (
       if (
         this.comIndex == 9999 ||
         this.comIndex == 9999 ||
         this.comIndex == 9998 ||
         this.comIndex == 9998 ||
@@ -584,7 +641,6 @@ export default {
         this.comIndex = 0;
         this.comIndex = 0;
         this.AttributeIndex = 0;
         this.AttributeIndex = 0;
       }
       }
-      
     },
     },
     //设置当前索引
     //设置当前索引
     onSetActiveIndex(e) {
     onSetActiveIndex(e) {
@@ -634,7 +690,9 @@ export default {
       _this.docAttr.links = JSON.stringify(_this.docAttr.linkProduct);
       _this.docAttr.links = JSON.stringify(_this.docAttr.linkProduct);
       _this.docAttr.projects = JSON.stringify(_this.docAttr.linkProject);
       _this.docAttr.projects = JSON.stringify(_this.docAttr.linkProject);
       _this.docAttr.data = JSON.stringify(_this.coms);
       _this.docAttr.data = JSON.stringify(_this.coms);
-
+      _this.docAttr.is_template = 0;
+      _this.docAttr.user_name = _this.$store.state.user.name;
+      _this.docAttr.user_id = _this.$store.state.user.id;
       if (_this.docAttr.id > 0) {
       if (_this.docAttr.id > 0) {
         updateDocument(_this.docAttr).then((res) => {
         updateDocument(_this.docAttr).then((res) => {
           if (res.status != 200) return; //更新文档
           if (res.status != 200) return; //更新文档
@@ -651,6 +709,44 @@ export default {
         });
         });
       }
       }
     },
     },
+    /* 保存并更新模版 */
+    onSaveUpload(e) {
+      let _this = this;
+      if (_this.coms.length <= 0) {
+        _this.$alert("增加组件");
+        return;
+      }
+      if (_this.docAttr.category_id == "" || _this.docAttr.category_id <= 0) {
+        _this.$alert("请选择分类");
+        return;
+      }
+      if (_this.docAttr.title == "") {
+        _this.$alert("请填写模版标题");
+        return;
+      }
+
+      _this.docAttr.links = JSON.stringify(_this.docAttr.linkProduct);
+      _this.docAttr.projects = JSON.stringify(_this.docAttr.linkProject);
+      _this.docAttr.data = JSON.stringify(_this.coms);
+      _this.docAttr.is_template = 1;
+      _this.docAttr.user_name = _this.$store.state.user.name;
+      _this.docAttr.user_id = _this.$store.state.user.id;
+      if (_this.docAttr.id > 0) {
+        updateDocument(_this.docAttr).then((res) => {
+          if (res.status != 200) return; //更新文档
+          _this.docAttr.id = res.data;
+          _this.$alert("模版更新成功");
+          _this.searchArticle();
+        });
+      } else {
+        createDocument(_this.docAttr).then((res) => {
+          if (res.status != 200) return; //保存文档
+          _this.docAttr.id = res.data;
+          _this.$alert("模版保存成功");
+          _this.searchArticle();
+        });
+      }
+    },
 
 
     //设置组件值
     //设置组件值
     onSetComs(e) {
     onSetComs(e) {
@@ -750,7 +846,7 @@ export default {
       }
       }
       console.log(e);
       console.log(e);
       let com = _this.coms[_this.comIndex];
       let com = _this.coms[_this.comIndex];
-      console.log("com:",com);
+      console.log("com:", com);
       let data = {
       let data = {
         type: "Directory",
         type: "Directory",
         id: "Directory" + (com.attrs.length + 1),
         id: "Directory" + (com.attrs.length + 1),
@@ -1050,10 +1146,15 @@ export default {
       let _this = this;
       let _this = this;
       searchDocument({
       searchDocument({
         page: 1,
         page: 1,
-        pageSize: 10,
+        pageSize: 99,
       }).then((res) => {
       }).then((res) => {
         if (res.status != 200) return;
         if (res.status != 200) return;
-        _this.articleList = res.data.dataList;
+        _this.articleList = res.data.dataList.filter(
+          (el) => el.is_template == 0
+        );
+        _this.templateList = res.data.dataList.filter(
+          (el) => el.is_template == 1
+        );
       });
       });
     },
     },
   },
   },

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

@@ -150,7 +150,7 @@
       btnEdit(e){
       btnEdit(e){
         let _this=this;
         let _this=this;
         let a=document.createElement("a");
         let a=document.createElement("a");
-        a.href="/document/create?articleId="+e;
+        a.href="#/document/create?articleId="+e;
         a.target="_blank";
         a.target="_blank";
         a.click();
         a.click();
 
 
@@ -168,7 +168,7 @@
         let _this=this;
         let _this=this;
         searchDocument(_this.queryForm).then(res=>{
         searchDocument(_this.queryForm).then(res=>{
           if(!res)return;
           if(!res)return;
-          _this.dataList=res.data.dataList;
+          _this.dataList=res.data.dataList.filter(el => el.is_template == 1);
           _this.recordCount=res.data.totalRecord;
           _this.recordCount=res.data.totalRecord;
           _this.pageTotal=res.data.pageTotal;
           _this.pageTotal=res.data.pageTotal;
         })
         })

+ 1 - 1
src/views/login/index.scss

@@ -18,7 +18,7 @@ $cursor: #333;
     width: 85%;
     width: 85%;
 
 
     input {
     input {
-
+      background-color: #e8f0fe;
       border: 0px;
       border: 0px;
       -webkit-appearance: none;
       -webkit-appearance: none;
       border-radius: 0px;
       border-radius: 0px;

+ 119 - 2
src/views/role/components/dataInfo.vue

@@ -31,6 +31,11 @@
               padding: 10px;
               padding: 10px;
             "
             "
           >
           >
+            <el-checkbox
+              v-model="allChecked.nodeTree"
+              @change="handleCheckAllChange('nodeTree')"
+              >全选</el-checkbox
+            >
             <el-tree
             <el-tree
               ref="nodeTree"
               ref="nodeTree"
               style="max-width: 600px"
               style="max-width: 600px"
@@ -39,6 +44,7 @@
               default-expand-all
               default-expand-all
               node-key="value"
               node-key="value"
               show-checkbox
               show-checkbox
+              @check="handleNodeCheck"
             />
             />
           </div>
           </div>
         </el-form-item>
         </el-form-item>
@@ -54,6 +60,11 @@
               padding: 10px;
               padding: 10px;
             "
             "
           >
           >
+            <el-checkbox
+              v-model="allChecked.templateCate"
+              @change="handleTemplateAllChange('templateCate')"
+              >全选</el-checkbox
+            >
             <el-tree
             <el-tree
               ref="templateCate"
               ref="templateCate"
               style="max-width: 600px"
               style="max-width: 600px"
@@ -62,6 +73,7 @@
               default-expand-all
               default-expand-all
               node-key="value"
               node-key="value"
               show-checkbox
               show-checkbox
+              @check="handleTemplateCheck"
             />
             />
           </div>
           </div>
         </el-form-item>
         </el-form-item>
@@ -76,6 +88,11 @@
               padding: 10px;
               padding: 10px;
             "
             "
           >
           >
+            <el-checkbox
+              v-model="allChecked.docCate"
+              @change="handleDocAllChange('docCate')"
+              >全选</el-checkbox
+            >
             <el-tree
             <el-tree
               ref="docCate"
               ref="docCate"
               style="max-width: 600px"
               style="max-width: 600px"
@@ -84,6 +101,7 @@
               default-expand-all
               default-expand-all
               node-key="value"
               node-key="value"
               show-checkbox
               show-checkbox
+              @check="handleDocCheck"
             />
             />
           </div>
           </div>
         </el-form-item>
         </el-form-item>
@@ -98,6 +116,11 @@
               padding: 10px;
               padding: 10px;
             "
             "
           >
           >
+            <el-checkbox
+              v-model="allChecked.sourceDataTree"
+              @change="handleSourceDataAllChange('sourceDataTree')"
+              >全选</el-checkbox
+            >
             <el-tree
             <el-tree
               ref="sourceDataTree"
               ref="sourceDataTree"
               style="max-width: 600px"
               style="max-width: 600px"
@@ -106,6 +129,7 @@
               default-expand-all
               default-expand-all
               node-key="value"
               node-key="value"
               show-checkbox
               show-checkbox
+              @check="handleSourceDataCheck"
             />
             />
           </div>
           </div>
         </el-form-item>
         </el-form-item>
@@ -205,6 +229,12 @@ export default {
       templateCate: [],
       templateCate: [],
       documentCate: [],
       documentCate: [],
       sourceDataCate: [],
       sourceDataCate: [],
+      allChecked: {
+        nodeTree: false,
+        templateCate: false,
+        docCate: false,
+        sourceDataTree: false,
+      },
     };
     };
   },
   },
 
 
@@ -215,6 +245,22 @@ export default {
     this.initSourceDataCate();
     this.initSourceDataCate();
   },
   },
   methods: {
   methods: {
+    /* 全选原始数据分类 */
+    handleSourceDataAllChange(treeRef) {
+      const tree = this.$refs[treeRef];
+      const data = this.sourceDataCate;
+      tree.setCheckedNodes(
+        this.allChecked[treeRef] ? this.flattenTree(data) : []
+      );
+    },
+
+    handleSourceDataCheck() {
+      const tree = this.$refs.sourceDataTree;
+      const checkedCount = tree.getCheckedNodes(true).length;
+      const totalCount = this.countAllNodes(this.sourceDataCate);
+      this.allChecked.sourceDataTree =
+        checkedCount === totalCount && totalCount > 0;
+    },
     initSourceDataCate() {
     initSourceDataCate() {
       let _this = this;
       let _this = this;
       searchSourceDataCategory({ page: 1, pageSize: 9999, status: 5 }).then(
       searchSourceDataCategory({ page: 1, pageSize: 9999, status: 5 }).then(
@@ -269,6 +315,21 @@ export default {
         }
         }
       );
       );
     },
     },
+    /* 全选文档分类 */
+    handleDocAllChange(treeRef) {
+      const tree = this.$refs[treeRef];
+      const data = this.documentCate;
+      tree.setCheckedNodes(
+        this.allChecked[treeRef] ? this.flattenTree(data) : []
+      );
+    },
+
+    handleDocCheck() {
+      const tree = this.$refs.docCate;
+      const checkedCount = tree.getCheckedNodes(true).length;
+      const totalCount = this.countAllNodes(this.documentCate);
+      this.allChecked.docCate = checkedCount === totalCount && totalCount > 0;
+    },
     initDocCategory() {
     initDocCategory() {
       let _this = this;
       let _this = this;
       searchDocumentCategory({ page: 1, pageSize: 9999, status: 5 }).then(
       searchDocumentCategory({ page: 1, pageSize: 9999, status: 5 }).then(
@@ -323,7 +384,40 @@ export default {
         }
         }
       );
       );
     },
     },
+    /* 全选模版分类 */
+    handleTemplateAllChange(treeRef) {
+      const tree = this.$refs[treeRef];
+      const data = this.templateCate;
+      tree.setCheckedNodes(
+        this.allChecked[treeRef] ? this.flattenTree(data) : []
+      );
+    },
+
+    handleTemplateCheck() {
+      const tree = this.$refs.templateCate;
+      const checkedCount = tree.getCheckedNodes(true).length;
+      const totalCount = this.countAllNodes(this.templateCate);
+      this.allChecked.templateCate =
+        checkedCount === totalCount && totalCount > 0;
+    },
+
+    flattenTree(tree) {
+      return tree.reduce((acc, node) => {
+        if (node.children && node.children.length > 0) {
+          return [...acc, node, ...this.flattenTree(node.children)];
+        }
+        return [...acc, node];
+      }, []);
+    },
 
 
+    countAllNodes(nodes) {
+      return nodes.reduce((count, node) => {
+        if (node.children && node.children.length > 0) {
+          return count + 1 + this.countAllNodes(node.children);
+        }
+        return count + 1;
+      }, 0);
+    },
     //初始化模板分类
     //初始化模板分类
     initTemplateCate() {
     initTemplateCate() {
       let _this = this;
       let _this = this;
@@ -388,7 +482,30 @@ export default {
         });
         });
       });
       });
     },
     },
+    /* 权限配置全选 */
+    handleCheckAllChange(treeRef) {
+      const tree = this.$refs[treeRef];
+      tree.setCheckedNodes(this.allChecked[treeRef] ? this.treeData : []);
+    },
+
+    handleNodeCheck() {
+      const tree = this.$refs.nodeTree;
+      const checkedCount = tree.getCheckedNodes().length;
+      const totalCount = this.countAllNodes(this.treeData);
+      this.allChecked.nodeTree = checkedCount === totalCount;
+    },
 
 
+    countAllNodes(nodes) {
+      let count = 0;
+      for (const node of nodes) {
+        count++;
+        if (node.children) {
+          count += this.countAllNodes(node.children);
+        }
+      }
+      return count;
+    },
+    /* 权限配置 */
     initNodeList() {
     initNodeList() {
       let _this = this;
       let _this = this;
       searchAdminAuth({ page: 1, pageSize: 999, status: 5 }).then((res) => {
       searchAdminAuth({ page: 1, pageSize: 999, status: 5 }).then((res) => {
@@ -531,7 +648,7 @@ export default {
         if (sourceCate.length > 0) {
         if (sourceCate.length > 0) {
           let list = sourceCate.flatMap((el) =>
           let list = sourceCate.flatMap((el) =>
             el.children.map((e) => {
             el.children.map((e) => {
-              if(e.isMain=='True'){
+              if (e.isMain == "True") {
                 e.isMain = true;
                 e.isMain = true;
               }
               }
               return e;
               return e;
@@ -546,7 +663,7 @@ export default {
         if (docCate.length > 0) {
         if (docCate.length > 0) {
           let list = docCate.flatMap((el) =>
           let list = docCate.flatMap((el) =>
             el.children.map((e) => {
             el.children.map((e) => {
-              if(e.isMain=='True'){
+              if (e.isMain == "True") {
                 e.isMain = true;
                 e.isMain = true;
               }
               }
               return e;
               return e;

+ 148 - 119
src/views/template/category/components/dataInfo.vue

@@ -1,151 +1,180 @@
 <template>
 <template>
   <div class="data-info">
   <div class="data-info">
     <el-card>
     <el-card>
-      <el-form :model="dataForm" label-width="120px">
+      <el-form :model="dataForm" ref="dataFormRef" label-width="120px">
         <el-form-item label="父级分类:">
         <el-form-item label="父级分类:">
-          <el-select v-model="dataForm.parent_id"  placeholder="请选择你级分类" size="large"  style="width:100%;">
-              <el-option
-                v-for="item in parentList"
-                :key="item.id"
-                :label="item.name"
-                :value="item.id"
-              />
-            </el-select>
+          <el-select
+            v-model="dataForm.parent_id"
+            placeholder="请选择你级分类"
+            size="large"
+            clearable
+            style="width: 100%"
+          >
+            <el-option
+              v-for="item in parentList"
+              :key="item.id"
+              :label="item.name"
+              :value="item.id"
+            />
+          </el-select>
         </el-form-item>
         </el-form-item>
         <el-form-item label="分类名称:">
         <el-form-item label="分类名称:">
           <el-input v-model="dataForm.name"></el-input>
           <el-input v-model="dataForm.name"></el-input>
         </el-form-item>
         </el-form-item>
-       <!-- <el-form-item label="分类介绍:">
+        <!-- <el-form-item label="分类介绍:">
            <el-input type="textarea" v-model="dataForm.intro"></el-input>
            <el-input type="textarea" v-model="dataForm.intro"></el-input>
        </el-form-item> -->
        </el-form-item> -->
         <el-form-item label="分类状态:">
         <el-form-item label="分类状态:">
-          <el-select v-model="dataForm.status"  placeholder="请选择分类状态" size="large"  style="width:100%;">
-              <el-option
-                v-for="item in statusOptions"
-                :key="item.value"
-                :label="item.label"
-                :value="item.value"
-              />
-            </el-select>
+          <el-select
+            v-model="dataForm.status"
+            placeholder="请选择分类状态"
+            size="large"
+            style="width: 100%"
+          >
+            <el-option
+              v-for="item in statusOptions"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value"
+            />
+          </el-select>
         </el-form-item>
         </el-form-item>
-
       </el-form>
       </el-form>
     </el-card>
     </el-card>
-    <div style="text-align:right; margin-top:20px;">
-        <el-button type="warning" @click="btnSave">确认保存</el-button>
+    <div style="text-align: right; margin-top: 20px">
+      <el-button type="warning" @click="btnSave">确认保存</el-button>
     </div>
     </div>
   </div>
   </div>
 </template>
 </template>
 
 
 <script>
 <script>
-  import { createTemplateCategory,updateTemplateCategory,getTemplateCategoryInfo,searchTemplateCategory } from '@/api/template';
-  export default{
-    emits:['onClose'],
-    props:{
-      id:{
-        type:Number,
-        default:0
+import {
+  createTemplateCategory,
+  updateTemplateCategory,
+  getTemplateCategoryInfo,
+  searchTemplateCategory,
+} from "@/api/template";
+export default {
+  emits: ["onClose", "onSearch"],
+  props: {
+    id: {
+      type: Number,
+      default: 0,
+    },
+  },
+  watch: {
+    id: {
+      handler(v) {
+        let _this = this;
+        if (v == null || v <= 0) return;
+        _this.getInfo(v);
       },
       },
+      immediate: true,
+      deep: true,
     },
     },
-    watch:{
-      id:{
-        handler(v){
-            let _this=this;
-            if(v==null || v<=0)return;
-            _this.getInfo(v);
+  },
+  data() {
+    return {
+      activeName: "base",
+      currentCategory: [],
+      dataForm: {
+        id: 0,
+        name: "",
+        parent_id: "",
+        intro: "",
+        status: 5,
+      },
+      parentList: [],
+      statusOptions: [
+        {
+          value: "",
+          label: "请选择状态",
         },
         },
-        immediate: true,
-        deep: true
-      }
-    },
-    data(){
-      return{
-        activeName:'base',
-        currentCategory:[],
-        dataForm:{
-           id:0,
-           name:'',
-           parent_id:'',
-           intro:'',
-           status:5,
+        {
+          value: 5,
+          label: "启用",
         },
         },
-        parentList:[],
-        statusOptions:[
-          {
-            value:'',
-            label:"请选择状态"
-          },
-          {
-            value:5,
-            label:'启用'
-          },
-          {
-            value:6,
-            label:"停用"
-          },
-        ],
-      }
-    },
+        {
+          value: 6,
+          label: "停用",
+        },
+      ],
+    };
+  },
 
 
-    mounted() {
-      this.initParentCategory();
+  mounted() {
+    this.initParentCategory();
+  },
+  methods: {
+    resetForm() {
+      // 重置所有表单字段
+      this.dataForm = {}; // 或者设置为初始值
+      // 如果使用 el-form,可以调用其 resetFields 方法
+      this.$refs.dataFormRef.resetFields();
     },
     },
-    methods:{
-      initParentCategory(){
-        let _this=this;
-        searchTemplateCategory({page:1,pageSize:999,parent_id:0,status:5}).then(res=>{
-            if(res.status!=200)return;
-            _this.parentList.push({id:0,name:"父级分类"})
-            for(var i=0;i<res.data.dataList.length;i++){
-              _this.parentList.push({id:res.data.dataList[i].id,name:res.data.dataList[i].name});
-            }
-        })
-      },
-      //保存更新
-      btnSave(e){
-        let _this=this;
-        if(_this.dataForm.id>0){
-          updateTemplateCategory(_this.dataForm).then(res=>{
-            if(res.status!=200)return;
-            _this.$alert("模板类别信息更新成功");
-            _this.$emit("onClose");
-          })
-        }else{
-          createTemplateCategory(_this.dataForm).then(res=>{
-            if(res.status!=200)return;
-            _this.$alert("模板类别信息创建成功");
-            _this.$emit("onClose");
-          })
+    initParentCategory() {
+      let _this = this;
+      searchTemplateCategory({
+        page: 1,
+        pageSize: 999,
+        parent_id: 0,
+        status: 5,
+      }).then((res) => {
+        if (res.status != 200) return;
+        _this.parentList.push({ id: 0, name: "父级分类" });
+        for (var i = 0; i < res.data.dataList.length; i++) {
+          _this.parentList.push({
+            id: res.data.dataList[i].id,
+            name: res.data.dataList[i].name,
+          });
         }
         }
-      },
-
-      //产品详情
-      getInfo(id){
-          let _this=this;
-          let par={
-            id:id,
-          };
-          getTemplateCategoryInfo(par).then(res=>{
-              if(!res)return;
-              if(res.status!=200)return;
-              _this.dataForm=res.data;
-          })
-      },
-
-      onChangeStatus(e){
-          this.dataForm.status=e;
-      },
-      //修改分类信息
-      onChangeCategory(e){
-         let _this=this;
-         _this.dataForm.categoryId=e;
-      },
+      });
+    },
+    //保存更新
+    btnSave(e) {
+      let _this = this;
+      if (_this.dataForm.id > 0) {
+        updateTemplateCategory(_this.dataForm).then((res) => {
+          if (res.status != 200) return;
+          _this.$alert("模板类别信息更新成功");
+          _this.$emit("onSearch");
+          _this.$emit("onClose");
+        });
+      } else {
+        createTemplateCategory(_this.dataForm).then((res) => {
+          if (res.status != 200) return;
+          _this.$alert("模板类别信息创建成功");
+          _this.$emit("onSearch");
+          _this.$emit("onClose");
+        });
+      }
+    },
 
 
+    //产品详情
+    getInfo(id) {
+      let _this = this;
+      let par = {
+        id: id,
+      };
+      getTemplateCategoryInfo(par).then((res) => {
+        if (!res) return;
+        if (res.status != 200) return;
+        _this.dataForm = res.data;
+      });
+    },
 
 
-    }
-  }
+    onChangeStatus(e) {
+      this.dataForm.status = e;
+    },
+    //修改分类信息
+    onChangeCategory(e) {
+      let _this = this;
+      _this.dataForm.categoryId = e;
+    },
+  },
+};
 </script>
 </script>
 
 
 <style lang="scss">
 <style lang="scss">
- @import './dataInfo.scss'
+@import "./dataInfo.scss";
 </style>
 </style>

+ 25 - 11
src/views/template/category/components/dataList.vue

@@ -74,8 +74,14 @@
       width="50%"
       width="50%"
       custom-class="prod-verify"
       custom-class="prod-verify"
       title="创建模板分类"
       title="创建模板分类"
+      @closed="handleDialogClosed"
     >
     >
-      <dataInfo :id="currentDataId" @onClose="onClose"></dataInfo>
+      <dataInfo
+        :id="currentDataId"
+        @onClose="onClose"
+        ref="currentInfoRef"
+        @onSearch="search"
+      ></dataInfo>
     </el-dialog>
     </el-dialog>
   </div>
   </div>
 </template>
 </template>
@@ -126,6 +132,12 @@ export default {
     this.search();
     this.search();
   },
   },
   methods: {
   methods: {
+    handleDialogClosed() {
+      // 清空 dataInfo 组件内的表单
+      if (this.$refs.dataInfoRef) {
+        this.$refs.dataInfoRef.resetForm(); // 假设 dataInfo 组件有一个 resetForm 方法
+      }
+    },
     btnView(e) {
     btnView(e) {
       let _this = this;
       let _this = this;
       _this.queryForm.parent_id = e;
       _this.queryForm.parent_id = e;
@@ -137,14 +149,14 @@ export default {
 
 
     loadData(row, node, resolve) {
     loadData(row, node, resolve) {
       setTimeout(() => {
       setTimeout(() => {
-        searchTemplateCategory({parent_id:row.id}).then(res=>{
-          if(res.data.length==0){
-            this.$message.warning('暂无数据!')
+        searchTemplateCategory({ parent_id: row.id }).then((res) => {
+          if (res.data.length == 0) {
+            this.$message.warning("暂无数据!");
           }
           }
-          resolve(res.data)
-        })
-       
-     /*    resolve(row.children); */
+          resolve(res.data);
+        });
+
+        /*    resolve(row.children); */
       }, 0);
       }, 0);
     },
     },
 
 
@@ -193,9 +205,11 @@ export default {
       let _this = this;
       let _this = this;
       searchTemplateCategory(_this.queryForm).then((res) => {
       searchTemplateCategory(_this.queryForm).then((res) => {
         if (!res) return;
         if (!res) return;
-        res.data.dataList.map(el=>{
-            el.hasChildren=true
-        })
+        res.data.dataList.map((el) => {
+          if (el.child_count > 0) {
+            el.hasChildren = true;
+          }
+        });
         _this.dataList = res.data.dataList;
         _this.dataList = res.data.dataList;
         _this.recordCount = res.data.totalRecord;
         _this.recordCount = res.data.totalRecord;
         _this.pageTotal = res.data.totalPage;
         _this.pageTotal = res.data.totalPage;

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

@@ -143,7 +143,7 @@
       btnEdit(e){
       btnEdit(e){
         let _this=this;
         let _this=this;
         var a = document.createElement('a');
         var a = document.createElement('a');
-        a.href="/document/create?templateId="+e
+        a.href="#/document/create?templateId="+e
         a.target="_blank";
         a.target="_blank";
         a.click();
         a.click();
       },
       },

+ 1 - 1
src/views/template/components/dataSearch.vue

@@ -102,7 +102,7 @@ export default{
       window.open(url, '_blank'); */
       window.open(url, '_blank'); */
       let _this=this;
       let _this=this;
         var a = document.createElement('a');
         var a = document.createElement('a');
-        a.href="/document/create"
+        a.href="#/document/create"
         a.target="_blank";
         a.target="_blank";
         a.click();
         a.click();
     },
     },

Niektoré súbory nie sú zobrazené, pretože je v týchto rozdielových dátach zmenené mnoho súborov