Browse Source

保存病例首字母自动填写

zhangxc 5 years ago
parent
commit
a648b834b8

+ 6 - 0
src/components/Advice/Textarea/index.jsx

@@ -23,6 +23,10 @@ class Textarea extends Component {
     handleChangeAssistValue&&handleChangeAssistValue(text);
    
   }
+  handleFocus() {
+    const {handleFocus} = this.props
+    handleFocus&&handleFocus()
+  }
   shouldComponentUpdate(next){
     if(JSON.stringify(next) == JSON.stringify(this.props)){
       return false;
@@ -40,6 +44,7 @@ class Textarea extends Component {
   }
   componentDidMount(){
     const {value} = this.props;
+    console.log("aaaavalue",value)
     if(value && value.trim()){
       this.$dom.current.innerHTML = value
       // this.$dom.current.focus()
@@ -70,6 +75,7 @@ class Textarea extends Component {
             className={`${style['text']} ${setFontColorSize(2)}`}
             contenteditable={true}
             ref={this.$dom}
+            onFocus={this.handleFocus}
             onInput={this.handleInput}
             onKeyUp={this.handleInput}
             onkeydown={(e) => {e.stopPropagation()}}

+ 104 - 9
src/components/Operation/index.jsx

@@ -42,6 +42,7 @@ class Operation extends Component {
       folderNameVal:'',//选中文件夹名称
       folderId:'',//选中文件夹名称
       folderListShow:false, //文件夹列表展示
+      showSaveModule:false, //保存病例模板
     }
     this.showPrint = this.showPrint.bind(this);
     this.closePrint = this.closePrint.bind(this);
@@ -56,7 +57,11 @@ class Operation extends Component {
     this.handleChangeIpt = this.handleChangeIpt.bind(this);
     this.newFolder = this.newFolder.bind(this);
     this.saveNewFolder = this.saveNewFolder.bind(this);
-    this.folderManage = this.folderManage.bind(this)
+    this.folderManage = this.folderManage.bind(this);
+    this.changeTitle = this.changeTitle.bind(this);
+    this.closeDiagBox = this.closeDiagBox.bind(this);
+    this.spellFst = this.spellFst.bind(this);
+    this.$inp = React.createRef()
   }
 
   showPrint() {
@@ -184,6 +189,9 @@ class Operation extends Component {
         }
       }
     }
+    this.setState({
+      showSaveModule: true
+    })
     this.setState({
       title: '',
       sex:'3',
@@ -192,19 +200,39 @@ class Operation extends Component {
       borderColor: '#3B9ED0',
       okColor: '#fff',
       oKBg: '#3B9ED0',
-      msg: this.changeTitle()
+      // msg: this.changeTitle()
     })
     admin&&getFloderList()//获取文件夹列表
-    diagShowTmp(true)
+    // diagShowTmp(true)
   }
   spellFst(){
     console.log(this.state.title)
+    const {diagShowTmp} = this.props
     let tmpFst = pinyin.getCamelChars(this.state.title);
     console.log(tmpFst)
     console.log(tmpFst.substr(0,1).toUpperCase())
     this.setState({fstName:tmpFst})
+    console.log(this.$inp)
+      // this.$inp.current.vaule = tmpFst
+    document.getElementById ('FstInp').value=tmpFst
+    
+  }
+  closeSaveModule() {
+    const {diagShowTmp} = this.props
+    const { type } = this.state;
+    if (type == 3){
+      this.setState({
+        showSaveModule: false
+      })
+      diagShowTmp(false)
+      this.setState({ title: '',deptId:"",value:"",folderListShow:false })
+      this.setState({fstName:''})
+    }
   }
   changeTitle() {
+    console.log('testChangeTitle', this.state.fstName)
+    const {isRead,typeConfig} = this.props
+    const value = this.state.fstName
     return <div className={style['box']}>
       <div className={style['iptWrap']}>
         <div className={style.name}>
@@ -225,11 +253,13 @@ class Operation extends Component {
         <div className={`${style.name} ${style.firstname}`}>
           <span className={style.leftName}>模板名首拼:</span>
           <input className={style['ipt']}
-            placeholder=""
+            ref = {this.$inp}
+            value={value}
+            id='FstInp'
+            placeholder=''
             type="text"
             maxLength='30'
-            value={this.state.fstName}
-            onFocus={()=>this.spellFst()}
+            onFocus={() =>this.spellFst()}
             onInput={(e) => {
               this.handleInputFst(e)
             }}
@@ -396,7 +426,7 @@ class Operation extends Component {
     const { showPrint, closePrint, showPreview, closePreview,handleChangeIpt,newFolder,folderManage } = this;
     const { visible, preVisible,diagShow } = this.props.print;
     const {winWidth,cancelDelTag,departLis,handleChangeValue,admin,floderListAdmin,folderModalShow,floderModal,folderOrderShow,folderOrder,adminItems,patInfo,saveOrderFolder} = this.props;
-    const {zIndex,type,le,value,folder,folderListShow} = this.state;
+    const {zIndex,type,le,value,folder,folderListShow,showSaveModule} = this.state;
     return <div className={style['container']} style={{left:le}}>
       <span className={style['button']} onClick={showPrint}><img src={printImg} /> 打印病历</span>
       <span className={style['preButton']} onClick={showPreview}><img src={preview} /> 预览</span>
@@ -406,7 +436,72 @@ class Operation extends Component {
       <span className={winWidth<=1082?`${style['clearButton']} ${style['saveButton']} ${style['minstyle']}`:`${style['clearButton']} ${style['saveButton']}`} onClick={() => { this.clearAll(2) }}>清除</span>
       {visible?<PrintPreviewContainer visible={visible} onClose={closePrint} />:null}
       {preVisible?<PreviewContainer visible={preVisible} onClose={closePreview} />:null}
-      <ConfirmModal
+      {showSaveModule&&<ConfirmModal
+        visible={showSaveModule}        //改为全局控制
+        confirm={() => { this.makeSure() }}
+        close={() => { this.closeSaveModule()}}
+        cancel={() => {this.closeSaveModule()}}
+        okText={this.state.okText}
+        height={type==3&admin?365:type==3&!admin?275:200}
+        width={585}
+        okBorderColor={this.state.borderColor}
+        okColor={this.state.okColor}
+        oKBg={this.state.oKBg}
+        borderBtm='1px solid #ccc'
+        title='保存病历模板'
+      >
+        {this.changeTitle()}
+        {
+          admin&&type==3?<div className={style.addList}>
+            <div className={style.department}>
+              <span className={style.leftName}>科室归属:</span>
+                <Search handleChangeValue={handleChangeValue} handleChangeIpt={handleChangeIpt} value={value} visible={true} zIndex={11}>
+                {
+                  departLis.length>0&&value&&<ul className={style.departLis}>
+                    {
+                      departLis.map((item,idx)=>{
+                        return <li onClick={()=>this.setDeptId(item.id,item.conceptDeptName)}>
+                          {item.conceptDeptName}
+                        </li>
+                      })
+                    }
+                  </ul>
+                }
+                </Search>
+              <span style={{paddingRight:0,color:'#777777'}}>(支持汉字关键字搜索)</span>
+          </div>
+            <div className={style.department}>
+              <span className={style.leftName}>存储为:</span>
+                <div  className={style.selectFolder}>
+                  <input className={style.selectFolderIpt}
+                    type="text"
+                    maxLength='30'
+                    readOnly
+                    value={this.state.folderNameVal}
+                    onClick={(e) => {
+                      this.handleFolderShow(e)
+                    }}
+                  />
+                  <img src={slideDown} alt=""/>
+                </div>
+                {
+                  floderListAdmin.length>0&&folderListShow&&<ul className={`${style.departLis} ${style.departLisFolder}`}>
+                    {
+                      floderListAdmin.map((item,idx)=>{
+                        return <li onClick={()=>this.setFolderId(item.id,item.name)}>
+                          {item.name}
+                        </li>
+                      })
+                    }
+                  </ul>
+                }
+              <span className={style.newFolder} onClick={()=>newFolder(true)}>新建文件夹</span>
+              <span className={style.mangerFolder} onClick={()=>folderManage(true)}>管理文件夹</span>
+          </div>
+          </div>:null
+        }
+      </ConfirmModal>}
+      {<ConfirmModal
         visible={diagShow}        //改为全局控制
         confirm={() => { this.makeSure() }}
         close={() => { this.closeDiagBox()}}
@@ -470,7 +565,7 @@ class Operation extends Component {
           </div>
           </div>:null
         }
-      </ConfirmModal>
+      </ConfirmModal>}
       <FolderName 
         folderModalShow={folderModalShow}
         floderModal={floderModal}

+ 1 - 1
src/containers/OperationContainer.js

@@ -36,7 +36,7 @@ function mapStateToProps(state) {
     folderModalShow:state.tabTemplate.folderModalShow,
     folderOrderShow:state.tabTemplate.folderOrderShow,
     adminItems: state.tabTemplate.adminItems,
-    patInfo: state.patInfo.message
+    patInfo: state.patInfo.message,
   });
 }