Browse Source

文本模式下主诉禁止回车;杂音类型处理函数调整

liucf 6 năm trước cách đây
mục cha
commit
6dd5a34dc7

+ 11 - 1
src/common/components/Textarea/index.jsx

@@ -18,6 +18,7 @@ class Textarea extends Component {
     this.handleInput = this.handleInput.bind(this);
     this.handleFocus = this.handleFocus.bind(this);
     this.handleBlur = this.handleBlur.bind(this);
+    this.handleKeydown = this.handleKeydown.bind(this);
   }
   handleFocus(){            //初始显示props中的值,focus已经显示输入的值,避免值更新闪烁
     const {handleFocus,fuzhen,handleInput} = this.props;
@@ -98,6 +99,14 @@ class Textarea extends Component {
     //存值到store
     handleInput&&handleInput({text});
   }
+  handleKeydown(e){
+    const {boxMark} = this.props;
+    const ev = e||window.event;
+    if(+boxMark==1){
+      //禁止回车事件
+      if(ev.keyCode==13){return false;}
+    }
+  }
   render() {
     const { title } = this.props;
     return (
@@ -109,7 +118,8 @@ class Textarea extends Component {
              ref={this.$dom}
              contentEditable={true}
              onInput={this.handleInput}
-             onBlur={this.handleBlur}>
+             onBlur={this.handleBlur}
+             onkeydown={this.handleKeydown}>
         </div>
       </div>
     );

+ 9 - 5
src/containers/SpreadDrop.js

@@ -136,7 +136,7 @@ function currentIll(dispatch,store,params){
   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(",");console.log("点击的下标是:",index,"选中的id是:",ids)
+  const ids = (existsId.concat(withsId)).join(",");
   let has = [],wes=[];
   //获取选中项目模板
   fetchModules(ids).then((res)=>{
@@ -309,7 +309,8 @@ function mainSuitCheck(dispatch,store,params){
   let ikey = getLabelIndex(index);
   dispatch({
     type: COMM_CONFIRM,
-    data: {exists:exists,existsName:existsName,ikey}
+    // data: {exists:exists,existsName:existsName,ikey}
+    data:Object.assign({},params,{existsName,withsName,labelInx})
   });
   dispatch({//隐藏下拉
     type:HIDEDROP
@@ -324,7 +325,8 @@ function currentCheck(dispatch,store,params){
   let labelInx = getLabelIndex(ikey);
   dispatch({
     type:SETMAINCHECKBOX,
-    data:{labelInx,ikey,exclusion,excluName,nones,exists,existsName,noneIds,noneOn,nowOn,withOn,withs,withsName}
+    // data:{labelInx,ikey,exclusion,excluName,nones,exists,existsName,noneIds,noneOn,nowOn,withOn,withs,withsName}
+    data:Object.assign({},params,{existsName,withsName,labelInx})
   })
 }
 
@@ -337,7 +339,8 @@ function checkBodyCheck(dispatch,store,params){
   let labelInx = getLabelIndex(ikey);
   dispatch({
     type:SETCHECKBOX,
-    data:{labelInx,ikey,exclusion,excluName,nones,exists,existsName,noneIds,noneOn,nowOn,withOn,withs,withsName}
+    // data:{labelInx,ikey,exclusion,excluName,nones,exists,existsName,noneIds,noneOn,nowOn,withOn,withs,withsName}
+    data:Object.assign({},params,{existsName,withsName,labelInx})
   })
 }
 //其他史普通多选确定
@@ -348,7 +351,8 @@ function otherHisCheck(dispatch,store,params){
   let labelInx = getLabelIndex(ikey);
   dispatch({
     type:SETOTHERCHECKBOX,
-    data:{labelInx,ikey,exclusion,excluName,nones,exists,existsName,noneIds,noneOn,nowOn,withOn,withs,withsName}
+    // data:{labelInx,ikey,exclusion,excluName,nones,exists,existsName,noneIds,noneOn,nowOn,withOn,withs,withsName}
+    data:Object.assign({},params,{existsName,withsName,labelInx})
   })
 }
 

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

@@ -204,8 +204,8 @@ export function setCheckText(state,action) {
 //多选文字,如杂音
 export function setCheckBoxValue(state,action) {
   let res = Object.assign({},state);
-  const {labelInx,excluName,existsName,nones,withsName} = action.data;
-  let showText = (excluName||'')+(existsName||'')+(nones||'')+(withsName||'');
+  const {labelInx,excluName,existsName,nones,withsName,ban} = action.data;
+  let showText = (excluName||'')+(existsName||'')+(ban.name||'')+(withsName||'')+(nones||'');
   // 若每个选项都有符号,去掉最后一个,因与标签间的符号有冲突
   let pattern = new RegExp(/\,+$|\,+$|\.+$|\。+$|\、+$/);//+ 一次或多次
   if(pattern.test(showText)){

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

@@ -79,7 +79,7 @@ export const setData = (state,action) =>{
     objToArr.push(mainLabelModule[m]);
   }*/
   // 过滤掉没有mapping的数据
-  let mainLabelModuleArr = objToArr;console.log(5,action,mainModleData,mainLabelModuleArr);
+  let mainLabelModuleArr = objToArr;
   /*let mainLabelModuleArr = objToArr.filter((item)=>{
     return item.questionMapping.length>0;
   })*/
@@ -100,7 +100,7 @@ export const setData = (state,action) =>{
     })
     useEmpty = existData&&existData.length>0?false:true;
   }
-  // console.log(888,useEmpty);
+  
   if (useEmpty) {
     // res.data = res.emptyData;
     res.data = JSON.parse(JSON.stringify(res.emptyData));
@@ -244,7 +244,6 @@ export const setData = (state,action) =>{
       }
       
       let symptomArr = newMainCopy.concat(manInput,newWiths,manWithInput);
-      console.log("组装好的数据:",symptomArr,manInput,manWithInput);
       let newSymptomArr = JSON.parse(JSON.stringify(symptomArr));  
       //组装好的主症状和伴随症状插入现病史模板(flag=4前)
       let insertIdx = null;
@@ -370,16 +369,15 @@ export const confirm = (state,action) =>{
 //普通多选确定事件-主诉通用特征、初为后为等
 export const setCheckBox = (state,action)=>{
   const res = Object.assign({},state);
-  const {exists,labelInx,existsName} = action.data;
+  const {labelInx,excluName,existsName,nones,withsName,ban} = action.data;
   // 若每个选项都有符号,去掉最后一个,因与标签间的符号有冲突
-  let names=existsName;
+  let showText = (excluName||'')+(existsName||'')+(ban.name||'')+(withsName||'')+(nones||'');
   let pattern = new RegExp(/\,+$|\,+$|\.+$|\。+$|\、+$/);//+ 一次或多次
-  if(pattern.test(existsName)){
-    names = existsName.substr(0,existsName.length-1);
+  if(pattern.test(showText)){
+    showText = showText.substr(0,showText.length-1);
   }
-  let arr = res.data;
-  arr[labelInx].value = names;
-  res.saveText[labelInx] = names;
+  res.data[labelInx].value = showText;
+  res.saveText[labelInx] = showText;
   res.selecteds[labelInx] = action.data;
   res.update=Math.random();
   return res;

+ 7 - 8
src/store/actions/mainSuit.js

@@ -264,17 +264,16 @@ export const confirm = (state,action) =>{
 // 普通多选确定事件
 export const commConfirm=(state,action)=>{
   const res = Object.assign({},state);
-  const {exists,ikey,existsName} = action.data;
+  const {labelInx,excluName,existsName,nones,withsName,ban} = action.data;
   // 若每个选项都有符号,去掉最后一个,因与标签间的符号有冲突
-  let names=existsName;
+  let showText = (excluName||'')+(existsName||'')+(ban.name||'')+(withsName||'')+(nones||'');
   let pattern = new RegExp(/\,+$|\,+$|\.+$|\。+$|\、+$/);//+ 一次或多次
-  if(pattern.test(existsName)){
-    names = existsName.substr(0,existsName.length-1);
+  if(pattern.test(showText)){
+    showText = showText.substr(0,showText.length-1);
   }
-  let arr = res.data;
-  arr[ikey].value = names;
-  res.saveText[ikey] = names;
-  res.selecteds[ikey] = action.data;
+  res.data[labelInx].value = showText;
+  res.saveText[labelInx] = showText;
+  res.selecteds[labelInx] = action.data;
   res.update=Math.random();
   return res;
 }

+ 4 - 4
src/store/actions/otherHistory.js

@@ -196,10 +196,10 @@ export function setOtherInput(state,action){
 
 //多选文字,如杂音
 export function setCheckBoxValue(state,action) {
-  let res = Object.assign({},state);
-  const {labelInx,excluName,existsName,nones,withsName} = action.data;
-  let showText = (excluName||'')+(existsName||'')+(nones||'')+(withsName||'');
+  const res = Object.assign({},state);
+  const {labelInx,excluName,existsName,nones,withsName,ban} = action.data;
   // 若每个选项都有符号,去掉最后一个,因与标签间的符号有冲突
+  let showText = (excluName||'')+(existsName||'')+(ban.name||'')+(withsName||'')+(nones||'');
   let pattern = new RegExp(/\,+$|\,+$|\.+$|\。+$|\、+$/);//+ 一次或多次
   if(pattern.test(showText)){
     showText = showText.substr(0,showText.length-1);
@@ -207,7 +207,7 @@ export function setCheckBoxValue(state,action) {
   res.data[labelInx].value = showText;
   res.saveText[labelInx] = showText;
   res.selecteds[labelInx] = action.data;
-  res.update = Math.random();
+  res.update=Math.random();
   return res;
 }
 //搜索结果