Преглед на файлове

血压标签禁止回车、homepage的for-in循环及部分样式修改

liucf преди 6 години
родител
ревизия
b7bfe2b0f9

+ 3 - 1
src/common/less/variables.less

@@ -53,9 +53,11 @@
 /*******下拉框公用样式**********/
 .pop{
   position: absolute;
-  top:40px;
+  // top:40px;
+  top:30px;
   background: #fff;
   box-shadow: 0 10px 20px 0 #989DA3;
+  filter:progid:DXImageTransform.Microsoft.Shadow(color='#CCCCCC',Direction=125,Strength=4);
   z-index: 203;
   padding: 20px;
   white-space: nowrap;

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

@@ -76,7 +76,7 @@ class CheckBody extends Component{
     return  <div className={style['container']}>
       <ItemBox title='查体' editable={!data.length}  handleClick={this.handleClick} onchange={this.handleInput}>
         {this.getLabels()}
-        <SearchDrop data={searchData} show={!totalHide} left={boxLeft} top={boxTop} onSelect={this.handleSearchSelect}></SearchDrop>
+        {searchData && searchData.length>0?<SearchDrop data={searchData} show={!totalHide} left={boxLeft} top={boxTop} onSelect={this.handleSearchSelect}></SearchDrop>:''}
       </ItemBox>
     </div>
   }

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

@@ -127,7 +127,8 @@ class MultSpread extends Component{
     return (<div style={{display:'inline-block'}}
                  onDoubleClick={this.changeToEdit}
                  contentEditable={this.state.editable}
-                 onBlur={this.handleEdit}>
+                 onBlur={this.handleEdit}
+                 onkeydown={tools.handleEnter}>
       {textPrefix?<span>{textPrefix}</span>:''}
       <div className={this.getClass()}>
       {this.getLabels()}

+ 1 - 3
src/components/NumberUnitDrop/index.jsx

@@ -48,7 +48,7 @@ class NumberUnitDrop extends Component{
     handleSelect&&handleSelect({ikey,text,suffix,prefix,mainSaveText});
   }
   
-  handleNumClick(e){ 
+  handleNumClick(e){
     e.stopPropagation();
     const {show,handleShow,ikey,id,patId,handleHide,value} = this.props;
     const {hasSelect} = this.state;
@@ -77,7 +77,6 @@ class NumberUnitDrop extends Component{
       // this.$span.current.innerText='';      //修改生成文字变成输入的2倍bug 
       // handleSelect&&handleSelect({ikey,text,suffix,prefix,mainSaveText});
       handleLabelChange&&handleLabelChange({ikey,changeVal:text,suffix,prefix,mainSaveText,type:boxMark});
-      
     }
     this.setState({
       isClosed:false,
@@ -85,7 +84,6 @@ class NumberUnitDrop extends Component{
       hasSelect:false,
       editable:false
     });
-    
   }
 
   handleSpanInp(e){ //数字框输入事件

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

@@ -104,7 +104,7 @@ class OtherHistory extends Component{
     return  <div>
       <ItemBox title='其他史' editable={hasData?false:true} isRead={isRead} handleClick={this.handleClick} handleFocus={this.getData} onchange={this.handleInput}>
         {this.getLabels()}
-        <SearchDrop data={searchData} show={!totalHide} left={boxLeft} top={boxTop} onSelect={this.handleSearchSelect}></SearchDrop>
+        {searchData && searchData.length>0?<SearchDrop data={searchData} show={!totalHide} left={boxLeft} top={boxTop} onSelect={this.handleSearchSelect}></SearchDrop>:''}
       </ItemBox>
     </div>
   }

+ 11 - 2
src/components/SpreadDrop/index.jsx

@@ -35,6 +35,8 @@ class SpreadDrop extends Component{
       ban:{},  //放'伴'字段
       editable:false,      //双击编辑
       labelVal:'',  //存放标签原有的值--主诉字数限制用
+      boxLeft:null,
+      boxTop:null
     };
     this.$div = React.createRef();
     this.handleSelect = this.handleSelect.bind(this);
@@ -51,6 +53,13 @@ class SpreadDrop extends Component{
   }
   handleShow(e){//单击
     e&&e.stopPropagation();
+    let boxLeft = e.pageX -175 + 'px';
+    let offsetTop = e.target.offsetTop;
+    let boxTop = offsetTop + 29 + 'px';
+    this.setState({
+      boxLeft:boxLeft,
+      boxTop:boxTop
+    })
     // window.event? window.event.cancelBubble = true : e.stopPropagation();
     // this.setStateInit();      //恢复初始选中状态
     const {ikey,handleShow,placeholder,flag,id,value,tagType,type} = this.props;
@@ -310,7 +319,7 @@ class SpreadDrop extends Component{
 
   render(){
     const {placeholder,value,show} = this.props;
-    const {editable} = this.state;
+    const {editable,boxLeft,boxTop} = this.state;
     return <div className={style['container']}
             onFocus={(e)=>e.stopPropagation()}
             onBlur={(e)=>e.stopPropagation()}
@@ -325,7 +334,7 @@ class SpreadDrop extends Component{
       onInput={this.onChange}
       onkeydown={handleEnter}
       >{value||placeholder}</div>
-      <div className={style["drop-list"]} style={{display:show?'block':'none'}} contentEditable="false" onClick={(e)=>{e.stopPropagation();}}>
+      <div className={style["drop-list"]} style={{display:show?'block':'none',top:boxTop,left:boxLeft}} contentEditable="false" onClick={(e)=>{e.stopPropagation();}}>
         {this.getLabels()}
         <div className="oper">
           <span className={style['clear']} onClick={this.handleClear}>清空选项</span>

+ 3 - 3
src/containers/NumberUnitDrop.js

@@ -75,7 +75,7 @@ function handleModuleDiff(dispatch,params){
 function mainSuitLabel(dispatch,params){
   const index = params.ikey;
   let ikey = getLabelIndex(index);
-  const {changeVal,totalVal} = params;
+  const {changeVal,totalVal} = params;console.log(11,params);
   dispatch({
     type:CHANGE_LABELVAL,
     data:{changeVal:changeVal,ikey:ikey,totalVal}
@@ -160,7 +160,7 @@ function mapDispatchToProps(dispatch,store){
       });*/
     },
     handleLabelChange(params){
-      const {type} = params;
+      const {type} = params;console.log(2,type);
       switch (+type){
         case 1:
           mainSuitLabel(dispatch,params);
@@ -179,7 +179,7 @@ function mapDispatchToProps(dispatch,store){
       dispatch({
         type: ISREAD
       });
-      console.log("更新可编辑span");
+      console.log("更新span");
     }
   }
 }

+ 1 - 1
src/containers/SpreadDrop.js

@@ -82,7 +82,7 @@ function currentIll(dispatch,store,params){
   let existsId = exists && exists.length>0?getIds(exists):[];
   let withsId = withs && withs.length>0?getIds(withs):[];
   // const ids = existsId.join(",")+withsId.join(",");
-  const ids = (existsId.concat(withsId)).join(",");console.log("点击的下标是:",index,"选中的id是:",ids)
+  const ids = (existsId.concat(withsId)).join(",");
   let has = [],wes=[];
   //获取选中项目模板
   fetchModules(ids).then((res)=>{

+ 1 - 1
src/containers/eleType.js

@@ -35,7 +35,7 @@ export function singleRadio(params){
                         ikey={showInx}
                         hideTag={hideTag}></RadioDrop>;
     case 3:
-      return <EditableSpan {...params} value={data.value||data.name} update={Math.random()}/>;
+      return <EditableSpan {...params} value={data.value||data.value==''?data.value:data.name} update={Math.random()}/>;
     case 5://带单位数字键盘
       return <NumberUnitDrop prefix={data.labelPrefix}
                          suffix={data.labelSuffix}

+ 5 - 2
src/store/actions/checkBody.js

@@ -166,11 +166,14 @@ export const changeLabelVal = (state,action)=>{//双击标签输入改变值
   const index = action.data.ikey;
   const newVal = action.data.changeVal;     //下拉修改的内容
   const totalVal = action.data.totalVal;    //包含前后缀修改的内容
+  let labText = totalVal?totalVal:newVal;
   let item = res.data[index];
-  if(newVal.trim()){
+  // if(newVal && newVal.trim()){
+  if(labText && labText.trim()){
     if(item){
       item.value = newVal;
-      res.saveText[index] = totalVal;
+      // res.saveText[index] = totalVal;
+      res.saveText[index] = labText;
     }
   }else{//删除完标签内容则删除该标签
     res.data.splice(index,1);

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

@@ -69,9 +69,13 @@ export const setData = (state,action) =>{
   let newMain = [];
   let mainLabelModule = res.mainLabelModule;//主诉选中的症状id获取到的模板
   let objToArr = [];
-  for(let m in mainLabelModule){
-    objToArr.push(mainLabelModule[m]);
+  let keyArr = Object.keys(mainLabelModule); 
+  for(let i=0; i<keyArr.length; i++){
+    objToArr.push(mainLabelModule[JSON.parse(keyArr[i])]);
   }
+  /*for(let m in mainLabelModule){
+    objToArr.push(mainLabelModule[m]);
+  }*/
   // 过滤掉没有mapping的数据
   let mainLabelModuleArr = objToArr;
   /*let mainLabelModuleArr = objToArr.filter((item)=>{

+ 18 - 6
src/store/actions/homePage.js

@@ -14,9 +14,13 @@ export const showDrop=(state,action)=>{
   const {ikey} = action.data;
   let obj = res.showDrop||{};
   let temp = Object.assign({},obj);
-  for(let i in obj){
+  let keyArr = Object.keys(obj); 
+  for(let i=0; i<keyArr.length; i++){
+    temp[JSON.parse(keyArr[i])] = false;
+  }
+  /*for(let i in obj){
     temp[i] = false;
-  };
+  };*/
   res.showDrop = Object.assign(temp,{[ikey]:action.show!==undefined?action.show:true});
   res.update=Math.random();
 
@@ -28,9 +32,13 @@ export const confirmHide=(state,action)=>{
   let res = Object.assign({},state);
   let obj = res.showDrop||{};
   let temp = Object.assign({},obj);
-  for(let i in obj){
+  let keyArr = Object.keys(obj); 
+  for(let i=0; i<keyArr.length; i++){
+    temp[JSON.parse(keyArr[i])] = false;
+  }
+  /*for(let i in obj){
     temp[i] = false;
-  };
+  };*/
   res.showDrop = temp;
   res.commSymHide = true;
   res.update=Math.random();
@@ -73,9 +81,13 @@ export const setLabelToEdit = (state,action)=>{
   const {ikey} = action.data;
   let obj = res.editState||{};
   let temp = Object.assign({},obj);
-  for(let i in obj){
+  let keyArr = Object.keys(obj); 
+  for(let i=0; i<keyArr.length; i++){
+    temp[JSON.parse(keyArr[i])] = false;
+  }
+  /*for(let i in obj){
     temp[i] = false;
-  };
+  };*/
   res.editState = Object.assign(temp,{[ikey]:action.edit!==undefined?action.edit:true});
   res.update=Math.random();
   return res;

+ 9 - 5
src/store/actions/mainSuit.js

@@ -364,17 +364,21 @@ export const changeLabelVal = (state,action)=>{
   const res = Object.assign({},state);
   const index = action.data.ikey;
   const newVal = action.data.changeVal;
-  let item = res.data[index];
+  let data = res.data;
+  let item = data[index];
   if(newVal.trim()){
     if(item){
       item.value = newVal;
       res.saveText[index] = newVal;
     }
   }else{//删除完标签内容则删除该标签
-    res.data.splice(index,1);
-    res.saveText = fullfillText(res.data).saveText;
-  }  
-  res.update = Math.random();//console.log(44,action,res);
+    
+    data.splice(index,1);
+    // res.data.splice(index,1);
+    // res.saveText = fullfillText(res.data).saveText;
+    res.saveText.splice(index,1);
+  } 
+  res.update = Math.random();
   return res;
 }