wuqun 2 years ago
parent
commit
6cc60624ec
  1. 4
      api/app/lib/controllers/customerContactsFollup/index.js
  2. 2
      api/app/lib/controllers/report/achievement.js
  3. 33
      api/app/lib/models/contract_detail.js
  4. 2
      web/client/src/sections/business/constants/index.js
  5. 93
      web/client/src/sections/business/containers/customer/customerContactFollowup.jsx
  6. 2
      web/client/src/sections/business/containers/performanceReport/contractDetails.jsx
  7. 84
      web/client/src/sections/business/containers/performanceReport/importInvoicingDetailsModal.js
  8. 5
      web/client/src/sections/business/containers/performanceReport/invoicingDetails.jsx
  9. 8
      web/config.js
  10. 4
      web/package.json

4
api/app/lib/controllers/customerContactsFollup/index.js

@ -1,11 +1,11 @@
'use strict';
// 查询储备项目统计表
// 查询客户联系人对接跟进
async function getCustomerContactsFollowup(ctx, next) {
const { type } = ctx.params;
let rslt = null;
try {
rslt = await ctx.fs.dc.models.ReserveItemReport.findAll({
rslt = await ctx.fs.dc.models.CustomerContactsFollowup.findAll({
order: [['id', 'DESC']],
// where: { type: type }
})

2
api/app/lib/controllers/report/achievement.js

@ -346,6 +346,7 @@ async function getContractDetail(ctx) {
where[keywordTarget] = { $iLike: `%${keyword}%` };
}
let contractDetail = await models.ContractDetail.findAndCountAll({
attributes: { exclude: ['iscopy', 'hiredate', 'regularDate'] },
where: where,
offset: Number(page) * Number(limit),
limit: Number(limit),
@ -394,6 +395,7 @@ async function exportContractDetail(ctx) {
try {
const { models } = ctx.fs.dc;
let exportData = await models.ContractDetail.findAll({
attributes: { exclude: ['iscopy', 'hiredate', 'regularDate'] },
order: [['id', 'ASC']]
});
const { utils: { simpleExcelDown, contractDetailsColumnKeys } } = ctx.app.fs;

33
api/app/lib/models/contract_detail.js

@ -16,7 +16,7 @@ module.exports = dc => {
autoIncrement: true
},
year: {
type: DataTypes.STRING,
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: "年度",
@ -402,13 +402,13 @@ module.exports = dc => {
field: "cus_province",
autoIncrement: false
},
cusArea: {
itemArea: {
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: "项目所在地",
primaryKey: false,
field: "cus_area",
field: "item_area",
autoIncrement: false
},
text: {
@ -419,6 +419,33 @@ module.exports = dc => {
primaryKey: false,
field: "text",
autoIncrement: false
},
iscopy: {
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: "是否可复制的业务路径",
primaryKey: false,
field: "iscopy",
autoIncrement: false
},
hiredate: {
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: "入职时间",
primaryKey: false,
field: "hiredate",
autoIncrement: false
},
regularDate: {
type: DataTypes.STRING,
allowNull: true,
defaultValue: null,
comment: "转正时间",
primaryKey: false,
field: "regular_date",
autoIncrement: false
}
}, {
tableName: "contract_detail",

2
web/client/src/sections/business/constants/index.js

@ -47,7 +47,7 @@ export const contractDetailsColumnKeys = {
industry: '行业',
source: '信息来源',
cusProvince: '客户省份',
cusArea: '项目所在地',
itemArea: '项目所在地',
text: '备注',
}

93
web/client/src/sections/business/containers/customer/customerContactFollowup.jsx

@ -4,13 +4,18 @@ import { Select, Input, Button, Banner, Radio, Tooltip, Table } from '@douyinfe/
import { IconSearch } from '@douyinfe/semi-icons';
import '../../style.less'
import moment from 'moment'
import FileSaver from 'file-saver';
import xlsx from 'xlsx';
const CustomerContactFollowup = (props) => {
const { dispatch,actions } = props
const { dispatch, actions, customerContactsFollowupList } = props
const [keyType, setKeyType] = useState('customer');
const [keyTypeSearch, setKeyTypeSearch] = useState('customer');
const [keyword, setKeyword] = useState('');
const [keywordSearch, setKeywordSearch] = useState('');
useEffect(() => {
dispatch(actions.businessManagement.getCustomerContactsFollowup());
}, []);
const columns = [
{
title: '序号',
@ -19,46 +24,84 @@ const CustomerContactFollowup = (props) => {
},
{
title: '客户名称',
dataIndex: 'department',
dataIndex: 'customer',
render: (text, record) => text == null ? '---' : text
},
{
title: '项目名称',
dataIndex: 'salesManager',
dataIndex: 'items',
render: (text, record) => text == null ? '---' : text
},
{
title: '部门',
dataIndex: 'projectName',
dataIndex: 'department',
render: (text, record) => text == null ? '---' : text
},
{
title: '跟进人员',
dataIndex: 'customerName',
dataIndex: 'sale',
render: (text, record) => text == null ? '---' : text
},
{
title: '跟进日期',
dataIndex: 'projectType',
dataIndex: 'updatetime',
render: (text, record) => text == null ? '---' : moment(text).format('YYYY-MM-DD')
},
{
title: '客户联系人',
dataIndex: 'projectState',
dataIndex: 'customerContacts',
render: (text, record) => text == null ? '---' : text
},
{
title: '联系方式',
dataIndex: 'projectDescribe',
dataIndex: 'phone',
render: (text, record) => text == null ? '---' : text
},
{
title: '拜访方式',
dataIndex: 'creationTime',
dataIndex: 'visitStyle',
render: (text, record) => text == null ? '---' : text
},
{
title: '项目进展',
dataIndex: 'reserveProjectCycle',
dataIndex: 'itemText',
render: (text, record) => text == null ? '---' : text
}
];
const data = [];
const exportAll = () => {
let data = customerContactsFollowupList;
if (keywordSearch != '') {
switch (keyTypeSearch) {
case 'customer':
data = customerContactsFollowupList.filter(e => e.customer.match(keywordSearch))
break;
case 'items':
data = customerContactsFollowupList.filter(e => e.items.match(keywordSearch))
break;
case 'sale':
data = customerContactsFollowupList.filter(e => e.sale.match(keywordSearch))
break;
default:
break;
}
}
const search = () => {
setKeywordSearch(keyword)
setKeyTypeSearch(keyType)
}
const exportAll = () => {
// const allList = this.props.projectList.rows;
if (JSON.stringify(customerContactsFollowupList) != '[]') {
const strs = "\uFEFF" + ['序号,客户名称,项目名称,部门,跟进人员,跟进日期,客户联系人,联系方式,拜访方式,项目进展'].concat(customerContactsFollowupList.map((d, i) => {
let update = d.updatetime ? moment(d.updatetime).format('YYYY-MM-DD') : ''
return [`"${i + 1}"`, `"${d['customer'] ? d['customer'] : ''}"`, `"${d['items'] ? d['items'] : ''}"`, `"${d['department'] ? d['department'] : ''}"`, `"${d['sale'] ? d['sale'] : ''}"`, `"${update}"`, `"${d['customerContacts'] ? d['customerContacts'] : ''}"`, `"${d['phone'] ? d['phone'] : ''}"`, `"${d['visitStyle'] ? d['visitStyle'] : ''}"`, `"${d['itemText'] ? d['itemText'] : ''}"`,].join(',')
})).join('\r\n');
let blob = new Blob([strs], { type: 'text/csv' });
FileSaver.saveAs(blob, `客户联系人对接跟进记录${moment().format('YYYY-MM-DD')}.csv`);
} else if (JSON.stringify(customerContactsFollowupList) == '[]') {
message.warning('暂无导出的数据')
}
}
return (
<>
<div style={{ padding: '0px 12px' }}>
@ -80,29 +123,27 @@ const CustomerContactFollowup = (props) => {
<div style={{ display: 'flex', marginTop: 16, marginBottom: 17 }}>
<div style={{ marginLeft: 12, marginRight: 18 }}>
<Select defaultValue='customer' style={{ width: 120, marginRight: 10 }} onChange={(value) => { setKeyType(value) }}>
<Select.Option value='customer'>客户名称</Select.Option>
<Select.Option value='items'>项目名称</Select.Option>
<Select.Option value='sale'>跟进人员</Select.Option>
</Select>
<Input suffix={<IconSearch />}
showClear
placeholder='请输入关键字'
style={{ width: 346 }}
// onChange={seachValueChange}
onChange={(value) => { setKeyword(value) }}
>
</Input>
</div>
<Button theme='solid' type='primary' style={{ width: 80, borderRadius: 2, height: 32, background: '#DBECFF', color: '#005ABD' }}
onClick={() => {
// dispatch(humanAffairs.getMemberList({ keywordTarget, keyword, state: typeChoose })).then((res) => {//
// if (res.success) {
// setArchivesList(res.payload.data.rows)
// }
// })
}}>查询</Button>
<Button theme='solid' type='primary' style={{ width: 80, borderRadius: 2, height: 32, background: '#DBECFF', color: '#005ABD' }} onClick={search}>查询</Button>
<Button theme='solid' type='secondary' style={{ width: 80, borderRadius: 2, marginLeft: 15 }}
onClick={exportAll}>导出全部</Button>
</div>
<div style={{ borderBottom: '1px solid #F2F3F5', marginBottom: 16 }}></div>
<Table columns={columns} dataSource={data} pagination={false} />
<Table columns={columns} dataSource={data} pagination />
</div>
</div>
@ -112,10 +153,12 @@ const CustomerContactFollowup = (props) => {
function mapStateToProps(state) {
const { auth, global } = state;
const { auth, global, customerContactsFollowupList } = state;
return {
user: auth.user,
actions: global.actions,
customerContactsFollowupList: customerContactsFollowupList.data || [],
isRequesting: customerContactsFollowupList.isRequesting
};
}

2
web/client/src/sections/business/containers/performanceReport/contractDetails.jsx

@ -35,7 +35,7 @@ const ContractDetails = (props) => {
columns.push({
title: columnKeys[key], dataIndex: key, key: key,
render: (text, record) => text === 0 ? text : text ? text : '-',
width: 32 + columnKeys[key].length * 32
width: 60 + columnKeys[key].length * 16
});
break;
}

84
web/client/src/sections/business/containers/performanceReport/importInvoicingDetailsModal.js

@ -4,22 +4,35 @@ import { connect } from 'react-redux';
import { Modal, Form, Button, Notification } from '@douyinfe/semi-ui';
import { IconUpload } from '@douyinfe/semi-icons';
import XLSX from 'xlsx';
import moment from 'moment';
import { invoicingDetailsColumnKeys } from '../../constants/index';
const ColumnDateKey = ['invoiceDate'];
const ColumnDateName = ['开票日期'];
//下载模板和上传文件读取
const ImportInvoicingDetailsModal = props => {
const { dispatch, actions, onCancel } = props;
const { humanAffairs } = actions;
const { businessManagement } = actions;
const [msg, setMsg] = useState('');
const [loading, setLoading] = useState('');
const [postData, setPostData] = useState([]);
const [uploadAble, setUploadAble] = useState(false);
const [allNumbers, setAllNumbers] = useState([]);
//初始化
useEffect(() => {
//查询明细表已存在编号数据接口通用
dispatch(businessManagement.getReceivedNumbers({ tableModel: 'InvoiceDetail' })).then(r => {
if (r.success) {
setUploadAble(true);
setAllNumbers(r.payload.data);
}
})
}, []);
const confirm = () => {
if (postData.length) {
setLoading(true)
dispatch(humanAffairs.addSalesMemberBulk(postData)).then(res => {
//导入明细接口通用
dispatch(businessManagement.importBackDetails(postData, { tableModel: 'InvoiceDetail' })).then(res => {
if (res.success) {
onCancel()
}
@ -94,9 +107,29 @@ const ImportInvoicingDetailsModal = props => {
})
}
const judgeNullTime = (v) => {
//注意的点:xlsx将excel中的时间内容解析后,会小一天
//如2020/8/1,xlsx会解析成 Fri Jul 31 2020 23:59:17 GMT+0800 小了43秒
let a = new Date(v);
a.setTime(a.getTime() + 43 * 1000);
return v ? a : null;
}
const judgeNull = (value) => {
return value ? String(value).trim().replace(/\s*/g, "") : null;
const judgeTimeValid = (time) => {
let valid = true;
if (!time) {
return valid;//可以不填
}
const ymd = /^((19|20)[0-9]{2})[\/\-]((0[1-9])|(1[0-2]))[\/\-]((0[1-9])|((1|2)[0-9])|(3[0-1]))$/;//年月日
if (time instanceof Date) {
let timeStr = moment(time).format('YYYY/MM/DD');
if (!ymd.test(timeStr)) {
valid = false;
}
} else {
valid = false;
}
return valid;
}
return (
@ -137,12 +170,51 @@ const ImportInvoicingDetailsModal = props => {
return
}
let postData = [];
let yearPattern = /^(19|20)\d{2}$/;//1900-2099年
let zzsPattern = /^[+]{0,1}(\d+)$/;//正整数
for (let i = 0; i < res.length; i++) {
let d = res[i];
let obj = {};
Object.keys(invoicingDetailsColumnKeys).map(key => {
obj[key] = d[invoicingDetailsColumnKeys[key]] || '';
//日期验证“开票日期”
if (ColumnDateKey.indexOf(key) != -1) {//两个时间
obj[key] = judgeNullTime(d[invoicingDetailsColumnKeys[key]]);
} else {
obj[key] = d[invoicingDetailsColumnKeys[key]] || null;
}
})
//年度 序号 编号必填
if (!obj.year || !obj.serialNo || !obj.number) {
error(`${i + 2}行【年度】、【序号】、【编号】存在空值,请填写`)
return
}
//年度
if (obj.year && !yearPattern.test(obj.year)) {
error(`${i + 2}行【年度】填写错误`)
return
}
//序号 正整数
if (obj.serialNo && !zzsPattern.test(obj.serialNo)) {
error(`${i + 2}行【序号】填写错误,需要为非负整数`)
return
}
let exist = allNumbers.find(m => m.number == obj.number);//数据库中 已有该编号
if (exist) {
error(`${i + 2}行的【编号】在系统中已存在`)
return
}
if (postData.some(p => p.number == obj.number)) {//编号 唯一
error(`${i + 2}行【编号】重复,请更改后重新上传`)
return
}
for (let k = 0; k < ColumnDateKey.length; k++) {
let cValid = judgeTimeValid(obj[ColumnDateKey[k]]);
if (!cValid) {
error(`${i + 2}行【${ColumnDateName[k]}】错误,请填写yyyy/mm/dd格式`)
return
}
}
postData.push(obj);
}
setPostData(postData)
@ -151,7 +223,7 @@ const ImportInvoicingDetailsModal = props => {
onSuccess({ message: msg })
})
}}>
<Button icon={<IconUpload />} theme="light">
<Button icon={<IconUpload />} theme="light" disabled={!uploadAble}>
请选择文件
</Button>
</Form.Upload>

5
web/client/src/sections/business/containers/performanceReport/invoicingDetails.jsx

@ -34,8 +34,8 @@ const InvoicingDetails = (props) => {
default:
columns.push({
title: columnKeys[key], dataIndex: key, key: key,
render: (text, record) => text === 0 ? text : text ? text : '',
width: 32 + columnKeys[key].length * 16
render: (text, record) => text === 0 ? text : text ? text : '-',
width: 60 + columnKeys[key].length * 16
});
break;
}
@ -216,6 +216,7 @@ const InvoicingDetails = (props) => {
importModalV ? <ImportInvoicingDetailsModal
onCancel={() => {
setImportModalV(false);
getInvoicingDetailData();
}} /> : ''
}
{

8
web/config.js

@ -12,7 +12,7 @@ dev && console.log('\x1B[33m%s\x1b[0m', '请遵循并及时更新 readme.md,
args.option(['p', 'port'], '启动端口');
args.option(['u', 'api-url'], 'webapi的URL');
args.option('apiHrUrl', 'webapi的URL 外网可访问');
args.option(['d', 'domain'], 'web domain');
args.option(['d', 'domain'], '项企的顶级域名 domain');
args.option('webPepUrl', '企业管理 web');
@ -28,7 +28,7 @@ const flags = args.parse(process.argv);
const API_URL = process.env.API_URL || flags.apiUrl;
const API_DC_URL = process.env.API_DC_URL || flags.apiHrUrl;
const FS_REPORT_DOMAIN = process.FS_REPORT_DOMAIN || flags.domain;
const FS_PEP_DOMAIN = process.FS_REPORT_DOMAIN || flags.domain;
const WEB_PEP_URL = process.env.WEB_PEP_URL || flags.webPepUrl;
// 七牛
@ -43,6 +43,8 @@ const ANXINCLOUD_PM_SERVICES = process.env.ANXINCLOUD_PM_SERVICES || flags.pmrs;
if (
!API_URL
|| !API_DC_URL
|| !WEB_PEP_URL
|| !FS_PEP_DOMAIN
|| !ANXINCLOUD_QINIU_AK || !ANXINCLOUD_QINIU_SK || !ANXINCLOUD_QINIU_BUCKET_RESOURCE || !ANXINCLOUD_QINIU_DOMAIN_QNDMN_RESOURCE
) {
console.log('缺少启动参数,异常退出');
@ -83,7 +85,7 @@ const product = {
service: {
url: ANXINCLOUD_PM_SERVICES
},
domain: FS_REPORT_DOMAIN,
domain: FS_PEP_DOMAIN,
webPepUrl: WEB_PEP_URL
}
}, {

4
web/package.json

@ -58,6 +58,7 @@
"echarts": "^5.3.3",
"echarts-for-react": "^3.0.2",
"ezuikit-js": "^0.6.1",
"file-saver": "^2.0.5",
"fs-attachment": "^1.0.0",
"fs-web-server-scaffold": "^1.0.6",
"js-cookie": "^3.0.1",
@ -78,6 +79,7 @@
"webpack-cli": "^4.2.0",
"webpack-dev-middleware": "^4.0.2",
"webpack-dev-server": "^3.11.2",
"webpack-hot-middleware": "^2.25.0"
"webpack-hot-middleware": "^2.25.0",
"xlsx": "^0.18.5"
}
}

Loading…
Cancel
Save