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, getApprovedState, getWhether, getLiquidationStatus } from "@/tools.js"; import { projectStatusList, salesList } from "@/dataDic"; import { citySelect } from "../../../NewDicProvinceList"; import ShowModalDiv from "@/showModal.jsx"; import { ChooseList } from "../../order/orderNew/chooseList"; import StaffSearch from '../../../../component/common/staffSearch'; import Cascaders from "../../../common/cascaders"; import './index.less'; const TabPane = Tabs.TabPane; const { RangePicker, MonthPicker } = DatePicker; const ProjecDataStatistics = 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: "salesType", key: "salesType", render: (text, record) => { const obj = { children: {salesList[text]} , props: { rowSpan: record.rowSpan || 0 } } return obj }, }, { title: "订单类型", dataIndex: "serviceType", key: "serviceType", render: (text, record) => { const obj = { children:
{text}
, props: { rowSpan: record.rowSpan || 0 } } return obj } }, { title: "结算状态", dataIndex: "liquidationStatus", key: "liquidationStatus", render: (text, record) => { const obj = { children: getLiquidationStatus(text), props: { rowSpan: record.rowSpan || 0 } } return obj } }, { title: "催款节点", dataIndex: "dunNodeContent", key: "dunNodeContent", render: (text, record) => { const obj = { children:
{text}
, props: { rowSpan: record.rowSpan || 0 } } return obj } }, { title: '是否会员', dataIndex: 'projectType', key: 'projectType', render: (text, record) => { const obj = { children: getWhether(text), props: { rowSpan: record.rowSpan || 0 } } return obj } }, { title: '是否大客户', dataIndex: 'bigCustomer', key: 'bigCustomer', render: (text, record) => { const obj = { children: getWhether(text), props: { rowSpan: record.rowSpan || 0 } } return obj } }, { title: "是否特批", dataIndex: "approval", key: "approval", render: (text, record) => { const obj = { children: getApprovedState(text), props: { rowSpan: record.rowSpan || 0 } } return obj } }, { title: '签单时间', dataIndex: 'signTime', key: 'signTime', render: (text, record) => { const obj = { children: text, props: { rowSpan: record.rowSpan || 0 } } return obj } }, { title: "派单时间", dataIndex: "createTime", key: "createTime", render: (text, record) => { const obj = { children: text, props: { rowSpan: record.rowSpan || 0 } } return obj } }, { title: '公司名称', dataIndex: 'buyerName', key: 'buyerName', render: (text, record) => { const obj = { children:
{text}
, props: { rowSpan: record.rowSpan || 0 } } return obj } }, { title: "合同编号", dataIndex: "contractNo", key: "contractNo", render: (text, record) => { const obj = { children: text, props: { rowSpan: record.rowSpan || 0 } } return obj } }, { title: '合同类型', dataIndex: 'htlx', key: 'htlx', render: (text, record) => { const obj = { children: text, props: { rowSpan: record.rowSpan || 0 } } return obj } }, { title: '省份', dataIndex: 'province', key: 'province', render: (text, record) => { const obj = { children: text, props: { rowSpan: record.rowSpan || 0 } } return obj } }, { title: "派单公司", dataIndex: "depName", key: "depName", render: (text, record) => { const obj = { children: text, props: { rowSpan: record.rowSpan || 0 } } return obj } }, { title: '签单金额', dataIndex: 'totalAmount', key: 'totalAmount', render: (text, record) => { const obj = { children: text, props: { rowSpan: record.rowSpan || 0 } } return obj } }, { title: '合同收款比例', dataIndex: 'contractAmountProportion', key: 'contractAmountProportion', render: (text, record) => { const obj = { children: text, props: { rowSpan: record.rowSpan || 0 } } return obj } }, { title: '应收款', dataIndex: 'orderReceivables', key: 'orderReceivables', render: (text, record) => { const obj = { children: text, props: { rowSpan: record.rowSpan || 0 } } return obj } }, { title: '已收款', dataIndex: 'settlementAmount', key: 'settlementAmount', render: (text, record) => { const obj = { children: text, props: { rowSpan: record.rowSpan || 0 } } return obj } }, { title: "欠款", dataIndex: "arrearsAmount", key: "arrearsAmount", render: (text, record) => { const obj = { children: text, props: { rowSpan: record.rowSpan || 0 } } return obj } }, { title: "已报销", dataIndex: "expenseAmount", key: "expenseAmount", render: (text, record) => { const obj = { children: text, props: { rowSpan: record.rowSpan || 0 } } return obj } }, { title: "应公出/已公出/超出", dataIndex: "shouldPublic", key: "shouldPublic", render: (text, record) => { const obj = { children: {text + " / " + record.alreadyPublic + " / " + record.exceedPublic} , props: { rowSpan: record.rowSpan || 0 } } return obj } }, { title: "总成本/实付", dataIndex: "costAmount", key: "costAmount", render: (text, record) => { const obj = { children: {text + " / " + record.paymentAmount} , props: { rowSpan: record.rowSpan || 0 } } return obj } }, { title: "已开票金额", dataIndex: "invicueAmount", key: "invicueAmount", render: (text, record) => { const obj = { children: text, props: { rowSpan: record.rowSpan || 0 } } return obj } }, { title: "退款金额", dataIndex: "refundAmount", key: "refundAmount", render: (text, record) => { const obj = { children: text, props: { rowSpan: record.rowSpan || 0 } } return obj } }, { title: "财务负责人", dataIndex: "financeName", key: "financeName", render: (text, record) => { const obj = { children: text, props: { rowSpan: record.rowSpan || 0 } } return obj } }, { title: "营销负责人", dataIndex: "salesmanName", key: "salesmanName", render: (text, record) => { const obj = { children: text, props: { rowSpan: record.rowSpan || 0 } } return obj } }, { title: "项目名称", dataIndex: "commodityName", key: "commodityName", render: (text, record) => { return (
{text} {!!record.serviceLife && {"-" + record.serviceLife}} {!!record.yearSum && {",共" + record.yearSum + "年"}} {!!record.serviceYear && {",本次" + record.serviceYear}}
) } }, { title: "项目转入时间", dataIndex: "taskDistributionTime", key: "taskDistributionTime", }, { title: "是否重报", dataIndex: "restatementType", key: "restatementType", }, { title: "是否科技项目", dataIndex: "sortType", key: "sortType", }, { title: "项目数", dataIndex: "commodityQuantity", key: "commodityQuantity", }, { title: "项目成本", dataIndex: "projectCostAmount", key: "projectCostAmount", }, { title: "项目状态", dataIndex: "projectStatus", key: "projectStatus", }, { title: "项目启动时间", dataIndex: "taskStartTime", key: "taskStartTime", }, { title: "项目完成时间", dataIndex: "taskEndTime", key: "taskEndTime", }, // { // title: "技术组", // dataIndex: "expenseAmount", // key: "expenseAmount", // }, { title: "项目负责人", dataIndex: "receiverName", key: "receiverName", }, { title: "满意度", dataIndex: "satisfactionDegree", key: "satisfactionDegree", render: text => { return ( {["非常满意", "满意", "一般", "不满意"][text]} ) } }, { title: "项目备注", dataIndex: "taskComment", key: "taskComment", render: text => { return (
{text}
) } }, { title: "核算比例", dataIndex: "hsbl", key: "hsbl", render: (text, record) => { const obj = { children: text, props: { rowSpan: record.rowSpan || 0 } } return obj } }, { title: "订单情况", dataIndex: "orderStatus", key: "orderStatus", render: (text, record) => { const obj = { children: text, props: { rowSpan: record.rowSpan || 0 } } return obj } }, { title: "变更情况", dataIndex: "changeType", key: "changeType", render: (text, record) => { const obj = { children: text, props: { rowSpan: record.rowSpan || 0 } } return obj } }, { title: "退单退款", dataIndex: "refundType", key: "refundType", render: (text, record) => { const obj = { children: text, props: { rowSpan: record.rowSpan || 0 } } return obj } }, ], dataSource: [], departmentArr: [], searchMore: false, }; }, 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; } let dList = this.handleData(data.data.list, "contractNo") this.setState({ dataSource: dList, 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( {theData.cname} ); } 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, }); }, exportAll() { message.config({ duration: 20, }); let loading = message.loading("下载中..."); this.setState({ exportPendingLoading: true, }); let data = JSON.parse(JSON.stringify(this.state.searchValues)); $.ajax({ method: "get", dataType: "json", crossDomain: false, url: "/api/admin/statistis/orderProject/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({ exportPendingLoading: false, }); }.bind(this) ); }, download(fileName) { window.location.href = globalConfig.context + "/open/download?fileName=" + fileName; }, handleData(array, key) { if (array.length === 0) return let arr = [...array] let startItem = arr[0] startItem.rowSpan = 1 arr.forEach((item, index) => { let nextItem = arr[index + 1] || {} if (item[key] === nextItem[key]) { startItem.rowSpan++ } else { startItem = nextItem startItem.rowSpan = 1 } }) return arr }, search() { this.loadData(); }, reset() { this.setState({ financeName: "", salesmanName: "", techName: "", searchValues: JSON.parse(JSON.stringify({})), }, () => { // this.Cascaders1.empty(); // this.Cascaders2.empty(); this.StaffSearch1.httpChange(""); this.StaffSearch2.httpChange(""); this.StaffSearch3.httpChange(""); this.loadData(); }) }, render() { const { searchValues } = this.state let departmentArr = this.state.departmentArr || []; const getRowClassName = (record, index) => { // 根据某些条件返回不同的类名 if (index % 10 + 1 === 1) { return 'even-row1'; } else if (index % 10 + 1 === 2) { return 'even-row2'; } else if (index % 10 + 1 === 3) { return 'even-row3'; } else if (index % 10 + 1 === 4) { return 'even-row4'; } else if (index % 10 + 1 === 5) { return 'even-row5'; } else if (index % 10 + 1 === 6) { return 'even-row6'; } else if (index % 10 + 1 === 7) { return 'even-row7'; } else if (index % 10 + 1 === 8) { return 'even-row8'; } else if (index % 10 + 1 === 9) { return 'even-row9'; } else if (index % 10 + 1 === 10) { return 'even-row10'; } }; return (
{ this.setState({ showModal: false }) }} />
项目数据统计
{ searchValues["orderNo"] = e.target.value; this.setState({ searchValues: searchValues, }); }} /> { searchValues["contractNo"] = e.target.value; this.setState({ searchValues: searchValues, }); }} /> { searchValues["userName"] = e.target.value; this.setState({ searchValues: searchValues, }); }} /> { searchValues["projectName"] = e.target.value this.setState({ searchValues: searchValues, }); }} /> 订单部门: {/* this.Cascaders1 = ref} placeholder="请选择订单部门" height={28} width={170} onSel={(e) => { searchValues["deps"] = JSON.stringify(e) this.setState({ searchValues: searchValues, }); }} /> */} 负责部门: {/* this.Cascaders2 = ref} placeholder="请选择负责部门" height={28} width={170} onSel={(e) => { searchValues["thchDeps"] = JSON.stringify(e) this.setState({ searchValues: searchValues, }); }} /> */} 申报批次: 项目金额: 项目状态: 满  意  度: 派单时间: { searchValues["startDate"] = String( dataString[0] ); searchValues["endDate"] = String( dataString[1] ); this.setState({ searchValues: searchValues, }); }} /> 项目转入时间: { searchValues["projectStartDate"] = String( dataString[0] ); searchValues["projectEndDate"] = String( dataString[1] ); this.setState({ searchValues: searchValues, }); }} /> 销售类型: 订单类型: { searchValues["serviceType"] = e.target.value; this.setState({ searchValues: searchValues, }); }} /> 结算状态: 催款节点: 签单时间: { searchValues["signStartDate"] = String( dataString[0] ); searchValues["signEndDate"] = String( dataString[1] ); this.setState({ searchValues: searchValues, }); }} /> 项目完成时间: { searchValues["projectCompleteStartTime"] = String( dataString[0] ); searchValues["projectCompleteEndTime"] = String( dataString[1] ); this.setState({ searchValues: searchValues, }); }} /> 是否特批: 是否会员: 是否重报: 是否变更: 是否退单: 是否大客户: 是否科技项目: 省份选择: 财务负责人: this.StaffSearch1 = ref} valueName={this.state.financeName} placeholder="财务负责人" width="150px" onBlurText={e => { this.setState({ financeName: e.title }) }} onBlurChange={(obj) => { searchValues["financeId"] = obj.value this.setState({ searchValues: searchValues, }); }} /> 营销负责人: this.StaffSearch2 = ref} valueName={this.state.salesmanName} placeholder="营销负责人" width="150px" onBlurText={e => { this.setState({ salesmanName: e.title }) }} onBlurChange={(obj) => { searchValues["salesmanId"] = obj.value this.setState({ searchValues: searchValues, }); }} /> 技术负责人: this.StaffSearch3 = ref} valueName={this.state.techName} placeholder="技术负责人" width="150px" onBlurText={e => { this.setState({ techName: e.title }) }} onBlurChange={(obj) => { searchValues["techId"] = obj.value this.setState({ searchValues: searchValues, }); }} /> 更多搜索 { this.setState({ searchMore: !this.state.searchMore }) }} />
{adminData.isSuperAdmin ? : ""}
); } })); export default ProjecDataStatistics;