Prechádzať zdrojové kódy

节点名称改为150

natasha 1 rok pred
rodič
commit
031757e1ba
1 zmenil súbory, kde vykonal 53 pridanie a 44 odobranie
  1. 53 44
      src/components/Adult/inputModules/Catelog.vue

+ 53 - 44
src/components/Adult/inputModules/Catelog.vue

@@ -29,7 +29,7 @@
           paddingLeft:
             node.is_courseware === 'false'
               ? node.nodexIndex * 22 + 8 + 'px'
-              : '0px',
+              : '0px'
         }"
         class="tree_box"
       >
@@ -60,7 +60,7 @@
             'tree_box_' + node.nodexIndex,
             activeIndex !== '' && JSON.stringify(node).indexOf(activeIndex) > -1
               ? 'tree_box_item_light'
-              : '',
+              : ''
           ]"
           @click="tree.toggleFold(node, path)"
         >
@@ -74,7 +74,7 @@
           :class="[
             'tree_box_item',
             'tree_box_leaf',
-            activeIndex == node.id ? 'tree_box_item_active' : '',
+            activeIndex == node.id ? 'tree_box_item_active' : ''
           ]"
           :style="{ paddingLeft: node.nodexIndex * 22 + 12 + 'px' }"
           @click="handleNodeClick(node, path)"
@@ -107,11 +107,20 @@
         </div>
       </div>
     </Tree>
-    <el-dialog :visible.sync="dialogFlag" :title="dialogTitle" :close-on-click-modal="false" width="40%">
+    <el-dialog
+      :visible.sync="dialogFlag"
+      :title="dialogTitle"
+      :close-on-click-modal="false"
+      width="40%"
+    >
       <div>
         <el-form ref="form" :model="formDialog" label-width="80px">
           <el-form-item label="节点名称">
-            <el-input v-model="formDialog.name" maxlength="100" show-word-limit />
+            <el-input
+              v-model="formDialog.name"
+              maxlength="150"
+              show-word-limit
+            />
           </el-form-item>
           <el-form-item label="节点类型">
             <el-radio-group
@@ -139,7 +148,7 @@ import { Tree, Fold, Draggable } from "he-tree-vue";
 
 export default {
   components: {
-    Tree: Tree.mixPlugins([Fold, Draggable]),
+    Tree: Tree.mixPlugins([Fold, Draggable])
   },
   props: [
     "changeId",
@@ -147,7 +156,7 @@ export default {
     "bookLevel",
     "bookNodeIndex",
     "changeTreeData",
-    "currentTreeID",
+    "currentTreeID"
   ],
   data() {
     return {
@@ -158,7 +167,7 @@ export default {
         name: "",
         radio: "1",
         is_courseware: "false",
-        children: [],
+        children: []
       },
       curNode: null,
       curIndex: "",
@@ -178,7 +187,7 @@ export default {
       dialogTitle: "添加节点",
       dialogDisabled: false, // 是否禁用单选按钮
       loading: false, // 加载中
-      pidList: [],
+      pidList: []
     };
   },
   mounted() {
@@ -202,11 +211,11 @@ export default {
     async currentTreeID(newval, oldval) {
       if (newval) {
         this.activeIndex = newval;
-        this.pidList = []
+        this.pidList = [];
         await this.unfoldData(this.activeIndex, this.treeData);
         await this.unfoldFather(this.treeData);
       }
-    },
+    }
   },
   methods: {
     // 递归找到当前节点的所有父节点
@@ -225,7 +234,7 @@ export default {
     // 展示父节点
     unfoldFather(data) {
       data.forEach((item, i) => {
-        this.pidList.forEach((p) => {
+        this.pidList.forEach(p => {
           if (item.id == p) {
             item.$folded = false;
           } else if (item.children) {
@@ -258,7 +267,7 @@ export default {
         const data = {
           id: this.oldId,
           dest_position: this.destPosition,
-          dest_id: this.destId,
+          dest_id: this.destId
         };
         // if (this.is_coursewareFlag == "false") {
         //   MethodName = "book-chapter_manager-MoveChapter";
@@ -269,7 +278,7 @@ export default {
         // }
         this.loading = true;
         getContent(MethodName, data)
-          .then((res) => {
+          .then(res => {
             this.loading = false;
             this.$message.success("移动成功");
             this.getList();
@@ -298,7 +307,7 @@ export default {
             this.changeTreeData(this.oldLists);
             this.$message({
               type: "warning",
-              message: "不能跨级移动!",
+              message: "不能跨级移动!"
             });
             return false;
           } else {
@@ -317,7 +326,7 @@ export default {
                 this.isDragFlag = false;
                 this.$message({
                   type: "warning",
-                  message: "不能跨级移动!",
+                  message: "不能跨级移动!"
                 });
                 return false;
               }
@@ -335,7 +344,7 @@ export default {
                 this.isDragFlag = false;
                 this.$message({
                   type: "warning",
-                  message: "不能跨级移动!",
+                  message: "不能跨级移动!"
                 });
                 return false;
               }
@@ -372,7 +381,7 @@ export default {
           let data = {
             name: this.formDialog.name,
             book_id: this.bookId,
-            parent_id: this.parent_id,
+            parent_id: this.parent_id
           };
           let MethodName = "book-chapter_manager-AddChapterToBook";
           if (this.formDialog.radio === "2") {
@@ -380,19 +389,19 @@ export default {
             data = {
               name: this.formDialog.name,
               book_id: this.bookId,
-              chapter_id: this.parent_id ? this.parent_id : "",
+              chapter_id: this.parent_id ? this.parent_id : ""
             };
           }
           if (this.isAddFlag) {
             this.isAddFlag = false;
             this.loading = true;
             getContent(MethodName, data)
-              .then((res) => {
+              .then(res => {
                 this.loading = false;
                 this.isAddFlag = true;
                 this.$message({
                   message: "添加成功",
-                  type: "success",
+                  type: "success"
                 });
                 this.getList();
                 // let node = JSON.parse(JSON.stringify(this.formDialog));
@@ -402,7 +411,7 @@ export default {
                 this.formDialog.radio = "1";
                 this.parent_id = "";
               })
-              .catch((error) => {
+              .catch(error => {
                 this.loading = false;
                 this.isAddFlag = true;
               });
@@ -417,20 +426,20 @@ export default {
           }
           const datas = {
             id: this.oldId,
-            name: this.formDialog.name,
+            name: this.formDialog.name
           };
           if (this.isAddFlag) {
             this.isAddFlag = false;
             this.loading = true;
             getContent(MethodName, datas)
-              .then((res) => {
+              .then(res => {
                 this.loading = false;
                 this.isAddFlag = true;
                 this.type = "修改";
                 this.getList();
                 this.$message({
                   type: "success",
-                  message: "修改成功!",
+                  message: "修改成功!"
                 });
                 // let node = JSON.parse(JSON.stringify(this.formDialog));
                 // this.curNode.children.push(node);
@@ -448,7 +457,7 @@ export default {
       } else {
         this.$message({
           message: "节点名称不能为空",
-          type: "warning",
+          type: "warning"
         });
       }
     },
@@ -463,14 +472,14 @@ export default {
       const _this = this;
       const MethodName = "book-book_manager-GetBookChapterStruct";
       const data = {
-        book_id: this.bookId,
+        book_id: this.bookId
       };
       this.loading = true;
       getContent(MethodName, data)
-        .then((res) => {
+        .then(res => {
           this.loading = false;
           this.handleData(res, 0);
-          let nodesData = res.nodes ? res.nodes : []
+          let nodesData = res.nodes ? res.nodes : [];
           this.treeData = JSON.parse(JSON.stringify(nodesData));
           this.oldLists = JSON.parse(JSON.stringify(nodesData));
           this.changeTreeData(nodesData);
@@ -490,14 +499,14 @@ export default {
             }
           });
         })
-        .catch((e) => {
+        .catch(e => {
           this.loading = false;
         });
     },
     // 递归
     handleData(data, nodeIndex) {
       if (data.nodes) {
-        data.nodes.forEach((item) => {
+        data.nodes.forEach(item => {
           item.label = item.name;
           item.pid = data.id;
           item.fatherName = `${data.name}  /  ${item.name}`;
@@ -539,7 +548,7 @@ export default {
       this.$confirm("确定要删除此节点吗?", "提示", {
         confirmButtonText: "确定",
         cancelButtonText: "取消",
-        type: "warning",
+        type: "warning"
       })
         .then(() => {
           let MethodName = "book-chapter_manager-DeleteChapter";
@@ -553,17 +562,17 @@ export default {
           };
           this.loading = true;
           getContent(MethodName, datas)
-            .then((res) => {
+            .then(res => {
               this.loading = false;
               this.type = "删除";
               this.getList();
               this.$message({
                 type: "success",
-                message: "删除成功!",
+                message: "删除成功!"
               });
-              if(this.currentTreeID==data.id){
-                  this.activeIndex = "";
-                  this.emptyQustion();
+              if (this.currentTreeID == data.id) {
+                this.activeIndex = "";
+                this.emptyQustion();
               }
             })
             .catch(() => {
@@ -598,17 +607,17 @@ export default {
       let datas = {
         id: data.id,
         is_courseware: data.is_courseware,
-        is_free_trial: JSON.stringify(data.is_free_trial_bool),
+        is_free_trial: JSON.stringify(data.is_free_trial_bool)
       };
       this.loading = true;
       getContent(MethodName, datas)
-        .then((res) => {
+        .then(res => {
           this.loading = false;
           this.type = "免费试看";
           this.getList();
           this.$message({
             type: "success",
-            message: "设置成功!",
+            message: "设置成功!"
           });
         })
         .catch(() => {
@@ -630,8 +639,8 @@ export default {
     },
     BookenterKeyup() {
       document.addEventListener("keyup", this.BookenterKey);
-    },
-  },
+    }
+  }
 };
 </script>
 <style lang="scss" scoped>
@@ -706,13 +715,13 @@ export default {
     }
   }
   .tree_box_item_light,
-  .tree_box_leaf:hover  {
+  .tree_box_leaf:hover {
     color: #ff9900;
     > i {
       color: #ff9900;
     }
   }
-  .tree_box_item_active{
+  .tree_box_item_active {
     color: #fff !important;
     background: #ff9900 !important;
     > i {