|
@@ -1,6 +1,7 @@
|
|
|
import React,{Component} from 'react';
|
|
|
import style from './index.less';
|
|
|
import {ItemBox} from '@commonComp';
|
|
|
+import Textarea from './Textarea';
|
|
|
|
|
|
class Advice extends Component{
|
|
|
constructor(props){
|
|
@@ -9,11 +10,26 @@ class Advice extends Component{
|
|
|
this.treatInput = React.createRef();
|
|
|
this.assayRef = React.createRef();
|
|
|
this.checkRef = React.createRef();
|
|
|
+ this.adviceInputRef = React.createRef();
|
|
|
this.handleTreatInput = this.handleTreatInput.bind(this);
|
|
|
this.handleAssayInput = this.handleAssayInput.bind(this);
|
|
|
this.handleCheckInput = this.handleCheckInput.bind(this);
|
|
|
+ this.handleComTreatInput = this.handleComTreatInput.bind(this);
|
|
|
+ this.handleAdviceInput = this.handleAdviceInput.bind(this);
|
|
|
}
|
|
|
|
|
|
+ shouldComponentUpdate(next){
|
|
|
+ if(JSON.stringify(next) == JSON.stringify(this.props)){
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ componentWillReceiveProps(next){
|
|
|
+ const isRead = this.props.isRead;
|
|
|
+ // if(next.isRead != isRead||next.value!=this.props.value){ //value对比解决复诊不显示bug
|
|
|
+ // this.adviceInputRef.current.innerText?(this.adviceInputRef.current.innerText = next.value||''):(this.adviceInputRef.current.innerHTML = next.value||'');
|
|
|
+ // }
|
|
|
+ }
|
|
|
handleTreatInput(e, index, ii) {
|
|
|
const {advice} = this.props.pushMessage;
|
|
|
const changeInput = e.target.value //改变的同类药的值
|
|
@@ -33,10 +49,28 @@ class Advice extends Component{
|
|
|
const { setChangeAdviceCheck } = this.props;
|
|
|
setChangeAdviceCheck && setChangeAdviceCheck(changeInput)
|
|
|
}
|
|
|
+ handleComTreatInput(text) {
|
|
|
+ const { comTreatChange } = this.props;
|
|
|
+ comTreatChange && comTreatChange(text)
|
|
|
+
|
|
|
+ }
|
|
|
+ handleAdviceInput(e) {
|
|
|
+ const { adviceInputChange } = this.props;
|
|
|
+ const text = e.target.innerText;
|
|
|
+ console.log(text)
|
|
|
+ adviceInputChange && adviceInputChange(text)
|
|
|
+
|
|
|
+ }
|
|
|
+ componentDidMount(){
|
|
|
+
|
|
|
+ this.adviceInputRef.current.innerText?(this.adviceInputRef.current.innerText = '') : (this.adviceInputRef.current.innerHTML = '')
|
|
|
+ // this.$dom.current.nextSibling.innerText?(this.$dom.current.nextSibling.innerText = ''):(this.$dom.current.nextSibling.innerHTML = '')
|
|
|
+
|
|
|
+}
|
|
|
|
|
|
render(){
|
|
|
const {advice} = this.props.pushMessage;
|
|
|
- let billing = ''
|
|
|
+ const {isRead} = this.props
|
|
|
|
|
|
|
|
|
|
|
@@ -61,16 +95,17 @@ class Advice extends Component{
|
|
|
{advice.assay && <span className={style['treat-input']}> {advice.assay}</span>}
|
|
|
{advice.check && <span className={style['treat-input']}> {advice.check}</span>}
|
|
|
</div> */}
|
|
|
- {advice.commontreatment && advice.commontreatment.length > 0 &&<div className={style['billing']} contentEditable={true} style = {{outline: 'none'}}>
|
|
|
+ {advice.commontreatment && advice.commontreatment.length > 0 &&<div className={style['billing']} >
|
|
|
{advice.commontreatment && advice.commontreatment.length > 0 && <h1>一般治疗</h1>}
|
|
|
- {advice.commontreatment && <span className={style['treat-input']} >{advice.commontreatment} </span>}
|
|
|
+ {/* {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>}
|
|
|
{advice.scheme && advice.scheme.length > 0 &&<div contentEditable='false' className={style['scheme']}>
|
|
|
{advice.scheme && advice.scheme.length > 0 && <h1>治疗方案</h1>}
|
|
|
{scheme}
|
|
|
</div>}
|
|
|
- <div contentEditable={true} style = {{outline: 'none'}}>
|
|
|
-
|
|
|
+ <div className={style['billing']} ref={this.adviceInputRef} contentEditable={true} style = {{outline: 'none'}} onInput={this.handleAdviceInput} >
|
|
|
+
|
|
|
</div>
|
|
|
</ItemBox>
|
|
|
</div>
|