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

update:选择视图

上级 9d1798e6
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
{{/if}} {{/if}}
{{#if item.psEditor.psNavigateParams}} {{#if item.psEditor.psNavigateParams}}
localParam="{{> @macro/front-end/common/navparam.hbs appNavParams=item.psEditor.psNavigateParams}}" localParam="{{> @macro/front-end/common/navparam.hbs appNavParams=item.psEditor.psNavigateParams}}"
{{!-- localParam="{{item.psEditor.psNavigateParams}}" --}}
{{/if}} {{/if}}
:context="state.context" :context="state.context"
:viewParams="state.viewParams" :viewParams="state.viewParams"
...@@ -26,7 +27,10 @@ ...@@ -26,7 +27,10 @@
{{!-- {{/each}} --}} {{!-- {{/each}} --}}
{{!-- deKeyField="{{item.psEditor.psAppDataEntity.codeName}}" --}} {{!-- deKeyField="{{item.psEditor.psAppDataEntity.codeName}}" --}}
{{/if}} {{/if}}
{{!-- :pickupView="getPickupView({{item.psEditor}})" --}} {{!-- {{#if item.psEditor.pickuppsAppView }} --}}
{{!-- :pickupView="{{item.psEditor.pickuppsAppView}}" --}}
{{!-- {{/if}} --}}
pickUpView="ChartDataPickupView"
{{!-- :linkView="getLinkView({{item.psEditor}})" --}} {{!-- :linkView="getLinkView({{item.psEditor}})" --}}
{{!-- :acParams="getAcParams({{item.psEditor}})" --}} {{!-- :acParams="getAcParams({{item.psEditor}})" --}}
{{#if item.psEditor.psAppDEACMode.minorSortDir}} {{#if item.psEditor.psAppDEACMode.minorSortDir}}
......
...@@ -25,7 +25,7 @@ export const AppViewConfig:IParam = { ...@@ -25,7 +25,7 @@ export const AppViewConfig:IParam = {
"iconCls": "{{appView.psSysImage.cssClass}}", "iconCls": "{{appView.psSysImage.cssClass}}",
{{/if}} {{/if}}
"viewType": "{{appView.viewType}}", "viewType": "{{appView.viewType}}",
"fileDir": "@page/{{#if psAppDataEntity}}{{spinalCase psAppDataEntity.codeName}}{{else}}default{{/if}}/{{spinalCase appView.codeName}}" "fileDir": "@page/{{lowerCase app.codeName}}/{{spinalCase appView.codeName}}"
}{{#unless @last}},{{/unless}} }{{#unless @last}},{{/unless}}
{{/each}} {{/each}}
} }
\ No newline at end of file
<script setup lang="ts"> <script setup lang="ts">
import { onBeforeMount, Ref, ref } from 'vue'; import { onBeforeMount, Ref, ref } from 'vue';
import { SearchOutlined, ExportOutlined } from '@ant-design/icons-vue'; import { SearchOutlined, ExportOutlined } from '@ant-design/icons-vue';
import { deepCopy, IParam, IActionParam, EditorBase, IContext } from '@core'; import { deepCopy, IParam, IActionParam, EditorBase, IContext, PickupView } from '@core';
interface DataPickerProps { interface DataPickerProps {
/** /**
* @description 编辑器名称 * @description 编辑器名称
...@@ -66,7 +66,7 @@ interface DataPickerProps { ...@@ -66,7 +66,7 @@ interface DataPickerProps {
/** /**
* @description 选择视图 * @description 选择视图
*/ */
pickUpView?: IParam; pickUpView?: string;
/** /**
* @description 链接视图 * @description 链接视图
...@@ -195,13 +195,35 @@ const onSelect = (value: any) => { ...@@ -195,13 +195,35 @@ const onSelect = (value: any) => {
fillPickUpData(selectItem); fillPickUpData(selectItem);
}; };
const initValue = (data: any) => {
// todo
};
// 打开视图
const openView = () => {
if (!props.pickUpView) {
return;
}
const view = App.getViewInfo(props.pickUpView);
if (!view) {
return;
}
const subject = App.getOpenViewService().openView(view, {});
const subjectEvent = subject?.subscribe((data: any) => {
if (data?.ret == 'OK' && data.resultData) {
const value = initValue(data.resultData);
emit('editorEvent', { tag: props.valueItem, action: 'valueChange', data: value });
}
subjectEvent?.unsubscribe();
});
};
</script> </script>
<template> <template>
<template v-if="linkOnly" :class="['app-data-picker', `app-data-picker-${name}`]"> <template v-if="linkOnly" :class="['app-data-picker', `app-data-picker-${name}`]">
<a @click="openLinkView">\{{ value }}</a> <a @click="openLinkView">{{ value }}</a>
</template> </template>
<template v-else-if="!noAc && !isDropdown"> <template v-else-if="!isAC && !isDropdown">
<a-auto-complete <a-auto-complete
:class="['app-data-picker', `app-data-picker-${name}`]" :class="['app-data-picker', `app-data-picker-${name}`]"
:allowClear="true" :allowClear="true"
...@@ -214,11 +236,11 @@ const onSelect = (value: any) => { ...@@ -214,11 +236,11 @@ const onSelect = (value: any) => {
:defaultOpen="true" :defaultOpen="true"
> >
<template #option="option"> <template #option="option">
<div @click="onSelect(option[deKeyField])">\{{ option[deMajorField] }}</div> <div @click="onSelect(option[deKeyField])">{{ option[deMajorField] }}</div>
</template> </template>
<a-input :placeholder="placeholder"> <a-input :placeholder="placeholder">
<template #suffix> <template #suffix>
<search-outlined v-if="pickUpView && showButton" class="certain-category-icon" @click="openView" /> <search-outlined v-if="pickUpView" class="certain-category-icon" @click="openView" />
<export-outlined v-if="linkView" @click="openLinkView" /> <export-outlined v-if="linkView" @click="openLinkView" />
</template> </template>
</a-input> </a-input>
...@@ -245,11 +267,11 @@ const onSelect = (value: any) => { ...@@ -245,11 +267,11 @@ const onSelect = (value: any) => {
:placeholder="placeholder" :placeholder="placeholder"
> >
<template #suffixIcon> <template #suffixIcon>
<search-outlined v-if="pickUpView" @click="openPickUpView" /> <search-outlined v-if="pickUpView" @click="openPickUpView" />
<select-outlined v-if="linkView" @click="openLinkView" /> <select-outlined v-if="linkView" @click="openLinkView" />
</template> </template>
<a-select-option v-for="(item, index) in items" :key="index" :value="item[deKeyField]"> <a-select-option v-for="(item, index) in items" :key="index" :value="item[deKeyField]">
\{{ item[deMajorField] }} {{ item[deMajorField] }}
</a-select-option> </a-select-option>
</a-select> </a-select>
</template> </template>
......
<script setup lang="ts">
</script>
<template>
<IbizViewBaseLayout>
<template v-slot:header-left>
<slot name="caption" />
</template>
<template v-slot:header-right>
<slot name="toolbar" />
</template>
<template v-slot:header-bottom>
<slot name="topMessage" />
<slot name="searchForm" />
</template>
<template v-slot:body-top>
<slot name="bodyMessage" />
</template>
<slot />
<template v-slot:footer-content>
<slot name="bottomMessage" />
<slot name="footer" />
</template>
</IbizViewBaseLayout>
</template>
<style lang="scss">
</style>
\ No newline at end of file
<script setup lang="ts"></script>
<template>
<IbizViewBaseLayout>
<template v-slot:header-left>
<slot name="caption" />
</template>
<template v-slot:header-right>
<slot name="toolbar" />
</template>
<template v-slot:header-bottom>
<slot name="topMessage" />
<slot name="searchForm" />
</template>
<template v-slot:body-top>
<slot name="bodyMessage" />
</template>
<slot />
<template v-slot:footer-content>
<slot name="bottomMessage" />
<slot name="footer" />
</template>
</IbizViewBaseLayout>
</template>
<style lang="scss">
</style>
\ No newline at end of file
...@@ -133,7 +133,7 @@ export class AppActionBase { ...@@ -133,7 +133,7 @@ export class AppActionBase {
if (Object.is(uiAction?.uILogicAttachMode, 'AFTER')) { if (Object.is(uiAction?.uILogicAttachMode, 'AFTER')) {
this.executeUILogic(uiAction, params); this.executeUILogic(uiAction, params);
} }
// 后续界面行为 todo // 后续界面行为
if (!uiAction.nextActionCodeName) { if (!uiAction.nextActionCodeName) {
return; return;
} }
......
import { IActionParam } from "@core";
import { PickupView } from "../pickup-view"; import { PickupView } from "../pickup-view";
import { PickupGridViewProps } from "./pickup-grid-view-prop"; import { PickupGridViewProps } from "./pickup-grid-view-prop";
import { PickupGridViewState } from "./pickup-grid-view-state"; import { PickupGridViewState } from "./pickup-grid-view-state";
...@@ -17,6 +18,7 @@ export class PickupGridView extends PickupView { ...@@ -17,6 +18,7 @@ export class PickupGridView extends PickupView {
*/ */
public declare viewState: PickupGridViewState; public declare viewState: PickupGridViewState;
/** /**
* @description 使用加载功能模块 * @description 使用加载功能模块
* @param {PickupGridViewProps} props 传入的props * @param {PickupGridViewProps} props 传入的props
...@@ -29,6 +31,25 @@ export class PickupGridView extends PickupView { ...@@ -29,6 +31,25 @@ export class PickupGridView extends PickupView {
}) })
} }
/**
* 部件事件
*
* @param {IActionParam} actionParam
* @memberof PickupGridView
*/
public handleCtrlEvent(actionParam: IActionParam) {
const { tag, action, data } = actionParam;
if (tag !== 'grid') {
return;
}
if (action === 'selectionChange') {
this.selectData = data;
this.emit('viewEvent', actionParam)
}
}
/** /**
* @description 安装视图所有功能模块的方法 * @description 安装视图所有功能模块的方法
* @param {PickupGridViewProps} props 传入的Props * @param {PickupGridViewProps} props 传入的Props
...@@ -37,10 +58,12 @@ export class PickupGridView extends PickupView { ...@@ -37,10 +58,12 @@ export class PickupGridView extends PickupView {
* @memberof PickupGridView * @memberof PickupGridView
*/ */
public moduleInstall(props: PickupGridViewProps, emit?: Function) { public moduleInstall(props: PickupGridViewProps, emit?: Function) {
this.emit = emit;
const superParams = super.moduleInstall(props, emit); const superParams = super.moduleInstall(props, emit);
this.useLoad(props); this.useLoad(props);
return { return {
...superParams, ...superParams,
handleCtrlEvent: this.handleCtrlEvent.bind(this),
state: this.viewState, state: this.viewState,
}; };
} }
......
import { IActionParam } from "@core";
import { MainView } from "../main-view"; import { MainView } from "../main-view";
import { PickupViewProps } from "./pickup-view-prop"; import { PickupViewProps } from "./pickup-view-prop";
import { PickupViewState } from "./pickup-view-state"; import { PickupViewState } from "./pickup-view-state";
...@@ -17,6 +18,9 @@ export class PickupView extends MainView { ...@@ -17,6 +18,9 @@ export class PickupView extends MainView {
*/ */
public declare viewState: PickupViewState; public declare viewState: PickupViewState;
public selectData: any[] = [];
/** /**
* @description 使用加载功能模块 * @description 使用加载功能模块
* @param {PickupViewProps} props 传入的props * @param {PickupViewProps} props 传入的props
...@@ -42,8 +46,24 @@ export class PickupView extends MainView { ...@@ -42,8 +46,24 @@ export class PickupView extends MainView {
* @memberof PickupView * @memberof PickupView
*/ */
public confirm() { public confirm() {
//todo this.emit('viewEvent', { data: this.selectData, tag: '', action: 'close' })
} }
public handleCtrlEvent(actionParam: IActionParam) {
debugger
const { tag, action, data } = actionParam;
// TODO
if (action === 'selectionChange') {
this.selectData = data;
this.emit('viewEvent', { data: this.selectData, tag: '', action: 'viewDataChange' })
}
if (action === 'close') {
this.emit('viewEvent', { data: this.selectData, tag: '', action: 'viewDataChange' })
}
}
/** /**
* @description 安装视图所有功能模块的方法 * @description 安装视图所有功能模块的方法
...@@ -58,6 +78,7 @@ export class PickupView extends MainView { ...@@ -58,6 +78,7 @@ export class PickupView extends MainView {
return { return {
...superParams, ...superParams,
state: this.viewState, state: this.viewState,
selectData: this.selectData,
cancel: this.cancel.bind(this), cancel: this.cancel.bind(this),
confirm: this.confirm.bind(this) confirm: this.confirm.bind(this)
}; };
......
...@@ -25,6 +25,13 @@ export class ViewBase { ...@@ -25,6 +25,13 @@ export class ViewBase {
this.viewState = reactive(options); this.viewState = reactive(options);
} }
/**
* @description 事件
* @type {*}
* @memberof ViewBase
*/
emit: any;
/** /**
* @description 根据props调整设置部分视图基类 * @description 根据props调整设置部分视图基类
* @param {ViewPropsBase} props 传入参数 * @param {ViewPropsBase} props 传入参数
...@@ -124,6 +131,7 @@ export class ViewBase { ...@@ -124,6 +131,7 @@ export class ViewBase {
* @memberof ViewBase * @memberof ViewBase
*/ */
public moduleInstall(props: ViewPropsBase, emit?: Function) { public moduleInstall(props: ViewPropsBase, emit?: Function) {
this.emit = emit?.bind(this);
this.setState(props); this.setState(props);
this.useViewContextParams(props); this.useViewContextParams(props);
this.useCounterService(props); this.useCounterService(props);
......
...@@ -18,16 +18,6 @@ export class PickupViewPanelControl extends MainControl { ...@@ -18,16 +18,6 @@ export class PickupViewPanelControl extends MainControl {
*/ */
public declare controlState: PickupViewPanelControlState; public declare controlState: PickupViewPanelControlState;
/**
* @description 是否初始化完成
* @type {Ref<boolean>}
* @memberof PickupViewPanelControl
*/
public inited: Ref<boolean> = ref(false);
public viewdata: string = '';
public viewparam: string = '';
/** /**
* @description 根据props设置部件state * @description 根据props设置部件state
...@@ -36,9 +26,6 @@ export class PickupViewPanelControl extends MainControl { ...@@ -36,9 +26,6 @@ export class PickupViewPanelControl extends MainControl {
*/ */
public setState(props: PickupViewPanelControlProps) { public setState(props: PickupViewPanelControlProps) {
super.setState(props); super.setState(props);
this.controlState.isSingleSelect = toRef(props, 'isSingleSelect');
this.controlState.isShowButton = toRef(props, 'isShowButton');
this.controlState.selectedData = toRef(props, 'selectedData');
} }
/** /**
...@@ -49,21 +36,34 @@ export class PickupViewPanelControl extends MainControl { ...@@ -49,21 +36,34 @@ export class PickupViewPanelControl extends MainControl {
public useLoad(props: PickupViewPanelControlProps) { public useLoad(props: PickupViewPanelControlProps) {
const { viewSubject, controlName, context, viewParams } = this.controlState; const { viewSubject, controlName, context, viewParams } = this.controlState;
// 订阅viewSubject,监听load行为 // 订阅viewSubject,监听load行为
if(viewSubject){ if (viewSubject) {
let subscription = viewSubject.subscribe(({ tag, action, data }: IActionParam)=>{ let subscription = viewSubject.subscribe(({ tag, action, data }: IActionParam) => {
if(Object.is(controlName, tag) && Object.is("load", action) ){ if (Object.is(controlName, tag) && Object.is("load", action)) {
this.viewdata = JSON.stringify(context);
this.viewparam = JSON.stringify(viewParams);
this.inited.value = true;
} }
}) })
// 部件卸载时退订viewSubject // 部件卸载时退订viewSubject
onUnmounted(()=>{ onUnmounted(() => {
subscription.unsubscribe(); subscription.unsubscribe();
}) })
} }
} }
/**
* 部件事件
*
* @param {IActionParam} actionParam
* @memberof PickupViewPanelControl
*/
public handleViewEvent(actionParam: IActionParam) {
const { tag, action, data } = actionParam;
const { controlName } = this.controlState;
if (Object.is("selectionChange", action)) {
this.emit('ctrlEvent', { tag: controlName, action: action, data: data });
}
}
/** /**
* @description 安装部件所有功能模块的方法 * @description 安装部件所有功能模块的方法
* @param {PickupViewPanelControlProps} props 传入的Props * @param {PickupViewPanelControlProps} props 传入的Props
...@@ -75,9 +75,7 @@ export class PickupViewPanelControl extends MainControl { ...@@ -75,9 +75,7 @@ export class PickupViewPanelControl extends MainControl {
const superParams = super.moduleInstall(props, emit); const superParams = super.moduleInstall(props, emit);
return { return {
...superParams, ...superParams,
inited: this.inited, handleViewEvent: this.handleViewEvent.bind(this),
viewdata: this.viewdata,
viewparam: this.viewparam,
state: this.controlState state: this.controlState
}; };
} }
......
import {{page.codeName}} from "./{{spinalCase page.codeName}}.vue";
export default {{page.codeName}};
...@@ -2,11 +2,14 @@ ...@@ -2,11 +2,14 @@
import { Subject } from 'rxjs'; import { Subject } from 'rxjs';
import { PickupGridView, IActionParam, IParam, IContext } from '@core'; import { PickupGridView, IActionParam, IParam, IContext } from '@core';
import { ViewConfig } from './{{spinalCase page.codeName}}-config'; import { ViewConfig } from './{{spinalCase page.codeName}}-config';
{{#page.ctrls}} // todo 表格部件拿不到目前导入固定表格
{{#eq controlType "GRID"}} import { MainGrid } from '@widgets/chart-data/main-grid';
import { {{codeName}}Grid } from '@widgets/{{spinalCase appEntity.codeName}}/{{spinalCase codeName}}-grid'; {{#each page.controls as |control|}}
{{/eq}} {{#if (eq control.controlType 'GRID') }}
{{/page.ctrls}} import { {{control.codeName}}Grid } from '@widgets/{{spinalCase appEntity.codeName}}/{{spinalCase codeName}}-grid';
{{/if}}
{{/each}}
// props声明和默认值处理 // props声明和默认值处理
interface Props { interface Props {
...@@ -29,11 +32,11 @@ interface ViewEmit { ...@@ -29,11 +32,11 @@ interface ViewEmit {
const emit = defineEmits<ViewEmit>(); const emit = defineEmits<ViewEmit>();
// 安装功能模块,提供状态和能力方法 // 安装功能模块,提供状态和能力方法
const { state } = new PickupGridView(ViewConfig).moduleInstall(props, emit); const { state, confirm, handleCtrlEvent } = new PickupGridView(ViewConfig).moduleInstall(props, emit);
</script> </script>
<template> <template>
<IbizDefaultViewLayout class="ibiz-pickup-grid-view"> <IbizPickerUpGridViewLayout class="ibiz-pickup-grid-view">
<template v-slot:header-left> <template v-slot:header-left>
<IbizIconText class="ibiz-view__caption" size="large" :text="state.viewCaption" /> <IbizIconText class="ibiz-view__caption" size="large" :text="state.viewCaption" />
</template> </template>
...@@ -51,21 +54,15 @@ const { state } = new PickupGridView(ViewConfig).moduleInstall(props, emit); ...@@ -51,21 +54,15 @@ const { state } = new PickupGridView(ViewConfig).moduleInstall(props, emit);
></{{codeName}}Grid> ></{{codeName}}Grid>
{{/eq}} {{/eq}}
{{/page.ctrls}} {{/page.ctrls}}
<template v-slot:footer> <MainGrid
<a-space class="ibiz-pickup-grid-view--footer"> :context="state.context"
<a-button @click="cancel">取消</a-button> :rowEditState="state.rowEditState"
<a-button @click="confirm">确认</a-button> :rowActiveMode="state.gridRowActiveMode"
</a-space> :showBusyIndicator="true"
</template> :viewParams="state.viewParams"
</IbizDefaultViewLayout> :controlAction="state.controlsAction.grid"
:viewSubject="state.viewSubject"
@ctrlEvent="handleCtrlEvent"
></MainGrid>
</IbizPickerUpGridViewLayout>
</template> </template>
<style lang="scss">
.ibiz-pickup-grid-view {
position: relative;
.ibiz-pickup-grid-view--footer {
position: absolute;
bottom: 20px;
right: 35px;
}
}
</style>
\ No newline at end of file
import {{page.codeName}} from "./{{spinalCase page.codeName}}.vue";
export default {{page.codeName}};
...@@ -2,7 +2,11 @@ ...@@ -2,7 +2,11 @@
import { Subject } from 'rxjs'; import { Subject } from 'rxjs';
import { PickupView, IActionParam, IParam, IContext } from '@core'; import { PickupView, IActionParam, IParam, IContext } from '@core';
import { ViewConfig } from './{{spinalCase page.codeName}}-config'; import { ViewConfig } from './{{spinalCase page.codeName}}-config';
{{#page.ctrls}}
{{#eq controlType "PICKUPVIEWPANEL"}}
import { {{codeName}}PickUpViewPanel } from '@widgets/{{spinalCase appEntity.codeName}}/{{spinalCase codeName}}-pickup-view-panel';
{{/eq}}
{{/page.ctrls}}
// props声明和默认值处理 // props声明和默认值处理
interface Props { interface Props {
context: IContext; context: IContext;
...@@ -24,13 +28,53 @@ interface ViewEmit { ...@@ -24,13 +28,53 @@ interface ViewEmit {
const emit = defineEmits<ViewEmit>(); const emit = defineEmits<ViewEmit>();
// 安装功能模块,提供状态和能力方法 // 安装功能模块,提供状态和能力方法
const { state } = new PickupView(ViewConfig).moduleInstall(props, emit); const { state, cancel, confirm,handleCtrlEvent } = new PickupView(ViewConfig).moduleInstall(props, emit);
</script> </script>
<template> <template>
<IbizDefaultViewLayout class="ibiz-pickup-view"> <IbizPickerUpViewLayout class="ibiz-pickup-view">
<template v-slot:header-left> <template v-slot:header-left>
<IbizIconText class="ibiz-view__caption" size="large" :text="state.viewCaption" /> <IbizIconText class="ibiz-view__caption" size="large" :text="state.viewCaption" />
</template>
{{#page.ctrls}}
{{#eq controlType "TOOLBAR"}}
<template v-slot:toolbar>
<IbizToolbar
mode="button"
name="{{lowerCase codeName}}"
:actionModel="state.viewToolbarModel"
@toolbarEvent="handleToolbarEvent"/>
</template>
{{/eq}}
{{#eq controlType "PICKUPVIEWPANEL"}}
<{{codeName}}PickUpViewPanel
:context="state.context"
:rowEditState="state.rowEditState"
:rowActiveMode="state.gridRowActiveMode"
:showBusyIndicator="true"
:viewParams="state.viewParams"
:controlAction="state.controlsAction.{{name}}"
:viewSubject="state.viewSubject"
@ctrlEvent="handleCtrlEvent"
></{{codeName}}PickUpViewPanel>
{{/eq}}
{{/page.ctrls}}
<template v-slot:footer>
<a-space class="ibiz-pickup-view--footer">
<a-button @click="cancel">取消</a-button>
<a-button @click="confirm">确认</a-button>
</a-space>
</template> </template>
</IbizDefaultViewLayout> </IbizPickerUpViewLayout>
</template> </template>
\ No newline at end of file <style lang="scss">
.ibiz-pickup-view {
position: relative;
.ibiz-pickup-view--footer {
position: absolute;
bottom: 20px;
right: 35px;
}
}
</style>
\ No newline at end of file
<script setup lang="ts"> <script setup lang="ts">
import { IParam, ViewDetail } from '@core'; import { IActionParam, IParam, ViewDetail } from '@core';
import { Subject } from 'rxjs'; import { Subject } from 'rxjs';
import { Ref, ref } from 'vue'; import { Ref, ref } from 'vue';
interface AppModalProps { interface AppModalProps {
...@@ -31,7 +31,7 @@ interface AppModalProps { ...@@ -31,7 +31,7 @@ interface AppModalProps {
/** /**
* @description 是否全屏 * @description 是否全屏
*/ */
isFullscreen:boolean; isFullscreen: boolean;
/** /**
* @description 模态参数 * @description 模态参数
...@@ -49,7 +49,6 @@ const props = withDefaults(defineProps<AppModalProps>(), { ...@@ -49,7 +49,6 @@ const props = withDefaults(defineProps<AppModalProps>(), {
*/ */
let isVisible: Ref<boolean> = ref(false); let isVisible: Ref<boolean> = ref(false);
/** /**
* 临时结果 * 临时结果
*/ */
...@@ -132,8 +131,9 @@ onMounted(() => { ...@@ -132,8 +131,9 @@ onMounted(() => {
*/ */
const close = (result: any) => { const close = (result: any) => {
if (result && Array.isArray(result) && result.length > 0) { if (result && Array.isArray(result) && result.length > 0) {
Object.assign(tempResult, { ret: 'OK' }, { datas: JSON.parse(JSON.stringify(result)) }); Object.assign(tempResult, { ret: 'OK' }, { resultData: JSON.parse(JSON.stringify(result)) });
} }
props.subject?.next(tempResult);
isVisible.value = false; isVisible.value = false;
}; };
...@@ -143,7 +143,7 @@ const close = (result: any) => { ...@@ -143,7 +143,7 @@ const close = (result: any) => {
const viewDataChange = (result: any) => { const viewDataChange = (result: any) => {
tempResult = { ret: '' }; tempResult = { ret: '' };
if (result && Array.isArray(result) && result.length > 0) { if (result && Array.isArray(result) && result.length > 0) {
Object.assign(tempResult, { ret: 'OK' }, { datas: JSON.parse(JSON.stringify(result)) }); Object.assign(tempResult, { ret: 'OK' }, { resultData: JSON.parse(JSON.stringify(result)) });
} }
}; };
...@@ -156,6 +156,18 @@ const viewDataActivated = (result: any) => { ...@@ -156,6 +156,18 @@ const viewDataActivated = (result: any) => {
} }
}; };
const handelViewEvent = (actionParam: IActionParam) => {
const { tag, action, data } = actionParam;
switch (action) {
case 'viewDataChange':
viewDataChange(data);
break;
case 'close':
close(data);
break;
}
};
/** /**
* 模态显示隐藏切换回调 * 模态显示隐藏切换回调
*/ */
...@@ -196,7 +208,7 @@ const handleShowState = ($event: any) => { ...@@ -196,7 +208,7 @@ const handleShowState = ($event: any) => {
:viewParams="viewParams" :viewParams="viewParams"
:viewDefaultUsage="false" :viewDefaultUsage="false"
:noViewCaption="true" :noViewCaption="true"
@viewDataChange="viewDataChange($event)" @viewEvent="handelViewEvent($event)"
@viewDataActivated="viewDataActivated($event)" @viewDataActivated="viewDataActivated($event)"
@close="close($event)" @close="close($event)"
:ref="viewName" :ref="viewName"
......
import {{ctrl.codeName}}PickUpViewPanel from "./{{spinalCase ctrl.codeName}}-pickup-view-panel.vue";
export { {{ctrl.codeName}}PickUpViewPanel };
export const CtrlConfig = {
controlCodeName: '{{ctrl.codeName}}',
controlName: '{{ctrl.name}}',
data: {},
embeddedView: {
{{#if ctrl.embeddedPSAppDEView}}
viewName: '{{ctrl.embeddedPSAppDEView.codeName}}'
{{/if}}
}
};
\ No newline at end of file
<script setup lang="ts">
import { Subject } from 'rxjs';
import { IActionParam, IParam, ControlAction, PickupViewPanelControl, IContext } from '@core';
import { CtrlConfig } from './{{spinalCase ctrl.codeName}}-pickup-view-panel-config';
import ChartDataPickUpGridView from '../../../page/sample/chart-data-pickup-grid-view';
interface Props {
context: IContext;
viewParams?: IParam;
controlAction: ControlAction;
showBusyIndicator?: boolean;
isSingleSelect?: boolean;
viewMode?: number;
selectedData?: string;
isShowButton?: boolean;
viewSubject: Subject<IActionParam>;
}
const props = withDefaults(defineProps < Props > (), {
viewSubject: () => new Subject < IActionParam > (),
viewMode: 0,
isSingleSelect: false,
isShowButton: true,
showBusyIndicator: true,
})
// emit声明
interface CtrlEmit {
(name: "ctrlEvent", value: IActionParam): void;
}
const emit = defineEmits < CtrlEmit > ();
// 安装功能模块,提供状态和能力方法
const { state, handleViewEvent} = new PickupViewPanelControl(CtrlConfig).moduleInstall(props, emit);
</script>
<template>
<div class="ibiz-pickupviewpanel">
<ChartDataPickUpGridView
:isSingleSelect="state.isSingleSelect"
:isShowButton="state.isShowButton"
:selectedData="state.selectedData"
@viewEvent="handleViewEvent"
></ChartDataPickUpGridView>
</div>
</template>
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册