减少请求次数
This commit is contained in:
parent
08fd4dcb80
commit
7aa44b6ca0
@ -32,32 +32,32 @@ import SoftwareManagementShow from '../../route/proj/edit/ProjConfigModListShow.
|
|||||||
import DisplayOrder from '../../route/proj/edit/ProjConfigMenuList.tsx'
|
import DisplayOrder from '../../route/proj/edit/ProjConfigMenuList.tsx'
|
||||||
import DisplayOrderShow from '../../route/proj/edit/ProjConfigMenuListShow.tsx'
|
import DisplayOrderShow from '../../route/proj/edit/ProjConfigMenuListShow.tsx'
|
||||||
export default function CardProj(props: any) {
|
export default function CardProj(props: any) {
|
||||||
// 选项数组
|
// // 选项数组
|
||||||
const [tagArray, setTagArray] = useState([])
|
// const [tagArray, setTagArray] = useState([])
|
||||||
// 获取标签
|
// // 获取标签
|
||||||
const getTag = () => {
|
// const getTag = () => {
|
||||||
get({
|
// get({
|
||||||
messageApi,
|
// messageApi,
|
||||||
url: `/api/proj/tag/list-tag`,
|
// url: `/api/proj/tag/list-tag`,
|
||||||
onBefore() {
|
// onBefore() {
|
||||||
|
|
||||||
},
|
// },
|
||||||
onSuccess(data: any) {
|
// onSuccess(data: any) {
|
||||||
// console.log('标签信息', data);
|
// // console.log('标签信息', data);
|
||||||
const newarrty: any = (data.data).map((item: any) => ({
|
// const newarrty: any = (data.data).map((item: any) => ({
|
||||||
value: item.key,
|
// value: item.key,
|
||||||
label: item.value
|
// label: item.value
|
||||||
}));
|
// }));
|
||||||
// console.log('标签信息', newarrty);
|
// // console.log('标签信息', newarrty);
|
||||||
|
|
||||||
setTagArray(newarrty)
|
// setTagArray(newarrty)
|
||||||
|
|
||||||
},
|
// },
|
||||||
onFinally() {
|
// onFinally() {
|
||||||
|
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
}
|
// }
|
||||||
// 更新标签状态
|
// 更新标签状态
|
||||||
const upTag = (dataId:string,projId:string) => {
|
const upTag = (dataId:string,projId:string) => {
|
||||||
post<any>({
|
post<any>({
|
||||||
@ -73,6 +73,7 @@ export default function CardProj(props: any) {
|
|||||||
onSuccess() {
|
onSuccess() {
|
||||||
// console.log(data);
|
// console.log(data);
|
||||||
// props.upData
|
// props.upData
|
||||||
|
// props.updata()
|
||||||
},
|
},
|
||||||
onFinally() {
|
onFinally() {
|
||||||
|
|
||||||
@ -107,11 +108,11 @@ export default function CardProj(props: any) {
|
|||||||
const isShow = data.pay.chargeAdditionals.includes('PKG') || data.pay.charge.includes('ALL')
|
const isShow = data.pay.chargeAdditionals.includes('PKG') || data.pay.charge.includes('ALL')
|
||||||
|
|
||||||
const [messageApi, messageContext] = useMessage();
|
const [messageApi, messageContext] = useMessage();
|
||||||
const [projCategoryId, setProjCategoryId] = useState(data.projCategoryId);
|
// const [projCategoryId, setProjCategoryId] = useState(data.projCategoryId);
|
||||||
const [projCategoryName, setProjCategoryName] = useState(data.projCategoryName);
|
// const [projCategoryName, setProjCategoryName] = useState(data.projCategoryName);
|
||||||
const [charge, setCharge] = useState('');
|
const [charge, setCharge] = useState('');
|
||||||
const [payCharge, setPayCharge] = useState('');
|
const [payCharge, setPayCharge] = useState('');
|
||||||
const indexListContext = useContext(IndexListContext);
|
// const indexListContext = useContext(IndexListContext);
|
||||||
/**
|
/**
|
||||||
* 生成状态
|
* 生成状态
|
||||||
*/
|
*/
|
||||||
@ -164,7 +165,7 @@ export default function CardProj(props: any) {
|
|||||||
// console.log('额外收费视频',videoDemoValue);
|
// console.log('额外收费视频',videoDemoValue);
|
||||||
// console.log('额外收费加急',URGENTvalue);
|
// console.log('额外收费加急',URGENTvalue);
|
||||||
// console.log('基础服务费',basicsValue);
|
// console.log('基础服务费',basicsValue);
|
||||||
getTag()
|
// getTag()
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -185,7 +186,7 @@ export default function CardProj(props: any) {
|
|||||||
<div className='cp-time'>
|
<div className='cp-time'>
|
||||||
{data.gmtCreate}
|
{data.gmtCreate}
|
||||||
</div>
|
</div>
|
||||||
{tagArray.map((item:any) => {
|
{props.tagArray.map((item:any) => {
|
||||||
return (
|
return (
|
||||||
<div className='proj-progress' key={item.value} style={{
|
<div className='proj-progress' key={item.value} style={{
|
||||||
background:(data.tagDataIds).includes(item.value)?'#ff7b00':'',
|
background:(data.tagDataIds).includes(item.value)?'#ff7b00':'',
|
||||||
|
@ -29,11 +29,11 @@ export default function ListProj() {
|
|||||||
// // setKeywords(state.keyword)
|
// // setKeywords(state.keyword)
|
||||||
// }
|
// }
|
||||||
const keywords = state ? state.keyword : ''
|
const keywords = state ? state.keyword : ''
|
||||||
const name = state ? state.name : ''
|
const name = state ? state.name : ''
|
||||||
|
|
||||||
const chargeAdditionals = state? state.chargeAdditionals:''
|
const chargeAdditionals = state ? state.chargeAdditionals : ''
|
||||||
const tagDataId = state? state.tagDataId:''
|
const tagDataId = state ? state.tagDataId : ''
|
||||||
const authorId = state? state.authorId:''
|
const authorId = state ? state.authorId : ''
|
||||||
// console.log(keywords);
|
// console.log(keywords);
|
||||||
// const images = [syminga,symingb,symingc,symingd]
|
// const images = [syminga,symingb,symingc,symingd]
|
||||||
const listProjRef: MutableRefObject<HTMLDivElement | null> = useRef(null);
|
const listProjRef: MutableRefObject<HTMLDivElement | null> = useRef(null);
|
||||||
@ -62,9 +62,9 @@ export default function ListProj() {
|
|||||||
rows: 10,
|
rows: 10,
|
||||||
keywords: keywords,
|
keywords: keywords,
|
||||||
charge: name,
|
charge: name,
|
||||||
chargeAdditionals:chargeAdditionals,
|
chargeAdditionals: chargeAdditionals,
|
||||||
tagDataId:tagDataId,
|
tagDataId: tagDataId,
|
||||||
authorId:authorId,
|
authorId: authorId,
|
||||||
projCategoryId: indexListContext.category,
|
projCategoryId: indexListContext.category,
|
||||||
status: indexListContext.status ? indexListContext.status : getMenuActive()
|
status: indexListContext.status ? indexListContext.status : getMenuActive()
|
||||||
}
|
}
|
||||||
@ -73,8 +73,8 @@ export default function ListProj() {
|
|||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
},
|
},
|
||||||
onSuccess({ data }) {
|
onSuccess({ data }) {
|
||||||
console.log('数据',data);
|
console.log('数据', data);
|
||||||
|
|
||||||
setPage(data.page);
|
setPage(data.page);
|
||||||
setTotal(data.total);
|
setTotal(data.total);
|
||||||
setProjs(data.rows);
|
setProjs(data.rows);
|
||||||
@ -91,7 +91,35 @@ export default function ListProj() {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
// 选项数组
|
||||||
|
const [tagArray, setTagArray] = useState([])
|
||||||
|
// 获取标签
|
||||||
|
const getTag = () => {
|
||||||
|
get({
|
||||||
|
messageApi,
|
||||||
|
url: `/api/proj/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);
|
||||||
|
|
||||||
|
setTagArray(newarrty)
|
||||||
|
|
||||||
|
},
|
||||||
|
onFinally() {
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
useEffect(()=>{
|
||||||
|
getTag()
|
||||||
|
},[])
|
||||||
// 更新数据
|
// 更新数据
|
||||||
const upreqData = () => {
|
const upreqData = () => {
|
||||||
get<IListPage<IProj>>({
|
get<IListPage<IProj>>({
|
||||||
@ -103,9 +131,9 @@ export default function ListProj() {
|
|||||||
rows: 10,
|
rows: 10,
|
||||||
keywords: keywords,
|
keywords: keywords,
|
||||||
charge: name,
|
charge: name,
|
||||||
chargeAdditionals:chargeAdditionals,
|
chargeAdditionals: chargeAdditionals,
|
||||||
tagDataId:tagDataId,
|
tagDataId: tagDataId,
|
||||||
authorId:authorId,
|
authorId: authorId,
|
||||||
projCategoryId: indexListContext.category,
|
projCategoryId: indexListContext.category,
|
||||||
status: indexListContext.status ? indexListContext.status : getMenuActive()
|
status: indexListContext.status ? indexListContext.status : getMenuActive()
|
||||||
}
|
}
|
||||||
@ -121,7 +149,7 @@ export default function ListProj() {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const renderList = () => {
|
const renderList = () => {
|
||||||
if (projs.length == 0) {
|
if (projs.length == 0) {
|
||||||
@ -143,7 +171,8 @@ export default function ListProj() {
|
|||||||
return (
|
return (
|
||||||
<div className='projListBox' key={new Date().getTime() + ':' + item.projId}>
|
<div className='projListBox' key={new Date().getTime() + ':' + item.projId}>
|
||||||
<CardProj item={item}
|
<CardProj item={item}
|
||||||
updata = {upreqData}
|
updata={upreqData}
|
||||||
|
tagArray={tagArray}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
@ -168,7 +197,7 @@ export default function ListProj() {
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
setShowPage(true)
|
setShowPage(true)
|
||||||
}, 0);
|
}, 0);
|
||||||
}, [indexListContext.status, keywords, name,chargeAdditionals,tagDataId,authorId])
|
}, [indexListContext.status, keywords, name, chargeAdditionals, tagDataId, authorId])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
reqData(page);
|
reqData(page);
|
||||||
|
Loading…
Reference in New Issue
Block a user