From 06e26bc36684bfccdd8feb3ad0a4a84ec6c358bb Mon Sep 17 00:00:00 2001 From: lyp Date: Thu, 29 May 2025 17:02:18 +0800 Subject: [PATCH] =?UTF-8?q?app=E7=94=B5=E5=AD=90=E8=BD=AF=E8=91=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/request/api.ts | 8 +- src/route/AppElectron/AppEdit.tsx | 31 +- src/route/AppElectron/AppElectron.tsx | 171 ++++- .../components/AppInfo/AppInfo.tsx | 632 ++++++++++++------ .../components/AppInfo/app-info.css | 5 +- .../components/EditAppFiles/EditAppFiles.tsx | 15 +- .../components/EditAppInfo/EditAppInfo.tsx | 16 +- .../AppElectron/components/File/File.tsx | 482 +++++++++++++ src/route/index/Index.tsx | 5 +- 9 files changed, 1129 insertions(+), 236 deletions(-) create mode 100644 src/route/AppElectron/components/File/File.tsx diff --git a/src/request/api.ts b/src/request/api.ts index 8b50a97..e4e87ac 100644 --- a/src/request/api.ts +++ b/src/request/api.ts @@ -134,7 +134,8 @@ export const runSystemList = () => aiShopRequest.get(`/aishop/api/data/listbypar export const bigClassList = () => aiShopRequest.get(`/aishop/api/data/listbyparentid/8abb5b58-83d2-465c-b164-a189efee28c1`) // 获取小类 export const twoClass = (id:string) => aiShopRequest.get(`/aishop/api/data/listbyparentid/${id}`) - +// 通过类得id获取内容 +export const getContent = (id:string) => aiShopRequest.get(`/aishop/api/data/get/${id}`) // 下单购买APP电子软著 export const buyAppGoods = (orderMoneyId:string) => aiShopRequest.post(`/aishop/api/apporder/pay/${orderMoneyId}`) // 获取我的app电子软著订单列表 @@ -149,7 +150,8 @@ export const agreementWord = (appOrderId:string,appName:string,versionName:strin export const sourceCodeWord = (appOrderId:string,) => aiShopRequest.get(`aishop/api/apporder/create-file/SHOP02/${appOrderId}?name=源码文档示例`) // 生成软件文档word文件 export const softwareDocumentWord = (appOrderId:string,) => aiShopRequest.get(`aishop/api/apporder/create-file/SHOP03/${appOrderId}?name=软件文档示例`) - +// 补充资料 +export const supplementAppData = (params:any) => aiShopRequest.post(`/aishop/api/correction/save-app`, params) // 获取文件详细信息 export const fileDetail = (fileId:string) => aiShopRequest.get(`aishop/api/file/list?ids=${fileId}`) // 第一步 企业认证 @@ -158,5 +160,7 @@ export const companyAuth = (appOrderId:any,params:any) => aiShopRequest.post(`ai export const softwareInfo = (appOrderId:any,params:any) => aiShopRequest.post(`aishop/api/apporder/update/2/${appOrderId}`,params) // 第三步 上传鉴别材料 export const uploadMaterial = (appOrderId:any,params:any) => aiShopRequest.post(`/aishop/api/apporder/update/3/${appOrderId}`,params) +// 第四步 提交审核 +export const submitapp = (appOrderId:any) => aiShopRequest.post(`/aishop/api/apporder/update/sub-check/${appOrderId}`) // ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ \ No newline at end of file diff --git a/src/route/AppElectron/AppEdit.tsx b/src/route/AppElectron/AppEdit.tsx index 3bd8361..9537b33 100644 --- a/src/route/AppElectron/AppEdit.tsx +++ b/src/route/AppElectron/AppEdit.tsx @@ -35,12 +35,12 @@ export default function AppEdit() { const getRunSystemList = async () => { try { const res: any = await runSystemList(); - console.log('运行系统选项', res.map((item: any) => { - return { - label: item.dataName, - value: item.dataName, - } - })); + // console.log('运行系统选项', res.map((item: any) => { + // return { + // label: item.dataName, + // value: item.dataName, + // } + // })); setSystemList(res.map((item: any) => { return { label: item.dataName, @@ -123,6 +123,7 @@ export default function AppEdit() { companyPhoto: '', // 企业照片 companyAuth: '',//授权书 }); + const [checkStatus, setCheckStatus] = useState('') //审核状态 // 软件基本信息 const [appInfo, setAppInfo] = useState({ appName: '', // 项目名称 @@ -131,7 +132,9 @@ export default function AppEdit() { packageName: '', // 包名APPID systemName: '', // 运行系统 bigClassify: '', // 软件分类(大类) + // bigClassifyName: '', subClassify: '', // 软件分类(小类) + // subClassifyName: '', developWay: '', // 开发方式 completeTime: '', // 开发完成时期 projOwnerName: '',//著作权人姓名 @@ -139,11 +142,13 @@ export default function AppEdit() { projOwnerId: '',//著作权人信息ID getFile: '',//获取文件 }) + // 材料信息 const [filesInfo, setFilesInfo] = useState({ sourceCodeDocFile: '',//源码 softwareDocFile: '',//软件 }) + const [checkRemark, setCheckRemark] = useState('') //未通过原因 // 文件想想请 // const [fileList, setFileList] = useState([]); // 获取详情 @@ -152,7 +157,7 @@ export default function AppEdit() { setLoading(true) const res: any = await appOrderDetail(appOrderId); - console.log('详情', res); + // console.log('详情', res); setCompanyInfo({ companyName: res.companyName, // 企业名称 companyNumber: res.companyNumber, // 企业统一社会信用代码 @@ -173,12 +178,16 @@ export default function AppEdit() { projOwnerIdentity: res.projOwnerIdentity,//著作权人证件号 projOwnerId: res.projOwnerId,//著作权人信息ID getFile: res.getFile,//获取文件 + // bigClassifyName: res.bigClassifyName, + // subClassifyName: res.subClassifyName, }) setFilesInfo({ sourceCodeDocFile: res.sourceCodeDocFile,//源码 softwareDocFile: res.softwareDocFile,//软件 }) setEditProcess(Number(res.appOrderProgress) + 1) + setCheckStatus(res.checkStatus) + setCheckRemark(res.checkRemark) // const fileres: any = await fileDetail(res.getFile) // console.log('文件详情', fileres); @@ -393,6 +402,10 @@ export default function AppEdit() { } }> */} { + setCheckStatus(value) + }} appOrderId={appOrderId} companyInfo={companyInfo} appInfo={appInfo} @@ -401,7 +414,9 @@ export default function AppEdit() { (num: number) => { setEditProcess(num) } - }> + } + checkRemark={checkRemark} + > {/*
state) const data = redxuState.appGoodsListData; + const [checkRemarkModal, setCheckRemarkModal] = useState(false) //未通过原因弹窗 + const [checkRemark, setCheckRemark] = useState('') //未通过原因 const columns: TableProps['columns'] = [ { title: '序号', @@ -68,7 +76,7 @@ export default function AppElectron() { }, render: (text, record) => ( - {text ? ` ${record.bigClassifyName} / ${record.subClassifyName}` : '未完善'} + {text ? ` ${record.bigClassifyName} - ${record.subClassifyName}` : '未完善'} ) }, @@ -97,9 +105,35 @@ export default function AppElectron() { align: 'center', key: 'appOrderId', width: 100, - render: (text) => ( + render: (text, record) => ( - {text == '1' ? '待审核' : text == '2' ? '通过' : text == '0' ? '未通过' : '未提交'} + {text == '1' ? + 待审核 + : text == '2' ? + 通过 + : text == '0' ? + { + setCheckRemark(record.checkRemark) + setCheckRemarkModal(true) + }} + >未通过 + : + 未提交 + } ) }, @@ -108,10 +142,10 @@ export default function AppElectron() { dataIndex: 'appOrderStatus', align: 'center', key: 'appOrderId', - width: 100, + width: 150, render: (text) => ( - {text == '1' ? '未付款' : text == '2' ? '资料填写中' : text == '3' ? '资料审核中' : text == '4' ? '下线申请中' : text == '5' ? '已下证' : '未知'} + {text == '1' ? '未付款' : text == '2' ? '资料填写中' : text == '3' ? '资料审核中' : text == '4' ? '线下申请中' : text == '5' ? '已下证' : '未知'} ) }, @@ -121,21 +155,79 @@ export default function AppElectron() { // dataIndex: 'contractManagementId', align: 'center', key: 'appOrderId', - width: 200, + width: 150, // bordeLeft: true, fixed: 'right', render: (record) => (
- }} onClick={() => { - nav(`/app-edit/${record.appOrderId}`) - // console.log(record); +
编辑
+ }} onClick={() => { + nav(`/app-edit/${record.appOrderId}`) + // console.log(record.checkStatus); + + + }}>{record.checkStatus == '' ? '编辑' : record.checkStatus == '0' ? '修改' : '查看'}
+
0 && record.appOrderStatus != '5' ? 'unset' : 'none', + + }} + onClick={() => { + setFileModal(true) + // console.log(record); + setAppOrderId(record.appOrderId) + + }} + > + 资料补充 +
+ {record.waitCorrectionCount} +
+
+
{ + console.log(record.appOrderResultFile); + + window.open(showImage(record.appOrderResultFile, false)); + }} + > + 查看证书 + +
+
) }, @@ -164,7 +256,7 @@ export default function AppElectron() { val: res }) } catch (error: any) { - + setLoading(false) if (error.response) { const data = error.response.data; messageApi.open({ @@ -242,7 +334,56 @@ export default function AppElectron() { )} + { + setCheckRemarkModal(false) + }} + // onOk={ + // // setModal(false) + // clickOk + // } + > + +
+ {checkRemark} +
+ +
+ { + // setOrderDetailModal(false) + // }} + onCancel={() => { + setFileModal(false) + }} + width={1150} + centered + > + { + getAppOrderList(page) + }} + user={'buy'} + orderId={appOrderId}> + diff --git a/src/route/AppElectron/components/AppInfo/AppInfo.tsx b/src/route/AppElectron/components/AppInfo/AppInfo.tsx index a12b5d7..e571976 100644 --- a/src/route/AppElectron/components/AppInfo/AppInfo.tsx +++ b/src/route/AppElectron/components/AppInfo/AppInfo.tsx @@ -1,207 +1,455 @@ +import { useEffect, useState } from 'react'; import './app-info.css' -import { Button, message } from "antd" +import { Button, message, Spin, Modal } from "antd" +import { fileDetail, submitapp, getContent } from '../../../../request/api' +import { showImage } from '../../../../request/request' export default function AppInfo(props: any) { + const [messageApi, contextHolder] = message.useMessage(); const height = window.innerHeight - 460; + const [loading, setLoading] = useState(false); + const [modal, setModal] = useState(false); const handleSubmit = () => { - message.success('提交成功'); - + setModal(true) + // message.success('提交成功'); + // props.setCheckStatus('1') }; + const clickOk = async () => { + try { + setLoading(true) + await submitapp(props.appOrderId) + setModal(false) + setLoading(false) + message.success('提交成功'); + props.setCheckStatus('1') + } catch (error: any) { + setLoading(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 { + setLoading(false) + } + } + const companyInfo = props.companyInfo; + const appInfo = props.appInfo; + const filesInfo = props.filesInfo; + const [photofileDetail, setPhotofileDetail] = useState({ + + fileId: '', //文件id + fileName: '', //文件名称 + url: '' + }); + const [authfileDetail, setAuthfileDetail] = useState({ + fileId: '', //文件id + fileName: '', //文件名称 + url: '' + }) + const [file, setFile] = useState({ + fileId: '', //文件id + fileName: '', //文件名称 + url: '' + }) + const [codefileDetail, setCodefileDetail] = useState({ + fileId: '', //文件id + fileName: '', //文件名称 + url: '' + }) + const [softfileDetail, setSoftfileDetail] = useState({ + fileId: '', //文件id + fileName: '', //文件名称 + url: '' + }) + const getPhotoFileDetail = async (id: string) => { + try { + const res: any = await fileDetail(id) + setPhotofileDetail({ + fileId: res[0].fileId, //文件id + fileName: res[0].fileName, //文件名称 + url: showImage(res[0].fileId, false) + }) + } 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) + } + } + } + const getAuthFileDetail = async (id: string) => { + try { + const res: any = await fileDetail(id) + setAuthfileDetail({ + fileId: res[0].fileId, //文件id + fileName: res[0].fileName, //文件名称 + url: showImage(res[0].fileId, false) + }) + + } 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) + } + } + } + const getFileDetail = async (id: string) => { + try { + const res: any = await fileDetail(id) + setFile({ + fileId: res[0].fileId, //文件id + fileName: res[0].fileName, //文件名称 + url: showImage(res[0].fileId, false) + }) + } 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) + } + } + } + const getCodeFileDetail = async (id: string) => { + try { + const res: any = await fileDetail(id) + setCodefileDetail({ + fileId: res[0].fileId, //文件id + fileName: res[0].fileName, //文件名称 + url: showImage(res[0].fileId, false) + }) + } 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) + } + } + } + const getSoftFileDetail = async (id: string) => { + try { + const res: any = await fileDetail(id) + setSoftfileDetail({ + fileId: res[0].fileId, //文件id + fileName: res[0].fileName, //文件名称 + url: showImage(res[0].fileId, false) + }) + } 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) + } + } + } + const [bigClassName, setBigClassName] = useState('') + const [smallClassName, setSmallClassName] = useState('') + const getBigClassName = async (id: string) => { + try { + const res: any = await getContent(id) + // console.log(res); + + setBigClassName(res.dataName) + } 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) + } + } + } + const getSmallClassName = async (id: string) => { + try { + const res: any = await getContent(id) + // console.log(res); + setSmallClassName(res.dataName) + + } 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(() => { + if (companyInfo.companyPhoto) { + getPhotoFileDetail(companyInfo.companyPhoto) + + } + if (companyInfo.companyAuth) { + getAuthFileDetail(companyInfo.companyAuth) + } + if (appInfo.getFile) { + getFileDetail(appInfo.getFile) + } + if (filesInfo.sourceCodeDocFile) { + getCodeFileDetail(filesInfo.sourceCodeDocFile) + } + if (filesInfo.softwareDocFile) { + getSoftFileDetail(filesInfo.softwareDocFile) + } + if (appInfo.bigClassify) { + getBigClassName(appInfo.bigClassify) + } + if (appInfo.subClassify) { + getSmallClassName(appInfo.subClassify) + } + + }, [companyInfo.companyPhoto, companyInfo.companyAuth, appInfo.getFile, filesInfo.sourceCodeDocFile, filesInfo.softwareDocFile, appInfo.bigClassify, appInfo.subClassify]) return ( -
-
-
+
+ {contextHolder} +
- }}> -
-
企业/机构信息
-
-
-
企业/机构信息名称 :
-
嘻嘻嘻嘻公司
-
-
-
所在省市 :
-
辽宁省沈阳市
-
-
-
企业/机构地址 :
-
xxx路xxx号
-
-
-
证件类型 :
-
xx证
-
-
-
证件号 :
-
111111111
-
-
-
上传证件 :
-
xx.png
-
-
-
授权书 :
-
xxx.jpg
-
+
+ +
+
未通过原因:{props.checkRemark}
+
企业/机构信息
+
+
+
企业/机构信息名称 :
+
{companyInfo.companyName}
+
+
+
统一社会信用代码 :
+
{companyInfo.companyNumber}
+
+ + + + +
+
+
+
软件基本信息
+
+
+
APP软件全称 :
+
{appInfo.appName}
+
+
+
软件简称 :
+
{appInfo.subName}
+
+
+
版本号 :
+
{appInfo.versionName}
+
+
+
包名(APPID) :
+
{appInfo.packageName}
+
+
+
运行系统 :
+
{appInfo.systemName}
+
+
+
软件分类 :
+
{bigClassName} - {smallClassName}
+
+
+
开发方式 :
+
{appInfo.developWay}
+
+ + +
+
开发完成日期 :
+
{appInfo.completeTime}
+
+ +
+
产权所属者 :
+
{appInfo.projOwnerName}
+
+ +
+
+ + + +
+ +
+
+
+ + +
+
+ 正在审核中... +
+
+ 审核通过
-
-
软件基本信息
-
-
-
APP软件全称 :
-
嘻嘻嘻嘻
-
-
-
软件简称 :
-
嘻嘻嘻嘻
-
-
-
版本号 :
-
v.10
-
-
-
包名(APPID) :
-
com.zhongxinhy.communitymanage
-
-
-
运行系统 :
-
android for phone
-
-
-
APP软件分类 :
-
应用 - 生活实用
-
-
-
开发方式 :
-
独立开发
-
- {/*
-
软件作品说明 :
-
原创
-
*/} -
-
开发完成日期 :
-
2025-05-05
-
- {/*
-
发表状态 :
-
未发表
-
*/} -
-
产权所属者 :
-
嘻嘻公司
-
- -
-
- {/*
-
权利说明
-
-
-
权力取得方式 :
-
原始
-
-
-
权利范围 :
-
全部权利
-
-
-
其他相关文件 :
-
asdasjdadja.png
-
- - -
-
*/} -
-
鉴别材料
-
- -
-
源码文档 :
-
asdkaksd.png
-
- - -
-
软件文档 :
-
asdkaksd.png
-
- -
-
- {/*
-
功能特点
-
-
-
硬件环境 :
-
1GHz以上处理器,1GB以上内存,16GB以上存储空间、安卓智能移动设备
-
-
-
软件环境 :
-
Android操作系统
-
-
-
编程语言 :
-
Java
-
-
-
源程序量 :
-
672384行左右
-
-
-
主要功能 :
-
隆盛社区APP软件主要功能有考勤打卡、房屋人口管理、工作轨迹、事件上报、事件处理、事件检查、学校管理、重点区域管理、重点场所、实有车辆、用户登录退出等功能。
-
-
-
技术特点 :
-
基于 Android Jetpack 组件构建,利用 ViewModel 和 LiveData 实现数据的高效管理与界面的实时更新,确保用户体验流畅。网络通信方面,运用 Retrofit 框架结合 OkHttp,实现安全快速的数据交互。
-
- -
-
*/} - {/*
-
著作权人
-
-
-
著作权人名称 :
-
嘻嘻嘻嘻嘻嘻嘻哈哈哈哈公司
-
- -
-
*/} -
- -
-
- -
+ { + setModal(false) -
+ }} + onOk={ + // setModal(false) + clickOk + } + > + +
+ 注 : 提交后无法修改,请确认信息是否正确! +
+ + + ) } diff --git a/src/route/AppElectron/components/AppInfo/app-info.css b/src/route/AppElectron/components/AppInfo/app-info.css index 34062ee..ba10480 100644 --- a/src/route/AppElectron/components/AppInfo/app-info.css +++ b/src/route/AppElectron/components/AppInfo/app-info.css @@ -35,4 +35,7 @@ .appInfoTextItemText{ max-width: 60%; /* background-color: pink; */ -} \ No newline at end of file + /* 下划线 */ + + +} diff --git a/src/route/AppElectron/components/EditAppFiles/EditAppFiles.tsx b/src/route/AppElectron/components/EditAppFiles/EditAppFiles.tsx index 693bfef..436b0c7 100644 --- a/src/route/AppElectron/components/EditAppFiles/EditAppFiles.tsx +++ b/src/route/AppElectron/components/EditAppFiles/EditAppFiles.tsx @@ -68,11 +68,11 @@ export default function EditAppFiles(props: any) { return true; }; // 处理文件点击预览 - const handlePreview = (file: any) => { - console.log(file); + // const handlePreview = (file: any) => { + // console.log(file); - }; + // }; // 上传文件源码文档列表 const [upCodeArray, setUpCodeArray] = useState([]) // const [codeDis, setCodeDis] = useState(false) @@ -227,7 +227,7 @@ export default function EditAppFiles(props: any) { const getCodeFileDetail = async (id: string) => { try { const res: any = await fileDetail(id) - console.log('文件详情', res); + // console.log('源码文档文件详情', res); setUpCodeArray([ { uid: res[0].fileId, @@ -252,7 +252,6 @@ export default function EditAppFiles(props: any) { const getSoftFileDetail = async (id: string) => { try { const res: any = await fileDetail(id) - console.log('文件详情', res); setUpSoftArray([ { uid: res[0].fileId, @@ -385,7 +384,7 @@ export default function EditAppFiles(props: any) { }); }} beforeUpload={beforeUpload} - onPreview={handlePreview} + // onPreview={handlePreview} // onChange={handleUploadChange} headers={{ 'Auth': `Bearer ${token}` }} > @@ -406,7 +405,7 @@ export default function EditAppFiles(props: any) { onClick={ downCodeWord } - >[ 下载1 ] + >[ 下载 ]
{ try { const res: any = await twoClass(id) - console.log(res); + // console.log(res); setSmallClassList(res.map((item: any) => { return { label: item.dataName, @@ -153,8 +153,8 @@ export default function EditAppInfo(props: any) { } const onFinish = async (values: any) => { // 处理表单提交逻辑 - console.log('表单提交成功', values); - console.log(dayjs(values.completeTime).format('YYYY-MM-DD')); + // console.log('表单提交成功', values); + // console.log(dayjs(values.completeTime).format('YYYY-MM-DD')); // 给表单赋值 time: dayjs(res.goodsGetTime, 'YYYY-MM-DD'), // submitInfo(values) // 给表单赋值 @@ -165,10 +165,10 @@ export default function EditAppInfo(props: any) { projOwnerId: belongPeopleInfo.authorId,//著作权人信息ID } - console.log('表单数据', data); - console.log('传递数据', props.appInfo); + // console.log('表单数据', data); + // console.log('传递数据', props.appInfo); // console.log(JSON.stringify(props.appInfo) == JSON.stringify(data)); - console.log(deepCompareObjects(props.appInfo, data)); + // console.log(deepCompareObjects(props.appInfo, data)); // console.log(props.appInf == data); // return @@ -256,13 +256,13 @@ export default function EditAppInfo(props: any) { } useEffect(() => { if (props.appInfo.getFile) { - console.log('嘻嘻', props.appInfo.getFile); + // console.log('嘻嘻', props.appInfo.getFile); getFileDetail(props.appInfo.getFile) } }, [props.appInfo.getFile]) useEffect(() => { - console.log('传过来的信息', props); + // console.log('传过来的信息', props); if (props.appInfo.appName) { // setSmallClassList(props.smallClass) form.setFieldsValue({ diff --git a/src/route/AppElectron/components/File/File.tsx b/src/route/AppElectron/components/File/File.tsx new file mode 100644 index 0000000..0d7349a --- /dev/null +++ b/src/route/AppElectron/components/File/File.tsx @@ -0,0 +1,482 @@ +import { useEffect, useState } from 'react' +import { Table, Space, Modal, Input, Form, Upload, Button } from "antd" +import { UploadOutlined } from '@ant-design/icons'; +import { sellSupplementList, buySupplementList, supplementDetail, getFileTypeByIds, supplementAppData } from '../../../../request/api' +import { showImage, uploadFileUrl } from '../../../../request/request' +const { Column } = Table; +import useMessage from "antd/es/message/useMessage"; +// import './File.css' +const { TextArea } = Input; +export default function File(props: any) { + const [upFileArray, setUpFileArray] = useState([]) // 上传的文件数组 + // 自定义验证函数 + const validateContentOrFile = (_rule: any, _value: any, callback: (error?: string) => void, form: any) => { + const { upCorrectionRemark, upFile } = form.getFieldsValue(); + if (upCorrectionRemark || (upFile && Array.isArray(upFile.fileList) && upFile.fileList.length > 0)) { + callback(); + } else { + callback('内容和附件至少需要填写或上传一项'); + } + }; + // 点击上传资料确定 + const submitData = async (params: any) => { + try { + await supplementAppData({ + correctionParentId: correctionId, + // correctionType: CorrectionType, + orderId: props.orderId, + correctionFiles: params.correctionFiles, + correctionRemark: params.correctionRemark, + }) + if (props.user == 'sell') { + getSellSupplementList() + } else if (props.user == 'buy') { + getBuySupplementList() + } + props.upData() + messageApi.open({ + type: 'success', + content: '已提交', + }) + setIsModalVisible(false) + // form.resetFields(); + + // console.log(res); + + } 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) + } + } + } + const token = sessionStorage.getItem('token') + const [form] = Form.useForm(); + const [messageApi, messageContext] = useMessage(); + const [correctionId, setCorrectionId] = useState('') // 点击查看内容选中的id + // const [CorrectionType, setCorrectionType] = useState('') + // 补充资料弹窗 + const [isModalVisible, setIsModalVisible] = useState(false) + const [page, setPage] = useState(1) // 当前页码 + const [total, setTotal] = useState(0) // 总条数 + const [data, setData] = useState([]) + const getSellSupplementList = async () => { + try { + const res: any = await sellSupplementList({ + orderId: props.orderId, + page: page, + rows: 10 + }) + setPage(res.page) + setTotal(res.total) + console.log(res); + setData(res.rows) + // let newData:any = []; + // for (let i = 0; i < 10; i++) { + // newData = newData.concat(res.rows); + // } + // setData(newData); + + } 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) + } + } + } + const getBuySupplementList = async () => { + try { + const res: any = await buySupplementList({ + orderId: props.orderId, + page: page, + rows: 10 + }) + setPage(res.page) + setTotal(res.total) + // console.log(res); + setData(res.rows) + } 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) + } + } + } + const [fileList, setFileList] = useState([]) // 上传文件列表 + // 获取文件类型 + const getFileTypeByIdsArray = async (ids: string) => { + try { + const res: any = await getFileTypeByIds({ + ids: ids + }) + setFileList(res) + + } 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) + } + } + } + // 补充资料详情 + const [detailData, setDetailData] = useState({}) + const getSupplementDetail = async (id: string) => { + try { + const res: any = await supplementDetail(id) + // console.log(res); + setDetailData(res) + await getFileTypeByIdsArray(res.correctionFiles) + + } 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(() => { + if (props.user == 'sell') { + getSellSupplementList() + } else if (props.user == 'buy') { + getBuySupplementList() + } + }, [page]) + return ( +
+ {messageContext} + { + setPage(currentPage); + }, + showSizeChanger: false, + current: page + + } + } + // pagination={false} // 不显示分页 + style={{ textAlign: 'center' }} // 设置表格内容居中显示 + rowKey="correctionId" // 指定数据项的唯一标识符 + > + ( + index + 1 + )} align="center" /> + ( +
{text}
+ )} + // render={(text) => ( + // {text} + // )} + /> + ( +
{text}
+ )} + /> + + ( + <> + 待补充 + 已补充 + + )} + /> + + {/* */} + ( + + { + // console.log(record.correctionId); + setCorrectionId(record.correctionId) + getSupplementDetail(record.correctionId) + setIsModalVisible(true) + // 清空表单 + form.resetFields(); + // setCorrectionType(record.correctionType) + }}>查看内容 + + + )} + /> +
+ { + setIsModalVisible(false); + // 清空表单 + form.resetFields(); + }} + centered + > +
+ {/* {correctionId} + {CorrectionType} */} +
+
+
平台需要您补充的内容说明
+
+
+
主题
+ +
+
+
内容
+ +
+
+
附件
+ {fileList.length > 0 ? ( + //
材料列表
+
+ { + fileList.map((item: any) => { + return ( +
{ + + window.open(showImage(item.fileId, false)) + + }} + > + {item.fileName} +
+ ) + }) + } +
+ + ) : ( +
+ 无 +
+ )} +
+
+
+
在下面填写您补充的内容
+
+
{ + + // console.log(value); + // if (value.upFile && Array.isArray(value.upFile.fileList)) { + // const uids = value.upFile.fileList.map((file: any) => file.uid); + // const uidString = uids.join(','); + // console.log('提取的 uid 字符串:', uidString); + // // 你可以在这里继续处理 uid 字符串,比如发送请求等 + + // } + // const uids = value.upFile ? (value.upFile.fileList.map((file: any) => file.uid)).join(',') : ''; + + // console.log('提取的 uid 字符串:', uids); + + // submitData({ + // correctionFiles: uids, + // correctionRemark: value.upCorrectionRemark, + // }) + // console.log(upFileArray); + // 将upFileArray 数组周末和每项的response里的data 里的 fileId 拼接成一个字符串,用逗号隔开 + const uids = upFileArray.map((file: any) => file.response.data.fileId).join(','); + // console.log('提取的 uid 字符串:', uids); + submitData({ + correctionFiles: uids, + correctionRemark: value.upCorrectionRemark, + }) + + + }} + onFinishFailed={() => { + messageApi.open({ + type: 'error', + content: '内容和附件至少需要填写或上传一项', + }) + }} + autoComplete="off" + > +
+
内容
+ validateContentOrFile(rule, value, callback, form), + }, + + ]} + > + + + +
+
+
附件
+
+ validateContentOrFile(rule, value, callback, form), + }, + ]} + > + + { + setUpFileArray(info.fileList) + // console.log(info.fileList); + + }} + + headers={{ 'Auth': `Bearer ${token}` }} + + > + + + + + +
+ +
+ + +
+ + +
+
+ + +
+
+
+
+ ) +} diff --git a/src/route/index/Index.tsx b/src/route/index/Index.tsx index 377453f..ceb0876 100644 --- a/src/route/index/Index.tsx +++ b/src/route/index/Index.tsx @@ -3314,6 +3314,7 @@ export default function Index() { style={{ background: 'var(--color-searchbtn)' }} onClick={() => { setAppModal(true) + setAppGoodsId('') }} >申请电子软著 @@ -3822,7 +3823,7 @@ export default function Index() { footer={null} onCancel={() => { setAppModal(false) - setAppGoodsId('') + }} okButtonProps={{ style: { background: 'red', color: 'white' } }} width={830}