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
{this.judgeFenpai(recard)}
; } } ], dataSource: [], searchTime: [,] }; }, /* 判断是否有分派按钮 */ judgeFenpai(recard) { if (recard.approval === 2) { if (recard.financeId === null || recard.financeId === "") { return ( ); } else { return undefined; } } else if (recard.processStatus <= 2) { return ( ); } 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 (
派单管理
{ this.setState({ orderNoSearch: e.target.value }); }} /> { this.setState({ contractNoSearch: e.target.value }); }} /> { this.setState({ nameSearch: e.target.value }); }} /> { this.setState({ departmenttList: e }); }} /> 下单时间 : { this.setState({ releaseDate: dataString }); }} />
*驳回原因 } > { this.setState({ content: e.target.value }); }} />
); } }); export default PaiDan;