提交 53137e73 编写于 作者: tony001's avatar tony001

update:更新

上级 61dc240b
......@@ -33,6 +33,8 @@ export class EditView extends MainView {
// 初始化表单引用
this.form = ref(null);
onMounted(() => {
// 初始化数据能力部件
this.xDataControl = this.getForm();
const { isLoadDefault, context, viewparams, keyPSDEField } = this.state;
if (this.getForm() && isLoadDefault) {
const tag = this.getForm().name;
......
......@@ -15,14 +15,6 @@ export class MainView extends ViewBase {
*/
public declare state: MainViewState;
/**
* 当前视图具有数据能力部件
*
* @type {IParam}
* @memberof MainView
*/
public declare xDataControl: IParam;
/**
* @description 处理工具栏事件
*
......@@ -44,7 +36,7 @@ export class MainView extends ViewBase {
const inputParam = {
context: this.state.context,
viewParams: this.state.viewParams,
data: this.xDataControl.getData(),
data: this.xDataControl?.getData(),
event: data.event,
actionEnvironment: this
};
......
import { Ref } from 'vue';
import { useRoute } from 'vue-router';
import { ViewPropsBase, ViewStateBase, UIBase, IParam, UIUtil, deepCopy } from '@core';
import { ViewPropsBase, ViewStateBase, UIBase, IParam, UIUtil, deepCopy, IActionParam } from '@core';
/**
* @description 视图基类
......@@ -33,6 +33,14 @@ export class ViewBase {
*/
public declare emit: Function;
/**
* 当前视图具有数据能力部件
*
* @type {IParam}
* @memberof ViewBase
*/
public declare xDataControl: IParam;
/**
* 界面行为服务
*
......@@ -93,7 +101,13 @@ export class ViewBase {
*
*/
public closeView() {
window.history.go(-1);
// 路由模式直接返回
if (Object.is(this.props.openType, 'ROUTE')) {
window.history.back();
} else {
// 非路由模式继续向外抛关闭视图事件
this.emit('onViewEvent', { tag: this.state.viewName, action: 'closeView', data: this.xDataControl?.getData() });
}
}
/**
......
......@@ -26,6 +26,15 @@ export class FormControl extends MainControl {
*/
public declare state: FormControlState;
/**
* 获取当前激活数据
*
* @memberof FormControl
*/
public getData(): IParam[] {
return [this.state.data];
}
/**
* @description 检验表单动态逻辑
* @param {IParam} data 表单数据
......
......@@ -40,10 +40,10 @@ interface CtrlEmit {
const emit = defineEmits <CtrlEmit> ();
// 安装功能模块,提供状态和能力方法
const { name, state, onEditorEvent, onComponentEvent } = new FormControl(ctrlState, props, emit).moduleInstall();
const { name, state, onEditorEvent, onComponentEvent, getData } = new FormControl(ctrlState, props, emit).moduleInstall();
// 暴露内部状态及能力
defineExpose({ name, state });
defineExpose({ name, state, getData });
</script>
<template>
<a-form name="{{ctrl.codeName}}" class="app-form{{#if ctrl.psSysCss}} {{ctrl.psSysCss.cssName}}{{/if}}{{#if ctrl.infoFormMode}} app-info-form{{/if}}" style="{{#if ctrl.formWidth}}width: {{ctrl.formWidth}}px;{{/if}}" :model="state.data" :rules="state.rules">
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册