Browse Source

bug2967,2960,2959

luolei 5 years ago
parent
commit
bcc9fe8d20
3 changed files with 32 additions and 12 deletions
  1. 3 2
      src/components/SpreadDrop/index.jsx
  2. 11 3
      src/containers/SpreadDrop.js
  3. 18 7
      src/store/actions/currentIll.js

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

@@ -224,7 +224,7 @@ class SpreadDrop extends Component{
     const params = Object.assign({},this.state,{ikey,type,tagType,order,mainSaveText,copyType,value,mainData});
     delete params.tmpDom;       //避免上面deepClone selecteds报错
     handleConfirm&&handleConfirm(params);
-	this.btnClickFlag = true;
+	  this.btnClickFlag = true;
     //点确定后隐藏弹窗
     this.props.handleHide();
   }
@@ -243,6 +243,7 @@ class SpreadDrop extends Component{
         return;
       }
       //未选中互斥项,直接选中该互斥项
+      console.log(id,isExclu,joint,listIndex,selected,exclusion,name)
       let temp = '';
       if(exclusion==''){
         temp = id;
@@ -410,7 +411,7 @@ class SpreadDrop extends Component{
         onkeydown={handleEnter}
         onMouseUp={()=>handleMouseUp({select_start,i,boxMark})}
         onMouseDown={this.handleMouseDown.bind(this)}
-        >{showV||placeholder}</div>
+        >{showV||placeholder}|ts|</div>
       {showCommonData&&show?<CommonSymptom data={CommonSymptoms} show={true} onSelect={this.handleCommonSelect.bind(this)} isCurrent={true} />:
           <ListItems parDiv={this.$list} defaulted={showDefaulted&&defaulted} pos={pos} data={data} order={order} left={left} boxMark={type} tagType={tagType}
              show={show} handleSelect={this.handleSelect} handleConfirm={this.handleConfirm} handleClear={this.handleClear} {...this.state}></ListItems>}

+ 11 - 3
src/containers/SpreadDrop.js

@@ -149,7 +149,7 @@ function mainSuitModule(dispatch,store,params){
 
 // 现病史
 function currentIll(dispatch,store,params){
-  const {nones,exists,withs,exclusion,excluName,ban,noneIds} = params;
+  const {nones,exists,withs,exclusion,excluName,ban,noneIds,tagType} = params;
   const index = params.ikey;
   let ikey = getLabelIndex(index);
   let existsId = exists && exists.length>0?getIds(exists):[];
@@ -157,6 +157,13 @@ function currentIll(dispatch,store,params){
   // const ids = (existsId.concat(withsId)).join(",");
   const ids = existsId.concat(withsId);
   let has = [],wes=[];
+  if(params.exclusion){//既往史
+    dispatch({
+      type: CURRENT_CONFIRM,
+      data:{exclusion,excluName,exists:has,withs:wes,nones:nones,ikey,ban,noneIds,tagType}
+    });
+    return ;
+  }
   //获取选中项目模板
   fetchModules(ids).then((res)=>{
     if(+res.data.code===0){
@@ -173,12 +180,13 @@ function currentIll(dispatch,store,params){
         });
         dispatch({
           type: CURRENT_CONFIRM,
-          data: {exists:has,withs:wes,nones:nones,ikey,ban,noneIds}
+          data: {exclusion,excluName,exists:has,withs:wes,nones:nones,ikey,ban,noneIds,tagType}
         });
       }else{
         dispatch({
           type: CURRENT_CONFIRM,
-          data: {exists,withs,nones,ikey,ban,noneIds}
+          data: {exclusion,excluName,exists:has,withs:wes,nones:nones,ikey,ban,noneIds,tagType}
+          // data: {exists,withs,nones,ikey,ban,noneIds}
         });
       }
       dispatch({    //自由文本标签数据更新

+ 18 - 7
src/store/actions/currentIll.js

@@ -338,9 +338,14 @@ export const confirm = (state,action) =>{
   let res = Object.assign({},state);
   let length1 = res.data.length;
   let arr = JSON.parse(JSON.stringify(res.data));
-  const {nones,exists,withs,ikey,exclusion,excluName,ban,noneIds} = action.data;
+  const {nones,exists,withs,ikey,exclusion,excluName,ban,noneIds,tagType} = action.data;
   let existConpId = [];
   let withConpId = [];
+  //既往史选中互斥项
+  if(exclusion){
+    arr[ikey].value = excluName;
+    arr[ikey].selecteds = action.data;
+  }
   exists.map((v,i)=>{
     existConpId.push(v.conceptId);
   })
@@ -350,32 +355,38 @@ export const confirm = (state,action) =>{
   res.symptomIds = res.symptomIds.concat(existConpId,withConpId,noneIds);//搜索去重
   // 伴 标签
   const banText = JSON.stringify(ban)=='{}'?'':{id:ban.id,name:ban.name,value:ban.name,tagType:config.tagType};
-
   // 处理主症状标签及尾巴展开symptomType=1
   if(exists && exists.length>0){
     let tempArr = [];
      for(let i=0;i<exists.length; i++){
-      tempArr.push(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;})));
+      if(tagType == 6){
+        tempArr.push(...(exists[i].questionMapping && exists[i].questionMapping.filter((item)=>{return item.symptomType==0||item.symptomType==1;})));
+      }else{
+        tempArr.push(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;})));
+      }
     }
     arr.splice(ikey,0,...formatContinueDots(tempArr));
   }
-  
   let length = arr.length - length1;
   let withsArr = JSON.parse(JSON.stringify(arr));
   // 伴 伴随症状标签及尾巴展开symptomType=2
   if(withs && withs.length>0){
     let tempArr = [];
     for(let i=0;i<withs.length; i++){
-      tempArr.push(banText,getLabel(withs[i].id,withs[i].questionMapping && withs[i].questionMapping.length==0?(withs[i].name+','):(withs[i].name)),...(withs[i].questionMapping&&withs[i].questionMapping.length>0?withs[i].questionMapping.filter((item)=>{return item.symptomType==0||item.symptomType==2;}):[]));
+      if(tagType == 6){
+        tempArr.push(banText,...(withs[i].questionMapping&&withs[i].questionMapping.length>0?withs[i].questionMapping.filter((item)=>{return item.symptomType==0||item.symptomType==2;}):[]));
+      }else{
+        tempArr.push(banText,getLabel(withs[i].id,withs[i].questionMapping && withs[i].questionMapping.length==0?(withs[i].name+','):(withs[i].name)),...(withs[i].questionMapping&&withs[i].questionMapping.length>0?withs[i].questionMapping.filter((item)=>{return item.symptomType==0||item.symptomType==2;}):[]));
+      }
     }
     withsArr.splice(parseInt(ikey)+length,0,...formatContinueDots(tempArr));
   }
-
   // 无 不用展开
+
   let lengthN = withsArr.length - length1;
   let noneArr = JSON.parse(JSON.stringify(withsArr));  
   if(nones.length>1){//只点无不上去
-    const nonesName = nones.slice(0,nones.length-1)+',';
+    const nonesName = tagType == 6?nones:(nones.slice(0,nones.length-1)+',');
     const noneObj = Object.assign({},JSON.parse(config.textLabel),{name:nonesName,value:nonesName});
     const none = nones?noneObj:'';
     noneArr.splice(parseInt(ikey)+lengthN,0,none);