import React, { Component } from "react"; import st from "styled-components"; import AddPlaceModal from "./AddPlaceModal"; import PTable from '../../../../components/Pro/PTable'; import { deleteAttendAddress } from '../../../../services/api'; import { Modal, message, Alert, Button, Popconfirm } from "antd"; export default class PlaceInfo extends Component { constructor(props, context) { super(props, context); this.state = { addPlaceStatus: false, dataList: [],//考勤点数据 selectedRowKeys: [], selectedRows: [], pageParm: { //表格参数 pageSize: 10, pageNumber: 1, comTempTaskId: this.props.comTempTaskId, }, forceUpdate: false }; } componentDidMount() { } //刷新列表 updateTable() { this.setState({ forceUpdate: true }, () => { this.setState({ forceUpdate: false }) }) } //删除考勤 _deleteAttendAddress(selectedRow) { this.setState({ selectedRows: [], selectedRowKeys: [] }) let data = [] if (selectedRow.length > 0) { selectedRow.forEach(item => { data.push(item.taskAttendAddressId) }) } deleteAttendAddress({ comTempTaskId: this.props.comTempTaskId, taskAttendAddressId: data.join(",") }).then(res => { if (res.retType === '0') { this.updateTable() this.props._updateTable() } }) } render() { /* 考勤地点--drawer */ let columns = [ { key: "address", title: "考勤地点", dataIndex: "address" }, { key: "addressRange", title: "考勤范围(米)", dataIndex: "addressRange" }, { width: 60, title: "操作", dataIndex: "action", render: (text, record, index) => { return ( { this.props.readOnly ? - : { this._deleteAttendAddress([record]); }} okText="确定" cancelText="取消" > 删除 } ) } } ]; return (
{ this.setState({ selectedRowKeys, selectedRows, }); }, selectedRowKeys: this.state.selectedRowKeys }} /> { this.state.addPlaceStatus && { this.setState({ addPlaceStatus: value }) }} comTempTaskId={this.props.comTempTaskId} onHandleOk={() => { this.setState({ addPlaceStatus: false, }) this.updateTable() this.props._updateTable() }} /> }
); } } const Btns = st.div` margin: 10px; >button{ margin-left: 10px; &:first-child{ margin-left: 0; } } `;