Просмотр исходного кода

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

zhouna 6 лет назад
Родитель
Сommit
f7a59360be

+ 15 - 10
src/components/AssessResult/ScaleItem/index.jsx

@@ -40,7 +40,8 @@ class ScaleItem extends Component {
   }
   showOption(id){
     this.setState({
-      optionId:id
+      optionId: id,
+      formulaId: ''
     })
   }
   closeOption(){
@@ -116,7 +117,8 @@ class ScaleItem extends Component {
   }
   showFormula(id){
     this.setState({
-      formulaId:id
+      formulaId: id,
+      optionId: ''
     });
   }
   closeFormula(){
@@ -183,9 +185,11 @@ class ScaleItem extends Component {
       if(indexs[i]&&indexs[i].includes(j)){
         if(its.type==1){     //量表
           let scaleRes=formulaResult&&formulaResult[it.content.conceptId]&&formulaResult[it.content.conceptId].calcalculate;
+          const name = scaleRes&&scaleRes.result?(' 【'+it.content.name+'】 结果:'+scaleRes.result.value+" "+(scaleRes.result.text||'')):'【'+it.content.name+'】';
           temp =<span className={style['scale']}
+                      title={name}
                       onClick={this.handleShowScale.bind(this,it.content)}>
-                        {scaleRes&&scaleRes.result?(' 【'+it.content.name+'】 结果:'+scaleRes.result.value+" "+(scaleRes.result.text||'')):'【'+it.content.name+'】'}
+                        {name}
                         </span>;
         }else if(its.type==2){      //计算公式
           const showRes = calcuResult&&calcuResult[item.conceptId]||it.content.result;
@@ -282,10 +286,10 @@ class ScaleItem extends Component {
         }
         const passId = item.details[j].type==1?item.details[j].content.conceptId:undefined;
         const li = disabled?<li>
-            <span>{item.name}:</span>
+            <span className={style['s-title']}>{item.name}:</span>
             <div className={style['row']}>{temp}</div>
           </li>:<li>
-          <span>{item.name}:</span>
+          <span className={style['s-title']}>{item.name}:</span>
           <div className={style['row']}>{temp}</div>
           <div className={style["recommend"]} onClick={()=>this.props.handleRemove(false,i,passId,j)}>
             <img className={style["deleteIconNo"]} src={deleteIconNo} />
@@ -323,15 +327,16 @@ class ScaleItem extends Component {
       it = {conceptId:i,name:scaleItems[i].name};//this.getScaleContent(scaleItems[i].data);
       if(!it) continue;
       let scaleRes=formulaResult&&formulaResult[it.conceptId]&&formulaResult[it.conceptId].calcalculate;
+      const name = scaleRes&&scaleRes.result?(' 【'+scaleItems[i].name+'】 结果:'+scaleRes.result.value+" "+(scaleRes.result.text||'')):'【'+scaleItems[i].name+'】';
       //这里onClick不能用箭头函数,用箭头函数会一直绑定for的最后一个it
-      temp =<span className={style['scale']} onClick={this.handleShowScale.bind(this,it)}>
-                        {scaleRes&&scaleRes.result?(' 【'+scaleItems[i].name+'】 结果:'+scaleRes.result.value+" "+(scaleRes.result.text||'')):'【'+scaleItems[i].name+'】'}
-                        </span>;
+      temp =<span className={style['scale']}
+                  title={name}
+                  onClick={this.handleShowScale.bind(this,it)}>{name}</span>;
       li = disabled?<li>
-        <span>相关量表:</span>
+        <span className={style['s-title']}>相关量表:</span>
         <div className={style['row']}>{temp}</div>
       </li>:<li>
-        <span>相关量表:</span>
+        <span className={style['s-title']}>相关量表:</span>
         <div className={style['row']}>{temp}</div>
         <div className={style["recommend"]} onClick={()=>this.props.handleRemove(true,it.conceptId)}>
           <img className={style["deleteIconNo"]} src={deleteIconNo} />

+ 13 - 0
src/components/AssessResult/index.less

@@ -36,6 +36,7 @@
     line-height: 35px;
     .row{
       display: inline-block;
+      max-width: 100%;
     }
     .results{
       position: relative;
@@ -45,11 +46,22 @@
       margin-right: 10px;
       .recomand{
         color: @blue;
+
       }
     }
+    .s-title{
+      display: inline-block;
+      max-width: 100px;
+      vertical-align: top;
+    }
     .scale{
+      display: inline-block;
       color: @blue;
       cursor: pointer;
+      white-space: nowrap;
+      max-width: 100%;
+      overflow: hidden;
+      text-overflow: ellipsis;
     }
     .blue{
       color:#3B9ED0;
@@ -63,6 +75,7 @@
       float: right;
       color: #929292;
       cursor: pointer;
+      margin-top: 8px;
     }
   }
   .edit-row{

+ 11 - 1
src/components/MedicalInfo/index.jsx

@@ -41,9 +41,19 @@ class MedicalInfo extends Component {
       handleChangeValue&&handleChangeValue(val);
     }
   handleChange(){
+    const value = this.$inp.current.value;
+    const {clearResult} = this.props;
       this.setState({
-        val:this.$inp.current.value
+        val: value
       });
+    if (value === '') {
+      this.setState({
+        val: '',
+        hasSearch: false,
+        msg: ''
+      });
+      clearResult && clearResult();
+    }
   }
   handleEnter(e){
       if(e.keyCode==13){

+ 11 - 1
src/components/ScaleSearch/index.jsx

@@ -56,9 +56,19 @@ class ScaleSearch extends Component {
     handleChangeValue&&handleChangeValue(val);
   }
   handleChange(){
+    const value = this.$inp.current.value;
+    const {clearResult} = this.props;
     this.setState({
-      val:this.$inp.current.value
+      val: value
     });
+    if (value === '') {
+      this.setState({
+        val: '',
+        hasSearch: false,
+        msg: ''
+      });
+      clearResult && clearResult();
+    }
   }
   handleEnter(e){
     if(e.keyCode==13){

+ 2 - 2
src/components/ScaleTableHis/index.jsx

@@ -104,7 +104,7 @@ class ScaleTableHis extends React.Component{
 
   render(){
     const {title,data,result} = this.props;
-    const scale = data && this.filterScale(data);
+    const scale = data && this.filterScale(data.data);
     const datas = scale && scale.content && JSON.parse(scale.content);
     const scaleResult = datas; //量表计算结果
     return <div className={style['tableBox']} id="printcontent">
@@ -112,7 +112,7 @@ class ScaleTableHis extends React.Component{
               <Information></Information>
             </div> 
             <h1>{datas?datas.scaleName:''}</h1>
-            {data && data.map((v,i)=>{
+            {data &&data.data&& data.data.map((v,i)=>{
               if(v.type==0){
                 return <div dangerouslySetInnerHTML={{__html:v.content}} className={style['textlh']}></div>
               }else{

+ 10 - 2
src/containers/CurrentIll.js

@@ -56,10 +56,18 @@ function mapDispatchToProps(dispatch) {
           clickType:'单击',
           num:1
         });
+        // 判断是否有子模板数据
+        const sonId = obj.relationModule;//子模板id
+        let sonArr = allModules.filter((item)=>{return item.id==sonId})
+        if(sonArr.length==0){//未匹配到子模板
+          Notify.info("未找到相关内容");
+          return
+        }
         dispatch({
           type:INSERT_PROCESS,
-          id:obj.relationModule,
-          allModules:allModules
+          // id:obj.relationModule,
+          // allModules:allModules
+          addSmoduleData:JSON.parse(JSON.stringify(sonArr[0].moduleDetailDTOList))
         });
         dispatch({
           type:ISREAD

+ 12 - 1
src/containers/MainSuit.js

@@ -72,11 +72,22 @@ function mapDispatchToProps(dispatch) {
             clickType:'单击',
             num:1
           });
-          dispatch({
+          // 判断是否有子模板数据
+          const sonId = obj.relationModule;
+          let sonArr = allModules.filter((item)=>{return item.id==sonId})
+          if(sonArr.length==0){//未匹配到子模板
+            Notify.info("未找到相关内容");
+            return
+          }
+          /*dispatch({
             type: SHOW_TAIL,
             info:obj.questionMapping,
             id:obj.relationModule,
             allModules:allModules
+          })*/
+          dispatch({
+            type: SHOW_TAIL,
+            addSmoduleData:JSON.parse(JSON.stringify(sonArr[0].moduleDetailDTOList))
           })
           dispatch({
             type:ISREAD

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

@@ -383,7 +383,10 @@ export const changeNumLabelVal = (state,action)=>{
   const newVal = changeVal;
   let item = res.data[index];
   const next = res.data[+index+1];
+  const next2 = res.data[+index + 2];
   const nextVal = next.value||next.name;
+  //下一个非文本标签是数字组件
+  const next2IsNum = +next2.tagType === 1 && +next2.controlType === 7;
   //标签后是不是标点符号标签,是的话删除本标签时一起删除
   let nextIsDot = +next.tagType===8&&!nextVal.match(config.punctuationReg);
   if(totalVal.trim()){
@@ -399,7 +402,11 @@ export const changeNumLabelVal = (state,action)=>{
     }
     
   }else{//删除完标签内容则删除该标签
-    const num = nextIsDot?2:1;
+    let num = nextIsDot ? 2 : 1;
+    if (nextIsDot && next2IsNum) {      //解决连续2个相同的数字组件删除第一个,第二个显示异常bug--临时方案
+      next.value = '';
+      num = 1;
+    }
     res.data.splice(index,num);
     res.selecteds.splice(index,num);      //杂音类样式选中状态对应
     res.saveText = checkFullfillText(res.data).saveText;
@@ -421,7 +428,7 @@ export function clearCheckBody(state,action){  //清空
 
 //文本输入标签
 export function setInputLabel(state,action){
-  let res = Object.assign({},state);//console.log(state,action)
+  let res = Object.assign({}, state);
   const {i,text,prefix,suffix,subIndex} = action;
   const item = res.data[i];
   if(+item.tagType===3){      //multSpred标签

+ 9 - 9
src/store/actions/currentIll.js

@@ -63,14 +63,7 @@ export const setModule = (state,action)=>{
 //插入病程变化
 export const insertProcess = (state,action)=>{
   const res = Object.assign({},state);
-  const sonId = action.id;//子模板id
-  let addSmoduleData;
-  let allModules = action.allModules;
-  for(let k=0; k<allModules.length; k++){
-    if(allModules[k].id==sonId){
-      addSmoduleData = JSON.parse(JSON.stringify(allModules[k].moduleDetailDTOList));
-    }
-  }
+  let addSmoduleData = action.addSmoduleData;
   let data = res.data;
   let newData = insertPro(data,addSmoduleData);
   res.data = fullfillText(newData).newArr;
@@ -639,7 +632,10 @@ export const changeNumLabelVal = (state,action)=>{
   const newVal = changeVal;
   let item = res.data[index];
   const next = res.data[+index+1];
+  const next2 = res.data[+index + 2];
   const nextVal = next.value||next.name;
+  //下一个非文本标签是数字组件
+  const next2IsNum = +next2.tagType === 1 && +next2.controlType === 7;
   //标签后是不是标点符号标签,是的话删除本标签时一起删除
   let nextIsDot = +next.tagType===8&&!nextVal.match(config.punctuationReg);
   // let labText = totalVal?totalVal:newVal;   //如单选没有前后缀
@@ -651,7 +647,11 @@ export const changeNumLabelVal = (state,action)=>{
     }
     res.saveText[index] = totalVal;
   }else{//删除完标签内容则删除该标签
-    const num = nextIsDot?2:1;
+    let num = nextIsDot ? 2 : 1;
+    if (nextIsDot && next2IsNum) {      //解决连续2个相同的数字组件删除第一个,第二个显示异常bug--临时方案
+      next.value = '';
+      num = 1;
+    }
     res.data.splice(index,num);
     res.saveText.splice(index,num);
     // res.saveText = fullfillText(res.data).saveText;

+ 1 - 15
src/store/actions/mainSuit.js

@@ -95,27 +95,13 @@ export const getBigSymptom = (state,action) => {
 //点击插入新模板--添加病程变化
 export const handleTailClick = (state,action)=>{
   const res = Object.assign({},state);
-  const sonId = action.id;//子模板id
   let num = res.moduleNum.num;
   num++;
-  // const addSmoduleData = JSON.parse(JSON.stringify(res.addSmoduleData));
-  // const addDatas = JSON.parse(JSON.stringify(fullfillText(action.info).newArr));
-  let addSmoduleData;
-  // const allModules = JSON.parse(localStorage.getItem('modules'));
-  let allModules = action.allModules;
-  for(let k=0; k<allModules.length; k++){
-    if(allModules[k].id==sonId){
-      addSmoduleData = JSON.parse(JSON.stringify(allModules[k].moduleDetailDTOList));
-    }
-  }
+  let addSmoduleData = action.addSmoduleData;
   let datas = JSON.parse(JSON.stringify(res.data));
-  let leng = datas.length;
   
   for(let i=0; i<addSmoduleData.length; i++){
     addSmoduleData[i].pos = num;
-    // let pos = leng-1+i;
-   /* let pos = leng-2+i;
-    datas.splice(pos,0,addDatas[i]);*/
   }
   let newData = insertPro(datas,addSmoduleData);
   res.data = fullfillText(newData).newArr;

+ 23 - 5
src/store/actions/otherHistory.js

@@ -210,10 +210,21 @@ export function setCheckText(state,action) {
 
 //文本输入标签
 export function setOtherInput(state,action){
-  let res = Object.assign({},state);
-  const {i,text,prefix,suffix} = action;
-  if(res.data[i]){
-    res.data[i].value=text;
+  let res = Object.assign({}, state);//console.log(state,action)
+  const {i, text, prefix, suffix, subIndex} = action;
+  const item = res.data[i];
+  if (+item.tagType === 3 || +item.tagType === 4) {      //multSpred标签
+    item.questionMapping[subIndex].value = text;
+    let texts = item.questionMapping.map((it) => {
+      return (it.labelPrefix || '') + (it.value || '') + (it.labelSuffix || '');
+    });
+    res.saveText[i] = texts.join('');
+    res.update = Math.random();
+    return res;
+  } else {
+    if (item) {
+      item.value = text;
+    }
   }
   if(text){
     res.saveText[i] = prefix+text+suffix;
@@ -366,7 +377,10 @@ export const changeNumLabelVal = (state,action)=>{
   const newVal = changeVal;
   let item = res.data[index];
   const next = res.data[+index+1];
+  const next2 = res.data[+index + 2];
   const nextVal = next.value||next.name;
+  //下一个非文本标签是数字组件
+  const next2IsNum = +next2.tagType === 1 && +next2.controlType === 7;
   //标签后是不是标点符号标签,是的话删除本标签时一起删除
   let nextIsDot = +next.tagType===8&&!nextVal.match(config.punctuationReg);
   let labText = totalVal?totalVal:newVal;   //如单选没有前后缀
@@ -378,7 +392,11 @@ export const changeNumLabelVal = (state,action)=>{
     }
     res.saveText[index] = labText;
   }else{//删除完标签内容则删除该标签
-    const num = nextIsDot?2:1;
+    let num = nextIsDot ? 2 : 1;
+    if (nextIsDot && next2IsNum) {      //解决连续2个相同的数字组件删除第一个,第二个显示异常bug--临时方案
+      next.value = '';
+      num = 1;
+    }
     res.data.splice(index,num);
     res.selecteds.splice(index,num);//杂音类样式选中状态对应
     res.saveText = fullfillText(res.data).saveText;