123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728 |
- import React, { Component } from 'react';
- import { Button, DatePicker, AutoComplete, Input, message, Select, Spin, Table, Tabs } from "antd";
- import { ChooseList } from "../../order/orderNew/chooseList";
- import $ from "jquery/src/ajax";
- import {
- ShowModal,
- getProjectName,
- download,
- } from "@/tools";
- import moment from "moment";
- import ProjectDetails from "../summary/projectDetails";
- const { TabPane } = Tabs;
- const { RangePicker } = DatePicker;
- const { Option } = Select;
- class EnterpriseProjectQuery extends Component {
- constructor(props) {
- super(props);
- this.state = {
- visible: false,
- dataSource: [],
- departmentArr: [],
- page: 1,
- 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: "id",
- key: "id",
- },
- {
- title: "派单时间",
- dataIndex: "taskDistributionTime",
- key: "taskDistributionTime",
- },
- {
- title: "派单省份",
- dataIndex: "provinceName",
- key: "provinceName",
- },
- {
- title: '订单部门',
- dataIndex: 'depName',
- key: 'depName',
- },
- {
- title: "营销员",
- dataIndex: "salesmanName",
- key: "salesmanName",
- },
- {
- title: "合同编号",
- dataIndex: "contractNo",
- key: "contractNo",
- },
- {
- title: "订单编号",
- dataIndex: "orderNo",
- key: "orderNo",
- },
- {
- title: "签单客户",
- dataIndex: "userName",
- key: "userName",
- },
- {
- title: "项目类型",
- dataIndex: "cname",
- key: "cname",
- },
- {
- title: "项目名称",
- dataIndex: "commodityName",
- key: "commodityName",
- },
- {
- title: "数量",
- dataIndex: "commodityQuantity",
- key: "commodityQuantity",
- },
- {
- title: "负责部门",
- dataIndex: "techDepName",
- key: "techDepName",
- },
- {
- title: "咨询师/咨询经理",
- dataIndex: "techName",
- key: "techName",
- },
- {
- title: "项目状态",
- dataIndex: "projectStatus",
- key: "projectStatus",
- render: (value) => (
- getProjectName(parseInt(value))
- )
- },
- {
- title: "项目金额",
- dataIndex: "commodityPrice",
- key: "commodityPrice",
- },
- {
- title: "特别说明",
- dataIndex: "specialComment",
- key: "specialComment",
- },
- ],
- releaseDate: [],
- searchOrderNo: '',
- searchContractNo: '',
- searchEnterpriseName: '',
- declarationBatch: '',
- projectSituation: '',
- projectAmount: '',
- depId: '',
- thchDepId: '',
- projectType: '',
- projectStatus: '',
- contactsOption: [],
- contactsOptionData: [],
- }
- this.changeList = this.changeList.bind(this);
- this.resetAll = this.resetAll.bind(this);
- this.exportPending = this.exportPending.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/orderProject/managerSelect",
- data: {
- pageNo: pageNo || 1,
- pageSize: this.state.pagination.pageSize || 10,
- startTime: this.state.releaseDate.length > 0 ? this.state.releaseDate[0] : undefined, //开始时间
- endTime: this.state.releaseDate.length > 0 ? this.state.releaseDate[1] : undefined, //结束时间
- depId: this.state.depId || undefined,//部门ID
- techDepId: this.state.thchDepId || undefined,//责任部门ID
- cid: this.state.projectStatus || undefined,//项目类别
- projectType: typeof this.state.projectType === 'number' ? this.state.projectType : undefined,//项目分类
- orderNo: this.state.searchOrderNo || undefined,//订单编号
- contractNo: this.state.searchContractNo || undefined,//合同编号
- name: this.state.searchEnterpriseName || undefined,//企业名称
- declarationBatch: this.state.declarationBatch || undefined,//申报批次
- // projectSituation: typeof this.state.projectSituation === 'number' ? this.state.projectSituation : undefined,//项目分类
- commodityPrice: this.state.projectAmount || undefined,//项目金额
- thchId: this.state.thchId || undefined, //咨询师/咨询经理id
- },
- 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];
- 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({
- dataSource: theArr,
- page: data.data.pageNo,
- pagination: this.state.pagination,
- });
- }
- }.bind(this),
- }).always(
- function () {
- this.setState({
- loading: false,
- });
- }.bind(this)
- );
- }
- //部门
- departmentList() {
- this.setState({
- departmentListloading: 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({
- departmentListloading: false,
- });
- }.bind(this)
- );
- }
- resetAll() {
- this.setState({
- releaseDate: [],
- searchOrderNo: '',
- searchContractNo: '',
- searchEnterpriseName: '',
- declarationBatch: '',
- projectSituation: '',
- projectAmount: '',
- projectType: '',
- depId: '',
- thchDepId: '',
- projectStatus: '',
- thchId: "",
- auto: ""
- }, () => {
- 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 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(
- );
- }
- exportPending() {
- $.ajax({
- method: "get",
- dataType: "json",
- crossDomain: false,
- url: globalConfig.context + "/api/admin/orderProject/exportManagerSelect",
- data: {
- pageNo: 1,
- pageSize: 99999,
- startTime: this.state.releaseDate.length > 0 ? this.state.releaseDate[0] : undefined, //开始时间
- endTime: this.state.releaseDate.length > 0 ? this.state.releaseDate[1] : undefined, //结束时间
- depId: this.state.depId || undefined,//部门ID
- techDepId: this.state.thchDepId || undefined,//责任部门ID
- cid: this.state.projectStatus || undefined,//项目类别
- projectType: typeof this.state.projectType === 'number' ? this.state.projectType : undefined,//项目分类
- orderNo: this.state.searchOrderNo || undefined,//订单编号
- contractNo: this.state.searchContractNo || undefined,//合同编号
- name: this.state.searchEnterpriseName || undefined,//企业名称
- declarationBatch: this.state.declarationBatch || undefined,//申报批次
- commodityPrice: this.state.projectAmount || undefined,//项目金额
- thchId: this.state.thchId || undefined, //咨询师/咨询经理id
- },
- success: function (data) {
- ShowModal(this);
- if (data.error && data.error.length) {
- message.warning(data.error[0].message);
- } else {
- download(data.data, true);
- }
- }.bind(this),
- }).always(
- function () {
- this.setState({
- loading: false,
- });
- }.bind(this)
- );
- }
- // 查询用户
- 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,
- });
- }
- componentDidMount() {
- this.departmentList();
- this.selectSuperId();
- this.loadData();
- }
- // 暂停项目 颜色
- suspendColor(record) {
- if (record.projectStatus == 29) {
- return 'light'
- } else {
- return 'dark'
- }
- }
- render() {
- const dataSources = this.state.customerArr || [];
- const options = dataSources.map((group) => (
- <Select.Option key={group.id} value={group.name}>
- {group.name}
- </Select.Option>
- ));
- return (
- <div className="user-content">
- <div className="content-title">
- <span style={{ fontWeight: 900, fontSize: 16 }}>企业项目派单查询</span>
- </div>
- <Tabs defaultActiveKey="1" onChange={this.callback} className="test">
- <TabPane tab="搜索" key="1">
- <div className="user-search" style={{
- marginTop: '10px',
- marginLeft: '10px',
- marginRight: '10px'
- }}>
- <Input
- placeholder="订单编号"
- style={{ width: 200, marginRight: '10px', marginBottom: '10px' }}
- value={this.state.searchOrderNo}
- onChange={e => {
- this.setState({ searchOrderNo: e.target.value });
- }}
- />
- <Input
- placeholder="合同编号"
- style={{ width: 200, marginRight: '10px', marginBottom: '10px' }}
- value={this.state.searchContractNo}
- onChange={e => {
- this.setState({ searchContractNo: e.target.value });
- }}
- />
- <Input
- placeholder="企业名称"
- style={{ width: 200, marginRight: '10px', marginBottom: '10px' }}
- value={this.state.searchEnterpriseName}
- onChange={e => {
- this.setState({ searchEnterpriseName: e.target.value });
- }}
- />
- <span style={{ display: "inline-block", marginRight: '10px', marginBottom: '10px' }}>
- <Spin spinning={this.state.departmentListloading}>
- <span>订单部门:</span>
- <Select
- placeholder="请选择部门"
- style={{ width: 200, marginRight: '10px', marginLeft: '10px', marginBottom: '10px' }}
- value={this.state.depId || undefined}
- onChange={e => {
- this.setState({ depId: e });
- }}
- >
- {
- this.state.departmentArr.map(function (item) {
- return <Select.Option key={item.id} value={item.id}>{item.name}</Select.Option>
- })
- }
- </Select>
- </Spin>
- </span>
- <span style={{ display: "inline-block", marginRight: '10px', marginBottom: '10px' }}>
- <span>负责部门:</span>
- <Select
- placeholder="请选择部门"
- style={{ width: 200, marginRight: '10px', marginLeft: '10px', marginBottom: '10px' }}
- value={this.state.thchDepId || undefined}
- onChange={e => {
- this.setState({ thchDepId: e });
- }}
- >
- {
- this.state.departmentArr.map(function (item) {
- return <Select.Option key={item.id} value={item.id}>{item.name}</Select.Option>
- })
- }
- </Select>
- </span>
- <span style={{ display: "inline-block", marginRight: '10px', marginBottom: '10px' }}>
- <span>咨询师/经理:</span>
- <AutoComplete
- className="certain-category-search"
- dropdownClassName="certain-category-search-dropdown"
- dropdownMatchSelectWidth={false}
- style={{ width: "200px", marginLeft: '10px' }}
- dataSource={options}
- placeholder='请输入姓名'
- value={this.state.auto}
- onChange={this.httpChange}
- filterOption={true}
- onBlur={this.blurChange}
- onSelect={this.selectAuto}
- >
- <Input />
- </AutoComplete>
- </span>
- <span style={{ display: "inline-block" }}>
- <span style={{ marginRight: '10px', marginBottom: '10px' }}>项目类别 :</span>
- <Select
- value={this.state.projectStatus || undefined}
- placeholder="请选择项目类别"
- notFoundContent="未获取到上级品类列表"
- style={{ width: 150, marginRight: '10px', marginBottom: '10px' }}
- onChange={(e) => {
- let infor = this.state.contactsOptionData.filter((v) => v.id === e);
- this.setState({
- projectStatus: e,
- })
- }}
- >
- {this.state.contactsOption}
- </Select>
- </span>
- <span style={{ display: "inline-block" }}>
- <span style={{ marginRight: '10px', marginBottom: '10px' }}>项目分类 :</span>
- <Select
- value={typeof this.state.projectType === 'number' ? this.state.projectType : undefined}
- placeholder="请选择项目分类"
- style={{ width: 150, marginRight: '10px', marginBottom: '10px' }}
- onChange={(e) => {
- this.setState({
- projectType: e,
- })
- }}
- >
- {/*0通用 1专利 2软著 3审计 4双软 5高新*/}
- <Option value={0}>通用</Option>
- <Option value={1}>专利</Option>
- <Option value={2}>软著</Option>
- <Option value={3}>审计</Option>
- <Option value={4}>双软</Option>
- <Option value={5}>高新</Option>
- <Option value={6}>商标</Option>
- <Option value={7}>会员</Option>
- </Select>
- </span>
- <span style={{ display: "inline-block" }}>
- <span style={{ marginRight: '10px', marginBottom: '10px' }}>申报批次 :</span>
- <Select
- value={this.state.declarationBatch || undefined}
- placeholder="请选择批次"
- style={{ width: 150, marginRight: '10px', marginBottom: '10px' }}
- onChange={(e) => {
- this.setState({
- declarationBatch: e,
- });
- }}
- >
- <Option value={1}>第一批</Option>
- <Option value={2}>第二批</Option>
- <Option value={3}>第三批</Option>
- <Option value={4}>第四批</Option>
- </Select>
- </span>
- <span style={{ display: "inline-block" }}>
- <span style={{ marginRight: '10px', marginBottom: '10px' }}>项目金额 :</span>
- <Select
- value={this.state.projectAmount || undefined}
- placeholder="请选择项目金额"
- style={{ width: 150, marginRight: '10px', marginBottom: '10px' }}
- onChange={(e) => {
- this.setState({
- projectAmount: e,
- });
- }}
- >
- <Option value={1}>0~0.5万</Option>
- <Option value={2}>0.5~1万</Option>
- <Option value={3}>1~2万</Option>
- <Option value={4}>2~5万</Option>
- <Option value={5}>5~10万</Option>
- <Option value={6}>10~30万</Option>
- <Option value={7}>30~50万</Option>
- <Option value={8}>50~80万</Option>
- <Option value={9}>80万上</Option>
- </Select>
- </span>
- {/*<span style={{display:"inline-block"}}>*/}
- {/* <span style={{marginRight:'10px',marginBottom:'10px'}}>项目情况 :</span>*/}
- {/* <Select*/}
- {/* value={typeof this.state.projectSituation === 'number' ? this.state.projectSituation : undefined}*/}
- {/* placeholder="请选择项目情况"*/}
- {/* style={{ width: 200,marginRight:'10px',marginBottom:'10px' }}*/}
- {/* onChange={(e) => {*/}
- {/* this.setState({*/}
- {/* projectSituation: e,*/}
- {/* });*/}
- {/* }}*/}
- {/* >*/}
- {/* <Option value={0}>未开始</Option>*/}
- {/* <Option value={1}>进行中</Option>*/}
- {/* <Option value={2}>已暂停</Option>*/}
- {/* <Option value={3}>已驳回(专利、软著项目编写)</Option>*/}
- {/* <Option value={4}>已完成</Option>*/}
- {/* <Option value={5}>项目已完成 已退单</Option>*/}
- {/* <Option value={6}>项目未完成 已退单</Option>*/}
- {/* </Select>*/}
- {/*</span>*/}
- <span style={{ display: "inline-block" }}>
- <span style={{ marginRight: '10px', marginBottom: '10px' }}>派单时间 :</span>
- <RangePicker
- style={{ marginRight: '10px', marginBottom: '10px' }}
- 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 });
- }}
- />
- </span>
- <Button type="primary" onClick={() => { this.loadData(); }} style={{ marginRight: '10px', marginBottom: '10px' }}>搜索</Button>
- <Button onClick={this.resetAll} style={{ marginRight: '10px', marginBottom: '10px' }}>重置</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>
- <TabPane tab="导出EXCEL" key="3">
- <Button type="primary" style={{ margin: '10px' }} onClick={this.exportPending}>导出</Button>
- </TabPane>
- </Tabs>
- <div className="patent-table">
- <Spin spinning={this.state.loading}>
- <Table
- scroll={{ x: 1200, y: 0 }}
- columns={
- this.state.changeList
- ? this.state.changeList
- : this.state.columns
- }
- dataSource={this.state.dataSource}
- pagination={this.state.pagination}
- style={{
- cursor: 'pointer',
- }}
- onRowClick={(record) => {
- this.setState({
- projectdetailsId: record.id,
- projectdetailsOrderNo: record.orderNo,
- commodityName: record.commodityName,
- visible: true,
- })
- }}
- bordered
- size="middle"
- rowClassName={this.suspendColor}
- />
- </Spin>
- </div>
- {this.state.visible ? <ProjectDetails
- visible={this.state.visible}
- id={this.state.projectdetailsId}
- orderNo={this.state.projectdetailsOrderNo}
- taskName={this.state.commodityName}
- visitOk={() => {
- this.setState({
- visible: false,
- });
- }}
- visitCancel={() => {
- this.setState({
- visible: false,
- });
- }}
- /> : null}
- </div>
- )
- }
- }
- export default EnterpriseProjectQuery;
|