diff --git a/lib/checkers/userEntityGrant.js b/lib/checkers/userEntityGrant.js
index 625ce67c9..57c9744de 100644
--- a/lib/checkers/userEntityGrant.js
+++ b/lib/checkers/userEntityGrant.js
@@ -16,9 +16,16 @@ var checkers = [
data = operation.data;
if (data instanceof Array) {
data.forEach(function (ele) {
- (0, validator_1.checkAttributesNotNull)('userEntityGrant', ele, ['type', 'entity', 'entityId', 'relation']);
+ (0, validator_1.checkAttributesNotNull)('userEntityGrant', ele, [
+ 'type',
+ 'entity',
+ 'entityId',
+ 'relation',
+ ]);
if (ele.type === 'grant') {
- (0, validator_1.checkAttributesNotNull)('userEntityGrant', ele, ['number']);
+ (0, validator_1.checkAttributesNotNull)('userEntityGrant', ele, [
+ 'number',
+ ]);
if (ele.number <= 0) {
throw new types_1.OakInputIllegalException('userEntityGrant', ['number', '分享的权限数量必须大于0']);
}
@@ -29,11 +36,19 @@ var checkers = [
});
}
else {
- (0, validator_1.checkAttributesNotNull)('userEntityGrant', data, ['type', 'entity', 'entityId', 'relation']);
+ (0, validator_1.checkAttributesNotNull)('userEntityGrant', data, [
+ 'type',
+ 'entity',
+ 'entityId',
+ 'relation',
+ ]);
if (data.type === 'grant') {
(0, validator_1.checkAttributesNotNull)('userEntityGrant', data, ['number']);
if (data.number <= 0) {
- throw new types_1.OakInputIllegalException('userEntityGrant', ['number', '分享的权限数量必须大于0']);
+ throw new types_1.OakInputIllegalException('userEntityGrant', [
+ 'number',
+ '分享的权限数量必须大于0',
+ ]);
}
}
Object.assign(data, {
@@ -45,5 +60,40 @@ var checkers = [
});
},
},
+ {
+ type: 'row',
+ entity: 'userEntityGrant',
+ action: ['disable'],
+ checker: function (event, context, params) { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
+ var filter, rowStore, _a, userEntityGrant;
+ return tslib_1.__generator(this, function (_b) {
+ switch (_b.label) {
+ case 0:
+ filter = event.operation.filter;
+ rowStore = context.rowStore;
+ return [4 /*yield*/, rowStore.select('userEntityGrant', {
+ data: {
+ id: 1,
+ expired: 1,
+ },
+ filter: {
+ id: filter === null || filter === void 0 ? void 0 : filter.id,
+ },
+ indexFrom: 0,
+ count: 1,
+ }, context, params)];
+ case 1:
+ _a = tslib_1.__read.apply(void 0, [(_b.sent()).result, 1]), userEntityGrant = _a[0];
+ if (!(userEntityGrant === null || userEntityGrant === void 0 ? void 0 : userEntityGrant.expired)) {
+ return [2 /*return*/, 1];
+ }
+ else {
+ throw new types_1.OakUserUnpermittedException();
+ }
+ return [2 /*return*/];
+ }
+ });
+ }); },
+ },
];
exports.default = checkers;
diff --git a/lib/components/userEntityGrant/cellButton/index.d.ts b/lib/components/userEntityGrant/cellButton/index.d.ts
new file mode 100644
index 000000000..42765aac1
--- /dev/null
+++ b/lib/components/userEntityGrant/cellButton/index.d.ts
@@ -0,0 +1,3 @@
+///
+declare const _default: import("react").ComponentType;
+export default _default;
diff --git a/lib/components/userEntityGrant/cellButton/index.js b/lib/components/userEntityGrant/cellButton/index.js
new file mode 100644
index 000000000..9685f5825
--- /dev/null
+++ b/lib/components/userEntityGrant/cellButton/index.js
@@ -0,0 +1,53 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var tslib_1 = require("tslib");
+exports.default = OakComponent({
+ entity: 'userEntityGrant',
+ isList: false,
+ formData: function (_a) {
+ var data = _a.data;
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
+ return tslib_1.__generator(this, function (_b) {
+ return [2 /*return*/, {}];
+ });
+ });
+ },
+ actions: ['disable'],
+ methods: {
+ tapAction: function (action) {
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
+ var id, _a;
+ return tslib_1.__generator(this, function (_b) {
+ switch (_b.label) {
+ case 0:
+ id = this.props.oakId;
+ _a = action;
+ switch (_a) {
+ case 'disable': return [3 /*break*/, 1];
+ }
+ return [3 /*break*/, 3];
+ case 1: return [4 /*yield*/, this.addOperation({
+ action: 'disable',
+ data: {
+ expired: true
+ },
+ filter: {
+ id: id,
+ },
+ })];
+ case 2:
+ _b.sent();
+ this.execute();
+ return [3 /*break*/, 4];
+ case 3:
+ {
+ return [3 /*break*/, 4];
+ }
+ _b.label = 4;
+ case 4: return [2 /*return*/];
+ }
+ });
+ });
+ },
+ },
+});
diff --git a/lib/components/userEntityGrant/cellButton/web.d.ts b/lib/components/userEntityGrant/cellButton/web.d.ts
new file mode 100644
index 000000000..a9cb6ae3b
--- /dev/null
+++ b/lib/components/userEntityGrant/cellButton/web.d.ts
@@ -0,0 +1 @@
+export default function render(this: any): any;
diff --git a/lib/components/userEntityGrant/cellButton/web.js b/lib/components/userEntityGrant/cellButton/web.js
new file mode 100644
index 000000000..28bf035f4
--- /dev/null
+++ b/lib/components/userEntityGrant/cellButton/web.js
@@ -0,0 +1,39 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+var tslib_1 = require("tslib");
+var jsx_runtime_1 = require("react/jsx-runtime");
+var antd_1 = require("antd");
+function render() {
+ var _this = this;
+ var oakLegalActions = this.state.oakLegalActions;
+ return (oakLegalActions === null || oakLegalActions === void 0 ? void 0 : oakLegalActions.length) > 0
+ ? oakLegalActions.map(function (ele) {
+ var btnName = _this.t("userEntityGrant:action.".concat(ele));
+ if (ele === 'remove') {
+ btnName = _this.t("common:action.".concat(ele));
+ }
+ return ((0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ type: "link", onClick: function (event) {
+ var modal = antd_1.Modal.confirm({
+ title: "\u786E\u8BA4".concat(btnName, "\u8BE5\u6388\u6743\u8BB0\u5F55\u5417\uFF1F"),
+ okText: '确定',
+ cancelText: '取消',
+ onOk: function (e) { 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*/, this.tapAction(ele)];
+ case 1:
+ _a.sent();
+ modal.destroy();
+ return [2 /*return*/];
+ }
+ });
+ }); },
+ onCancel: function (e) {
+ modal.destroy();
+ },
+ });
+ } }, { children: btnName })));
+ })
+ : null;
+}
+exports.default = render;
diff --git a/lib/components/userEntityGrant/cellButton/web.module.less b/lib/components/userEntityGrant/cellButton/web.module.less
new file mode 100644
index 000000000..e69de29bb
diff --git a/lib/general-app-domain/UserEntityGrant/Action.d.ts b/lib/general-app-domain/UserEntityGrant/Action.d.ts
index b50514661..6e244e47e 100644
--- a/lib/general-app-domain/UserEntityGrant/Action.d.ts
+++ b/lib/general-app-domain/UserEntityGrant/Action.d.ts
@@ -1,6 +1,6 @@
import { GenericAction } from "oak-domain/lib/actions/action";
-export declare type ParticularAction = 'confirm';
+export declare type ParticularAction = 'confirm' | 'disable';
export declare type Action = GenericAction | ParticularAction;
export declare const actions: string[];
-export declare type IState = 'init';
+export declare type IState = 'effective' | 'invalid';
export declare const ActionDefDict: {};
diff --git a/lib/general-app-domain/UserEntityGrant/Action.js b/lib/general-app-domain/UserEntityGrant/Action.js
index 261fcdfe0..d62d3247f 100644
--- a/lib/general-app-domain/UserEntityGrant/Action.js
+++ b/lib/general-app-domain/UserEntityGrant/Action.js
@@ -1,5 +1,5 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ActionDefDict = exports.actions = void 0;
-exports.actions = ["count", "stat", "download", "select", "create", "remove", "update", "confirm"];
+exports.actions = ["count", "stat", "download", "select", "create", "remove", "update", "confirm", "disable"];
exports.ActionDefDict = {};
diff --git a/lib/general-app-domain/UserEntityGrant/locales/zh_CN.json b/lib/general-app-domain/UserEntityGrant/locales/zh_CN.json
index 656742ec9..ff8872c04 100644
--- a/lib/general-app-domain/UserEntityGrant/locales/zh_CN.json
+++ b/lib/general-app-domain/UserEntityGrant/locales/zh_CN.json
@@ -1 +1 @@
-{ "attr": { "relation": "关系", "entity": "关联对象", "entityId": "关联对象id", "type": "类型", "number": "次数", "confirmed": "已确认人数", "remark": "备注", "grantee": "领取人", "granter": "授权人", "files": "微信码", "expired": "是否过期", "expiresAt": "过期时间", "iState": "状态" }, "action": { "confirm": "确认" }, "v": { "type": { "grant": "授予", "transfer": "转交" }, "iState": { "init": "初始" } } }
+{ "attr": { "relation": "关系", "entity": "关联对象", "entityId": "关联对象id", "type": "类型", "number": "次数", "confirmed": "已确认人数", "remark": "备注", "grantee": "领取人", "granter": "授权人", "files": "微信码", "expired": "是否过期", "expiresAt": "过期时间", "iState": "状态" }, "action": { "confirm": "确认", "disable": "禁用" }, "v": { "type": { "grant": "授予", "transfer": "转交" }, "iState": { "effective": "有效", "invalid": "失效" } } }
diff --git a/lib/pages/article/list/web.module.less b/lib/pages/article/list/web.module.less
index e69de29bb..9f3d17c7f 100644
--- a/lib/pages/article/list/web.module.less
+++ b/lib/pages/article/list/web.module.less
@@ -0,0 +1,6 @@
+.container {
+ background: var(--oak-bg-color-container);
+ box-shadow: 0 2px 3px #0000001a;
+ border-radius: 3px;
+ padding: 30px 32px;
+}
\ No newline at end of file
diff --git a/lib/pages/system/config/upsert/web.module.less b/lib/pages/system/config/upsert/web.module.less
new file mode 100644
index 000000000..9f3d17c7f
--- /dev/null
+++ b/lib/pages/system/config/upsert/web.module.less
@@ -0,0 +1,6 @@
+.container {
+ background: var(--oak-bg-color-container);
+ box-shadow: 0 2px 3px #0000001a;
+ border-radius: 3px;
+ padding: 30px 32px;
+}
\ No newline at end of file
diff --git a/lib/pages/system/detail/web.module.less b/lib/pages/system/detail/web.module.less
new file mode 100644
index 000000000..9f3d17c7f
--- /dev/null
+++ b/lib/pages/system/detail/web.module.less
@@ -0,0 +1,6 @@
+.container {
+ background: var(--oak-bg-color-container);
+ box-shadow: 0 2px 3px #0000001a;
+ border-radius: 3px;
+ padding: 30px 32px;
+}
\ No newline at end of file
diff --git a/lib/pages/system/list/web.module.less b/lib/pages/system/list/web.module.less
new file mode 100644
index 000000000..9f3d17c7f
--- /dev/null
+++ b/lib/pages/system/list/web.module.less
@@ -0,0 +1,6 @@
+.container {
+ background: var(--oak-bg-color-container);
+ box-shadow: 0 2px 3px #0000001a;
+ border-radius: 3px;
+ padding: 30px 32px;
+}
\ No newline at end of file
diff --git a/lib/pages/system/upsert/web.module.less b/lib/pages/system/upsert/web.module.less
new file mode 100644
index 000000000..9f3d17c7f
--- /dev/null
+++ b/lib/pages/system/upsert/web.module.less
@@ -0,0 +1,6 @@
+.container {
+ background: var(--oak-bg-color-container);
+ box-shadow: 0 2px 3px #0000001a;
+ border-radius: 3px;
+ padding: 30px 32px;
+}
\ No newline at end of file
diff --git a/lib/pages/userEntityGrant/list/web.js b/lib/pages/userEntityGrant/list/web.js
index c8504f7cd..406024d7d 100644
--- a/lib/pages/userEntityGrant/list/web.js
+++ b/lib/pages/userEntityGrant/list/web.js
@@ -5,6 +5,7 @@ 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 cellButton_1 = tslib_1.__importDefault(require("../../../components/userEntityGrant/cellButton"));
var web_module_less_1 = tslib_1.__importDefault(require("./web.module.less"));
function render() {
var _this = this;
@@ -68,12 +69,7 @@ function render() {
title: '操作',
align: 'center',
render: function (value, record, index) {
- return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ type: "link", onClick: function () {
- _this.setMessage({
- type: 'warning',
- content: '尚未实现'
- });
- } }, { children: "\u7981\u7528" })) }));
+ return ((0, jsx_runtime_1.jsx)(cellButton_1.default, { oakId: record.id, oakPath: "".concat(_this.state.oakFullpath, ".").concat(record.id) }));
},
fixed: 'right',
},
diff --git a/lib/pages/userEntityGrant/list/web.module.less b/lib/pages/userEntityGrant/list/web.module.less
new file mode 100644
index 000000000..9f3d17c7f
--- /dev/null
+++ b/lib/pages/userEntityGrant/list/web.module.less
@@ -0,0 +1,6 @@
+.container {
+ background: var(--oak-bg-color-container);
+ box-shadow: 0 2px 3px #0000001a;
+ border-radius: 3px;
+ padding: 30px 32px;
+}
\ No newline at end of file
diff --git a/package.json b/package.json
index 8903651c9..bde45325a 100644
--- a/package.json
+++ b/package.json
@@ -15,7 +15,7 @@
"@uiw/react-amap": "^4.0.2",
"@wangeditor/editor": "^5.1.22",
"@wangeditor/editor-for-react": "^1.0.4",
- "antd": "^4.23.6",
+ "antd": "^4.24.2",
"antd-mobile": "^5.24.1",
"antd-mobile-icons": "^0.3.0",
"classnames": "^2.3.1",
diff --git a/src/checkers/userEntityGrant.ts b/src/checkers/userEntityGrant.ts
index 5d3d3dbd3..6dca18ec2 100644
--- a/src/checkers/userEntityGrant.ts
+++ b/src/checkers/userEntityGrant.ts
@@ -1,5 +1,9 @@
import {
- Checker, CreateChecker, OakInputIllegalException,
+ Checker,
+ CreateChecker,
+ UpdateChecker,
+ OakInputIllegalException,
+ OakUserUnpermittedException,
} from 'oak-domain/lib/types';
import { EntityDict } from '../general-app-domain';
import { RuntimeContext } from '../context/RuntimeContext';
@@ -14,30 +18,45 @@ const checkers: Checker<
type: 'data',
action: 'create',
entity: 'userEntityGrant',
- checker: async ({ operation }, context) => {
+ checker: async ({ operation }, context) => {
const { data } = operation;
if (data instanceof Array) {
- data.forEach(
- ele => {
- checkAttributesNotNull('userEntityGrant', ele, ['type', 'entity', 'entityId', 'relation']);
- if (ele.type === 'grant') {
- checkAttributesNotNull('userEntityGrant', ele, ['number']);
- if (ele.number <= 0 ) {
- throw new OakInputIllegalException('userEntityGrant', ['number', '分享的权限数量必须大于0']);
- }
+ data.forEach((ele) => {
+ checkAttributesNotNull('userEntityGrant', ele, [
+ 'type',
+ 'entity',
+ 'entityId',
+ 'relation',
+ ]);
+ if (ele.type === 'grant') {
+ checkAttributesNotNull('userEntityGrant', ele, [
+ 'number',
+ ]);
+ if (ele.number <= 0) {
+ throw new OakInputIllegalException(
+ 'userEntityGrant',
+ ['number', '分享的权限数量必须大于0']
+ );
}
- Object.assign(ele, {
- confirmed: 0,
- });
}
- );
- }
- else {
- checkAttributesNotNull('userEntityGrant', data, ['type', 'entity', 'entityId', 'relation']);
+ Object.assign(ele, {
+ confirmed: 0,
+ });
+ });
+ } else {
+ checkAttributesNotNull('userEntityGrant', data, [
+ 'type',
+ 'entity',
+ 'entityId',
+ 'relation',
+ ]);
if (data.type === 'grant') {
checkAttributesNotNull('userEntityGrant', data, ['number']);
- if (data.number <= 0 ) {
- throw new OakInputIllegalException('userEntityGrant', ['number', '分享的权限数量必须大于0']);
+ if (data.number <= 0) {
+ throw new OakInputIllegalException('userEntityGrant', [
+ 'number',
+ '分享的权限数量必须大于0',
+ ]);
}
}
Object.assign(data, {
@@ -46,8 +65,49 @@ const checkers: Checker<
}
return 0;
},
- } as CreateChecker
->,
+ } as CreateChecker<
+ EntityDict,
+ 'userEntityGrant',
+ RuntimeContext
+ >,
+ {
+ type: 'row',
+ entity: 'userEntityGrant',
+ action: ['disable'],
+ checker: async (event, context, params) => {
+ const {
+ operation: { filter },
+ } = event;
+ const { rowStore } = context;
+ const {
+ result: [userEntityGrant],
+ } = await rowStore.select(
+ 'userEntityGrant',
+ {
+ data: {
+ id: 1,
+ expired: 1,
+ },
+ filter: {
+ id: filter?.id!,
+ },
+ indexFrom: 0,
+ count: 1,
+ },
+ context,
+ params
+ );
+ if (!userEntityGrant?.expired) {
+ return 1;
+ } else {
+ throw new OakUserUnpermittedException();
+ }
+ },
+ } as UpdateChecker<
+ EntityDict,
+ 'userEntityGrant',
+ RuntimeContext
+ >,
];
export default checkers;
diff --git a/src/components/userEntityGrant/cellButton/index.ts b/src/components/userEntityGrant/cellButton/index.ts
new file mode 100644
index 000000000..cf3fbd558
--- /dev/null
+++ b/src/components/userEntityGrant/cellButton/index.ts
@@ -0,0 +1,42 @@
+export default OakComponent({
+ entity: 'userEntityGrant',
+ isList: false,
+ async formData({ data }) {
+ return {};
+ },
+ actions: ['disable'],
+ methods: {
+ async tapAction(action: string) {
+ const { oakId: id } = this.props;
+ switch (action) {
+ case 'disable': {
+ await this.addOperation({
+ action: 'disable',
+ data: {
+ expired: true,
+ },
+ filter: {
+ id,
+ },
+ });
+ this.execute();
+ break;
+ }
+ // case 'remove': {
+ // await this.addOperation({
+ // action: 'remove',
+ // data: {},
+ // filter: {
+ // id,
+ // },
+ // });
+ // this.execute();
+ // break;
+ // }
+ default: {
+ break;
+ }
+ }
+ },
+ },
+});
diff --git a/src/components/userEntityGrant/cellButton/web.module.less b/src/components/userEntityGrant/cellButton/web.module.less
new file mode 100644
index 000000000..e69de29bb
diff --git a/src/components/userEntityGrant/cellButton/web.tsx b/src/components/userEntityGrant/cellButton/web.tsx
new file mode 100644
index 000000000..2128b4efc
--- /dev/null
+++ b/src/components/userEntityGrant/cellButton/web.tsx
@@ -0,0 +1,36 @@
+import React from 'react';
+import { Button, Modal } from 'antd';
+
+export default function render(this: any) {
+ const { oakLegalActions } = this.state;
+
+ return oakLegalActions?.length > 0
+ ? oakLegalActions.map((ele: string) => {
+ let btnName = this.t(`userEntityGrant:action.${ele}`);
+ if (ele === 'remove') {
+ btnName = this.t(`common:action.${ele}`);
+ }
+ return (
+
+ );
+ })
+ : null;
+}
diff --git a/src/pages/userEntityGrant/list/index.ts b/src/pages/userEntityGrant/list/index.ts
index bd702dc29..cbb8a2d84 100644
--- a/src/pages/userEntityGrant/list/index.ts
+++ b/src/pages/userEntityGrant/list/index.ts
@@ -31,6 +31,17 @@ export default OakComponent({
},
},
],
+ sorters: [
+ {
+ sorter: {
+ $attr: {
+ $$createAt$$: 1,
+ },
+ $direction: 'desc',
+ },
+ "#name": 'default'
+ },
+ ],
async formData({ data }) {
const pagination = this.getPagination();
return {
@@ -41,7 +52,5 @@ export default OakComponent({
data: {
open: false,
},
- methods: {
-
- },
+ methods: {},
});
diff --git a/src/pages/userEntityGrant/list/web.tsx b/src/pages/userEntityGrant/list/web.tsx
index 9204bf48c..eb86910f7 100644
--- a/src/pages/userEntityGrant/list/web.tsx
+++ b/src/pages/userEntityGrant/list/web.tsx
@@ -2,6 +2,7 @@ import * as React from 'react';
import { Table, Button, Space, Typography, Modal } from 'antd';
import dayjs from 'dayjs';
import PageHeader from '../../../components/common/pageHeader';
+import CellButton from '../../../components/userEntityGrant/cellButton';
import Style from './web.module.less';
@@ -74,8 +75,16 @@ export default function render(this: any) {
title: '状态',
render: (value, record, index) => {
return (
-
+
{record.expired ? '失效' : '有效'}
+ {!record.expired && (
+
+
+ {dayjs(record.expireAt).format('YYYY-MM-DD HH:mm')}
+
+ )}
);
},
@@ -87,16 +96,7 @@ export default function render(this: any) {
align: 'center',
render: (value, record, index) => {
return (
- <>
-
- >
+
);
},
fixed: 'right',