import React, { Component } from 'react';
import { AutoComplete, Button, DatePicker, Input, message, Select, Spin, Table, Tabs } from "antd";
import {
    ShowModal,
} from "@/tools";
import { ChooseList } from "../../order/orderNew/chooseList";
import $ from "jquery/src/ajax";
import './index.less';
import moment from "moment";
import DetailedList from './detailedList';
import { object } from "prop-types";
const { TabPane } = Tabs;
const { RangePicker } = DatePicker;
class ProjecCount extends Component {
    constructor(props) {
        super(props);
        this.state = {
            pageNo: 1,
            loading: false,
            changeList: undefined,
            columns: [
                {
                    title: "编号",
                    dataIndex: "key",
                    key: "key",
                },
                {
                    title: "公出人员",
                    dataIndex: "name",
                    key: "name",
                },
                {
                    title: "公出次数",
                    dataIndex: "tg",
                    key: "tg",
                    className: 'projectTable',
                    onCellClick: (record, event) => {
                        event.stopPropagation();
                        this.setState({
                            status: 2,
                            visible: true,
                            aid: record.aid,
                            title: '公出次数',
                            aName: record.name,
                        })
                    }
                },
                {
                    title: "总时长(时)",
                    dataIndex: "duration",
                    key: "duration",
                    className: 'projectTable',
                    onCellClick: (record, event) => {
                        event.stopPropagation();
                        this.setState({
                            status: 2,
                            visible: true,
                            aid: record.aid,
                            title: '总时长(时)',
                            aName: record.name,
                        })
                    }
                },
                {
                    title: "未审核次数",
                    dataIndex: "wsh",
                    key: "wsh",
                    className: 'projectTable',
                    onCellClick: (record, event) => {
                        event.stopPropagation();
                        this.setState({
                            status: 1,
                            visible: true,
                            aid: record.aid,
                            title: '未审核次数',
                            aName: record.name,
                        })
                    }
                },
                {
                    title: "驳回次数",
                    dataIndex: "bh",
                    key: "bh",
                    className: 'projectTable',
                    onCellClick: (record, event) => {
                        event.stopPropagation();
                        this.setState({
                            status: 0,
                            visible: true,
                            aid: record.aid,
                            title: '驳回次数',
                            aName: record.name,
                        })
                    }
                },
                {
                    title: "已打卡次数",
                    dataIndex: "dk",
                    key: "dk",
                    className: 'projectTable',
                    onCellClick: (record, event) => {
                        event.stopPropagation();
                        this.setState({
                            status: undefined,
                            clockIn: 1,
                            visible: true,
                            aid: record.aid,
                            title: '已打卡次数',
                            aName: record.name,
                        })
                    }
                },
            ],
            pagination: {
                defaultCurrent: 1,
                defaultPageSize: 10,
                showQuickJumper: true,
                pageSize: 10,
                onChange: function (page) {
                    this.loadData(page);
                }.bind(this),
                showTotal: function (total) {
                    return "共" + total + "条数据";
                }
            },
            dataSource: [],
            releaseDate: [],
            createReleaseDate: [],
            superId: undefined,
            clockIn: 0,
        }
        this.loadData = this.loadData.bind(this);
        this.resetAll = this.resetAll.bind(this);
        this.changeList = this.changeList.bind(this);
        this.selectSuperId = this.selectSuperId.bind(this);
        this.supervisor = this.supervisor.bind(this);
        this.httpChange = this.httpChange.bind(this);
        this.blurChange = this.blurChange.bind(this);
        this.selectAuto = this.selectAuto.bind(this);
        this.exportExec = this.exportExec.bind(this);
    }
    //获取上级组织
    selectSuperId() {
        $.ajax({
            method: "get",
            dataType: "json",
            crossDomain: false,
            url: globalConfig.context + "/api/admin/organization/selectSuperId",
            data: {},
            success: function (data) {
                let theArr = [];
                if (data.error && data.error.length === 0) {
                    for (let i = 0; i < data.data.length; i++) {
                        let theData = data.data[i];
                        theArr.push(