소스 검색

配置对应

zhouna 5 년 전
부모
커밋
21d44a3ffe
3개의 변경된 파일56개의 추가작업 그리고 38개의 파일을 삭제
  1. 45 36
      src/components/MainPage.vue
  2. 2 2
      src/components/Preview.vue
  3. 9 0
      src/store.js

+ 45 - 36
src/components/MainPage.vue

@@ -2,9 +2,7 @@
   <div class="page">
     <div class="progress-bar">
       <div class="title">
-        <span :class="{'active':activeTab===0}">症状情况</span>
-        <span :class="{'active':activeTab===1}">诊疗情况</span>
-        <span :class="{'active':activeTab===2}">其他情况</span>
+        <span :class="{'active':activeTab==i.type}" :style="{width:(100/allMoudles.length)+'%'}" v-for="i in allMoudles">{{i.name}}</span>
       </div>
       <div class="progress">
         <p :style="{width:progress}"></p>
@@ -38,14 +36,14 @@
           </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" @cancel="cancelSelected" :num="num" :cancelNum="canceledQa" :isLast="idx===allquestionLis.length-1"/>
+        <div v-for="(item,idx) in symptomQasList" :key="'0'+item.id" v-if="activeTab">
+          <Dialog :idx="idx" v-if="item.show" :item="item" @cancel="cancelSelected" :num="num" :cancelNum="canceledQa" :isLast="idx===symptomQasList.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" :extNum ="allquestionLis.length" :cancelNum="canceledQa" :isLast="idx===diagQasList.length-1"/>
+        <div v-for="(item,idx) in diagnoseQasList" :key="'1'+item.id" v-if="activeTab==moduleKeys[1]||activeTab==moduleKeys[2]">
+          <Dialog :idx="idx" v-if="item.show" :item="item" @cancel="cancelSelected" :num="num" :extNum ="symptomQasList.length" :cancelNum="canceledQa" :isLast="idx===diagnoseQasList.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" :extNum ="allquestionLis.length+diagQasList.length" :cancelNum="canceledQa"/>
+        <div v-for="(item,idx) in othersQasList" :key="'2'+item.id" v-if="activeTab==moduleKeys[2]">
+          <Dialog :idx="idx" v-if="item.show" :item="item" @cancel="cancelSelected" :num="num" :extNum ="symptomQasList.length+diagnoseQasList.length" :cancelNum="canceledQa"/>
         </div>
       </div>
     </div>
@@ -101,7 +99,7 @@ import MultSelect from '../common/MultSelect.vue';
 import TipWarning from '../common/TipWarning.vue';
 import api from "../utils/api.js";
 import {mapState} from 'vuex';
-import {moduleCP} from '@utils/tools'
+import {moduleCP,moduleConfig} from '@utils/tools'
 
 export default {
   name:'MainPage',
@@ -109,8 +107,9 @@ export default {
     return {
       num:-1,//题目计数
       pickDVal:'1天',    //时间控件默认值
+      allMoudles:[],
       showUsual:false,    //常用症状显示
-      activeTab:0,      //当前模块
+      activeTab:1,      //当前模块
       scroll:null,
       canceledSym:false,    //是否已修改过主症状
       canceledQa:-1,
@@ -120,19 +119,13 @@ export default {
       symptomResult:'',//症状选择
       connectResult:[],//关联问题的id
       contentResult:{},//选中的结果val医生端显示,valp患者端显示
-      allquestionLis:[],//症状详情所有的问题
-      diagQasList:[], //诊疗详情所有问题
-      otherQasList:[],//其他情况所有问题
-      moduleKeys:[1,51,3,52],
-      listMap:{
-        0:'allquestionLis',
-        1:'diagQasList',
-        2:'otherQasList'
-      },
+      symptomQasList:[],//症状详情所有的问题
+      diagnoseQasList:[], //诊疗详情所有问题
+      othersQasList:[],//其他情况所有问题
       moduleMap:{
-        0:'symptom',
-        1:'diagnose',
-        2:'others'
+        1:'symptom',
+        51:'diagnose',
+        3:'others'
       },
       defaultIndex: 0, //温度默认值
       order:0,
@@ -148,6 +141,8 @@ export default {
     //const userInfo= JSON.parse(localStorage.getItem("userInfo"))
     const userInfo = this.$store.state.pathInfo;
     this.userInfo = userInfo;
+    let tmpModule = moduleConfig(this.config,this.tmpAllMoudles);
+    this.allMoudles = tmpModule.data;
     this.updata()
   },
   mounted(){
@@ -164,12 +159,19 @@ export default {
   computed:{
     ...mapState({
       imgs: state => state.diagnose.imgSrc,
+      tmpAllMoudles: state => state.allMoudles,
+      config: state => state.sysConfig,
     }),
+    moduleKeys(){
+      return this.allMoudles.map((it)=>{
+        return it.type;
+      });
+    },
     progress(){
       if(this.num===-1){
         return '0.1px';
       }
-      const moduleName = this.listMap[this.activeTab];
+      const moduleName = this.moduleMap[this.activeTab]+'QasList';
       const precent = (this.num+1)/this[moduleName].length;
       return precent*100+"%";
     }
@@ -181,7 +183,7 @@ export default {
       })
     },
     updata(){
-      this.allquestionLis = [];
+      this.symptomQasList = [];
       this.pdbm = '8.5rem';
       this.showUsual=true;
       this.num = 0;
@@ -217,13 +219,13 @@ export default {
     },
     cancelSelected(){     //修改题目
       let moduleName='',tmpArr=[],tmpPreItem={},tmpNowItem={};
-      moduleName = this.listMap[this.activeTab];
+      moduleName = this.moduleMap[this.activeTab]+'QasList';
       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];
+      if(this.activeTab!==this.moduleKeys[0]&&this.num===0){     //取消上一阶段的最后一题时
+        moduleName = this.moduleMap[this.activeTab-1]+'QasList';
         const n = this[moduleName].length-1;
         tmpPreItem = this[moduleName][n];
         this.activeTab=this.activeTab-1;
@@ -243,7 +245,8 @@ export default {
     updataResultSingle(result,contentResult,num){
       this.num = num;
       this.type = -1;
-      let moduleName = this.listMap[this.activeTab];
+      const mkeys =this.moduleKeys;
+      let moduleName = this.moduleMap[this.activeTab]+'QasList';
       let tmpArr = JSON.parse(JSON.stringify(this[moduleName]));
       tmpArr[num-1].content = contentResult.valp;
       //选没有可上传报告,则上传控件不显示
@@ -255,18 +258,25 @@ export default {
       this[moduleName] = tmpArr;
       //上传的图片及是否有可上传***答案不显示在预览所以不记录到state.diagnose.text中
       if(this.symptomResult.id!==999999&&this.symptomResult.controlType!=4){
-        this.$store.commit('setText', { type: this.moduleKeys[this.activeTab], text: contentResult.val,textP: contentResult.valp,idx:contentResult.idx,flag:contentResult.flag });
+        this.$store.commit('setText', { type: this.activeTab,
+          text: contentResult.val,
+          textP: contentResult.valp,
+          idx:contentResult.idx,
+          flag:contentResult.flag,
+          isEdit:this.num-1==this.canceledQa
+        });
       }
       console.log(this.$store.state);   //最后一题答完
       if(+num===this[moduleName].length||(noUpload&&+num===this[moduleName].length+1)){
-        if(this.activeTab>1){         //模块配置待修改
+        if(this.activeTab===mkeys[mkeys.length-1]){   //最后一个模块时显示预览按钮
           this.showPreview=true;
           return;
         }
         const state = this.$store.state;
-        this.activeTab++;   //进入下一个阶段问题
+        const tabIndx =  this.moduleKeys.findIndex((i)=>i==this.activeTab);
+        this.activeTab=this.moduleKeys[+tabIndx+1];   //进入下一个阶段问题
         this.num = 0;
-        moduleName = this.listMap[this.activeTab];
+        moduleName = this.moduleMap[this.activeTab]+'QasList';
         const mDataName = this.moduleMap[this.activeTab];
         this[moduleName] = JSON.parse(JSON.stringify(state[mDataName].datas));
         let tmpArrDetail1 = JSON.parse(JSON.stringify(this[moduleName][0]));
@@ -312,7 +322,7 @@ export default {
       },4500);*/
     },
     cancelSymptom(){      //修改(即删除)已选主症
-      this.allquestionLis = [];
+      this.symptomQasList = [];
       this.selectedSymptom=[];
       this.showUsual=true;
       this.type=-1;
@@ -350,7 +360,7 @@ export default {
           this.type = qaLis[0].controlType;
           this.symptomResult = qaLis[0];
           this.$store.commit('setSymptomDatas',qaLis);
-          this.allquestionLis = this.$store.state.symptom.origin;
+          this.symptomQasList = this.$store.state.symptom.origin;
         }else{
 
         }
@@ -401,7 +411,6 @@ export default {
   span{
     display: inline-block;
     font-size: .26rem;
-    width: 30%;
     color: #aaa;
     text-align: center;
     &:not(:last-child):after{

+ 2 - 2
src/components/Preview.vue

@@ -36,12 +36,12 @@
               <h4><i></i> 现病史:</h4>
               <p>
                   <!-- 患者于时间单位前诱因出现症状,其余题目的内容; -->
-                <span>{{mainText+","}}</span>
+                <span>{{mainTextP+","}}</span>
                 <template v-for="(value,index) in checkText">
                   <!-- 患者于时间单位前诱因出现症状,其余题目的内容; -->
                   <span :key="index" v-if="index>2&&index<checkText.length-1">{{value.textP+","}}</span>
                 </template>
-                <span>{{banTextp}}</span>
+                <span>{{banTextP}}</span>
               </p>
               <p><span>{{getDetailText(diagnose.text,false).view}}</span></p>
             </li>

+ 9 - 0
src/store.js

@@ -277,14 +277,23 @@ const store = new Vuex.Store({
           // 对象易更新但顺序无法控制
           // state.symptom.text = Object.assign({},state.symptom.text,{[param.pId]:param.text});
           let text = state.symptom.text;
+          if(param.isEdit){   //修改后提交的答案,先删除原存的答案
+            text.pop();
+          }
           text.push(param);
           break;
         case moduleCP['diagT']: //诊疗情况
           let dtext = state.diagnose.text;
+          if(param.isEdit){
+            dtext.pop();
+          }
           dtext.push(param);
           break;
         case moduleCP['other']: //其他情况
           let otherText = state.others.text;
+          if(param.isEdit){
+            otherText.pop();
+          }
           otherText.push(param);
           /*let oitem = otherText[param.order];
           if(oitem){