瀏覽代碼

一般治疗添加到医嘱

zhangxc 6 年之前
父節點
當前提交
7d7d482fba
共有 2 個文件被更改,包括 11 次插入12 次删除
  1. 5 3
      src/components/Advice/Textarea/index.jsx
  2. 6 9
      src/components/Advice/index.jsx

+ 5 - 3
src/components/Advice/Textarea/index.jsx

@@ -31,14 +31,16 @@ class Textarea extends Component {
   }
   componentWillReceiveProps(next){
     const isRead = this.props.isRead;
-    if(next.isRead != isRead||next.value!=this.props.value){      //value对比解决复诊不显示bug
-      this.$dom.current.innerText?(this.$dom.current.innerText = next.value||''):(this.$dom.current.innerHTML = next.value||'');
+    if(next.isRead != isRead && next.value!=this.props.value){      //value对比解决复诊不显示bug
+      next.value ? this.$dom.current.innerText = next.value :  ''
+      // this.$dom.current.innerText?(this.$dom.current.innerText = next.value||''):(this.$dom.current.innerHTML = next.value||'');
     }
   }
   componentDidMount(){
     const {value} = this.props;
     if(value && value.trim()){
-      this.$dom.current.innerText?(this.$dom.current.innerText = value) : (this.$dom.current.innerHTML = value)
+      this.$dom.current.innerText = value
+      // this.$dom.current.innerText ? (this.$dom.current.innerText = value) : (this.$dom.current.innerHTML = value)
     //   this.$dom.current.nextSibling.innerText?(this.$dom.current.nextSibling.innerText = ''):(this.$dom.current.nextSibling.innerHTML = '')
     }
   }

+ 6 - 9
src/components/Advice/index.jsx

@@ -38,13 +38,11 @@ class Advice extends Component{
   }
 
   handleAssayInput(e) {
-    console.log(e.target.value)
     const changeInput = e.target.value
     const { setChangeAdviceAssay } = this.props;
     setChangeAdviceAssay && setChangeAdviceAssay(changeInput)
   }
   handleCheckInput(e) {
-    console.log(e.target.value)
     const changeInput = e.target.value
     const { setChangeAdviceCheck } = this.props;
     setChangeAdviceCheck && setChangeAdviceCheck(changeInput)
@@ -54,17 +52,15 @@ class Advice extends Component{
     comTreatChange && comTreatChange(text)
 
   }
-  handleAdviceInput(e) {
+  handleAdviceInput(text) {
     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 = '')
+  // const {advice} = this.props.pushMessage.advice
+  // console.log('adviceInput', this.props.pushMessage)
   
 }
 
@@ -104,8 +100,9 @@ class Advice extends Component{
           {advice.scheme && advice.scheme.length > 0  && <h1>治疗方案</h1>}
           {scheme}
         </div>}
-        <div className={style['billing']} ref={this.adviceInputRef} contentEditable={true} style = {{outline: 'none'}} onInput={this.handleAdviceInput} > 
-              
+        <div className={style['billing']} > 
+            {!advice.adviceInput && <Textarea value='' isRead={isRead} handleChangeAssistValue={this.handleAdviceInput} ></Textarea>}
+            {advice.adviceInput && <Textarea value={advice.adviceInput} isRead={isRead} handleChangeAssistValue={this.handleAdviceInput} ></Textarea>}
         </div>
       </ItemBox>
     </div>