diff --git a/src/route/Correction/Correction.css b/src/route/Correction/Correction.css index b14f45c..8177181 100644 --- a/src/route/Correction/Correction.css +++ b/src/route/Correction/Correction.css @@ -50,4 +50,28 @@ box-sizing: border-box; text-align: center; line-height: 25px; +} + +.projBoxTop { + /* background-color: pink; */ + align-items: center; +} + +.corrTypeC { + /* background-color: skyblue; */ + height: 20px; + /* background: #ff7b00; */ + /* background: #01a13f; */ + border-radius: 5px; + /* font-family: Microsoft YaHei UI; */ + font-weight: 400; + font-size: 12px; + padding-left: 9px; + padding-right: 9px; + margin-left: 10px; + cursor: pointer; + display: flex; + align-items: center; + justify-content: center; + text-wrap: nowrap; } \ No newline at end of file diff --git a/src/route/Correction/Correction.tsx b/src/route/Correction/Correction.tsx index 1f209c4..e515c6c 100644 --- a/src/route/Correction/Correction.tsx +++ b/src/route/Correction/Correction.tsx @@ -17,7 +17,8 @@ import { useSelector, useDispatch } from 'react-redux' import { get, put, downloadUrl, - Axios + Axios, + post } from '../../util/AjaxUtils' // import type { TableProps } from 'antd'; import { useLocation } from 'react-router-dom'; @@ -64,6 +65,7 @@ export default function Correction() { // } const keyWords = state ? state.keywords : '' const applyStatus = state ? state.applyStatus : '' + const tagCor = state ? state.tagCor : '' const authorId = state ? state.authorId : '' const correctionNumType = state ? state.correctionNumType : '' const correctionType = state ? state.correctionType : '' @@ -712,12 +714,40 @@ export default function Correction() { const dispath = useDispatch() const redxuState: any = useSelector(state => state) const correctionArray = redxuState.correctionArray + // const [tagIdArray,setTagIdArray] = useState([]) const total = redxuState.correctionTotal const newCorrection = redxuState.newCorrection const [projCorrectionApplyId, setprojCorrectionApplyId] = useState('') //要撤销的id // const correctionType = state?state.correctionType:'' + // 补正标签数组 + const [tagCorArray, setTagCorArray] = useState([]) + // 获取补正标签 + const getCorTag = () => { + get({ + messageApi, + url: `/api/proj/correction/apply/tag/list-tag`, + onBefore() { + + }, + onSuccess(data: any) { + // console.log('标签信息', data); + const newarrty: any = (data.data).map((item: any) => ({ + value: item.key, + label: item.value + })); + console.log('标签信息', newarrty); + + setTagCorArray(newarrty) + + }, + onFinally() { + + } + }) + } const getData = (page: number) => { + const [part1, part2] = tagCor ? tagCor.split(':') : ['', '']; get({ messageApi, url: `/api/proj/correction/apply/listpage/self`, @@ -730,7 +760,9 @@ export default function Correction() { applyStatus: applyStatus, type: correctionNumType, correctionType: correctionType, - authorId: authorId + authorId: authorId, + tagDataId: part1, + tagNot: part2 == 'TAG_NOT' ? true : '', } }, onBefore() { @@ -754,6 +786,37 @@ export default function Correction() { }, }) } + // 更新标签状态 + // const upTag = (dataId: string, projCorrectionApplyId: string, projId: string) => { + // post({ + // messageApi, + // url: `/api/proj/correction/apply/tag/save-or-delete`, + // body: { + // dataId, + // projCorrectionApplyId, + // projId + // }, + // onBefore() { + + // }, + // onSuccess(data) { + // console.log(data.data.data); + // // props.upData + // // props.updata() + // // setTagStatus(data.data.data) + // // 根据返回的状态更新 tagIdArray + // if (data.data.data === 'SAVE') { + // // setTagIdArray((prevArray: any) => [...prevArray, dataId]); + // } else if (data.data.data === 'DELETE') { + // // setTagIdArray((prevArray: any[]) => prevArray.filter(id => id !== dataId)); + // } + + // }, + // onFinally() { + + // } + // }) + // } // 撤销补正 const projRefund = () => { put({ @@ -812,10 +875,11 @@ export default function Correction() { // getData(1) setPage(1) getData(1) - // console.log(type); + // console.log(tagCor); // console.log('嘻嘻',correctionArray); - }, [keyWords, applyStatus, authorId, correctionNumType, correctionType]) + + }, [keyWords, applyStatus, authorId, correctionNumType, correctionType, tagCor]) useEffect(() => { // 获取id为refun的元素 const refun: any = document.getElementById('refun'); @@ -836,7 +900,15 @@ export default function Correction() { }, [newCorrection]) - + useEffect(() => { + getCorTag() + // dispath({ + // type: 'upCorrectionArray', + // val: updatedArray + // }); + // getData(1) + }, []) + return (
{contextHolder} @@ -945,11 +1017,103 @@ export default function Correction() { {item.correctionType == 'CODE' ? '代码' : item.correctionType == 'MANUAL' ? '操作手册' : item.correctionType == 'ALL' ? '全部补正' : ''}
+ { + // tagCorArray.map((item: any) => ( + // const [part1, part2] = item.value.split(':'); + // if(part2 == 'TAG_NOT'){ + // return( + //
+ // ) + // } + // //
+ + // //
+ // )) + } +
+ { + tagCorArray.map((tagitem: any) => { + const [part1, part2] = tagitem.value.split(':'); + + if (part2 !== 'TAG_NOT') { + return ( +
{ + post({ + messageApi, + url: `/api/proj/correction/apply/tag/save-or-delete`, + body: { + dataId: part1, + projCorrectionApplyId: item.projCorrectionApplyId, + projId: item.projId + }, + onBefore() { + + }, + onSuccess(data) { + + + if (data.data.data === 'SAVE') { + const updatedArray = correctionArray.map((Aitem:any) => { + if (Aitem.projCorrectionApplyId === item.projCorrectionApplyId) { + return { + ...Aitem, + tagDataIds: [...Aitem.tagDataIds, part1] + }; + } + return Aitem; + }); + dispath({ + type: 'upCorrectionArray', + val: updatedArray + }); + + + } else if (data.data.data === 'DELETE') { + const updatedArray = correctionArray.map((Aitem:any) => { + if (Aitem.projCorrectionApplyId === item.projCorrectionApplyId) { + return { + ...Aitem, + tagDataIds: Aitem.tagDataIds.filter((id:any) => id !== part1) + }; + } + return Aitem; + }); + dispath({ + type: 'upCorrectionArray', + val: updatedArray + }); + } + + }, + onFinally() { + + } + }) + } + } + > + {tagitem.label} +
+ ) + } + + }) + } +
100 ? '12px' : '18px' }} + // style={{ fontSize: (page - 1) * 20 + index + 1 > 100 ? '12px' : '18px' }} > {(page - 1) * 20 + index + 1}
diff --git a/src/route/index/Index.tsx b/src/route/index/Index.tsx index 3d0262a..deb4842 100644 --- a/src/route/index/Index.tsx +++ b/src/route/index/Index.tsx @@ -52,6 +52,36 @@ const { Search } = Input; export default function Index() { // 是否可以点击所属者 (当点击了退款选项,所属者列表跟他不产生联系 不给他点) // const [clickBelongpeople, setClickBelongpeople] = useState(true) + // 补正搜索条件标签数组 + const [tagCorArray, setTagCorArray] = useState([]) + // 获取补正标签 + const getCorTag = () => { + get({ + messageApi, + url: `/api/proj/correction/apply/tag/list-tag`, + onBefore() { + + }, + onSuccess(data: any) { + // console.log('标签信息', data); + const newarrty: any = (data.data).map((item: any) => ({ + value: item.key, + label: item.value + })); + // console.log('标签信息', newarrty); + + setTagCorArray(newarrty) + + }, + onFinally() { + + } + }) + } + // 选择的标签 + const [tagCor, setTagCor] = useState('') + + // 选项数组 const [tagArray, setTagArray] = useState([]) @@ -65,7 +95,7 @@ export default function Index() { }, onSuccess(data: any) { - console.log('标签信息', data); + // console.log('标签信息', data); const newarrty: any = (data.data).map((item: any) => ({ value: item.key, label: item.value @@ -172,7 +202,6 @@ export default function Index() { const [tagDataId, settagDataId] = useState(null) const [payStatus, setpayStatus] = useState(null) const [authorId, setauthorId] = useState('') - const [projRemindId, setprojRemindId] = useState(null) //退款状态 const [applyStatus, setapplyStatus] = useState(null) @@ -838,6 +867,7 @@ export default function Index() { } getProjOwnerList() + getCorTag() getTag() getremindTag() }, []); @@ -872,12 +902,13 @@ export default function Index() { correctionNumType: correctionNumType, correctionType: correctionType, applyStatus: correctionApplyStatus, - authorId: authorId + authorId: authorId, + tagCor:tagCor, } }) } - }, [type, chargeAdditionals, keywords, tagDataId, projRemindId, payStatus, authorId, refunKeywords, applyStatus, correctionKeywords, correctionNumType, correctionType, correctionApplyStatus]); + }, [type, chargeAdditionals, keywords, tagDataId, projRemindId, payStatus, authorId, refunKeywords, applyStatus, correctionKeywords, correctionNumType, correctionType, correctionApplyStatus,tagCor]); // const [menuName,setMenuName] = useState('') // useEffect(()=>{ @@ -959,7 +990,8 @@ export default function Index() { correctionNumType: correctionNumType, correctionType: correctionType, applyStatus: correctionApplyStatus, - authorId: authorId + authorId: authorId, + tagCor:tagCor, } }) } @@ -974,7 +1006,8 @@ export default function Index() { correctionNumType: correctionNumType, correctionType: correctionType, applyStatus: correctionApplyStatus, - authorId: authorId + authorId: authorId, + tagCor:tagCor, } }) } @@ -1305,7 +1338,7 @@ export default function Index() { // value={tagDataId} style={{ height: '31px', width: '130px', marginLeft: 20, display: showSearchBox ? 'block' : 'none' }} onChange={(value: string) => { - console.log(`selected ${value}`); + // console.log(`selected ${value}`); // const [part1, part2] = value.split(':'); // console.log('part1:', part1); // console.log('part2:', part2); @@ -1514,7 +1547,7 @@ export default function Index() { onSearch={correctionhandleSearch} onChange={correctionhandleChange} style={{ - width: '200px', + width: '160px', height: '31px', marginLeft: 10 }} @@ -1522,7 +1555,7 @@ export default function Index() { /> { setcorrectionType(value) @@ -1556,7 +1590,8 @@ export default function Index() { correctionNumType: correctionNumType, correctionType: value, applyStatus: correctionApplyStatus, - authorId: authorId + authorId: authorId, + tagCor:tagCor, } }) }} @@ -1573,7 +1608,7 @@ export default function Index() { /> { + setTagCor(value) + nav('/correction', { + state: { + keywords: correctionKeywords, + correctionNumType: correctionNumType, + correctionType: correctionType, + applyStatus: applyStatus, + authorId: authorId, + tagCor:value, + } + }) + }} + options={ + tagCorArray + } + // defaultValue="" + placeholder={'选择标签'} + allowClear />