Browse Source

Merge branch 'beta' of https://git.cocorobo.cn/CocoRoboLabs/pbl-teacher-table into beta

lsc 1 year ago
parent
commit
c5f4ca5863
1 changed files with 60 additions and 21 deletions
  1. 60 21
      src/components/pages/evaluation.vue

+ 60 - 21
src/components/pages/evaluation.vue

@@ -135,7 +135,7 @@
             <el-button @click="updateEJson" type="primary" v-else
               >保存</el-button
             >
-            <el-button @click="dialogVisible = fasle" type="primary"
+            <el-button @click="clearAll()" type="primary"
               >不保存</el-button
             >
           </div>
@@ -199,18 +199,21 @@
                 />
               </div>
               <div class="e_add_input">
-                <el-input v-model="evaObject.fName" />
+                <el-input v-model="evaObject.fName" @focus="setDetail(1)"/>
                 <img
                   src="../../assets/icon/new/addInput.png"
                    @click="addInputName(1)"
                   alt
                 />
-                <!-- <el-button @click="addInputName(1)" type="primary"
-                  >确 定</el-button
-                > -->
               </div>
             </div>
-            <div class="e_add_list_detail" v-if="fid">
+            <div class="e_add_list_detail" v-if="isFold">
+              <textarea
+                placeholder="添加目标描述"
+                v-model="isFoldDetail"
+              ></textarea>
+            </div>
+            <div class="e_add_list_detail" v-if="fid && !isFold">
               <textarea
                 placeholder="添加目标描述"
                 v-model="eJson[fid].detail"
@@ -280,18 +283,21 @@
                 />
               </div>
               <div class="e_add_input" v-if="fid != ''">
-                <el-input v-model="evaObject.sName" />
+                <el-input v-model="evaObject.sName" @focus="setDetail(2)"/>
                 <img
                   src="../../assets/icon/new/addInput.png"
                    @click="addInputName(2)"
                   alt
                 />
-                <!-- <el-button @click="addInputName(2)" type="primary"
-                  >确 定</el-button
-                > -->
               </div>
             </div>
-            <div class="e_add_list_detail" v-if="sid">
+            <div class="e_add_list_detail" v-if="isSold">
+              <textarea
+                placeholder="添加目标描述"
+                v-model="isSoldDetail"
+              ></textarea>
+            </div>
+            <div class="e_add_list_detail" v-if="sid && !isSold">
               <textarea
                 placeholder="添加目标描述"
                 v-model="eJson[fid].child[sid].detail"
@@ -363,18 +369,21 @@
                 />
               </div>
               <div class="e_add_input" v-if="sid != ''">
-                <el-input v-model="evaObject.tName" />
+                <el-input v-model="evaObject.tName" @focus="setDetail(3)"/>
                 <img
                   src="../../assets/icon/new/addInput.png"
                    @click="addInputName(3)"
                   alt
                 />
-                <!-- <el-button @click="addInputName(3)" type="primary"
-                  >确 定</el-button
-                > -->
               </div>
             </div>
-            <div class="e_add_list_detail" v-if="tid">
+            <div class="e_add_list_detail" v-if="isTold">
+              <textarea
+                placeholder="添加目标描述"
+                v-model="isToldDetail"
+              ></textarea>
+            </div>
+            <div class="e_add_list_detail" v-if="tid && !isTold">
               <textarea
                 placeholder="添加目标描述"
                 v-model="eJson[fid].child[sid].child[tid].detail"
@@ -547,6 +556,12 @@ export default {
         tName1: "",
         isTInput: "",
       },
+      isFold:false,
+      isFoldDetail:"",
+      isSold:false,
+      isSoldDetail:"",
+      isTold:false,
+      isToldDetail:"",
     };
   },
   methods: {
@@ -605,6 +620,24 @@ export default {
       this.type = type;
       this.dialogVisible3 = true;
     },
+    setDetail(t){
+      if(t == 1){
+        this.isFold = true;
+      }else if(t == 2){
+        this.isSold = true;
+      }else if(t == 3){
+        this.isTold = true;
+      }
+    },
+    clearAll(){
+      this.dialogVisible = false;
+      this.isFold = false;
+      this.isSold = false;
+      this.isTold = false;
+      this.isFoldDetail = "";
+      this.isSoldDetail = "";
+      this.isToldDetail = "";
+    },
     addInputName(t) {
       let _id = this.guid();
       if (t == 1) {
@@ -615,10 +648,12 @@ export default {
         this.eJson[_id] = {
           id: _id,
           name: this.evaObject.fName,
-          detail: "",
+          detail: this.isFoldDetail ? this.isFoldDetail : "",
           child: {},
         };
         this.evaObject.fName = "";
+        this.isFold = false;
+        this.isFoldDetail = "";
         this.checkF(_id);
       } else if (t == 2) {
         if (this.evaObject.sName == "") {
@@ -628,19 +663,23 @@ export default {
         this.eJson[this.fid].child[_id] = {
           id: _id,
           name: this.evaObject.sName,
-          detail: "",
+          detail: this.isSoldDetail ? this.isSoldDetail : "",
           child: {},
         };
         this.evaObject.sName = "";
+        this.isSold = false;
+        this.isSoldDetail = "";
         this.checkS(_id);
       } else if (t == 3) {
         this.eJson[this.fid].child[this.sid].child[_id] = {
           id: _id,
           name: this.evaObject.tName,
-          detail: "",
+          detail: this.isToldDetail ? this.isToldDetail : "",
           child: [],
         };
         this.evaObject.tName = "";
+        this.isTold = false;
+        this.isToldDetail = "";
         this.checkT(_id);
       }
       this.eJSONNum++;
@@ -832,7 +871,7 @@ export default {
         .then((res) => {
           this.$message.success("保存成功");
           this.init();
-          this.dialogVisible = false;
+          this.clearAll();
           this.getData();
         })
         .catch((err) => {
@@ -857,7 +896,7 @@ export default {
         .then((res) => {
           this.$message.success("修改成功");
           this.init();
-          this.dialogVisible = false;
+          this.clearAll();
           this.getData();
         })
         .catch((err) => {