|
@@ -4,7 +4,7 @@ import Notify from '../Notify';
|
|
|
import config from '@config/index';
|
|
|
import {isIE,moveEnd} from '@utils/tools.js';
|
|
|
import {getFeature} from '@store/async-actions/fetchModules';
|
|
|
-import {getAllDataList,getAllDataStringList,ifOtherClear} from "@utils/tools.js";
|
|
|
+import {getAllDataList,getAllDataStringList,ifOtherClear,setFontColorSize} from "@utils/tools.js";
|
|
|
import store from '@store';
|
|
|
import $ from "jquery";
|
|
|
import {SET_CURRENT_MODULE} from '@types/homePage';
|
|
@@ -16,7 +16,6 @@ class BlockInp extends Component {
|
|
|
this.state = {
|
|
|
timer:null,
|
|
|
inpText:'',
|
|
|
- overFlag:false,
|
|
|
};
|
|
|
this.$dom = React.createRef();
|
|
|
this.handleInput = this.handleInput.bind(this);
|
|
@@ -26,7 +25,7 @@ class BlockInp extends Component {
|
|
|
this.handleBlur = this.handleBlur.bind(this);
|
|
|
}
|
|
|
handleFocus(e){ //初始显示props中的值,focus已经显示输入的值,避免值更新闪烁
|
|
|
- const {handleFocus,fuzhen,handleInput,isChronic,hasMain,boxMark,title} = this.props;
|
|
|
+ const {handleFocus,boxMark,title} = this.props;
|
|
|
const state = store.getState()
|
|
|
const moduleName = state.homePage.moduleName
|
|
|
//黏贴时去掉html格式
|
|
@@ -39,13 +38,8 @@ class BlockInp extends Component {
|
|
|
moveEnd($(that.$dom.current)[0]); //光标落到最后去
|
|
|
});
|
|
|
});
|
|
|
- //const {inpText} = this.state;console.log(inpText,boxMark,hasMain)
|
|
|
- handleFocus&&handleFocus(); //其他史、查体获取数据的方法
|
|
|
- /*if(fuzhen&& !isChronic&&!(this.$dom.current.innerText?this.$dom.current.innerText:this.$dom.current.innerHTML)){
|
|
|
- const text = config.currentText.replace("(**)",fuzhen.replace(";",''));
|
|
|
- this.$dom.current.innerText?(this.$dom.current.innerText = text):(this.$dom.current.innerHTML = text);
|
|
|
- handleInput&&handleInput({text});
|
|
|
- }*/
|
|
|
+ handleFocus&&handleFocus(); //其他史获取上一次记录
|
|
|
+
|
|
|
if(moduleName != title) {
|
|
|
store.dispatch({
|
|
|
type: SET_CURRENT_MODULE,
|
|
@@ -57,36 +51,15 @@ class BlockInp extends Component {
|
|
|
|
|
|
}
|
|
|
handleInput(e){
|
|
|
- const {handleInput,boxMark,handlePush,value} = this.props;
|
|
|
- const {inpText,overFlag} = this.state;
|
|
|
+ const {handleInput,handlePush,boxMark} = this.props;
|
|
|
const text = e.target.innerText || e.target.innerHTML.replace(/ +/g,' ').replace(/<br>$/,'');
|
|
|
const stimer = this.state.timer;//console.log(e.target,text)
|
|
|
- if(boxMark=='1'&&text.length>config.limited){ //主诉字符数限制
|
|
|
- e.target.innerText?(e.target.innerText = text.substr(0,config.limited)):(e.target.innerHTML = text.substr(0,config.limited));
|
|
|
- e.target.blur();
|
|
|
- Notify.error(config.limitText);
|
|
|
- if(overFlag){
|
|
|
- e.target.innerText?(e.target.innerText = inpText):(e.target.innerHTML = inpText);
|
|
|
- return
|
|
|
- }
|
|
|
- this.setState({
|
|
|
- inpText:text.substr(0,config.limited),
|
|
|
- overFlag:true
|
|
|
- });
|
|
|
- handleInput&&handleInput({text:text.substr(0,config.limited).replace('<br>','')});
|
|
|
- return;
|
|
|
- }
|
|
|
- /*if(boxMark=='3'&&!hasMain){
|
|
|
- e.target.innerText = '';
|
|
|
- return;
|
|
|
- }*/
|
|
|
this.setState({
|
|
|
inpText:text,
|
|
|
- overFlag:false
|
|
|
})
|
|
|
|
|
|
//存值到store FF26 会有一个<br>
|
|
|
- handleInput&&handleInput({text:text.replace('<br>','')});
|
|
|
+ handleInput&&handleInput({text:text.replace('<br>',''),boxMark});
|
|
|
//右侧推送--延时推送
|
|
|
clearTimeout(stimer);
|
|
|
let timer = setTimeout(function(){
|
|
@@ -97,29 +70,17 @@ class BlockInp extends Component {
|
|
|
timer
|
|
|
});
|
|
|
}
|
|
|
- //除主诉外 其他是否为空
|
|
|
- ifClear(){
|
|
|
- let baseList = store.getState();
|
|
|
- let jsonData = getAllDataList(baseList);
|
|
|
- let jsonStr = getAllDataStringList(baseList);
|
|
|
- let flg = ifOtherClear(jsonData,jsonStr,baseList);
|
|
|
- return flg;
|
|
|
- }
|
|
|
handleBlur(e){
|
|
|
//解除绑定事件
|
|
|
$(this.$dom.current).off("paste");
|
|
|
}
|
|
|
handleKeydown(e){
|
|
|
- const {boxMark} = this.props;
|
|
|
const ev = e||window.event;
|
|
|
- if(+boxMark===1){
|
|
|
- //禁止回车事件
|
|
|
- if(ev.keyCode==13){return false;}
|
|
|
- }
|
|
|
+ if(ev.keyCode==13){return false;}
|
|
|
}
|
|
|
componentWillReceiveProps(next){
|
|
|
const isRead = this.props.isRead;
|
|
|
- if(next.isRead != isRead||(next.value!=this.props.value&&next.value&&next.value.indexOf("复诊")!=-1)){ //value对比解决复诊不显示bug,复诊对比解决关标跳到前面bug
|
|
|
+ if(next.isRead != isRead){ //value对比解决复诊不显示bug,复诊对比解决关标跳到前面bug
|
|
|
this.$dom.current.innerHTML = next.value||''; //ff26下不支持innerText,但ref会自动加上innerText属性,所以上面的判断不为空
|
|
|
this.setState({
|
|
|
inpText:''
|
|
@@ -142,8 +103,8 @@ class BlockInp extends Component {
|
|
|
const { title,boxMark } = this.props;
|
|
|
return (
|
|
|
<div className={style["box"]}>
|
|
|
- <div className={style["title"]}>{title}</div>
|
|
|
- <div className={style["content"]}
|
|
|
+ <div className={`${style["title"]} ${setFontColorSize(2,4)}`}>{title}</div>
|
|
|
+ <div className={`${style["content"]} ${setFontColorSize(2,5)}`}
|
|
|
onFocus={this.handleFocus}
|
|
|
ref={this.$dom}
|
|
|
contentEditable={true}
|