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

This commit is contained in:
wenjiarui 2023-08-23 17:06:10 +08:00
commit 410ed73ac3
20 changed files with 308 additions and 415 deletions

View File

@ -82,7 +82,6 @@ exports.default = OakComponent({
return [3 /*break*/, 3];
case 2:
this.clean();
this.unsetId();
_a.label = 3;
case 3:
this.setState({

View File

@ -11,7 +11,9 @@ function Render(props) {
var _a = props.data, mobileValue = _a.mobileValue, mobileValueReady = _a.mobileValueReady, relations = _a.relations, entity = _a.entity, entityId = _a.entityId, userId = _a.userId, oakFullpath = _a.oakFullpath, oakExecutable = _a.oakExecutable, legal = _a.legal, isNew = _a.isNew;
var _b = props.methods, onConfirm = _b.onConfirm, onMobileChange = _b.onMobileChange, onReset = _b.onReset, t = _b.t;
var _c = tslib_1.__read((0, react_1.useState)(false), 2), passwordConfirm = _c[0], setPasswordConfirm = _c[1];
return ((0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: web_module_less_1.default.container }, { children: [(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({ label: "\u624B\u673A\u53F7\u7801", required: true, name: "mobile", rules: [
return ((0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: web_module_less_1.default.container }, { children: [(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({ label: "\u624B\u673A\u53F7\u7801", required: true,
// name="mobile"
rules: [
{
message: '手机号不能为空',
},
@ -23,10 +25,10 @@ function Render(props) {
max: 11,
message: '请输入11位手机号',
},
] }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.Input, { maxLength: 11, value: mobileValue, onChange: function (e) {
var strValue = e.target.value;
onMobileChange(strValue);
}, placeholder: "\u8BF7\u8F93\u5165\u624B\u673A\u53F7\u7801", type: "tel" }) }) })) })), mobileValueReady && userId && ((0, jsx_runtime_1.jsx)(index_1.default, { oakAutoUnmount: true, oakPath: oakFullpath ? "".concat(oakFullpath, ".user") : undefined, entity: entity, entityId: entityId, relations: relations, oakId: userId, setPasswordConfirm: setPasswordConfirm })), (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({ style: { flex: 2 }, type: "primary", htmlType: "reset", onClick: function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
] }, { children: (0, jsx_runtime_1.jsx)(antd_1.Input, { maxLength: 11, value: mobileValue, onChange: function (e) {
var strValue = e.target.value;
onMobileChange(strValue);
}, placeholder: "\u8BF7\u8F93\u5165\u624B\u673A\u53F7\u7801", type: "tel" }) })) })), mobileValueReady && userId && ((0, jsx_runtime_1.jsx)(index_1.default, { oakAutoUnmount: true, oakPath: oakFullpath ? "".concat(oakFullpath, ".user") : undefined, entity: entity, entityId: entityId, relations: relations, oakId: userId, setPasswordConfirm: setPasswordConfirm })), (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({ style: { flex: 2 }, type: "primary", htmlType: "reset", onClick: function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, onConfirm()];

View File

@ -13,39 +13,34 @@ function render(props) {
width: '100%',
display: 'flex',
justifyContent: 'flex-end',
} }, { children: (0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ type: "primary", onClick: function () { return setInit(); } }, { children: t('restart') })) }))] })) : ((0, jsx_runtime_1.jsxs)(antd_1.Form, tslib_1.__assign({ labelCol: { span: 4 }, wrapperCol: { span: 8 } }, { children: [(0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: t('userEntityGrant:attr.relation'), name: "relation", rules: [
{
required: true,
},
] }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.Radio.Group, { value: relationId, onChange: function (_a) {
var target = _a.target;
var value = target.value;
update({ relationId: value });
}, options: relations === null || relations === void 0 ? void 0 : relations.map(function (ele) { return ({
value: ele.id,
label: ele.display || t("".concat(entity, ":r.").concat(ele.name)),
}); }) }) }) })), type === 'grant' && ((0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: t('userEntityGrant:attr.number'), name: "number", rules: [
{
required: true,
message: t('chooseNumber'),
},
] }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.Radio.Group, { value: number, onChange: function (_a) {
var target = _a.target;
var value = target.value;
update({ number: value });
}, options: [
{ value: 1, label: t('single') },
{ value: 10000, label: t('unlimited') },
] }) }) }))), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: t('userEntityGrant:attr.expiresAt'), name: "period", rules: [
{
required: true,
message: t('chooseExpiresAt'),
},
], help: (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ style: { marginBottom: 16 } }, { children: t('expiresHelp') })), tooltip: "\u901A\u8FC7\u914D\u7F6E\u5B9E\u73B0\u5728\u89C4\u5B9A\u7684\u65F6\u6548\u5185\u626B\u63CF\u4E8C\u7EF4\u7801\u4E0D\u8FC7\u671F\u7684\u6548\u679C\u3002" }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.InputNumber, { min: 1, max: maxes[unit], value: period, onChange: function (value) { return setPeriod(value); },
// addonAfter="分钟"
addonAfter: (0, jsx_runtime_1.jsxs)(antd_1.Select, tslib_1.__assign({ value: unit, style: { width: 80 }, onChange: function (v) {
setUnit(v);
} }, { children: [(0, jsx_runtime_1.jsx)(antd_1.Select.Option, tslib_1.__assign({ value: "minute" }, { children: t('unit.minute') })), (0, jsx_runtime_1.jsx)(antd_1.Select.Option, tslib_1.__assign({ value: "hour" }, { children: t('unit.hour') }))] })) }) }) })), (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({ type: "primary", onClick: function () { return confirm(); }, disabled: oakExecutable !== true }, { children: t('common::action.confirm') })), (0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ onClick: function () { return onBack(); } }, { children: t('common::back') }))] }) }))] })));
} }, { children: (0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ type: "primary", onClick: function () { return setInit(); } }, { children: t('restart') })) }))] })) : ((0, jsx_runtime_1.jsxs)(antd_1.Form, tslib_1.__assign({ labelCol: { span: 4 }, wrapperCol: { span: 8 } }, { children: [(0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: t('userEntityGrant:attr.relation'), required: true }, { children: (0, jsx_runtime_1.jsx)(antd_1.Radio.Group, { value: relationId, onChange: function (_a) {
var target = _a.target;
var value = target.value;
update({ relationId: value });
}, options: relations === null || relations === void 0 ? void 0 : relations.map(function (ele) { return ({
value: ele.id,
label: ele.display ||
t("".concat(entity, ":r.").concat(ele.name)),
}); }) }) })), type === 'grant' && ((0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: t('userEntityGrant:attr.number'), required: true }, { children: (0, jsx_runtime_1.jsx)(antd_1.Radio.Group, { value: number, onChange: function (_a) {
var target = _a.target;
var value = target.value;
update({ number: value });
}, options: [
{ value: 1, label: t('single') },
{ value: 10000, label: t('unlimited') },
] }) }))), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: t('userEntityGrant:attr.expiresAt'), required: true,
// name="period"
// rules={[
// {
// required: true,
// message: t('chooseExpiresAt'),
// },
// ]}
help: (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ style: { marginBottom: 16 } }, { children: t('expiresHelp') })), tooltip: "\u901A\u8FC7\u914D\u7F6E\u5B9E\u73B0\u5728\u89C4\u5B9A\u7684\u65F6\u6548\u5185\u626B\u63CF\u4E8C\u7EF4\u7801\u4E0D\u8FC7\u671F\u7684\u6548\u679C\u3002" }, { children: (0, jsx_runtime_1.jsx)(antd_1.InputNumber, { min: 1, max: maxes[unit], value: period, onChange: function (value) { return setPeriod(value); },
// addonAfter="分钟"
addonAfter: (0, jsx_runtime_1.jsxs)(antd_1.Select, tslib_1.__assign({ value: unit, style: { width: 80 }, onChange: function (v) {
setUnit(v);
} }, { children: [(0, jsx_runtime_1.jsx)(antd_1.Select.Option, tslib_1.__assign({ value: "minute" }, { children: t('unit.minute') })), (0, jsx_runtime_1.jsx)(antd_1.Select.Option, tslib_1.__assign({ value: "hour" }, { children: t('unit.hour') }))] })) }) })), (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({ type: "primary", onClick: function () { return confirm(); }, disabled: oakExecutable !== true }, { children: t('common::action.confirm') })), (0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ onClick: function () { return onBack(); } }, { children: t('common::back') }))] }) }))] })));
return (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.container }, { children: P }));
}
exports.default = render;

View File

@ -1,39 +0,0 @@
{
"ptrActivate": "松开刷新",
"ptrDeactivate": "下拉刷新",
"ptrRelease": "正在刷新...",
"ptrFinish": "刷新完成",
"noData": "暂无数据",
"areYouSure": "请确认",
"action": {
"create": "创建",
"update": "更新",
"delete": "删除",
"remove": "删除",
"confirm": "确定",
"cancel": "取消",
"grant": "授权",
"revoke": "回收",
"tip": "提示",
"detail": "详情",
"editor": "编辑",
"newAdd": "新增",
"add": "添加"
},
"reset": "重置",
"select": "查询",
"expand": "展开",
"shrink": "收起",
"back": "返回",
"$$createAt$$": "创建时间",
"$$updateAt$$": "更新时间",
"$$deleteAt$$": "删除时间",
"$$seq$$": "序号",
"message": "消息",
"more": "更多",
"view": "查看",
"scan": "扫一扫",
"bind": "绑定",
"true": "是",
"false": "否"
}

View File

@ -2,5 +2,8 @@
.container {
display: flex;
flex-direction: column;
flex: 1;
justify-content: center;
background-color: var(--oak-bg-color-page);
height: 100%;
}

View File

@ -10,7 +10,7 @@
<view class="title">
{{granter.name || granter.nickname}}
授予您【
{{relation ? t(entity + ':r.' + relation) : ''}}
{{relation.display || relation ? t(entity + ':r.' + relation.name) : ''}}
</view>
</block>
@ -18,7 +18,7 @@
<view class="title">
{{granter.name || granter.nickname}}
转让您【
{{relation ? t(entity + ':r.' + relation) : ''}}
{{relation.display || relation ? t(entity + ':r.' + relation.name) : ''}}
</view>
</block>

View File

@ -3,7 +3,7 @@ import { EntityDict } from '../../../oak-app-domain';
export default function Render(props: WebComponentProps<EntityDict, 'userEntityGrant', true, {
type: 'grant';
expired: boolean;
relation: boolean;
relation: EntityDict['relation']['Schema'];
expiresAt: boolean;
granter?: {
name: string;

View File

@ -13,7 +13,7 @@ function Render(props) {
var isOwner = !!(granteeId && userId === granteeId);
var getRelationTip = function () {
var str = "".concat((granter === null || granter === void 0 ? void 0 : granter.name) || (granter === null || granter === void 0 ? void 0 : granter.nickname));
var relationStr = relation ? t("".concat(entity, ":r.").concat(relation)) : '';
var relationStr = (relation === null || relation === void 0 ? void 0 : relation.display) || relation ? t("".concat(entity, ":r.").concat(relation === null || relation === void 0 ? void 0 : relation.name)) : '';
if (type === 'grant') {
str = str.concat('授予您【').concat(relationStr).concat('】');
return str;

View File

@ -1,9 +1,5 @@
import { WebComponentProps } from 'oak-frontend-base';
import { EntityDict } from '../../../oak-app-domain';
export default function render(props: WebComponentProps<EntityDict, 'userEntityGrant', true, {
searchValue: string;
list: EntityDict['userEntityGrant']['Schema'][];
pagination: any;
showBack: boolean;
variant?: 'inline' | 'alone' | 'dialog';
}, {}>): import("react/jsx-runtime").JSX.Element;

View File

@ -4,87 +4,79 @@ var tslib_1 = require("tslib");
var jsx_runtime_1 = require("react/jsx-runtime");
var antd_1 = require("antd");
var dayjs_1 = tslib_1.__importDefault(require("dayjs"));
var pageHeader_1 = tslib_1.__importDefault(require("../../../components/common/pageHeader"));
var web_module_less_1 = tslib_1.__importDefault(require("./web.module.less"));
function render(props) {
var _a = props.data, oakPagination = _a.oakPagination, oakFullpath = _a.oakFullpath, _b = _a.list, list = _b === void 0 ? [] : _b, oakLoading = _a.oakLoading, showBack = _a.showBack, variant = _a.variant;
var _a = props.data, oakPagination = _a.oakPagination, oakFullpath = _a.oakFullpath, _b = _a.list, list = _b === void 0 ? [] : _b, oakLoading = _a.oakLoading;
var _c = oakPagination || {}, pageSize = _c.pageSize, total = _c.total, currentPage = _c.currentPage;
var _d = props.methods, t = _d.t, setPageSize = _d.setPageSize, setCurrentPage = _d.setCurrentPage;
return ((0, jsx_runtime_1.jsx)(Container, tslib_1.__assign({ showBack: showBack, variant: variant }, { children: (0, jsx_runtime_1.jsx)(antd_1.Table, { loading: oakLoading, dataSource: list, rowKey: "id", columns: [
// {
// dataIndex: 'id',
// title: '序号',
// render: (value, record, index) => {
// return index + 1;
// },
// },
{
dataIndex: 'name',
title: '授权人',
render: function (value, record, index) {
var _a, _b;
return ((0, jsx_runtime_1.jsxs)(antd_1.Space, tslib_1.__assign({ direction: "vertical" }, { children: [(0, jsx_runtime_1.jsxs)(antd_1.Typography.Text, { children: ["\u59D3\u540D\uFF1A", ((_a = record.granter) === null || _a === void 0 ? void 0 : _a.name) || '-'] }), (0, jsx_runtime_1.jsxs)(antd_1.Typography.Text, { children: ["\u6635\u79F0\uFF1A", (_b = record.granter) === null || _b === void 0 ? void 0 : _b.nickname] })] })));
},
return ((0, jsx_runtime_1.jsx)(antd_1.Table, { loading: oakLoading, dataSource: list, rowKey: "id", columns: [
// {
// dataIndex: 'id',
// title: '序号',
// render: (value, record, index) => {
// return index + 1;
// },
// },
{
dataIndex: 'name',
title: '授权人',
render: function (value, record, index) {
var _a, _b;
return ((0, jsx_runtime_1.jsxs)(antd_1.Space, tslib_1.__assign({ direction: "vertical" }, { children: [(0, jsx_runtime_1.jsxs)(antd_1.Typography.Text, { children: ["\u59D3\u540D\uFF1A", ((_a = record.granter) === null || _a === void 0 ? void 0 : _a.name) || '-'] }), (0, jsx_runtime_1.jsxs)(antd_1.Typography.Text, { children: ["\u6635\u79F0\uFF1A", (_b = record.granter) === null || _b === void 0 ? void 0 : _b.nickname] })] })));
},
{
dataIndex: 'number',
title: '邀请成员数',
render: function (value, record, index) {
return "".concat(value || 0, "\u4EBA");
},
},
{
dataIndex: 'number',
title: '邀请成员数',
render: function (value, record, index) {
return "".concat(value || 0, "\u4EBA");
},
{
dataIndex: 'confirmed',
title: '加入成员数',
render: function (value, record, index) {
return "".concat(value || 0, "\u4EBA");
},
},
{
dataIndex: 'confirmed',
title: '加入成员数',
render: function (value, record, index) {
return "".concat(value || 0, "\u4EBA");
},
{
dataIndex: 'type',
title: '授权类型',
render: function (value, record, index) {
return t("userEntityGrant:v.type.".concat(value));
},
},
{
dataIndex: 'type',
title: '授权类型',
render: function (value, record, index) {
return t("userEntityGrant:v.type.".concat(value));
},
{
dataIndex: 'relation',
title: '权限',
render: function (value, record, index) {
return value.display || t("".concat(record.entity, ":r.").concat(value.name));
},
},
{
dataIndex: 'relation',
title: '权限',
render: function (value, record, index) {
return (value.display ||
t("".concat(record.entity, ":r.").concat(value.name)));
},
{
dataIndex: '$$createAt$$',
title: '创建时间',
render: function (value, record, index) {
return (0, dayjs_1.default)(value).format('YYYY-MM-DD HH:mm');
},
},
{
dataIndex: '$$createAt$$',
title: '创建时间',
render: function (value, record, index) {
return (0, dayjs_1.default)(value).format('YYYY-MM-DD HH:mm');
},
{
dataIndex: 'expired',
title: '状态',
render: function (value, record, index) {
return ((0, jsx_runtime_1.jsxs)(antd_1.Typography.Text, tslib_1.__assign({ type: record.expired ? 'danger' : 'success' }, { children: [record.expired ? '失效' : '有效', !record.expired && ((0, jsx_runtime_1.jsxs)(antd_1.Typography.Text, { children: ["\u00A0", (0, dayjs_1.default)(record.expiresAt).format('YYYY-MM-DD HH:mm')] }))] })));
},
},
{
dataIndex: 'expired',
title: '状态',
render: function (value, record, index) {
return ((0, jsx_runtime_1.jsxs)(antd_1.Typography.Text, tslib_1.__assign({ type: record.expired ? 'danger' : 'success' }, { children: [record.expired ? '失效' : '有效', !record.expired && ((0, jsx_runtime_1.jsxs)(antd_1.Typography.Text, { children: ["\u00A0", (0, dayjs_1.default)(record.expiresAt).format('YYYY-MM-DD HH:mm')] }))] })));
},
], pagination: {
total: total,
pageSize: pageSize,
current: currentPage,
onShowSizeChange: function (pageSize) {
setPageSize(pageSize);
},
onChange: function (current) {
setCurrentPage(current);
},
} }) })));
},
], pagination: {
total: total,
pageSize: pageSize,
current: currentPage,
onShowSizeChange: function (pageSize) {
setPageSize(pageSize);
},
onChange: function (current) {
setCurrentPage(current);
},
} }));
}
exports.default = render;
function Container(props) {
var children = props.children, _a = props.variant, variant = _a === void 0 ? 'alone' : _a, showBack = props.showBack;
if (['inline', 'dialog'].includes(variant)) {
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children });
}
return ((0, jsx_runtime_1.jsx)(pageHeader_1.default, tslib_1.__assign({ showBack: showBack, title: "\u6388\u6743\u8BB0\u5F55" }, { children: (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.container }, { children: children })) })));
}

View File

@ -40,15 +40,14 @@
},
"peerDependencies": {
"@ant-design/icons": "^4.7.0",
"antd": "^5.2.0",
"antd-mobile": "^5.24.1",
"antd": "^5.8.3",
"antd-mobile": "^5.32.0",
"antd-mobile-icons": "^0.3.0",
"react": ">=18.2.0",
"react-dom": ">=18.1.0",
"react-router-dom": "^6.3.0"
},
"devDependencies": {
"@ant-design/icons": "^4.7.0",
"@babel/cli": "^7.12.13",
"@babel/core": "^7.12.13",
"@babel/plugin-proposal-class-properties": "^7.12.13",
@ -93,9 +92,10 @@
"copy-svg": "copyfiles -u 1 src/**/*.svg lib/ & copyfiles -u 1 src/**/*.png lib/",
"copy-less": "copyfiles -u 1 src/**/*.less lib/ & copyfiles -u 1 src/**/*.wxss lib/",
"copy-wxs": "copyfiles -u 1 src/**/*.wxs lib/",
"copy-xml": "copyfiles -u 1 src/**/*.xml lib/ & copyfiles -u 1 src/**/*.wxml lib/",
"copy-xml": "copyfiles -u 1 src/**/*.xml lib/",
"copy-wxml": "copyfiles -u 1 src/**/*.wxml lib/",
"prebuild": "npm run make:locale",
"build": "tsc && npm run copy-js && npm run copy-less && npm run copy-wxs && npm run copy-svg && npm run copy-xml",
"build": "tsc && npm run copy-js && npm run copy-less && npm run copy-wxs && npm run copy-svg && npm run copy-xml && npm run copy-wxml",
"gen:areaDebug": "ts-node ./scripts/generateAreaDebug.ts",
"gen:subway": "ts-node ./scripts/local/getAmapSubway.ts",
"clean:dir": "ts-node ./scripts/cleanDtsAndJs",

View File

@ -77,7 +77,7 @@ export default OakComponent({
}
else {
this.clean();
this.unsetId();
// this.unsetId();
}
this.setState({
mobileValueReady,

View File

@ -30,7 +30,7 @@ export default function Render(props: WebComponentProps<EntityDict, 'mobile', fa
<Form.Item
label="手机号码"
required
name="mobile"
// name="mobile"
rules={[
{
message: '手机号不能为空',
@ -45,18 +45,16 @@ export default function Render(props: WebComponentProps<EntityDict, 'mobile', fa
},
]}
>
<>
<Input
maxLength={11}
value={mobileValue}
onChange={(e) => {
const strValue = e.target.value;
onMobileChange(strValue);
}}
placeholder="请输入手机号码"
type="tel"
/>
</>
<Input
maxLength={11}
value={mobileValue}
onChange={(e) => {
const strValue = e.target.value;
onMobileChange(strValue);
}}
placeholder="请输入手机号码"
type="tel"
/>
</Form.Item>
</Form>
{mobileValueReady && userId && (

View File

@ -83,94 +83,99 @@ export default function render(
<Form labelCol={{ span: 4 }} wrapperCol={{ span: 8 }}>
<Form.Item
label={t('userEntityGrant:attr.relation')}
name="relation"
rules={[
{
required: true,
},
]}
required
// name="relation"
// rules={[
// {
// required: true,
// },
// ]}
>
<>
<Radio.Group
value={relationId}
onChange={({ target }) => {
const { value } = target;
update({ relationId: value });
}}
options={relations?.map((ele) => ({
value: ele.id,
label: ele.display || t(`${entity as string}:r.${ele.name}`),
}))}
/>
</>
<Radio.Group
value={relationId}
onChange={({ target }) => {
const { value } = target;
update({ relationId: value });
}}
options={relations?.map((ele) => ({
value: ele.id,
label:
ele.display ||
t(`${entity as string}:r.${ele.name}`),
}))}
/>
</Form.Item>
{type === 'grant' && (
<Form.Item
label={t('userEntityGrant:attr.number')}
name="number"
rules={[
{
required: true,
message: t('chooseNumber'),
},
]}
label={t('userEntityGrant:attr.number')}
required
// name="number"
// rules={[
// {
// required: true,
// message: t('chooseNumber'),
// },
// ]}
>
<>
<Radio.Group
value={number}
onChange={({ target }) => {
const { value } = target;
update({ number: value });
}}
options={[
{ value: 1, label: t('single') },
{ value: 10000, label: t('unlimited') },
]}
/>
</>
<Radio.Group
value={number}
onChange={({ target }) => {
const { value } = target;
update({ number: value });
}}
options={[
{ value: 1, label: t('single') },
{ value: 10000, label: t('unlimited') },
]}
/>
</Form.Item>
)}
<Form.Item
label={t('userEntityGrant:attr.expiresAt')}
name="period"
rules={[
{
required: true,
message: t('chooseExpiresAt'),
},
]}
help={<div style={{ marginBottom: 16 }}>{t('expiresHelp')}</div>}
required
// name="period"
// rules={[
// {
// required: true,
// message: t('chooseExpiresAt'),
// },
// ]}
help={
<div style={{ marginBottom: 16 }}>{t('expiresHelp')}</div>
}
tooltip="通过配置实现在规定的时效内扫描二维码不过期的效果。"
>
<>
<InputNumber
min={1}
max={maxes[unit]}
value={period}
onChange={(value) => setPeriod(value!)}
// addonAfter="分钟"
addonAfter={
<Select
value={unit}
style={{ width: 80 }}
onChange={(v) => {
setUnit(v);
}}
>
<Select.Option value="minute">
{t('unit.minute')}
</Select.Option>
<Select.Option value="hour">
{t('unit.hour')}
</Select.Option>
</Select>
}
/>
</>
<InputNumber
min={1}
max={maxes[unit]}
value={period}
onChange={(value) => setPeriod(value!)}
// addonAfter="分钟"
addonAfter={
<Select
value={unit}
style={{ width: 80 }}
onChange={(v) => {
setUnit(v);
}}
>
<Select.Option value="minute">
{t('unit.minute')}
</Select.Option>
<Select.Option value="hour">
{t('unit.hour')}
</Select.Option>
</Select>
}
/>
</Form.Item>
<Form.Item wrapperCol={{ offset: 4 }}>
<Space>
<Button type="primary" onClick={() => confirm()} disabled={oakExecutable !== true}>
<Button
type="primary"
onClick={() => confirm()}
disabled={oakExecutable !== true}
>
{t('common::action.confirm')}
</Button>
<Button onClick={() => onBack()}>

View File

@ -1,39 +0,0 @@
{
"ptrActivate": "松开刷新",
"ptrDeactivate": "下拉刷新",
"ptrRelease": "正在刷新...",
"ptrFinish": "刷新完成",
"noData": "暂无数据",
"areYouSure": "请确认",
"action": {
"create": "创建",
"update": "更新",
"delete": "删除",
"remove": "删除",
"confirm": "确定",
"cancel": "取消",
"grant": "授权",
"revoke": "回收",
"tip": "提示",
"detail": "详情",
"editor": "编辑",
"newAdd": "新增",
"add": "添加"
},
"reset": "重置",
"select": "查询",
"expand": "展开",
"shrink": "收起",
"back": "返回",
"$$createAt$$": "创建时间",
"$$updateAt$$": "更新时间",
"$$deleteAt$$": "删除时间",
"$$seq$$": "序号",
"message": "消息",
"more": "更多",
"view": "查看",
"scan": "扫一扫",
"bind": "绑定",
"true": "是",
"false": "否"
}

View File

@ -2,5 +2,8 @@
.container {
display: flex;
flex-direction: column;
flex: 1;
justify-content: center;
background-color: var(--oak-bg-color-page);
height: 100%;
}

View File

@ -74,7 +74,7 @@ export default OakComponent({
methods: {
async getUserRelations() {
// 检查当前登陆者跟该授权实体缩手所受relation有关系了(todo)
const { entity, entityId, relationId} = this.state;
const { entity, entityId, relationId } = this.state;
const userId = this.features.token.getUserId(true);
if (!userId) {
return;
@ -137,7 +137,7 @@ export default OakComponent({
state
);
return;
}
}
this.redirectTo(
{
url,

View File

@ -10,7 +10,7 @@
<view class="title">
{{granter.name || granter.nickname}}
授予您【
{{relation ? t(entity + ':r.' + relation) : ''}}
{{relation.display || relation ? t(entity + ':r.' + relation.name) : ''}}
</view>
</block>
@ -18,7 +18,7 @@
<view class="title">
{{granter.name || granter.nickname}}
转让您【
{{relation ? t(entity + ':r.' + relation) : ''}}
{{relation.display || relation ? t(entity + ':r.' + relation.name) : ''}}
</view>
</block>

View File

@ -2,7 +2,7 @@ import React, { Component } from 'react';
import { Button, Space } from 'antd';
import Style from './web.module.less';
import { UserAddOutlined, UserSwitchOutlined } from '@ant-design/icons';
import { isWeiXin } from 'oak-frontend-base/lib/utils/utils';
import { WebComponentProps } from 'oak-frontend-base';
@ -16,7 +16,7 @@ export default function Render(
{
type: 'grant';
expired: boolean;
relation: boolean;
relation: EntityDict['relation']['Schema'];
expiresAt: boolean;
granter?: {
name: string;
@ -59,7 +59,7 @@ export default function Render(
const getRelationTip = () => {
let str = `${granter?.name || granter?.nickname}`;
const relationStr = relation ? t(`${entity}:r.${relation}`) : '';
const relationStr = relation?.display || relation ? t(`${entity}:r.${relation?.name}`) : '';
if (type === 'grant') {
str = str.concat('授予您【').concat(relationStr).concat('】');
return str;

View File

@ -2,7 +2,6 @@ import * as React from 'react';
import { Table, Space, Typography } from 'antd';
import dayjs from 'dayjs';
import { WebComponentProps } from 'oak-frontend-base';
import PageHeader from '../../../components/common/pageHeader';
import { EntityDict } from '../../../oak-app-domain';
import Style from './web.module.less';
@ -12,11 +11,7 @@ export default function render(
'userEntityGrant',
true,
{
searchValue: string;
list: EntityDict['userEntityGrant']['Schema'][];
pagination: any;
showBack: boolean;
variant?: 'inline' | 'alone' | 'dialog';
},
{}
>
@ -26,8 +21,6 @@ export default function render(
oakFullpath,
list = [],
oakLoading,
showBack,
variant,
} = props.data;
const { pageSize, total, currentPage } = oakPagination || {};
@ -35,120 +28,105 @@ export default function render(
const { t, setPageSize, setCurrentPage } = props.methods;
return (
<Container showBack={showBack} variant={variant}>
<Table
loading={oakLoading}
dataSource={list}
rowKey="id"
columns={[
// {
// dataIndex: 'id',
// title: '序号',
// render: (value, record, index) => {
// return index + 1;
// },
// },
{
dataIndex: 'name',
title: '授权人',
render: (value, record, index) => {
return (
<Space direction="vertical">
<Typography.Text>
{record.granter?.name || '-'}
</Typography.Text>
<Typography.Text>
{record.granter?.nickname}
</Typography.Text>
</Space>
);
},
},
{
dataIndex: 'number',
title: '邀请成员数',
render: (value, record, index) => {
return `${value || 0}`;
},
},
{
dataIndex: 'confirmed',
title: '加入成员数',
render: (value, record, index) => {
return `${value || 0}`;
},
},
{
dataIndex: 'type',
title: '授权类型',
render: (value, record, index) => {
return t(`userEntityGrant:v.type.${value}`);
},
},
{
dataIndex: 'relation',
title: '权限',
render: (value, record, index) => {
return value.display || t(`${record.entity}:r.${value.name}`);
},
},
{
dataIndex: '$$createAt$$',
title: '创建时间',
render: (value, record, index) => {
return dayjs(value).format('YYYY-MM-DD HH:mm');
},
},
{
dataIndex: 'expired',
title: '状态',
render: (value, record, index) => {
return (
<Typography.Text
type={record.expired ? 'danger' : 'success'}
>
{record.expired ? '失效' : '有效'}
{!record.expired && (
<Typography.Text>
&nbsp;
{dayjs(record.expiresAt).format(
'YYYY-MM-DD HH:mm'
)}
</Typography.Text>
)}
<Table
loading={oakLoading}
dataSource={list}
rowKey="id"
columns={[
// {
// dataIndex: 'id',
// title: '序号',
// render: (value, record, index) => {
// return index + 1;
// },
// },
{
dataIndex: 'name',
title: '授权人',
render: (value, record, index) => {
return (
<Space direction="vertical">
<Typography.Text>
{record.granter?.name || '-'}
</Typography.Text>
);
},
<Typography.Text>
{record.granter?.nickname}
</Typography.Text>
</Space>
);
},
]}
pagination={{
total,
pageSize,
current: currentPage,
onShowSizeChange: (pageSize: number) => {
setPageSize(pageSize);
},
{
dataIndex: 'number',
title: '邀请成员数',
render: (value, record, index) => {
return `${value || 0}`;
},
onChange: (current: number) => {
setCurrentPage(current);
},
{
dataIndex: 'confirmed',
title: '加入成员数',
render: (value, record, index) => {
return `${value || 0}`;
},
}}
/>
</Container>
);
}
function Container(props: {
children: React.ReactNode;
variant?: 'inline' | 'alone' | 'dialog';
showBack?: boolean;
}) {
const { children, variant = 'alone', showBack } = props;
if (['inline', 'dialog'].includes(variant)) {
return <>{children}</>;
}
return (
<PageHeader showBack={showBack} title="授权记录">
<div className={Style.container}>{children}</div>
</PageHeader>
},
{
dataIndex: 'type',
title: '授权类型',
render: (value, record, index) => {
return t(`userEntityGrant:v.type.${value}`);
},
},
{
dataIndex: 'relation',
title: '权限',
render: (value, record, index) => {
return (
value.display ||
t(`${record.entity}:r.${value.name}`)
);
},
},
{
dataIndex: '$$createAt$$',
title: '创建时间',
render: (value, record, index) => {
return dayjs(value).format('YYYY-MM-DD HH:mm');
},
},
{
dataIndex: 'expired',
title: '状态',
render: (value, record, index) => {
return (
<Typography.Text
type={record.expired ? 'danger' : 'success'}
>
{record.expired ? '失效' : '有效'}
{!record.expired && (
<Typography.Text>
&nbsp;
{dayjs(record.expiresAt).format(
'YYYY-MM-DD HH:mm'
)}
</Typography.Text>
)}
</Typography.Text>
);
},
},
]}
pagination={{
total,
pageSize,
current: currentPage,
onShowSizeChange: (pageSize: number) => {
setPageSize(pageSize);
},
onChange: (current: number) => {
setCurrentPage(current);
},
}}
/>
);
}