瀏覽代碼

主诉标点符号字数限制

liucf 6 年之前
父節點
當前提交
d09d3b992c

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

@@ -43,7 +43,7 @@ class NumberUnitDrop extends Component{
     this.changeToEdit = this.changeToEdit.bind(this);
   }
   select(obj){         //选中键盘上数字事件
-    const {handleSelect,ikey,suffix,prefix,mainSaveText,formulaCode} = this.props;
+    const {handleSelect,ikey,suffix,prefix,mainSaveText,formulaCode,mainData} = this.props;
     this.setState({
       hasSelect:true
     });
@@ -52,7 +52,7 @@ class NumberUnitDrop extends Component{
         value:''
       });
     }
-    handleSelect&&handleSelect({ikey,text:obj.text,suffix,prefix,mainSaveText,mark:obj.mark,formulaCode});
+    handleSelect&&handleSelect({ikey,text:obj.text,suffix,prefix,mainSaveText,mark:obj.mark,formulaCode,mainData});
   }
   
   handleNumClick(e){ 

+ 1 - 1
src/config/index.js

@@ -26,7 +26,7 @@ export default {
     addOthSId:21,      //现病史 添加其他症状id
     banId:10,       //伴 id
     limited:30,    //主诉限制字数
-    limitText:"已超过30字符,请修改主诉",    //主诉限制提示
+    limitText:"已超过30字符(含标点),请修改主诉",    //主诉限制提示
     delayTime:500,      //延迟搜索的时间
     delayPushTime:1000,    //延迟推送时间
     pushDelay:1000,

+ 16 - 4
src/containers/NumberUnitDrop.js

@@ -15,6 +15,7 @@ import config from '@config/index.js';
 function mapStateToProps(state){
   return {
     mainSaveText:state.mainSuit.saveText,
+    mainData:state.mainSuit.data,
   }
 }
 //查体数字键盘选中
@@ -47,13 +48,22 @@ function currentSelect(dispatch,params){
 }
 
 function handleModuleDiff(dispatch,params){
-  const {mainSaveText,mark} = params;
+  const {mainSaveText,mark,mainData} = params;
   const type = params.ikey.substr(0,1);    //当前所在的项目
+  let ikey = getLabelIndex(params.ikey);
   switch (+type){
     case 1:
       if(mark){//选中才限制,清空和回退无需验证
-        let text = filterDataArr(mainSaveText);
-        if(text.length >= config.limited){
+        // let text = filterDataArr(mainSaveText);
+        let text = filterArr(mainSaveText);
+        const item = mainData[+ikey];
+        const nextItem = mainData[+ikey+1];
+        let lengths = text.length;
+        if(nextItem&&nextItem.tagType==8 && nextItem.tagName==',' && item.value){
+          lengths = text.length + 1;
+        }
+        // console.log(999,mainSaveText,lengths);
+        if(lengths >= config.limited){
           Notify.info(config.limitText);
           return
         }
@@ -135,7 +145,9 @@ function mapDispatchToProps(dispatch,store){
           type:ISREAD
         })
       }
-      
+      dispatch({
+        type: ISREAD
+      });
     },
     handleDbclick(obj){
       dispatch({

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

@@ -27,7 +27,14 @@ function modulesParseJson(data){
 export const getInitModules= (dispatch,getStore)=>{
   const state = getStore();
   const {message} = state.patInfo;
-  return json(api.getModules,{age:message.patientAge,sexType:message.sex}).then((res) => {
+  const param = {
+    age:message.patientAge,
+    sexType:message.sex,
+    mouduleType:1,//慢病2  科室1 其他0
+    relationId:message.hospitalDeptId, //慢病id  科室id  其他0
+  }
+  // return json(api.getModules,{age:message.patientAge,sexType:message.sex}).then((res) => {
+  return json(api.getModules,param).then((res) => {
       dispatch(initHistoryDetails(message));      //历史病历回读
       if (res.data.code == '0') {
         const newObj = modulesParseJson(res.data.data);

+ 2 - 1
src/store/async-actions/mainSuit.js

@@ -18,7 +18,8 @@ export const getCommSymptoms = ()=>{//获取常见症状
     const params = {
       'deptId':deptCode,
       'age':message.patientAge,
-      'sexType':message.sex
+      'sexType':message.sex,
+      'type':1
     };
     json(api.getCommSymptoms,params).then((res)=>{
         let result = res.data;