import React from "react";
import $ from "jquery/src/ajax";
import moment from "moment";
import {
  Button,
  Form,
  Input,
  Spin,
  Table,
  Select,
  message,
  Tabs,
  Tag,
  Tooltip,
  DatePicker,
  Modal,
} from "antd";
import { ChooseList } from "../../order/orderNew/chooseList";
import { ShowModal, splitUrl, getAccountName, getVehicleName, getTypeName, commonAdd } from "../../../tools"
import ShowModalDiv from "@/showModal.jsx";
import ImgList from "../../../common/imgList";
import { accountType, accountStatus } from "@/dataDic";

const FormItem = Form.Item;
const { RangePicker } = DatePicker;
const { TabPane } = Tabs;

const AccountReview = React.createClass({

  getInitialState() {
    return {
      showDetails: false,
      data: {},
      logvisible: false,
      logdataSour: [],
      visible: "",
      reason: "",
      checkData: {},
      searchValues: {}, // 列表筛选条件
      loading: false, //加载动画
      changeList: undefined, // 更改后的表格显示数据
      dataSource: [], // 列表数据
      departmentArr: [],
      pagination: {
        defaultCurrent: 1,
        defaultPageSize: 10,
        showQuickJumper: true,
        pageSize: 10,
        onChange: function (page) {
          this.loadData(page);
        }.bind(this),
        showTotal: function (total) {
          return "共" + total + "条数据";
        },
      },
      columns: [
        {
          title: "类型",
          dataIndex: "type",
          key: "type",
          render: (text, record) => {
            return (
              <span>
                {accountType.find(item => item.value === text).label}
              </span>
            );
          },
        },
        {
          title: "报销金额（元）",
          dataIndex: "totalAmount",
          key: "totalAmount",
        },
        {
          title: "报销至订单",
          dataIndex: "buyerName",
          key: "buyerName",
          render: (text, record) => {
            return (
              <div>
                <div>{text || ""}</div>
                <div>{record.contractNo || ""}</div>
              </div>
            );
          },
        },
        {
          title: "报销至部门",
          dataIndex: "appDepName",
          key: "appDepName",
        },
        {
          title: "报销人",
          dataIndex: "aname",
          key: "aname",
        },

        {
          title: "财务负责人",
          dataIndex: "financeName",
          key: "financeName",
        },
        {
          title: "状态",
          dataIndex: "status",
          key: "status",
          render: (text, record) => {
            return (
              <span style={{ color: accountStatus[text].color }}>
                {accountStatus[text].label}
              </span>
            );
          },
        },
        {
          title: "报销公司/支付公司",
          dataIndex: "payDepName",
          key: "payDepName",
          render: (text, record) => {
            return (
              <div>
                <div>{record.appDepName || ""}</div>
                <div>{text || ""}</div>
              </div>
            );
          },
        },
        {
          title: "报销时间",
          dataIndex: "createTimeStr",
          key: "createTimeStr",
        },
        {
          title: "操作",
          dataIndex: "operate",
          key: "operate",
          render: (text, record) => {
            return (
              <div>
                {this.props.isOperate &&
                  <div>
                    <Button type="primary"
                      style={{ margin: 4 }}
                      onClick={() => { this.download(record.attachmentUrl) }}
                    >下载附件</Button>
                  </div>}
                <div>
                  {this.props.isOperate && record.examine == 1 &&
                    <Button type="primary"
                      style={{ margin: 4 }}
                      onClick={(e) => {
                        e.stopPropagation();
                        this.setState({
                          visible: "adopt",
                          checkData: record,
                        })
                      }}
                    >同意</Button>}
                  {this.props.isOperate && record.examine == 1 &&
                    <Button type="danger"
                      style={{ margin: 4 }}
                      onClick={(e) => {
                        e.stopPropagation();
                        this.setState({
                          visible: "reject",
                          checkData: record,
                        })
                      }}
                    >驳回</Button>}
                  {record.status != 0 && <Button
                    style={{ margin: 4 }}
                    onClick={() => {
                      this.setState({
                        logvisible: true
                      })
                      this.getLogData(record.id)
                    }}>日志</Button>}
                </div>
              </div>
            )
          }
        },
      ],
      logcolumns: [
        {
          title: "审核人",
          dataIndex: "auditorName",
          key: "auditorName"
        },
        {
          title: "操作",
          dataIndex: "status",
          key: "status",
          width: 120,
          render: (text, record) => {
            return (
              <span style={{ color: ["#1D4FEA", "#34DE38", "#108EE9", "red", "#1D4FEA"][text] }}>
                {["【发起】", "【通过】", "【完成】", "【驳回】", "【重新发起】"][text]}
                {this.state.processStatus == record.processStatus && !record.id &&
                  <span style={{ color: "#FFA500" }}>&nbsp;审核中...</span>}
              </span>
            );
          },
        },
        {
          title: "操作时间",
          dataIndex: "createTimeStr",
          key: "createTimeStr",
          width: 88,
        },
        {
          title: "备注",
          dataIndex: "remarks",
          key: "remarks",
          render: (text, record) => {
            return (
              <div style={{ minWidth: 250 }}>{text}</div>
            )
          }
        }
      ]
    };
  },

  componentWillMount() {
    this.departmentList();
    this.loadData();
  },

  // 列表接口
  loadData(pageNo) {
    const { searchValues, pagination } = this.state;
    this.setState({
      loading: true,
    });
    let datas = Object.assign(searchValues, {
      pageNo: pageNo || 1,
      pageSize: pagination.pageSize,
      processStatus: this.props.isOperate ? 1 : undefined,
    });
    $.ajax({
      method: "get",
      dataType: "json",
      crossDomain: false,
      url: globalConfig.context + "/api/admin/expenseAccount/pageList",
      data: datas,
      success: function (data) {
        ShowModal(this);
        this.setState({
          loading: false,
        });
        if (data.error && data.error.length === 0) {
          if (data.data.list) {
            pagination.current = data.data.pageNo;
            pagination.total = data.data.totalCount;
            if (data.data && data.data.list && !data.data.list.length) {
              pagination.current = 0;
              pagination.total = 0;
            }
            this.setState({
              dataSource: data.data.list,
              pagination: this.state.pagination,
              pageNo: data.data.pageNo,
              totalAmount: data.data.totalAmount,
            });
          } else {
            this.setState({
              dataSource: data.data,
              pagination: false,
            });
          }
        } else {
          message.warning(data.error[0].message);
        }
      }.bind(this),
    }).always(
      function () {
        this.setState({
          loading: false,
        });
      }.bind(this)
    );
  },

  // 日志
  getLogData(eaid) {
    $.ajax({
      method: "get",
      dataType: "json",
      crossDomain: false,
      url: globalConfig.context + "/api/admin/expenseAccount/log/list",
      data: { eaid },
      success: function (data) {
        if (data.error.length === 0) {
          this.setState({
            logdataSour: data.data || []
          });
          this.isHere(data.data || [])
        } else {
          message.warning(data.error[0].message);
        }
      }.bind(this)
    }).always(
      function () {

      }.bind(this)
    );
  },

  // 
  isHere(list = []) {
    for (var i = 0; i < list.length; i++) {
      if (!list[i].id) {
        this.setState({
          processStatus: list[i].processStatus
        })
        return
      }
    }
  },

  download(urls) {
    if (!urls) {
      message.error("暂无可下载的附件！");
    } else {
      let list = urls.split(',') || []
      list.forEach(e => {
        var aLink = document.createElement('a');
        aLink.download = e;
        aLink.href = globalConfig.context + `/open/download?fileName=${e}&delete=false`;
        document.body.appendChild(aLink);
        aLink.click();
        document.body.removeChild(aLink);
      });




    }
  },

  departmentList() {
    $.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 () {

      }.bind(this)
    );
  },

  // 审核
  toExamine(num) {
    const { checkData, reason } = this.state
    if (!reason) {
      message.warning("请填写审核说明~");
      return;
    }
    this.setState({
      loading: true,
    });
    $.ajax({
      method: "POST",
      dataType: "json",
      crossDomain: false,
      url: globalConfig.context + "/api/admin/expenseAccount/examine",
      data: {
        id: checkData.id,
        reason,
        status: num,//1同意 3驳回
      },
    }).done(
      function (data) {
        if (!data.error.length) {
          message.success("审核成功！");
          this.setState({
            visible: "",
            reason: "",
            showDetails: false,
            checkData: {},
          });
          this.loadData()
        } else {
          message.warning(data.error[0].message);
        }
      }.bind(this)
    );
  },

  tableRowClick(e) {
    this.setState({
      showDetails: true
    })
    this.getDetails(e.id)
    this.getAccountList(e.id)
  },

  // 报销信息详情
  getDetails(id) {
    $.ajax({
      method: "get",
      dataType: "json",
      crossDomain: false,
      url: globalConfig.context + "/api/admin/expenseAccount/selectById",
      data: { id, },
      success: function (data) {
        if (data.error.length === 0) {
          this.setState({
            data: data.data,
            imgs: data.data.attachmentUrl
              ? splitUrl(data.data.attachmentUrl, ",", globalConfig.avatarHost + "/upload")
              : [],
          })
        } else {
          message.warning(data.error[0].message);
        }
      }.bind(this),
    }).always(
      function () {
        this.setState({
          loading: false,
        });
      }.bind(this)
    );
  },

  // 报销费用详情
  getAccountList(eaid) {
    $.ajax({
      method: "get",
      dataType: "json",
      crossDomain: false,
      url: globalConfig.context + "/api/admin/expenseAccount/details/list",
      data: { eaid, },
      success: function (data) {
        if (data.error.length === 0) {
          let sum = 0
          for (var i = 0; i < data.data.length; i++) {
            sum = commonAdd(sum, data.data[i].amount)
          }
          this.setState({
            list: data.data,
            total: sum,
          })
        } else {
          message.warning(data.error[0].message);
        }
      }.bind(this),
    }).always(
      function () {
        this.setState({
          loading: false,
        });
      }.bind(this)
    );
  },

  // 搜索
  search() {
    this.loadData();
  },

  // 重置
  reset() {
    this.setState({
      searchValues: JSON.parse(JSON.stringify({})),
    }, () => {
      this.loadData();
    })
  },

  changeList(arr) {
    const newArr = [];
    this.state.columns.forEach((item) => {
      arr.forEach((val) => {
        if (val === item.title) {
          newArr.push(item);
        }
      });
    });
    this.setState({
      changeList: newArr,
    });
  },


  render() {
    const { TextArea } = Input
    const { searchValues, data, visible, list = [], total } = this.state
    const formItemLayout = {
      labelCol: { span: 10 },
      wrapperCol: { span: 14 },
    };
    return (
      <div className="user-content">
        <ShowModalDiv ShowModal={this.state.showModal} />
        <div className="content-title" style={{ marginBottom: 10 }}>
          <span style={{ fontWeight: 900, fontSize: 16 }}>{this.props.isOperate ? "报销审核" : "报销列表"}</span>
        </div>
        <Tabs defaultActiveKey="2" className="test">
          <TabPane tab="搜索" key="2">
            <div className="user-search" style={{ marginLeft: 10 }}>

              <Input
                placeholder="合同编号"
                value={searchValues["contractNo"]
                  ? searchValues["contractNo"]
                  : ""}
                onChange={(e) => {
                  searchValues["contractNo"] = e.target.value;
                  this.setState({
                    searchValues: searchValues,
                  });
                }}
              />

              <Input
                placeholder="客户名称"
                value={searchValues["username"]
                  ? searchValues["username"]
                  : ""}
                onChange={(e) => {
                  searchValues["username"] = e.target.value;
                  this.setState({
                    searchValues: searchValues,
                  });
                }}
              />
              <Select
                placeholder="所属部门"
                style={{ width: 200, marginRight: 10 }}
                value={searchValues["depId"]
                  ? searchValues["depId"]
                  : undefined}
                onChange={e => {
                  searchValues["depId"] = e;
                  this.setState({
                    searchValues: searchValues,
                  });
                }}
              >
                {this.state.departmentArr.map(function (item) {
                  return <Select.Option key={item.id}>{item.name}</Select.Option>;
                })}
              </Select>
              <Select
                placeholder="申请部门"
                style={{ width: 200, marginRight: 10 }}
                value={searchValues["applyDep"]
                  ? searchValues["applyDep"]
                  : undefined}
                onChange={e => {
                  searchValues["applyDep"] = e;
                  this.setState({
                    searchValues: searchValues,
                  });
                }}
              >
                {this.state.departmentArr.map(function (item) {
                  return <Select.Option key={item.id}>{item.name}</Select.Option>;
                })}
              </Select>
              <Select
                placeholder="支付部门"
                style={{ width: 200, marginRight: 10 }}
                value={searchValues["payDep"]
                  ? searchValues["payDep"]
                  : undefined}
                onChange={e => {
                  searchValues["payDep"] = e;
                  this.setState({
                    searchValues: searchValues,
                  });
                }}
              >
                {this.state.departmentArr.map(function (item) {
                  return <Select.Option key={item.id}>{item.name}</Select.Option>;
                })}
              </Select>

              <Select
                style={{ width: 120 }}
                placeholder="审核状态"
                value={searchValues["examineStatus"]
                  ? searchValues["examineStatus"]
                  : undefined}
                onChange={(e) => {
                  searchValues["examineStatus"] = e;
                  this.setState({
                    searchValues: searchValues,
                  });
                }}
              >
                <Option value="0">待审核</Option>
                <Option value="1">已审核</Option>
              </Select>
              <span>报销时间：</span>
              <RangePicker
                style={{ width: 300 }}
                value={[
                  searchValues.startTime ? moment(searchValues.startTime) : null,
                  searchValues.endTime ? moment(searchValues.endTime) : null,
                ]}
                onChange={(data, dataString) => {
                  this.setState({
                    searchValues: Object.assign(searchValues, {
                      startTime: dataString[0],
                      endTime: dataString[1],
                    }),
                  });
                }}
              />
              <Button
                type="primary"
                onClick={this.search}
                style={{ marginLeft: 10 }}
              >
                搜索
              </Button>
              <Button onClick={this.reset}>重置</Button>
            </div>
          </TabPane>
          <TabPane tab="更改表格显示数据" key="1">
            <div style={{ marginLeft: 10 }}>
              <ChooseList
                columns={this.state.columns}
                changeFn={this.changeList}
                changeList={this.state.changeList}
                top={55}
                margin={11}
              />
            </div>
          </TabPane>
        </Tabs>
        <div className="patent-table">
          <Spin spinning={this.state.loading}>
            <Table
              bordered
              columns={
                this.state.changeList == undefined
                  ? this.state.columns
                  : this.state.changeList
              }
              dataSource={this.state.dataSource}
              pagination={this.state.pagination}
              onRowDoubleClick={this.tableRowClick.bind(this)}
              size="small"
            />
          </Spin>
          <p
            style={{ display: "inline-block", fontSize: "14px", color: "red" }}
          >
            {
              <span style={{ marginRight: 10 }}>
                {`金额总计(元):${this.state.totalAmount}`}
              </span>
            }
          </p>
        </div>
        {
          //审核弹窗
          this.state.visible != "" &&
          <Modal
            width="400px"
            maskClosable={false}
            title="审核"
            confirmLoading={this.state.loading}
            visible={this.state.visible != ""}
            onOk={() => { this.toExamine(visible == "adopt" ? 1 : visible == "reject" && 3) }}
            okText={this.state.visible == "adopt" ? "通过" : this.state.visible == "reject" && "驳回"}
            onCancel={() => {
              this.setState({
                visible: '',
                reason: "",
                checkData: {},
              })
            }}
          >
            <TextArea
              rows={4}
              value={this.state.reason}
              onChange={(e) => {
                this.setState({
                  reason: e.target.value,
                })
              }}
              placeholder="请填写审核内容"
            />
          </Modal>
        }
        {
          // 报销详情
          this.state.showDetails &&
          <Modal
            maskClosable={false}
            visible={this.state.showDetails}
            onOk={false}
            onCancel={() => { this.setState({ showDetails: false }) }}
            width="800px"
            title='报销详情'
            footer=""
          >
            <div>
              <Form layout="horizontal" id="demand-form">
                <Spin spinning={this.state.loading}>
                  <div className="clearfix">
                    {data.type == 1 &&
                      <div>
                        <FormItem
                          className="half-item"
                          {...formItemLayout}
                          label="公出企业"
                        >
                          <span>{data.userNames}</span>
                        </FormItem>
                        <FormItem
                          className="half-item"
                          {...formItemLayout}
                          label="公出地点"
                        >
                          <span>{data.districtName}</span>
                        </FormItem>
                        <FormItem
                          className="half-item"
                          {...formItemLayout}
                          label="时间"
                        >
                          <span>{data.releaseStartStr} 至 {data.releaseEndStr}</span>
                        </FormItem>
                        <FormItem
                          className="half-item"
                          {...formItemLayout}
                          label="公出时长"
                        >
                          <span>{data.duration}小时</span>
                        </FormItem>
                      </div>}
                    <FormItem
                      className="half-item"
                      {...formItemLayout}
                      label="申请类型"
                    >
                      <span>{getAccountName(data.type, data.typeOther)}</span>
                    </FormItem>

                    <FormItem
                      className="half-item"
                      {...formItemLayout}
                      label="报销至订单"
                    >
                      <div>
                        <div>{data.buyerName}</div>
                        <div>{data.contractNo}</div>
                      </div>
                    </FormItem>
                    <FormItem
                      className="half-item"
                      {...formItemLayout}
                      label="报销人"
                    >
                      <span>{data.aname}</span>
                    </FormItem>
                    <FormItem
                      className="half-item"
                      {...formItemLayout}
                      label="报销公司"
                    >
                      <span>{data.appDepName}</span>
                    </FormItem>
                    <FormItem
                      className="half-item"
                      {...formItemLayout}
                      label="支付公司"
                    >
                      <span>{data.payDepName}</span>
                    </FormItem>
                  </div>

                  <div className="clearfix">
                    <FormItem
                      labelCol={{ span: 5 }}
                      wrapperCol={{ span: 18 }}
                      label="报销事由"
                    >
                      <p style={{ maxWidth: 500, wordWrap: "break-word" }}>
                        {data.remarks}
                      </p>
                    </FormItem>
                  </div>

                  {/* 差旅费显示 */}
                  {data.type == 1 &&
                    list.length > 0 && list.map(item =>
                      item.type == 1
                        ? <div className="clearfix" style={{ border: "1px solid #333", marginBottom: 1 }}>
                          <FormItem
                            className="half-item"
                            {...formItemLayout}
                            label="交通工具"
                          >
                            <span>
                              {getVehicleName(item.vehicle, item.vehicleOther)}
                              &nbsp;&nbsp;
                              {!!item.startDistrict && <span>（{item.startDistrict}&nbsp;⇀&nbsp;{item.endDistrict}）</span>}
                            </span>
                          </FormItem>
                          {/* <FormItem
                            className="half-item"
                            {...formItemLayout}
                            label="地点"
                          >
                            <span>{item.startDistrict}
                              <span>&nbsp;⇀&nbsp;</span>
                              {item.endDistrict}</span>
                          </FormItem> */}
                          <div className="clearfix" style={{ marginBottom: "-10px" }}>
                            <FormItem
                              labelCol={{ span: 5 }}
                              wrapperCol={{ span: 18 }}
                              label="时间"
                            >
                              <span>{item.startTimeStr}&nbsp;&nbsp;至&nbsp;&nbsp;{item.endTimeStr}</span>
                            </FormItem>
                          </div>
                          <FormItem
                            className="half-item"
                            {...formItemLayout}
                            label="交通费"
                          >
                            <span>{item.amount}（元）</span>
                          </FormItem>
                        </div>
                        : <div className="clearfix" style={{ border: "1px solid #333", marginBottom: 1 }}>
                          <FormItem
                            className="half-item"
                            {...formItemLayout}
                            label={getTypeName(item.type)}
                          >
                            <span>{item.amount}（元）</span>
                          </FormItem>
                        </div>
                    )
                  }

                  {/* 通用 */}
                  {(data.type == 0 || data.type == 2 || data.type == 4 || data.type == 5) &&
                    list.length > 0 && list.map(item =>
                      <div className="clearfix" style={{ border: "1px solid #333", marginBottom: 1 }}>
                        {!!item.agreeTimeStr &&
                          <FormItem
                            className="half-item"
                            {...formItemLayout}
                            label={data.type == 5 ? "支付时间:" : "需付款时间:"}
                          >
                            <span>{item.agreeTimeStr.slice(0, 10)}</span>
                          </FormItem>}
                        <FormItem
                          className="half-item"
                          {...formItemLayout}
                          label={data.type == 4
                            ? "预借支金额:" : data.type == 5
                              ? "抵扣金额:" : "金额:"}
                        >
                          <span>{item.amount}（元）</span>
                        </FormItem>
                      </div>
                    )
                  }

                  {/* 第三方付款 */}
                  {data.type == 3 &&
                    list.length > 0 && list.map(item =>
                      <div className="clearfix" style={{ border: "1px solid #333", marginBottom: 1 }}>
                        {!!item.agreeTimeStr &&
                          <FormItem
                            className="half-item"
                            {...formItemLayout}
                            label="需付款时间"
                          >
                            <span>{item.agreeTimeStr.slice(0, 10)}</span>
                          </FormItem>
                        }
                        <FormItem
                          className="half-item"
                          {...formItemLayout}
                          label="付款方式"
                        >
                          <span>{["公对公转账"][item.payType]}</span>
                        </FormItem>
                        <FormItem
                          className="half-item"
                          {...formItemLayout}
                          label="发票类型"
                        >
                          <span>{["普票", "专票"][item.invoiceType]}</span>
                        </FormItem>
                        <FormItem
                          className="half-item"
                          {...formItemLayout}
                          label="发票号"
                        >
                          <span>{item.invoiceNo}</span>
                        </FormItem>
                        <FormItem
                          className="half-item"
                          {...formItemLayout}
                          label="付款单位"
                        >
                          <span>{item.payerName}</span>
                        </FormItem>
                        <FormItem
                          className="half-item"
                          {...formItemLayout}
                          label="开户银行"
                        >
                          <span>{item.openBank}</span>
                        </FormItem>
                        <FormItem
                          className="half-item"
                          {...formItemLayout}
                          label="银行账户"
                        >
                          <span>{item.bankAccounts}</span>
                        </FormItem>
                        <FormItem
                          className="half-item"
                          {...formItemLayout}
                          label="开户行地址"
                        >
                          <span>{item.openBankAddress}</span>
                        </FormItem>
                        <FormItem
                          className="half-item"
                          {...formItemLayout}
                          label="金额（元）"
                        >
                          <span>{item.amount}</span>
                        </FormItem>
                      </div>
                    )
                  }

                  {data.type != 4 && data.debitTotalAmount &&
                    <div className="clearfix">
                      <FormItem
                        className="half-item"
                        {...formItemLayout}
                        label="预借支"
                      >
                        <span style={{ color: "red" }}>{data.debitTotalAmount}（元）</span>
                      </FormItem>
                    </div>}

                  {data.type != 4 && data.type != 5 &&
                    <div className="clearfix">
                      <FormItem
                        className="half-item"
                        {...formItemLayout}
                        label="总金额"
                      >
                        <span style={{ color: "red" }}>{total}（元）</span>
                      </FormItem>
                    </div>}

                  {data.type != 4 && data.type != 5 &&
                    <div className="clearfix">
                      <FormItem
                        className="half-item"
                        {...formItemLayout}
                        label="实报金额"
                      >
                        <span style={{ color: "red" }}>{(total > data.debitTotalAmount) ? commonAdd(total, -data.debitTotalAmount) : 0}（元）</span>
                      </FormItem>
                    </div>}

                  <div className="clearfix">
                    <FormItem
                      labelCol={{ span: 5 }}
                      wrapperCol={{ span: 18 }}
                      label="附件"
                    >
                      <div style={{ paddingTop: '10px', paddingBottom: '10px' }}>
                        {this.state.imgs ? <ImgList fileList={this.state.imgs} ItemWidth={'96px'} /> : <div />}
                      </div>
                    </FormItem>
                  </div>

                  {data.type != 3 && data.type != 5 &&
                    <div className="clearfix" style={{ border: "1px dashed #000" }}>
                      <FormItem
                        className="half-item"
                        {...formItemLayout}
                        label="收款人"
                      >
                        <span>{data.name}</span>
                      </FormItem>
                      <FormItem
                        className="half-item"
                        {...formItemLayout}
                        label="收款银行"
                      >
                        <span>{data.bank}</span>
                      </FormItem>
                      <FormItem
                        className="half-item"
                        {...formItemLayout}
                        label="收款账户"
                      >
                        <span>{data.accounts}</span>
                      </FormItem>
                    </div>}

                  <div className="clearfix" style={{ marginTop: 20 }}>
                    <Button
                      type="primary"
                      style={{
                        float: "right",
                      }}
                      onClick={() => {
                        this.setState({
                          logvisible: true
                        })
                        this.getLogData(data.id)
                      }}
                    >
                      查看日志
                    </Button>
                  </div>

                  {this.props.isOperate && data.examine == 1 &&
                    <div className="clearfix"
                      style={{ width: 500, margin: "20px auto" }}>
                      <TextArea
                        rows={4}
                        value={this.state.reason}
                        onChange={(e) => {
                          this.setState({
                            reason: e.target.value,
                          })
                        }}
                        placeholder="请填写审核内容"
                      />
                      <div
                        style={{
                          width: 250,
                          display: "flex",
                          justifyContent: "space-between",
                          margin: "20px auto 0"
                        }}
                      >
                        <Button type="primary"
                          style={{ margin: 4 }}
                          onClick={(e) => {
                            this.setState({
                              checkData: data
                            }, () => {
                              this.toExamine(1)
                            })
                          }}
                        >同意</Button>
                        <Button type="danger"
                          style={{ margin: 4 }}
                          onClick={(e) => {
                            this.setState({
                              checkData: data
                            }, () => {
                              this.toExamine(3)
                            })
                          }}
                        >驳回</Button>
                      </div>
                    </div>
                  }
                </Spin>
              </Form>
            </div>
          </Modal>
        }
        {
          // 审核日志
          this.state.logvisible &&
          <Modal
            visible={this.state.logvisible}
            className="admin-desc-content"
            width="800px"
            maskClosable={false}
            title="审核日志"
            footer={null}
            onCancel={() => {
              this.setState({
                logvisible: false,
                logdataSour: []
              })
            }}
          >
            <div className="patent-table">
              <Spin spinning={this.state.loading}>
                <Table
                  columns={this.state.logcolumns}
                  dataSource={this.state.logdataSour}
                  pagination={false}
                  bordered
                  size="small"
                />
              </Spin>
            </div>
          </Modal>
        }

      </div>
    );
  },
});

export default AccountReview;
