@bit-sun/business-component 2.4.30 → 2.4.31-alpha.1
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/dist/index.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
2
|
import cookie from 'js-cookie';
|
|
3
|
-
import { message as message$1, Tooltip, Image, Popover, Card, Avatar, Space, Dropdown, Button, Checkbox, Menu, Input, Modal, Select, Form, Divider, Spin, Table, TreeSelect, Tag, InputNumber, Typography, Alert, Anchor, Breadcrumb, Drawer as Drawer$1, List, Tree, Row, Col, Tabs, Affix, Cascader, DatePicker, TimePicker, Switch } from 'antd';
|
|
3
|
+
import { message as message$1, Tooltip, Image, Popover, Card, Avatar, Space, Dropdown, Button, Checkbox, Menu, Input, Modal, Select, Form, Divider, Spin, Table, TreeSelect, Tag, InputNumber, Typography, Alert, Anchor, Breadcrumb, Drawer as Drawer$1, List, Tree, Row, Col, Result, Tabs, Affix, Cascader, DatePicker, TimePicker, Switch } from 'antd';
|
|
4
4
|
import _, { omit, debounce, cloneDeep as cloneDeep$1, throttle, isEmpty } from 'lodash';
|
|
5
5
|
import { formatMessage, history, useLocation, Link, useModel, useIntl } from 'umi';
|
|
6
6
|
import isEqual from 'lodash/isEqual';
|
|
@@ -16489,10 +16489,70 @@ var CustomerMenuHeader = function CustomerMenuHeader(_ref) {
|
|
|
16489
16489
|
var css_248z$m = ".customer_menu_content {\n color: #b1bad4;\n background: #141620;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 18px;\n height: 40px;\n border-bottom: 1px solid #3d4047;\n}\n.customer_menu_content .ant-btn-link {\n color: #b1bad4 !important;\n font-size: 16px;\n height: 36px;\n}\n.menu_item {\n line-height: 30px;\n height: 30px;\n color: rgba(44, 47, 46);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.link_style:hover {\n background-color: #e4e7ed;\n cursor: pointer;\n color: #1890ff;\n}\n.sub_menu_content {\n box-shadow: 2px 0px 4px 0px rgba(185, 185, 185, 0.5);\n position: fixed;\n top: 50px;\n left: 140px;\n width: 200px;\n height: 100%;\n background-color: #fff;\n padding-top: 10px;\n z-index: 9999;\n}\n.tab_left_operate {\n display: flex;\n height: 28px;\n align-items: center;\n}\n.tab_left_operate > div {\n width: 28px;\n font-size: 12px;\n color: #2C2F2ECC;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n border-right: 1px solid #E4E4E4;\n background-color: #fff;\n cursor: pointer;\n}\n.tab_left_operate > div:last-child {\n box-shadow: 2px -2px 4px 0px rgba(185, 185, 185, 0.9);\n z-index: 99;\n}\n.tab_right_operate {\n height: 28px;\n width: 28px;\n font-size: 12px;\n color: #2C2F2ECC;\n display: flex;\n align-items: center;\n justify-content: center;\n border-right: 1px solid #E4E4E4;\n background-color: #fff;\n box-shadow: -2px -2px 4px 0px rgba(185, 185, 185, 0.9);\n z-index: 99;\n cursor: pointer;\n position: relative;\n}\n";
|
|
16490
16490
|
styleInject(css_248z$m);
|
|
16491
16491
|
|
|
16492
|
+
/*
|
|
16493
|
+
* @Date: 2022-04-01 15:42:51
|
|
16494
|
+
* @LastEditors: 追随
|
|
16495
|
+
* @LastEditTime: 2022-09-16 20:53:23
|
|
16496
|
+
*/
|
|
16497
|
+
var NoFoundPage = function NoFoundPage(props) {
|
|
16498
|
+
return /*#__PURE__*/React$1.createElement("div", {
|
|
16499
|
+
style: {
|
|
16500
|
+
height: 'calc(100vh - 88px)',
|
|
16501
|
+
background: '#fff',
|
|
16502
|
+
display: 'flex',
|
|
16503
|
+
justifyContent: 'center',
|
|
16504
|
+
alignItems: 'center'
|
|
16505
|
+
}
|
|
16506
|
+
}, /*#__PURE__*/React$1.createElement(Result, {
|
|
16507
|
+
status: "404",
|
|
16508
|
+
title: "404",
|
|
16509
|
+
subTitle: /*#__PURE__*/React$1.createElement("div", null, /*#__PURE__*/React$1.createElement("div", null, "\u62B1\u6B49\uFF0C\u65E0\u6CD5\u8BBF\u95EE\u8BE5\u9875\u9762\uFF01"), /*#__PURE__*/React$1.createElement("div", null, "\u8BF7\u5173\u95ED\u5F53\u524D\u9875\u7B7E"))
|
|
16510
|
+
}));
|
|
16511
|
+
};
|
|
16512
|
+
|
|
16492
16513
|
var _excluded$g = ["route"];
|
|
16493
16514
|
var TabPane = Tabs.TabPane;
|
|
16515
|
+
var getId = function getId(str) {
|
|
16516
|
+
// 找到最后一个 / 的位置
|
|
16517
|
+
var lastSlashIndex = str.lastIndexOf("/");
|
|
16518
|
+
// 如果找到了 /,则返回它后面的部分
|
|
16519
|
+
if (lastSlashIndex !== -1) {
|
|
16520
|
+
return str.substring(lastSlashIndex + 1);
|
|
16521
|
+
} else {
|
|
16522
|
+
// 如果没有找到 /,则返回整个字符串
|
|
16523
|
+
return null;
|
|
16524
|
+
}
|
|
16525
|
+
};
|
|
16526
|
+
// 获取权限菜单path&通用单据id
|
|
16527
|
+
var getAuthMenuPathAndDocsId = function getAuthMenuPathAndDocsId(pathToRegexp) {
|
|
16528
|
+
var limitedMenuData = localStorage.getItem(getLimitMenuDataKey()) ? JSON.parse(localStorage.getItem(getLimitMenuDataKey())) : [];
|
|
16529
|
+
var menuKeys = [];
|
|
16530
|
+
var docsId = [];
|
|
16531
|
+
var getLimitedMenuKeys = function getLimitedMenuKeys(data) {
|
|
16532
|
+
data.forEach(function (item) {
|
|
16533
|
+
if (item.children && item.children.length > 0) {
|
|
16534
|
+
getLimitedMenuKeys(item.children);
|
|
16535
|
+
} else {
|
|
16536
|
+
var originPath = item.path.replace(/^\/\w+\//, '/');
|
|
16537
|
+
menuKeys.push(originPath);
|
|
16538
|
+
if (pathToRegexp('/operation-and-maintenance-center/configuration-management/all-general-documents-specific/:id').test(originPath)) {
|
|
16539
|
+
getId(originPath) && docsId.push(getId(originPath));
|
|
16540
|
+
}
|
|
16541
|
+
}
|
|
16542
|
+
});
|
|
16543
|
+
};
|
|
16544
|
+
try {
|
|
16545
|
+
getLimitedMenuKeys(limitedMenuData);
|
|
16546
|
+
} catch (e) {}
|
|
16547
|
+
return {
|
|
16548
|
+
menuKeys: menuKeys,
|
|
16549
|
+
docsId: docsId
|
|
16550
|
+
};
|
|
16551
|
+
};
|
|
16494
16552
|
var UN_LISTTEN_DRP;
|
|
16495
16553
|
var routerArray = [];
|
|
16554
|
+
var authMenuPathList = [];
|
|
16555
|
+
var docsId = [];
|
|
16496
16556
|
var lastTwoRouterArray = [1, 2];
|
|
16497
16557
|
var type = 'DraggableTabNode';
|
|
16498
16558
|
var DraggableTabNode = function DraggableTabNode(_ref) {
|
|
@@ -16685,6 +16745,7 @@ var ItemMenu = function ItemMenu(props) {
|
|
|
16685
16745
|
};
|
|
16686
16746
|
var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
|
|
16687
16747
|
function BasicLayout(props) {
|
|
16748
|
+
var _getAuthMenuPathAndDo, _getAuthMenuPathAndDo2;
|
|
16688
16749
|
var _this;
|
|
16689
16750
|
_classCallCheck(this, BasicLayout);
|
|
16690
16751
|
_this = _callSuper(this, BasicLayout, [props]);
|
|
@@ -16701,24 +16762,37 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
16701
16762
|
return queryString;
|
|
16702
16763
|
};
|
|
16703
16764
|
_this.updateTree = function (Tree) {
|
|
16765
|
+
var authMenuKeys = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
16704
16766
|
var treeData = Tree;
|
|
16705
16767
|
var treeList = [];
|
|
16768
|
+
// 是否为权限菜单路径
|
|
16769
|
+
var getLimitedMenuPath = function getLimitedMenuPath(node) {
|
|
16770
|
+
return authMenuKeys.some(function (item) {
|
|
16771
|
+
return (node.path || '').includes(item);
|
|
16772
|
+
});
|
|
16773
|
+
};
|
|
16774
|
+
// 是否为通用单据菜单路径
|
|
16775
|
+
var getGenerateDocs = function getGenerateDocs(node) {
|
|
16776
|
+
return (node.path || '').includes('all-general-documents');
|
|
16777
|
+
};
|
|
16706
16778
|
// 递归获取树列表
|
|
16707
16779
|
var getTreeList = function getTreeList(data) {
|
|
16708
16780
|
data.forEach(function (node) {
|
|
16709
16781
|
if (node.routes && node.routes.length > 0) {
|
|
16710
16782
|
getTreeList(node.routes);
|
|
16711
16783
|
} else {
|
|
16712
|
-
|
|
16713
|
-
|
|
16714
|
-
|
|
16715
|
-
|
|
16716
|
-
|
|
16717
|
-
|
|
16718
|
-
|
|
16719
|
-
|
|
16720
|
-
|
|
16721
|
-
|
|
16784
|
+
if (node.path === '/' || getLimitedMenuPath(node) || getGenerateDocs(node)) {
|
|
16785
|
+
treeList.push({
|
|
16786
|
+
tab: node.locale,
|
|
16787
|
+
key: node.path,
|
|
16788
|
+
locale: node.locale,
|
|
16789
|
+
closable: true,
|
|
16790
|
+
content: node.component,
|
|
16791
|
+
name: node.name,
|
|
16792
|
+
hideInMenu: node.hideInMenu,
|
|
16793
|
+
isOnlyOnePage: node.isOnlyOnePage
|
|
16794
|
+
});
|
|
16795
|
+
}
|
|
16722
16796
|
}
|
|
16723
16797
|
});
|
|
16724
16798
|
};
|
|
@@ -16775,7 +16849,6 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
16775
16849
|
return moment$1(timeStr).add(8, 'hours').format(format) || '- -';
|
|
16776
16850
|
};
|
|
16777
16851
|
_this.onChange = function (key) {
|
|
16778
|
-
// console.log('onChange');
|
|
16779
16852
|
if (key !== _this.state.activeKey) {
|
|
16780
16853
|
_this.setState({
|
|
16781
16854
|
activeKey: key
|
|
@@ -17061,7 +17134,11 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
17061
17134
|
});
|
|
17062
17135
|
}
|
|
17063
17136
|
};
|
|
17064
|
-
|
|
17137
|
+
authMenuPathList = ((_getAuthMenuPathAndDo = getAuthMenuPathAndDocsId(props.pathToRegexp)) === null || _getAuthMenuPathAndDo === void 0 ? void 0 : _getAuthMenuPathAndDo.menuKeys) || [];
|
|
17138
|
+
docsId = ((_getAuthMenuPathAndDo2 = getAuthMenuPathAndDocsId(props.pathToRegexp)) === null || _getAuthMenuPathAndDo2 === void 0 ? void 0 : _getAuthMenuPathAndDo2.docsId) || [];
|
|
17139
|
+
console.log('aaaaaaaa', authMenuPathList, docsId);
|
|
17140
|
+
routerArray = _this.updateTree(props.route.routes, authMenuPathList);
|
|
17141
|
+
console.log('bbbbbbbb', routerArray);
|
|
17065
17142
|
var homeRouter = routerArray.filter(function (itemroute) {
|
|
17066
17143
|
return itemroute.key === '/';
|
|
17067
17144
|
})[0];
|
|
@@ -17162,6 +17239,12 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
17162
17239
|
var newListenRouterState = _toConsumableArray(listenRouterState);
|
|
17163
17240
|
var newListenRouterKey = _toConsumableArray(listenRouterKey);
|
|
17164
17241
|
var replaceRouter = routerArray.filter(function (itemRoute) {
|
|
17242
|
+
var _route$pathname;
|
|
17243
|
+
if ((_route$pathname = route.pathname) === null || _route$pathname === void 0 ? void 0 : _route$pathname.includes('all-general-documents')) {
|
|
17244
|
+
return pathToRegexp(itemRoute.key || '').test(route.pathname) && docsId.some(function (item) {
|
|
17245
|
+
return route.pathname.includes(item);
|
|
17246
|
+
});
|
|
17247
|
+
}
|
|
17165
17248
|
return pathToRegexp(itemRoute.key || '').test(route.pathname);
|
|
17166
17249
|
})[0];
|
|
17167
17250
|
var currentKey = '';
|
|
@@ -17185,20 +17268,15 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
17185
17268
|
}
|
|
17186
17269
|
if (!listenRouterKey.includes(currentKey)) {
|
|
17187
17270
|
if (!replaceRouter) {
|
|
17188
|
-
|
|
17189
|
-
|
|
17190
|
-
|
|
17191
|
-
|
|
17192
|
-
|
|
17193
|
-
|
|
17194
|
-
|
|
17195
|
-
|
|
17196
|
-
|
|
17197
|
-
activeKey: currentKey,
|
|
17198
|
-
listenRouterKey: [].concat(_toConsumableArray(listenRouterKey), [currentKey])
|
|
17199
|
-
}, function () {
|
|
17200
|
-
_this2.checkisNavSlide();
|
|
17201
|
-
});
|
|
17271
|
+
replaceRouter = {
|
|
17272
|
+
content: currentKey,
|
|
17273
|
+
key: currentKey,
|
|
17274
|
+
name: '404',
|
|
17275
|
+
tab: '404',
|
|
17276
|
+
isNotFound: true
|
|
17277
|
+
};
|
|
17278
|
+
newListenRouterState = [].concat(_toConsumableArray(newListenRouterState), [_objectSpread2({}, replaceRouter)]);
|
|
17279
|
+
newListenRouterKey = [].concat(_toConsumableArray(listenRouterKey), [currentKey]);
|
|
17202
17280
|
} else {
|
|
17203
17281
|
var match = matchPath(route.pathname, {
|
|
17204
17282
|
path: replaceRouter.key
|
|
@@ -17716,8 +17794,7 @@ var WrapperComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
17716
17794
|
getDictionaryTextByValue = _this$props4.getDictionaryTextByValue,
|
|
17717
17795
|
timeFormat = _this$props4.timeFormat,
|
|
17718
17796
|
transparentProps = _this$props4.transparentProps;
|
|
17719
|
-
|
|
17720
|
-
return /*#__PURE__*/React$1.createElement(React$1.Fragment, null, /*#__PURE__*/React$1.createElement(item.content, _objectSpread2(_objectSpread2(_objectSpread2({
|
|
17797
|
+
return /*#__PURE__*/React$1.createElement(React$1.Fragment, null, item.isNotFound ? ( /*#__PURE__*/React$1.createElement(NoFoundPage, null)) : /*#__PURE__*/React$1.createElement(item.content, _objectSpread2(_objectSpread2(_objectSpread2({
|
|
17721
17798
|
getDictionarySource: getDictionarySource,
|
|
17722
17799
|
getDictionaryTextByValue: getDictionaryTextByValue,
|
|
17723
17800
|
timeFormat: timeFormat
|
package/dist/index.js
CHANGED
|
@@ -16509,10 +16509,70 @@ var CustomerMenuHeader = function CustomerMenuHeader(_ref) {
|
|
|
16509
16509
|
var css_248z$m = ".customer_menu_content {\n color: #b1bad4;\n background: #141620;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 18px;\n height: 40px;\n border-bottom: 1px solid #3d4047;\n}\n.customer_menu_content .ant-btn-link {\n color: #b1bad4 !important;\n font-size: 16px;\n height: 36px;\n}\n.menu_item {\n line-height: 30px;\n height: 30px;\n color: rgba(44, 47, 46);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.link_style:hover {\n background-color: #e4e7ed;\n cursor: pointer;\n color: #1890ff;\n}\n.sub_menu_content {\n box-shadow: 2px 0px 4px 0px rgba(185, 185, 185, 0.5);\n position: fixed;\n top: 50px;\n left: 140px;\n width: 200px;\n height: 100%;\n background-color: #fff;\n padding-top: 10px;\n z-index: 9999;\n}\n.tab_left_operate {\n display: flex;\n height: 28px;\n align-items: center;\n}\n.tab_left_operate > div {\n width: 28px;\n font-size: 12px;\n color: #2C2F2ECC;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n border-right: 1px solid #E4E4E4;\n background-color: #fff;\n cursor: pointer;\n}\n.tab_left_operate > div:last-child {\n box-shadow: 2px -2px 4px 0px rgba(185, 185, 185, 0.9);\n z-index: 99;\n}\n.tab_right_operate {\n height: 28px;\n width: 28px;\n font-size: 12px;\n color: #2C2F2ECC;\n display: flex;\n align-items: center;\n justify-content: center;\n border-right: 1px solid #E4E4E4;\n background-color: #fff;\n box-shadow: -2px -2px 4px 0px rgba(185, 185, 185, 0.9);\n z-index: 99;\n cursor: pointer;\n position: relative;\n}\n";
|
|
16510
16510
|
styleInject(css_248z$m);
|
|
16511
16511
|
|
|
16512
|
+
/*
|
|
16513
|
+
* @Date: 2022-04-01 15:42:51
|
|
16514
|
+
* @LastEditors: 追随
|
|
16515
|
+
* @LastEditTime: 2022-09-16 20:53:23
|
|
16516
|
+
*/
|
|
16517
|
+
var NoFoundPage = function NoFoundPage(props) {
|
|
16518
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
16519
|
+
style: {
|
|
16520
|
+
height: 'calc(100vh - 88px)',
|
|
16521
|
+
background: '#fff',
|
|
16522
|
+
display: 'flex',
|
|
16523
|
+
justifyContent: 'center',
|
|
16524
|
+
alignItems: 'center'
|
|
16525
|
+
}
|
|
16526
|
+
}, /*#__PURE__*/React__default['default'].createElement(antd.Result, {
|
|
16527
|
+
status: "404",
|
|
16528
|
+
title: "404",
|
|
16529
|
+
subTitle: /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement("div", null, "\u62B1\u6B49\uFF0C\u65E0\u6CD5\u8BBF\u95EE\u8BE5\u9875\u9762\uFF01"), /*#__PURE__*/React__default['default'].createElement("div", null, "\u8BF7\u5173\u95ED\u5F53\u524D\u9875\u7B7E"))
|
|
16530
|
+
}));
|
|
16531
|
+
};
|
|
16532
|
+
|
|
16512
16533
|
var _excluded$g = ["route"];
|
|
16513
16534
|
var TabPane = antd.Tabs.TabPane;
|
|
16535
|
+
var getId = function getId(str) {
|
|
16536
|
+
// 找到最后一个 / 的位置
|
|
16537
|
+
var lastSlashIndex = str.lastIndexOf("/");
|
|
16538
|
+
// 如果找到了 /,则返回它后面的部分
|
|
16539
|
+
if (lastSlashIndex !== -1) {
|
|
16540
|
+
return str.substring(lastSlashIndex + 1);
|
|
16541
|
+
} else {
|
|
16542
|
+
// 如果没有找到 /,则返回整个字符串
|
|
16543
|
+
return null;
|
|
16544
|
+
}
|
|
16545
|
+
};
|
|
16546
|
+
// 获取权限菜单path&通用单据id
|
|
16547
|
+
var getAuthMenuPathAndDocsId = function getAuthMenuPathAndDocsId(pathToRegexp) {
|
|
16548
|
+
var limitedMenuData = localStorage.getItem(getLimitMenuDataKey()) ? JSON.parse(localStorage.getItem(getLimitMenuDataKey())) : [];
|
|
16549
|
+
var menuKeys = [];
|
|
16550
|
+
var docsId = [];
|
|
16551
|
+
var getLimitedMenuKeys = function getLimitedMenuKeys(data) {
|
|
16552
|
+
data.forEach(function (item) {
|
|
16553
|
+
if (item.children && item.children.length > 0) {
|
|
16554
|
+
getLimitedMenuKeys(item.children);
|
|
16555
|
+
} else {
|
|
16556
|
+
var originPath = item.path.replace(/^\/\w+\//, '/');
|
|
16557
|
+
menuKeys.push(originPath);
|
|
16558
|
+
if (pathToRegexp('/operation-and-maintenance-center/configuration-management/all-general-documents-specific/:id').test(originPath)) {
|
|
16559
|
+
getId(originPath) && docsId.push(getId(originPath));
|
|
16560
|
+
}
|
|
16561
|
+
}
|
|
16562
|
+
});
|
|
16563
|
+
};
|
|
16564
|
+
try {
|
|
16565
|
+
getLimitedMenuKeys(limitedMenuData);
|
|
16566
|
+
} catch (e) {}
|
|
16567
|
+
return {
|
|
16568
|
+
menuKeys: menuKeys,
|
|
16569
|
+
docsId: docsId
|
|
16570
|
+
};
|
|
16571
|
+
};
|
|
16514
16572
|
var UN_LISTTEN_DRP;
|
|
16515
16573
|
var routerArray = [];
|
|
16574
|
+
var authMenuPathList = [];
|
|
16575
|
+
var docsId = [];
|
|
16516
16576
|
var lastTwoRouterArray = [1, 2];
|
|
16517
16577
|
var type = 'DraggableTabNode';
|
|
16518
16578
|
var DraggableTabNode = function DraggableTabNode(_ref) {
|
|
@@ -16705,6 +16765,7 @@ var ItemMenu = function ItemMenu(props) {
|
|
|
16705
16765
|
};
|
|
16706
16766
|
var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
|
|
16707
16767
|
function BasicLayout(props) {
|
|
16768
|
+
var _getAuthMenuPathAndDo, _getAuthMenuPathAndDo2;
|
|
16708
16769
|
var _this;
|
|
16709
16770
|
_classCallCheck(this, BasicLayout);
|
|
16710
16771
|
_this = _callSuper(this, BasicLayout, [props]);
|
|
@@ -16721,24 +16782,37 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
16721
16782
|
return queryString;
|
|
16722
16783
|
};
|
|
16723
16784
|
_this.updateTree = function (Tree) {
|
|
16785
|
+
var authMenuKeys = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
16724
16786
|
var treeData = Tree;
|
|
16725
16787
|
var treeList = [];
|
|
16788
|
+
// 是否为权限菜单路径
|
|
16789
|
+
var getLimitedMenuPath = function getLimitedMenuPath(node) {
|
|
16790
|
+
return authMenuKeys.some(function (item) {
|
|
16791
|
+
return (node.path || '').includes(item);
|
|
16792
|
+
});
|
|
16793
|
+
};
|
|
16794
|
+
// 是否为通用单据菜单路径
|
|
16795
|
+
var getGenerateDocs = function getGenerateDocs(node) {
|
|
16796
|
+
return (node.path || '').includes('all-general-documents');
|
|
16797
|
+
};
|
|
16726
16798
|
// 递归获取树列表
|
|
16727
16799
|
var getTreeList = function getTreeList(data) {
|
|
16728
16800
|
data.forEach(function (node) {
|
|
16729
16801
|
if (node.routes && node.routes.length > 0) {
|
|
16730
16802
|
getTreeList(node.routes);
|
|
16731
16803
|
} else {
|
|
16732
|
-
|
|
16733
|
-
|
|
16734
|
-
|
|
16735
|
-
|
|
16736
|
-
|
|
16737
|
-
|
|
16738
|
-
|
|
16739
|
-
|
|
16740
|
-
|
|
16741
|
-
|
|
16804
|
+
if (node.path === '/' || getLimitedMenuPath(node) || getGenerateDocs(node)) {
|
|
16805
|
+
treeList.push({
|
|
16806
|
+
tab: node.locale,
|
|
16807
|
+
key: node.path,
|
|
16808
|
+
locale: node.locale,
|
|
16809
|
+
closable: true,
|
|
16810
|
+
content: node.component,
|
|
16811
|
+
name: node.name,
|
|
16812
|
+
hideInMenu: node.hideInMenu,
|
|
16813
|
+
isOnlyOnePage: node.isOnlyOnePage
|
|
16814
|
+
});
|
|
16815
|
+
}
|
|
16742
16816
|
}
|
|
16743
16817
|
});
|
|
16744
16818
|
};
|
|
@@ -16795,7 +16869,6 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
16795
16869
|
return moment__default['default'](timeStr).add(8, 'hours').format(format) || '- -';
|
|
16796
16870
|
};
|
|
16797
16871
|
_this.onChange = function (key) {
|
|
16798
|
-
// console.log('onChange');
|
|
16799
16872
|
if (key !== _this.state.activeKey) {
|
|
16800
16873
|
_this.setState({
|
|
16801
16874
|
activeKey: key
|
|
@@ -17081,7 +17154,11 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
17081
17154
|
});
|
|
17082
17155
|
}
|
|
17083
17156
|
};
|
|
17084
|
-
|
|
17157
|
+
authMenuPathList = ((_getAuthMenuPathAndDo = getAuthMenuPathAndDocsId(props.pathToRegexp)) === null || _getAuthMenuPathAndDo === void 0 ? void 0 : _getAuthMenuPathAndDo.menuKeys) || [];
|
|
17158
|
+
docsId = ((_getAuthMenuPathAndDo2 = getAuthMenuPathAndDocsId(props.pathToRegexp)) === null || _getAuthMenuPathAndDo2 === void 0 ? void 0 : _getAuthMenuPathAndDo2.docsId) || [];
|
|
17159
|
+
console.log('aaaaaaaa', authMenuPathList, docsId);
|
|
17160
|
+
routerArray = _this.updateTree(props.route.routes, authMenuPathList);
|
|
17161
|
+
console.log('bbbbbbbb', routerArray);
|
|
17085
17162
|
var homeRouter = routerArray.filter(function (itemroute) {
|
|
17086
17163
|
return itemroute.key === '/';
|
|
17087
17164
|
})[0];
|
|
@@ -17182,6 +17259,12 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
17182
17259
|
var newListenRouterState = _toConsumableArray(listenRouterState);
|
|
17183
17260
|
var newListenRouterKey = _toConsumableArray(listenRouterKey);
|
|
17184
17261
|
var replaceRouter = routerArray.filter(function (itemRoute) {
|
|
17262
|
+
var _route$pathname;
|
|
17263
|
+
if ((_route$pathname = route.pathname) === null || _route$pathname === void 0 ? void 0 : _route$pathname.includes('all-general-documents')) {
|
|
17264
|
+
return pathToRegexp(itemRoute.key || '').test(route.pathname) && docsId.some(function (item) {
|
|
17265
|
+
return route.pathname.includes(item);
|
|
17266
|
+
});
|
|
17267
|
+
}
|
|
17185
17268
|
return pathToRegexp(itemRoute.key || '').test(route.pathname);
|
|
17186
17269
|
})[0];
|
|
17187
17270
|
var currentKey = '';
|
|
@@ -17205,20 +17288,15 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
17205
17288
|
}
|
|
17206
17289
|
if (!listenRouterKey.includes(currentKey)) {
|
|
17207
17290
|
if (!replaceRouter) {
|
|
17208
|
-
|
|
17209
|
-
|
|
17210
|
-
|
|
17211
|
-
|
|
17212
|
-
|
|
17213
|
-
|
|
17214
|
-
|
|
17215
|
-
|
|
17216
|
-
|
|
17217
|
-
activeKey: currentKey,
|
|
17218
|
-
listenRouterKey: [].concat(_toConsumableArray(listenRouterKey), [currentKey])
|
|
17219
|
-
}, function () {
|
|
17220
|
-
_this2.checkisNavSlide();
|
|
17221
|
-
});
|
|
17291
|
+
replaceRouter = {
|
|
17292
|
+
content: currentKey,
|
|
17293
|
+
key: currentKey,
|
|
17294
|
+
name: '404',
|
|
17295
|
+
tab: '404',
|
|
17296
|
+
isNotFound: true
|
|
17297
|
+
};
|
|
17298
|
+
newListenRouterState = [].concat(_toConsumableArray(newListenRouterState), [_objectSpread2({}, replaceRouter)]);
|
|
17299
|
+
newListenRouterKey = [].concat(_toConsumableArray(listenRouterKey), [currentKey]);
|
|
17222
17300
|
} else {
|
|
17223
17301
|
var match = matchPath(route.pathname, {
|
|
17224
17302
|
path: replaceRouter.key
|
|
@@ -17736,8 +17814,7 @@ var WrapperComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
17736
17814
|
getDictionaryTextByValue = _this$props4.getDictionaryTextByValue,
|
|
17737
17815
|
timeFormat = _this$props4.timeFormat,
|
|
17738
17816
|
transparentProps = _this$props4.transparentProps;
|
|
17739
|
-
|
|
17740
|
-
return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(item.content, _objectSpread2(_objectSpread2(_objectSpread2({
|
|
17817
|
+
return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, item.isNotFound ? ( /*#__PURE__*/React__default['default'].createElement(NoFoundPage, null)) : /*#__PURE__*/React__default['default'].createElement(item.content, _objectSpread2(_objectSpread2(_objectSpread2({
|
|
17741
17818
|
getDictionarySource: getDictionarySource,
|
|
17742
17819
|
getDictionaryTextByValue: getDictionaryTextByValue,
|
|
17743
17820
|
timeFormat: timeFormat
|
package/package.json
CHANGED
|
@@ -45,6 +45,8 @@ import { HTML5Backend } from 'react-dnd-html5-backend';
|
|
|
45
45
|
import ENUM from '@/utils/enumConfig';
|
|
46
46
|
import { memoizeOneFormatter } from '@/utils/utils';
|
|
47
47
|
import Item from 'antd/lib/list/Item';
|
|
48
|
+
import { getLimitMenuDataKey } from '@/utils';
|
|
49
|
+
import NoFoundPage from '@/components/Functional/AccessWrapper';
|
|
48
50
|
|
|
49
51
|
const { TabPane } = Tabs;
|
|
50
52
|
|
|
@@ -62,6 +64,43 @@ export type BasicLayoutContext = { [K in 'location']: BasicLayoutProps[K] } & {
|
|
|
62
64
|
breadcrumbNameMap: Record<string, MenuDataItem>;
|
|
63
65
|
};
|
|
64
66
|
|
|
67
|
+
const getId = (str) => {
|
|
68
|
+
// 找到最后一个 / 的位置
|
|
69
|
+
var lastSlashIndex = str.lastIndexOf("/");
|
|
70
|
+
|
|
71
|
+
// 如果找到了 /,则返回它后面的部分
|
|
72
|
+
if (lastSlashIndex !== -1) {
|
|
73
|
+
return str.substring(lastSlashIndex + 1);
|
|
74
|
+
} else {
|
|
75
|
+
// 如果没有找到 /,则返回整个字符串
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// 获取权限菜单path&通用单据id
|
|
81
|
+
const getAuthMenuPathAndDocsId = (pathToRegexp) => {
|
|
82
|
+
const limitedMenuData = localStorage.getItem(getLimitMenuDataKey()) ? JSON.parse(localStorage.getItem(getLimitMenuDataKey())) : [];
|
|
83
|
+
const menuKeys = [];
|
|
84
|
+
const docsId = [];
|
|
85
|
+
const getLimitedMenuKeys = (data) => {
|
|
86
|
+
data.forEach((item) => {
|
|
87
|
+
if (item.children && item.children.length > 0) {
|
|
88
|
+
getLimitedMenuKeys(item.children);
|
|
89
|
+
} else {
|
|
90
|
+
const originPath = item.path.replace(/^\/\w+\//, '/');
|
|
91
|
+
menuKeys.push(originPath);
|
|
92
|
+
if (pathToRegexp('/operation-and-maintenance-center/configuration-management/all-general-documents-specific/:id').test(originPath)) {
|
|
93
|
+
getId(originPath) && docsId.push(getId(originPath))
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
};
|
|
98
|
+
try {
|
|
99
|
+
getLimitedMenuKeys(limitedMenuData);
|
|
100
|
+
} catch(e) {}
|
|
101
|
+
return {menuKeys, docsId};
|
|
102
|
+
}
|
|
103
|
+
|
|
65
104
|
const menuDataRender = (menuList: MenuDataItem[]): MenuDataItem[] =>
|
|
66
105
|
menuList.map((item) => {
|
|
67
106
|
return {
|
|
@@ -72,6 +111,8 @@ const menuDataRender = (menuList: MenuDataItem[]): MenuDataItem[] =>
|
|
|
72
111
|
|
|
73
112
|
let UN_LISTTEN_DRP;
|
|
74
113
|
let routerArray = [];
|
|
114
|
+
let authMenuPathList = [];
|
|
115
|
+
let docsId = [];
|
|
75
116
|
let lastTwoRouterArray = [1, 2];
|
|
76
117
|
|
|
77
118
|
let draggerTabKeys = [];
|
|
@@ -287,7 +328,11 @@ class BasicLayout extends React.PureComponent {
|
|
|
287
328
|
}>();
|
|
288
329
|
constructor(props) {
|
|
289
330
|
super(props);
|
|
290
|
-
|
|
331
|
+
authMenuPathList = getAuthMenuPathAndDocsId(props.pathToRegexp)?.menuKeys || [];
|
|
332
|
+
docsId = getAuthMenuPathAndDocsId(props.pathToRegexp)?.docsId || [];
|
|
333
|
+
console.log('aaaaaaaa', authMenuPathList, docsId)
|
|
334
|
+
routerArray = this.updateTree(props.route.routes, authMenuPathList);
|
|
335
|
+
console.log('bbbbbbbb',routerArray)
|
|
291
336
|
const homeRouter = routerArray.filter(
|
|
292
337
|
(itemroute) => itemroute.key === '/',
|
|
293
338
|
)[0];
|
|
@@ -391,9 +436,12 @@ class BasicLayout extends React.PureComponent {
|
|
|
391
436
|
let newListenRouterState = [...listenRouterState];
|
|
392
437
|
let newListenRouterKey = [...listenRouterKey];
|
|
393
438
|
|
|
394
|
-
let replaceRouter = routerArray.filter((itemRoute) =>
|
|
395
|
-
|
|
396
|
-
|
|
439
|
+
let replaceRouter = routerArray.filter((itemRoute) => {
|
|
440
|
+
if (route.pathname?.includes('all-general-documents')) {
|
|
441
|
+
return pathToRegexp(itemRoute.key || '').test(route.pathname) && docsId.some(item => route.pathname.includes(item));
|
|
442
|
+
}
|
|
443
|
+
return pathToRegexp(itemRoute.key || '').test(route.pathname);
|
|
444
|
+
})[0];
|
|
397
445
|
|
|
398
446
|
let currentKey = '';
|
|
399
447
|
|
|
@@ -420,24 +468,23 @@ class BasicLayout extends React.PureComponent {
|
|
|
420
468
|
}
|
|
421
469
|
|
|
422
470
|
if (!listenRouterKey.includes(currentKey)) {
|
|
471
|
+
|
|
423
472
|
if (!replaceRouter) {
|
|
424
|
-
replaceRouter =
|
|
425
|
-
|
|
426
|
-
|
|
473
|
+
replaceRouter = {
|
|
474
|
+
content: currentKey,
|
|
475
|
+
key: currentKey,
|
|
476
|
+
name:'404',
|
|
477
|
+
tab: '404',
|
|
478
|
+
isNotFound: true,
|
|
479
|
+
}
|
|
427
480
|
|
|
428
|
-
|
|
481
|
+
newListenRouterState = [
|
|
482
|
+
...newListenRouterState,
|
|
429
483
|
{
|
|
430
|
-
|
|
431
|
-
...listenRouterState,
|
|
432
|
-
{ ...replaceRouter, key: currentKey, tab: '404' },
|
|
433
|
-
],
|
|
434
|
-
activeKey: currentKey,
|
|
435
|
-
listenRouterKey: [...listenRouterKey, currentKey],
|
|
436
|
-
},
|
|
437
|
-
() => {
|
|
438
|
-
this.checkisNavSlide();
|
|
484
|
+
...replaceRouter,
|
|
439
485
|
},
|
|
440
|
-
|
|
486
|
+
];
|
|
487
|
+
newListenRouterKey = [...listenRouterKey, currentKey];
|
|
441
488
|
} else {
|
|
442
489
|
const match = matchPath(route.pathname, { path: replaceRouter.key }, pathToRegexp);
|
|
443
490
|
newListenRouterState = [
|
|
@@ -540,25 +587,40 @@ class BasicLayout extends React.PureComponent {
|
|
|
540
587
|
return queryString;
|
|
541
588
|
};
|
|
542
589
|
|
|
543
|
-
updateTree = (Tree) => {
|
|
590
|
+
updateTree = (Tree, authMenuKeys = []) => {
|
|
544
591
|
const treeData = Tree;
|
|
545
592
|
const treeList = [];
|
|
593
|
+
|
|
594
|
+
|
|
595
|
+
|
|
596
|
+
// 是否为权限菜单路径
|
|
597
|
+
const getLimitedMenuPath = (node) => {
|
|
598
|
+
return authMenuKeys.some(item => (node.path || '').includes(item));
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
// 是否为通用单据菜单路径
|
|
602
|
+
const getGenerateDocs = (node) => {
|
|
603
|
+
return (node.path || '').includes('all-general-documents');
|
|
604
|
+
}
|
|
605
|
+
|
|
546
606
|
// 递归获取树列表
|
|
547
607
|
const getTreeList = (data) => {
|
|
548
608
|
data.forEach((node) => {
|
|
549
609
|
if (node.routes && node.routes.length > 0) {
|
|
550
610
|
getTreeList(node.routes);
|
|
551
611
|
} else {
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
612
|
+
if (node.path === '/' || getLimitedMenuPath(node) || getGenerateDocs(node)) {
|
|
613
|
+
treeList.push({
|
|
614
|
+
tab: node.locale,
|
|
615
|
+
key: node.path,
|
|
616
|
+
locale: node.locale,
|
|
617
|
+
closable: true,
|
|
618
|
+
content: node.component,
|
|
619
|
+
name: node.name,
|
|
620
|
+
hideInMenu: node.hideInMenu,
|
|
621
|
+
isOnlyOnePage: node.isOnlyOnePage,
|
|
622
|
+
});
|
|
623
|
+
}
|
|
562
624
|
}
|
|
563
625
|
});
|
|
564
626
|
};
|
|
@@ -636,7 +698,6 @@ class BasicLayout extends React.PureComponent {
|
|
|
636
698
|
};
|
|
637
699
|
|
|
638
700
|
onChange = (key) => {
|
|
639
|
-
// console.log('onChange');
|
|
640
701
|
if (key !== this.state.activeKey) {
|
|
641
702
|
this.setState({
|
|
642
703
|
activeKey: key,
|
|
@@ -1452,10 +1513,10 @@ class WrapperComponent extends React.Component {
|
|
|
1452
1513
|
timeFormat,
|
|
1453
1514
|
transparentProps,
|
|
1454
1515
|
} = this.props;
|
|
1455
|
-
console.log('child wrapper conpent', this.props)
|
|
1456
1516
|
return (
|
|
1457
1517
|
<>
|
|
1458
|
-
{
|
|
1518
|
+
{item.isNotFound ? ( <NoFoundPage />) :
|
|
1519
|
+
React.createElement(item.content, {
|
|
1459
1520
|
getDictionarySource: getDictionarySource,
|
|
1460
1521
|
getDictionaryTextByValue: getDictionaryTextByValue,
|
|
1461
1522
|
timeFormat: timeFormat,
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Date: 2022-04-01 15:42:51
|
|
3
|
+
* @LastEditors: 追随
|
|
4
|
+
* @LastEditTime: 2022-09-16 20:53:23
|
|
5
|
+
*/
|
|
6
|
+
import { Button, Result } from 'antd';
|
|
7
|
+
import React from 'react';
|
|
8
|
+
|
|
9
|
+
const NoFoundPage: React.FC<{
|
|
10
|
+
closeCurrentTab?: () => void;
|
|
11
|
+
}> = (props) => (
|
|
12
|
+
<div
|
|
13
|
+
style={{
|
|
14
|
+
height: 'calc(100vh - 88px)',
|
|
15
|
+
background: '#fff',
|
|
16
|
+
display: 'flex',
|
|
17
|
+
justifyContent: 'center',
|
|
18
|
+
alignItems: 'center',
|
|
19
|
+
}}
|
|
20
|
+
>
|
|
21
|
+
<Result
|
|
22
|
+
status="404"
|
|
23
|
+
title="404"
|
|
24
|
+
subTitle={
|
|
25
|
+
<div>
|
|
26
|
+
<div>抱歉,无法访问该页面!</div>
|
|
27
|
+
<div>请关闭当前页签</div>
|
|
28
|
+
</div>
|
|
29
|
+
}
|
|
30
|
+
/>
|
|
31
|
+
</div>
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
export default NoFoundPage;
|