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

update:更新

上级 61dc240b
...@@ -33,6 +33,8 @@ export class EditView extends MainView { ...@@ -33,6 +33,8 @@ export class EditView extends MainView {
// 初始化表单引用 // 初始化表单引用
this.form = ref(null); this.form = ref(null);
onMounted(() => { onMounted(() => {
// 初始化数据能力部件
this.xDataControl = this.getForm();
const { isLoadDefault, context, viewparams, keyPSDEField } = this.state; const { isLoadDefault, context, viewparams, keyPSDEField } = this.state;
if (this.getForm() && isLoadDefault) { if (this.getForm() && isLoadDefault) {
const tag = this.getForm().name; const tag = this.getForm().name;
......
...@@ -15,14 +15,6 @@ export class MainView extends ViewBase { ...@@ -15,14 +15,6 @@ export class MainView extends ViewBase {
*/ */
public declare state: MainViewState; public declare state: MainViewState;
/**
* 当前视图具有数据能力部件
*
* @type {IParam}
* @memberof MainView
*/
public declare xDataControl: IParam;
/** /**
* @description 处理工具栏事件 * @description 处理工具栏事件
* *
...@@ -44,7 +36,7 @@ export class MainView extends ViewBase { ...@@ -44,7 +36,7 @@ export class MainView extends ViewBase {
const inputParam = { const inputParam = {
context: this.state.context, context: this.state.context,
viewParams: this.state.viewParams, viewParams: this.state.viewParams,
data: this.xDataControl.getData(), data: this.xDataControl?.getData(),
event: data.event, event: data.event,
actionEnvironment: this actionEnvironment: this
}; };
......
import { Ref } from 'vue'; import { Ref } from 'vue';
import { useRoute } from 'vue-router'; 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 视图基类 * @description 视图基类
...@@ -33,6 +33,14 @@ export class ViewBase { ...@@ -33,6 +33,14 @@ export class ViewBase {
*/ */
public declare emit: Function; public declare emit: Function;
/**
* 当前视图具有数据能力部件
*
* @type {IParam}
* @memberof ViewBase
*/
public declare xDataControl: IParam;
/** /**
* 界面行为服务 * 界面行为服务
* *
...@@ -93,7 +101,13 @@ export class ViewBase { ...@@ -93,7 +101,13 @@ export class ViewBase {
* *
*/ */
public closeView() { 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 { ...@@ -26,6 +26,15 @@ export class FormControl extends MainControl {
*/ */
public declare state: FormControlState; public declare state: FormControlState;
/**
* 获取当前激活数据
*
* @memberof FormControl
*/
public getData(): IParam[] {
return [this.state.data];
}
/** /**
* @description 检验表单动态逻辑 * @description 检验表单动态逻辑
* @param {IParam} data 表单数据 * @param {IParam} data 表单数据
......
...@@ -40,10 +40,10 @@ interface CtrlEmit { ...@@ -40,10 +40,10 @@ interface CtrlEmit {
const emit = defineEmits <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> </script>
<template> <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"> <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 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册