页面状态与 供应商入库

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

View File

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

View File

@ -11,7 +11,8 @@ import GroupLeaderModal from './components/GroupLeaderModal';
import ViewModal from './components/ViewModal';
//统一列表分页
import tableProps from '@/utils/tableProps'
//字典
import { getDictList } from '@/servers/api/dicts'
interface Data {
deptName: string;
categoryName: string;
@ -35,7 +36,7 @@ const CooperateEnterprise: React.FC = () => {
const [loading, setLoading] = useState(false);
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 [approveTypeMap, setApproveTypeMap] = useState<{ [code: string]: string }>({});
const openModal = (type: 'teamMembers' | 'groupLeader' | 'view', record: Data, view = false) => {
setModalInfo({ type, visible: true, record, view });
};
@ -79,7 +80,17 @@ const CooperateEnterprise: React.FC = () => {
};
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 });
}, []);
const columns: ColumnsType<Data> = [
@ -156,9 +167,10 @@ const CooperateEnterprise: React.FC = () => {
},
{
title: '审批状态',
dataIndex: 'approveStatusText',
key: 'approveStatusText',
dataIndex: 'approveStatus',
key: 'approveStatus',
width: 120,
render: (code: string) => approveTypeMap[code] || code
},
{
title: '操作',

View File

@ -152,9 +152,9 @@ const CategoryAddModal: React.FC<Props> = ({ visible, onCancel, onSuccess }) =>
<Form.Item
label="负责部门"
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 name="coscoAccessCategoryList" noStyle>
<Input type="hidden" />

View File

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