|
@@ -1,7 +1,7 @@
|
|
import React, { Component } from "react";
|
|
import React, { Component } from "react";
|
|
import styles from "./index.less";
|
|
import styles from "./index.less";
|
|
-import { normalVal,timestampToTime,getPageCoordinate,setPosition,setFontColorSize } from '@utils/tools';
|
|
|
|
-import { InspectCommon, Calendar,DelToast} from '@commonComp';
|
|
|
|
|
|
+import { normalVal,getArrow,timestampToTime,getDomUpDown,getPageCoordinate,setPosition,setFontColorSize } from '@utils/tools';
|
|
|
|
+import { InspectCommon, Notify,DelToast} from '@commonComp';
|
|
import slideUp from "@common/images/slide-up.png";
|
|
import slideUp from "@common/images/slide-up.png";
|
|
import slideDown from "@common/images/slide-down.png";
|
|
import slideDown from "@common/images/slide-down.png";
|
|
import $ from 'jquery';
|
|
import $ from 'jquery';
|
|
@@ -9,6 +9,9 @@ import date1 from '../img/date1.png';
|
|
import ScrollArea from 'react-scrollbar';
|
|
import ScrollArea from 'react-scrollbar';
|
|
import InspectName from '../InspectName';
|
|
import InspectName from '../InspectName';
|
|
|
|
|
|
|
|
+import up from '@images/up.png';
|
|
|
|
+import down from '@images/down.png';
|
|
|
|
+
|
|
class SlideSelect extends Component {
|
|
class SlideSelect extends Component {
|
|
constructor(props) {
|
|
constructor(props) {
|
|
super(props);
|
|
super(props);
|
|
@@ -16,7 +19,8 @@ class SlideSelect extends Component {
|
|
show:false,
|
|
show:false,
|
|
activeInd:false,
|
|
activeInd:false,
|
|
activeName:'',
|
|
activeName:'',
|
|
- canEdit:true
|
|
|
|
|
|
+ canEdit:true,
|
|
|
|
+ style:'',
|
|
};
|
|
};
|
|
this.toTime = this.toTime.bind(this);
|
|
this.toTime = this.toTime.bind(this);
|
|
this.handleSlide = this.handleSlide.bind(this);
|
|
this.handleSlide = this.handleSlide.bind(this);
|
|
@@ -26,23 +30,34 @@ class SlideSelect extends Component {
|
|
this.timeSure = this.timeSure.bind(this);
|
|
this.timeSure = this.timeSure.bind(this);
|
|
this.setEdit = this.setEdit.bind(this);
|
|
this.setEdit = this.setEdit.bind(this);
|
|
this.handleLabelSub = this.handleLabelSub.bind(this);
|
|
this.handleLabelSub = this.handleLabelSub.bind(this);
|
|
|
|
+ this.handleBlur = this.handleBlur.bind(this);
|
|
}
|
|
}
|
|
handleChangeDate(date) {
|
|
handleChangeDate(date) {
|
|
// console.log(date,'外')
|
|
// console.log(date,'外')
|
|
}
|
|
}
|
|
|
|
+
|
|
componentDidMount() {
|
|
componentDidMount() {
|
|
|
|
+ const {item} = this.props;
|
|
$(document).click((event) => {
|
|
$(document).click((event) => {
|
|
- let inspectToggleDate = document.getElementById("inspectToggleDate")
|
|
|
|
- let timeIcon = document.getElementById("timeIcon")
|
|
|
|
- let calendarDate = document.getElementById("calendarDate")
|
|
|
|
- if (calendarDate) {
|
|
|
|
- if (inspectToggleDate != event.target && timeIcon != event.target && !calendarDate.contains(event.target)) {
|
|
|
|
- this.props.handleShowDate();
|
|
|
|
- }
|
|
|
|
|
|
+ if($(event.target).attr("id")!='addClose'&&$(event.target).attr("id")!='delTit'){
|
|
|
|
+ this.setState({
|
|
|
|
+ activeInd:false
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ let type = getArrow(item.minValue,item.maxValue,item.value||null)
|
|
|
|
+ this.setState({style:type,value:item.value,time:item.time})
|
|
|
|
+ const that = this;
|
|
|
|
+ document.addEventListener('mousedown',function(e){
|
|
|
|
+ //onMousedown的目标为滚动条时,标签填写单不关闭
|
|
|
|
+ if(e.target.className=='scrollbar'){
|
|
|
|
+ that.isBar = true;
|
|
|
|
+ }else{
|
|
|
|
+ that.isBar = false;
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
+ // this.setState({ dateTime: getCurrentDate(1) })
|
|
}
|
|
}
|
|
-
|
|
|
|
toTime(time){
|
|
toTime(time){
|
|
let tmpTim = time.split(',').join('')-0
|
|
let tmpTim = time.split(',').join('')-0
|
|
if(time && tmpTim.toString() != 'NaN'){
|
|
if(time && tmpTim.toString() != 'NaN'){
|
|
@@ -71,13 +86,13 @@ class SlideSelect extends Component {
|
|
})
|
|
})
|
|
})
|
|
})
|
|
}
|
|
}
|
|
- handleDel(){
|
|
|
|
- const {handleDelClick,idx,item} = this.props;
|
|
|
|
|
|
+ handleDel(time){
|
|
|
|
+ const {handleDelClick,item} = this.props;
|
|
this.setState({
|
|
this.setState({
|
|
activeInd:true,
|
|
activeInd:true,
|
|
- activeName:item.uniqueName
|
|
|
|
|
|
+ activeName:item.uniqueName,
|
|
})
|
|
})
|
|
- handleDelClick&&handleDelClick(1,idx);
|
|
|
|
|
|
+ handleDelClick&&handleDelClick(1,time);
|
|
}
|
|
}
|
|
handleCancel(){
|
|
handleCancel(){
|
|
this.setState({
|
|
this.setState({
|
|
@@ -85,9 +100,11 @@ class SlideSelect extends Component {
|
|
activeName:''
|
|
activeName:''
|
|
})
|
|
})
|
|
}
|
|
}
|
|
- delConfirm(){
|
|
|
|
- const {handleDelConfirm} = this.props;
|
|
|
|
- handleDelConfirm&&handleDelConfirm();
|
|
|
|
|
|
+ delConfirm(item){
|
|
|
|
+ const {handleDelConfirm,handlePush} = this.props;
|
|
|
|
+ handleDelConfirm&&handleDelConfirm(item);
|
|
|
|
+ Notify.success("删除成功");
|
|
|
|
+ handlePush && handlePush({mode:8}); //右侧推送
|
|
this.setState({
|
|
this.setState({
|
|
activeInd:false,
|
|
activeInd:false,
|
|
activeName:''
|
|
activeName:''
|
|
@@ -107,27 +124,60 @@ class SlideSelect extends Component {
|
|
refreshScroller()&&refreshScroller().scrollYTo(290);
|
|
refreshScroller()&&refreshScroller().scrollYTo(290);
|
|
})*/
|
|
})*/
|
|
}
|
|
}
|
|
|
|
+ handleInput(e,item){
|
|
|
|
+ const {setTipValue} = this.props
|
|
|
|
+ setTipValue(item,e.target.value)
|
|
|
|
+ let type = getArrow(item.minValue,item.maxValue,e.target.value||null)
|
|
|
|
+ this.setState({
|
|
|
|
+ value:e.target.value,
|
|
|
|
+ style:type
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ handleBlur(){
|
|
|
|
+ const {handlePush} = this.props;
|
|
|
|
+ handlePush && handlePush({mode:8}); //右侧推送
|
|
|
|
+ }
|
|
render() {
|
|
render() {
|
|
- const {item,idx} = this.props;
|
|
|
|
- const {canEdit,activeInd,activeName} = this.state;
|
|
|
|
|
|
+ const {item,idx,time} = this.props;
|
|
|
|
+ const {canEdit,activeInd,activeName,value,style} = this.state;
|
|
return (
|
|
return (
|
|
item.flg == 1?<li key={item.uniqueName+idx} className={`${styles.slideLi} clearfix`}>
|
|
item.flg == 1?<li key={item.uniqueName+idx} className={`${styles.slideLi} clearfix`}>
|
|
- {item.uniqueName}
|
|
|
|
|
|
+ <span className={styles.bigname}>{item.uniqueName}</span>
|
|
|
|
+ <span className={styles.smallname}></span>
|
|
|
|
+ <span className={styles.edit}></span>
|
|
|
|
+ <span className={styles.maxmin}></span>
|
|
|
|
+ <span className={styles.pass}>化验时间:{item.time}</span>
|
|
|
|
+ <span id="addClose" className={styles.partDel} onClick={()=>{this.handleDel(item.time)}}></span>
|
|
|
|
+ <DelToast show={time==item.time&&activeInd?true:false}
|
|
|
|
+ name={activeName}
|
|
|
|
+ right={'-34px'}
|
|
|
|
+ top={'30px'}
|
|
|
|
+ cancel={this.handleCancel}
|
|
|
|
+ confirm={()=>{this.delConfirm(item)}}/>
|
|
</li>:<li key={item.uniqueName+idx} className={`${styles.slideLi} clearfix`}>
|
|
</li>:<li key={item.uniqueName+idx} className={`${styles.slideLi} clearfix`}>
|
|
<span className={styles.bigname}>{item.name}</span>
|
|
<span className={styles.bigname}>{item.name}</span>
|
|
<span className={styles.smallname}>{item.uniqueName}</span>
|
|
<span className={styles.smallname}>{item.uniqueName}</span>
|
|
<span className={styles.edit}>
|
|
<span className={styles.edit}>
|
|
- <input disabled={canEdit} type="text" id="canEdit" onDoubleClick={this.setEdit} placeholder='(填写)'/><i></i>{item.units}
|
|
|
|
|
|
+ <input disabled={canEdit} type="text"
|
|
|
|
+ id="canEdit"
|
|
|
|
+ onDoubleClick={this.setEdit}
|
|
|
|
+ style={{color:style==2||style==4?'red':style==1?'#D949FF':'#333'}}
|
|
|
|
+ placeholder='(填写)'
|
|
|
|
+ autoComplete="off"
|
|
|
|
+ value={value}
|
|
|
|
+ onInput={(e)=>{this.handleInput(e,item)}}
|
|
|
|
+ onBlur={()=>{this.handleBlur()}}
|
|
|
|
+ /><img style={{display:style==1||style==2?'inline-block':'none'}} src={style==1?down:style==2?up:''} />{item.units}
|
|
</span>
|
|
</span>
|
|
- <span className={styles.maxmin}>正常值:({item.minValue}~{item.maxValue})</span>
|
|
|
|
|
|
+ <span className={styles.maxmin}>{normalVal(item.minValue,item.maxValue)}</span>
|
|
<span className={styles.pass}>化验时间:{item.time}</span>
|
|
<span className={styles.pass}>化验时间:{item.time}</span>
|
|
- <span id="addClose" className={styles.partDel} onClick={this.handleDel}></span>
|
|
|
|
- <DelToast show={activeInd?true:false}
|
|
|
|
- name={activeName}
|
|
|
|
|
|
+ <span id="addClose" className={styles.partDel} onClick={()=>{this.handleDel(item.time)}}></span>
|
|
|
|
+ <DelToast show={time==item.time&&activeInd?true:false}
|
|
|
|
+ name={activeName}
|
|
right={'-34px'}
|
|
right={'-34px'}
|
|
top={'30px'}
|
|
top={'30px'}
|
|
cancel={this.handleCancel}
|
|
cancel={this.handleCancel}
|
|
- confirm={this.delConfirm}/>
|
|
|
|
|
|
+ confirm={()=>{this.delConfirm(item)}}/>
|
|
</li>
|
|
</li>
|
|
);
|
|
);
|
|
}
|
|
}
|