userRelation页面上的一些细节

This commit is contained in:
Xu Chang 2023-08-03 18:09:57 +08:00
parent cce3716067
commit 44e13f15e5
6 changed files with 56 additions and 48 deletions

View File

@ -4,7 +4,6 @@ var tslib_1 = require("tslib");
var jsx_runtime_1 = require("react/jsx-runtime");
var react_1 = require("react");
var antd_1 = require("antd");
var pageHeader_1 = tslib_1.__importDefault(require("../../../components/common/pageHeader"));
// import UserEntityGrantList from '../../../pages/userEntityGrant/list';
var web_module_less_1 = tslib_1.__importDefault(require("./web.module.less"));
function Render(props) {
@ -14,7 +13,7 @@ function Render(props) {
var _f = props.methods, goUpsert = _f.goUpsert, t = _f.t, setCurrentPage = _f.setCurrentPage, setPageSize = _f.setPageSize, confirmDelete = _f.confirmDelete, goUpdate = _f.goUpdate;
var _g = tslib_1.__read((0, react_1.useState)(undefined), 2), idRemove = _g[0], setIdRemove = _g[1];
var _h = tslib_1.__read((0, react_1.useState)(false), 2), inviteVisible = _h[0], setInviteVisible = _h[1];
return ((0, jsx_runtime_1.jsxs)(pageHeader_1.default, tslib_1.__assign({ title: showTitle ? '权限列表' : undefined, showBack: showBack }, { children: [(0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: web_module_less_1.default.container }, { children: [(0, jsx_runtime_1.jsx)(antd_1.Space, tslib_1.__assign({ style: { marginBottom: 16 } }, { children: (0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ type: "primary", onClick: function () { return goUpsert(); } }, { children: "\u6DFB\u52A0" })) })), (0, jsx_runtime_1.jsx)(antd_1.Table, { loading: oakLoading, rowKey: "id", columns: [
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: web_module_less_1.default.container }, { children: [(0, jsx_runtime_1.jsx)(antd_1.Space, tslib_1.__assign({ style: { marginBottom: 16 } }, { children: (0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ type: "primary", onClick: function () { return goUpsert(); } }, { children: "\u6DFB\u52A0" })) })), (0, jsx_runtime_1.jsx)(antd_1.Table, { loading: oakLoading, rowKey: "id", columns: [
{
width: 100,
dataIndex: 'index',
@ -82,6 +81,6 @@ function Render(props) {
return [2 /*return*/];
}
});
}); }, onCancel: function () { return setIdRemove(undefined); }, cancelText: t('common:action.cancel'), okText: t('common:action.confirm') }, { children: (0, jsx_runtime_1.jsx)("p", { children: t('confirmRevokeAll') }) }))] })));
}); }, onCancel: function () { return setIdRemove(undefined); }, cancelText: t('common:action.cancel'), okText: t('common:action.confirm') }, { children: (0, jsx_runtime_1.jsx)("p", { children: t('confirmRevokeAll') }) }))] }));
}
exports.default = Render;

View File

@ -1,7 +1,8 @@
/// <reference types="react" />
import { EntityDict } from '../../../../general-app-domain';
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<EntityDict, keyof EntityDict, false, {
entity: keyof EntityDict;
import { ReactComponentProps } from 'oak-frontend-base/lib/types/Page';
import { EntityDict as BaseEntityDict } from 'oak-domain/lib/types/Entity';
declare const _default: <ED2 extends EntityDict & BaseEntityDict, T2 extends keyof ED2>(props: ReactComponentProps<ED2, T2, true, {
entity: keyof ED2;
entityId: string;
}>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
}>) => React.ReactElement;
export default _default;

View File

@ -5,10 +5,9 @@ var jsx_runtime_1 = require("react/jsx-runtime");
var antd_1 = require("antd");
var web_module_less_1 = tslib_1.__importDefault(require("./web.module.less"));
var index_1 = tslib_1.__importDefault(require("../onUser/index"));
var pageHeader_1 = tslib_1.__importDefault(require("../../../../components/common/pageHeader"));
function Render(props) {
var _a = props.data, relations = _a.relations, entity = _a.entity, entityId = _a.entityId, oakId = _a.oakId, oakDirty = _a.oakDirty, oakFullpath = _a.oakFullpath;
var _b = props.methods, onConfirm = _b.onConfirm, onReset = _b.onReset, t = _b.t;
return ((0, jsx_runtime_1.jsx)(pageHeader_1.default, tslib_1.__assign({ showBack: true, title: "\u7F16\u8F91\u6743\u9650" }, { children: (0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: web_module_less_1.default.container }, { children: [(0, jsx_runtime_1.jsx)(index_1.default, { oakAutoUnmount: true, oakPath: oakFullpath && "".concat(oakFullpath, ".user"), entity: entity, entityId: entityId, relations: relations, oakId: oakId }), (0, jsx_runtime_1.jsx)(antd_1.Form, tslib_1.__assign({ colon: true, labelCol: { span: 4 }, wrapperCol: { span: 8 } }, { children: (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ wrapperCol: { offset: 4 } }, { children: (0, jsx_runtime_1.jsxs)(antd_1.Space, { children: [(0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ disabled: !oakDirty, type: "primary", onClick: function () { return onConfirm(); } }, { children: t('common:action.confirm') })), (0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ htmlType: "reset", onClick: function () { return onReset(); } }, { children: t('common:action.reset') }))] }) })) }))] })) })));
return ((0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: web_module_less_1.default.container }, { children: [(0, jsx_runtime_1.jsx)(index_1.default, { oakAutoUnmount: true, oakPath: oakFullpath && "".concat(oakFullpath, ".user"), entity: entity, entityId: entityId, relations: relations, oakId: oakId }), (0, jsx_runtime_1.jsx)(antd_1.Form, tslib_1.__assign({ colon: true, labelCol: { span: 4 }, wrapperCol: { span: 8 } }, { children: (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ wrapperCol: { offset: 4 } }, { children: (0, jsx_runtime_1.jsxs)(antd_1.Space, { children: [(0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ disabled: !oakDirty, type: "primary", onClick: function () { return onConfirm(); } }, { children: t('common:action.confirm') })), (0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ htmlType: "reset", onClick: function () { return onReset(); } }, { children: t('common:reset') }))] }) })) }))] })));
}
exports.default = Render;

View File

@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var jsx_runtime_1 = require("react/jsx-runtime");
var antd_1 = require("antd");
var pageHeader_1 = tslib_1.__importDefault(require("../../../components/common/pageHeader"));
var web_module_less_1 = tslib_1.__importDefault(require("./web.module.less"));
var index_1 = tslib_1.__importDefault(require("./byMobile/index"));
var byUserEntityGrant_1 = tslib_1.__importDefault(require("./byUserEntityGrant"));
@ -19,12 +18,12 @@ function Render(props) {
SubPart = (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.container }, { children: "\u5C1A\u672A\u5B9E\u73B0" }));
}
else if (grantByMobile) {
SubPart = ((0, jsx_runtime_1.jsx)(index_1.default, { entity: entity, entityId: entityId, relations: relations, oakPath: oakFullpath ? "$".concat(oakFullpath, "-mobile") : undefined, oakAutoUnmount: true }));
SubPart = ((0, jsx_runtime_1.jsx)(index_1.default, { entity: entity, entityId: entityId, relations: relations, oakPath: oakFullpath ? "$userRelation-upsert-by-mobile" : undefined, oakAutoUnmount: true }));
}
else {
(0, assert_1.default)(grantByUserEntityGrant === true);
SubPart = ((0, jsx_runtime_1.jsx)(byUserEntityGrant_1.default, { qrCodeType: qrCodeType, entity: entity, entityId: entityId, relations: relations, oakPath: oakFullpath
? "$".concat(oakFullpath, "-userEntityGrant")
? "$userRelation-upsert-by-userEntityGrant"
: undefined, oakAutoUnmount: true, redirectToAfterConfirm: redirectToAfterConfirm }));
}
}
@ -38,13 +37,13 @@ function Render(props) {
{
label: '手机号',
key: 'item-2',
children: ((0, jsx_runtime_1.jsx)(index_1.default, { entity: entity, entityId: entityId, relations: relations, oakPath: oakFullpath ? "$".concat(oakFullpath, "-mobile") : undefined, oakAutoUnmount: true })),
children: ((0, jsx_runtime_1.jsx)(index_1.default, { entity: entity, entityId: entityId, relations: relations, oakPath: oakFullpath ? "$userRelation-upsert-by-mobile" : undefined, oakAutoUnmount: true })),
},
{
label: '二维码',
key: 'item-3',
children: ((0, jsx_runtime_1.jsx)(byUserEntityGrant_1.default, { entity: entity, entityId: entityId, relations: relations, qrCodeType: qrCodeType, oakPath: oakFullpath
? "$".concat(oakFullpath, "-userEntityGrant")
? "$userRelation-upsert-by-userEntityGrant"
: undefined, oakAutoUnmount: true, redirectToAfterConfirm: redirectToAfterConfirm })),
},
];
@ -60,6 +59,6 @@ function Render(props) {
}
SubPart = (0, jsx_runtime_1.jsx)(antd_1.Tabs, { items: items2 });
}
return ((0, jsx_runtime_1.jsx)(pageHeader_1.default, tslib_1.__assign({ showBack: true, title: "\u6DFB\u52A0\u6743\u9650" }, { children: SubPart })));
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: SubPart }));
}
exports.default = Render;

View File

@ -1,4 +1,6 @@
import { EntityDict } from '../../../../general-app-domain';
import { ReactComponentProps } from 'oak-frontend-base/lib/types/Page';
import { EntityDict as BaseEntityDict } from 'oak-domain/lib/types/Entity';
export default OakComponent({
isList: false,
@ -59,4 +61,15 @@ export default OakComponent({
this.clean();
}
}
});
})as <ED2 extends EntityDict & BaseEntityDict, T2 extends keyof ED2>(
props: ReactComponentProps<
ED2,
T2,
true,
{
entity: keyof ED2,
entityId: string,
}
>
) => React.ReactElement;

View File

@ -2,7 +2,6 @@ import React from 'react';
import { Form, Button, Space } from 'antd';
import Style from './web.module.less';
import OnUser from '../onUser/index';
import PageHeader from '../../../../components/common/pageHeader';
import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../../general-app-domain';
import { t } from '@wangeditor/editor';
@ -20,36 +19,34 @@ export default function Render(props: WebComponentProps<EntityDict, 'user', fals
const { relations, entity, entityId, oakId, oakDirty, oakFullpath } = props.data;
const { onConfirm, onReset, t } = props.methods;
return (
<PageHeader showBack={true} title="编辑权限">
<div className={Style.container}>
<OnUser
oakAutoUnmount={true}
oakPath={oakFullpath && `${oakFullpath}.user`}
entity={entity}
entityId={entityId}
relations={relations}
oakId={oakId}
/>
<Form colon labelCol={{ span: 4 }} wrapperCol={{ span: 8 }}>
<Form.Item wrapperCol={{ offset: 4 }}>
<Space>
<Button
disabled={!oakDirty}
type="primary"
onClick={() => onConfirm()}
>
{t('common:action.confirm')}
</Button>
<Button
htmlType="reset"
onClick={() => onReset()}
>
{t('common:action.reset')}
</Button>
</Space>
</Form.Item>
</Form>
</div>
</PageHeader>
<div className={Style.container}>
<OnUser
oakAutoUnmount={true}
oakPath={oakFullpath && `${oakFullpath}.user`}
entity={entity}
entityId={entityId}
relations={relations}
oakId={oakId}
/>
<Form colon labelCol={{ span: 4 }} wrapperCol={{ span: 8 }}>
<Form.Item wrapperCol={{ offset: 4 }}>
<Space>
<Button
disabled={!oakDirty}
type="primary"
onClick={() => onConfirm()}
>
{t('common:action.confirm')}
</Button>
<Button
htmlType="reset"
onClick={() => onReset()}
>
{t('common:reset')}
</Button>
</Space>
</Form.Item>
</Form>
</div>
);
}