Browse Source

Merge branch 'bugfix' into test

zhangxc 5 years ago
parent
commit
719393a2b6

+ 5 - 1
src/components/preTreat/AddSimpleQuestion.vue

@@ -1,5 +1,5 @@
 <template>
-    <div class="NoiseTemplateWrapper TemplateWrapper">
+    <div class="NoiseTemplateWrapper TemplateWrapper" @click="hideQas">
         <crumbs
                 :title="txt"
                 class="topBack"
@@ -20,6 +20,7 @@
             </p>
             <PubSelect
                     v-if="dataPub.region2==1 || dataPub.region2==2 || dataPub.region2==3 || dataPub.region2==11|| dataPub.region2==8|| dataPub.region2==10"
+                    ref="PubSelect"
                     :ascription="dataPub.region1"
                     :sexType="dataPub.region7"
                     :type="dataPub.region2"
@@ -78,6 +79,9 @@
       changeVal(val) {   //子组件数据改变传递到父组件
         this.dataPub = val;
       },
+      hideQas(){
+        this.$refs.PubSelect.hideQas();
+      },
       pushValues(its){
         this.options = its;
       },

+ 15 - 8
src/components/preTreat/PubSelect.vue

@@ -1,5 +1,5 @@
 <template>
-  <div class="single-container">
+  <div class="single-container" @click="hideQas">
     <el-form>
       <div class="operation-row">
         <el-checkbox-group size="small">
@@ -51,7 +51,7 @@
             ></el-input>
           </div>
           <el-tag v-if="it.exclusion" type="info" size="mini">互斥项</el-tag>
-          <span :class="tagActive===i?'tag-active el-tag--mini el-tag el-tag--info':'el-tag--mini el-tag el-tag--info'" v-if="it.exclusionCon" @click="getConnectedQas(it.subQuestion,i)">已关联</span>
+          <span :class="tagActive===i?'tag-active el-tag--mini el-tag el-tag--info':'el-tag--mini el-tag el-tag--info'" v-if="it.exclusionCon" @click="getConnectedQas($event,it.subQuestion,i)">已关联</span>
         </el-col>
         <el-button @click="addRow">+</el-button>
         <div class="bottomPartMid bottomPartMidss">
@@ -62,7 +62,7 @@
             <span class="el-icon-arrow-down" @click="orderUpDown(1)"></span>
           </p>
         </div>
-        <div class="connected-qas" v-if="showQas.length>0">
+        <div class="connected-qas" @click.stop v-if="showQas.length>0">
           <p style="margin-bottom: 10px;">关联的问题:</p>
           <p v-for="(qa,i) in showQas">{{i+1}}. {{qa.name}}</p>
         </div>
@@ -202,7 +202,7 @@
     margin: 20px 150px 20px 30%;
     .bottomPartMid {
       top: 0;
-      right: 40%;
+      right: 5%;
     }
   }
   .inps {
@@ -259,6 +259,7 @@ export default {
   data() {
     return {
       rows: [...initRows],
+      selectIndex: -1,
       checkedExc: false,
       checkedCon: false,
       focusOn: -1, //聚焦的行index
@@ -305,8 +306,10 @@ export default {
       this.searchTagList();
     },
     focusOn(newVal) {
+      this.selectIndex = newVal
       this.checkedExc = this.rows[newVal].exclusion === 1;
       this.checkedCon = this.rows[newVal].exclusionCon === 1;
+      this.searchTagList()
     },
     /*type() {
         this.initData();
@@ -316,10 +319,10 @@ export default {
     }
   },
   methods: {
-    getConnectedQas(ids,n){
+    getConnectedQas(e,ids,n){
+      e.stopPropagation();
       if(this.tagActive===n){
-        this.tagActive=-1;
-        this.showQas=[];
+       this.hideQas()
         return;
       }
       this.tagActive=n;
@@ -351,6 +354,10 @@ export default {
         }
       });
     },
+    hideQas(){
+      this.tagActive=-1;
+      this.showQas =[]
+    },
     selectLeftTag(tag) {
       const hasTag = this.isHasTag(tag, this.selectLeftTagsList);
       if (hasTag) {
@@ -376,7 +383,7 @@ export default {
     searchTagList() {
       let ids = []
       this.rows.map((it, x) => {
-        if (it.subQuestion) {
+        if (it.subQuestion&&this.selectIndex===x) {
           ids=ids.concat(it.subQuestion.split(','))
         }
       });