提交 8b03aaa6 编写于 作者: chitanda's avatar chitanda

feat: 修正

上级 591b6115
export default { export default {
"caption": "首页视图布局(预置模型承载)",
"codeName": "AppIndexViewLayout",
"controls": [
{
"layoutMode": "TABLE_24COL",
"autoLoad": true,
"showBusyIndicator": true,
"codeName": "Usr0427030074Menu",
"controlType": "APPMENU",
"logicName": "应用首页视图菜单",
"controlParam": {},
"name": "appmenu",
"id": "usr0427030074menu"
},
{
"caption": "首页视图布局(预置模型承载)",
"codeName": "captionbar",
"controlType": "CAPTIONBAR",
"controlParam": {},
"id": "captionbar"
}
],
"viewLayoutPanel": {
"layoutMode": "FLEX", "layoutMode": "FLEX",
"rootPanelItems": [ "rootPanelItems": [
{ {
...@@ -218,12 +195,4 @@ export default { ...@@ -218,12 +195,4 @@ export default {
"controlParam": {}, "controlParam": {},
"name": "layoutpanel", "name": "layoutpanel",
"id": "indexviewlayout" "id": "indexviewlayout"
},
"title": "首页视图布局(预置模型承载)",
"viewStyle": "DEFAULT",
"viewType": "APPINDEXVIEW",
"enableDP": true,
"showCaptionBar": true,
"name": "AppIndexViewLayout",
"id": "web.appindexviewlayout"
} }
import { DSLHelper } from '@ibiz/rt-model-api';
import { IAppView } from '@ibiz/model-core';
import fs from 'fs-extra';
import path from 'path';
// 当前所有的
const layoutViews = ['ViewLayoutModelRepositoryDEGridViewLayout', 'AppIndexViewLayout'];
// 输出目录
const output = path.resolve(process.cwd(), 'layout-out');
// 模型目录
const basePath = '/root/workspace/train/TrainSys/trainsys-core/src/main/resources/model/cn/ibizlab/trainsys';
// 应用目录
const appPath = 'PSSYSAPPS/Web';
// dsl 转换器
const helper = new DSLHelper();
// 根据模型路径读取模型
async function getModel(pathStr: string): Promise<IModel> {
return new Promise(resolve => {
pathStr = pathStr.replace(appPath, '');
fs.readFile(path.join(basePath, appPath, pathStr), 'utf-8').then((data: string) => {
resolve(JSON.parse(data));
});
});
}
// 输出目录不存在则创建
if (fs.existsSync(output) === false) {
fs.mkdirSync(output);
}
// 输出 json 文件
function writeJsonFile(view: IAppView) {
fs.writeFileSync(path.resolve(output, `${view.codeName!.replace('ViewLayoutModelRepository', '')}.json`), JSON.stringify(view.viewLayoutPanel, null ,2));
}
async function main(): Promise<void> {
const app = await getModel('PSSYSAPP.json');
const viewModels: IModel[] = app.getAllPSAppViews || [];
const views = await Promise.all(viewModels.map(ref => getModel(ref.path)));
const dslViews = helper.appViews(views.filter(item => {
return item.getPSViewLayoutPanel.useDefaultLayout !== true && layoutViews.includes(item.codeName);
})) as IAppView[];
dslViews.forEach(item => {
writeJsonFile(item);
});
}
main();
{{#eq page.codeName 'AppIndexViewLayout'}} {{#eq page.codeName 'AppIndexViewLayout'}}
export default {{jsonStringify pageDSL 2}} export default {{jsonStringify pageDSL.viewLayoutPanel 2}}
{{/eq}} {{/eq}}
\ No newline at end of file
{{#eq page.codeName 'ViewLayoutModelRepositoryDEGridViewLayout'}} {{#eq page.codeName 'ViewLayoutModelRepositoryDEGridViewLayout'}}
export default {{jsonStringify pageDSL 2}} export default {{jsonStringify pageDSL.viewLayoutPanel 2}}
{{/eq}} {{/eq}}
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册