message 增加platformId

This commit is contained in:
Wang Kejun 2023-09-08 16:18:03 +08:00
parent de261f3ce9
commit bfe63596fc
94 changed files with 658 additions and 544 deletions

View File

@ -1,5 +1,6 @@
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
import { Form, Input, Tabs } from 'antd';
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { Space, Form, Input, Button, Tabs, ColorPicker } from 'antd';
import { ClearOutlined } from '@ant-design/icons';
import { set, get } from 'oak-domain/lib/utils/lodash';
const Colors = ['primary', 'success', 'error', 'warning', 'info'];
function Color(props) {
@ -7,10 +8,13 @@ function Color(props) {
;
return (_jsx(Form, { children: Colors.map((ele) => (_jsx(Form.Item, { label: ele,
// required
// name="folder"
tooltip: `设置系统【${ele}】颜色`, children: _jsx(_Fragment, { children: _jsx(Input, { onChange: (e) => {
setValue(ele, e.target.value);
}, value: get(value, ele) }) }) }, ele))) }));
tooltip: `设置系统【${ele}】颜色`, children: _jsxs(Space.Compact, { block: true, children: [_jsx(ColorPicker, { onChangeComplete: (color) => {
setValue(ele, color.toHexString());
}, children: _jsx(Input, { value: get(value, ele), readOnly: true, onChange: (e) => {
setValue(ele, e.target.value);
} }) }), _jsx(Button, { icon: _jsx(ClearOutlined, {}), onClick: (e) => {
setValue(ele, '');
} })] }) }, ele))) }));
}
export default function Render(props) {
const { value: styleValue, onChange } = props;

View File

@ -6,7 +6,9 @@ export const users = [
name: 'root',
isRoot: true,
id: ROOT_USER_ID,
}
userState: 'shadow',
idState: 'unverified',
},
];
export const mobiles = [
{

View File

@ -2,6 +2,7 @@ import { String, Text } from 'oak-domain/lib/types/DataType';
import { Schema as User } from './User';
import { EntityShape } from 'oak-domain/lib/types/Entity';
import { Channel, Weight } from '../types/Message';
import { Schema as Platform } from './Platform';
declare type Router = {
pathname: string;
props?: Record<string, any>;
@ -23,5 +24,6 @@ export interface Schema extends EntityShape {
content: Text;
data?: Object;
router?: Router;
platform?: Platform;
}
export {};

View File

@ -28,6 +28,7 @@ const entityDesc = {
visitState: '访问状态',
router: '目标路由',
data: '透传数据',
platform: '平台',
},
action: {
succeed: '成功',
@ -51,6 +52,6 @@ const entityDesc = {
},
},
},
}
},
};
export {};

View File

@ -2,4 +2,5 @@ import { String } from 'oak-domain/lib/types/DataType';
import { EntityShape } from 'oak-domain/lib/types/Entity';
export interface Schema extends EntityShape {
type: String<64>;
display?: String<64>;
}

View File

@ -5,8 +5,9 @@ const entityDesc = {
name: '消息类型',
attr: {
type: '类型',
display: '显示值',
},
},
}
},
};
export {};

View File

@ -7,6 +7,7 @@ import { String, Text } from "oak-domain/lib/types/DataType";
import { EntityShape } from "oak-domain/lib/types/Entity";
import { Channel, Weight } from "../../types/Message";
import * as User from "../User/Schema";
import * as Platform from "../Platform/Schema";
import * as MessageSystem from "../MessageSystem/Schema";
declare type Router = {
pathname: string;
@ -29,6 +30,7 @@ export declare type OpSchema = EntityShape & {
content: Text;
data?: Object | null;
router?: Router | null;
platformId?: ForeignKey<"platform"> | null;
iState?: IState | null;
visitState?: VisitState | null;
};
@ -44,9 +46,11 @@ export declare type Schema = EntityShape & {
content: Text;
data?: Object | null;
router?: Router | null;
platformId?: ForeignKey<"platform"> | null;
iState?: IState | null;
visitState?: VisitState | null;
user: User.Schema;
platform?: Platform.Schema | null;
messageSystem$message?: Array<MessageSystem.Schema>;
messageSystem$message$$aggr?: AggregationResult<MessageSystem.Schema>;
} & {
@ -68,6 +72,8 @@ declare type AttrFilter = {
content: Q_StringValue;
data: Object;
router: JsonFilter<Router>;
platformId: Q_StringValue;
platform: Platform.Filter;
iState: Q_EnumValue<IState>;
visitState: Q_EnumValue<VisitState>;
messageSystem$message: MessageSystem.Filter & SubQueryPredicateMetadata;
@ -91,6 +97,8 @@ export declare type Projection = {
content?: number;
data?: number | Object;
router?: number | JsonProjection<Router>;
platformId?: number;
platform?: Platform.Projection;
iState?: number;
visitState?: number;
messageSystem$message?: MessageSystem.Selection & {
@ -106,6 +114,9 @@ declare type MessageIdProjection = OneOf<{
declare type UserIdProjection = OneOf<{
userId: number;
}>;
declare type PlatformIdProjection = OneOf<{
platformId: number;
}>;
export declare type SortAttr = {
id: number;
} | {
@ -134,6 +145,10 @@ export declare type SortAttr = {
content: number;
} | {
router: number;
} | {
platformId: number;
} | {
platform: Platform.SortAttr;
} | {
iState: number;
} | {
@ -149,7 +164,7 @@ export declare type Sorter = SortNode[];
export declare type SelectOperation<P extends Object = Projection> = OakSelection<"select", P, Filter, Sorter>;
export declare type Selection<P extends Object = Projection> = SelectOperation<P>;
export declare type Aggregation = DeduceAggregation<Projection, Filter, Sorter>;
export declare type CreateOperationData = FormCreateData<Omit<OpSchema, "entity" | "entityId" | "userId">> & (({
export declare type CreateOperationData = FormCreateData<Omit<OpSchema, "entity" | "entityId" | "userId" | "platformId">> & (({
userId?: never;
user: User.CreateSingleOperation;
} | {
@ -157,6 +172,14 @@ export declare type CreateOperationData = FormCreateData<Omit<OpSchema, "entity"
user?: User.UpdateOperation;
} | {
userId: ForeignKey<"user">;
}) & ({
platformId?: never;
platform?: Platform.CreateSingleOperation;
} | {
platformId: ForeignKey<"platform">;
platform?: Platform.UpdateOperation;
} | {
platformId?: ForeignKey<"platform">;
})) & ({
entity?: string;
entityId?: string;
@ -167,7 +190,7 @@ export declare type CreateOperationData = FormCreateData<Omit<OpSchema, "entity"
export declare type CreateSingleOperation = OakOperation<"create", CreateOperationData>;
export declare type CreateMultipleOperation = OakOperation<"create", Array<CreateOperationData>>;
export declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation;
export declare type UpdateOperationData = FormUpdateData<Omit<OpSchema, "userId">> & (({
export declare type UpdateOperationData = FormUpdateData<Omit<OpSchema, "userId" | "platformId">> & (({
user: User.CreateSingleOperation;
userId?: never;
} | {
@ -179,6 +202,18 @@ export declare type UpdateOperationData = FormUpdateData<Omit<OpSchema, "userId"
} | {
user?: never;
userId?: ForeignKey<"user"> | null;
}) & ({
platform: Platform.CreateSingleOperation;
platformId?: never;
} | {
platform: Platform.UpdateOperation;
platformId?: never;
} | {
platform: Platform.RemoveOperation;
platformId?: never;
} | {
platform?: never;
platformId?: ForeignKey<"platform"> | null;
})) & {
[k: string]: any;
messageSystem$message?: OakOperation<MessageSystem.UpdateOperation["action"], Omit<MessageSystem.UpdateOperationData, "message" | "messageId">, Omit<MessageSystem.Filter, "message" | "messageId">> | OakOperation<MessageSystem.RemoveOperation["action"], Omit<MessageSystem.RemoveOperationData, "message" | "messageId">, Omit<MessageSystem.Filter, "message" | "messageId">> | OakOperation<"create", Omit<MessageSystem.CreateOperationData, "message" | "messageId">[]> | Array<OakOperation<"create", Omit<MessageSystem.CreateOperationData, "message" | "messageId">> | OakOperation<MessageSystem.UpdateOperation["action"], Omit<MessageSystem.UpdateOperationData, "message" | "messageId">, Omit<MessageSystem.Filter, "message" | "messageId">> | OakOperation<MessageSystem.RemoveOperation["action"], Omit<MessageSystem.RemoveOperationData, "message" | "messageId">, Omit<MessageSystem.Filter, "message" | "messageId">>>;
@ -186,10 +221,13 @@ export declare type UpdateOperationData = FormUpdateData<Omit<OpSchema, "userId"
export declare type UpdateOperation = OakOperation<"update" | ParticularAction | string, UpdateOperationData, Filter, Sorter>;
export declare type RemoveOperationData = {} & (({
user?: User.UpdateOperation | User.RemoveOperation;
}) & ({
platform?: Platform.UpdateOperation | Platform.RemoveOperation;
}));
export declare type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>;
export declare type Operation = CreateOperation | UpdateOperation | RemoveOperation;
export declare type UserIdSubQuery = Selection<UserIdProjection>;
export declare type PlatformIdSubQuery = Selection<PlatformIdProjection>;
export declare type MessageIdSubQuery = Selection<MessageIdProjection>;
export declare type EntityDef = {
Schema: Schema;

View File

@ -52,6 +52,10 @@ export const desc = {
router: {
type: "object"
},
platformId: {
type: "ref",
ref: "platform"
},
iState: {
type: "enum",
enumeration: ["sending", "success", "failure"]

View File

@ -1 +1 @@
{ "name": "消息", "attr": { "entity": "关联对象", "entityId": "关联对象ID", "restriction": "限制", "title": "标题", "content": "内容", "user": "关联用户", "type": "消息类型", "weight": "优先级", "iState": "发送状态", "visitState": "访问状态", "router": "目标路由", "data": "透传数据" }, "action": { "succeed": "成功", "fail": "失败", "visit": "阅读" }, "v": { "iState": { "sending": "发送中", "success": "发送成功", "failure": "发送失败" }, "visitState": { "unvisited": "未读", "visited": "已读" }, "weight": { "high": "高", "medium": "中", "low": "低" } } }
{ "name": "消息", "attr": { "entity": "关联对象", "entityId": "关联对象ID", "restriction": "限制", "title": "标题", "content": "内容", "user": "关联用户", "type": "消息类型", "weight": "优先级", "iState": "发送状态", "visitState": "访问状态", "router": "目标路由", "data": "透传数据", "platform": "平台" }, "action": { "succeed": "成功", "fail": "失败", "visit": "阅读" }, "v": { "iState": { "sending": "发送中", "success": "发送成功", "failure": "发送失败" }, "visitState": { "unvisited": "未读", "visited": "已读" }, "weight": { "high": "高", "medium": "中", "low": "低" } } }

View File

@ -6,10 +6,12 @@ import { String } from "oak-domain/lib/types/DataType";
import { EntityShape } from "oak-domain/lib/types/Entity";
export declare type OpSchema = EntityShape & {
type: String<64>;
display?: String<64> | null;
};
export declare type OpAttr = keyof OpSchema;
export declare type Schema = EntityShape & {
type: String<64>;
display?: String<64> | null;
} & {
[A in ExpressionKey]?: any;
};
@ -19,6 +21,7 @@ declare type AttrFilter = {
$$seq$$: Q_StringValue;
$$updateAt$$: Q_DateValue;
type: Q_StringValue;
display: Q_StringValue;
};
export declare type Filter = MakeFilter<AttrFilter & ExprOp<OpAttr | string>>;
export declare type Projection = {
@ -29,6 +32,7 @@ export declare type Projection = {
$$updateAt$$?: number;
$$seq$$?: number;
type?: number;
display?: number;
} & Partial<ExprOp<OpAttr | string>>;
declare type MessageTypeIdProjection = OneOf<{
id: number;
@ -43,6 +47,8 @@ export declare type SortAttr = {
$$updateAt$$: number;
} | {
type: number;
} | {
display: number;
} | {
[k: string]: any;
} | OneOf<ExprOp<OpAttr | string>>;

View File

@ -7,6 +7,12 @@ export const desc = {
params: {
length: 64
}
},
display: {
type: "varchar",
params: {
length: 64
}
}
},
actionType: "crud",

View File

@ -1 +1 @@
{ "name": "消息类型", "attr": { "type": "类型" } }
{ "name": "消息类型", "attr": { "type": "类型", "display": "显示值" } }

View File

@ -7,6 +7,7 @@ import { String, Text } from "oak-domain/lib/types/DataType";
import { EntityShape } from "oak-domain/lib/types/Entity";
import { Config } from "../../types/Config";
import { Style } from "../../types/Style";
import * as Message from "../Message/Schema";
import * as System from "../System/Schema";
export declare type OpSchema = EntityShape & {
name: String<32>;
@ -24,6 +25,8 @@ export declare type Schema = EntityShape & {
style?: Style | null;
entity?: String<32> | null;
entityId?: String<64> | null;
message$platform?: Array<Message.Schema>;
message$platform$$aggr?: AggregationResult<Message.Schema>;
system$platform?: Array<System.Schema>;
system$platform$$aggr?: AggregationResult<System.Schema>;
} & {
@ -40,6 +43,7 @@ declare type AttrFilter = {
style: JsonFilter<Style>;
entity: Q_StringValue;
entityId: Q_StringValue;
message$platform: Message.Filter & SubQueryPredicateMetadata;
system$platform: System.Filter & SubQueryPredicateMetadata;
};
export declare type Filter = MakeFilter<AttrFilter & ExprOp<OpAttr | string>>;
@ -56,6 +60,12 @@ export declare type Projection = {
style?: number | JsonProjection<Style>;
entity?: number;
entityId?: number;
message$platform?: Message.Selection & {
$entity: "message";
};
message$platform$$aggr?: Message.Aggregation & {
$entity: "message";
};
system$platform?: System.Selection & {
$entity: "system";
};
@ -102,6 +112,7 @@ export declare type CreateOperationData = FormCreateData<Omit<OpSchema, "entity"
entityId?: string;
[K: string]: any;
}) & {
message$platform?: OakOperation<Message.UpdateOperation["action"], Omit<Message.UpdateOperationData, "platform" | "platformId">, Omit<Message.Filter, "platform" | "platformId">> | OakOperation<"create", Omit<Message.CreateOperationData, "platform" | "platformId">[]> | Array<OakOperation<"create", Omit<Message.CreateOperationData, "platform" | "platformId">> | OakOperation<Message.UpdateOperation["action"], Omit<Message.UpdateOperationData, "platform" | "platformId">, Omit<Message.Filter, "platform" | "platformId">>>;
system$platform?: OakOperation<System.UpdateOperation["action"], Omit<System.UpdateOperationData, "platform" | "platformId">, Omit<System.Filter, "platform" | "platformId">> | OakOperation<"create", Omit<System.CreateOperationData, "platform" | "platformId">[]> | Array<OakOperation<"create", Omit<System.CreateOperationData, "platform" | "platformId">> | OakOperation<System.UpdateOperation["action"], Omit<System.UpdateOperationData, "platform" | "platformId">, Omit<System.Filter, "platform" | "platformId">>>;
};
export declare type CreateSingleOperation = OakOperation<"create", CreateOperationData>;
@ -109,6 +120,7 @@ export declare type CreateMultipleOperation = OakOperation<"create", Array<Creat
export declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation;
export declare type UpdateOperationData = FormUpdateData<OpSchema> & {
[k: string]: any;
message$platform?: OakOperation<Message.UpdateOperation["action"], Omit<Message.UpdateOperationData, "platform" | "platformId">, Omit<Message.Filter, "platform" | "platformId">> | OakOperation<Message.RemoveOperation["action"], Omit<Message.RemoveOperationData, "platform" | "platformId">, Omit<Message.Filter, "platform" | "platformId">> | OakOperation<"create", Omit<Message.CreateOperationData, "platform" | "platformId">[]> | Array<OakOperation<"create", Omit<Message.CreateOperationData, "platform" | "platformId">> | OakOperation<Message.UpdateOperation["action"], Omit<Message.UpdateOperationData, "platform" | "platformId">, Omit<Message.Filter, "platform" | "platformId">> | OakOperation<Message.RemoveOperation["action"], Omit<Message.RemoveOperationData, "platform" | "platformId">, Omit<Message.Filter, "platform" | "platformId">>>;
system$platform?: OakOperation<System.UpdateOperation["action"], Omit<System.UpdateOperationData, "platform" | "platformId">, Omit<System.Filter, "platform" | "platformId">> | OakOperation<System.RemoveOperation["action"], Omit<System.RemoveOperationData, "platform" | "platformId">, Omit<System.Filter, "platform" | "platformId">> | OakOperation<"create", Omit<System.CreateOperationData, "platform" | "platformId">[]> | Array<OakOperation<"create", Omit<System.CreateOperationData, "platform" | "platformId">> | OakOperation<System.UpdateOperation["action"], Omit<System.UpdateOperationData, "platform" | "platformId">, Omit<System.Filter, "platform" | "platformId">> | OakOperation<System.RemoveOperation["action"], Omit<System.RemoveOperationData, "platform" | "platformId">, Omit<System.Filter, "platform" | "platformId">>>;
};
export declare type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>;

View File

@ -278,7 +278,9 @@ export declare type ParasiteIdSubQuery = {
}) | any;
};
export declare type PlatformIdSubQuery = {
[K in "$in" | "$nin"]?: (System.PlatformIdSubQuery & {
[K in "$in" | "$nin"]?: (Message.PlatformIdSubQuery & {
entity: "message";
}) | (System.PlatformIdSubQuery & {
entity: "system";
}) | (Platform.PlatformIdSubQuery & {
entity: "platform";

View File

@ -1,7 +1,7 @@
export default OakComponent({
isList: true,
entity: 'application',
actions: ['update', 'remove'],
actions: ['update', 'remove', 'create'],
projection: {
id: 1,
name: 1,

View File

@ -1,11 +1,7 @@
import { EntityDict } from '../../../oak-app-domain';
import { WebComponentProps, RowWithActions } from 'oak-frontend-base';
export default function Render(props: WebComponentProps<EntityDict, 'application', true, {
searchValue: string;
list: RowWithActions<EntityDict, 'application'>[];
pagination: any;
showBack: boolean;
variant?: 'inline' | 'alone' | 'dialog';
}, {
goDetail: (id: string) => void;
goCreate: () => void;

View File

@ -1,28 +1,26 @@
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
import { Table, Button, Space, Typography } from 'antd';
import PageHeader from '../../../components/common/pageHeader';
import ActionBtnPanel from 'oak-frontend-base/es/components/actionBtnPanel';
import Style from './web.module.less';
export default function Render(props) {
const { oakPagination, list = [], oakLoading, showBack, variant, oakFullpath, } = props.data;
const { oakPagination, list = [], oakLoading, oakFullpath, oakLegalActions, } = props.data;
const { pageSize, total, currentPage } = oakPagination || {};
const { t, setPageSize, setCurrentPage, goCreate, goDetail, goSetConfig, goUpdate, removeApplication, } = props.methods;
return (_jsxs(Container, { variant: variant, children: [_jsx(Space, { children: _jsx(Button, { type: "primary", onClick: () => {
return (_jsxs(_Fragment, { children: [oakLegalActions?.includes('create') && (_jsx(Space, { style: { marginBottom: 16 }, children: _jsx(Button, { type: "primary", onClick: () => {
goCreate();
}, children: "\u6DFB\u52A0\u5E94\u7528" }) }), _jsx(Table, { loading: oakLoading, dataSource: list, rowKey: "id", columns: [
// {
// dataIndex: 'id',
// title: '序号',
// render: (value, record, index) => {
// return index + 1;
// },
// },
}, children: "\u6DFB\u52A0\u5E94\u7528" }) })), _jsx(Table, { loading: oakLoading, dataSource: list, rowKey: "id", columns: [
{
dataIndex: 'id',
title: '#',
render: (value, record, index) => {
return index + 1;
},
},
{
dataIndex: 'name',
title: '应用名称',
width: 300,
render: (value, record, index) => {
return (_jsx(Typography.Link, { onClick: () => {
return (_jsx(Typography.Link, { disabled: !record?.['#oakLegalActions']?.includes('update'), onClick: () => {
goDetail(record.id);
}, children: value }));
},
@ -45,7 +43,7 @@ export default function Render(props) {
title: '应用配置',
align: 'center',
render: (value, record, index) => {
return (_jsx(_Fragment, { children: _jsx(Button, { type: "link", onClick: () => {
return (_jsx(_Fragment, { children: _jsx(Button, { type: "link", disabled: !record?.['#oakLegalActions']?.includes('update'), onClick: () => {
goSetConfig(record.id);
}, children: "\u914D\u7F6E" }) }));
},
@ -94,10 +92,3 @@ export default function Render(props) {
},
} })] }));
}
function Container(props) {
const { children, variant = 'alone', showBack } = props;
if (['inline', 'dialog'].includes(variant)) {
return _jsx(_Fragment, { children: children });
}
return (_jsx(PageHeader, { showBack: showBack, title: "\u5E94\u7528\u7BA1\u7406", children: _jsx("div", { className: Style.container, children: children }) }));
}

View File

@ -1,7 +1,7 @@
export default OakComponent({
isList: true,
entity: 'domain',
actions: ['update'],
actions: ['update', 'create'],
projection: {
id: 1,
systemId: 1,

View File

@ -1,11 +1,7 @@
import { EntityDict } from '../../../oak-app-domain';
import { WebComponentProps, RowWithActions } from 'oak-frontend-base';
export default function Render(props: WebComponentProps<EntityDict, 'domain', true, {
searchValue: string;
list: RowWithActions<EntityDict, 'domain'>[];
pagination: any;
showBack: boolean;
variant?: 'inline' | 'alone' | 'dialog';
}, {
goDetail: (id: string) => void;
goCreate: () => void;

View File

@ -1,27 +1,25 @@
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
import { Table, Button, Space, Typography } from 'antd';
import PageHeader from '../../../components/common/pageHeader';
import ActionBtnPanel from 'oak-frontend-base/es/components/actionBtnPanel';
import Style from './web.module.less';
export default function Render(props) {
const { oakPagination, list = [], oakLoading, showBack, variant, oakFullpath, } = props.data;
const { oakPagination, list = [], oakLoading, oakFullpath, oakLegalActions, } = props.data;
const { pageSize, total, currentPage } = oakPagination || {};
const { t, setPageSize, setCurrentPage, goCreate, goDetail, goUpdate, } = props.methods;
return (_jsxs(Container, { showBack: showBack, variant: variant, children: [_jsx(Space, { children: _jsx(Button, { type: "primary", onClick: () => {
return (_jsxs(_Fragment, { children: [oakLegalActions?.includes('create') && (_jsx(Space, { style: { marginBottom: 16 }, children: _jsx(Button, { type: "primary", onClick: () => {
goCreate();
}, children: "\u6DFB\u52A0\u57DF\u540D" }) }), _jsx(Table, { loading: oakLoading, dataSource: list, rowKey: "id", columns: [
// {
// dataIndex: 'id',
// title: '序号',
// render: (value, record, index) => {
// return index + 1;
// },
// },
}, children: "\u6DFB\u52A0\u57DF\u540D" }) })), _jsx(Table, { loading: oakLoading, dataSource: list, rowKey: "id", columns: [
{
dataIndex: 'id',
title: '#',
render: (value, record, index) => {
return index + 1;
},
},
{
dataIndex: 'url',
title: '域名',
render: (value, record, index) => {
return (_jsx(Typography.Link, { onClick: () => {
return (_jsx(Typography.Link, { disabled: !record?.['#oakLegalActions']?.includes('update'), onClick: () => {
goDetail(record.id);
}, children: value }));
},
@ -74,10 +72,3 @@ export default function Render(props) {
},
} })] }));
}
function Container(props) {
const { children, variant = 'alone', showBack } = props;
if (['inline', 'dialog'].includes(variant)) {
return _jsx(_Fragment, { children: children });
}
return (_jsx(PageHeader, { showBack: showBack, title: "\u7CFB\u7EDF\u7BA1\u7406", children: _jsx("div", { className: Style.container, children: children }) }));
}

View File

@ -17,7 +17,7 @@ export default function Render(props) {
{
label: '系统管理',
key: 'system_list',
children: (_jsx(SystemList, { platformId: oakId, variant: "inline", oakPath: "$platform/detail/-system/list", oakAutoUnmount: true })),
children: (_jsx(SystemList, { platformId: oakId, oakPath: "$platform/detail/-system/list", oakAutoUnmount: true })),
},
] }) }) }) }));
}

View File

@ -1,7 +1,7 @@
export default OakComponent({
isList: true,
entity: 'platform',
actions: ['update'],
actions: ['update', 'create'],
projection: {
id: 1,
name: 1,

View File

@ -1,11 +1,7 @@
import { EntityDict } from '../../../oak-app-domain';
import { WebComponentProps, RowWithActions } from 'oak-frontend-base';
export default function Render(props: WebComponentProps<EntityDict, 'platform', true, {
searchValue: string;
list: RowWithActions<EntityDict, 'platform'>[];
pagination: any;
showBack: boolean;
variant?: 'inline' | 'alone' | 'dialog';
}, {
goDetail: (id: string) => void;
goCreate: () => void;

View File

@ -5,25 +5,25 @@ import ActionBtnPanel from 'oak-frontend-base/es/components/actionBtnPanel';
import Style from './web.module.less';
import dayjs from 'dayjs';
export default function Render(props) {
const { oakPagination, list = [], oakLoading, showBack, variant, oakFullpath, } = props.data;
const { oakPagination, list = [], oakLoading, oakFullpath, oakLegalActions } = props.data;
const { pageSize, total, currentPage } = oakPagination || {};
const { t, setPageSize, setCurrentPage, goCreate, goDetail, goSetConfig, goUpdate, } = props.methods;
return (_jsx(PageHeader, { title: "\u5E73\u53F0\u7BA1\u7406", children: _jsxs("div", { className: Style.container, children: [_jsx(Space, { style: { marginBottom: 16 }, children: _jsx(Button, { type: "primary", onClick: () => {
return (_jsx(PageHeader, { title: "\u5E73\u53F0\u7BA1\u7406", children: _jsxs("div", { className: Style.container, children: [oakLegalActions?.includes('create') && (_jsx(Space, { style: { marginBottom: 16 }, children: _jsx(Button, { type: "primary", onClick: () => {
goCreate();
}, children: "\u6DFB\u52A0\u5E73\u53F0" }) }), _jsx(Table, { loading: oakLoading, dataSource: list, rowKey: "id", columns: [
// {
// dataIndex: 'id',
// title: '序号',
// render: (value, record, index) => {
// return index + 1;
// },
// },
}, children: "\u6DFB\u52A0\u5E73\u53F0" }) })), _jsx(Table, { loading: oakLoading, dataSource: list, rowKey: "id", columns: [
{
dataIndex: 'id',
title: '#',
render: (value, record, index) => {
return index + 1;
},
},
{
dataIndex: 'name',
title: '平台名称',
width: 300,
render: (value, record, index) => {
return (_jsx(Typography.Link, { onClick: () => {
return (_jsx(Typography.Link, { disabled: !record?.['#oakLegalActions']?.includes('update'), onClick: () => {
goDetail(record.id);
}, children: value }));
},
@ -47,7 +47,7 @@ export default function Render(props) {
title: '配置',
align: 'center',
render: (value, record, index) => {
return (_jsx(_Fragment, { children: _jsx(Button, { type: "link", onClick: () => {
return (_jsx(_Fragment, { children: _jsx(Button, { type: "link", disabled: !record?.['#oakLegalActions']?.includes('update'), onClick: () => {
goSetConfig(record.id);
}, children: "\u914D\u7F6E" }) }));
},

View File

@ -19,12 +19,12 @@ export default function Render(props) {
{
label: '应用管理',
key: 'application_list',
children: (_jsx(ApplicationList, { systemId: oakId, variant: "inline", oakPath: "$system/detail-application/list", oakAutoUnmount: true })),
children: (_jsx(ApplicationList, { systemId: oakId, oakPath: "$system/detail-application/list", oakAutoUnmount: true })),
},
{
label: '域名管理',
key: 'domain_list',
children: (_jsx(DomainList, { systemId: oakId, variant: "inline", oakPath: "$system/detail-domain/list", oakAutoUnmount: true })),
children: (_jsx(DomainList, { systemId: oakId, oakPath: "$system/detail-domain/list", oakAutoUnmount: true })),
},
] }) }) }) }));
}

View File

@ -1,7 +1,7 @@
export default OakComponent({
isList: true,
entity: 'system',
actions: ['update'],
actions: ['update', 'create'],
projection: {
id: 1,
name: 1,

View File

@ -1,11 +1,7 @@
import { EntityDict } from '../../../oak-app-domain';
import { WebComponentProps, RowWithActions } from 'oak-frontend-base';
export default function Render(props: WebComponentProps<EntityDict, 'system', true, {
searchValue: string;
list: RowWithActions<EntityDict, 'system'>[];
pagination: any;
showBack: boolean;
variant?: 'inline' | 'alone' | 'dialog';
}, {
goDetail: (id: string) => void;
goCreate: () => void;

View File

@ -1,28 +1,26 @@
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
import { Table, Button, Space, Typography, Tag } from 'antd';
import PageHeader from '../../../components/common/pageHeader';
import ActionBtnPanel from 'oak-frontend-base/es/components/actionBtnPanel';
import Style from './web.module.less';
export default function Render(props) {
const { oakPagination, list = [], oakLoading, showBack, variant, oakFullpath, } = props.data;
const { oakPagination, list = [], oakLoading, oakFullpath, oakLegalActions, } = props.data;
const { pageSize, total, currentPage } = oakPagination || {};
const { t, setPageSize, setCurrentPage, goCreate, goDetail, goSetConfig, goUpdate, } = props.methods;
return (_jsxs(Container, { showBack: showBack, variant: variant, children: [_jsx(Space, { children: _jsx(Button, { type: "primary", onClick: () => {
return (_jsxs(_Fragment, { children: [oakLegalActions?.includes('create') && (_jsx(Space, { style: { marginBottom: 16 }, children: _jsx(Button, { type: "primary", onClick: () => {
goCreate();
}, children: "\u6DFB\u52A0\u7CFB\u7EDF" }) }), _jsx(Table, { loading: oakLoading, dataSource: list, rowKey: "id", columns: [
// {
// dataIndex: 'id',
// title: '序号',
// render: (value, record, index) => {
// return index + 1;
// },
// },
}, children: "\u6DFB\u52A0\u7CFB\u7EDF" }) })), _jsx(Table, { loading: oakLoading, dataSource: list, rowKey: "id", columns: [
{
dataIndex: 'id',
title: '#',
render: (value, record, index) => {
return index + 1;
},
},
{
dataIndex: 'name',
title: '系统名称',
width: 300,
render: (value, record, index) => {
return (_jsx(Typography.Link, { onClick: () => {
return (_jsx(Typography.Link, { disabled: !record?.['#oakLegalActions']?.includes('update'), onClick: () => {
goDetail(record.id);
}, children: value }));
},
@ -54,7 +52,7 @@ export default function Render(props) {
title: '配置',
align: 'center',
render: (value, record, index) => {
return (_jsx(_Fragment, { children: _jsx(Button, { type: "link", onClick: () => {
return (_jsx(_Fragment, { children: _jsx(Button, { type: "link", disabled: !record?.['#oakLegalActions']?.includes('update'), onClick: () => {
goSetConfig(record.id);
}, children: "\u914D\u7F6E" }) }));
},
@ -95,10 +93,3 @@ export default function Render(props) {
},
} })] }));
}
function Container(props) {
const { children, variant = 'alone', showBack } = props;
if (['inline', 'dialog'].includes(variant)) {
return _jsx(_Fragment, { children: children });
}
return (_jsx(PageHeader, { showBack: showBack, title: "\u7CFB\u7EDF\u7BA1\u7406", children: _jsx("div", { className: Style.container, children: children }) }));
}

View File

@ -99,6 +99,14 @@ export default OakComponent({
this.update({ [attr]: value });
},
async confirm() {
const { nickname } = this.state;
if (!nickname) {
this.setMessage({
type: 'warning',
content: '请输入昵称'
});
return;
}
await this.execute();
this.navigateBack();
},

View File

@ -8,7 +8,7 @@ export default function Render(props) {
const { GenderOptions, IDCardTypeOptions } = data;
const { t, update, setDisablePulldownRefresh, confirm } = methods;
const [birthPickerVisible, setBirthPickerVisible] = useState(false);
return (_jsxs("div", { className: Style.container, children: [_jsxs(Form, { layout: "horizontal", children: [_jsx(Form.Item, { label: t('user:attr.nickname'), children: _jsx(Input, { onChange: (val) => update({ nickname: val }), value: data.nickname || '' }) }), _jsx(Form.Item, { label: t('user:attr.name'), children: _jsx(Input, { onChange: (val) => update({ name: val }), value: data.name || '' }) }), _jsx(Form.Item, { label: t('user:attr.birth'), onClick: () => {
return (_jsxs("div", { className: Style.container, children: [_jsxs(Form, { layout: "horizontal", children: [_jsx(Form.Item, { label: t('user:attr.nickname'), rules: [{ required: true }], children: _jsx(Input, { onChange: (val) => update({ nickname: val }), value: data.nickname || '' }) }), _jsx(Form.Item, { label: t('user:attr.name'), children: _jsx(Input, { onChange: (val) => update({ name: val }), value: data.name || '' }) }), _jsx(Form.Item, { label: t('user:attr.birth'), onClick: () => {
setBirthPickerVisible(true);
setDisablePulldownRefresh(true);
}, children: _jsx(Input, { value: data.birth

View File

@ -6,7 +6,7 @@ export default function Render(props) {
const { data, methods } = props;
const { GenderOptions, IDCardTypeOptions } = data;
const { t, update, confirm } = methods;
return (_jsx("div", { className: Style.container, children: _jsxs(Form, { layout: "horizontal", labelCol: { span: 8 }, wrapperCol: { span: 16 }, style: { maxWidth: 600 }, children: [_jsx(Form.Item, { label: t('user:attr.nickname'), children: _jsx(Input, { onChange: (e) => update({ nickname: e.target.value }), value: data.nickname || '' }) }), _jsx(Form.Item, { label: t('user:attr.name'), children: _jsx(Input, { onChange: (e) => update({ name: e.target.value }), value: data.name || '' }) }), _jsx(Form.Item, { label: t('user:attr.birth'), children: _jsx(DatePicker, { value: data.birth ? dayjs(data.birth) : undefined, format: 'YYYY/MM/DD', onChange: (value) => update({ birth: dayjs(value).valueOf() }) }) }), _jsx(Form.Item, { label: t('user:attr.gender'), children: _jsx(Radio.Group, { onChange: (e) => {
return (_jsx("div", { className: Style.container, children: _jsxs(Form, { layout: "horizontal", labelCol: { span: 8 }, wrapperCol: { span: 16 }, style: { maxWidth: 600 }, children: [_jsx(Form.Item, { label: t('user:attr.nickname'), required: true, children: _jsx(Input, { onChange: (e) => update({ nickname: e.target.value }), value: data.nickname || '' }) }), _jsx(Form.Item, { label: t('user:attr.name'), children: _jsx(Input, { onChange: (e) => update({ name: e.target.value }), value: data.name || '' }) }), _jsx(Form.Item, { label: t('user:attr.birth'), children: _jsx(DatePicker, { value: data.birth ? dayjs(data.birth) : undefined, format: 'YYYY/MM/DD', onChange: (value) => update({ birth: dayjs(value).valueOf() }) }) }), _jsx(Form.Item, { label: t('user:attr.gender'), children: _jsx(Radio.Group, { onChange: (e) => {
update({
gender: e.target
.value,

View File

@ -44,12 +44,9 @@ export async function tryMakeSmsNotification(message, context) {
}
}
async function createNotification(message, context) {
const { restriction, userId, weight, type, entity, entityId } = message;
const { restriction, userId, weight, type, entity, entityId, platformId } = message;
assert(userId);
// 根据用户所关联的system和定义限制选择将要发送的system。这里有的应用是到platform级别有的是到system级别
const application = context.getApplication();
const platformId = application.system.platformId;
const systemId = application.systemId;
const filter = {
userId,
};
@ -58,10 +55,6 @@ async function createNotification(message, context) {
platformId,
};
}
else {
assert(systemId);
filter.systemId = systemId;
}
const userSystems = await context.select('userSystem', {
data: {
id: 1,

View File

@ -1,4 +1,4 @@
import { generateNewId, generateNewIdAsync } from 'oak-domain/lib/utils/uuid';
import { generateNewIdAsync } from 'oak-domain/lib/utils/uuid';
import { ROOT_USER_ID } from '../constants';
import { randomName } from '../utils/randomUser';
import { assert } from 'oak-domain/lib/utils/assert';
@ -12,45 +12,29 @@ const triggers = [
fn: async ({ operation }, context) => {
const { data } = operation;
const systemId = context.getSystemId();
const setDefaultState = (userData) => {
const setData = async (userData) => {
if (!userData.userState) {
userData.userState = 'shadow';
}
if (!userData.nickname) {
userData.nickname = randomName('user_', 8);
}
userData.userSystem$user = [
{
id: await generateNewIdAsync(),
action: 'create',
data: {
id: await generateNewIdAsync(),
systemId,
},
},
];
};
if (data instanceof Array) {
await Promise.all(data.map(async (ele) => {
Object.assign(ele, {
userSystem$user: [
{
id: generateNewId(),
action: 'create',
data: {
id: generateNewId(),
systemId,
},
},
],
});
setDefaultState(ele);
}));
data.forEach(async (ele) => await setData(ele));
}
else {
Object.assign(data, {
userSystem$user: [
{
id: generateNewId(),
action: 'create',
data: {
id: generateNewId(),
systemId,
},
},
],
});
setDefaultState(data);
await setData(data);
}
return 1;
},

View File

@ -40,6 +40,7 @@ export const userProjection = {
};
export const tokenProjection = {
id: 1,
applicationId: 1,
userId: 1,
user: userProjection,
ableState: 1,
@ -78,6 +79,7 @@ export const applicationProjection = {
type: 1,
systemId: 1,
style: 1,
description: 1,
system: {
id: 1,
name: 1,

View File

@ -3,6 +3,7 @@ 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 icons_1 = require("@ant-design/icons");
var lodash_1 = require("oak-domain/lib/utils/lodash");
var Colors = ['primary', 'success', 'error', 'warning', 'info'];
function Color(props) {
@ -10,10 +11,13 @@ function Color(props) {
;
return ((0, jsx_runtime_1.jsx)(antd_1.Form, { children: Colors.map(function (ele) { return ((0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: ele,
// required
// name="folder"
tooltip: "\u8BBE\u7F6E\u7CFB\u7EDF\u3010".concat(ele, "\u3011\u989C\u8272") }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.Input, { onChange: function (e) {
setValue(ele, e.target.value);
}, value: (0, lodash_1.get)(value, ele) }) }) }), ele)); }) }));
tooltip: "\u8BBE\u7F6E\u7CFB\u7EDF\u3010".concat(ele, "\u3011\u989C\u8272") }, { children: (0, jsx_runtime_1.jsxs)(antd_1.Space.Compact, tslib_1.__assign({ block: true }, { children: [(0, jsx_runtime_1.jsx)(antd_1.ColorPicker, tslib_1.__assign({ onChangeComplete: function (color) {
setValue(ele, color.toHexString());
} }, { children: (0, jsx_runtime_1.jsx)(antd_1.Input, { value: (0, lodash_1.get)(value, ele), readOnly: true, onChange: function (e) {
setValue(ele, e.target.value);
} }) })), (0, jsx_runtime_1.jsx)(antd_1.Button, { icon: (0, jsx_runtime_1.jsx)(icons_1.ClearOutlined, {}), onClick: function (e) {
setValue(ele, '');
} })] })) }), ele)); }) }));
}
function Render(props) {
var styleValue = props.value, onChange = props.onChange;

View File

@ -9,7 +9,9 @@ exports.users = [
name: 'root',
isRoot: true,
id: constants_1.ROOT_USER_ID,
}
userState: 'shadow',
idState: 'unverified',
},
];
exports.mobiles = [
{

View File

@ -2,6 +2,7 @@ import { String, Text } from 'oak-domain/lib/types/DataType';
import { Schema as User } from './User';
import { EntityShape } from 'oak-domain/lib/types/Entity';
import { Channel, Weight } from '../types/Message';
import { Schema as Platform } from './Platform';
declare type Router = {
pathname: string;
props?: Record<string, any>;
@ -23,5 +24,6 @@ export interface Schema extends EntityShape {
content: Text;
data?: Object;
router?: Router;
platform?: Platform;
}
export {};

View File

@ -30,6 +30,7 @@ var entityDesc = {
visitState: '访问状态',
router: '目标路由',
data: '透传数据',
platform: '平台',
},
action: {
succeed: '成功',
@ -53,5 +54,5 @@ var entityDesc = {
},
},
},
}
},
};

View File

@ -2,4 +2,5 @@ import { String } from 'oak-domain/lib/types/DataType';
import { EntityShape } from 'oak-domain/lib/types/Entity';
export interface Schema extends EntityShape {
type: String<64>;
display?: String<64>;
}

View File

@ -7,7 +7,8 @@ var entityDesc = {
name: '消息类型',
attr: {
type: '类型',
display: '显示值',
},
},
}
},
};

View File

@ -7,6 +7,7 @@ import { String, Text } from "oak-domain/lib/types/DataType";
import { EntityShape } from "oak-domain/lib/types/Entity";
import { Channel, Weight } from "../../types/Message";
import * as User from "../User/Schema";
import * as Platform from "../Platform/Schema";
import * as MessageSystem from "../MessageSystem/Schema";
declare type Router = {
pathname: string;
@ -29,6 +30,7 @@ export declare type OpSchema = EntityShape & {
content: Text;
data?: Object | null;
router?: Router | null;
platformId?: ForeignKey<"platform"> | null;
iState?: IState | null;
visitState?: VisitState | null;
};
@ -44,9 +46,11 @@ export declare type Schema = EntityShape & {
content: Text;
data?: Object | null;
router?: Router | null;
platformId?: ForeignKey<"platform"> | null;
iState?: IState | null;
visitState?: VisitState | null;
user: User.Schema;
platform?: Platform.Schema | null;
messageSystem$message?: Array<MessageSystem.Schema>;
messageSystem$message$$aggr?: AggregationResult<MessageSystem.Schema>;
} & {
@ -68,6 +72,8 @@ declare type AttrFilter = {
content: Q_StringValue;
data: Object;
router: JsonFilter<Router>;
platformId: Q_StringValue;
platform: Platform.Filter;
iState: Q_EnumValue<IState>;
visitState: Q_EnumValue<VisitState>;
messageSystem$message: MessageSystem.Filter & SubQueryPredicateMetadata;
@ -91,6 +97,8 @@ export declare type Projection = {
content?: number;
data?: number | Object;
router?: number | JsonProjection<Router>;
platformId?: number;
platform?: Platform.Projection;
iState?: number;
visitState?: number;
messageSystem$message?: MessageSystem.Selection & {
@ -106,6 +114,9 @@ declare type MessageIdProjection = OneOf<{
declare type UserIdProjection = OneOf<{
userId: number;
}>;
declare type PlatformIdProjection = OneOf<{
platformId: number;
}>;
export declare type SortAttr = {
id: number;
} | {
@ -134,6 +145,10 @@ export declare type SortAttr = {
content: number;
} | {
router: number;
} | {
platformId: number;
} | {
platform: Platform.SortAttr;
} | {
iState: number;
} | {
@ -149,7 +164,7 @@ export declare type Sorter = SortNode[];
export declare type SelectOperation<P extends Object = Projection> = OakSelection<"select", P, Filter, Sorter>;
export declare type Selection<P extends Object = Projection> = SelectOperation<P>;
export declare type Aggregation = DeduceAggregation<Projection, Filter, Sorter>;
export declare type CreateOperationData = FormCreateData<Omit<OpSchema, "entity" | "entityId" | "userId">> & (({
export declare type CreateOperationData = FormCreateData<Omit<OpSchema, "entity" | "entityId" | "userId" | "platformId">> & (({
userId?: never;
user: User.CreateSingleOperation;
} | {
@ -157,6 +172,14 @@ export declare type CreateOperationData = FormCreateData<Omit<OpSchema, "entity"
user?: User.UpdateOperation;
} | {
userId: ForeignKey<"user">;
}) & ({
platformId?: never;
platform?: Platform.CreateSingleOperation;
} | {
platformId: ForeignKey<"platform">;
platform?: Platform.UpdateOperation;
} | {
platformId?: ForeignKey<"platform">;
})) & ({
entity?: string;
entityId?: string;
@ -167,7 +190,7 @@ export declare type CreateOperationData = FormCreateData<Omit<OpSchema, "entity"
export declare type CreateSingleOperation = OakOperation<"create", CreateOperationData>;
export declare type CreateMultipleOperation = OakOperation<"create", Array<CreateOperationData>>;
export declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation;
export declare type UpdateOperationData = FormUpdateData<Omit<OpSchema, "userId">> & (({
export declare type UpdateOperationData = FormUpdateData<Omit<OpSchema, "userId" | "platformId">> & (({
user: User.CreateSingleOperation;
userId?: never;
} | {
@ -179,6 +202,18 @@ export declare type UpdateOperationData = FormUpdateData<Omit<OpSchema, "userId"
} | {
user?: never;
userId?: ForeignKey<"user"> | null;
}) & ({
platform: Platform.CreateSingleOperation;
platformId?: never;
} | {
platform: Platform.UpdateOperation;
platformId?: never;
} | {
platform: Platform.RemoveOperation;
platformId?: never;
} | {
platform?: never;
platformId?: ForeignKey<"platform"> | null;
})) & {
[k: string]: any;
messageSystem$message?: OakOperation<MessageSystem.UpdateOperation["action"], Omit<MessageSystem.UpdateOperationData, "message" | "messageId">, Omit<MessageSystem.Filter, "message" | "messageId">> | OakOperation<MessageSystem.RemoveOperation["action"], Omit<MessageSystem.RemoveOperationData, "message" | "messageId">, Omit<MessageSystem.Filter, "message" | "messageId">> | OakOperation<"create", Omit<MessageSystem.CreateOperationData, "message" | "messageId">[]> | Array<OakOperation<"create", Omit<MessageSystem.CreateOperationData, "message" | "messageId">> | OakOperation<MessageSystem.UpdateOperation["action"], Omit<MessageSystem.UpdateOperationData, "message" | "messageId">, Omit<MessageSystem.Filter, "message" | "messageId">> | OakOperation<MessageSystem.RemoveOperation["action"], Omit<MessageSystem.RemoveOperationData, "message" | "messageId">, Omit<MessageSystem.Filter, "message" | "messageId">>>;
@ -186,10 +221,13 @@ export declare type UpdateOperationData = FormUpdateData<Omit<OpSchema, "userId"
export declare type UpdateOperation = OakOperation<"update" | ParticularAction | string, UpdateOperationData, Filter, Sorter>;
export declare type RemoveOperationData = {} & (({
user?: User.UpdateOperation | User.RemoveOperation;
}) & ({
platform?: Platform.UpdateOperation | Platform.RemoveOperation;
}));
export declare type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>;
export declare type Operation = CreateOperation | UpdateOperation | RemoveOperation;
export declare type UserIdSubQuery = Selection<UserIdProjection>;
export declare type PlatformIdSubQuery = Selection<PlatformIdProjection>;
export declare type MessageIdSubQuery = Selection<MessageIdProjection>;
export declare type EntityDef = {
Schema: Schema;

View File

@ -55,6 +55,10 @@ exports.desc = {
router: {
type: "object"
},
platformId: {
type: "ref",
ref: "platform"
},
iState: {
type: "enum",
enumeration: ["sending", "success", "failure"]

View File

@ -1 +1 @@
{ "name": "消息", "attr": { "entity": "关联对象", "entityId": "关联对象ID", "restriction": "限制", "title": "标题", "content": "内容", "user": "关联用户", "type": "消息类型", "weight": "优先级", "iState": "发送状态", "visitState": "访问状态", "router": "目标路由", "data": "透传数据" }, "action": { "succeed": "成功", "fail": "失败", "visit": "阅读" }, "v": { "iState": { "sending": "发送中", "success": "发送成功", "failure": "发送失败" }, "visitState": { "unvisited": "未读", "visited": "已读" }, "weight": { "high": "高", "medium": "中", "low": "低" } } }
{ "name": "消息", "attr": { "entity": "关联对象", "entityId": "关联对象ID", "restriction": "限制", "title": "标题", "content": "内容", "user": "关联用户", "type": "消息类型", "weight": "优先级", "iState": "发送状态", "visitState": "访问状态", "router": "目标路由", "data": "透传数据", "platform": "平台" }, "action": { "succeed": "成功", "fail": "失败", "visit": "阅读" }, "v": { "iState": { "sending": "发送中", "success": "发送成功", "failure": "发送失败" }, "visitState": { "unvisited": "未读", "visited": "已读" }, "weight": { "high": "高", "medium": "中", "low": "低" } } }

View File

@ -6,10 +6,12 @@ import { String } from "oak-domain/lib/types/DataType";
import { EntityShape } from "oak-domain/lib/types/Entity";
export declare type OpSchema = EntityShape & {
type: String<64>;
display?: String<64> | null;
};
export declare type OpAttr = keyof OpSchema;
export declare type Schema = EntityShape & {
type: String<64>;
display?: String<64> | null;
} & {
[A in ExpressionKey]?: any;
};
@ -19,6 +21,7 @@ declare type AttrFilter = {
$$seq$$: Q_StringValue;
$$updateAt$$: Q_DateValue;
type: Q_StringValue;
display: Q_StringValue;
};
export declare type Filter = MakeFilter<AttrFilter & ExprOp<OpAttr | string>>;
export declare type Projection = {
@ -29,6 +32,7 @@ export declare type Projection = {
$$updateAt$$?: number;
$$seq$$?: number;
type?: number;
display?: number;
} & Partial<ExprOp<OpAttr | string>>;
declare type MessageTypeIdProjection = OneOf<{
id: number;
@ -43,6 +47,8 @@ export declare type SortAttr = {
$$updateAt$$: number;
} | {
type: number;
} | {
display: number;
} | {
[k: string]: any;
} | OneOf<ExprOp<OpAttr | string>>;

View File

@ -10,6 +10,12 @@ exports.desc = {
params: {
length: 64
}
},
display: {
type: "varchar",
params: {
length: 64
}
}
},
actionType: "crud",

View File

@ -1 +1 @@
{ "name": "消息类型", "attr": { "type": "类型" } }
{ "name": "消息类型", "attr": { "type": "类型", "display": "显示值" } }

View File

@ -7,6 +7,7 @@ import { String, Text } from "oak-domain/lib/types/DataType";
import { EntityShape } from "oak-domain/lib/types/Entity";
import { Config } from "../../types/Config";
import { Style } from "../../types/Style";
import * as Message from "../Message/Schema";
import * as System from "../System/Schema";
export declare type OpSchema = EntityShape & {
name: String<32>;
@ -24,6 +25,8 @@ export declare type Schema = EntityShape & {
style?: Style | null;
entity?: String<32> | null;
entityId?: String<64> | null;
message$platform?: Array<Message.Schema>;
message$platform$$aggr?: AggregationResult<Message.Schema>;
system$platform?: Array<System.Schema>;
system$platform$$aggr?: AggregationResult<System.Schema>;
} & {
@ -40,6 +43,7 @@ declare type AttrFilter = {
style: JsonFilter<Style>;
entity: Q_StringValue;
entityId: Q_StringValue;
message$platform: Message.Filter & SubQueryPredicateMetadata;
system$platform: System.Filter & SubQueryPredicateMetadata;
};
export declare type Filter = MakeFilter<AttrFilter & ExprOp<OpAttr | string>>;
@ -56,6 +60,12 @@ export declare type Projection = {
style?: number | JsonProjection<Style>;
entity?: number;
entityId?: number;
message$platform?: Message.Selection & {
$entity: "message";
};
message$platform$$aggr?: Message.Aggregation & {
$entity: "message";
};
system$platform?: System.Selection & {
$entity: "system";
};
@ -102,6 +112,7 @@ export declare type CreateOperationData = FormCreateData<Omit<OpSchema, "entity"
entityId?: string;
[K: string]: any;
}) & {
message$platform?: OakOperation<Message.UpdateOperation["action"], Omit<Message.UpdateOperationData, "platform" | "platformId">, Omit<Message.Filter, "platform" | "platformId">> | OakOperation<"create", Omit<Message.CreateOperationData, "platform" | "platformId">[]> | Array<OakOperation<"create", Omit<Message.CreateOperationData, "platform" | "platformId">> | OakOperation<Message.UpdateOperation["action"], Omit<Message.UpdateOperationData, "platform" | "platformId">, Omit<Message.Filter, "platform" | "platformId">>>;
system$platform?: OakOperation<System.UpdateOperation["action"], Omit<System.UpdateOperationData, "platform" | "platformId">, Omit<System.Filter, "platform" | "platformId">> | OakOperation<"create", Omit<System.CreateOperationData, "platform" | "platformId">[]> | Array<OakOperation<"create", Omit<System.CreateOperationData, "platform" | "platformId">> | OakOperation<System.UpdateOperation["action"], Omit<System.UpdateOperationData, "platform" | "platformId">, Omit<System.Filter, "platform" | "platformId">>>;
};
export declare type CreateSingleOperation = OakOperation<"create", CreateOperationData>;
@ -109,6 +120,7 @@ export declare type CreateMultipleOperation = OakOperation<"create", Array<Creat
export declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation;
export declare type UpdateOperationData = FormUpdateData<OpSchema> & {
[k: string]: any;
message$platform?: OakOperation<Message.UpdateOperation["action"], Omit<Message.UpdateOperationData, "platform" | "platformId">, Omit<Message.Filter, "platform" | "platformId">> | OakOperation<Message.RemoveOperation["action"], Omit<Message.RemoveOperationData, "platform" | "platformId">, Omit<Message.Filter, "platform" | "platformId">> | OakOperation<"create", Omit<Message.CreateOperationData, "platform" | "platformId">[]> | Array<OakOperation<"create", Omit<Message.CreateOperationData, "platform" | "platformId">> | OakOperation<Message.UpdateOperation["action"], Omit<Message.UpdateOperationData, "platform" | "platformId">, Omit<Message.Filter, "platform" | "platformId">> | OakOperation<Message.RemoveOperation["action"], Omit<Message.RemoveOperationData, "platform" | "platformId">, Omit<Message.Filter, "platform" | "platformId">>>;
system$platform?: OakOperation<System.UpdateOperation["action"], Omit<System.UpdateOperationData, "platform" | "platformId">, Omit<System.Filter, "platform" | "platformId">> | OakOperation<System.RemoveOperation["action"], Omit<System.RemoveOperationData, "platform" | "platformId">, Omit<System.Filter, "platform" | "platformId">> | OakOperation<"create", Omit<System.CreateOperationData, "platform" | "platformId">[]> | Array<OakOperation<"create", Omit<System.CreateOperationData, "platform" | "platformId">> | OakOperation<System.UpdateOperation["action"], Omit<System.UpdateOperationData, "platform" | "platformId">, Omit<System.Filter, "platform" | "platformId">> | OakOperation<System.RemoveOperation["action"], Omit<System.RemoveOperationData, "platform" | "platformId">, Omit<System.Filter, "platform" | "platformId">>>;
};
export declare type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>;

View File

@ -278,7 +278,9 @@ export declare type ParasiteIdSubQuery = {
}) | any;
};
export declare type PlatformIdSubQuery = {
[K in "$in" | "$nin"]?: (System.PlatformIdSubQuery & {
[K in "$in" | "$nin"]?: (Message.PlatformIdSubQuery & {
entity: "message";
}) | (System.PlatformIdSubQuery & {
entity: "system";
}) | (Platform.PlatformIdSubQuery & {
entity: "platform";

View File

@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
exports.default = OakComponent({
isList: true,
entity: 'application',
actions: ['update', 'remove'],
actions: ['update', 'remove', 'create'],
projection: {
id: 1,
name: 1,

View File

@ -1,11 +1,7 @@
import { EntityDict } from '../../../oak-app-domain';
import { WebComponentProps, RowWithActions } from 'oak-frontend-base';
export default function Render(props: WebComponentProps<EntityDict, 'application', true, {
searchValue: string;
list: RowWithActions<EntityDict, 'application'>[];
pagination: any;
showBack: boolean;
variant?: 'inline' | 'alone' | 'dialog';
}, {
goDetail: (id: string) => void;
goCreate: () => void;

View File

@ -3,29 +3,28 @@ 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 actionBtnPanel_1 = tslib_1.__importDefault(require("oak-frontend-base/es/components/actionBtnPanel"));
var web_module_less_1 = tslib_1.__importDefault(require("./web.module.less"));
function Render(props) {
var _a = props.data, oakPagination = _a.oakPagination, _b = _a.list, list = _b === void 0 ? [] : _b, oakLoading = _a.oakLoading, showBack = _a.showBack, variant = _a.variant, oakFullpath = _a.oakFullpath;
var _a = props.data, oakPagination = _a.oakPagination, _b = _a.list, list = _b === void 0 ? [] : _b, oakLoading = _a.oakLoading, oakFullpath = _a.oakFullpath, oakLegalActions = _a.oakLegalActions;
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, goCreate = _d.goCreate, goDetail = _d.goDetail, goSetConfig = _d.goSetConfig, goUpdate = _d.goUpdate, removeApplication = _d.removeApplication;
return ((0, jsx_runtime_1.jsxs)(Container, tslib_1.__assign({ variant: variant }, { children: [(0, jsx_runtime_1.jsx)(antd_1.Space, { children: (0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ type: "primary", onClick: function () {
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(oakLegalActions === null || oakLegalActions === void 0 ? void 0 : oakLegalActions.includes('create')) && ((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 () {
goCreate();
} }, { children: "\u6DFB\u52A0\u5E94\u7528" })) }), (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;
// },
// },
} }, { children: "\u6DFB\u52A0\u5E94\u7528" })) }))), (0, jsx_runtime_1.jsx)(antd_1.Table, { loading: oakLoading, dataSource: list, rowKey: "id", columns: [
{
dataIndex: 'id',
title: '#',
render: function (value, record, index) {
return index + 1;
},
},
{
dataIndex: 'name',
title: '应用名称',
width: 300,
render: function (value, record, index) {
return ((0, jsx_runtime_1.jsx)(antd_1.Typography.Link, tslib_1.__assign({ onClick: function () {
var _a;
return ((0, jsx_runtime_1.jsx)(antd_1.Typography.Link, tslib_1.__assign({ disabled: !((_a = record === null || record === void 0 ? void 0 : record['#oakLegalActions']) === null || _a === void 0 ? void 0 : _a.includes('update')), onClick: function () {
goDetail(record.id);
} }, { children: value })));
},
@ -48,7 +47,8 @@ function Render(props) {
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 () {
var _a;
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ type: "link", disabled: !((_a = record === null || record === void 0 ? void 0 : record['#oakLegalActions']) === null || _a === void 0 ? void 0 : _a.includes('update')), onClick: function () {
goSetConfig(record.id);
} }, { children: "\u914D\u7F6E" })) }));
},
@ -96,13 +96,6 @@ function Render(props) {
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: "\u5E94\u7528\u7BA1\u7406" }, { children: (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.container }, { children: children })) })));
}

View File

@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
exports.default = OakComponent({
isList: true,
entity: 'domain',
actions: ['update'],
actions: ['update', 'create'],
projection: {
id: 1,
systemId: 1,

View File

@ -1,11 +1,7 @@
import { EntityDict } from '../../../oak-app-domain';
import { WebComponentProps, RowWithActions } from 'oak-frontend-base';
export default function Render(props: WebComponentProps<EntityDict, 'domain', true, {
searchValue: string;
list: RowWithActions<EntityDict, 'domain'>[];
pagination: any;
showBack: boolean;
variant?: 'inline' | 'alone' | 'dialog';
}, {
goDetail: (id: string) => void;
goCreate: () => void;

View File

@ -3,28 +3,27 @@ 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 actionBtnPanel_1 = tslib_1.__importDefault(require("oak-frontend-base/es/components/actionBtnPanel"));
var web_module_less_1 = tslib_1.__importDefault(require("./web.module.less"));
function Render(props) {
var _a = props.data, oakPagination = _a.oakPagination, _b = _a.list, list = _b === void 0 ? [] : _b, oakLoading = _a.oakLoading, showBack = _a.showBack, variant = _a.variant, oakFullpath = _a.oakFullpath;
var _a = props.data, oakPagination = _a.oakPagination, _b = _a.list, list = _b === void 0 ? [] : _b, oakLoading = _a.oakLoading, oakFullpath = _a.oakFullpath, oakLegalActions = _a.oakLegalActions;
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, goCreate = _d.goCreate, goDetail = _d.goDetail, goUpdate = _d.goUpdate;
return ((0, jsx_runtime_1.jsxs)(Container, tslib_1.__assign({ showBack: showBack, variant: variant }, { children: [(0, jsx_runtime_1.jsx)(antd_1.Space, { children: (0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ type: "primary", onClick: function () {
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(oakLegalActions === null || oakLegalActions === void 0 ? void 0 : oakLegalActions.includes('create')) && ((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 () {
goCreate();
} }, { children: "\u6DFB\u52A0\u57DF\u540D" })) }), (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;
// },
// },
} }, { children: "\u6DFB\u52A0\u57DF\u540D" })) }))), (0, jsx_runtime_1.jsx)(antd_1.Table, { loading: oakLoading, dataSource: list, rowKey: "id", columns: [
{
dataIndex: 'id',
title: '#',
render: function (value, record, index) {
return index + 1;
},
},
{
dataIndex: 'url',
title: '域名',
render: function (value, record, index) {
return ((0, jsx_runtime_1.jsx)(antd_1.Typography.Link, tslib_1.__assign({ onClick: function () {
var _a;
return ((0, jsx_runtime_1.jsx)(antd_1.Typography.Link, tslib_1.__assign({ disabled: !((_a = record === null || record === void 0 ? void 0 : record['#oakLegalActions']) === null || _a === void 0 ? void 0 : _a.includes('update')), onClick: function () {
goDetail(record.id);
} }, { children: value })));
},
@ -76,13 +75,6 @@ function Render(props) {
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: "\u7CFB\u7EDF\u7BA1\u7406" }, { children: (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.container }, { children: children })) })));
}

View File

@ -20,7 +20,7 @@ function Render(props) {
{
label: '系统管理',
key: 'system_list',
children: ((0, jsx_runtime_1.jsx)(list_1.default, { platformId: oakId, variant: "inline", oakPath: "$platform/detail/-system/list", oakAutoUnmount: true })),
children: ((0, jsx_runtime_1.jsx)(list_1.default, { platformId: oakId, oakPath: "$platform/detail/-system/list", oakAutoUnmount: true })),
},
] }) })) })) })));
}

View File

@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
exports.default = OakComponent({
isList: true,
entity: 'platform',
actions: ['update'],
actions: ['update', 'create'],
projection: {
id: 1,
name: 1,

View File

@ -1,11 +1,7 @@
import { EntityDict } from '../../../oak-app-domain';
import { WebComponentProps, RowWithActions } from 'oak-frontend-base';
export default function Render(props: WebComponentProps<EntityDict, 'platform', true, {
searchValue: string;
list: RowWithActions<EntityDict, 'platform'>[];
pagination: any;
showBack: boolean;
variant?: 'inline' | 'alone' | 'dialog';
}, {
goDetail: (id: string) => void;
goCreate: () => void;

View File

@ -8,25 +8,26 @@ var actionBtnPanel_1 = tslib_1.__importDefault(require("oak-frontend-base/es/com
var web_module_less_1 = tslib_1.__importDefault(require("./web.module.less"));
var dayjs_1 = tslib_1.__importDefault(require("dayjs"));
function Render(props) {
var _a = props.data, oakPagination = _a.oakPagination, _b = _a.list, list = _b === void 0 ? [] : _b, oakLoading = _a.oakLoading, showBack = _a.showBack, variant = _a.variant, oakFullpath = _a.oakFullpath;
var _a = props.data, oakPagination = _a.oakPagination, _b = _a.list, list = _b === void 0 ? [] : _b, oakLoading = _a.oakLoading, oakFullpath = _a.oakFullpath, oakLegalActions = _a.oakLegalActions;
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, goCreate = _d.goCreate, goDetail = _d.goDetail, goSetConfig = _d.goSetConfig, goUpdate = _d.goUpdate;
return ((0, jsx_runtime_1.jsx)(pageHeader_1.default, tslib_1.__assign({ title: "\u5E73\u53F0\u7BA1\u7406" }, { 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 ((0, jsx_runtime_1.jsx)(pageHeader_1.default, tslib_1.__assign({ title: "\u5E73\u53F0\u7BA1\u7406" }, { children: (0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: web_module_less_1.default.container }, { children: [(oakLegalActions === null || oakLegalActions === void 0 ? void 0 : oakLegalActions.includes('create')) && ((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 () {
goCreate();
} }, { children: "\u6DFB\u52A0\u5E73\u53F0" })) })), (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;
// },
// },
} }, { children: "\u6DFB\u52A0\u5E73\u53F0" })) }))), (0, jsx_runtime_1.jsx)(antd_1.Table, { loading: oakLoading, dataSource: list, rowKey: "id", columns: [
{
dataIndex: 'id',
title: '#',
render: function (value, record, index) {
return index + 1;
},
},
{
dataIndex: 'name',
title: '平台名称',
width: 300,
render: function (value, record, index) {
return ((0, jsx_runtime_1.jsx)(antd_1.Typography.Link, tslib_1.__assign({ onClick: function () {
var _a;
return ((0, jsx_runtime_1.jsx)(antd_1.Typography.Link, tslib_1.__assign({ disabled: !((_a = record === null || record === void 0 ? void 0 : record['#oakLegalActions']) === null || _a === void 0 ? void 0 : _a.includes('update')), onClick: function () {
goDetail(record.id);
} }, { children: value })));
},
@ -50,7 +51,8 @@ function Render(props) {
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 () {
var _a;
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ type: "link", disabled: !((_a = record === null || record === void 0 ? void 0 : record['#oakLegalActions']) === null || _a === void 0 ? void 0 : _a.includes('update')), onClick: function () {
goSetConfig(record.id);
} }, { children: "\u914D\u7F6E" })) }));
},

View File

@ -22,12 +22,12 @@ function Render(props) {
{
label: '应用管理',
key: 'application_list',
children: ((0, jsx_runtime_1.jsx)(list_1.default, { systemId: oakId, variant: "inline", oakPath: "$system/detail-application/list", oakAutoUnmount: true })),
children: ((0, jsx_runtime_1.jsx)(list_1.default, { systemId: oakId, oakPath: "$system/detail-application/list", oakAutoUnmount: true })),
},
{
label: '域名管理',
key: 'domain_list',
children: ((0, jsx_runtime_1.jsx)(list_2.default, { systemId: oakId, variant: "inline", oakPath: "$system/detail-domain/list", oakAutoUnmount: true })),
children: ((0, jsx_runtime_1.jsx)(list_2.default, { systemId: oakId, oakPath: "$system/detail-domain/list", oakAutoUnmount: true })),
},
] }) })) })) })));
}

View File

@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
exports.default = OakComponent({
isList: true,
entity: 'system',
actions: ['update'],
actions: ['update', 'create'],
projection: {
id: 1,
name: 1,

View File

@ -1,11 +1,7 @@
import { EntityDict } from '../../../oak-app-domain';
import { WebComponentProps, RowWithActions } from 'oak-frontend-base';
export default function Render(props: WebComponentProps<EntityDict, 'system', true, {
searchValue: string;
list: RowWithActions<EntityDict, 'system'>[];
pagination: any;
showBack: boolean;
variant?: 'inline' | 'alone' | 'dialog';
}, {
goDetail: (id: string) => void;
goCreate: () => void;

View File

@ -3,29 +3,28 @@ 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 actionBtnPanel_1 = tslib_1.__importDefault(require("oak-frontend-base/es/components/actionBtnPanel"));
var web_module_less_1 = tslib_1.__importDefault(require("./web.module.less"));
function Render(props) {
var _a = props.data, oakPagination = _a.oakPagination, _b = _a.list, list = _b === void 0 ? [] : _b, oakLoading = _a.oakLoading, showBack = _a.showBack, variant = _a.variant, oakFullpath = _a.oakFullpath;
var _a = props.data, oakPagination = _a.oakPagination, _b = _a.list, list = _b === void 0 ? [] : _b, oakLoading = _a.oakLoading, oakFullpath = _a.oakFullpath, oakLegalActions = _a.oakLegalActions;
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, goCreate = _d.goCreate, goDetail = _d.goDetail, goSetConfig = _d.goSetConfig, goUpdate = _d.goUpdate;
return ((0, jsx_runtime_1.jsxs)(Container, tslib_1.__assign({ showBack: showBack, variant: variant }, { children: [(0, jsx_runtime_1.jsx)(antd_1.Space, { children: (0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ type: "primary", onClick: function () {
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(oakLegalActions === null || oakLegalActions === void 0 ? void 0 : oakLegalActions.includes('create')) && ((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 () {
goCreate();
} }, { children: "\u6DFB\u52A0\u7CFB\u7EDF" })) }), (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;
// },
// },
} }, { children: "\u6DFB\u52A0\u7CFB\u7EDF" })) }))), (0, jsx_runtime_1.jsx)(antd_1.Table, { loading: oakLoading, dataSource: list, rowKey: "id", columns: [
{
dataIndex: 'id',
title: '#',
render: function (value, record, index) {
return index + 1;
},
},
{
dataIndex: 'name',
title: '系统名称',
width: 300,
render: function (value, record, index) {
return ((0, jsx_runtime_1.jsx)(antd_1.Typography.Link, tslib_1.__assign({ onClick: function () {
var _a;
return ((0, jsx_runtime_1.jsx)(antd_1.Typography.Link, tslib_1.__assign({ disabled: !((_a = record === null || record === void 0 ? void 0 : record['#oakLegalActions']) === null || _a === void 0 ? void 0 : _a.includes('update')), onClick: function () {
goDetail(record.id);
} }, { children: value })));
},
@ -57,7 +56,8 @@ function Render(props) {
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 () {
var _a;
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ type: "link", disabled: !((_a = record === null || record === void 0 ? void 0 : record['#oakLegalActions']) === null || _a === void 0 ? void 0 : _a.includes('update')), onClick: function () {
goSetConfig(record.id);
} }, { children: "\u914D\u7F6E" })) }));
},
@ -97,13 +97,6 @@ function Render(props) {
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: "\u7CFB\u7EDF\u7BA1\u7406" }, { children: (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.container }, { children: children })) })));
}

View File

@ -105,9 +105,19 @@ exports.default = OakComponent({
},
confirm: function () {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var nickname;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.execute()];
case 0:
nickname = this.state.nickname;
if (!nickname) {
this.setMessage({
type: 'warning',
content: '请输入昵称'
});
return [2 /*return*/];
}
return [4 /*yield*/, this.execute()];
case 1:
_a.sent();
this.navigateBack();

View File

@ -11,7 +11,7 @@ function Render(props) {
var GenderOptions = data.GenderOptions, IDCardTypeOptions = data.IDCardTypeOptions;
var t = methods.t, update = methods.update, setDisablePulldownRefresh = methods.setDisablePulldownRefresh, confirm = methods.confirm;
var _a = tslib_1.__read((0, react_1.useState)(false), 2), birthPickerVisible = _a[0], setBirthPickerVisible = _a[1];
return ((0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: mobile_module_less_1.default.container }, { children: [(0, jsx_runtime_1.jsxs)(antd_mobile_1.Form, tslib_1.__assign({ layout: "horizontal" }, { children: [(0, jsx_runtime_1.jsx)(antd_mobile_1.Form.Item, tslib_1.__assign({ label: t('user:attr.nickname') }, { children: (0, jsx_runtime_1.jsx)(antd_mobile_1.Input, { onChange: function (val) { return update({ nickname: val }); }, value: data.nickname || '' }) })), (0, jsx_runtime_1.jsx)(antd_mobile_1.Form.Item, tslib_1.__assign({ label: t('user:attr.name') }, { children: (0, jsx_runtime_1.jsx)(antd_mobile_1.Input, { onChange: function (val) { return update({ name: val }); }, value: data.name || '' }) })), (0, jsx_runtime_1.jsx)(antd_mobile_1.Form.Item, tslib_1.__assign({ label: t('user:attr.birth'), onClick: function () {
return ((0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: mobile_module_less_1.default.container }, { children: [(0, jsx_runtime_1.jsxs)(antd_mobile_1.Form, tslib_1.__assign({ layout: "horizontal" }, { children: [(0, jsx_runtime_1.jsx)(antd_mobile_1.Form.Item, tslib_1.__assign({ label: t('user:attr.nickname'), rules: [{ required: true }] }, { children: (0, jsx_runtime_1.jsx)(antd_mobile_1.Input, { onChange: function (val) { return update({ nickname: val }); }, value: data.nickname || '' }) })), (0, jsx_runtime_1.jsx)(antd_mobile_1.Form.Item, tslib_1.__assign({ label: t('user:attr.name') }, { children: (0, jsx_runtime_1.jsx)(antd_mobile_1.Input, { onChange: function (val) { return update({ name: val }); }, value: data.name || '' }) })), (0, jsx_runtime_1.jsx)(antd_mobile_1.Form.Item, tslib_1.__assign({ label: t('user:attr.birth'), onClick: function () {
setBirthPickerVisible(true);
setDisablePulldownRefresh(true);
} }, { children: (0, jsx_runtime_1.jsx)(antd_mobile_1.Input, { value: data.birth

View File

@ -9,7 +9,7 @@ function Render(props) {
var data = props.data, methods = props.methods;
var GenderOptions = data.GenderOptions, IDCardTypeOptions = data.IDCardTypeOptions;
var t = methods.t, update = methods.update, confirm = methods.confirm;
return ((0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.container }, { children: (0, jsx_runtime_1.jsxs)(antd_1.Form, tslib_1.__assign({ layout: "horizontal", labelCol: { span: 8 }, wrapperCol: { span: 16 }, style: { maxWidth: 600 } }, { children: [(0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: t('user:attr.nickname') }, { children: (0, jsx_runtime_1.jsx)(antd_1.Input, { onChange: function (e) { return update({ nickname: e.target.value }); }, value: data.nickname || '' }) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: t('user:attr.name') }, { children: (0, jsx_runtime_1.jsx)(antd_1.Input, { onChange: function (e) { return update({ name: e.target.value }); }, value: data.name || '' }) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: t('user:attr.birth') }, { children: (0, jsx_runtime_1.jsx)(antd_1.DatePicker, { value: data.birth ? (0, dayjs_1.default)(data.birth) : undefined, format: 'YYYY/MM/DD', onChange: function (value) {
return ((0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.container }, { children: (0, jsx_runtime_1.jsxs)(antd_1.Form, tslib_1.__assign({ layout: "horizontal", labelCol: { span: 8 }, wrapperCol: { span: 16 }, style: { maxWidth: 600 } }, { children: [(0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: t('user:attr.nickname'), required: true }, { children: (0, jsx_runtime_1.jsx)(antd_1.Input, { onChange: function (e) { return update({ nickname: e.target.value }); }, value: data.nickname || '' }) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: t('user:attr.name') }, { children: (0, jsx_runtime_1.jsx)(antd_1.Input, { onChange: function (e) { return update({ name: e.target.value }); }, value: data.name || '' }) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: t('user:attr.birth') }, { children: (0, jsx_runtime_1.jsx)(antd_1.DatePicker, { value: data.birth ? (0, dayjs_1.default)(data.birth) : undefined, format: 'YYYY/MM/DD', onChange: function (value) {
return update({ birth: (0, dayjs_1.default)(value).valueOf() });
} }) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: t('user:attr.gender') }, { children: (0, jsx_runtime_1.jsx)(antd_1.Radio.Group, tslib_1.__assign({ onChange: function (e) {
update({

View File

@ -63,17 +63,14 @@ function tryMakeSmsNotification(message, context) {
exports.tryMakeSmsNotification = tryMakeSmsNotification;
function createNotification(message, context) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var restriction, userId, weight, type, entity, entityId, application, platformId, systemId, filter, userSystems, systems, messageTypeTemplateIds, channels, messageSentCount, messageSystemDatas, _a;
var restriction, userId, weight, type, entity, entityId, platformId, filter, userSystems, systems, messageTypeTemplateIds, channels, messageSentCount, messageSystemDatas, _a;
var _b;
var _this = this;
return tslib_1.__generator(this, function (_c) {
switch (_c.label) {
case 0:
restriction = message.restriction, userId = message.userId, weight = message.weight, type = message.type, entity = message.entity, entityId = message.entityId;
restriction = message.restriction, userId = message.userId, weight = message.weight, type = message.type, entity = message.entity, entityId = message.entityId, platformId = message.platformId;
(0, assert_1.assert)(userId);
application = context.getApplication();
platformId = application.system.platformId;
systemId = application.systemId;
filter = {
userId: userId,
};
@ -82,10 +79,6 @@ function createNotification(message, context) {
platformId: platformId,
};
}
else {
(0, assert_1.assert)(systemId);
filter.systemId = systemId;
}
return [4 /*yield*/, context.select('userSystem', {
data: {
id: 1,

View File

@ -15,56 +15,54 @@ var triggers = [
fn: function (_a, context) {
var operation = _a.operation;
return tslib_1.__awaiter(void 0, void 0, void 0, function () {
var data, systemId, setDefaultState;
var data, systemId, setData;
return tslib_1.__generator(this, function (_b) {
switch (_b.label) {
case 0:
data = operation.data;
systemId = context.getSystemId();
setDefaultState = function (userData) {
if (!userData.userState) {
userData.userState = 'shadow';
setData = function (userData) { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
var _a;
var _b, _c;
return tslib_1.__generator(this, function (_d) {
switch (_d.label) {
case 0:
if (!userData.userState) {
userData.userState = 'shadow';
}
if (!userData.nickname) {
userData.nickname = (0, randomUser_1.randomName)('user_', 8);
}
_a = userData;
_b = {};
return [4 /*yield*/, (0, uuid_1.generateNewIdAsync)()];
case 1:
_b.id = _d.sent(),
_b.action = 'create';
_c = {};
return [4 /*yield*/, (0, uuid_1.generateNewIdAsync)()];
case 2:
_a.userSystem$user = [
(_b.data = (_c.id = _d.sent(),
_c.systemId = systemId,
_c),
_b)
];
return [2 /*return*/];
}
});
}); };
if (!(data instanceof Array)) return [3 /*break*/, 1];
data.forEach(function (ele) { return tslib_1.__awaiter(void 0, void 0, void 0, function () { return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, setData(ele)];
case 1: return [2 /*return*/, _a.sent()];
}
if (!userData.nickname) {
userData.nickname = (0, randomUser_1.randomName)('user_', 8);
}
};
if (!(data instanceof Array)) return [3 /*break*/, 2];
return [4 /*yield*/, Promise.all(data.map(function (ele) { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
return tslib_1.__generator(this, function (_a) {
Object.assign(ele, {
userSystem$user: [
{
id: (0, uuid_1.generateNewId)(),
action: 'create',
data: {
id: (0, uuid_1.generateNewId)(),
systemId: systemId,
},
},
],
});
setDefaultState(ele);
return [2 /*return*/];
});
}); }))];
case 1:
_b.sent();
}); }); });
return [3 /*break*/, 3];
case 1: return [4 /*yield*/, setData(data)];
case 2:
Object.assign(data, {
userSystem$user: [
{
id: (0, uuid_1.generateNewId)(),
action: 'create',
data: {
id: (0, uuid_1.generateNewId)(),
systemId: systemId,
},
},
],
});
setDefaultState(data);
_b.sent();
_b.label = 3;
case 3: return [2 /*return*/, 1];
}

View File

@ -43,6 +43,7 @@ exports.userProjection = {
};
exports.tokenProjection = {
id: 1,
applicationId: 1,
userId: 1,
user: exports.userProjection,
ableState: 1,
@ -81,6 +82,7 @@ exports.applicationProjection = {
type: 1,
systemId: 1,
style: 1,
description: 1,
system: {
id: 1,
name: 1,

View File

@ -1,5 +1,6 @@
import React from 'react';
import { Button, Form, Input, Tooltip, Tabs } from 'antd';
import { Space, Form, Input, Button, Tooltip, Tabs, ColorPicker } from 'antd';
import { ClearOutlined } from '@ant-design/icons'
import { Style as StyleType, ColorType } from '../../../types/Style';
import { set, get } from 'oak-domain/lib/utils/lodash';
@ -21,22 +22,29 @@ function Color(props: { value: StyleType['color'], setValue: (path: string, valu
key={ele}
label={ele}
// required
// name="folder"
tooltip={`设置系统【${ele}】颜色`}
// rules={[
// {
// required: true,
// },
// ]}
>
<>
<Input
onChange={(e) => {
setValue(ele, e.target.value);
<Space.Compact block>
<ColorPicker
onChangeComplete={(color) => {
setValue(ele, color.toHexString());
}}
>
<Input
value={get(value, ele)}
readOnly
onChange={(e) => {
setValue(ele, e.target.value);
}}
/>
</ColorPicker>
<Button
icon={<ClearOutlined />}
onClick={(e) => {
setValue(ele, '');
}}
value={get(value, ele)}
/>
</>
</Space.Compact>
</Form.Item>
))}
</Form>

View File

@ -10,7 +10,9 @@ export const users: Array<UserCreate> = [
name: 'root',
isRoot: true,
id: ROOT_USER_ID,
}
userState: 'shadow',
idState: 'unverified',
},
];
export const mobiles: Array<MobileCreate> = [

View File

@ -1,10 +1,12 @@
import { String, Int, Text, Image } from 'oak-domain/lib/types/DataType';
import { Schema as User } from './User';
import { Schema as System } from './System';
import { EntityShape } from 'oak-domain/lib/types/Entity';
import { Index, ActionDef } from 'oak-domain/lib/types';
import { Channel, Weight } from '../types/Message';
import { EntityDesc } from 'oak-domain/lib/types/EntityDesc';
import { Schema as System } from './System';
import { Schema as Platform } from './Platform';
type Router = {
pathname: string;
@ -29,6 +31,7 @@ export interface Schema extends EntityShape {
content: Text;
data?: Object; // 透传到前台的数据OpRecords
router?: Router; // 通知前端需要到达的路由
platform?: Platform;
};
type IAction = 'succeed' | 'fail';
@ -53,14 +56,16 @@ const VisitActionDef: ActionDef<VisitAction, VisitState> = {
is: 'unvisited',
};
const entityDesc: EntityDesc<Schema,
const entityDesc: EntityDesc<
Schema,
Action,
'',
{
visitState: VisitState,
visitState: VisitState;
iState: IState;
weight: Schema['weight'];
}> = {
weight: Weight;
}
> = {
locales: {
zh_CN: {
name: '消息',
@ -77,6 +82,7 @@ const entityDesc: EntityDesc<Schema,
visitState: '访问状态',
router: '目标路由',
data: '透传数据',
platform: '平台',
},
action: {
succeed: '成功',
@ -100,5 +106,5 @@ const entityDesc: EntityDesc<Schema,
},
},
},
}
},
};

View File

@ -5,7 +5,7 @@ import { EntityShape } from 'oak-domain/lib/types/Entity';
import { EntityDesc } from 'oak-domain/lib/types/EntityDesc';
export interface Schema extends EntityShape {
type: String<64>
type: String<64>;
};
const entityDesc: EntityDesc<Schema> = {
@ -16,5 +16,5 @@ const entityDesc: EntityDesc<Schema> = {
type: '类型',
},
},
}
},
};

View File

@ -10,6 +10,7 @@ import { Index, ActionDef } from "oak-domain/lib/types";
import { Channel, Weight } from "../../types/Message";
import { EntityDesc } from "oak-domain/lib/types/EntityDesc";
import * as User from "../User/Schema";
import * as Platform from "../Platform/Schema";
import * as MessageSystem from "../MessageSystem/Schema";
type Router = {
pathname: string;
@ -32,6 +33,7 @@ export type OpSchema = EntityShape & {
content: Text;
data?: Object | null;
router?: Router | null;
platformId?: ForeignKey<"platform"> | null;
iState?: IState | null;
visitState?: VisitState | null;
};
@ -47,9 +49,11 @@ export type Schema = EntityShape & {
content: Text;
data?: Object | null;
router?: Router | null;
platformId?: ForeignKey<"platform"> | null;
iState?: IState | null;
visitState?: VisitState | null;
user: User.Schema;
platform?: Platform.Schema | null;
messageSystem$message?: Array<MessageSystem.Schema>;
messageSystem$message$$aggr?: AggregationResult<MessageSystem.Schema>;
} & {
@ -71,6 +75,8 @@ type AttrFilter = {
content: Q_StringValue;
data: Object;
router: JsonFilter<Router>;
platformId: Q_StringValue;
platform: Platform.Filter;
iState: Q_EnumValue<IState>;
visitState: Q_EnumValue<VisitState>;
messageSystem$message: MessageSystem.Filter & SubQueryPredicateMetadata;
@ -94,6 +100,8 @@ export type Projection = {
content?: number;
data?: number | Object;
router?: number | JsonProjection<Router>;
platformId?: number;
platform?: Platform.Projection;
iState?: number;
visitState?: number;
messageSystem$message?: MessageSystem.Selection & {
@ -109,6 +117,9 @@ type MessageIdProjection = OneOf<{
type UserIdProjection = OneOf<{
userId: number;
}>;
type PlatformIdProjection = OneOf<{
platformId: number;
}>;
export type SortAttr = {
id: number;
} | {
@ -137,6 +148,10 @@ export type SortAttr = {
content: number;
} | {
router: number;
} | {
platformId: number;
} | {
platform: Platform.SortAttr;
} | {
iState: number;
} | {
@ -152,7 +167,7 @@ export type Sorter = SortNode[];
export type SelectOperation<P extends Object = Projection> = OakSelection<"select", P, Filter, Sorter>;
export type Selection<P extends Object = Projection> = SelectOperation<P>;
export type Aggregation = DeduceAggregation<Projection, Filter, Sorter>;
export type CreateOperationData = FormCreateData<Omit<OpSchema, "entity" | "entityId" | "userId">> & (({
export type CreateOperationData = FormCreateData<Omit<OpSchema, "entity" | "entityId" | "userId" | "platformId">> & (({
userId?: never;
user: User.CreateSingleOperation;
} | {
@ -160,6 +175,14 @@ export type CreateOperationData = FormCreateData<Omit<OpSchema, "entity" | "enti
user?: User.UpdateOperation;
} | {
userId: ForeignKey<"user">;
}) & ({
platformId?: never;
platform?: Platform.CreateSingleOperation;
} | {
platformId: ForeignKey<"platform">;
platform?: Platform.UpdateOperation;
} | {
platformId?: ForeignKey<"platform">;
})) & ({
entity?: string;
entityId?: string;
@ -170,7 +193,7 @@ export type CreateOperationData = FormCreateData<Omit<OpSchema, "entity" | "enti
export type CreateSingleOperation = OakOperation<"create", CreateOperationData>;
export type CreateMultipleOperation = OakOperation<"create", Array<CreateOperationData>>;
export type CreateOperation = CreateSingleOperation | CreateMultipleOperation;
export type UpdateOperationData = FormUpdateData<Omit<OpSchema, "userId">> & (({
export type UpdateOperationData = FormUpdateData<Omit<OpSchema, "userId" | "platformId">> & (({
user: User.CreateSingleOperation;
userId?: never;
} | {
@ -182,6 +205,18 @@ export type UpdateOperationData = FormUpdateData<Omit<OpSchema, "userId">> & (({
} | {
user?: never;
userId?: ForeignKey<"user"> | null;
}) & ({
platform: Platform.CreateSingleOperation;
platformId?: never;
} | {
platform: Platform.UpdateOperation;
platformId?: never;
} | {
platform: Platform.RemoveOperation;
platformId?: never;
} | {
platform?: never;
platformId?: ForeignKey<"platform"> | null;
})) & {
[k: string]: any;
messageSystem$message?: OakOperation<MessageSystem.UpdateOperation["action"], Omit<MessageSystem.UpdateOperationData, "message" | "messageId">, Omit<MessageSystem.Filter, "message" | "messageId">> | OakOperation<MessageSystem.RemoveOperation["action"], Omit<MessageSystem.RemoveOperationData, "message" | "messageId">, Omit<MessageSystem.Filter, "message" | "messageId">> | OakOperation<"create", Omit<MessageSystem.CreateOperationData, "message" | "messageId">[]> | Array<OakOperation<"create", Omit<MessageSystem.CreateOperationData, "message" | "messageId">> | OakOperation<MessageSystem.UpdateOperation["action"], Omit<MessageSystem.UpdateOperationData, "message" | "messageId">, Omit<MessageSystem.Filter, "message" | "messageId">> | OakOperation<MessageSystem.RemoveOperation["action"], Omit<MessageSystem.RemoveOperationData, "message" | "messageId">, Omit<MessageSystem.Filter, "message" | "messageId">>>;
@ -189,10 +224,13 @@ export type UpdateOperationData = FormUpdateData<Omit<OpSchema, "userId">> & (({
export type UpdateOperation = OakOperation<"update" | ParticularAction | string, UpdateOperationData, Filter, Sorter>;
export type RemoveOperationData = {} & (({
user?: User.UpdateOperation | User.RemoveOperation;
}) & ({
platform?: Platform.UpdateOperation | Platform.RemoveOperation;
}));
export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>;
export type Operation = CreateOperation | UpdateOperation | RemoveOperation;
export type UserIdSubQuery = Selection<UserIdProjection>;
export type PlatformIdSubQuery = Selection<PlatformIdProjection>;
export type MessageIdSubQuery = Selection<MessageIdProjection>;
export type EntityDef = {
Schema: Schema;

View File

@ -54,6 +54,10 @@ export const desc: StorageDesc<OpSchema> = {
router: {
type: "object"
},
platformId: {
type: "ref",
ref: "platform"
},
iState: {
type: "enum",
enumeration: ["sending", "success", "failure"]

View File

@ -1 +1 @@
{"name":"消息","attr":{"entity":"关联对象","entityId":"关联对象ID","restriction":"限制","title":"标题","content":"内容","user":"关联用户","type":"消息类型","weight":"优先级","iState":"发送状态","visitState":"访问状态","router":"目标路由","data":"透传数据"},"action":{"succeed":"成功","fail":"失败","visit":"阅读"},"v":{"iState":{"sending":"发送中","success":"发送成功","failure":"发送失败"},"visitState":{"unvisited":"未读","visited":"已读"},"weight":{"high":"高","medium":"中","low":"低"}}}
{"name":"消息","attr":{"entity":"关联对象","entityId":"关联对象ID","restriction":"限制","title":"标题","content":"内容","user":"关联用户","type":"消息类型","weight":"优先级","iState":"发送状态","visitState":"访问状态","router":"目标路由","data":"透传数据","platform":"平台"},"action":{"succeed":"成功","fail":"失败","visit":"阅读"},"v":{"iState":{"sending":"发送中","success":"发送成功","failure":"发送失败"},"visitState":{"unvisited":"未读","visited":"已读"},"weight":{"high":"高","medium":"中","low":"低"}}}

View File

@ -8,6 +8,7 @@ import { EntityShape } from "oak-domain/lib/types/Entity";
import { Config } from "../../types/Config";
import { Style } from "../../types/Style";
import { EntityDesc } from "oak-domain/lib/types/EntityDesc";
import * as Message from "../Message/Schema";
import * as System from "../System/Schema";
export type OpSchema = EntityShape & {
name: String<32>;
@ -25,6 +26,8 @@ export type Schema = EntityShape & {
style?: Style | null;
entity?: String<32> | null;
entityId?: String<64> | null;
message$platform?: Array<Message.Schema>;
message$platform$$aggr?: AggregationResult<Message.Schema>;
system$platform?: Array<System.Schema>;
system$platform$$aggr?: AggregationResult<System.Schema>;
} & {
@ -41,6 +44,7 @@ type AttrFilter = {
style: JsonFilter<Style>;
entity: Q_StringValue;
entityId: Q_StringValue;
message$platform: Message.Filter & SubQueryPredicateMetadata;
system$platform: System.Filter & SubQueryPredicateMetadata;
};
export type Filter = MakeFilter<AttrFilter & ExprOp<OpAttr | string>>;
@ -57,6 +61,12 @@ export type Projection = {
style?: number | JsonProjection<Style>;
entity?: number;
entityId?: number;
message$platform?: Message.Selection & {
$entity: "message";
};
message$platform$$aggr?: Message.Aggregation & {
$entity: "message";
};
system$platform?: System.Selection & {
$entity: "system";
};
@ -103,6 +113,7 @@ export type CreateOperationData = FormCreateData<Omit<OpSchema, "entity" | "enti
entityId?: string;
[K: string]: any;
}) & {
message$platform?: OakOperation<Message.UpdateOperation["action"], Omit<Message.UpdateOperationData, "platform" | "platformId">, Omit<Message.Filter, "platform" | "platformId">> | OakOperation<"create", Omit<Message.CreateOperationData, "platform" | "platformId">[]> | Array<OakOperation<"create", Omit<Message.CreateOperationData, "platform" | "platformId">> | OakOperation<Message.UpdateOperation["action"], Omit<Message.UpdateOperationData, "platform" | "platformId">, Omit<Message.Filter, "platform" | "platformId">>>;
system$platform?: OakOperation<System.UpdateOperation["action"], Omit<System.UpdateOperationData, "platform" | "platformId">, Omit<System.Filter, "platform" | "platformId">> | OakOperation<"create", Omit<System.CreateOperationData, "platform" | "platformId">[]> | Array<OakOperation<"create", Omit<System.CreateOperationData, "platform" | "platformId">> | OakOperation<System.UpdateOperation["action"], Omit<System.UpdateOperationData, "platform" | "platformId">, Omit<System.Filter, "platform" | "platformId">>>;
};
export type CreateSingleOperation = OakOperation<"create", CreateOperationData>;
@ -110,6 +121,7 @@ export type CreateMultipleOperation = OakOperation<"create", Array<CreateOperati
export type CreateOperation = CreateSingleOperation | CreateMultipleOperation;
export type UpdateOperationData = FormUpdateData<OpSchema> & {
[k: string]: any;
message$platform?: OakOperation<Message.UpdateOperation["action"], Omit<Message.UpdateOperationData, "platform" | "platformId">, Omit<Message.Filter, "platform" | "platformId">> | OakOperation<Message.RemoveOperation["action"], Omit<Message.RemoveOperationData, "platform" | "platformId">, Omit<Message.Filter, "platform" | "platformId">> | OakOperation<"create", Omit<Message.CreateOperationData, "platform" | "platformId">[]> | Array<OakOperation<"create", Omit<Message.CreateOperationData, "platform" | "platformId">> | OakOperation<Message.UpdateOperation["action"], Omit<Message.UpdateOperationData, "platform" | "platformId">, Omit<Message.Filter, "platform" | "platformId">> | OakOperation<Message.RemoveOperation["action"], Omit<Message.RemoveOperationData, "platform" | "platformId">, Omit<Message.Filter, "platform" | "platformId">>>;
system$platform?: OakOperation<System.UpdateOperation["action"], Omit<System.UpdateOperationData, "platform" | "platformId">, Omit<System.Filter, "platform" | "platformId">> | OakOperation<System.RemoveOperation["action"], Omit<System.RemoveOperationData, "platform" | "platformId">, Omit<System.Filter, "platform" | "platformId">> | OakOperation<"create", Omit<System.CreateOperationData, "platform" | "platformId">[]> | Array<OakOperation<"create", Omit<System.CreateOperationData, "platform" | "platformId">> | OakOperation<System.UpdateOperation["action"], Omit<System.UpdateOperationData, "platform" | "platformId">, Omit<System.Filter, "platform" | "platformId">> | OakOperation<System.RemoveOperation["action"], Omit<System.RemoveOperationData, "platform" | "platformId">, Omit<System.Filter, "platform" | "platformId">>>;
};
export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>;

View File

@ -278,7 +278,9 @@ export type ParasiteIdSubQuery = {
}) | any;
};
export type PlatformIdSubQuery = {
[K in "$in" | "$nin"]?: (System.PlatformIdSubQuery & {
[K in "$in" | "$nin"]?: (Message.PlatformIdSubQuery & {
entity: "message";
}) | (System.PlatformIdSubQuery & {
entity: "system";
}) | (Platform.PlatformIdSubQuery & {
entity: "platform";

View File

@ -109,7 +109,7 @@ export default function Render(
return (
<PageHeader showBack={true} title="应用概览">
<div className={Style.container}>
<Card title={name} bordered={false} actions={Actions}>
<Card title={name} bordered={false} extra={Actions}>
<Tabs
items={items}
/>

View File

@ -1,7 +1,7 @@
export default OakComponent({
isList: true,
entity: 'application',
actions: ['update', 'remove'],
actions: ['update', 'remove', 'create'],
projection: {
id: 1,
name: 1,

View File

@ -13,11 +13,7 @@ export default function Render(
'application',
true,
{
searchValue: string;
list: RowWithActions<EntityDict, 'application'>[];
pagination: any;
showBack: boolean;
variant?: 'inline' | 'alone' | 'dialog';
},
{
goDetail: (id: string) => void;
@ -32,9 +28,8 @@ export default function Render(
oakPagination,
list = [],
oakLoading,
showBack,
variant,
oakFullpath,
oakLegalActions,
} = props.data;
const { pageSize, total, currentPage } = oakPagination || {};
@ -51,30 +46,32 @@ export default function Render(
} = props.methods;
return (
<Container variant={variant}>
<Space>
<Button
type="primary"
onClick={() => {
goCreate();
}}
>
</Button>
</Space>
<>
{oakLegalActions?.includes('create') && (
<Space style={{ marginBottom: 16 }}>
<Button
type="primary"
onClick={() => {
goCreate();
}}
>
</Button>
</Space>
)}
<Table
loading={oakLoading}
dataSource={list}
rowKey="id"
columns={[
// {
// dataIndex: 'id',
// title: '序号',
// render: (value, record, index) => {
// return index + 1;
// },
// },
{
dataIndex: 'id',
title: '#',
render: (value, record, index) => {
return index + 1;
},
},
{
dataIndex: 'name',
title: '应用名称',
@ -82,6 +79,11 @@ export default function Render(
render: (value, record, index) => {
return (
<Typography.Link
disabled={
!record?.['#oakLegalActions']?.includes(
'update'
)
}
onClick={() => {
goDetail(record.id!);
}}
@ -113,6 +115,11 @@ export default function Render(
<>
<Button
type="link"
disabled={
!record?.[
'#oakLegalActions'
]?.includes('update')
}
onClick={() => {
goSetConfig(record.id!);
}}
@ -144,7 +151,9 @@ export default function Render(
{
action: 'update',
show: record?.['#oakLegalActions']?.includes('update'),
show: record?.[
'#oakLegalActions'
]?.includes('update'),
onClick: () => {
goUpdate(record.id!);
},
@ -152,7 +161,9 @@ export default function Render(
{
action: 'remove',
alerted: true,
show: record?.['#oakLegalActions']?.includes('remove'),
show: record?.[
'#oakLegalActions'
]?.includes('remove'),
onClick: () => {
removeApplication(
record.id!
@ -179,22 +190,6 @@ export default function Render(
},
}}
/>
</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>
</>
);
}

View File

@ -1,7 +1,7 @@
export default OakComponent({
isList: true,
entity: 'domain',
actions: ['update'],
actions: ['update', 'create'],
projection: {
id: 1,
systemId: 1,

View File

@ -14,11 +14,7 @@ export default function Render(
'domain',
true,
{
searchValue: string;
list: RowWithActions<EntityDict, 'domain'>[];
pagination: any;
showBack: boolean;
variant?: 'inline' | 'alone' | 'dialog';
},
{
goDetail: (id: string) => void;
@ -31,9 +27,8 @@ export default function Render(
oakPagination,
list = [],
oakLoading,
showBack,
variant,
oakFullpath,
oakLegalActions,
} = props.data;
const { pageSize, total, currentPage } = oakPagination || {};
@ -48,30 +43,33 @@ export default function Render(
} = props.methods;
return (
<Container showBack={showBack} variant={variant}>
<Space>
<Button
type="primary"
onClick={() => {
goCreate();
}}
>
</Button>
</Space>
<>
{oakLegalActions?.includes('create') && (
<Space style={{ marginBottom: 16 }}>
<Button
type="primary"
onClick={() => {
goCreate();
}}
>
</Button>
</Space>
)}
<Table
loading={oakLoading}
dataSource={list}
rowKey="id"
columns={[
// {
// dataIndex: 'id',
// title: '序号',
// render: (value, record, index) => {
// return index + 1;
// },
// },
{
dataIndex: 'id',
title: '#',
render: (value, record, index) => {
return index + 1;
},
},
{
dataIndex: 'url',
@ -79,6 +77,11 @@ export default function Render(
render: (value, record, index) => {
return (
<Typography.Link
disabled={
!record?.['#oakLegalActions']?.includes(
'update'
)
}
onClick={() => {
goDetail(record.id!);
}}
@ -121,7 +124,9 @@ export default function Render(
{
action: 'update',
show: record?.['#oakLegalActions']?.includes('update'),
show: record?.[
'#oakLegalActions'
]?.includes('update'),
onClick: () => {
goUpdate(record.id!);
},
@ -146,22 +151,7 @@ export default function Render(
},
}}
/>
</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>
);
}

View File

@ -70,7 +70,6 @@ export default function Render(
children: (
<SystemList
platformId={oakId}
variant="inline"
oakPath="$platform/detail/-system/list"
oakAutoUnmount={true}
/>

View File

@ -1,7 +1,7 @@
export default OakComponent({
isList: true,
entity: 'platform',
actions: ['update'],
actions: ['update', 'create'],
projection: {
id: 1,
name: 1,

View File

@ -15,11 +15,7 @@ export default function Render(
'platform',
true,
{
searchValue: string;
list: RowWithActions<EntityDict, 'platform'>[];
pagination: any;
showBack: boolean;
variant?: 'inline' | 'alone' | 'dialog';
},
{
goDetail: (id: string) => void;
@ -33,9 +29,8 @@ export default function Render(
oakPagination,
list = [],
oakLoading,
showBack,
variant,
oakFullpath,
oakLegalActions
} = props.data;
const { pageSize, total, currentPage } = oakPagination || {};
@ -53,29 +48,31 @@ export default function Render(
return (
<PageHeader title="平台管理">
<div className={Style.container}>
<Space style={{ marginBottom: 16 }}>
<Button
type="primary"
onClick={() => {
goCreate();
}}
>
</Button>
</Space>
{oakLegalActions?.includes('create') && (
<Space style={{ marginBottom: 16 }}>
<Button
type="primary"
onClick={() => {
goCreate();
}}
>
</Button>
</Space>
)}
<Table
loading={oakLoading}
dataSource={list}
rowKey="id"
columns={[
// {
// dataIndex: 'id',
// title: '序号',
// render: (value, record, index) => {
// return index + 1;
// },
// },
{
dataIndex: 'id',
title: '#',
render: (value, record, index) => {
return index + 1;
},
},
{
dataIndex: 'name',
title: '平台名称',
@ -83,6 +80,11 @@ export default function Render(
render: (value, record, index) => {
return (
<Typography.Link
disabled={
!record?.[
'#oakLegalActions'
]?.includes('update')
}
onClick={() => {
goDetail(record.id!);
}}
@ -115,6 +117,11 @@ export default function Render(
<>
<Button
type="link"
disabled={
!record?.[
'#oakLegalActions'
]?.includes('update')
}
onClick={() => {
goSetConfig(record.id!);
}}
@ -146,7 +153,9 @@ export default function Render(
{
action: 'update',
show: record?.['#oakLegalActions']?.includes('update'),
show: record?.[
'#oakLegalActions'
]?.includes('update'),
onClick: () => {
goUpdate(record.id!);
},

View File

@ -91,7 +91,6 @@ export default function Render(
children: (
<ApplicationList
systemId={oakId}
variant="inline"
oakPath="$system/detail-application/list"
oakAutoUnmount={true}
/>
@ -103,7 +102,6 @@ export default function Render(
children: (
<DomainList
systemId={oakId}
variant="inline"
oakPath="$system/detail-domain/list"
oakAutoUnmount={true}
/>

View File

@ -1,7 +1,7 @@
export default OakComponent({
isList: true,
entity: 'system',
actions: ['update'],
actions: ['update', 'create'],
projection: {
id: 1,
name: 1,

View File

@ -14,11 +14,7 @@ export default function Render(
'system',
true,
{
searchValue: string;
list: RowWithActions<EntityDict, 'system'>[];
pagination: any;
showBack: boolean;
variant?: 'inline' | 'alone' | 'dialog';
},
{
goDetail: (id: string) => void;
@ -32,9 +28,8 @@ export default function Render(
oakPagination,
list = [],
oakLoading,
showBack,
variant,
oakFullpath,
oakLegalActions,
} = props.data;
const { pageSize, total, currentPage } = oakPagination || {};
@ -50,30 +45,32 @@ export default function Render(
} = props.methods;
return (
<Container showBack={showBack} variant={variant}>
<Space>
<Button
type="primary"
onClick={() => {
goCreate();
}}
>
</Button>
</Space>
<>
{oakLegalActions?.includes('create') && (
<Space style={{ marginBottom: 16 }}>
<Button
type="primary"
onClick={() => {
goCreate();
}}
>
</Button>
</Space>
)}
<Table
loading={oakLoading}
dataSource={list}
rowKey="id"
columns={[
// {
// dataIndex: 'id',
// title: '序号',
// render: (value, record, index) => {
// return index + 1;
// },
// },
{
dataIndex: 'id',
title: '#',
render: (value, record, index) => {
return index + 1;
},
},
{
dataIndex: 'name',
title: '系统名称',
@ -81,6 +78,11 @@ export default function Render(
render: (value, record, index) => {
return (
<Typography.Link
disabled={
!record?.['#oakLegalActions']?.includes(
'update'
)
}
onClick={() => {
goDetail(record.id!);
}}
@ -125,6 +127,11 @@ export default function Render(
<>
<Button
type="link"
disabled={
!record?.[
'#oakLegalActions'
]?.includes('update')
}
onClick={() => {
goSetConfig(record.id!);
}}
@ -156,7 +163,9 @@ export default function Render(
{
action: 'update',
show: record?.['#oakLegalActions']?.includes('update'),
show: record?.[
'#oakLegalActions'
]?.includes('update'),
onClick: () => {
goUpdate(record.id!);
},
@ -181,22 +190,6 @@ export default function Render(
},
}}
/>
</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>
</>
);
}

View File

@ -115,6 +115,14 @@ export default OakComponent({
this.update({ [attr]: value });
},
async confirm() {
const { nickname } = this.state;
if (!nickname) {
this.setMessage({
type: 'warning',
content: '请输入昵称'
})
return
}
await this.execute();
this.navigateBack();
},

View File

@ -40,7 +40,7 @@ export default function Render(
wrapperCol={{ span: 16 }}
style={{ maxWidth: 600 }}
>
<Form.Item label={t('user:attr.nickname')}>
<Form.Item label={t('user:attr.nickname')} required>
<Input
onChange={(e) => update({ nickname: e.target.value })}
value={data.nickname || ''}

View File

@ -35,7 +35,10 @@ export default function Render(
return (
<div className={Style.container}>
<Form layout="horizontal">
<Form.Item label={t('user:attr.nickname')}>
<Form.Item
label={t('user:attr.nickname')}
rules={[{ required: true }]}
>
<Input
onChange={(val) => update({ nickname: val })}
value={data.nickname || ''}

View File

@ -58,13 +58,11 @@ export async function tryMakeSmsNotification(message: EntityDict['message']['Sch
}
async function createNotification(message: CreateMessageData, context: BRC) {
const { restriction, userId, weight, type, entity, entityId } = message;
const { restriction, userId, weight, type, entity, entityId, platformId } = message;
assert(userId);
// 根据用户所关联的system和定义限制选择将要发送的system。这里有的应用是到platform级别有的是到system级别
const application = context.getApplication();
const platformId = application!.system!.platformId!;
const systemId = application!.systemId;
const filter: EntityDict['userSystem']['Selection']['filter'] = {
userId,
};
@ -73,10 +71,6 @@ async function createNotification(message: CreateMessageData, context: BRC) {
platformId,
};
}
else {
assert(systemId);
filter.systemId = systemId;
}
const userSystems = await context.select('userSystem', {
data: {
id: 1,

View File

@ -1,4 +1,4 @@
import { generateNewId, generateNewIdAsync } from 'oak-domain/lib/utils/uuid';
import { generateNewIdAsync } from 'oak-domain/lib/utils/uuid';
import { CreateTrigger, Trigger } from 'oak-domain/lib/types/Trigger';
import { EntityDict } from '../oak-app-domain/EntityDict';
import { CreateOperationData as CreateUserData } from '../oak-app-domain/User/Schema';
@ -17,46 +17,28 @@ const triggers: Trigger<EntityDict, 'user', RuntimeCxt>[] = [
fn: async ({ operation }, context) => {
const { data } = operation;
const systemId = context.getSystemId();
const setDefaultState = (userData: CreateUserData) => {
const setData = async (userData: CreateUserData) => {
if (!userData.userState) {
userData.userState = 'shadow';
}
if (!userData.nickname) {
userData.nickname = randomName('user_', 8);
}
userData.userSystem$user = [
{
id: await generateNewIdAsync(),
action: 'create',
data: {
id: await generateNewIdAsync(),
systemId,
},
},
];
};
if (data instanceof Array) {
await Promise.all(
data.map(async (ele) => {
Object.assign(ele, {
userSystem$user: [
{
id: generateNewId(),
action: 'create',
data: {
id: generateNewId(),
systemId,
},
},
],
});
setDefaultState(ele);
})
);
data.forEach(async (ele) => await setData(ele));
} else {
Object.assign(data, {
userSystem$user: [
{
id: generateNewId(),
action: 'create',
data: {
id: generateNewId(),
systemId,
},
},
],
});
setDefaultState(data);
await setData(data);
}
return 1;
},

View File

@ -45,13 +45,14 @@ export const userProjection: EntityDict['user']['Selection']['data'] = {
};
export const tokenProjection: EntityDict['token']['Selection']['data'] = {
id: 1,
applicationId: 1,
userId: 1,
user: userProjection,
ableState: 1,
playerId: 1,
player: {
id: 1,
isRoot: 1,
isRoot: 1,
},
entity: 1,
entityId: 1,
@ -84,6 +85,7 @@ export const applicationProjection: EntityDict['application']['Selection']['data
type: 1,
systemId: 1,
style: 1,
description: 1,
system: {
id: 1,
name: 1,