diff --git a/src/pages/supplier/admission/SupplierCategoryEntry/index.tsx b/src/pages/supplier/admission/SupplierCategoryEntry/index.tsx index 5a90750..f53eda6 100644 --- a/src/pages/supplier/admission/SupplierCategoryEntry/index.tsx +++ b/src/pages/supplier/admission/SupplierCategoryEntry/index.tsx @@ -1,269 +1,204 @@ -import React, { useRef } from 'react'; -import ProTable from '@ant-design/pro-table'; -import type { ProColumns, ActionType } from '@ant-design/pro-table'; -import { Form, Select, Button, Row, Col, Tag, Space, DatePicker, Input } from 'antd'; +import React, { useEffect, useState } from 'react'; +import { Table, Form, Select, Button, Tag, message } from 'antd'; import { SearchOutlined, ReloadOutlined } from '@ant-design/icons'; +;import { getApprovePage } from './services' +import type { ColumnsType } from 'antd/es/table'; -const { RangePicker } = DatePicker; -// 示例数据 -const tableData = [ - { - id: 1, - name: '中山市合创展包装材料有限公司', - region: '境内', - type: '民营企业', - category: '船用物料,添加剂', - time: '2025-03-03 09:30', - status: '未开始', - result: '', - }, - { - id: 2, - name: '深圳市欧阳华斯电源有限公司', - region: '境内', - type: '民营企业', - category: '绳机物料', - time: '2025-03-03 09:30', - status: '未开始', - result: '', - }, - { - id: 3, - name: '广东振兴塑胶机械有限公司', - region: '境内', - type: '民营企业', - category: '船用物料', - time: '2025-03-03 09:30', - status: '进行中', - result: '', - }, - { - id: 4, - name: '上海硕建建筑技术工程有限公司', - region: '境内', - type: '民营企业', - category: '绳机物料', - time: '2025-03-03 09:30', - status: '进行中', - result: '', - }, - { - id: 5, - name: '中山市合创展包装材料有限公司', - region: '境内', - type: '民营企业', - category: '船用物料', - time: '2025-03-03 09:30', - status: '进行中', - result: '', - }, - { - id: 6, - name: '深圳市欧阳华斯电源有限公司', - region: '境内', - type: '民营企业', - category: '绳机物料', - time: '2025-03-03 09:30', - status: '进行中', - result: '', - }, - { - id: 7, - name: '广东振兴塑胶机械有限公司', - region: '境内', - type: '民营企业', - category: '船用物料', - time: '2025-03-03 09:30', - status: '已结束', - result: '通过', - }, - { - id: 8, - name: '上海硕建建筑技术工程有限公司', - region: '境内', - type: '民营企业', - category: '绳机物料', - time: '2025-03-03 09:30', - status: '已结束', - result: '驳回', - }, - { - id: 9, - name: '广东振兴塑胶机械有限公司', - region: '境内', - type: '民营企业', - category: '船用物料', - time: '2025-03-03 09:30', - status: '已结束', - result: '驳回', - }, - { - id: 10, - name: '上海硕建建筑技术工程有限公司', - region: '境内', - type: '民营企业', - category: '绳机物料', - time: '2025-03-03 09:30', - status: '已结束', - result: '驳回', - }, -]; +interface SupplierEntryReviewRecord { + id: string; + accessWorkName: string; // 准入工作 + deptId: string; // 准入部门ID + accessTypeText: string; // 准入方式 + reviewStatusText: string; // 流程状态 + categoryName: string; // 品类名称 + startTime: string; // 申请时间 + endTime: string; + createTime: string; // 创建时间 + updateTime: string; // 更新时间 + [key: string]: any; // 允许有其它字段 +} const statusColorMap: Record = { '未开始': 'default', '进行中': 'processing', - '已结束': 'success', + '已完成': 'success', }; -const resultColorMap: Record = { - '通过': 'success', - '驳回': 'error', -}; +const methodOptions = [ + { label: '全部', value: '' }, + { label: '线上准入', value: '线上准入' }, + { label: '线下准入', value: '线下准入' }, +]; -const columns: ProColumns[] = [ +const statusOptions = [ + { label: '全部', value: '' }, + { label: '未开始', value: '未开始' }, + { label: '进行中', value: '进行中' }, + { label: '已完成', value: '已完成' }, +]; + +const deptOptions = [ + { label: '全部', value: '' }, + { label: '采购部', value: 'DEPT001' }, + { label: '业务部', value: 'DEPT002' }, +]; + +const columns:ColumnsType = [ { title: '序号', dataIndex: 'index', - valueType: 'index', width: 48, align: 'center', + render: (_: any, __: any, idx: number) => idx + 1, }, { - title: '供应商名称', - dataIndex: 'name', + title: '准入工作', + dataIndex: 'accessWorkName', align: 'center', ellipsis: true, }, { - title: '境内/境外', - dataIndex: 'region', + title: '准入部门', + dataIndex: 'deptId', align: 'center', + render: (deptId: string) => deptId === 'DEPT001' ? '采购部' : deptId === 'DEPT002' ? '业务部' : deptId, }, { - title: '企业类型', - dataIndex: 'type', + title: '准入方式', + dataIndex: 'accessTypeText', align: 'center', }, { title: '准入品类', - dataIndex: 'category', + dataIndex: 'categoryName', align: 'center', ellipsis: true, }, { - title: '提交时间', - dataIndex: 'time', + title: '开始时间', + dataIndex: 'startTime', + align: 'center', + }, + { + title: '结束时间', + dataIndex: 'endTime', align: 'center', - sorter: (a, b) => new Date(a.time).getTime() - new Date(b.time).getTime(), }, { title: '流程状态', - dataIndex: 'status', + dataIndex: 'reviewStatusText', align: 'center', - render: (_, record) => - {record.status}, + render: (text: string) => {text}, }, - { - title: '审批结果', - dataIndex: 'result', - align: 'center', - render: (val: string) => - val ? {val} : null, - }, - { - title: '操作', - dataIndex: 'option', - align: 'center', - valueType: 'option', - render: (_, record) => ( - - 审批 - 审批记录 - - ), - }, -]; - -// 查询项选项 -const regionOptions = [ - { label: '请选择', value: '' }, - { label: '境内', value: '境内' }, - { label: '境外', value: '境外' }, -]; -const statusOptions = [ - { label: '请选择', value: '' }, - { label: '未开始', value: '未开始' }, - { label: '进行中', value: '进行中' }, - { label: '已结束', value: '已结束' }, -]; -const resultOptions = [ - { label: '请选择', value: '' }, - { label: '通过', value: '通过' }, - { label: '驳回', value: '驳回' }, ]; const SupplierCategoryEntry: React.FC = () => { - const actionRef = useRef(); + const [form] = Form.useForm(); + const [data, setData] = useState([]); + const [pagination, setPagination] = useState({ current: 1, pageSize: 10, total: 0 }); + const [loading, setLoading] = useState(false); - // 查询区渲染 - const searchFormRender = ( -
- - - - - - - - - - - - - - + + + + + + + + + + + diff --git a/src/pages/supplier/admission/SupplierCategoryEntry/services.ts b/src/pages/supplier/admission/SupplierCategoryEntry/services.ts new file mode 100644 index 0000000..940d2b4 --- /dev/null +++ b/src/pages/supplier/admission/SupplierCategoryEntry/services.ts @@ -0,0 +1,16 @@ +import request from '@/utils/request'; + +/** + * 品类准入审核列表 + */ +interface getPageData { + accessType?: string; + approveStatus?: string; + categoryId?: string; + deptId?: string; + pageNo: string; + pageSize: string; + reviewStatus?: string; + [property: string]: any; +} +export const getApprovePage = (data: getPageData) => request.post('/coscoAccessWorkCategory/getPage', { data}); \ No newline at end of file diff --git a/src/pages/supplier/admission/SupplierCategoryEntryReview/index.tsx b/src/pages/supplier/admission/SupplierCategoryEntryReview/index.tsx index 5a90750..04c5c89 100644 --- a/src/pages/supplier/admission/SupplierCategoryEntryReview/index.tsx +++ b/src/pages/supplier/admission/SupplierCategoryEntryReview/index.tsx @@ -1,8 +1,9 @@ -import React, { useRef } from 'react'; +import React, { useState, useEffect } from 'react'; import ProTable from '@ant-design/pro-table'; import type { ProColumns, ActionType } from '@ant-design/pro-table'; import { Form, Select, Button, Row, Col, Tag, Space, DatePicker, Input } from 'antd'; import { SearchOutlined, ReloadOutlined } from '@ant-design/icons'; +import { getApprovePage } from './services' const { RangePicker } = DatePicker; @@ -204,8 +205,18 @@ const resultOptions = [ ]; const SupplierCategoryEntry: React.FC = () => { - const actionRef = useRef(); + // const actionRef = useRef(); + console.log(1); + + useEffect(() => { + console.log(1); + + getApprovePage({ + pageNo: 1, + pageSize: 10, + }); + }, []) // 查询区渲染 const searchFormRender = (
@@ -250,7 +261,7 @@ const SupplierCategoryEntry: React.FC = () => { {/* 查询表单 */} {searchFormRender} {/* 表格 */} - { }} options={false} bordered - /> + /> */} ); }; diff --git a/src/pages/supplier/admission/SupplierCategoryEntryReview/services.ts b/src/pages/supplier/admission/SupplierCategoryEntryReview/services.ts new file mode 100644 index 0000000..a779958 --- /dev/null +++ b/src/pages/supplier/admission/SupplierCategoryEntryReview/services.ts @@ -0,0 +1,12 @@ +import request from '@/utils/request'; + +/** + * 列表 + */ +interface getPageData { + pageNo: number; + pageSize: number; + parentCode?: string; +} +export const getApprovePage = (data: getPageData) => request.post('/coscoAccessWork/getApprovePage', { data}); + \ No newline at end of file diff --git a/src/pages/supplier/admission/SupplierEntryReview/index.tsx b/src/pages/supplier/admission/SupplierEntryReview/index.tsx index 7dba919..940650f 100644 --- a/src/pages/supplier/admission/SupplierEntryReview/index.tsx +++ b/src/pages/supplier/admission/SupplierEntryReview/index.tsx @@ -1,288 +1,205 @@ -// src/pages/SupplierEntryReview/index.tsx - -import React, { useRef } from 'react'; -import ProTable from '@ant-design/pro-table'; -import type { ProColumns, ActionType } from '@ant-design/pro-table'; -import { Form, Select, Button, Row, Col, Tag, Space, message } from 'antd'; +import React, { useEffect, useState } from 'react'; +import { Table, Form, Select, Button, Tag, message } from 'antd'; import { SearchOutlined, ReloadOutlined } from '@ant-design/icons'; +import { getApprovePage } from './services'; +import type { ColumnsType } from 'antd/es/table'; -// 示例数据 -const tableData = [ - { - id: 1, - work: '燃料XXX有限公司', - unit: '散运', - dept: '采购部', - method: '线上', - applyTime: '2025-03-03 09:30', - status: '未开始', - result: '', - }, - { - id: 2, - work: '备件XXX有限公司', - unit: '散运二级单位', - dept: '业务部', - method: '线下', - applyTime: '2025-03-03 09:30', - status: '未开始', - result: '', - }, - { - id: 3, - work: '电机XXX有限公司', - unit: '散运', - dept: '采购部', - method: '线上', - applyTime: '2025-03-03 09:30', - status: '进行中', - result: '', - }, - { - id: 4, - work: '钢板XXX有限公司', - unit: '散运', - dept: '业务部', - method: '线下', - applyTime: '2025-03-03 09:30', - status: '进行中', - result: '', - }, - { - id: 5, - work: '燃料XXX有限公司', - unit: '散运', - dept: '采购部', - method: '线上', - applyTime: '2025-03-03 09:30', - status: '进行中', - result: '', - }, - { - id: 6, - work: '备件XXX有限公司', - unit: '散运二级单位', - dept: '业务部', - method: '线下', - applyTime: '2025-03-03 09:30', - status: '进行中', - result: '', - }, - { - id: 7, - work: '电机XXX有限公司', - unit: '散运', - dept: '采购部', - method: '线上', - applyTime: '2025-03-03 09:30', - status: '已结束', - result: '通过', - }, - { - id: 8, - work: '钢板XXX有限公司', - unit: '散运二级单位', - dept: '业务部', - method: '线下', - applyTime: '2025-03-03 09:30', - status: '已结束', - result: '驳回', - }, - { - id: 9, - work: '燃料XXX有限公司', - unit: '散运', - dept: '采购部', - method: '线上', - applyTime: '2025-03-03 09:30', - status: '已结束', - result: '驳回', - }, - { - id: 10, - work: '钢板XXX有限公司', - unit: '散运二级单位', - dept: '业务部', - method: '线下', - applyTime: '2025-03-03 09:30', - status: '已结束', - result: '驳回', - }, -]; + +interface SupplierEntryReviewRecord { + id: string; + accessWorkName: string; // 准入工作 + deptId: string; // 准入部门ID + accessTypeText: string; // 准入方式 + reviewStatusText: string; // 流程状态 + categoryName: string; // 品类名称 + startTime: string; // 申请时间 + endTime: string; + createTime: string; // 创建时间 + updateTime: string; // 更新时间 + [key: string]: any; // 允许有其它字段 +} const statusColorMap: Record = { '未开始': 'default', '进行中': 'processing', - '已结束': 'success', + '已完成': 'success', }; -const resultColorMap: Record = { - '通过': 'success', - '驳回': 'error', -}; +const methodOptions = [ + { label: '全部', value: '' }, + { label: '线上准入', value: '线上准入' }, + { label: '线下准入', value: '线下准入' }, +]; -const columns: ProColumns[] = [ +const statusOptions = [ + { label: '全部', value: '' }, + { label: '未开始', value: '未开始' }, + { label: '进行中', value: '进行中' }, + { label: '已完成', value: '已完成' }, +]; + +const deptOptions = [ + { label: '全部', value: '' }, + { label: '采购部', value: 'DEPT001' }, + { label: '业务部', value: 'DEPT002' }, +]; + +const columns:ColumnsType = [ { title: '序号', dataIndex: 'index', - valueType: 'index', width: 48, align: 'center', + render: (_: any, __: any, idx: number) => idx + 1, }, { title: '准入工作', - dataIndex: 'work', + dataIndex: 'accessWorkName', align: 'center', ellipsis: true, }, - { - title: '准入单位', - dataIndex: 'unit', - align: 'center', - }, { title: '准入部门', - dataIndex: 'dept', + dataIndex: 'deptId', align: 'center', + render: (deptId: string) => deptId === 'DEPT001' ? '采购部' : deptId === 'DEPT002' ? '业务部' : deptId, }, { title: '准入方式', - dataIndex: 'method', + dataIndex: 'accessTypeText', align: 'center', }, { - title: '申请时间', - dataIndex: 'applyTime', + title: '准入品类', + dataIndex: 'categoryName', + align: 'center', + ellipsis: true, + }, + { + title: '开始时间', + dataIndex: 'startTime', + align: 'center', + }, + { + title: '结束时间', + dataIndex: 'endTime', align: 'center', - sorter: (a, b) => new Date(a.applyTime).getTime() - new Date(b.applyTime).getTime(), }, { title: '流程状态', - dataIndex: 'status', + dataIndex: 'reviewStatusText', align: 'center', - render: (_, record) => - {record.status}, + render: (text: string) => {text}, }, - { - title: '审批结果', - dataIndex: 'result', - align: 'center', - render: (val: string) => - val ? {val} : null, - }, - { - title: '操作', - dataIndex: 'option', - align: 'center', - valueType: 'option', - render: (_, record) => ( - - 审批 - 审批记录 - - ), - }, -]; - -const statusOptions = [ - { label: '未开始', value: '未开始' }, - { label: '进行中', value: '进行中' }, - { label: '已结束', value: '已结束' }, -]; - -const unitOptions = [ - { label: '散运', value: '散运' }, - { label: '散运二级单位', value: '散运二级单位' }, -]; - -const deptOptions = [ - { label: '采购部', value: '采购部' }, - { label: '业务部', value: '业务部' }, -]; - -const methodOptions = [ - { label: '线上', value: '线上' }, - { label: '线下', value: '线下' }, -]; - -const categoryOptions = [ - { label: '全部', value: '' }, -]; - -const reviewResultOptions = [ - { label: '全部', value: '' }, - { label: '通过', value: '通过' }, - { label: '驳回', value: '驳回' }, ]; const SupplierEntryReview: React.FC = () => { - const actionRef = useRef(); + const [form] = Form.useForm(); + const [data, setData] = useState([]); + const [pagination, setPagination] = useState({ current: 1, pageSize: 10, total: 0 }); + const [loading, setLoading] = useState(false); - // 自定义查询表单 - const searchFormRender = ( - - -
- - - - - - - - - - - - - - - - - - - - - - - ); + // 查询数据 + const fetchData = async (params = {}) => { + setLoading(true); + try { + const res = await getApprovePage({ + pageNo: pagination.current, + pageSize: pagination.pageSize, + ...form.getFieldsValue(), + ...params, + }); + if (res.code === 200) { + setData(res.data.records); + setPagination({ + ...pagination, + current: res.data.current, + total: res.data.total, + pageSize: res.data.size, + }); + } else { + setData([]); + setPagination({ ...pagination, total: 0 }); + } + } catch (err) { + message.error('获取数据失败'); + } finally { + setLoading(false); + } + }; + + useEffect(() => { + fetchData({ pageNo: 1 }); + // eslint-disable-next-line + }, []); + + // 表格分页切换 + const handleTableChange = (pag: any) => { + setPagination({ + ...pagination, + current: pag.current, + pageSize: pag.pageSize, + }); + fetchData({ + pageNo: pag.current, + pageSize: pag.pageSize, + }); + }; + + // 搜索 + const handleSearch = () => { + setPagination({ ...pagination, current: 1 }); + fetchData({ pageNo: 1 }); + }; + + // 重置 + const handleReset = () => { + form.resetFields(); + setPagination({ ...pagination, current: 1 }); + fetchData({ pageNo: 1 }); + }; return (
- {/* 查询表单 */} - {searchFormRender} +
+ + + + + handleSummaryChange(sup.supplierId, val)} + options={[ + { label: '合格', value: 0 }, + { label: '不合格', value: 1 } + ]} + /> + + ) + })} + + ); + + return ( + 取消, + + ]} + width={1000} + bodyStyle={{ maxHeight: '60vh', overflowY: 'auto' }} + centered + destroyOnClose + > + +
summaryRow} + scroll={{ x: 300 * suppliers.length + 200 }} + /> + + setRemarkModal({ open: false, remark: '', file: undefined })} + remark={remarkModal.remark} + file={remarkModal.file} + /> + + ); +}; + +export default GroupLeaderModal; diff --git a/src/pages/supplier/admission/admissionReviewManagement/components/ResultModal.tsx b/src/pages/supplier/admission/admissionReviewManagement/components/ResultModal.tsx index 694315f..6eda462 100644 --- a/src/pages/supplier/admission/admissionReviewManagement/components/ResultModal.tsx +++ b/src/pages/supplier/admission/admissionReviewManagement/components/ResultModal.tsx @@ -1,166 +1,200 @@ import React, { useEffect, useState } from 'react'; import { Modal, Table, Button, Radio, Input, Upload, message, Spin } from 'antd'; -import { reviewInfo, uploadFile } from '../services'; // 你的接口 - +import { reviewInfo, uploadFile, update } from '../services'; +import type { ColumnsType } from 'antd/es/table'; +//主体参数接口 interface ResultModalProps { visible: boolean; record?: { id?: string; [key: string]: any } | null; onCancel: () => void; - onSubmit: (payload: any) => void; + onSubmit: () => void; +} +interface RowData { + key: string; + itemName: string; + // 其他如有 } - -// 单元格内容 type CellValue = { - reviewResult?: 0 | 1; // 0合格 1不合格 + reviewResult?: 0 | 1; remark?: string; file?: any; }; - +//主体 const ResultModal: React.FC = ({ visible, record, onCancel, onSubmit }) => { + // type: 'teamMembers' | 'groupLeader' + // 供应商、评审项、单元格数据 const [suppliers, setSuppliers] = useState([]); const [items, setItems] = useState([]); - const [cellData, setCellData] = useState<{ - [itemId: string]: { [supplierId: string]: CellValue } - }>({}); + const [userItemMatrix, setUserItemMatrix] = useState([]); + // userItemId为唯一key + const [cellData, setCellData] = useState<{ [userItemId: string]: CellValue }>({}); const [loading, setLoading] = useState(false); // 备注弹窗 const [remarksModalVisible, setRemarksModalVisible] = useState(false); const [remarks, setRemarks] = useState(''); const [fileList, setFileList] = useState([]); - const [currentCell, setCurrentCell] = useState<{ itemId: string, supplierId: string } | null>(null); + const [currentUserItemId, setCurrentUserItemId] = useState(null); - // 拉取评审数据 + // 拉取并整理表格数据 useEffect(() => { if (visible && record?.id) { setLoading(true); - reviewInfo({ id: record.id, userId: 'E0001' }) + reviewInfo({ id: record.id }) .then((res: any) => { - const data = res?.data || []; - setSuppliers(data); + const supplierList = res?.data || []; + setSuppliers(supplierList); - // 用第一家供应商的coscoAccessItemList生成所有评审项 - const firstSupplier = data[0] || {}; - const itemList = (firstSupplier.coscoAccessItemList || []).filter((i: { itemType:string } ) => i.itemType !== 'summary'); - setItems(itemList); + // 用第一家供应商取所有“非summary”的评审项 + const baseItems = (supplierList[0]?.coscoAccessItemList || []).filter( + (item: any) => item.itemType !== 'summary' + ); + setItems(baseItems); - // 初始化 cellData - const newCellData: any = {}; - itemList.forEach((item: any) => { - newCellData[item.id] = {}; - data.forEach((sup: any) => { - newCellData[item.id][sup.supplierId] = {}; + // 构建userItem二维矩阵:[row][col]=userItem/null + // userItemMatrix[row][col]为对应格的userItem + const matrix: any[][] = []; + const newCellData: { [userItemId: string]: CellValue } = {}; + baseItems.forEach((item: any, rowIdx: number) => { + matrix[rowIdx] = []; + supplierList.forEach((sup: any, colIdx: number) => { + const cur = (sup.coscoAccessItemList || []).find((it: any) => it.itemName === item.itemName && it.itemType !== 'summary'); + const userItem = + cur?.coscoAccessUserItemList?.length > 0 + ? cur.coscoAccessUserItemList[0] + : null; + matrix[rowIdx][colIdx] = userItem; + + // 初始化cellData + if (userItem) { + newCellData[userItem.id] = { + reviewResult: userItem.reviewResult, + remark: userItem.remark, + file: userItem.coscoAccessTtemAttachments + }; + } }); }); + setUserItemMatrix(matrix); setCellData(newCellData); }) .finally(() => setLoading(false)); + } else if (!visible) { + setSuppliers([]); + setItems([]); + setUserItemMatrix([]); + setCellData({}); } }, [visible, record]); - // 单选 - const handleRadioChange = (itemId: string, supplierId: string, value: string) => { + // 单选(只用userItemId为唯一key) + const handleRadioChange = (userItemId: string, value: string) => { setCellData(prev => ({ ...prev, - [itemId]: { - ...prev[itemId], - [supplierId]: { - ...prev[itemId]?.[supplierId], - reviewResult: value === '合格' ? 0 : 1 - } + [userItemId]: { + ...prev[userItemId], + reviewResult: value === '合格' ? 0 : 1 } })); }; // 打开备注弹窗 - const openRemarksModal = (itemId: string, supplierId: string) => { - setCurrentCell({ itemId, supplierId }); - const cell = cellData[itemId]?.[supplierId] || {}; + const openRemarksModal = (userItemId: string) => { + setCurrentUserItemId(userItemId); + const cell = cellData[userItemId] || {}; setRemarks(cell.remark || ''); - setFileList(cell.file - ? [{ - uid: '-1', - name: cell.file.fileName, - status: 'done', - url: cell.file.fileUrl, - response: cell.file - }] - : []); + setFileList( + cell.file + ? [ + { + uid: '-1', + name: cell.file.fileName, + status: 'done', + url: cell.file.fileUrl, + response: cell.file + } + ] + : [] + ); setRemarksModalVisible(true); }; - // 上传 + // 上传附件 const uploadProps = { fileList, maxCount: 1, onRemove: () => setFileList([]), customRequest: async (options: any) => { - - const res = await uploadFile(options.file); - const fileObj = res; - setFileList([{ - uid: options.file.uid, - name: fileObj.fileName, - status: 'done', - url: fileObj.url, - response: fileObj - }]); - message.success('文件上传成功'); - options.onSuccess && options.onSuccess(res, options.file); - - + const res = await uploadFile(options.file); + setFileList([ + { + uid: options.file.uid, + name: res.fileName, + status: 'done', + url: res.fileUrl, + response: { ...res, fileUrl: res.url } + } + ]); + message.success('文件上传成功'); + options.onSuccess && options.onSuccess(res, options.file); } }; // 备注提交 const handleSubmitRemarks = () => { - if (!currentCell) return; + if (!currentUserItemId) return; setCellData(prev => ({ ...prev, - [currentCell.itemId]: { - ...prev[currentCell.itemId], - [currentCell.supplierId]: { - ...prev[currentCell.itemId]?.[currentCell.supplierId], - remark: remarks, - file: fileList[0]?.response || undefined - } + [currentUserItemId]: { + ...prev[currentUserItemId], + remark: remarks, + file: fileList[0]?.response || undefined } })); setRemarksModalVisible(false); }; - // 提交 + // 提交数据 const handleSubmit = () => { - // 组装参数 + // 遍历userItemMatrix拼装参数 let result: any[] = []; - items.forEach(item => { - suppliers.forEach(sup => { - const cell = cellData?.[item.id]?.[sup.supplierId]; - if (cell && cell.reviewResult !== undefined) { + userItemMatrix.forEach(row => { + row.forEach(userItem => { + if (userItem && cellData[userItem.id]?.reviewResult !== undefined) { result.push({ - id: item.id, - reviewResult: cell.reviewResult, - remark: cell.remark || '', - coscoAccessTtemAttachments: cell.file || undefined + id: userItem.id, + reviewResult: cellData[userItem.id]?.reviewResult, + remark: cellData[userItem.id]?.remark || '', + coscoAccessTtemAttachments: cellData[userItem.id]?.file + ? { + ...cellData[userItem.id]?.file, + accessWorkId: userItem.accessWorkId // 补充 + } + : undefined }); } }); }); - - console.log(items,'items'); - console.log(result,'result'); - - - onSubmit && onSubmit({ coscoAccessUserItemList: result }); + let accessWorkId = '' + if(record?.id) { + accessWorkId = record?.id + } + // 提交审核 + update( {coscoAccessUserItemList: result, accessWorkId }).then((res) => { + if(res.code == 200) { + message.success('提交成功'); + onSubmit() + } + }) }; // 组装表头 - const columns = [ + const columns: ColumnsType = [ { title: '评审项', dataIndex: 'itemName', @@ -168,15 +202,15 @@ const ResultModal: React.FC = ({ width: 200, fixed: 'left' }, - ...suppliers.map(sup => ({ + ...suppliers.map((sup, colIdx) => ({ title: sup.supplierName, dataIndex: sup.supplierId, key: sup.supplierId, width: 300, - render: (_: any, row: any) => { - const v = cellData?.[row.key]?.[sup.supplierId] || {}; - console.log(sup,'sup'); - + render: (_: any, row: any, rowIdx: number) => { + const userItem = userItemMatrix[rowIdx]?.[colIdx]; + if (!userItem) return null; // 无userItem不渲染 + const v = cellData[userItem.id] || {}; return (
= ({ ? '不合格' : undefined } - onChange={e => handleRadioChange(row.key, sup.supplierId, e.target.value)} + onChange={e => handleRadioChange(userItem.id, e.target.value)} > 合格 不合格 - - {v.remark && 已备注} - {v.file && 已上传} + + {v.remark && ( + 已备注 + )} + {v.file && ( + + 已上传 + + )}
); } })) ]; - // 行数据 - const tableData = items.map(item => ({ + // 表格数据 + const tableData = items.map((item: any) => ({ key: item.id, itemName: item.itemName })); @@ -213,8 +255,12 @@ const ResultModal: React.FC = ({ visible={visible} onCancel={onCancel} footer={[ - , - + , + ]} width={1000} bodyStyle={{ maxHeight: '60vh', overflowY: 'auto' }} @@ -235,8 +281,12 @@ const ResultModal: React.FC = ({ visible={remarksModalVisible} onCancel={() => setRemarksModalVisible(false)} footer={[ - , - + , + ]} destroyOnClose > diff --git a/src/pages/supplier/admission/admissionReviewManagement/index.tsx b/src/pages/supplier/admission/admissionReviewManagement/index.tsx index 282293f..3cb9ac2 100644 --- a/src/pages/supplier/admission/admissionReviewManagement/index.tsx +++ b/src/pages/supplier/admission/admissionReviewManagement/index.tsx @@ -1,11 +1,12 @@ import React, { useEffect, useState } from "react"; import { useIntl } from 'umi'; -import { Form, Button, Table, Select, Space, Input } from 'antd'; +import { Form, Button, Table, Space, Input } from 'antd'; import type { ColumnsType, TablePaginationConfig } from 'antd/es/table'; import { SearchOutlined } from '@ant-design/icons'; import { getPage } from './services'; //查看评审结果 弹窗 import ResultModal from './components/ResultModal'; +import GroupLeaderModal from './components/GroupLeaderModal'; interface Data { deptName: string; @@ -16,7 +17,7 @@ interface Data { } interface ModalInfo { - type: 'view' | 'result' | null; + type: 'teamMembers' | 'groupLeader' | null; visible: boolean; record: Data | null; } @@ -30,18 +31,24 @@ const CooperateEnterprise: React.FC = () => { const [pagination, setPagination] = useState({ current: 1, pageSize: 10, total: 0 }); const [modalInfo, setModalInfo] = useState({ type: null, visible: false, record: null }); - const openModal = (type: 'view' | 'result', record: Data) => { + const openModal = (type: 'teamMembers' | 'groupLeader', record: Data) => { setModalInfo({ type, visible: true, record }); }; - + //提交关闭审核 const closeModal = () => { setModalInfo({ type: null, visible: false, record: null }); }; + //提交审核 + const submitModal = () => { + closeModal(); + handleReset(); + }; + // 列表数据 const getList = async (params: { pageNo: number; pageSize: number; parentCode: string; }) => { setLoading(true); try { - const { code, data } = await getPage(params); + const { code, data } = await getPage({...params }); if (code === 200) { setData(data.records); setPagination({ current: params.pageNo, pageSize: params.pageSize, total: data.total }); @@ -97,8 +104,8 @@ const CooperateEnterprise: React.FC = () => { }, { title: '品类', - dataIndex: 'exitTime', - key: 'exitTime', + dataIndex: 'categoryName', + key: 'categoryName', }, { title: '准入方式', @@ -117,11 +124,19 @@ const CooperateEnterprise: React.FC = () => { }, { title: '操作', - render: (_: any, record: any) => ( + render: (_: any, record: any) => { + const showAudit = ( + (['未开始', '进行中'].includes(record.reviewStatusText) && record.isLeader === '0') || + (['结果汇总中'].includes(record.reviewStatusText) && record.isLeader === '1') + ); + const type = ['未开始', '进行中'].includes(record.reviewStatusText)? 'teamMembers': 'groupLeader'; + return ( - openModal('result', record)}>审核 - - ), + {showAudit && openModal(type, record)}>审核} + + ) + + }, }, ]; return ( @@ -153,12 +168,23 @@ const CooperateEnterprise: React.FC = () => { loading={loading} onChange={(pagination) => getList({ pageNo: pagination.current!, pageSize: pagination.pageSize!, parentCode: '', })} /> - - + { modalInfo.type && modalInfo.type === 'teamMembers' && ( + + )} + { modalInfo.type && modalInfo.type === 'groupLeader' && ( + + )} + ); }; diff --git a/src/pages/supplier/admission/admissionReviewManagement/services.ts b/src/pages/supplier/admission/admissionReviewManagement/services.ts index 5134f6a..167aeb2 100644 --- a/src/pages/supplier/admission/admissionReviewManagement/services.ts +++ b/src/pages/supplier/admission/admissionReviewManagement/services.ts @@ -1,8 +1,5 @@ import request from '@/utils/request'; - - - /** * 准入列表 */ @@ -11,7 +8,7 @@ interface getPageData { pageSize: number; parentCode?: string; } -export const getPage = (data: getPageData) => request.post('/coscoAccessWork/getPage', { data }); +export const getPage = (data: getPageData) => request.post('/coscoAccessWork/getPage', { data}); /** * 评审修改时用的详情页 */ @@ -37,42 +34,34 @@ export const uploadFile = async (file: File) => { }); }; - - - - -export async function coscoSupplier(params:any) { - console.log(params,'params'); - - return request('/api/system/coscoSupplier', { - method: 'GET', - params - }); +/** + * 组员评审 + */ +export interface updateData { + accessWorkId: string; + coscoAccessUserItemList: CoscoAccessUserItemList[]; + [property: string]: any; } -export async function library(params:any) { - return request('/api/system/library', { - method: 'GET', - params - }); +export interface CoscoAccessUserItemList { + coscoAccessTtemAttachments: CoscoAccessTtemAttachments; + id: number; + remark: string; + reviewResult: number; + [property: string]: any; } -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 interface CoscoAccessTtemAttachments { + accessWorkId: string; + fileName: string; + filePath: string; + fileSize: string; + fileType: string; + fileUrl: string; + [property: string]: any; } +export const update = (data: updateData) => request.post('/coscoAccessWork/update', { data }); + + + \ No newline at end of file