|
@@ -1,17 +1,9 @@
|
|
|
import React, { Component } from "react";
|
|
|
import styles from "./index.less";
|
|
|
-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 slideDown from "@common/images/slide-down.png";
|
|
|
+import { Notify,DelToast} from '@commonComp';
|
|
|
import $ from 'jquery';
|
|
|
import checkOff from '@common/images/check_off.png';
|
|
|
import checkOn from '@common/images/check_on.png';
|
|
|
-import ScrollArea from 'react-scrollbar';
|
|
|
-import InspectName from '../InspectName';
|
|
|
-
|
|
|
-import up from '@images/up.png';
|
|
|
-import down from '@images/down.png';
|
|
|
|
|
|
class SlidePic extends Component {
|
|
|
constructor(props) {
|
|
@@ -21,25 +13,17 @@ class SlidePic extends Component {
|
|
|
activeInd:false,
|
|
|
activeName:'',
|
|
|
canEdit:true,
|
|
|
- style:'',
|
|
|
+ style:''
|
|
|
};
|
|
|
- this.toTime = this.toTime.bind(this);
|
|
|
- this.handleSlide = this.handleSlide.bind(this);
|
|
|
this.handleDel = this.handleDel.bind(this);
|
|
|
this.handleCancel = this.handleCancel.bind(this);
|
|
|
this.delConfirm = this.delConfirm.bind(this);
|
|
|
- this.timeSure = this.timeSure.bind(this);
|
|
|
this.setEdit = this.setEdit.bind(this);
|
|
|
- this.handleLabelSub = this.handleLabelSub.bind(this);
|
|
|
this.handleBlur = this.handleBlur.bind(this);
|
|
|
this.checkOnOff = this.checkOnOff.bind(this);
|
|
|
}
|
|
|
- handleChangeDate(date) {
|
|
|
- // console.log(date,'外')
|
|
|
- }
|
|
|
|
|
|
componentDidMount() {
|
|
|
- const {item} = this.props;
|
|
|
$(document).click((event) => {
|
|
|
if($(event.target).attr("id")!='addClose'&&$(event.target).attr("id")!='delTit'){
|
|
|
this.setState({
|
|
@@ -47,37 +31,14 @@ class SlidePic extends Component {
|
|
|
})
|
|
|
}
|
|
|
});
|
|
|
- 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){
|
|
|
- let tmpTim = time.split(',').join('')-0
|
|
|
- if(time && tmpTim.toString() != 'NaN'){
|
|
|
- let date = new Date('1900-01-01');
|
|
|
- let dateTim = date.getTime();
|
|
|
- let times = (tmpTim-2)*24*60*60*1000;
|
|
|
- let result = timestampToTime(dateTim+times).split(' ')[0]
|
|
|
- return result;
|
|
|
- }else{
|
|
|
- return time;
|
|
|
- }
|
|
|
- }
|
|
|
- handleSlide(){
|
|
|
- let tmpShow = this.state.show
|
|
|
- this.setState({
|
|
|
- show:!tmpShow
|
|
|
- })
|
|
|
}
|
|
|
+ // shouldComponentUpdate(nextProps,nextState){
|
|
|
+ // console.log(this.props.item.time , nextProps.item.time,nextState)
|
|
|
+ // if(this.props.item.time == nextProps.item.time){
|
|
|
+ // return false
|
|
|
+ // }
|
|
|
+ // return true
|
|
|
+ // }
|
|
|
handleDel(time){
|
|
|
const {handleDelClick,item} = this.props;
|
|
|
this.setState({
|
|
@@ -102,22 +63,9 @@ class SlidePic extends Component {
|
|
|
activeName:''
|
|
|
})
|
|
|
}
|
|
|
- timeSure(date){
|
|
|
- const {handleChangeDate} = this.props;
|
|
|
- handleChangeDate&&handleChangeDate(date)
|
|
|
- }
|
|
|
- handleLabelSub(e,questionId,idx){
|
|
|
- const {handleLabelSub,handleFillShow,setHighter,refreshScroller} = this.props;
|
|
|
- handleLabelSub(e,questionId,idx);
|
|
|
- handleFillShow(e,idx);
|
|
|
- //弹窗高度超出屏幕,增加页面高度
|
|
|
- setPosition(e,"#inspectFill",setHighter);
|
|
|
- /*setTimeout(function(){//如果检验下面有很多数据,则会跳过头
|
|
|
- refreshScroller()&&refreshScroller().scrollYTo(290);
|
|
|
- })*/
|
|
|
- }
|
|
|
handleInput(e,item,sign){
|
|
|
const {setTipValue} = this.props
|
|
|
+ console.log(item,e.target.value)
|
|
|
setTipValue(item,e.target.value,sign)
|
|
|
}
|
|
|
handleBlur(){
|
|
@@ -148,7 +96,7 @@ class SlidePic extends Component {
|
|
|
<input disabled='disabled' type="text"
|
|
|
class="canEdit"
|
|
|
onDoubleClick={(e)=>this.setEdit(e)}
|
|
|
- style={{color:style==2||style==4?'red':style==1?'#D949FF':'#333'}}
|
|
|
+ style={{color:'#333'}}
|
|
|
placeholder={item.flg == 5?'(填写用法计量)':'(填写用量)'}
|
|
|
autoComplete="off"
|
|
|
value={item.value}
|
|
@@ -165,8 +113,8 @@ class SlidePic extends Component {
|
|
|
placeholder='时间'
|
|
|
autoComplete="off"
|
|
|
value={item.time}
|
|
|
- onInput={(e)=>{this.handleInput(e,item,1)}}
|
|
|
- onBlur={()=>{this.handleBlur()}}
|
|
|
+ onChange={(e)=>{this.handleInput(e,item,1)}}
|
|
|
+ onBlur={(e)=>{this.handleBlur();}}
|
|
|
/>
|
|
|
</span>
|
|
|
<span id="addClose" className={styles.partDel} onClick={()=>{this.handleDel(item.time)}}></span>
|