部门与退出

This commit is contained in:
孙景学
2025-07-15 15:47:21 +08:00
parent 7870f5289e
commit 7b410178ae
13 changed files with 131 additions and 38 deletions

View File

@ -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<AccessDepartmentSelectProps> = ({
value,
onChange,
placeholder = '请选择准入部门',
disabled = false,
}) => {
//部门
const [userOrgAll, setUserOrgAll] = useState<Dict[]>();
useEffect(() => {
queryUserOrgAll().then((res) => {
const { code, data } = res;
if (code == 200) {
setUserOrgAll(data)
}
})
}, [])
return (
<Select
value={value}
onChange={onChange}
placeholder={placeholder}
disabled={disabled}
allowClear
style={{ width: '100%' }}
showSearch
optionFilterProp="label"
>
{userOrgAll?.map(item => (
<Select.Option key={item.orgId} value={item.orgId}>{item.orgName}</Select.Option>
))}
</Select>
);
};
export default AccessDepartmentSelect;

View File

@ -0,0 +1,30 @@
import request from '@/utils/request';
/**
* 部门
*/
export const queryUserOrgAll = () => request.get(`/org/queryUserOrgAll`);

View File

@ -84,7 +84,7 @@ const InvoiceTab: React.FC<InvoiceTabProps> = (props) => {
const columns: ColumnsType<InvoiceInfo> = [ const columns: ColumnsType<InvoiceInfo> = [
{ title: 'page.workbench.invoice.index', dataIndex: 'index', width: 80, key: 'index', render: (_: any, __: any, index: number) => index + 1 }, { 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.taxpayerCode', dataIndex: 'taxpayerCode', ellipsis: true },
{ title: 'page.workbench.invoice.head', dataIndex: 'head', ellipsis: true }, { title: 'page.workbench.invoice.head', dataIndex: 'head', ellipsis: true },
{ title: 'page.workbench.invoice.address', dataIndex: 'address', ellipsis: true }, { title: 'page.workbench.invoice.address', dataIndex: 'address', ellipsis: true },

View File

@ -4,13 +4,20 @@ import LogoImg from '@/assets/img/logo.png';
//导入菜单组件 //导入菜单组件
import Language from './Language'; import Language from './Language';
import User from './User'; import User from './User';
import { history } from 'umi';
import './layout.less'; import './layout.less';
import { Logout } from '@/servers/api/login';
const HeaderComponent: React.FC = () => { const HeaderComponent: React.FC = () => {
// 用 state 保存 userId // 用 state 保存 userId
const [userId, setUserId] = useState(() => sessionStorage.getItem('userId')); const [userId, setUserId] = useState(() => sessionStorage.getItem('userId'));
const handLogout = () => {
Logout()
sessionStorage.clear();
history.replace('/login');
}
useEffect(() => { useEffect(() => {
// 定义一个方法用于手动刷新 userId // 定义一个方法用于手动刷新 userId
const refreshUserId = () => setUserId(sessionStorage.getItem('userId')); const refreshUserId = () => setUserId(sessionStorage.getItem('userId'));
@ -26,7 +33,12 @@ const HeaderComponent: React.FC = () => {
<img className="logo" src={LogoImg} alt="logo" /> <img className="logo" src={LogoImg} alt="logo" />
<div className="flex"> <div className="flex">
<Language /> <Language />
{!userId ? (
<User /> <User />
) : (
<div style={{cursor: 'pointer'}} onClick={handLogout}>退</div>
)}
</div> </div>
</div> </div>
); );

View File

@ -2,6 +2,7 @@ import React, { useState, useEffect } from 'react';
import { Modal, Form, Select, Button, Tree, message, Input } from 'antd'; import { Modal, Form, Select, Button, Tree, message, Input } from 'antd';
//组件 //组件
import SupplierSelector from './SupplierSelector'; import SupplierSelector from './SupplierSelector';
import AccessDepartmentSelect from '@/components/AccessDepartmentSelect';
// 请求 // 请求
import { categoryTree, add } from '../services'; import { categoryTree, add } from '../services';
const { Option } = Select; const { Option } = Select;
@ -143,10 +144,7 @@ const CreateModal: React.FC<{ visible: boolean; onCancel: () => void; }> = ({ vi
name="deptId" name="deptId"
rules={[{ required: true, message: '请选择准入部门' }]} rules={[{ required: true, message: '请选择准入部门' }]}
> >
<Select placeholder="请选择部门"> <AccessDepartmentSelect />
<Option value="DEPT001">A</Option>
<Option value="DEPT001">B</Option>
</Select>
</Form.Item> </Form.Item>

View File

@ -6,6 +6,7 @@ import type { ColumnsType } from 'antd/es/table';
import { getApprovePage } from './services'; import { getApprovePage } from './services';
import { getDictList } from '@/servers/api/dicts' import { getDictList } from '@/servers/api/dicts'
//组件 //组件
import AccessDepartmentSelect from '@/components/AccessDepartmentSelect';
import ViewModal from './components/ViewModal'; import ViewModal from './components/ViewModal';
//统一列表分页 //统一列表分页
import tableProps from '@/utils/tableProps' import tableProps from '@/utils/tableProps'
@ -218,7 +219,7 @@ const SupplierEntryReview: React.FC = () => {
</Select> </Select>
</Form.Item> </Form.Item>
<Form.Item name="deptId" label="准入部门"> <Form.Item name="deptId" label="准入部门">
<Select options={deptOptions} allowClear style={{ width: 120 }} placeholder="请选择准入部门" /> <AccessDepartmentSelect />
</Form.Item> </Form.Item>
<Form.Item name="approveStatus" label="审批状态"> <Form.Item name="approveStatus" label="审批状态">

View File

@ -9,6 +9,8 @@ import DivisionModal from './DivisionModal';
// 请求 // 请求
import { categoryTree, add, uploadFile } from '../services'; import { categoryTree, add, uploadFile } from '../services';
import AccessDepartmentSelect from '@/components/AccessDepartmentSelect';
const { Option } = Select; const { Option } = Select;
const { RangePicker } = DatePicker; const { RangePicker } = DatePicker;
//selected 类型 //selected 类型
@ -276,10 +278,7 @@ const CreateModal: React.FC<{ visible: boolean; onCancel: () => void; }> = ({ vi
name="deptId" name="deptId"
rules={[{ required: true, message: '请选择准入部门' }]} rules={[{ required: true, message: '请选择准入部门' }]}
> >
<Select placeholder="请选择部门"> <AccessDepartmentSelect />
<Option value="DEPT001">A</Option>
<Option value="DEPT001">B</Option>
</Select>
</Form.Item> </Form.Item>
<Form.Item <Form.Item

View File

@ -150,8 +150,8 @@ const AccessManagement: React.FC = () => {
<Form.Item name="categoryId" label="准入品类"> <Form.Item name="categoryId" label="准入品类">
<CategorySelector multiple={false} style={{ width: 150 }} /> <CategorySelector multiple={false} style={{ width: 150 }} />
</Form.Item> </Form.Item>
<Form.Item name="approveStatus" label="审状态"> <Form.Item name="approveStatus" label="审状态">
<Select style={{ width: 150 }} placeholder="请选择审状态" allowClear> <Select style={{ width: 150 }} placeholder="请选择审状态" allowClear>
<Option value="0"></Option> <Option value="0"></Option>
<Option value="1"></Option> <Option value="1"></Option>
<Option value="2"></Option> <Option value="2"></Option>

View File

@ -3,7 +3,7 @@ import { Modal, Form, Input, DatePicker, Button, Tree, Select, message, Spin, Up
import { UploadOutlined } from '@ant-design/icons'; import { UploadOutlined } from '@ant-design/icons';
import { categoryTree, uploadFile, superiorLockList, getSupplierPage, library, libraryData } from '../services'; import { categoryTree, uploadFile, superiorLockList, getSupplierPage, library, libraryData } from '../services';
import type { UploadFile } from 'antd/es/upload/interface'; import type { UploadFile } from 'antd/es/upload/interface';
import AccessDepartmentSelect from '@/components/AccessDepartmentSelect';
import { getregionInternational } from '@/servers/api/register'; import { getregionInternational } from '@/servers/api/register';
const { Option } = Select; const { Option } = Select;
@ -239,14 +239,7 @@ const CategoryAddModal: React.FC<Props> = ({ visible, onCancel, onSuccess }) =>
name="applyDeptId" name="applyDeptId"
rules={[{ required: true, message: '请选择品类库负责人' }]} rules={[{ required: true, message: '请选择品类库负责人' }]}
> >
<Select <AccessDepartmentSelect />
placeholder="请选择品类库负责人"
style={{ width: 260 }}
options={deptOptions.map(item => ({
label: item.deptId,
value: item.deptId,
}))}
/>
</Form.Item> </Form.Item>
<Form.Item <Form.Item
label="选择品类" label="选择品类"

View File

@ -203,7 +203,9 @@ const SupplierAddModal: React.FC<{
showQuickJumper: true, showQuickJumper: true,
onChange: (page, pageSize) => handleTableChange({ current: page, pageSize }), onChange: (page, pageSize) => handleTableChange({ current: page, pageSize }),
}} }}
bordered style={{ flex: 1, minHeight: 0 }}
scroll={{ y: 'calc(100vh - 650px)' }}
/> />
</Spin> </Spin>
</Modal> </Modal>

View File

@ -220,7 +220,8 @@ const SupplierAddModal: React.FC<{
showQuickJumper: true, showQuickJumper: true,
onChange: (page, pageSize) => handleTableChange({ current: page, pageSize }), onChange: (page, pageSize) => handleTableChange({ current: page, pageSize }),
}} }}
bordered style={{ flex: 1, minHeight: 0 }}
scroll={{ y: 'calc(100vh - 650px)' }}
/> />
</Spin> </Spin>
</Modal> </Modal>

View File

@ -140,7 +140,8 @@ const ViewModal: React.FC<{
dataSource={categoryInfo.coscoCategoryLibrarySupplierVos} dataSource={categoryInfo.coscoCategoryLibrarySupplierVos}
rowKey="id" rowKey="id"
pagination={false} pagination={false}
bordered style={{ flex: 1, minHeight: 0 }}
scroll={{ y: 'calc(100vh - 650px)' }}
/> />

View File

@ -51,7 +51,7 @@ export async function getUserinfo() {
*/ */
export async function Logout() { export async function Logout() {
return request('/v1/login/logout', { return request('/v1/login/logout', {
method: 'GET' method: 'POST'
}); });
} }
/** /**