From 0852a973d37e90d1ab95f19742aaba4163ac1f2c Mon Sep 17 00:00:00 2001 From: houjishuang <46269784@qq.com> Date: Tue, 3 Jun 2025 17:19:01 +0800 Subject: [PATCH] shenqing --- config/router.config.ts | 4 + .../Agency/AgencyManager/approveIndex.tsx | 415 ++++++++++++++++++ src/pages/Agency/AgencyManager/index.tsx | 103 ++++- src/pages/Agency/AgencyManager/service.ts | 19 + 4 files changed, 521 insertions(+), 20 deletions(-) create mode 100644 src/pages/Agency/AgencyManager/approveIndex.tsx diff --git a/config/router.config.ts b/config/router.config.ts index 8633fbb..b916f61 100644 --- a/config/router.config.ts +++ b/config/router.config.ts @@ -113,6 +113,10 @@ export default [ path: '/ToAgencyValid', component: './Agency/AgencyManager/applyIndex', }, + { + path: '/ToAgencyApprove', + component: './Agency/AgencyManager/approveIndex', + }, //==============================================================引入的业务路由 ...approvalForm,//审批单 ...juryRoom,//评标室内所有路由 diff --git a/src/pages/Agency/AgencyManager/approveIndex.tsx b/src/pages/Agency/AgencyManager/approveIndex.tsx new file mode 100644 index 0000000..bc2ac18 --- /dev/null +++ b/src/pages/Agency/AgencyManager/approveIndex.tsx @@ -0,0 +1,415 @@ +import React, { useState, useRef } from 'react'; +import {Table,Radio, message, Modal, Input, Form, PageHeader, Button, Spin, Select, Tree, DatePicker } from 'antd'; +import ProTable, { ProColumns, ActionType } from '@ant-design/pro-table'; +import { searchWaitToAgree, getDataById, rejectAgency, agreeAgency, updateAgency,disableAgency } from './service'; +// import './styles.less'; +import { getSessionRoleData,getDicData,getSessionUserData } from '@/utils/session'; +import TextArea from 'antd/lib/input/TextArea'; +import SelectProvider from './components/SelectProvider'; +import 'moment/locale/zh-cn'; +import locale from 'antd/es/date-picker/locale/zh_CN'; +import moment from 'moment'; +import dayjs from 'dayjs'; +import 'dayjs/locale/zh-cn'; +import advancedFormat from 'dayjs/plugin/advancedFormat' +import customParseFormat from 'dayjs/plugin/customParseFormat' +import localeData from 'dayjs/plugin/localeData' +import weekday from 'dayjs/plugin/weekday' +import weekOfYear from 'dayjs/plugin/weekOfYear' +import weekYear from 'dayjs/plugin/weekYear' + +dayjs.extend(customParseFormat) +dayjs.extend(advancedFormat) +dayjs.extend(weekday) +dayjs.extend(localeData) +dayjs.extend(weekOfYear) +dayjs.extend(weekYear) + + +dayjs.locale('zh-cn'); +const AgencyWaitToAgree: React.FC<{}> = () => { + + let userData: any=getSessionUserData(); + //获取字典 + const getDict: any = getDicData(); + const [form] = Form.useForm(); + const [title, setTitle] = useState(''); + const [open, setOpen] = useState(false); + + const [checkedKeys, setCheckedKeys] = useState([]); + const [currentRoleId, setCurrentRoleId] = useState(null); + const dictData = JSON.parse(getDict); + const actionRef = useRef(); + const [spin, spinSet] = useState(false); + const [selectProviderVisible, setSelectProviderVisible] = useState(false); + const [currentRecord, setCurrentRecord] = useState(null); + const [showEndDate, setShowEndDate] = useState(false); + const [dataSource, setdataSource] = useState(); + //查询分页数据 + const [pageData, pageDataSet] = useState({ + pageNo: 1, + pageSize: 10 + }); + const layout = { + labelCol: { span: 6 }, + wrapperCol: { span: 13 }, + }; + interface DictType { + value: string; + label: string; + } + + const [date, setDate] = useState(dayjs(new Date())); + const columnsAgencyInvalidations= [ + { title: '序号', valueType: 'index',}, + { + title: '有效期开始', + dataIndex: 'periodBegin', + key: 'periodBegin', + }, + { + title: '有效期结束', + dataIndex: 'periodEnd', + key: 'periodEnd', + }, + { + title: '失效类型', + dataIndex: 'invalidType', + key: 'invalidType', + }, + + ]; + //委托列表 + const columns: ProColumns[] = [ + { title: '序号', valueType: 'index', width: 50, search: false, }, + { title: '代理机构名称', dataIndex: 'providerName',search: false, },//, ellipsis: true + { title: '申请人', dataIndex: 'applyUser', search: false, },//, ellipsis: true//, ellipsis: true + { title: '申请时间', dataIndex: 'createDate', search: false, },//, ellipsis: true + + { title: 'id', dataIndex: 'id', search: false,hideInTable:true,},//, ellipsis: true + // { title: '创建时间', dataIndex: 'createDate', width: '10%', valueType: 'dateTime', search: false }, + { title: 'providerId', dataIndex: 'providerId', search: false,hideInTable:true,}, + { + title: '操作', width: '9%', + valueType: 'option', + render: (_, record) => [ + , + + + ] + }, + ]; + // 删除操作 + const handleDelete = (id: string) => { + Modal.confirm({ + title: '确认删除该代理机构?', + onOk: async () => { + await deleteAgency(id).then((r: any) => { + if (r?.code == 200) { + message.success('删除成功'); + } else { + message.error('删除失败'); + } + }) + .finally(() => actionRef.current?.reload()); + }, + }); + }; + + const handleDisable = (id: string) => { + Modal.confirm({ + title: '确认失效该代理机构?', + onOk: async () => { + await disableAgency(id).then((r: any) => { + if (r?.code == 200) { + message.success('操作成功'); + } else { + message.error('操作失败'); + } + }) + .finally(() => actionRef.current?.reload()); + }, + }); + }; + + const handleAdd = async (record: any) => { + form.resetFields(); + form.setFieldsValue({ + //...record, + providerId: record.id, + providerName: record.name, + id: '', + }); + + setOpen(true); + setTitle('添加招标代理机构'); + }; + const handleReSelect = async (record: any) => { + form.resetFields(); + const agencyDetail = await getDataById(record.id); + if(agencyDetail&&(agencyDetail?.code == 200)&&agencyDetail.data&&agencyDetail.data.providerDetail) { + setCurrentRecord(agencyDetail.data.providerDetail); + setShowEndDate(agencyDetail.data.validity === '2'); + form.setFieldsValue({ + // ...currentRecord, + providerId: agencyDetail.data.providerDetail.id, + providerName: agencyDetail.data.providerDetail.name, + + }); + } + + + setOpen(true); + setTitle('添加招标代理机构'); + }; + const [menuOptions, setMenuOptions] = useState([]); + + + + const handleUpdate = async (record: any) => { + form.resetFields(); + const agencyDetail = await getDataById(record.id); + + if(agencyDetail&&(agencyDetail?.code == 200)&&agencyDetail.data) { + setCurrentRecord(agencyDetail.data.providerDetail); + setShowEndDate(agencyDetail.data.validity === '2'); + setdataSource(agencyDetail.data.agencyInvalidations); + + form.setFieldsValue({ + ...agencyDetail.data + }); + if(agencyDetail.data.providerDetail && agencyDetail.data.periodEnd){ + console.log(agencyDetail.data.periodEnd); + setDate(dayjs(agencyDetail.data.periodEnd, 'YYYY-MM-DD')); + + } + } + + + setOpen(true); + setTitle('代理机构审批'); + }; + + const closeModal = async () => { + actionRef.current?.reload(); + form.resetFields(); + setCheckedKeys([]); + setOpen(false); + }; + + const handleSubmit = async (approve: any) => { + try { + const values = await form.validateFields(); + + // 处理日期,确保只保留日期部分 + if (approve && approve==='1') { + await agreeAgency(values.id).then((r: any) => { + if (r?.code == 200) { + message.success('同意成功'); + } else { + message.error('同意失败'); + } + }); + } + if (approve && approve==='3') { + await agreeAgency(values.id).then((r: any) => { + if (r?.code == 200) { + message.success('驳回成功'); + } else { + message.error('驳回失败'); + } + }); + } + + closeModal(); + } catch (error) { + console.error(error); + } + }; + const checkSupModal = ( + setOpen(false)}>关闭} + onOk={() => handleSubmit('1')} + onCancel={() => handleSubmit('3')} + okText='同意' + cancelText='驳回' + > + + + +
+ +
+ 供应商名称: + {currentRecord?.name || '-'} +
+ +
+ 供应商类型名称: + {currentRecord?.kindName || '-'} +
+
+ 准入时间: + {currentRecord?.accessTime || '-'} +
+
+ 商品品类: + {currentRecord?.goodsTypeName || '-'} +
+ +
+ +
+
+ 姓名: + {userData?.fullName || '-'} +
+
+ 工号: + {userData?.fullName || '-'} +
+
+ 角色: + {userData?.fullName || '-'} +
+
+ 公司: + {userData?.fullName || '-'} +
+
+ 部门: + {userData?.fullName || '-'} +
+ +
+ + +
+{ + dataSource && ( "历史记录"} />) +} + + + + + + + + + + + { + const value = e.target.value; + setShowEndDate(value === '2'); + if (value === '1') { + + } + }} + /> + + + {showEndDate && ( + + setDate(date)} disabledDate={(current) => current && current < moment().startOf('day')} style={{ width: '100%' }} format={'YYYY-MM-DD'} /> + + )} + + + + + + + ); + return ( + + +
+ + actionRef={actionRef}//action触发后更新表格 + columns={columns}//表格 + options={false} + bordered={false} + className='tableSearch' + size='small' + search={{ labelWidth: 'auto', span: 6 }} + request={(params) => + searchWaitToAgree({ + ...params, + basePageRequest: { pageNo: pageData.pageNo, pageSize: pageData.pageSize }, + }).then((res) => { + const result = { + data: res.data.records, + total: res.data.total, + success: res.success, + pageSize: res.data.size, + current: res.data.current + } + return result; + }) + } + + pagination={{ + defaultPageSize: 10, + showSizeChanger: false, + onChange: (page, pageSize) => pageDataSet({ pageNo: page, pageSize: pageSize }), + onShowSizeChange: (current, size) => pageDataSet({ pageNo: current, pageSize: size }), + }} + onReset={() => { pageDataSet({ pageNo: 1, pageSize: 10 }) }} + /> + {checkSupModal} + { + console.log('Selected provider:', provider); + // 处理选中的供应商数据 + setCurrentRecord(provider); + // if (currentRecord && provider) { + handleAdd(provider); + // } + setSelectProviderVisible(false); + // setCurrentRecord(null); + }} + onCancel={() => { + setSelectProviderVisible(false); + setCurrentRecord(null); + }} + /> +
+ {/* 查看 */} +
+ ) +}; +export default AgencyWaitToAgree; \ No newline at end of file diff --git a/src/pages/Agency/AgencyManager/index.tsx b/src/pages/Agency/AgencyManager/index.tsx index 4415911..d698f57 100644 --- a/src/pages/Agency/AgencyManager/index.tsx +++ b/src/pages/Agency/AgencyManager/index.tsx @@ -1,13 +1,35 @@ import React, { useState, useRef } from 'react'; -import {Radio, message, Modal, Input, Form, PageHeader, Button, Spin, Select, Tree, DatePicker } from 'antd'; +import {Table,Radio, message, Modal, Input, Form, PageHeader, Button, Spin, Select, Tree, DatePicker } from 'antd'; import ProTable, { ProColumns, ActionType } from '@ant-design/pro-table'; import { getPage, getDataById, deleteAgency, addAgency, updateAgency,disableAgency } from './service'; // import './styles.less'; -import { getDicData } from '@/utils/session'; +import { getSessionRoleData,getDicData,getSessionUserData } from '@/utils/session'; import TextArea from 'antd/lib/input/TextArea'; import SelectProvider from './components/SelectProvider'; +import 'moment/locale/zh-cn'; +import locale from 'antd/es/date-picker/locale/zh_CN'; +import moment from 'moment'; +import dayjs from 'dayjs'; +import 'dayjs/locale/zh-cn'; +import advancedFormat from 'dayjs/plugin/advancedFormat' +import customParseFormat from 'dayjs/plugin/customParseFormat' +import localeData from 'dayjs/plugin/localeData' +import weekday from 'dayjs/plugin/weekday' +import weekOfYear from 'dayjs/plugin/weekOfYear' +import weekYear from 'dayjs/plugin/weekYear' +dayjs.extend(customParseFormat) +dayjs.extend(advancedFormat) +dayjs.extend(weekday) +dayjs.extend(localeData) +dayjs.extend(weekOfYear) +dayjs.extend(weekYear) + + +dayjs.locale('zh-cn'); const agency: React.FC<{}> = () => { + + let userData: any=getSessionUserData(); //获取字典 const getDict: any = getDicData(); const [form] = Form.useForm(); @@ -22,6 +44,7 @@ const agency: React.FC<{}> = () => { const [selectProviderVisible, setSelectProviderVisible] = useState(false); const [currentRecord, setCurrentRecord] = useState(null); const [showEndDate, setShowEndDate] = useState(false); + const [dataSource, setdataSource] = useState(); //查询分页数据 const [pageData, pageDataSet] = useState({ pageNo: 1, @@ -35,20 +58,37 @@ const agency: React.FC<{}> = () => { value: string; label: string; } - const sys_normal_scope: DictType[] = [ - { value: 'EBTP', label: '招标采购中心' }, - ]; + const [date, setDate] = useState(dayjs(new Date())); + const columnsAgencyInvalidations= [ + { title: '序号', valueType: 'index',}, + { + title: '有效期开始', + dataIndex: 'periodBegin', + key: 'periodBegin', + }, + { + title: '有效期结束', + dataIndex: 'periodEnd', + key: 'periodEnd', + }, + { + title: '失效类型', + dataIndex: 'invalidType', + key: 'invalidType', + }, + + ]; //委托列表 const columns: ProColumns[] = [ { title: '序号', valueType: 'index', width: 50, search: false, }, { title: '代理机构名称', dataIndex: 'providerName', },//, ellipsis: true { title: '申请人', dataIndex: 'applyUser', search: false, },//, ellipsis: true//, ellipsis: true - { title: '开始服务时间', dataIndex: 'periodBegin', search: false, },//, ellipsis: true + { title: '开始服务时间', dataIndex: 'createDate', search: false, },//, ellipsis: true { title: '准入人', dataIndex: 'accessUser', search: false, },//, ellipsis: true { title: '失效时间', dataIndex: 'periodEnd', search: false,},//, ellipsis: true { title: '状态', dataIndex: 'validityStatus', valueType: 'select', - valueEnum: { '1': { text: '有效', status: '1' },'2': { text: '失效', status: '2' }, }, + valueEnum: {'0': { text: '审批中', status: '0' }, '1': { text: '有效', status: '1' },'2': { text: '失效', status: '2' }, }, },//, ellipsis: true { title: 'id', dataIndex: 'id', search: false,hideInTable:true,},//, ellipsis: true // { title: '创建时间', dataIndex: 'createDate', width: '10%', valueType: 'dateTime', search: false }, @@ -140,13 +180,21 @@ const agency: React.FC<{}> = () => { form.resetFields(); const agencyDetail = await getDataById(record.id); - if(agencyDetail&&(agencyDetail?.code == 200)&&agencyDetail.data&&agencyDetail.data.providerDetail) { + if(agencyDetail&&(agencyDetail?.code == 200)&&agencyDetail.data) { setCurrentRecord(agencyDetail.data.providerDetail); setShowEndDate(agencyDetail.data.validity === '2'); + setdataSource(agencyDetail.data.agencyInvalidations); + + form.setFieldsValue({ + ...agencyDetail.data + }); + if(agencyDetail.data.providerDetail && agencyDetail.data.periodEnd){ + console.log(agencyDetail.data.periodEnd); + setDate(dayjs(agencyDetail.data.periodEnd, 'YYYY-MM-DD')); + + } } - form.setFieldsValue({ - ...agencyDetail.data - }); + setOpen(true); setTitle('修改代理机构'); @@ -164,8 +212,8 @@ const agency: React.FC<{}> = () => { const values = await form.validateFields(); // 处理日期,确保只保留日期部分 - if (values.periodEnd) { - values.periodEnd = values.periodEnd.format('YYYY-MM-DD'); + if (date && values.validity==='2') { + values.periodEnd =date.format('YYYY-MM-DD'); } if (values.id) { @@ -241,26 +289,40 @@ const agency: React.FC<{}> = () => { }}>
姓名: - {currentRecord?.applyUser || '-'} + {userData?.fullName || '-'}
工号: - {currentRecord?.name || '-'} + {userData?.fullName || '-'}
角色: - {currentRecord?.kindCode || '-'} + {userData?.fullName || '-'}
公司: - {currentRecord?.kindName || '-'} + {userData?.fullName || '-'}
部门: - {currentRecord?.goodsTypeCode || '-'} + {userData?.fullName || '-'}
+ + +
+{ + dataSource && (
"历史记录"} />) +} + + + {showEndDate && ( - - + + setDate(date)} disabledDate={(current) => current && current < moment().startOf('day')} style={{ width: '100%' }} format={'YYYY-MM-DD'} /> )} + ); diff --git a/src/pages/Agency/AgencyManager/service.ts b/src/pages/Agency/AgencyManager/service.ts index ed5c24c..d49cd3e 100644 --- a/src/pages/Agency/AgencyManager/service.ts +++ b/src/pages/Agency/AgencyManager/service.ts @@ -53,4 +53,23 @@ export async function getProviderToAgencyPage(params: any) { data: params, }); } + +export async function searchWaitToAgree(params: any) { + return request('/api/biz-service-ebtp-agency/api/agencies/wait/to/agree', { + method: 'post', + data: params, + }); +} + +export async function agreeAgency(id: any) { + return request(`/api/biz-service-ebtp-agency/api/agencies/approve/agree/${id}`, { + method: 'post', + }); +} + +export async function rejectAgency(id: any) { + return request(`/api/biz-service-ebtp-agency/api/agencies/approve/reject/${id}`, { + method: 'post', + }); +} \ No newline at end of file