page.tsx 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903
  1. "use client";
  2. import {fetchApi} from "@/app/_modules/func";
  3. import {DeleteOutlined, ExclamationCircleFilled, PlusOutlined, ReloadOutlined,} from "@ant-design/icons";
  4. import type {ActionType, ProColumns, ProFormInstance,} from "@ant-design/pro-components";
  5. import {
  6. ModalForm,
  7. PageContainer,
  8. ProForm,
  9. ProFormDigit,
  10. ProFormRadio,
  11. ProFormSelect,
  12. ProFormText,
  13. ProFormTreeSelect,
  14. ProTable,
  15. } from "@ant-design/pro-components";
  16. import {App, Button, Modal, Space, Tag} from "antd";
  17. import {useRouter} from "next/navigation";
  18. import {
  19. faArrowsUpDown,
  20. faCheck,
  21. faPenToSquare,
  22. faToggleOff,
  23. faToggleOn,
  24. faXmark,
  25. } from "@fortawesome/free-solid-svg-icons";
  26. import {FontAwesomeIcon} from "@fortawesome/react-fontawesome";
  27. import {IconMap} from "@/app/_modules/definies";
  28. import {useRef, useState} from "react";
  29. import globalMessage from "@/app/_modules/globalMessage";
  30. //查询表格数据API
  31. const queryAPI = "/api/system/menu/list";
  32. //新建数据API
  33. const newAPI = "/api/system/menu";
  34. //修改数据API
  35. const modifyAPI = "/api/system/menu";
  36. //查询详情数据API
  37. const queryDetailAPI = "/api/system/menu";
  38. //删除API
  39. const deleteAPI = "/api/system/menu";
  40. export default function SysMenu() {
  41. const { message } = App.useApp();
  42. const { push } = useRouter();
  43. // 添加用于控制删除确认模态框的状态
  44. const [deleteModalVisible, setDeleteModalVisible] = useState(false);
  45. const [deleteRecord, setDeleteRecord] = useState<any>(null);
  46. // 添加用于控制清空确认模态框的状态(如果需要的话)
  47. const [clearModalVisible, setClearModalVisible] = useState(false);
  48. //表格列定义
  49. const columns: ProColumns[] = [
  50. {
  51. title: "菜单名称",
  52. fieldProps: {
  53. placeholder: "请输入菜单名称",
  54. },
  55. dataIndex: "menuName",
  56. order: 2,
  57. },
  58. {
  59. title: "图标",
  60. dataIndex: "icon",
  61. search: false,
  62. },
  63. {
  64. title: "排序",
  65. dataIndex: "orderNum",
  66. search: false,
  67. },
  68. {
  69. title: "权限标识",
  70. dataIndex: "perms",
  71. ellipsis: true,
  72. search: false,
  73. },
  74. {
  75. title: "状态",
  76. fieldProps: {
  77. placeholder: "请选择菜单状态",
  78. },
  79. dataIndex: "status",
  80. valueType: "select",
  81. render: (_, record) => {
  82. return (
  83. <Space>
  84. <Tag
  85. color={record.status === "0" ? "green" : "red"}
  86. icon={
  87. record.status == 0 ? (
  88. <FontAwesomeIcon icon={faCheck} />
  89. ) : (
  90. <FontAwesomeIcon icon={faXmark} />
  91. )
  92. }
  93. >
  94. {_}
  95. </Tag>
  96. </Space>
  97. );
  98. },
  99. valueEnum: {
  100. 0: {
  101. text: "正常",
  102. status: "0",
  103. },
  104. 1: {
  105. text: "停用",
  106. status: "1",
  107. },
  108. },
  109. order: 1,
  110. },
  111. {
  112. title: "创建时间",
  113. dataIndex: "createTime",
  114. valueType: "dateTime",
  115. search: false,
  116. },
  117. {
  118. title: "操作",
  119. key: "option",
  120. search: false,
  121. render: (_, record) => [
  122. <Button
  123. key="modifyBtn"
  124. type="link"
  125. icon={<FontAwesomeIcon icon={faPenToSquare} />}
  126. onClick={() => onClickShowRowModifyModal(record)}
  127. >
  128. 修改
  129. </Button>,
  130. <Button
  131. key="newBtn"
  132. type="link"
  133. icon={<PlusOutlined />}
  134. onClick={() => onClickAdd(record)}
  135. >
  136. 新建
  137. </Button>,
  138. <Button
  139. key="deleteBtn"
  140. type="link"
  141. danger
  142. icon={<DeleteOutlined />}
  143. onClick={() => onClickDeleteRow(record)}
  144. >
  145. 删除
  146. </Button>,
  147. ],
  148. },
  149. ];
  150. //0.查询表格数据
  151. //原始的可展开的所有行的 id
  152. const [defaultExpandKeys, setDefaultExpandKeys] = useState<any[]>([]);
  153. //控制行展开的数据
  154. const [expandKeys, setExpandKeys] = useState<any[]>([]);
  155. const queryTableData = async (params: any, sorter: any, filter: any) => {
  156. const searchParams = {
  157. ...params,
  158. };
  159. const queryParams = new URLSearchParams(searchParams);
  160. Object.keys(sorter).forEach((key) => {
  161. queryParams.append("orderByColumn", key);
  162. if (sorter[key] === "ascend") {
  163. queryParams.append("isAsc", "ascending");
  164. } else {
  165. queryParams.append("isAsc", "descending");
  166. }
  167. });
  168. const body = await fetchApi(`${queryAPI}?${queryParams}`, push);
  169. const firstLevel = getFirstLevel(body.data);
  170. firstLevel.forEach((first) => {
  171. getChildren(body.data, first);
  172. });
  173. const newExpandedKeys: any[] = [];
  174. const render = (treeDatas: any[]) => {
  175. // 获取到所有可展开的父节点
  176. treeDatas.map((item) => {
  177. if (item.children) {
  178. newExpandedKeys.push(item.menuId);
  179. render(item.children);
  180. }
  181. });
  182. return newExpandedKeys;
  183. };
  184. const keys = render(firstLevel);
  185. setDefaultExpandKeys(keys);
  186. setExpandKeys([]);
  187. return firstLevel;
  188. };
  189. const getFirstLevel = (data: any[]) => {
  190. const firstLevel: any[] = [];
  191. for (let index = 0; index < data.length; index++) {
  192. const item = data[index];
  193. if (item.parentId === 0) {
  194. firstLevel.push(item);
  195. }
  196. }
  197. return firstLevel;
  198. };
  199. const getChildren = (data: any[], parentNode: any) => {
  200. for (let index = 0; index < data.length; index++) {
  201. const item = data[index];
  202. if (item.parentId === parentNode.menuId) {
  203. parentNode.children.push(item);
  204. getChildren(data, item);
  205. }
  206. }
  207. if (parentNode.children.length == 0) {
  208. delete parentNode.children;
  209. }
  210. };
  211. //1.新建
  212. const [showAddModal, setShowAddModal] = useState(false);
  213. //新建表单是否带有父节点id
  214. const [rowParentId, setRowParentId] = useState(0);
  215. //点击新建,如果从行点击新建,给定父节点
  216. const onClickAdd = (record?: any) => {
  217. setRowParentId(record.menuId);
  218. setShowAddModal(true);
  219. };
  220. const cancelAddModal = () => {
  221. setShowAddModal(false);
  222. setRowParentId(0);
  223. };
  224. //确定新建数据
  225. const executeAddData = async (values: any) => {
  226. const body = await fetchApi(newAPI, push, {
  227. method: "POST",
  228. headers: {
  229. "Content-Type": "application/json",
  230. },
  231. body: JSON.stringify(values),
  232. });
  233. if (body != undefined) {
  234. if (body.code == 200) {
  235. globalMessage.success(body.msg);
  236. if (actionTableRef.current) {
  237. actionTableRef.current.reload();
  238. }
  239. setShowAddModal(false);
  240. return true;
  241. }
  242. globalMessage.error(body.msg);
  243. return false;
  244. }
  245. return false;
  246. };
  247. //2.修改
  248. //是否展示修改对话框
  249. const [isShowModifyDataModal, setIsShowModifyDataModal] = useState(false);
  250. //展示修改对话框
  251. const onClickShowRowModifyModal = (record: any) => {
  252. queryRowData(record);
  253. setIsShowModifyDataModal(true);
  254. };
  255. //修改数据表单引用
  256. const modifyFormRef = useRef<ProFormInstance>(null);
  257. //操作当前数据的附加数据
  258. const [operatRowData, setOperateRowData] = useState<{
  259. [key: string]: any;
  260. }>({});
  261. //查询并加载待修改数据的详细信息
  262. const queryRowData = async (record: any) => {
  263. const menuId = record.menuId;
  264. operatRowData["menuId"] = menuId;
  265. setOperateRowData(operatRowData);
  266. if (menuId !== undefined) {
  267. const body = await fetchApi(`${queryDetailAPI}/${menuId}`, push);
  268. if (body !== undefined) {
  269. if (body.code == 200) {
  270. modifyFormRef?.current?.setFieldsValue({
  271. //需要加载到修改表单中的数据
  272. parentId: body.data.parentId,
  273. menuName: body.data.menuName,
  274. orderNum: body.data.orderNum,
  275. path: body.data.path,
  276. isFrame: body.data.isFrame,
  277. menuType: body.data.menuType,
  278. perms: body.data.perms,
  279. icon: body.data.icon,
  280. visible: body.data.visible,
  281. status: body.data.status,
  282. });
  283. setIsCatalog(body.data.menuType === "M");
  284. setIsMenu(body.data.menuType === "C");
  285. setIsButton(body.data.menuType === "F");
  286. }
  287. }
  288. }
  289. };
  290. //确认修改数据
  291. const executeModifyData = async (values: any) => {
  292. values["menuId"] = operatRowData["menuId"];
  293. const body = await fetchApi(modifyAPI, push, {
  294. method: "PUT",
  295. headers: {
  296. "Content-Type": "application/json",
  297. },
  298. body: JSON.stringify(values),
  299. });
  300. if (body !== undefined) {
  301. if (body.code == 200) {
  302. globalMessage.success(body.msg);
  303. //刷新列表
  304. if (actionTableRef.current) {
  305. actionTableRef.current.reload();
  306. }
  307. setIsShowModifyDataModal(false);
  308. return true;
  309. }
  310. globalMessage.error(body.msg);
  311. return false;
  312. }
  313. };
  314. //3.展开/折叠
  315. //点击展开/折叠按钮
  316. const onClickExpandRow = () => {
  317. if (expandKeys.length > 0) {
  318. setExpandKeys([]);
  319. } else {
  320. setExpandKeys(defaultExpandKeys);
  321. }
  322. };
  323. //处理行的展开/折叠逻辑
  324. const handleExpand = (expanded: boolean, record: any) => {
  325. console.log("has keys:", expandKeys);
  326. let keys = [...expandKeys];
  327. if (expanded) {
  328. keys.push(record.menuId);
  329. } else {
  330. keys = keys.filter((key: number) => key !== record.menuId);
  331. }
  332. console.log("now keys:", keys);
  333. setExpandKeys(keys);
  334. };
  335. //4.导出
  336. //5.选择行
  337. //搜索栏显示状态
  338. const [showSearch, setShowSearch] = useState(true);
  339. //action对象引用
  340. const actionTableRef = useRef<ActionType>(null);
  341. //搜索表单对象引用
  342. const searchTableFormRef = useRef<ProFormInstance>(null!);
  343. const getMenuList = async () => {
  344. const body = await fetchApi(queryAPI, push);
  345. if (body !== undefined) {
  346. const firstLevel = getFirstLevel(body.data);
  347. firstLevel.forEach((first) => {
  348. getChildren(body.data, first);
  349. });
  350. const root: any = {
  351. menuId: 0,
  352. menuName: "根目录",
  353. children: [],
  354. };
  355. firstLevel.forEach((first: any) => {
  356. root.children.push(first as never);
  357. });
  358. return [root];
  359. }
  360. return [];
  361. };
  362. //点击删除按钮
  363. const onClickDeleteRow = (record: any) => {
  364. setDeleteRecord(record);
  365. setDeleteModalVisible(true);
  366. };
  367. //确定删除选中的菜单
  368. const executeDeleteRow = async () => {
  369. if (!deleteRecord) return;
  370. const menuId = deleteRecord.menuId;
  371. const body = await fetchApi(`${deleteAPI}/${menuId}`, push, {
  372. method: "DELETE",
  373. });
  374. if (body !== undefined) {
  375. if (body.code == 200) {
  376. globalMessage.success("删除成功");
  377. //刷新列表
  378. if (actionTableRef.current) {
  379. actionTableRef.current.reload();
  380. }
  381. } else {
  382. globalMessage.error(body.msg);
  383. }
  384. }
  385. setDeleteModalVisible(false);
  386. setDeleteRecord(null);
  387. };
  388. const [isCatalog, setIsCatalog] = useState(true);
  389. const [isMenu, setIsMenu] = useState(false);
  390. const [isButton, setIsButton] = useState(false);
  391. const onChangeType = (e: any) => {
  392. const type = e.target.value;
  393. setIsCatalog(type === "M");
  394. setIsMenu(type === "C");
  395. setIsButton(type === "F");
  396. };
  397. const IconData = () => {
  398. const iconData = { ...IconMap };
  399. Object.keys(iconData).forEach((key) => {
  400. iconData[key] = (
  401. <>
  402. <span style={{ marginRight: 8 }}>{iconData[key]}</span>
  403. {key}
  404. </>
  405. );
  406. });
  407. return iconData;
  408. };
  409. return (
  410. <PageContainer title={false}>
  411. <ProTable
  412. formRef={searchTableFormRef}
  413. rowKey="menuId"
  414. columns={columns}
  415. expandable={{
  416. expandedRowKeys: expandKeys,
  417. onExpand: handleExpand,
  418. }}
  419. request={async (params: any, sorter: any, filter: any) => {
  420. // 表单搜索项会从 params 传入,传递给后端接口。
  421. const data = await queryTableData(params, sorter, filter);
  422. if (data !== undefined) {
  423. return Promise.resolve({
  424. data: data,
  425. success: true,
  426. total: data.length,
  427. });
  428. }
  429. return Promise.resolve({
  430. data: [],
  431. success: true,
  432. });
  433. }}
  434. pagination={false}
  435. search={
  436. showSearch
  437. ? {
  438. defaultCollapsed: false,
  439. searchText: "搜索",
  440. }
  441. : false
  442. }
  443. dateFormatter="string"
  444. actionRef={actionTableRef}
  445. toolbar={{
  446. actions: [
  447. <ModalForm
  448. key="addmodal"
  449. title="添加菜单"
  450. open={showAddModal}
  451. trigger={
  452. <Button icon={<PlusOutlined />} type="primary">
  453. 新建
  454. </Button>
  455. }
  456. autoFocusFirstInput
  457. modalProps={{
  458. destroyOnHidden: true,
  459. onCancel: () => {
  460. cancelAddModal();
  461. },
  462. }}
  463. submitTimeout={2000}
  464. onFinish={executeAddData}
  465. >
  466. <ProForm.Group>
  467. <ProFormTreeSelect
  468. width="md"
  469. name="parentId"
  470. initialValue={rowParentId}
  471. label="上级菜单"
  472. placeholder="请选择上级菜单"
  473. rules={[{ required: true, message: "请选择上级菜单" }]}
  474. request={getMenuList}
  475. fieldProps={{
  476. filterTreeNode: true,
  477. showSearch: true,
  478. treeNodeFilterProp: "label",
  479. fieldNames: {
  480. label: "menuName",
  481. value: "menuId",
  482. },
  483. }}
  484. />
  485. </ProForm.Group>
  486. <ProForm.Group>
  487. <ProFormRadio.Group
  488. name="menuType"
  489. width="md"
  490. label="类型"
  491. initialValue="M"
  492. fieldProps={{
  493. onChange: (e: any) => onChangeType(e),
  494. }}
  495. options={[
  496. {
  497. label: "目录",
  498. value: "M",
  499. },
  500. {
  501. label: "菜单",
  502. value: "C",
  503. },
  504. {
  505. label: "按钮",
  506. value: "F",
  507. },
  508. ]}
  509. />
  510. </ProForm.Group>
  511. {(isCatalog || isMenu) && (
  512. <ProForm.Group>
  513. <ProFormSelect
  514. width="md"
  515. name="icon"
  516. label="菜单图标"
  517. fieldProps={{
  518. showSearch,
  519. }}
  520. valueEnum={IconData}
  521. placeholder="请选择菜单图标"
  522. rules={[{ required: true, message: "请选择菜单图标" }]}
  523. />
  524. </ProForm.Group>
  525. )}
  526. <ProForm.Group>
  527. <ProFormText
  528. width="md"
  529. name="menuName"
  530. label="菜单名称"
  531. placeholder="请输入菜单名称"
  532. rules={[{ required: true, message: "请输入菜单名称" }]}
  533. />
  534. <ProFormDigit
  535. fieldProps={{ precision: 0 }}
  536. width="md"
  537. name="orderNum"
  538. initialValue="1"
  539. label="排序"
  540. placeholder="请输入排序"
  541. rules={[{ required: true, message: "请输入排序" }]}
  542. />
  543. </ProForm.Group>
  544. {(isCatalog || isMenu) && (
  545. <ProForm.Group>
  546. <ProFormText
  547. width="md"
  548. name="path"
  549. label="路由地址"
  550. placeholder="请输入路由地址"
  551. rules={[{ required: true, message: "请输入路由地址" }]}
  552. />
  553. <ProFormRadio.Group
  554. name="isFrame"
  555. width="md"
  556. label="是否外链"
  557. initialValue="1"
  558. options={[
  559. {
  560. label: "是",
  561. value: "0",
  562. },
  563. {
  564. label: "否",
  565. value: "1",
  566. },
  567. ]}
  568. />
  569. </ProForm.Group>
  570. )}
  571. {isMenu && (
  572. <ProForm.Group>
  573. <ProFormText
  574. width="md"
  575. name="perms"
  576. label="权限字符"
  577. placeholder="请输入权限字符"
  578. />
  579. </ProForm.Group>
  580. )}
  581. <ProForm.Group>
  582. <ProFormRadio.Group
  583. name="visible"
  584. width="md"
  585. label="显示状态"
  586. initialValue="0"
  587. options={[
  588. {
  589. label: "显示",
  590. value: "0",
  591. },
  592. {
  593. label: "隐藏",
  594. value: "1",
  595. },
  596. ]}
  597. />
  598. <ProFormRadio.Group
  599. name="status"
  600. width="md"
  601. label="菜单状态"
  602. initialValue="0"
  603. options={[
  604. {
  605. label: "正常",
  606. value: "0",
  607. },
  608. {
  609. label: "停用",
  610. value: "1",
  611. },
  612. ]}
  613. />
  614. </ProForm.Group>
  615. </ModalForm>,
  616. <Button
  617. key="expand"
  618. icon={<FontAwesomeIcon icon={faArrowsUpDown} />}
  619. onClick={() => onClickExpandRow()}
  620. >
  621. 折叠/展开
  622. </Button>,
  623. ],
  624. settings: [
  625. {
  626. key: "switch",
  627. icon: showSearch ? (
  628. <FontAwesomeIcon icon={faToggleOn} />
  629. ) : (
  630. <FontAwesomeIcon icon={faToggleOff} />
  631. ),
  632. tooltip: showSearch ? "隐藏搜索栏" : "显示搜索栏",
  633. onClick: (key: string | undefined) => {
  634. setShowSearch(!showSearch);
  635. },
  636. },
  637. {
  638. key: "refresh",
  639. tooltip: "刷新",
  640. icon: <ReloadOutlined />,
  641. onClick: (key: string | undefined) => {
  642. if (actionTableRef.current) {
  643. actionTableRef.current.reload();
  644. }
  645. },
  646. },
  647. ],
  648. }}
  649. />
  650. <ModalForm
  651. key="modifymodal"
  652. title="修改菜单"
  653. formRef={modifyFormRef}
  654. open={isShowModifyDataModal}
  655. autoFocusFirstInput
  656. modalProps={{
  657. destroyOnHidden: true,
  658. onCancel: () => {
  659. setIsShowModifyDataModal(false);
  660. },
  661. }}
  662. submitTimeout={2000}
  663. onFinish={executeModifyData}
  664. >
  665. <ProForm.Group>
  666. <ProFormTreeSelect
  667. width="md"
  668. name="parentId"
  669. initialValue={rowParentId}
  670. label="上级菜单"
  671. placeholder="请选择上级菜单"
  672. rules={[{ required: true, message: "请选择上级菜单" }]}
  673. request={getMenuList}
  674. fieldProps={{
  675. filterTreeNode: true,
  676. showSearch: true,
  677. treeNodeFilterProp: "label",
  678. fieldNames: {
  679. label: "menuName",
  680. value: "menuId",
  681. },
  682. }}
  683. />
  684. </ProForm.Group>
  685. <ProForm.Group>
  686. <ProFormRadio.Group
  687. name="menuType"
  688. width="md"
  689. label="类型"
  690. fieldProps={{
  691. onChange: (e: any) => onChangeType(e),
  692. }}
  693. options={[
  694. {
  695. label: "目录",
  696. value: "M",
  697. },
  698. {
  699. label: "菜单",
  700. value: "C",
  701. },
  702. {
  703. label: "按钮",
  704. value: "F",
  705. },
  706. ]}
  707. />
  708. </ProForm.Group>
  709. {(isCatalog || isMenu) && (
  710. <ProForm.Group>
  711. <ProFormSelect
  712. width="md"
  713. name="icon"
  714. label="菜单图标"
  715. fieldProps={{
  716. showSearch,
  717. }}
  718. valueEnum={IconData}
  719. placeholder="请选择菜单图标"
  720. rules={[{ required: true, message: "请选择菜单图标" }]}
  721. />
  722. </ProForm.Group>
  723. )}
  724. <ProForm.Group>
  725. <ProFormText
  726. width="md"
  727. name="menuName"
  728. label="菜单名称"
  729. placeholder="请输入菜单名称"
  730. rules={[{ required: true, message: "请输入菜单名称" }]}
  731. />
  732. <ProFormDigit
  733. fieldProps={{ precision: 0 }}
  734. width="md"
  735. name="orderNum"
  736. initialValue="1"
  737. label="排序"
  738. placeholder="请输入排序"
  739. rules={[{ required: true, message: "请输入排序" }]}
  740. />
  741. </ProForm.Group>
  742. {(isCatalog || isMenu) && (
  743. <ProForm.Group>
  744. <ProFormText
  745. width="md"
  746. name="path"
  747. label="路由地址"
  748. placeholder="请输入路由地址"
  749. rules={[{ required: true, message: "请输入路由地址" }]}
  750. />
  751. <ProFormRadio.Group
  752. name="isFrame"
  753. width="md"
  754. label="是否外链"
  755. initialValue="1"
  756. options={[
  757. {
  758. label: "是",
  759. value: "0",
  760. },
  761. {
  762. label: "否",
  763. value: "1",
  764. },
  765. ]}
  766. />
  767. </ProForm.Group>
  768. )}
  769. {isMenu && (
  770. <ProForm.Group>
  771. <ProFormText
  772. width="md"
  773. name="perms"
  774. label="权限字符"
  775. placeholder="请输入权限字符"
  776. />
  777. </ProForm.Group>
  778. )}
  779. <ProForm.Group>
  780. <ProFormRadio.Group
  781. name="visible"
  782. width="md"
  783. label="显示状态"
  784. initialValue="0"
  785. options={[
  786. {
  787. label: "显示",
  788. value: "0",
  789. },
  790. {
  791. label: "隐藏",
  792. value: "1",
  793. },
  794. ]}
  795. />
  796. <ProFormRadio.Group
  797. name="status"
  798. width="md"
  799. label="菜单状态"
  800. initialValue="0"
  801. options={[
  802. {
  803. label: "正常",
  804. value: "0",
  805. },
  806. {
  807. label: "停用",
  808. value: "1",
  809. },
  810. ]}
  811. />
  812. </ProForm.Group>
  813. </ModalForm>
  814. {/* 删除确认模态框 */}
  815. <Modal
  816. title={
  817. <div style={{ display: 'flex', alignItems: 'center' }}>
  818. <ExclamationCircleFilled style={{ color: '#faad14', marginRight: 8 }} />
  819. <span>系统提示</span>
  820. </div>
  821. }
  822. open={deleteModalVisible}
  823. onOk={executeDeleteRow}
  824. onCancel={() => {
  825. setDeleteModalVisible(false);
  826. setDeleteRecord(null);
  827. }}
  828. okText="确认"
  829. cancelText="取消"
  830. >
  831. <p>{`确定删除菜单名称为“${deleteRecord?.menuName}”的数据项?`}</p>
  832. </Modal>
  833. </PageContainer>
  834. );
  835. }