From d58d4dd60927d5ca9ac9070e5ade96a2caf4a05e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E6=99=AF=E5=AD=A6?= <5412262+sun_jing_xue@user.noreply.gitee.com> Date: Wed, 16 Jul 2025 10:28:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=AC=E5=8F=B8=E4=BF=A1=E6=81=AF=20?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E4=BD=9C=E5=BA=9F=E4=BB=A5=E5=8F=8A=E5=9F=BA?= =?UTF-8?q?=E6=9C=AC=E4=BF=A1=E6=81=AF=20=E8=90=A5=E4=B8=9A=E6=89=A7?= =?UTF-8?q?=E7=85=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CompanyInfo/component/AttachmentsTab.tsx | 67 +++++++++---- .../CompanyInfo/component/BankInfoTab.tsx | 51 ++++++++-- .../component/BaseInfoFormModal.tsx | 35 +++---- .../CompanyInfo/component/BaseInfoTab.tsx | 32 +++++-- .../CompanyInfo/component/DomesticForm.tsx | 70 +++++++++++--- .../CompanyInfo/component/InvoiceTab.tsx | 43 +++++++-- .../component/QualificationTab.tsx | 65 ++++++++++--- src/components/CompanyInfo/services.ts | 94 +++++++++---------- 8 files changed, 314 insertions(+), 143 deletions(-) diff --git a/src/components/CompanyInfo/component/AttachmentsTab.tsx b/src/components/CompanyInfo/component/AttachmentsTab.tsx index 222d0db..484ebc1 100644 --- a/src/components/CompanyInfo/component/AttachmentsTab.tsx +++ b/src/components/CompanyInfo/component/AttachmentsTab.tsx @@ -1,12 +1,12 @@ import React, { useEffect, useState } from 'react'; -import { Table, Button } from 'antd'; +import { Table, Button, message, Switch } from 'antd'; import type { ColumnsType, TablePaginationConfig } from 'antd/es/table'; -import { battachmentsGetPage } from '../services'; +import { battachmentsGetPage, attachmentsEdit } from '../services'; import { useIntl } from 'umi'; import AttachmentsFormModal from './AttachmentsFormModal'; interface attachmentsAdd { - id?: string; + id: string; attachmentsType?: string; fileName?: string; filePath?: string; @@ -15,6 +15,7 @@ interface attachmentsAdd { fileUrl?: string; supplierId?: string; certificateUrl?: string; + delFlag: string; } interface Props { @@ -55,24 +56,35 @@ const OtherAttachmentsTab: React.FC = (props) => { setFormVisible(false); getList(); }; + //新增 const handleAdd = () => { setEditingRecord(null); setIsViewMode(false); setFormVisible(true); }; - + // 作废 修改 const handleEdit = (record: attachmentsAdd) => { setEditingRecord(record); setIsViewMode(false); setFormVisible(true); }; - + // 作废 查看 const handleView = (record: attachmentsAdd) => { setEditingRecord(record); setIsViewMode(true); setFormVisible(true); }; - + //是否作废 + const handleObsoleteChange = async (checked: boolean, id:string) => { + // 调用你的作废接口 + const res = await attachmentsEdit( { id, delFlag: checked? 'normal':'deleted' } ); + if (res.code === 200) { + message.success('操作成功'); + getList(pagination.current, pagination.pageSize); // 刷新列表 + } else { + message.error('操作失败'); + } + } //初始化 useEffect(() => { if(record) { @@ -98,19 +110,38 @@ const OtherAttachmentsTab: React.FC = (props) => { title: '更新时间', dataIndex: 'updateTime', }, - ...(viewType ? [] : [ - { - title: 'page.workbench.attachments.action', - dataIndex: 'option', - width: 120, - render: (_: any, record: attachmentsAdd) => ( - <> - handleView(record)}>查看 - handleEdit(record)}>修改 - - ), + + { + title: '是否作废', + dataIndex: 'delFlag', + align: 'center', + width: 100, + render: (value, record: attachmentsAdd) => { + let checkedType = value === 'normal' ? true : false; + return ( + handleObsoleteChange(checked, record.id)} + /> + ) + }, - ]), + }, + + // ...(viewType ? [] : [ + // { + // title: 'page.workbench.attachments.action', + // dataIndex: 'option', + // width: 120, + // render: (_: any, record: attachmentsAdd) => ( + // <> + // handleView(record)}>查看 + // handleEdit(record)}>修改 + // + // ), + // }, + // ]), ]; return (
diff --git a/src/components/CompanyInfo/component/BankInfoTab.tsx b/src/components/CompanyInfo/component/BankInfoTab.tsx index b3ec7b5..62f8c67 100644 --- a/src/components/CompanyInfo/component/BankInfoTab.tsx +++ b/src/components/CompanyInfo/component/BankInfoTab.tsx @@ -1,7 +1,7 @@ import React, { useEffect, useState } from 'react'; -import { Table, Button } from 'antd'; +import { Table, Button, message, Switch } from 'antd'; import type { ColumnsType, TablePaginationConfig } from 'antd/es/table'; -import { bankGetPage } from '../services'; +import { bankGetPage, bankEdit } from '../services'; import { useIntl } from 'umi'; import BankFormModal from './BankFormModal'; @@ -16,6 +16,7 @@ interface BankInfo { nation: string; province: string; supplierId: string; + delFlag: string; swiftCode: null; } interface Props { @@ -55,24 +56,35 @@ const BankInfoTab: React.FC = (props) => { setFormVisible(false); getList(); }; + //新增 const handleAdd = () => { setEditingRecord(null); setIsViewMode(false); setFormVisible(true); }; - + //修改 const handleEdit = (record: BankInfo) => { setEditingRecord(record); setIsViewMode(false); setFormVisible(true); }; - + // 查看 const handleView = (record: BankInfo) => { setEditingRecord(record); setIsViewMode(true); setFormVisible(true); }; - + //是否作废 + const handleObsoleteChange = async (checked: boolean, id:string) => { + // 调用你的作废接口 + const res = await bankEdit( { id, delFlag: checked? 'normal':'deleted' } ); + if (res.code === 200) { + message.success('操作成功'); + getList(pagination.current, pagination.pageSize); // 刷新列表 + } else { + message.error('操作失败'); + } + } //初始化 useEffect(() => { if(record) { @@ -111,22 +123,22 @@ const BankInfoTab: React.FC = (props) => { }, { title: 'page.workbench.bank.currency', - dataIndex: 'currency', + dataIndex: 'currencyName', key: 'currency', ellipsis: true }, { title: 'page.workbench.bank.nation', - dataIndex: 'nation', + dataIndex: 'nationName', key: 'nation', ellipsis: true }, { title: 'page.workbench.bank.province', - dataIndex: 'province', + dataIndex: 'provinceName', key: 'province', ellipsis: true }, { title: 'page.workbench.bank.city', - dataIndex: 'city', + dataIndex: 'cityName', key: 'city', ellipsis: true }, { @@ -134,6 +146,23 @@ const BankInfoTab: React.FC = (props) => { dataIndex: 'updateTime', key: 'updateTime', ellipsis: true }, + { + title: '是否作废', + dataIndex: 'delFlag', + align: 'center', + width: 100, + render: (value, record) => { + let checkedType = value === 'normal' ? true : false; + return ( + handleObsoleteChange(checked, record.id)} + /> + ) + + }, + }, ...(viewType ? [] : [ { title: 'page.workbench.attachments.action', @@ -142,7 +171,9 @@ const BankInfoTab: React.FC = (props) => { render: (_: any, record: BankInfo) => ( <> handleView(record)}>查看 - handleEdit(record)}>修改 + {record.delFlag === 'normal' && ( + handleEdit(record)}>修改 + )} ), }, diff --git a/src/components/CompanyInfo/component/BaseInfoFormModal.tsx b/src/components/CompanyInfo/component/BaseInfoFormModal.tsx index 91c19f9..e07941c 100644 --- a/src/components/CompanyInfo/component/BaseInfoFormModal.tsx +++ b/src/components/CompanyInfo/component/BaseInfoFormModal.tsx @@ -94,6 +94,8 @@ const BaseInfoFormModal: React.FC = ({ //数据初始化 useEffect(() => { if (visible && initialValues) { + console.log(initialValues,'initialValues'); + form.setFieldsValue({ ...changeData, coscoSupplierBase: { @@ -106,29 +108,13 @@ const BaseInfoFormModal: React.FC = ({ url: initialValues.licenceAccessory, thumbUrl: initialValues.licenceAccessory, }] - : [], - }, - attachment: changeData?.coscoSupplierSurveyAttachments - ? [{ - uid: '-1', - name: changeData?.coscoSupplierSurveyAttachments[0].fileName, - url: changeData?.coscoSupplierSurveyAttachments[0].fileUrl, - status: 'done', - response: { - fileName: changeData?.coscoSupplierSurveyAttachments[0].fileName, - fileType: changeData?.coscoSupplierSurveyAttachments[0].fileType, - fileSize: changeData?.coscoSupplierSurveyAttachments[0].fileSize, - filePath: changeData?.coscoSupplierSurveyAttachments[0].filePath, - fileUrl: changeData?.coscoSupplierSurveyAttachments[0].fileUrl, - attachmentsType: "change", - } - }] - : [], + : [] + } }); setChangeComparisonData({ name: initialValues.name, - range: initialValues.range, + range: initialValues.range }) setViewData({ ...changeData, @@ -151,7 +137,6 @@ const BaseInfoFormModal: React.FC = ({ message.success(`验证码已发送至 ${values.contactPhone}`); let count = 60; setCountdown(count); - const timer = setInterval(() => { count--; setCountdown(count); @@ -172,6 +157,8 @@ const BaseInfoFormModal: React.FC = ({ title: '是否确认个人信息变更?', onOk: async () => { const values = await form.validateFields(); + console.log(values,'values'); + const payload = { ...values, }; @@ -281,11 +268,11 @@ const BaseInfoFormModal: React.FC = ({ <> - + = ({ Array.isArray(e) ? e : e?.fileList} diff --git a/src/components/CompanyInfo/component/BaseInfoTab.tsx b/src/components/CompanyInfo/component/BaseInfoTab.tsx index 708bb0e..9f1d69a 100644 --- a/src/components/CompanyInfo/component/BaseInfoTab.tsx +++ b/src/components/CompanyInfo/component/BaseInfoTab.tsx @@ -98,9 +98,28 @@ const BaseInfoTab: React.FC = (props) => { style={{ background: '#fff', padding: '16px 0 0' }} > {registerInfo.coscoSupplierBase.supplierType === 'dvs' && ( - - {intl.formatMessage({ id: 'component.globalModal.domesticEnterprise' })} - + <> + + {intl.formatMessage({ id: 'component.globalModal.domesticEnterprise' })} + + + {registerInfo.coscoSupplierBase.licenceAccessory ? ( + + 营业执照 + + ) : ( + 无附件 + )} + + )} {registerInfo.coscoSupplierBase.name} @@ -151,6 +170,9 @@ const BaseInfoTab: React.FC = (props) => { {registerInfo.coscoSupplierBase.regAddress} + + {registerInfo.coscoSupplierBase.contactsTypeName} + {registerInfo.coscoSupplierBase.idCard} @@ -160,10 +182,6 @@ const BaseInfoTab: React.FC = (props) => { {registerInfo.coscoSupplierBase.contactsPhone} - - - {registerInfo.coscoSupplierBase.contactsType} - )} diff --git a/src/components/CompanyInfo/component/DomesticForm.tsx b/src/components/CompanyInfo/component/DomesticForm.tsx index 72961b7..cf657cc 100644 --- a/src/components/CompanyInfo/component/DomesticForm.tsx +++ b/src/components/CompanyInfo/component/DomesticForm.tsx @@ -4,7 +4,7 @@ import { Form, Input, Select, Row, Col, message, Upload, Button } from 'antd'; import type { UploadProps } from 'antd'; import { UploadOutlined } from '@ant-design/icons'; import { uploadFile } from '../services'; - +import type { UploadFile } from 'antd/es/upload/interface'; import { getDictList } from '@/servers/api/dicts'; import type { DictItem } from '@/servers/api/dicts'; const { Option } = Select; @@ -22,6 +22,8 @@ interface ForeignFormProps { const DomesticForm: React.FC = ({ form, countdown, handleGetCaptcha }) => { const [contactsType, setContactsType] = useState([]); const [enterpriseType, setEnterpriseType] = useState([]); + //上传得图片 + const [licenceFileList, setLicenceFileList] = useState([]); useEffect(() => { getDictList('contacts_type').then((res) => { if (res.code === 200) { @@ -33,11 +35,26 @@ const DomesticForm: React.FC = ({ form, countdown, handleGetCa setEnterpriseType(res.data); } }); + const licenceAccessory = form.getFieldValue(['coscoSupplierBase', 'licenceAccessory']); + if (licenceAccessory) { + setLicenceFileList([{ + uid: '-1', + name: '营业执照', + status: 'done', + url: licenceAccessory, + thumbUrl: licenceAccessory, + }]); + } else { + setLicenceFileList([]); + } }, []) //上传接口 const uploadProps: UploadProps = { name: 'file', + accept: 'image/*', + fileList: licenceFileList, + maxCount: 1, showUploadList: true, beforeUpload: (file) => { if (file.size > 1048576) { // 1MB @@ -50,18 +67,39 @@ const DomesticForm: React.FC = ({ form, countdown, handleGetCa try { const realFile = file as File; const res = await uploadFile(realFile); - const uploadedFile = { - uid: res.fileSize, + const uploadedFile: UploadFile = { + uid: String(res.fileSize), name: res.fileName, status: 'done', url: res.url, + thumbUrl: res.url, }; + setLicenceFileList([uploadedFile]); + + // 让表单跟随 + form.setFieldsValue({ + coscoSupplierBase: { + ...form.getFieldValue('coscoSupplierBase'), + licenceAccessoryD: [uploadedFile] + } + }); + onSuccess?.(uploadedFile, new XMLHttpRequest()) message.success('上传成功'); } catch (err: any) { onError?.(err); message.error(err.message || '上传失败'); } + }, + onRemove: () => { + setLicenceFileList([]); + form.setFieldsValue({ + coscoSupplierBase: { + ...form.getFieldValue('coscoSupplierBase'), + licenceAccessoryD: [] + } + }); + return true; } }; return ( @@ -281,20 +319,26 @@ const DomesticForm: React.FC = ({ form, countdown, handleGetCa - Array.isArray(e) ? e : e?.fileList} - > - + Array.isArray(e) ? e : e?.fileList} + rules={[{ required: true, message: '请上传营业执照' }]} + > + + {licenceFileList.length < 1 && ( - - - + )} + + + + + + diff --git a/src/components/CompanyInfo/component/InvoiceTab.tsx b/src/components/CompanyInfo/component/InvoiceTab.tsx index 5849e0b..39ac318 100644 --- a/src/components/CompanyInfo/component/InvoiceTab.tsx +++ b/src/components/CompanyInfo/component/InvoiceTab.tsx @@ -1,7 +1,7 @@ import React, { useEffect, useState } from 'react'; -import { Table, Button } from 'antd'; +import { Table, Button, Switch, message } from 'antd'; import type { ColumnsType, TablePaginationConfig } from 'antd/es/table'; -import { invoiceGetPage } from '../services'; +import { invoiceGetPage, invoiceEdit } from '../services'; import { useIntl } from 'umi'; import InvoiceFormModal from './InvoiceFormModal'; @@ -16,6 +16,7 @@ interface InvoiceInfo { account: string; updateTime: string; certificateUrl: string; + delFlag: string; } interface InvoiceTabProps { @@ -57,24 +58,35 @@ const InvoiceTab: React.FC = (props) => { setFormVisible(false); getList(); }; + //新增 const handleAdd = () => { setEditingRecord(null); setIsViewMode(false); setFormVisible(true); }; - + // 修改 const handleEdit = (record: InvoiceInfo) => { setEditingRecord(record); setIsViewMode(false); setFormVisible(true); }; - + // 查看 const handleView = (record: InvoiceInfo) => { setEditingRecord(record); setIsViewMode(true); setFormVisible(true); }; - + //是否作废 + const handleObsoleteChange = async (checked: boolean, id:string) => { + // 调用你的作废接口 + const res = await invoiceEdit( { id, delFlag: checked? 'normal':'deleted' } ); + if (res.code === 200) { + message.success('操作成功'); + getList(pagination.current, pagination.pageSize); // 刷新列表 + } else { + message.error('操作失败'); + } + } //初始化 useEffect(() => { if(record) { @@ -92,6 +104,23 @@ const InvoiceTab: React.FC = (props) => { { title: 'page.workbench.invoice.bank', dataIndex: 'bank', ellipsis: true }, { title: 'page.workbench.invoice.account', dataIndex: 'account', ellipsis: true }, { title: 'page.workbench.invoice.updateTime', dataIndex: 'updateTime', ellipsis: true }, + { + title: '是否作废', + dataIndex: 'delFlag', + align: 'center', + width: 100, + render: (value, record) => { + let checkedType = value === 'normal' ? true : false; + return ( + handleObsoleteChange(checked, record.id)} + /> + ) + + }, + }, { title: 'page.workbench.invoice.qualificationCertificate', width: '180px', @@ -106,7 +135,9 @@ const InvoiceTab: React.FC = (props) => { render: (_: any, record: InvoiceInfo) => ( <> handleView(record)}>查看 - handleEdit(record)}>修改 + {record.delFlag === 'normal' && ( + handleEdit(record)}>修改 + )} ), }, diff --git a/src/components/CompanyInfo/component/QualificationTab.tsx b/src/components/CompanyInfo/component/QualificationTab.tsx index bf6662d..8297aa5 100644 --- a/src/components/CompanyInfo/component/QualificationTab.tsx +++ b/src/components/CompanyInfo/component/QualificationTab.tsx @@ -1,7 +1,7 @@ import React, { useEffect, useState } from 'react'; -import { Table, Button, message } from 'antd'; +import { Table, Button, Switch, message } from 'antd'; import type { ColumnsType, TablePaginationConfig } from 'antd/es/table'; -import { qualificationsGetPage } from '../services'; +import { qualificationsGetPage, qualificationsEdit } from '../services'; import { useIntl } from 'umi'; import QualificationFormModal from './QualificationFormModal'; @@ -15,6 +15,7 @@ interface Qualification { dateTime: string; termOfValidity: string; updateTime: string; + delFlag: string; } interface QualificationTabProps { @@ -33,7 +34,7 @@ const QualificationTab: React.FC = (props) => { const [formVisible, setFormVisible] = useState(false); const [editingRecord, setEditingRecord] = useState(null); const [isViewMode, setIsViewMode] = useState(false); - + //列表渲染 const getList = async (pageNo = 1, pageSize = 10) => { setLoading(true); try { @@ -46,36 +47,49 @@ const QualificationTab: React.FC = (props) => { setLoading(false); } }; - + //初始化 useEffect(() => { - if(record) { + if (record) { getList(); } }, [record]); - + //打开新增 const handleAdd = () => { setEditingRecord(null); setIsViewMode(false); setFormVisible(true); }; - + //打开修改 const handleEdit = (record: Qualification) => { setEditingRecord(record); setIsViewMode(false); setFormVisible(true); }; - + //打开查看 const handleView = (record: Qualification) => { setEditingRecord(record); setIsViewMode(true); setFormVisible(true); }; + //提交回调 const handleFormSubmit = () => { setFormVisible(false); getList(); }; + //是否作废 + const handleObsoleteChange = async (checked: boolean, id:string) => { + // 调用你的作废接口 + const res = await qualificationsEdit( { id, delFlag: checked? 'normal':'deleted' } ); + if (res.code === 200) { + message.success('操作成功'); + getList(pagination.current, pagination.pageSize); // 刷新列表 + } else { + message.error('操作失败'); + } + } + const columns: ColumnsType = [ { title: 'page.workbench.certificateType', dataIndex: 'certificateType', ellipsis: true }, { title: 'page.workbench.certificateName', dataIndex: 'name', ellipsis: true }, @@ -85,18 +99,39 @@ const QualificationTab: React.FC = (props) => { { title: 'page.workbench.dateTime', dataIndex: 'dateTime', ellipsis: true }, { title: 'page.workbench.termOfValidity', dataIndex: 'termOfValidity', ellipsis: true }, { title: 'page.workbench.updateTime', dataIndex: 'updateTime', ellipsis: true }, - + { + title: '是否作废', + dataIndex: 'delFlag', + align: 'center', + width: 100, + render: (value, record) => { + let checkedType = value === 'normal' ? true : false; + return ( + handleObsoleteChange(checked, record.id)} + /> + ) + + }, + }, + ...(viewType ? [] : [ { title: 'page.workbench.attachments.action', dataIndex: 'option', width: 120, - render: (_: any, record: Qualification) => ( - <> - handleView(record)}>查看 - handleEdit(record)}>修改 - - ), + render: (_: any, record: Qualification) => { + return ( + <> + handleView(record)}>查看 + {record.delFlag === 'normal' && ( + handleEdit(record)}>修改 + )} + + ) + } } ]), ]; diff --git a/src/components/CompanyInfo/services.ts b/src/components/CompanyInfo/services.ts index 5bf4a5a..d964088 100644 --- a/src/components/CompanyInfo/services.ts +++ b/src/components/CompanyInfo/services.ts @@ -25,16 +25,17 @@ export const qualificationsView = (id: string) => request.get(`/qualifications/$ * 资质新增 */ interface qualificationsaAdd { - id: string; - accessory: string; - authority: string; - certificateType: string; - code: string; - dateTime: string; - name: string; - supplierId: string; - termOfValidity: string; - typeLevel: string; + id?: string; + accessory?: string; + authority?: string; + certificateType?: string; + code?: string; + dateTime?: string; + name?: string; + supplierId?: string; + termOfValidity?: string; + typeLevel?: string; + delFlag?: string; } export const qualificationsaAdd = (data: qualificationsaAdd) => request.post('/qualifications', { data }); /** @@ -77,16 +78,18 @@ export const invoiceView = (id: string) => request.get(`/invoice/${id}`); * 开票新增 */ interface invoiceAdd { - id: string; - account: string; - address: string; - bank: string; - head: string; - phone: string; - qualificationCertificate: string; - supplierId: string; - taxpayerCode: string; - taxpayerType: string; + id?: string; + account?: string; + address?: string; + bank?: string; + head?: string; + phone?: string; + qualificationCertificate?: string; + supplierId?: string; + taxpayerCode?: string; + taxpayerType?: string; + delFlag?: string; + } export const invoiceAdd = (data: invoiceAdd) => request.post('/invoice', { data }); /** @@ -116,17 +119,18 @@ export const bankView = (id: string) => request.get(`/bank/${id}`); * 银行新增 */ interface bankAdd { - id: string; - account: string; - accountName: string; - bank: string; - city: string; - currency: string; - interbankNumber: string; - nation: string; - province: string; - supplierId: string; - swiftCode: null; + id?: string; + account?: string; + accountName?: string; + bank?: string; + city?: string; + currency?: string; + interbankNumber?: string; + nation?: string; + province?: string; + supplierId?: string; + swiftCode?: null; + delFlag?: string; [property: string]: any; } export const bankAdd = (data: bankAdd) => request.post('/bank', { data }); @@ -157,14 +161,15 @@ export const attachmentskView = (id: string) => request.get(`/attachments/${id}` * 附件新增 */ interface attachmentsAdd { - id: string; - attachmentsType: string; - fileName: string; - filePath: string; - fileSize: string; - fileType: string; - fileUrl: string; - supplierId: string; + id?: string; + attachmentsType?: string; + fileName?: string; + filePath?: string; + fileSize?: string; + fileType?: string; + fileUrl?: string; + supplierId?: string; + delFlag?: string; [property: string]: any; } export const attachmentsAdd = (data: attachmentsAdd) => request.post('/attachments', { data }); @@ -231,17 +236,6 @@ export const updateSupplierBase = (data: updateSupplierBase) => request.post('/c - - - - - - - - - - -