Bladeren bron

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

# Conflicts:
#	src/common/components/SearchOption/index.jsx
#	src/common/js/func.js
#	src/components/CheckBody/index.jsx
#	src/containers/CurrentIll.js
#	src/store/async-actions/homePage.js
zhouna 6 jaren geleden
bovenliggende
commit
5ae9b8fae1

+ 6 - 2
src/common/components/EditableSpan/index.jsx

@@ -156,9 +156,13 @@ class EditableSpan extends Component{
     let innerVal = target.innerText;
     if(ev.keyCode==8){
       // 主诉现病史去重:删除最后一个字的时候移除该数据(将name、id和value替换成空)并移除id
+      // 前面是标签,内容为空时再删一次才移除标签;前面是文本,则直接移除;
+      let preObj = $(this.$span.current).prev();
       if(preVal.trim().length==1){
           removeId && removeId({boxMark,i:index,text:""});
-          // this.moveEnd(obj[0]);
+          if(preObj[0].nodeName !=="DIV"){
+            this.moveEnd(preObj[0]);
+          }
         }
       
       if(innerVal !==preVal){return false}
@@ -166,7 +170,7 @@ class EditableSpan extends Component{
       //判断是否为空、中英文:, 。、;,且不是第一位
       let pattern = new RegExp(/^\,?$|^\,?$|^\.?$|^\。?$|^\、?$|^\;?$|^\;?$|^\:?$|^\:?$\s/);
       if(index!==0 && pattern.test(data)){
-        let preObj = $(this.$span.current).prev();
+        // let preObj = $(this.$span.current).prev();
         let obj = preObj[0].nodeName=="DIV"?preObj.prev():preObj;
         handleKeydown&&handleKeydown({boxMark,i:index,text:data});
         this.moveEnd(obj[0]);  

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

@@ -5,7 +5,7 @@
   word-break: break-word;
   min-width: 10px;
   // line-height: 2;
-  /*height: 20px;*/
+  height: 16px;
   line-height: 16px;
   /*vertical-align: middle;*/
   text-align: left;

+ 1 - 2
src/common/components/SearchOption/index.jsx

@@ -57,8 +57,7 @@ class SearchOption extends React.Component {
               show:true
           })
       }else{
-          //this.handleClearVal('')            //这个要放开,输入为空清除列表
-          handleChangeValue('');
+          this.handleClearVal('')            //这个要放开,输入为空清除列表
           this.setState({
               show:false
           })

+ 1 - 1
src/common/js/func.js

@@ -66,7 +66,7 @@ export const strTrim = (str) =>{
 };
 
 //获取组合组件已填文字填入saveText
-function getSaveText(data){
+function getSaveText(data){//console.log(data)
   const arr = data.questionMapping.map((it)=>{
     return it.value?(it.labelPrefix||'')+(it.value||'')+(it.labelSuffix||''):'';
   });

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

@@ -34,7 +34,7 @@ class CurrentIll extends Component{
 
   handleFocus(e){
     // 判断主诉是否为空
-    const {mainData,mainText,setData,moduleNum,mainIds,data,changeEditIll,editClear,mainSymptIds} = this.props;
+    const {mainData,mainText,setData,moduleNum,mainIds,data,changeEditIll,editClear} = this.props;
     const that = this;
     let mainFinallyText = filterDataArr(mainText);
     // if(mainData.length == 0 && !mainText[0]){
@@ -46,11 +46,11 @@ class CurrentIll extends Component{
       })
     }else {
       // let useEmpty = mainData.length>0?false:true;
-      let useEmpty = mainSymptIds.length>0?false:true;
       let num = moduleNum.num;//主诉使用了几个模板
       // if(editClear && data.length==0){//第一次聚焦去设置现病史的data
       if(data.length==0){//第一次聚焦去设置现病史的data
-        setData && setData({useEmpty,num,mainData,mainIds});//是否使用空模板 及数据处理
+        // setData && setData({useEmpty,num,mainData,mainIds});//是否使用空模板 及数据处理
+        setData && setData({num,mainData,mainIds});//是否使用空模板 及数据处理
       }
       this.setState({
           showMoudle:true,

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

@@ -175,8 +175,8 @@ class SpreadDrop extends Component{
   }
   handleConfirm(e){
     e.stopPropagation();
-    const {handleConfirm,ikey,type,tagType,order,mainSaveText,copyType} = this.props;
-    const params = Object.assign({},this.state,{ikey,type,tagType,order,mainSaveText,copyType});
+    const {handleConfirm,ikey,type,tagType,order,mainSaveText,copyType,value} = this.props;
+    const params = Object.assign({},this.state,{ikey,type,tagType,order,mainSaveText,copyType,value});
     handleConfirm&&handleConfirm(params);
 	this.btnClickFlag = true;
     //点确定后隐藏弹窗

+ 1 - 2
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) {
+function mapStateToProps(state) { 
   const {homePage} = state;
     return {
         data:state.currentIll.data,//主诉模板
@@ -29,7 +29,6 @@ function mapStateToProps(state) {
         moduleNum:state.mainSuit.moduleNum,//主诉使用的模板
         type: state.typeConfig.typeConfig,
         mainIds:state.mainSuit.mainIds,//主诉症状选中的id(去重用)
-        mainSymptIds:state.mainSuit.mainSymptIds,//主诉症状选中的id(移植用)
         fillInfo: state.fillInfo,
         showArr:homePage.showDrop,
         totalHide: homePage.totalHide,

+ 15 - 6
src/containers/SpreadDrop.js

@@ -45,6 +45,10 @@ function mainSuitModule(dispatch,store,params){
   let withsName = getNames(withs);
   let banName = ban.name;
   let text = filterArr(mainSaveText);
+  if(text.length >= config.limited){
+    Notify.info(config.limitText);
+    return
+  }
   let names;
   if(banName){
     names = existsName + banName + withsName;
@@ -169,11 +173,11 @@ function handleModuleDiff(dispatch,store,params){
   const {type,mainSaveText} = params;
   switch (+type){
     case 1:
-      let text = filterArr(mainSaveText);
+      /*let text = filterArr(mainSaveText);
       if(text.length >= config.limited){
         Notify.info(config.limitText);
         return
-      }
+      }*/
       mainSuitModule(dispatch,store,params);
       break;
     case 2:
@@ -194,10 +198,15 @@ function handleModuleDiff(dispatch,store,params){
 
 //主诉普通多选确定
 function mainSuitCheck(dispatch,store,params){
-  const {nones,exists,withs,order,mainSaveText} = params;
+  const {nones,exists,withs,order,mainSaveText,value} = params;
   let existsName = getNames(exists,order);
   let text = filterArr(mainSaveText);
-  let lengths = text.length + existsName.length;
+  if(text.length >= config.limited){
+    Notify.info(config.limitText);
+    return
+  }
+  // let lengths = text.length + existsName.length;
+  let lengths = value?(text.length - value.length + existsName.length):(text.length + existsName.length);
   if(lengths > config.limited){
     Notify.info(config.limitText);
     return
@@ -253,11 +262,11 @@ function handleCheckBox(dispatch,store,params){
   const {type,mainSaveText} = params;
   switch (+type){
     case 1:
-      let text = filterArr(mainSaveText);
+      /*let text = filterArr(mainSaveText);
       if(text.length >= config.limited){
         Notify.info(config.limitText);
         return
-      }
+      }*/
       mainSuitCheck(dispatch,store,params);
       break;
     case 2:

+ 8 - 3
src/store/actions/currentIll.js

@@ -616,9 +616,14 @@ export function removeId(state,action){
   if(ids.includes(id)){
     ids.splice(ids.indexOf(id),1);
   }
-  data[index].id = "";
-  data[index].name = text;
-  data[index].value = text;
+  if(!data[index].value && data[index-1].tagType==8){
+    data.splice(index,1);
+  }else{
+    data[index].id = "";
+    data[index].name = text;
+    data[index].value = text;
+  }
+  
   res.update = Math.random();
   return res;
 }

+ 1 - 1
src/store/actions/homePage.js

@@ -32,7 +32,7 @@ export const confirmHide=(state,action)=>{
   let res = Object.assign({},state);
   let obj = res.showDrop||{};
   let temp = Object.assign({},obj);
-  let keyArr = Object.keys(obj); 
+  let keyArr = Object.keys(obj);
   for(let i=0; i<keyArr.length; i++){
     temp[JSON.parse(keyArr[i])] = false;
   }

+ 6 - 10
src/store/actions/mainSuit.js

@@ -110,7 +110,6 @@ export const insertMain = (state,action) => {
   // res.saveText[inserIndx] = text.name;
   res.saveText = fullfillText(res.data).saveText;
   res.mainIds.push(id);
-  res.mainSymptIds.push(id);
   res.editClear = false;//主诉框编辑状态
   res.update=Math.random();
   return res;
@@ -136,7 +135,6 @@ export const confirm = (state,action) =>{
     let existsId = getIds(exists);
     let withsId = getIds(withs);
     res.mainIds = res.mainIds?res.mainIds.concat(existsId,withsId):[];
-    res.mainSymptIds = res.mainSymptIds.concat(existsId,withsId);
   }
 
   // 第二病程-伴位置处理
@@ -298,7 +296,6 @@ export const insertSearch = (state,action)=>{
     // res.saveText[inserIndx] = searchData;
     res.saveText = fullfillText(res.data).saveText;
     res.mainIds.push(id);
-    res.mainSymptIds.push(id);
     res.editClear = false;//主诉框编辑状态
   }else{
     // 替换
@@ -518,7 +515,6 @@ export const clearMainSuit = (state,action)=>{//回读和清除
   // res.saveText = fullfillText(action.data).saveText;//解决删除data里的值保存,回读后页面上有内容saveText里没有的情况
   res.selecteds = action.selecteds?action.selecteds:[];
   res.mainIds = action.mainIds;
-  res.mainSymptIds = action.mainSymptIds;
   if(action.editClear){
     res.editClear = action.editClear;
   }
@@ -611,16 +607,16 @@ export function removeId(state,action){
   const data = res.data;
   const id = data[index].id;
   let ids = res.mainIds;
-  let mainIds = res.mainSymptIds;
   if(ids.includes(id)){
     ids.splice(ids.indexOf(id),1);
   }
-  if(mainIds.includes(id)){
-    mainIds.splice(mainIds.indexOf(id),1);
+  if(!data[index].value && data[index-1].tagType==8){
+    data.splice(index,1);
+  }else{
+    data[index].id = "";
+    data[index].name = text;
+    data[index].value = text;
   }
-  data[index].id = "";
-  data[index].name = text;
-  data[index].value = text;
   res.update = Math.random();
   return res;
 }

+ 1 - 1
src/store/async-actions/homePage.js

@@ -56,7 +56,7 @@ export const getInitModules= (dispatch,getStore)=>{
           emptyData:initData.currentEmpty,//现病史空模板
           saveEmpty:initSaveText.currentEmpty,
         });
-        dispatch(getOtherHisRecord());  console.log(111)        //获取其他史最近记录
+        dispatch(getOtherHisRecord());          //获取其他史最近记录
         initHis(dispatch)
       }else{
         initHis(dispatch)

+ 0 - 1
src/store/reducers/mainSuit.js

@@ -20,7 +20,6 @@ const initState = {
   focusIndex:'',
   mainIds:[], //选中的主症状和伴随的id(搜索去重)
   editClear:true,
-  mainSymptIds:[]//选中的主症状和伴随的id(移植到现病史)
 }
 
 export default function(state=initState,action){

+ 1 - 4
src/utils/tools.js

@@ -177,7 +177,6 @@ const getAllDataList =(baseList) =>{           //获取所有模块结构化的
     jsonData.checkBodySelecteds = baseList.checkBody.selecteds;      //主诉选中状态保存
     jsonData.addItems = baseList.homePage.addItems||{};
     jsonData.mainsuitIds = baseList.mainSuit.mainIds;      //主诉去重
-    jsonData.mainSymptIds = baseList.mainSuit.mainSymptIds;      //主诉去重
     jsonData.currentIds = baseList.currentIll.symptomIds;      //现病史去重
     // console.log(jsonData,'结构化数据获取')
     return jsonData;
@@ -230,7 +229,7 @@ const getAllDataStringList =(baseList) =>{           //获取所有模块文本
  */
 const pushAllDataList =(whichSign,action,reData,type) =>{           //回读清空所有的数据
     if(action == 'clear'){     //清空
-        store.dispatch({type: CLEAR_MAIN_SUIT,data:[],saveText:[],selecteds:[],editClear:true,mainIds:[],mainSymptIds:[]});
+        store.dispatch({type: CLEAR_MAIN_SUIT,data:[],saveText:[],selecteds:[],editClear:true,mainIds:[]});
         store.dispatch({type: CLEAR_CURRENT_ILL,data:[],saveText:[],selecteds:[],editClear:true,symptomIds:[]});
         store.dispatch({type: CLEAROTHERHISTORY,data:[],saveText:[],selecteds:[],editClear:true});
         store.dispatch({type: CLEARCHECKBODY,data:[],isEmpty:true,saveText:[],selecteds:[]});
@@ -264,7 +263,6 @@ const pushAllDataList =(whichSign,action,reData,type) =>{           //回读清
                     selecteds:dataJson.mainSuitSelecteds?dataJson.mainSuitSelecteds:[],
                     saveText:JSON.parse(dataJsonStr.chief),
                     mainIds:dataJson.mainsuitIds?dataJson.mainsuitIds:[],
-                    mainSymptIds:dataJson.mainSymptIds?dataJson.mainSymptIds:[],
                 });
                 store.dispatch({
                     type: CLEAR_CURRENT_ILL,
@@ -318,7 +316,6 @@ const pushAllDataList =(whichSign,action,reData,type) =>{           //回读清
                     selecteds:dataJson.mainSuitSelecteds?dataJson.mainSuitSelecteds:[],
                     saveText:dataJsonStr[0].content ? JSON.parse(dataJsonStr[0].content) :[],
                     mainIds:dataJson.mainsuitIds?dataJson.mainsuitIds:[],
-                    mainSymptIds:dataJson.mainSymptIds?dataJson.mainSymptIds:[],
                 });
                 store.dispatch({
                     type: CLEAR_CURRENT_ILL,