import React from "react";
import $ from "jquery/src/ajax";
import moment from "moment";
import "./public.less";
import "./shouKuan.less";
import {
  Button,
  Form,
  Input,
  Spin,
  Table,
  Select,
  message,
  DatePicker,
  Modal,
  Tabs,
  Col,
  Tag,
  Popconfirm, Tooltip
} from "antd";
import OrderDesc from "../orderDetail/orderDesc";
import ResolutionDetail from "@/resolutionDetail";
import Receivable from "./receivable";
import Assign from "@/manageCenter/publicComponent/assign";
import KaiPiaoModal from "./kaiPiaoModal";
import ReactToPrint from "react-to-print";
import {
  getLiquidationStatus,
  getProcessStatus,
  getApproval,
  getInvoiceStatus,
  getTransactionProject,
  getTaskStatus,
  getNewOrderStatus,
  getProjectStatus,
  getjiedian,
  splitUrl,
} from "@/tools";
import { ChooseList } from "../../order/orderNew/chooseList"
import Project from "../../../../component/project"
import LogPopup from "../../../common/logPopup";
import { throws } from "assert";
import {getProjectName} from "../../../tools";
const FormItem = Form.Item;
const { TabPane } = Tabs;
const { TextArea } = Input;
const ShouKuang = React.createClass({
  departmentList() {
    // this.setState({
    //   loading: true
    // });
    $.ajax({
      method: "get",
      dataType: "json",
      crossDomain: false,
      url: globalConfig.context + "/api/admin/organization/selectSuperId",
      data: {},
      success: function (data) {
        let thedata = data.data;
        let theArr = [];
        if (!thedata) {
          if (data.error && data.error.length) {
            message.warning(data.error[0].message);
          }
        } else {
          thedata.map(function (item, index) {
            theArr.push({
              key: index,
              name: item.name,
              id: item.id,
            });
          });
        }
        this.setState({
          departmentArr: theArr,
        });
      }.bind(this),
    }).always(
      function () {
        // this.setState({
        //   loading: false
        // });
      }.bind(this)
    );
  },
  loadData(pageNo, pageSize) {
    this.state.data = [];
    this.state.pagination.pageSize = 10;
    this.setState({
      // selectedRowKeys: [],
      // selectedRowKey: [],
      page: pageNo || this.state.pageNo,
      loadingA: true,
      pagination: this.state.pagination,
    });
    $.ajax({
      method: "get",
      dataType: "json",
      crossDomain: false,
      url: globalConfig.context + "/api/admin/financial/financeList",
      data: {
        pageNo: pageNo || 1,
        pageSize: pageSize || this.state.pagination.pageSize,
        buyerName: this.state.nameSearch, //客户名称
        orderNo: this.state.orderNoSearch,
        startTime: this.state.releaseDate[0],
        endTime: this.state.releaseDate[1],
        startFinalReceivablesTime: this.state.shouKuanDate[0],
        endFinalReceivablesTime: this.state.shouKuanDate[1],
        departmentId: this.state.departmenttList,
        processStatus: this.state.processStatusSearch,
        contractNo: this.state.contractNoSearch,
        liquidationStatus: this.state.liquidationStatus,
        amountStatus: this.state.amountStatus,
      },
      success: function (data) {
        let theArr = [];
        if (!data.data || !data.data.pagination.list) {
          if (data.error && data.error.length) {
            message.warning(data.error[0].message);
          }
        } else {
          for (let i = 0; i < data.data.pagination.list.length; i++) {
            let thisdata = data.data.pagination.list[i];
            thisdata.key = thisdata.orderNo;
            theArr.push(thisdata);
          }
        }
        this.state.pagination.current = data.data.pagination.pageNo;
        this.state.pagination.total = data.data.pagination.totalCount;
        if (
          data.data &&
          data.data.pagination.list &&
          !data.data.pagination.list.length
        ) {
          this.state.pagination.current = 0;
          this.state.pagination.total = 0;
        }
        this.setState({
          totalPage: data.data.pagination.totalPage,
          dataSource: theArr,
          pagination: this.state.pagination,
          totalHui: data.data.count ? data.data.count.signTotalAmount : 0,
          hui: data.data.count ? data.data.count.actuallyTotalAmount : 0,
        });
      }.bind(this),
    }).always(
      function () {
        // window.setTimeout(() => {
        this.setState({
          loadingA: false,
        });
        // },5000)
      }.bind(this)
    );
  },
  getInitialState() {
    return {
      cuiTabKey: "1",
      //默认搜索无流程状态
      processStatusSearch: [],
      searchMore: true,
      dvisible: false,
      pageNo: 1,
      assignVisibleX: false,
      assignVisibleY: false,
      releaseDate: [],
      shouKuanDate: [],
      assignDataX: [],
      assignDataY: [],
      totalPage: 0,
      // processStatusSearch: "3",
      boHuivisible: false,
      selectedRowKeys: [],
      selectedRows: [],
      loading: false,
      loadingA: false,
      pagination: {
        defaultCurrent: 1,
        defaultPageSize: 10,
        showQuickJumper: true,
        pageSize: 10,
        onChange: function (page) {
          // console.log(page);
          this.setState({
            pageNo: page,
          });
          this.loadData(page);
        }.bind(this),
        showTotal: function (total) {
          return "共" + total + "条数据";
        },
      },
      // 子组件改变的表格title数组
      changeList: undefined,
      proColumns: [
        {
          title: "序号",
          dataIndex: "key",
          key: "key",
        },
        {
          title: "合同编号",
          dataIndex: "contractNo",
          key: "contractNo",
        },
        {
          title: "订单编号",
          dataIndex: "orderNo",
          key: "orderNo",
        },
        // {
        //   title: "项目编号",
        //   dataIndex: "id",
        //   key: "id"
        // },
        {
          title: "客户名称",
          dataIndex: "userName",
          key: "userName",
          render: text => {
            return (
                
                  {text}
                
            )
          }
        },
        {
          title: "订单负责人",
          dataIndex: "salesmanName",
          key: "salesmanName",
        },
        {
          title: "是否主项目",
          dataIndex: "main",
          key: "main",
          render: (text) => {
            return text == 0 ? "否" : "是";
          },
        },
        {
          title: "项目类别",
          dataIndex: "cname",
          key: "cname",
        },
        {
          title: "项目名称",
          dataIndex: "commodityName",
          key: "commodityName",
        },
        {
          title: "项目数量",
          dataIndex: "commodityQuantity",
          key: "commodityQuantity",
          render: (text, record) => {
            if (record.splitStatus == 1) {
              return (
                
                  {text}{" "}
                   {
                      e.stopPropagation();
                      this.showRes(record);
                    }}
                  >
                    已拆
                  
                
              );
            } else {
              return text;
            }
          },
        },
        {
          title: "服务市价",
          dataIndex: "commodityPrice",
          key: "commodityPrice",
        },
        {
          title: "证书编号",
          dataIndex: "certificateNumber",
          key: "certificateNumber",
        },
        {
          title: "项目状态",
          dataIndex: "projectStatus",
          key: "projectStatus",
          render: (text) => {
            return getProjectName(text);
          },
        },
        {
          title: "项目说明",
          dataIndex: "taskComment",
          key: "taskComment",
        },
        {
          title: "是否外包",
          dataIndex: "outsource",
          key: "outsource",
          render: (text) => {
            if (text == 0) {
              return "否";
            } else if (text == 1) {
              return "是";
            }
          },
        },
        // {
        //   title: "外包(内部)公司",
        //   dataIndex: "outsourceName",
        //   key: "outsourceName",
        // },
        // {
        //   title: "外包(内部)价格",
        //   dataIndex: "outsourcePrice",
        //   key: "outsourcePrice",
        // },
      ],
      qianColumns: [
        {
          title: "序号",
          dataIndex: "key",
          key: "key",
        },
        {
          title: "合同编号",
          dataIndex: "contractNo",
          key: "contractNo",
        },
        {
          title: "订单编号",
          dataIndex: "orderNo",
          key: "orderNo",
        },
        {
          title: "客户名称",
          dataIndex: "userName",
          key: "userName",
          render: text => {
            return (
                
                  {text}
                
            )
          }
        },
        {
          title: "订单负责人",
          dataIndex: "salesmanName",
          key: "salesmanName",
        },
        {
          title: "订单部门",
          dataIndex: "depName",
          key: "depName",
        },
        {
          title: "订单状态",
          dataIndex: "orderStatus",
          key: "orderStatus",
          render: (text) => {
            return getNewOrderStatus(text);
          },
        },
        {
          title: "项目状态",
          dataIndex: "projectStatus",
          key: "projectStatus",
          render: (text) => {
            return getProjectName(text);
          },
        },
        {
          title: "签单金额",
          dataIndex: "totalAmount",
          key: "totalAmount",
        },
        {
          title: "结算状态",
          dataIndex: "liquidationStatus",
          key: "liquidationStatus",
          render: (text) => {
            return getLiquidationStatus(text);
          },
        },
        {
          title: "已收款",
          dataIndex: "settlementAmount",
          key: "settlementAmount",
        },
        {
          title: "欠款",
          dataIndex: "orderArrears",
          key: "orderArrears",
        },
        {
          title: "催收科目",
          dataIndex: "type",
          key: "type",
          render: (text) => {
            return "按时触发应收欠款";
          },
        },
        {
          title: "催款状态",
          dataIndex: "dunStatus",
          key: "dunStatus",
          render: (text) => {
            if (text == 0) {
              return "未启动";
            } else if (text == 1) {
              return "催款中";
            } else if (text == 2) {
              return "已完成";
            } else if (text == 3) {
              return "已停止";
            }
          },
        },
        {
          title: "催收启动时间",
          dataIndex: "startDate",
          key: "startDate",
        },
      ],
      cuiColumns: [
        {
          title: "序号",
          dataIndex: "key",
          key: "key",
        },
        {
          title: "合同编号",
          dataIndex: "contractNo",
          key: "contractNo",
        },
        {
          title: "订单编号",
          dataIndex: "orderNo",
          key: "orderNo",
        },
        {
          title: "客户名称",
          dataIndex: "userName",
          key: "userName",
          render: text => {
            return (
                
                  {text}
                
            )
          }
        },
        {
          title: "订单负责人",
          dataIndex: "salesmanName",
          key: "salesmanName",
        },
        {
          title: "订单部门",
          dataIndex: "depName",
          key: "depName",
        },
        {
          title: "订单状态",
          dataIndex: "orderStatus",
          key: "orderStatus",
          render: (text) => {
            return getNewOrderStatus(text);
          },
        },
        {
          title: "项目状态",
          dataIndex: "projectStatus",
          key: "projectStatus",
          render: (text) => {
            return getProjectName(text);
          },
        },
        {
          title: "签单金额",
          dataIndex: "totalAmount",
          key: "totalAmount",
        },
        {
          title: "结算状态",
          dataIndex: "liquidationStatus",
          key: "liquidationStatus",
          render: (text) => {
            return getLiquidationStatus(text);
          },
        },
        {
          title: "已收款",
          dataIndex: "settlementAmount",
          key: "settlementAmount",
        },
        {
          title: "应收款",
          dataIndex: "accountsReceivable",
          key: "accountsReceivable",
        },
        {
          title: "催收科目",
          dataIndex: "dunSubject",
          key: "dunSubject",
          // render: text => {
          //   return getjiedian(text);
          // }
        },
        {
          title: "催款状态",
          dataIndex: "dunStatus",
          key: "dunStatus",
        },
        {
          title: "催收启动时间",
          dataIndex: "startDate",
          key: "startDate",
        },
      ],
      timeColumns: [
        {
          title: "合同编号",
          dataIndex: "contractNo",
          key: "contractNo",
        },
        {
          title: "订单编号",
          dataIndex: "orderNo",
          key: "orderNo",
        },
        {
          title: "项目编号",
          dataIndex: "id",
          key: "id",
          render: (text, record) => {
            if (record.splitStatus == 2) {
              return {record.splitSuper + "-" + record.splitId};
            } else {
              return text;
            }
          },
        },
        {
          title: "客户名称",
          dataIndex: "userName",
          key: "userName",
          render: text => {
            return (
                
                  {text}
                
            )
          }
        },
        {
          title: "订单部门",
          dataIndex: "depName",
          key: "depName",
        },
        {
          title: "订单负责人",
          dataIndex: "salesmanName",
          key: "salesmanName",
        },
        {
          title: "项目类别",
          dataIndex: "cname",
          key: "cname",
        },
        {
          title: "项目名称",
          dataIndex: "taskName",
          key: "taskName",
        },
        {
          title: "项目负责人",
          dataIndex: "receiverName",
          key: "receiverName",
        },
        {
          title: "项目价格(万元)",
          dataIndex: "commodityPrice",
          key: "commodityPrice",
        },
        {
          title: "数量(个)",
          dataIndex: "commodityQuantity",
          key: "commodityQuantity",
        },
        {
          title: "任务状态",
          dataIndex: "taskStatus",
          key: "taskStatus",
          render: (text) => {
            return getTaskStatus(text);
          },
        },
        {
          title: "项目状态",
          dataIndex: "projectStatus",
          key: "projectStatus",
          render: (text) => {
            return getProjectName(text);
          },
        },
        {
          title: "工时",
          dataIndex: "hours",
          key: "hours",
        },
        {
          title: "是否外包",
          dataIndex: "outsource",
          key: "outsource",
          render: (text) => {
            if (text == 0) {
              return "否";
            } else if (text == 1) {
              return "是";
            }
          },
        },
        {
          title: "签单日期",
          dataIndex: "signTime",
          key: "signTime",
        },
        {
          title: "派单日期",
          dataIndex: "creteTime",
          key: "creteTime",
        },
        {
          title: "分配时间",
          dataIndex: "taskDistributionTime",
          key: "taskDistributionTime",
        },
        {
          title: "完成时间",
          dataIndex: "taskEndTime",
          key: "taskEndTime",
        },
      ],
      printColumns: [
        {
          title: "合同编号",
          dataIndex: "contractNo",
          key: "contractNo",
        },
        {
          title: "订单编号",
          dataIndex: "orderNo",
          key: "orderNo",
          // fixed: "left"
        },
        {
          title: "客户名称",
          dataIndex: "buyerName",
          key: "buyerName",
          render: text => {
            return (
                
                  {text}
                
            )
          }
        },
        {
          title: "订单部门",
          dataIndex: "departmentName",
          key: "departmentName",
        },
        {
          title: "订单负责人",
          dataIndex: "sellerName",
          key: "sellerName",
        },
        {
          title: "签单日期",
          dataIndex: "signTime",
          key: "signTime",
        },
        {
          title: "下单日期",
          dataIndex: "createTime",
          key: "createTime",
        },
        {
          title: "签单金额(万元)",
          dataIndex: "signTotalAmount",
          key: "signTotalAmount",
          render: (text) => {
            return isNaN(parseFloat(text)) ? text : parseFloat(text);
          },
        },
        {
          title: "开票金额(万元)",
          dataIndex: "invoiceAmount",
          key: "invoiceAmount",
          render: (text) => {
            return isNaN(parseFloat(text)) ? text : parseFloat(text);
          },
        },
        {
          title: "已收款(万元)",
          dataIndex: "actuallyTotalAmount",
          key: "actuallyTotalAmount",
          render: (text) => {
            return isNaN(parseFloat(text)) ? text : parseFloat(text);
          },
        },
        {
          title: "总成本(万元)",
          dataIndex: "costAmount",
          key: "costAmount",
          render: (text) => {
            return isNaN(parseFloat(text)) ? text : parseFloat(text);
          }
        },
        {
          title: "已付成本(万元)",
          dataIndex: "paymentAmount",
          key: "paymentAmount",
          render: (text) => {
            return isNaN(parseFloat(text)) ? text : parseFloat(text);
          },
        },
        {
          title: "最近收款(万元)",
          dataIndex: "finalReceivables",
          key: "finalReceivables",
          render: (text) => {
            return isNaN(parseFloat(text)) ? text : parseFloat(text);
          },
        },
        {
          title: "最近收款时间",
          dataIndex: "finalReceivablesTime",
          key: "finalReceivablesTime",
        },
        {
          title: "结算状态",
          dataIndex: "liquidationStatus",
          key: "liquidationStatus",
          render: (text) => {
            return getLiquidationStatus(text);
          },
        },
        {
          title: "流程状态",
          dataIndex: "processStatus",
          key: "processStatus",
          render: (text) => {
            return getProcessStatus(text);
          },
        },
        {
          title: "特批状态",
          dataIndex: "approval",
          key: "approval",
          render: (text) => {
            return getApproval(text);
          },
        },
      ],
      columns: [
        {
          title: "合同编号",
          dataIndex: "contractNo",
          key: "contractNo",
          className: "title-table",
          fixed: "left",
        },
        {
          title: "客户名称",
          dataIndex: "buyerName",
          key: "buyerName",
          className: "title-table",
          fixed: "left",
          width:150,
          render: text => {
            return (
                
                  {text}
                
            )
          }
        },
        {
          title: "订单编号",
          dataIndex: "orderNo",
          key: "orderNo",
          className: "title-table",
          // fixed: "left"
        },
        {
          title: "特批状态",
          dataIndex: "approval",
          key: "approval",
          className: "title-table",
          render: (text) => {
            if (text == 1 || text == 2) {
              return {getApproval(text)};
            }
            return getApproval(text);
          },
        },
        {
          title: "订单部门",
          dataIndex: "departmentName",
          key: "departmentName",
          className: "title-table",
        },
        {
          title: "订单负责人",
          dataIndex: "sellerName",
          key: "sellerName",
          className: "title-table",
        },
        {
          title: "财务负责人",
          dataIndex: "financeName",
          key: "financeName",
          className: "title-table",
        },
        {
          title: "签单日期",
          dataIndex: "signTime",
          key: "signTime",
          className: "title-table",
        },
        {
          title: "下单日期",
          dataIndex: "createTime",
          key: "createTime",
          className: "title-table",
        },
        {
          title: "签单金额(万元)",
          dataIndex: "signTotalAmount",
          key: "signTotalAmount",
          className: "title-table",
          render: (text) => {
            return isNaN(parseFloat(text)) ? text : parseFloat(text);
          }
        },
        {
          title: "开票金额(万元)",
          dataIndex: "invoiceAmount",
          key: "invoiceAmount",
          className: "title-table",
          render: (text) => {
            return isNaN(parseFloat(text)) ? text : parseFloat(text);
          }
        },
        {
          title: "已收款(万元)",
          dataIndex: "actuallyTotalAmount",
          key: "actuallyTotalAmount",
          className: "title-table",
          render: (text) => {
            return isNaN(parseFloat(text)) ? text : parseFloat(text);
          }
        },
        {
          title: "应收款(万元)",
          dataIndex: "orderReceivables",
          key: "orderReceivables",
          className: "title-table",
          render: (text) => {
            return isNaN(parseFloat(text)) ? text : parseFloat(text);
          }
        },
        {
          title: "欠款(万元)",
          dataIndex: "orderArrears",
          key: "orderArrears",
          className: "title-table",
          render: (text) => {
            return isNaN(parseFloat(text)) ? text : parseFloat(text);
          }
        },
        {
          title: "总成本(万元)",
          dataIndex: "costAmount",
          key: "costAmount",
          className: "title-table",
          render: (text) => {
            return isNaN(parseFloat(text)) ? text : parseFloat(text);
          }
        },
        {
          title: "已付成本(万元)",
          dataIndex: "paymentAmount",
          key: "paymentAmount",
          className: "title-table",
          render: (text) => {
            return isNaN(parseFloat(text)) ? text : parseFloat(text);
          }
        },
        {
          title: "最近收款(万元)",
          dataIndex: "finalReceivables",
          key: "finalReceivables",
          className: "title-table",
          render: (text) => {
            return isNaN(parseFloat(text)) ? text : parseFloat(text);
          }
        },
        {
          title: "最近收款时间",
          dataIndex: "finalReceivablesTime",
          key: "finalReceivablesTime",
          className: "title-table",
        },
        {
          title: "结算状态",
          dataIndex: "liquidationStatus",
          key: "liquidationStatus",
          className: "title-table",
          render: (text) => {
            return getLiquidationStatus(text);
          },
        },
        {
          title: "流程状态",
          dataIndex: "processStatus",
          key: "processStatus",
          className: "title-table",
          render: (text) => {
            return getProcessStatus(text);
          },
        },
        //                 {
        //                     title: '订单状态',
        //                     dataIndex: 'orderStatus',
        //                     key: 'orderStatus',
        //                     render: text => { return getNewOrderStatus(text)}
        //                 },
        {
          title: "操作",
          dataIndex: "caozuo",
          key: "caouzo",
          className: "title-table",
          render: (text, recard) => {
            return (
              
                {/* {recard.liquidationStatus < 2 &&
                (recard.approval === 1 || recard.approval === 2) ? (
                  
                ) : (
                  
                )} */}
                {recard.backStatus == 3 ? 已驳回 : ""}
                {recard.processStatus == 3 ? (
                  
                ) : (
                  ""
                )}
                {!(
                  recard.actuallyTotalAmount &&
                  Number(recard.actuallyTotalAmount) > 0
                ) && (
                  
                )}
                {
                  // 
                }
              
            );
          },
        },
      ],
      dataSource: [],
      searchTime: [],
      columnsDate: [
        {
          title: "编号",
          dataIndex: "id",
          key: "id",
        },
        {
          title: "订单编号",
          dataIndex: "orderno",
          key: "orderno",
        },
        {
          title: "开票金额(万元)",
          dataIndex: "amount",
          key: "amount",
        },
        {
          title: "申请时间",
          dataIndex: "createTime",
          key: "createTime",
        },
        {
          title: "开票状态",
          dataIndex: "status",
          key: "status",
          render: (text, record) => {
            return {getInvoiceStatus(text, record)} 
;
          },
        },
      ],
      waterlistDate: [
        {
          title: "订单编号",
          dataIndex: "orderNo",
          key: "orderNo",
        },
        {
          title: "平台流水号",
          dataIndex: "billNo",
          key: "billNo",
          //   fixed: "left"
        },
        {
          title: "收款金额(万元)",
          dataIndex: "transactionAmount",
          key: "transactionAmount",
        },
        {
          title: "收款方",
          dataIndex: "payeeName",
          key: "payeeName",
        },
        {
          title: "付款方",
          dataIndex: "payerName",
          key: "payerName",
        },
        {
          title: "流水科目",
          dataIndex: "transactionSubject",
          key: "transactionSubject",
          render: (text) => {
            return getTransactionProject(text);
          },
        },
        {
          title: "收款类型",
          dataIndex: "type",
          key: "type",
        },
        {
          title: "财务流水时间",
          dataIndex: "financialPayTimes",
          key: "financialPayTimes",
        },
        {
          title: "财务流水号",
          dataIndex: "financialPayNo",
          key: "financialPayNo",
        },
        {
          title: "订单负责人",
          dataIndex: "saleName",
          key: "saleName",
        },
        {
          title: "创建时间",
          dataIndex: "createTimes",
          key: "createTimes",
        },
        {
          title: "退款时间",
          dataIndex: "refundTimes",
          key: "refundTimes",
        },
        {
          title: "删除时间",
          dataIndex: "deleteTimes",
          key: "deleteTimes",
        },
        {
          title: "备注",
          dataIndex: "remarks",
          key: "remarks",
        },
        {
          title: "流水状态",
          dataIndex: "deleteSign",
          key: "deleteSign",
          render: (text, record) => {
            if (!text) {
              return (
                 {
                    this.changeWater(record.billNo);
                  }}
                  okText="删除"
                  cancelText="不删除"
                >
                  
                
              );
            } else {
              return 已删除;
            }
          },
        },
      ],
      waterData: [],
    };
  },
  changeWater(billNo) {
    this.setState({
      loading: true,
    });
    $.ajax({
      method: "get",
      dataType: "json",
      crossDomain: false,
      url: globalConfig.context + "/api/admin/financial/deleteMyBill",
      data: {
        billNo,
      },
      success: function (data) {
        let theArr = [];
        if (data.error && data.error.length) {
          message.warning(data.error[0].message);
        } else {
          message.warning("删除流水成功!");
          this.waterData();
          this.loadData();
        }
      }.bind(this),
    }).always(
      function () {
        this.setState({
          loading: false,
        });
      }.bind(this)
    );
  },
  // 特批通过
  evaluateZ(record) {
    $.ajax({
      method: "POST",
      dataType: "json",
      crossDomain: false,
      url: globalConfig.context + "/api/admin/financial/financeApproval",
      data: {
        orderNo: record.orderNo,
      },
    }).done(
      function (data) {
        if (!data.error.length) {
          message.success("通过成功!");
          this.setState({
            loading: false,
          });
          this.loadData();
        } else {
          message.warning(data.error[0].message);
        }
      }.bind(this)
    );
  },
  /* 收款 */
  evaluateX(recard) {
    this.state.assignDataX = recard;
    this.setState({
      assignVisibleX: true,
    });
  },
  /* 转交 */
  evaluateY(recard, nub) {
    this.state.assignDataY = recard;
    this.setState({
      nub,
      assignVisibleY: true,
    });
  },
  /* 驳回 */
  reject(recard) {
    this.setState({
      bohuiData: recard,
      boHuiVisible: true,
      content: "",
    });
  },
  boHuiOk() {
    this.setState({
      boHuiVisible: false,
    });
    if (
      this.state.pagination.current == this.state.totalPage &&
      this.state.pagination.total % 10 == 1
    ) {
      this.loadData(this.state.page - 1);
    } else {
      this.loadData(this.state.page);
    }
  },
  boHuiCancel() {
    this.setState({
      boHuiVisible: false,
    });
  },
  componentWillMount() {
    this.loadData();
    this.departmentList();
  },
  tableRowClick(record) {
    this.state.RowData = record;
    this.setState({
      showDesc: true,
    });
  },
  closeDesc(e, s) {
    this.state.showDesc = e;
    if (s) {
      this.loadData(this.state.page);
    }
  },
  closeAssignX(e, s) {
    this.state.assignDataX = {};
    this.state.assignVisibleX = e;
    if (s) {
      this.loadData(this.state.page);
    }
  },
  closeAssignY(e, s) {
    this.state.assignDataY = {};
    this.state.assignVisibleY = e;
    if (s) {
      this.loadData(this.state.page);
    }
  },
  search() {
    this.setState({
      selectedRowKeys: []
    })
    this.loadData();
  },
  // 拆分详细
  showRes(record) {
    this.setState({
      resVisible: true,
      resRecord: record,
    });
  },
  resCancel() {
    this.setState({
      resVisible: false,
    });
  },
  reset() {
    this.state.nameSearch = "";
    this.state.releaseDate = [];
    this.state.shouKuanDate = [];
    this.state.orderNoSearch = "";
    this.state.departmenttList = undefined;
    this.state.amountStatus = undefined;
    this.state.processStatus = [];
    this.state.contractNoSearch = "";
    this.state.liquidationStatus = [];
    this.state.processStatusSearch = [];
    this.state.contractNo = "";
    this.loadData();
  },
  //驳回
  boHuiSubmit(e) {
    e.preventDefault();
    if (!this.state.content) {
      message.warning("请填写驳回原因");
      return false;
    }
    this.setState({
      loading: true,
    });
    $.ajax({
      method: "POST",
      dataType: "json",
      crossDomain: false,
      url: globalConfig.context + "/api/admin/financial/reject",
      data: {
        orderNo: this.state.bohuiData.orderNo,
        reason: this.state.content,
      },
    }).done(
      function (data) {
        if (!data.error.length) {
          message.success("驳回成功!");
          this.setState({
            loading: false,
          });
          this.boHuiOk();
        } else {
          message.warning(data.error[0].message);
        }
      }.bind(this)
    );
  },
  searchSwitch() {
    this.setState({
      searchMore: !this.state.searchMore,
    });
  },
  changeList(arr) {
    const newArr = [];
    this.state.columns.forEach((item) => {
      arr.forEach((val) => {
        if (val === item.title) {
          newArr.push(item);
        }
      });
    });
    this.setState({
      changeList: newArr,
    });
  },
  callback(key) {
    // console.log(key);
  },
  onSelectChange(selectedRowKeys) {
    // for(var i=0; i
        {this.state.resVisible ? (
          
        ) : (
          ""
        )}
        
          收款结算
        
        
          
            
              
            
          
          
            
               {
                  this.setState({ orderNoSearch: e.target.value });
                }}
              />
               {
                  this.setState({ nameSearch: e.target.value });
                }}
              />
              
               {
                  this.setState({
                    contractNoSearch: e.target.value,
                  });
                }}
              />
              
              
              
              下单日期:
               {
                  this.setState({ releaseDate: dataString });
                }}
              />
              最近收款:
               {
                  this.setState({ shouKuanDate: dataString });
                }}
              />
              
              
            
          
          
            
            
            
            
            
            
          
          
            
            
            
            
            
            
          
          
            
            
            
            
            
          
          {/* 
            
           */}
        
        
          
            
          
          
            {
              
                {`收款金额总计(万元):${this.state.hui ? this.state.hui : "0"}`}
              
            }
            {
              
                {`合同额总计(万元):${
                  this.state.totalHui ? this.state.totalHui : "0"
                }`}
              
            }
          
         
        
        
        
        
          
        
        
          
             {
                this.refs.kaiPiao = e;
              }}
            >
              
              
                开票总计}
                >
                  {this.state.sum + "(万元)"}
                
              
               (
                  
                )}
                content={() => this.refs.kaiPiao}
              />
             
          
        
        
          
             {
                this.refs.shouKuan = e;
              }}
            >
              
              
                总计金额}
                >
                  {this.state.waterSum + "(万元)"}
                
              
               (
                  
                )}
                content={() => this.refs.shouKuan}
              />
             
          
        
         {
            this.loadData();
            this.setState({
              dvisible: false,
            });
          }}
        >
          
             {
                this.refs.all = e;
              }}
            >
              
             
          
           (
              
            )}
            content={() => this.refs.all}
          />
        
         {
              this.setState({ pvisible: false });
            }}
        />
         {
            this.loadData();
            this.setState({
              timeVisible: false,
            });
          }}
        >
          
             {
                this.refs.all = e;
              }}
            >
              
             
          
           (
              
            )}
            content={() => this.refs.all}
          />
        
         {
            this.loadData();
            this.setState({
              cuiVisible: false,
              cuiTabKey: "1",
            });
          }}
        >
          
            
              
                 {
                    this.refs.all = e;
                  }}
                >
                  
                 
                 (
                    
                  )}
                  content={() => this.refs.all}
                />
              
            
            
              
                 {
                    this.refs.all = e;
                  }}
                >
                  
                 
                 (
                    
                  )}
                  content={() => this.refs.all}
                />
              
            
          
        
         {
            this.loadData(this.state.page);
            this.setState({
              proVisible: false,
            });
          }}
        >
          
             {
                this.refs.all = e;
              }}
            >
              
             
            
              外包(内部)价格总计(万元):{this.state.totalWaibao}
            
          
           (
              
            )}
            content={() => this.refs.all}
          />
        
        
          {this.state.checkVisible ?  {
              this.state.financeApprovalAjaxObj ? this.state.financeApprovalAjaxObj.abort() : null;
              this.setState({
                financeApprovalAjaxObj: null
              })
              this.loadData();
              this.setState({
                checkVisible: false,
                checkData: "",
              });
            }}
          >
             : }
        
        
      
    );
  },
});
export default ShouKuang;