Commit 6039d9c8 authored by Maofei94's avatar Maofei94

fix: fix

parent 80c27a1f
......@@ -155,9 +155,9 @@ const MiniMenu = props => {
obj.menuType !== 'MiniAppMenuThree' &&
obj.menuType !== 'MiniAppMenu' ? (
<FolderFilled />
) : (
<FileOutlined />
),
) : (
<FileOutlined />
),
menuType: obj.menuType,
children: hasChild ? obj.children.map(i => mapTree(i)) : [],
};
......@@ -395,14 +395,21 @@ const MiniMenu = props => {
const dragPos = infos.dragNode.props.pos.split('-'); // 拖动的节点
const dropKey = infos.node.props.eventKey;
const dropPos = infos.node.props.pos.split('-'); // 拖动结束的节点
const endIndex = Number(dropPos[dropPos.length - 1]);
const dropPosition =
infos.dropPosition - Number(dropPos[dropPos.length - 1]);
console.log(findNum(newTreeList, dragKey, getArrList), 'aa');
let obj = findNum(newTreeList, dragKey, getArrList);
// let obj = findNum(newTreeList, dragKey, getArrList);
let obj;
findNum(newTreeList, dragKey, (arr, id, parentId, index) => {
obj = { arr, id, parentId, index };
return { arr, id, parentId, index };
});
console.log(obj, 'obj');
let arrList = [];
if (dragPos.length !== dropPos.length) {
if (
dragPos.length !== dropPos.length ||
dragPos[dragPos.length - 2] !== dropPos[dropPos.length - 2]
) {
notification.warning({
message: '提示',
duration: 3,
......@@ -410,30 +417,28 @@ const MiniMenu = props => {
});
return null;
}
obj.arr.map(item => {
let idIndex;
obj.arr.map((item, index) => {
if (item.menuID === obj.id) {
idIndex = index;
return;
}
arrList.push(item.menuID);
});
console.log(
infos,
'info',
pos,
dragKey,
dropKey,
dropPos,
infos.dropPosition,
dragPos,
dropPosition,
arrList,
);
if (dropPosition === -1) {
arrList.splice(Number(dropPos[dropPos.length - 1]), 0, obj.id);
} else if (dropPosition === 1) {
arrList.splice(Number(dropPos[dropPos.length - 1]) + 1, 0, obj.id);
if (idIndex > endIndex) {
if (dropPosition === -1) {
arrList.splice(endIndex, 0, obj.id);
} else if (dropPosition === 1) {
arrList.splice(endIndex + 1, 0, obj.id);
}
} else if (idIndex < endIndex) {
if (dropPosition === -1) {
arrList.splice(endIndex - 1, 0, obj.id);
} else if (dropPosition === 1) {
arrList.splice(endIndex, 0, obj.id);
}
}
console.log(arrList, 'console.log(arrList);', obj.menuID);
dragMenu({
menuID: obj.id,
newParentID: obj.parentId || -1,
......@@ -455,30 +460,23 @@ const MiniMenu = props => {
};
const findNum = (array, id, callback, parentId = '') => {
let ptId = parentId;
let arr = [];
let arrFlag = true;
array.map((item, index) => {
if (item.menuID === id) {
arr = callback(array, id, parentId, index);
callback(array, id, parentId, index);
arrFlag = false;
return arr;
return;
}
console.log(arr, 'arr');
if (arrFlag && item.children && item.children.length > 0) {
ptId = item.menuID;
arr = findNum(item.children, id, callback, ptId);
return arr;
findNum(item.children, id, callback, ptId);
}
});
return arr;
};
const getArrList = (arr, id, parentId, index) => {
console.log(arr, 'arr', id, 'id', parentId, 'parentId', index, 'index');
return { arr, id, parentId, index };
};
const handleDragEnter = infos => {
console.log(infos, 'info');
};
return (
<Spin spinning={loading} tip="loading...">
<div
......
import { request } from '../utils/request';
export const CITY_SERVICE = '/Cityinterface/rest/services';
// export const CITY_SERVICE = '/Cityinterface/rest/services';
export const PUBLISH_SERVICE = '/Publish/OMS';
// export const CITY_SERVICE = '/Publish/GateWay/CityServer';
export const CITY_SERVICE = '/Publish/GateWay/CityServer';
const get = async (url, params, options = {}) =>
request({
......
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