This commit is contained in:
jlzhangyx5
2025-05-28 17:50:00 +08:00
4 changed files with 189 additions and 118 deletions

View File

@ -48,6 +48,12 @@ export default {
changeOrigin: true,
pathRewrite: { '/api/biz-service-ebtp-agency': '' },
},
'/api/biz-supplier-manage': {
target: 'http://localhost:18096',
changeOrigin: true,
pathRewrite: { '/api/biz-supplier-manage': '' },
}
// '/api/wfap/v1/audit/bill/find/by/procid': {
// target: 'http://10.242.31.158:8891/',//审批单 uat环境自动审批暂时用不到
// changeOrigin: true,

View File

@ -1,12 +1,18 @@
import React, { useState, useRef } from 'react';
import { message, Modal, Input, Form, PageHeader, Button, Spin, Select, Tree } from 'antd';
import ProTable, { ProColumns, ActionType } from '@ant-design/pro-table';
import { getPage, getDataById, deleteAgency, addAgency, updateAgency,disableAgency } from './service';
import { getProviderToAgencyPage } from '../service';
// import './styles.less';
import { getDicData } from '@/utils/session';
import TextArea from 'antd/lib/input/TextArea';
const selectProvider: React.FC<{}> = () => {
interface SelectProviderProps {
onSelect?: (record: any) => void;
visible?: boolean;
onCancel?: () => void;
}
const SelectProvider: React.FC<SelectProviderProps> = ({ onSelect, visible = false, onCancel }) => {
//获取字典
const getDict: any = getDicData();
const [form] = Form.useForm();
@ -38,18 +44,19 @@ const selectProvider: React.FC<{}> = () => {
//委托列表
const columns: ProColumns<any>[] = [
{ title: '序号', valueType: 'index', width: 50, search: false, },
{ title: '供应商名称', dataIndex: 'providerName', },//, ellipsis: true
{ title: '供应商分类', dataIndex: 'roleName',
{ title: '供应商名称', dataIndex: 'name', },//, ellipsis: true
{ title: '供应商分类code', dataIndex: 'kindCode', hideInTable:true,
valueEnum: { 'EBTP': { text: '招标采购中心', status: 'EBTP' }, },
},
{ title: '供应商分类', dataIndex: 'kindName',
},//, ellipsis: true//, ellipsis: true
{ title: '品类', dataIndex: 'roleName', },
{ title: '准入时间', dataIndex: 'roleName', },//, ellipsis: true
{ title: '准入人', dataIndex: 'roleName', search: false, hideInTable:true,},//, ellipsis: true
{ title: '失效时间', dataIndex: 'roleName', search: false,},//, ellipsis: true
{ title: '状态', dataIndex: 'status', },//, ellipsis: true
{ title: '品类', dataIndex: 'goodsTypeName', },
{ title: '准入时间', dataIndex: 'accessTime', },//, ellipsis: true
{ title: '准入人', dataIndex: 'accessUser', search: false, hideInTable:true,},//, ellipsis: true
{ title: '状态', dataIndex: 'agent', },//, ellipsis: true
{ title: 'id', dataIndex: 'id', search: false,hideInTable:true,},//, ellipsis: true
{ title: 'providerId', dataIndex: 'providerId', search: false,hideInTable:true,},
// { title: '创建时间', dataIndex: 'createDate', width: '10%', valueType: 'dateTime', search: false },
{
@ -62,19 +69,17 @@ const selectProvider: React.FC<{}> = () => {
]
},
];
// 删除操作
const handleSelect = (id: string) => {
// 选择供应商
const handleSelect = (record: any) => {
Modal.confirm({
title: '确认选择该供应商?',
onOk: async () => {
await deleteAgency(id).then((r: any) => {
if (r?.code == 200) {
message.success('删除成功');
} else {
message.error('删除失败');
// 调用父组件传入的onSelect回调传递选中的供应商数据
if (onSelect) {
onSelect(record);
message.success('已选择供应商');
// 如果需要关闭弹窗,可以在这里添加关闭逻辑
}
})
.finally(() => actionRef.current?.reload());
},
});
};
@ -84,9 +89,15 @@ const selectProvider: React.FC<{}> = () => {
return (
<Modal
title="选择供应商"
visible={visible}
onCancel={onCancel}
width={1000}
footer={null}
>
<Spin spinning={spin}>
<PageHeader title="我的招标代理" />
<div style={{ maxHeight: innerHeight - 130, height: innerHeight - 130 }} className='xsy-entrust bgCWhite'>
<div style={{ height: '600px' }} className='xsy-entrust bgCWhite'>
<ProTable<any>
actionRef={actionRef}//action触发后更新表格
columns={columns}//表格
@ -96,9 +107,9 @@ const selectProvider: React.FC<{}> = () => {
size='small'
search={{ labelWidth: 'auto', span: 6 }}
request={(params) =>
getPage({
getProviderToAgencyPage({
...params,
basePageRequest: { pageNo: pageData.pageNo, pageSize: pageData.pageSize },
pageNo: pageData.pageNo, pageSize: pageData.pageSize ,
}).then((res) => {
const result = {
data: res.data.records,
@ -110,12 +121,7 @@ const selectProvider: React.FC<{}> = () => {
return result;
})
}
toolBarRender={() => [
<Button onClick={() => { handleAdd() }} type="primary">
</Button>,
]
}
pagination={{
defaultPageSize: 10,
showSizeChanger: false,
@ -128,6 +134,7 @@ const selectProvider: React.FC<{}> = () => {
</div>
{/* 查看 */}
</Spin >
</Modal>
)
};
export default selectProvider;
export default SelectProvider;

View File

@ -1,10 +1,11 @@
import React, { useState, useRef } from 'react';
import { message, Modal, Input, Form, PageHeader, Button, Spin, Select, Tree } from 'antd';
import {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 TextArea from 'antd/lib/input/TextArea';
import SelectProvider from './components/SelectProvider';
const agency: React.FC<{}> = () => {
//获取字典
@ -18,6 +19,9 @@ const agency: React.FC<{}> = () => {
const dictData = JSON.parse(getDict);
const actionRef = useRef<ActionType>();
const [spin, spinSet] = useState<boolean>(false);
const [selectProviderVisible, setSelectProviderVisible] = useState<boolean>(false);
const [currentRecord, setCurrentRecord] = useState<any>(null);
const [showEndDate, setShowEndDate] = useState<boolean>(false);
//查询分页数据
const [pageData, pageDataSet] = useState<any>({
pageNo: 1,
@ -56,7 +60,9 @@ const agency: React.FC<{}> = () => {
<Button type='text' onClick={() => { handleUpdate(record.providerId) }}></Button>,
<Button type='text' onClick={() => { handleDelete(record.id) }}></Button>,
<Button type='text' onClick={() => { handleUpdate(record.id) }}></Button>,
<Button type='text' onClick={() => { handleDelete(record) }}></Button>
<Button type='text' onClick={() => {
}}></Button>
]
},
@ -64,7 +70,7 @@ const agency: React.FC<{}> = () => {
// 删除操作
const handleDelete = (id: string) => {
Modal.confirm({
title: '确认删除该角色',
title: '确认删除该代理机构',
onOk: async () => {
await deleteAgency(id).then((r: any) => {
if (r?.code == 200) {
@ -77,67 +83,33 @@ const agency: React.FC<{}> = () => {
},
});
};
const handleAdd = async () => {
const handleAdd = async (record: any) => {
form.resetFields();
// const menus = await menuTreeselect();
// setMenuOptions(menus.data || []);
// setMenuOptions(menu || []);
form.setFieldsValue({
...record,
providerId: record.id
});
// 使用时转换
setMenuOptions(formatMenuOptions(menu) || []);
setOpen(true);
setTitle('添加角色');
setTitle('添加招标代理机构');
};
const [menuOptions, setMenuOptions] = useState<any[]>([]);
let menu = [{
"id": '1', "parentId": '0', "label": "系统管理", "weight": 1,
"children": [{
"id": '101', "parentId": '1', "label": "角色管理", "weight": 2,
"children": [{ "id": '1008', "parentId": '101', "label": "角色查询", "weight": 1 },
{ "id": '1009', "parentId": '101', "label": "角色新增", "weight": 2 },
{ "id": '1010', "parentId": '101', "label": "角色修改", "weight": 3 },
{ "id": '1011', "parentId": '101', "label": "角色删除", "weight": 4 },
{ "id": '1012', "parentId": '101', "label": "角色导出", "weight": 5 }]
},
{
"id": '105', "parentId": '1', "label": "字典管理", "weight": 6,
"children": [{ "id": '1026', "parentId": '105', "label": "字典查询", "weight": 1 },
{ "id": '1027', "parentId": '105', "label": "字典新增", "weight": 2 },
{ "id": '1028', "parentId": '105', "label": "字典修改", "weight": 3 },
{ "id": '1029', "parentId": '105', "label": "字典删除", "weight": 4 },
{ "id": '1030', "parentId": '105', "label": "字典导出", "weight": 5 }]
}]
},
{ "id": '4', "parentId": '0', "label": "PLUS官网", "weight": 4 },
{
"id": "1494925781048545281", "parentId": '0', "label": "个人待办", "weight": 18,
"children": [{ "id": "1494926258733633538", "parentId": "1494925781048545281", "label": "待办任务", "weight": 1 },
{ "id": "1494926586677874690", "parentId": "1494925781048545281", "label": "已办任务", "weight": 2 }]
}];
const formatMenuOptions = (data: any[]) => {
return data.map(item => ({
title: item.label,
key: item.id,
children: item.children ? formatMenuOptions(item.children) : undefined,
}));
};
const handleUpdate = async (record: any) => {
form.resetFields();
const role = await getDataById(record.roleId);
const agencyDetail = await getDataById(record.id);
// const menus = await roleMenuTreeselect(record.roleId);
// setMenuOptions(menus.data.menus || []);
setMenuOptions(formatMenuOptions(menu) || []);
setCheckedKeys(role.data.menuIds || []);
form.setFieldsValue({
...role.data,
menuIds: role.data.menuIds || [],
...agencyDetail.data
});
// form.setFieldsValue(role.data);
setCurrentRoleId(record.roleId);
setOpen(true);
setTitle('修改角色');
setTitle('修改代理机构');
};
const closeModal = async () => {
@ -185,40 +157,98 @@ const agency: React.FC<{}> = () => {
onOk={handleSubmit}
onCancel={() => closeModal()}
>
<div className="info-display" style={{
display: 'flex',
flexWrap: 'wrap',
margin: '0 -1%',
marginBottom: '1.5rem'
}}>
<div className="info-item" style={{ flex: '0 0 48%', margin: '0 1% 1rem', display: 'flex' }}>
<span className="info-label" style={{ flex: '0 0 30%', textAlign: 'right', marginRight: '2%' }}></span>
<span className="info-content" style={{ flex: '1' }}>{currentRecord?.name || '-'}</span>
</div>
<div className="info-item" style={{ flex: '0 0 48%', margin: '0 1% 1rem', display: 'flex' }}>
<span className="info-label" style={{ flex: '0 0 30%', textAlign: 'right', marginRight: '2%' }}></span>
<span className="info-content" style={{ flex: '1' }}>{currentRecord?.kindName || '-'}</span>
</div>
<div className="info-item" style={{ flex: '0 0 48%', margin: '0 1% 1rem', display: 'flex' }}>
<span className="info-label" style={{ flex: '0 0 30%', textAlign: 'right', marginRight: '2%' }}></span>
<span className="info-content" style={{ flex: '1' }}>{currentRecord?.accessTime || '-'}</span>
</div>
<div className="info-item" style={{ flex: '0 0 48%', margin: '0 1% 1rem', display: 'flex' }}>
<span className="info-label" style={{ flex: '0 0 30%', textAlign: 'right', marginRight: '2%' }}></span>
<span className="info-content" style={{ flex: '1' }}>{currentRecord?.goodsTypeName || '-'}</span>
</div>
</div>
<div className="info-display" style={{
display: 'flex',
flexWrap: 'wrap',
margin: '0 -1%',
marginBottom: '1.5rem'
}}>
<div className="info-item" style={{ flex: '0 0 48%', margin: '0 1% 1rem', display: 'flex' }}>
<span className="info-label" style={{ flex: '0 0 30%', textAlign: 'right', marginRight: '2%' }}></span>
<span className="info-content" style={{ flex: '1' }}>{currentRecord?.applyUser || '-'}</span>
</div>
<div className="info-item" style={{ flex: '0 0 48%', margin: '0 1% 1rem', display: 'flex' }}>
<span className="info-label" style={{ flex: '0 0 30%', textAlign: 'right', marginRight: '2%' }}></span>
<span className="info-content" style={{ flex: '1' }}>{currentRecord?.name || '-'}</span>
</div>
<div className="info-item" style={{ flex: '0 0 48%', margin: '0 1% 1rem', display: 'flex' }}>
<span className="info-label" style={{ flex: '0 0 30%', textAlign: 'right', marginRight: '2%' }}></span>
<span className="info-content" style={{ flex: '1' }}>{currentRecord?.kindCode || '-'}</span>
</div>
<div className="info-item" style={{ flex: '0 0 48%', margin: '0 1% 1rem', display: 'flex' }}>
<span className="info-label" style={{ flex: '0 0 30%', textAlign: 'right', marginRight: '2%' }}></span>
<span className="info-content" style={{ flex: '1' }}>{currentRecord?.kindName || '-'}</span>
</div>
<div className="info-item" style={{ flex: '0 0 48%', margin: '0 1% 1rem', display: 'flex' }}>
<span className="info-label" style={{ flex: '0 0 30%', textAlign: 'right', marginRight: '2%' }}></span>
<span className="info-content" style={{ flex: '1' }}>{currentRecord?.goodsTypeCode || '-'}</span>
</div>
</div>
<Form form={form} {...layout}>
<Form.Item label="角色id" name="roleId" hidden>
<Input />
<Form.Item label="供应商ID" name="providerId" hidden>
<Input disabled />
</Form.Item>
<Form.Item label="角色名称" name="roleName" rules={[{ required: true }]}>
<Input />
<Form.Item label="ID" name="id" hidden>
<Input disabled />
</Form.Item>
<Form.Item label="角色编码" name="roleCode" rules={[{ required: true }]}>
<Input />
</Form.Item>
<Form.Item label="角色范围" name="roleScope" rules={[{ required: true }]}>
<Select>
{sys_normal_scope.map((item) => (
<Option key={item.value} value={item.value}>
{item.label}
</Option>
))}
</Select>
</Form.Item>
<Form.Item label="角色描述" name="roleDesc" rules={[{ required: true }]}>
<TextArea />
</Form.Item>
<Form.Item label="菜单权限" name="menuIds" >
<Tree
defaultExpandAll
checkable
checkedKeys={checkedKeys}
onCheck={(checkedKeys) => {
setCheckedKeys(checkedKeys as React.Key[]);
form.setFieldsValue({ menuIds: checkedKeys });
<Form.Item label="有效期" name="validity">
<Radio.Group
options={[
{ value: '1', label: '长期' },
{ value: '2', label: '定期' }
]}
onChange={(e) => {
const value = e.target.value;
setShowEndDate(value === '2');
if (value === '1') {
}
}}
treeData={menuOptions}
/>
</Form.Item>
{showEndDate && (
<Form.Item label="结束日期" name="periodEnd">
<DatePicker style={{ width: '100%' }} />
</Form.Item>
)}
</Form>
</Modal>
);
@ -250,9 +280,13 @@ const agency: React.FC<{}> = () => {
})
}
toolBarRender={() => [
<Button onClick={() => { handleAdd() }} type="primary">
</Button>,
<Button type="primary" onClick={() => {
setSelectProviderVisible(true);
}}></Button>
// <Button onClick={() => { handleAdd() }} type="primary">
// 新增招标代理
// </Button>,
]
}
pagination={{
@ -264,6 +298,23 @@ const agency: React.FC<{}> = () => {
onReset={() => { pageDataSet({ pageNo: 1, pageSize: 10 }) }}
/>
{checkSupModal}
<SelectProvider
visible={selectProviderVisible}
onSelect={(provider) => {
console.log('Selected provider:', provider);
// 处理选中的供应商数据
setCurrentRecord(provider);
// if (currentRecord && provider) {
handleAdd(provider);
// }
setSelectProviderVisible(false);
// setCurrentRecord(null);
}}
onCancel={() => {
setSelectProviderVisible(false);
setCurrentRecord(null);
}}
/>
</div>
{/* 查看 */}
</Spin >

View File

@ -35,3 +35,10 @@ export async function disableAgency(id: any) {
method: 'post',
});
}
export async function getProviderToAgencyPage(params: any) {
return request('/api/biz-supplier-manage/supplier/base/getToAgencyPage', {
method: 'post',
data: params,
});
}