react-toolkits 2.13.17 → 2.13.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/lib/index.js +276 -268
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/lib/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { jwtDecode } from 'jwt-decode';
|
|
|
3
3
|
import { useStore, create, createStore } from 'zustand';
|
|
4
4
|
import { persist, createJSONStorage } from 'zustand/middleware';
|
|
5
5
|
import * as Antd2 from 'antd';
|
|
6
|
-
import { Modal,
|
|
6
|
+
import { Modal, Form, Spin, Result, Table, Button, Card, Input, Select, App, Switch, InputNumber, theme, Space, Tag, Typography, Alert, Divider, Menu, Popconfirm, Row, Col, Breadcrumb, Descriptions, Skeleton, Empty, Dropdown, Tooltip, Collapse, Checkbox } from 'antd';
|
|
7
7
|
import { forwardRef, lazy, useContext, useMemo, useState, useEffect, useImperativeHandle, cloneElement, useRef, createContext, memo, useCallback, Fragment as Fragment$1, Suspense } from 'react';
|
|
8
8
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
9
9
|
import { last, has, template, get, isEqual, first } from 'lodash-es';
|
|
@@ -11,7 +11,7 @@ import { flushSync } from 'react-dom';
|
|
|
11
11
|
import { createRoot } from 'react-dom/client';
|
|
12
12
|
import useSWR5, { mutate, unstable_serialize } from 'swr';
|
|
13
13
|
import logoUrl from './logo-L6MFCL6M.png';
|
|
14
|
-
import { Routes, Route, Navigate, useNavigate,
|
|
14
|
+
import { Routes, Route, Navigate, useNavigate, useParams, useLocation, Link } from 'react-router-dom';
|
|
15
15
|
import { PlusOutlined, UserAddOutlined, UsergroupAddOutlined, LogoutOutlined, UserOutlined, MenuUnfoldOutlined, MenuFoldOutlined, MinusCircleOutlined } from '@ant-design/icons';
|
|
16
16
|
import useSWRMutation2 from 'swr/mutation';
|
|
17
17
|
import { Editor } from '@monaco-editor/react';
|
|
@@ -1043,12 +1043,9 @@ function useModal(props) {
|
|
|
1043
1043
|
const open = isOpen(_id);
|
|
1044
1044
|
const [confirmLoading, setConfirmLoading] = useState(false);
|
|
1045
1045
|
const isRenderFunction = typeof content === "function";
|
|
1046
|
-
const [loading, setLoading] = useState(false);
|
|
1047
1046
|
const _show = async () => {
|
|
1048
1047
|
show(_id);
|
|
1049
|
-
setLoading(true);
|
|
1050
1048
|
await afterOpen?.();
|
|
1051
|
-
setLoading(false);
|
|
1052
1049
|
};
|
|
1053
1050
|
const _hide = () => {
|
|
1054
1051
|
hide(_id);
|
|
@@ -1065,7 +1062,7 @@ function useModal(props) {
|
|
|
1065
1062
|
setConfirmLoading(false);
|
|
1066
1063
|
}
|
|
1067
1064
|
};
|
|
1068
|
-
const internalModal = /* @__PURE__ */ jsx(Modal, { ...modalProps, open, confirmLoading, onOk, onCancel, children:
|
|
1065
|
+
const internalModal = /* @__PURE__ */ jsx(Modal, { ...modalProps, open, confirmLoading, onOk, onCancel, children: isRenderFunction ? content({ hide: _hide }) : content });
|
|
1069
1066
|
return {
|
|
1070
1067
|
id: _id,
|
|
1071
1068
|
show: _show,
|
|
@@ -1477,118 +1474,122 @@ var init_menuItemList = __esm({
|
|
|
1477
1474
|
init_highlight();
|
|
1478
1475
|
init_locale();
|
|
1479
1476
|
init_queryList();
|
|
1477
|
+
init_toolkitsProvider();
|
|
1480
1478
|
init_menu();
|
|
1481
1479
|
init_hooks4();
|
|
1482
1480
|
init_hooks2();
|
|
1483
|
-
MenuItemList = (
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
/* @__PURE__ */
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1481
|
+
MenuItemList = withContext(
|
|
1482
|
+
() => {
|
|
1483
|
+
const { t } = useTranslation();
|
|
1484
|
+
const { message } = App.useApp();
|
|
1485
|
+
const remove = useRemoveMenu();
|
|
1486
|
+
const { refetch } = useQueryListStore();
|
|
1487
|
+
const { mutate: mutate2 } = useMenuList();
|
|
1488
|
+
const navigate = useNavigate();
|
|
1489
|
+
const columns = [
|
|
1490
|
+
{
|
|
1491
|
+
title: "\u83DC\u5355\u540D\u79F0",
|
|
1492
|
+
dataIndex: "category",
|
|
1493
|
+
key: "category"
|
|
1494
|
+
},
|
|
1495
|
+
{
|
|
1496
|
+
title: "\u524D\u7AEF\u8DEF\u7531",
|
|
1497
|
+
dataIndex: "front_route"
|
|
1498
|
+
},
|
|
1499
|
+
{
|
|
1500
|
+
title: "Order",
|
|
1501
|
+
dataIndex: "order"
|
|
1502
|
+
},
|
|
1503
|
+
{
|
|
1504
|
+
title: "Is Common",
|
|
1505
|
+
dataIndex: "is_common",
|
|
1506
|
+
key: "is_common",
|
|
1507
|
+
render: (value) => value ? "\u662F" : "\u5426"
|
|
1508
|
+
},
|
|
1509
|
+
{
|
|
1510
|
+
title: "\u6A21\u677F\u540D\u79F0",
|
|
1511
|
+
dataIndex: "model_name",
|
|
1512
|
+
key: "model_name"
|
|
1513
|
+
},
|
|
1514
|
+
// {
|
|
1515
|
+
// title: '是否预设',
|
|
1516
|
+
// dataIndex: 'is_model',
|
|
1517
|
+
// key: 'is_model',
|
|
1518
|
+
// render: value => (value ? '否' : '是'),
|
|
1519
|
+
// },
|
|
1520
|
+
{
|
|
1521
|
+
title: "\u64CD\u4F5C",
|
|
1522
|
+
key: "action",
|
|
1523
|
+
width: 150,
|
|
1524
|
+
align: "center",
|
|
1525
|
+
render(_, record) {
|
|
1526
|
+
if (record.is_model) {
|
|
1527
|
+
return /* @__PURE__ */ jsxs(Space, { size: "small", children: [
|
|
1528
|
+
/* @__PURE__ */ jsx(
|
|
1529
|
+
Button,
|
|
1530
|
+
{
|
|
1531
|
+
type: "link",
|
|
1532
|
+
onClick: () => {
|
|
1533
|
+
navigate(`./update/${record.id}`);
|
|
1534
|
+
},
|
|
1535
|
+
children: t("global.update")
|
|
1536
|
+
}
|
|
1537
|
+
),
|
|
1538
|
+
/* @__PURE__ */ jsx(
|
|
1539
|
+
Popconfirm,
|
|
1540
|
+
{
|
|
1541
|
+
title: "\u5220\u9664\u83DC\u5355",
|
|
1542
|
+
placement: "topRight",
|
|
1543
|
+
description: /* @__PURE__ */ jsxs(Highlight_default, { texts: [record.category], children: [
|
|
1544
|
+
"\u786E\u5B9A\u8981\u5220\u9664\u83DC\u5355 ",
|
|
1545
|
+
record.category,
|
|
1546
|
+
" \u5417\uFF1F"
|
|
1547
|
+
] }),
|
|
1548
|
+
onConfirm: async () => {
|
|
1549
|
+
await remove.trigger(record.id);
|
|
1550
|
+
refetch(url);
|
|
1551
|
+
mutate2();
|
|
1552
|
+
message.success("\u5220\u9664\u6210\u529F");
|
|
1553
|
+
},
|
|
1554
|
+
children: /* @__PURE__ */ jsx(Button, { danger: true, type: "link", size: "small", children: t("global.delete") })
|
|
1555
|
+
}
|
|
1556
|
+
)
|
|
1557
|
+
] });
|
|
1558
|
+
}
|
|
1559
|
+
return null;
|
|
1559
1560
|
}
|
|
1560
|
-
return null;
|
|
1561
1561
|
}
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
}
|
|
1590
|
-
|
|
1591
|
-
|
|
1562
|
+
];
|
|
1563
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
1564
|
+
Card,
|
|
1565
|
+
{
|
|
1566
|
+
title: "\u83DC\u5355\u7BA1\u7406",
|
|
1567
|
+
extra: /* @__PURE__ */ jsx(
|
|
1568
|
+
Button,
|
|
1569
|
+
{
|
|
1570
|
+
type: "primary",
|
|
1571
|
+
onClick: () => {
|
|
1572
|
+
navigate("./create");
|
|
1573
|
+
},
|
|
1574
|
+
children: "\u521B\u5EFA\u83DC\u5355\u9879"
|
|
1575
|
+
}
|
|
1576
|
+
),
|
|
1577
|
+
children: /* @__PURE__ */ jsx(
|
|
1578
|
+
QueryList_default,
|
|
1579
|
+
{
|
|
1580
|
+
onePage: true,
|
|
1581
|
+
code: "9900001",
|
|
1582
|
+
rowKey: "id",
|
|
1583
|
+
url,
|
|
1584
|
+
columns,
|
|
1585
|
+
getDataSource: (response) => response
|
|
1586
|
+
}
|
|
1587
|
+
)
|
|
1588
|
+
}
|
|
1589
|
+
) });
|
|
1590
|
+
},
|
|
1591
|
+
{ isGlobal: true }
|
|
1592
|
+
);
|
|
1592
1593
|
menuItemList_default = MenuItemList;
|
|
1593
1594
|
}
|
|
1594
1595
|
});
|
|
@@ -1601,82 +1602,86 @@ __export(createMenuItem_exports, {
|
|
|
1601
1602
|
var CreateMenuItem, createMenuItem_default;
|
|
1602
1603
|
var init_createMenuItem = __esm({
|
|
1603
1604
|
"src/pages/menu/createMenuItem/index.tsx"() {
|
|
1605
|
+
init_toolkitsProvider();
|
|
1604
1606
|
init_constants();
|
|
1605
1607
|
init_menu();
|
|
1606
1608
|
init_hooks2();
|
|
1607
|
-
CreateMenuItem = (
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
const
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
}
|
|
1649
|
-
) }),
|
|
1650
|
-
/* @__PURE__ */ jsx(Form.Item, { label: "Schema", name: "scheme", rules: [{ required: true }], children: /* @__PURE__ */ jsx(
|
|
1651
|
-
Editor,
|
|
1652
|
-
{
|
|
1653
|
-
theme: "vs-dark",
|
|
1654
|
-
height: "600px",
|
|
1655
|
-
language: "json",
|
|
1656
|
-
options: {
|
|
1657
|
-
minimap: {
|
|
1658
|
-
enabled: false
|
|
1609
|
+
CreateMenuItem = withContext(
|
|
1610
|
+
() => {
|
|
1611
|
+
const { message } = App.useApp();
|
|
1612
|
+
const [form] = Form.useForm();
|
|
1613
|
+
const navigate = useNavigate();
|
|
1614
|
+
const { trigger } = useCreateMenu();
|
|
1615
|
+
const { mutate: mutate2 } = useMenuList();
|
|
1616
|
+
const onFinish = async (values) => {
|
|
1617
|
+
const { permissions, front_route, ...rest } = values;
|
|
1618
|
+
await trigger({
|
|
1619
|
+
...rest,
|
|
1620
|
+
front_route: FRONTEND_ROUTE_PREFIX + front_route,
|
|
1621
|
+
permissions: permissions ? JSON.parse(permissions) : void 0
|
|
1622
|
+
});
|
|
1623
|
+
mutate2();
|
|
1624
|
+
message.success("\u521B\u5EFA\u6210\u529F", 0.8, () => navigate("..", { relative: "route" }));
|
|
1625
|
+
};
|
|
1626
|
+
return /* @__PURE__ */ jsx(Card, { title: "\u521B\u5EFA\u83DC\u5355\u9879", children: /* @__PURE__ */ jsxs(
|
|
1627
|
+
Form,
|
|
1628
|
+
{
|
|
1629
|
+
scrollToFirstError: true,
|
|
1630
|
+
form,
|
|
1631
|
+
labelCol: { flex: "120px" },
|
|
1632
|
+
initialValues: { is_common: false, is_model: false, order: 0 },
|
|
1633
|
+
onFinish,
|
|
1634
|
+
children: [
|
|
1635
|
+
/* @__PURE__ */ jsx(Form.Item, { label: "\u83DC\u5355\u9879\u540D\u79F0", name: "category", rules: [{ required: true }], children: /* @__PURE__ */ jsx(Input, {}) }),
|
|
1636
|
+
/* @__PURE__ */ jsx(Form.Item, { label: "\u524D\u7AEF\u8DEF\u7531", name: "front_route", rules: [{ required: true }], children: /* @__PURE__ */ jsx(Input, { prefix: FRONTEND_ROUTE_PREFIX }) }),
|
|
1637
|
+
/* @__PURE__ */ jsx(Form.Item, { label: "\u6A21\u677F\u540D\u79F0", name: "model_name", rules: [{ required: true }], children: /* @__PURE__ */ jsx(Input, {}) }),
|
|
1638
|
+
/* @__PURE__ */ jsx(Form.Item, { label: "Is Common", name: "is_common", rules: [{ required: true }], valuePropName: "checked", children: /* @__PURE__ */ jsx(Switch, {}) }),
|
|
1639
|
+
/* @__PURE__ */ jsx(Form.Item, { label: "Order", name: "order", children: /* @__PURE__ */ jsx(InputNumber, { className: "w-full" }) }),
|
|
1640
|
+
/* @__PURE__ */ jsx(Form.Item, { label: "\u63A5\u53E3\u89C4\u5219", name: "permissions", children: /* @__PURE__ */ jsx(
|
|
1641
|
+
Editor,
|
|
1642
|
+
{
|
|
1643
|
+
theme: "vs-dark",
|
|
1644
|
+
height: "300px",
|
|
1645
|
+
language: "json",
|
|
1646
|
+
options: {
|
|
1647
|
+
minimap: {
|
|
1648
|
+
enabled: false
|
|
1649
|
+
}
|
|
1659
1650
|
}
|
|
1660
1651
|
}
|
|
1661
|
-
}
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
/* @__PURE__ */ jsx(Form.Item, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-center gap-8", children: [
|
|
1665
|
-
/* @__PURE__ */ jsx(Button, { type: "primary", htmlType: "submit", children: "\u63D0\u4EA4" }),
|
|
1666
|
-
/* @__PURE__ */ jsx(
|
|
1667
|
-
Button,
|
|
1652
|
+
) }),
|
|
1653
|
+
/* @__PURE__ */ jsx(Form.Item, { label: "Schema", name: "scheme", rules: [{ required: true }], children: /* @__PURE__ */ jsx(
|
|
1654
|
+
Editor,
|
|
1668
1655
|
{
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1656
|
+
theme: "vs-dark",
|
|
1657
|
+
height: "600px",
|
|
1658
|
+
language: "json",
|
|
1659
|
+
options: {
|
|
1660
|
+
minimap: {
|
|
1661
|
+
enabled: false
|
|
1662
|
+
}
|
|
1663
|
+
}
|
|
1673
1664
|
}
|
|
1674
|
-
)
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1665
|
+
) }),
|
|
1666
|
+
/* @__PURE__ */ jsx(Form.Item, { label: "Ext", name: "ext", children: /* @__PURE__ */ jsx(Input.TextArea, { rows: 5 }) }),
|
|
1667
|
+
/* @__PURE__ */ jsx(Form.Item, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-center gap-8", children: [
|
|
1668
|
+
/* @__PURE__ */ jsx(Button, { type: "primary", htmlType: "submit", children: "\u63D0\u4EA4" }),
|
|
1669
|
+
/* @__PURE__ */ jsx(
|
|
1670
|
+
Button,
|
|
1671
|
+
{
|
|
1672
|
+
onClick: () => {
|
|
1673
|
+
navigate("..", { relative: "path" });
|
|
1674
|
+
},
|
|
1675
|
+
children: "\u53D6\u6D88"
|
|
1676
|
+
}
|
|
1677
|
+
)
|
|
1678
|
+
] }) })
|
|
1679
|
+
]
|
|
1680
|
+
}
|
|
1681
|
+
) });
|
|
1682
|
+
},
|
|
1683
|
+
{ isGlobal: true }
|
|
1684
|
+
);
|
|
1680
1685
|
createMenuItem_default = CreateMenuItem;
|
|
1681
1686
|
}
|
|
1682
1687
|
});
|
|
@@ -1693,96 +1698,99 @@ var init_updateMenuItem = __esm({
|
|
|
1693
1698
|
init_constants();
|
|
1694
1699
|
init_menu();
|
|
1695
1700
|
init_hooks2();
|
|
1696
|
-
EditMenuItem = (
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
const
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
}
|
|
1755
|
-
) }),
|
|
1756
|
-
/* @__PURE__ */ jsx(Form.Item, { label: "Schema", name: "scheme", rules: [{ required: true }], children: /* @__PURE__ */ jsx(
|
|
1757
|
-
Editor,
|
|
1758
|
-
{
|
|
1759
|
-
theme: "vs-dark",
|
|
1760
|
-
height: "600px",
|
|
1761
|
-
language: "json",
|
|
1762
|
-
options: {
|
|
1763
|
-
minimap: {
|
|
1764
|
-
enabled: false
|
|
1701
|
+
EditMenuItem = withContext(
|
|
1702
|
+
() => {
|
|
1703
|
+
const { message } = App.useApp();
|
|
1704
|
+
const [form] = Form.useForm();
|
|
1705
|
+
const navigate = useNavigate();
|
|
1706
|
+
const { trigger } = useUpdateMenu();
|
|
1707
|
+
const params = useParams();
|
|
1708
|
+
const { mutate: mutate2 } = useMenuList();
|
|
1709
|
+
const { axios: axios2 } = useToolkitsStore((s) => s);
|
|
1710
|
+
const { data, isLoading } = useSWR5(
|
|
1711
|
+
`/api/usystem/menu/info?id=${params.id}`,
|
|
1712
|
+
(url4) => axios2(url4).then((response) => response.data.data)
|
|
1713
|
+
);
|
|
1714
|
+
const onFinish = async (values) => {
|
|
1715
|
+
const { permissions, front_route, ...rest } = values;
|
|
1716
|
+
await trigger({
|
|
1717
|
+
...rest,
|
|
1718
|
+
permissions: permissions ? JSON.parse(permissions) : void 0,
|
|
1719
|
+
front_route: FRONTEND_ROUTE_PREFIX + front_route,
|
|
1720
|
+
id: +params.id
|
|
1721
|
+
});
|
|
1722
|
+
mutate2();
|
|
1723
|
+
message.success("\u66F4\u65B0\u6210\u529F", 0.8, () => navigate("../..", { relative: "route" }));
|
|
1724
|
+
};
|
|
1725
|
+
useEffect(() => {
|
|
1726
|
+
const { permissions, front_route, ...rest } = data ?? {};
|
|
1727
|
+
const permissionsString = JSON.stringify(permissions || [], null, 2);
|
|
1728
|
+
const frontRoute = front_route?.replace(FRONTEND_ROUTE_PREFIX, "");
|
|
1729
|
+
form.setFieldsValue({
|
|
1730
|
+
...rest,
|
|
1731
|
+
permissions: permissionsString,
|
|
1732
|
+
front_route: frontRoute
|
|
1733
|
+
});
|
|
1734
|
+
}, [data]);
|
|
1735
|
+
return /* @__PURE__ */ jsx(Card, { title: "\u66F4\u65B0\u83DC\u5355\u9879", loading: isLoading, children: /* @__PURE__ */ jsxs(
|
|
1736
|
+
Form,
|
|
1737
|
+
{
|
|
1738
|
+
scrollToFirstError: true,
|
|
1739
|
+
form,
|
|
1740
|
+
labelCol: { flex: "120px" },
|
|
1741
|
+
initialValues: { is_common: false, is_model: false, order: 0 },
|
|
1742
|
+
onFinish,
|
|
1743
|
+
children: [
|
|
1744
|
+
/* @__PURE__ */ jsx(Form.Item, { label: "\u83DC\u5355\u9879\u540D\u79F0", name: "category", rules: [{ required: true }], children: /* @__PURE__ */ jsx(Input, {}) }),
|
|
1745
|
+
/* @__PURE__ */ jsx(Form.Item, { label: "\u524D\u7AEF\u8DEF\u7531", name: "front_route", rules: [{ required: true }], children: /* @__PURE__ */ jsx(Input, { prefix: FRONTEND_ROUTE_PREFIX }) }),
|
|
1746
|
+
/* @__PURE__ */ jsx(Form.Item, { label: "\u6A21\u677F\u540D\u79F0", name: "model_name", rules: [{ required: true }], children: /* @__PURE__ */ jsx(Input, {}) }),
|
|
1747
|
+
/* @__PURE__ */ jsx(Form.Item, { label: "Is Common", name: "is_common", rules: [{ required: true }], valuePropName: "checked", children: /* @__PURE__ */ jsx(Switch, {}) }),
|
|
1748
|
+
/* @__PURE__ */ jsx(Form.Item, { label: "Order", name: "order", children: /* @__PURE__ */ jsx(InputNumber, { className: "w-full" }) }),
|
|
1749
|
+
/* @__PURE__ */ jsx(Form.Item, { label: "\u63A5\u53E3\u89C4\u5219", name: "permissions", children: /* @__PURE__ */ jsx(
|
|
1750
|
+
Editor,
|
|
1751
|
+
{
|
|
1752
|
+
theme: "vs-dark",
|
|
1753
|
+
height: "300px",
|
|
1754
|
+
language: "json",
|
|
1755
|
+
options: {
|
|
1756
|
+
minimap: {
|
|
1757
|
+
enabled: false
|
|
1758
|
+
}
|
|
1765
1759
|
}
|
|
1766
1760
|
}
|
|
1767
|
-
}
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
/* @__PURE__ */ jsx(Form.Item, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-center gap-8", children: [
|
|
1771
|
-
/* @__PURE__ */ jsx(Button, { type: "primary", htmlType: "submit", children: "\u63D0\u4EA4" }),
|
|
1772
|
-
/* @__PURE__ */ jsx(
|
|
1773
|
-
Button,
|
|
1761
|
+
) }),
|
|
1762
|
+
/* @__PURE__ */ jsx(Form.Item, { label: "Schema", name: "scheme", rules: [{ required: true }], children: /* @__PURE__ */ jsx(
|
|
1763
|
+
Editor,
|
|
1774
1764
|
{
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1765
|
+
theme: "vs-dark",
|
|
1766
|
+
height: "600px",
|
|
1767
|
+
language: "json",
|
|
1768
|
+
options: {
|
|
1769
|
+
minimap: {
|
|
1770
|
+
enabled: false
|
|
1771
|
+
}
|
|
1772
|
+
}
|
|
1779
1773
|
}
|
|
1780
|
-
)
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1774
|
+
) }),
|
|
1775
|
+
/* @__PURE__ */ jsx(Form.Item, { label: "Ext", name: "ext", children: /* @__PURE__ */ jsx(Input.TextArea, { rows: 5 }) }),
|
|
1776
|
+
/* @__PURE__ */ jsx(Form.Item, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-center gap-8", children: [
|
|
1777
|
+
/* @__PURE__ */ jsx(Button, { type: "primary", htmlType: "submit", children: "\u63D0\u4EA4" }),
|
|
1778
|
+
/* @__PURE__ */ jsx(
|
|
1779
|
+
Button,
|
|
1780
|
+
{
|
|
1781
|
+
onClick: () => {
|
|
1782
|
+
navigate("../..", { relative: "path" });
|
|
1783
|
+
},
|
|
1784
|
+
children: "\u53D6\u6D88"
|
|
1785
|
+
}
|
|
1786
|
+
)
|
|
1787
|
+
] }) })
|
|
1788
|
+
]
|
|
1789
|
+
}
|
|
1790
|
+
) });
|
|
1791
|
+
},
|
|
1792
|
+
{ isGlobal: true }
|
|
1793
|
+
);
|
|
1786
1794
|
updateMenuItem_default = EditMenuItem;
|
|
1787
1795
|
}
|
|
1788
1796
|
});
|