Merge branch 'dev' of codeup.aliyun.com:61c14a7efa282c88e103c23f/oak-general-business into dev

This commit is contained in:
Xu Chang 2023-02-06 21:53:40 +08:00
commit 6aa49282f1
3 changed files with 44 additions and 13 deletions

View File

@ -4,7 +4,7 @@ import { EntityDict } from '../../general-app-domain';
declare type Item = {
label?: string;
action?: string;
unRelation: boolean;
auth: boolean;
type?: 'a' | 'button';
index?: number;
alerted?: boolean;

View File

@ -32,7 +32,15 @@ function Render(props) {
var t = methods.t;
var items = data.items, oakLegalActions = data.oakLegalActions, spaceProps = data.spaceProps, entity = data.entity;
return ((0, jsx_runtime_1.jsx)(antd_1.Space, tslib_1.__assign({}, spaceProps, { children: items && items.map(function (ele, index) {
if (ele.unRelation || (oakLegalActions === null || oakLegalActions === void 0 ? void 0 : oakLegalActions.includes(ele.action))) {
var _a = ele.auth, auth = _a === void 0 ? true : _a;
if (
!auth ||
(auth && (
oakLegalActions === null || oakLegalActions === void 0
? void 0
: oakLegalActions.includes(ele.action)
))
) {
var onClick = function () {
if (ele.onClick) {
ele.onClick();
@ -56,11 +64,18 @@ function Render(props) {
if (ele.callBack) {
ele.callBack(index);
}
}
},
});
};
}
return ((0, jsx_runtime_1.jsx)(ItemComponent, tslib_1.__assign({}, ele, { entity: entity, t: t, onClick: onClick })));
return (0, jsx_runtime_1.jsx)(
ItemComponent,
tslib_1.__assign({}, ele, {
entity: entity,
t: t,
onClick: onClick,
})
);
}
}) })));
}

View File

@ -7,7 +7,7 @@ const { confirm } = Modal;
type Item = {
label?: string;
action?: string;
unRelation: boolean;
auth: boolean;
type?: 'a' | 'button';
index?: number;
alerted?: boolean;
@ -78,13 +78,22 @@ export default function Render(
return (
<Space {...spaceProps}>
{items && items.map((ele, index: number) => {
if (ele.unRelation || oakLegalActions?.includes(ele.action as EntityDict[keyof EntityDict]['Action'])) {
const { auth = true} = ele;
if (
!auth ||
(auth &&
oakLegalActions?.includes(
ele.action as EntityDict[keyof EntityDict]['Action']
))
) {
let onClick = () => {
if (ele.onClick) {
ele.onClick();
return;
}
methods.execute(ele.action as EntityDict[keyof EntityDict]['Action'])
methods.execute(
ele.action as EntityDict[keyof EntityDict]['Action']
);
};
if (ele.alerted) {
onClick = () => {
@ -98,17 +107,24 @@ export default function Render(
ele.onClick();
return;
}
methods.execute(ele.action as EntityDict[keyof EntityDict]['Action'])
methods.execute(
ele.action as EntityDict[keyof EntityDict]['Action']
);
if (ele.callBack) {
ele.callBack(index);
}
}
})
}
},
});
};
}
return (
<ItemComponent {...ele} entity={entity} t={t} onClick={onClick} />
)
<ItemComponent
{...ele}
entity={entity}
t={t}
onClick={onClick}
/>
);
}
})}
</Space>