提交 8bcb839d 编写于 作者: tony001's avatar tony001

update:更新模板

上级 7a0761eb
......@@ -6,6 +6,7 @@
width: '{{page.width}}',
appEntityName: '{{page.appEntity.codeName}}',
isLoadDefault: true,
keyPSDEField: '{{lowerCase page.appEntity.codeName}}',
{{!-- viewMsgGroup: '{{page.psAppViewMsgGroup}}', --}}
{{!-- viewUIActions: '{{page.psAppViewUIActions}}', --}}
viewSysCss: '{{page.psSysCss}}',
......
......@@ -33,8 +33,22 @@ export class EditView extends MainView {
// 初始化表单引用
this.form = ref(null);
onMounted(() => {
const { viewSubject } = this.state;
viewSubject.next({ tag: this.getForm().name, action: "load", data: {} })
const { isLoadDefault, context, viewparams, keyPSDEField } = this.state;
if (this.getForm() && isLoadDefault) {
const tag = this.getForm().name;
let action: string = '';
if (
keyPSDEField &&
context[keyPSDEField] &&
!Object.is(context[keyPSDEField], '')
) {
action = 'load';
} else {
action = 'loadDraft';
}
this.next({ tag: tag, action: action, data: viewparams });
}
this.state.isLoadDefault = true;
})
}
......@@ -45,11 +59,7 @@ export class EditView extends MainView {
* @memberof IndexView
*/
public getForm(): any {
if (this.form.value) {
return this.form.value;
} else {
return null;
}
return unref(this.form);
}
/**
......
......@@ -56,11 +56,7 @@ public declare state: GridViewState;
* @memberof GridView
*/
public getMDCtrl(): any {
if (this.grid.value) {
return this.grid.value;
} else {
return null;
}
return unref(this.grid);
}
/**
......
......@@ -227,11 +227,7 @@ export class MDView extends MainView {
* @memberof MDView
*/
public getSearchForm(): any {
if (this.searchForm.value) {
return this.searchForm.value;
} else {
return null;
}
return unref(this.searchForm);
}
/**
......@@ -241,11 +237,7 @@ export class MDView extends MainView {
* @memberof MDView
*/
public getSearchBar() {
if (this.searchBar.value) {
return this.searchBar.value;
} else {
return null;
}
return unref(this.searchBar);
}
/**
......
......@@ -341,13 +341,7 @@ export class FormControl extends MainControl {
*/
public useLoadDraft() {
const { viewSubject, controlName } = this.state;
/**
* 加载行为
*
* @param [opt={}]
* @return {*}
*/
// 加载草稿
const loadDraft = async (opt: any = {}) => {
try {
const { controlService, context, viewParams, showBusyIndicator, controlAction, appDeKeyFieldName } = this.state;
......@@ -377,7 +371,6 @@ export class FormControl extends MainControl {
console.log(error);
}
};
// 订阅viewSubject,监听load行为
if (viewSubject) {
let subscription = viewSubject.subscribe(({ tag, action, data }: IActionParam) => {
......@@ -385,16 +378,12 @@ export class FormControl extends MainControl {
loadDraft(data);
}
});
// 部件卸载时退订viewSubject
onUnmounted(() => {
subscription.unsubscribe();
});
}
return {
loadDraft: loadDraft,
};
return { loadDraft };
}
/**
......@@ -660,14 +649,11 @@ export class FormControl extends MainControl {
*/
public moduleInstall() {
const superParams = super.moduleInstall();
// 表单行为能力启用
const { load } = this.useLoad();
const { save } = this.useSave();
return {
...superParams,
load,
save,
load: this.useLoad(),
loadDraft: this.useLoadDraft(),
save: this.useSave(),
handleEditorEvent: this.handleEditorEvent.bind(this),
handleComponentEvent: this.handleComponentEvent.bind(this),
};
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册