瀏覽代碼

bug1826修改

zhouna 6 年之前
父節點
當前提交
d75243a44b
共有 2 個文件被更改,包括 12 次插入23 次删除
  1. 0 4
      src/components/preTreat/AddSimpleQuestion.vue
  2. 12 19
      src/components/preTreat/PubSelect.vue

+ 0 - 4
src/components/preTreat/AddSimpleQuestion.vue

@@ -60,10 +60,6 @@
         this.editData = data;
       }
     },
-    beforeDestroy(){
-      console.log(33333)
-      this.options = [];
-    },
     methods: {
       back() { this.$router.go(-1) },
       changeVal(val) {   //子组件数据改变传递到父组件

+ 12 - 19
src/components/preTreat/PubSelect.vue

@@ -156,15 +156,11 @@
         const arr = options.filter((it)=>{
           return it.name;
         });
-        /*const arrLen = arr.length;
-        if(arrLen < 4) {
-          for (let i = 0; i < 4 - arrLen; i++) {
-            arr.push(Object.assign({},initRow,{orderNo:arr.length}));
-          }
-        }*/
         this.rows = arr;
         const items = utils.simpleOptionData(this.rows);
         this.$emit('pushValues',items);
+      }else{
+        this.initData();
       }
     },
     computed:{
@@ -178,23 +174,20 @@
       },
     },
     watch: {
-      ascription(newVal, preVal) {
-        if (newVal != preVal) {
-            this.rows = [...utils.getInitRow(initRow,4)];
-        }
-      },
-      type(newVal, preVal) {
-        if (newVal != preVal) {
-            this.rows = [...utils.getInitRow(initRow,4)];
-        }
+      /*ascription(newVal, preVal) {        //永远检测不到,因为归属修改时类型被清空,本组件被销毁
+        this.rows = [...utils.getInitRow(initRow,4)];
+      },*/
+      type() {
+        this.initData();
       },
-      sexType(newVal, preVal) {
-        if (newVal != preVal) {
-            this.rows = [...utils.getInitRow(initRow,4)];
-        }
+      sexType() {
+        this.initData();
       },
     },
     methods:{
+      initData(){
+        this.rows = [...utils.getInitRow(initRow,4)];
+      },
       addRow(){
         this.rows.push(Object.assign({},initRow,{orderNo:this.rows.length}));
       },