Browse Source

伴随症状‘没有了’互斥

zhouna 5 years ago
parent
commit
2e750b581e
4 changed files with 48 additions and 16 deletions
  1. 7 4
      src/common/Dialog.vue
  2. 21 1
      src/common/PushSymptom.vue
  3. 17 8
      src/components/MainPage.vue
  4. 3 3
      src/components/Preview.vue

+ 7 - 4
src/common/Dialog.vue

@@ -3,7 +3,7 @@
     <div class="left clearfix" v-if="item.show">
       <img src="../images/doctor.png" class="fl" />
       <div class="content fl">
-        <p>{{num}}.{{item.name}}{{item.type==2?'(可多选)':''}}</p>
+        <p>{{item.name}}{{item.type==2?'(可多选)':''}}</p>
       </div>
     </div>
     <div class="right clearfix" v-if="item.content">
@@ -22,14 +22,17 @@
 </template>
 <script>
 export default {
-  props:['item','idx','cancelNum','num'],
+  props:['item','idx','cancelNum','num','extNum','isLast'],
   data() {
     return {};
   },
   computed:{
     showEdit(){
-      const {cancelNum,idx,num}=this;
-      if(cancelNum<idx&&idx===num-1){
+      const {cancelNum,idx,num,extNum}=this;console.log('cancelNum:',cancelNum,'idx:',idx,'num',num,'extNum',extNum);
+      const  realCNum = ((extNum+1)||1)+cancelNum;
+      const realNum = ((extNum+1)||1)+num;
+      const realIdx = ((extNum+1)||1)+idx;
+      if((realCNum<realIdx&&realIdx===realNum-1)||(num===0&&this.isLast)){
         return true;
       }
       return false;

+ 21 - 1
src/common/PushSymptom.vue

@@ -84,10 +84,18 @@
               id: 0,
               type: 1,
               description: "",
+              exclusionType:1,
               hasExplain: 0,
               explains: null,
             };
-            this.symptoms = [none,...syms];
+            //没有了与其他互斥
+            const hasNone = symptoms.indexOf("没有了")!==-1;
+            if(hasNone){
+              this.symptoms = [...syms];
+            }else{
+              this.symptoms = [none,...syms];
+            }
+
             //this.getSymptomLisCom(result)
           }else{
             //this.getSymptomLisCom()
@@ -125,6 +133,18 @@
       selectResult(item) {
         if(this.selecteds.length>2){
 
+        }
+        const hasNone = this.selecteds.findIndex((it)=>{
+          return it.name==='没有了';
+        })!==-1;
+        if(hasNone){
+          this.selecteds.splice(0,1);
+          this.selectedsName = this.selectedsName.replace("没有了",'');
+          this.selectedsNamep = this.selectedsNamep.replace("没有了",'');
+        }else if(item.name==='没有了'){
+          this.selecteds=[];
+          this.selectedsName = '';
+          this.selectedsNamep ='';
         }
         const name = item.name;
         const namep=item.description||item.name;

+ 17 - 8
src/components/MainPage.vue

@@ -39,13 +39,13 @@
           <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" @cancel="cancelSelected" :num="num" :bgtATab="activeTab" :cancelNum="canceledQa"/>
+          <Dialog :idx="idx" v-if="item.show" :item="item" @cancel="cancelSelected" :num="num" :cancelNum="canceledQa" :isLast="idx===allquestionLis.length-1"/>
         </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" @cancel="cancelSelected" :num="num" :bgtATab="activeTab" :cancelNum="canceledQa"/>
+          <Dialog :idx="idx" v-if="item.show" :item="item" @cancel="cancelSelected" :num="num" :extNum ="allquestionLis.length" :cancelNum="canceledQa" :isLast="idx===diagQasList.length-1"/>
         </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" @cancel="cancelSelected" :num="num" :bgtATab="activeTab" :cancelNum="canceledQa"/>
+          <Dialog :idx="idx" v-if="item.show" :item="item" @cancel="cancelSelected" :num="num" :extNum ="allquestionLis.length+diagQasList.length" :cancelNum="canceledQa"/>
         </div>
       </div>
     </div>
@@ -216,14 +216,23 @@ export default {
       ]
     },
     cancelSelected(){     //修改题目
-      let moduleName = this.listMap[this.activeTab];
-      let tmpArr = this[moduleName];
-      const tmpPreItem = tmpArr[this.num-1];
-      const tmpNowItem = tmpArr[this.num];
+      let moduleName='',tmpArr=[],tmpPreItem={},tmpNowItem={};
+      moduleName = this.listMap[this.activeTab];
+      tmpArr = this[moduleName];
+      tmpNowItem = tmpArr[this.num];
       this.type = -1;
       tmpNowItem.show = false;
+      if(this.activeTab!==0&&this.num===0){     //取消上一阶段的最后一题时
+        moduleName = this.listMap[this.activeTab-1];
+        const n = this[moduleName].length-1;
+        tmpPreItem = this[moduleName][n];
+        this.activeTab=this.activeTab-1;
+        this.num=n;
+      }else{
+        tmpPreItem = tmpArr[this.num-1];
+        this.num=this.num-1;
+      }
       tmpPreItem.content='';
-      this.num=this.num-1;
       this.symptomResult = tmpPreItem;
       const timer = setTimeout(()=>{
         this.type = tmpPreItem.controlType;

+ 3 - 3
src/components/Preview.vue

@@ -41,7 +41,7 @@
                   <!-- 患者于时间单位前诱因出现症状,其余题目的内容; -->
                   <span :key="index" v-if="index>2&&index<checkText.length-1">{{value.textP+","}}</span>
                 </template>
-                <span>{{banText}}</span>
+                <span>{{banTextp}}</span>
               </p>
               <p><span>{{getDetailText(diagnose.text,false).view}}</span></p>
             </li>
@@ -272,7 +272,7 @@ export default {
       const timeText = times?"于"+times+"前"+reason+"出现":reason+"出现";
       const timeTextp = times?"于"+timesp+"前"+reasonp+"出现":reasonp+"出现";
       this.mainText = call+timeText+symChoose[0].name;
-      this.mainTextP = call+timeTextp+symChoose[0].name;
+      this.mainTextP = call+timeTextp+(symChoose[0].description||symChoose[0].name);
       this.banText = bans.text==="没有了"?"":"伴"+bans.text;
       this.banTextP = bans.text==="没有了"?"":"伴"+bans.textP;
     },
@@ -287,7 +287,7 @@ export default {
           let tmpArr = [this.mainText];
           let tmpStr = this.banText;
           let symText = tmpSymptom.text;
-          for(let j = 1;j < symText.length-1;j++){console.log(symText[j].text,typeof(symText[j].text)!=='object')
+          for(let j = 1;j < symText.length-1;j++){
             if(+symText[j].flag!==1&&+symText[j].flag!==2&&typeof(symText[j].text)!=='object'){   //诱因和时间已拼不重复添加,上传的图片不拼单独显示
               tmpArr.push(symText[j].text);
             }