Explorar o código

ie8现病史添加症状报错的问题&查体血压选中不变黑的问题

liucf %!s(int64=6) %!d(string=hai) anos
pai
achega
27178b569e

+ 8 - 0
src/common/components/NumberUnitPan/index.jsx

@@ -55,6 +55,14 @@ class NumberUnitPan extends Component{
     });
     onSelect&&onSelect(text);
   }
+  componentWillReceiveProps(nextProps){
+    //重新选择的值替换 不追加
+     if(!nextProps.show){
+      this.setState({
+        value:''
+      });
+     }
+  }
   render(){
     // const select = this.handleSelect.bind(this);
     const {show} = this.props;      //table onBlur阻止冒泡是为了修复multSpread中数字键盘点击触发最外层数字组件onBlur事件

+ 1 - 1
src/common/components/NumberUnitPan/index.less

@@ -18,7 +18,7 @@
     height: 100%;
     text-align: center;
     line-height: 44px;
-    color: #666;
+    color: #333;
     cursor: pointer;
   }
   span:hover{

+ 1 - 1
src/containers/CurrentIll.js

@@ -12,7 +12,7 @@ import {getModule} from '@store/async-actions/fetchModules.js';
 import {didPushParamChange} from '@utils/tools.js';
 
 
-function mapStateToProps(state) {//console.log(11,state);
+function mapStateToProps(state) {
   const {homePage} = state;
     return {
         data:state.currentIll.data,//主诉模板

+ 1 - 0
src/containers/NumberUnitDrop.js

@@ -179,6 +179,7 @@ function mapDispatchToProps(dispatch,store){
       dispatch({
         type: ISREAD
       });
+      console.log("更新可编辑span");
     }
   }
 }

+ 5 - 3
src/containers/SpreadDrop.js

@@ -77,10 +77,12 @@ function currentIll(dispatch,store,params){
   // const ikey = params.ikey.substr(1,1);
   const index = params.ikey;
   let ikey = getLabelIndex(index);
-  let existsId = getIds(exists);
-  let withsId = getIds(withs);
+  // let existsId = getIds(exists);
+  // let withsId = getIds(withs);
+  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(",");
+  const ids = (existsId.concat(withsId)).join(",");console.log("点击的下标是:",index,"选中的id是:",ids)
   let has = [],wes=[];
   //获取选中项目模板
   fetchModules(ids).then((res)=>{

+ 1 - 1
src/main.js

@@ -27,7 +27,7 @@ const render = (Component) => {
         }
       })
     })
-  };
+  };          
     ReactDOM.render(
         <AppContainer>
             <Provider store={store}>

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

@@ -5,6 +5,7 @@ export function set(state,action){
   let res = Object.assign({},state);
   const {data} = action;
   res.data = [...data];
+  res.saveText = fullfillText(res.data).saveText;//存逗号
   res.update = Math.random();
   return res;
 }
@@ -30,13 +31,13 @@ export function setNumberValue(state,action){
     });
     res.saveText[labelInx] = hasValue?sub.join(''):'';
   }
-  res.saveText = fullfillText(res.data).saveText;
+  // res.saveText = fullfillText(res.data).saveText;
   res.update = Math.random();
   return res;
 }
 
 //查体单选下拉选中
-export function setRadioValue(state,action){console.log(221)
+export function setRadioValue(state,action){
   let res = Object.assign({},state);
   const {ikey,id,text} = action;
   let labelInx = getLabelIndex(ikey);
@@ -76,7 +77,7 @@ export function setRadioValue(state,action){console.log(221)
     });
     res.saveText[labelInx] = hasValue?sub.join(''):'';
   }
-  res.saveText = fullfillText(res.data).saveText;
+  // res.saveText = fullfillText(res.data).saveText;
   res.update = Math.random();
   return res;
 }

+ 14 - 12
src/store/actions/currentIll.js

@@ -207,32 +207,34 @@ function getLabel(lid,lname){
 // 多选展开确定事件--主、伴、无
 export const confirm = (state,action) =>{
   let res = Object.assign({},state);
-  let length1 = res.data.length;console.log(123,action);
+  let length1 = res.data.length;
   let arr = JSON.parse(JSON.stringify(res.data));
   const {nones,exists,withs,ikey,exclusion,excluName,ban,noneIds} = action.data;
-  let existsId = getIds(exists);
-  let withsId = getIds(withs);
+  let existsId = exists && exists.length>0?getIds(exists):[];
+  let withsId = withs && withs.length>0?getIds(withs):[];
   res.symptomIds = res.symptomIds.concat(existsId,withsId,noneIds);//搜索去重
   // 伴 标签
   const banText = JSON.stringify(ban)=='{}'?'':{id:ban.id,name:ban.name,value:ban.name,tagType:config.tagType};
-  
+
   // 处理主症状标签及尾巴展开symptomType=1
-  if(exists.length>0){
-    for(let i in exists){
-      arr.splice(ikey,0,getLabel(exists[i].id,exists[i].questionMapping.length==0?exists[i].name+',':exists[i].name),...(exists[i].questionMapping.filter((item)=>{return item.symptomType==0||item.symptomType==1;})));
+  if(exists && exists.length>0){
+    // for(let i in exists){//ie8不支持for in循环
+     for(let i=0;i<exists.length; i++){
+      arr.splice(ikey,0,getLabel(exists[i].id,exists[i].questionMapping && exists[i].questionMapping.length==0?exists[i].name+',':exists[i].name),...(exists[i].questionMapping && exists[i].questionMapping.filter((item)=>{return item.symptomType==0||item.symptomType==1;})));
     }
   }
 
   let length = arr.length - length1;
   let withsArr = JSON.parse(JSON.stringify(arr));
   // 伴 伴随症状标签及尾巴展开symptomType=2
-  if(withs.length>0){
-    for(let i in withs){
+  if(withs && withs.length>0){
+    // for(let i in withs){
+    for(let i=0;i<withs.length; i++){
       // withsArr.splice(parseInt(ikey)+length,0,banText,getLabel(withs[i].id,withs[i].name),...(withs[i].questionMapping.filter((item)=>{return item.symptomType==0||item.symptomType==2;})));
-      withsArr.splice(parseInt(ikey)+length,0,getLabel(withs[i].id,withs[i].questionMapping.length==0?(ban.name+withs[i].name+','):(ban.name+withs[i].name)),...(withs[i].questionMapping.filter((item)=>{return item.symptomType==0||item.symptomType==2;})));
+      withsArr.splice(parseInt(ikey)+length,0,getLabel(withs[i].id,withs[i].questionMapping && withs[i].questionMapping.length==0?(ban.name+withs[i].name+','):(ban.name+withs[i].name)),...(withs[i].questionMapping && withs[i].questionMapping.filter((item)=>{return item.symptomType==0||item.symptomType==2;})));
     }
   }
-  
+
   // 无 不用展开
   let lengthN = withsArr.length - length1;
   let noneArr = JSON.parse(JSON.stringify(withsArr));  
@@ -247,7 +249,7 @@ export const confirm = (state,action) =>{
   // res.data = resData;
   res.data = fullfillText(resData).newArr;
   res.saveText = fullfillText(resData).saveText;
-  res.update=Math.random(); 
+  res.update=Math.random();
   return res;
 };
 

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

@@ -127,12 +127,18 @@ export const confirm = (state,action) =>{
   let arr = res.data;
   let saveText = JSON.parse(JSON.stringify(res.saveText));
   const {exists,withs,ikey,withsName,existsName,ban} = action.data;
-  let existsId = getIds(exists);
-  let withsId = getIds(withs);
+  // let existsId = getIds(exists);
+  // let withsId = getIds(withs);
   let banText = JSON.stringify(ban) == "{}" ? '':{id:ban.id,name:ban.name,value:ban.name,tagType:config.tagType};
-  res.mainIds = res.mainIds?res.mainIds.concat(existsId,withsId):[];
+  // res.mainIds = res.mainIds?res.mainIds.concat(existsId,withsId):[];
   let length = exists.length;
   let labelIndx = parseInt(ikey);//当前点击标签的index
+  // 取第一个添加症状的主症状和伴随
+  if(!arr[labelIndx].pos){
+    let existsId = getIds(exists);
+    let withsId = getIds(withs);
+    res.mainIds = res.mainIds?res.mainIds.concat(existsId,withsId):[];
+  }
 
   let text = saveText.slice(0,labelIndx);
   let index = text.indexOf('伴');