Prechádzať zdrojové kódy

Merge branch 'test' into byll

luolei 5 rokov pred
rodič
commit
1b3a6b12ed

+ 4 - 0
build/webpack.dev.conf.js

@@ -34,7 +34,11 @@ const devWebpackConfig = merge(baseWebpackConfig, {
     compress: true,
     // host: HOST || config.dev.host,
     // host: '192.168.3.6',
+<<<<<<< HEAD
     host: '192.168.1.103',
+=======
+    host: '192.168.1.106',
+>>>>>>> test
     port: PORT || config.dev.port,
     open: config.dev.autoOpenBrowser,
     overlay: config.dev.errorOverlay

+ 8 - 37
src/common/CheckBox.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="check-wrap" v-if="item">
-    <img :src="datas.url.replace('{imageUrlPrefix}',imgUrl)" v-if="datas.url">
+    <!-- <img :src="datas.url.replace('{imageUrlPrefix}',imgUrl)" v-if="datas.url"> -->
     <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> -->
@@ -23,7 +23,7 @@
   </div>
 </template>
 <script type="text/javascript">
-import {imageUrlPrefix,patt} from '@utils/tools.js';
+import {imageUrlPrefix,patt,concatVal} from '@utils/tools.js';
 import icon from '../images/check-default.png';
 import checkIcon from '../images/check.png';
 import MultiLineInput from '../common/MultiLineInput.vue';
@@ -77,48 +77,19 @@ import OptionInp from '../common/OptionInp.vue';
             this.exclusion = filArr1[0].exclusion;
           }
         }
-        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);
-              let strP = (data[k].description || data[k].name).replace(patt,newVal);
-              value += str + ',';
-              valueP += strP + ',';
-            }else{
-              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):''},{valueP:valueP?valueP.substring(0,valueP.length-1):''});
+        let temp = concatVal(data);
+        const newData = Object.assign({},this.datas,{questionDetailList:data},{value:temp.value?temp.value.substring(0,temp.value.length-1):''},{valueP:temp.valueP?temp.valueP.substring(0,temp.valueP.length-1):''});
         this.$emit("updata",newData);
       },
       inpVal(val,index){//输入框失焦处理
-        let valueStr = this.datas.value;
-        if(valueStr){
-          // let patt = /\$\{[^\]]+\}/g;
-          let rePatt = /\#\{[^\]]+\}/g;
-          let newVal = '#{' +val+'}';
-          let str = "";
-          // 区分第一次输入还是修改
-          if(valueStr.indexOf("${") !== -1){
-            str = valueStr.replace(patt,newVal);
-          }else{//修改
-            str = valueStr.replace(rePatt,newVal);
-          }
-          this.datas.value = str;
-          this.datas.valueP = str;
-        }
-        
         // 输入框回读
         let detailList = this.datas.questionDetailList;
         let currItem = detailList[index];
         currItem.value = val;
+        // 输入框失焦重新拼接父级的value
+        let temp = concatVal(detailList);
+        this.datas.value = temp.value;
+        this.datas.valueP = temp.valueP;
         this.$emit("updata",this.datas);
       },
       resetExc(){

+ 9 - 41
src/common/Radio.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="radio-wrap" v-if="item">
-    <img :src="datas.url.replace('{imageUrlPrefix}',imgUrl)" v-if="datas.url">
+    <!-- <img :src="datas.url.replace('{imageUrlPrefix}',imgUrl)" v-if="datas.url"> -->
     <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> -->
@@ -20,7 +20,7 @@
 <script type="text/javascript">
 import icon from '../images/radio-default.png'
 import checkIcon from '../images/radio-check.png'
-import {patt,imageUrlPrefix} from '@utils/tools.js'
+import {patt,imageUrlPrefix,concatVal} from '@utils/tools.js'
 import MultiLineInput from '../common/MultiLineInput.vue';
 import OptionInp from '../common/OptionInp.vue';
   export default{
@@ -40,59 +40,27 @@ import OptionInp from '../common/OptionInp.vue';
     },
     methods:{
       handleClick(it,index){
-        // let patt = /\$\{[^\]]+\}/g;
         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){
             data[i].select = 1;
-            // value = data[i].name;
-            // 选中该项时,带的输入框内有值则加上
-            if(data[i].value){
-              let newVal = '#{' + data[i].value + '}';
-              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].description ||data[i].name ;
-            }
           }
         }
-        // const newData = Object.assign({},this.datas,{questionDetailList:data},{value:value})
-        const newData = Object.assign({},this.datas,{questionDetailList:data,value:value,valueP:valueP})
+        let temp = concatVal(data);
+        const newData = Object.assign({},this.datas,{questionDetailList:data,value:temp.value,valueP:temp.valueP})
         this.$emit("updata",newData);
       },
-      inpVal(val,index){//输入框失焦处理
-        let valueStr = this.datas.value;
-        /*if(valueStr){
-          // let patt = /\$\{[^\]]+\}/g;
-          let newVal =  val;//修改时替换值用
-          const str = valueStr.replace(patt,newVal);
-          this.datas.value = str;
-        }*/
-        if(valueStr){
-          let rePatt = /\#\{[^\]]+\}/g;
-          let newVal = '#{' +val+'}';
-          let str = "";
-          // 区分第一次输入还是修改
-          if(valueStr.indexOf("${") !== -1){
-            str = valueStr.replace(patt,newVal);
-          }else{//修改
-            str = valueStr.replace(rePatt,newVal);
-          }
-          this.datas.value = str;
-          this.datas.valueP = str;//输入框内容无医生患者之分
-        }
-        
+      inpVal(val,index){//输入框失焦处理  
         // 输入框回读
         let detailList = this.datas.questionDetailList;
         let currItem = detailList[index];
         currItem.value = val; 
+        // 输入框失焦重新拼接父级的value
+        let temp = concatVal(detailList);
+        this.datas.value = temp.value;
+        this.datas.valueP = temp.valueP;
         this.$emit("updata",this.datas);
       },
     },

+ 10 - 6
src/components/Detail.vue

@@ -3,6 +3,7 @@
     <!-- <div v-for="(item,index) in datas"> -->
     <div v-for="(item,index) in checkDatas.questionMapping">
       <p class="quest">{{index + 1 +'.' + (item.description || item.name)}}</p>
+      <img class="questionImg" :src="item.url.replace('{imageUrlPrefix}',imgUrl)" v-if="item.url">
       <Radio v-if="item.controlType==1" 
             :item="item"
             :key="item.id"
@@ -40,14 +41,15 @@ import CheckBox from '../common/CheckBox.vue';
 import Input from '../common/Input.vue';
 import ComTextArea from '../common/ComTextArea.vue';
 import MultiLineInput from '../common/MultiLineInput.vue';
-import {patt,trimDots} from '@utils/tools.js'
+import {patt,trimDots,imageUrlPrefix} from '@utils/tools.js'
 // 将获取到的数据源转换成私有数据,处理选择事件。点击完成后统一存到store中,便于回读
   export default {
     name:'Detail',
     data(){
       return{
         checkDatas:{},
-        finished:false
+        finished:false,
+        imgUrl:imageUrlPrefix,
       }
     },
     props:['datas','type','ppId'],
@@ -107,10 +109,10 @@ import {patt,trimDots} from '@utils/tools.js'
         const datas = this.checkDatas.questionMapping;
         let text = ""; //医生
         let textP = "";//患者
-        for(let i in datas){// 输入框的值用占位符#{}标识,便于修改
+        for(let i in datas){
           if(datas[i].value){
-            text += datas[i].value.replace(patt,'').replace(/\#\{/g,'').replace(/\}/g,'')+',';
-            textP += datas[i].valueP.replace(patt,'').replace(/\#\{/g,'').replace(/\}/g,'')+',';
+            text += datas[i].value+',';
+            textP += datas[i].valueP+',';
           }
         }
         
@@ -127,7 +129,6 @@ import {patt,trimDots} from '@utils/tools.js'
         }
         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:trimDots(newMsg),textP:trimDots(newMsgP),pId:this.checkDatas.id,type:this.type,flag:true});
       },
       clearData(){//清空
@@ -186,5 +187,8 @@ import {patt,trimDots} from '@utils/tools.js'
       color:#000;
       margin-bottom: .2rem;
     }
+    .questionImg {
+      width: 100%;
+    }
   }
 </style>

+ 2 - 1
src/components/DetailBox.vue

@@ -103,7 +103,8 @@
     width: 100%;
     // overflow-y: auto;
     position: fixed;
-    bottom: 0;
+    // bottom: 0; //iPhone6plus键盘收起会跳转
+    top:45px;
     left: 0;
     z-index: 666;
     background: #fff;

+ 7 - 2
src/components/DiagTreat.vue

@@ -5,6 +5,7 @@
         :key="it.id"
         class="label">
       <p class="quest">{{i + 1 +'.' + (it.description||it.name)}}</p>
+      <img class="questionImg" :src="it.url.replace('{imageUrlPrefix}',imgUrl)" v-if="it.url">
         <Label v-if="it.controlType==0" 
               :item="it" 
               :indx="i" 
@@ -65,7 +66,7 @@
   import DetailBox from './DetailBox.vue';
   import Input from '../common/Input.vue';
   import ComTextArea from '../common/ComTextArea.vue';
-  import {moduleCP,patt} from '@utils/tools';
+  import {moduleCP,patt,imageUrlPrefix} from '@utils/tools';
   import Radio from '../common/Radio.vue';
   import CheckBox from '../common/CheckBox.vue';
   export default {
@@ -80,7 +81,8 @@
         labelDetail:{}, //标签明细
         checkText:text, //选中的文字-Arr
         show:false,
-        ppId:null
+        ppId:null,
+        imgUrl:imageUrlPrefix,
       }
     },
     props:['datas','preName','nextName','modluesLen'],
@@ -182,4 +184,7 @@
 .footer{
   .footer;
 }
+.questionImg {
+  width: 96%;
+}
 </style>

+ 6 - 1
src/components/Others.vue

@@ -5,6 +5,7 @@
         :key="it.id"
         class="label">
         <p class="quest">{{i + 1 +'.' + (it.description||it.name)}}</p>
+        <img class="questionImg" :src="it.url.replace('{imageUrlPrefix}',imgUrl)" v-if="it.url">
         <!-- <Label v-if="it.controlType==0" -->
         <Label v-if="it.controlType==0"
               :item="it"
@@ -70,7 +71,7 @@
   import Toast from '../common/Toast.vue';
   import Input from '../common/Input.vue';
   import ComTextArea from '../common/ComTextArea.vue';
-  import {moduleCP,patt} from '@utils/tools';
+  import {moduleCP,patt,imageUrlPrefix} from '@utils/tools';
   import Radio from '../common/Radio.vue';
   import CheckBox from '../common/CheckBox.vue';
   import MultiLineInput from '../common/MultiLineInput.vue';
@@ -87,6 +88,7 @@
         checkText:text, //选中的文字
         ppId:null,
         show:false,
+        imgUrl:imageUrlPrefix,
       }
     },
     props:['datas','preName','nextName','modluesLen'],
@@ -184,5 +186,8 @@
     .mask;
     z-index: 66;
   }
+  .questionImg {
+    width: 96%;
+  }
   
 </style>

+ 5 - 3
src/components/Symptom.vue

@@ -220,7 +220,7 @@ export default {
     },
     deletSymp(item, index) {
       this.delIndex = index;
-      this.questId = item.questionId || item.conceptId;
+      this.questId = item.questionId || item.id || item.conceptId;
       if (this.chooseSymp.length == 1) {
         this.delText = "是否删除该信息?<br/>删除后将重新填写预问诊流程 <br/>(已填内容将清除)"
       }
@@ -237,7 +237,9 @@ export default {
         const sympText = this.getSympText();
         this.getPush(sympText);//删除后重新调推理-入参:拼好的内容
       } else {
-        this.getSympList();
+        // 全部删除完 重新走问诊流程
+        this.$router.push("/")
+        // this.getSympList();
       }
       this.cancelDel();
     },
@@ -259,7 +261,7 @@ export default {
     showChecked(item) {
       const origin = this.$store.state.symptom.origin;
       const read = this.$store.state.symptom.datas;
-      const data = read[item.questionId] || origin[item.questionId];
+      const data = read[(item.questionId||item.id)] || origin[(item.questionId||item.id)];
       if (data.questionMapping && data.questionMapping.length > 0) {
         this.labelDetail = data;
         this.show = true;

+ 22 - 1
src/utils/tools.js

@@ -232,6 +232,26 @@ function trimDots(str){
   }).replace(/^[,,.。::"“??”;;、!!\s]+/,'');
 }
 
+// 拼值,并去掉占位符
+function concatVal(data){
+  let value = ""; //医生
+  let valueP = ""; //患者
+  for(let k in data){
+    if(data[k].select==1){
+      if(data[k].value){
+        let str = data[k].name.replace(patt,data[k].value);
+        let strP = (data[k].description || data[k].name).replace(patt,data[k].value);
+        value += str + ',';
+        valueP += strP + ',';
+      }else{
+        value += data[k].name.replace(patt,'') + ',';
+        valueP += (data[k].description || data[k].name).replace(patt,'') + ',';
+      }
+    }
+  }
+  return {value,valueP};
+}
+
 module.exports =  {
   imageUrlPrefix,
   getUrlArgObject,
@@ -245,7 +265,8 @@ module.exports =  {
   fixedKeyboard,
   scrollToV,
   isIos,
-  trimDots
+  trimDots,
+  concatVal
 }