فهرست منبع

Merge remote-tracking branch 'origin/IE_test' into dev/new1

# Conflicts:
#	src/common/components/InlineTag/index.less
#	src/config/index.js
zhouna 6 سال پیش
والد
کامیت
14f3ee1688

+ 13 - 2
src/common/components/EditableSpan/index.jsx

@@ -146,6 +146,7 @@ class EditableSpan extends Component{
 
   handleKeydown(e){
     const ev = e||window.event;
+    const {i} = this.props;
     const target = ev.target||ev.srcElement;
     let innerVal = target.innerText;
     //禁止回车事件
@@ -160,17 +161,27 @@ class EditableSpan extends Component{
     let range = window.getSelection();
     let textIndex = range.focusOffset;
     let textLength = range.anchorNode.length;
-    if(ev.keyCode==37){//向左
+    if(ev.keyCode==37&& i!=0){//向左
       let preObj = $(this.$span.current).prev();
       let obj = preObj[0]&&preObj[0].nodeName=="DIV"?preObj.prev():preObj;
       if(textIndex == 0){
+        if(ev.preventDefault){//阻止默认事件
+          ev.preventDefault();
+        }else{
+          ev.returnValue=false;
+        } 
         this.moveEnd(obj[0]);
       }
     }
     if(ev.keyCode==39){//向右
       let nextObj = $(this.$span.current).next();
       let obj = nextObj[0]&&nextObj[0].nodeName=="DIV"?nextObj.next():nextObj;
-      if(textIndex == textLength){
+      if(textIndex == textLength || textLength==undefined){
+        if(ev.preventDefault){//阻止默认事件
+          ev.preventDefault();
+        }else{
+          ev.returnValue=false;
+        }
         obj.focus();
       }
     }

+ 8 - 2
src/common/components/ItemBox/index.jsx

@@ -1,6 +1,6 @@
 import React,{Component} from 'react';
 import style from './index.less';
-import {isIE} from '@utils/tools.js';
+import {isIE,handleEnter} from '@utils/tools.js';
 import $ from 'jquery';
 /***
  * author:zn@2018-11-13
@@ -38,6 +38,12 @@ class ItemBox extends Component {
     }
   }
 
+  /*componentWillReceiveProps(next){
+    if(this.props.value && next.value!=this.props.value){
+      this.$div.current.innerText?(this.$div.current.innerText = next.value||''):(this.$div.current.innerHTML = next.value||'');
+    }
+  }*/
+
   componentDidMount(){
     if(isIE()){
       $(this.$div.current).onIe8Input(function(e){
@@ -50,7 +56,7 @@ class ItemBox extends Component {
     const {title,children,editable,className,handleFocus,onchange,fuzhen,border,handleBlur,titleTop,backgroundColor,boxId} = this.props;
     return <div className={style["box"]+" "+"clearfix"} >
       <div className={style["title"] + ' '+(className||'')} style={{marginTop:titleTop?'22px':''}}>{title}</div>
-      <div ref={this.$div} className={`${style["content"]} ${border?style["border"]:''} ${backgroundColor?style["noBorder"]:''}`} contentEditable={editable} style={this.getBoxStyle()} onFocus={handleFocus} onInput={this.handleInput} onClick={(e)=>{this.handleClick(e);}} onBlur={handleBlur} id={boxId}>
+      <div ref={this.$div} className={`${style["content"]} ${border?style["border"]:''} ${backgroundColor?style["noBorder"]:''}`} contentEditable={editable} style={this.getBoxStyle()} onFocus={handleFocus} onInput={this.handleInput} onClick={(e)=>{this.handleClick(e);}} onBlur={handleBlur} id={boxId} onkeydown={handleEnter}>
         {fuzhen?children||fuzhen:children}
       </div>
     </div>

+ 8 - 2
src/common/less/variables.less

@@ -97,6 +97,8 @@
   text-align: center;
   cursor: pointer;
   margin-left: 22px;
+  position: relative;
+  bottom: -10px;
 }
 .confirm{
   width: 120px;
@@ -104,13 +106,17 @@
   line-height: 44px;
   color:@blue;
   font-size: 12px;
-  border: 1px solid @blue;
+  // border: 1px solid @blue;
   background: #fff;
   margin-left: 20px;
   float: right;
   outline: none;
-  text-align: center;
+  text-align: right;
   cursor: pointer;
+  font-weight: bold;
+  position: relative;
+  bottom: -10px;
+  padding-right: 10px;
 }
 :global(.red){
   color: @red;

+ 3 - 3
src/components/CommonSymptom/index.jsx

@@ -48,13 +48,13 @@ class CommonSymptom extends Component{
     const id = item.questionId
     if(ids.includes(id)){
       ids.splice(ids.indexOf(id),1);
-      let selectData = select;
+      let selectData = select;  
       select.forEach((it,i)=>{
-        if(it.id==id){
+        if(it.questionId==id){
          selectData.splice(i,1); 
         }
       })
-      select = selectData;
+      select = selectData; 
     }else{
       ids.push(id);
       select.push(item);

+ 3 - 0
src/components/CommonSymptom/index.less

@@ -37,11 +37,14 @@
   .clear{
     .clear;
     margin-left: 15px;
+    bottom: 0;
   }
   .confirm{
     .confirm;
     width: 75px;
     margin-left: 15px;
+    bottom: 0;
+    padding-right: 20px;
   }
   .oper{
     margin-top: 5px;

+ 1 - 1
src/components/CurrentIll/index.jsx

@@ -105,7 +105,7 @@ class CurrentIll extends Component{
       }
       leftL = ele.offsetLeft+90
     }
-    console.log(getPageCoordinate(e).boxTop)
+    // console.log(getPageCoordinate(e).boxTop)
     getSearchLocation(getPageCoordinate(e).boxTop,leftL)
     this.setState({
       // boxLeft:getPageCoordinate(e).boxLeft,

+ 3 - 3
src/components/MainSuit/index.jsx

@@ -233,16 +233,16 @@ class MainSuit extends Component{
   handleBlur(e){//隐藏常见症状下拉、存自由输入的值
     const {freeText,saveText,datas,clearSearch,getSymptomFeature,currentData} = this.props;
     const that = this;
+    const ev = e || window.event;
     let data = this.state.inpText;
     if(!isIE()){
       if(currentData&&currentData.length==0){//现病史没有模板的时候才去获取
-        getSymptomFeature && getSymptomFeature(e.target.innerText);
+        getSymptomFeature && getSymptomFeature(ev.target.innerText);
       } 
-      e.target.innerText?(e.target.innerText=""):(e.target.innerHTML="")
+      ev.target.innerText?(ev.target.innerText=""):(ev.target.innerHTML="")
       freeText && freeText(data.trim());
     }else{
       if(datas.length==0){
-        const ev = e || window.event;
         const data = ev.target.innerText;
         // freeText && freeText(data.trim());
         freeText && freeText(data);

+ 1 - 1
src/config/index.js

@@ -19,7 +19,7 @@ export default {
     },
     textId:'text',        //自由文本标签的id,
     textLabel:'{"tagType":"8","id":"","name":""}',
-    _textLabel:'{"tagType":"8","id":"","name":","}',//查体每个标签后面加逗号(1-29
+    _textLabel:'{"tagType":"8","id":"","name":","}',//查体每个标签后面加逗号(1-29/改成中文逗号3-18
     tagType:"8",
     tongYId:7,      //主诉通用特征描述id
     addSId:8,      //主诉添加症状id

+ 22 - 10
src/store/actions/currentIll.js

@@ -174,7 +174,7 @@ export const setData = (state,action) =>{
               if(items.length==0){//没有尾巴时给症状后加逗号(3.5)
                 for(let j=0; j<newMainCopy.length; j++){
                   if(newMainCopy[j].id==mainCopy[k].id){
-                    newMainCopy[j].value = newMainCopy[j].name = mainCopy[k].value+',';
+                    newMainCopy[j].value = newMainCopy[j].name = mainCopy[k].value+'';
                   }
                 }
               }       
@@ -222,7 +222,7 @@ export const setData = (state,action) =>{
               if(items.length==0){//没有尾巴时给症状后加逗号(3.5)
                 for(let j=0; j<newWiths.length; j++){
                   if(newWiths[j].id==mainCopy[d].id){
-                    newWiths[j].value = newWiths[j].name = withs[d].value+',';
+                    newWiths[j].value = newWiths[j].name = withs[d].value+'';
                   }
                 }
               }
@@ -269,7 +269,7 @@ export const setData = (state,action) =>{
               if(items.length==0){//没有尾巴时给症状后加逗号(3.5)
                 for(let j=0; j<featureData.length; j++){
                   if(featureData[j].id==symptomFeature[k].id){
-                    featureData[j].value = featureData[j].name = symptomFeature[k].value+',';
+                    featureData[j].value = featureData[j].name = symptomFeature[k].value+'';
                   }
                 }
               }
@@ -622,7 +622,7 @@ export function setCheckText(state,action) {
 //搜索 插入标签数据
 export function insertLabelData(state,action){
   let res = Object.assign({},state); 
-  const {index,data,isReplace,span}=action;console.log('现病史搜索数据',action);
+  const {index,data,isReplace,span}=action;
   let id = data.id;
   let searchData = action.name;
   // res.symptomIds.push(id);
@@ -720,11 +720,23 @@ export function insertLabelData(state,action){
       res.saveText = fullfillText(resData).saveText;
     }else{//标签
       if(strIndex < 1){//前
-        res.data.splice(focusIndex,0,data,textEmpty);
-        res.saveText.splice(focusIndex,0,'','');
-        res.selecteds.splice(focusIndex,0,null,null);
-        res.data[focusIndex+1].value = value;
-        res.saveText[focusIndex+1] = value;
+        // 判断前一个是否为文本标签,是直接插入标签,不是则在前面插入一个空文本标签
+        const preItem = res.data[focusIndex-1];
+        if(preItem&&preItem.tagType==8){
+          res.data.splice(focusIndex,0,data);
+          res.saveText.splice(focusIndex,0,'','');
+          res.selecteds.splice(focusIndex,0,null,null);
+          res.data[focusIndex+1].value = value;
+          res.saveText[focusIndex+1] = value;
+        }else{
+          res.data.splice(focusIndex,0,textEmpty,data);
+          res.saveText.splice(focusIndex,0,'','');
+          res.selecteds.splice(focusIndex,0,null,null);
+          res.data[focusIndex+2].value = value;
+          res.saveText[focusIndex+2] = value;
+        }
+        // res.data.splice(focusIndex,0,data,textEmpty);
+        
       }else{
         res.data.splice(focusIndex+1,0,data,textEmpty);
         res.saveText.splice(focusIndex+1,0,'','');
@@ -738,7 +750,7 @@ export function insertLabelData(state,action){
     // res.saveText = fullfillText(resData).saveText;
   }
   res.searchData = [];    //选中清空搜索内容(即关闭搜索弹窗)
-  res.update = Math.random();
+  res.update = Math.random();//console.log('现病史',res);
   return res;
 }
 

+ 6 - 4
src/store/actions/mainSuit.js

@@ -98,7 +98,7 @@ export const insertMain = (state,action) => {
   if(items.length>1){
     for(let i=1; i<items.length; i++){
       items[i].name = '、'+items[i].name;
-      items[i].value = '、'+items[i].value;
+      items[i].value = items[i].value?'、'+items[i].value:items[i].name;
     } 
   }
   let obj = [];
@@ -111,13 +111,14 @@ export const insertMain = (state,action) => {
         inserIndx = i;
       }
     })
-  data.splice(inserIndx-1,1,...obj);
+  // data.splice(inserIndx-1,1,...obj);
+  // 防止没有flag的情况下报错,找不到flag就插到最后
+  inserIndx?data.splice(inserIndx-1,1,...obj):data.splice(-1,0,...obj);
   // data[inserIndx-1] = text;//替换空标签
   res.data = data;
   res.saveText = [];//将手动输入的值清掉
   // res.saveText[inserIndx] = text.name;
   res.saveText = fullfillText(res.data).saveText;
-  // res.mainIds.push(id);
   res.mainIds = res.mainIds.concat(id);
   res.editClear = false;//主诉框编辑状态
   res.update=Math.random();
@@ -309,7 +310,7 @@ export const insertSearch = (state,action)=>{
       }
     })
     // flag=1前是文本标签就替换,否则插入
-    const iftext = moduleData[inserIndx-1].tagType;
+    const iftext = inserIndx?moduleData[inserIndx-1].tagType:null;
     if(iftext==config.tagType){
        moduleData.splice(inserIndx-1,1,{id:id,name:searchData,value:searchData,tagType:config.tagType,exist:1});
      }else{
@@ -586,6 +587,7 @@ export const saveFreeVal = (state,action)=>{
     res.saveText = [];
   }*/
   // res.update = Math.random();
+  // console.log(666,action,res);
   return res;
 }