Commit 4860b064 authored by zhengke's avatar zhengke

模版 修复重复id

parent e8cebf14
......@@ -412,11 +412,16 @@ const GetTripTemplate = async () =>{
}else if(SlidesData.length>0){
newSlides = SlidesData
}
let IDs = []
newSlides.forEach((x,index)=>{
let IDs = x.id.split('-')
if(IDs&&IDs.length==3){
x.id = x.id+'-'+index
let ids = x.id.split('-')
let existId = IDs.findIndex(y=>{ y==x.id }) == -1
if(existId) IDs.push(x.id)
else {
let id = Math.floor(Math.random() * newSlides.length)//Math.floor(Math.random())+index
x.id = `${ids[0]}-${ids[1]}-${id}`
}
console.log(existId,x.id,'----newSlides ID')
x.elements.forEach(y=>{
if(x.pageType!=1&&y.TemplateDataSource&&y.TemplateDataSource.index==null){
Reflect.set(y.TemplateDataSource, 'index', null)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment