| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891 | import React from "react";import $ from "jquery/src/ajax";import moment from "moment";import {  Button,  Form,  Input,  Spin,  Table,  Select,  message,  Tabs,  DatePicker,  Modal,} from "antd";import { ChooseList } from "../../order/orderNew/chooseList";import { ShowModal, getAccountName, getSecondaryAccountName } from "../../../tools"import { accountType, accountStatus } from "@/dataDic";import ShowModalDiv from "@/showModal.jsx";import OrderDetail from '../../order/orderNew/changeComponent/orderDetail';import './index.less';const FormItem = Form.Item;const { RangePicker } = DatePicker;const { TabPane } = Tabs;const AccountTotal = React.createClass({  getInitialState() {    return {      searchValues: {        targetType: 1      }, // 列表筛选条件      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: "contractNo",          key: "contractNo",          render: (text, record) => {            return (              this.state.searchValues["targetType"] == 1 ?                <span>                  {text + " / " + record.buyerName}                </span>                : <span>{record.depName}</span>            );          },        },        {          title: "合同总额/已收款(万元)",          dataIndex: "totalAmount",          key: "totalAmount",          render: (text, record) => {            return (              <div                className='receiveCount'                onClick={(e) => {                  e.stopPropagation();                  this.xiangqing(record.orderNo)                  this.xiangmu(record.orderNo)                  this.jiedian(record.orderNo)                  this.jiedianNew(record.orderNo)                  this.setState({                    visibleD: true,                    orderNo: record.orderNo,                  })                }}              >                {text + " / " + record.settlementAmount}              </div>            );          },        },        {          title: "报销总额(元)",          dataIndex: "expenseAmount",          key: "expenseAmount",          render: (text, record) => {            return (              <div                className='receiveCount'                onClick={(e) => {                  e.stopPropagation();                  this.tableRowClick(record)                }}              >                {text}              </div>            );          },        },        {          title: "已付成本(万元)",          dataIndex: "paymentAmount",          key: "paymentAmount",          render: (text, record) => {            return (              <div                className='receiveCount'                onClick={(e) => {                  e.stopPropagation();                  this.tableRowClick(record)                }}              >                {text}              </div>            );          },        },        {          title: "报销人数/天数/报销次数",          dataIndex: "peopleCount",          key: "peopleCount",          render: (text, record) => {            return (              <div                className='receiveCount'                onClick={(e) => {                  e.stopPropagation();                  this.tableRowClick(record)                }}              >                {text + " / " + record.days + " / " + record.expenseCount}              </div>            );          },        },        {          title: "报销未审核/驳回次数",          dataIndex: "notExamine",          key: "notExamine",          render: (text, record) => {            return (              <div                className='receiveCount'                onClick={(e) => {                  e.stopPropagation();                  this.tableRowClick(record)                }}              >                {text + " / " + record.rejectCount}              </div>            );          },        },      ],      visible: false,      columnsA: [        {          title: "类型",          dataIndex: "type",          key: "type",          render: (text, record) => {            return (              <span>                {(text == 0 && !record.typeOther)                  ? getAccountName(record.sonType, record.sonTypeOther)                  : getSecondaryAccountName(text, record.typeOther)}              </span>            );          },        },        {          title: "报销时间",          dataIndex: "releaseStart",          key: "releaseStart",          render: (text, record) => {            return (              <div>                <div style={{ textAlign: "center" }}>{text}</div>                <div style={{ textAlign: "center" }}>至</div>                <div style={{ textAlign: "center" }}>{record.releaseEnd}</div>              </div>            );          },        },        {          title: "工时",          dataIndex: "duration",          key: "duration",        },        {          title: "报销金额(元)",          dataIndex: "amount",          key: "amount",          width: 70,        },        {          title: "实报金额(元)",          dataIndex: "realAmount",          key: "realAmount",          width: 70,        },        {          title: "天数",          dataIndex: "days",          key: "days",        },        {          title: "报销编号",          dataIndex: "checkNo",          key: "checkNo",        },        {          title: "报销合同",          dataIndex: "contractNo",          key: "contractNo",        },        {          title: "客户",          dataIndex: "buyerName",          key: "buyerName",        },        {          title: "报销人",          dataIndex: "aname",          key: "aname",        },        {          title: "财务负责人",          dataIndex: "financeName",          key: "financeName",        },        {          title: "报销公司/支付公司",          dataIndex: "payDepName",          key: "payDepName",          render: (text, record) => {            return (              <div>                <div>{record.applyDepName || ""}</div>                <div>{text || ""}</div>              </div>            );          },        },        {          title: "发起时间",          dataIndex: "createTimeStr",          key: "createTimeStr",        },        {          title: "状态",          dataIndex: "status",          key: "status",          render: (text, record) => {            return (              <span style={{ color: accountStatus[text].color }}>                {accountStatus[text].label}              </span>            );          },        },      ],      dataSourceA: [],      visibleD: false,    };  },  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,    });    $.ajax({      method: "get",      dataType: "json",      crossDomain: false,      url: globalConfig.context + "/api/admin/expenseCounts/getCounts",      data: datas,      success: function (data) {        ShowModal(this);        this.setState({          loading: false,        });        if (data.error && data.error.length === 0) {          if (data.data) {            pagination.current = data.data.pageNo;            pagination.total = data.data.totalCount;            if (data.data && data.data && !data.data.length) {              pagination.current = 0;              pagination.total = 0;            }            this.setState({              dataSource: data.data,              pagination: this.state.pagination,              pageNo: data.data.pageNo,              totalAmount: data.data.totalAmount,            });          }        } else {          message.warning(data.error[0].message);        }      }.bind(this),    }).always(      function () {        this.setState({          loading: false,        });      }.bind(this)    );  },  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)    );  },  // 搜索  search() {    this.loadData();  },  // 重置  reset() {    this.setState({      searchValues: {        targetType: 1      },    }, () => {      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,    });  },  export() {    this.setState({      exportExecLoading: true    })    let loading = message.loading('加载中...');    let data = this.state.searchValues;    $.ajax({      method: "get",      dataType: "json",      crossDomain: false,      url: globalConfig.context + "/api/admin/expenseCounts/getCounts/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({        exportExecLoading: false      })    }.bind(this));  },  // 下载  download(fileName) {    window.location.href = globalConfig.context + "/open/download?fileName=" + fileName  },  // 清理缓存  getCountsClear() {    this.setState({      loading: true,    });    $.ajax({      method: "get",      dataType: "json",      crossDomain: false,      url: globalConfig.context + "/api/admin/expenseCounts/getCountsClear",      data: {},      success: function (data) {        ShowModal(this);        this.setState({          loading: false,        });        if (data.error && data.error.length === 0) {          message.success("清除成功!")        } else {          message.warning(data.error[0].message);        }      }.bind(this),    }).always(      function () {        this.setState({          loading: false,        });      }.bind(this)    );  },  tableRowClick(e) {    this.setState({      visible: true,      contractNo: e.contractNo,    }, () => {      this.getListA()    })  },  getListA() {    this.setState({      loading: true,    });    let data = {      pageNo: 1,      pageSize: 9999,      contractNo: this.state.contractNo,    };    $.ajax({      method: "get",      dataType: "json",      crossDomain: false,      url: globalConfig.context + "/api/admin/expenseAccount/detailsList",      data: data,      success: function (data) {        ShowModal(this);        this.setState({          loading: false,        });        if (data.error && data.error.length === 0) {          if (data.data.list) {            this.setState({              dataSourceA: data.data.list,              totalAmountA: data.data.totalAmount,            });          }        } else {          message.warning(data.error[0].message);        }      }.bind(this),    }).always(      function () {        this.setState({          loading: false,        });      }.bind(this)    );  },  //订单详情  xiangqing(orderNos) {    this.setState({      orderData: {}    }, () => {      $.ajax({        method: "get",        dataType: "json",        crossDomain: false,        url: globalConfig.context + "/api/admin/newOrder/getOrderNewDetail",        data: {          orderNo: orderNos        },        success: function (data) {          if (data.error.length || data.data.list == "") {            if (data.error && data.error.length) {              message.warning(data.error[0].message);            }          } else {            let thisdata = data.data;            this.setState({              orderUid: thisdata.uid,              userName: thisdata.userName,              primaryOrderNo: thisdata.primaryOrder,              additionalOrder: thisdata.additionalOrder,              contractNo: thisdata.contractNo,              // arrears: thisdata.arrears,              orderData: thisdata,              isAddition: thisdata.additionalOrder ? true : false,              deleteSign: thisdata.deleteSign,            });          }        }.bind(this)      });    });  },  //项目列表  xiangmu(orderNos) {    $.ajax({      method: "get",      dataType: "json",      crossDomain: false,      url: globalConfig.context + "/api/admin/newOrder/getOrderTask",      data: {        orderNo: orderNos      },      success: function (data) {        let theArr = [];        if (data.error.length || data.data.list == "") {          if (data.error && data.error.length) {            message.warning(data.error[0].message);          }        } else {          for (let i = 0; i < data.data.length; i++) {            let thisdata = data.data[i];            thisdata.key = i;            thisdata.sort = thisdata.cSort;            theArr.push(thisdata);          }        }        this.setState({          dataSourceX: theArr        });      }.bind(this)    });  },  //节点列表  jiedian(orderNos) {    $.ajax({      method: "get",      dataType: "json",      crossDomain: false,      url: globalConfig.context + "/api/admin/newOrder/selectOrderDun",      data: {        orderNo: orderNos      },      success: function (data) {        let theArr = [];        let thisData = [];        if (data.error.length || data.data.list == "") {          if (data.error && data.error.length) {            message.warning(data.error[0].message);          }        } else {          for (let i = 0; i < data.data.length; i++) {            thisData = data.data[i];            theArr.push({              key: i,              dunSubject: thisData.dunSubject                ? thisData.dunSubject.toString()                : "", //催款科目              id: thisData.id, //节点Id              money: thisData.money, //催款金额              dunStatus: thisData.dunStatus //催款状态            });          }          this.setState({            contactList: theArr          });        }      }.bind(this)    });  },  jiedianNew(orderNos) {    $.ajax({      method: "get",      dataType: "json",      crossDomain: false,      url:        globalConfig.context + "/api/admin/newOrderDun/selectListNewOrderDun",      data: {        orderNo: orderNos      },      success: function (data) {        if (data.error && data.error.length) {          message.warning(data.error[0].message);        } else {          let theArr = [];          let thisData = [];          let arr = data.data || [];          let totalCui = 0;          for (let i = 0; i < arr.length; i++) {            thisData = arr[i];            totalCui += +thisData.money;            theArr.push({              key: i,              dunSubject: thisData.dunSubject                ? thisData.dunSubject.toString()                : "", //催款科目              id: thisData.id, //节点Id              money: thisData.money, //催款金额              // orderNo: record ? record.orderNo : this.props.datauser.orderNo,              commodityName: thisData.commodityName,              projectType: thisData.projectType,              dunTypeName: thisData.dunTypeName,              status: thisData.status,              waitDay: thisData.waitDay,              effectiveCount: thisData.effectiveCount,              startDate: thisData.startDate,              dunType: thisData.dunType,              appropriationRatio: thisData.appropriationRatio,              customizeName: thisData.customizeName,              customizeTimes: thisData.customizeTimes,              tid: thisData.tid,            });          }          if (!totalCui) {            totalCui = 0;          }          totalCui = (Math.round(totalCui * 1000000) / 1000000).toFixed(6);          this.setState({            contactListNew: theArr,            totalCui          });        }      }.bind(this)    }).always(      function () {        this.setState({          loading: false        });      }.bind(this)    );  },  getOrderLog(orderNo) {    this.setState({      rizhivisible: true    });    this.rizhi(orderNo);  },  rizhi(orderNo) {    $.ajax({      method: "get",      dataType: "json",      crossDomain: false,      url: "/api/admin/newOrder/selectOrderLog",      data: {        orderNo: orderNo      },      success: function (data) {        let theArr = [];        let thisData = data.data;        if (!thisData.length) {          if (data.error && data.error.length) {            message.warning(data.error[0].message);          }          thisData = {};        } else {          for (let i = 0; i < data.data.length; i++) {            let thisdata = data.data[i];            theArr.push({              processName: thisdata.processName,              adminName: thisdata.adminName,              createDate: thisdata.createDate,              remarks: thisdata.remarks            });          }        }        this.setState({          dataSourcerizhi: theArr        });      }.bind(this)    });  },  render() {    const { searchValues, } = this.state    return (      <div className="user-content">        <ShowModalDiv ShowModal={this.state.showModal} />        <div className="content-title" style={{ marginBottom: 10 }}>          <span style={{ fontWeight: 900, fontSize: 16 }}>报销总计</span>        </div>        <Tabs defaultActiveKey="2" className="test">          <TabPane tab="搜索" key="2">            <div className="user-search" style={{ marginLeft: 10 }}>              <Select placeholder="" style={{ width: 140 }}                value={searchValues["targetType"]}                onChange={(e) => {                  searchValues["targetType"] = e;                  const _this = this;                  this.setState({                    searchValues: searchValues,                  }, () => {                    _this.search()                  });                }}              >                <Select.Option value={0} >部门</Select.Option>                <Select.Option value={1} >订单</Select.Option>              </Select>              {                searchValues["targetType"] == 1 &&                <Input                  placeholder="合同编号"                  value={searchValues["contactNo"]                    ? searchValues["contactNo"]                    : ""}                  onChange={(e) => {                    searchValues["contactNo"] = e.target.value;                    this.setState({                      searchValues: searchValues,                    });                  }}                />              }              <Input                placeholder="客户名称"                value={searchValues["buyerName"]                  ? searchValues["buyerName"]                  : ""}                onChange={(e) => {                  searchValues["buyerName"] = 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>              <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={{ margin: "0 10px" }}              >搜索</Button>              <Button onClick={this.reset}>重置</Button>              <Button                type="primary"                onClick={this.getCountsClear}                style={{ marginLeft: 10 }}              >清理缓存</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>          <TabPane tab="导出" key="3">            <div style={{ float: "left" }}>              <Button                type="primary"                loading={this.state.exportPendingLoading}                onClick={this.export}                style={{ margin: 10 }}              >                导出excel              </Button>            </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={false}              size="small"            />          </Spin>        </div>        <Modal          visible={this.state.visible}          maskClosable={false}          footer={false}          width={1400}          onCancel={() => { this.setState({ visible: false }) }}        >          <Spin spinning={this.state.loading}>            <Table              columns={this.state.columnsA}              dataSource={this.state.dataSourceA}              bordered              size="middle"              pagination={false}            />          </Spin>        </Modal>        {          this.state.visibleD &&          <Modal            title="订单详情"            visible={this.state.visibleD}            maskClosable={false}            footer={false}            width={1200}            onCancel={() => { this.setState({ visibleD: false }) }}          >            <OrderDetail              orderData={this.state.orderData}              orderUid={this.state.orderUid}              getOrderLog={this.getOrderLog}              dataSourceX={this.state.dataSourceX}              contactList={this.state.contactList}              orderNo={this.state.orderNo}              totalCui={this.state.totalCui}              contactListNew={this.state.contactListNew}            />          </Modal>        }      </div>    );  },});export default AccountTotal;
 |