import React from "react";
import $ from "jquery/src/ajax";
import moment from "moment";
import "./public.less";
import "./shouKuan.less";
import {
  AutoComplete,
  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, getClockState } from "@/tools";
import { clockState, salesList } from "@/dataDic";
import OrderItemStatus from "../../../common/orderItemStatus";
import Cascaders from "../../../common/cascaders";
const FormItem = Form.Item;
const { TabPane } = Tabs;
const { TextArea } = Input;
const ShouKuang = React.createClass({
  //获取上级组织
  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(
              
                {theData.name}
              
            );
          }
          this.setState({
            contactsOption: theArr,
          });
        } else {
          message.warning(data.error[0].message);
        }
      }.bind(this),
    }).always(
      function () {
        this.setState({
          loading: false,
        });
      }.bind(this)
    );
  },
  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],
        deps: this.state.departmenttList,
        processStatus: this.state.processStatusSearch,
        contractNo: this.state.contractNoSearch,
        liquidationStatus: this.state.liquidationStatus,
        amountStatus: this.state.amountStatus,
        approval: this.state.approval,
        projectType: this.state.projectType,
        myExamine: this.state.myExamine,
      },
      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",
      pubVisible: false,
      pubDataList: [],
      pubpageNo: 1,
      pubpagination: {
        defaultCurrent: 1,
        defaultPageSize: 10,
        showQuickJumper: true,
        pageSize: 10,
        onChange: function (page) {
          this.loadData(page);
        }.bind(this),
        showTotal: function (total) {
          return "共" + total + "条数据";
        },
      },
      searchMore: true,
      dvisible: false,
      pageNo: 1,
      assignVisibleX: false,
      assignVisibleY: false,
      releaseDate: [],
      shouKuanDate: [],
      assignDataX: [],
      assignDataY: [],
      totalPage: 0,
      processStatusSearch: [],//默认搜索无流程状态
      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,
      pubColumns: [
        {
          title: "编号",
          dataIndex: "key",
          key: "key",
          width: 45,
        },
        {
          title: "公出类型",
          dataIndex: "type",
          key: "type",
          width: 70,
          render: (text) =>
            
              {
                text === 0
                  ? "业务公出" : text === 1
                    ? "技术公出" : text === 2
                      ? "行政公出" : text === 3
                        ? "技术协单" : ""
              }
            
        },
        {
          title: "客户名称",
          dataIndex: "nickname",
          key: "nickname",
          width: 80,
          render: (text) => {
            return (
              
                {text}
              
            );
          },
        },
        {
          title: "跟单人",
          dataIndex: "sname",
          key: "sname",
          width: 70,
          render: (text) => {
            return (
              
                
                  {text}
                
              
            );
          },
        },
        {
          title: "公出人",
          dataIndex: "aname",
          key: "aname",
          width: 70,
          render: (text) => {
            return (
              
                
                  {text}
                
              
            );
          },
        },
        // {
        //   title: "申请时间",
        //   dataIndex: "createTimes",
        //   key: "createTimes",
        //   width: 130,
        // },
        {
          title: "公出时间",
          dataIndex: "releaseStarts",
          key: "releaseStarts",
          width: 130,
          render: (text, record) => (
            
              {text}
              至
              {record.releaseEnds}
             
          ),
        },
        {
          title: "公出地点",
          dataIndex: "userName",
          key: "userName",
          width: 120,
          render: (text) => {
            return (
              {text}
            );
          },
        },
        {
          title: "打卡时间",
          dataIndex: "clockInTimes",
          key: "clockInTimes",
          width: 75,
        },
        {
          title: "时长(时)",
          dataIndex: "duration",
          key: "duration",
          width: 50,
        },
        {
          title: "打卡状态",
          dataIndex: "clockIn",
          key: "clockIn",
          width: 65,
          render: (text) => (
            
              {["未打卡", "已打卡"][text]}
            
          )
        },
        {
          title: "审核状态",
          dataIndex: "status",
          key: "status",
          width: 110,
          render: (text, record) => (
            
              
                {getClockState(text).title}
              
              {record.updateStatus == 1 && 改}
            
          ),
        },
        {
          title: "审核/指导",
          dataIndex: "auditInfo",
          key: "auditInfo",
          width: 160,
          render: (text) => {
            return {text}
;
          },
        },
      ],
      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, record) => {
            return getProcessStatus(text, record.examineName, record.approval);
          },
        },
        {
          title: "特批状态",
          dataIndex: "approval",
          key: "approval",
          render: (text) => {
            return getApproval(text);
          },
        },
      ],
      columns: [
        {
          title: "销售类型",
          dataIndex: "salesType",
          key: "salesType",
          className: "title-table",
          fixed: "left",
          render: (text, record) => {
            return (
              
                
                  {salesList[text]}
                
              
            );
          },
        },
        {
          title: "合同编号",
          dataIndex: "contractNo",
          key: "contractNo",
          className: "title-table",
          fixed: "left",
          render: (text, record) => {
            return (
               {
                      e.stopPropagation();
                      let input = document.getElementById("copyText");
                      input.value = text;
                      input.select();
                      document.execCommand("copy");
                      message.success("复制成功");
                    }}
                  >
                    复制
                  
                }
              >
                
                  {text}
                  
                    
                    {
                      record.approval == 1
                        ? 特批待审 : record.approval == 2
                          ? 特批通过 : record.approval == 4
                            ? 特批待审 : record.approval == 5
                              ? 特批通过 : ""
                    }
                  
                 
              
            );
          },
        },
        {
          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",
          width: 150,
          render: (text, record) => {
            return (
               {
                      e.stopPropagation();
                      let input = document.getElementById("copyText");
                      input.value = text;
                      input.select();
                      document.execCommand("copy");
                      message.success("复制成功");
                    }}
                  >
                    复制
                  
                }
              >
                
                  {text}
                  
                    {record.signTotalAmount >= 10 && 大客户}
                    {record.projectType == 1 && 会员}
                  
                 
              
            );
          },
        },
        // {
        //   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: "serviceType",
          key: "serviceType",
          className: "title-table",
          width: 150,
          render: (text) => {
            return !!text && text.replace(/[,,]/g, "+");
          }
        },
        {
          title: "订单内容",
          dataIndex: "serviceProject",
          key: "serviceProject",
          className: "title-table",
          render: (text) => {
            return (") }} />);
            // return ({!!text && text.replace(/[,,]/g, "\n")});
          }
        },
        {
          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, record) => {
            return (
              
                {isNaN(parseFloat(text)) ? text : parseFloat(text)}/
                {isNaN(parseFloat(record.paymentAmount)) ? text : parseFloat(record.paymentAmount)}
              
            )
          },
        },
        {
          title: "专利/专利已付",
          dataIndex: "patentCost",
          key: "patentCost",
          className: "title-table",
          render: (text, record) => {
            return (
              
                {isNaN(parseFloat(text)) ? text : parseFloat(text)}/
                {isNaN(parseFloat(record.patentCostActual)) ? text : parseFloat(record.patentCostActual)}
              
            )
          },
        },
        {
          title: "软著/软著已付",
          dataIndex: "softCost",
          key: "softCost",
          className: "title-table",
          render: (text, record) => {
            return (
              
                {isNaN(parseFloat(text)) ? text : parseFloat(text)}/
                {isNaN(parseFloat(record.softCostActual)) ? text : parseFloat(record.softCostActual)}
              
            )
          },
        },
        {
          title: "审计/审计已付",
          dataIndex: "auditCost",
          key: "auditCost",
          className: "title-table",
          render: (text, record) => {
            return (
              
                {isNaN(parseFloat(text)) ? text : parseFloat(text)}/
                {isNaN(parseFloat(record.auditCostActual)) ? text : parseFloat(record.auditCostActual)}
              
            )
          },
        },
        {
          title: "其他/其他已付",
          dataIndex: "otherCost",
          key: "otherCost",
          className: "title-table",
          render: (text, record) => {
            return (
              
                {isNaN(parseFloat(text)) ? text : parseFloat(text)}/
                {isNaN(parseFloat(record.otherCostActual)) ? text : parseFloat(record.otherCostActual)}
              
            )
          },
        },
        {
          title: "预估毛利(万元)",
          dataIndex: "expectProfit",
          key: "expectProfit",
          className: "title-table",
        },
        {
          title: "实际毛利(万元)",
          dataIndex: "actualProfit",
          key: "actualProfit",
          className: "title-table",
        },
        {
          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, record) => {
            return getProcessStatus(text, record.examineName, record.approval);
          },
        },
        //                 {
        //                     title: '订单状态',
        //                     dataIndex: 'orderStatus',
        //                     key: 'orderStatus',
        //                     render: text => { return getNewOrderStatus(text)}
        //                 },
        {
          title: "操作",
          dataIndex: "caozuo",
          key: "caouzo",
          className: "title-table",
          fixed: "right",
          render: (text, recard) => {
            return (
              
                {/* {recard.backStatus == 3 ? 已驳回 : ""} */}
                {recard.processStatus == 3 && recard.myExamine == 0 &&
                  }
                {recard.processStatus == 3 && recard.myExamine == 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: [],
      newVisible: "",
    };
  },
  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,
    });
  },
  tableonRowClick(record) {
    if (this.state.newVisible == "项目进度") {
      this.state.onRowData = record;
      this.setState({
        pvisible: true,
        record
      })
    }
  },
  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.approval = undefined;
    this.state.projectType = undefined;
    this.state.processStatus = [];
    this.state.contractNoSearch = "";
    this.state.liquidationStatus = [];
    this.state.processStatusSearch = [];
    this.state.contractNo = "";
    this.Cascaders.empty();
    this.loadData();
  },
  //驳回
  boHuiSubmit(e) {
    e.preventDefault();
    if (!this.state.content) {
      message.warning("请填写驳回原因");
      return false;
    }
    if (!this.state.content.replace(/\s+/g, '')) {
      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, selectedRows) {
    // for(var i=0; i {
        this.pubData();
      }
    );
  },
  //公出导出
  pubexportExec() {
    this.setState({
      exportPendingLoading: true,
    });
    message.config({
      duration: 20,
    });
    let loading = message.loading("下载中...");
    let rows = this.state.selectedRows[0]
    let searchInfor = {
      releaseStart: this.state.releaseDate[0] || undefined,
      releaseEnd: this.state.releaseDate[1] || undefined,
      aid: this.state.theTypes || undefined,
      sid: this.state.theTypes1 || undefined,
      status: this.state.status,
      clockIn: this.state.clockIn,
      depId: this.state.depId || undefined,
      publicType: this.state.type,
    }
    let data = Object.assign(searchInfor, {
      pageNo: this.state.pubpageNo || 1,
      pageSize: 9999999,
      uid: rows.buyerId,
      exportType: 1,
    });
    for (let i of Object.keys(data)) {
      if (i === "status" || i === "clockIn") {
        if (isNaN(parseInt(data[i]))) {
          delete data[i];
        }
      } else if (!data[i]) {
        delete data[i];
      }
    }
    $.ajax({
      method: "get",
      dataType: "json",
      crossDomain: false,
      url: globalConfig.context + "/api/admin/release/publicReleaseDtails/export",
      data,
      success: function (data) {
        if (data.error.length === 0) {
          this.download(data.data);
        } else {
          message.warning(data.error[0].message);
        }
      }.bind(this),
    }).always(
      function () {
        loading();
        this.setState({
          exportPendingLoading: false,
        });
      }.bind(this)
    );
  },
  // 下载
  download(fileName) {
    window.location.href =
      globalConfig.context + "/open/download?fileName=" + fileName;
  },
  checkRemark(record) {
    this.setState({
      checkVisible: true,
      checkOrderNo: record.orderNo,
    });
  },
  checkOk() {
    if (!this.state.checkData) {
      message.warning("请填写审核内容");
      return;
    }
    if (!this.state.checkData.replace(/\s+/g, '')) {
      message.warning("请填写审核内容");
      return;
    }
    this.setState({
      loading: true,
    });
    let ajaxObj = $.ajax({
      method: "post",
      dataType: "json",
      crossDomain: false,
      url: globalConfig.context + "/api/admin/financial/financeApproval",
      data: {
        orderNo: this.state.checkOrderNo,
        remarks: this.state.checkData,
      },
      success: function (data) {
        let theArr = [];
        if (!data.data) {
          if (data.error && data.error.length) {
            message.warning(data.error[0].message);
          }
        } else {
          message.success("通过成功!");
          this.loadData();
          this.setState({
            checkVisible: false,
            checkData: "",
          });
        }
      }.bind(this),
    }).always(
      function () {
        this.setState({
          loading: false,
          financeApprovalAjaxObj: null
        });
      }.bind(this)
    );
    this.setState({
      financeApprovalAjaxObj: ajaxObj
    })
  },
  tableRowClickPro(record) {
    this.setState({
      pvisible: true,
      record,
    });
  },
  kaiPiaoData(record) {
    this.setState({
      avisible: true,
    });
    this.invoiceData(record.id)
  },
  invoiceData(id) {
    this.setState({
      loading: true,
    });
    $.ajax({
      method: "get",
      dataType: "json",
      crossDomain: false,
      url:
        globalConfig.context + "/api/admin/orderInvoice/selectByIdOrderInvoice",
      data: {
        id,
      },
      success: function (data) {
        let thisdata = data.data;
        let obj = {
          contractNo: thisdata.contractNo,
          orderNo: thisdata.orderNo,
          approval: thisdata.approval,
          type: thisdata.type,
          status: thisdata.status,
          remarks: thisdata.remarks,
          invoiceType: thisdata.invoiceType,
          unitName: thisdata.unitName,
          taxNumber: thisdata.taxNumber,
          amount: thisdata.amount,
          banks: thisdata.banks,
          content: thisdata.content,
          unitAddress: thisdata.unitAddress,
          invoiceRemarks: thisdata.invoiceRemarks,
          unitMobile: thisdata.unitMobile,
          post: thisdata.post,
          addressee: thisdata.addressee,
          addresseeMobile: thisdata.addresseeMobile,
          addresseeProvince: thisdata.addresseeProvince,
          addresseeCity: thisdata.addresseeCity,
          addresseeArea: thisdata.addresseeArea,
          alreadyAmount: thisdata.alreadyAmount,
          recipientAddress: thisdata.recipientAddress,
          orgCodeUrl: thisdata.voucherUrl
            ? splitUrl(
              thisdata.voucherUrl,
              ",",
              globalConfig.avatarHost + "/upload"
            )
            : [],
        };
        this.setState({
          modalData: obj,
        });
      }.bind(this),
    }).done(
      function () {
        this.setState({
          loading: false,
        });
      }.bind(this)
    );
  },
  visitCancels() {
    this.setState({
      avisible: false
    })
  },
  selectAuto(value, options) {
    this.setState({
      auto: value,
    });
  },
  selectAuto1(value, options) {
    this.setState({
      auto1: value,
    });
  },
  blurChange(e) {
    let theType = "";
    let contactLists = this.state.customerArr || [];
    if (e) {
      contactLists.map(function (item) {
        if (item.name == e.toString()) {
          theType = item.id;
        }
      });
    }
    this.setState({
      theTypes: theType,
    });
  },
  blurChange1(e) {
    let theType = "";
    let contactLists = this.state.customerArr1 || [];
    if (e) {
      contactLists.map(function (item) {
        if (item.name == e.toString()) {
          theType = item.id;
        }
      });
    }
    this.setState({
      theTypes1: theType,
    });
  },
  httpChange(e) {
    if (e.length >= 1) {
      this.supervisor(e);
    }
    this.setState({
      auto: e,
    });
  },
  httpChange1(e) {
    if (e.length >= 1) {
      this.supervisor1(e);
    }
    this.setState({
      auto1: e,
    });
  },
  supervisor(e) {
    $.ajax({
      method: "get",
      dataType: "json",
      crossDomain: false,
      url: globalConfig.context + "/api/admin/customer/listAdminByName",
      data: {
        adminName: e,
      },
      success: function (data) {
        if (data.error && data.error.length === 0) {
          this.setState({
            customerArr: data.data,
          });
        } else {
          message.warning(data.error[0].message);
        }
      }.bind(this),
    }).always(function () { }.bind(this));
  },
  supervisor1(e) {
    $.ajax({
      method: "get",
      dataType: "json",
      crossDomain: false,
      url: globalConfig.context + "/api/admin/customer/listAdminByName",
      data: {
        adminName: e,
      },
      success: function (data) {
        if (data.error && data.error.length === 0) {
          this.setState({
            customerArr1: data.data,
          });
        } else {
          message.warning(data.error[0].message);
        }
      }.bind(this),
    }).always(function () { }.bind(this));
  },
  render() {
    const formItemLayout = {
      labelCol: { span: 8 },
      wrapperCol: { span: 14 },
    };
    const { RangePicker } = DatePicker;
    var departmentArr = this.state.departmentArr || [];
    const { loading, selectedRowKeys, visible } = this.state;
    const rowSelection = {
      selectedRowKeys,
      onChange: this.onSelectChange,
      hideDefaultSelections: true,
      type: "radio",
    };
    const dataSources = this.state.customerArr || [];
    const dataSources1 = this.state.customerArr1 || [];
    const options = dataSources.map((group) => (
      
        {group.name}
      
    ));
    const options1 = dataSources1.map((group) => (
      
        {group.name}
      
    ));
    return (
      
        {this.state.resVisible ? (
          
        ) : (
          ""
        )}
        
          收款结算
        
        
          
            
              
            
          
          
            
               {
                  this.setState({ orderNoSearch: e.target.value });
                }}
              />
               {
                  this.setState({
                    contractNoSearch: e.target.value,
                  });
                }}
              />
               {
                  this.setState({ nameSearch: e.target.value });
                }}
              />
               this.Cascaders = node}
                placeholder="订单部门"
                id="id"
                name="name"
                children="list"
                height={28}
                onSel={(e) => {
                  this.setState({
                    departmenttList: JSON.stringify(e),
                  });
                }}
              />
              {/*  */}
              
              
              
              
              
              下单日期:
               {
                  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.selectedRows.length > 0 && this.state.selectedRows[0].buyerName}
            )}
          className="admin-desc-content"
          width="1500px"
          pagination={false}
          onCancel={() => {
            this.pubData();
            this.setState({
              pubVisible: false,
            });
          }}
        >
          
          
             {
                this.refs.all = e;
              }}
            >
              
             
          
          
           (
              
            )}
            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: "",
              });
            }}
          >
             : }
        
        
        {/* 合并查看 */}
        {
          this.state.newVisible != "" &&
           {
              this.setState({
                newVisible: "",
              });
            }}
          >
            
              
                
                
                  
                  
                  
                  
                  
                  
                
                {
                  this.state.newVisible == "公出详细列表" &&
                  
                }
                {
                  this.state.newVisible == "催款详情"
                    ? 
                      
                        
                           {
                              this.refs.all = e;
                            }}
                          >
                            
                           
                          
                           (
                              
                            )}
                            content={() => this.refs.all}
                          />
                        
                      
                      
                        
                           {
                              this.refs.all = e;
                            }}
                          >
                            
                           
                           (
                              
                            )}
                            content={() => this.refs.all}
                          />
                        
                      
                    
                    : 
 {
                        this.refs.all = e;
                      }}
                    >
                      
                      {
                        this.state.newVisible == "开票历史记录" &&
                        
                          开票总计}
                          >
                            {this.state.sum + "(万元)"}
                          
                        
                      }
                      {
                        this.state.newVisible == "开票历史记录" &&
                        
                      }
                      {
                        this.state.newVisible == "开票历史记录" &&
                        
 (
                            
                          )}
                          content={() => this.refs.kaiPiao}
                        />
                      }
                      {
                        this.state.newVisible == "详细收款流水" &&
                        
                          总计金额}
                          >
                            {this.state.waterSum + "(万元)"}
                          
                        
                      }
                      {
                        this.state.newVisible == "详细收款流水" &&
                        
                      }
                      {
                        this.state.newVisible == "详细收款流水" &&
                         (
                            
                          )}
                          content={() => this.refs.shouKuan}
                        />
                      }
                      {
                        this.state.newVisible == "工时详情" &&
                        
                      }
                      {
                        this.state.newVisible == "工时详情" &&
                         (
                            
                          )}
                          content={() => this.refs.all}
                        />
                      }
                      {
                        this.state.newVisible == "项目进度" &&
                        
                          外包(内部)价格总计(万元):{this.state.totalWaibao}
                        
                      }
                      {
                        this.state.newVisible == "项目进度" &&
                        
                      }
                      {
                        this.state.newVisible == "项目进度" &&
                         (
                            
                          )}
                          content={() => this.refs.all}
                        />
                      }
                      {
                        this.state.newVisible == "公出详细列表" &&
                        
                      }
                      {
                        this.state.newVisible == "公出详细列表" &&
                         (
                            
                          )}
                          content={() => this.refs.all}
                        />
                      }
                    
                }
              
 
            
          
        }
        
       
    );
  },
});
export default ShouKuang;