miniMenu.jsx 17.2 KB
Newer Older
Maofei94's avatar
Maofei94 committed
1 2 3 4 5 6 7 8 9
import React, { useEffect, useState } from 'react';
import {
  message,
  notification,
  Tooltip,
  Modal,
  Input,
  Button,
  Spin,
Maofei94's avatar
Maofei94 committed
10
  Empty,
Maofei94's avatar
Maofei94 committed
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
} from 'antd';
import {
  FileAddTwoTone,
  FolderAddTwoTone,
  FolderFilled,
  FileOutlined,
  DeleteTwoTone,
} from '@ant-design/icons';
import classnames from 'classnames';
import {
  miniAppSiteTree,
  getMiniAppModuleTree,
  addMenu,
  getMenuInfo,
  deleteMenu,
  editMenu,
Maofei94's avatar
Maofei94 committed
27
  getRoleListPlain,
Maofei94's avatar
Maofei94 committed
28
  dragMenu,
Maofei94's avatar
Maofei94 committed
29 30
} from '@/services/mobileConfig/api';
import styles from './miniMenu.less';
Maofei94's avatar
Maofei94 committed
31
import { appConnector } from '@/containers/App/store';
张烨's avatar
张烨 committed
32
import Tree from '@/components/ExpendableTree';
Maofei94's avatar
Maofei94 committed
33 34
import AddForm from './AddForm';
import EditForm from './editForm';
Maofei94's avatar
Maofei94 committed
35
import CheckList from './checkBox';
Maofei94's avatar
Maofei94 committed
36 37

const MiniMenu = props => {
Maofei94's avatar
Maofei94 committed
38
  const { userMode, clientName, parentKey } = props;
Maofei94's avatar
Maofei94 committed
39
  const [flag, setFlag] = useState(1); // 刷新标志
Maofei94's avatar
Maofei94 committed
40
  const [treeFlag, setTreeFlag] = useState(true);
Maofei94's avatar
Maofei94 committed
41 42 43 44 45 46 47 48
  const [treeData, setTreeData] = useState([]); // 树的数据
  const [loading, setLoading] = useState(false); // 加载
  const [menuID, setMenuID] = useState(''); // 选中的树ID
  const [saveID, setSaveID] = useState(''); // 保存选择的树id
  const [nodeType, setNodeType] = useState(''); // 选中的节点类型
  const [info, setInfo] = useState({});
  const [addVisible, setAddVisible] = useState(false); // 新增弹窗
  const [addTwoVisible, setAddTwoVisible] = useState(false); // 编辑弹窗
Maofei94's avatar
Maofei94 committed
49
  const [delVisible, setDelVisible] = useState(false); // 删除弹窗
Maofei94's avatar
Maofei94 committed
50 51
  const [nodeObj, setNodeObj] = useState({});
  const [addType, setAddType] = useState(''); // 添加下级类型
Maofei94's avatar
Maofei94 committed
52
  const [modalTitle, setModalTitle] = useState('');
Maofei94's avatar
Maofei94 committed
53
  const [roleList, setRoleList] = useState([]); // 复选框选中的值
Maofei94's avatar
Maofei94 committed
54 55
  const [modalLoading, setModalLoading] = useState(false);
  const [submitLoading, setSubmitLoading] = useState(false);
Maofei94's avatar
Maofei94 committed
56
  const [addList, setAddList] = useState([]);
Maofei94's avatar
Maofei94 committed
57
  const [newTreeList, setNewTreeList] = useState([]);
Maofei94's avatar
Maofei94 committed
58

Maofei94's avatar
Maofei94 committed
59 60
  // 获取菜单树
  useEffect(() => {
Maofei94's avatar
Maofei94 committed
61
    console.log(props);
Maofei94's avatar
Maofei94 committed
62 63
    updateTrees();
  }, [flag]);
Maofei94's avatar
Maofei94 committed
64
  // 获取角色列表
Maofei94's avatar
Maofei94 committed
65 66
  useEffect(() => {
    getRoleListPlain({
Maofei94's avatar
Maofei94 committed
67
      subSystemValue: clientName || 'miniapp',
Maofei94's avatar
Maofei94 committed
68 69 70
      _dc: Date.now(),
      _version: 9999,
    }).then(res => {
71
      if (res.code === 0) {
Maofei94's avatar
Maofei94 committed
72 73 74
        setAddList(res.list);
      }
    });
Maofei94's avatar
Maofei94 committed
75
  }, [flag, clientName]);
Maofei94's avatar
Maofei94 committed
76 77 78 79 80 81 82 83
  // 获取菜单信息
  useEffect(() => {
    getInfo();
  }, [menuID]);

  // 更新树
  const updateTrees = () => {
    setLoading(true);
Maofei94's avatar
Maofei94 committed
84
    getMiniAppModuleTree({
Maofei94's avatar
Maofei94 committed
85
      userMode: userMode || 'super',
Maofei94's avatar
Maofei94 committed
86 87
    })
      .then(res => {
Maofei94's avatar
Maofei94 committed
88
        console.log(res, 'res');
Maofei94's avatar
Maofei94 committed
89 90 91 92
        // const result1 = res[0].children[0].children[2].children;
        // setNewTreeList(JSON.parse(JSON.stringify(result1)));
        // setTreeData(result1);
        // setLoading(false);
Maofei94's avatar
Maofei94 committed
93 94
        if (res.code === 0) {
          const { data } = res;
Maofei94's avatar
Maofei94 committed
95
          setLoading(false);
Maofei94's avatar
Maofei94 committed
96
          let obj = data[0].children.find(item => item.id === parentKey);
Maofei94's avatar
Maofei94 committed
97
          const result = obj.children[1].children;
Maofei94's avatar
Maofei94 committed
98
          setNewTreeList(JSON.parse(JSON.stringify(result)));
Maofei94's avatar
Maofei94 committed
99 100 101
          setTreeData(result);
          console.log(result);
          // 第一次加载,默认选择第一个组织
Maofei94's avatar
Maofei94 committed
102
          // if (treeFlag) {
Maofei94's avatar
Maofei94 committed
103 104 105
          //   handleSelect([result[0].menuID], false);
          //   setTreeFlag(false);
          // }
Maofei94's avatar
Maofei94 committed
106 107 108 109 110 111
        } else {
          notification({
            message: '提示',
            duration: 10,
            description: '获取菜单失败',
          });
Maofei94's avatar
Maofei94 committed
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
        }
      })
      .catch(err => {
        setLoading(false);
        message.error(err);
      });
  };
  // 处理数据
  const mapTree = val => {
    const obj = { ...val };
    const hasChild = obj.children.length > 0;
    return {
      title: (
        <div className={styles.title}>
          <div>{obj.text}</div>
          <div className={styles.tip}>
            {obj.menuType === 'MiniAppMenuGroup' && (
Maofei94's avatar
Maofei94 committed
129
              <Tooltip title="新增菜单组" className={styles.fsize}>
Maofei94's avatar
Maofei94 committed
130 131 132 133
                <FolderAddTwoTone onClick={() => addMenuGroupTip(obj)} />
              </Tooltip>
            )}
            {obj.menuType === 'MiniAppMenuGroupTwo' && (
Maofei94's avatar
Maofei94 committed
134
              <Tooltip title="新增功能菜单" className={styles.fsize}>
Maofei94's avatar
Maofei94 committed
135 136 137
                <FileAddTwoTone onClick={() => addMenuTip(obj)} />
              </Tooltip>
            )}
Maofei94's avatar
Maofei94 committed
138

Maofei94's avatar
Maofei94 committed
139
            <Tooltip title="删除菜单" className={styles.fsize}>
Maofei94's avatar
Maofei94 committed
140 141
              <DeleteTwoTone onClick={() => deleteMenuTip(obj)} />
            </Tooltip>
Maofei94's avatar
Maofei94 committed
142 143 144 145 146 147 148
          </div>
        </div>
      ),
      key: obj.menuID,
      icon:
        obj.menuType !== 'MiniAppMenuThree' &&
        obj.menuType !== 'MiniAppMenu' ? (
149 150
          <FolderFilled />
        ) : (
151
          <FileOutlined />
152
        ),
Maofei94's avatar
Maofei94 committed
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204
      menuType: obj.menuType,
      children: hasChild ? obj.children.map(i => mapTree(i)) : [],
    };
  };
  // 树的点击事件
  const handleSelect = (prop, treeNode) => {
    console.log(prop, treeNode);
    if (treeNode) {
      const {
        node,
        node: { menuType },
      } = treeNode;
      console.log(menuType);
      switch (menuType) {
        case 'MiniAppMenuGroup':
          setNodeType(1);
          setAddType(2);
          break;
        case 'MiniAppMenuGroupTwo':
          setNodeType(2);
          setAddType(4);
          break;
        case 'MiniAppMenu':
          setNodeType(3);
          setAddType(3);
          break;
        case 'MiniAppMenuThree':
          setNodeType(4);
          setAddType(4);
          break;
        default:
          break;
      }
    }
    if (prop[0]) {
      setMenuID(prop[0]);
      setSaveID(prop[0]);
    } else {
      setMenuID(saveID);
    }
  };

  const getInfo = id => {
    if (!menuID) {
      return;
    }
    setLoading(true);
    getMenuInfo({
      menuID,
    })
      .then(res => {
        setLoading(false);
205
        if (res.code === 0) {
Maofei94's avatar
Maofei94 committed
206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223
          setInfo({ ...res });
        } else {
          notification.error({
            message: '提示',
            duration: 10,
            description: res.message || '获取失败',
          });
        }
        console.log(res, 'resss');
      })
      .catch(err => {
        setLoading(false);
        console.error(err);
      });
  };
  // 删除的回调
  const deleteMenuTip = val => {
    console.log(val, 'val');
Maofei94's avatar
Maofei94 committed
224 225 226 227 228 229
    setModalTitle(val.text);
    setNodeObj(val);
    setDelVisible(true);
  };
  const delMenu = () => {
    setModalLoading(true);
Maofei94's avatar
Maofei94 committed
230
    deleteMenu({
Maofei94's avatar
Maofei94 committed
231
      menuID: nodeObj.menuID,
Maofei94's avatar
Maofei94 committed
232 233
      _dc: Date.now(),
      _version: 9999,
Maofei94's avatar
Maofei94 committed
234 235 236
    })
      .then(res => {
        setModalLoading(false);
237
        if (res.code === 0) {
Maofei94's avatar
Maofei94 committed
238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258
          setDelVisible(false);
          setFlag(flag + 1);
          setNodeType('');
          setNodeObj('');
          notification.success({
            message: '提示',
            duration: 3,
            description: '删除成功',
          });
        } else {
          notification.error({
            message: '提示',
            duration: 10,
            description: res.message || '删除失败',
          });
        }
      })
      .catch(err => {
        setModalLoading(false);
        console.log(err);
      });
Maofei94's avatar
Maofei94 committed
259 260 261 262
  };
  // 新增菜单组
  const addMenuGroupTip = val => {
    console.log(val, 'addgroup');
Maofei94's avatar
Maofei94 committed
263
    setModalTitle(`在${val.text}下新增菜单组`);
Maofei94's avatar
Maofei94 committed
264 265 266 267 268
    setNodeObj(val);
    setAddVisible(true);
  };
  const rootAddGroup = () => {
    setNodeObj('');
Maofei94's avatar
Maofei94 committed
269
    // setNodeType(1);
Maofei94's avatar
Maofei94 committed
270
    setModalTitle('新增最上级菜单组');
Maofei94's avatar
Maofei94 committed
271 272 273 274 275 276 277
    setAddType(1);
    setAddVisible(true);
  };
  // 新增功能菜单
  const addMenuTip = val => {
    console.log(val, 'add');
    setNodeObj(val);
Maofei94's avatar
Maofei94 committed
278
    setModalTitle(`在${val.text}下新增功能菜单`);
Maofei94's avatar
Maofei94 committed
279 280 281
    setAddTwoVisible(true);
  };
  const rootAdd = () => {
Maofei94's avatar
Maofei94 committed
282
    setModalTitle('新增最上级功能菜单');
Maofei94's avatar
Maofei94 committed
283
    setNodeObj('');
Maofei94's avatar
Maofei94 committed
284
    // setNodeType(3);
Maofei94's avatar
Maofei94 committed
285 286 287
    setAddType(3);
    setAddTwoVisible(true);
  };
Maofei94's avatar
Maofei94 committed
288
  // 新增提交的回调
Maofei94's avatar
Maofei94 committed
289
  const submitCallback = (prop, item) => {
Maofei94's avatar
Maofei94 committed
290
    setSubmitLoading(true);
Maofei94's avatar
Maofei94 committed
291
    let obj = { ...prop };
Maofei94's avatar
Maofei94 committed
292 293 294 295
    // if (addType === 3 || addType === 4) {
    //   obj.relatedRoleList = String(roleList) || '';
    // }
    console.log(obj);
皮倩雯's avatar
皮倩雯 committed
296
    const parentID = item.menuID ? item.menuID : '-1';
Maofei94's avatar
Maofei94 committed
297 298 299
    addMenu({
      _dc: Date.now(),
      parentID,
Maofei94's avatar
Maofei94 committed
300
      subSystemValue: clientName || 'miniapp',
Maofei94's avatar
Maofei94 committed
301 302 303 304
      _version: 9999,
      ...obj,
    })
      .then(res => {
Maofei94's avatar
Maofei94 committed
305
        setSubmitLoading(false);
306
        if (res.code === 0) {
Maofei94's avatar
Maofei94 committed
307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323
          setAddVisible(false);
          setAddTwoVisible(false);
          setFlag(flag + 1);
          notification.success({
            message: '提示',
            description: '新增成功',
            duration: 3,
          });
        } else {
          notification.error({
            message: '提示',
            description: res.message || '新增失败',
            duration: 10,
          });
        }
      })
      .catch(err => {
Maofei94's avatar
Maofei94 committed
324
        setSubmitLoading(false);
Maofei94's avatar
Maofei94 committed
325 326 327 328 329 330 331 332
        console.error(err);
      });
  };
  // 编辑的回调
  const editSubmitCallback = prop => {
    setLoading(true);
    console.log(prop);
    let obj = { ...prop };
Maofei94's avatar
Maofei94 committed
333 334 335
    if (nodeType === 3 || nodeType === 4) {
      obj.relatedRoleList = String(roleList) || '';
    }
Maofei94's avatar
Maofei94 committed
336 337 338
    editMenu({
      _dc: Date.now(),
      menuID,
Maofei94's avatar
Maofei94 committed
339
      subSystemValue: clientName || 'miniapp',
Maofei94's avatar
Maofei94 committed
340 341 342 343 344 345
      _version: 9999,
      ...obj,
    })
      .then(res => {
        setLoading(false);

346
        if (res.code === 0) {
Maofei94's avatar
Maofei94 committed
347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366
          setFlag(flag + 1);
          notification.success({
            message: '提示',
            duration: 3,
            description: '编辑成功',
          });
        } else {
          notification.error({
            message: '提示',
            duration: 3,
            description: res.message || '编辑失败',
          });
        }
        console.log(res, 'resres');
      })
      .catch(err => {
        console.error(err);
        setLoading(false);
      });
  };
Maofei94's avatar
Maofei94 committed
367
  // 复选框选中值
Maofei94's avatar
Maofei94 committed
368
  const valueCallback = val => {
Maofei94's avatar
Maofei94 committed
369 370
    console.log(val, 'val');
    // relatedRoleCode
Maofei94's avatar
Maofei94 committed
371 372 373 374 375 376 377 378 379
    let arr = [...val];
    let arr2 = [];
    arr.map(item => {
      if (item.related) {
        arr2.push(item.relatedRoleCode);
      }
    });
    setRoleList(arr2);
  };
Maofei94's avatar
Maofei94 committed
380
  // 树的拖动
Maofei94's avatar
Maofei94 committed
381 382 383 384 385 386 387
  const handleDrop = infos => {
    console.log(infos, 'newTree');
    const { pos } = infos.node.props;
    const dragKey = infos.dragNode.props.eventKey;
    const dragPos = infos.dragNode.props.pos.split('-'); // 拖动的节点
    const dropKey = infos.node.props.eventKey;
    const dropPos = infos.node.props.pos.split('-'); // 拖动结束的节点
Maofei94's avatar
Maofei94 committed
388
    const endIndex = Number(dropPos[dropPos.length - 1]);
Maofei94's avatar
Maofei94 committed
389 390
    const dropPosition =
      infos.dropPosition - Number(dropPos[dropPos.length - 1]);
Maofei94's avatar
Maofei94 committed
391 392 393 394 395 396
    // 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 };
    });
Maofei94's avatar
Maofei94 committed
397
    console.log(obj, 'obj');
Maofei94's avatar
Maofei94 committed
398
    let arrList = [];
Maofei94's avatar
Maofei94 committed
399 400 401 402
    if (
      dragPos.length !== dropPos.length ||
      dragPos[dragPos.length - 2] !== dropPos[dropPos.length - 2]
    ) {
Maofei94's avatar
Maofei94 committed
403 404 405 406 407 408 409
      notification.warning({
        message: '提示',
        duration: 3,
        description: '操作失败',
      });
      return null;
    }
Maofei94's avatar
Maofei94 committed
410 411
    let idIndex;
    obj.arr.map((item, index) => {
Maofei94's avatar
Maofei94 committed
412
      if (item.menuID === obj.id) {
Maofei94's avatar
Maofei94 committed
413
        idIndex = index;
Maofei94's avatar
Maofei94 committed
414 415 416 417
        return;
      }
      arrList.push(item.menuID);
    });
Maofei94's avatar
Maofei94 committed
418 419 420 421 422 423 424 425 426 427 428 429
    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);
      }
Maofei94's avatar
Maofei94 committed
430
    }
Maofei94's avatar
Maofei94 committed
431

Maofei94's avatar
Maofei94 committed
432 433
    dragMenu({
      menuID: obj.id,
皮倩雯's avatar
皮倩雯 committed
434
      newParentID: obj.parentId.toString() || '-1',
Maofei94's avatar
Maofei94 committed
435 436 437 438 439
      menuList: String(arrList) || '',
      _version: 9999,
      _dc: Date.now(),
    }).then(res => {
      console.log(res);
皮倩雯's avatar
皮倩雯 committed
440
      if (res.code === 0) {
Maofei94's avatar
Maofei94 committed
441 442 443 444 445 446 447 448 449 450 451 452
        setFlag(flag + 1);
      } else {
        notification.error({
          message: '提示',
          duration: 3,
          description: res.message || '操作失败',
        });
      }
    });
  };
  const findNum = (array, id, callback, parentId = '') => {
    let ptId = parentId;
Maofei94's avatar
Maofei94 committed
453
    let arrFlag = true;
Maofei94's avatar
Maofei94 committed
454 455
    array.map((item, index) => {
      if (item.menuID === id) {
Maofei94's avatar
Maofei94 committed
456
        callback(array, id, parentId, index);
Maofei94's avatar
Maofei94 committed
457
        arrFlag = false;
Maofei94's avatar
Maofei94 committed
458
        return;
Maofei94's avatar
Maofei94 committed
459
      }
Maofei94's avatar
Maofei94 committed
460
      if (arrFlag && item.children && item.children.length > 0) {
Maofei94's avatar
Maofei94 committed
461
        ptId = item.menuID;
Maofei94's avatar
Maofei94 committed
462
        findNum(item.children, id, callback, ptId);
Maofei94's avatar
Maofei94 committed
463 464 465 466 467 468
      }
    });
  };
  const getArrList = (arr, id, parentId, index) => {
    console.log(arr, 'arr', id, 'id', parentId, 'parentId', index, 'index');
    return { arr, id, parentId, index };
Maofei94's avatar
Maofei94 committed
469
  };
Maofei94's avatar
Maofei94 committed
470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492
  return (
    <Spin spinning={loading} tip="loading...">
      <div
        className={classnames({
          [styles.box]: true,
        })}
      >
        <div
          className={classnames({
            [styles.left]: true,
          })}
        >
          <div
            className={classnames({
              [styles.leftTop]: true,
            })}
          >
            菜单列表
            <div
              className={classnames({
                [styles.tRight]: true,
              })}
            >
Maofei94's avatar
Maofei94 committed
493
              <Tooltip title="新增最上级菜单组">
Maofei94's avatar
Maofei94 committed
494 495 496 497 498
                <FolderAddTwoTone
                  className={`${styles.icon1} ${styles.icon}`}
                  onClick={() => rootAddGroup()}
                />
              </Tooltip>
Maofei94's avatar
Maofei94 committed
499
              <Tooltip title="新增最上级功能菜单">
Maofei94's avatar
Maofei94 committed
500 501 502 503 504 505 506
                <FileAddTwoTone
                  onClick={() => rootAdd()}
                  className={`${styles.icon2} ${styles.icon}`}
                />
              </Tooltip>
            </div>
          </div>
Maofei94's avatar
Maofei94 committed
507
          {treeData.length > 0 ? (
Maofei94's avatar
Maofei94 committed
508 509 510 511 512
            <Tree
              showIcon
              onSelect={handleSelect}
              treeData={treeData.map(item => mapTree(item))}
              blockNode
Maofei94's avatar
Maofei94 committed
513
              draggable
Maofei94's avatar
Maofei94 committed
514
              autoExpandParent
Maofei94's avatar
Maofei94 committed
515
              onDrop={handleDrop}
Maofei94's avatar
Maofei94 committed
516
              // onDragEnter={handleDragEnter}
Maofei94's avatar
Maofei94 committed
517
              selectedKeys={[menuID]}
518
              // expandedKeys={[menuID]}
Maofei94's avatar
Maofei94 committed
519
            />
Maofei94's avatar
Maofei94 committed
520 521 522 523 524
          ) : (
            <Empty
              image={Empty.PRESENTED_IMAGE_SIMPLE}
              description="暂无菜单"
            />
Maofei94's avatar
Maofei94 committed
525 526 527 528
          )}
        </div>
        <Modal
          visible={addVisible}
Maofei94's avatar
Maofei94 committed
529
          title={modalTitle}
Maofei94's avatar
Maofei94 committed
530
          bodyStyle={{ width: '100%', minHeight: '100px' }}
Maofei94's avatar
Maofei94 committed
531
          style={{ top: 80 }}
Maofei94's avatar
Maofei94 committed
532 533 534 535 536
          width="600px"
          destroyOnClose
          footer={null}
          cancelText="取消"
          okText="确认"
Maofei94's avatar
Maofei94 committed
537
          maskClosable={false}
Maofei94's avatar
Maofei94 committed
538 539 540 541 542 543 544
          onCancel={() => setAddVisible(false)}
        >
          <AddForm
            nodeType={nodeType}
            nodeObj={nodeObj}
            addType={addType}
            submitCallback={submitCallback}
Maofei94's avatar
Maofei94 committed
545
            submitLoading={submitLoading}
Maofei94's avatar
Maofei94 committed
546 547
            valueCallback={valueCallback}
            addList={addList}
Maofei94's avatar
Maofei94 committed
548 549 550 551
          />
        </Modal>
        <Modal
          visible={addTwoVisible}
Maofei94's avatar
Maofei94 committed
552
          title={modalTitle}
Maofei94's avatar
Maofei94 committed
553 554 555 556 557 558
          bodyStyle={{
            width: '100%',
            minHeight: '100px',
            maxHeight: '700px',
            overflowY: 'scroll',
          }}
Maofei94's avatar
Maofei94 committed
559
          style={{ top: 80 }}
Maofei94's avatar
Maofei94 committed
560 561 562 563 564
          width="600px"
          destroyOnClose
          footer={null}
          cancelText="取消"
          okText="确认"
Maofei94's avatar
Maofei94 committed
565
          maskClosable={false}
Maofei94's avatar
Maofei94 committed
566 567 568
          onCancel={() => setAddTwoVisible(false)}
        >
          <AddForm
Maofei94's avatar
Maofei94 committed
569
            submitLoading={submitLoading}
Maofei94's avatar
Maofei94 committed
570 571 572
            nodeType={nodeType}
            nodeObj={nodeObj}
            addType={addType}
Maofei94's avatar
Maofei94 committed
573
            addList={addList}
Maofei94's avatar
Maofei94 committed
574
            submitCallback={submitCallback}
Maofei94's avatar
Maofei94 committed
575
            valueCallback={valueCallback}
Maofei94's avatar
Maofei94 committed
576 577
          />
        </Modal>
Maofei94's avatar
Maofei94 committed
578 579 580 581 582 583 584 585 586
        <Modal
          visible={delVisible}
          title="请确认"
          bodyStyle={{ width: '100%', minHeight: '100px' }}
          style={{ top: 80 }}
          width="400px"
          destroyOnClose
          cancelText="取消"
          okText="确认"
Maofei94's avatar
Maofei94 committed
587
          maskClosable={false}
Maofei94's avatar
Maofei94 committed
588 589 590 591 592 593
          onCancel={() => setDelVisible(false)}
          onOk={() => delMenu()}
          confirmLoading={modalLoading}
        >
          是否删除<span style={{ color: 'red' }}>{modalTitle}</span>?
        </Modal>
Maofei94's avatar
Maofei94 committed
594 595 596 597 598
        <div
          className={classnames({
            [styles.middle]: true,
          })}
        >
Maofei94's avatar
Maofei94 committed
599 600
          菜单配置
          {nodeType ? (
601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620
            <div style={{ marginTop: '10px' }}>
              <EditForm
                nodeType={nodeType}
                info={info}
                submitCallback={editSubmitCallback}
                valueCallback={valueCallback}
              />
              {/* <div
                className={classnames({
                  [styles.rightBox]: true,
                })}
              >
                关联角色
                <CheckList
                  info={info}
                  nodeType={nodeType}
                  valueCallback={valueCallback}
                />
              </div> */}
            </div>
Maofei94's avatar
Maofei94 committed
621
          ) : (
Maofei94's avatar
Maofei94 committed
622 623 624 625
            <Empty
              image={Empty.PRESENTED_IMAGE_SIMPLE}
              description="当前未选中菜单"
            />
Maofei94's avatar
Maofei94 committed
626 627 628 629 630 631 632
          )}
        </div>
      </div>
    </Spin>
  );
};

Maofei94's avatar
Maofei94 committed
633
export default MiniMenu;