Commit 5bd92c73 by zhaochengxiang

负责人不要用工号

parent 6a33a9c3
......@@ -27,14 +27,14 @@ function* request(args) {
error && error(ex);
if (ex) {
if (ex?.ApiError?.cnMessage) {
showErrorNotifaction('系统异常', ex.ApiError.cnMessage, 5);
showErrorNotifaction('温馨提示', ex.ApiError.cnMessage, 5);
} else if (ex?.response?.data) {
let newData = {};
try {
newData = JSON.parse(ex?.response?.data);
showErrorNotifaction('系统异常', newData.ApiError?.cnMessage, 5);
showErrorNotifaction('温馨提示', newData.ApiError?.cnMessage, 5);
} catch(error) {
showErrorNotifaction('系统异常', ex?.response?.data, 5);
showErrorNotifaction('温馨提示', ex?.response?.data, 5);
}
}
}
......
......@@ -429,7 +429,7 @@ const AssetAction = (props) => {
},
};
const elementComponent = (element) => {
const elementEditComponent = (element) => {
if (element.name==='资产项') return <MetadataInfo />;
if (element.name === '数据源系统') {
......@@ -489,6 +489,26 @@ const AssetAction = (props) => {
return <Input disabled={element.manualMaintain==='否'} />
}
const elementDetailComponent = (item) => {
if (item.name === '资产项') {
return <MetadataInfo config={false} value={item.value||''} terms={terms} />;
}
if (item.name === '指标标准编码') {
return <IndexCode value={item.value||''} terms={terms} />;
}
if (item.name==='数据关键用户' || item.name==='业务部门负责人' || item.name?.toLowerCase()==='it责任人') {
return <SelectUser
type='detail'
users={users}
value={item.value||''}
/>
}
return <span className='text-color'>{highlightSearchContentByTerms(item.value||'', terms)}</span>;
}
return (
<div
className='flex'
......@@ -694,7 +714,7 @@ const AssetAction = (props) => {
key={_index}
style={{ marginBottom: (_index===sameAttributeElements.length-1)? 0 : 15 }}
>
{elementComponent(element)}
{elementEditComponent(element)}
</Form.Item>
);
})
......@@ -708,22 +728,7 @@ const AssetAction = (props) => {
(sameAttributeElements||[]).map((item, index) => {
return (
<Descriptions.Item label={<div className='title-common' style={{ textAlign: 'right', width: 60 }}>{item.name||''}</div>} key={index} style={{ paddingBottom: (index===sameAttributeElements.length-1)? 0 : 10 }}>
{
item.name==='资产项' && <MetadataInfo config={false} value={item.value||''} terms={terms} />
}
{
item.name==='指标标准编码' && <IndexCode value={item.value||''} terms={terms} />
}
{
(item.name==='数据关键用户' || item.name==='业务部门负责人' || item.name?.toLowerCase()==='it责任人') && <SelectUser
type='detail'
users={users}
value={item.value||''}
/>
}
{
item.name!=='资产项' && item.name!=='指标标准编码' && item.name!=='数据关键用户' && item.name!=='业务部门负责人' && item.name?.toLowerCase()!=='it责任人' && <span className='text-color'>{highlightSearchContentByTerms(item.value||'', terms)}</span>
}
{ elementDetailComponent(item) }
</Descriptions.Item>
);
})
......
......@@ -5,6 +5,7 @@ import MetadataInfo from './MetadataInfo';
import { highlightSearchContentByTerms } from '../../../../util';
import { dispatch } from '../../../../model';
import IndexCode from './IndexCode';
import SelectUser from '../../Model/Component/SelectUsers';
const AssetDetail = (props)=>{
......@@ -12,11 +13,13 @@ const AssetDetail = (props)=>{
const [ asset, setAsset ] = useState('');
const [ types, setTypes ] = useState([]);
const [ loading, setLoading ] = useState(false);
const [ users, setUsers ] = useState([]);
useEffect(() => {
if ((id||'') !== '') {
// getUserElements();
getUsers();
getAsset([]);
}
//eslint-disable-next-line react-hooks/exhaustive-deps
......@@ -35,6 +38,15 @@ const AssetDetail = (props)=>{
})
}
const getUsers = () => {
dispatch({
type: 'pds.getOwners',
callback: (data) => {
setUsers(data);
}
})
}
const getAsset = (userElements) => {
setLoading(true);
dispatch({
......@@ -73,6 +85,26 @@ const AssetDetail = (props)=>{
})
}
const elementItemComponent = (item) => {
if (item.name === '资产项') {
return <MetadataInfo config={false} value={item.value||''} terms={terms} />;
}
if (item.name === '指标标准编码') {
return <IndexCode value={item.value||''} terms={terms} />;
}
if (item.name==='数据关键用户' || item.name==='业务部门负责人' || item.name?.toLowerCase()==='it责任人') {
return <SelectUser
type='detail'
users={users}
value={item.value||''}
/>
}
return <span className='text-color'>{highlightSearchContentByTerms(item.value||'', terms)}</span>;
}
return(
<Spin spinning={loading}>
{
......@@ -102,15 +134,7 @@ const AssetDetail = (props)=>{
(_currentValues||[]).map((item, index) => {
return (
<Descriptions.Item label={item.name||''} key={index}>
{
item.name==='资产项' && <MetadataInfo config={false} value={item.value||''} terms={terms} />
}
{
item.name==='指标标准编码' && <IndexCode value={item.value||''} terms={terms} />
}
{
item.name!=='资产项' && item.name!=='指标标准编码' && <span className='text-color'>{highlightSearchContentByTerms(item.value||'', terms)}</span>
}
{ elementItemComponent(item) }
</Descriptions.Item>
);
})
......
import React,{ useState, useEffect, useRef, useContext } from "react";
import React,{ useState, useEffect, useRef, useContext, useMemo } from "react";
import { Button, Pagination, Space, Modal, Input, Table, Tooltip, Checkbox, Typography, Dropdown, Menu } from "antd";
import classNames from 'classnames';
import { Resizable } from 'react-resizable';
......@@ -151,6 +151,7 @@ const AssetTable = (props) => {
const [ compact, setCompact ] = useState(false);
const [ assetDeleteModalVisible, setAssetDeleteModalVisible ] = useState(false);
const [ startFlowModalVisible, setStartFlowModalVisible ] = useState(false);
const [ users, setUsers ] = useState([]);
const [ modal, contextHolder ] = Modal.useModal();
const anchorId = getQueryParam(AnchorId, props?.location?.search);
......@@ -181,6 +182,7 @@ const AssetTable = (props) => {
}, [columns, TableWidth])
useEffect(() => {
getUsers();
window?.addEventListener("storage", storageChange);
return () => {
......@@ -226,6 +228,39 @@ const AssetTable = (props) => {
//eslint-disable-next-line react-hooks/exhaustive-deps
}, [ keyword, pagination, elementsChanged, assetActionChanged, recursive, fullSearch ])
const realAssets = useMemo(() => {
const newAssets = [...assets];
if (users?.length > 0 && assets?.length > 0 && columns?.length > 0) {
const index1 = columns.findIndex(item => item.title === '数据关键用户');
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 user = users?.filter((user)=>(user.pernr===item[`element${index3+1}`]));
if (user?.length > 0) {
item[`element${index3+1}`] = user[0].nachn;
}
}
})
}
return newAssets;
}, [users, assets, columns])
const storageChange = (e) => {
if (e.key === 'assetRelationOnClickEvent') {
remoteRelationRef.current = e.relation;
......@@ -239,6 +274,15 @@ const AssetTable = (props) => {
}
}
const getUsers = () => {
dispatch({
type: 'pds.getOwners',
callback: (data) => {
setUsers(data);
}
})
}
const getDataAssetLocationByRelation = () => {
setLoading(true);
dispatch({
......@@ -1042,7 +1086,7 @@ const AssetTable = (props) => {
})
}
rowKey='id'
dataSource={assets}
dataSource={realAssets}
pagination={false}
size='default'
scroll={{ y: scrollY }}
......
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