Browse Source

患者端医生端存值

liucf 5 years ago
parent
commit
655abe42cf

+ 10 - 5
src/common/CheckBox.vue

@@ -4,7 +4,7 @@
     <p v-for="(it,index) in datas.questionDetailList" :key="it.id" class="list" @click="handleClick(it,index)">
       <img :src="it.select==1?check:defaultPic">
       <!-- <span :class="{'check':it.select==1}">{{it.name}}</span> -->
-      <span v-if="(it.name.indexOf('${'))==-1" :class="[{'check':it.select==1},{'exclu':exclusion !==999 && it.exclusion !== exclusion}]">{{it.name}}</span>
+      <span v-if="(it.name.indexOf('${'))==-1" :class="[{'check':it.select==1},{'exclu':exclusion !==999 && it.exclusion !== exclusion}]">{{it.description||it.name}}</span>
       <!-- <MultiLineInput v-else 
           @handleInp="inpVal($event,index)"
           :msg="it.name" 
@@ -77,21 +77,25 @@ import OptionInp from '../common/OptionInp.vue';
             this.exclusion = filArr1[0].exclusion;
           }
         }
-        let value = "";
+        let value = ""; //医生
+        let valueP = ""; //患者
         for(let k in data){
           if(data[k].select==1){
             // 选中该项时,带的输入框内有值则加上
             if(data[k].value){
               let newVal = '#{' + data[k].value + '}';
               let str = data[k].name.replace(patt,newVal);
-              value += str + ','
+              let strP = (data[k].description || data[k].name).replace(patt,newVal);
+              value += str + ',';
+              valueP += strP + ',';
             }else{
-              value += data[k].name + ','
+              value += data[k].name + ',';
+              valueP += (data[k].description || data[k].name) + ',';
             }
             
           }
         }
-        const newData = Object.assign({},this.datas,{questionDetailList:data},{value:value?value.substring(0,value.length-1):''});
+        const newData = Object.assign({},this.datas,{questionDetailList:data},{value:value?value.substring(0,value.length-1):''},{valueP:valueP?valueP.substring(0,valueP.length-1):''});
         this.$emit("updata",newData);
       },
       inpVal(val,index){//输入框失焦处理
@@ -108,6 +112,7 @@ import OptionInp from '../common/OptionInp.vue';
             str = valueStr.replace(rePatt,newVal);
           }
           this.datas.value = str;
+          this.datas.valueP = str;
         }
         
         // 输入框回读

+ 1 - 1
src/common/ComTextArea.vue

@@ -36,7 +36,7 @@ export default {
       this.$emit('changeAreaVal',this.txt)
     },
     blur(){
-      const newData = Object.assign({},this.item,{value:this.txt});
+      const newData = Object.assign({},this.item,{value:this.txt,valueP:this.txt});
       this.$emit("updata",newData);
     }
   },

+ 1 - 1
src/common/Input.vue

@@ -27,7 +27,7 @@
       },
       blur(){
         this.borColor = false;
-        const newData = Object.assign({},this.item,{value:this.val});
+        const newData = Object.assign({},this.item,{value:this.val,valueP:this.val});
         this.$emit("updata",newData);
       }
     },

+ 1 - 1
src/common/Label.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="label-wrap" v-if="item">
     <p v-for="(it,index) in datas.questionMapping" :key="it.id" :class="['symp',{'check':it.select==1},{'exclu':exclusion !==999 && it.exclusionType !== exclusion}]" @click="handleClick(it,index)">
-      <span>{{it.name}}</span>
+      <span>{{it.description||it.name}}</span>
       <!-- <span v-if="it.select==1" @click="deletSymp($event,it,index)"><img src="../images/delete.png" alt=""></span> -->
       <span v-if="it.select==1" @click="deletSymp($event,it,index)"><img src="../images/del.png" alt=""></span>
     </p>

+ 1 - 1
src/common/MultiLineInput.vue

@@ -80,7 +80,7 @@ export default {
       // 如果该项未选中,则不存值
       const select = this.part.select;
       // if(!select){return}
-      const newData = Object.assign({},this.part,{value:this.txt,controlType:3});
+      const newData = Object.assign({},this.part,{value:this.txt,controlType:3,valueP:this.txt});
       this.$emit("updata",newData);
       this.$emit('handleInp',this.txt);
     },

+ 2 - 1
src/common/OptionInp.vue

@@ -28,7 +28,8 @@ import { getExpStr,scrollToV} from '@utils/tools';
     },
     props:['item','exclu'],
     mounted(){
-      this.msg = getExpStr(this.item.name);
+      const text = this.item.description || this.item.name;
+      this.msg = getExpStr(text);
       this.select = this.item.select;
     },
     methods:{

+ 9 - 3
src/common/Radio.vue

@@ -4,7 +4,7 @@
     <p v-for="(it,index) in datas.questionDetailList" :key="it.id" class="list" @click="handleClick(it,index)">
       <img :src="it.select==1?check:defaultPic">
       <!-- <span :class="{'check':it.select==1}">{{it.name}}</span> -->
-      <span v-if="(it.name.indexOf('${'))==-1" :class="{'check':it.select==1}">{{it.name}}</span>
+      <span v-if="(it.name.indexOf('${'))==-1" :class="{'check':it.select==1}">{{it.description||it.name}}</span>
       <!-- <MultiLineInput v-else 
           @handleInp="inpVal($event,index)"
           :msg="it.name" 
@@ -44,6 +44,7 @@ import OptionInp from '../common/OptionInp.vue';
         const list = this.datas;
         let data = list.questionDetailList&&list.questionDetailList.slice(0); //数组深拷贝?
         let value = "";
+        let valueP = "";
         for(let i=0;i<data.length; i++){
           data[i].select = 0
           if(i==index){
@@ -52,14 +53,18 @@ import OptionInp from '../common/OptionInp.vue';
             // 选中该项时,带的输入框内有值则加上
             if(data[i].value){
               let newVal = '#{' + data[i].value + '}';
-              let str = data[i].name.replace(patt,newVal);
+              let str = data[i].name.replace(patt,newVal);//医生
+              let strP = (data[i].description ||data[i].name).replace(patt,newVal);//患者
               value = str ;
+              valueP = strP ;
             }else{
               value = data[i].name ;
+              valueP = data[i].name ;
             }
           }
         }
-        const newData = Object.assign({},this.datas,{questionDetailList:data},{value:value})
+        // const newData = Object.assign({},this.datas,{questionDetailList:data},{value:value})
+        const newData = Object.assign({},this.datas,{questionDetailList:data,value:value,valueP:valueP})
         this.$emit("updata",newData);
       },
       inpVal(val,index){//输入框失焦处理
@@ -81,6 +86,7 @@ import OptionInp from '../common/OptionInp.vue';
             str = valueStr.replace(rePatt,newVal);
           }
           this.datas.value = str;
+          this.datas.valueP = str;//输入框内容无医生患者之分
         }
         
         // 输入框回读

+ 2 - 2
src/components/AddContent.vue

@@ -3,7 +3,7 @@
     <div class="choose">
       <ul class="addPart">
         <li v-for="(item,idx) in dataTrd">
-          <p class="question">{{idx+1 + '. ' +item.name}}</p>
+          <p class="question">{{idx+1 + '. ' +(item.description||item.name)}}</p>
           <Radio v-if="item.controlType==1" 
             :item="item"
             :key="item.id"
@@ -28,7 +28,7 @@
           >
             <MultiLineInput
               v-if="item.controlType == 3"
-              :msg="part.name"
+              :msg="part.description||part.name"
               :part="part"
               @updata="updataData($event,index,item)"
             ></MultiLineInput>

+ 15 - 6
src/components/Detail.vue

@@ -2,7 +2,7 @@
   <div class="detail-wrap">
     <!-- <div v-for="(item,index) in datas"> -->
     <div v-for="(item,index) in checkDatas.questionMapping">
-      <p class="quest">{{index + 1 +'.' + item.name}}</p>
+      <p class="quest">{{index + 1 +'.' + (item.description || item.name)}}</p>
       <Radio v-if="item.controlType==1" 
             :item="item"
             :key="item.id"
@@ -73,44 +73,53 @@ import {patt} from '@utils/tools.js'
         this.finished = true;
         this.checkDatas = Object.assign({},this.checkDatas,{select:1});
         const datas = this.checkDatas.questionMapping;
-        let text = "";
+        let text = ""; //医生
+        let textP = "";//患者
         for(let i in datas){
           if(datas[i].value){
             text += datas[i].value+',';
+            textP += datas[i].valueP+',';
           }
         }
-        // let msg = this.checkDatas.name+ ',' + text.substring(0,text.length-1);
+
         let msg = this.checkDatas.name+ ',' + text;
+        let msgP = (this.checkDatas.description || this.checkDatas.name)+ ',' + textP;
         let newMsg = "";
+        let newMsgP = "";
         if(msg[msg.length-1] == ','){
           newMsg = msg.substring(0,msg.length-1);
+          newMsgP = msgP.substring(0,msgP.length-1);
         }else{
-          newMsg = msg
+          newMsg = msg;
+          newMsgP = msgP;
         }
         this.$store.commit('setDatas',{data:this.checkDatas,pId:this.checkDatas.id,type:this.type,ppId:this.ppId});
         // flag是区分点开已选症状 未点完成
         // this.$store.commit('setText',{text:newMsg.replace(patt,''),pId:this.checkDatas.id,type:this.type,flag:true});
         // 输入框的值用占位符#{}标识,便于修改
-        this.$store.commit('setText',{text:newMsg.replace(patt,'').replace(/\#\{/g,'').replace(/\}/g,''),pId:this.checkDatas.id,type:this.type,flag:true});
+        this.$store.commit('setText',{text:newMsg.replace(patt,'').replace(/\#\{/g,'').replace(/\}/g,''),textP:newMsgP.replace(patt,'').replace(/\#\{/g,'').replace(/\}/g,''),pId:this.checkDatas.id,type:this.type,flag:true});
       },
       clearData(){//清空
         const datas = this.checkDatas.questionMapping;
         for(let i in datas){
           datas[i].value = "";
+          datas[i].valueP = "";
           let detaiList = datas[i].questionDetailList;
           if(detaiList.length>0){
             for(let k in detaiList){
               detaiList[k].select = 0;
               if(detaiList[k].value){
                 detaiList[k].value = "";
+                detaiList[k].valueP = "";
               }
             }
           }
         }
         this.checkDatas = Object.assign({},this.checkDatas,{questionMapping:datas});
         let msg = this.checkDatas.name;
+        let msgP = (this.checkDatas.description||this.checkDatas.name);
         this.$store.commit('setDatas',{data:this.checkDatas,pId:this.checkDatas.id,type:this.type,ppId:this.ppId});
-        this.$store.commit('setText',{text:msg,pId:this.checkDatas.id,type:this.type,flag:true});
+        this.$store.commit('setText',{text:msg,textP:msgP,pId:this.checkDatas.id,type:this.type,flag:true});
       },
       check(){// 校验是否有已填项
         const datas = this.checkDatas.questionMapping;

+ 11 - 4
src/components/DetailBox.vue

@@ -15,7 +15,8 @@
               :ppId="ppId"
               @check="changeCheck($event)"/>
     </div>
-    <div class="foot" @click="complete">完成</div>
+    <!-- <div class="foot" @click="complete">完成</div> -->
+    <div :class="['foot',{'noCheck':!checkF}]" @click="complete">完成</div>
     <Toast :message="clearTxt" 
           :show="showToast"
           @comfirn="comfirnDel" 
@@ -62,9 +63,11 @@
       close(){
         this.$emit("close");
       },
-      complete(){
-        this.$refs.detail.saveData();
-        this.$emit("pComplete");
+      complete(){//有选中内容才可以点完成#1919
+        if(this.checkF){
+          this.$refs.detail.saveData();
+          this.$emit("pComplete");
+        }
       },
       changeCheck(flag){
         this.checkF = flag;
@@ -81,6 +84,7 @@
       comfirnDel(){
         this.$refs.detail.clearData();
         this.showToast = false;
+        this.checkF = false;
         // 让detail组件更新
         // this.privateData = JSON.parse(JSON.stringify(this.data));
         this.$emit('reload',this.data.id);
@@ -162,6 +166,9 @@
     .check{
       color: #1A1A1A;
     }
+    .noCheck{
+      background: #CACCFF !important;
+    }
   }
   @keyframes wave {
     0%   {top:100% ;}

+ 6 - 4
src/components/DiagTreat.vue

@@ -4,7 +4,7 @@
         v-if="dtoList"
         :key="it.id"
         class="label">
-      <p class="quest">{{i + 1 +'.' + it.name}}</p>
+      <p class="quest">{{i + 1 +'.' + (it.description||it.name)}}</p>
         <Label v-if="it.controlType==0" 
               :item="it" 
               :indx="i" 
@@ -115,8 +115,10 @@
         let textArr = this.checkText;
         let msg = "";
         for(let k in textArr){
-          msg += textArr[k].text + ';'
-        }
+          if(textArr[k].textP){
+            msg += textArr[k].textP + ';'
+          }
+        }          
         return msg;
       },
       updataData(data,id){//输入框存值
@@ -127,7 +129,7 @@
           }
         }
         this.$store.commit('setDatas',{type:moduleCP['diagT'],data:data,pId:data.id,ppId:id});
-        this.$store.commit('setText',{type:moduleCP['diagT'],text:data.value,pId:data.id,flag:true}); 
+        this.$store.commit('setText',{type:moduleCP['diagT'],text:data.value,textP:data.valueP,pId:data.id,flag:true}); 
       }
     },
     components:{

+ 4 - 4
src/components/Others.vue

@@ -4,7 +4,7 @@
         v-if="dtoList"
         :key="it.id"
         class="label">
-        <p class="quest">{{i + 1 +'.' + it.name}}</p>
+        <p class="quest">{{i + 1 +'.' + (it.description||it.name)}}</p>
         <!-- <Label v-if="it.controlType==0" -->
         <Label v-if="it.controlType==0"
               :item="it"
@@ -128,14 +128,14 @@
         
         // this.$store.commit('setOrigin',{type:'3',data:data,pId:data.id});
         this.$store.commit('setDatas',{type:moduleCP['other'],data:data,pId:data.id,ppId:id});
-        this.$store.commit('setText',{type:moduleCP['other'],text:data.value,pId:data.id,flag:true}); 
+        this.$store.commit('setText',{type:moduleCP['other'],text:data.value,textP:data.valueP,pId:data.id,flag:true}); 
       },
       getText(){
         let textArr = this.checkText;
         let msg = "";
         for(let k in textArr){
-          if(textArr[k].text){
-            msg += textArr[k].text + ';'
+          if(textArr[k].textP){
+            msg += textArr[k].textP + ';'
           }          
         }
         return msg;

+ 1 - 1
src/components/Symptom.vue

@@ -35,7 +35,7 @@
       v-if="checkText.length>0"
     >
       <p class="title">{{nameStr}}</p>
-      <p v-for="(value,index) in checkText">{{value.text}}</p>
+      <p v-for="(value,index) in checkText">{{value.textP}}</p>
     </div>
     <div v-if="modluesLen>1"
       :class="['footer',{'nofoot':chooseSymp.length==0}]"