|
@@ -831,6 +831,7 @@ const onMenu = async (val: string) => {
|
|
|
break;
|
|
|
case 'del':
|
|
|
delDialog.show = true;
|
|
|
+ delDialog.contextmenuObj = deepClone(contextmenu)
|
|
|
break;
|
|
|
default:
|
|
|
if (val.indexOf('move:')) {
|
|
@@ -886,27 +887,34 @@ const hideContextmenu = () => {
|
|
|
};
|
|
|
|
|
|
const delComponet = async () => {
|
|
|
- const id = contextmenu.component._id || contextmenu.component.id;
|
|
|
- await axios.post(`/api/data/le5leV-components/delete`, {
|
|
|
- id,
|
|
|
- });
|
|
|
+ // const id = contextmenu.component._id || contextmenu.component.id;
|
|
|
+ const id = delDialog.contextmenuObj.component._id || delDialog.contextmenu.component.id;;
|
|
|
+ try {
|
|
|
+ await axios.post(`/api/data/le5leV-components/delete`, {
|
|
|
+ id
|
|
|
+ });
|
|
|
+ }catch (e){
|
|
|
+ console.log(e)
|
|
|
+ return
|
|
|
+ }
|
|
|
|
|
|
// 前端:从源文件夹移出组件
|
|
|
- contextmenu.group.list.forEach((item: any, index: number, arr: any[]) => {
|
|
|
+ delDialog.contextmenuObj.group.list.forEach((item: any, index: number, arr: any[]) => {
|
|
|
if (id === item._id || id === item.id) {
|
|
|
arr.splice(index, 1);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
// 更新后端源文件夹列表
|
|
|
- if (contextmenu.group.name !== '我的组件') {
|
|
|
+ if (delDialog.contextmenuObj.group.name !== '我的组件') {
|
|
|
await axios.post('/api/data/folders/update', {
|
|
|
- _id: contextmenu.group._id || contextmenu.group.id,
|
|
|
- list: contextmenu.group.list,
|
|
|
+ _id: delDialog.contextmenuObj.group._id ||delDialog.contextmenuObj.group.id,
|
|
|
+ list: delDialog.contextmenuObj.group.list,
|
|
|
});
|
|
|
}
|
|
|
|
|
|
delDialog.show = false;
|
|
|
+ delDialog.contextmenuObj = {}
|
|
|
};
|
|
|
|
|
|
const drop = (obj: any) => {
|