2 Incheckningar 0a2fb8f05b ... 151b1bd104

Upphovsman SHA1 Meddelande Datum
  reloaded 151b1bd104 Merge branch 'master' of http://git.cc-lotus.info/live-platform/live-cms 4 år sedan
  reloaded 57532c41c1 1 4 år sedan
1 ändrade filer med 7 tillägg och 5 borttagningar
  1. 7 5
      src/views/question/part/wenjuan.vue

+ 7 - 5
src/views/question/part/wenjuan.vue

@@ -129,7 +129,6 @@ export default {
   }),
   created() {
     this.search();
-    this.searchQuestion();
   },
   computed: {},
   methods: {
@@ -157,10 +156,12 @@ export default {
     async detailBtn(item) {
       this.dialogFormVisible = true;
       this.form = item;
+      this.searchQuestion();
       this.$nextTick(function() {
         item.question.forEach(row => {
+          let r = this.questions.find(f => f._id == row._id);
           //this.multipleSelection.push(row);
-          this.$refs.multipleTable.toggleRowSelection(row);
+          this.$refs.multipleTable.toggleRowSelection(r);
         });
       });
       console.log(this.multipleSelection);
@@ -177,7 +178,9 @@ export default {
     //提交问卷
     async submitFrom() {
       this.form.question = this.multipleSelection;
-      let res = await this.create(this.form);
+      let res;
+      if (this.form.id) res = await this.update(this.form);
+      else res = await this.create(this.form);
       if (res.errcode == '0') {
         this.dialogFormVisible = false;
         this.search();
@@ -189,6 +192,7 @@ export default {
       this.qstatus = null;
       this.qtype = null;
       this.form = {};
+      this.searchQuestion();
       this.multipleSelection = [];
     },
     //选中问题时触发
@@ -200,8 +204,6 @@ export default {
       this.searchQuestion({ skip: (val - 1) * 10, limit: val * 10 });
     },
     getRowKey(row) {
-      console.log(row);
-
       return row._id;
     },
   },