diff --git a/src/route/Correction/Correction.tsx b/src/route/Correction/Correction.tsx index c8f06f7..034dc5d 100644 --- a/src/route/Correction/Correction.tsx +++ b/src/route/Correction/Correction.tsx @@ -47,6 +47,9 @@ import red from '../../static/projBox/red.png' import blue from '../../static/projBox/blue.png' import black from '../../static/projBox/black.png' export default function Correction() { + // 标签变量 + + // const [tagDataIds, setTagDataIds] = useState([]) const height = window.innerHeight - 180; const [messageApi, contextHolder] = message.useMessage(); // const nav = useNavigate(); @@ -921,6 +924,7 @@ export default function Correction() { : <> {correctionArray.map((item: any, index: any) => { + // setBack(item.tagDataIds.includes(part1)?true:false) const downCode = [ { key: 'downword', @@ -1017,26 +1021,14 @@ 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(':'); - + // setTagDataIds(tagitem.tagDataIds) if (part2 !== 'TAG_NOT') { return (
{ + (e:any) => { + // 获取点击的这个盒子的背景色 + + post({ messageApi, url: `/api/proj/correction/apply/tag/save-or-delete`, @@ -1059,38 +1056,21 @@ export default function Correction() { }, 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 - }); - + + e.target.style.background = '#ff7b00'; + e.target.style.color = '#ffffff'; + e.target.style.border = '1px solid #ff7b00'; + } 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 - }); + + e.target.style.background = ''; + e.target.style.color = '#5a5a5a'; + e.target.style.border = '1px solid #5a5a5a'; + } },