提交 f248649f 编写于 作者: RedPig97's avatar RedPig97

add: 新增数据多选视图

上级 668f7ef1
<script setup lang="ts"></script>
<template>
<AppViewBaseLayout>
<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>
</AppViewBaseLayout>
</template>
\ No newline at end of file
...@@ -6,5 +6,6 @@ export * from './edit-view' ...@@ -6,5 +6,6 @@ export * from './edit-view'
export * from './index-view' export * from './index-view'
export * from './grid-view' export * from './grid-view'
export * from './pickup-view' export * from './pickup-view'
export * from './mpickup-view'
export * from './pickup-grid-view' export * from './pickup-grid-view'
export * from './tree-exp-view' export * from './tree-exp-view'
\ No newline at end of file
export * from './mpickup-view-prop'
export * from './mpickup-view-state'
export * from './mpickup-view'
\ No newline at end of file
import { PickupViewProps } from "@core";
/**
* @description 多选视图props
* @export
* @interface MPickupViewProps
* @extends {PickupViewProps}
*/
export interface MPickupViewProps extends PickupViewProps { }
\ No newline at end of file
import { PickupViewState } from '@core';
/**
* @description 多选视图状态
* @export
* @interface MPickupViewState
* @extends {PickupViewState}
*/
export interface MPickupViewState extends PickupViewState {
}
import { IActionParam, IParam, PickupView } from "@core";
import { MainView } from "../main-view";
import { MPickupViewProps } from "./mpickup-view-prop";
import { MPickupViewState } from "./mpickup-view-state";
/**
* @description 多选视图
* @export
* @class MPickupView
* @extends {PickupView}
*/
export class MPickupView extends PickupView {
/**
* @description 视图状态
* @type {MPickupViewState}
* @memberof PickupView
*/
public declare state: MPickupViewState;
public select: IParam = {};
public useSelections: any[] = [];
public onMoveRight() {
this.useSelections.push(this.selectData);
}
public onMoveLeft() {
const index = this.useSelections.findIndex((selection: any) => Object.is(this.select.srfkey, selection.srfkey));
if (index !== -1) {
this.useSelections.splice(index, 1);
}
}
public onAllMoveRight() {
//todo
}
public onAllMoveLeft() {
this.useSelections = [];
}
/**
* @description 安装视图所有功能模块的方法
* @return {*}
* @memberof PickupView
*/
public moduleInstall() {
const superParams = super.moduleInstall();
return {
...superParams,
useSelections: this.useSelections,
onMoveRight: this.onMoveRight.bind(this),
onMoveLeft: this.onMoveLeft.bind(this),
onAllMoveRight: this.onAllMoveRight.bind(this),
onAllMoveLeft: this.onAllMoveLeft.bind(this),
};
}
}
\ No newline at end of file
...@@ -73,7 +73,6 @@ export class PickupView extends MainView { ...@@ -73,7 +73,6 @@ export class PickupView extends MainView {
const superParams = super.moduleInstall(); const superParams = super.moduleInstall();
return { return {
...superParams, ...superParams,
selectData: this.selectData,
onCancel: this.onCancel.bind(this), onCancel: this.onCancel.bind(this),
onConfirm: this.onConfirm.bind(this) onConfirm: this.onConfirm.bind(this)
}; };
......
.app-mpickup-view {
padding: 0;
.app-pickup-grid-view {
padding: 0;
}
.app-mpickup-view__split {
.split__buttons {
display: flex;
align-items: center;
justify-content: center;
}
.split__right {
background-color: #f6f6f6;
}
}
.app-view-layout__footer {
padding: 12px 0;
justify-content: flex-end;
}
}
\ No newline at end of file
@use './app-view-base-layout.scss'; @use './app-view-base-layout.scss';
@use './app-index-view-base-layout.scss'; @use './app-index-view-base-layout.scss';
@use './app-default-index-view-base-layout.scss'; @use './app-default-index-view-base-layout.scss';
@use './app-pick-up-view-layout.scss'; @use './app-pickup-view-layout.scss';
\ No newline at end of file @use './app-mpickup-view-layout.scss';
\ No newline at end of file
import {{page.codeName}} from "./{{spinalCase page.codeName}}.vue";
export default {{page.codeName}};
<script setup lang="ts">
import { Subject } from 'rxjs';
import { RightOutlined, LeftOutlined, DoubleRightOutlined, DoubleLeftOutlined } from '@ant-design/icons-vue';
import { MPickupView, IActionParam, IParam, IContext } from '@core';
import { viewState } from './{{spinalCase page.codeName}}-state';
{{#page.ctrls}}
{{#eq controlType "PICKUPVIEWPANEL"}}
import { {{codeName}}PickupViewPanel } from '@widgets/{{spinalCase appEntity.codeName}}/{{spinalCase codeName}}-pickup-view-panel';
{{/eq}}
{{/page.ctrls}}
// props声明和默认值处理
interface Props {
context?: IContext;
viewParams?: IParam;
openType?: "ROUTE" | "MODAL" | "EMBED";
viewSubject?: Subject<IActionParam>;
}
const props = withDefaults(defineProps<Props>(), {
openType:'ROUTE',
viewSubject: () => new Subject<IActionParam>()
})
// emit声明
interface ViewEmit {
(name: "viewEvent", value: IActionParam): void;
}
const emit = defineEmits<ViewEmit>();
// 安装功能模块,提供状态和能力方法
const { state, onCancel, onConfirm, onCtrlEvent, useSelections, onMoveRight, onMoveLeft, onAllMoveRight, onAllMoveLeft } = new MPickupView(viewState, props, emit).moduleInstall();
</script>
<template>
<AppMpickupViewLayout :class="['app-mpickup-view', state.viewSysCss]">
<template #caption>
<AppIconText class="app-view__caption" size="large" :text="state.viewCaption" />
</template>
{{#page.ctrls}}
{{#eq controlType "TOOLBAR"}}
<template v-slot:toolbar>
<AppToolbar
mode="button"
name="{{lowerCase codeName}}"
:actionModel="state.viewToolbarModel"
@onToolbarEvent="onToolbarEvent"/>
</template>
{{/eq}}
{{/page.ctrls}}
<a-row class="app-mpickup-view__split">
<a-col :span="18">
{{#page.ctrls}}
{{#eq controlType "PICKUPVIEWPANEL"}}
<{{codeName}}PickupViewPanel
:context="state.context"
:rowEditState="state.rowEditState"
:rowActiveMode="state.gridRowActiveMode"
:showBusyIndicator="true"
:viewParams="state.viewParams"
:controlAction="state.{{name}}.action"
:viewSubject="state.viewSubject"
@onCtrlEvent="onCtrlEvent"
></{{codeName}}PickupViewPanel>
{{/eq}}
{{/page.ctrls}}
</a-col>
<a-col :span="1" class="split__buttons">
<a-space direction="vertical">
<a-button @click="onMoveRight"><right-outlined /></a-button>
<a-button @click="onMoveLeft"><left-outlined /></a-button>
<a-button @click="onAllMoveRight"><double-right-outlined /></a-button>
<a-button @click="onAllMoveLeft"><double-left-outlined /></a-button>
</a-space>
</a-col>
<a-col :span="5" class="split__right">
<div v-for="(item,index) in useSelections" :key="index">\{{item.srfmajortext}}</div>
</a-col>
</a-row>
<template v-slot:footer>
<a-space class="app-mpickup-view--footer">
<a-button @click="onConfirm">确认</a-button>
<a-button @click="onCancel">取消</a-button>
</a-space>
</template>
</AppMpickupViewLayout>
</template>
\ No newline at end of file
...@@ -36,7 +36,7 @@ const { state, confirm, onCtrlEvent } = new PickupGridView(viewState, props, emi ...@@ -36,7 +36,7 @@ const { state, confirm, onCtrlEvent } = new PickupGridView(viewState, props, emi
</script> </script>
<template> <template>
<AppPickUpGridViewLayout :class="['app-pickup-grid-view', state.viewSysCss]"> <AppPickupGridViewLayout :class="['app-pickup-grid-view', state.viewSysCss]">
<template v-slot:header-left> <template v-slot:header-left>
<AppIconText class="app-view__caption" size="large" :text="state.viewCaption" /> <AppIconText class="app-view__caption" size="large" :text="state.viewCaption" />
</template> </template>
...@@ -54,5 +54,5 @@ const { state, confirm, onCtrlEvent } = new PickupGridView(viewState, props, emi ...@@ -54,5 +54,5 @@ const { state, confirm, onCtrlEvent } = new PickupGridView(viewState, props, emi
></{{codeName}}Grid> ></{{codeName}}Grid>
{{/eq}} {{/eq}}
{{/page.ctrls}} {{/page.ctrls}}
</AppPickUpGridViewLayout> </AppPickupGridViewLayout>
</template> </template>
...@@ -32,7 +32,7 @@ const { state, onCancel, onConfirm, onCtrlEvent } = new PickupView(viewState, pr ...@@ -32,7 +32,7 @@ const { state, onCancel, onConfirm, onCtrlEvent } = new PickupView(viewState, pr
</script> </script>
<template> <template>
<AppPickUpViewLayout :class="['app-pickup-view', state.viewSysCss]"> <AppPickupViewLayout :class="['app-pickup-view', state.viewSysCss]">
<template #caption> <template #caption>
<AppIconText class="app-view__caption" size="large" :text="state.viewCaption" /> <AppIconText class="app-view__caption" size="large" :text="state.viewCaption" />
</template> </template>
...@@ -65,5 +65,5 @@ const { state, onCancel, onConfirm, onCtrlEvent } = new PickupView(viewState, pr ...@@ -65,5 +65,5 @@ const { state, onCancel, onConfirm, onCtrlEvent } = new PickupView(viewState, pr
<a-button @click="onCancel">取消</a-button> <a-button @click="onCancel">取消</a-button>
</a-space> </a-space>
</template> </template>
</AppPickUpViewLayout> </AppPickupViewLayout>
</template> </template>
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册