Selaa lähdekoodia

Merge remote-tracking branch 'origin/ChronicMag' into ChronicMag

zhouna 6 vuotta sitten
vanhempi
commit
f855d74808

+ 9 - 2
src/common/components/InlineTag/index.jsx

@@ -32,6 +32,11 @@ class InlineTag extends Component {
   }
   changeToEdit(e){
     const {handledbClick,id} = this.props;
+    // 输入框有值才可以双击编辑
+    const text = this.$span.current.innerText;
+    if(!text.trim()){
+      return
+    }
     this.setState({
       editable:true
     });
@@ -64,6 +69,7 @@ class InlineTag extends Component {
    // e.target.innerText = text;  
   }
   handleBlur(e){         //鼠标离开是保存值到store中
+    e.stopPropagation(); //不阻止会触发外层div的失焦事件
     const {value} = this.state;
     const {handleInput,ikey,prefix,suffix} = this.props;
     this.$span.current.innerText?(this.$span.current.innerText=''):(this.$span.current.innerHTML='');      //修改生成文字变成输入的2倍bug
@@ -118,12 +124,13 @@ class InlineTag extends Component {
   }
   render(){
     const {placeholder,value,prefix,suffix} = this.props;
+    const {editable} = this.state;
     const inp = this.state.value;
     return <div className={this.getStyle()}
                  onDoubleClick={this.changeToEdit}
-                  onClick={this.handleFixClick}
+                  onClick={!editable?this.handleFixClick:''}
                  onkeydown={handleEnter}
-                 onBlur={this.changeToClick} ref={this.$box} contentEditable={this.state.editable}>
+                 onBlur={this.changeToClick} ref={this.$box} contentEditable={editable}>
                 {prefix}
                 <span className={style['free-in']}
                       contentEditable={true}

+ 1 - 1
src/components/Advice/index.jsx

@@ -93,7 +93,7 @@ class Advice extends Component{
             {/* {advice.commontreatment && <div className={style['treat-input']}  onInput={this.handleComTreatInput}  contentEditable={true} style = {{outline: 'none'}}></div>} */}
             {<Textarea value={advice.commontreatment} isRead={isRead} handleChangeAssistValue={this.handleComTreatInput} ></Textarea>}
         </div>}
-        {!isFirstMainDiag && followUp &&<div><FollowUp  noHeader="true" textStyle={{padding: '0 10px'}}  setFollowUp={saveFollowUp} followUp = {followUp} isRead={isRead}></FollowUp></div>}
+        {!isFirstMainDiag && hasFollowUp &&<div><FollowUp  noHeader="true" textStyle={{padding: '0 10px'}}  setFollowUp={saveFollowUp} followUp = {followUp} isRead={isRead}></FollowUp></div>}
         {advice.scheme && advice.scheme.length > 0 &&<div contentEditable='false' className={style['scheme']}>
           {advice.scheme && advice.scheme.length > 0  && <h1>治疗方案</h1>}
           {scheme}

+ 3 - 3
src/components/Treat/DrugHistory/LastDrug/index.jsx

@@ -15,9 +15,9 @@ class LastDrug extends Component {
         this.setDrugInfo = this.setDrugInfo.bind(this);
     }
     handleMouseEnterDrug(index, item) {
-        const drugNameWidth = parseInt($('#'+item.id)[0].offsetWidth)
-        const imgLeft = drugNameWidth/2-8
-        $('#'+item.id).find('img').css('left', imgLeft)
+        // const drugNameWidth = parseInt($('#'+item.id)[0].offsetWidth)
+        // const imgLeft = drugNameWidth/2-8
+        // $('#'+item.id).find('img').css('left', imgLeft)
         this.setState({
             currentIndex: index,
         })

+ 2 - 1
src/components/Treat/DrugHistory/LastDrug/index.less

@@ -17,6 +17,7 @@
 .info-img {
     position: absolute;
     width: 15px;
-    position: absolute;
     top: -8px;
+    left: 50%;
+    margin-left: -7px;
 }

+ 1 - 1
src/containers/AdviceContainer.js

@@ -10,7 +10,7 @@ function mapStateToProps(state) {
         adviceInput: state.pushMessage.advice.adviceInput,
         isFirstMainDiag:  state.treat.isFirstMainDiag,
         followUp: state.pushMessage.advice.followUp,
-        hasFollowUp: state.treat.hasFollowUp,
+        hasFollowUp: state.pushMessage.advice.hasFollowUp,
         typeConfig: state.typeConfig.typeConfig
     })
 }

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

@@ -159,7 +159,9 @@ export const setData = (state,action) =>{
       let firstT = 0;
       mainData.map((v,i)=>{
         // 主诉通用症状描述
-        if(v.id==config.tongYId && v.value && !v.pos){tongYong = v.value;}
+        // if(v.id==config.tongYId && v.value && !v.pos){tongYong = v.value;}
+        // id会改变,故通过打标来获取flag=5
+        if(v.flag==5 && v.value && !v.pos){tongYong = v.value;}
         if(v.exist){v.exist==1?main.push(v):withs.push(v)}
         // 时间单位
         if(v.controlType==5&&v.value){

+ 3 - 0
src/store/actions/pushMessage.js

@@ -292,6 +292,9 @@ export const setAdviceInput = (state, action) => {
 export const saveFollowUp = (state, action) => {
 	const res = JSON.parse(JSON.stringify(state));
 	res.advice.followUp = action.followUp;
+	if(action.hasFollowUp) {
+		res.advice.hasFollowUp = action.hasFollowUp 
+	}
 	return res;
 }
 

+ 9 - 5
src/store/async-actions/treat.js

@@ -247,7 +247,7 @@ function getTreatment(item, dispatch, state,url,params, isChronic) {
             }
             if(followUp) {  
                 const followUpList = state.treat.followUpList
-                if(followUpList) {  //判断之前有没有存过的回访时间,如果有替换掉
+                if(followUpList) {  //判断之前有没有存过的回访时间,如果有替换掉
                     for(let i = 0; i < followUpList.length; i++) {
                         if(item.id == followUpList[i].id) {
                             followUp = followUpList[i].followUp
@@ -396,10 +396,14 @@ export const commonTreatAddToAdvice = () => {
                 type: SET_COMMONTREATMENT,
                 commontreatment: state.treat.treatItem.treat.commonTreatment.text
             })
-            dispatch({
-                type: SAVE_FOLLOW_UP,
-                followUp: state.treat.followUp
-            })
+            if(followUp) {
+                dispatch({
+                    type: SAVE_FOLLOW_UP,
+                    followUp: followUp,
+                    hasFollowUp: true
+                })
+            }
+            
         } else {
             return
         }