优化与接口调试

This commit is contained in:
孙景学
2025-07-22 13:17:34 +08:00
parent c586e121fe
commit f229b9a19b
22 changed files with 249 additions and 181 deletions

View File

@ -18,6 +18,8 @@ interface Data {
createTime: string;
exitTime: string;
exitReason: string;
approveStatus: string;
lastUpdateTime: string;
id?: string;
}
@ -57,16 +59,20 @@ const CooperateEnterprise: React.FC = () => {
title: '变更标题',
dataIndex: 'title',
key: 'title',
width: 300,
ellipsis: true
},
{
title: '提交时间',
dataIndex: 'updateTime',
key: 'updateTime',
dataIndex: 'createTime',
key: 'createTime',
},
{
title: '审批单位',
dataIndex: 'deptNames',
key: 'deptNames',
width: 300,
ellipsis: true
},
{
title: '审批状态',
@ -77,10 +83,16 @@ const CooperateEnterprise: React.FC = () => {
title: '审批时间',
dataIndex: 'updateTime',
key: 'updateTime',
render: (text: string, record: Data) => {
const { approveStatus, lastUpdateTime } = record;
return approveStatus !== '0' ? lastUpdateTime : null;
},
},
{
title: '操作',
key: 'action',
width: 80,
fixed: 'right',
render: (text: string, record: Data) => (
<Button type="link" onClick={() => handleDetail(record)}>

View File

@ -1,6 +1,8 @@
import React, { useMemo } from 'react';
import { Descriptions } from 'antd';
import React, { useEffect, useState } from 'react';
import { Descriptions, Spin, message } from 'antd';
import { useIntl } from 'umi';
import { getUserInfo } from '../services';
// 性别转中文
const getGenderLabel = (sex: string | number | undefined) => {
if (sex === '1' || sex === 1) return '男';
@ -10,45 +12,53 @@ const getGenderLabel = (sex: string | number | undefined) => {
const PersonalInfo: React.FC = () => {
const intl = useIntl();
// 从缓存读取,推荐用 useMemo 保证只读一次
const localUser = useMemo(() => {
const cacheStr = sessionStorage.getItem('currentUser');
if (!cacheStr) return {};
try {
return JSON.parse(cacheStr);
} catch {
return {};
}
}, []);
// 优先显示 user其次 supplierUser
const base = localUser.user || localUser.supplierUser || {};
const [userInfo, setUserInfo] = useState<any>({});
const [loading, setLoading] = useState<boolean>(true);
useEffect(() => {
setLoading(true);
getUserInfo()
.then(res => {
if (res.code === 200 && res.data) {
setUserInfo(res.data);
} else {
message.error('获取用户信息失败');
}
})
.catch(() => {
message.error('获取用户信息失败');
})
.finally(() => {
setLoading(false);
});
}, []);
return (
<div style={{ padding: '24px 24px 0 0' }}>
<Descriptions bordered column={2} labelStyle={{ width: '120px' }}>
<Descriptions.Item label={intl.formatMessage({ id: 'page.workbench.personal.name' })}>
{base.name || '-'}
</Descriptions.Item>
<Descriptions.Item label={intl.formatMessage({ id: 'page.workbench.personal.gender' })}>
{getGenderLabel(base.sex)}
</Descriptions.Item>
<Descriptions.Item label={intl.formatMessage({ id: 'page.workbench.personal.phone' })}>
{base.mobile || base.phone || '-'}
</Descriptions.Item>
<Descriptions.Item label={intl.formatMessage({ id: 'page.workbench.personal.email' })}>
{base.email || '-'}
</Descriptions.Item>
<Descriptions.Item label={intl.formatMessage({ id: 'page.workbench.personal.department' })}>
{base.orgName || '-'}
</Descriptions.Item>
<Descriptions.Item label={intl.formatMessage({ id: 'page.workbench.personal.position' })}>
{base.position || '-'}
</Descriptions.Item>
{/* 如有入职日期再补 */}
</Descriptions>
<Spin spinning={loading}>
<Descriptions bordered column={2} labelStyle={{ width: '120px' }}>
<Descriptions.Item label={intl.formatMessage({ id: 'page.workbench.personal.name' })}>
{userInfo.contactsName || '-'}
</Descriptions.Item>
<Descriptions.Item label={intl.formatMessage({ id: 'page.workbench.personal.gender' })}>
{getGenderLabel(userInfo.sex)}
</Descriptions.Item>
<Descriptions.Item label={intl.formatMessage({ id: 'page.workbench.personal.phone' })}>
{userInfo.mobile || userInfo.contactsPhone || '-'}
</Descriptions.Item>
<Descriptions.Item label={intl.formatMessage({ id: 'page.workbench.personal.email' })}>
{userInfo.contactsEmail || '-'}
</Descriptions.Item>
<Descriptions.Item label={intl.formatMessage({ id: 'page.workbench.personal.department' })}>
{userInfo.orgName || '-'}
</Descriptions.Item>
<Descriptions.Item label={intl.formatMessage({ id: 'page.workbench.personal.position' })}>
{userInfo.position || '-'}
</Descriptions.Item>
</Descriptions>
</Spin>
</div>
);
};
export default PersonalInfo;
export default PersonalInfo;

View File

@ -1,38 +1,11 @@
import request from '@/utils/request';
export async function coscoSupplier(params:any) {
console.log(params,'params');
return request('/api/system/coscoSupplier', {
method: 'GET',
params
});
}
export async function library(params:any) {
return request('/api/system/library', {
method: 'GET',
params
});
}
export async function qualifications(params:any) {
return request('/api/system/qualifications', {
method: 'GET',
params
});
}
export async function invoice(params:any) {
return request('/api/system/invoice', {
method: 'GET',
params
});
}
export async function bank(params:any) {
return request('/api/system/bank', {
method: 'GET',
params
/**
* 用户信息
*/
export async function getUserInfo() {
return request('/coscoSupplierUser/user/info', {
method: 'GET'
});
}

View File

@ -72,16 +72,17 @@ const groupQualifiedSupplierQuery: React.FC<Props> = ({ dispatch }) => {
const [viewVisible, setViewVisible] = useState(false);
const [detailVisible, setDetailVisible] = useState(false);
const [currentRecord, setCurrentRecord] = useState<any>(null);
const orgIdStr = sessionStorage.getItem('Userinfo');
const currentUser = orgIdStr ? JSON.parse(orgIdStr) : null;
// 查询
const handleSearch = () => {
setPagination(p => ({ ...p, current: 1 }));
getList(selectedKeys);
getList(selectedKeys? selectedKeys:currentUser.organizationId);
};
const handleReset = () => {
form.resetFields();
setPagination(p => ({ ...p, current: 1 }));
getList(selectedKeys);
getList(selectedKeys? selectedKeys:currentUser.organizationId);
};
const handleTreeSelect = (keys: React.Key[]) => {
const key = keys[0] as string;
@ -110,12 +111,12 @@ const groupQualifiedSupplierQuery: React.FC<Props> = ({ dispatch }) => {
};
// 获取列表
const getList = async (deptId: string, pageNo: number = 1, pageSize: number = 10) => {
const getList = async (orgId: string, pageNo: number = 1, pageSize: number = 10) => {
setLoading(true);
try {
setDeptId(deptId)
setDeptId(orgId)
const values = form.getFieldsValue();
const { code, data, message } = await getPageQualified({ pageNo, pageSize, deptId, ...values });
const { code, data, message } = await getPageQualified({ pageNo, pageSize, orgId, ...values });
if (code === 200) {
setData(data.records);
setPagination({ current: pageNo, pageSize, total: data.total });
@ -137,9 +138,10 @@ const groupQualifiedSupplierQuery: React.FC<Props> = ({ dispatch }) => {
setDataTree(tree);
const firstLeafKey = findFirstLeafKey(tree);
if (firstLeafKey) {
setSelectedKeys(firstLeafKey);
setTreeSelected([firstLeafKey]);
getList(firstLeafKey);
// setSelectedKeys(firstLeafKey);
// setTreeSelected([firstLeafKey]);
getList(currentUser.organizationId);
}
}
}).finally(() => {
@ -250,7 +252,7 @@ const groupQualifiedSupplierQuery: React.FC<Props> = ({ dispatch }) => {
<Button className="buttonOther" type="primary" onClick={() => {
const values = form.getFieldsValue();
values.deptId = DeptId;
values.orgId = DeptId? DeptId: currentUser.organizationId;
downloadFile('/coscoSupplierBase/getPageQualifiedExport', 'GET', values);
// window.open(`${SERVER_BASE}/coscoSupplierBase/getPageQualifiedExport`, '_blank');

View File

@ -7,6 +7,7 @@ interface getPageQualified {
pageNo: number;
pageSize: number;
deptId?: string;
orgId?: string;
}
export const getPageQualified = (data: getPageQualified) => request.post('/coscoSupplierBase/getPageQualified', { data });

View File

@ -73,16 +73,17 @@ const PersonQualifiedSupplierQuery: React.FC<Props> = ({ dispatch }) => {
const [viewVisible, setViewVisible] = useState(false);
const [detailVisible, setDetailVisible] = useState(false);
const [currentRecord, setCurrentRecord] = useState<any>(null);
const orgIdStr = sessionStorage.getItem('Userinfo');
const currentUser = orgIdStr ? JSON.parse(orgIdStr) : null;
// 查询
const handleSearch = () => {
setPagination(p => ({ ...p, current: 1 }));
getList(selectedKeys);
getList(selectedKeys? selectedKeys:currentUser.organizationId);
};
const handleReset = () => {
form.resetFields();
setPagination(p => ({ ...p, current: 1 }));
getList(selectedKeys);
getList(selectedKeys? selectedKeys:currentUser.organizationId);
};
const handleTreeSelect = (keys: React.Key[]) => {
@ -110,12 +111,12 @@ const PersonQualifiedSupplierQuery: React.FC<Props> = ({ dispatch }) => {
}
};
const getList = async (deptId: string, pageNo: number = 1, pageSize: number = 10) => {
const getList = async (orgId: string, pageNo: number = 1, pageSize: number = 10) => {
setLoading(true);
try {
setDeptId(deptId)
setDeptId(orgId)
const values = form.getFieldsValue();
const { code, data, message } = await getPagePe({ pageNo, pageSize, deptId, ...values });
const { code, data, message } = await getPagePe({ pageNo, pageSize, orgId, ...values });
if (code === 200) {
setData(data.records);
setPagination({ current: pageNo, pageSize, total: data.total });
@ -137,9 +138,9 @@ const PersonQualifiedSupplierQuery: React.FC<Props> = ({ dispatch }) => {
setDataTree(tree);
const firstLeafKey = findFirstLeafKey(tree);
if (firstLeafKey) {
setSelectedKeys(firstLeafKey);
setTreeSelected([firstLeafKey]);
getList(firstLeafKey);
// setSelectedKeys(firstLeafKey);
// setTreeSelected([firstLeafKey]);
getList(currentUser.organizationId);
}
}
}).finally(() => {
@ -225,6 +226,7 @@ const PersonQualifiedSupplierQuery: React.FC<Props> = ({ dispatch }) => {
<Button className="buttonOther" type="primary" onClick={() => {
const values = form.getFieldsValue();
values.deptId = DeptId;
values.orgId = DeptId? DeptId: currentUser.organizationId;
downloadFile('/coscoSupplierBase/getPagePeExport', 'GET', values);
}}>

View File

@ -7,6 +7,7 @@ interface getPagePe {
pageNo: number;
pageSize: number;
deptId?: string;
orgId?: string;
}
export const getPagePe = (data: getPagePe) => request.post('/coscoSupplierBase/getPagePe', { data });

View File

@ -103,16 +103,18 @@ const blacklistManage: React.FC = () => {
width: 60,
render: (_: any, __: any, idx: number) => (((pagination.current ?? 1) - 1) * (pagination.pageSize ?? 10)) + idx + 1,
},
{ title: "申请主题", dataIndex: "themeName", key: "themeName", align: "left", ellipsis: true },
{ title: "发起单位", dataIndex: "unitName", key: "unitName", align: "center" },
{ title: "发起部门", dataIndex: "deptName", key: "deptName", align: "center" },
{ title: "发起时间", dataIndex: "createTime", key: "createTime", align: "center", width: 180 },
{ title: "审批记录状态", dataIndex: "approveStatusName", key: "approveStatusName", align: "center" },
{ title: "申请主题", dataIndex: "themeName", key: "themeName", align: "center", width: 120, ellipsis: true },
{ title: "发起单位", dataIndex: "unitName", key: "unitName", align: "center", width: 180, ellipsis: true },
{ title: "发起部门", dataIndex: "deptName", key: "deptName", align: "center", width: 180, ellipsis: true },
{ title: "发起时间", dataIndex: "createTime", key: "createTime", align: "center", width: 180 },
{ title: "审批记录状态", dataIndex: "approveStatusName", key: "approveStatusName", align: "center", width: 180 },
{
title: "操作",
key: "option",
align: "center",
width: 180,
fixed: 'right',
render: (record: any) => {
const showSubmit = record.approveStatus;
const showRestoreSubmi = record.restoreApproveStatus;

View File

@ -97,15 +97,18 @@ const blacklistManage: React.FC = () => {
width: 60,
render: (_: any, __: any, idx: number) => (((pagination.current ?? 1) - 1) * (pagination.pageSize ?? 10)) + idx + 1,
},
{ title: "申请主题", dataIndex: "themeName", key: "themeName", align: "left", ellipsis: true },
{ title: "发起单位", dataIndex: "unitName", key: "unitName", align: "center" },
{ title: "发起部门", dataIndex: "deptName", key: "deptName", align: "center" },
{ title: "发起时间", dataIndex: "createTime", key: "createTime", align: "center", width: 180 },
{ title: "审批记录状态", dataIndex: "approveStatusName", key: "approveStatusName", align: "center" },
{ title: "申请主题", dataIndex: "themeName", key: "themeName", align: "center", width: 120, ellipsis: true },
{ title: "发起单位", dataIndex: "unitName", key: "unitName", align: "center", width: 180, ellipsis: true },
{ title: "发起部门", dataIndex: "deptName", key: "deptName", align: "center", width: 180, ellipsis: true },
{ title: "发起时间", dataIndex: "createTime", key: "createTime", align: "center", width: 180 },
{ title: "审批记录状态", dataIndex: "approveStatusName", key: "approveStatusName", align: "center", width: 180 },
{
title: "操作",
key: "option",
align: "center",
width: 100,
fixed: 'right',
render: (record: any) => (
<a
onClick={() => {

View File

@ -93,15 +93,17 @@ const supplierExitAudit: React.FC = () => {
width: 60,
render: (_: any, __: any, idx: number) => (((pagination.current ?? 1) - 1) * (pagination.pageSize ?? 10)) + idx + 1,
},
{ title: "申请主题", dataIndex: "exitTheme", key: "exitTheme", align: "left", ellipsis: true },
{ title: "发起单位", dataIndex: "orgName", key: "orgName", align: "center" },
{ title: "发起部门", dataIndex: "deptName", key: "deptName", align: "center" },
{ title: "发起时间", dataIndex: "createTime", key: "createTime", align: "center", width: 180 },
{ title: "审批记录状态", dataIndex: "approveStatusText", key: "approveStatusText", align: "center" },
{ title: "申请主题", dataIndex: "exitTheme", key: "exitTheme", align: "center", width: 120, ellipsis: true },
{ title: "发起单位", dataIndex: "orgName", key: "orgName", align: "center", width: 180, ellipsis: true },
{ title: "发起部门", dataIndex: "deptName", key: "deptName", align: "center", width: 180, ellipsis: true },
{ title: "发起时间", dataIndex: "createTime", key: "createTime", align: "center", width: 180 },
{ title: "审批记录状态", dataIndex: "approveStatusText", key: "approveStatusText", align: "center", width: 180 },
{
title: "操作",
key: "option",
align: "center",
width: 100,
fixed: 'right',
render: (record: any) => (
<a
onClick={() => {

View File

@ -37,7 +37,7 @@ const CreateBlacklistModal: React.FC<CreateBlacklistModalProps> = ({
const [suppliers, setSuppliers] = useState<Supplier[]>([]);
// 获取缓存 用户单位ID
const [userDeptId, setUserDeptId] = useState('');
const currentUserStr = sessionStorage.getItem('currentUser');
const currentUserStr = sessionStorage.getItem('Userinfo');
const currentUser = currentUserStr ? JSON.parse(currentUserStr) : null;
//提交防抖
const [submitting, setSubmitting] = useState(false);
@ -65,7 +65,7 @@ const CreateBlacklistModal: React.FC<CreateBlacklistModalProps> = ({
coscoSupplierexit: {
exitTheme: string;
exitReason: string;
deptId: string;
orgId: string;
},
supplierIdList: string[],
coscoSupplierexitSupplierCategoryList: { supplierId: string; categoryId: string; }[];
@ -91,16 +91,16 @@ const CreateBlacklistModal: React.FC<CreateBlacklistModalProps> = ({
if (visible) {
setSuppliers([]);
form.resetFields();
setUserDeptId(currentUser?.user?.orgId || '');
setUserDeptId(currentUser?.organizationId || '');
// 设置表单的初始单位
form.setFieldsValue({ deptId: currentUser?.user?.orgId || '' });
form.setFieldsValue({ orgId: currentUser?.organizationId || '' });
}
}, [visible]);
//列表头
const columns: ColumnsType<Supplier> = [
{ title: "供应商名称", dataIndex: "supplierName", align: "center" },
{ title: "准入部门", dataIndex: "deptId", align: "center" },
{ title: "准入部门", dataIndex: "deptName", align: "center" },
{ title: "准入时间", dataIndex: "createTime", align: "center" },
{ title: "准入品类", dataIndex: "categoryName", align: "center" },
{
@ -153,10 +153,10 @@ const CreateBlacklistModal: React.FC<CreateBlacklistModalProps> = ({
<Form.Item
label="发起单位"
name="deptId"
name="orgId"
rules={[{ required: true, message: '请选择发起单位' }]}
>
<AccessDepartmentSelect value={userDeptId} placeholder={'请选择发起单位'} />
<AccessDepartmentSelect value={userDeptId} disabled={true} style={{width: '100%'}} placeholder={'请选择发起单位'} />
</Form.Item>
<Form.Item

View File

@ -92,15 +92,17 @@ const supplierExitManage: React.FC = () => {
width: 60,
render: (_: any, __: any, idx: number) => (((pagination.current ?? 1) - 1) * (pagination.pageSize ?? 10)) + idx + 1,
},
{ title: "申请主题", dataIndex: "exitTheme", key: "exitTheme", align: "center" },
{ title: "发起单位", dataIndex: "orgName", key: "orgName", align: "center" },
{ title: "发起部门", dataIndex: "deptName", key: "deptName", align: "center" },
{ title: "发起时间", dataIndex: "createTime", key: "createTime", align: "center" },
{ title: "审批记录状态", dataIndex: "approveStatusText", key: "approveStatusText", align: "center" },
{ title: "申请主题", dataIndex: "exitTheme", key: "exitTheme", align: "center", width: 120, ellipsis: true },
{ title: "发起单位", dataIndex: "orgName", key: "orgName", align: "center", width: 180, ellipsis: true },
{ title: "发起部门", dataIndex: "deptName", key: "deptName", align: "center", width: 180, ellipsis: true },
{ title: "发起时间", dataIndex: "createTime", key: "createTime", align: "center", width: 180 },
{ title: "审批记录状态", dataIndex: "approveStatusText", key: "approveStatusText", align: "center", width: 180 },
{
title: "操作",
key: "option",
align: "center",
width: 100,
fixed: 'right',
render: (record: any) => (
<a
onClick={() => {
@ -158,6 +160,8 @@ const supplierExitManage: React.FC = () => {
loading={loading}
pagination={{...tableProps.pagination, total: pagination.total }}
onChange={handleTableChange}
style={{ flex: 1, minHeight: 0 }}
scroll={{ y: 'calc(100vh - 350px)' }}
/>
</div>
<CreateBlacklistModal visible={createVisible} onCancel={() => setCreateVisible(false)} onOk={handleSelectOk} />

View File

@ -62,7 +62,8 @@ export interface addInterface {
}
export interface CoscoSupplierexit {
deptId: string;
deptId?: string;
orgId?: string;
exitReason: string;
exitTheme: string;
[property: string]: any;