Merge branch 'dev' of codeup.aliyun.com:61c14a7efa282c88e103c23f/oak-general-business into dev
This commit is contained in:
commit
6d451a26eb
|
|
@ -1,11 +1,12 @@
|
|||
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
||||
import { useState, useRef, useEffect } from 'react';
|
||||
import { Input, Button, Dropdown, Divider, Modal, Form, Image } from 'antd';
|
||||
import { Input, Button, Dropdown, Divider, Modal, Form, Image, Space } from 'antd';
|
||||
import { EditOutlined, DownOutlined, UpOutlined, MinusOutlined, PlusOutlined, EyeOutlined } from '@ant-design/icons';
|
||||
import ArticleMenuTreeList from '../treeList';
|
||||
import ArticleTreeList from '../../article/treeList';
|
||||
import Styles from './web.pc.module.less';
|
||||
import OakGallery from "../../../components/extraFile/gallery";
|
||||
import ExtraFileUpload from '../../extraFile/upload';
|
||||
import ExtraFileCommit from '../../extraFile/commit';
|
||||
export default function Render(props) {
|
||||
const { row, allowCreateSubArticle, allowCreateSubMenu, allowRemove, onRemove, onUpdateName, oakFullpath, logo, onChildEditArticleChange, editArticle, show, getBreadcrumbItemsByParent, breadItems, drawerOpen, changeDrawerOpen, selectedArticleId, openArray, getTopInfo, articleId, articleMenuId, getSideInfo, currentArticle, setCurrentArticle } = props.data;
|
||||
const { update, execute, createSubArticle, createSubArticleMenu, setMessage, gotoDoc } = props.methods;
|
||||
|
|
@ -120,24 +121,35 @@ export default function Render(props) {
|
|||
// </div> :
|
||||
_jsxs(_Fragment, { children: [_jsx(Button, { type: "text", icon: _jsx(EditOutlined, {}), size: "small", onClick: () => {
|
||||
setNameEditing(true);
|
||||
modal.confirm({
|
||||
const modalInstance = modal.confirm({
|
||||
title: '编辑分类',
|
||||
cancelText: '取消',
|
||||
okText: '提交',
|
||||
content: (_jsxs("div", { children: [_jsx(Form.Item, { label: "\u5206\u7C7B\u540D\u79F0", children: _jsx(Input, { ref: menuNameRef, defaultValue: row.name }) }), _jsx(Form.Item, { label: "LOGO", help: _jsxs("div", { children: [_jsx("span", { children: "\u8BF7\u4E0A\u4F20LOGO\u9AD8\u6E05\u56FE\u7247\uFF0C" }), _jsx("span", { children: "108*108\u50CF\u7D20\uFF0C\u4EC5\u652F\u6301PNG\u3001JPG\u683C\u5F0F\uFF0C\u5927\u5C0F\u4E0D\u8D85\u8FC7300KB\u3002" })] }), children: _jsx(_Fragment, { children: _jsx(OakGallery, { oakPath: oakFullpath
|
||||
content: (_jsxs("div", { children: [_jsx(Form.Item, { label: "\u5206\u7C7B\u540D\u79F0", children: _jsx(Input, { ref: menuNameRef, defaultValue: row.name, onChange: (val) => update({ name: val.target.value }) }) }), _jsx(Form.Item, { label: "LOGO", help: _jsxs("div", { children: [_jsx("span", { children: "\u8BF7\u4E0A\u4F20LOGO\u9AD8\u6E05\u56FE\u7247\uFF0C" }), _jsx("span", { children: "108*108\u50CF\u7D20\uFF0C\u4EC5\u652F\u6301PNG\u3001JPG\u683C\u5F0F\uFF0C\u5927\u5C0F\u4E0D\u8D85\u8FC7300KB\u3002" })] }), children: _jsx(_Fragment, { children: _jsx(ExtraFileUpload, { oakPath: oakFullpath
|
||||
? `${oakFullpath}.extraFile$entity$1`
|
||||
: undefined, type: "image", origin: "qiniu", tag1: "logo", entity: "articleMenu", accept: ".PNG, .JPG", maxNumber: 1 }) }) })] })),
|
||||
onOk: async () => {
|
||||
if (menuNameRef.current.input.value) {
|
||||
await onUpdateName(menuNameRef.current.input.value);
|
||||
}
|
||||
else {
|
||||
setMessage({
|
||||
type: 'warning',
|
||||
content: '请输入分类标题',
|
||||
});
|
||||
}
|
||||
}
|
||||
// onOk: async () => {
|
||||
// if (menuNameRef.current!.input!.value) {
|
||||
// await onUpdateName(menuNameRef.current!.input!.value);
|
||||
// } else {
|
||||
// setMessage({
|
||||
// type: 'warning',
|
||||
// content: '请输入分类标题',
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
footer: () => _jsxs(Space, { children: [_jsx(ExtraFileCommit, { oakPath: oakFullpath, efPaths: [
|
||||
'extraFile$entity$1',
|
||||
], afterCommit: () => {
|
||||
modalInstance.destroy();
|
||||
}, beforeCommit: () => {
|
||||
if (menuNameRef.current.input.value) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
} }), _jsx(Button, { onClick: () => modalInstance.destroy(), children: "\u53D6\u6D88" })] })
|
||||
});
|
||||
}, style: { marginRight: 4 } }), _jsxs("div", { className: Styles.name, children: [logo ? (_jsx(Image, { height: 26, width: 26, src: logo, preview: false })) : null, _jsx("div", { style: { marginLeft: 4, overflow: 'hidden', width: '100px', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }, children: row?.name })] })] }) }), _jsx(Divider, { type: "vertical", style: { height: '100%', marginTop: 4, marginBottom: 4 } }), _jsxs("div", { className: Styles.control, children: [!row.parentId && _jsx(Button, { type: "text", onClick: () => {
|
||||
gotoDoc(row?.id);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
import { EntityDict } from '../oak-app-domain/EntityDict';
|
||||
import { Trigger } from 'oak-domain/lib/types';
|
||||
import { BackendRuntimeContext } from '../context/BackendRuntimeContext';
|
||||
declare const triggers: Trigger<EntityDict, 'account', BackendRuntimeContext<EntityDict>>[];
|
||||
export default triggers;
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
import { assert } from 'oak-domain/lib/utils/assert';
|
||||
import { generateNewIdAsync } from 'oak-domain/lib/utils/uuid';
|
||||
const triggers = [
|
||||
// 目前先这样授予关系
|
||||
{
|
||||
name: '充值的时候,将用户赋予owner关系',
|
||||
entity: 'account',
|
||||
action: 'create',
|
||||
when: 'before',
|
||||
fn: async (event, context) => {
|
||||
const { operation: { data, filter }, } = event;
|
||||
assert(!(data instanceof Array));
|
||||
const accountId = data.id;
|
||||
const [relation] = await context.select('relation', {
|
||||
data: {
|
||||
id: 1,
|
||||
},
|
||||
filter: {
|
||||
name: 'owner',
|
||||
entity: 'account',
|
||||
entityId: {
|
||||
$exists: false,
|
||||
}
|
||||
}
|
||||
}, { dontCollect: true });
|
||||
assert(relation);
|
||||
const closeRootMode = context.openRootMode();
|
||||
await context.operate('userRelation', {
|
||||
id: await generateNewIdAsync(),
|
||||
action: 'create',
|
||||
data: {
|
||||
id: await generateNewIdAsync(),
|
||||
relationId: relation.id,
|
||||
userId: context.getCurrentUserId(),
|
||||
entity: 'account',
|
||||
entityId: accountId,
|
||||
},
|
||||
}, {});
|
||||
closeRootMode();
|
||||
return 1;
|
||||
},
|
||||
},
|
||||
];
|
||||
export default triggers;
|
||||
|
|
@ -8,7 +8,8 @@ const icons_1 = require("@ant-design/icons");
|
|||
const treeList_1 = tslib_1.__importDefault(require("../treeList"));
|
||||
const treeList_2 = tslib_1.__importDefault(require("../../article/treeList"));
|
||||
const web_pc_module_less_1 = tslib_1.__importDefault(require("./web.pc.module.less"));
|
||||
const gallery_1 = tslib_1.__importDefault(require("../../../components/extraFile/gallery"));
|
||||
const upload_1 = tslib_1.__importDefault(require("../../extraFile/upload"));
|
||||
const commit_1 = tslib_1.__importDefault(require("../../extraFile/commit"));
|
||||
function Render(props) {
|
||||
const { row, allowCreateSubArticle, allowCreateSubMenu, allowRemove, onRemove, onUpdateName, oakFullpath, logo, onChildEditArticleChange, editArticle, show, getBreadcrumbItemsByParent, breadItems, drawerOpen, changeDrawerOpen, selectedArticleId, openArray, getTopInfo, articleId, articleMenuId, getSideInfo, currentArticle, setCurrentArticle } = props.data;
|
||||
const { update, execute, createSubArticle, createSubArticleMenu, setMessage, gotoDoc } = props.methods;
|
||||
|
|
@ -123,24 +124,35 @@ function Render(props) {
|
|||
// </div> :
|
||||
(0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(antd_1.Button, { type: "text", icon: (0, jsx_runtime_1.jsx)(icons_1.EditOutlined, {}), size: "small", onClick: () => {
|
||||
setNameEditing(true);
|
||||
modal.confirm({
|
||||
const modalInstance = modal.confirm({
|
||||
title: '编辑分类',
|
||||
cancelText: '取消',
|
||||
okText: '提交',
|
||||
content: ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(antd_1.Form.Item, { label: "\u5206\u7C7B\u540D\u79F0", children: (0, jsx_runtime_1.jsx)(antd_1.Input, { ref: menuNameRef, defaultValue: row.name }) }), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, { label: "LOGO", help: (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("span", { children: "\u8BF7\u4E0A\u4F20LOGO\u9AD8\u6E05\u56FE\u7247\uFF0C" }), (0, jsx_runtime_1.jsx)("span", { children: "108*108\u50CF\u7D20\uFF0C\u4EC5\u652F\u6301PNG\u3001JPG\u683C\u5F0F\uFF0C\u5927\u5C0F\u4E0D\u8D85\u8FC7300KB\u3002" })] }), children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(gallery_1.default, { oakPath: oakFullpath
|
||||
content: ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(antd_1.Form.Item, { label: "\u5206\u7C7B\u540D\u79F0", children: (0, jsx_runtime_1.jsx)(antd_1.Input, { ref: menuNameRef, defaultValue: row.name, onChange: (val) => update({ name: val.target.value }) }) }), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, { label: "LOGO", help: (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("span", { children: "\u8BF7\u4E0A\u4F20LOGO\u9AD8\u6E05\u56FE\u7247\uFF0C" }), (0, jsx_runtime_1.jsx)("span", { children: "108*108\u50CF\u7D20\uFF0C\u4EC5\u652F\u6301PNG\u3001JPG\u683C\u5F0F\uFF0C\u5927\u5C0F\u4E0D\u8D85\u8FC7300KB\u3002" })] }), children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(upload_1.default, { oakPath: oakFullpath
|
||||
? `${oakFullpath}.extraFile$entity$1`
|
||||
: undefined, type: "image", origin: "qiniu", tag1: "logo", entity: "articleMenu", accept: ".PNG, .JPG", maxNumber: 1 }) }) })] })),
|
||||
onOk: async () => {
|
||||
if (menuNameRef.current.input.value) {
|
||||
await onUpdateName(menuNameRef.current.input.value);
|
||||
}
|
||||
else {
|
||||
setMessage({
|
||||
type: 'warning',
|
||||
content: '请输入分类标题',
|
||||
});
|
||||
}
|
||||
}
|
||||
// onOk: async () => {
|
||||
// if (menuNameRef.current!.input!.value) {
|
||||
// await onUpdateName(menuNameRef.current!.input!.value);
|
||||
// } else {
|
||||
// setMessage({
|
||||
// type: 'warning',
|
||||
// content: '请输入分类标题',
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
footer: () => (0, jsx_runtime_1.jsxs)(antd_1.Space, { children: [(0, jsx_runtime_1.jsx)(commit_1.default, { oakPath: oakFullpath, efPaths: [
|
||||
'extraFile$entity$1',
|
||||
], afterCommit: () => {
|
||||
modalInstance.destroy();
|
||||
}, beforeCommit: () => {
|
||||
if (menuNameRef.current.input.value) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
} }), (0, jsx_runtime_1.jsx)(antd_1.Button, { onClick: () => modalInstance.destroy(), children: "\u53D6\u6D88" })] })
|
||||
});
|
||||
}, style: { marginRight: 4 } }), (0, jsx_runtime_1.jsxs)("div", { className: web_pc_module_less_1.default.name, children: [logo ? ((0, jsx_runtime_1.jsx)(antd_1.Image, { height: 26, width: 26, src: logo, preview: false })) : null, (0, jsx_runtime_1.jsx)("div", { style: { marginLeft: 4, overflow: 'hidden', width: '100px', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }, children: row?.name })] })] }) }), (0, jsx_runtime_1.jsx)(antd_1.Divider, { type: "vertical", style: { height: '100%', marginTop: 4, marginBottom: 4 } }), (0, jsx_runtime_1.jsxs)("div", { className: web_pc_module_less_1.default.control, children: [!row.parentId && (0, jsx_runtime_1.jsx)(antd_1.Button, { type: "text", onClick: () => {
|
||||
gotoDoc(row?.id);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
import { EntityDict } from '../oak-app-domain/EntityDict';
|
||||
import { Trigger } from 'oak-domain/lib/types';
|
||||
import { BackendRuntimeContext } from '../context/BackendRuntimeContext';
|
||||
declare const triggers: Trigger<EntityDict, 'account', BackendRuntimeContext<EntityDict>>[];
|
||||
export default triggers;
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const assert_1 = require("oak-domain/lib/utils/assert");
|
||||
const uuid_1 = require("oak-domain/lib/utils/uuid");
|
||||
const triggers = [
|
||||
// 目前先这样授予关系
|
||||
{
|
||||
name: '充值的时候,将用户赋予owner关系',
|
||||
entity: 'account',
|
||||
action: 'create',
|
||||
when: 'before',
|
||||
fn: async (event, context) => {
|
||||
const { operation: { data, filter }, } = event;
|
||||
(0, assert_1.assert)(!(data instanceof Array));
|
||||
const accountId = data.id;
|
||||
const [relation] = await context.select('relation', {
|
||||
data: {
|
||||
id: 1,
|
||||
},
|
||||
filter: {
|
||||
name: 'owner',
|
||||
entity: 'account',
|
||||
entityId: {
|
||||
$exists: false,
|
||||
}
|
||||
}
|
||||
}, { dontCollect: true });
|
||||
(0, assert_1.assert)(relation);
|
||||
const closeRootMode = context.openRootMode();
|
||||
await context.operate('userRelation', {
|
||||
id: await (0, uuid_1.generateNewIdAsync)(),
|
||||
action: 'create',
|
||||
data: {
|
||||
id: await (0, uuid_1.generateNewIdAsync)(),
|
||||
relationId: relation.id,
|
||||
userId: context.getCurrentUserId(),
|
||||
entity: 'account',
|
||||
entityId: accountId,
|
||||
},
|
||||
}, {});
|
||||
closeRootMode();
|
||||
return 1;
|
||||
},
|
||||
},
|
||||
];
|
||||
exports.default = triggers;
|
||||
|
|
@ -1,12 +1,13 @@
|
|||
import React, { useState, useRef, useEffect } from 'react';
|
||||
import { Input, Button, MenuProps, Dropdown, Divider, Modal, InputRef, Form, Image } from 'antd';
|
||||
import { Input, Button, MenuProps, Dropdown, Divider, Modal, InputRef, Form, Image, Space } from 'antd';
|
||||
import { EditOutlined, DownOutlined, UpOutlined, RightOutlined, LeftOutlined, MinusOutlined, PlusOutlined, EyeOutlined } from '@ant-design/icons';
|
||||
import { WebComponentProps } from "oak-frontend-base";
|
||||
import ArticleMenuTreeList from '../treeList';
|
||||
import ArticleTreeList from '../../article/treeList';
|
||||
import { EntityDict } from "../../../oak-app-domain";
|
||||
import Styles from './web.pc.module.less';
|
||||
import OakGallery from "../../../components/extraFile/gallery";
|
||||
import ExtraFileUpload from '../../extraFile/upload';
|
||||
import ExtraFileCommit from '../../extraFile/commit';
|
||||
|
||||
export default function Render(props: WebComponentProps<EntityDict, 'articleMenu', false, {
|
||||
row: EntityDict['articleMenu']['OpSchema'];
|
||||
|
|
@ -219,7 +220,7 @@ export default function Render(props: WebComponentProps<EntityDict, 'articleMenu
|
|||
size="small"
|
||||
onClick={() => {
|
||||
setNameEditing(true);
|
||||
modal.confirm({
|
||||
const modalInstance = modal.confirm({
|
||||
title: '编辑分类',
|
||||
cancelText: '取消',
|
||||
okText: '提交',
|
||||
|
|
@ -231,6 +232,7 @@ export default function Render(props: WebComponentProps<EntityDict, 'articleMenu
|
|||
<Input
|
||||
ref={menuNameRef}
|
||||
defaultValue={row.name}
|
||||
onChange={(val) => update({ name: val.target.value })}
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
|
|
@ -245,7 +247,7 @@ export default function Render(props: WebComponentProps<EntityDict, 'articleMenu
|
|||
}
|
||||
>
|
||||
<>
|
||||
<OakGallery
|
||||
<ExtraFileUpload
|
||||
oakPath={
|
||||
oakFullpath
|
||||
? `${oakFullpath}.extraFile$entity$1`
|
||||
|
|
@ -262,17 +264,37 @@ export default function Render(props: WebComponentProps<EntityDict, 'articleMenu
|
|||
</Form.Item>
|
||||
</div>
|
||||
),
|
||||
onOk: async () => {
|
||||
if (menuNameRef.current!.input!.value) {
|
||||
await onUpdateName(menuNameRef.current!.input!.value);
|
||||
} else {
|
||||
setMessage({
|
||||
type: 'warning',
|
||||
content: '请输入分类标题',
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
// onOk: async () => {
|
||||
// if (menuNameRef.current!.input!.value) {
|
||||
// await onUpdateName(menuNameRef.current!.input!.value);
|
||||
// } else {
|
||||
// setMessage({
|
||||
// type: 'warning',
|
||||
// content: '请输入分类标题',
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
footer: () => <Space>
|
||||
<ExtraFileCommit
|
||||
oakPath={oakFullpath}
|
||||
efPaths={[
|
||||
'extraFile$entity$1',
|
||||
]}
|
||||
afterCommit={() => {
|
||||
modalInstance!.destroy()
|
||||
}}
|
||||
beforeCommit={() => {
|
||||
if (menuNameRef.current!.input!.value) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}}
|
||||
/>
|
||||
<Button onClick={() => modalInstance!.destroy()}>
|
||||
取消
|
||||
</Button>
|
||||
</Space>
|
||||
});
|
||||
}}
|
||||
style={{ marginRight: 4 }}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,61 @@
|
|||
import { EntityDict } from '../oak-app-domain/EntityDict';
|
||||
import { Trigger } from 'oak-domain/lib/types';
|
||||
import { BackendRuntimeContext } from '../context/BackendRuntimeContext';
|
||||
import { assert } from 'oak-domain/lib/utils/assert';
|
||||
import { generateNewIdAsync } from 'oak-domain/lib/utils/uuid';
|
||||
import { OakPreConditionUnsetException } from 'oak-domain/lib/types';
|
||||
import { RuntimeCxt } from '../types/RuntimeCxt';
|
||||
|
||||
const triggers: Trigger<
|
||||
EntityDict,
|
||||
'account',
|
||||
BackendRuntimeContext<EntityDict>
|
||||
>[] = [
|
||||
// 目前先这样授予关系
|
||||
{
|
||||
name: '充值的时候,将用户赋予owner关系',
|
||||
entity: 'account',
|
||||
action: 'create',
|
||||
when: 'before',
|
||||
fn: async (event: any, context: any) => {
|
||||
const {
|
||||
operation: { data, filter },
|
||||
} = event;
|
||||
assert(!(data instanceof Array));
|
||||
const accountId = data.id!;
|
||||
const [relation] = await context.select('relation', {
|
||||
data: {
|
||||
id: 1,
|
||||
},
|
||||
filter: {
|
||||
name: 'owner',
|
||||
entity: 'account',
|
||||
entityId: {
|
||||
$exists: false,
|
||||
}
|
||||
}
|
||||
}, { dontCollect: true });
|
||||
|
||||
assert(relation);
|
||||
const closeRootMode = context.openRootMode();
|
||||
await context.operate(
|
||||
'userRelation',
|
||||
{
|
||||
id: await generateNewIdAsync(),
|
||||
action: 'create',
|
||||
data: {
|
||||
id: await generateNewIdAsync(),
|
||||
relationId: relation.id,
|
||||
userId: context.getCurrentUserId(),
|
||||
entity: 'account',
|
||||
entityId: accountId!,
|
||||
} as EntityDict['userRelation']['CreateSingle']['data'],
|
||||
},
|
||||
{}
|
||||
);
|
||||
closeRootMode();
|
||||
return 1;
|
||||
},
|
||||
},
|
||||
];
|
||||
export default triggers;
|
||||
|
|
@ -14,8 +14,11 @@ import sessionMessageTriggers from './sessionMessage';
|
|||
import wechatMenuTriggers from './wechatMenu';
|
||||
import wechatPublicTag from './wechatPublicTag';
|
||||
|
||||
import accountTriggers from './account';
|
||||
|
||||
|
||||
export default [
|
||||
...accountTriggers,
|
||||
...applicationTriggers,
|
||||
...addressTriggers,
|
||||
...userTriggers,
|
||||
|
|
|
|||
Loading…
Reference in New Issue