relation/entityList 对user授权支持

This commit is contained in:
梁朝伟 2023-08-07 16:58:54 +08:00
parent eb2964e920
commit 0ee815c1ef
5 changed files with 9 additions and 11 deletions

View File

@ -39,7 +39,7 @@ var ProList = function (props) {
var newTableAttr = attributes.map(function (ele) { return ({ attribute: ele, show: true }); });
setTableAttributes(newTableAttr);
}
} }, { children: (0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: index_module_less_1.default.listContainer }, { children: [!isMobile && ((0, jsx_runtime_1.jsx)(toolBar_1.default, { title: title || t('list', { name: t("".concat(entity, ":name")) }), buttonGroup: buttonGroup, reload: function () {
} }, { children: (0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: index_module_less_1.default.listContainer }, { children: [!isMobile && ((0, jsx_runtime_1.jsx)(toolBar_1.default, { title: title || (t("".concat(entity, ":name")) + t('list')), buttonGroup: buttonGroup, reload: function () {
onReload && onReload();
} })), isMobile && ((0, jsx_runtime_1.jsx)(buttonGroup_1.default, { items: buttonGroup })), (0, jsx_runtime_1.jsx)(list_1.default, { entity: entity, extraActions: extraActions, onAction: onAction, disabledOp: disabledOp, attributes: attributes, data: data, loading: loading, tablePagination: tablePagination, rowSelection: rowSelection })] })) })));
};

View File

@ -28,7 +28,7 @@ exports.default = OakComponent({
var _a = this.props, path = _a.path, entity = _a.entity;
return {
destEntity: entity,
path: path,
path: path === null || path === void 0 ? void 0 : path.replaceAll('(user)', ''),
};
},
'#name': 'path',
@ -40,7 +40,6 @@ exports.default = OakComponent({
},
formData: function (_a) {
var rows = _a.data;
// console.log(this.props.path);
return {
rows: rows
};
@ -59,7 +58,7 @@ exports.default = OakComponent({
this.getRelationAndActions();
this.addNamedFilter({
filter: {
path: path,
path: path === null || path === void 0 ? void 0 : path.replaceAll('(user)', ''),
destEntity: entity,
},
'#name': 'path'

View File

@ -114,8 +114,8 @@ exports.default = OakComponent({
actionAuths: $actionAuthsObject[ele],
});
});
// path 中含有user 也要特殊处理
var hasUserActionAuths = data.filter(function (ele) { var _a; return (_a = ele.path) === null || _a === void 0 ? void 0 : _a.split('.').includes('user'); });
// relationId为空字符串 表示为user的actionAuth 也要特殊处理
var hasUserActionAuths = data.filter(function (ele) { return ele.relationId === ''; });
var $actionAuthsObject2 = (0, lodash_2.groupBy)(hasUserActionAuths, 'path');
Object.keys($actionAuthsObject2).forEach(function (ele) {
var entities = ele.split('.');

View File

@ -29,7 +29,7 @@ export default OakComponent({
const { path, entity } = this.props;
return {
destEntity: entity as string,
path,
path: path?.replaceAll('(user)', ''),
};
},
'#name': 'path',
@ -40,7 +40,6 @@ export default OakComponent({
currentPage: 0,
},
formData({ data: rows }) {
// console.log(this.props.path);
return {
rows
};
@ -56,7 +55,7 @@ export default OakComponent({
this.getRelationAndActions();
this.addNamedFilter({
filter: {
path,
path: path?.replaceAll('(user)', ''),
destEntity: entity as string,
},
'#name': 'path'

View File

@ -118,8 +118,8 @@ export default OakComponent({
})
})
// path 中含有user 也要特殊处理
const hasUserActionAuths = data.filter((ele) => ele.path?.split('.').includes('user'));
// relationId为空字符串 表示为user的actionAuth 也要特殊处理
const hasUserActionAuths = data.filter((ele) => ele.relationId === '');
const $actionAuthsObject2 = groupBy(hasUserActionAuths, 'path');
Object.keys($actionAuthsObject2).forEach((ele) => {
const entities = ele.split('.');