Bläddra i källkod

type配置抽离,诊疗和其他史模块页新增单选多选

liucf 5 år sedan
förälder
incheckning
a1ac90cb6f

+ 3 - 2
src/common/Radio.vue

@@ -19,7 +19,7 @@
 <script type="text/javascript">
 import icon from '../images/radio-default.png'
 import checkIcon from '../images/radio-check.png'
-import {patt} from '@utils/tools.js'
+import {patt,imageUrlPrefix} from '@utils/tools.js'
 import MultiLineInput from '../common/MultiLineInput.vue';
   export default{
     name:'Radio',
@@ -27,7 +27,8 @@ import MultiLineInput from '../common/MultiLineInput.vue';
       return{
         defaultPic:icon,
         check:checkIcon,
-        datas:{}
+        datas:{},
+        imgUrl:imageUrlPrefix,
       }
     },
     props:['item'],

+ 16 - 3
src/components/DiagTreat.vue

@@ -26,6 +26,14 @@
         <ComTextArea v-if="it.controlType == 5"
             :item="it"
             @updata="updataData($event,it.id)"/>
+        <Radio v-if="it.controlType==1" 
+            :item="it"
+            :key="it.id"
+            @updata="updataData($event,it.id)"/>
+        <CheckBox v-if="it.controlType==2" 
+            :item="it"
+            :key="it.id"
+            @updata="updataData($event,it.id)"/>
     </div>
     <div class="result" v-if="checkText.length>0">
       <p class="title">治疗情况</p>
@@ -57,6 +65,9 @@
   import DetailBox from './DetailBox.vue';
   import Input from '../common/Input.vue';
   import ComTextArea from '../common/ComTextArea.vue';
+  import {moduleCP} from '@utils/tools';
+  import Radio from '../common/Radio.vue';
+  import CheckBox from '../common/CheckBox.vue';
   export default {
     name:'DiagTreat',
     data(){
@@ -115,8 +126,8 @@
             list.splice(i,1,data)
           }
         }
-        this.$store.commit('setDatas',{type:'2',data:data,pId:data.id,ppId:id});
-        this.$store.commit('setText',{type:'2',text:data.value,pId:data.id,flag:true}); 
+        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}); 
       }
     },
     components:{
@@ -124,7 +135,9 @@
       Label,
       DetailBox,
       Input,
-      ComTextArea
+      ComTextArea,
+      Radio,
+      CheckBox
     },
     /*watch:{
       dtoList:{

+ 31 - 3
src/components/Others.vue

@@ -5,6 +5,7 @@
         :key="it.id"
         class="label">
         <p class="quest">{{i + 1 +'.' + it.name}}</p>
+        <!-- <Label v-if="it.controlType==0" -->
         <Label v-if="it.controlType==0"
               :item="it"
               :ppId="it.id" 
@@ -19,6 +20,26 @@
         <ComTextArea v-if="it.controlType == 5"
             :item="it"
             @updata="updataData($event,it.id)"/>
+        <Radio v-if="it.controlType==1" 
+            :item="it"
+            :key="it.id"
+            @updata="updataData($event,it.id)"/>
+        <CheckBox v-if="it.controlType==2" 
+            :item="it"
+            :key="it.id"
+            @updata="updataData($event,it.id)"/>
+        <!-- 多行输入 存值和回读事件未处理 -->
+        <!-- <template
+            v-if="it.controlType == 3"
+            v-for="(part,index) in it.questionDetailList"
+          >
+            <MultiLineInput
+              v-if="it.controlType == 3"
+              :msg="part.name"
+              :part="part"
+              @updata="updataData($event,index,it)"
+            ></MultiLineInput>
+        </template> -->
     </div>
     <div class="result" v-if="checkText.length>0">
       <p class="title">其他病史</p>
@@ -49,6 +70,10 @@
   import Toast from '../common/Toast.vue';
   import Input from '../common/Input.vue';
   import ComTextArea from '../common/ComTextArea.vue';
+  import {moduleCP} from '@utils/tools';
+  import Radio from '../common/Radio.vue';
+  import CheckBox from '../common/CheckBox.vue';
+  import MultiLineInput from '../common/MultiLineInput.vue';
   export default {
     name:'Others',
     data(){
@@ -102,8 +127,8 @@
         }
         
         // this.$store.commit('setOrigin',{type:'3',data:data,pId:data.id});
-        this.$store.commit('setDatas',{type:'3',data:data,pId:data.id,ppId:id});
-        this.$store.commit('setText',{type:'3',text:data.value,pId:data.id,flag:true}); 
+        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}); 
       },
       getText(){
         let textArr = this.checkText;
@@ -121,7 +146,10 @@
       Label,
       DetailBox,
       Input,
-      ComTextArea
+      ComTextArea,
+      Radio,
+      CheckBox,
+      MultiLineInput
     },
     /*watch:{
       dtoList:{

+ 5 - 4
src/components/Symptom.vue

@@ -79,6 +79,7 @@ import api from '@utils/api.js';
 import DetailBox from './DetailBox.vue';
 import Toast from '../common/Toast.vue';
 import Search from './Search.vue';
+import {moduleCP} from '@utils/tools'
 export default {
   name: 'Symptom',
   props:['modluesLen'],
@@ -138,7 +139,7 @@ export default {
       // 把1切换成完成图标,且2高亮--判断有几个模块显示,1个--提交预览;1个以上--下一步
       if (this.chooseSymp.length == 0) { return }
       // 把症状情况的数据存起-已选
-      this.$store.commit('setChoose', { choose: this.chooseSymp, type: "1" });
+      this.$store.commit('setChoose', { choose: this.chooseSymp, type: moduleCP['symp'] });
       if(this.modluesLen==1){
         this.$emit('next','preview')
       }else{
@@ -156,7 +157,7 @@ export default {
       this.questId = item.questionId || item.id || item.conceptId;
       const id = item.questionId || item.id; //常见症状questionId,推送id,两者均有可能没有
       //将选中的name存到store中的text
-      this.$store.commit('setText', { type: "1", text: item.name, pId: this.questId });
+      this.$store.commit('setText', { type: moduleCP['symp'], text: item.name, pId: this.questId });
       if (id) {
         const param = {
           "age": this.age,
@@ -168,7 +169,7 @@ export default {
           if (result.code == 0) {
             const mapping = result.data.questionMapping;
             this.labelDetail = result.data;
-            this.$store.commit('setOrigin', { type: "1", data: result.data });
+            this.$store.commit('setOrigin', { type: moduleCP['symp'], data: result.data });
             if (mapping && mapping.length > 0) {
               this.show = true;
             } else { //没有详情,推送
@@ -225,7 +226,7 @@ export default {
       this.chooseSymp.splice(this.delIndex, 1);
       // delete(this.checkText[this.questId]);
       this.checkText.splice(this.delIndex, 1);
-      this.$store.commit('delText', { type: "1", pId: this.questId })
+      this.$store.commit('delText', { type: moduleCP['symp'], pId: this.questId })
       // 删除完-常见;其他-推送
       if (this.chooseSymp.length > 0) {
         const sympText = this.getSympText();

+ 15 - 14
src/components/TabPage.vue

@@ -16,13 +16,13 @@
     <div class="content">
       <template v-for="(item,idx) in modlues">
         <Symptom
-          v-if="flag==1&&item.type==1&&moduleShow"
+          v-if="flag==moduleCP['symp']&&item.type==moduleCP['symp']&&moduleShow"
           @next="toNext"
           :modluesLen="modluesLen"
         />
       
         <DiagTreat
-          v-if="flag==51&&item.type==51&&moduleShow"
+          v-if="flag==moduleCP['diagT']&&item.type==moduleCP['diagT']&&moduleShow"
           :datas="item"
           :preName="modlues[0]&&modlues[0].name"
           :modluesLen="modluesLen"
@@ -32,7 +32,7 @@
         />
 
         <Others
-          v-if="flag==3&&item.type==3&&moduleShow"
+          v-if="flag==moduleCP['other']&&item.type==moduleCP['other']&&moduleShow"
           :modluesLen="modluesLen"
           :datas="item"
           :preName="modlues[idx-1]&&modlues[idx-1].name"
@@ -41,7 +41,7 @@
           @back="beBack"
         />
         <AddContent
-          v-show="flag == 52&&item.type==52&&moduleShow"
+          v-show="flag == moduleCP['suplement']&&item.type==moduleCP['suplement']&&moduleShow"
           :modluesLen="modluesLen"
           :allMoudles="item"
           :preName="modlues[idx-1]&&modlues[idx-1].name"
@@ -63,7 +63,7 @@ import AddContent from './AddContent.vue';
 import DiagTreat from './DiagTreat.vue';
 import Others from './Others.vue';
 import Preview from './Preview.vue';
-import {moduleConfig} from '../utils/tools.js';
+import {moduleConfig,moduleCP} from '../utils/tools.js';
 export default {
   name: 'TabPage',
   data() {
@@ -75,20 +75,21 @@ export default {
       modlues: allMoudles.data,
       modluesLen: allMoudles.len,
       type: {
-        "1": sysConfig.length > 0 && sysConfig.filter(item => item.code == "symptoms_show")[0].value,
-        "51": 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,
-        "52": sysConfig.length > 0 && sysConfig.filter(item => item.code == "replenish_show")[0].value,
+        '1': sysConfig.length > 0 && sysConfig.filter(item => item.code == "symptoms_show")[0].value,
+        '51': 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,
+        '52': sysConfig.length > 0 && sysConfig.filter(item => item.code == "replenish_show")[0].value,
       },
       flag: allMoudles.order,
       moduleShow:true,
       finish:{ //标识已填
-        "1":true,
-        "51":false,
-        "3":false,
-        "52":false
+        '1':true,
+        '51':false,
+        '3':false,
+        '52':false
       },
-      number:0
+      number:0,
+      moduleCP:moduleCP
     }
   },
   created() {

+ 35 - 35
src/store.js

@@ -1,6 +1,6 @@
 import Vue from 'vue';
 import Vuex from 'vuex';
-import {deepClone,getAllStr} from '@utils/tools.js'
+import {deepClone,getAllStr,moduleCP} from '@utils/tools.js'
 Vue.use(Vuex);
 
 const store = new Vuex.Store({
@@ -74,10 +74,10 @@ const store = new Vuex.Store({
     saveAll(state,param){
       state.allMoudles = param;
       for(let k in param){
-        if(param[k].type == 51){
+        if(param[k].type == moduleCP['diagT']){
           state.diagnose.origin = JSON.parse(JSON.stringify(param[k].moduleDetailDTOList))
           state.diagnose.datas = JSON.parse(JSON.stringify(param[k].moduleDetailDTOList))
-        }else if(param[k].type == 3){
+        }else if(param[k].type == moduleCP['other']){
           state.others.origin = JSON.parse(JSON.stringify(param[k].moduleDetailDTOList))
           state.others.datas = JSON.parse(JSON.stringify(param[k].moduleDetailDTOList))
         }
@@ -87,10 +87,10 @@ const store = new Vuex.Store({
       const type = parseInt(param.type);
       const data = param.data;
       switch(type){
-        case 1: //症状情况
+        case moduleCP['symp']: //症状情况
           state.symptom.origin = Object.assign({},state.symptom.origin,{[data.id]:data});
           break;
-        case 51: //诊疗情况
+        case moduleCP['diagT']: //诊疗情况
           let diagData = state.diagnose.origin;
           for(let i in diagData){
             if(diagData[i].id == param.pId){
@@ -103,7 +103,7 @@ const store = new Vuex.Store({
             }
           }
           break;
-        case 3:
+        case moduleCP['other']:
           let otherData = state.others.origin;
           for(let i in otherData){
             if(otherData[i].id == param.pId){
@@ -116,7 +116,7 @@ const store = new Vuex.Store({
             }
           }
           break;
-        case 52:
+        case moduleCP['suplement']:
           
           break;
         default:
@@ -129,10 +129,10 @@ const store = new Vuex.Store({
       const data = param.data;
       const ppId = param.ppId;
       switch(type){
-        case 1:
+        case moduleCP['symp']:
           state.symptom.datas = Object.assign({},state.symptom.datas,{[param.pId]:data});
           break;
-        case 51: //诊疗情况
+        case moduleCP['diagT']: //诊疗情况
           let diagData = state.diagnose.datas;
           for(let i in diagData){
             if(diagData[i].id == ppId){
@@ -146,7 +146,7 @@ const store = new Vuex.Store({
             }
           }
           break;
-        case 3:
+        case moduleCP['other']:
           let otherData = state.others.datas;
           for(let i in otherData){
             if(otherData[i].id == ppId){
@@ -159,7 +159,7 @@ const store = new Vuex.Store({
             }
           }
           break;
-        case 52:
+        case moduleCP['suplement']:
 
           break;
         default:
@@ -170,7 +170,7 @@ const store = new Vuex.Store({
     setText(state,param){
       const type = parseInt(param.type);
       switch(type){
-        case 1:
+        case moduleCP['symp']:
           // 对象易更新但顺序无法控制
           // state.symptom.text = Object.assign({},state.symptom.text,{[param.pId]:param.text}); 
           let text = state.symptom.text;
@@ -189,7 +189,7 @@ const store = new Vuex.Store({
             text.push(param);
           }
           break;
-        case 51: //诊疗情况
+        case moduleCP['diagT']: //诊疗情况
           let diaText = state.diagnose.text;
           if(diaText.length > 0){
             for(let i in diaText){
@@ -205,7 +205,7 @@ const store = new Vuex.Store({
             diaText.push(param);
           }
           break;
-        case 3: //其他情况
+        case moduleCP['other']: //其他情况
           let otherText = state.others.text;
           if(otherText.length > 0){
             for(let i in otherText){
@@ -221,7 +221,7 @@ const store = new Vuex.Store({
             otherText.push(param);
           }
           break;
-        case 52:
+        case moduleCP['suplement']:
           let addText = state.addContent.txt
           state.addContent.origin = param.data
           state.addContent.txt = getAllStr(param)
@@ -233,7 +233,7 @@ const store = new Vuex.Store({
     delText(state,param){
       const type = parseInt(param.type);
       switch(type){
-        case 1:
+        case moduleCP['symp']:
           let text = state.symptom.text;
           for(let i in text){
             if(text[i].pId==param.pId){
@@ -241,7 +241,7 @@ const store = new Vuex.Store({
             }
           }
           break;
-        case 51: //诊疗情况
+        case moduleCP['diagT']: //诊疗情况
           let diaText = state.diagnose.text;
           for(let i in diaText){
             if(diaText[i].pId==param.pId){
@@ -249,7 +249,7 @@ const store = new Vuex.Store({
             }
           }
           break;
-        case 3:
+        case moduleCP['other']:
           let otherText = state.others.text;
           for(let i in otherText){
             if(otherText[i].pId==param.pId){
@@ -257,7 +257,7 @@ const store = new Vuex.Store({
             }
           }
           break;
-        case 52:
+        case moduleCP['suplement']:
 
           break;
         default:
@@ -270,16 +270,16 @@ const store = new Vuex.Store({
     setImgFile(state,param){//区别模块
       const type = parseInt(param.type);
       switch(type){
-        case 1:
+        case moduleCP['symp']:
 
           break;
-        case 51: //诊疗情况
+        case moduleCP['diagT']: //诊疗情况
           state.diagnose.imgFile.push(param);
           break;
-        case 3:
+        case moduleCP['other']:
 
           break;
-        case 52:
+        case moduleCP['suplement']:
 
           break;
         default:
@@ -292,16 +292,16 @@ const store = new Vuex.Store({
       const src = param.src;
       const type = parseInt(param.type);
       switch(type){
-        case 1:
+        case moduleCP['symp']:
 
           break;
-        case 51:
+        case moduleCP['diagT']:
           state.diagnose.imgSrc = Object.assign({},state.diagnose.imgSrc,{[key]:src});
           break;
-        case 3:
+        case moduleCP['other']:
 
           break;
-        case 52:
+        case moduleCP['suplement']:
 
           break;
         default:
@@ -313,10 +313,10 @@ const store = new Vuex.Store({
       const key = param.key;
       const type = parseInt(param.type);
       switch(type){
-        case 1:
+        case moduleCP['symp']:
 
           break;
-        case 51:
+        case moduleCP['diagT']:
           let data = state.diagnose.imgFile;
           for(let i=0; i<data.length;i++){
             if(data[i].key==key){
@@ -324,10 +324,10 @@ const store = new Vuex.Store({
             }
           }
           break;
-        case 3:
+        case moduleCP['other']:
 
           break;
-        case 52:
+        case moduleCP['suplement']:
 
           break;
         default:
@@ -339,19 +339,19 @@ const store = new Vuex.Store({
       const key = param.key;
       const type = parseInt(param.type);
       switch(type){
-        case 1:
+        case moduleCP['symp']:
 
           break;
-        case 51:
+        case moduleCP['diagT']:
           let data = state.diagnose.imgFile;
           let obj = state.diagnose.imgSrc;
           delete(obj[key]);
           state.diagnose.imgSrc = Object.assign({},obj);
           break;
-        case 3:
+        case moduleCP['other']:
 
           break;
-        case 52:
+        case moduleCP['suplement']:
 
           break;
         default:

+ 0 - 9
src/utils/config.js

@@ -1,9 +0,0 @@
-// 通用配置信息
-export default {
-  moduleType:{
-    'symp':'1',
-    'diagT':'51',
-    'other':'3',
-    'suplement':'52',
-  }
-}

+ 15 - 6
src/utils/tools.js

@@ -1,6 +1,7 @@
 
 const qs = require('qs');
-const imageUrlPrefix = 'http://192.168.2.236:82' //后台图片地址
+// const imageUrlPrefix = 'http://192.168.2.236:82' //后台图片地址
+const imageUrlPrefix = 'http://192.168.2.241:82' //后台图片地址
 
 const getUrlArgObject = (parm) => {
     let query = window.location.search;
@@ -70,19 +71,26 @@ const getAllStr = (allData) =>{//获取界面数据,拼接字符串
   return allStr;
 }
 
+const moduleCP = {
+  'symp':1,   //症状情况
+  'diagT':51,  //诊疗情况
+  'other':3,   //其他史
+  'suplement':52,//补充内容
+}
+
 const moduleConfig = (config,modules) => {
   let activeModule = []
   for(let i = 0;i < config.length;i++){
     let tmpCode = config[i].code
     for(let j = 0;j < modules.length;j++){
       let tmpType = modules[j].type
-      if(tmpCode=="symptoms_show"&&tmpType==1){
+      if(tmpCode=="symptoms_show"&&tmpType==moduleCP['symp']){
         activeModule.push(modules[j])
-      }else if(tmpCode=="diagnosis_show"&&tmpType==51){
+      }else if(tmpCode=="diagnosis_show"&&tmpType==moduleCP['diagT']){
         activeModule.push(modules[j])
-      }else if(tmpCode=="omhistory_show"&&tmpType==3){
+      }else if(tmpCode=="omhistory_show"&&tmpType==moduleCP['other']){
         activeModule.push(modules[j])
-      }else if(tmpCode=="replenish_show"&&tmpType==52){
+      }else if(tmpCode=="replenish_show"&&tmpType==moduleCP['suplement']){
         activeModule.push(modules[j])
       }
     }
@@ -104,7 +112,8 @@ module.exports =  {
   getModelExpStr,
   getAllStr,
   moduleConfig,
-  patt
+  patt,
+  moduleCP
 }