Browse Source

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

# Conflicts:
#	src/common/components/EditableSpan/index.jsx
#	src/components/Advice/Textarea/index.jsx
#	src/components/Advice/index.jsx
#	src/components/NumberDrop/index.jsx
#	src/components/NumberUnitDrop/index.jsx
zhouna 6 năm trước cách đây
mục cha
commit
cab14cdb8b

+ 4 - 3
src/common/components/EditableSpan/index.jsx

@@ -185,9 +185,10 @@ class EditableSpan extends Component{
         obj.focus();
       }
     }
-    ele = document.activeElement;
-    boxTop = target.innerText?getPageCoordinate(e).boxTop:$(ele).offset().top+30;
-    setSearchLocation(boxTop,ele.offsetLeft)     //搜索框的位置动态获取
+    // 注释掉,放开会影响删除
+    // ele = document.activeElement;
+    // boxTop = target.innerText?getPageCoordinate(e).boxTop:$(ele).offset().top+30;
+    // setSearchLocation(boxTop,ele.offsetLeft)     //搜索框的位置动态获取
   }  
   handleKeyup(e){
     const {boxMark,handleKeydown,i,value,removeId,handleClear,delSingleLable,setSearchLocation} = this.props;

+ 11 - 4
src/common/components/Textarea/index.jsx

@@ -17,7 +17,7 @@ class Textarea extends Component {
     this.$dom = React.createRef();
     this.handleInput = this.handleInput.bind(this);
     this.handleFocus = this.handleFocus.bind(this);
-    //this.handleBlur = this.handleBlur.bind(this);
+    this.handleBlur = this.handleBlur.bind(this);
   }
   handleFocus(){            //初始显示props中的值,focus已经显示输入的值,避免值更新闪烁
     const {handleFocus,fuzhen,handleInput} = this.props;
@@ -58,7 +58,7 @@ class Textarea extends Component {
     })
 
     //存值到store
-    handleInput&&handleInput({text});
+    // handleInput&&handleInput({text});
     //右侧推送--延时推送
     clearTimeout(stimer);
     let timer = setTimeout(function(){
@@ -84,7 +84,7 @@ class Textarea extends Component {
   componentDidMount(){
     const {value} = this.props;
     if(value){
-      this.$dom.current.innerText?(this.$dom.current.innerText = value||''):(this.$dom.current.innerText=value||'');
+      this.$dom.current.innerText?(this.$dom.current.innerText = value||''):(this.$dom.current.innerHTML=value||'');
     }
     if(isIE()){
       $(this.$dom.current).onIe8Input(function(e){
@@ -92,6 +92,12 @@ class Textarea extends Component {
       },this);
     }
   }
+  handleBlur(){
+    const {handleInput} = this.props;
+    const text = this.$dom.current.innerText||this.$dom.current.innerHTML;
+    //存值到store
+    handleInput&&handleInput({text});
+  }
   render() {
     const { title } = this.props;
     return (
@@ -102,7 +108,8 @@ class Textarea extends Component {
              onFocus={this.handleFocus}
              ref={this.$dom}
              contentEditable={true}
-             onInput={this.handleInput}>
+             onInput={this.handleInput}
+             onBlur={this.handleBlur}>
         </div>
       </div>
     );

+ 1 - 5
src/components/Advice/Textarea/index.jsx

@@ -31,11 +31,7 @@ class Textarea extends Component {
   }
   componentWillReceiveProps(next){
     const isRead = this.props.isRead;
-    // if(next.isRead != isRead && next.value!=this.props.value){      //value对比解决复诊不显示bug
-    //   next.value ? this.$dom.current.innerText = next.value :  ''
-    //   // this.$dom.current.innerText?(this.$dom.current.innerText = next.value||''):(this.$dom.current.innerHTML = next.value||'');
-    // }
-    if(next.isRead != isRead && next.value){      //value对比解决复诊不显示bug
+    if(next.isRead != isRead && next.value!=this.props.value){      //value对比解决复诊不显示bug
       next.value ? this.$dom.current.innerText = next.value :  ''
       // this.$dom.current.innerText?(this.$dom.current.innerText = next.value||''):(this.$dom.current.innerHTML = next.value||'');
     }

+ 2 - 1
src/components/Advice/index.jsx

@@ -101,7 +101,8 @@ class Advice extends Component{
           {scheme}
         </div>}
         <div className={style['billing']} > 
-            <Textarea value={advice.adviceInput} isRead={isRead} handleChangeAssistValue={this.handleAdviceInput} ></Textarea>
+            {!advice.adviceInput && <Textarea value='' isRead={isRead} handleChangeAssistValue={this.handleAdviceInput} ></Textarea>}
+            {advice.adviceInput && <Textarea value={advice.adviceInput} isRead={isRead} handleChangeAssistValue={this.handleAdviceInput} ></Textarea>}
         </div>
       </ItemBox>
     </div>

+ 35 - 18
src/components/NumberUnitDrop/index.jsx

@@ -33,6 +33,8 @@ class NumberUnitDrop extends Component{
       tmpScroll:0
     };
     this.$span = React.createRef();
+    this.$pre = React.createRef();
+    this.$suf = React.createRef();
     this.$cont = React.createRef();
     this.select = this.select.bind(this);
     this.numInpBlur = this.numInpBlur.bind(this);
@@ -41,7 +43,7 @@ class NumberUnitDrop extends Component{
     this.changeToEdit = this.changeToEdit.bind(this);
   }
   select(obj){         //选中键盘上数字事件
-    const {handleSelect,ikey,suffix,prefix,mainSaveText,formulaCode} = this.props;
+    const {handleSelect,ikey,suffix,prefix,mainSaveText,formulaCode,mainData} = this.props;
     this.setState({
       hasSelect:true
     });
@@ -50,7 +52,7 @@ class NumberUnitDrop extends Component{
         value:''
       });
     }
-    handleSelect&&handleSelect({ikey,text:obj.text,suffix,prefix,mainSaveText,mark:obj.mark,formulaCode});
+    handleSelect&&handleSelect({ikey,text:obj.text,suffix,prefix,mainSaveText,mark:obj.mark,formulaCode,mainData});
   }
   
   handleNumClick(e){ 
@@ -85,13 +87,20 @@ class NumberUnitDrop extends Component{
   //数字框失焦,保存值到store中
   numInpBlur(e){
     e.stopPropagation();
-    const {handleSelect,ikey,suffix,prefix,mainSaveText,handleLabelChange,boxMark,formulaCode} = this.props;
+    // const {handleSelect,ikey,suffix,prefix,mainSaveText,handleLabelChange,boxMark,formulaCode} = this.props;
+    const {handleSelect,ikey,mainSaveText,handleLabelChange,boxMark,formulaCode} = this.props;
     const {editable} = this.state;
     if(editable){
-      const text = e.target.innerText || e.target.innerHTML;
+      // const text = e.target.innerText || e.target.innerHTML;
       // this.$span.current.innerText='';      //修改生成文字变成输入的2倍bug 
+      let totalVal = e.target.innerText|| e.target.innerHTML;
+      let changeVal = this.$span.current.innerText.replace(/^\s*/,'');//数字框值-修改后;去掉前空格避免多空格叠加
+      let prefix = this.$pre.current.innerText.replace(/^\s*/,''); //前缀值-修改后
+      let suffix = this.$suf.current.innerText.replace(/^\s*/,''); //后缀值-修改后
+      // console.log('数字框:'+changeVal,";全部:"+totalVal,";前缀:"+prefix+";后缀:"+suffix);
+      handleLabelChange && handleLabelChange({ikey,changeVal,type:boxMark,totalVal,prefix,suffix,formulaCode});
       // handleSelect&&handleSelect({ikey,text,suffix,prefix,mainSaveText});
-      handleLabelChange&&handleLabelChange({ikey,changeVal:text,suffix,prefix,mainSaveText,type:boxMark,formulaCode});
+      // handleLabelChange&&handleLabelChange({ikey,changeVal:text,suffix,prefix,mainSaveText,type:boxMark,formulaCode});
       
     }
     this.setState({
@@ -143,9 +152,13 @@ class NumberUnitDrop extends Component{
   }
   changeToEdit(e){        //整个标签双击编辑状态
     e.stopPropagation();
-    const {value,id,handleDbclick,patId} = this.props;
+    const {value,id,handleDbclick,patId,handleHide,show} = this.props;
     const text = e.target.innerText || e.target.innerHTML;
-    // clearTimeout(this.state.timer);//取消延时的单击事件
+    clearTimeout(this.state.timer);//取消延时的单击事件
+    e.preventDefault();
+    if(show){
+      handleHide&&handleHide();
+    }
     if(value&&value.trim()) {//有选中值的标签才能双击编辑
       this.setState({
         editable: true,
@@ -153,7 +166,8 @@ class NumberUnitDrop extends Component{
       });
       //失焦关闭编辑状态
       setTimeout(()=>{
-        e.target.focus();
+        // e.target.focus();
+        this.$cont.current.focus();
       })
       //双击埋点记录
       handleDbclick && handleDbclick({id:patId||id});
@@ -161,7 +175,8 @@ class NumberUnitDrop extends Component{
   }
   componentDidMount(){
     if(isIE()){
-      $(this.$span.current).onIe8Input(function(e){
+      // $(this.$span.current).onIe8Input(function(e){
+      $(this.$cont.current).onIe8Input(function(e){
         this.handleSpanInp(e)
       },this);
     }
@@ -170,17 +185,19 @@ class NumberUnitDrop extends Component{
   render(){
     const {placeholder,prefix,suffix,show,value,handleHide} = this.props;
     const {numEditable,editable,hasSelect,placeholderFlag,boxLeft,boxTop} = this.state;
-    return <div className={this.getClasses()} ref={this.$cont}>
-      <span>{prefix}</span>
-      <span onClick={this.handleNumClick}
-            contentEditable={editable}
-            ref = {this.$span}
-            onBlur={this.numInpBlur}
-            onInput={this.handleSpanInp}
-            onDoubleClick={this.changeToEdit}
+    return <div className={this.getClasses()}
+                ref={this.$cont}
+                onClick={this.handleNumClick}
+                contentEditable={editable}
+                onBlur={this.numInpBlur}
+                onDoubleClick={this.changeToEdit}
+                onkeydown={handleEnter}
+                onInput={this.handleSpanInp}>
+      <span ref = {this.$pre}>{prefix?prefix+' ':prefix}</span>
+      <span ref = {this.$span}
             onkeydown={handleEnter}
             style={{cursor:editable?'text':'pointer'}}>{value||placeholder}</span>
-      <span>{suffix}</span>
+      <span ref = {this.$suf}>{suffix?' '+suffix:suffix}</span>
       <NumberUnitPan handleSelect={(obj)=>this.select(obj)}
                  onClose={handleHide}
                  top={boxTop}

+ 1 - 1
src/config/index.js

@@ -26,7 +26,7 @@ export default {
     addOthSId:21,      //现病史 添加其他症状id
     banId:10,       //伴 id
     limited:30,    //主诉限制字数
-    limitText:"已超过30字符,请修改主诉",    //主诉限制提示
+    limitText:"已超过30字符(含标点),请修改主诉",    //主诉限制提示
     delayTime:500,      //延迟搜索的时间
     delayPushTime:1000,    //延迟推送时间
     pushDelay:1000,

+ 24 - 8
src/containers/NumberUnitDrop.js

@@ -15,6 +15,7 @@ import config from '@config/index.js';
 function mapStateToProps(state){
   return {
     mainSaveText:state.mainSuit.saveText,
+    mainData:state.mainSuit.data,
   }
 }
 //查体数字键盘选中
@@ -47,13 +48,22 @@ function currentSelect(dispatch,params){
 }
 
 function handleModuleDiff(dispatch,params){
-  const {mainSaveText,mark} = params;
+  const {mainSaveText,mark,mainData} = params;
   const type = params.ikey.substr(0,1);    //当前所在的项目
+  let ikey = getLabelIndex(params.ikey);
   switch (+type){
     case 1:
       if(mark){//选中才限制,清空和回退无需验证
-        let text = filterDataArr(mainSaveText);
-        if(text.length >= config.limited){
+        // let text = filterDataArr(mainSaveText);
+        let text = filterArr(mainSaveText);
+        const item = mainData[+ikey];
+        const nextItem = mainData[+ikey+1];
+        let lengths = text.length;
+        if(nextItem&&nextItem.tagType==8 && nextItem.tagName==',' && item.value){
+          lengths = text.length + 1;
+        }
+        // console.log(999,mainSaveText,lengths);
+        if(lengths >= config.limited){
           Notify.info(config.limitText);
           return
         }
@@ -80,7 +90,8 @@ function mainSuitLabel(dispatch,params){
   const {changeVal,totalVal} = params;
   dispatch({
     type:CHANGE_LABELVAL,
-    data:{changeVal:changeVal,ikey:ikey,totalVal}
+    // data:{changeVal:changeVal,ikey:ikey,totalVal}
+    data:Object.assign({},params,{ikey})
   })
 }
 // 现病史
@@ -89,7 +100,8 @@ function currentLabel(dispatch,params){
   let ikey = getLabelIndex(index);
   dispatch({
     type:CURRENT_TEXT_LABEL,
-    data:{changeVal:params.changeVal,ikey:ikey}
+    // data:{changeVal:params.changeVal,ikey:ikey}
+    data:Object.assign({},params,{ikey})
   })
 }
 
@@ -100,7 +112,8 @@ function otherHisLabelEdit(dispatch,params){
   let ikey = getLabelIndex(index);
   dispatch({
     type:CHANGEOTHERTEXTLABEL,
-    data:{changeVal:changeVal,ikey:ikey,totalVal}
+    // data:{changeVal:changeVal,ikey:ikey,totalVal}
+    data:Object.assign({},params,{ikey})
   })
 }
 
@@ -111,7 +124,8 @@ function checkBodyLabelEdit(dispatch,params){
   const {changeVal,totalVal} = params;
   dispatch({
     type:CHANGECHECKTEXTLABEL,
-    data:{changeVal:changeVal,ikey:ikey,totalVal}
+    // data:{changeVal:changeVal,ikey:ikey,totalVal}
+    data:Object.assign({},params,{ikey})
   })
 }
 function mapDispatchToProps(dispatch,store){
@@ -131,7 +145,9 @@ function mapDispatchToProps(dispatch,store){
           type:ISREAD
         })
       }
-      
+      dispatch({
+        type: ISREAD
+      });
     },
     handleDbclick(obj){
       dispatch({

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

@@ -174,7 +174,8 @@ 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+',';
+                    newMainCopy[j].value = newMainCopy[j].name = mainCopy[k].value||mainCopy[k].name+',';
                   }
                 }
               }       
@@ -221,8 +222,9 @@ export const setData = (state,action) =>{
               withLengArr[d] = items.length;
               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+',';
+                  if(newWiths[j].id==withs[d].id){
+                    // newWiths[j].value = newWiths[j].name = withs[d].value+',';
+                    newWiths[j].value = newWiths[j].name = withs[d].value||withs[d].name+',';
                   }
                 }
               }
@@ -269,7 +271,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||symptomFeature[k].name+',';
                   }
                 }
               }

+ 14 - 14
src/store/actions/mainSuit.js

@@ -521,29 +521,29 @@ export const setRadioInputValue = (state,action)=>{
 //双击标签输入改变值
 export const changeLabelVal = (state,action)=>{
   const res = Object.assign({},state);
-  const index = parseInt(action.data.ikey);
-  const newVal = action.data.changeVal;
-  let data = res.data;
-  let item = data[index];
+  const {changeVal,totalVal,ikey,prefix,suffix} = action.data;
+  const index = ikey;
+  const newVal = changeVal;
+  let item = res.data[index];
   const next = res.data[+index+1];
   const nextVal = next.value||next.name;
   //标签后是不是标点符号标签,是的话删除本标签时一起删除
   let nextIsDot = +next.tagType===8&&!nextVal.match(config.punctuationReg);
-  // if(newVal&&newVal.trim()){//时间单位传空--键盘输入
-  if(newVal){
+  let labText = totalVal?totalVal:newVal;
+  if(labText.trim()){
     if(item){
       item.value = newVal;
-      res.saveText[index] = newVal;
+      item.labelPrefix = prefix||'';
+      item.labelSuffix = suffix||'';
+      res.saveText[index] = labText;
     }
   }else{//删除完标签内容则删除该标签
     const num = nextIsDot?2:1;
-    data.splice(index,num);
-    // data[index].value = "";
-    // res.data.splice(index,1);
-    res.saveText.splice(index,1);
-    // res.saveText[index] = "";
-  } 
-  res.update = Math.random();
+    res.data.splice(index,num);
+    res.selecteds.splice(index,num);//杂音类样式选中状态对应
+    res.saveText = fullfillText(res.data).saveText;
+  }
+  res.update = Math.random();//console.log(222,res);
   return res;
 }
 

+ 1 - 1
src/store/actions/otherHistory.js

@@ -284,7 +284,7 @@ export function changeTextLabel(state,action) {
     res.selecteds.splice(index,num);//杂音类样式选中状态对应
     res.saveText = fullfillText(res.data).saveText;
   }
-  res.update = Math.random();
+  res.update = Math.random();//console.log(888,res,action);
   return res;
 }
 

+ 8 - 1
src/store/async-actions/homePage.js

@@ -27,7 +27,14 @@ function modulesParseJson(data){
 export const getInitModules= (dispatch,getStore)=>{
   const state = getStore();
   const {message} = state.patInfo;
-  return json(api.getModules,{age:message.patientAge,sexType:message.sex}).then((res) => {
+  const param = {
+    age:message.patientAge,
+    sexType:message.sex,
+    mouduleType:1,//慢病2  科室1 其他0
+    relationId:message.hospitalDeptId, //慢病id  科室id  其他0
+  }
+  // return json(api.getModules,{age:message.patientAge,sexType:message.sex}).then((res) => {
+  return json(api.getModules,param).then((res) => {
       dispatch(initHistoryDetails(message));      //历史病历回读
       if (res.data.code == '0') {
         const newObj = modulesParseJson(res.data.data);

+ 2 - 1
src/store/async-actions/mainSuit.js

@@ -18,7 +18,8 @@ export const getCommSymptoms = ()=>{//获取常见症状
     const params = {
       'deptId':deptCode,
       'age':message.patientAge,
-      'sexType':message.sex
+      'sexType':message.sex,
+      'type':1
     };
     json(api.getCommSymptoms,params).then((res)=>{
         let result = res.data;

+ 2 - 2
src/utils/config.js

@@ -1,7 +1,7 @@
 // const host='http://192.168.3.100:5050';//王峰
 // const host='http://192.168.3.101:5050';//任国宾
-// const host='http://192.168.2.241:5050';//后端接口访问地址
-const host='http://192.168.2.236:5050';//后端接口访问地址
+const host='http://192.168.2.241:5050';//后端接口访问地址
+// const host='http://192.168.2.236:5050';//后端接口访问地址
 //const host='http://192.168.2.164:8080';
 // const host='http://192.168.3.117:8080'; //周铁刚
 // const newIcssVisitUrl = '223.93.170.82:13000';    //icss服务访问地址(跳转目的地),不能加http://