diff --git a/src/layouts/User.tsx b/src/layouts/User.tsx index 021830b..b0b9834 100644 --- a/src/layouts/User.tsx +++ b/src/layouts/User.tsx @@ -11,8 +11,6 @@ interface PageProps extends ConnectProps { dispatch: Dispatch; // dva dispatch方法 } const User: React.FC = ({ user, dispatch }) => { - - const intl = useIntl(); useEffect(() => { if (!user.userInfo) { @@ -29,7 +27,7 @@ const User: React.FC = ({ user, dispatch }) => { console.error('Userinfo 解析失败', e); } } - } else if (user.token) { + } else if (user.token) { dispatch({ type: 'user/fetchUserInfo', }); @@ -42,6 +40,9 @@ const User: React.FC = ({ user, dispatch }) => { icon: , content: '退出登录后,您将需要重新登录', onOk() { + dispatch({ + type: 'tab/clearTab' + }); dispatch({ type: 'user/logout', }).then(() => { @@ -54,7 +55,7 @@ const User: React.FC = ({ user, dispatch }) => { return; }, }); - } else if(e.key === 'profile') { + } else if (e.key === 'profile') { history.push('/PersonalInfo'); } }; diff --git a/src/models/tab.ts b/src/models/tab.ts index f44177c..3e76652 100644 --- a/src/models/tab.ts +++ b/src/models/tab.ts @@ -21,6 +21,7 @@ export interface TabModelType { addTab: Effect; closeTab: Effect; switchTab: Effect; + clearTab: Effect; // 新增清空tab的effect }; reducers: { updateState: Reducer; @@ -84,7 +85,17 @@ const TabModel: TabModelType = { }); } }, - + //清空tab + *clearTab({ payload }, { call, put }) { + // 清空tab列表 + yield put({ + type: 'updateState', + payload: { + tabList: [], + activeKey: '/', + }, + }); + }, *closeTab({ payload }, { call, put, select }) { const { key } = payload; const { tabList, activeKey } = yield select((state: any) => state.tab); diff --git a/src/pages/supplier/admission/SupplierCategoryEntry/index.tsx b/src/pages/supplier/admission/SupplierCategoryEntry/index.tsx index 2067d12..6cd7936 100644 --- a/src/pages/supplier/admission/SupplierCategoryEntry/index.tsx +++ b/src/pages/supplier/admission/SupplierCategoryEntry/index.tsx @@ -30,6 +30,7 @@ interface Dict { const SupplierCategoryEntry: React.FC = () => { + const userId = sessionStorage.getItem('userId') || ''; // 查询 const [form] = Form.useForm(); //列表渲染数据 @@ -120,7 +121,7 @@ const SupplierCategoryEntry: React.FC = () => { 发起审批 )} - {record.approveStatus === '0' && ( + {record.approveStatus === '0' && userId == '8' && ( {/* 测试使用,需删除 */} - { record.approveStatus === '0' && ( + { record.approveStatus === '0' && userId == '8' && ( )} - + ), }, ]; diff --git a/src/pages/supplier/supplierExit/supplierExitAudit/index.tsx b/src/pages/supplier/supplierExit/supplierExitAudit/index.tsx index 476269a..eca0a0a 100644 --- a/src/pages/supplier/supplierExit/supplierExitAudit/index.tsx +++ b/src/pages/supplier/supplierExit/supplierExitAudit/index.tsx @@ -26,6 +26,7 @@ interface Dict { } const supplierExitAudit: React.FC = () => { + const userId = sessionStorage.getItem('userId') || ''; const [form] = Form.useForm(); const [data, setData] = useState([]); const [loading, setLoading] = useState(false); @@ -114,7 +115,7 @@ const supplierExitAudit: React.FC = () => { > 查看 - {record.approveStatus === '0' && ( + {record.approveStatus === '0' && userId == '8' && ( )} - + ), }, ];