import React, { Component } from "react"; import { Button, DatePicker, Input, message, Select, Spin, Table, Tabs, Cascader, AutoComplete, } from "antd"; import { ShowModal, getApprovedType } from "@/tools"; import { ChooseList } from "../../order/orderNew/chooseList"; import $ from "jquery/src/ajax"; import moment from "moment"; import { member, highTechColumns, doubleSoft, softWriting, patent, audit, currency, } from "./highTechConfig"; import { projectStatusList, approvalOptions } from "@/dataDic"; import ProjectDetails from "./projectDetails"; import Cascaders from "../../../common/cascaders"; const { TabPane } = Tabs; const { RangePicker } = DatePicker; const { Option } = Select; class HighTech extends Component { constructor(props) { super(props); this.state = { approvaType: [], tbaindex: 1, loading: false, changeList: undefined, columns: currency, status: 0, page: 1, pagination: { defaultCurrent: 1, defaultPageSize: 10, showQuickJumper: true, pageSize: 10, onChange: function (page) { this.loadData(page); }.bind(this), showTotal: function (total) { return "共" + total + "条数据"; }, }, dataSource: [], releaseDate: [], searchOrderNo: "", searchContractNo: "", searchEnterpriseName: "", declarationBatch: "", projectSituation: "", projectAmount: "", deps: "", thchDeps: "", projectType: "", projectStatus: "", departmentArr: [], contactsOption: [], contactsOptionData: [], visible: false, }; this.resetAll = this.resetAll.bind(this); this.changeList = this.changeList.bind(this); this.loadData = this.loadData.bind(this); this.selectSuperId = this.selectSuperId.bind(this); this.supervisor = this.supervisor.bind(this); this.httpChange = this.httpChange.bind(this); this.selectAuto = this.selectAuto.bind(this); this.blurChange = this.blurChange.bind(this); } changeList(arr) { const newArr = []; this.state.columns.forEach((item) => { arr.forEach((val) => { if (val === item.title) { newArr.push(item); } }); }); this.setState({ changeList: newArr, }); } loadData(pageNo = "") { this.setState({ loading: true, }); $.ajax({ method: "get", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/admin/statistis/selectTaskList", data: this.props.searchData ? Object.assign( { pageNo: pageNo || 1, pageSize: this.state.pagination.pageSize || 10, }, this.props.searchData ) : { pageNo: pageNo || 1, pageSize: this.state.pagination.pageSize || 10, startDate: this.state.releaseDate.length > 0 ? this.state.releaseDate[0] : undefined, //开始时间 endDate: this.state.releaseDate.length > 0 ? this.state.releaseDate[1] : undefined, //结束时间 deps: this.state.deps || undefined, //部门ID thchDeps: this.state.thchDeps || undefined, //责任部门ID projectStatus: this.state.projectStatus || undefined, //项目类别 projectType: !this.state.projectType ? undefined : this.state.projectType, //项目分类 orderNo: this.state.searchOrderNo || undefined, //订单编号 contractNo: this.state.searchContractNo || undefined, //合同编号 userName: this.state.searchEnterpriseName || undefined, //企业名称 declarationBatch: this.state.declarationBatch || undefined, //申报批次 projectSituation: typeof this.state.projectSituation === "number" ? this.state.projectSituation : undefined, //项目分类 projectAmount: this.state.projectAmount || undefined, //项目金额 status: this.state.status, thchId: this.state.thchId || undefined, //咨询师/咨询经理id taskProjectStatus: this.state.taskProjectStatus || undefined,//项目状态 sdStatus: this.state.sdStatus,//满意度 type: this.state.approvaType.length > 0 ? this.state.approvaType.toString() : undefined, //特批类型 }, success: function (data) { ShowModal(this); 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]; thisdata.key = (data.data.pageNo - 1) * data.data.pageSize + i + 1; theArr.push(thisdata); } 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({ pagination: this.state.pagination, page: pageNo, dataSource: theArr, }); } }.bind(this), }).always( function () { this.setState({ loading: false, }); }.bind(this) ); } resetAll() { this.setState( { newArray: [], releaseDate: [], searchOrderNo: "", searchContractNo: "", searchEnterpriseName: "", declarationBatch: "", projectSituation: "", projectAmount: "", projectType: "", deps: "", thchDeps: "", projectStatus: "", columns: currency, status: 0, thchId: "", auto: "", taskProjectStatus: "", sdStatus: undefined, approvaType: [], }, () => { this.Cascaders1.empty(); this.Cascaders2.empty(); this.defaultcolumns(); // this.loadData(); } ); } //项目类别 selectSuperId() { $.ajax({ method: "get", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/admin/ProjectSize/getAllCname", data: { flag: 0, }, success: function (data) { let theArr = []; let newTheArr = [] 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} ); let newChildren = [] for (let j = 0; j < theData.typeList.length; j++) { newChildren.push({ label: theData.typeList[j].name, value: theData.typeList[j].id, }) } newTheArr.push({ label: theData.cname, value: theData.id, children: newChildren }) } this.setState({ contactsOption: theArr, contactsOptionData: newTheArr, // contactsOptionData: data.data, }); }.bind(this), }).always(); } // 设置默认table(用来默认不显示某列数据 isNoD:true) defaultcolumns() { const newArr = []; this.state.columns.forEach((item) => { if (item.isNoD) { return } else { newArr.push(item); } }); this.setState({ changeList: newArr, }, () => { this.loadData(); }); } // 导出excel exportExec() { message.config({ duration: 20, }); let loading = message.loading("下载中..."); this.setState({ exportPendingLoading: true, }); let data = { startDate: this.state.releaseDate.length > 0 ? this.state.releaseDate[0] : undefined, //开始时间 endDate: this.state.releaseDate.length > 0 ? this.state.releaseDate[1] : undefined, //结束时间 deps: this.state.deps || undefined, //部门ID thchDeps: this.state.thchDeps || undefined, //责任部门ID projectStatus: this.state.projectStatus || undefined, //项目类别 projectType: !this.state.projectType ? undefined : this.state.projectType, //项目分类 status: this.state.status, orderNo: this.state.searchOrderNo || undefined, //订单编号 contractNo: this.state.searchContractNo || undefined, //合同编号 userName: this.state.searchEnterpriseName || undefined, //企业名称 declarationBatch: this.state.declarationBatch || undefined, //申报批次 projectAmount: this.state.projectAmount || undefined, //项目金额 thchId: this.state.thchId || undefined, //咨询师/咨询经理id taskProjectStatus: this.state.taskProjectStatus || undefined,//项目状态 sdStatus: this.state.sdStatus,//满意度 type: this.state.approvaType.length > 0 ? this.state.approvaType.toString() : undefined, //特批类型 }; $.ajax({ method: "get", dataType: "json", crossDomain: false, url: "/api/admin/statistis/exporTaskList", 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; } // 查询用户 supervisor(e) { $.ajax({ method: "get", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/admin/customer/listAdminByName", data: { adminName: e, }, success: function (data) { let thedata = data.data; if (!thedata) { if (data.error && data.error.length) { message.warning(data.error[0].message); } thedata = {}; } this.setState({ customerArr: thedata, }); }.bind(this), }).always( function () { }.bind(this) ); } // 输入触发 httpChange(e) { if (e.length >= 1) { this.supervisor(e); } this.setState({ auto: e, }); } // 选中 selectAuto(value, options) { let thchId = "" let contactLists = this.state.customerArr || []; if (value) { contactLists.map(function (item) { if (item.name == value.toString()) { thchId = item.id; } }); } this.setState({ auto: value, thchId: thchId, }); } // 失去焦点 blurChange(e) { let thchId = "" let contactLists = this.state.customerArr || []; if (e) { contactLists.map(function (item) { if (item.name == e.toString()) { thchId = item.id; } }); } this.setState({ thchId: thchId, }); } componentWillMount() { // if (!this.props.introduce) { this.defaultcolumns(); this.selectSuperId(); } if (this.props.searchData) { let e = this.props.searchData.projectType; this.setState({ columns: e == "0" ? currency : e == "1" ? patent : e == "2" ? softWriting : e == "3" ? audit : e == "4" ? doubleSoft : e == "5" ? highTechColumns : e == "6" ? currency : e == "7" ? member : currency, }, () => { this.defaultcolumns(); }); } } // 暂停项目 颜色 suspendColor(record) { if (record.projectStatus == 29) { return 'light' } else { return 'dark' } } render() { const dataSources = this.state.customerArr || []; const options = dataSources.map((group) => ( {group.name} )); const approvaChildren = approvalOptions.map(i => ( )); return (
{this.props.introduce ? ( this.props.introduce() ) : (
项目汇总表 ( {this.state.status === 1 ? "高新" : this.state.status === 2 ? "双软" : this.state.status === 3 ? "软著" : this.state.status === 4 ? "专利" : this.state.status === 5 ? "会员" : this.state.status === 6 ? "审计" : "通用"} )
{ this.setState({ tbaindex: e }) }} >
{ this.setState({ searchOrderNo: e.target.value }); }} /> { this.setState({ searchContractNo: e.target.value }); }} /> { this.setState({ searchEnterpriseName: e.target.value }); }} /> 项目分类: { let first = e[0]; let two = e[1]; this.setState({ newArray: e, projectStatus: first, projectType: two, changeList: undefined, dataSource: [], status: two == "4" ? 2 : two == "3" ? 6 : two == "2" ? 3 : two == "1" ? 4 : two == "5" ? 1 : two == "7" ? 5 : 0, columns: two == "0" ? currency : two == "1" ? patent : two == "2" ? softWriting : two == "3" ? audit : two == "4" ? doubleSoft : two == "5" ? highTechColumns : two == "6" ? currency : two == "7" ? member : currency, }, () => { this.defaultcolumns() }) }} /> {/* 项目类别 : 项目分类 : */} 订单部门: this.Cascaders1 = ref} placeholder="请选择订单部门" height={28} width={150} onSel={(e) => { this.setState({ deps: JSON.stringify(e) }) }} /> 负责部门: this.Cascaders2 = ref} placeholder="请选择负责部门" height={28} width={150} onSel={(e) => { this.setState({ thchDeps: JSON.stringify(e) }) }} /> 咨询师/经理: 申报批次: 项目金额: 项目状态: {/* */} {/* 项目情况 :*/} {/* {*/} {/* this.setState({*/} {/* projectSituation: e,*/} {/* });*/} {/* }}*/} {/* >*/} {/* */} {/* */} {/* */} {/* */} {/* */} {/* */} {/* */} {/* */} {/**/} 满  意  度: 派单时间: { this.setState({ releaseDate: dataString }); }} />
{ this.state.tbaindex == 2 &&
}
{adminData.isSuperAdmin ? : ""}
)}
{ this.setState({ projectdetailsId: record.id, projectdetailsOrderNo: record.orderNo, pname: record.pname, visible: true, }); }} /> {this.state.visible ? ( { this.setState({ visible: false, }); }} visitCancel={() => { this.loadData(this.state.page); this.setState({ visible: false, }); }} /> ) : null} ); } } export default HighTech;