ソースを参照

数据处理
Squashed commit of the following:

commit 54aa3aad2d6163449bff54abd5fbee53f8010941
Merge: 9b50ae5 ea78834
Author: Luolei <16657115156@163.com>
Date: Wed Jul 3 20:22:00 2019 +0800

Merge remote-tracking branch 'remotes/origin/development' into dev

commit 9b50ae5cf4fb61577133d0ff0f0470f86c3da87d
Author: Luolei <16657115156@163.com>
Date: Wed Jul 3 19:43:27 2019 +0800

新增文本域组件

commit c49d6a90ceb0a9f4166b1bb787c8b36171d6db41
Author: Luolei <16657115156@163.com>
Date: Wed Jul 3 09:56:18 2019 +0800

添加补充内容页面

commit db3d558cc2e8292c65bb8e460a206c40b44e4f75
Author: liucf <liucf@zjlantone.com>
Date: Tue Jul 2 11:38:56 2019 +0800

Squashed commit of the following:

commit abb05f77689576a0834513d2a21f5f05b321e495
Author: liucf <liucf@zjlantone.com>
Date: Tue Jul 2 11:36:51 2019 +0800

增加图片

commit 1a3e1b96d9dfd09cf7c9b5d05001db5a12cc2ac4
Author: liucf <liucf@zjlantone.com>
Date: Mon Jul 1 20:44:08 2019 +0800

新增弹窗,单选,多选,待完善

commit 565f06729383a7df1bfde511faacb5979432a7da
Author: liucf <liucf@zjlantone.com>
Date: Fri Jun 28 17:36:42 2019 +0800

患者信息页完成

liucf 6 年 前
コミット
29702b2314

+ 42 - 0
src/common/ComTextArea.vue

@@ -0,0 +1,42 @@
+<template>
+  <div class="comArea">
+    <textarea @input="changeVal" :style={width:width,height:height} v-model="txt"></textarea>
+  </div>
+</template>
+
+<script type="text/javascript">
+export default {
+  name:'ComTextArea',
+  props: {
+    width: {
+      default: '100%',
+      type: String
+    },
+    height: {
+      default: '2rem',
+      type: String
+    },
+  },
+  data() {
+    return {
+      txt:''
+    }
+  },
+  methods:{
+    changeVal(){
+      this.$emit('changeVal',this.txt)
+    }
+  }
+}
+</script>
+<style lang="less" scoped>
+  .comArea {
+    textarea {
+      border: 1px solid #DFE0E4;
+      border-radius: .08rem /* 8/100 */;
+      padding: .16rem /* 16/100 */ .3rem /* 30/100 */;
+      resize: none;
+      box-sizing: border-box;
+    }
+  }
+</style>

+ 3 - 3
src/common/Radio.vue

@@ -3,7 +3,7 @@
     <p class="quest">{{indx + '.' + item.name}}</p>
     <img :src="item.url.replace('{imageUrlPrefix}',imgUrl)" v-if="item.url">
     <p v-for="(it,index) in item.questionDetailList" :key="it.id" class="list">
-      <img :src="index==current?check:defaultPic" @click="handleClick(it,index)">
+      <img :src="index==current||it.select==1?check:defaultPic" @click="handleClick(it,index)">
       <!-- <img :src="it.select?check:defaultPic" @click="handleClick(it,index)"> -->
       <span :class="{'check':index==current}">{{it.name}}</span>
     </p>
@@ -25,7 +25,7 @@ import {deepClone} from '@utils/tools.js'
     },
     props:['item','indx','pId'],
     methods:{
-      handleClick(it,index){
+      handleClick(it,index){console.log("单选:",this.item)
         this.current = index;
         const list = JSON.parse(JSON.stringify(this.item));
         let data = list.questionDetailList.slice(0); //数组深拷贝?
@@ -39,7 +39,7 @@ import {deepClone} from '@utils/tools.js'
           }
         }
         const newData = Object.assign({},this.item,{questionDetailList:data},{value:value})
-        this.$store.commit('setDatas',{data:newData,pId:this.pId});
+        this.$store.commit('setDatas',{data:newData,pId:this.pId,type:"1"});
         this.$store.commit('getUpdate'); //更新数据
       }
     }

+ 7 - 9
src/common/UploadImg.vue

@@ -30,9 +30,6 @@
     },
     props:['item','moduleType','imgList'],//moduleType-哪个模块下上传的图
     mounted(){
-      /*this.$preview.on('imageLoadComplete',(e,item)=>{
-        console.log(this.$preview.self)
-      })*/
       // 将store存的值赋给imgs
       this.imgs = this.imgList;
     },
@@ -44,9 +41,10 @@
       delImg(key){
         let obj = this.imgs;
         delete(obj[key]);
+        this.imgLen--;
         this.imgs = Object.assign({},obj);
-        this.$store.commit('deleImg',key);
-        this.$store.commit('deleSrc',key);
+        this.$store.commit('deleImg',{key:key,type:this.moduleType});
+        this.$store.commit('deleSrc',{key:key,type:this.moduleType});
       },
       addImg(){
         // 上传图片进行压缩,压缩后超过4M则不允许上传
@@ -60,7 +58,7 @@
             var uploadSrc;
             var uploadFile;
             if(fileSize > maxSize) { // 如果图片大小大于4m,进行压缩
-              console.log(maxSize,fileSize, maxSize/fileSize );
+              // console.log(maxSize,fileSize, maxSize/fileSize );
               uploadSrc = canvas.toDataURL(file.type, maxSize/fileSize);
                 uploadFile = that.dataURLtoFile(uploadSrc, file.name.split('.')[0]); // 转成file文件
                 // uploadFile = that.convertBase64UrlToBlob(uploadSrc); // 转成blob
@@ -78,7 +76,7 @@
                 that.imgLen++;
                 // 将图片信息存到store
                 that.$store.commit('setImgFile',{type:that.moduleType,pId:that.item.id,key:key,file:uploadFile})
-                that.$store.commit('setImgSrc',{key:key,src:uploadSrc})
+                that.$store.commit('setImgSrc',{key:key,src:uploadSrc,type:that.moduleType})
                 that.$previewRefresh(); //异步获取的图片需要刷新下
               }
           });
@@ -171,7 +169,7 @@
         }
       }
       li{
-        width:1.9rem;
+        width:1.86rem;
         height:1.9rem;
         display: inline-block;
         position: relative;
@@ -189,7 +187,7 @@
           z-index: 3;
         }
       }
-      li:nth-child(3n+2){
+      li:nth-child(3n+1){
         margin-left: 0;
       }
       .imgbox{

+ 127 - 0
src/components/AddContent.vue

@@ -0,0 +1,127 @@
+<template>
+  <div class="symp-wrap">
+    <div class="choose">
+      <ul class="addPart">
+        <li v-for="(item,idx) in dataTrd">
+          <p class="question">{{idx+1 + '. ' +item.name}}</p>
+          <ComTextArea @changeVal="changeVal($event,idx)"></ComTextArea>
+        </li>
+      </ul>
+    </div>
+    <div
+      class="footer"
+      @click="back"
+    >上一步</div>
+  </div>
+</template>
+<script type="text/javascript">
+import ComTextArea from '../common/ComTextArea.vue';
+
+export default {
+  name: 'AddContent',
+  props: ['allMoudles'],
+  data() {
+    return {
+      dataTrd: []
+    }
+  },
+  mounted() {
+    this.dataTrd = this.allMoudles&&this.allMoudles.moduleDetailDTOList
+  },
+  methods: {
+    back() {
+      this.$emit("back");
+    },
+    changeVal(value,idx){
+      // console.log(value,idx)
+    }
+  },
+  components: {
+    ComTextArea,
+  }
+}
+</script>
+<style lang="less" scoped>
+@import "../less/base.less";
+.symp-wrap {
+  font-size: 0.3rem;
+  h3 {
+    color: #000;
+    margin-bottom: 0.36rem;
+  }
+}
+.choose {
+  padding-bottom: 0.2rem;
+  .addPart {
+    li {
+      margin-bottom: .5rem /* 50/100 */;
+    }
+    .question {
+      margin-bottom: .3rem /* 30/100 */;
+      font-weight: bold;
+    }
+  }
+  .choo-symp {
+    display: inline-block;
+    width: 1.9rem;
+    height: 0.74rem;
+    background: linear-gradient(-270deg, #4f4fff, #4f8bff);
+    box-shadow: 0 0.08rem 0.16rem 0 rgba(79, 129, 255, 0.4);
+    border-radius: 0.08rem;
+    white-space: nowrap;
+    margin: 0 0.3rem 0.3rem 0;
+    span {
+      display: inline-block;
+      vertical-align: top;
+    }
+    span:first-child {
+      width: 1.34rem;
+      height: 0.74rem;
+      line-height: 0.74rem;
+      text-align: center;
+      color: #fff;
+    }
+    img {
+      width: 0.56rem;
+      height: 0.74rem;
+    }
+  }
+}
+.label {
+  padding-bottom: 0.2rem;
+  .symp {
+    display: inline-block;
+    width: 1.9rem;
+    height: 0.74rem;
+    line-height: 0.74rem;
+    border: 1px solid #dfe0e4;
+    border-radius: 0.08rem;
+    text-align: center;
+    color: #7c828e;
+    margin: 0 0 0.3rem 0.3rem;
+    box-sizing: border-box;
+  }
+  .symp:nth-child(3n + 2) {
+    margin-left: 0;
+  }
+}
+.result {
+  h4 {
+    color: #4f50ff;
+    padding-left: 0.1rem;
+    border-left: 0.08rem solid #4f50ff;
+    margin-bottom: 0.19rem;
+  }
+  p {
+    color: #666;
+    line-height: 0.44rem;
+  }
+}
+.footer {
+  .footer;
+}
+.detail {
+  .mask;
+  z-index: 66;
+}
+</style>

+ 13 - 6
src/components/DetailBox.vue

@@ -4,11 +4,11 @@
       <span class="icon" @click="close">
         <img src="../images/small-close.png">
       </span>
-      <span class="name">{{data.name+'详情'}}</span>
+      <span class="name">{{privateData.name+'详情'}}</span>
       <span>清空</span>
     </div>
     <div class="main">
-      <Detail :datas="data.questionMapping" :id="data.id"/>
+      <Detail :datas="privateData.questionMapping" :id="privateData.id"/>
     </div>
     <div class="foot" @click="complete">完成</div>
   </div>
@@ -19,21 +19,28 @@
     name:'DetailBox', //点开详情的盒子
     data(){
       return{
-        msg:"胸痛详情"
+        msg:"胸痛详情",
+        privateData:{}
       }
     },
+    created(){
+      console.log("详情盒子:",this.data);
+      this.privateData = this.data;
+    },
     mounted(){
       const box = this.$refs.detailBox;
       const height = document.documentElement.clientHeight;
-      box.style.height = height - 100 + 'px';
+      box.style.height = height - 100 + 'px'; 
     },
     methods:{
       close(){
         this.$emit("close","胸痛");
       },
-      complete(){//拼接value
+      complete(){
+      //拼接value,将选中的数据结构存到store--setDatas
         const id = this.data.id;
-        const datas = this.$store.state.datas;
+        // const datas = this.$store.state.datas;
+        const datas = this.$store.state.symptom.datas;
         const current = datas[id];
         const detail = current.questionMapping;
         let text = "";

+ 1 - 1
src/components/DiagTreat.vue

@@ -31,7 +31,7 @@
       return{
         msg:"诊疗情况",
         chooseSymp:[{name:'未治疗'}],
-        imgs:this.$store.state.imgSrc
+        imgs:this.$store.state.diagnose.imgSrc
       }
     },
     props:['datas','preName','nextName'],

+ 20 - 3
src/components/Symptom.vue

@@ -3,7 +3,7 @@
     <div class="choose" v-if="chooseSymp.length>0">
       <p class="quest">已选症状</p>
       <p class="choo-symp" v-for="(v,i) in chooseSymp">
-        <span>{{v.name}}</span>
+        <span @click="showChecked(v)">{{v.name}}</span>
         <span @click="deletSymp(v,i)"><img src="../images/delete.png" alt=""></span>
       </p>
     </div>
@@ -64,6 +64,10 @@ import Toast from '../common/Toast.vue';
     created(){
       this.getSympList();
     },
+    mounted(){
+      // 从store中取数据
+
+    },
     methods:{
       getSympList(){ 
         const param = {
@@ -82,6 +86,9 @@ import Toast from '../common/Toast.vue';
         // 把1切换成完成图标,且2高亮
         if(this.chooseSymp.length==0){return}
         this.$emit('next');
+        // 把症状情况的数据存起-已选、详情、拼好的文字
+        
+
       },
       showDetil(item){
         this.chooseSymp.push(item);
@@ -97,7 +104,7 @@ import Toast from '../common/Toast.vue';
           if(result.code==0){
             const mapping = result.data.questionMapping;
             this.labelDetail = result.data;
-            this.$store.commit('setOrigin',result.data);
+            this.$store.commit('setOrigin',{type:"1",data:result.data});
             // this.$store.commit('getUpdate');
             if(mapping&&mapping.length>0){
               this.show = true;
@@ -168,6 +175,16 @@ import Toast from '../common/Toast.vue';
         this.checkText = Object.assign({},this.checkText,{[this.questId]:msg});
         this.show = false;
         this.questId = null;
+      },
+      showChecked(item){  
+        const origin = this.$store.state.symptom.origin;
+        const read = this.$store.state.symptom.datas;
+        console.log(1111,item,origin,read,)
+        const data = read[item.questionId] || origin[item.questionId];
+        if(data.questionMapping&&data.questionMapping.length>0){
+          this.labelDetail = data;
+          this.show = true;
+        }
       }
     },
     components:{
@@ -182,7 +199,7 @@ import Toast from '../common/Toast.vue';
     watch:{
       getQuestId:{
         handler(newVal,oldVal){
-          console.log("数据更新了11",newVal,oldVal);
+          console.log("数据更新了",newVal,oldVal);
           let datas = this.$store.state.datas;
           let originDatas = this.$store.state.originDatas;
           this.labelDetail = datas[this.questId] || originDatas[this.questId];

+ 15 - 6
src/components/TabPage.vue

@@ -26,11 +26,16 @@
             @next="toNext"
             @back="beBack"
             />
+      <AddContent v-show="flag == 4" 
+        :allMoudles="modlues[3]" 
+        @back="beBack"
+         />
     </div>
   </div>
 </template>
 <script type="text/javascript">
   import Symptom from './Symptom.vue';
+  import AddContent from './AddContent.vue';
   import DiagTreat from './DiagTreat.vue';
   import Others from './Others.vue';
   export default {
@@ -42,21 +47,25 @@
         config:sysConfig,
         modlues:allMoudles,
         type:{
-          "1":sysConfig.filter(item=>item.code=="symptoms_show")[0].value,
-          "2":sysConfig.filter(item=>item.code=="diagnosis_show")[0].value,
-          "3":sysConfig.filter(item=>item.code=="omhistory_show")[0].value,
-          "4":sysConfig.filter(item=>item.code=="replenish_show")[0].value,
+          "1":sysConfig.length>0&&sysConfig.filter(item=>item.code=="symptoms_show")[0].value,
+          "2":sysConfig.length>0&&sysConfig.filter(item=>item.code=="diagnosis_show")[0].value,
+          "3":sysConfig.length>0&&sysConfig.filter(item=>item.code=="omhistory_show")[0].value,
+          "4":sysConfig.length>0&&sysConfig.filter(item=>item.code=="replenish_show")[0].value,
         },
-        flag:allMoudles[0].type
+        flag:allMoudles.length>0&&allMoudles[0].type
       }
     },
     created(){
       // console.log('配置信息:',this.config,'type',this.type)
+      if(this.config.length == 0){
+        this.$router.go(-1)
+      }
     },
     components:{
       Symptom,
       DiagTreat,
-      Others
+      Others,
+      AddContent
     },
     methods:{
       toNext(){

+ 139 - 20
src/store.js

@@ -8,11 +8,24 @@ const store = new Vuex.Store({
     pathInfo:{}, //患者信息-后续提交要用
     sysConfig:[], //系统配置项
     allMoudles:[], //模板
-    originDatas:{},  //getById获取到的数据
+    originDatas:{},  //getById获取到的数据
     datas:{},  //处理过的数据
     updata:false,  //更新数据
     imgFile:[],   //上传图片信息file
     imgSrc:{},   //上传的图片信息src
+    symptom:{ //症状情况
+      choose:[],
+      origin:{},
+      datas:{},
+      text:""
+    },
+    diagnose:{ //诊疗
+      origin:{},
+      datas:{},
+      text:"",
+      imgFile:[],
+      imgSrc:{}
+    }
   },
   mutations:{
     savePathInfo(state,param){
@@ -24,42 +37,148 @@ const store = new Vuex.Store({
     saveAll(state,param){
       state.allMoudles = param;
     },
-    setOrigin(state,param){
-      state.originDatas[param.id] = param;
+    setOrigin(state,param){console.log("存值:",param)
+      const type = parseInt(param.type);
+      const data = param.data;
+      switch(type){
+        case 1: //症状情况
+          state.symptom.origin = Object.assign({},state.symptom.origin,{[data.id]:data});
+          break;
+        case 2: //诊疗情况
+          
+          break;
+        case 3:
+
+          break;
+        case 4:
+
+          break;
+        default:
+          break;
+      }
+      // state.originDatas = Object.assign({},state.originDatas,{[param.id]:param});
     },
     setDatas(state,param){
-      let originData = state.datas[param.pId]?state.datas[param.pId]:JSON.parse(JSON.stringify(state.originDatas[param.pId]));
-      let list = originData.questionMapping.slice(0);
-      for(let i=0; i<originData.questionMapping.length; i++){
-        if(originData.questionMapping[i].id==param.data.id){
-          list.splice(i,1,param.data);
-        }
+      // let originData = state.datas[param.pId]?state.datas[param.pId]:JSON.parse(JSON.stringify(state.originDatas[param.pId]));
+      const type = parseInt(param.type);
+      switch(type){
+        case 1:
+          let originData = state.symptom.datas[param.pId]?state.symptom.datas[param.pId]:JSON.parse(JSON.stringify(state.symptom.origin[param.pId]));
+          let list = originData.questionMapping.slice(0);
+          for(let i=0; i<originData.questionMapping.length; i++){
+            if(originData.questionMapping[i].id==param.data.id){
+              list.splice(i,1,param.data);
+            }
+          }
+          state.symptom.datas[param.pId] = Object.assign({},state.symptom.origin[param.pId],{questionMapping:list});
+          break;
+        case 2: //诊疗情况
+          break;
+        case 3:
+
+          break;
+        case 4:
+
+          break;
+        default:
+          break;
       }
-      state.datas[param.pId] = Object.assign({},state.originDatas[param.pId],{questionMapping:list});
+      
     },
     getUpdate(state){//更新数据
       state.updata = !state.updata;
     },
     setImgFile(state,param){//区别模块
-      const type = param.type;
-      state.imgFile.push(param);
+      const type = parseInt(param.type);
+      switch(type){
+        case 1:
+
+          break;
+        case 2: //诊疗情况
+          state.diagnose.imgFile.push(param);
+          break;
+        case 3:
+
+          break;
+        case 4:
+
+          break;
+        default:
+          break;
+      }
+      
     },
     setImgSrc(state,param){
       const key = param.key;
       const src = param.src;
-      state.imgSrc = Object.assign({},state.imgSrc,{[key]:src});
+      const type = parseInt(param.type);
+      switch(type){
+        case 1:
+
+          break;
+        case 2:
+          state.diagnose.imgSrc = Object.assign({},state.diagnose.imgSrc,{[key]:src});
+          break;
+        case 3:
+
+          break;
+        case 4:
+
+          break;
+        default:
+          break;
+      }
+      
     },
     deleImg(state,param){
-      for(let i=0; i<state.imgFile.length;i++){
-        if(state.imgFile[i].key==param){
-          state.imgFile.splice(i,1)
-        }
+      const key = param.key;
+      const type = parseInt(param.type);
+      switch(type){
+        case 1:
+
+          break;
+        case 2:
+          let data = state.diagnose.imgFile;
+          for(let i=0; i<data.length;i++){
+            if(data[i].key==key){
+              data.splice(i,1)
+            }
+          }
+          break;
+        case 3:
+
+          break;
+        case 4:
+
+          break;
+        default:
+          break;
       }
+      
     },
     deleSrc(state,param){
-      let obj = state.imgSrc;
-      delete(obj[param]);
-      state.imgSrc = Object.assign({},obj);
+      const key = param.key;
+      const type = parseInt(param.type);
+      switch(type){
+        case 1:
+
+          break;
+        case 2:
+          let data = state.diagnose.imgFile;
+          let obj = state.diagnose.imgSrc;
+          delete(obj[key]);
+          state.diagnose.imgSrc = Object.assign({},obj);
+          break;
+        case 3:
+
+          break;
+        case 4:
+
+          break;
+        default:
+          break;
+      }
+      
     },
   }
 })