123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688 |
- import React from 'react';
- import {
- Tooltip,
- Button,
- AutoComplete,
- Input,
- Select,
- Spin,
- Table,
- message,
- Form,
- Tabs,
- DatePicker,
- } from 'antd';
- import $ from 'jquery/src/ajax';
- import { ShowModal, } from "@/tools.js";
- import { industry } from "@/dataDic.js"
- import ShowModalDiv from "@/showModal.jsx";
- import { ChooseList } from "../../../order/orderNew/chooseList";
- import MainBusinessLog from './mainBusinessLog';
- import moment from 'moment';
- import './customer.less';
- const TabPane = Tabs.TabPane;
- const { RangePicker } = DatePicker;
- const IntentionCustomer = Form.create()(React.createClass({
- getInitialState() {
- return {
- searchInfor: {},
- fjlist: [],
- loading: false,
- visible: false,
- changeList: undefined,
- uid: '',
- 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: 'nickname',
- key: 'nickname',
- fixed: 'left',
- width: 200,
- render: text => {
- return (
- <Tooltip title={text}>
- <div>{text}</div>
- </Tooltip>
- )
- }
- },
- {
- title: '地区',
- dataIndex: 'area',
- key: 'area',
- width: 150,
- render: (text, record) => {
- return (record.province || "") + (!record.city ? "" : "-") + (record.city || "") + (!record.area ? "" : "-") + (record.area || "");
- },
- },
- {
- title: '客户类型',
- dataIndex: 'shareType',
- key: 'shareType',
- render: text => {
- return (
- <div>{["私有客户", "公共客户", "签单客户", "外联客户"][text]}</div>
- )
- }
- },
- {
- title: '是否签单',
- dataIndex: 'signBills',
- key: 'signBills',
- render: text => {
- return (
- <div>{["否", "是"][text]}</div>
- )
- }
- },
- {
- title: '主营产品',
- dataIndex: 'businessScope',
- key: 'businessScope',
- width: 200,
- },
- {
- title: '行业',
- dataIndex: 'industry',
- key: 'industry',
- },
- {
- title: '联系人',
- dataIndex: 'contactName',
- key: 'contactName',
- },
- {
- title: '所属人',
- dataIndex: 'adminName',
- key: 'adminName',
- },
- {
- title: '意向合作项目',
- dataIndex: 'intendedProject',
- key: 'intendedProject',
- width: 220,
- },
- {
- title: '知产情况',
- dataIndex: 'patentCount',
- key: 'patentCount',
- width: 220,
- render: (text, record) => {
- return (
- <div>
- 专利 {text || 0}
- 其中发明专利 {record.inventionPatentCount || 0}
- 实用新型 {record.utilityModelCount || 0}
- 外观设计 {record.appearancePatentCount || 0}
- 软著 {record.softwareWorksCount || 0}
- 其他类型 {record.otherCount || 0}
- </div>
- )
- }
- },
- {
- title: '财务数据',
- dataIndex: 'financialData',
- key: 'financialData',
- width: 200,
- },
- {
- title: '前期沟通',
- dataIndex: 'earlyCommunication',
- key: 'earlyCommunication',
- width: 200,
- },
- {
- title: '面谈思路及目的',
- dataIndex: 'interviewIdeas',
- key: 'interviewIdeas',
- width: 200,
- },
- {
- title: '更新时间',
- dataIndex: 'updateTime',
- key: 'updateTime',
- width: 80,
- },
- {
- title: '所属部门',
- dataIndex: 'depName',
- key: 'depName',
- },
- {
- title: '操作',
- dataIndex: 'id',
- key: 'id',
- render: text => {
- return (
- <div>
- <Button
- onClick={(e) => {
- e.stopPropagation();
- this.setState({
- visible: true,
- uid: text
- })
- }} type="primary" style={{ marginLeft: '10px' }}>主营日志</Button>
- </div>
- )
- }
- }
- ],
- columnsX: [
- {
- title: '客户名称',
- dataIndex: 'nickname',
- key: 'nickname',
- fixed: 'left',
- width: 200,
- render: text => {
- return (
- <Tooltip title={text}>
- <div>{text}</div>
- </Tooltip>
- )
- }
- },
- {
- title: '地区',
- dataIndex: 'area',
- key: 'area',
- width: 150,
- render: (text, record) => {
- return (record.province || "") + (!record.city ? "" : "-") + (record.city || "") + (!record.area ? "" : "-") + (record.area || "");
- },
- },
- {
- title: '客户类型',
- dataIndex: 'shareType',
- key: 'shareType',
- render: text => {
- return (
- <div>{["私有客户", "公共客户", "签单客户", "外联客户"][text]}</div>
- )
- }
- },
- {
- title: '渠道类别',
- dataIndex: 'channelType',
- key: 'channelType',
- render: text => {
- return (
- <div>{["", "其他", "民主党派", "园区", "民间组织", "战略合作单位"][text]}</div>
- )
- }
- },
- {
- title: '企业数',
- dataIndex: 'enterpriseCount',
- key: 'enterpriseCount',
- },
- {
- title: '联系人',
- dataIndex: 'contactName',
- key: 'contactName',
- },
- {
- title: '所属人',
- dataIndex: 'adminName',
- key: 'adminName',
- },
- {
- title: '面谈项目',
- dataIndex: 'intendedProject',
- key: 'intendedProject',
- width: 200,
- },
- {
- title: '考核指标',
- dataIndex: 'channelIndicators',
- key: 'channelIndicators',
- width: 200,
- },
- {
- title: '面谈思路及目的',
- dataIndex: 'interviewIdeas',
- key: 'interviewIdeas',
- width: 200,
- },
- {
- title: '面谈人及分工',
- dataIndex: 'interviewDistribution',
- key: 'interviewDistribution',
- width: 200,
- },
- {
- title: '所属部门',
- dataIndex: 'depName',
- key: 'depName',
- },
- {
- title: '操作',
- dataIndex: 'id',
- key: 'id',
- render: text => {
- return (
- <div>
- <Button
- onClick={(e) => {
- e.stopPropagation();
- this.setState({
- visible: true,
- uid: text
- })
- }} type="primary" style={{ marginLeft: '10px' }}>主营日志</Button>
- </div>
- )
- }
- }
- ],
- dataSource: [],
- };
- },
- componentWillMount() {
- this.loadData();
- },
- componentWillReceiveProps(nextProps) {
- if (nextProps.newChannel !== this.props.newChannel) {
- this.setState({
- changeList: undefined
- })
- this.reset();
- }
- },
- loadData(pageNo) {
- const { searchInfor, pagination } = this.state;
- this.setState({
- loading: true,
- });
- let datas = Object.assign(searchInfor, {
- newChannel: this.props.newChannel,
- pageNo: pageNo || 1,
- pageSize: pagination.pageSize,
- });
- $.ajax({
- method: "get",
- dataType: "json",
- crossDomain: false,
- url: globalConfig.context + "/api/admin/userArchives/selectUserArchives",
- 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)
- );
- },
- followUp(e) {
- const { searchInfor } = this.state;
- this.setState({
- searchInfor: Object.assign(searchInfor, {
- aname: 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({
- fjlist: thedata,
- });
- }.bind(this),
- }).always(
- function () {
- this.setState({
- loading: false,
- });
- }.bind(this)
- );
- },
- selectF(value) {
- const { searchInfor, fjlist } = this.state;
- const newdataSources = JSON.stringify(fjlist) == "{}" ? [] : fjlist;
- this.setState({
- searchInfor: Object.assign(searchInfor, {
- aid: newdataSources.find((item) => item.name == value).id,
- }),
- });
- },
- changeList(arr) {
- const newArr = [];
- let list = this.props.newChannel == 1
- ? this.state.columnsX
- : 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.searchInfor));
- $.ajax({
- method: "get",
- dataType: "json",
- crossDomain: false,
- url: "/api/admin/userArchives/selectUserArchives/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;
- },
- search() {
- this.loadData();
- },
- reset() {
- this.setState({
- searchInfor: JSON.parse(JSON.stringify({})),
- }, () => {
- this.loadData();
- })
- },
- render() {
- const { searchInfor } = this.state
- const { newChannel } = this.props
- const newdataSources =
- JSON.stringify(this.state.fjlist) == "{}" ? [] : this.state.fjlist;
- const newoptions = newdataSources.map((group) => (
- <Select.Option key={group.id} value={group.name}>
- {group.name}
- </Select.Option>
- ));
- 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 }}>{newChannel == 1 ? "渠道档案汇总" : "客户档案汇总"}</span>
- </div>
- <div className="user-search">
- <Tabs
- defaultActiveKey="1"
- className="test">
- <TabPane tab="搜索" key="1" style={{ paddingTop: '10px' }}>
- <Input
- placeholder={newChannel == 1 ? "渠道名称" : "客户名称"}
- value={searchInfor.name || undefined}
- style={{ width: 150, marginRight: 10 }}
- onChange={e => {
- this.setState({
- searchInfor: Object.assign(searchInfor, {
- name: e.target.value,
- }),
- });
- }}
- />
- <AutoComplete
- className="certain-category-search"
- dropdownClassName="certain-category-search-dropdown"
- dropdownMatchSelectWidth={false}
- style={{ width: "150px" }}
- dataSource={newoptions}
- placeholder="所属人"
- value={searchInfor.aname || undefined}
- onChange={this.followUp.bind(this)}
- filterOption={true}
- onSelect={this.selectF.bind(this)}
- >
- <Input />
- </AutoComplete>
- {newChannel == 1 &&
- <Select
- mode="multiple"
- placeholder={"请选择渠道类别"}
- style={{ width: 200 }}
- value={searchInfor.channelType ? searchInfor.channelType.split(",") : undefined}
- onChange={(e) => {
- this.setState({
- searchInfor: Object.assign(searchInfor, {
- channelType: e.toString(),
- }),
- });
- }}
- >
- {[
- { name: "民主党派", val: 2 },
- { name: "园区", val: 3 },
- { name: "民间组织", val: 4 },
- { name: "战略合作单位", val: 5 },
- { name: "其他", val: 1 },].map((it, ins) => (
- <Option key={it.val}>{it.name}</Option>
- ))}
- </Select>}
- {newChannel == 0 && <Input
- placeholder="产品关键字"
- value={searchInfor.businessScope || undefined}
- style={{ width: 150, marginRight: 10 }}
- onChange={e => {
- this.setState({
- searchInfor: Object.assign(searchInfor, {
- businessScope: e.target.value,
- }),
- });
- }}
- />}
- {newChannel == 0 &&
- <Select
- mode="multiple"
- placeholder={"请选择行业"}
- style={{ width: 150 }}
- value={searchInfor.industry ? searchInfor.industry.split(",") : undefined}
- onChange={(e) => {
- this.setState({
- searchInfor: Object.assign(searchInfor, {
- industry: e.toString(),
- }),
- });
- }}
- >
- {industry.map((it, ins) => (
- <Option key={it.value}>{it.key}</Option>
- ))}
- </Select>}
- <Select
- placeholder={"请选择客户类型"}
- style={{ width: 150 }}
- value={searchInfor.shareType}
- onChange={(e) => {
- this.setState({
- searchInfor: Object.assign(searchInfor, {
- shareType: e,
- }),
- });
- }}
- >
- <Option value="">全部客户</Option>
- <Option value="0">私有客户</Option>
- <Option value="1">公共客户</Option>
- <Option value="2">签单客户</Option>
- <Option value="3">外联客户</Option>
- <Option value="4">私有&签单</Option>
- </Select>
- <Select
- placeholder={"是否签单"}
- style={{ width: 100 }}
- value={searchInfor.signBills}
- onChange={(e) => {
- this.setState({
- searchInfor: Object.assign(searchInfor, {
- signBills: e,
- }),
- });
- }}
- >
- <Option value="0">否</Option>
- <Option value="1">是</Option>
- </Select>
- <span>更新时间: </span>
- <RangePicker
- style={{ width: 300 }}
- value={[
- searchInfor.startTime ? moment(searchInfor.startTime) : null,
- searchInfor.endTime ? moment(searchInfor.endTime) : null,
- ]}
- onChange={(data, dataString) => {
- this.setState({
- searchInfor: Object.assign(searchInfor, {
- startTime: dataString[0],
- endTime: dataString[1],
- }),
- });
- }}
- />
- <Button type="primary" onClick={this.search} style={{ marginRight: 10 }}>
- 搜索
- </Button>
- <Button onClick={this.reset}>重置</Button>
- </TabPane>
- <TabPane tab="更改表格显示数据" key="2">
- <div style={{ marginLeft: 10 }}>
- <ChooseList
- columns={newChannel == 1 ? this.state.columnsX : this.state.columns}
- changeFn={this.changeList}
- changeList={this.state.changeList}
- top={55}
- margin={11}
- />
- </div>
- </TabPane>
- <TabPane tab="导出EXCEL" key="3">
- <Button
- type="primary"
- loading={this.state.exportPendingLoading}
- onClick={this.exportAll}
- style={{ margin: 10 }}
- >
- 导出excel
- </Button>
- </TabPane>
- </Tabs>
- </div>
- <div className="patent-table">
- <Spin spinning={this.state.loading}>
- <Table
- columns={this.state.changeList
- ? this.state.changeList
- : newChannel == 1
- ? this.state.columnsX
- : this.state.columns}
- dataSource={this.state.dataSource}
- pagination={this.state.pagination}
- bordered
- scroll={{ x: newChannel == 0 ? "140%" : "130%" }}
- />
- </Spin>
- </div>
- {this.state.visible &&
- <MainBusinessLog
- visible={this.state.visible}
- uid={this.state.uid}
- onCancel={() => {
- this.setState({
- visible: false,
- uid: ''
- })
- }}
- />}
- </div>
- );
- }
- }));
- export default IntentionCustomer;
|