|
@@ -80,8 +80,9 @@ const ModalStore: React.FC<ModalStoreProps> = props => {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function push(key: string, compState: any) {
|
|
function push(key: string, compState: any) {
|
|
|
|
|
+ const isDrawer = key.startsWith('D')
|
|
|
// eslint-disable-next-line no-param-reassign
|
|
// eslint-disable-next-line no-param-reassign
|
|
|
- key = compState?.dataId ? `${key}@${compState?.dataId}` : key
|
|
|
|
|
|
|
+ key = isDrawer && compState?.dataId ? `${key}@${compState?.dataId}` : key
|
|
|
const { visiblePropName, onClosePropName, destroyOnClose } = getModalConfig(key)
|
|
const { visiblePropName, onClosePropName, destroyOnClose } = getModalConfig(key)
|
|
|
|
|
|
|
|
setModalState(prevModals => {
|
|
setModalState(prevModals => {
|
|
@@ -89,7 +90,8 @@ const ModalStore: React.FC<ModalStoreProps> = props => {
|
|
|
[visiblePropName]: key.startsWith('D') ? false : true,
|
|
[visiblePropName]: key.startsWith('D') ? false : true,
|
|
|
[onClosePropName]: getCloseFunction(key, compState?.[onClosePropName])
|
|
[onClosePropName]: getCloseFunction(key, compState?.[onClosePropName])
|
|
|
}
|
|
}
|
|
|
- compState?.dataId &&
|
|
|
|
|
|
|
+ isDrawer &&
|
|
|
|
|
+ compState?.dataId &&
|
|
|
dispatch({
|
|
dispatch({
|
|
|
type: 'refresh/commitAction',
|
|
type: 'refresh/commitAction',
|
|
|
payload: compState.dataId
|
|
payload: compState.dataId
|
|
@@ -113,7 +115,7 @@ const ModalStore: React.FC<ModalStoreProps> = props => {
|
|
|
const index = nextModals.findIndex(item => item.key === key)
|
|
const index = nextModals.findIndex(item => item.key === key)
|
|
|
|
|
|
|
|
if (index !== -1) {
|
|
if (index !== -1) {
|
|
|
- if (key.startsWith('D')) {
|
|
|
|
|
|
|
+ if (isDrawer) {
|
|
|
message.warning('当前窗口正在运行中,请勿重复打开')
|
|
message.warning('当前窗口正在运行中,请勿重复打开')
|
|
|
return prevModals
|
|
return prevModals
|
|
|
}
|
|
}
|
|
@@ -123,7 +125,7 @@ const ModalStore: React.FC<ModalStoreProps> = props => {
|
|
|
|
|
|
|
|
return nextModals
|
|
return nextModals
|
|
|
})
|
|
})
|
|
|
- if (key.startsWith('D')) {
|
|
|
|
|
|
|
+ if (isDrawer) {
|
|
|
// 利用事件循环,先让dom元素渲染出来再使其展示动画(否则可能导致抽屉无动画直接出现)
|
|
// 利用事件循环,先让dom元素渲染出来再使其展示动画(否则可能导致抽屉无动画直接出现)
|
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
|
setModalState(prevModals =>
|
|
setModalState(prevModals =>
|
|
@@ -153,8 +155,9 @@ const ModalStore: React.FC<ModalStoreProps> = props => {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function renderMaskProps(item: ModalItem) {
|
|
function renderMaskProps(item: ModalItem) {
|
|
|
|
|
+ const isDrawer = item.key.startsWith('D')
|
|
|
// 没有dataId 不是抽屉
|
|
// 没有dataId 不是抽屉
|
|
|
- if (!item.dataId) return item
|
|
|
|
|
|
|
+ if (!isDrawer && !item.dataId) return item
|
|
|
const drawerStore = state.currentModal.filter(modal => modal.dataId).map(modal => modal.dataId)
|
|
const drawerStore = state.currentModal.filter(modal => modal.dataId).map(modal => modal.dataId)
|
|
|
const len = drawerStore.length
|
|
const len = drawerStore.length
|
|
|
if (len === 1) return item
|
|
if (len === 1) return item
|