帮助文档

This commit is contained in:
qsc 2023-06-29 14:21:23 +08:00
parent 558fbdf149
commit e85c53c4b5
42 changed files with 207 additions and 322 deletions

View File

@ -28,7 +28,7 @@ exports.default = OakComponent({
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
this.removeItem(id);
this.remove();
return [4 /*yield*/, this.execute()];
case 1:
_a.sent();

View File

@ -7,7 +7,7 @@ export default function Render(props: WebComponentProps<EntityDict, 'article', f
name: string;
}, {
gotoArticleEdit: (articleId: string) => void;
onRemoveArticle: (id: string) => void;
onRemoveArticle: () => void;
gotoPreview: (content: string, name: string, articleId: string) => void;
copy: (articleId: string) => void;
}>): import("react/jsx-runtime").JSX.Element;

View File

@ -31,7 +31,7 @@ function Render(props) {
okText: '确定',
cancelText: '取消',
onOk: function (e) {
onRemoveArticle(oakId);
onRemoveArticle();
modal.destroy();
},
});

View File

@ -1,4 +1,6 @@
/// <reference types="wechat-miniprogram" />
/// <reference types="react" />
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../general-app-domain").EntityDict, "articleMenu", false, WechatMiniprogram.Component.DataOption>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../general-app-domain").EntityDict, "articleMenu", false, {
entity: string;
entityId: string;
}>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
export default _default;

View File

@ -1,5 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
exports.default = OakComponent({
entity: 'articleMenu',
projection: {
@ -47,6 +48,10 @@ exports.default = OakComponent({
},
filters: [],
lifetimes: {},
properties: {
entity: '',
entityId: ''
},
methods: {
goUpsert: function (id) {
this.navigateTo({
@ -55,9 +60,12 @@ exports.default = OakComponent({
});
},
gotoEditByParentId: function (parentId) {
var _a = this.props, entity = _a.entity, entityId = _a.entityId;
this.navigateTo({
url: '/articleMenu/upsert',
parentId: parentId,
entity: entity,
entityId: entityId
});
},
gotoArticleEdit: function (articleId) {
@ -72,5 +80,17 @@ exports.default = OakComponent({
articleMenuId: articleMenuId,
});
},
onRemoveArticleMenu: function (id) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.execute('remove')];
case 1:
_a.sent();
return [2 /*return*/];
}
});
});
},
},
});

View File

@ -8,9 +8,9 @@ export default function render(props: WebComponentProps<EntityDict, 'articleMenu
isArticle: boolean;
isLeaf: boolean;
logo: string;
onRemoveArticleMenu: (id: string) => void;
}, {
goUpsert: (id?: string) => void;
gotoEditByParentId: (parentId: string) => void;
gotoArticleEditByArticleMenuId: (articleMenuId: string) => void;
onRemoveArticleMenu: (id: string) => void;
}>): import("react/jsx-runtime").JSX.Element;

View File

@ -6,8 +6,8 @@ var antd_1 = require("antd");
var web_module_less_1 = tslib_1.__importDefault(require("./web.module.less"));
function render(props) {
var data = props.data, methods = props.methods;
var t = methods.t, update = methods.update, goUpsert = methods.goUpsert, gotoEditByParentId = methods.gotoEditByParentId, gotoArticleEditByArticleMenuId = methods.gotoArticleEditByArticleMenuId;
var name = data.name, parentId = data.parentId, parentName = data.parentName, isArticle = data.isArticle, logo = data.logo, isLeaf = data.isLeaf, oakId = data.oakId, onRemoveArticleMenu = data.onRemoveArticleMenu;
var t = methods.t, update = methods.update, goUpsert = methods.goUpsert, gotoEditByParentId = methods.gotoEditByParentId, gotoArticleEditByArticleMenuId = methods.gotoArticleEditByArticleMenuId, onRemoveArticleMenu = methods.onRemoveArticleMenu;
var name = data.name, parentId = data.parentId, parentName = data.parentName, isArticle = data.isArticle, logo = data.logo, isLeaf = data.isLeaf, oakId = data.oakId;
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({ colon: true, labelCol: { span: 4 }, wrapperCol: { span: 12 } }, { children: [(0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: '分类标题', name: "name" }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: "".concat(name) }) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: "LOGO", name: "extraFile$entity" }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: logo ? ((0, jsx_runtime_1.jsx)(antd_1.Image, { src: logo, width: 100, height: 100 })) : ('暂无图片') }) }))] }), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ wrapperCol: {
offset: 4,
} }, { children: (0, jsx_runtime_1.jsxs)(antd_1.Space, { children: [(0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ type: "primary", onClick: function () {

View File

@ -6,7 +6,5 @@ export interface Schema extends EntityShape {
name: String<32>;
content: Text;
articleMenu: ArticleMenu;
entity: String<32>;
entityId: String<64>;
files?: Array<ExtraFile>;
}

View File

@ -7,8 +7,6 @@ var locale = {
name: '文章标题',
content: '请输入正文内容',
articleMenu: '文章菜单',
entity: '对象',
entityId: '对象Id',
files: '文件'
},
},

View File

@ -9,7 +9,7 @@ var locale = {
parent: '所属分类',
entity: '对象',
entityId: '对象Id',
isLeaf: '是否为叶结点',
isLeaf: '结点下是否存在叶子结点',
files: '图片',
},
},

View File

@ -10,16 +10,12 @@ export declare type OpSchema = EntityShape & {
name: String<32>;
content: Text;
articleMenuId: ForeignKey<"articleMenu">;
entity: String<32>;
entityId: String<64>;
};
export declare type OpAttr = keyof OpSchema;
export declare type Schema = EntityShape & {
name: String<32>;
content: Text;
articleMenuId: ForeignKey<"articleMenu">;
entity: String<32>;
entityId: String<64>;
articleMenu: ArticleMenu.Schema;
extraFile$entity?: Array<ExtraFile.Schema>;
extraFile$entity$$aggr?: AggregationResult<ExtraFile.Schema>;
@ -35,8 +31,6 @@ declare type AttrFilter = {
content: Q_StringValue;
articleMenuId: Q_StringValue | SubQuery.ArticleMenuIdSubQuery;
articleMenu: ArticleMenu.Filter;
entity: Q_StringValue;
entityId: Q_StringValue;
};
export declare type Filter = MakeFilter<AttrFilter & ExprOp<OpAttr | string>>;
export declare type Projection = {
@ -50,8 +44,6 @@ export declare type Projection = {
content?: number;
articleMenuId?: number;
articleMenu?: ArticleMenu.Projection;
entity?: number;
entityId?: number;
extraFile$entity?: ExtraFile.Selection & {
$entity: "extraFile";
};
@ -81,10 +73,6 @@ export declare type SortAttr = {
articleMenuId: number;
} | {
articleMenu: ArticleMenu.SortAttr;
} | {
entity: number;
} | {
entityId: number;
} | {
[k: string]: any;
} | OneOf<ExprOp<OpAttr | string>>;
@ -96,7 +84,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> = Omit<SelectOperation<P>, "action">;
export declare type Aggregation = DeduceAggregation<Projection, Filter, Sorter>;
export declare type CreateOperationData = FormCreateData<Omit<OpSchema, "entity" | "entityId" | "articleMenuId">> & (({
export declare type CreateOperationData = FormCreateData<Omit<OpSchema, "articleMenuId">> & (({
articleMenuId?: never;
articleMenu: ArticleMenu.CreateSingleOperation;
} | {
@ -104,11 +92,7 @@ export declare type CreateOperationData = FormCreateData<Omit<OpSchema, "entity"
articleMenu?: ArticleMenu.UpdateOperation;
} | {
articleMenuId: String<64>;
})) & ({
entity?: string;
entityId?: string;
[K: string]: any;
}) & {
})) & {
extraFile$entity?: OakOperation<ExtraFile.UpdateOperation["action"], Omit<ExtraFile.UpdateOperationData, "entity" | "entityId">, ExtraFile.Filter> | OakOperation<"create", Omit<ExtraFile.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<ExtraFile.CreateOperationData, "entity" | "entityId">> | OakOperation<ExtraFile.UpdateOperation["action"], Omit<ExtraFile.UpdateOperationData, "entity" | "entityId">, ExtraFile.Filter>>;
};
export declare type CreateSingleOperation = OakOperation<"create", CreateOperationData>;

View File

@ -19,20 +19,6 @@ exports.desc = {
notNull: true,
type: "ref",
ref: "articleMenu"
},
entity: {
notNull: true,
type: "varchar",
params: {
length: 32
}
},
entityId: {
notNull: true,
type: "varchar",
params: {
length: 64
}
}
},
actionType: "crud",

View File

@ -1 +1 @@
{ "name": "文章", "attr": { "name": "文章标题", "content": "请输入正文内容", "articleMenu": "文章菜单", "entity": "对象", "entityId": "对象Id", "files": "文件" } }
{ "name": "文章", "attr": { "name": "文章标题", "content": "请输入正文内容", "articleMenu": "文章菜单", "files": "文件" } }

View File

@ -1 +1 @@
{ "name": "文章菜单", "attr": { "name": "文章分类标题", "isArticle": "是否存在文章", "parent": "所属分类", "entity": "对象", "entityId": "对象Id", "isLeaf": "是否为叶结点", "files": "图片" } }
{ "name": "文章分类", "attr": { "name": "分类标题", "isArticle": "是否存在文章", "parent": "所属分类", "entity": "对象", "entityId": "对象Id", "isLeaf": "是否为叶结点", "files": "图片" } }

View File

@ -19,8 +19,8 @@ exports.default = OakComponent({
id: article === null || article === void 0 ? void 0 : article.id,
content: article === null || article === void 0 ? void 0 : article.content,
name: article === null || article === void 0 ? void 0 : article.name,
entity: article === null || article === void 0 ? void 0 : article.entity,
entityId: article === null || article === void 0 ? void 0 : article.entityId,
// entity: article?.entity,
// entityId: article?.entityId,
};
},
// listeners: {

View File

@ -11,8 +11,6 @@ exports.default = OakComponent({
articleMenu: {
id: 1,
},
entity: 1,
entityId: 1,
},
isList: false,
formData: function (_a) {
@ -21,8 +19,6 @@ exports.default = OakComponent({
id: article === null || article === void 0 ? void 0 : article.id,
content: article === null || article === void 0 ? void 0 : article.content,
name: article === null || article === void 0 ? void 0 : article.name,
entity: article === null || article === void 0 ? void 0 : article.entity,
entityId: article === null || article === void 0 ? void 0 : article.entityId,
};
},
data: {
@ -40,13 +36,12 @@ exports.default = OakComponent({
},
lifetimes: {
ready: function () {
var _a, _b;
return tslib_1.__awaiter(this, void 0, void 0, function () {
var _c, oakId, articleMenuId, entity, article, _d, articleMenu;
return tslib_1.__generator(this, function (_e) {
switch (_e.label) {
var _a, oakId, articleMenuId, entity, article, _b, articleMenu;
return tslib_1.__generator(this, function (_c) {
switch (_c.label) {
case 0:
_c = this.props, oakId = _c.oakId, articleMenuId = _c.articleMenuId, entity = _c.entity;
_a = this.props, oakId = _a.oakId, articleMenuId = _a.articleMenuId, entity = _a.entity;
if (!oakId) return [3 /*break*/, 2];
return [4 /*yield*/, this.features.cache.refresh('article', {
data: {
@ -57,15 +52,13 @@ exports.default = OakComponent({
id: 1,
name: 1,
},
entity: 1,
entityId: 1,
},
filter: {
id: oakId
},
})];
case 1:
article = (_e.sent()).data;
article = (_c.sent()).data;
return [3 /*break*/, 4];
case 2: return [4 /*yield*/, this.features.cache.refresh('articleMenu', {
data: {
@ -79,15 +72,13 @@ exports.default = OakComponent({
},
})];
case 3:
_d = tslib_1.__read.apply(void 0, [(_e.sent()).data, 1]), articleMenu = _d[0];
_b = tslib_1.__read.apply(void 0, [(_c.sent()).data, 1]), articleMenu = _b[0];
if (articleMenuId && !articleMenu.isArticle) {
this.update({
entity: 'platformProvider',
entityId: (_b = (_a = this.features.application.getApplication()) === null || _a === void 0 ? void 0 : _a.system.platform) === null || _b === void 0 ? void 0 : _b.entityId,
articleMenuId: articleMenuId,
});
}
_e.label = 4;
_c.label = 4;
case 4: return [2 /*return*/];
}
});

View File

@ -1,5 +1,7 @@
/// <reference types="wechat-miniprogram" />
/// <reference types="react" />
import { EntityDict } from '../../../general-app-domain';
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<EntityDict, "articleMenu", true, WechatMiniprogram.Component.DataOption>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<EntityDict, "articleMenu", true, {
entity: string;
entityId: string;
}>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
export default _default;

View File

@ -14,6 +14,8 @@ exports.default = OakComponent({
isArticle: 1,
isLeaf: 1,
},
entity: 1,
entityId: 1,
extraFile$entity: {
$entity: 'extraFile',
data: {
@ -144,6 +146,11 @@ exports.default = OakComponent({
selectArticleId: '',
treeData: [],
},
properties: {
entity: '',
entityId: '',
},
actions: ['create', 'update', 'remove'],
methods: {
buildTreeData: function (nodes, parentId) {
var e_1, _a;
@ -207,23 +214,14 @@ exports.default = OakComponent({
});
}
else {
var _a = this.props, entity = _a.entity, entityId = _a.entityId;
this.navigateTo({
url: '/articleMenu/upsert',
entity: entity,
entityId: entityId,
});
}
},
gotoEditByParentId: function (parentId) {
this.navigateTo({
url: '/articleMenu/upsert',
parentId: parentId,
});
},
gotoArticleEdit: function (articleId) {
this.navigateTo({
url: '/article/upsert',
oakId: articleId,
});
},
onRemoveArticleMenu: function (id) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
return tslib_1.__generator(this, function (_a) {

View File

@ -13,6 +13,8 @@ export default function render(props: WebComponentProps<EntityDict, 'articleMenu
treeData: DataNode[];
selectArticleMenuId: string;
selectArticleId: string;
entity: string;
entityId: string;
}, {
gotoUpsertById: (id: string) => void;
gotoArticleUpsert: (articleId: string) => void;

View File

@ -8,7 +8,7 @@ var pageHeader_1 = tslib_1.__importDefault(require("../../../components/common/p
var detail_1 = tslib_1.__importDefault(require("../../../components/article/detail"));
var cell_1 = tslib_1.__importDefault(require("../../../components/articleMenu/cell"));
function render(props) {
var _a = props.data, treeData = _a.treeData, selectArticleMenuId = _a.selectArticleMenuId, selectArticleId = _a.selectArticleId, oakFullpath = _a.oakFullpath;
var _a = props.data, entity = _a.entity, entityId = _a.entityId, treeData = _a.treeData, selectArticleMenuId = _a.selectArticleMenuId, selectArticleId = _a.selectArticleId, oakFullpath = _a.oakFullpath, oakLegalActions = _a.oakLegalActions;
var _b = props.methods, t = _b.t, gotoUpsertById = _b.gotoUpsertById, gotoArticleUpsert = _b.gotoArticleUpsert, onRemoveArticleMenu = _b.onRemoveArticleMenu, gotoEdit = _b.gotoEdit;
var renderMenuItems = function (data) {
return data === null || data === void 0 ? void 0 : data.map(function (menuItem) {
@ -29,8 +29,6 @@ function render(props) {
};
return ((0, jsx_runtime_1.jsx)(pageHeader_1.default, tslib_1.__assign({ title: "\u5206\u7C7B\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 () {
gotoEdit();
} }, { children: "\u65B0\u589E" })) })), (treeData === null || treeData === void 0 ? void 0 : treeData.length) === 0 ? ((0, jsx_runtime_1.jsx)(antd_1.Empty, { image: antd_1.Empty.PRESENTED_IMAGE_SIMPLE })) : ((0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: web_module_less_1.default.article }, { children: [(0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.menu }, { children: (0, jsx_runtime_1.jsx)(antd_1.Menu, tslib_1.__assign({ style: { width: 256 }, mode: "inline" }, { children: renderMenuItems(treeData) })) })), (0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: web_module_less_1.default.editor }, { children: [selectArticleMenuId ? ((0, jsx_runtime_1.jsx)(cell_1.default, { oakAutoUnmount: true, oakId: selectArticleMenuId, oakPath: "$articleMenu-cell-".concat(selectArticleMenuId), onRemoveArticleMenu: function (id) {
onRemoveArticleMenu(id);
} })) : null, selectArticleId ? ((0, jsx_runtime_1.jsx)(detail_1.default, { oakAutoUnmount: true, oakId: selectArticleId, oakPath: "$article-detail-".concat(selectArticleId) })) : null] }))] })))] })) })));
} }, { children: "\u65B0\u589E" })) })), (treeData === null || treeData === void 0 ? void 0 : treeData.length) === 0 ? ((0, jsx_runtime_1.jsx)(antd_1.Empty, { image: antd_1.Empty.PRESENTED_IMAGE_SIMPLE })) : ((0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: web_module_less_1.default.article }, { children: [(0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.menu }, { children: (0, jsx_runtime_1.jsx)(antd_1.Menu, tslib_1.__assign({ style: { width: 256 }, mode: "inline" }, { children: renderMenuItems(treeData) })) })), (0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: web_module_less_1.default.editor }, { children: [selectArticleMenuId ? ((0, jsx_runtime_1.jsx)(cell_1.default, { oakAutoUnmount: true, oakId: selectArticleMenuId, oakPath: "$articleMenu-cell-".concat(selectArticleMenuId), entity: entity, entityId: entityId })) : null, selectArticleId ? ((0, jsx_runtime_1.jsx)(detail_1.default, { oakAutoUnmount: true, oakId: selectArticleId, oakPath: "$article-detail-".concat(selectArticleId) })) : null] }))] })))] })) })));
}
exports.default = render;

View File

@ -1,4 +1,7 @@
/// <reference types="wechat-miniprogram" />
/// <reference types="react" />
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../general-app-domain").EntityDict, "articleMenu", false, WechatMiniprogram.Component.DataOption>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../general-app-domain").EntityDict, "articleMenu", false, {
entity: string;
entityId: string;
parentId: string;
}>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
export default _default;

View File

@ -44,27 +44,31 @@ exports.default = OakComponent({
};
},
filters: [],
properties: {
entity: '',
entityId: '',
parentId: '',
},
lifetimes: {
ready: function () {
var _a, _b, _c, _d;
return tslib_1.__awaiter(this, void 0, void 0, function () {
var _e, parentId, oakId;
return tslib_1.__generator(this, function (_f) {
_e = this.props, parentId = _e.parentId, oakId = _e.oakId;
var _a, parentId, oakId, entity, entityId;
return tslib_1.__generator(this, function (_b) {
_a = this.props, parentId = _a.parentId, oakId = _a.oakId, entity = _a.entity, entityId = _a.entityId;
if (!oakId) {
if (parentId) {
this.update({
parentId: parentId,
entity: 'platformProvider',
entityId: (_b = (_a = this.features.application.getApplication()) === null || _a === void 0 ? void 0 : _a.system.platform) === null || _b === void 0 ? void 0 : _b.entityId,
entity: entity,
entityId: entityId,
isArticle: false,
isLeaf: false,
});
}
else {
this.update({
entity: 'platformProvider',
entityId: (_d = (_c = this.features.application.getApplication()) === null || _c === void 0 ? void 0 : _c.system.platform) === null || _d === void 0 ? void 0 : _d.entityId,
entity: entity,
entityId: entityId,
isArticle: false,
isLeaf: false,
});

View File

@ -27,8 +27,8 @@ exports.default = OakComponent({
// abstract: article?.abstract,
// author: article?.author,
content: article === null || article === void 0 ? void 0 : article.content,
entity: article === null || article === void 0 ? void 0 : article.entity,
entityId: article === null || article === void 0 ? void 0 : article.entityId,
// entity: article?.entity,
// entityId: article?.entityId,
};
}),
pagination: pagination,
@ -36,16 +36,16 @@ exports.default = OakComponent({
};
},
filters: [
// 由调用者注入oakFilter
{
filter: function () {
var _a = this.props, entityId = _a.entityId, entity = _a.entity;
return {
entityId: entityId,
entity: entity,
};
},
},
// 由调用者注入oakFilter
// {
// filter() {
// const { entityId, entity } = this.props;
// return {
// entityId,
// entity,
// };
// },
// },
],
// sorters: [],
methods: {

View File

@ -126,7 +126,7 @@ var triggers = [
}, {})];
case 1:
_b = tslib_1.__read.apply(void 0, [_g.sent(), 1]), articleMenu = _b[0];
if (!articleMenu) return [3 /*break*/, 5];
if (!(articleMenu && articleMenu.parentId)) return [3 /*break*/, 5];
return [4 /*yield*/, context.select('articleMenu', {
data: {
id: 1,

View File

@ -20,8 +20,8 @@ export default OakComponent({
},
methods: {
async onRemoveArticle(id: string) {
this.removeItem(id);
await this.execute();
this.remove();
await this.execute();
},
gotoArticleEdit(articleId: string) {
this.navigateTo({

View File

@ -26,7 +26,7 @@ export default function Render(
},
{
gotoArticleEdit: (articleId: string) => void;
onRemoveArticle: (id: string) => void;
onRemoveArticle: () => void;
gotoPreview: (
content: string,
name: string,
@ -99,7 +99,7 @@ export default function Render(
okText: '确定',
cancelText: '取消',
onOk: (e) => {
onRemoveArticle(oakId);
onRemoveArticle();
modal!.destroy();
},
});

View File

@ -1,27 +1,22 @@
export default OakComponent({
entity: 'article',
isList: true,
isList: false,
projection: {
id: 1,
name: 1,
content: 1,
articleMenu: {
id: 1,
name: 1,
isArticle: 1,
isLeaf: 1,
}
content: 1,
articleMenu: {
id: 1,
name: 1,
isArticle: 1,
isLeaf: 1,
},
},
methods: {
async onRemoveArticle(id: string) {
this.removeItem(id);
await this.execute();
},
gotoArticleEdit(articleId: string) {
this.navigateTo({
url: '/article/upsert',
oakId: articleId
})
},
formData: function ({ data: article }) {
return {
content: article?.content,
name: article?.name,
};
},
methods: {}
});

View File

@ -17,8 +17,9 @@ export default function Render(
'article',
false,
{
articleId: string;
content: string;
oakId: string;
content: string;
name: string;
},
{
gotoArticleEdit: (articleId:string) => void;
@ -27,7 +28,7 @@ export default function Render(
>
) {
const { methods: method, data } = props;
const { content, articleId } = props.data;
const { content, name } = props.data;
const {
t,
onRemoveArticle,
@ -38,7 +39,12 @@ export default function Render(
autoFocus: true,
scroll: false,
};
const [value, setValue] = useState('');
useEffect(() => {
if(content) {
setValue(content);
}
},[content])
return (
<div className={Style.rightContainer}>
<Row>
@ -53,7 +59,7 @@ export default function Render(
<>
<Editor
defaultConfig={editorConfig}
value={content}
value={value}
mode="default"
style={{
width: 750
@ -62,36 +68,6 @@ export default function Render(
</>
</Form.Item>
</>
{/* <Form.Item wrapperCol={{ offset: 4 }}>
<Space>
<Button
type="primary"
onClick={() => {
gotoArticleEdit(articleId);
}}
>
</Button>
<Button
type="link"
onClick={() => {
const modal = confirm({
title: "确定删除该文章吗?",
content: "删除后不可恢复",
okText: "确定",
cancelText: "取消",
onOk: (e) => {
onRemoveArticle(articleId);
modal!.destroy();
},
});
}}
>
</Button>
</Space>
</Form.Item> */}
</Form>
</Col>
</Row>

View File

@ -47,6 +47,10 @@ export default OakComponent({
},
filters: [],
lifetimes: {},
properties: {
entity: '',
entityId: ''
},
methods: {
goUpsert(id: string) {
this.navigateTo({
@ -55,9 +59,12 @@ export default OakComponent({
});
},
gotoEditByParentId(parentId?: string) {
const { entity, entityId } = this.props;
this.navigateTo({
url: '/articleMenu/upsert',
parentId,
entity,
entityId
});
},
gotoArticleEdit(articleId: string) {
@ -72,5 +79,8 @@ export default OakComponent({
articleMenuId,
});
},
async onRemoveArticleMenu(id: string) {
await this.execute('remove');
},
},
});

View File

@ -18,12 +18,12 @@ export default function render(
isArticle: boolean;
isLeaf: boolean;
logo: string;
onRemoveArticleMenu: (id: string) => void;
},
{
goUpsert: (id?: string) => void;
gotoEditByParentId: (parentId: string) => void;
gotoArticleEditByArticleMenuId: (articleMenuId: string) => void;
onRemoveArticleMenu: (id: string) => void;
}
>
) {
@ -34,6 +34,7 @@ export default function render(
goUpsert,
gotoEditByParentId,
gotoArticleEditByArticleMenuId,
onRemoveArticleMenu,
} = methods;
const {
name,
@ -43,7 +44,6 @@ export default function render(
logo,
isLeaf,
oakId,
onRemoveArticleMenu,
} = data;
return (
@ -105,7 +105,11 @@ export default function render(
</Button>
)}
<Button
{
(isArticle || isLeaf ) ? (
''
) : (
<Button
type="link"
onClick={() => {
const modal = Modal.confirm({
@ -122,6 +126,9 @@ export default function render(
>
</Button>
)
}
</Space>
</Form.Item>
</Form>

View File

@ -10,8 +10,6 @@ export interface Schema extends EntityShape {
name: String<32>; //标题名称
content: Text; //文章内容
articleMenu: ArticleMenu; //文章菜单
entity: String<32>;
entityId: String<64>;
files?: Array<ExtraFile>;
}
const locale: LocaleDef<
@ -27,8 +25,6 @@ const locale: LocaleDef<
name: '文章标题',
content: '请输入正文内容',
articleMenu: '文章菜单',
entity: '对象',
entityId: '对象Id',
files: '文件'
},
},

View File

@ -25,7 +25,7 @@ const locale: LocaleDef<Schema, '', '', {}> = {
parent: '所属分类',
entity: '对象',
entityId: '对象Id',
isLeaf: '是否为叶结点',
isLeaf: '结点下是否存在叶子结点',
files: '图片',
},
},

View File

@ -142,11 +142,23 @@ export default OakComponent({
};
});
this.setState({
arr,
treeData,
});
},
},
data: {
selectedArticleId: '',
openKeys: [] as string[],
selectedKeys: [] as string[],
treeData: [] as DataNode[],
parentId: '',
articleMenuId: '',
id: '',
name: '',
isArticle: false,
isChildren: false,
logo: '',
},
methods: {
getOpenKeys(
targetKey: string,
@ -367,33 +379,14 @@ export default OakComponent({
) {
if (selectedKeys.includes(articleId)) {
} else {
if (articleId) {
const { data: article } = await this.features.cache.refresh(
'article',
{
data: {
id: 1,
name: 1,
content: 1,
articleMenuId: 1,
},
filter: {
id: articleId,
},
}
);
if (article) {
this.setState({
selectedKeys: [articleId],
content: article[0]?.content,
articleId,
selectedArticleId: articleId,
id: '',
parentId: '',
});
}
}
}
},
},
gotoEdit(id?: string) {
if (id) {
this.navigateTo({

View File

@ -57,6 +57,7 @@ export default function render(
logo: string;
openKeys: string[];
selectedKeys: string[];
selectedArticleId: string;
},
{
gotoUpsert: (id?: string) => void;
@ -94,6 +95,7 @@ export default function render(
logo,
openKeys,
selectedKeys,
selectedArticleId
} = props.data;
const {
t,
@ -169,12 +171,11 @@ export default function render(
</Menu>
</div>
<div className={Style.editor}>
{articleId?.length > 0 ? (
{selectedArticleId?.length > 0 ? (
<ArticleUpsert
oakAutoUnmount={true}
content={content}
articleId={articleId}
oakPath={`$article-detail-${articleId}`}
oakId={selectedArticleId}
oakPath={`$article-detail2-${selectedArticleId}`}
/>
) : null}
</div>

View File

@ -18,8 +18,8 @@ export default OakComponent({
id: article?.id,
content: article?.content,
name: article?.name,
entity: article?.entity,
entityId: article?.entityId,
// entity: article?.entity,
// entityId: article?.entityId,
};
},
// listeners: {

View File

@ -16,8 +16,6 @@ export default OakComponent({
articleMenu: {
id: 1,
},
entity: 1,
entityId: 1,
},
isList: false,
formData: function ({ data: article, features }) {
@ -25,8 +23,6 @@ export default OakComponent({
id: article?.id,
content: article?.content,
name: article?.name,
entity: article?.entity,
entityId: article?.entityId,
};
},
data: {
@ -55,8 +51,6 @@ export default OakComponent({
id: 1,
name: 1,
},
entity: 1,
entityId: 1,
},
filter: {
id: oakId
@ -77,11 +71,8 @@ export default OakComponent({
id: articleMenuId,
},
});
if (articleMenuId && !articleMenu.isArticle) {
if (articleMenuId ) {
this.update({
entity: 'platformProvider',
entityId: this.features.application.getApplication()?.system!
.platform?.entityId!,
articleMenuId,
});

View File

@ -18,6 +18,7 @@ import { IToolbarConfig } from "@wangeditor/editor";
import OakGallery from "./../../../components/extraFile/gallery";
import { EntityDict } from "./../../../general-app-domain";
import { WebComponentProps } from "oak-frontend-base";
import PageHeader from "../../../components/common/pageHeader";
import Style from "./web.module.less";
import useFeatures from "../../../hooks/useFeatures";
@ -111,6 +112,7 @@ export default function Render(
}
}, [id]);
return (
<PageHeader showBack={true} title="添加文章">
<div className={Style.container}>
<Affix offsetTop={64}>
<Toolbar editor={editor} defaultConfig={toolbarConfig} mode="default" />
@ -133,17 +135,6 @@ export default function Render(
className={Style.titleInput}
/>
</div>
{/* <div className={Style.authorContainer}>
<Input
onChange={(e) =>
update({ author: e.target.value })
}
value={data.author}
placeholder={t('placeholder.author')}
className={Style.input}
maxLength={16}
/>
</div> */}
{data.contentTip && (
<Alert
type="info"
@ -258,55 +249,8 @@ export default function Render(
}}
mode="default"
/>
{/* <div className={Style.abstract}>
<Card
title="封面及摘要"
bordered={false}
className={Style.card}
>
<Row>
<Col flex="none">
<OakGallery
maxNumber={1}
oakPath={
oakFullpath
? `${oakFullpath}.extraFile$entity`
: undefined
}
type="image"
origin="qiniu"
tag1="cover"
entity="article"
></OakGallery>
</Col>
<Col flex="auto">
<Input.TextArea
autoSize={{
minRows: 4,
}}
maxLength={120}
placeholder={t(
'placeholder.abstract'
)}
onChange={(e) =>
update({
abstract:
e.target.value,
})
}
value={data.abstract || ''}
></Input.TextArea>
</Col>
</Row>
</Card>
</div> */}
<div className={Style.footer}>
<Row align="middle">
{/* <Col flex="auto">
<div className={Style.contentNumber}>
<span> {wordCount}</span>
</div>
</Col> */}
<Col flex="none">
<Space>
<Button
@ -325,22 +269,6 @@ export default function Render(
<EyeOutlined />
</Button>
{/* <Button
onClick={() => {
const modal = confirm({
title: "确定删除该文章吗?",
content: "删除后不可恢复",
okText: "确定",
cancelText: "取消",
onOk: (e) => {
onRemoveArticle(id);
modal!.destroy();
},
});
}}
>
</Button> */}
</Space>
</Col>
</Row>
@ -351,5 +279,6 @@ export default function Render(
<Col flex={4} />
</Row>
</div>
</PageHeader>
);
}

View File

@ -21,6 +21,8 @@ export default OakComponent({
isArticle: 1,
isLeaf: 1,
},
entity: 1,
entityId: 1,
extraFile$entity: {
$entity: 'extraFile',
data: {
@ -149,6 +151,11 @@ export default OakComponent({
selectArticleId: '',
treeData: [] as DataNode[],
},
properties: {
entity: '',
entityId: '',
},
actions: ['create', 'update', 'remove'],
methods: {
buildTreeData(
nodes: EntityDict['articleMenu']['Schema'][] | any[],
@ -195,24 +202,14 @@ export default OakComponent({
oakId: id,
});
} else {
const { entity, entityId } = this.props;
this.navigateTo({
url: '/articleMenu/upsert',
entity,
entityId,
});
}
},
gotoEditByParentId(parentId?: string) {
this.navigateTo({
url: '/articleMenu/upsert',
parentId,
});
},
gotoArticleEdit(articleId: string) {
this.navigateTo({
url: '/article/upsert',
oakId: articleId,
});
},
async onRemoveArticleMenu(id: string) {
this.removeItem(id);
await this.execute();

View File

@ -27,6 +27,8 @@ export default function render(
treeData: DataNode[];
selectArticleMenuId: string;
selectArticleId: string;
entity: string;
entityId: string;
},
{
gotoUpsertById: (id: string) => void;
@ -37,10 +39,13 @@ export default function render(
>
) {
const {
entity,
entityId,
treeData,
selectArticleMenuId,
selectArticleId,
oakFullpath,
oakLegalActions,
} = props.data;
const {
t,
@ -49,7 +54,6 @@ export default function render(
onRemoveArticleMenu,
gotoEdit,
} = props.methods;
const renderMenuItems = (data: any) => {
return data?.map((menuItem: any) => {
if (menuItem.children) {
@ -126,9 +130,8 @@ export default function render(
oakAutoUnmount={true}
oakId={selectArticleMenuId}
oakPath={`$articleMenu-cell-${selectArticleMenuId}`}
onRemoveArticleMenu={(id: string) => {
onRemoveArticleMenu(id);
}}
entity={entity}
entityId={entityId}
/>
) : null}
{selectArticleId ? (

View File

@ -39,26 +39,27 @@ export default OakComponent({
};
},
filters: [],
properties: {
entity: '',
entityId: '',
parentId: '',
},
lifetimes: {
async ready() {
const { parentId, oakId } = this.props;
const { parentId, oakId, entity, entityId} = this.props;
if (!oakId) {
if (parentId) {
this.update({
parentId,
entity: 'platformProvider',
entityId:
this.features.application.getApplication()?.system!
.platform?.entityId!,
entity,
entityId,
isArticle: false,
isLeaf: false,
});
} else {
this.update({
entity: 'platformProvider',
entityId:
this.features.application.getApplication()?.system!
.platform?.entityId!,
entity,
entityId,
isArticle: false,
isLeaf: false,
});

View File

@ -25,8 +25,8 @@ export default OakComponent({
// abstract: article?.abstract,
// author: article?.author,
content: article?.content,
entity: article?.entity,
entityId: article?.entityId,
// entity: article?.entity,
// entityId: article?.entityId,
};
}),
pagination,
@ -35,15 +35,15 @@ export default OakComponent({
},
filters: [
// 由调用者注入oakFilter
{
filter() {
const { entityId, entity } = this.props;
return {
entityId,
entity,
};
},
},
// {
// filter() {
// const { entityId, entity } = this.props;
// return {
// entityId,
// entity,
// };
// },
// },
],
// sorters: [],
methods: {

View File

@ -135,7 +135,7 @@ const triggers: Trigger<
},
{}
);
if (articleMenu) {
if (articleMenu && articleMenu.parentId) {
const articleMenus = await context.select(
'articleMenu',
{