zhouna 5 năm trước cách đây
mục cha
commit
8af32f5b90
2 tập tin đã thay đổi với 65 bổ sung10 xóa
  1. 24 5
      src/common/Dialog.vue
  2. 41 5
      src/components/MainPage.vue

+ 24 - 5
src/common/Dialog.vue

@@ -1,9 +1,9 @@
 <template>
   <div>
-    <div class="left clearfix" v-if="item.show" @click="selectToggle(item.type,item.questionDetailList,item.order)">
+    <div class="left clearfix" v-if="item.show">
       <img src="../images/doctor.png" class="fl" />
       <div class="content fl">
-        <p>{{item.name}}{{item.type==2?'(可多选)':''}}</p>
+        <p>{{num}}.{{item.name}}{{item.type==2?'(可多选)':''}}</p>
       </div>
     </div>
     <div class="right clearfix" v-if="item.content">
@@ -16,18 +16,28 @@
           <img v-for="img in item.content" :src="img" alt=""/>
         </p>
       </div>
+      <span class="edit" v-if="showEdit" @click="cancelPre(item.type,item.questionDetailList)">修改</span>
     </div>
   </div>
 </template>
 <script>
 export default {
-  props:['item','idx'],
+  props:['item','idx','cancelNum','num'],
   data() {
     return {};
   },
+  computed:{
+    showEdit(){
+      const {cancelNum,idx,num}=this;
+      if(cancelNum<idx&&idx===num-1){
+        return true;
+      }
+      return false;
+    }
+  },
   methods:{
-    selectToggle(type,result,order){
-      this.$emit("selectToggle",type,result,false,this.idx,order)
+    cancelPre(type,result){
+      this.$emit("cancel",type,result,false,this.idx);
     }
   }
 };
@@ -67,6 +77,15 @@ export default {
       height: 1.5rem;
     }
   }
+  .edit{
+    color: #colors[theme];
+    font-style: normal;
+    font-size: .26rem;
+    float: right;
+    display: inline-block;
+    margin-top: .56rem;
+    margin-right: .24rem;
+  }
   .content {
     max-width: 5rem;
     background-color: #colors[theme];

+ 41 - 5
src/components/MainPage.vue

@@ -36,15 +36,16 @@
           <div class="content fr">
             <p>{{selectedSymptom.description||selectedSymptom.name}}</p>
           </div>
+          <span v-if="!canceledSym&&num<1" class="edit" @click="cancelSymptom">修改</span>
         </div>
         <div v-for="(item,idx) in allquestionLis" :key="'0'+item.id" v-if="activeTab>-1">
-          <Dialog :idx="idx" v-if="item.show" :item="item" @selectToggle="selectToggle"/>
+          <Dialog :idx="idx" v-if="item.show" :item="item" @cancel="cancelSelected" :num="num" :cancelNum="canceledQa"/>
         </div>
         <div v-for="(item,idx) in diagQasList" :key="'1'+item.id" v-if="activeTab>0">
-          <Dialog :idx="idx" v-if="item.show" :item="item" @selectToggle="selectToggle"/>
+          <Dialog :idx="idx" v-if="item.show" :item="item" @cancel="cancelSelected" :num="num" :cancelNum="canceledQa"/>
         </div>
         <div v-for="(item,idx) in otherQasList" :key="'2'+item.id" v-if="activeTab>1">
-          <Dialog :idx="idx" v-if="item.show" :item="item" @selectToggle="selectToggle"/>
+          <Dialog :idx="idx" v-if="item.show" :item="item" @cancel="cancelSelected" :num="num" :cancelNum="canceledQa"/>
         </div>
       </div>
     </div>
@@ -111,6 +112,8 @@ export default {
       showUsual:false,    //常用症状显示
       activeTab:0,      //当前模块
       scroll:null,
+      canceledSym:false,    //是否已修改过主症状
+      canceledQa:-1,
       type :-1,       //当前显示的控件类型
       showPreview:false,//显示预览按钮
       selectedSymptom:{},
@@ -167,7 +170,7 @@ export default {
         return '0.1px';
       }
       const moduleName = this.listMap[this.activeTab];
-      const precent = this.num/(this[moduleName].length+1);
+      const precent = this.num/this[moduleName].length;
       return precent*100+"%";
     }
   },
@@ -179,7 +182,7 @@ export default {
     },
     updata(){
       this.allquestionLis = [];
-      this.pdbm = '8.5rem'
+      this.pdbm = '8.5rem';
       this.showUsual=true;
       this.num = 0;
     },
@@ -212,6 +215,22 @@ export default {
         },
       ]
     },
+    cancelSelected(){     //修改题目
+      let moduleName = this.listMap[this.activeTab];
+      let tmpArr = this[moduleName];
+      const tmpPreItem = tmpArr[this.num-1];
+      const tmpNowItem = tmpArr[this.num];
+      this.type = -1;
+      tmpNowItem.show = false;
+      tmpPreItem.content='';
+      this.num=this.num-1;
+      this.symptomResult = tmpPreItem;
+      const timer = setTimeout(()=>{
+        this.type = tmpPreItem.controlType;
+        clearTimeout(timer);
+      });
+      this.canceledQa=this.num;     //记录被修改过的题目,只可修改一次
+    },
     updataResultSingle(result,contentResult,num){
       this.num = num;
       this.type = -1;
@@ -274,6 +293,14 @@ export default {
     closeTip(){
       this.wrong=false;
     },
+    cancelSymptom(){      //修改(即删除)已选主症
+      this.allquestionLis = [];
+      this.selectedSymptom=[];
+      this.showUsual=true;
+      this.type=-1;
+      this.$store.commit('setChoose', { choose: [], type: moduleCP['symp'] });
+      this.canceledSym = true;
+    },
     selectUsual(sym){
       this.getSymptomQas(sym.questionId);     //获取症状下的关联问题
       sym.idx=1;    //标记主诉
@@ -420,6 +447,15 @@ export default {
     margin-right: .24rem;
   }
 }
+  .edit{
+    color: #colors[theme];
+    font-style: normal;
+    font-size: .26rem;
+    float: right;
+    display: inline-block;
+    margin-top: .56rem;
+    margin-right: .24rem;
+  }
   .submit{
     position: fixed;
     bottom: 0;