瀏覽代碼

查体重新加载原则修改2781

zhouna 5 年之前
父節點
當前提交
8d3ff00d35
共有 3 個文件被更改,包括 24 次插入12 次删除
  1. 3 3
      src/components/MultSpread/index.jsx
  2. 7 4
      src/store/actions/checkBody.js
  3. 14 5
      src/utils/tools.js

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

@@ -9,7 +9,7 @@ import addIcon from '@images/addItem.png';
 import addIcon1 from '@images/addItem2.png';
 import style from "./index.less";
 import tools from '@utils/tools';
-import {setFontColorSize} from '@utils/tools';
+import {setFontColorSize,handleMouseUp} from '@utils/tools';
 import NumberUnitDrop from '@containers/NumberUnitDrop';
 
 
@@ -255,7 +255,7 @@ class MultSpread extends Component{
     }
   }
   getContClass(){
-    const {isImports,ikey,saveText,isExtBlue,mouseSelect,select_start,i,boxMark} = this.props;
+    const {isImports,ikey,saveText,isExtBlue,mouseSelect} = this.props;
     const labelInx = tools.getLabelIndex(ikey);
     const text = saveText&&saveText[+labelInx];
     const ext = !text&&isExtBlue?style['ext']:'';
@@ -264,7 +264,7 @@ class MultSpread extends Component{
     return classNames(orgBorder,ext,selectedArea);
   }
   render(){
-    const {showAdd,addLabelItem,ikey,copyId,textPrefix,textSuffix,isExtBlue} = this.props;
+    const {showAdd,addLabelItem,ikey,copyId,textPrefix,textSuffix,isExtBlue,select_start,i,boxMark} = this.props;
     return (<div className={this.getContClass()}
                  style={{display:'inline-block'}}
                  onMouseUp={()=>handleMouseUp({select_start,i,boxMark})}

+ 7 - 4
src/store/actions/checkBody.js

@@ -1,5 +1,5 @@
 import config from '@config/index.js';
-import {formatContinueDots,getLabelIndex,handleLocalDelTag,checkFullfillText,shiftLocalDelTag,getValuedLabels,removeRepeat} from '@utils/tools.js';
+import {formatContinueDots,getLabelIndex,handleLocalDelTag,checkFullfillText,shiftLocalDelTag,getLifeLabels,getValuedLabels,removeRepeat} from '@utils/tools.js';
 
 export function preSetCheckbody(state,action) {
   let res = Object.assign({},state);
@@ -340,9 +340,12 @@ export function recoveTag(state,action) {
 
 export function reflashLabels(state,action) {
   let res = Object.assign({},state);
-  const valuedLabels = getValuedLabels(res.data);
-  const newLabels = removeRepeat(valuedLabels,action.data);
-  const addTextsArr = checkFullfillText(newLabels);
+  const newLifeLabels = getLifeLabels(action.data);     //新生命体征标签
+  const oldLifeLabels = getLifeLabels(res.data);     //旧生命体征标签
+  const oldValuedLabels = getValuedLabels(res.data);    //旧已填值标签
+  const lifeLabels = removeRepeat(newLifeLabels,oldLifeLabels);   //将被保留的生命体征标签
+  const newUnlifeLabels = getLifeLabels(action.data,true);    //新非生命体征标签
+  const addTextsArr = checkFullfillText([...lifeLabels,...oldValuedLabels,...newUnlifeLabels]);
   res.data = addTextsArr.newArr;
   res.saveText = addTextsArr.saveText;
   res.update = Math.random();

+ 14 - 5
src/utils/tools.js

@@ -1503,16 +1503,24 @@ const setFontColorSize = (flg,pacs) => {
   // }, 0);
 }
 
-//获取查体体征和已选中的标签
+//获取生命体征或非生命体征标签
+function getLifeLabels(arr,flag){     //flag=true获取非生命体征
+  const newArr = arr.filter((it)=>{
+    return flag?+it.specFlag!==4:+it.specFlag===4;
+  });
+  return newArr;
+}
+
+//获取已选中的标签
 function getValuedLabels(arr){
   const newArr = arr.filter((it)=>{
     if(it.tagType=='3'){      //血压类型
-      if(it.questionMapping.findIndex((i)=>i.value!==undefined)!==-1||+it.specFlag===4){
+      if(+it.specFlag!==4&&it.questionMapping.findIndex((i)=>i.value!==undefined)!==-1){
         return true;
       }
       return false;
     }
-    return it.value||+it.specFlag===4;
+    return +it.specFlag!==4&&it.value;
   });
   return newArr;
 }
@@ -1521,8 +1529,8 @@ function getValuedLabels(arr){
 function removeRepeat(arr1,arr2){     //arr1被完全保留的数组
   const arr = arr2.reduce(function(newArr,item){
     const it = newArr.findIndex((i)=>i.id===item.id);
-    if(it===-1){
-      newArr.push(item);
+    if(it!==-1){
+      newArr.splice(it,1,item);
     }
     return newArr;
   },[...arr1]);
@@ -1593,6 +1601,7 @@ module.exports = {
     setFontColorSize,
     moveEnd,
     setFontColorSize,
+    getLifeLabels,
     getValuedLabels,
     removeRepeat,
     handleMouseUp