diff --git a/web/client/src/sections/humanAffairs/containers/salersDistribution/importSalersModal.js b/web/client/src/sections/humanAffairs/containers/salersDistribution/importSalersModal.js index 8de7e25..86ec5ce 100644 --- a/web/client/src/sections/humanAffairs/containers/salersDistribution/importSalersModal.js +++ b/web/client/src/sections/humanAffairs/containers/salersDistribution/importSalersModal.js @@ -115,7 +115,7 @@ const ImportSalersModal = props => { const judgeProvinces = (provinces) => { let noMark = 0; - provinces.split('、')?.map(p => { + provinces?.split('、')?.map(p => { if (allProvinces.indexOf(p) == -1) { noMark++ } @@ -124,14 +124,17 @@ const ImportSalersModal = props => { } const judgeCities = (provinces, cities) => { + if (!cities) {//可以不填 + return true; + } 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 => { nowCities.push(c.name) }) }) let noMark = 0; - cities.split('、')?.map(p => { + cities?.split('、')?.map(p => { if (nowCities.indexOf(p) == -1) { noMark++ } @@ -225,7 +228,7 @@ const ImportSalersModal = props => { } postData.push({ pepUserId: rzExist.pepUserId, name, - provinces: provinces.split('、'), cities: cities.split('、'), + provinces: provinces?.split('、') || [], cities: cities?.split('、') || [], del: false }) } diff --git a/web/client/src/sections/humanAffairs/containers/salersDistribution/salesMemberModal.js b/web/client/src/sections/humanAffairs/containers/salersDistribution/salesMemberModal.js index ac554dd..61e8b92 100644 --- a/web/client/src/sections/humanAffairs/containers/salersDistribution/salesMemberModal.js +++ b/web/client/src/sections/humanAffairs/containers/salersDistribution/salesMemberModal.js @@ -50,7 +50,12 @@ const SalesMemberModal = (props) => { function handleOk() { 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 (dataToEdit) { dispatch(humanAffairs.editSalesMember({ pepUserId: peoplePro.pepUserId, msg: '编辑销售人员信息', ...values })).then((res) => { @@ -73,7 +78,7 @@ const SalesMemberModal = (props) => { } } else { Notification.error({ - content: '你填写的员工编号无对应的人员信息', + content: '请查询人员编号对应的员工信息', duration: 2, }) } @@ -81,55 +86,63 @@ const SalesMemberModal = (props) => { } const memberSeach = (id) => {//搜索项企用户 - dispatch(humanAffairs.getMemberSearch({ code: id })).then((res) => {//搜索项企用户 - if (res.success) { - if (res.payload.data.length) { - let user = res.payload.data[0] - let exist = rzMembers.find(m => m.pepUserId == user.pepUserId);//人员档案里面需要有 - if (exist) { - let item = { - pepUserId: user.pepUserId, - name: exist.userName, - department: exist.departmrnt, - hireDate: exist.hiredate, - regularDate: exist.regularDate, - userCode: user.userCode, - post: user.userPost//岗位 - } - setPeoplePro(item) - } - } + // dispatch(humanAffairs.getMemberSearch({ code: id })).then((res) => {//搜索项企用户 + // if (res.success) { + // if (res.payload.data.length) { + // let user = res.payload.data[0] + let exist = rzMembers.find(m => m.userCode == id);//人员档案里面需要有 + if (exist) { + let item = { + pepUserId: exist.pepUserId, + name: exist.userName, + department: exist.departmrnt, + hireDate: exist.hiredate, + regularDate: exist.regularDate, + userCode: exist.userCode, + post: exist.userPost//岗位 } - }) + setPeoplePro(item) + } else { + setPeoplePro('noValid') + } + // } else { + // setPeoplePro('noValid') + // } + // } + // }) } const renderSimpleInfo = () => { let arrStr = peoplePro?.department?.map(t => t.name) || []; return
{ - peoplePro?.name ? ( -
-
- {renderPeopleItem('姓名:', peoplePro.name)} -
-
- + peoplePro == 'noValid' ? +
+ 没有符合条件的结果 +
: + peoplePro?.name ? ( +
+
+ {renderPeopleItem('姓名:', peoplePro.name)} +
+
+ +
+
+ 所属部门: +
+ {getMultis(arrStr)}
-
- 所属部门: -
- {getMultis(arrStr)} +
+
+ {renderPeopleItem('入职时间:', peoplePro.hireDate)} + {renderPeopleItem('岗位:', peoplePro.post)} +
+ {renderPeopleItem('转正时间:', peoplePro.regularDate)} + {renderPeopleItem('工龄:', peoplePro.hireDate ? String(moment(new Date()).diff(peoplePro.hireDate, 'years', true)).substring(0, 3) + '年' : '-')}
-
- {renderPeopleItem('入职时间:', peoplePro.hireDate)} - {renderPeopleItem('岗位:', peoplePro.post)} -
- {renderPeopleItem('转正时间:', peoplePro.regularDate)} - {renderPeopleItem('工龄:', peoplePro.hireDate ? String(moment(new Date()).diff(peoplePro.hireDate, 'years', true)).substring(0, 3) + '年' : '-')} -
-
- ) : ('') + ) : ('') }
} @@ -177,6 +190,7 @@ const SalesMemberModal = (props) => { showClear style={{ width: '100%' }} rules={[{ required: true, message: "请输入人员编号" }]} + onChange={() => setPeoplePro({})} addonAfter={
{ let formList = form.current.getValues() if (formList.userCode) {