zmh 2 years ago
parent
commit
c9c5cf8dba
  1. 11
      web/client/src/sections/humanAffairs/containers/salersDistribution/importSalersModal.js
  2. 96
      web/client/src/sections/humanAffairs/containers/salersDistribution/salesMemberModal.js

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

@ -115,7 +115,7 @@ const ImportSalersModal = props => {
const judgeProvinces = (provinces) => { const judgeProvinces = (provinces) => {
let noMark = 0; let noMark = 0;
provinces.split('、')?.map(p => { provinces?.split('、')?.map(p => {
if (allProvinces.indexOf(p) == -1) { if (allProvinces.indexOf(p) == -1) {
noMark++ noMark++
} }
@ -124,14 +124,17 @@ const ImportSalersModal = props => {
} }
const judgeCities = (provinces, cities) => { const judgeCities = (provinces, cities) => {
if (!cities) {//可以不填
return true;
}
let nowCities = []; let nowCities = [];
cityData.filter(cd => provinces.split('、').indexOf(cd.name) != -1).map(d => { cityData.filter(cd => provinces?.split('、').indexOf(cd.name) != -1).map(d => {
d.children?.map(c => { d.children?.map(c => {
nowCities.push(c.name) nowCities.push(c.name)
}) })
}) })
let noMark = 0; let noMark = 0;
cities.split('、')?.map(p => { cities?.split('、')?.map(p => {
if (nowCities.indexOf(p) == -1) { if (nowCities.indexOf(p) == -1) {
noMark++ noMark++
} }
@ -225,7 +228,7 @@ const ImportSalersModal = props => {
} }
postData.push({ postData.push({
pepUserId: rzExist.pepUserId, name, pepUserId: rzExist.pepUserId, name,
provinces: provinces.split('、'), cities: cities.split('、'), provinces: provinces?.split('、') || [], cities: cities?.split('、') || [],
del: false del: false
}) })
} }

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

@ -50,7 +50,12 @@ const SalesMemberModal = (props) => {
function handleOk() { function handleOk() {
form.current.validate().then((values) => { form.current.validate().then((values) => {
if (peoplePro?.userCode) { if (peoplePro == 'noValid') {
Notification.error({
content: '你填写的员工编号无对应的人员信息',
duration: 2,
})
} else if (peoplePro?.userCode) {
if (values.userCode == peoplePro.userCode) { if (values.userCode == peoplePro.userCode) {
if (dataToEdit) { if (dataToEdit) {
dispatch(humanAffairs.editSalesMember({ pepUserId: peoplePro.pepUserId, msg: '编辑销售人员信息', ...values })).then((res) => { dispatch(humanAffairs.editSalesMember({ pepUserId: peoplePro.pepUserId, msg: '编辑销售人员信息', ...values })).then((res) => {
@ -73,7 +78,7 @@ const SalesMemberModal = (props) => {
} }
} else { } else {
Notification.error({ Notification.error({
content: '你填写的员工编号无对应的人员信息', content: '请查询人员编号对应的员工信息',
duration: 2, duration: 2,
}) })
} }
@ -81,55 +86,63 @@ const SalesMemberModal = (props) => {
} }
const memberSeach = (id) => {//搜索项企用户 const memberSeach = (id) => {//搜索项企用户
dispatch(humanAffairs.getMemberSearch({ code: id })).then((res) => {//搜索项企用户 // dispatch(humanAffairs.getMemberSearch({ code: id })).then((res) => {//搜索项企用户
if (res.success) { // if (res.success) {
if (res.payload.data.length) { // if (res.payload.data.length) {
let user = res.payload.data[0] // let user = res.payload.data[0]
let exist = rzMembers.find(m => m.pepUserId == user.pepUserId);//人员档案里面需要有 let exist = rzMembers.find(m => m.userCode == id);//人员档案里面需要有
if (exist) { if (exist) {
let item = { let item = {
pepUserId: user.pepUserId, pepUserId: exist.pepUserId,
name: exist.userName, name: exist.userName,
department: exist.departmrnt, department: exist.departmrnt,
hireDate: exist.hiredate, hireDate: exist.hiredate,
regularDate: exist.regularDate, regularDate: exist.regularDate,
userCode: user.userCode, userCode: exist.userCode,
post: user.userPost//岗位 post: exist.userPost//岗位
}
setPeoplePro(item)
}
}
} }
}) setPeoplePro(item)
} else {
setPeoplePro('noValid')
}
// } else {
// setPeoplePro('noValid')
// }
// }
// })
} }
const renderSimpleInfo = () => { const renderSimpleInfo = () => {
let arrStr = peoplePro?.department?.map(t => t.name) || []; let arrStr = peoplePro?.department?.map(t => t.name) || [];
return <div> return <div>
{ {
peoplePro?.name ? ( peoplePro == 'noValid' ?
<div style={{ width: 749, height: 95, background: '#F4F5FC', border: '1px solid rgba(0, 90, 189, 0.2)', marginTop: 8, padding: '20px 83px 20px 50px' }}> <div style={{ background: '#F4F5FC', border: '1px solid rgba(0, 90, 189, 0.2)', marginTop: 8, padding: '10px 0px', textAlign: 'center', color: '#4A4A4A' }}>
<div style={{ display: 'flex' }}> 没有符合条件的结果
{renderPeopleItem('姓名:', peoplePro.name)} </div> :
<div style={{ display: 'flex', flexBasis: '50%' }}> peoplePro?.name ? (
<div style={{ width: 16, height: 16, marginRight: 9 }}> <div style={{ background: '#F4F5FC', border: '1px solid rgba(0, 90, 189, 0.2)', marginTop: 8, padding: '20px 83px 20px 50px' }}>
<img src="/assets/images/hrImg/department.png" alt="" style={{ width: '100%', height: '100%' }} /> <div style={{ display: 'flex' }}>
{renderPeopleItem('姓名:', peoplePro.name)}
<div style={{ display: 'flex', flexBasis: '50%' }}>
<div style={{ width: 16, height: 16, marginRight: 9 }}>
<img src="/assets/images/hrImg/department.png" alt="" style={{ width: '100%', height: '100%' }} />
</div>
<div style={{ color: 'rgba(0,0,0,0.6)', fontSize: 12 }}>
所属部门
</div>
{getMultis(arrStr)}
</div> </div>
<div style={{ color: 'rgba(0,0,0,0.6)', fontSize: 12 }}> </div>
所属部门 <div style={{ display: 'flex' }}>
</div> {renderPeopleItem('入职时间:', peoplePro.hireDate)}
{getMultis(arrStr)} {renderPeopleItem('岗位:', peoplePro.post)}
</div> <div style={{ display: 'flex' }}>
{renderPeopleItem('转正时间:', peoplePro.regularDate)}
{renderPeopleItem('工龄:', peoplePro.hireDate ? String(moment(new Date()).diff(peoplePro.hireDate, 'years', true)).substring(0, 3) + '年' : '-')}
</div> </div>
</div> </div>
<div style={{ display: 'flex' }}> ) : ('')
{renderPeopleItem('入职时间:', peoplePro.hireDate)}
{renderPeopleItem('岗位:', peoplePro.post)}
</div> <div style={{ display: 'flex' }}>
{renderPeopleItem('转正时间:', peoplePro.regularDate)}
{renderPeopleItem('工龄:', peoplePro.hireDate ? String(moment(new Date()).diff(peoplePro.hireDate, 'years', true)).substring(0, 3) + '年' : '-')}
</div>
</div>
) : ('')
} }
</div> </div>
} }
@ -177,6 +190,7 @@ const SalesMemberModal = (props) => {
showClear showClear
style={{ width: '100%' }} style={{ width: '100%' }}
rules={[{ required: true, message: "请输入人员编号" }]} rules={[{ required: true, message: "请输入人员编号" }]}
onChange={() => setPeoplePro({})}
addonAfter={<div style={{ margin: '0px 12px', color: '#005ABD', cursor: "pointer", fontSize: 14 }} onClick={() => { addonAfter={<div style={{ margin: '0px 12px', color: '#005ABD', cursor: "pointer", fontSize: 14 }} onClick={() => {
let formList = form.current.getValues() let formList = form.current.getValues()
if (formList.userCode) { if (formList.userCode) {

Loading…
Cancel
Save