更新部分功能

This commit is contained in:
孙景学
2025-07-03 10:24:33 +08:00
parent cf8e9d0820
commit e15c97d741
26 changed files with 199 additions and 114 deletions

View File

@ -4,6 +4,7 @@ import { RightOutlined, LeftOutlined } from '@ant-design/icons';
import { coscoSupplierBase } from '../services';
const { Option } = Select;
type OptionType = { label: string; value: string };
const SupplierSelector: React.FC<{ visible: boolean; onCancel: () => void; onSelect?: (selected: any[]) => void; }> = ({ visible, onCancel, onSelect }) => {
// 查询
@ -20,6 +21,8 @@ const SupplierSelector: React.FC<{ visible: boolean; onCancel: () => void; onSel
const [rightSelected, setRightSelected] = useState<React.Key[]>([]);
//确认 已选供应商
const [chosenSuppliers, setChosenSuppliers] = useState<any[]>([]);
// 境内/境外下拉数据
const [regionOptions, setRegionOptions] = useState<OptionType[]>([]);
//已选供应商 去重
const filteredData = (chosenSuppliers:any, selected:any) => {
const ids = new Set(chosenSuppliers.map((item:any) => item.id));
@ -56,6 +59,11 @@ const SupplierSelector: React.FC<{ visible: boolean; onCancel: () => void; onSel
// 初始化
useEffect(() => {
if(visible) {
// 境内/境外 下拉
setRegionOptions([
{ label: '境内企业', value: 'dvs' },
{ label: '境外企业', value: 'ovs' },
])
const values = form.getFieldsValue();
getTableList(values,1 , 10)
}
@ -73,20 +81,25 @@ const SupplierSelector: React.FC<{ visible: boolean; onCancel: () => void; onSel
<Modal title="选择供应商" visible={visible} onCancel={onCancel} footer={null} width="80%">
<Form layout="inline" form={form} onFinish={getTableList} style={{ marginBottom: 16 }}>
<Form.Item name="accessType" label="供应商名称">
<Input placeholder="供应商名称" allowClear />
</Form.Item>
<Form.Item name="deptId" label="境内/境外">
<Select placeholder="境内/境外" allowClear >
<Option value="境内"></Option>
<Option value="境外"></Option>
</Select>
</Form.Item>
<Form.Item name="name" label="供应商名称">
<Input placeholder="请输入供应商名称关键字" style={{ width: 220 }} allowClear maxLength={20} />
</Form.Item>
<Form.Item name="supplierType" label="境内/境外">
<Select style={{ width: 160 }} placeholder="请选择境内/境外" allowClear>
{regionOptions.map(opt => (
<Select.Option key={opt.value} value={opt.value}>{opt.label}</Select.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();
getTableList(values,1 , 10)
}}></Button>
</Form.Item>
</Form>

View File

@ -4,7 +4,7 @@ import { RightOutlined, LeftOutlined } from '@ant-design/icons';
import { coscoSupplierBase } from '../services';
const { Option } = Select;
type OptionType = { label: string; value: string };
const SupplierSelector: React.FC<{ visible: boolean; onCancel: () => void; onSelect?: (selected: any[]) => void; }> = ({ visible, onCancel, onSelect }) => {
// 查询
const [form] = Form.useForm();
@ -20,6 +20,8 @@ const SupplierSelector: React.FC<{ visible: boolean; onCancel: () => void; onSel
const [rightSelected, setRightSelected] = useState<React.Key[]>([]);
//确认 已选供应商
const [chosenSuppliers, setChosenSuppliers] = useState<any[]>([]);
// 境内/境外下拉数据
const [regionOptions, setRegionOptions] = useState<OptionType[]>([]);
//已选供应商 去重
const filteredData = (chosenSuppliers:any, selected:any) => {
const ids = new Set(chosenSuppliers.map((item:any) => item.id));
@ -55,9 +57,16 @@ const SupplierSelector: React.FC<{ visible: boolean; onCancel: () => void; onSel
};
// 初始化
useEffect(() => {
const values = form.getFieldsValue();
getTableList(values,1 , 10)
}, [])
if(visible) {
// 境内/境外 下拉
setRegionOptions([
{ label: '境内企业', value: 'dvs' },
{ label: '境外企业', value: 'ovs' },
])
const values = form.getFieldsValue();
getTableList(values,1 , 10)
}
}, [visible])
//供应商名称
const columns = [
{ title: '供应商名称', dataIndex: 'name', ellipsis: true, render: (name: string) => (
@ -71,20 +80,28 @@ const SupplierSelector: React.FC<{ visible: boolean; onCancel: () => void; onSel
<Modal title="选择供应商" visible={visible} onCancel={onCancel} footer={null} width="80%">
<Form layout="inline" form={form} onFinish={getTableList} style={{ marginBottom: 16 }}>
<Form.Item name="accessType" label="供应商名称">
<Input placeholder="供应商名称" allowClear />
</Form.Item>
<Form.Item name="deptId" label="境内/境外">
<Select placeholder="境内/境外" allowClear >
<Option value="境内"></Option>
<Option value="境外"></Option>
</Select>
</Form.Item>
<Form.Item name="name" label="供应商名称">
<Input placeholder="请输入供应商名称关键字" style={{ width: 220 }} allowClear maxLength={20} />
</Form.Item>
<Form.Item name="supplierType" label="境内/境外">
<Select style={{ width: 160 }} placeholder="请选择境内/境外" allowClear>
{regionOptions.map(opt => (
<Select.Option key={opt.value} value={opt.value}>{opt.label}</Select.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();
getTableList(values,1 , 10)
}}></Button>
</Form.Item>
</Form>

View File

@ -116,11 +116,12 @@ const GroupLeaderModal: React.FC<GroupLeaderModalProps> = ({
accessWorkId = record?.id
}
if(summaryParams.length === 0) {
message.warning('请选择审核');
return
for (let index = 0; index < summaryParams.length; index++) {
if(summaryParams[index].reviewResult === null) {
message.warning('有未评审项');
return
}
}
return
update({ coscoAccessUserItemList: summaryParams, accessWorkId }).then((res: any) => {
if (res.code === 200) {
message.success('提交成功');

View File

@ -2,6 +2,7 @@ import React, { useEffect, useState } from 'react';
import { Modal, Table, Button, Radio, Input, Upload, message, Spin } from 'antd';
import { reviewInfo, uploadFile, update } from '../services';
import type { ColumnsType } from 'antd/es/table';
import { connect } from 'umi';
//主体参数接口
interface ResultModalProps {
visible: boolean;
@ -9,6 +10,7 @@ interface ResultModalProps {
record?: { id?: string; [key: string]: any } | null;
onCancel: () => void;
onSubmit: () => void;
dispatch: any;
}
interface RowData {
key: string;
@ -58,7 +60,8 @@ const ResultModal: React.FC<ResultModalProps> = ({
view,
record,
onCancel,
onSubmit
onSubmit,
dispatch,
}) => {
// type: 'teamMembers' | 'groupLeader'
// 供应商、评审项、单元格数据
@ -219,6 +222,13 @@ const ResultModal: React.FC<ResultModalProps> = ({
if(record?.id) {
accessWorkId = record?.id
}
for (let index = 0; index < result.length; index++) {
if(result[index].reviewResult === null) {
message.warning('有未评审项');
return
}
}
// 提交审核
update( {coscoAccessUserItemList: result, accessWorkId }).then((res) => {
if(res.code == 200) {
@ -238,7 +248,22 @@ const ResultModal: React.FC<ResultModalProps> = ({
fixed: 'left'
},
...suppliers.map((sup, colIdx) => ({
title: sup.supplierName,
title: (
<div>
<a
onClick={() => {
dispatch({
type: 'globalModal/show',
payload: {
id: sup.supplierId,
},
});
}}
>
{sup.supplierName}
</a>
</div>
),
dataIndex: sup.supplierId,
key: sup.supplierId,
width: 300,
@ -365,4 +390,4 @@ const ResultModal: React.FC<ResultModalProps> = ({
);
};
export default ResultModal;
export default connect()(ResultModal);

View File

@ -50,7 +50,7 @@ const CooperateEnterprise: React.FC = () => {
setLoading(true);
try {
const values = searchForm.getFieldsValue();
const { code, data } = await getPage({...params, ...values });
const { code, data } = await getPage({...params, ...values});
if (code === 200) {
setData(data.records);
setPagination({ current: params.pageNo, pageSize: params.pageSize, total: data.total });

View File

@ -0,0 +1,22 @@
import React from "react";
//第三方UI库/组件
import { Modal } from "antd";
//本地组件、业务逻辑
import CompanyInfo from '@/components/CompanyInfo';
//主体接口
interface SupplierViewModalProps {
visible: boolean;
onCancel: () => void;
record?: string;
}
// 查看主体
const SupplierViewModal: React.FC<SupplierViewModalProps> = ({ visible, onCancel, record }) => {
return (
<Modal visible={visible} title="供应商信息查看" onCancel={onCancel} footer={null} width='80%' destroyOnClose >
<CompanyInfo
viewType={true} record={record} />
</Modal>
);
};
export default SupplierViewModal;

View File

@ -2,9 +2,17 @@ import React, { useRef, useEffect, useState } from 'react';
import { Table, Form, Input, Button, Row, Col, DatePicker, Tabs, Space, message } from 'antd';
import { SearchOutlined, ReloadOutlined, PlusOutlined } from '@ant-design/icons';
import { getPageAgent } from './services';
import type { ColumnsType } from 'antd/es/table';
import SupplierViewModal from './components/SupplierViewModal';
const { RangePicker } = DatePicker;
const { TabPane } = Tabs;
interface Columns {
name: string;
enterpriseType: string;
deptId: string;
createTime: string;
id: string;
}
const SupplierRegisterAgent: React.FC = () => {
const [form] = Form.useForm();
@ -12,7 +20,10 @@ const SupplierRegisterAgent: React.FC = () => {
const [loading, setLoading] = useState(false);
const [pagination, setPagination] = useState({ current: 1, pageSize: 10, total: 0 });
const [tabKey, setTabKey] = useState('dvs');
//查看是否显示状态
const [viewVisible, setViewVisible] = useState(false);
//查看 参数传递
const [currentRecord, setCurrentRecord] = useState('');
// 查询数据
const fetchData = async (page = 1, pageSize = 10) => {
setLoading(true);
@ -67,7 +78,7 @@ const SupplierRegisterAgent: React.FC = () => {
};
// 列
const columns = [
const columns: ColumnsType<Columns> = [
{
title: '序号',
dataIndex: 'index',
@ -108,7 +119,7 @@ const SupplierRegisterAgent: React.FC = () => {
align: 'center',
render: (_: any, record: any) => (
<Space>
<a onClick={() => message.info(`查看:${record.name}`)}></a>
<a onClick={() => { setCurrentRecord(record.id); setViewVisible(true); }}></a>
<a onClick={() => message.info(`编辑:${record.name}`)}></a>
</Space>
),
@ -161,7 +172,12 @@ const SupplierRegisterAgent: React.FC = () => {
showSizeChanger: true,
onChange: (current, pageSize) => handleTableChange({ current, pageSize }),
}}
bordered
/>
{/* 查看组件 */}
<SupplierViewModal
visible={viewVisible}
record={currentRecord}
onCancel={() => setViewVisible(false)}
/>
</div>
);

View File

@ -23,7 +23,7 @@ interface Data {
interface SupplierAccessDetailModalProps {
visible: boolean;
onCancel: () => void;
record?: any; // 你可以定义具体类型
record?: string; // 你可以定义具体类型
}
//主体
const SupplierAccessDetailModal: React.FC<SupplierAccessDetailModalProps> = ({ visible, onCancel, record, }) => {
@ -55,7 +55,7 @@ const SupplierAccessDetailModal: React.FC<SupplierAccessDetailModalProps> = ({ v
setLoading(true);
try {
const values = form.getFieldsValue();
const { code, data, message } = await getCategoryPage({ pageNo, pageSize , ...values});
const { code, data, message } = await getCategoryPage({ pageNo, pageSize , id:record, ...values});
if (code === 200) {
setData(data.records);
setPagination({ current: pageNo, pageSize, total: data.total });

View File

@ -7,13 +7,13 @@ import CompanyInfo from '@/components/CompanyInfo';
interface SupplierViewModalProps {
visible: boolean;
onCancel: () => void;
record?: any;
record?: string;
}
// 查看主体
const SupplierViewModal: React.FC<SupplierViewModalProps> = ({ visible, onCancel, record }) => {
return (
<Modal visible={visible} title="供应商信息查看" onCancel={onCancel} footer={null} width='80%' destroyOnClose >
<CompanyInfo viewType={true} />
<CompanyInfo viewType={true} record={record} />
</Modal>
);
};

View File

@ -39,7 +39,7 @@ const mySupplierInquiry: React.FC = () => {
//准入明细是否显示状态
const [detailVisible, setDetailVisible] = useState(false);
//查看、准入明细 参数传递
const [currentRecord, setCurrentRecord] = useState<any>(null);
const [currentRecord, setCurrentRecord] = useState('');
// 境内/境外下拉数据
const [regionOptions, setRegionOptions] = useState<OptionType[]>([]);
// 准入状态
@ -150,11 +150,11 @@ const mySupplierInquiry: React.FC = () => {
<Space>
<a
style={{ color: '#1677ff' }}
onClick={() => { setCurrentRecord(record); setViewVisible(true); }}
onClick={() => { setCurrentRecord(record.id); setViewVisible(true); }}
></a>
<a
style={{ color: '#1677ff' }}
onClick={() => { setCurrentRecord(record); setDetailVisible(true); }}
onClick={() => { setCurrentRecord(record.id); setDetailVisible(true); }}
></a>
</Space>
),

View File

@ -21,7 +21,7 @@ interface Data {
interface SupplierAccessDetailModalProps {
visible: boolean;
onCancel: () => void;
record?: any; // 你可以定义具体类型
record?: string; // 你可以定义具体类型
}
//主体
const SupplierAccessDetailModal: React.FC<SupplierAccessDetailModalProps> = ({ visible, onCancel, record, }) => {
@ -51,7 +51,7 @@ const SupplierAccessDetailModal: React.FC<SupplierAccessDetailModalProps> = ({ v
setLoading(true);
try {
const values = form.getFieldsValue();
const { code, data, message } = await getCategoryPage({ pageNo, pageSize , ...values});
const { code, data, message } = await getCategoryPage({ pageNo, pageSize, id: record, ...values});
if (code === 200) {
setData(data.records);
setPagination({ current: pageNo, pageSize, total: data.total });

View File

@ -7,14 +7,14 @@ import CompanyInfo from '@/components/CompanyInfo';
interface SupplierViewModalProps {
visible: boolean;
onCancel: () => void;
record?: any;
record?: string;
}
// 查看主体
const SupplierViewModal: React.FC<SupplierViewModalProps> = ({ visible, onCancel, record }) => {
return (
<Modal visible={visible} title="供应商信息查看" onCancel={onCancel} footer={null} width='80%' destroyOnClose >
<CompanyInfo
viewType={true} />
viewType={true} record={record} />
</Modal>
);
};

View File

@ -46,7 +46,7 @@ const RegistrationQuery: React.FC = () => {
//准入明细是否显示状态
const [detailVisible, setDetailVisible] = useState(false);
//查看、准入明细 参数传递
const [currentRecord, setCurrentRecord] = useState<any>(null);
const [currentRecord, setCurrentRecord] = useState('');
// 境内/境外下拉数据
const [regionOptions, setRegionOptions] = useState<OptionType[]>([]);
//状态 下拉数据
@ -153,11 +153,11 @@ const RegistrationQuery: React.FC = () => {
<Space>
<a
style={{ color: '#1677ff' }}
onClick={() => { setCurrentRecord(record); setViewVisible(true); }}
onClick={() => { setCurrentRecord(record.id); setViewVisible(true); }}
></a>
<a
style={{ color: '#1677ff' }}
onClick={() => { setCurrentRecord(record); setDetailVisible(true); }}
onClick={() => { setCurrentRecord(record.id); setDetailVisible(true); }}
></a>
</Space>
),

View File

@ -3,7 +3,7 @@ import {
Modal, Table, Button, Checkbox, Row, Col, Input, Select, Form, Space, message
} from "antd";
import { getSupplierCategoryPage } from '../services';
import CategorySelector from '@/components/CategorySelector';
const { Option } = Select;
interface Supplier {
@ -161,23 +161,22 @@ const SupplierSelectModal: React.FC<SupplierSelectModalProps> = ({
bodyStyle={{ padding: 24 }}
>
<Form layout="inline" form={form} style={{ marginBottom: 16 }}>
<Form.Item name="name" label="供应商名称">
<Input style={{ width: 180 }} allowClear />
<Input style={{ width: 140 }} allowClear maxLength={50} placeholder="请输入供应商名称" />
</Form.Item>
<Form.Item name="evalLevel" label="最近一次评价等级">
<Select style={{ width: 140 }} allowClear>
<Form.Item name="levelName" label="最近一次评价等级">
<Select style={{ width: 140 }} allowClear placeholder="请选择最近一次评价等级" >
{['A', 'B', 'C', 'D'].map(level => (
<Option key={level} value={level}>{level}</Option>
))}
</Select>
</Form.Item>
<Form.Item name="category" label="准入品类">
<Select style={{ width: 140 }} allowClear>
{['燃油', '润滑油', '备件'].map(cat => (
<Option key={cat} value={cat}>{cat}</Option>
))}
</Select>
<Form.Item name="categoryId" label="准入品类">
<CategorySelector multiple={false} style={{ width: 140 }} />
</Form.Item>
<Form.Item>
<Space>
<Button type="primary" onClick={handleSearch}></Button>
@ -200,7 +199,6 @@ const SupplierSelectModal: React.FC<SupplierSelectModalProps> = ({
fetchData(values, pag.current!, pag.pageSize!);
}}
size="small"
bordered
/>
</Col>
<Col span={2} style={{ textAlign: "center", display: "flex", flexDirection: "column", justifyContent: "center" }}>
@ -215,7 +213,6 @@ const SupplierSelectModal: React.FC<SupplierSelectModalProps> = ({
columns={rightColumns}
pagination={false}
size="small"
bordered
/>
</Col>
</Row>

View File

@ -27,6 +27,9 @@ interface getSupplierCategoryPageData {
supplierName?: number;
categoryId?: string;
reviewResult?: string;
levelName?: string;
name?: string;
}
export const getSupplierCategoryPage = (data: getSupplierCategoryPageData) => request.post('/coscoSupplierexit/getSupplierCategoryPage', { data });

View File

@ -3,7 +3,7 @@ import {
Modal, Table, Button, Checkbox, Row, Col, Input, Select, Form, Space, message
} from "antd";
import { getSupplierCategoryPage } from '../services';
import CategorySelector from '@/components/CategorySelector';
const { Option } = Select;
interface Supplier {
@ -161,22 +161,18 @@ const SupplierSelectModal: React.FC<SupplierSelectModalProps> = ({
bodyStyle={{ padding: 24 }}
>
<Form layout="inline" form={form} style={{ marginBottom: 16 }}>
<Form.Item name="name" label="供应商名称">
<Input style={{ width: 180 }} allowClear />
<Form.Item name="name" label="供应商名称">
<Input style={{ width: 140 }} allowClear maxLength={50} placeholder="请输入供应商名称" />
</Form.Item>
<Form.Item name="evalLevel" label="最近一次评价等级">
<Select style={{ width: 140 }} allowClear>
<Form.Item name="levelName" label="最近一次评价等级">
<Select style={{ width: 140 }} allowClear placeholder="请选择最近一次评价等级" >
{['A', 'B', 'C', 'D'].map(level => (
<Option key={level} value={level}>{level}</Option>
))}
</Select>
</Form.Item>
<Form.Item name="category" label="准入品类">
<Select style={{ width: 140 }} allowClear>
{['燃油', '润滑油', '备件'].map(cat => (
<Option key={cat} value={cat}>{cat}</Option>
))}
</Select>
<Form.Item name="categoryId" label="准入品类">
<CategorySelector multiple={false} style={{ width: 140 }} />
</Form.Item>
<Form.Item>
<Space>

View File

@ -26,6 +26,8 @@ interface getSupplierCategoryPageData {
supplierName?: number;
categoryId?: string;
reviewResult?: string;
name?: string;
levelName?: string;
}
export const getSupplierCategoryPage = (data: getSupplierCategoryPageData) => request.post('/coscoSupplierexit/getSupplierCategoryPage', { data });

View File

@ -115,10 +115,10 @@ const SupplierMessage: React.FC = () => {
<>
<Form form={form} layout="inline" style={{ marginBottom: 12 }}>
<Form.Item name="content" label="消息内容">
<Input placeholder="请输入" style={{ width: 220 }} />
<Input placeholder="请输入消息内容" style={{ width: 220 }} maxLength={50} />
</Form.Item>
<Form.Item name="type" label="业务类型">
<Select style={{ width: 200 }}>
<Select style={{ width: 200 }} placeholder="请选择业务类型">
{messageTypeOptions.map(opt => (
<Select.Option key={opt.value} value={opt.value}>{opt.label}</Select.Option>
))}