zmh 2 years ago
parent
commit
754f4f83b6
  1. 46
      api/app/lib/controllers/member/index.js
  2. 1
      api/app/lib/controllers/salesDistribution/index.js
  3. 2
      web/client/index.ejs
  4. 2
      web/client/index.html
  5. 2
      web/client/src/sections/humanAffairs/containers/import-members-modal.js
  6. 12
      web/client/src/sections/humanAffairs/containers/salersDistribution/importSalersModal.js
  7. 54
      web/client/src/sections/humanAffairs/containers/salersDistribution/personnelDistribution.jsx
  8. 4
      web/client/src/sections/humanAffairs/containers/salersDistribution/salesMemberModal.js
  9. 2
      web/client/src/sections/humanAffairs/nav-item.jsx

46
api/app/lib/controllers/member/index.js

@ -2,7 +2,7 @@
const moment = require('moment')
const fs = require('fs');
async function add (ctx) {
async function add(ctx) {
try {
const { models } = ctx.fs.dc;
const {
@ -45,7 +45,7 @@ async function add (ctx) {
}
}
async function edit (ctx) {
async function edit(ctx) {
try {
const { models } = ctx.fs.dc;
const {
@ -85,7 +85,7 @@ async function edit (ctx) {
}
}
async function searchPepMember (ctx) {
async function searchPepMember(ctx) {
try {
const { models } = ctx.fs.dc;
const { clickHouse } = ctx.app.fs
@ -116,12 +116,12 @@ async function searchPepMember (ctx) {
ON user_role.user = user.id
LEFT JOIN role
ON role.id = user_role.role
LEFT JOIN basicdata_post
ON basicdata_post.id = user.post
LEFT JOIN department_user
ON department_user.user = user.id
LEFT JOIN department
ON department.id = department_user.department
LEFT JOIN basicdata_post
ON basicdata_post.id = user.post
ON department.id = department_user.department
WHERE
user.delete = '0'
${whereOption.length ? `AND ${whereOption.join(' OR ')}` : ''}
@ -149,6 +149,7 @@ async function searchPepMember (ctx) {
pepUserId: u.pepUserId,
name: u.userName,
userCode: u.userCode,
userPost: u.userPost,
departmrnt: u.depId ? [{
id: u.depId,
name: u.depName
@ -156,8 +157,7 @@ async function searchPepMember (ctx) {
role: u.roleId ? [{
id: u.roleId,
name: u.roleName
}] : [],
userPost:u.userPost
}] : []
})
}
})
@ -173,7 +173,7 @@ async function searchPepMember (ctx) {
}
}
async function del (ctx) {
async function del(ctx) {
try {
const { models } = ctx.fs.dc;
const { pepUserId } = ctx.query
@ -185,7 +185,13 @@ async function del (ctx) {
pepUserId,
}
})
await models.SalesDistribution.update({//顺便把销售人员删了
del: true,
}, {
where: {
pepUserId,
}
})
ctx.status = 204;
} catch (error) {
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`);
@ -196,7 +202,7 @@ async function del (ctx) {
}
}
async function nativePlaceList (ctx) {
async function nativePlaceList(ctx) {
// 获取已有的户籍地列表
try {
const { models } = ctx.fs.dc;
@ -220,7 +226,7 @@ async function nativePlaceList (ctx) {
}
}
async function workPlaceList (ctx) {
async function workPlaceList(ctx) {
// 获取已有的工作地列表
try {
const { models } = ctx.fs.dc;
@ -244,7 +250,7 @@ async function workPlaceList (ctx) {
}
}
async function maritalList (ctx) {
async function maritalList(ctx) {
// 获取已有的婚育状况列表
try {
const { models } = ctx.fs.dc;
@ -268,7 +274,7 @@ async function maritalList (ctx) {
}
}
async function list (ctx) {
async function list(ctx) {
try {
const { models } = ctx.fs.dc;
const { judgeHoliday, memberList, packageUserData } = ctx.app.fs.utils
@ -303,7 +309,7 @@ async function list (ctx) {
}
}
async function overTimeStatistics (ctx) {
async function overTimeStatistics(ctx) {
try {
const { models } = ctx.fs.dc;
const { clickHouse } = ctx.app.fs
@ -379,7 +385,7 @@ async function overTimeStatistics (ctx) {
let returnD = {
...(statisticRes.length ? statisticRes[0] : {}),
data: dataRes,
dayStatisticData: statisticDayRes.sort((a,b)=>moment(a.day)-moment(b.day))
dayStatisticData: statisticDayRes.sort((a, b) => moment(a.day) - moment(b.day))
}
ctx.status = 200;
ctx.body = returnD
@ -392,7 +398,7 @@ async function overTimeStatistics (ctx) {
}
}
async function vacateStatistics (ctx) {
async function vacateStatistics(ctx) {
try {
const { models } = ctx.fs.dc;
const { clickHouse } = ctx.app.fs
@ -469,7 +475,7 @@ async function vacateStatistics (ctx) {
let returnD = {
statistic: statisticRes,
data: dataRes,
dayStatisticData: statisticDayRes.sort((a,b)=>moment(a.day)-moment(b.day))
dayStatisticData: statisticDayRes.sort((a, b) => moment(a.day) - moment(b.day))
}
ctx.status = 200;
ctx.body = returnD
@ -482,7 +488,7 @@ async function vacateStatistics (ctx) {
}
}
async function exportData (ctx) {
async function exportData(ctx) {
try {
const { models } = ctx.fs.dc;
const { clickHouse, opts: { qiniu } } = ctx.app.fs
@ -627,7 +633,7 @@ async function exportData (ctx) {
}
}
async function addMembersBulk (ctx) {
async function addMembersBulk(ctx) {
let errorMsg = { message: '导入员工信息失败' };
const transaction = await ctx.fs.dc.orm.transaction();
try {

1
api/app/lib/controllers/salesDistribution/index.js

@ -27,6 +27,7 @@ async function salesList(ctx) {
where: { del: false },
offset: Number(page) * Number(limit),
limit: Number(limit),
order: [['id', 'DESC']]
})
let rslt = []

2
web/client/index.ejs

@ -9,7 +9,7 @@
<!-- <link rel="shortcut icon" href="/assets/images/favicon.ico"> -->
<script src="https://lf1-cdn-tos.bytegoofy.com/obj/iconpark/icons_20231_12.7f8fd1546294d369f0a85f7d68afb538.es5.js"></script>
<script src="https://lf1-cdn-tos.bytegoofy.com/obj/iconpark/icons_20231_13.3484caadabc6f822796451f94a83fc64.es5.js"></script>
</head>

2
web/client/index.html

@ -7,7 +7,7 @@
<!-- <link rel="shortcut icon" href="/assets/images/favicon.ico"> -->
<script src="https://lf1-cdn-tos.bytegoofy.com/obj/iconpark/icons_20231_12.7f8fd1546294d369f0a85f7d68afb538.es5.js"></script>
<script src="https://lf1-cdn-tos.bytegoofy.com/obj/iconpark/icons_20231_13.3484caadabc6f822796451f94a83fc64.es5.js"></script>
</head>
<body>

2
web/client/src/sections/humanAffairs/containers/import-members-modal.js

@ -343,7 +343,7 @@ const ImportMembersModal = props => {
error(`${i + 2}行工作经验(年)错误,请填写非负数`)
return
}
postData.push({//人员编号 待办todotodo
postData.push({
pepUserId: xqExist.pepUserId, name, idNumber, gender, birthday, nativePlace, marital,
politicsStatus, phoneNumber, workPlace, graduatedFrom, educationBackground, specialty, graduationDate,
hiredate, turnProbationPeriod, regularDate, dimissionDate, experienceYear, occupationalHistory,

12
web/client/src/sections/humanAffairs/containers/salersDistribution/importSalersModal.js

@ -5,7 +5,6 @@ import { Modal, Form, Button, Notification } from '@douyinfe/semi-ui';
import { IconUpload } from '@douyinfe/semi-icons';
import cityData from '../../components/city.json';
import XLSX from 'xlsx'
import { membersBulkAdd } from '../../actions/personnelFiles'
//下载模板和上传文件读取
const ImportSalersModal = props => {
const { dispatch, actions, onCancel, rzMembers } = props
@ -147,7 +146,7 @@ const ImportSalersModal = props => {
return (
<Modal
title="导入" visible={true}
onOk={confirm}
onOk={confirm} width={620}
confirmLoading={loading}
onCancel={() => {
setMsg('')
@ -224,7 +223,7 @@ const ImportSalersModal = props => {
error(`${i + 2}行销售区域(市)错误`)
return
}
postData.push({//人员编号 待办todotodo
postData.push({
pepUserId: rzExist.pepUserId, name,
provinces: provinces.split('、'), cities: cities.split('、'),
del: false
@ -244,6 +243,13 @@ const ImportSalersModal = props => {
<div style={{ color: '#ccc' }}>最大不超过200M导入文件需与
<span onClick={() => download()} style={{ cursor: 'pointer', color: '#0066FF' }}>导入模板</span>
一致</div>
<div style={{ marginTop: 20, border: '1px solid #C7E1FF', background: '#F4F8FF', borderRadius: 2, padding: '8px 0px 7px 12px', alignItems: 'center', color: '#0F7EFB', fontSize: 12 }}>
<div>填写要求</div>
<div>员工编号必填唯一数字和字母的组合</div>
<div>姓名必填若与员工编号对应的项企用户姓名不同将以项企数据为准</div>
<div>销售区域/直辖市必填省或直辖市顿号隔开北京市江西省江苏省</div>
<div>销售区域非必填归属所填省的地级市顿号隔开南昌市镇江市</div>
</div>
</Form>
</Modal >
)

54
web/client/src/sections/humanAffairs/containers/salersDistribution/personnelDistribution.jsx

@ -71,26 +71,27 @@ const PersonnelDistribution = (props) => {
const getMultis = (arrStr) => {//2
return <div style={{ display: 'flex' }}>
{
arrStr.map((ite, idx) => {
return (
<div key={idx} style={{ display: 'flex' }}>
{idx < 2 ?
<div style={{ padding: '0px 4px 1px 4px', color: '#FFF', fontSize: 12, background: 'rgba(0,90,189,0.8)', borderRadius: 2, marginRight: 4 }}>
{ite}
</div> : ''
}
{
arrStr.length > 2 && idx == 2 ?
<Tooltip content={arrStr.join(',')} trigger="click" style={{ lineHeight: 2 }}>
<div style={{ padding: '0px 4px 1px 4px ', color: 'rgba(0,90,189,0.8)', fontSize: 12, marginRight: 4, cursor: "pointer" }}>
+{arrStr.length - 2}
</div>
</Tooltip>
: ''
}
</div>
)
})
arrStr.length ?
arrStr.map((ite, idx) => {
return (
<div key={idx} style={{ display: 'flex' }}>
{idx < 2 ?
<div style={{ padding: '0px 4px 1px 4px', color: '#FFF', fontSize: 12, background: 'rgba(0,90,189,0.8)', borderRadius: 2, marginRight: 4 }}>
{ite}
</div> : ''
}
{
arrStr.length > 2 && idx == 2 ?
<Tooltip content={arrStr.join(',')} trigger="click" style={{ lineHeight: 2 }}>
<div style={{ padding: '0px 4px 1px 4px ', color: 'rgba(0,90,189,0.8)', fontSize: 12, marginRight: 4, cursor: "pointer" }}>
+{arrStr.length - 2}
</div>
</Tooltip>
: ''
}
</div>
)
}) : '-'
}
</div>
}
@ -111,7 +112,7 @@ const PersonnelDistribution = (props) => {
title: starHeader('部门名称'),
dataIndex: 'department',
key: 'department',
width: '15%',
width: '18%',
render: (text, r, index) => {
let arrStr = text.map(t => t.name);
return getMultis(arrStr);
@ -136,18 +137,19 @@ const PersonnelDistribution = (props) => {
title: starHeader('岗位'),
dataIndex: 'post',
key: 'post',
width: '10%',
width: '11%',
render: (text, record) => <span>{text || '-'}</span>
}, {
title: starHeader('入职时间'),
dataIndex: 'hireDate',
key: 'hireDate',
width: '10%',
width: '8%',
render: (text, record) => <span>{text || '-'}</span>
}, {
title: starHeader('转正时间'),
dataIndex: 'regularDate',
key: 'regularDate',
width: '10%',
width: '8%',
render: (text, record) => <span>{text || '-'}</span>
}, {
title: starHeader('工龄'),
@ -236,9 +238,9 @@ const PersonnelDistribution = (props) => {
onClick={() => { setImportModalV(true); }}>
导入
</div>
<div style={{ padding: '6px 20px', background: '#00BA85', color: '#FFFFFF', fontSize: 14, marginLeft: 18 }}>
{/* <div style={{ padding: '6px 20px', background: '#00BA85', color: '#FFFFFF', fontSize: 14, marginLeft: 18 }}>
导出
</div>
</div> */}
</div>
</div>

4
web/client/src/sections/humanAffairs/containers/salersDistribution/salesMemberModal.js

@ -94,7 +94,7 @@ const SalesMemberModal = (props) => {
hireDate: exist.hiredate,
regularDate: exist.regularDate,
userCode: user.userCode,
post: '岗位todo'
post: user.userPost//岗位
}
setPeoplePro(item)
}
@ -143,7 +143,7 @@ const SalesMemberModal = (props) => {
{label}
</div>
<div style={{ color: '#4A4A4A', fontSize: 12 }}>
{value}
{value || '-'}
</div>
</div>
}

2
web/client/src/sections/humanAffairs/nav-item.jsx

@ -49,7 +49,7 @@ export function getNavItem(user, dispatch) {
}, {
itemKey: 'salesStatistics',
text: '销售统计',
icon: <iconpark-icon style={{ width: 20, height: 20 }} name="iconcbzhaopin"></iconpark-icon>,//wwwtodo
icon: <iconpark-icon style={{ width: 20, height: 20 }} name="iconxiaoshou"></iconpark-icon>,//wwwtodo
to: '/humanAffairs/recruit/salesStatistics/personnelDistribution',
items: [{
itemKey: 'personnelDistribution', to: '/humanAffairs/recruit/salesStatistics/personnelDistribution', text: '销售人员分布'

Loading…
Cancel
Save