import React, { Component } from "react"; import styles from "./index.less"; import edit1 from "@common/images/edit1.png"; import edit2 from "@common/images/edit2.png"; import { normalVal, timestampToTime, getStatusImg,setFontColorSize } from '@utils/tools'; class InspectName extends Component { constructor(props) { super(props); this.state = { isEdit: false, value:'' }; this.handleInput = this.handleInput.bind(this) this.handleBlur = this.handleBlur.bind(this) this.handleEdit = this.handleEdit.bind(this) } componentDidMount(){ const {item} = this.props this.setState({ value:item.inpValue, isEdit:item.inpValue?true:false }); if(this.refs.iptTip){ this.refs.iptTip.getDOMNode().value = item.inpValue } } handleEdit(){ this.setState({ isEdit:true },()=>{ this.refs.iptTip.getDOMNode().focus() }) } handleBlur(){ let val = this.state.value if (val) return this.setState({ isEdit:false }) } handleInput(e){ const {setTipValue,idx} = this.props this.setState({ value:e.target.value }) this.props.setTipValue(idx,e.target.value) } render(){ const {item,getInfomation,idx,handleLabelSub} = this.props return item.show ?

handleLabelSub(e,item.questionId,idx)}> {item.name} getInfomation({name:item.uniqueName || '', position: 1, type: 12})}> { item.inpValue||this.state.isEdit?

:点击备注 }

:

handleLabelSub(e,item.questionId,idx)}> {item.name} getInfomation({name:item.uniqueName || '', position: 1, type: 12})}>

} } export default InspectName;