Commit da27d97d by zhaochengxiang

不显示工号

parent c29c4f0a
...@@ -822,7 +822,7 @@ const AssetAction = (props) => { ...@@ -822,7 +822,7 @@ const AssetAction = (props) => {
return <IndexCode value={item.value||''} terms={terms} />; return <IndexCode value={item.value||''} terms={terms} />;
} }
if (item.name==='数据关键用户' || item.name?.toLowerCase()==='业务数据owner' || item.name?.toLowerCase()==='it责任人') { if (item.name==='数据关键用户' || item.name?.toLowerCase()==='业务数据owner' || item.name?.toLowerCase()==='it责任人' || item.name==='创建人' || item.name==='更新人') {
return <SelectUser return <SelectUser
type='detail' type='detail'
users={users} users={users}
......
...@@ -94,7 +94,7 @@ const AssetDetail = (props)=>{ ...@@ -94,7 +94,7 @@ const AssetDetail = (props)=>{
return <IndexCode value={item.value||''} terms={terms} />; return <IndexCode value={item.value||''} terms={terms} />;
} }
if (item.name==='数据关键用户' || item.name==='业务部门负责人' || item.name?.toLowerCase()==='it责任人') { if (item.name==='数据关键用户' || item.name==='业务部门负责人' || item.name?.toLowerCase()==='it责任人' || item.name==='创建人' || item.name==='更新人') {
return <SelectUser return <SelectUser
type='detail' type='detail'
users={users} users={users}
......
...@@ -231,30 +231,22 @@ const AssetTable = (props) => { ...@@ -231,30 +231,22 @@ const AssetTable = (props) => {
const realAssets = useMemo(() => { const realAssets = useMemo(() => {
const newAssets = [...assets]; const newAssets = [...assets];
if (users?.length > 0 && assets?.length > 0 && columns?.length > 0) { if (users?.length > 0 && assets?.length > 0 && columns?.length > 0) {
const index1 = columns.findIndex(item => item.title === '数据关键用户'); const specialCol = ['数据关键用户', '业务数据owner', 'it责任人', '创建人', '更新人'];
const index2 = columns.findIndex(item => item.title === '业务部门负责人');
const index3 = columns.findIndex(item => item.title?.toLowerCase()==='it责任人');
newAssets?.forEach(item => {
if (index1 !== -1) {
const user = users?.filter((user)=>(user.pernr===item[`element${index1+1}`]));
if (user?.length > 0) {
item[`element${index1+1}`] = user[0].nachn;
}
}
if (index2 !== -1) {
const user = users?.filter((user)=>(user.pernr===item[`element${index2+1}`]));
if (user?.length > 0) {
item[`element${index2+1}`] = user[0].nachn;
}
}
if (index3 !== -1) { const indexArray = [];
const user = users?.filter((user)=>(user.pernr===item[`element${index3+1}`])); columns.forEach((item, index) => {
if (user?.length > 0) { if (specialCol.indexOf(item.title?.toLowerCase()) !== -1) {
item[`element${index3+1}`] = user[0].nachn; indexArray.push(index);
}
} }
});
newAssets?.forEach((item) => {
indexArray?.forEach(index => {
const user = users?.filter((user)=>(user.pernr===item[`element${index+1}`]));
if (user && user.length > 0) {
item[`element${index+1}`] = user[0].nachn?`${user[0].nachn}(${user[0].pernr})`:user[0].pernr;
}
})
}) })
} }
......
...@@ -52,7 +52,7 @@ const SelectUser:React.FC=(props)=>{ ...@@ -52,7 +52,7 @@ const SelectUser:React.FC=(props)=>{
}else if(type==='detail'){ }else if(type==='detail'){
try { try {
const user = users?.filter((item)=>(item.pernr===value)) const user = users?.filter((item)=>(item.pernr===value))
return user[0].nachn return `${user[0].nachn}(${user[0].pernr})`;
} catch (error) { } catch (error) {
return value return value
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment