-
-
-
-
-
+
)
}
diff --git a/src/route/TrademarkMall/components/EditThree/EditThree.tsx b/src/route/TrademarkMall/components/EditThree/EditThree.tsx
index 66767ef..0d32309 100644
--- a/src/route/TrademarkMall/components/EditThree/EditThree.tsx
+++ b/src/route/TrademarkMall/components/EditThree/EditThree.tsx
@@ -1,50 +1,2163 @@
-// import React from 'react'
-import { Button } from 'antd'
-export default function editThree(props: any) {
+import { useState, useEffect } from 'react'
+import { Button, Form, Input, message, Modal, Radio, Upload, Image, Spin, Cascader, Table } from "antd"
+import type { TableColumnsType } from 'antd';
+import { uploadImageUrl, showImage } from '../../../../request/request'
+import { addTrademarkApplicant, trademarkApplicantList, deleteTrademarkApplicant, trademarkApplicantDetails, updateTrademarkApplicant, submitTrademarkApplicant } from '../../../../request/api'
+import {
+ PlusOutlined
+} from '@ant-design/icons';
+import './edit-three.css'
+import personCard from '../../../../static/editThree/personCard.png'
+import personLicense from '../../../../static/editThree/personLicense.png'
+import individualLicense from '../../../../static/editThree/individualLicense.png'
+import { getCityList } from '../../../../request/api'
+interface Option {
+ value?: string | number | null;
+ label: React.ReactNode;
+ children?: Option[];
+ isLeaf?: boolean;
+ // id: string;
+ // pId: string;
+}
+import useMessage from "antd/es/message/useMessage";
+// interface DataType {
+// key: React.Key;
+// name: string;
+// age: number;
+// address: string;
+// trademarkUserId: string;
+// }
+const { Search } = Input;
+export default function EditThree(props: any) {
+ // 申请人信息
+
+ // const [applicantData, setApplicantData] = useState({
+ // name: '',
+ // trademarkUserId: '',
+ // })
+ // 获取联系人详情
+ const getContactDetails = async (trademarkUserId: string) => {
+ try {
+ const res: any = await trademarkApplicantDetails(trademarkUserId)
+ console.log(res);
+ if (res.type == '1') {
+ setApplicantType('1')
+ setQualifications(res.subType)
+ setPersonalIdCard([
+ {
+ uid: res.identityPhoto,
+ name: res.identityPhoto,
+ status: 'done',
+ url: showImage(res.identityPhoto, false)
+ }
+ ])
+ setPersonalLicense([
+ {
+ uid: res.businessLicense,
+ name: res.businessLicense,
+ status: 'done',
+ url: showImage(res.businessLicense, false)
+ }
+ ])
+ // console.log(res.rangeAddress.split(',')[0]);
+ const rangeAddressArray = res.rangeAddress.split(',');
+ // 检查省份 ID 是否存在
+ if (rangeAddressArray.length > 0) {
+ const provinceId = rangeAddressArray[0];
+ const provinceOption = areaArray.find(option => option.value === provinceId);
+ if (provinceOption) {
+ // 加载该省份下的城市
+ loadCityList([provinceOption]);
+ }
+ }
+ // getLoadProvinces(res.rangeAddress.split(',')[0])
+ // 给formA表单赋值
+ formA.setFieldsValue({
+ identityPhoto: res.identityPhoto,
+ identity: res.identity,
+ businessLicense: res.businessLicense,
+ businessLicenseIdcard: res.businessLicenseIdcard,
+ name: res.name,
+ rangeAddress: res.rangeAddress.split(','),
+ address: res.address,
+ contactName: res.contactName,
+ contactPhone: res.contactPhone,
+ contactEmail: res.contactEmail,
+ contactAddress: res.contactAddress,
+ contactEmailCode: res.contactEmailCode,
+ })
+
+ }
+ if (res.type == '2') {
+ setApplicantType('2')
+ setEnterpriseLicense([
+ {
+ uid: res.businessLicense,
+ name: res.businessLicense,
+ status: 'done',
+ url: showImage(res.businessLicense, false)
+ }
+ ])
+ const rangeAddressArray = res.rangeAddress.split(',');
+ // 检查省份 ID 是否存在
+ if (rangeAddressArray.length > 0) {
+ const provinceId = rangeAddressArray[0];
+ const provinceOption = areaArray.find(option => option.value === provinceId);
+ if (provinceOption) {
+ // 加载该省份下的城市
+ loadCityList([provinceOption]);
+ }
+ }
+ formB.setFieldsValue({
+ // identityPhoto: res.identityPhoto,
+ // identity: res.identity,
+ businessLicense: res.businessLicense,
+ name: res.name,
+ businessLicenseIdcard: res.businessLicenseIdcard,
+ rangeAddress: res.rangeAddress.split(','),
+ address: res.address,
+ contactName: res.contactName,
+ contactPhone: res.contactPhone,
+ contactEmail: res.contactEmail,
+ contactAddress: res.contactAddress,
+ contactEmailCode: res.contactEmailCode,
+ })
+
+ }
+ } catch (error: any) {
+ // setAddLoading(false)
+ if (error.response) {
+ const data = error.response.data;
+ messageApi.open({
+ type: 'error',
+ content: data.msg ? data.msg : `${data.path}(${data.status})`,
+ });
+ } else {
+ console.error(error)
+ }
+ } finally {
+ // setAddLoading(false)
+ }
+ }
+ const [trademarkUserId, setTrademarkUserId] = useState('')
+ const [selectPeopleModal, setSelectPeopleModal] = useState(false)
+ const [selectedRowKey, setSelectedRowKey] = useState('');
+ // 临时选择的申请人信息
+ const [nowSelectPeopleData, setNowSelectPeopleData] = useState({
+ trademarkUserId: '',
+ name: '',
+ });
+ // 确定选择的申请人信息
+ const [confirmSelectPeopleData, setConfirmSelectPeopleData] = useState({
+ trademarkUserId: '',
+ name: '',
+ });
+ useEffect(() => {
+ if (props.editThreeData.trademarkUserId) {
+ setConfirmSelectPeopleData({
+ trademarkUserId: props.editThreeData.trademarkUserId,
+ name: props.editThreeData.name,
+ })
+
+ }
+ }, [props.editThreeData])
+ const [disabled, setDisabled] = useState(false)
+ const [showBtn, setShowBtn] = useState(true)
+ const columns: TableColumnsType
= [
+ // title: '名称',
+ // dataIndex: 'invoiceName',
+ // align: 'center',
+ // width: 180
+ {
+ title: '序号',
+ align: 'center',
+ dataIndex: 'trademarkUserId',
+ render: (_text, _record, index) => (page - 1) * 5 + index + 1, // 显示序号,从1开始
+ },
+ {
+ title: '申请人',
+ align: 'center',
+
+ dataIndex: 'name',
+ // render: (text: string) => {text},
+ },
+ // {
+ // title: '证件号',
+ // align: 'center',
+
+ // dataIndex: 'identity',
+ // // render: (text: string) => {text},
+ // },
+
+ {
+ title: '申请人类型',
+ dataIndex: 'type',
+ align: 'center',
+ render: (text: string) => {text == '1' ? '个人/个体工商户' : '企业'},
+ },
+ {
+ title: '联系人',
+ dataIndex: 'contactName',
+ align: 'center',
+
+ },
+ {
+ title: '联系人电话',
+ dataIndex: 'contactPhone',
+ align: 'center',
+
+ },
+ {
+
+ title: '操作',
+ align: 'center',
+ dataIndex: 'operation',
+ render: (text: string, record: any) => {
+ return (
+
+ {
+ // setApplicantData({
+ // name: record.name,
+ // trademarkUserId: record.key as string,
+ // })
+ setTrademarkUserId(record.trademarkUserId)
+ setDisabled(false)
+ setAddPeopleModal(true)
+ setShowBtn(true)
+ getContactDetails(record.trademarkUserId)
+ }}>编辑
+ {
+ setDisabled(true)
+ setAddPeopleModal(true)
+ setTrademarkUserId(record.trademarkUserId)
+ getContactDetails(record.trademarkUserId)
+ setShowBtn(false)
+ }}>查看
+ {
+ setTrademarkUserId(record.trademarkUserId)
+ setDeleteModal(true)
+ }}>删除
+
+ )
+ }
+ }
+ ];
+ const [page, setPage] = useState(1);
+ const [total, setTotal] = useState(0);
+ const [listLoading, setListLoading] = useState(false);
+ const [nowSearchKeyWords, setNowSearchKeyWords] = useState('');
+ const [searchKeyWords, setSearchKeyWords] = useState('');
+ const [tableData, setTableData] = useState([])
+ // 获取申请人列表
+ const getTrademarkApplicantList = async (page: number) => {
+ try {
+ setListLoading(true);
+ const res: any = await trademarkApplicantList({
+ page,
+ rows: 5,
+ keywords: searchKeyWords
+ })
+
+ if (res.rows.length <= 0 && page > 1) {
+ setPage(page - 1)
+ getTrademarkApplicantList(page - 1)
+ } else {
+ setTableData(res.rows)
+ setTotal(res.total)
+ setListLoading(false);
+ }
+
+ } catch (error: any) {
+ setListLoading(false)
+ if (error.response) {
+ const data = error.response.data;
+ messageApi.open({
+ type: 'error',
+ content: data.msg ? data.msg : `${data.path}(${data.status})`,
+ });
+ } else {
+ console.error(error)
+ }
+ } finally {
+ setListLoading(false)
+ }
+ }
+ useEffect(() => {
+ getTrademarkApplicantList(1)
+ setPage(1)
+ }, [searchKeyWords])
+
+ // 加载省份数据
+ const getLoadProvinces = async (cityId: string) => {
+ try {
+ // 假设传入空字符串获取省份列表
+ const res: any = await getCityList(cityId);
+ const provinces = res.map((province: any) => ({
+ value: province.areaId,
+ label: province.areaName,
+ children: [], // 标记有子节点
+ isLeaf: false,
+ }));
+ setAreaArray(provinces);
+ } catch (error: any) {
+ if (error.response) {
+ const data = error.response.data;
+ messageApi.open({
+ type: 'error',
+ content: data.msg ? data.msg : `${data.path}(${data.status})`,
+ });
+ } else {
+ console.error(error);
+ }
+ }
+ }
+ useEffect(() => {
+ getLoadProvinces('0')
+ }, []);
+
+ const [messageApi, contextHolder] = useMessage();
+ // 省市
+ const [areaArray, setAreaArray] = useState