From ec4565dd04e66bd2c1b1fe55a0db2410c81c72e5 Mon Sep 17 00:00:00 2001 From: xixi <123@qq.com> Date: Wed, 4 Sep 2024 15:52:35 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=80=E6=AC=BE=E8=A1=A5=E6=AD=A3=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CorrectionModal/CorrectionModal.tsx | 263 ++++++++++++--- src/components/RefunModal/RefunModal.css | 17 + src/components/RefunModal/RefunModal.tsx | 313 ++++++++++++------ src/components/menu/MenuWithTopButton.tsx | 6 +- src/interfaces/menu/IMenuWithTopButton.ts | 4 + src/route/Correction/Correction.tsx | 75 +++-- src/route/Refun/Refun.tsx | 9 +- src/route/index/Index.tsx | 136 ++++++-- 8 files changed, 614 insertions(+), 209 deletions(-) diff --git a/src/components/CorrectionModal/CorrectionModal.tsx b/src/components/CorrectionModal/CorrectionModal.tsx index f63f6b1..b3c11e1 100644 --- a/src/components/CorrectionModal/CorrectionModal.tsx +++ b/src/components/CorrectionModal/CorrectionModal.tsx @@ -1,14 +1,70 @@ // import React from 'react' import { useEffect, useState } from 'react' // import './RefunModal.css' -import { Form, Select, Button, Upload, message, Input } from 'antd'; +import { Form, Select, Button, Upload, message, Input, Modal, Table,Empty } from 'antd'; +import type { TableColumnsType } from 'antd'; +const { Search } = Input; import { UploadOutlined } from '@ant-design/icons'; import { uploadImageUrl, DevUserId, get, post } from "../../util/AjaxUtils.ts"; -import { getMenuActive } from '../../util/cache.ts' +// import { getMenuActive } from '../../util/cache.ts' import { useDispatch } from 'react-redux' const { TextArea } = Input; +interface DataType { + key: React.Key; + projName: string; + projContext: string; + gmtCreate: string; + projId: string +} export default function CorrectionModal(props: any) { + const columns: TableColumnsType = [ + { + title: '序号', + dataIndex: 'index', + align: 'center', + width: 80, + render: (_text, _record, index) => (page - 1) * 20 + index + 1, // 显示序号,从1开始 + }, + { + title: '项目名称', + dataIndex: 'projName', + align: 'center', + + render: (text: string) => <>{text}, + }, + { + title: '编号', + dataIndex: 'projContext', + align: 'center', + + + }, + { + title: '创建时间', + dataIndex: 'gmtCreate', + align: 'center', + + }, + ]; + const [messageApi, contextHolder] = message.useMessage(); + // 选择项目得临时name + const [newprojName, setnewprojName] = useState('') + // 选择项目得name + const [projName, setProjName] = useState('') + // 选择得项目临时id + const [newprojId, setnewProjId] = useState('') + // 选择 项目的id + const [projId, setProjId] = useState('') + //默认选择得项目 + const [selectedRowKeys, setselectedRowKeys] = useState([]) + // 分页 + const [page, setPage] = useState(1) + const [total, setTotal] = useState(0) + // 搜索关键字 + const [keywords, setKeywords] = useState('') + // 选择项目弹窗 + const [projModal, setProjModal] = useState(false) // 上传附件 const [correctionArray, setCorrectionArray] = useState([]); // const [selectedReason, setSelectedReason] = useState(''); //选择原因 @@ -17,10 +73,20 @@ export default function CorrectionModal(props: any) { // setSelectedReason(value); // }; // 获取当前选择类型 - const type = getMenuActive() == 'Correction-PENDING' ? 'PENDING' : getMenuActive() == 'Correction-APPROVED' ? 'APPROVED' : getMenuActive() == 'Correction-REJECTED' ? 'REJECTED' : getMenuActive() == 'Correction-CANCELED' ? 'CANCELED' : '' + // const type = getMenuActive() == 'Correction-PENDING' ? 'PENDING' : getMenuActive() == 'Correction-APPROVED' ? 'APPROVED' : getMenuActive() == 'Correction-REJECTED' ? 'REJECTED' : getMenuActive() == 'Correction-CANCELED' ? 'CANCELED' : '' const dispath = useDispatch() - const [correctionDataArray, setCorrectionDataArray] = useState([]) //未退款项目 - const [isDisabled,setIsDisabled] = useState(false) //提交按钮是否禁用 + const [correctionDataArray, setCorrectionDataArray] = useState([]) //未补正项目 + const [isDisabled, setIsDisabled] = useState(false) //提交按钮是否禁用 + const [form] = Form.useForm(); + // 关键字搜索 + const handleSearch = (value: string) => { + setKeywords(value) + } + const handleChange = (e: any) => { + if (e.target.value == '') { + setKeywords('') + } + } // 提交表单 const onFinish = (values: any) => { // console.log('Form values:', values); @@ -32,10 +98,10 @@ export default function CorrectionModal(props: any) { messageApi, url: `/api/proj/correction/apply/save`, body: { - projId: values.title, + projId: projId, correctionReason: values.other, correctionVoucher: correctionArray.join(','), - correctionType:values.correctionType + correctionType: values.correctionType }, onBefore() { setIsDisabled(true) @@ -45,12 +111,12 @@ export default function CorrectionModal(props: any) { setIsDisabled(true) setTimeout(() => { props.closeModal() - - }, 500) - if (type === 'PENDING') { - getData() - } + }, 500) + + getData() + + }, onFinally() { @@ -62,12 +128,11 @@ export default function CorrectionModal(props: any) { get({ messageApi, url: `/api/proj/correction/apply/listpage`, - // url: `/api/proj/refund/apply/listpage?applyStatus=${state.type}`, config: { params: { page: 1, rows: 20, - applyStatus: type + applyStatus: '' } }, onSuccess(data: any) { @@ -88,23 +153,26 @@ export default function CorrectionModal(props: any) { const getCorrectionData = () => { get({ messageApi, - url: `/api/proj/correction/apply/list-proj-unapply/self`, - // config: { - // params: { - - // } - // }, + url: `/api/proj/correction/apply/listpage-proj-unapply/self`, + config: { + params: { + page: 1, + rows: 20, + keywords + } + }, onBefore() { }, onSuccess(data: any) { - // console.log(data); - const newArray = (data.data).map((item: { projId: any; projName: any; }) => ({ - value: item.projId, - label: item.projName - })) - setCorrectionDataArray(newArray) + console.log(data); + // const newArray = (data.data).map((item: { projId: any; projName: any; }) => ({ + // value: item.projId, + // label: item.projName + // })) + setCorrectionDataArray(data.data.rows) + setTotal(data.data.total) }, onFinally() { @@ -115,14 +183,15 @@ export default function CorrectionModal(props: any) { } useEffect(() => { getCorrectionData() - // console.log(type); - }, []) + + }, [page, keywords]) return (
{contextHolder}
补正软著*
- - - + placeholder="选择需要补正的软著" + disabled + > + + + +
{ + setProjModal(true) + setKeywords('') + setPage(1) + getCorrectionData() + }}> + 选择 +
+
@@ -157,13 +235,14 @@ export default function CorrectionModal(props: any) {