Merge pull request !15 from 白书科技/fix/1031
This commit is contained in:
白书科技 2023-11-13 03:56:19 +00:00 committed by Gitee
commit aa8e1d88aa
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 62 additions and 9 deletions

View File

@ -65,6 +65,7 @@ export const TreeHours = (props: PropInterface) => {
} }
props.onRemoveItem(id); props.onRemoveItem(id);
}; };
const onDrop: TreeProps["onDrop"] = (info) => { const onDrop: TreeProps["onDrop"] = (info) => {
const dropKey = info.node.key; const dropKey = info.node.key;
const dragKey = info.dragNode.key; const dragKey = info.dragNode.key;
@ -96,23 +97,35 @@ export const TreeHours = (props: PropInterface) => {
// Find dragObject // Find dragObject
let dragObj: DataNode; let dragObj: DataNode;
loop(data, dragKey, (item, index, arr) => { let dragLength = (info.dragNode as any).props.pos.split("-").length;
arr.splice(index, 1); let dropLength = (info.node as any).props.pos.split("-").length;
dragObj = item;
});
if (!info.dropToGap) { if (!info.dropToGap) {
// Drop on the content // Drop on the content
loop(data, dropKey, (item) => { if (
item.children = item.children || []; (dropPosition == 0 && dropPos.length == 3) ||
// where to insert 示例添加到头部,可以是随意位置 (dropPosition == 0 && dropPos.length == 2 && dragLength == 2)
item.children.unshift(dragObj); ) {
}); } else {
loop(data, dragKey, (item, index, arr) => {
arr.splice(index, 1);
dragObj = item;
});
loop(data, dropKey, (item) => {
item.children = item.children || [];
// where to insert 示例添加到头部,可以是随意位置
item.children.unshift(dragObj);
});
}
} else if ( } else if (
((info.node as any).props.children || []).length > 0 && // Has children ((info.node as any).props.children || []).length > 0 && // Has children
(info.node as any).props.expanded && // Is expanded (info.node as any).props.expanded && // Is expanded
dropPosition === 1 // On the bottom gap dropPosition === 1 // On the bottom gap
) { ) {
loop(data, dragKey, (item, index, arr) => {
arr.splice(index, 1);
dragObj = item;
});
loop(data, dropKey, (item) => { loop(data, dropKey, (item) => {
item.children = item.children || []; item.children = item.children || [];
// where to insert 示例添加到头部,可以是随意位置 // where to insert 示例添加到头部,可以是随意位置
@ -121,6 +134,16 @@ export const TreeHours = (props: PropInterface) => {
// item to the tail of the children // item to the tail of the children
}); });
} else { } else {
if (
(dragLength == 3 && dropLength == 2) ||
(dragLength == 2 && dropLength == 3)
) {
return;
}
loop(data, dragKey, (item, index, arr) => {
arr.splice(index, 1);
dragObj = item;
});
let ar: DataNode[] = []; let ar: DataNode[] = [];
let i: number; let i: number;
loop(data, dropKey, (_item, index, arr) => { loop(data, dropKey, (_item, index, arr) => {

View File

@ -77,6 +77,16 @@ export const SystemAdminrolesCreate: React.FC<PropInterface> = ({
value: "线上课-n", value: "线上课-n",
children: [], children: [],
}, },
{
title: "分类管理",
value: "分类管理-n",
children: [],
},
{
title: "资源管理",
value: "资源管理-n",
children: [],
},
{ {
title: "资源分类", title: "资源分类",
value: "资源分类-n", value: "资源分类-n",
@ -97,6 +107,11 @@ export const SystemAdminrolesCreate: React.FC<PropInterface> = ({
value: "其它-n", value: "其它-n",
children: [], children: [],
}, },
{
title: "其它权限",
value: "其它权限-n",
children: [],
},
]; ];
let actions = res.data.perm_action.action; let actions = res.data.perm_action.action;
let permissions = res.data.perm_action.data; let permissions = res.data.perm_action.data;

View File

@ -91,6 +91,16 @@ export const SystemAdminrolesUpdate: React.FC<PropInterface> = ({
value: "线上课-n", value: "线上课-n",
children: [], children: [],
}, },
{
title: "分类管理",
value: "分类管理-n",
children: [],
},
{
title: "资源管理",
value: "资源管理-n",
children: [],
},
{ {
title: "资源分类", title: "资源分类",
value: "资源分类-n", value: "资源分类-n",
@ -111,6 +121,11 @@ export const SystemAdminrolesUpdate: React.FC<PropInterface> = ({
value: "其它-n", value: "其它-n",
children: [], children: [],
}, },
{
title: "其它权限",
value: "其它权限-n",
children: [],
},
]; ];
let actions = res.data.perm_action.action; let actions = res.data.perm_action.action;
let permissions = res.data.perm_action.data; let permissions = res.data.perm_action.data;