Commit 6039d9c8 authored by Maofei94's avatar Maofei94

fix: fix

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