detail撤回逻辑调整,移动位置也会添加撤回记录中

This commit is contained in:
X1627315083
2025-10-31 15:22:43 +08:00
parent e8036b2f3c
commit 465f9f8004
4 changed files with 30 additions and 15 deletions

View File

@@ -248,15 +248,13 @@ export default defineComponent({
const setRevocation = ()=>{//设置撤销
let itemDetail = JSON.parse(JSON.stringify(detailData.designDetail))
let revocation:any = JSON.parse((sessionStorage.getItem("revocation") as any))
if(!revocation)revocation = []
// let oppositeRevocation = JSON.parse((sessionStorage.getItem("oppositeRevocation") as any))
if(revocation?.[0]?.designItemId != itemDetail.designItemId || revocation?.[0]?.designItemId == undefined){
// sessionStorage.setItem('revocation', JSON.stringify([]));
// sessionStorage.setItem('oppositeRevocation',JSON.stringify([]));
revocation = []
}
// if(revocation?.[0]?.designItemId != itemDetail.designItemId || revocation?.[0]?.designItemId == undefined){
// revocation = []
// }
revocation.push({designData:itemDetail,position:null})
detailData.revocationShow = revocation?.length
detailData.oppositeRevocationShow = 0
sessionStorage.setItem('revocation', JSON.stringify(revocation));
sessionStorage.setItem('oppositeRevocation',JSON.stringify([]));
}
@@ -265,13 +263,16 @@ export default defineComponent({
const revocation = ()=>{//撤回
let oppositeRevocation = JSON.parse((sessionStorage.getItem("oppositeRevocation") as any))
let revocation = JSON.parse((sessionStorage.getItem("revocation") as any))
if(detailData.revocationShow <= 1)return
if(revocation.length <= 1)return
oppositeRevocation.push(revocation[revocation.length-1])
detailData.oppositeRevocationShow = oppositeRevocation.length
revocation.splice(revocation.length-1,1)
detailData.revocationShow = revocation.length
// store.commit("DesignDetail/setDesignDetail", revocation[revocation.length-1]);
store.commit('DesignDetail/setDesignDetail',revocation[revocation.length-1])
if(revocation[revocation.length-1].designData){
store.commit('DesignDetail/setDesignDetail',revocation[revocation.length-1].designData)
}else{
store.commit('DesignDetail/setFrontBack',revocation[revocation.length-1].position)
}
store.commit('DesignDetail/setDesignColthes',detailData.selectDetail.id)
sessionStorage.setItem('oppositeRevocation', JSON.stringify(oppositeRevocation));
sessionStorage.setItem('revocation', JSON.stringify(revocation));
@@ -281,8 +282,13 @@ export default defineComponent({
const oppositeRevocation = ()=>{//反撤回
let oppositeRevocation = JSON.parse((sessionStorage.getItem("oppositeRevocation") as any))
let revocation = JSON.parse((sessionStorage.getItem("revocation") as any))
if(!oppositeRevocation[oppositeRevocation.length-1])return
store.commit("DesignDetail/setDesignDetail", oppositeRevocation[oppositeRevocation.length-1]);
// if(!oppositeRevocation[oppositeRevocation.length-1].designData)return
if(oppositeRevocation.length < 1)return
if(oppositeRevocation[oppositeRevocation.length-1]?.designData){
store.commit('DesignDetail/setDesignDetail',oppositeRevocation[oppositeRevocation.length-1].designData)
}else if(oppositeRevocation[oppositeRevocation.length-1]?.position){
store.commit('DesignDetail/setFrontBack',oppositeRevocation[oppositeRevocation.length-1].position)
}
store.commit('DesignDetail/setDesignColthes',detailData.selectDetail.id)
revocation.push(oppositeRevocation[oppositeRevocation.length-1])
detailData.revocationShow = revocation.length
@@ -363,7 +369,6 @@ export default defineComponent({
}
const getSubmitData = async (str:string)=>{
// return
console.log(detailData.selectDetail)
let workspace = store.state.Workspace.probjects
if(!detailData?.selectDetail?.path && !detailData?.selectDetail?.newDetail?.sketch?.minIOPath)return
let clothes:any