瀏覽代碼

文件夹编辑调整

zhangjie 2 年之前
父節點
當前提交
da029bccef
共有 1 個文件被更改,包括 7 次插入1 次删除
  1. 7 1
      src/modules/question/components/QuestionFolder.vue

+ 7 - 1
src/modules/question/components/QuestionFolder.vue

@@ -76,7 +76,6 @@
               ></el-button>
               ></el-button>
               <!-- 新增的时候可以删除临时文件 -->
               <!-- 新增的时候可以删除临时文件 -->
               <el-button
               <el-button
-                v-if="!modalForm.id"
                 type="danger"
                 type="danger"
                 icon="el-icon-close"
                 icon="el-icon-close"
                 :disabled="loading"
                 :disabled="loading"
@@ -115,6 +114,7 @@ const initModalForm = {
   parentId: null,
   parentId: null,
   name: "",
   name: "",
   remark: "",
   remark: "",
+  level: 0,
 };
 };
 
 
 export default {
 export default {
@@ -249,6 +249,7 @@ export default {
       const newChild = {
       const newChild = {
         ...initModalForm,
         ...initModalForm,
         parentId: this.curNodeData.id,
         parentId: this.curNodeData.id,
+        level: this.curNodeData.level + 1,
       };
       };
       if (!this.curNodeData.children) {
       if (!this.curNodeData.children) {
         this.$set(this.curNodeData, "children", []);
         this.$set(this.curNodeData, "children", []);
@@ -289,6 +290,11 @@ export default {
       }
       }
     },
     },
     toRemoveFolder(node, data) {
     toRemoveFolder(node, data) {
+      if (this.curEditClassifyId) {
+        this.curEditClassifyId = null;
+        this.modalForm = {};
+        return;
+      }
       const parent = node.parent;
       const parent = node.parent;
       const children = parent.data.children || parent.data;
       const children = parent.data.children || parent.data;
       const index = children.findIndex((d) => d.id === data.id);
       const index = children.findIndex((d) => d.id === data.id);