补正标签添加

This commit is contained in:
lyp 2025-01-03 15:56:36 +08:00
parent 21a778b92d
commit 8b6428fcff
3 changed files with 267 additions and 20 deletions

View File

@ -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;
}

View File

@ -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<any>({
// 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<any>({
@ -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 (
<div>
{contextHolder}
@ -945,11 +1017,103 @@ export default function Correction() {
{item.correctionType == 'CODE' ? '代码' : item.correctionType == 'MANUAL' ? '操作手册' : item.correctionType == 'ALL' ? '全部补正' : ''}
</div>
</div>
{
// tagCorArray.map((item: any) => (
// const [part1, part2] = item.value.split(':');
// if(part2 == 'TAG_NOT'){
// return(
// <div></div>
// )
// }
// // <div key={item.value} className='corrTypeC'>
// // </div>
// ))
}
<div style={{
display: 'flex',
}}>
{
tagCorArray.map((tagitem: any) => {
const [part1, part2] = tagitem.value.split(':');
if (part2 !== 'TAG_NOT') {
return (
<div key={tagitem.value} className='corrTypeC'
style={{
background: item.tagDataIds.includes(part1) ? '#ff7b00' : '',
color: item.tagDataIds.includes(part1) ? '#ffffff' : '#5a5a5a',
border: item.tagDataIds.includes(part1) ? ' 1px solid #ff7b00' : ' 1px solid #5a5a5a',
}}
onClick={
() => {
post<any>({
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}
</div>
)
}
})
}
</div>
</div>
<div className='projBoxBot'>
<div className='boxTopL'>
<div className='numImg'
// style={{ fontSize: (page - 1) * 20 + index + 1 > 100 ? '12px' : '18px' }}
// style={{ fontSize: (page - 1) * 20 + index + 1 > 100 ? '12px' : '18px' }}
>
{(page - 1) * 20 + index + 1}
</div>

View File

@ -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<string | null>(null)
const [payStatus, setpayStatus] = useState<string | null>(null)
const [authorId, setauthorId] = useState('')
const [projRemindId, setprojRemindId] = useState<string | null>(null)
//退款状态
const [applyStatus, setapplyStatus] = useState<string | null>(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<string | null>('')
// 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() {
/>
<Select
value={correctionNumType}
style={{ height: '31px', width: '150px', marginLeft: 10 }}
style={{ height: '31px', width: '110px', marginLeft: 10 }}
onChange={(value: string) => {
setcorrectionNumType(value)
@ -1532,7 +1565,8 @@ export default function Index() {
correctionNumType: value,
correctionType: correctionType,
applyStatus: correctionApplyStatus,
authorId: authorId
authorId: authorId,
tagCor:tagCor,
}
})
}}
@ -1546,7 +1580,7 @@ export default function Index() {
allowClear
/>
<Select
style={{ height: '31px', width: '150px', marginLeft: 10 }}
style={{ height: '31px', width: '130px', marginLeft: 10 }}
value={correctionType}
onChange={(value: string) => {
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() {
/>
<Select
value={correctionApplyStatus}
style={{ height: '31px', width: '150px', marginLeft: 10 }}
style={{ height: '31px', width: '120px', marginLeft: 10 }}
onChange={(value: string) => {
setcorrectionApplyStatus(value)
nav('/correction', {
@ -1582,7 +1617,8 @@ export default function Index() {
correctionNumType: correctionNumType,
correctionType: correctionType,
applyStatus: value,
authorId: authorId
authorId: authorId,
tagCor:tagCor,
}
})
}}
@ -1596,6 +1632,29 @@ export default function Index() {
// defaultValue=""
placeholder={'选择状态'}
allowClear
/>
<Select
// value={correctionApplyStatus}
style={{ height: '31px', width: '120px', marginLeft: 10 }}
onChange={(value: string) => {
setTagCor(value)
nav('/correction', {
state: {
keywords: correctionKeywords,
correctionNumType: correctionNumType,
correctionType: correctionType,
applyStatus: applyStatus,
authorId: authorId,
tagCor:value,
}
})
}}
options={
tagCorArray
}
// defaultValue=""
placeholder={'选择标签'}
allowClear
/>
<Button onClick={() => {
correctionInit()