From 7b410178aeb062ae6a0a73288766866fb615c37b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E6=99=AF=E5=AD=A6?= <5412262+sun_jing_xue@user.noreply.gitee.com> Date: Tue, 15 Jul 2025 15:47:21 +0800 Subject: [PATCH] =?UTF-8?q?=E9=83=A8=E9=97=A8=E4=B8=8E=E9=80=80=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AccessDepartmentSelect/index.tsx | 56 +++++++++++++++++++ .../AccessDepartmentSelect/services.ts | 30 ++++++++++ .../CompanyInfo/component/InvoiceTab.tsx | 2 +- src/layouts/Header.tsx | 38 ++++++++----- .../components/CreateModal.tsx | 6 +- .../admission/SupplierEntryReview/index.tsx | 3 +- .../components/CreateModal.tsx | 7 +-- .../admission/admissionManagement/index.tsx | 4 +- .../components/CategoryAddModal.tsx | 11 +--- .../components/SupplierAddModal.tsx | 4 +- .../components/SupplierAddModal.tsx | 3 +- .../components/ViewModal.tsx | 3 +- src/servers/api/login.ts | 2 +- 13 files changed, 131 insertions(+), 38 deletions(-) create mode 100644 src/components/AccessDepartmentSelect/index.tsx create mode 100644 src/components/AccessDepartmentSelect/services.ts diff --git a/src/components/AccessDepartmentSelect/index.tsx b/src/components/AccessDepartmentSelect/index.tsx new file mode 100644 index 0000000..1220bd1 --- /dev/null +++ b/src/components/AccessDepartmentSelect/index.tsx @@ -0,0 +1,56 @@ +import React, { useState, useEffect } from 'react'; +import { Select } from 'antd'; +import { queryUserOrgAll } from './services' + +export interface AccessDepartmentSelectProps { + value?: string | number; + onChange?: (value: string | number) => void; + options?: { label: string; value: string | number }[]; + placeholder?: string; + disabled?: boolean; +} + +interface Dict { + orgName: string; + orgId: string; +} + + +const AccessDepartmentSelect: React.FC = ({ + value, + onChange, + placeholder = '请选择准入部门', + disabled = false, +}) => { + + //部门 + const [userOrgAll, setUserOrgAll] = useState(); + useEffect(() => { + queryUserOrgAll().then((res) => { + const { code, data } = res; + if (code == 200) { + setUserOrgAll(data) + } + + }) + }, []) + + return ( + + ); +}; + +export default AccessDepartmentSelect; diff --git a/src/components/AccessDepartmentSelect/services.ts b/src/components/AccessDepartmentSelect/services.ts new file mode 100644 index 0000000..b6dcf3d --- /dev/null +++ b/src/components/AccessDepartmentSelect/services.ts @@ -0,0 +1,30 @@ +import request from '@/utils/request'; + +/** +* 部门 +*/ +export const queryUserOrgAll = () => request.get(`/org/queryUserOrgAll`); + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/components/CompanyInfo/component/InvoiceTab.tsx b/src/components/CompanyInfo/component/InvoiceTab.tsx index 3fc6abe..5849e0b 100644 --- a/src/components/CompanyInfo/component/InvoiceTab.tsx +++ b/src/components/CompanyInfo/component/InvoiceTab.tsx @@ -84,7 +84,7 @@ const InvoiceTab: React.FC = (props) => { const columns: ColumnsType = [ { title: 'page.workbench.invoice.index', dataIndex: 'index', width: 80, key: 'index', render: (_: any, __: any, index: number) => index + 1 }, - { title: 'page.workbench.invoice.taxpayerType', dataIndex: 'taxpayerType', ellipsis: true }, + { title: 'page.workbench.invoice.taxpayerType', dataIndex: 'taxpayerTypeCn', ellipsis: true }, { title: 'page.workbench.invoice.taxpayerCode', dataIndex: 'taxpayerCode', ellipsis: true }, { title: 'page.workbench.invoice.head', dataIndex: 'head', ellipsis: true }, { title: 'page.workbench.invoice.address', dataIndex: 'address', ellipsis: true }, diff --git a/src/layouts/Header.tsx b/src/layouts/Header.tsx index 477c246..b5ac2cb 100644 --- a/src/layouts/Header.tsx +++ b/src/layouts/Header.tsx @@ -4,29 +4,41 @@ import LogoImg from '@/assets/img/logo.png'; //导入菜单组件 import Language from './Language'; import User from './User'; +import { history } from 'umi'; import './layout.less'; +import { Logout } from '@/servers/api/login'; - const HeaderComponent: React.FC = () => { - // 用 state 保存 userId - const [userId, setUserId] = useState(() => sessionStorage.getItem('userId')); + // 用 state 保存 userId + const [userId, setUserId] = useState(() => sessionStorage.getItem('userId')); - useEffect(() => { - // 定义一个方法用于手动刷新 userId - const refreshUserId = () => setUserId(sessionStorage.getItem('userId')); - // 登录后你可以手动调用 refreshUserId - // 或者监听页面 storage 事件(多窗口/多tab同步) - window.addEventListener('storage', refreshUserId); - // 页面内操作,比如登录成功后,也可以在登录回调里调用 setUserId - return () => window.removeEventListener('storage', refreshUserId); - }, []); + const handLogout = () => { + Logout() + sessionStorage.clear(); + history.replace('/login'); + } + + useEffect(() => { + // 定义一个方法用于手动刷新 userId + const refreshUserId = () => setUserId(sessionStorage.getItem('userId')); + // 登录后你可以手动调用 refreshUserId + // 或者监听页面 storage 事件(多窗口/多tab同步) + window.addEventListener('storage', refreshUserId); + // 页面内操作,比如登录成功后,也可以在登录回调里调用 setUserId + return () => window.removeEventListener('storage', refreshUserId); + }, []); return (
logo
- + {!userId ? ( + + ) : ( +
退出
+ )} +
); diff --git a/src/pages/supplier/admission/SupplierCategoryEntry/components/CreateModal.tsx b/src/pages/supplier/admission/SupplierCategoryEntry/components/CreateModal.tsx index eadf8e2..d8436e1 100644 --- a/src/pages/supplier/admission/SupplierCategoryEntry/components/CreateModal.tsx +++ b/src/pages/supplier/admission/SupplierCategoryEntry/components/CreateModal.tsx @@ -2,6 +2,7 @@ import React, { useState, useEffect } from 'react'; import { Modal, Form, Select, Button, Tree, message, Input } from 'antd'; //组件 import SupplierSelector from './SupplierSelector'; +import AccessDepartmentSelect from '@/components/AccessDepartmentSelect'; // 请求 import { categoryTree, add } from '../services'; const { Option } = Select; @@ -143,10 +144,7 @@ const CreateModal: React.FC<{ visible: boolean; onCancel: () => void; }> = ({ vi name="deptId" rules={[{ required: true, message: '请选择准入部门' }]} > - + diff --git a/src/pages/supplier/admission/SupplierEntryReview/index.tsx b/src/pages/supplier/admission/SupplierEntryReview/index.tsx index 2d63543..a703d3e 100644 --- a/src/pages/supplier/admission/SupplierEntryReview/index.tsx +++ b/src/pages/supplier/admission/SupplierEntryReview/index.tsx @@ -6,6 +6,7 @@ import type { ColumnsType } from 'antd/es/table'; import { getApprovePage } from './services'; import { getDictList } from '@/servers/api/dicts' //组件 +import AccessDepartmentSelect from '@/components/AccessDepartmentSelect'; import ViewModal from './components/ViewModal'; //统一列表分页 import tableProps from '@/utils/tableProps' @@ -218,7 +219,7 @@ const SupplierEntryReview: React.FC = () => { - - - - + { - - diff --git a/src/pages/supplier/category/CategoryLibraryManage/components/CategoryAddModal.tsx b/src/pages/supplier/category/CategoryLibraryManage/components/CategoryAddModal.tsx index 67c0736..d134df3 100644 --- a/src/pages/supplier/category/CategoryLibraryManage/components/CategoryAddModal.tsx +++ b/src/pages/supplier/category/CategoryLibraryManage/components/CategoryAddModal.tsx @@ -3,7 +3,7 @@ import { Modal, Form, Input, DatePicker, Button, Tree, Select, message, Spin, Up import { UploadOutlined } from '@ant-design/icons'; import { categoryTree, uploadFile, superiorLockList, getSupplierPage, library, libraryData } from '../services'; import type { UploadFile } from 'antd/es/upload/interface'; - +import AccessDepartmentSelect from '@/components/AccessDepartmentSelect'; import { getregionInternational } from '@/servers/api/register'; const { Option } = Select; @@ -239,14 +239,7 @@ const CategoryAddModal: React.FC = ({ visible, onCancel, onSuccess }) => name="applyDeptId" rules={[{ required: true, message: '请选择品类库负责人' }]} > -