perf: 新增异常兜底处理
This commit is contained in:
parent
2030fcc711
commit
83f73aab8d
@ -594,35 +594,48 @@ export const useChartEditStore = defineStore({
|
|||||||
},
|
},
|
||||||
// * 创建分组
|
// * 创建分组
|
||||||
setGroup() {
|
setGroup() {
|
||||||
const groupClass = new PublicGroupConfigClass()
|
try {
|
||||||
this.getTargetChart.selectId.forEach((id: string) => {
|
loadingStart()
|
||||||
// 获取目标数据并从 list 中移除 (成组后不可再次成组, 断言处理)
|
const groupClass = new PublicGroupConfigClass()
|
||||||
const item = this.componentList.splice(this.fetchTargetIndex(id), 1)[0] as CreateComponentType
|
this.getTargetChart.selectId.forEach((id: string) => {
|
||||||
groupClass.groupList.push(item)
|
// 获取目标数据并从 list 中移除 (成组后不可再次成组, 断言处理)
|
||||||
})
|
const item = this.componentList.splice(this.fetchTargetIndex(id), 1)[0] as CreateComponentType
|
||||||
this.addComponentList(groupClass)
|
groupClass.groupList.push(item)
|
||||||
|
})
|
||||||
|
this.addComponentList(groupClass)
|
||||||
|
loadingFinish()
|
||||||
|
} catch (error) {
|
||||||
|
window['$message'].error('创建分组失败,请联系管理员!')
|
||||||
|
loadingFinish()
|
||||||
|
}
|
||||||
},
|
},
|
||||||
// * 解除分组
|
// * 解除分组
|
||||||
setUnGroup() {
|
setUnGroup() {
|
||||||
const selectGroupIdArr = this.getTargetChart.selectId
|
try {
|
||||||
|
loadingStart()
|
||||||
|
const selectGroupIdArr = this.getTargetChart.selectId
|
||||||
|
// 解组
|
||||||
|
const unGroup = (targetIndex: number) => {
|
||||||
|
const targetGroup = this.getComponentList[targetIndex] as CreateComponentGroupType
|
||||||
|
targetGroup.groupList.forEach(item => {
|
||||||
|
this.addComponentList(item)
|
||||||
|
})
|
||||||
|
this.setTargetSelectChart(targetGroup.id)
|
||||||
|
// 删除分组
|
||||||
|
this.removeComponentList(false)
|
||||||
|
}
|
||||||
|
|
||||||
// 解组
|
const targetIndex = this.fetchTargetGroupIndex(selectGroupIdArr[0])
|
||||||
const unGroup = (targetIndex: number) => {
|
// 判断目标是否为分组父级
|
||||||
const targetGroup = this.getComponentList[targetIndex] as CreateComponentGroupType
|
if(targetIndex !== -1) {
|
||||||
targetGroup.groupList.forEach(item => {
|
unGroup(targetIndex)
|
||||||
this.addComponentList(item)
|
} else {
|
||||||
})
|
window['$message'].error('解除分组失败,请联系管理员!')
|
||||||
this.setTargetSelectChart(targetGroup.id)
|
}
|
||||||
// 删除分组
|
loadingFinish()
|
||||||
this.removeComponentList(false)
|
} catch (error) {
|
||||||
}
|
|
||||||
|
|
||||||
const targetIndex = this.fetchTargetGroupIndex(selectGroupIdArr[0])
|
|
||||||
// 判断目标是否为分组父级
|
|
||||||
if(targetIndex !== -1) {
|
|
||||||
unGroup(targetIndex)
|
|
||||||
} else {
|
|
||||||
window['$message'].error('解除分组失败,请联系管理员!')
|
window['$message'].error('解除分组失败,请联系管理员!')
|
||||||
|
loadingFinish()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// ----------------
|
// ----------------
|
||||||
|
Loading…
x
Reference in New Issue
Block a user