Commit e519385d by zhaochengxiang

目录新增负责人

parent 67d00570
......@@ -3,6 +3,7 @@ import { Modal, Form, Input, Space, Button, Radio, Select, Spin } from 'antd';
import { dispatch } from '../../../../model';
import { showMessage } from '../../../../util';
import SelectUser from '../../Model/Component/SelectUsers';
// const resourceTypes = [
// // { key: 'innerSource', name: '内部资源' },
......@@ -39,9 +40,12 @@ const UpdateDirectoryModal = (props) => {
const [ dir, setDir ] = useState(null);
const [ confirmLoading, setConfirmLoading ] = useState(false);
const [ isThemeAdd, setIsThemeAdd ] = useState(false);
const [ users, setUsers ] = useState([]);
const [ loadingUsers, setLoadingUsers ] = useState(false);
useEffect(() => {
if (visible && dirId) {
getUsers();
getDirectory();
}
//eslint-disable-next-line react-hooks/exhaustive-deps
......@@ -59,10 +63,35 @@ const UpdateDirectoryModal = (props) => {
return false;
}, [action, dir, isThemeAdd])
const responsibilityer = React.useMemo(() => {
if (dir?.responsibilityer) {
const user = users?.filter((user)=>(user.pernr===dir?.responsibilityer))
if ((user??[]).length > 0) {
return user[0].nachn?`${user[0].nachn}(${user[0].pernr})`:user[0].pernr;
}
}
return ''
}, [dir, users])
const marginBottom = useMemo(() => {
return (action === 'detail') ? 5 : 15
}, [action])
const getUsers = () => {
setLoadingUsers(true);
dispatch({
type: 'pds.getOwners',
callback: (data) => {
setLoadingUsers(false);
setUsers(data);
},
error: () => {
setLoadingUsers(false);
}
})
}
const getDirectory = () => {
setLoading(true);
dispatch({
......@@ -75,7 +104,7 @@ const UpdateDirectoryModal = (props) => {
setDir(data);
if (action !== 'add') {
form.setFieldsValue({ code: data?.code, name: data?.name||'', desc: data?.desc||'', remarks: data?.remarks||'' });
form.setFieldsValue(data)
}
},
error: () => {
......@@ -92,10 +121,7 @@ const UpdateDirectoryModal = (props) => {
let payload = {
data: {
code: row.code,
name: row.name,
desc: row.desc,
remarks: row.remarks,
...row,
resourceType: 'dataAsset',
}
};
......@@ -282,6 +308,19 @@ const UpdateDirectoryModal = (props) => {
(action==='detail') ? <span>{dir?.remarks}</span> : <Input.TextArea placeholder="请输入备注" autoSize={{ minRows: 4, maxRows: 4 }} />
}
</Form.Item>
<Form.Item
label="目录负责人"
name="responsibilityer"
style={{ marginBottom }}
>
{
(action==='detail') ? <span>{responsibilityer}</span> : <SelectUser
type='edit'
loading={loadingUsers}
users={users}
/>
}
</Form.Item>
</Form>
</Spin>
</Modal>
......
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