Commit 1af4b7b0 by zhaochengxiang

bug fix

parent 8f163018
...@@ -299,9 +299,11 @@ const FC = (props) => { ...@@ -299,9 +299,11 @@ const FC = (props) => {
<Tooltip title={((selectedRows??[]).length === 0) ? '请先选择资产' : ''}> <Tooltip title={((selectedRows??[]).length === 0) ? '请先选择资产' : ''}>
<Button onClick={onExportClick} disabled={(selectedRows??[]).length === 0}>导出</Button> <Button onClick={onExportClick} disabled={(selectedRows??[]).length === 0}>导出</Button>
</Tooltip> </Tooltip>
<Tooltip title={((selectedRows??[]).length === 0) ? '请先选择资产' : ''}> {
<Button onClick={onPublishClick} disabled={(selectedRows??[]).length === 0}>发布</Button> isAdmin && <Tooltip title={((selectedRows??[]).length === 0) ? '请先选择资产' : ''}>
</Tooltip> <Button onClick={onPublishClick} disabled={(selectedRows??[]).length === 0}>发布</Button>
</Tooltip>
}
<Tooltip title={((selectedRows??[]).length === 0) ? '请先选择资产' : ''}> <Tooltip title={((selectedRows??[]).length === 0) ? '请先选择资产' : ''}>
<Button onClick={onDeletesClick} disabled={(selectedRows??[]).length === 0}>删除</Button> <Button onClick={onDeletesClick} disabled={(selectedRows??[]).length === 0}>删除</Button>
</Tooltip> </Tooltip>
......
...@@ -8,6 +8,7 @@ import './ExchangeOwner.less'; ...@@ -8,6 +8,7 @@ import './ExchangeOwner.less';
const FC = ({ visible, id, onCancel }) => { const FC = ({ visible, id, onCancel }) => {
const [service, setService] = useState(undefined); const [service, setService] = useState(undefined);
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [loadingOwners, setLoadingOwners] = useState(false);
const [owners, setOwners] = useState(undefined); const [owners, setOwners] = useState(undefined);
const [currentOwner, setCurrentOwner] = useState(undefined); const [currentOwner, setCurrentOwner] = useState(undefined);
...@@ -37,12 +38,15 @@ const FC = ({ visible, id, onCancel }) => { ...@@ -37,12 +38,15 @@ const FC = ({ visible, id, onCancel }) => {
} }
const getOwners = () => { const getOwners = () => {
setLoadingOwners(true);
dispatch({ dispatch({
type: 'pds.getOwners', type: 'pds.getOwners',
callback: (data) => { callback: (data) => {
setLoadingOwners(false);
setOwners(data); setOwners(data);
}, },
error: () => { error: () => {
setLoadingOwners(false);
} }
}) })
} }
...@@ -59,9 +63,9 @@ const FC = ({ visible, id, onCancel }) => { ...@@ -59,9 +63,9 @@ const FC = ({ visible, id, onCancel }) => {
} }
} }
const cancel = () => { const cancel = (refresh = false) => {
reset(); reset();
onCancel?.(); onCancel?.(refresh);
} }
const onOk = () => { const onOk = () => {
...@@ -76,7 +80,7 @@ const FC = ({ visible, id, onCancel }) => { ...@@ -76,7 +80,7 @@ const FC = ({ visible, id, onCancel }) => {
}, },
callback: () => { callback: () => {
setLoading(false); setLoading(false);
onCancel?.(true); cancel(true);
}, },
error: () => { error: () => {
setLoading(false); setLoading(false);
...@@ -87,12 +91,13 @@ const FC = ({ visible, id, onCancel }) => { ...@@ -87,12 +91,13 @@ const FC = ({ visible, id, onCancel }) => {
const reset = () => { const reset = () => {
setService(undefined); setService(undefined);
setLoading(false); setLoading(false);
setLoadingOwners(false);
} }
const footer = [ const footer = [
<Button <Button
key="0" key="0"
onClick={cancel} onClick={() => { cancel() }}
> >
取消 取消
</Button>, </Button>,
...@@ -112,7 +117,7 @@ const FC = ({ visible, id, onCancel }) => { ...@@ -112,7 +117,7 @@ const FC = ({ visible, id, onCancel }) => {
title='更换管理人' title='更换管理人'
width={800} width={800}
destroyOnClose destroyOnClose
onCancel={cancel} onCancel={() => { cancel() }}
footer={footer} footer={footer}
> >
<Spin spinning={loading}> <Spin spinning={loading}>
...@@ -131,7 +136,7 @@ const FC = ({ visible, id, onCancel }) => { ...@@ -131,7 +136,7 @@ const FC = ({ visible, id, onCancel }) => {
<Space> <Space>
<div>管理人:</div> <div>管理人:</div>
<div style={{ width: 200 }}> <div style={{ width: 200 }}>
<SelectUsers type='edit' users={owners} value={currentOwner} onChange={onOwnerChange} /> <SelectUsers type='edit' loading={loadingOwners} users={owners} value={currentOwner} onChange={onOwnerChange} />
</div> </div>
</Space> </Space>
</Spin> </Spin>
......
...@@ -8,7 +8,7 @@ const {Option} = Select ...@@ -8,7 +8,7 @@ const {Option} = Select
const SelectUser:React.FC=(props)=>{ const SelectUser:React.FC=(props)=>{
const {value,onChange,users,type,loading, terms,publishedValue} = props const {value,onChange,users,type,loading=false, terms,publishedValue} = props
const [searchValue, setSearchValue] = useState(undefined) const [searchValue, setSearchValue] = useState(undefined)
......
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