Commit a0114205 by zhaochengxiang

分支项目成员只允许模型设置

parent 13205385
...@@ -728,7 +728,7 @@ const ModelTree = (props) => { ...@@ -728,7 +728,7 @@ const ModelTree = (props) => {
return <span title={nodeData?.remark||''}>{nodeData?.name||''}</span>; return <span title={nodeData?.remark||''}>{nodeData?.name||''}</span>;
}} }}
onRightClick={({event, node}) => { onRightClick={({event, node}) => {
if ((viewSelectedKey==='dir'&&(isAdmin||isCatalogAdmin)) || (viewSelectedKey === 'branch'&&(node?.deletable||node?.editable))) { if ((viewSelectedKey==='dir'&&(isAdmin||isCatalogAdmin)) || (viewSelectedKey === 'branch')) {
setCurrentRightClickDir(node); setCurrentRightClickDir(node);
displayMenu(event); displayMenu(event);
} }
...@@ -759,7 +759,7 @@ const ModelTree = (props) => { ...@@ -759,7 +759,7 @@ const ModelTree = (props) => {
{ {
(refrence!=='recatalog') && <RcMenu id={MENU_ID}> (refrence!=='recatalog') && <RcMenu id={MENU_ID}>
{ {
(viewSelectedKey==='dir'||currentRightClickDir?.editable) && <RcItem id="edit" onClick={update}> (viewSelectedKey==='dir'||viewSelectedKey==='branch') && <RcItem id="edit" onClick={update}>
{ viewSelectedKey==='branch' ? '修改项目' : '修改目录'} { viewSelectedKey==='branch' ? '修改项目' : '修改目录'}
</RcItem> </RcItem>
} }
...@@ -774,7 +774,7 @@ const ModelTree = (props) => { ...@@ -774,7 +774,7 @@ const ModelTree = (props) => {
</RcItem> </RcItem>
} }
{ {
(viewSelectedKey==='dir'||currentRightClickDir?.deletable) && <RcItem id="delete" onClick={deleteNode}> (viewSelectedKey==='dir'||(viewSelectedKey==='branch'&&currentRightClickDir?.deletable)) && <RcItem id="delete" onClick={deleteNode}>
{ viewSelectedKey==='branch' ? '删除项目' : '删除目录'} { viewSelectedKey==='branch' ? '删除项目' : '删除目录'}
</RcItem> </RcItem>
} }
......
...@@ -126,7 +126,7 @@ const FC = (props) => { ...@@ -126,7 +126,7 @@ const FC = (props) => {
onCancel={() => { close() }} onCancel={() => { close() }}
> >
<Spin spinning={loading||loadingUser||waiting}> <Spin spinning={loading||loadingUser||waiting}>
<Basic ref={basicRef} type={type} item={branch} user={user} /> <Basic ref={basicRef} type={type} item={branch?branch:item} user={user} />
</Spin> </Spin>
</Modal> </Modal>
) )
...@@ -195,8 +195,8 @@ const Basic = React.forwardRef(function ({ type, item, user }, ref) { ...@@ -195,8 +195,8 @@ const Basic = React.forwardRef(function ({ type, item, user }, ref) {
}, [item]) }, [item])
const marginBottom = React.useMemo(() => { const marginBottom = React.useMemo(() => {
return (type === 'detail') ? 5 : 15 return (type==='update' && !item?.editable) ? 5 : 15
}, [type]) }, [type, item])
const getUsers = () => { const getUsers = () => {
setLoadingUsers(true) setLoadingUsers(true)
...@@ -236,14 +236,18 @@ const Basic = React.forwardRef(function ({ type, item, user }, ref) { ...@@ -236,14 +236,18 @@ const Basic = React.forwardRef(function ({ type, item, user }, ref) {
rules={[{ required: true, message: '请输入项目名称!' }]} rules={[{ required: true, message: '请输入项目名称!' }]}
style={{ marginBottom }} style={{ marginBottom }}
> >
<Input placeholder="请输入项目名称" /> {
(type==='update'&&!item?.editable) ? <span>{item?.name}</span> : <Input placeholder="请输入项目名称" />
}
</Form.Item> </Form.Item>
<Form.Item <Form.Item
label='项目说明' label='项目说明'
name='remark' name='remark'
style={{ marginBottom }} style={{ marginBottom }}
> >
<Input placeholder="请输入项目说明" /> {
(type==='update'&&!item?.editable) ? <span>{item?.remark}</span> : <Input placeholder="请输入项目说明" />
}
</Form.Item> </Form.Item>
<Form.Item <Form.Item
label='项目负责人' label='项目负责人'
...@@ -252,7 +256,7 @@ const Basic = React.forwardRef(function ({ type, item, user }, ref) { ...@@ -252,7 +256,7 @@ const Basic = React.forwardRef(function ({ type, item, user }, ref) {
rules={[{ required: (type==='update'), message: '请选择项目负责人!' }]} rules={[{ required: (type==='update'), message: '请选择项目负责人!' }]}
> >
{ {
type === 'add' ? <span>{user?.userName}</span> : <UsersItem loading={loadingUsers} users={users} /> type === 'add' ? <span>{user?.userName}</span> : <UsersItem loading={loadingUsers} users={users} readonly={(type==='update'&&!item?.editable)} />
} }
</Form.Item> </Form.Item>
<Form.Item <Form.Item
...@@ -261,7 +265,7 @@ const Basic = React.forwardRef(function ({ type, item, user }, ref) { ...@@ -261,7 +265,7 @@ const Basic = React.forwardRef(function ({ type, item, user }, ref) {
style={{ marginBottom }} style={{ marginBottom }}
// rules={[{ required: true, message: '请选择项目成员!' }]} // rules={[{ required: true, message: '请选择项目成员!' }]}
> >
<UsersItem loading={loadingUsers} users={users} /> <UsersItem loading={loadingUsers} users={users} readonly={(type==='update'&&!item?.editable)} />
</Form.Item> </Form.Item>
<Form.Item <Form.Item
label='模型设置' label='模型设置'
...@@ -274,7 +278,7 @@ const Basic = React.forwardRef(function ({ type, item, user }, ref) { ...@@ -274,7 +278,7 @@ const Basic = React.forwardRef(function ({ type, item, user }, ref) {
) )
}) })
export const UsersItem = ({ loading, users, value, onChange }) => { export const UsersItem = ({ loading, users, value, onChange, readonly = false }) => {
const [searchValue, setSearchValue] = React.useState() const [searchValue, setSearchValue] = React.useState()
const [options, setOptions] = React.useState() const [options, setOptions] = React.useState()
...@@ -290,22 +294,26 @@ export const UsersItem = ({ loading, users, value, onChange }) => { ...@@ -290,22 +294,26 @@ export const UsersItem = ({ loading, users, value, onChange }) => {
}, [searchValue, users], { wait: 300 }) }, [searchValue, users], { wait: 300 })
return ( return (
<Select loading={loading} mode='multiple' allowClear <>
placeholder='请选择用户' {
value={(options??[]).length>0?value?.map(item => item.id):[]} readonly ? <span>{value?.map(item => item.name).toString()}</span> : <Select loading={loading} mode='multiple' allowClear
searchValue={searchValue} placeholder='请选择用户'
onSearch={(val) => { value={(options??[]).length>0?value?.map(item => item.id):[]}
setSearchValue(val) searchValue={searchValue}
}} onSearch={(val) => {
onClear={() => { setSearchValue(val)
setSearchValue() }}
}} onClear={() => {
filterOption={false} setSearchValue()
options={options} }}
onChange={(val) => { filterOption={false}
onChange?.((users??[]).filter(item => (val??[]).indexOf(item.id) !== -1)) options={options}
}} onChange={(val) => {
/> onChange?.((users??[]).filter(item => (val??[]).indexOf(item.id) !== -1))
}}
/>
}
</>
) )
} }
......
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