Ver código fonte

数据处理

Luolei 5 anos atrás
pai
commit
4a52e16162
5 arquivos alterados com 68 adições e 36 exclusões
  1. 2 2
      config/index.js
  2. 8 13
      src/common/MultiLineInput.vue
  3. 29 17
      src/components/AddContent.vue
  4. 7 2
      src/store.js
  5. 22 2
      src/utils/tools.js

+ 2 - 2
config/index.js

@@ -4,8 +4,8 @@
 
 const path = require('path')
 // const proxy_path = 'http://192.168.2.236:80';
-// const proxy_path = 'http://192.168.2.236:5050';
-const proxy_path = 'http://192.168.2.241:5050';
+const proxy_path = 'http://192.168.2.236:5050';
+// const proxy_path = 'http://192.168.2.241:5050';
 
 module.exports = {
   dev: {

+ 8 - 13
src/common/MultiLineInput.vue

@@ -11,14 +11,14 @@
               :key="item.placeholder+idx" 
               v-model="item.value"
               :placeholder="item.placeholder"
-              @input="changeVal($event,idx)" 
+              @input="changeVal($event,idx,content.type)" 
               @blur="blur" 
               @click="handleClick">
             <input v-show="content.iptLis.length==1" class="contentVal" 
               :type="content.type=='number'?'tel':'text'" 
               :placeholder="content.placeholder" 
               v-model="item.value" 
-              @input="changeVal($event,idx)" 
+              @input="changeVal($event,idx,content.type)" 
               @blur="blur" 
               @click="handleClick">
             <span v-if="idx == 0&&content.iptLis.length>1">/</span>
@@ -62,25 +62,20 @@ export default {
     }
   },
   mounted(){
-    this.setValue()
+    this.content = getModelExpStr(this.msg,this.txt)
   },
   methods:{
-    changeVal(e,num){
+    changeVal(e,num,type){
       let tmpTxt = '',arr=this.tmpArr
-      e.currentTarget.value=e.currentTarget.value.replace(/[^\d]/g,'')
+      if(type == 'number'){
+        e.currentTarget.value=e.currentTarget.value.replace(/[^\d]/g,'')
+      }
       arr[num]=e.currentTarget.value
       tmpTxt=arr.join('/')
       this.txt = tmpTxt
-      this.setValue()
+      this.content = getModelExpStr(this.msg,this.txt)
       // this.$emit('changeMultipVal',e.currentTarget.value,num)
     },
-    setValue(){
-      if(this.txt){
-        this.content = getModelExpStr(this.msg,this.txt)
-      }else{
-        this.content = getModelExpStr(this.msg)
-      }
-    },
     blur(){
       // 如果该项未选中,则不存值
       const select = this.part.select;

+ 29 - 17
src/components/AddContent.vue

@@ -7,21 +7,21 @@
           <Radio v-if="item.controlType==1" 
             :item="item"
             :key="item.id"
-            @updata="updataData"/>
+            @updata="updataData($event,idx,item)"/>
           <CheckBox v-if="item.controlType==2" 
             :item="item"
             :key="item.id"
-            @updata="updataData"/>
+            @updata="updataData($event,idx,item)"/>
           <ComTextArea
             v-if="item.controlType == 5"
             :item="item"
-            @updata="updataData"
+            @updata="updataData($event,idx,item)"
             @changeAreaVal="changeAreaVal($event,idx)"
           ></ComTextArea>
           <Input v-if="item.controlType==6 || item.controlType==7"
             :item="item"
             :key="item.id"
-            @updata="updataData"/>
+            @updata="updataData($event,idx,item)"/>
           <template
             v-if="item.controlType == 3"
             v-for="(part,index) in item.questionDetailList"
@@ -31,17 +31,19 @@
               :msg="part.name"
               :part="part"
               @updata="updataData($event,index,item)"
-              @changeMultipVal="changeMultipVal($event,val,idx)"
             ></MultiLineInput>
           </template>
         </li>
       </ul>
+      <div class="result" v-if="allStr">
+        <p class="title">{{allMoudles.name}}</p>
+        <p>{{allStr}}</p>
+      </div>
       <div class="thanks">
         <p>感谢您的回答,您的病历已经自动生成。</p>
         <p>您可以点击预览病历回顾病情;或者点击顶部修改病历采集信息。</p>
         <p>如果没有需要修改的内容,请点击提交,医生便能看到您的病历。</p>
       </div>
-      <p>{{vals}}</p>
     </div>
     <div class="foot">
       <span class="back" @click="back">{{'返回'+ preName}}</span>
@@ -55,6 +57,7 @@ import MultiLineInput from '../common/MultiLineInput.vue';
 import Input from '../common/Input.vue';
 import Radio from '../common/Radio.vue';
 import CheckBox from '../common/CheckBox.vue';
+import {getAllStr} from '@utils/tools.js'
 
 export default {
   name: 'AddContent',
@@ -63,7 +66,7 @@ export default {
     return {
       dataTrd: [],
       val: '',
-      vals:''
+      allStr:''
     }
   },
   mounted() {
@@ -74,13 +77,8 @@ export default {
       this.$emit("back");
     },
     changeAreaVal(value, idx) {
-      // console.log(value,idx)
       this.val = value
     },
-    changeMultipVal(value, idx) {
-      console.log(value,idx)
-      this.vals = value
-    },
     next(){
       this.$store.commit('setText',{data:this.dataTrd,type:this.allMoudles&&this.allMoudles.type});
       this.$emit('next','preview')
@@ -95,14 +93,11 @@ export default {
       // this.dtoList = origin;console.log("更新:",origin)
     },
     updataData(data,idx,item){
-      console.log(data)
       let mapping = this.dataTrd;
       if(data.controlType == 3){//多行输入,多了一层需单独处理
         let tmpLis = item.questionDetailList
         tmpLis.splice(idx,1,data)
-        // console.log(this.dataTrd,7878)
-        // 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.allStr=getAllStr({data:this.dataTrd,type:this.allMoudles&&this.allMoudles.type})
         return;
       }
       for(let i in mapping){
@@ -110,7 +105,8 @@ export default {
           mapping.splice(i,1,data)
         }
       }
-      this.$store.commit('setDataAll',data);
+      this.allStr=getAllStr({data:this.dataTrd,type:this.allMoudles&&this.allMoudles.type})
+      this.$store.commit('setDataAll',{data:data,idx:idx});
     },
   },
   components: {
@@ -137,6 +133,7 @@ export default {
   .addPart {
     li {
       margin-bottom: 0.1rem;
+      clear: both;
     }
     .question {
       margin-bottom: 0.2rem;
@@ -147,6 +144,21 @@ export default {
   .foot{
     .dbfooter;
   }
+  
+.result{
+  margin-bottom: .3rem;
+  .title{
+    color: #4F50FF;
+    padding-left: .1rem;
+    border-left: .08rem solid #4F50FF;
+    margin-bottom: .19rem;
+    font-weight: 700;
+  }
+  p{
+    color: #666;
+    line-height: .44rem;
+  }
+}
 .thanks {
   font-size: .28rem /* 28/100 */;
   color: #666666;

+ 7 - 2
src/store.js

@@ -60,9 +60,14 @@ const store = new Vuex.Store({
         txt:'',
       }
     },
-    setDataAll(state,data){
+    setDataAll(state,param){
+      console.log(state,moduleCP['suplement'],param,1111)
       let res = state.allMoudles
-      res[1].moduleDetailDTOList[0].questionMapping[1].questionMapping = data
+      for(let i = 0;i<res.length;i++){
+        if(res[i].type == moduleCP['suplement']){
+          res[i].moduleDetailDTOList[param.idx] = param.data
+        }
+      }
       state.allMoudles = res
     },
     savePathInfo(state,param){

+ 22 - 2
src/utils/tools.js

@@ -49,11 +49,31 @@ const getModelExpStr = (str,txt) =>{
     }
   }else if(str.match(/\${input_(.*})/)){
     let matchStr = str.match(/\${input_(.*})/)[0]
+    let tmpHolder = matchStr.split('${input_')[1].split('}')[0]
+    let iptLis = [],join='';
+    if(tmpHolder.indexOf('/') != -1){
+      let tmpHolderArr = tmpHolder.split('/')
+      for(let i = 0;i < tmpHolderArr.length;i++){
+        let obj={placeholder:'',value:''}
+        let tmpData = tmpHolderArr[i];
+        obj.placeholder=tmpData
+        if(txt){
+          obj.value=txt.split('/')[i]
+        }
+        iptLis.push(obj)
+      }
+      join = '/'
+    }else{
+      let obj={placeholder:'tmpHolder',value:txt}
+      iptLis.push(obj)
+    }
     result = {
       type:'text',
-      placeholder:matchStr.split('${input_')[1].split('}')[0],
+      placeholder:tmpHolder,
+      iptLis:iptLis,
+      join:join,
       prefix:str.split(matchStr)[0]||'',
-      suffix:str.split(matchStr)[1]||''
+      suffix:str.split(matchStr)[1]||'',
     }
   }
   return result