|
@@ -1,5 +1,5 @@
|
|
|
import React from 'react';
|
|
|
-import { SearchOption, InspectCommon, Calendar } from '@commonComp';
|
|
|
+import { SearchOption, InspectCommon, Calendar ,Notify,ConfirmModal,Add} from '@commonComp';
|
|
|
import { deepClone } from '@utils/tools';
|
|
|
import styles from './index.less';
|
|
|
import date1 from './img/date1.png';
|
|
@@ -7,7 +7,7 @@ import date2 from './img/date2.png';
|
|
|
import close from './img/close.png';
|
|
|
import store from '@store';
|
|
|
import $ from 'jquery';
|
|
|
-
|
|
|
+import more from '@common/images/addItem1.png';
|
|
|
class Inspect extends React.Component {
|
|
|
constructor(props) {
|
|
|
super(props);
|
|
@@ -20,6 +20,10 @@ class Inspect extends React.Component {
|
|
|
currentData:{},
|
|
|
numPlus:0, //判断是否所有的填写单都是空
|
|
|
num:0, //暂存数据,获取一次,不能每次都是新的数据
|
|
|
+ toastText:'',
|
|
|
+ visible:false,
|
|
|
+ type:null,
|
|
|
+ id:null
|
|
|
}
|
|
|
this.handleChangeDate = this.handleChangeDate.bind(this)
|
|
|
this.handleShowDate = this.handleShowDate.bind(this)
|
|
@@ -29,8 +33,48 @@ class Inspect extends React.Component {
|
|
|
this.changeActivePart = this.changeActivePart.bind(this)
|
|
|
this.normalVal = this.normalVal.bind(this)
|
|
|
this.showDetails = this.showDetails.bind(this)
|
|
|
+ this.delConfirm = this.delConfirm.bind(this)
|
|
|
+ this.handleCancel = this.handleCancel.bind(this)
|
|
|
+ this.handleSearchShow = this.handleSearchShow.bind(this)
|
|
|
+ }
|
|
|
+ delConfirm(){//弹窗确定
|
|
|
+ const{delPartItem,handleCloseExcel} = this.props;
|
|
|
+ const{type,id} = this.state;
|
|
|
+ if(type==1){
|
|
|
+ delPartItem(id)
|
|
|
+ }else if(type==2){
|
|
|
+ handleCloseExcel(id)
|
|
|
+ }
|
|
|
+ this.setState({
|
|
|
+ visible:false,
|
|
|
+ type:null,
|
|
|
+ id:null,
|
|
|
+ })
|
|
|
+ Notify.success("删除成功");
|
|
|
+ }
|
|
|
+ handleDelClick(type,idx){
|
|
|
+ this.setState({
|
|
|
+ type:type,
|
|
|
+ id:idx,
|
|
|
+ visible:true
|
|
|
+ })
|
|
|
+ if(type==1){//单项
|
|
|
+ this.setState({
|
|
|
+ toastText:'是否删除该化验项?'
|
|
|
+ })
|
|
|
+ }else if(type==2){//导入项
|
|
|
+ this.setState({
|
|
|
+ toastText:'是否删除导入项?'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ handleCancel(){
|
|
|
+ this.setState({
|
|
|
+ visible:false,
|
|
|
+ type:null,
|
|
|
+ id:null,
|
|
|
+ })
|
|
|
}
|
|
|
-
|
|
|
componentDidMount() {
|
|
|
$(document).click((event) => {
|
|
|
let searchWrap = $('#searchWrap')[0]; // 搜索按钮
|
|
@@ -61,7 +105,8 @@ class Inspect extends React.Component {
|
|
|
handleSearchShow(e) {
|
|
|
let tmpShow = this.state.show;
|
|
|
this.setState({ show: !tmpShow })
|
|
|
- e.stopPropagation();
|
|
|
+ console.trace(789,this.state.show);
|
|
|
+ // e.stopPropagation();
|
|
|
}
|
|
|
handleFillShow(e,idx) {
|
|
|
let tmpShow = this.state.showFill;
|
|
@@ -216,6 +261,7 @@ class Inspect extends React.Component {
|
|
|
}
|
|
|
render() {
|
|
|
const { handleChangeValue, list, labelList,delPartItem, handleLabelSub, handleClear, handleConfirm, fillActive,getExcelDataList,handleCloseExcel } = this.props;
|
|
|
+ const {toastText,visible} = this.state;
|
|
|
return (
|
|
|
<div className={styles.wrapper}>
|
|
|
<div className={styles.check}>
|
|
@@ -224,7 +270,7 @@ class Inspect extends React.Component {
|
|
|
return <div style={{marginTop:'10px'}}>
|
|
|
{
|
|
|
items && items.lisExcelRes.length > 0 ? <ul className={styles.excelDataLists}>
|
|
|
- <img className={styles.close} src={close} alt="关闭导入excel数据" onClick={()=>{handleCloseExcel(idx)}}/>
|
|
|
+ <img className={styles.close} src={close} alt="关闭导入excel数据" onClick={(idx)=>{this.handleDelClick(2,idx)}}/>
|
|
|
{
|
|
|
items.lisExcelRes.map((item,idx)=>{
|
|
|
return <li className={styles.excelDataLis} style={{border:items.lisExcelRes.length-1 == idx? 0:''}}>
|
|
@@ -323,18 +369,32 @@ class Inspect extends React.Component {
|
|
|
: null
|
|
|
}
|
|
|
</div>
|
|
|
- <img className={styles.partDel} src={close} alt="删除项" onClick={()=>{delPartItem(idx)}}/>
|
|
|
+ <img className={styles.partDel} src={close} alt="删除项" onClick={(idx)=>{this.handleDelClick(1,idx)}}/>
|
|
|
</li>
|
|
|
})
|
|
|
}
|
|
|
</ul>
|
|
|
</div>
|
|
|
<div style={{position:"relative"}}>
|
|
|
+ <img src={more} style={{verticalAlign:'middle',marginRight:'2px'}}/>
|
|
|
<span id="searchWrap" className={`${styles.staticTag}`} onClick={(e) => this.handleSearchShow(e)}>添加化验项</span>
|
|
|
<SearchOption handleChangeValue={handleChangeValue} visible={this.state.show}>
|
|
|
{this.getSearchList(list)}
|
|
|
</SearchOption>
|
|
|
</div>
|
|
|
+ <ConfirmModal
|
|
|
+ visible={visible}
|
|
|
+ confirm={()=>{this.delConfirm()}}
|
|
|
+ close={this.handleCancel}
|
|
|
+ cancel={this.handleCancel}
|
|
|
+ okText="删除"
|
|
|
+ cancelText='取消'
|
|
|
+ okBorderColor={'#3B9ED0'}
|
|
|
+ okColor={'#fff'}
|
|
|
+ oKBg={'#3B9ED0'}
|
|
|
+ >
|
|
|
+ <p className={styles['center']}>{toastText}</p>
|
|
|
+ </ConfirmModal>
|
|
|
</div>
|
|
|
)
|
|
|
}
|