页面状态与 供应商入库

This commit is contained in:
孙景学
2025-08-11 14:22:12 +08:00
parent aedb63dee0
commit 0e90bdb8ea
5 changed files with 51 additions and 17 deletions

View File

@ -1,6 +1,7 @@
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { Select } from 'antd'; import { Select } from 'antd';
//字典
import { getDictList } from '@/servers/api/dicts'
interface Option { interface Option {
label: string; label: string;
value: string; value: string;
@ -9,11 +10,16 @@ interface Option {
const AdmissionTypeSelect: React.FC<any> = (props) => { const AdmissionTypeSelect: React.FC<any> = (props) => {
const [options, setOptions] = useState<Option[]>([]); const [options, setOptions] = useState<Option[]>([]);
useEffect(() => { useEffect(() => {
setOptions([ getDictList('approve_type').then((res) => {
{ label: '未准入', value: '0' }, if (res.code == 200) {
{ label: '已准入', value: '1' }, let option: Option[] = []
{ label: '退出', value: '2' }, res.data.forEach((item: { code: string, dicName: string }) => {
]); option.push({ label: item.dicName, value: item.code })
});
setOptions(option);
}
})
}, []); }, []);
return ( return (

View File

@ -16,7 +16,8 @@ import AccessDepartmentSelect from "@/components/AccessDepartmentSelect"
import { getPage, startApprove, supplierChangeApprove } from './services' import { getPage, startApprove, supplierChangeApprove } from './services'
//统一列表分页 //统一列表分页
import tableProps from '@/utils/tableProps' import tableProps from '@/utils/tableProps'
//字典
import { getDictList } from '@/servers/api/dicts'
interface Data { interface Data {
id: string; id: string;
deptId: string; deptId: string;
@ -29,6 +30,9 @@ interface Data {
const AccessManagement: React.FC = () => { const AccessManagement: React.FC = () => {
// //
const userId = sessionStorage.getItem('userId') || ''; const userId = sessionStorage.getItem('userId') || '';
const [approveTypeMap, setApproveTypeMap] = useState<{ [code: string]: string }>({});
// 查询 // 查询
const [form] = Form.useForm(); const [form] = Form.useForm();
//列表渲染数据 //列表渲染数据
@ -56,6 +60,17 @@ const AccessManagement: React.FC = () => {
useEffect(() => { useEffect(() => {
const values = form.getFieldsValue(); const values = form.getFieldsValue();
getList(values, 1, 10); getList(values, 1, 10);
getDictList('approve_type').then((res) => {
if (res.code == 200) {
const map: { [code: string]: string } = {};
res.data.forEach((item: { code: string, dicName: string }) => {
map[item.code] = item.dicName;
});
setApproveTypeMap(map);
}
})
}, []); }, []);
//开启弹窗 //开启弹窗
const openModal = (type: string, record?: any) => { const openModal = (type: string, record?: any) => {
@ -108,9 +123,10 @@ const AccessManagement: React.FC = () => {
}, },
{ {
title: '审批状态', title: '审批状态',
dataIndex: 'approveStatusText', dataIndex: 'approveStatus',
key: 'approveStatusText', key: 'approveStatus',
width: 120, width: 120,
render: (code: string) => approveTypeMap[code] || code
}, },
{ {
title: '操作', title: '操作',

View File

@ -11,7 +11,8 @@ import GroupLeaderModal from './components/GroupLeaderModal';
import ViewModal from './components/ViewModal'; import ViewModal from './components/ViewModal';
//统一列表分页 //统一列表分页
import tableProps from '@/utils/tableProps' import tableProps from '@/utils/tableProps'
//字典
import { getDictList } from '@/servers/api/dicts'
interface Data { interface Data {
deptName: string; deptName: string;
categoryName: string; categoryName: string;
@ -35,7 +36,7 @@ const CooperateEnterprise: React.FC = () => {
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [pagination, setPagination] = useState<TablePaginationConfig>({ current: 1, pageSize: 10, total: 0 }); const [pagination, setPagination] = useState<TablePaginationConfig>({ current: 1, pageSize: 10, total: 0 });
const [modalInfo, setModalInfo] = useState<ModalInfo>({ type: null, visible: false, record: null, view: false }); const [modalInfo, setModalInfo] = useState<ModalInfo>({ type: null, visible: false, record: null, view: false });
const [approveTypeMap, setApproveTypeMap] = useState<{ [code: string]: string }>({});
const openModal = (type: 'teamMembers' | 'groupLeader' | 'view', record: Data, view = false) => { const openModal = (type: 'teamMembers' | 'groupLeader' | 'view', record: Data, view = false) => {
setModalInfo({ type, visible: true, record, view }); setModalInfo({ type, visible: true, record, view });
}; };
@ -79,7 +80,17 @@ const CooperateEnterprise: React.FC = () => {
}; };
useEffect(() => { useEffect(() => {
getDictList('approve_type').then((res) => {
if (res.code == 200) {
const map: { [code: string]: string } = {};
res.data.forEach((item: { code: string, dicName: string }) => {
map[item.code] = item.dicName;
});
setApproveTypeMap(map);
}
})
getList({ pageNo: 1, pageSize: 10 }); getList({ pageNo: 1, pageSize: 10 });
}, []); }, []);
const columns: ColumnsType<Data> = [ const columns: ColumnsType<Data> = [
@ -156,9 +167,10 @@ const CooperateEnterprise: React.FC = () => {
}, },
{ {
title: '审批状态', title: '审批状态',
dataIndex: 'approveStatusText', dataIndex: 'approveStatus',
key: 'approveStatusText', key: 'approveStatus',
width: 120, width: 120,
render: (code: string) => approveTypeMap[code] || code
}, },
{ {
title: '操作', title: '操作',

View File

@ -152,9 +152,9 @@ const CategoryAddModal: React.FC<Props> = ({ visible, onCancel, onSuccess }) =>
<Form.Item <Form.Item
label="负责部门" label="负责部门"
name="deptId" name="deptId"
rules={[{ required: true, message: '请选择品类库负责人' }]} rules={[{ required: true, message: '请选择负责部门' }]}
> >
<AccessDepartmentSelect orgCategory='' style={{ width: '100%' }} /> <AccessDepartmentSelect placeholder='请选择负责部门' orgCategory='' style={{ width: '100%' }} />
</Form.Item> </Form.Item>
<Form.Item name="coscoAccessCategoryList" noStyle> <Form.Item name="coscoAccessCategoryList" noStyle>
<Input type="hidden" /> <Input type="hidden" />

View File

@ -153,7 +153,7 @@ const SupplierEntryManage: React.FC = () => {
align: 'center', align: 'center',
render: (record: any) => ( render: (record: any) => (
<> <>
{record.approveStatus === 1 && ( {record.approveStatus === 2 && (
<a <a
onClick={() => { onClick={() => {
setCurrentStoreId(record.id); setCurrentStoreId(record.id);
@ -163,7 +163,7 @@ const SupplierEntryManage: React.FC = () => {
</a> </a>
)} )}
{record.approveStatus !== 1 && ( {record.approveStatus !== 2 && (
<span style={{ color: '#a7a7a7' }}> <span style={{ color: '#a7a7a7' }}>
</span> </span>