123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431 |
- import React from 'react';
- import {
- DatePicker,
- Tooltip,
- Button,
- AutoComplete,
- Input,
- Select,
- Spin,
- Table,
- message,
- Form,
- Tabs,
- Switch
- } from 'antd';
- import $ from 'jquery/src/ajax';
- import moment from 'moment';
- import { ShowModal, getApprovedType } from "@/tools.js";
- import { } from "@/dataDic";
- import ShowModalDiv from "@/showModal.jsx";
- import { ChooseList } from "../../order/orderNew/chooseList";
- import './index.less';
- const TabPane = Tabs.TabPane;
- const { RangePicker, } = DatePicker;
- const Unlimited = Form.create()(React.createClass({
- getInitialState() {
- return {
- searchValues: {},
- loading: false,
- exportPendingLoading: false,
- changeList: undefined,
- dataSource: [],
- 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",
- width: 110,
- render: (text, record) => {
- return (
- <span>
- {getApprovedType(text ? text.split(",").map(Number) : [], record.typeExplain)}
- </span>
- );
- },
- },
- {
- title: "合同编号",
- dataIndex: "contractNo",
- key: "contractNo",
- },
- {
- title: '客户名称',
- dataIndex: 'userName',
- key: 'userName',
- render: (text, record) => {
- return (
- <Tooltip title={text}>
- <div style={{ maxWidth: 200 }}>{text}</div>
- </Tooltip>
- );
- }
- },
- {
- title: "订单部门",
- dataIndex: "depName",
- key: "depName",
- width: 100,
- },
- {
- title: "订单负责人",
- dataIndex: "salesmanName",
- key: "salesmanName"
- },
- {
- title: "签单日期",
- dataIndex: "time",
- key: "time",
- },
- {
- title: "下单时间",
- dataIndex: "createDate",
- key: "createTime",
- width: 80,
- render: (text) => {
- return <div style={{ textAlign: "center" }}>{text}</div>
- },
- },
- {
- title: "签单金额(万元)",
- dataIndex: "totalAmount",
- key: "totalAmount",
- render: (text) => {
- return <div style={{ textAlign: "center" }}>{text}</div>
- },
- },
- {
- title: "开票金额(万元)",
- dataIndex: "invoiceAmount",
- key: "invoiceAmount",
- render: (text) => {
- return <div style={{ textAlign: "center" }}>{text}</div>
- },
- },
- {
- title: "已收款(万元)",
- dataIndex: "settlementAmount",
- key: "settlementAmount",
- render: (text) => {
- return <div style={{ textAlign: "center" }}>{text}</div>
- },
- },
- {
- title: "应收款(万元)",
- dataIndex: "orderReceivables",
- key: "orderReceivables",
- render: (text) => {
- return <div style={{ textAlign: "center" }}>{text}</div>
- },
- },
- {
- title: "欠款(万元)",
- dataIndex: "orderArrears",
- key: "orderArrears",
- render: (text) => {
- return <div style={{ textAlign: "center" }}>{text}</div>
- },
- },
- {
- title: "总成本/实付",
- dataIndex: "costAmount",
- key: "costAmount",
- render: (text) => {
- return <div style={{ textAlign: "center" }}>{text}</div>
- },
- },
- {
- title: "公出时长(时)",
- dataIndex: "duration",
- key: "duration",
- },
- ],
- dataSource: [],
- departmentArr: [],
- };
- },
- componentWillMount() {
- // this.departmentList();
- // this.selectSuperId();
- 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/statistis/orderProject",
- 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,
- });
- } 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)
- );
- },
- // 部门
- 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);
- }
- thedata = {};
- } 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)
- );
- },
- // 项目类别
- selectSuperId() {
- $.ajax({
- method: "get",
- dataType: "json",
- crossDomain: false,
- url: globalConfig.context + "/api/admin/ProjectSize/getAllCname",
- data: {
- flag: 0
- },
- success: function (data) {
- let theArr = [];
- let thedata = data.data;
- if (!thedata) {
- if (data.error && data.error.length) {
- message.warning(data.error[0].message);
- }
- }
- for (let i = 0; i < data.data.length; i++) {
- let theData = data.data[i];
- theArr.push(
- <Select.Option value={theData.id} key={theData.cname}>
- {theData.cname}
- </Select.Option>
- );
- }
- this.setState({
- contactsOption: theArr,
- contactsOptionData: data.data,
- });
- }.bind(this)
- }).always(
- );
- },
- changeList(arr) {
- const newArr = [];
- let list = this.state.columns
- list.forEach((item) => {
- arr.forEach((val) => {
- if (val === item.title) {
- newArr.push(item);
- }
- });
- });
- this.setState({
- changeList: newArr,
- });
- },
- search() {
- this.loadData();
- },
- reset() {
- this.setState({
- searchValues: JSON.parse(JSON.stringify({})),
- }, () => {
- this.loadData();
- })
- },
- render() {
- const { searchValues } = this.state
- let departmentArr = this.state.departmentArr || [];
- return (
- <div className="user-content">
- <ShowModalDiv ShowModal={this.state.showModal} onClose={() => { this.setState({ showModal: false }) }} />
- <div className="content-title" style={{ marginBottom: 10 }}>
- <span style={{ fontWeight: 900, fontSize: 16 }}>无限制公出管理</span>
- </div>
- <div className="user-search">
- <Tabs
- defaultActiveKey="1"
- className="test">
- <TabPane tab="搜索" key="1">
- <div
- className="user-search"
- style={{
- marginTop: "10px",
- marginLeft: "10px",
- marginRight: "10px",
- }}
- >
- <Input
- placeholder="合同编号"
- style={{
- width: 220,
- marginRight: "10px",
- }}
- value={searchValues["contractNo"]
- ? searchValues["contractNo"]
- : ""}
- onChange={(e) => {
- searchValues["contractNo"] = e.target.value;
- this.setState({
- searchValues: searchValues,
- });
- }}
- />
- <Input
- placeholder="客户名称"
- style={{
- width: 220,
- marginRight: "10px",
- }}
- value={searchValues["userName"]
- ? searchValues["userName"]
- : ""}
- onChange={(e) => {
- searchValues["userName"] = e.target.value;
- this.setState({
- searchValues: searchValues,
- });
- }}
- />
- <Input
- placeholder="项目名称"
- value={searchValues["projectName"]
- ? searchValues["projectName"]
- : ""}
- style={{ width: 220, marginRight: 10 }}
- onChange={e => {
- searchValues["projectName"] = e.target.value
- this.setState({
- searchValues: searchValues,
- });
- }}
- />
- <Button type="primary" onClick={this.search} style={{ marginRight: 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>
- <div className="patent-table">
- <Spin spinning={this.state.loading}>
- <Table
- columns={this.state.changeList
- ? this.state.changeList
- : this.state.columns}
- dataSource={this.state.dataSource}
- pagination={this.state.pagination}
- bordered
- />
- </Spin>
- </div>
- </div >
- );
- }
- }));
- export default Unlimited;
|