退款补正样式更改

This commit is contained in:
xixi 2024-09-04 15:52:35 +08:00
parent 01ea979f11
commit ec4565dd04
8 changed files with 614 additions and 209 deletions

View File

@ -1,14 +1,70 @@
// import React from 'react' // import React from 'react'
import { useEffect, useState } from 'react' import { useEffect, useState } from 'react'
// import './RefunModal.css' // 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 { UploadOutlined } from '@ant-design/icons';
import { uploadImageUrl, DevUserId, get, post } from "../../util/AjaxUtils.ts"; 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' import { useDispatch } from 'react-redux'
const { TextArea } = Input; const { TextArea } = Input;
interface DataType {
key: React.Key;
projName: string;
projContext: string;
gmtCreate: string;
projId: string
}
export default function CorrectionModal(props: any) { export default function CorrectionModal(props: any) {
const columns: TableColumnsType<DataType> = [
{
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(); 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<string[]>([])
// 分页
const [page, setPage] = useState(1)
const [total, setTotal] = useState(0)
// 搜索关键字
const [keywords, setKeywords] = useState('')
// 选择项目弹窗
const [projModal, setProjModal] = useState(false)
// 上传附件 // 上传附件
const [correctionArray, setCorrectionArray] = useState<string[]>([]); const [correctionArray, setCorrectionArray] = useState<string[]>([]);
// const [selectedReason, setSelectedReason] = useState(''); //选择原因 // const [selectedReason, setSelectedReason] = useState(''); //选择原因
@ -17,10 +73,20 @@ export default function CorrectionModal(props: any) {
// setSelectedReason(value); // 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 dispath = useDispatch()
const [correctionDataArray, setCorrectionDataArray] = useState<any[]>([]) //未退款项目 const [correctionDataArray, setCorrectionDataArray] = useState<any[]>([]) //未补正项目
const [isDisabled, setIsDisabled] = useState(false) //提交按钮是否禁用 const [isDisabled, setIsDisabled] = useState(false) //提交按钮是否禁用
const [form] = Form.useForm<any>();
// 关键字搜索
const handleSearch = (value: string) => {
setKeywords(value)
}
const handleChange = (e: any) => {
if (e.target.value == '') {
setKeywords('')
}
}
// 提交表单 // 提交表单
const onFinish = (values: any) => { const onFinish = (values: any) => {
// console.log('Form values:', values); // console.log('Form values:', values);
@ -32,7 +98,7 @@ export default function CorrectionModal(props: any) {
messageApi, messageApi,
url: `/api/proj/correction/apply/save`, url: `/api/proj/correction/apply/save`,
body: { body: {
projId: values.title, projId: projId,
correctionReason: values.other, correctionReason: values.other,
correctionVoucher: correctionArray.join(','), correctionVoucher: correctionArray.join(','),
correctionType: values.correctionType correctionType: values.correctionType
@ -47,10 +113,10 @@ export default function CorrectionModal(props: any) {
props.closeModal() props.closeModal()
}, 500) }, 500)
if (type === 'PENDING') {
getData() getData()
}
}, },
onFinally() { onFinally() {
@ -62,12 +128,11 @@ export default function CorrectionModal(props: any) {
get({ get({
messageApi, messageApi,
url: `/api/proj/correction/apply/listpage`, url: `/api/proj/correction/apply/listpage`,
// url: `/api/proj/refund/apply/listpage?applyStatus=${state.type}`,
config: { config: {
params: { params: {
page: 1, page: 1,
rows: 20, rows: 20,
applyStatus: type applyStatus: ''
} }
}, },
onSuccess(data: any) { onSuccess(data: any) {
@ -88,23 +153,26 @@ export default function CorrectionModal(props: any) {
const getCorrectionData = () => { const getCorrectionData = () => {
get({ get({
messageApi, messageApi,
url: `/api/proj/correction/apply/list-proj-unapply/self`, url: `/api/proj/correction/apply/listpage-proj-unapply/self`,
// config: { config: {
// params: { params: {
page: 1,
// } rows: 20,
// }, keywords
}
},
onBefore() { onBefore() {
}, },
onSuccess(data: any) { onSuccess(data: any) {
// console.log(data); console.log(data);
const newArray = (data.data).map((item: { projId: any; projName: any; }) => ({ // const newArray = (data.data).map((item: { projId: any; projName: any; }) => ({
value: item.projId, // value: item.projId,
label: item.projName // label: item.projName
})) // }))
setCorrectionDataArray(newArray) setCorrectionDataArray(data.data.rows)
setTotal(data.data.total)
}, },
onFinally() { onFinally() {
@ -115,14 +183,15 @@ export default function CorrectionModal(props: any) {
} }
useEffect(() => { useEffect(() => {
getCorrectionData() getCorrectionData()
// console.log(type);
}, [])
}, [page, keywords])
return ( return (
<div className='refunModal'> <div className='refunModal'>
{contextHolder} {contextHolder}
<Form <Form
name="Form" name="Form"
form={form}
onFinish={onFinish} onFinish={onFinish}
initialValues={{ softWare: '' }} initialValues={{ softWare: '' }}
style={{ maxWidth: 600 }} style={{ maxWidth: 600 }}
@ -131,24 +200,33 @@ export default function CorrectionModal(props: any) {
<div className='refunModal-title'> <div className='refunModal-title'>
<span className='refunModal-red'>*</span> <span className='refunModal-red'>*</span>
</div> </div>
<div className='refunInput'>
<Form.Item <Form.Item
name="title" name="title"
// label="退款软著"
rules={[{ required: true, message: '请选择一个软著!' }]} rules={[{ required: true, message: '请选择一个软著!' }]}
> >
<Select <Input style={{
showSearch
placeholder="选择需要退款的软著"
filterOption={(input, option) =>
(option?.label ?? '').toLowerCase().includes(input.toLowerCase())
}
options={correctionDataArray}
style={{
width: 405, width: 405,
height: 46, height: 46,
background: '#FFF',
color: 'black'
}} }}
/> placeholder="选择需要补正的软著"
disabled
>
</Input>
</Form.Item> </Form.Item>
<div className='refunInput-button' onClick={() => {
setProjModal(true)
setKeywords('')
setPage(1)
getCorrectionData()
}}>
</div>
</div>
</div> </div>
<div className='refunModal-item'> <div className='refunModal-item'>
<div className='refunModal-title'> <div className='refunModal-title'>
@ -157,13 +235,14 @@ export default function CorrectionModal(props: any) {
<Form.Item <Form.Item
name="correctionType" name="correctionType"
// label="退款软著" // label="退款软著"
rules={[{ required: true, message: '请选择' }]} rules={[{ required: true, message: '请选择补正种类' }]}
> >
<Select <Select
placeholder="选择类型" placeholder="选择类型"
options={[ options={[
{ value: 'MANUAL', label: '操作手册' }, { value: 'MANUAL', label: '操作手册' },
{ value: 'CODE', label: '代码' }, { value: 'CODE', label: '代码' },
{ value: 'ALL', label: '操作手册+代码' },
]} ]}
style={{ style={{
width: 405, width: 405,
@ -218,10 +297,10 @@ export default function CorrectionModal(props: any) {
</div> </div>
<Form.Item <Form.Item
name="other" name="other"
rules={[{ required: true, message: '请输入退款原因' }]} rules={[{ required: true, message: '请输入补正原因' }]}
> >
<TextArea <TextArea
placeholder="输入退款原因" placeholder="输入补正原因"
style={{ height: 120, resize: 'none', width: 405 }} style={{ height: 120, resize: 'none', width: 405 }}
/> />
</Form.Item> </Form.Item>
@ -263,7 +342,7 @@ export default function CorrectionModal(props: any) {
} }
return e.fileList; return e.fileList;
}} }}
rules={[{ required: true, message: '请上传凭证' }]} rules={[{ required: true, message: '请上传补正通知书' }]}
> >
<Upload <Upload
name="image" name="image"
@ -280,7 +359,7 @@ export default function CorrectionModal(props: any) {
// listType="picture-card" // listType="picture-card"
> >
<Button icon={<UploadOutlined />} style={{ marginTop: 2 }}></Button> <Button icon={<UploadOutlined />} style={{ marginTop: 2 }}></Button>
</Upload> </Upload>
</Form.Item> </Form.Item>
</div> </div>
@ -299,6 +378,92 @@ export default function CorrectionModal(props: any) {
</div> </div>
</Form.Item> </Form.Item>
</Form> </Form>
<Modal title="选择补正项目"
destroyOnClose
okText="确认"
cancelText="取消"
open={projModal}
onOk={
() => {
if (newprojId) {
setProjName(newprojName)
setProjId(newprojId)
setProjModal(false)
setselectedRowKeys([newprojId])
form.setFieldsValue({
title: newprojName
});
} else {
messageApi.open({
type: 'error',
content: '请选择要退款项目'
})
}
}
}
width={1220}
onCancel={() => {
setselectedRowKeys([projId])
setnewProjId(projId)
setnewprojName(projName)
setProjModal(false)
}}>
<Search placeholder="输入项目名称"
onSearch={handleSearch}
onChange={handleChange}
style={{
width: '200px',
height: '31px',
marginBottom: 15
}}
allowClear
/>
<Table
rowSelection={{
selectedRowKeys: selectedRowKeys,
type: 'radio',
// ...rowSelection,
onChange: (_selectedRowKeys: React.Key[], selectedRows: DataType[]) => {
console.log('selectedRows: ', selectedRows);
setselectedRowKeys([selectedRows[0].projId])
setnewProjId(selectedRows[0].projId)
setnewprojName(selectedRows[0].projName)
},
}}
columns={columns}
dataSource={correctionDataArray}
rowKey={'projId'}
pagination={
{
pageSize: 20,
total: total,
onChange: (currentPage) => {
setPage(currentPage);
},
showSizeChanger: false,
current: page
}
}
locale={{
emptyText: <Empty
description="暂无数据"
/>,
}}
scroll={{ y: 500 }}
/>
</Modal>
</div> </div>
) )
} }

View File

@ -28,3 +28,20 @@
justify-content: center; justify-content: center;
margin-top: 20px; margin-top: 20px;
} }
.refunInput{
position: relative;
}
.refunInput-button{
/* height: 100%; */
width: 50px;
display: flex;
align-items: center;
justify-content: center;
/* background-color: #F04C4C; */
color: rgb(18, 128, 255);
position: absolute;
top:13px;
right: 20px;
cursor: pointer;
}

View File

@ -1,13 +1,53 @@
import { useEffect, useState } from 'react' import { useState, useEffect } from 'react'
import './RefunModal.css' import './RefunModal.css'
import { Form, Select, Button, Upload, message, Input } from 'antd'; import { Form, Button, Upload, message, Input, Modal, Table, Empty } from 'antd';
import type { TableColumnsType } from 'antd';
import { UploadOutlined } from '@ant-design/icons'; import { UploadOutlined } from '@ant-design/icons';
import { uploadImageUrl, DevUserId, get, post } from "../../util/AjaxUtils.ts"; 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' import { useDispatch } from 'react-redux'
const { Search } = Input;
const { TextArea } = Input; const { TextArea } = Input;
interface DataType {
key: React.Key;
projName: string;
projContext: string;
gmtCreate: string;
projId: string
}
export default function RefunModal(props: any) { export default function RefunModal(props: any) {
const columns: TableColumnsType<DataType> = [
{
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(); const [messageApi, contextHolder] = message.useMessage();
// 上传附件 // 上传附件
const [refunArray, setRefunArray] = useState<string[]>([]); const [refunArray, setRefunArray] = useState<string[]>([]);
@ -17,22 +57,46 @@ export default function RefunModal(props: any) {
// setSelectedReason(value); // setSelectedReason(value);
// }; // };
// 获取当前选择类型 // 获取当前选择类型
const type = getMenuActive() // const type = getMenuActive()
const dispath = useDispatch() const dispath = useDispatch()
const [refunDataArray, setRefunDataArray] = useState<any[]>([]) //未退款项目 // 选择项目得临时name
const [newprojName, setnewprojName] = useState('')
// 选择项目得name
const [projName, setProjName] = useState('')
// 选择得项目临时id
const [newprojId, setnewProjId] = useState('')
// 选择 项目的id
const [projId, setProjId] = useState('')
//默认选择得项目
const [selectedRowKeys, setselectedRowKeys] = useState<string[]>([])
// 分页
const [page, setPage] = useState(1)
const [total, setTotal] = useState(0)
// 搜索关键字
const [keywords, setKeywords] = useState('')
const [refunDataArray, setRefunDataArray] = useState<any[]>([]) //未退款项目数组
// 选择项目弹窗
const [projModal, setProjModal] = useState(false)
const [isDisabled, setIsDisabled] = useState(false) //提交按钮是否禁用 const [isDisabled, setIsDisabled] = useState(false) //提交按钮是否禁用
const [form] = Form.useForm<any>();
// 关键字搜索
const handleSearch = (value: string) => {
setKeywords(value)
}
const handleChange = (e: any) => {
if (e.target.value == '') {
setKeywords('')
}
}
// 提交表单 // 提交表单
const onFinish = (values: any) => { const onFinish = (values: any) => {
// console.log('Form values:', values); // console.log('Form values:', values);
// console.log(refunArray);
post<any>({ post<any>({
messageApi, messageApi,
url: `/api/proj/refund/apply/save`, url: `/api/proj/refund/apply/save`,
body: { body: {
projId: values.title, projId: projId,
refundReason: values.other, refundReason: values.other,
refundVoucher: refunArray.join(',') refundVoucher: refunArray.join(',')
}, },
@ -45,10 +109,8 @@ export default function RefunModal(props: any) {
setTimeout(() => { setTimeout(() => {
props.closeModal() props.closeModal()
}, 500) }, 500)
if ( type === 'PENDING') {
getData()
} getData()
}, },
onFinally() { onFinally() {
@ -60,17 +122,14 @@ export default function RefunModal(props: any) {
get({ get({
messageApi, messageApi,
url: `/api/proj/refund/apply/listpage`, url: `/api/proj/refund/apply/listpage`,
// url: `/api/proj/refund/apply/listpage?applyStatus=${state.type}`,
config: { config: {
params: { params: {
page: 1, page: 1,
rows: 20, rows: 20,
applyStatus: type applyStatus: ''
} }
}, },
onSuccess(data: any) { onSuccess(data: any) {
// console.log('更新');
dispath({ dispath({
type: 'upRefunArray', type: 'upRefunArray',
val: data.data.rows val: data.data.rows
@ -86,24 +145,21 @@ export default function RefunModal(props: any) {
const getRefunData = () => { const getRefunData = () => {
get({ get({
messageApi, messageApi,
url: `/api/proj/refund/apply/list-proj-unapply/self`, url: `/api/proj/refund/apply/listpage-proj-unapply/self`,
// config: { config: {
// params: { params: {
page: 1,
// } rows: 20,
// }, keywords
}
},
onBefore() { onBefore() {
}, },
onSuccess(data: any) { onSuccess(data: any) {
// console.log(data); setRefunDataArray(data.data.rows)
const newArray = (data.data).map((item: { projId: any; projName: any; }) => ({ setTotal(data.data.total)
value: item.projId,
label: item.projName
}))
setRefunDataArray(newArray)
}, },
onFinally() { onFinally() {
@ -113,14 +169,13 @@ export default function RefunModal(props: any) {
} }
useEffect(() => { useEffect(() => {
getRefunData() getRefunData()
// console.log(type); }, [page, keywords])
}, [])
return ( return (
<div className='refunModal'> <div className='refunModal'>
{contextHolder} {contextHolder}
<Form <Form
name="Form" name="Form"
form={form}
onFinish={onFinish} onFinish={onFinish}
initialValues={{ softWare: '' }} initialValues={{ softWare: '' }}
style={{ maxWidth: 600 }} style={{ maxWidth: 600 }}
@ -129,65 +184,35 @@ export default function RefunModal(props: any) {
<div className='refunModal-title'> <div className='refunModal-title'>
退<span className='refunModal-red'>*</span> 退<span className='refunModal-red'>*</span>
</div> </div>
<div className='refunInput'>
<Form.Item <Form.Item
name="title" name="title"
// label="退款软著"
rules={[{ required: true, message: '请选择一个软著!' }]} rules={[{ required: true, message: '请选择一个软著!' }]}
> >
<Select <Input style={{
showSearch width: 405,
height: 46,
background: '#FFF',
color: 'black'
}}
placeholder="选择需要退款的软著" placeholder="选择需要退款的软著"
filterOption={(input, option) => disabled
(option?.label ?? '').toLowerCase().includes(input.toLowerCase())
}
options={refunDataArray}
style={{
width: 405,
height: 46,
}}
/>
</Form.Item>
</div>
{/* <div className='refunModal-item'>
<div className='refunModal-title'>
退<span className='refunModal-red'>*</span>
</div>
<Form.Item
name="reason"
// label="退款软著"
rules={[{ required: true, message: '请选择退款原因' }]}
> >
<Select </Input>
placeholder="选择退款原因"
options={[
{ value: '没钱', label: '没钱' },
{ value: '不想买', label: '不想买' },
{ value: '其他', label: '其他' },
]}
style={{
width: 405,
height: 46,
}}
onChange={handleReasonChange}
/>
</Form.Item> </Form.Item>
</div> */} <div className='refunInput-button' onClick={() => {
{/* {selectedReason === '' && ( setProjModal(true)
<div className='refunModal-item'> setKeywords('')
<div className='refunModal-title'> setPage(1)
<span className='refunModal-red'>*</span> getRefunData()
}}>
</div> </div>
<Form.Item
name="other"
rules={[{ required: true, message: '请输入退款原因' }]}
>
<TextArea
placeholder="其他退款原因"
style={{ height: 120, resize: 'none', width: 405 }}
/>
</Form.Item>
</div> </div>
)} */}
</div>
<div className='refunModal-item'> <div className='refunModal-item'>
<div className='refunModal-title'> <div className='refunModal-title'>
退<span className='refunModal-red'>*</span> 退<span className='refunModal-red'>*</span>
@ -202,23 +227,6 @@ export default function RefunModal(props: any) {
/> />
</Form.Item> </Form.Item>
</div> </div>
{/* <div className='refunModal-item' >
<div className='refunModal-title'>
<span className='refunModal-red'>*</span>
</div>
<Form.Item
name="other"
// label="退款软著"
rules={[{ required: true, message: '请输入退款原因' }]}
>
<TextArea
// showCount
// maxLength={100}
placeholder="其他退款原因"
style={{ height: 120, resize: 'none', width: 405, }}
/>
</Form.Item>
</div> */}
<div className='refunModal-item'> <div className='refunModal-item'>
<div className='refunModal-title'> <div className='refunModal-title'>
退<span className='refunModal-red'>*</span> 退<span className='refunModal-red'>*</span>
@ -239,7 +247,7 @@ export default function RefunModal(props: any) {
} }
return e.fileList; return e.fileList;
}} }}
rules={[{ required: true, message: '请上传凭证' }]} rules={[{ required: true, message: '请上传补正通知书' }]}
> >
<Upload <Upload
name="image" name="image"
@ -256,7 +264,7 @@ export default function RefunModal(props: any) {
// listType="picture-card" // listType="picture-card"
> >
<Button icon={<UploadOutlined />} style={{ marginTop: 2 }}></Button> <Button icon={<UploadOutlined />} style={{ marginTop: 2 }}></Button>
</Upload> </Upload>
</Form.Item> </Form.Item>
</div> </div>
@ -275,6 +283,93 @@ export default function RefunModal(props: any) {
</div> </div>
</Form.Item> </Form.Item>
</Form> </Form>
<Modal title="选择退款项目"
destroyOnClose
okText="确认"
cancelText="取消"
open={projModal}
onOk={
() => {
if (newprojId) {
setProjName(newprojName)
setProjId(newprojId)
setProjModal(false)
setselectedRowKeys([newprojId])
form.setFieldsValue({
title: newprojName
});
} else {
messageApi.open({
type: 'error',
content: '请选择要退款项目'
})
}
}
}
width={1220}
onCancel={() => {
setselectedRowKeys([projId])
setnewProjId(projId)
setnewprojName(projName)
setProjModal(false)
}}>
<Search placeholder="输入项目名称"
onSearch={handleSearch}
onChange={handleChange}
style={{
width: '200px',
height: '31px',
marginBottom: 15
}}
allowClear
/>
<Table
rowSelection={{
selectedRowKeys: selectedRowKeys,
type: 'radio',
// ...rowSelection,
onChange: (_selectedRowKeys: React.Key[], selectedRows: DataType[]) => {
console.log('selectedRows: ', selectedRows);
setselectedRowKeys([selectedRows[0].projId])
setnewProjId(selectedRows[0].projId)
setnewprojName(selectedRows[0].projName)
},
}}
columns={columns}
dataSource={refunDataArray}
rowKey={'projId'}
pagination={
{
pageSize: 20,
total: total,
onChange: (currentPage) => {
setPage(currentPage);
},
showSizeChanger: false,
current: page
}
}
locale={{
emptyText: <Empty
description="暂无数据"
/>,
}}
scroll={{ y: 500 }}
/>
</Modal>
</div> </div>
) )
} }

View File

@ -64,7 +64,11 @@ export default function MenuWithTopButton(props: IMenuWithTopButton) {
// props.disableBelongpeople() // props.disableBelongpeople()
navugate('/correction', { navugate('/correction', {
state: { state: {
type: item.id keywords: props.correctionKeywords,
correctionNumType:props.correctionNumType,
correctionType:props.correctionType,
applyStatus: props.correctionApplyStatus,
authorId: props.authorId
} }
}) })
} }

View File

@ -27,6 +27,10 @@ export interface IMenuWithTopButton {
refunKeywords?:string refunKeywords?:string
applyStatus?:string applyStatus?:string
payStatus?:string payStatus?:string
correctionKeywords?:string
correctionNumType?:string
correctionType?:string
correctionApplyStatus?:string
// disableBelongpeople?:any // disableBelongpeople?:any
// enableBelongpeople?:any // enableBelongpeople?:any
} }

View File

@ -2,12 +2,12 @@ import { useState, useEffect, } from 'react';
import { import {
Table, Table,
// Pagination, // Pagination,
Modal, Tag, message, Spin, Select, Button, Empty Modal, Tag, message, Spin, Empty
} from 'antd'; } from 'antd';
import { // import {
// MenuFoldOutlined, // // MenuFoldOutlined,
ClearOutlined // ClearOutlined
} from '@ant-design/icons'; // } from '@ant-design/icons';
import { useSelector, useDispatch } from 'react-redux' import { useSelector, useDispatch } from 'react-redux'
import { import {
get, get,
@ -15,6 +15,7 @@ import {
Axios Axios
} from '../../util/AjaxUtils' } from '../../util/AjaxUtils'
import type { TableProps } from 'antd'; import type { TableProps } from 'antd';
import { useLocation } from 'react-router-dom';
// import { getMenuActive } from '../../util/cache' // import { getMenuActive } from '../../util/cache'
// import { useNavigate } from "react-router-dom"; // import { useNavigate } from "react-router-dom";
interface DataType { interface DataType {
@ -36,22 +37,27 @@ export default function Correction() {
const height = window.innerHeight - 180; const height = window.innerHeight - 180;
const [messageApi, contextHolder] = message.useMessage(); const [messageApi, contextHolder] = message.useMessage();
// const nav = useNavigate(); // const nav = useNavigate();
// const { state } = useLocation() const { state } = useLocation()
// const MenuActive = getMenuActive() == 'Correction-PENDING' ? 'PENDING' : getMenuActive() == 'Correction-APPROVED' ? 'APPROVED' : getMenuActive() == 'Correction-REJECTED' ? 'REJECTED' : getMenuActive() == 'Correction-CANCELED' ? 'CANCELED' : '' // const MenuActive = getMenuActive() == 'Correction-PENDING' ? 'PENDING' : getMenuActive() == 'Correction-APPROVED' ? 'APPROVED' : getMenuActive() == 'Correction-REJECTED' ? 'REJECTED' : getMenuActive() == 'Correction-CANCELED' ? 'CANCELED' : ''
const [type, setType] = useState<string | null>(null) // const [type, setType] = useState<string | null>(null)
const [isLoading, setIsLoading] = useState(false) const [isLoading, setIsLoading] = useState(false)
const [page, setPage] = useState(1) // 分页 const [page, setPage] = useState(1) // 分页
const [revokeModal, setRevokeModal] = useState(false) //撤销弹窗 const [revokeModal, setRevokeModal] = useState(false) //撤销弹窗
const [numtype, setnumtype] = useState<string | null>(null) //类型 一次 二次 // const [numtype, setnumtype] = useState<string | null>(null) //类型 一次 二次
const [correctionType, setcorrectionType] = useState<string | null>(null) //补正种类 // const [correctionType, setcorrectionType] = useState<string | null>(null) //补正种类
const init = () => { // const init = () => {
setnumtype(null) // setnumtype(null)
setcorrectionType(null) // setcorrectionType(null)
setType(null) // setType(null)
} // }
const keyWords = state ? state.keywords : ''
const applyStatus = state ? state.applyStatus : ''
const authorId = state ? state.authorId : ''
const correctionNumType = state ? state.correctionNumType : ''
const correctionType = state ? state.correctionType : ''
const columns: TableProps<DataType>['columns'] = const columns: TableProps<DataType>['columns'] =
// 撤销状态 // 撤销状态
type == 'CANCELED' ? [ applyStatus == 'CANCELED' ? [
{ {
title: '序号', title: '序号',
dataIndex: 'index', dataIndex: 'index',
@ -128,7 +134,7 @@ export default function Correction() {
}, },
] ]
: type == 'PENDING' ? : applyStatus == 'PENDING' ?
// PENDING待审核状态 // PENDING待审核状态
[ [
{ {
@ -219,7 +225,7 @@ export default function Correction() {
}, },
] ]
// 未通过 状态 // 未通过 状态
: type == 'REJECTED' ? : applyStatus == 'REJECTED' ?
[ [
{ {
title: '序号', title: '序号',
@ -270,6 +276,9 @@ export default function Correction() {
key: 'gmtReview', key: 'gmtReview',
align: 'center', align: 'center',
width: 200, width: 200,
render: (text) => <div>
{text ? text : '—'}
</div>
}, },
{ {
title: '审核状态', title: '审核状态',
@ -312,7 +321,7 @@ export default function Correction() {
] ]
//已通过状态 //已通过状态
: type == 'APPROVED' ? : applyStatus == 'APPROVED' ?
[ [
{ {
title: '序号', title: '序号',
@ -363,6 +372,9 @@ export default function Correction() {
key: 'gmtReview', key: 'gmtReview',
align: 'center', align: 'center',
width: 200, width: 200,
render: (text) => <div>
{text ? text : '—'}
</div>
}, },
{ {
title: '审核状态', title: '审核状态',
@ -485,6 +497,9 @@ export default function Correction() {
key: 'gmtReview', key: 'gmtReview',
align: 'center', align: 'center',
width: 200, width: 200,
render: (text) => <div>
{text ? text : '—'}
</div>
}, },
{ {
title: '审核状态', title: '审核状态',
@ -562,6 +577,8 @@ export default function Correction() {
const correctionArray = redxuState.correctionArray const correctionArray = redxuState.correctionArray
const total = redxuState.correctionTotal const total = redxuState.correctionTotal
const [projCorrectionApplyId, setprojCorrectionApplyId] = useState('') //要撤销的id const [projCorrectionApplyId, setprojCorrectionApplyId] = useState('') //要撤销的id
// const correctionType = state?state.correctionType:''
const getData = (page: number) => { const getData = (page: number) => {
get({ get({
messageApi, messageApi,
@ -571,9 +588,11 @@ export default function Correction() {
params: { params: {
page: page, page: page,
rows: 20, rows: 20,
applyStatus: type, projName: keyWords,
type: numtype, applyStatus: applyStatus,
correctionType: correctionType type: correctionNumType,
correctionType: correctionType,
authorId: authorId
} }
}, },
onBefore() { onBefore() {
@ -617,7 +636,11 @@ export default function Correction() {
params: { params: {
page: page, page: page,
rows: 20, rows: 20,
applyStatus: type projName: keyWords,
applyStatus: applyStatus,
type: correctionNumType,
correctionType: correctionType,
authorId: authorId
} }
}, },
onSuccess(data: any) { onSuccess(data: any) {
@ -654,12 +677,12 @@ export default function Correction() {
// console.log(type); // console.log(type);
// console.log('嘻嘻',correctionArray); // console.log('嘻嘻',correctionArray);
}, [type, numtype, correctionType]) }, [keyWords, applyStatus, authorId, correctionNumType, correctionType])
return ( return (
<div> <div>
{contextHolder} {contextHolder}
<div className='refun' style={{ height: `${height}px`, overflow: 'auto' }}> <div className='refun' style={{ height: `${height}px`, overflow: 'auto' }}>
<div style={{ marginBottom: 10 }}> {/* <div style={{ marginBottom: 10 }}>
<Select <Select
value={numtype} value={numtype}
style={{ height: '31px', width: '150px' }} style={{ height: '31px', width: '150px' }}
@ -717,7 +740,7 @@ export default function Correction() {
icon={<ClearOutlined />}> icon={<ClearOutlined />}>
</Button> </Button>
</div> </div> */}
{/* {state.type} */} {/* {state.type} */}
<Spin tip="加载中..." spinning={isLoading}> <Spin tip="加载中..." spinning={isLoading}>
<Table columns={columns} <Table columns={columns}
@ -747,7 +770,7 @@ export default function Correction() {
description="暂无数据" description="暂无数据"
/>, />,
}} }}
scroll={{ y: height - 190 }} scroll={{ y: height - 160 }}
rowKey="projCorrectionApplyId" rowKey="projCorrectionApplyId"
/> />
</Spin> </Spin>

View File

@ -246,6 +246,9 @@ export default function Refun() {
key: 'gmtReview', key: 'gmtReview',
align: 'center', align: 'center',
width: 200, width: 200,
render: (text) => <div>
{text ? text : '—'}
</div>
}, },
{ {
title: '审核状态', title: '审核状态',
@ -535,7 +538,7 @@ export default function Refun() {
description="暂无数据" description="暂无数据"
/>, />,
}} }}
scroll={{ y: height - 150 }} scroll={{ y: height - 160 }}
rowKey="projRefundApplyId" rowKey="projRefundApplyId"
/> />
</Spin> </Spin>

View File

@ -142,12 +142,23 @@ export default function Index() {
const [tagDataId, settagDataId] = useState<string | null>(null) const [tagDataId, settagDataId] = useState<string | null>(null)
const [payStatus, setpayStatus] = useState<string | null>(null) const [payStatus, setpayStatus] = useState<string | null>(null)
const [authorId, setauthorId] = useState('') const [authorId, setauthorId] = useState('')
//退款状态
const [applyStatus, setapplyStatus] = useState<string | null>(null) const [applyStatus, setapplyStatus] = useState<string | null>(null)
// 退款关键字 // 退款关键字
const [refunKeywords, setrefunKeywords] = useState('') const [refunKeywords, setrefunKeywords] = useState('')
// 退款临时关键字 // 退款临时关键字
const [newRefunValue, setnewRefunValue] = useState('') const [newRefunValue, setnewRefunValue] = useState('')
//补正搜索相关
// 补正关键字
const [correctionKeywords, setcorrectionKeywords] = useState('')
// 补正临时关键字
const [newCorrectionValue, setnewCorrectionValue] = useState('')
// 补正类型
const [correctionNumType, setcorrectionNumType] = useState<string | null>(null)
// 补正种类
const [correctionType, setcorrectionType] = useState<string | null>(null)
// 补正状态
const [correctionApplyStatus, setcorrectionApplyStatus] = useState<string | null>(null)
// const indexListContext = useContext(IndexListContext); // const indexListContext = useContext(IndexListContext);
// 所属者信息 // 所属者信息
// const [belongPeopleArray, setBelongPeopleArray] = useState<any[]>([]) // const [belongPeopleArray, setBelongPeopleArray] = useState<any[]>([])
@ -180,12 +191,20 @@ export default function Index() {
settagDataId(null) settagDataId(null)
setpayStatus(null) setpayStatus(null)
} }
// refun页初始化 // 退款页初搜索条件始化
const refunInit = () => { const refunInit = () => {
setnewRefunValue('') setnewRefunValue('')
setrefunKeywords('') setrefunKeywords('')
setapplyStatus(null) setapplyStatus(null)
} }
// 补正页面搜索条件初始化
const correctionInit = () => {
setnewCorrectionValue('')
setcorrectionKeywords('')
setcorrectionNumType(null)
setcorrectionType(null)
setcorrectionApplyStatus(null)
}
const nav = useNavigate(); const nav = useNavigate();
const [searchParams] = useSearchParams(); const [searchParams] = useSearchParams();
@ -660,8 +679,19 @@ export default function Index() {
} }
}) })
} }
if (location.pathname.includes('/correction')) {
nav('/correction', {
state: {
keywords: correctionKeywords,
correctionNumType: correctionNumType,
correctionType: correctionType,
applyStatus: correctionApplyStatus,
authorId: authorId
}
})
}
}, [type, chargeAdditionals, keywords, tagDataId,payStatus, authorId, refunKeywords, applyStatus]); }, [type, chargeAdditionals, keywords, tagDataId, payStatus, authorId, refunKeywords, applyStatus, correctionKeywords, correctionNumType, correctionType, correctionApplyStatus]);
// const [menuName,setMenuName] = useState<string | null>('') // const [menuName,setMenuName] = useState<string | null>('')
// useEffect(()=>{ // useEffect(()=>{
@ -728,6 +758,36 @@ export default function Index() {
}) })
} }
} }
// 补正关键字搜索
const correctionhandleSearch = (value: string) => {
// console.log(value);
setcorrectionKeywords(value)
nav('/correction', {
state: {
keywords: value,
correctionNumType: correctionNumType,
correctionType: correctionType,
applyStatus: correctionApplyStatus,
authorId: authorId
}
})
}
const correctionhandleChange = (e: any) => {
setnewCorrectionValue(e.target.value)
// console.log(e.target.value);
if (e.target.value == '') {
setcorrectionKeywords('')
nav('/correction', {
state: {
keywords: '',
correctionNumType: correctionNumType,
correctionType: correctionType,
applyStatus: correctionApplyStatus,
authorId: authorId
}
})
}
}
return ( return (
<> <>
{/* <Breadcrumb {/* <Breadcrumb
@ -750,13 +810,21 @@ export default function Index() {
list={projMenu.list} list={projMenu.list}
handleListItem={projMenu.handleListItem} handleListItem={projMenu.handleListItem}
keywords={keywords} keywords={keywords}
refunKeywords={refunKeywords}
applyStatus={applyStatus ? applyStatus : ''}
type={type ? type : ""}
chargeAdditionals={chargeAdditionals ? chargeAdditionals : ""} chargeAdditionals={chargeAdditionals ? chargeAdditionals : ""}
tagDataId={tagDataId ? tagDataId : ""} tagDataId={tagDataId ? tagDataId : ""}
authorId={authorId ? authorId : ""} authorId={authorId ? authorId : ""}
payStatus={payStatus ? payStatus : ''} payStatus={payStatus ? payStatus : ''}
// 退款
refunKeywords={refunKeywords}
applyStatus={applyStatus ? applyStatus : ''}
type={type ? type : ""}
// 补正
correctionKeywords={correctionKeywords ? correctionKeywords : ''}
correctionNumType={correctionNumType ? correctionNumType : ''}
correctionType={correctionType ? correctionType : ''}
correctionApplyStatus={correctionApplyStatus ? correctionApplyStatus : ''}
// enableBelongpeople = {()=>{setClickBelongpeople(true)}} // enableBelongpeople = {()=>{setClickBelongpeople(true)}}
/> />
@ -1105,7 +1173,10 @@ export default function Index() {
}} ></div> }} ></div>
<Button type="primary" onClick={() => { <Button type="primary" onClick={() => {
setRefunModal(true) setRefunModal(true)
}}> refunInit()
}}
style={{ background: '#FF9F08' }}
>
退 退
</Button> </Button>
<Search placeholder="输入项目名称" <Search placeholder="输入项目名称"
@ -1163,13 +1234,16 @@ export default function Index() {
}} ></div> }} ></div>
<Button type="primary" onClick={() => { <Button type="primary" onClick={() => {
setCorrectionModal(true) setCorrectionModal(true)
}}> correctionInit()
}}
style={{ background: '#FF9F08' }}
>
</Button> </Button>
<Search placeholder="输入项目名称" <Search placeholder="输入项目名称"
value={newRefunValue} value={newCorrectionValue}
onSearch={refunhandleSearch} onSearch={correctionhandleSearch}
onChange={refunhandleChange} onChange={correctionhandleChange}
style={{ style={{
width: '200px', width: '200px',
height: '31px', height: '31px',
@ -1178,11 +1252,20 @@ export default function Index() {
allowClear allowClear
/> />
<Select <Select
// value={numtype} value={correctionNumType}
style={{ height: '31px', width: '150px', marginLeft: 10 }} style={{ height: '31px', width: '150px', marginLeft: 10 }}
onChange={(value: string) => { onChange={(value: string) => {
// setnumtype(value) setcorrectionNumType(value)
nav('/correction', {
state: {
keywords: correctionKeywords,
correctionNumType: value,
correctionType: correctionType,
applyStatus: correctionApplyStatus,
authorId: authorId
}
})
}} }}
options={[ options={[
// { value: '', label: '全部项目' }, // { value: '', label: '全部项目' },
@ -1195,9 +1278,18 @@ export default function Index() {
/> />
<Select <Select
style={{ height: '31px', width: '150px', marginLeft: 10 }} style={{ height: '31px', width: '150px', marginLeft: 10 }}
// value={correctionType} value={correctionType}
onChange={(value: string) => { onChange={(value: string) => {
// setcorrectionType(value) setcorrectionType(value)
nav('/correction', {
state: {
keywords: correctionKeywords,
correctionNumType: correctionNumType,
correctionType: value,
applyStatus: correctionApplyStatus,
authorId: authorId
}
})
}} }}
allowClear allowClear
options={[ options={[
@ -1211,13 +1303,15 @@ export default function Index() {
placeholder={'选择补正种类'} placeholder={'选择补正种类'}
/> />
<Select <Select
value={applyStatus} value={correctionApplyStatus}
style={{ height: '31px', width: '150px', marginLeft: 10 }} style={{ height: '31px', width: '150px', marginLeft: 10 }}
onChange={(value: string) => { onChange={(value: string) => {
setapplyStatus(value) setcorrectionApplyStatus(value)
nav('/refun', { nav('/correction', {
state: { state: {
keywords: refunKeywords, keywords: correctionKeywords,
correctionNumType: correctionNumType,
correctionType: correctionType,
applyStatus: value, applyStatus: value,
authorId: authorId authorId: authorId
} }
@ -1235,7 +1329,7 @@ export default function Index() {
allowClear allowClear
/> />
<Button onClick={() => { <Button onClick={() => {
refunInit() correctionInit()
}} style={{ marginLeft: 10, height: 31 }} }} style={{ marginLeft: 10, height: 31 }}
// type="primary" // type="primary"
icon={<ClearOutlined />}> icon={<ClearOutlined />}>