123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496 |
- import React from "react";
- import $ from "jquery/src/ajax";
- import moment from "moment";
- import "./public.less";
- import {
- Button,
- Form,
- Input,
- Select,
- Spin,
- Table,
- message,
- DatePicker,
- Modal, Tabs
- } from "antd";
- import OrderDesc from "@/manageCenter/financialManage/orderDetail/orderDesc";
- import Assign from "@/manageCenter/publicComponent/assign";
- import { getProcessStatus, getApproval } from "@/tools";
- import { ChooseList } from "../../order/orderNew/chooseList";
- import DepartmentList from "../../../common/departmentList";
- const FormItem = Form.Item;
- const { TabPane } = Tabs;
- const PaiDan = React.createClass({
- loadData(pageNo) {
- this.state.data = [];
- this.setState({
- selectedRowKeys: [],
- selectedRowKey: [],
- page: pageNo,
- loading: true
- });
- $.ajax({
- method: "get",
- dataType: "json",
- crossDomain: false,
- url: globalConfig.context + "/api/admin/financial/allUnassignedOrder",
- data: {
- pageNo: pageNo || 1,
- pageSize: this.state.pagination.pageSize,
- buyerName: this.state.nameSearch, //客户名称
- orderNo: this.state.orderNoSearch,
- startTime: this.state.releaseDate[0],
- endTime: this.state.releaseDate[1],
- processStatus: this.state.processStatusSearch,
- contractNo: this.state.contractNoSearch,
- departmentId: this.state.departmenttList,
- outsource: 0
- },
- success: function (data) {
- let theArr = [];
- if (!data.data || !data.data.list) {
- if (data.error && data.error.length) {
- message.warning(data.error[0].message);
- }
- } else {
- for (let i = 0; i < data.data.list.length; i++) {
- let thisdata = data.data.list[i];
- theArr.push({
- key: i,
- orderNo: thisdata.orderNo,
- approval: thisdata.approval,
- orderType: thisdata.orderType,
- examineName: thisdata.examineName,
- processStatus: thisdata.processStatus,
- signTotalAmount: thisdata.signTotalAmount,
- buyerName: thisdata.buyerName,
- sellerName: thisdata.sellerName,
- createTime: thisdata.createTime
- ? new Date(thisdata.createTime).toLocaleString()
- : "",
- signTime: thisdata.signTime,
- contractNo: thisdata.contractNo,
- financeId: thisdata.financeId,
- departmentName: thisdata.departmentName
- });
- }
- }
- this.state.pagination.current = data.data.pageNo;
- this.state.pagination.total = data.data.totalCount;
- if (data.data && data.data.list && !data.data.list.length) {
- this.state.pagination.current = 0;
- this.state.pagination.total = 0;
- }
- this.setState({
- totalPage: data.data.totalPage,
- dataSource: theArr,
- pagination: this.state.pagination
- });
- }.bind(this)
- }).always(
- function () {
- this.setState({
- loading: false
- });
- }.bind(this)
- );
- },
- getInitialState() {
- return {
- searchMore: true,
- assignVisible: false,
- releaseDate: [],
- totalPage: 0,
- processStatusSearch: "2",
- boHuivisible: false,
- selectedRowKeys: [],
- selectedRows: [],
- loading: false,
- 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: "orderNo",
- key: "orderNo"
- },
- {
- title: "合同编号",
- dataIndex: "contractNo",
- key: "contractNo"
- },
- {
- title: "下单时间",
- dataIndex: "createTime",
- key: "createTime"
- },
- {
- title: "签单时间",
- dataIndex: "signTime",
- key: "signTime"
- },
- {
- title: "签单客户",
- dataIndex: "buyerName",
- key: "buyerName",
- render: text => {
- return text && text.length > 8 ? text.substr(0, 8) + "..." : text;
- }
- },
- {
- title: "流程状态",
- dataIndex: "processStatus",
- key: "processStatus",
- render: (text, record) => {
- return getProcessStatus(text, record.examineName, record.approval);
- },
- },
- {
- title: "订单部门",
- dataIndex: "departmentName",
- key: "departmentName",
- render: text => {
- return text && text.length > 8 ? text.substr(0, 8) + "..." : text;
- }
- },
- {
- title: "订单总金额(万)",
- dataIndex: "signTotalAmount",
- key: "signTotalAmount"
- },
- {
- title: "是否特批",
- dataIndex: "approval",
- key: "approval",
- render: text => {
- return getApproval(text);
- }
- },
- {
- title: "订单负责人",
- dataIndex: "sellerName",
- key: "sellerName"
- },
- {
- title: "操作",
- dataIndex: "caozuo",
- key: "caouzo",
- render: (text, recard) => {
- return <div>{this.judgeFenpai(recard)}</div>;
- }
- }
- ],
- dataSource: [],
- searchTime: [,]
- };
- },
- /* 判断是否有分派按钮 */
- judgeFenpai(recard) {
- if (recard.approval === 2) {
- if (recard.financeId === null || recard.financeId === "") {
- return (
- <Button
- type="primary"
- onClick={e => {
- e.stopPropagation(), this.evaluate(recard);
- }}
- >
- 分派
- </Button>
- );
- } else {
- return undefined;
- }
- } else if (recard.processStatus <= 2) {
- return (
- <Button
- type="primary"
- onClick={e => {
- e.stopPropagation(), this.evaluate(recard);
- }}
- >
- 分派
- </Button>
- );
- } else {
- return undefined;
- }
- },
- /* 分派 */
- evaluate(recard) {
- this.state.assignData = recard;
- this.setState({
- assignVisible: 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();
- },
- tableRowClick(record) {
- this.state.RowData = record;
- this.setState({
- showDesc: true
- });
- },
- closeDesc(e, s) {
- this.state.showDesc = e;
- if (s) {
- this.loadData(this.state.page);
- }
- },
- closeAssign(e, s) {
- this.state.assignVisible = e;
- if (s) {
- 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);
- }
- }
- },
- search() {
- this.loadData();
- },
- reset() {
- this.state.nameSearch = "";
- this.state.releaseDate = [];
- this.state.orderNoSearch = "";
- this.state.departmenttList = undefined;
- this.state.processStatus = [];
- this.state.contractNoSearch = "";
- this.loadData();
- },
- 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
- });
- },
- render() {
- const { RangePicker } = DatePicker;
- return (
- <div className="user-content">
- <div className="content-title" style={{ marginBottom: 10 }}>
- <span style={{ fontWeight: 900, fontSize: 16 }}>派单管理</span>
- </div>
- <Tabs defaultActiveKey="1" className="test">
- <TabPane tab="搜索" key="1">
- <div className="user-search" style={{ marginLeft: 10 }}>
- <Input
- placeholder="订单编号"
- value={this.state.orderNoSearch}
- onChange={e => {
- this.setState({ orderNoSearch: e.target.value });
- }}
- />
- <Input
- placeholder="合同编号"
- value={this.state.contractNoSearch}
- onChange={e => {
- this.setState({
- contractNoSearch: e.target.value
- });
- }}
- />
- <Input
- placeholder="客户名称"
- value={this.state.nameSearch}
- onChange={e => {
- this.setState({ nameSearch: e.target.value });
- }}
- />
- <DepartmentList
- value={this.state.departmenttList}
- onChange={e => {
- this.setState({ departmenttList: e });
- }} />
- <Select
- placeholder="流程状态"
- onChange={e => {
- this.setState({ processStatusSearch: e });
- }}
- style={{ width: 160, marginRight: 5 }}
- value={this.state.processStatusSearch}
- >
- <Option value="2">未分配</Option>
- <Option value="3">已分配</Option>
- </Select>
- <span style={{ marginRight: 10 }}>下单时间 :</span>
- <RangePicker
- value={[
- this.state.releaseDate[0]
- ? moment(this.state.releaseDate[0])
- : null,
- this.state.releaseDate[1]
- ? moment(this.state.releaseDate[1])
- : null
- ]}
- onChange={(data, dataString) => {
- this.setState({ releaseDate: dataString });
- }}
- />
- <Button
- type="primary"
- onClick={this.search}
- style={{ marginLeft: 10 }}
- >
- 搜索
- </Button>
- <Button onClick={this.reset}>重置</Button>
- </div>
- </TabPane>
- <TabPane tab="更改表格显示数据" key="2">
- <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
- columns={
- this.state.changeList
- ? this.state.changeList
- : this.state.columns
- }
- dataSource={this.state.dataSource}
- scroll={{ x: 1500, y: 0 }}
- rowSelection={false}
- pagination={this.state.pagination}
- onRowClick={this.tableRowClick.bind(this)}
- bordered
- size="small"
- />
- </Spin>
- </div>
- <OrderDesc
- data={this.state.RowData}
- showDesc={this.state.showDesc}
- closeDesc={this.closeDesc.bind(this)}
- />
- <Assign
- title="订单"
- selApi="/api/admin/financial/distributionFinance"
- data={this.state.assignData}
- fenpaiData={4}
- showDesc={this.state.assignVisible}
- closeDesc={this.closeAssign.bind(this)}
- roleName={"财务专员"}
- requestMethod={"post"}
- />
- <Modal
- visible={this.state.boHuiVisible}
- width="400px"
- title="驳回备注"
- footer=""
- onOk={this.boHuiOk}
- onCancel={this.boHuiCancel}
- >
- <Form layout="horizontal" onSubmit={this.boHuiSubmit}>
- <Spin spinning={this.state.loading}>
- <FormItem
- labelCol={{ span: 5 }}
- wrapperCol={{ span: 16 }}
- label={
- <span>
- <strong style={{ color: "#f00" }}>*</strong>驳回原因
- </span>
- }
- >
- <Input
- type="textarea"
- rows={4}
- placeholder="请输入驳回原因"
- value={this.state.content}
- onChange={e => {
- this.setState({ content: e.target.value });
- }}
- />
- </FormItem>
- <FormItem wrapperCol={{ span: 12, offset: 5 }}>
- <Button
- type="primary"
- htmlType="submit"
- style={{ marginRight: 20 }}
- >
- 驳回
- </Button>
- <Button
- type="default"
- onClick={() => {
- this.boHuiCancel();
- }}
- >
- 取消
- </Button>
- </FormItem>
- </Spin>
- </Form>
- </Modal>
- </div>
- );
- }
- });
- export default PaiDan;
|