Browse Source

Merge branch 'btscroll' of http://192.168.2.236:10080/zhouna/preliminary into btscroll

luolei 5 years ago
parent
commit
177ab0e7e7

+ 1 - 1
build/webpack.dev.conf.js

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

+ 1 - 1
src/common/Input.vue

@@ -24,7 +24,7 @@
         if(this.item.controlType==7){//数字键盘
           this.val = e.target.value=e.target.value.replace(/[^\d]/g,'')
         }
-        document.activeElement.scrollIntoViewIfNeeded(true);
+        // document.activeElement.scrollIntoViewIfNeeded(true);
         this.borColor = false;
         const newData = Object.assign({},this.item,{value:this.val,valueP:this.val});
         this.$emit("updata",newData);

+ 1 - 0
src/common/Label.vue

@@ -72,6 +72,7 @@ import {moduleCP} from '@utils/tools';
         this.$store.commit('setText',{type:this.moduleType,text:it.name,textP:(it.description||it.name),pId:it.id});
         if(it.questionMapping&&it.questionMapping.length>0){//有明细
           this.$emit("setDetail",{detail:it,ppId:this.ppId})
+          this.$store.commit('setDetail',{detail:it,ppId:this.ppId,moduleType:this.moduleType})
         }
       },
       deletSymp(e,it,index){

+ 38 - 12
src/components/DetailBox.vue

@@ -7,8 +7,8 @@
         <div class="main">
           <Detail :datas="privateData" 
                   ref="detail"
-                  :type="moduleType" 
-                  :ppId="ppId"
+                  :type="data.moduleType" 
+                  :ppId="data.ppId"
                   @check="changeCheck($event)"/>
         </div>
         <!-- <div class="foot" @click="complete">完成</div> -->
@@ -32,24 +32,28 @@
 <script type="text/javascript">
   import Detail from './Detail.vue';
   import Toast from '../common/Toast.vue';
-  import {fixedKeyboard,setScroll} from '@utils/tools.js';
+  import {fixedKeyboard,setScroll,moduleCP} from '@utils/tools.js';
   import BScroll from 'better-scroll';
   import $ from 'jquery';
   export default {
     name:'DetailBox', //点开详情的盒子
     data(){
+      const {detailInfo,detailShow} = this.$store.state;
       return{
         msg:"胸痛详情",
-        privateData:{},
+        data:detailInfo,
+        // privateData:{},
+        privateData:detailInfo.detail||{},
         compFlag:false,
         clearTxt:"是否清空当前已选内容?",
         showToast:false,
         tips:"(请完成病情预问诊可让医生提前了解病情)",
-        checkF:false //详情页有无已选项标识
+        checkF:false, //详情页有无已选项标识
+        show:detailShow
       }
     },
     created(){
-      this.privateData = this.data;
+      // this.privateData = this.data;
     },
     mounted(){
       this.$nextTick(()=>{
@@ -80,12 +84,14 @@
         document.activeElement.scrollIntoViewIfNeeded(true);        
       },
       close(){
-        this.$emit("close");
+        // this.$emit("close");
+        this.$store.commit('setDetail',{detail:{}})
       },
       complete(){//有选中内容才可以点完成#1919
         if(this.checkF){
           this.$refs.detail.saveData();
-          this.$emit("pComplete");
+          // this.$emit("pComplete");
+          this.$store.commit('setDetail',{detail:{}})
         }
       },
       changeCheck(flag){
@@ -105,15 +111,35 @@
         this.showToast = false;
         this.checkF = false;
         // 让detail组件更新
-        // this.privateData = JSON.parse(JSON.stringify(this.data));
-        this.$emit('reload',this.data.id);
+        const type = this.data.moduleType;
+        if(type == moduleCP['symp']){ //症状情况单独处理
+          const id = this.privateData.id;
+          const read = this.$store.state.symptom.datas;
+          const data = read[id];
+          this.$store.commit('setDetail',{detail:data,ppId:null,moduleType:moduleCP['symp']})
+        }
+        
       }
     },
-    props:['data','moduleType','ppId'],
+    // props:['data','moduleType','ppId'],
     components:{
       Detail,
       Toast
-    }
+    },
+    computed: {
+      getStoreItem () {
+        return this.$store.state.detailInfo
+      }
+    },
+    watch: {
+      getStoreItem:{
+        handler(newVal){
+          this.data = newVal;
+          this.privateData = newVal.detail||{};
+        },
+        deep:true
+      }
+    },
   }
 </script>
 <style lang="less" scoped>

+ 1 - 31
src/components/DiagTreat.vue

@@ -9,11 +9,8 @@
         <img class="questionImg" :src="it.url.replace('{imageUrlPrefix}',imgUrl)" v-if="it.url">
         <Label v-if="it.controlType==0" 
               :item="it" 
-              :indx="i" 
               :ppId="it.id"
-              :moduleType="datas.type"
-              dom=".treatper"
-              @setDetail="setDetail"/>
+              :moduleType="datas.type"/>
         <!-- 上传图片 -->
         <UploadImg v-if="it.controlType==4" 
             :item="it" 
@@ -63,14 +60,6 @@
       <span class="back" @click="beBack">{{'返回'+ preName}}</span>
       <span class="next" @click="toNext">{{'进入'+ nextName}}</span>
     </div>
-    <div class="detail" v-if="show">
-    <DetailBox @close="closeDetal" 
-            :data="labelDetail" 
-            :moduleType="datas.type"
-            :ppId="ppId"
-            v-if="labelDetail.questionMapping&&labelDetail.questionMapping.length>0"
-            @pComplete="complete"/>
-    </div>
   </div>
 </template>
 <script type="text/javascript">
@@ -123,25 +112,6 @@
           this.$emit('next');
         }
       },
-      setDetail(obj){
-        this.labelDetail = obj.detail;
-        this.ppId = obj.ppId;
-        this.show = true;
-      },
-      complete(){
-        this.show = false;
-        this.labelDetail = {};
-        this.ppId = null;
-        // 处理明细选中的值
-        this.$nextTick(()=>{
-          this.scroll.refresh()
-        })
-      },
-      closeDetal(){
-        this.show = false;
-        this.labelDetail = {};
-        this.ppId = null;
-      },
       getText(){
         let textArr = this.checkText;
         let msg = "";

+ 1 - 29
src/components/Others.vue

@@ -11,8 +11,7 @@
         <Label v-if="it.controlType==0"
               :item="it"
               :ppId="it.id" 
-              :moduleType="datas.type" 
-              @setDetail="setDetail"/>
+              :moduleType="datas.type"/>
         <!-- 输入框 -->
         <Input v-if="it.controlType==6 || it.controlType==7"
             :item="it"
@@ -55,14 +54,6 @@
       <span class="back" @click="beBack">{{'返回'+ preName}}</span>
       <span class="next" @click="toNext">{{'进入'+ nextName}}</span>
     </div>
-    <div class="detail" v-if="show">
-      <DetailBox @close="closeDetal" 
-              :data="labelDetail" 
-              :moduleType="datas.type"
-              :ppId="ppId"
-              v-if="labelDetail.questionMapping&&labelDetail.questionMapping.length>0"
-              @pComplete="complete"/>
-    </div>
   </div>
 </template>
 <script type="text/javascript">
@@ -117,25 +108,6 @@
           this.$emit('next');
         }
       },
-      setDetail(obj){
-        this.labelDetail = obj.detail;
-        this.ppId = obj.ppId;
-        this.show = true;
-      },
-      complete(){
-        this.show = false;
-        this.labelDetail = {};
-        this.ppId = null;
-        // 处理明细选中的值
-        this.$nextTick(()=>{
-          this.scroll.refresh()
-        })
-      },
-      closeDetal(){
-        this.show = false;
-        this.labelDetail = {};
-        this.ppId = null;
-      },
       updataData(data,id,index){//输入框存值
         let list = this.dtoList;
         for(let i in list){

+ 15 - 50
src/components/Symptom.vue

@@ -47,19 +47,6 @@
       :class="['footer',{'nofoot':chooseSymp.length==0}]"
       @click="toNext"
     >预览并提交病历</div>
-    <div
-      class="detail"
-      v-if="show"
-    >
-      <DetailBox
-        @close="closeDetal"
-        :data="labelDetail"
-        :moduleType="1"
-        v-if="labelDetail.questionMapping&&labelDetail.questionMapping.length>0"
-        @pComplete="complete"
-        @reload="reload"
-      />
-    </div>
     <Toast
       :message="delText"
       :show="showToast"
@@ -94,7 +81,7 @@ export default {
       sexType: pathInfo.patientSex == '男' ? 1 : (pathInfo.patientSex == '女' ? 2 : 3),
       deptName: pathInfo.selfDeptName,
       hosCode: pathInfo.hospitalCode,
-      show: false, //显示明细
+      // show: false, //显示明细
       chooseSymp: choose, //已选症状
       symp: [], //症状
       labelDetail: {}, //明细
@@ -184,24 +171,19 @@ export default {
             this.labelDetail = result.data;
             this.$store.commit('setOrigin', { type: moduleCP['symp'], data: result.data });
             if (mapping && mapping.length > 0) {
-              this.show = true;
+              this.$store.commit('setDetail',{detail:result.data,ppId:null,moduleType:moduleCP['symp']})
               if(flg){
                 return
               }
               this.chooseSymp.push(item);
-            } else { //没有详情,推送
-              const sympText = this.getSympText();
-              this.getPush(sympText);
+            } else { 
               this.chooseSymp.push(item);
               this.searchShow = false
-              // this.complete()
             }
           }
         })
-      } else {//没有questionId或id 则直接调推送
+      } else {//没有questionId或id 
         this.chooseSymp.push(item);
-        const sympText = this.getSympText();
-        this.getPush(sympText);
         this.checkText = this.$store.state.symptom.text;
       }
 
@@ -228,13 +210,6 @@ export default {
         }
       })
     },
-    closeDetal() {
-      // 推理 
-      const sympText = this.getSympText();
-      this.getPush(sympText);
-      this.show = false;
-      this.questId = null;
-    },
     deletSymp(item, index) {
       this.delIndex = index;
       this.questId = item.questionId || item.id || item.conceptId;
@@ -251,8 +226,7 @@ export default {
       this.$store.commit('setDatas', { type: moduleCP['symp'], pId: this.questId ,data:''})
       // 删除完-常见;其他-推送
       if (this.chooseSymp.length > 0) {
-        const sympText = this.getSympText();
-        this.getPush(sympText);//删除后重新调推理-入参:拼好的内容
+
       } else {
         // 全部删除完 重新走问诊流程
         // this.$router.push("/")
@@ -267,38 +241,29 @@ export default {
       this.questId = null;
       this.delText = "是否删除该信息?<br/>(已填内容将清除)";
     },
-    complete() {//明细填写完成
-      this.searchShow = false;
-      this.checkText = this.$store.state.symptom.text;
-      this.show = false;
-      this.questId = null;
-      // 推理 
-      const sympText = this.getSympText();
-      this.getPush(sympText);
-      this.$nextTick(()=>{
-        this.scroll.refresh()
-      })
-    },
     showChecked(item) {
       const origin = this.$store.state.symptom.origin;
       const read = this.$store.state.symptom.datas;
       const data = read[(item.questionId||item.id)] || origin[(item.questionId||item.id)];
       if (data&&data.questionMapping && data.questionMapping.length > 0) {
-        this.labelDetail = data;
-        this.show = true;
+        this.$store.commit('setDetail',{detail:data,ppId:null,moduleType:moduleCP['symp']})       
       }
     },
-    reload(id) {//清空重新赋值
-      const read = this.$store.state.symptom.datas;
-      const data = read[id];
-      this.labelDetail = data;
-    }
   },
   components: {
     DetailBox,
     Toast,
     Search
   },
+  watch:{
+    checkText:{//更新推送
+      handler(newVal,oldVal){
+        const sympText = this.getSympText();
+        this.getPush(sympText);
+      },
+      deep:true
+    }
+  }
 }
 </script>
 <style lang="less" scoped>

+ 8 - 1
src/components/TabPage.vue

@@ -59,6 +59,10 @@
         @back="beBack" 
       />
     </div>
+    <!-- 详情页 -->
+    <div class="detail" v-if="this.$store.state.detailShow">
+    <DetailBox />
+    </div>
   </div>
 </template>
 <script type="text/javascript">
@@ -69,6 +73,7 @@ import Others from './Others.vue';
 import Preview from './Preview.vue';
 import {moduleConfig,moduleCP} from '../utils/tools.js';
 import $ from 'jquery';
+import DetailBox from './DetailBox.vue';
 export default {
   name: 'TabPage',
   data() {
@@ -196,11 +201,13 @@ export default {
     DiagTreat,
     Others,
     AddContent,
-    Preview
+    Preview,
+    DetailBox
   }
 }
 </script>
 <style lang="less" scoped>
+@import '../less/base.less';
 .tab-wrap {
   width: 100%;
   height: 100%;

+ 12 - 1
src/store.js

@@ -33,7 +33,9 @@ const store = new Vuex.Store({
       txt:'',
       txtDoc:''
     },
-    loadingShow:false
+    loadingShow:false,
+    detailInfo:{},
+    detailShow:false
   },
   mutations:{
     initAllData(state){
@@ -63,6 +65,15 @@ const store = new Vuex.Store({
         txtDoc:''
       }
     },
+    setDetail(state,param){//明细
+      const detail = param.detail;
+      if(JSON.stringify(detail)=='{}'){
+        state.detailShow = false;
+      }else{
+        state.detailInfo = Object.assign({},param);
+        state.detailShow = true;
+      }
+    },
     setDataAll(state,param){
       let res = state.allMoudles
       for(let i = 0;i<res.length;i++){