Browse Source

修改bug并打包

yangg 10 months ago
parent
commit
39bae1f5de
42 changed files with 783 additions and 290 deletions
  1. 0 0
      dist/index.html
  2. 0 0
      dist/static/css/chunk-1c5bf07a.eba2c7e2.css
  3. 0 0
      dist/static/css/chunk-1cad9628.379f563b.css
  4. 0 0
      dist/static/css/chunk-23f05548.2133235c.css
  5. 0 0
      dist/static/css/chunk-3d89db3c.6044f932.css
  6. 0 0
      dist/static/css/chunk-4487d514.6044f932.css
  7. 0 0
      dist/static/css/chunk-56e70210.775a21e3.css
  8. 0 0
      dist/static/css/chunk-62250b71.7131743c.css
  9. 0 0
      dist/static/css/chunk-768c2465.a1e29eed.css
  10. 0 0
      dist/static/css/chunk-f23301fc.6f8877c6.css
  11. 0 0
      dist/static/js/app.ea419685.js
  12. 0 0
      dist/static/js/chunk-032394b1.cf7e5969.js
  13. 0 0
      dist/static/js/chunk-055f43c8.3d478033.js
  14. 0 0
      dist/static/js/chunk-07c440fa.66849224.js
  15. 0 0
      dist/static/js/chunk-1c5bf07a.c38585e2.js
  16. 0 0
      dist/static/js/chunk-1cad9628.5ea40efa.js
  17. 0 0
      dist/static/js/chunk-23f05548.9a76e388.js
  18. 0 0
      dist/static/js/chunk-3d89db3c.41678534.js
  19. 0 0
      dist/static/js/chunk-4487d514.753e8502.js
  20. 0 0
      dist/static/js/chunk-467147c8.09c88f63.js
  21. 0 0
      dist/static/js/chunk-56c89a2a.78a49871.js
  22. 2 0
      dist/static/js/chunk-56e70210.5e2d6b26.js
  23. 0 0
      dist/static/js/chunk-5f297ed0.0b78b3e4.js
  24. 0 0
      dist/static/js/chunk-62250b71.ae2cbef4.js
  25. 0 0
      dist/static/js/chunk-768c2465.ab830635.js
  26. 0 0
      dist/static/js/chunk-f23301fc.3ef8a5c3.js
  27. 5 5
      src/views/dashboard/admin/components/PanelGroup.vue
  28. 1 1
      src/views/document/com/components/Attribute/docAttr/index.vue
  29. 2 2
      src/views/document/com/components/Formula/dataInfo.vue
  30. 28 8
      src/views/document/com/components/TextArea/index.vue
  31. 4 0
      src/views/document/com/components/Variable/dataInfo.vue
  32. 9 2
      src/views/document/com/editor.scss
  33. 77 29
      src/views/document/com/editor.vue
  34. 1 1
      src/views/document/com/menus.scss
  35. 1 1
      src/views/document/components/dataList.vue
  36. 1 1
      src/views/document/components/dataSearch.vue
  37. 16 9
      src/views/document/create.scss
  38. 173 21
      src/views/document/create.vue
  39. 62 45
      src/views/role/components/dataInfo.vue
  40. 288 154
      src/views/template/components/dataList.vue
  41. 112 10
      src/views/template/components/dataSearch.vue
  42. 1 1
      vue.config.js

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


File diff suppressed because it is too large
+ 0 - 0
dist/static/css/chunk-1c5bf07a.eba2c7e2.css


File diff suppressed because it is too large
+ 0 - 0
dist/static/css/chunk-1cad9628.379f563b.css


File diff suppressed because it is too large
+ 0 - 0
dist/static/css/chunk-23f05548.2133235c.css


+ 0 - 0
dist/static/css/chunk-055f43c8.e30e9787.css → dist/static/css/chunk-3d89db3c.6044f932.css


+ 0 - 0
dist/static/css/chunk-db653464.e30e9787.css → dist/static/css/chunk-4487d514.6044f932.css


+ 0 - 0
dist/static/css/chunk-5f297ed0.775a21e3.css → dist/static/css/chunk-56e70210.775a21e3.css


+ 0 - 0
dist/static/css/chunk-56c89a2a.7131743c.css → dist/static/css/chunk-62250b71.7131743c.css


File diff suppressed because it is too large
+ 0 - 0
dist/static/css/chunk-768c2465.a1e29eed.css


+ 0 - 0
dist/static/css/chunk-467147c8.6f8877c6.css → dist/static/css/chunk-f23301fc.6f8877c6.css


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


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/chunk-032394b1.cf7e5969.js


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/chunk-055f43c8.3d478033.js


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/chunk-07c440fa.66849224.js


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/chunk-1c5bf07a.c38585e2.js


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/chunk-1cad9628.5ea40efa.js


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/chunk-23f05548.9a76e388.js


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


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/chunk-4487d514.753e8502.js


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/chunk-467147c8.09c88f63.js


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/chunk-56c89a2a.78a49871.js


File diff suppressed because it is too large
+ 2 - 0
dist/static/js/chunk-56e70210.5e2d6b26.js


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/chunk-5f297ed0.0b78b3e4.js


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/chunk-62250b71.ae2cbef4.js


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/chunk-768c2465.ab830635.js


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


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

@@ -1,6 +1,6 @@
 <template>
   <el-row :gutter="40" class="panel-group">
-    <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
+    <el-col :xs="12" :sm="12" :lg="8" class="card-panel-col">
       <div class="card-panel" @click="handleSetLineChartData('newVisitis')">
         <div class="card-panel-icon-wrapper icon-people">
           <svg-icon icon-class="peoples" class-name="card-panel-icon" />
@@ -13,7 +13,7 @@
         </div>
       </div>
     </el-col>
-    <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
+    <el-col :xs="12" :sm="12" :lg="8" class="card-panel-col">
       <div class="card-panel" @click="handleSetLineChartData('messages')">
         <div class="card-panel-icon-wrapper icon-message">
           <svg-icon icon-class="wendang" class-name="card-panel-icon" />
@@ -26,7 +26,7 @@
         </div>
       </div>
     </el-col>
-    <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
+    <el-col :xs="12" :sm="12" :lg="8" class="card-panel-col">
       <div class="card-panel" @click="handleSetLineChartData('purchases')">
         <div class="card-panel-icon-wrapper icon-money">
           <svg-icon icon-class="zujian" class-name="card-panel-icon" />
@@ -39,7 +39,7 @@
         </div>
       </div>
     </el-col>
-    <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
+    <!-- <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
       <div class="card-panel" @click="handleSetLineChartData('shoppings')">
         <div class="card-panel-icon-wrapper icon-shopping">
           <svg-icon icon-class="chanpin" class-name="card-panel-icon" />
@@ -51,7 +51,7 @@
           <count-to :start-val="0" :end-val="statisticsForm.product_count" :duration="3600" class="card-panel-num" />
         </div>
       </div>
-    </el-col>
+    </el-col> -->
   </el-row>
 </template>
 

+ 1 - 1
src/views/document/com/components/Attribute/docAttr/index.vue

@@ -3,7 +3,7 @@
     <el-form>
 
       <el-form-item label="标题:">
-        <el-input  v-model="attrs.title" style="width:100%;" class="input-item" placeholder="请填写文档名称"/>
+        <el-input  v-model="attrs.title" style="width:100%;" class="input-item" placeholder="请填写模板名称"/>
       </el-form-item>
 
 

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

@@ -14,9 +14,9 @@
             ref="formulaInput"
           ></el-input>
           <div style="display: flex; justify-content: flex-end">
-            <el-button style="margin-top: 10px" @click="InsertTableData"
+            <!-- <el-button style="margin-top: 10px" @click="InsertTableData"
               >插入表格数据</el-button
-            >
+            > -->
             <el-button style="margin-top: 10px" @click="InsertModule"
               >插入模块变量</el-button
             >

+ 28 - 8
src/views/document/com/components/TextArea/index.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="template-textarea">
     <template v-if="isEdit == 1">
-      <div class="editor-area">
+      <div class="editor-area sticky-editor">
         <ckeditor
           ref="editor"
           v-model="com.content"
@@ -124,7 +124,7 @@ export default {
       editorUrl: "/ckeditor/ckeditor.js",
       editorConfig: {
         language: "zh-cn",
-        height: "800px",
+        height: "650px",
       },
 
       content: "",
@@ -250,11 +250,14 @@ export default {
           //// console.log('attrs',_this.com.attrs[i]);
           //处理计算公式 不处理
           let formual = await _this.analysisFormual(_this.com.attrs[i]);
-          let point= _this.com.attrs[i].data.point
+          let point = _this.com.attrs[i].data.point;
           formual = await _this.getRemote(formual);
-        
+
           _this.com.attrs[i].content = eval(formual).toFixed(point);
-          data = data.replace("{{" + attrId + "}}", eval(formual).toFixed(point));
+          data = data.replace(
+            "{{" + attrId + "}}",
+            eval(formual).toFixed(point)
+          );
 
           /* let formual = await _this.analysisFormual(_this.com.attrs[i]);
           formual = await _this.getRemote(formual);
@@ -425,7 +428,7 @@ export default {
         let itemName = items[0];
         // console.log("处理项:", itemName);
         try {
-          let data = await _this.getFormualData(itemName,attrs.data);
+          let data = await _this.getFormualData(itemName, attrs.data);
           // console.log(`获取到的数据: ${itemName} = ${data}`);
           if (data === null || data === undefined || isNaN(data)) {
             console.warn(`获取到的数据无效: ${itemName}`);
@@ -442,7 +445,7 @@ export default {
       return formual;
     },
 
-    async getFormualData(formualItem,data) {
+    async getFormualData(formualItem, data) {
       let _this = this;
       // console.log("开始获取公式数据:", formualItem);
       var pattern = /\[(.*?)\]\[(.*?)\]\[(.*?)\]/;
@@ -455,7 +458,7 @@ export default {
       } else {
         console.warn("无法解析公式项:", formualItem);
       }
-   /*     console.log("计算结果:", formualItem,data); */
+      /*     console.log("计算结果:", formualItem,data); */
       return calResult;
     },
 
@@ -692,4 +695,21 @@ export default {
   font-weight: inherit;
   padding: 2px 4px;
 }
+.editor-wrapper {
+  position: relative;
+}
+
+.sticky-toolbar {
+  position: sticky;
+  top: 0;
+  z-index: 1000;
+  background-color: #fff;
+  border-bottom: 1px solid #d1d1d1;
+}
+
+.editor-area {
+  ::v-deep .cke_top {
+    display: none; // Hide the original toolbar
+  }
+}
 </style>

+ 4 - 0
src/views/document/com/components/Variable/dataInfo.vue

@@ -158,6 +158,10 @@ export default {
       activeName: "base",
       currentCategory: [],
       valueTypeList: [
+      {
+          value: 0,
+          name: "请选择取值类型",
+        },
         {
           value: 1,
           name: "输入框",

+ 9 - 2
src/views/document/com/editor.scss

@@ -15,7 +15,8 @@
   }
 
   .layers{
-    width:90%;
+    margin-bottom: 10px;
+    width:92.5%;
     // min-height:30px;
     display:flex;
     flex-direction: column;
@@ -117,7 +118,13 @@
   }
 
   .active-layer{
-    border: 1px solid blue;
+    box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
+    border: 1px solid black;
   }
 
 }
+.btn-save{
+  display: flex;
+  justify-content: flex-end;
+  margin-right: 15px;
+}

+ 77 - 29
src/views/document/com/editor.vue

@@ -6,13 +6,13 @@
       @update="onDragEnd"
       group="itxst"
       animation="300"
-      style="width: 100%"
+      :style="draggableStyle"
       handle=".drag-handle"
       :scroll="true"
       :scrollSensitivity="100"
       :scrollSpeed="20"
     >
-      <transition-group>
+      <transition-group style="display:block;min-height: 100vh;">
         <template v-for="(it, index) in comList">
           <div
             class="layers"
@@ -25,8 +25,8 @@
             <!-- :options="categoryList":props="props" -->
             <div style="padding: 10px 0">
               <el-form label-position="left" class="inline-form">
-                <el-row>
-                  <el-col :span="7">
+                <el-row :gutter="24">
+                  <el-col :span="8">
                     <el-form-item label="模块分类:">
                       <!-- 此处需要处理为只有admin账号可编辑 -->
                       <!-- <el-cascader
@@ -39,7 +39,7 @@
                         placeholder="请选择模块分类"
                       /> -->
                       <!-- {{ $store.state.user }} -->
-                      <el-select
+                      <!-- <el-select
                         v-if="$store.state.user.id == 2"
                         v-model="it.category_id"
                         placeholder="请选择模块分类"
@@ -52,21 +52,22 @@
                           :label="item.name"
                           :value="item.id"
                         />
-                      </el-select>
-                      <span v-else>{{ getCategory(it.category_id) }}</span>
+                      </el-select> -->
+                      <span>{{ getCategory(it.category_id) }}</span>
                     </el-form-item>
                   </el-col>
-                  <el-col :span="6">
+                  <el-col :span="8">
                     <el-form-item label="模块名称:">
-                      <el-input
-                        v-if="$store.state.user.id == 2"
+                      <!-- <el-input
+                       
                         class="input-item"
                         v-model="it.name"
                         placeholder="请填写模块名称"
-                      />
-                      <span v-else>{{ it.name }}</span>
-                    </el-form-item> </el-col
-                  ><el-col :span="6">
+                      /> -->
+                      <span >{{ it.name }}</span>
+                    </el-form-item>
+                  </el-col>
+                  <!-- <el-col :span="6">
                     <el-form-item label="模块描述:">
                       <el-input
                         v-if="$store.state.user.id == 2"
@@ -75,24 +76,66 @@
                         placeholder="请填写模块介绍"
                       />
                       <span v-else>{{ it.intro }}</span>
-                    </el-form-item></el-col
-                  >
-                  <el-col :span="4">
+                    </el-form-item>
+                  </el-col> -->
+                  <el-col :span="3" :offset="5">
                     <el-form-item v-if="$store.state.user.id == 2">
                       <div class="btn-save">
+                        <el-tooltip
+                          class="item"
+                          effect="dark"
+                          content="保存模块"
+                          placement="top"
+                        >
+                          <el-button
+                            size="mini"
+                            @click="onSaveTemplate(it)"
+                            icon="el-icon-document-add"
+                            circle
+                          >
+                          </el-button>
+                        </el-tooltip>
+                       <!--  <el-tooltip
+                          class="item"
+                          effect="dark"
+                          content="另存为"
+                          placement="top"
+                        >
+                          <el-button
+                            circle
+                            size="mini"
+                            @click="onSaveAs(it)"
+                            v-if="it.id > 0"
+                            icon="el-icon-document-copy"
+                          >
+                          </el-button>
+                        </el-tooltip> -->
                         <el-button
-                          type="primary"
+                          circle
                           size="mini"
-                          @click="onSaveTemplate(it)"
-                          >保存模块</el-button
+                          v-if="it.isEdit !== 1"
+                          @click="onEdit(index, 1)"
                         >
+                          <svg-icon icon-class="edit" />
+                        </el-button>
                         <el-button
-                          type="primary"
+                          circle
                           size="mini"
-                          @click="onSaveAs(it)"
-                          v-if="it.id > 0"
-                          >另存为</el-button
-                        ><!--  -->
+                          @click="onEdit(index, 2)"
+                          icon="el-icon-view"
+                          v-else
+                        >
+                        </el-button>
+                        <el-tooltip
+                          class="item"
+                          effect="dark"
+                          content="删除"
+                          placement="top"
+                        >
+                        <el-button circle size="mini" @click="onRemove(index)">
+                          <svg-icon icon-class="delete"
+                        /></el-button>
+                      </el-tooltip>
                       </div>
                     </el-form-item>
                   </el-col>
@@ -113,7 +156,7 @@
                 :isEdit="it.isEdit"
               />
             </div>
-            <div class="label">
+            <!--  <div class="label">
               {{ it.name }}
               <div class="del">
                 <svg-icon
@@ -134,7 +177,7 @@
                   style="color: #fff; margin-left: 10px"
                 />
               </div>
-            </div>
+            </div> -->
           </div>
         </template>
         <template v-if="comList.length <= 0">
@@ -229,6 +272,11 @@ export default {
         checkStrictly: true,
       },
       saveAs: false,
+      draggableStyle: {
+        width: '100%',
+        
+        overflowY: 'auto'
+      }
     };
   },
   mounted() {
@@ -401,10 +449,10 @@ export default {
     padding: 0 5px;
     display: flex;
     align-items: center;
-    background-color: #f0f0f0;
+   /*  background-color: #f0f0f0; */
 
     &:hover {
-      background-color: #e0e0e0;
+     /*  background-color: #e0e0e0; */
     }
   }
 

+ 1 - 1
src/views/document/com/menus.scss

@@ -23,7 +23,7 @@
     font-size:12px;
     margin-right: 10px;
     float:left;
-    background:#e2e2e2;
+/*     background:#e2e2e2; */
     margin-left:5px;
     border-radius: 5px;
     padding-top:5px;

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

@@ -182,7 +182,7 @@ export default {
     btnEdit(e) {
       let _this = this;
       let a = document.createElement("a");
-      a.href = "#/document/create?articleId=" + e; // 使用 hash
+      a.href = "#/document/create?articleId=" + e+"&type=document"; // 使用 hash
       a.target = "_blank";
       a.click();
 

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

@@ -102,7 +102,7 @@ export default{
       //this.$router.push('/document/create');
       let _this = this;
       let a = document.createElement("a");
-      a.href = "#/document/create"; // 使用 hash
+      a.href = "#/document/create?type=document"; // 使用 hash
       a.target = "_blank";
       a.click();
     }

+ 16 - 9
src/views/document/create.scss

@@ -58,14 +58,15 @@
     border:1px solid #ebebeb;
     .neary-doc{
       position:fixed;
-      top:65px;
-      left:5px;
-      width:200px;
+      top:60px;
+      left:0px;
+      width:205px;
       // min-height: 100%;
-      min-height: 80vh;
+      height: 100vh;
       border:1px solid #ebebeb;
       padding:5px;
       border-radius: 10px;
+      border-top-left-radius: 0;
       z-index:1000!important;
       background:#FFF;
       .left-content{
@@ -121,6 +122,12 @@
       }
       .editor{
         width: 100%;
+        div{
+          span{
+            
+          }
+        }
+        
         .template-textarea{
           .rich-editor{
                padding: 0 10px;     
@@ -132,11 +139,11 @@
 
 
     .editor-option{
-      width:250px;
-      min-height: 80vh;
+      width:255px;
+      height: 100vh;
       position:fixed;
-      top:65px;
-      right:5px;
+      top:60px;
+      right:0;
       border:1px solid #f0f0f0;
       z-index: 1000 !important;
       background:#FFF;
@@ -190,7 +197,7 @@
  */
  .right-sidebarew{
   position: absolute;
-  left: 198px;
+  left: 203px;
   top: 10px;
   display: flex;
   writing-mode: vertical-rl;

+ 173 - 21
src/views/document/create.vue

@@ -2,12 +2,16 @@
   <div class="doc-container">
     <div class="editor-top">
       <div class="left">
-        <div class="doc">
+        <div class="doc" v-if="type == 'document'">
           <span>当前打开文档:</span
           >{{ docAttr.title == "" ? "新建文档" : docAttr.title }}
         </div>
+        <div class="doc" v-else>
+          <span>当前打开模版:</span
+          >{{ docAttr.title == "" ? "新建模版" : docAttr.title }}
+        </div>
         <div class="creator" v-if="userInfo != null">
-          <span>创建者:</span>{{ userInfo.username }}
+          <span>创建者:</span>{{ userInfo && userInfo.username }}
         </div>
       </div>
       <div class="right">
@@ -15,17 +19,26 @@
           type="primary"
           size="mini"
           @click="onSaveAs"
-          v-if="type !== 'module'"
+          v-if="type !== 'module' && type == 'document'"
           >保存文档</el-button
         ><!-- v-if="docAttr.id > 0" -->
         <el-button
           type="primary"
           size="mini"
-          @click="onSave"
-          v-if="docAttr.is_template == 0 && docAttr.id > 0 && type !== 'module'"
+          @click="renew"
+          v-if="
+            docAttr.is_template == 0 &&
+            docAttr.id > 0 &&
+            type !== 'module' &&
+            type == 'document'
+          "
           >更新文档</el-button
         >
-        <el-popover placement="bottom" trigger="click" v-if="type !== 'module'">
+        <el-popover
+          placement="bottom"
+          trigger="click"
+          v-if="type !== 'module' && type !== 'document'"
+        >
           <el-button @click="onSaveUpload">保存</el-button>
           <el-button @click="onUpload">更新</el-button>
           <el-button
@@ -47,7 +60,7 @@
         <el-button
           type="primary"
           size="mini"
-          v-if="type !== 'module'"
+          v-if="type !== 'module' && type == 'document'"
           @click="onOpenView"
           >预览导出
         </el-button>
@@ -59,13 +72,17 @@
     <div class="editor-content">
       <div class="neary-doc">
         <div class="left-content">
-          <div class="search">
+          <!--  <div class="search">
             <el-input placeholder="搜索文档标题"></el-input>
-          </div>
+          </div> -->
           <div class="new-article">
             <div v-if="showView == 0 && type !== 'module'">
               <el-collapse v-model="activeNames">
-                <el-collapse-item title="最新文档" name="-1">
+                <el-collapse-item
+                  title="最新文档"
+                  name="-1"
+                  v-if="type == 'document'"
+                >
                   <div
                     v-for="(it, index) in articleList"
                     draggable
@@ -80,7 +97,7 @@
                 <el-collapse-item
                   title="模版列表"
                   name="-2"
-                  v-if="showView == 0"
+                  v-if="showView == 0 && type !== 'document'"
                 >
                   <div
                     v-for="(it, index) in templateList"
@@ -100,6 +117,7 @@
                 v-model="activeModel"
                 :accordion="true"
                 @change="handleItemClick"
+                class="borderless-collapse"
               >
                 <el-collapse-item
                   v-for="(item, itemIndex) in categoryList"
@@ -112,6 +130,7 @@
                     v-model="item.activeChildren"
                     @change="handleItemVal"
                     v-show="item.children"
+                    class="borderless-collapse"
                   >
                     <el-collapse-item
                       v-for="(child, childIndex) in item.children"
@@ -125,6 +144,7 @@
                           group: { name: 'itxst', pull: 'clone' },
                           sort: true,
                         }"
+                        :disabled="type == 'module'"
                       >
                         <transition-group>
                           <div
@@ -144,6 +164,7 @@
                       group: { name: 'itxst', pull: 'clone' },
                       sort: true,
                     }"
+                    :disabled="type == 'module'"
                   >
                     <transition-group>
                       <div
@@ -167,14 +188,15 @@
             :class="showView == 0 ? 'active-item' : ''"
             @click="viewDocument"
           >
-            查看文档
+            <span v-if="type == 'document'">查看文档</span>
+            <span v-else>查看模版</span>
           </div>
           <div
             class="sidebar-item"
             :class="showView == 1 ? 'active-item' : ''"
             @click="viewModule"
           >
-            查看模块
+            模块列表
           </div>
         </div>
       </div>
@@ -213,12 +235,12 @@
       <div class="editor-option">
         <div class="editor-menu">
           <div
-            v-if="type !== 'module'"
+            v-if="type !== 'module' && type !== 'document'"
             class="item"
             @click="onSetActiveIndexs(3)"
             :class="docuComIndex == 3 ? 'active-item' : ''"
           >
-            <span class="name">文档属性</span>
+            <span class="name">模版属性</span>
           </div>
           <div
             class="item"
@@ -243,7 +265,9 @@
           </div>
         </div>
 
-        <template v-if="docuComIndex == 3 && type !== 'module'">
+        <template
+          v-if="docuComIndex == 3 && type !== 'module' && type !== 'document'"
+        >
           <docAttr :attrs="docAttr"></docAttr>
         </template>
         <template v-if="comIndex == 9998">
@@ -307,6 +331,54 @@
         @onInsertProductAttr="onInsertProductAttr"
       ></ProductAttr>
     </el-dialog>
+    <el-dialog
+      :visible.sync="docVisible"
+      append-to-body
+      v-el-drag-dialog
+      :close-on-click-modal="false"
+      width="500px"
+      custom-class="prod-verify"
+      title="文档信息"
+    >
+      <el-form
+        :model="docForm"
+        :rules="docRules"
+        ref="docRef"
+        label-position="left"
+        label-width="100"
+      >
+        <el-form-item label="文档名称:" prop="title">
+          <el-input
+            v-model="docForm.title"
+            style="width: 60%"
+            class="input-item"
+            placeholder="请填写文档名称"
+          />
+        </el-form-item>
+
+        <el-form-item label="文档分类:" prop="category_id">
+          <el-select
+            v-model="docForm.category_id"
+            style="width: 60%"
+            placeholder="请选择所属分类"
+          >
+            <el-option
+              v-for="(item, index) in articleCategoryList"
+              :key="index"
+              :label="item.name"
+              :value="item.id"
+            />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="创建人:">
+          {{ userInfo && userInfo.username }}
+        </el-form-item>
+      </el-form>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="closeDoc">取 消</el-button>
+        <el-button type="primary" @click="submitDoc">确 定</el-button>
+      </span>
+    </el-dialog>
   </div>
 </template>
 
@@ -334,6 +406,7 @@ import {
   updateDocument,
   getDocumentInfo,
   exportDocument,
+  searchDocumentCategory,
 } from "@/api/document";
 import ViewForm from "./com/view";
 import elDragDialog from "@/directive/el-drag-dialog";
@@ -401,6 +474,16 @@ export default {
       catalogIndex: 0, //目录信息
       docuComIndex: 3,
       type: "",
+      docVisible: false,
+      docForm: {
+        title: "",
+        category_id: "",
+      },
+      docRules: {
+        title: [{ required: true, message: "请输文档名称", trigger: "blur" }],
+        category_id: [{ required: true, message: "请选择文档分类", trigger: "change" }],
+      },
+      articleCategoryList: [],
     };
   },
   watch: {
@@ -436,9 +519,38 @@ export default {
       _this.loadTemplateInfo(templateId);
     }
     _this.isAdmin = _this.userInfo.roleInfo.is_admin;
+    this.initArticleCategoryList();
   },
 
   methods: {
+    /* 取消新增 */
+    closeDoc() {
+      this.docVisible = false;
+      this.docForm = {
+        title: "",
+        category_id: "",
+      };
+    },
+    /* 确定新增模块*/
+    submitDoc() {
+      this.$refs.docRef.validate((valid) => {
+        if (valid) {
+          this.docAttr.title = this.docForm.title;
+          this.docAttr.category_id = this.docForm.category_id;
+          this.onSave();
+        }
+      });
+    },
+    //加载文档分类
+    initArticleCategoryList() {
+      let _this = this;
+      searchDocumentCategory({ page: 1, pageSize: 99, status: 5 }).then(
+        (res) => {
+          if (res.status != 200) return;
+          _this.articleCategoryList = res.data.dataList;
+        }
+      );
+    },
     updateAttrs(newComs, oldComs) {
       newComs.forEach((newCom, comIndex) => {
         const oldCom = oldComs[comIndex];
@@ -763,6 +875,13 @@ export default {
       };
       getTemplateInfo(par).then((res) => {
         if (res.status != 200) return;
+        if (res.data.attrs == null || res.data.type == "") {
+          res.data.attrs = "[]";
+          res.data.content = "请填写内容";
+          res.data.lay_id = "textArea";
+          res.data.type = "TextArea";
+        }
+        console.log(res.data);
         res.data.attrs = JSON.parse(res.data.attrs);
         _this.coms = [res.data];
       });
@@ -938,10 +1057,24 @@ export default {
         this.docuComIndex = 0;
       }
     },
+    /* 更新 */
+    renew() {
+      let _this = this;
+      _this.docVisible = true;
+      this.docForm.title = _this.docAttr.title;
+      this.docForm.category_id = _this.docAttr.category_id;
+    },
+    /* 保存 */
     onSaveAs(e) {
       let _this = this;
+      if (_this.coms.length <= 0) {
+        _this.$alert("请填写内容");
+        return;
+      }
       _this.docAttr.id = "";
-      _this.onSave(e);
+      _this.docVisible = true;
+      this.docForm.title = _this.docAttr.title;
+      this.docForm.category_id = _this.docAttr.category_id;
     },
     //保存文档
     onSave(e) {
@@ -970,6 +1103,11 @@ export default {
           if (res.status != 200) return; //更新文档
           _this.docAttr.id = res.data;
           _this.$alert("文档更新成功");
+          _this.docVisible = false;
+          _this.docForm = {
+            title: "",
+            category_id: "",
+          };
           _this.searchArticle();
         });
       } else {
@@ -977,6 +1115,11 @@ export default {
           if (res.status != 200) return; //保存文档
           _this.docAttr.id = res.data;
           _this.$alert("文档保存成功");
+          _this.docVisible = false;
+          _this.docForm = {
+            title: "",
+            category_id: "",
+          };
           _this.searchArticle();
         });
       }
@@ -1317,14 +1460,12 @@ export default {
       } else {
         //仅对图表中插入有效
         if (_this.comIndex >= 0) {
-          debugger;
           _this.setTableData(data.id);
         }
       }
     },
     //插入原数据
     insertSourceData(e) {
-      debugger;
       let _this = this;
       if (_this.comIndex < 0) {
         _this.$alert("请选择插入图层");
@@ -1390,7 +1531,7 @@ export default {
       }
     },
 
-    //获取模分类信息
+    //获取模分类信息
     async initCategoryList() {
       let _this = this;
       /*  let res = await getAllCategory({list:1 });
@@ -1424,7 +1565,7 @@ export default {
         );
       }
     },
-    //获取模列表
+    //获取模列表
     async getTemplateList(categoryId) {
       let _this = this;
       let res = await searchTemplate({
@@ -1464,4 +1605,15 @@ export default {
 
 <style lang="scss">
 @import "./create.scss";
+.borderless-collapse {
+  border: none;
+
+  ::v-deep .el-collapse-item__header,
+  ::v-deep .el-collapse-item__wrap {
+    border-bottom: none;
+  }
+  ::v-deep .el-collapse-item .el-collapse-item__header{
+    border-bottom: none;
+  }
+}
 </style>

+ 62 - 45
src/views/role/components/dataInfo.vue

@@ -1,11 +1,16 @@
 <template>
   <div class="data-info">
     <el-card>
-      <el-form :model="dataForm" label-width="140px">
-        <el-form-item label="角色名称:">
+      <el-form
+        :model="dataForm"
+        :rules="dataRule"
+        ref="dataRef"
+        label-width="140px"
+      >
+        <el-form-item label="角色名称:" prop="name">
           <el-input v-model="dataForm.name"></el-input>
         </el-form-item>
-        <el-form-item label="是否为管理员:">
+        <el-form-item label="是否为管理员:" prop="is_admin">
           <el-select
             v-model="dataForm.is_admin"
             placeholder="请选择是否为管理员"
@@ -240,6 +245,14 @@ export default {
         documentCate: [],
         sourceDataTree: [],
       },
+      dataRule: {
+        name: [
+          { required: true, message: "请输入角色名称", trigger: "blur" },
+        ],
+        is_admin: [
+          { required: true, message: "请选择是否为管理员", trigger: "change" },
+        ],
+      },
     };
   },
 
@@ -521,52 +534,56 @@ export default {
     //保存更新
     btnSave(e) {
       let _this = this;
-      let items = _this.$refs.nodeTree.getCheckedNodes();
-
-      let templateCate = _this.$refs.templateCate.getCheckedNodes();
-      let docCate = _this.$refs.docCate.getCheckedNodes();
-      let sourceDataTree = _this.$refs.sourceDataTree.getCheckedNodes();
+      _this.$refs.dataRef.validate((valid) => {
+        if (valid) {
+          let items = _this.$refs.nodeTree.getCheckedNodes();
 
-      let operation_id;
-      templateCate = templateCate.map((el) => {
-        operation_id = el.id;
-        return { operation_id: el.id };
-      });
-      docCate = docCate.map((el) => {
-        el.operation_id = el.id;
-        return { operation_id: el.id };
-      });
-      sourceDataTree = sourceDataTree.map((el) => {
-        el.operation_id = el.id;
-        return { operation_id: el.id };
-      });
+          let templateCate = _this.$refs.templateCate.getCheckedNodes();
+          let docCate = _this.$refs.docCate.getCheckedNodes();
+          let sourceDataTree = _this.$refs.sourceDataTree.getCheckedNodes();
 
-      _this.dataForm.template_cate_auth = JSON.stringify(templateCate);
-      _this.dataForm.doc_cate_auth = JSON.stringify(docCate);
-      _this.dataForm.source_cate_auth = JSON.stringify(sourceDataTree);
-      let pickedItem = items.filter((o) => o.sub == true);
-      _this.dataForm.authList = JSON.stringify(pickedItem);
-      let data = { ..._this.dataForm };
-      data.attrs = JSON.stringify(data.attrs);
-      if (_this.dataForm.id > 0) {
-        updateAdminRole(data).then((res) => {
-          if (res.status != 200) return;
-          _this.$alert("更新角色信息成功");
-          _this.$router.push({
-            path: "/system/role/index",
+          let operation_id;
+          templateCate = templateCate.map((el) => {
+            operation_id = el.id;
+            return { operation_id: el.id };
           });
-          _this.$emit("onClose");
-        });
-      } else {
-        createAdminRole(data).then((res) => {
-          if (res.status != 200) return;
-          _this.$alert("创建角色信息成功");
-          _this.$router.push({
-            path: "/system/role/index",
+          docCate = docCate.map((el) => {
+            el.operation_id = el.id;
+            return { operation_id: el.id };
           });
-          _this.$emit("onClose");
-        });
-      }
+          sourceDataTree = sourceDataTree.map((el) => {
+            el.operation_id = el.id;
+            return { operation_id: el.id };
+          });
+
+          _this.dataForm.template_cate_auth = JSON.stringify(templateCate);
+          _this.dataForm.doc_cate_auth = JSON.stringify(docCate);
+          _this.dataForm.source_cate_auth = JSON.stringify(sourceDataTree);
+          let pickedItem = items.filter((o) => o.sub == true);
+          _this.dataForm.authList = JSON.stringify(pickedItem);
+          let data = { ..._this.dataForm };
+          data.attrs = JSON.stringify(data.attrs);
+          if (_this.dataForm.id > 0) {
+            updateAdminRole(data).then((res) => {
+              if (res.status != 200) return;
+              _this.$alert("更新角色信息成功");
+              _this.$router.push({
+                path: "/system/role/index",
+              });
+              _this.$emit("onClose");
+            });
+          } else {
+            createAdminRole(data).then((res) => {
+              if (res.status != 200) return;
+              _this.$alert("创建角色信息成功");
+              _this.$router.push({
+                path: "/system/role/index",
+              });
+              _this.$emit("onClose");
+            });
+          }
+        }
+      });
     },
 
     //产品详情

+ 288 - 154
src/views/template/components/dataList.vue

@@ -1,181 +1,315 @@
 <template>
   <div class="data-list">
+    <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="center" width="180"/> -->
+      <el-table-column prop="name" label="模块名称" align="left" />
+      <el-table-column prop="type_name" label="所属分类" align="left" />
+      <el-table-column prop="create_time" label="创建时间" align="center" />
+      <el-table-column prop="status" label="模板状态" align="center">
+        <template #default="scope">
+          <div v-if="scope.row.status == 5">启用</div>
+          <div v-if="scope.row.status == 6">停用</div>
+        </template>
+      </el-table-column>
+      <el-table-column label="操作" fixed="right" align="center">
+        <template #default="scope">
+          <div class="btns">
+            <el-button
+              type="primary"
+              size="small"
+              @click="btnEdit(scope.row.id)"
+              ><svg-icon icon-class="edit" />编辑模块</el-button
+            >
+            <el-button
+              type="primary"
+              size="small"
+              @click="EditorInfo(scope.row)"
+              ><svg-icon icon-class="edit" />修改信息</el-button
+            >
+            <el-button
+              type="danger"
+              size="small"
+              @click="btnDelete(scope.row.id)"
+              ><svg-icon icon-class="delete" />删除</el-button
+            ><!-- v-if="scope.row.auth.delete" -->
+          </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-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="center" width="180"/> -->
-        <el-table-column prop="name" label="模块名称" align="left" min-width="180"/>
-        <el-table-column prop="type_name" label="所属分类" align="left"  width="120"/>
-        <el-table-column prop="create_time" label="创建时间" align="center" width="160"/>
-        <el-table-column prop="status" label="模板状态" align="center" width="120">
-          <template #default="scope">
-              <div v-if="scope.row.status==5">启用</div>
-              <div v-if="scope.row.status==6">停用</div>
-          </template>
-        </el-table-column>
-        <el-table-column label="操作" fixed="right" align="center" width="180">
-          <template #default="scope">
-            <div class="btns">
-              <el-button type="primary" size="small" @click="btnEdit(scope.row.id)"><svg-icon icon-class="edit"/>编辑</el-button>
-              <el-button type="danger" size="small"   @click="btnDelete(scope.row.id)"><svg-icon icon-class="delete"/>删除</el-button><!-- v-if="scope.row.auth.delete" -->
-            </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
+      :close-on-click-modal="false"
+      width="30%"
+      custom-class="prod-verify"
+      title="修改模块信息"
+    >
+      <el-form
+        :model="moduleForm"
+        :rules="moduleRules"
+        ref="moduleRef"
+        label-position="left"
+        label-width="100px"
+      >
+        <el-form-item label="模块名称:" prop="name">
+          <el-input
+            style="width: 220px"
+            v-model="moduleForm.name"
+            placeholder="请选择模块名称"
+          ></el-input>
+        </el-form-item>
+        <el-form-item label="所属分类:" prop="category_id">
+          <el-select
+            v-model="moduleForm.category_id"
+            clearable
+            class="m-2"
+            placeholder="请选择分类"
+            size="large"
+          >
+            <el-option
+              v-for="item in categoryList"
+              :key="item.id"
+              :label="item.name"
+              :value="item.id"
+            />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="模块状态:" prop="status">
+          <el-select
+            v-model="moduleForm.status"
+            class="m-2"
+            placeholder="请选择模板块态"
+            size="large"
+          >
+            <el-option
+              v-for="item in statusOptions"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value"
+            />
+          </el-select>
+        </el-form-item>
+      </el-form>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="closeModule">取 消</el-button>
+        <el-button type="primary" @click="submitModule">确 定</el-button>
+      </span>
+    </el-dialog>
   </div>
-
-
 </template>
 
 <script>
-  import { mapGetters } from 'vuex'
+import { mapGetters } from "vuex";
 
-  import{deleteTemplate,pageTemplate} from'@/api/template';
-  import dataInfo from './dataInfo.vue';
-  import elDragDialog from '@/directive/el-drag-dialog'
-  export default{
-    components:{
-      dataInfo,
+import { deleteTemplate, pageTemplate,getAllList,updateTemplate } from "@/api/template";
+import dataInfo from "./dataInfo.vue";
+import elDragDialog from "@/directive/el-drag-dialog";
+import Editor from "@/views/document/com/editor.vue";
+export default {
+  components: {
+    dataInfo,
+  },
+  directives: { elDragDialog },
+  props: {
+    queryForm: {
+      type: Object,
+      default: () => {
+        return {
+          page: 1,
+          pageSize: 10,
+          name: "",
+          sign: "",
+        };
+      },
     },
-    directives: { elDragDialog },
-    props:{
-      queryForm:{
-        type:Object,
-        default:()=>{
-          return {
-            page:1,
-            pageSize:10,
-            name:'',
-            sign:'',
-          }
-        }
-      }
+  },
+  watch: {
+    queryForm: {
+      handler: function (val) {
+        this.search();
+      },
+      // immediate: true,//立即执行
+      deep: true,
     },
-    watch:{
-
-        'queryForm': {
-          handler: function(val) {
-
-            this.search();
-          },
-          // immediate: true,//立即执行
-          deep: true
-
+  },
+  computed: {
+    ...mapGetters(["roleInfo", "authList"]),
+  },
+  data() {
+    return {
+      dialogVisible: false, //控制产品审核
+      currentDataId: 0,
+      recordCount: 0,
+      pageTotal: 1,
+      dataList: [],
+      currentData: {},
+      dialogVisible: false,
+      moduleForm: {
+        name: "",
+        status: 5,
+        category_id: "",
+      },
+      moduleRules: {
+        name: [{ required: true, message: "请输模块名称", trigger: "blur" }],
+        status: [{ required: true, message: "请选择状态", trigger: "change" }],
+        category_id: [
+          { required: true, message: "请选择分类", trigger: "change" },
+        ],
+      },
+      statusOptions: [
+        {
+          value: "",
+          label: "请选择状态",
         },
+        {
+          value: 5,
+          label: "启用",
+        },
+        {
+          value: 6,
+          label: "停用",
+        },
+      ],
+    };
+  },
+  mounted() {
+    this.search();
+    this.initCategoryList();
+  },
+  methods: {
+     /* 取消修改 */
+     closeModule() {
+      this.dialogVisible = false;
+      this.moduleForm = {
+        name: "",
+        status: 5,
+        category_id: "",
+      };
     },
-    computed: {
-      ...mapGetters([
-        'roleInfo',
-        'authList'
-      ])
-    },
-    data(){
-      return{
-        dialogVisible:false,//控制产品审核
-        currentDataId:0,
-        recordCount:0,
-        pageTotal:1,
-        dataList:[],
-        currentData:{},
-      }
+    /* 确定修改模块*/
+    submitModule() {
+      this.$refs.moduleRef.validate((valid) => {
+        if (valid) {
+          updateTemplate(this.moduleForm).then((res) => {
+            if (res.status !== 200) return;
+            this.$message.success("修改成功!");
+            this.dialogVisible = false;
+            this.moduleForm = {
+              name: "",
+              status: 5,
+              category_id: "",
+            };
+            this.onSubmit()
+          });
+        }
+      });
     },
-    mounted() {
-      this.search();
+    /* 获取分类 */
+    async initCategoryList() {
+      let _this = this;
+      let res = await getAllList();
+      this.categoryList = res.data; //this.processDataForCascader(res.data);
     },
-    methods:{
 
-      checkAuth(path){
-        if(this.roleInfo.is_admin==1){
-          return true;
-        }
-        let auth=this.authList.filter(o=>o.type==999 && o.path==path);
-        if(auth.length>0){
-          return true;
-        }
-        return false;
-      },
+    EditorInfo(item){
+      this.dialogVisible=true
+      this.moduleForm =item
+    },
+    checkAuth(path) {
+      if (this.roleInfo.is_admin == 1) {
+        return true;
+      }
+      let auth = this.authList.filter((o) => o.type == 999 && o.path == path);
+      if (auth.length > 0) {
+        return true;
+      }
+      return false;
+    },
 
-      btnDelete(e){
-        let _this=this;
-        let par={
-          id:e,
-        }
-        _this.$confirm("您是否确认删除该记录?","提示",{
-          confirmButtonText: '确认',
-          cancelButtonText: '取消',
-          type: 'warning',
-        }).then((res)=>{
+    btnDelete(e) {
+      let _this = this;
+      let par = {
+        id: e,
+      };
+      _this
+        .$confirm("您是否确认删除该记录?", "提示", {
+          confirmButtonText: "确认",
+          cancelButtonText: "取消",
+          type: "warning",
+        })
+        .then((res) => {
           // console.log("AAA")
-             deleteTemplate(par).then(res=>{
-               _this.search();
-             })
-        }).catch(()=>{
+          deleteTemplate(par).then((res) => {
+            _this.search();
+          });
         })
-      },
-
-      searchData(){
-        let _this=this;
-        _this.dialogVisible=false;
-        _this.search();
-      },
+        .catch(() => {});
+    },
 
+    searchData() {
+      let _this = this;
+      _this.dialogVisible = false;
+      _this.search();
+    },
 
-      //编辑
-      btnEdit(e){
-        let _this=this;
-        var a = document.createElement('a');
-        a.href="#/document/create?templateId="+e+"&type=module"
-        a.target="_blank";
-        a.click();
-        //this.$router.push({path:"/document/create",query:{templateId:e}})
-      },
+    //编辑
+    btnEdit(e) {
+      let _this = this;
+      var a = document.createElement("a");
+      a.href = "#/document/create?templateId=" + e + "&type=module";
+      a.target = "_blank";
+      a.click();
+      //this.$router.push({path:"/document/create",query:{templateId:e}})
+    },
 
-      handleClose(){
-        let _this=this;
-        _this.currentDataId=0;
-        _this.dialogVisible=false;
-        _this.search();
-      },
+    handleClose() {
+      let _this = this;
+      _this.currentDataId = 0;
+      _this.dialogVisible = false;
+      _this.search();
+    },
 
-      //搜索
-      search(){
-        let _this=this;
-        pageTemplate(_this.queryForm).then(res=>{
-          if(!res)return;
-          _this.dataList=res.data.dataList;
-          _this.recordCount=res.data.totalRecord;
-          _this.pageTotal=res.data.totalPage;
-        })
-      },
-      //修改分页
-      ChangePage(e){
-      	let _this=this;
-      	_this.queryForm.page=e;
-      	_this.search();
-      },
-    }
-  }
+    //搜索
+    search() {
+      let _this = this;
+      pageTemplate(_this.queryForm).then((res) => {
+        if (!res) return;
+        _this.dataList = res.data.dataList;
+        _this.recordCount = res.data.totalRecord;
+        _this.pageTotal = res.data.totalPage;
+      });
+    },
+    //修改分页
+    ChangePage(e) {
+      let _this = this;
+      _this.queryForm.page = e;
+      _this.search();
+    },
+  },
+};
 </script>
 
 <style lang="scss">
-@import './dataList.scss';
+@import "./dataList.scss";
 </style>

+ 112 - 10
src/views/template/components/dataSearch.vue

@@ -48,13 +48,73 @@
         >
       </el-form-item>
     </el-form>
+    <el-dialog
+      :visible.sync="dialogVisible"
+      append-to-body
+      v-el-drag-dialog
+      :close-on-click-modal="false"
+      width="30%"
+      custom-class="prod-verify"
+      title="创建模块"
+    >
+      <el-form
+        :model="moduleForm"
+        :rules="moduleRules"
+        ref="moduleRef"
+        label-position="left"
+        label-width="100px"
+      >
+        <el-form-item label="模块名称:" prop="name">
+          <el-input
+            style="width: 220px"
+            v-model="moduleForm.name"
+            placeholder="请选择模块名称"
+          ></el-input>
+        </el-form-item>
+        <el-form-item label="所属分类:" prop="category_id">
+          <el-select
+            v-model="moduleForm.category_id"
+            clearable
+            class="m-2"
+            placeholder="请选择分类"
+            size="large"
+          >
+            <el-option
+              v-for="item in categoryList"
+              :key="item.id"
+              :label="item.name"
+              :value="item.id"
+            />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="模块状态:" prop="status">
+          <el-select
+            v-model="moduleForm.status"
+            class="m-2"
+            placeholder="请选择模板块态"
+            size="large"
+          >
+            <el-option
+              v-for="item in statusOptions"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value"
+            />
+          </el-select>
+        </el-form-item>
+      </el-form>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="closeModule">取 消</el-button>
+        <el-button type="primary" @click="submitModule">确 定</el-button>
+      </span>
+    </el-dialog>
   </div>
 </template>
 
 <script>
 import dataInfo from "./dataInfo.vue";
 import elDragDialog from "@/directive/el-drag-dialog";
-import { searchTemplateCategory } from "@/api/template";
+import { searchTemplateCategory, createTemplate,getAllList } from "@/api/template";
 export default {
   components: {
     dataInfo,
@@ -92,13 +152,58 @@ export default {
       ],
       categoryList: [],
       dialogVisible: false,
+      moduleForm: {
+        name: "",
+        status: 5,
+        category_id: "",
+      },
+      moduleRules: {
+        name: [{ required: true, message: "请输模块名称", trigger: "blur" }],
+        status: [{ required: true, message: "请选择状态", trigger: "change" }],
+        category_id: [
+          { required: true, message: "请选择分类", trigger: "change" },
+        ],
+      },
     };
   },
   mounted() {
-    this.initCategory();
+    this.initCategoryList();
   },
   methods: {
-    initCategory() {
+    /* 取消新增 */
+    closeModule() {
+      this.dialogVisible = false;
+      this.moduleForm = {
+        name: "",
+        status: 5,
+        category_id: "",
+      };
+    },
+    /* 确定新增模块*/
+    submitModule() {
+      this.$refs.moduleRef.validate((valid) => {
+        if (valid) {
+          createTemplate(this.moduleForm).then((res) => {
+            if (res.status !== 200) return;
+            this.$message.success("创建成功!");
+            this.dialogVisible = false;
+            this.moduleForm = {
+              name: "",
+              status: 5,
+              category_id: "",
+            };
+            this.onSubmit()
+          });
+        }
+      });
+    },
+    /* 获取分类 */
+    async initCategoryList() {
+      let _this = this;
+      let res = await getAllList();
+      this.categoryList = res.data; //this.processDataForCascader(res.data);
+    },
+ /*    initCategory() {
       let _this = this;
       searchTemplateCategory({ page: 1, pageSize: 999, status: 5 }).then(
         (res) => {
@@ -106,17 +211,14 @@ export default {
           _this.categoryList = res.data.dataList;
         }
       );
-    },
+    }, */
     onCreate(e) {
-      /* this.dialogVisible=true; */
-      /*  const url = this.$router.resolve({ path: 'new' }).href;
-      window.open(url, '_blank'); */
-      let _this = this;
+      this.dialogVisible = true;
+      /* let _this = this;
       var a = document.createElement("a");
       a.href = "#/document/create?type=module";
       a.target = "_blank";
-      a.click();
-      /* this.$router.push('/document/create'); */
+      a.click(); */
     },
 
     //搜索

+ 1 - 1
vue.config.js

@@ -27,7 +27,7 @@ module.exports = {
   publicPath: '/',
   outputDir: 'dist',
   assetsDir: 'static',
-  lintOnSave: process.env.NODE_ENV === 'development',
+  lintOnSave: false,//process.env.NODE_ENV === 'development',
   productionSourceMap: false,
   devServer: {
     port: port,

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