合并代码

This commit is contained in:
孙景学
2025-07-02 16:18:03 +08:00
parent 2b3eb5672d
commit 3ae57eb23b
87 changed files with 3852 additions and 19276 deletions

View File

@ -5,6 +5,7 @@ import type { ColumnsType, TablePaginationConfig } from 'antd/es/table';
import ViewModal from './components/ViewModal';
//发起准入 弹窗
import CreateModal from './components/CreateModal';
import CategorySelector from '@/components/CategorySelector';
import { getPage, startApprove } from './services'
@ -30,7 +31,7 @@ const SupplierCategoryEntry: React.FC = () => {
//列表加载
const [loading, setLoading] = useState(false);
// 列表方法
const getList = async (values: any = {},pageNo: number = 1, pageSize: number = 10) => {
const getList = async (values: any = {}, pageNo: number = 1, pageSize: number = 10) => {
setLoading(true);
try {
const { code, data } = await getPage({ ...values, pageNo, pageSize });
@ -89,10 +90,10 @@ const SupplierCategoryEntry: React.FC = () => {
render: (_: any, record: any) => (
<Space>
<a onClick={() => openModal('view', record)}></a>
{ ( !record.approveStatusText) && (
<a onClick={() => handleApproval(record.id)}>
{(!record.approveStatusText) && (
<a onClick={() => handleApproval(record.id)}>
</a>
</a>
)}
</Space>
),
@ -103,34 +104,35 @@ const SupplierCategoryEntry: React.FC = () => {
<>
<Form layout="inline" form={form} onFinish={getList}>
<Form.Item name="accessType" label="准入方式">
<Select style={{ width: 150 }} placeholder="请选择">
<Option value="线上">线</Option>
<Option value="线下">线</Option>
<Select style={{ width: 150 }} placeholder="请选择准入方式" allowClear >
<Option value="online">线</Option>
<Option value="offline">线</Option>
</Select>
</Form.Item>
<Form.Item name="deptId" label="准入单位">
<Select style={{ width: 150 }} placeholder="请选择">
<Option value="单位A">A</Option>
<Option value="单位B">B</Option>
<Select style={{ width: 150 }} placeholder="请选择" allowClear>
</Select>
</Form.Item>
<Form.Item name="categoryId" label="准入品类">
<Select style={{ width: 150 }} placeholder="请选择">
<Option value="品类1">1</Option>
<Option value="品类2">2</Option>
</Select>
<CategorySelector multiple={false} style={{ width: 150 }} />
</Form.Item>
<Form.Item name="approveStatus" label="状态">
<Select style={{ width: 150 }} placeholder="请选择">
<Option value="草稿">稿</Option>
<Option value="已提交"></Option>
<Select style={{ width: 150 }} placeholder="请选择状态" allowClear>
<Option value="0"></Option>
<Option value="1"></Option>
<Option value="2"></Option>
<Option value="3"></Option>
</Select>
</Form.Item>
<Form.Item>
<Button type="primary" htmlType="submit"></Button>
</Form.Item>
<Form.Item>
<Button onClick={() => form.resetFields()}></Button>
<Button onClick={() => {
form.resetFields()
const values = form.getFieldsValue();
getList(values, 1, 10);
} }></Button>
</Form.Item>
</Form>
<div style={{ marginTop: 16, marginBottom: 16 }}>

View File

@ -3,6 +3,7 @@ import { Form, Select, Button, Table, Space, Modal, message } from 'antd';
import type { ColumnsType, TablePaginationConfig } from 'antd/es/table';
//查看弹窗
import ViewModal from './components/ViewModal';
import CategorySelector from '@/components/CategorySelector';
import { getPage } from './services'
@ -82,35 +83,36 @@ const SupplierCategoryEntryReview: React.FC = () => {
return (
<>
<Form layout="inline" form={form} onFinish={getList}>
<Form.Item name="accessType" label="准入方式">
<Select style={{ width: 150 }} placeholder="请选择">
<Option value="线上">线</Option>
<Option value="线下">线</Option>
<Form.Item name="accessType" label="准入方式">
<Select style={{ width: 150 }} placeholder="请选择准入方式" allowClear >
<Option value="online">线</Option>
<Option value="offline">线</Option>
</Select>
</Form.Item>
<Form.Item name="deptId" label="准入单位">
<Select style={{ width: 150 }} placeholder="请选择">
<Option value="单位A">A</Option>
<Option value="单位B">B</Option>
<Select style={{ width: 150 }} placeholder="请选择" allowClear>
</Select>
</Form.Item>
<Form.Item name="categoryId" label="准入品类">
<Select style={{ width: 150 }} placeholder="请选择">
<Option value="品类1">1</Option>
<Option value="品类2">2</Option>
</Select>
<CategorySelector multiple={false} style={{ width: 150 }} />
</Form.Item>
<Form.Item name="approveStatus" label="状态">
<Select style={{ width: 150 }} placeholder="请选择">
<Option value="草稿">稿</Option>
<Option value="已提交"></Option>
<Select style={{ width: 150 }} placeholder="请选择状态" allowClear>
<Option value="0"></Option>
<Option value="1"></Option>
<Option value="2"></Option>
<Option value="3"></Option>
</Select>
</Form.Item>
<Form.Item>
<Button type="primary" htmlType="submit"></Button>
</Form.Item>
<Form.Item>
<Button onClick={() => form.resetFields()}></Button>
<Button onClick={() => {
form.resetFields()
const values = form.getFieldsValue();
getList(values, 1, 10);
}}></Button>
</Form.Item>
</Form>
<Table

View File

@ -38,8 +38,6 @@ const ViewModal: React.FC<{
const [data, setData] = useState<Data | null>(null);
//初始化
useEffect(() => {
console.log(record,'record2');
if (record) {
coscoAccessWork(record).then((res) => {
const { code, data } = res;

View File

@ -4,7 +4,7 @@ import { SearchOutlined, ReloadOutlined } from '@ant-design/icons';
import { getApprovePage } from './services';
import type { ColumnsType } from 'antd/es/table';
import ViewModal from './components/ViewModal';
const { Option } = Select;
interface SupplierEntryReviewRecord {
id: string;
accessWorkName: string; // 准入工作
@ -18,7 +18,7 @@ interface SupplierEntryReviewRecord {
updateTime: string; // 更新时间
[key: string]: any; // 允许有其它字段
}
interface ModalInfo {
visible: boolean;
record: string | null;
@ -54,7 +54,7 @@ const SupplierEntryReview: React.FC = () => {
const [data, setData] = useState<any[]>([]);
const [pagination, setPagination] = useState({ current: 1, pageSize: 10, total: 0 });
const [loading, setLoading] = useState(false);
const [modalInfo, setModalInfo] = useState<ModalInfo>({ visible: false, record: null });
const [modalInfo, setModalInfo] = useState<ModalInfo>({ visible: false, record: null });
// 查询数据
const fetchData = async (params = {}) => {
setLoading(true);
@ -86,7 +86,6 @@ const SupplierEntryReview: React.FC = () => {
useEffect(() => {
fetchData({ pageNo: 1 });
// eslint-disable-next-line
}, []);
// 表格分页切换
@ -115,18 +114,18 @@ const SupplierEntryReview: React.FC = () => {
fetchData({ pageNo: 1 });
};
const openModal = (record: string) => {
setModalInfo({visible: true, record});
setModalInfo({ visible: true, record });
};
const closeModal = () => {
setModalInfo({ visible: false, record: null });
setModalInfo({ visible: false, record: null });
};
const columns:ColumnsType<SupplierEntryReviewRecord> = [
const columns: ColumnsType<SupplierEntryReviewRecord> = [
{
title: '序号',
dataIndex: 'index',
width: 48,
align: 'center',
render: (_: any, __: any, idx: number) => idx + 1,
render: (_: any, __: any, idx: number) => (((pagination.current ?? 1) - 1) * (pagination.pageSize ?? 10)) + idx + 1,
},
{
title: '准入工作',
@ -138,7 +137,6 @@ const SupplierEntryReview: React.FC = () => {
title: '准入部门',
dataIndex: 'deptId',
align: 'center',
render: (deptId: string) => deptId === 'DEPT001' ? '采购部' : deptId === 'DEPT002' ? '业务部' : deptId,
},
{
title: '准入方式',
@ -166,17 +164,22 @@ const SupplierEntryReview: React.FC = () => {
dataIndex: 'reviewStatusText',
align: 'center',
},
{
title: '审核',
dataIndex: 'approveStatusText',
align: 'center',
},
{
title: '操作',
width: 120,
render: (_: any, record: any) => {
console.log(record,'record');
return (
<Space>
<a onClick={() => openModal(record.id)}></a>
</Space>
)
console.log(record, 'record');
return (
<Space>
<a onClick={() => openModal(record.id)}></a>
</Space>
)
},
},
];
@ -188,14 +191,23 @@ const SupplierEntryReview: React.FC = () => {
style={{ marginBottom: 16 }}
onFinish={handleSearch}
>
<Form.Item name="accessTypeText" label="准入方式">
<Select options={methodOptions} allowClear style={{ width: 120 }} />
<Form.Item name="accessType" label="准入方式">
<Select style={{ width: 150 }} placeholder="请选择准入方式" allowClear >
<Option value="online">线</Option>
<Option value="offline">线</Option>
</Select>
</Form.Item>
<Form.Item name="deptId" label="准入部门">
<Select options={deptOptions} allowClear style={{ width: 120 }} />
<Select options={deptOptions} allowClear style={{ width: 120 }} placeholder="请选择准入部门" />
</Form.Item>
<Form.Item name="reviewStatusText" label="流程状态">
<Select options={statusOptions} allowClear style={{ width: 120 }} />
<Form.Item name="approveStatus" label="流程状态">
<Select style={{ width: 150 }} placeholder="请选择状态" allowClear>
<Option value="0"></Option>
<Option value="1"></Option>
<Option value="2"></Option>
<Option value="3"></Option>
</Select>
</Form.Item>
<Form.Item>
<Button type="primary" htmlType="submit" icon={<SearchOutlined />} style={{ marginRight: 8 }}>
@ -220,13 +232,12 @@ const SupplierEntryReview: React.FC = () => {
showSizeChanger: true,
}}
onChange={handleTableChange}
bordered
/>
<ViewModal
visible={modalInfo.visible}
record={modalInfo.record}
onCancel={closeModal}
/>
<ViewModal
visible={modalInfo.visible}
record={modalInfo.record}
onCancel={closeModal}
/>
</div>
);
};

View File

@ -52,7 +52,6 @@ const ApproveModal: React.FC<{
dispatch({
type: 'globalModal/show',
payload: {
title: '用户信息',
id: supplier.key,
},
});

View File

@ -1,6 +1,5 @@
import React, { useState, useEffect } from 'react';
import { Modal, Form, Select, Button, Tree, message, DatePicker, Radio, Upload, Input } from 'antd';
//
import { UploadOutlined } from '@ant-design/icons';
import type { UploadFile } from 'antd/es/upload/interface';
//组件
@ -82,7 +81,7 @@ const CreateModal: React.FC<{ visible: boolean; onCancel: () => void; }> = ({ vi
? checkedKeysValue
: checkedKeysValue.checked;
// 只取叶子节点 key
// 只取叶子节点 key
const leafKeys = findLeafKeys(convertTreeData(categoriesTreeData));
const onlyLeafChecked = keys.filter(key => leafKeys.includes(String(key)));
@ -115,7 +114,7 @@ const CreateModal: React.FC<{ visible: boolean; onCancel: () => void; }> = ({ vi
try {
// 1. 调用你自己写的上传接口
const res = await uploadFile(file);
// 2. 可根据后端返回结构,给 fileList 项增加 url 或其他字段
const uploadedFile: UploadFile = {
...file,
@ -144,12 +143,12 @@ const CreateModal: React.FC<{ visible: boolean; onCancel: () => void; }> = ({ vi
accessType: string;
accessWorkName: string;
deptId: string;
};
categoryIds: string[];
supplierIds: string[];
coscoAccessUserls: { userId: string; deptId: string; isLeader: number }[];
coscoAccessItems: { itemName: string; reviewBy: string[] }[];
coscoAccessWorkAttachments: any;
};
categoryIds: string[];
supplierIds: string[];
coscoAccessUserls: { userId: string; deptId: string; isLeader: number }[];
coscoAccessItems: { itemName: string; reviewBy: string[] }[];
coscoAccessWorkAttachments: any;
} = {
coscoAccessWork: {
startTime: '',
@ -174,12 +173,9 @@ const CreateModal: React.FC<{ visible: boolean; onCancel: () => void; }> = ({ vi
//品类选择
finalPayload.categoryIds = values.categoryIds;
//选择供应商
if(values.supplier.length != 0) {
values.supplier.forEach((item: { id: string }) => {
finalPayload.supplierIds.push(item.id)
})
}
values.supplier.forEach((item: { id: string }) => {
finalPayload.supplierIds.push(item.id)
})
if (values.accessType === 'online') {
// 评审时间
if (values.rangePicker && values.rangePicker.length === 2) {
@ -188,8 +184,8 @@ const CreateModal: React.FC<{ visible: boolean; onCancel: () => void; }> = ({ vi
finalPayload.coscoAccessWork.endTime = end.format('YYYY-MM-DD HH:mm');
}
//选择评审人员
finalPayload.coscoAccessUserls = values.reviewers.selected.map((item:{ userId:string, deptId:string,isLeader:number }) => {
return { userId: item.userId, deptId: item.deptId, isLeader: item.isLeader }
finalPayload.coscoAccessUserls = values.reviewers.selected.map((item: { userId: string, deptId: string, isLeader: number }) => {
return { userId: item.userId, deptId: item.deptId, isLeader: item.isLeader }
});
//评审分工
values.division.forEach((item: any) => {
@ -207,7 +203,6 @@ const CreateModal: React.FC<{ visible: boolean; onCancel: () => void; }> = ({ vi
finalPayload.coscoAccessWorkAttachments = values.supplierCompliance[0].response
}
console.log( finalPayload, values);
const res = await add(finalPayload);
if (res?.success) {
message.success('创建成功');
@ -255,6 +250,7 @@ const CreateModal: React.FC<{ visible: boolean; onCancel: () => void; }> = ({ vi
onFinish={onFinish}
labelCol={{ span: 5 }}
wrapperCol={{ span: 19 }}
initialValues={{ accessType: 'online' }}
>
<Form.Item
label="标题名称"
@ -392,11 +388,32 @@ const CreateModal: React.FC<{ visible: boolean; onCancel: () => void; }> = ({ vi
<Form.Item
label="评审分工"
name="division"
rules={[{ required: true, message: '请设置评审分工' }]}
rules={[
{
required: true,
message: '请设置评审分工',
},
{
validator: (_, value) => {
if (!value || !Array.isArray(value) || value.length === 0) {
return Promise.reject(new Error('请设置评审分工'));
}
// 判断所有分工的checkbox数量总和是否≥1
let checkedCount = 0;
for (const row of value) {
checkedCount += Object.values(row.reviewerChecks || {}).filter(Boolean).length;
}
if (checkedCount < 1) {
return Promise.reject(new Error('至少分配一名评审人'));
}
return Promise.resolve();
}
}
]}
>
<Button onClick={() => {
if (selectedReviewers.selected.length != 0) {
setDivisionModalVisible(true)
if (selectedReviewers.selected.length !== 0) {
setDivisionModalVisible(true);
} else {
message.warning('请选择评审人员');
}
@ -439,9 +456,9 @@ const CreateModal: React.FC<{ visible: boolean; onCancel: () => void; }> = ({ vi
<ReviewerSelector
visible={reviewerModalVisible}
onCancel={() => setReviewerModalVisible(false)}
selected={selectedReviewers.selected.map(i => i.userId)}
leader={selectedReviewers.leader?.userId}
onSelect={(result) => {
console.log(result,'result');
setSelectedReviewers(result);
form.setFieldsValue({ reviewers: result });
setReviewerModalVisible(false);

View File

@ -1,5 +1,5 @@
import React, { useState, useMemo } from 'react';
import { Modal, Table, Input, Button, Checkbox } from 'antd';
import { Modal, Table, Input, Button, Checkbox, message } from 'antd';
import type { ColumnsType } from 'antd/es/table';
//selected 类型
@ -139,7 +139,15 @@ const DivisionModal: React.FC<{
<Button
type="primary"
onClick={() => {
onSelect?.(data); // 回传分工数据
// 校验每一行的itemName非空
for (const row of data) {
if (!row.itemName || row.itemName.trim() === '') {
// 定位到哪一行也可用message.warning(`第${index+1}行未填写评审项`);
message.warning('请填写所有评审项名称');
return;
}
}
onSelect?.(data);
onCancel();
}}
>

View File

@ -1,11 +1,12 @@
import React, { useEffect, useState } from 'react';
import { Modal, Table, Button, Select, Spin, message } from 'antd';
import { reviewInfoData } from '../services';
import { reviewInfoData } from '../services';
import { connect } from 'umi';
interface ResultModalProps {
visible: boolean;
record?: { id?: string; [key: string]: any } | null;
record?: { id?: string;[key: string]: any } | null;
onCancel: () => void;
dispatch: any;
}
// 只读备注弹窗
@ -14,7 +15,7 @@ const RemarkViewModal: React.FC<{
onCancel: () => void;
remark: string;
file?: any;
}> = ({ visible, onCancel, remark, file }) => (
}> = ({ visible, onCancel, remark, file, }) => (
<Modal
visible={visible}
title="备注信息"
@ -42,6 +43,7 @@ const ResultModal: React.FC<ResultModalProps> = ({
visible,
record,
onCancel,
dispatch
}) => {
const [loading, setLoading] = useState(false);
const [suppliers, setSuppliers] = useState<any[]>([]);
@ -49,7 +51,6 @@ const ResultModal: React.FC<ResultModalProps> = ({
const [groupSummaryResult, setGroupSummaryResult] = useState<{ [k: string]: '0' | '1' | undefined }>({});
// 查看备注弹窗
const [remarkModal, setRemarkModal] = useState({ open: false, remark: '', file: undefined as any });
// 拉取数据
useEffect(() => {
if (visible && record?.id) {
@ -67,7 +68,7 @@ const ResultModal: React.FC<ResultModalProps> = ({
supplierList.forEach((sup: any) => {
// summary 行
const summaryItem = (sup.coscoAccessItemList || []).find((i: any) => i.itemType === 'summary');
console.log(summaryItem,'summaryItem');
console.log(summaryItem, 'summaryItem');
summaryMap[sup.supplierId] = summaryItem.coscoAccessUserItemList[0]?.reviewResult;
});
setGroupSummaryResult(summaryMap);
@ -79,8 +80,8 @@ const ResultModal: React.FC<ResultModalProps> = ({
setGroupSummaryResult({});
}
}, [visible, record]);
// 构造二级表头
const columns: any[] = [
@ -102,10 +103,23 @@ const ResultModal: React.FC<ResultModalProps> = ({
}
});
const reviewers = Array.from(reviewerSet);
console.log(sup, 'sup');
return {
title: (
<div>
<div style={{ fontWeight: 600 }}>{sup.supplierName}</div>
<a
onClick={() => {
dispatch({
type: 'globalModal/show',
payload: {
id: sup.supplierId,
},
});
}}
>
{sup.supplierName}
</a>
</div>
),
children: reviewers.map((reviewBy: string) => ({
@ -125,8 +139,8 @@ const ResultModal: React.FC<ResultModalProps> = ({
{userItem.reviewResult === '0'
? <span style={{ color: '#52c41a' }}></span>
: userItem.reviewResult === '1'
? <span style={{ color: '#f5222d' }}></span>
: ''}
? <span style={{ color: '#f5222d' }}></span>
: ''}
{userItem.remark && (
<Button type="link" size="small" onClick={() =>
setRemarkModal({ open: true, remark: userItem.remark, file: userItem.coscoAccessTtemAttachments })
@ -179,10 +193,10 @@ const ResultModal: React.FC<ResultModalProps> = ({
}
});
const colSpan = reviewerSet.size || 1;
return (
<Table.Summary.Cell index={index} key={sup.supplierId} colSpan={colSpan} align="center">
<span style={{color: groupSummaryResult[sup.supplierId] === '0'? '#52c41a': '#f5222d' }}> {groupSummaryResult[sup.supplierId] === '0'? '合格': '不合格'}</span>
<span style={{ color: groupSummaryResult[sup.supplierId] === '0' ? '#52c41a' : '#f5222d' }}> {groupSummaryResult[sup.supplierId] === '0' ? '合格' : '不合格'}</span>
</Table.Summary.Cell>
)
})}
@ -222,4 +236,4 @@ const ResultModal: React.FC<ResultModalProps> = ({
);
};
export default ResultModal;
export default connect()(ResultModal);

View File

@ -19,6 +19,8 @@ interface ReviewerSelectorProps {
visible: boolean;
onCancel: () => void;
onSelect?: (selected: ReviewerSelectorData) => void;
selected?: string[]; // 回显已选userId数组
leader?: string; // 回显组长userId
}
// 模拟分页接口
@ -50,6 +52,8 @@ const ReviewerSelector: React.FC<ReviewerSelectorProps> = ({
visible,
onCancel,
onSelect,
selected = [],
leader: leaderFromProps,
}) => {
// 分页
const [page, setPage] = useState<number>(1);
@ -60,9 +64,19 @@ const ReviewerSelector: React.FC<ReviewerSelectorProps> = ({
const [data, setData] = useState<Reviewer[]>([]);
const [loading, setLoading] = useState<boolean>(false);
// 已选评审人 & 组长
// 本地已选 & 组长
const [selectedRowKeys, setSelectedRowKeys] = useState<React.Key[]>([]);
const [leader, setLeader] = useState<string>('');
const [leaderUserId, setLeaderUserId] = useState<string>('');
// 回显
useEffect(() => {
if (visible) {
setSelectedRowKeys(selected);
setLeaderUserId(leaderFromProps || '');
setPage(1); // 可选:每次打开回第一页
}
// eslint-disable-next-line
}, [visible]); // 只在弹窗显示时同步 props
// 加载数据
useEffect(() => {
@ -92,8 +106,8 @@ const ReviewerSelector: React.FC<ReviewerSelectorProps> = ({
render: (_: any, record: Reviewer) => (
<Radio
disabled={!selectedRowKeys.includes(record.userId)}
checked={leader === record.userId}
onChange={() => setLeader(record.userId)}
checked={leaderUserId === record.userId}
onChange={() => setLeaderUserId(record.userId)}
/>
),
},
@ -105,7 +119,11 @@ const ReviewerSelector: React.FC<ReviewerSelectorProps> = ({
message.warning('请先选择评审人员');
return;
}
if (!leader) {
if (selectedRowKeys.length < 2) {
message.warning('请至少选择2个评审人员');
return;
}
if (!leaderUserId) {
message.warning('请指定组长');
return;
}
@ -114,7 +132,7 @@ const ReviewerSelector: React.FC<ReviewerSelectorProps> = ({
.filter((item) => selectedRowKeys.includes(item.userId))
.map((item) => ({
...item,
isLeader: item.userId === leader ? 1 : 0,
isLeader: item.userId === leaderUserId ? 1 : 0,
}));
// 完整数据传回
@ -141,12 +159,8 @@ const ReviewerSelector: React.FC<ReviewerSelectorProps> = ({
onChange: (keys) => {
setSelectedRowKeys(keys);
// 如果组长不在新选中里,清掉
if (!keys.includes(leader)) setLeader('');
if (!keys.includes(leaderUserId)) setLeaderUserId('');
},
getCheckboxProps: (record) => ({
// 可根据需要禁用某些行
// disabled: record.disabled,
}),
}}
columns={columns}
dataSource={data}

View File

@ -11,6 +11,7 @@ import RecordModal from './components/RecordModal';
import ResultModal from './components/ResultModal';
//发起准入 弹窗
import CreateModal from './components/CreateModal';
import CategorySelector from '@/components/CategorySelector';
import { getPage, startApprove } from './services'
@ -36,7 +37,7 @@ const AccessManagement: React.FC = () => {
//列表加载
const [loading, setLoading] = useState(false);
// 列表方法
const getList = async (values: any = {},pageNo: number = 1, pageSize: number = 10) => {
const getList = async (values: any = {}, pageNo: number = 1, pageSize: number = 10) => {
setLoading(true);
try {
const { code, data } = await getPage({ ...values, pageNo, pageSize });
@ -81,7 +82,7 @@ const AccessManagement: React.FC = () => {
{
title: '序号',
dataIndex: 'index',
render: (_: any, __: any, index: number) => index + 1,
render: (_: any, __: any, idx: number) => (((pagination.current ?? 1) - 1) * (pagination.pageSize ?? 10)) + idx + 1,
},
{ title: '准入工作', dataIndex: 'accessWorkName' },
{ title: '准入单位', dataIndex: 'deptId' },
@ -95,17 +96,17 @@ const AccessManagement: React.FC = () => {
render: (_: any, record: any) => (
<Space>
<a onClick={() => openModal('view', record)}></a>
{ (record.reviewStatus === '3' && !record.approveStatusText) && (
<a onClick={() => handleApproval(record.id)}>
{(record.reviewStatus === '3' && !record.approveStatusText) && (
<a onClick={() => handleApproval(record.id)}>
</a>
</a>
)}
{ record.reviewStatus === '3' && (
{record.reviewStatus === '3' && (
<>
<a onClick={() => openModal('result', record)}></a>
</>
)}
</Space>
),
},
@ -115,27 +116,24 @@ const AccessManagement: React.FC = () => {
<>
<Form layout="inline" form={form} onFinish={getList}>
<Form.Item name="accessType" label="准入方式">
<Select style={{ width: 150 }} placeholder="请选择">
<Option value="线上">线</Option>
<Option value="线下">线</Option>
<Select style={{ width: 150 }} placeholder="请选择准入方式" allowClear >
<Option value="online">线</Option>
<Option value="offline">线</Option>
</Select>
</Form.Item>
<Form.Item name="deptId" label="准入单位">
<Select style={{ width: 150 }} placeholder="请选择">
<Option value="单位A">A</Option>
<Option value="单位B">B</Option>
<Select style={{ width: 150 }} placeholder="请选择" allowClear>
</Select>
</Form.Item>
<Form.Item name="categoryId" label="准入品类">
<Select style={{ width: 150 }} placeholder="请选择">
<Option value="品类1">1</Option>
<Option value="品类2">2</Option>
</Select>
<CategorySelector multiple={false} style={{ width: 150 }} />
</Form.Item>
<Form.Item name="approveStatus" label="状态">
<Select style={{ width: 150 }} placeholder="请选择">
<Option value="草稿">稿</Option>
<Option value="已提交"></Option>
<Select style={{ width: 150 }} placeholder="请选择状态" allowClear>
<Option value="0"></Option>
<Option value="1"></Option>
<Option value="2"></Option>
<Option value="3"></Option>
</Select>
</Form.Item>
<Form.Item>

View File

@ -1,13 +1,14 @@
import React, { useEffect, useState } from 'react';
import { Modal, Table, Button, Select, Spin, message } from 'antd';
import { reviewInfo, update } from '../services';
interface ResultModalProps {
import { connect } from 'umi';
interface GroupLeaderModalProps {
visible: boolean;
view: boolean;
record?: { id?: string; [key: string]: any } | null;
onCancel: () => void;
onSubmit: () => void;
dispatch: any;
}
// 只读备注弹窗
@ -40,12 +41,13 @@ const RemarkViewModal: React.FC<{
</Modal>
);
const GroupLeaderModal: React.FC<ResultModalProps> = ({
const GroupLeaderModal: React.FC<GroupLeaderModalProps> = ({
visible,
record,
view,
onCancel,
onSubmit,
dispatch,
}) => {
const [loading, setLoading] = useState(false);
const [suppliers, setSuppliers] = useState<any[]>([]);
@ -72,7 +74,7 @@ const GroupLeaderModal: React.FC<ResultModalProps> = ({
supplierList.forEach((sup: any) => {
// summary 行
const summaryItem = (sup.coscoAccessItemList || []).find((i: any) => i.itemType === 'summary');
// summaryMap[sup.supplierId] = summaryItem?.reviewResult;
// summaryMap[sup.supplierId] = summaryItem?.reviewResult;coscoAccessUserItemList
summaryMap[sup.supplierId] = summaryItem.coscoAccessUserItemList[0]?.reviewResult;
});
setGroupSummaryResult(summaryMap);
@ -102,7 +104,7 @@ const GroupLeaderModal: React.FC<ResultModalProps> = ({
const summaryItem = (sup.coscoAccessItemList || []).find((i: any) => i.itemType === 'summary');
if (!summaryItem) return null;
return {
id: summaryItem.id,
id: summaryItem.coscoAccessUserItemList[0].id,
reviewResult: groupSummaryResult[sup.supplierId],
remark: '', // 可拓展
coscoAccessTtemAttachments: undefined,
@ -113,6 +115,12 @@ const GroupLeaderModal: React.FC<ResultModalProps> = ({
if(record?.id) {
accessWorkId = record?.id
}
if(summaryParams.length === 0) {
message.warning('请选择审核');
return
}
return
update({ coscoAccessUserItemList: summaryParams, accessWorkId }).then((res: any) => {
if (res.code === 200) {
message.success('提交成功');
@ -144,7 +152,19 @@ const GroupLeaderModal: React.FC<ResultModalProps> = ({
return {
title: (
<div>
<div style={{ fontWeight: 600 }}>{sup.supplierName}</div>
{/* <div style={{ fontWeight: 600 }}>{sup.supplierName}</div> */}
<a
onClick={() => {
dispatch({
type: 'globalModal/show',
payload: {
id: sup.supplierId,
},
});
}}
>
{sup.supplierName}
</a>
</div>
),
children: reviewers.map((reviewBy: string) => ({
@ -281,4 +301,4 @@ const GroupLeaderModal: React.FC<ResultModalProps> = ({
);
};
export default GroupLeaderModal;
export default connect()(GroupLeaderModal);

View File

@ -46,10 +46,11 @@ const CooperateEnterprise: React.FC = () => {
};
// 列表数据
const getList = async (params: { pageNo: number; pageSize: number; parentCode: string; }) => {
const getList = async (params: { pageNo: number; pageSize: number;}) => {
setLoading(true);
try {
const { code, data } = await getPage({...params });
try {
const values = searchForm.getFieldsValue();
const { code, data } = await getPage({...params, ...values });
if (code === 200) {
setData(data.records);
setPagination({ current: params.pageNo, pageSize: params.pageSize, total: data.total });
@ -63,20 +64,18 @@ const CooperateEnterprise: React.FC = () => {
const handleReset = () => {
searchForm.resetFields();
getList({ pageNo: 1, pageSize: pagination.pageSize ?? 10, parentCode: '' });
getList({ pageNo: 1, pageSize: pagination.pageSize ?? 10 });
};
const handleSearch = (values: any) => {
const { parentCode } = values;
const handleSearch = () => {
getList({
pageNo: 1,
pageSize: pagination.pageSize ?? 10,
parentCode: parentCode || ''
});
};
useEffect(() => {
getList({ pageNo: 1, pageSize: 10, parentCode: '' });
getList({ pageNo: 1, pageSize: 10 });
}, []);
const columns: ColumnsType<Data> = [
@ -86,12 +85,13 @@ const CooperateEnterprise: React.FC = () => {
key: 'index',
width: 80,
align: 'center',
render: (_: any, __: any, index: number) => index + 1,
render: (_: any, __: any, idx: number) => (((pagination.current ?? 1) - 1) * (pagination.pageSize ?? 10)) + idx + 1,
},
{
title: '准入工作',
dataIndex: 'accessWorkName',
key: 'accessWorkName',
ellipsis: true,
},
{
title: '发起单位',
@ -117,6 +117,7 @@ const CooperateEnterprise: React.FC = () => {
title: '评审时间',
dataIndex: 'createTime',
key: 'createTime',
ellipsis: true,
},
{
title: '评审状态',
@ -126,7 +127,7 @@ const CooperateEnterprise: React.FC = () => {
},
{
title: '操作',
width: 120,
width: 140,
render: (_: any, record: any) => {
// 已完成 3 、结果汇总中 2 、进行中1 、 未开始0
// 显示评审 按钮
@ -159,8 +160,8 @@ const CooperateEnterprise: React.FC = () => {
onFinish={handleSearch}
style={{ marginBottom: 16 }}
>
<Form.Item name="parentCode" label="准入工作">
<Input placeholder="请输入准入工作" />
<Form.Item name="accessWorkName" label="准入工作">
<Input placeholder="请输入准入工作" allowClear maxLength={50} />
</Form.Item>
<Form.Item>
<Button type="primary" htmlType="submit" icon={<SearchOutlined />}>
@ -178,7 +179,7 @@ const CooperateEnterprise: React.FC = () => {
dataSource={data}
pagination={pagination}
loading={loading}
onChange={(pagination) => getList({ pageNo: pagination.current!, pageSize: pagination.pageSize!, parentCode: '', })}
onChange={(pagination) => getList({ pageNo: pagination.current!, pageSize: pagination.pageSize! })}
/>
{ modalInfo.type && modalInfo.type === 'teamMembers' && (
<ResultModal

View File

@ -6,7 +6,7 @@ import request from '@/utils/request';
interface getPageData {
pageNo: number;
pageSize: number;
parentCode?: string;
accessWorkName?: string;
}
export const getPage = (data: getPageData) => request.post('/coscoAccessWork/getPage', { data});
/**