import { btnAuthority } from "@/utils/authority"; import ProTable, { ProColumns } from "@ant-design/pro-table"; import { Button, Card, Col, Input, message, Modal, Row, Spin, } from "antd"; import React, { useEffect, useRef, useState } from "react"; import '@/assets/xsy_style.less'; import { getSupplierList, getSupplierUser } from "@/utils/SupplierList/service"; import { getURLInformation } from "@/utils/CommonUtils"; import { addGys, addMan, deleteGys, getSimpleList } from "./simpleUploadServis"; import ExtendUpload from "@/utils/ExtendUpload"; import { SnowflakeID } from "@/services/untilService"; const SimpleUpload: React.FC<{}> = (props) => { //=======================================================================state const [spin, spinSet] = useState(false); const [data, dataSet] = useState([]); const roomId = getURLInformation('roomId'); const bsId = getURLInformation('bsId'); const tpId = getURLInformation('tpId'); const dis = getURLInformation('dis') == '3'; //添加供应商 const [addVis, addVisSet] = useState(false); const [serchVal, serchValSet] = useState(''); const [gysData, gysDataSet] = useState([]); const [spinGys, spinGysSet] = useState(false); const serchGysRef = useRef(null) //选择联系人 const [manVis, manVisSet] = useState(false); const [companyId, companyIdSet] = useState(false); const [recordId, recordIdSet] = useState(''); const [spinMan, spinManSet] = useState(false); //上传文件 const [fileVis, fileVisSet] = useState(false); const [UploadID, setUploadID] = useState(); //upload 业务id const [spinUp, spinUpSet] = useState(false); //查询分页数据 const [pageData, pageDataSet] = useState({ total: 0, pageNum: 1, pageSize: 10 }); const columns: ProColumns[] = [ { title: '序号', valueType: 'index', width: 60 }, { title: '机构编号', dataIndex: 'companyId', }, { title: '供应商', dataIndex: 'companyName', }, { title: '联系人', dataIndex: 'bidUserName', }, { title: '联系人账号', dataIndex: 'bidUserId', }, { title: '应答文件上传状态', dataIndex: 'decryptStatus', render: (_, record,) => { if (record.singleSourceAnswerFile != '' && record.singleSourceAnswerFile != null) { return '已上传' } else { return '未上传' } } }, { title: '操作', dataIndex: 'option', valueType: 'option', render: (_, record, index) => { return ( <> ) } }, ]; const columnsGys: ProColumns<{}>[] = [ { title: '供应商名称', dataIndex: 'partnerName', key: 'partnerName', align: 'left', }, { title: '供应商编号', dataIndex: 'organizationCode', key: 'organizationCode', hideInSearch: true,//列表中显示,查询条件中不显示 align: 'left', }, { title: '操作', dataIndex: 'status', key: "", hideInSearch: true,//列表中显示,查询条件中不显示 align: 'left', render: (_: any, record: any) => ( ) }, ]; const columnsMan: ProColumns<{}>[] = [ { title: '联系人', dataIndex: 'empName', key: 'empName', align: 'left', }, { title: '账号', dataIndex: 'userAccount', key: 'userAccount', search: false, align: 'left', }, { title: '电话', dataIndex: 'mobile', key: 'mobile', search: false, align: 'left', }, { title: '操作', dataIndex: 'status', align: 'left', search: false, render: (_: any, record: any) => ( ) }, ]; //=======================================================================func useEffect(() => { serchList(); }, []); useEffect(() => { addVis && serchGys(); }, [pageData.pageNum]); //查询列表 async function serchList() { spinSet(true); await getSimpleList(roomId).then((res) => { if (res.success) { dataSet(res.data) } }) spinSet(false); } //查询供应商 async function serchGys() { spinGysSet(true); await getSupplierList({ partnerName: serchVal, pageNum: pageData.pageNum }).then((res) => { if (res.success) { gysDataSet(res.data.records); pageDataSet({ ...pageData, total: res.data.total }); if (res.data.records.length == 0) { message.info('无符合条件的供应商,请确认输入的供应商名称是否正确。') } } }) spinGysSet(false); } //选择供应商 async function chooseGys(record: any) { spinGysSet(true); const params = { companyId: record.partnerMdmCode, companyName: record.partnerName, assessRoomId: roomId, packageId: bsId, projectId: tpId, } await addGys(params).then((res) => { if (res.success) { message.success('选择供应商成功,请选择邀请账号。'); addVisSet(false); serchList(); } }); addVisSet(false); spinGysSet(false); } /*选择供应商联系人*/ const chooseSupplierUser = async (param: any) => { await addMan(param).then(res => { if (res.code == 200) { message.success("保存成功"); } }) } //=======================================================================dom function addModal() { return ( { addVisSet(false); pageDataSet({ total: 0, pageNum: 1, pageSize: 10 }); }} > { serchValSet(e.target.value) }} onPressEnter={() => serchGys()} placeholder='请输入要查询的供应商名称' /> { gysData.length != 0 && pageDataSet({ ...pageData, pageNum: page, pageSize: pageSize }), onShowSizeChange: (current, size) => pageDataSet({ ...pageData, pageNum: current, pageSize: size }), }} /> } ) } function renderFooter() { return ( <> ) } function renderFooterUp() { return ( <> ) } //联系人modal function chooseMan() { return ( { manVisSet(false); pageDataSet({ total: 0, pageNum: 1, pageSize: 10 }); }} > { const msg = await getSupplierUser({ ...params, partnerMdmCode: companyId, pageNum: params.current, pageSize: params.pageSize, }); return { data: msg.data?.records, success: msg?.success, total: msg?.data.total, } }} pagination={{ defaultPageSize: 10, showSizeChanger: false, }} /> ) } //上传文件 function uploadFile() { return ( fileVisSet(false)} > 应答文件: 上传成功后,请点击保存按钮 (单个附件最大30MB) ) } return (

添加供应商及上传应答文件

{addModal()} {chooseMan()} {uploadFile()}
) } export default SimpleUpload;