提交 2b419506 编写于 作者: zhangkang's avatar zhangkang

update:关系界面

上级 3031388a
关系界面未实现 {{#eq item.psLayoutPos 'FLEX'}}
\ No newline at end of file <div style="flex-grow: {{#if item.psLayoutPos.grow}}{{item.psLayoutPos.grow}}{{else}}0{{/if}};">
<AppFormDruipart v-show="state.detailsModel.{{item.codeName}}.visible" name="{{item.codeName}}" title="{{item.caption}}">
<{{item.psAppView.codeName}}
:class="['app-view-layout--from-druipart']"
:context="druipartParams.context"
:viewParams="druipartParams.viewParams"
:viewDefaultUsage="false"
:noViewCaption="true"
@viewEvent="druipartParams.viewEvent"
>
</{{item.psAppView.codeName}}>
</AppFormDruipart>
</div>
{{else}}
<a-col
{{> @macro/front-end/widgets/common/layout-pos.hbs item=item.psLayoutPos}} >
<AppFormDruipart v-show="state.detailsModel.{{item.codeName}}.visible" name="{{item.codeName}}" title="{{item.caption}}">
<{{item.psAppView.codeName}}
:class="['app-view-layout--from-druipart']"
:context="druipartParams.context"
:viewParams="druipartParams.viewParams"
:viewDefaultUsage="false"
:noViewCaption="true"
@viewEvent="druipartParams.viewEvent"
>
</{{item.psAppView.codeName}}>
</AppFormDruipart>
</a-col>
{{/eq}}
\ No newline at end of file
<script setup lang="ts">
import { IActionParam, IParam, RouteUtil } from '@core';
import { Subject, Subscription } from 'rxjs';
interface FormDruipartProps {
// 关联视图
viewName: string;
// 刷新关系项
tempMode: string;
// 禁止加载
isForbidLoad: string;
// 传入参数项名称
paramItem: string;
// 视图上下文
context: string;
// 视图参数
viewParams: boolean;
// 应用实体参数名称
parentName: number;
// 应用实体映射实体名称
parentDeName: boolean;
// 标题
title: string;
// 刷新关系项
refreshItems: string;
// 表单数据
data: string;
// 表单订阅对象
formState: Subject<any>;
// 视图路由参数
parameters: any[];
// 名称
name: string;
// 是否忽略表单项值变化
ignoreFieldValueChange: boolean;
}
interface FormDruipartEmit {
(name: 'componentEvent', value: IActionParam): void;
}
const props = withDefaults(defineProps<FormDruipartProps>(), {});
const emit = defineEmits<FormDruipartEmit>();
let formStateEvent: undefined | Subscription = undefined;
const formDruipart: Subject<any> = new Subject<any>();
// 关秀界面上下文
let druipartContext:any = undefined;
// 关秀界面视图参数
let druipartViewParams:any = undefined;
onBeforeMount(() => {
watch(
() => props.data,
(newVal: any, oldVal: any) => {
if (props.ignoreFieldValueChange) {
return;
}
if (Object.is(newVal, oldVal)) {
return;
}
refreshDRUIPart();
},
);
druipartInit();
});
// 关系界面初始化
const druipartInit = () => {
if (!props.formState) {
return;
}
formStateEvent = props.formState.subscribe(($event: any) => {
// 表单加载完成
if (Object.is($event.type, 'load')) {
refreshDRUIPart($event.data);
}
});
};
// 刷新关系界面
const refreshDRUIPart = (data?: any) => {
// const formData: any = data ? data : JSON.parse(props.data);
// const _paramItem = formData[props.paramItem];
// let tempContext: any = {};
// let tempParam: any = {};
// const _parameters: any[] = [RouteUtil.getIndexViewParam(), ...props.parameters];
// _parameters.forEach((parameter: any) => {
// const { pathName, parameterName }: { pathName: string; parameterName: string } = parameter;
// if (formData[parameterName] && !Object.is(formData[parameterName], '')) {
// Object.assign(tempContext, {
// [parameterName]: formData[parameterName],
// });
// }
// });
// Object.assign(tempContext, { [props.paramItem]: _paramItem });
// //设置顶层视图唯一标识
// Object.assign(tempContext, props.context);
// Object.assign(tempContext, {
// srfParentDeName: props.parentName,
// srfParentDeMapName: props.parentDeName,
// srfParentKey: _paramItem,
// });
// Object.assign(tempParam, {
// srfParentDeName: props.parentName,
// srfParentDeMapName: props.parentDeName,
// srfParentKey: _paramItem,
// });
// 设置局部上下文
formDruipart.next({ action: 'load' });
};
const viewEvent = (action:any) => {
};
</script>
<template>
<a-card :class="['app-form-druipart', `app-form-druipart-${name}`]" :bordered="false">
<template #title>
<p :class="['app-form-druipart-title']">
<AppIconText :text="title" />
</p>
</template>
<slot :context="druipartContext" :viewParams="druipartViewParams" :viewEvent="viewEvent" ></slot>
</a-card>
</template>
<style lang="scss">
.app-form-druipart {
height: 100%;
width: 100%;
.ant-card-head {
text-align: left;
.app-form-druipart-title {
margin: 0px;
}
}
.app-view-layout--from-druipart {
padding: 0;
}
}
</style>
\ No newline at end of file
...@@ -3,7 +3,21 @@ ...@@ -3,7 +3,21 @@
import { Subject } from 'rxjs'; import { Subject } from 'rxjs';
import { ctrlState } from './{{spinalCase ctrl.codeName}}-form-state'; import { ctrlState } from './{{spinalCase ctrl.codeName}}-form-state';
import { FormControl, IActionParam, IParam, ControlAction, IContext } from '@core'; import { FormControl, IActionParam, IParam, ControlAction, IContext } from '@core';
{{#*inline "importFormDruipart"}}
{{#each items as | formDetail | }}
{{#eq formDetail.detailType 'DRUIPART'}}
import {{formDetail.psAppView.codeName}} from '@views/{{spinalCase formDetail.psAppView.psAppModule.codeName}}/{{spinalCase formDetail.psAppView.codeName}}';
{{/eq}}
{{#if formDetail.psDEFormDetails}}
{{>(lookup 'importFormDruipart') items=formDetail.psDEFormDetails}}
{{/if}}
{{/each }}
{{/inline}}
{{#each ctrl.psDEFormPages as | items | }}
{{#if items.psDEFormDetails}}
{{>(lookup 'importFormDruipart') items=items.psDEFormDetails}}
{{/if}}
{{/each}}
interface Props { interface Props {
context: IContext; context: IContext;
viewParams?: IParam; viewParams?: IParam;
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册