提交 b24eb94b 编写于 作者: Mosher's avatar Mosher

add:新增导出行为工具栏组件

上级 0014dcc9
<template>
<a-dropdown :trigger="['click']" class="app-export-excel" overlayClassName="app-export-excel__dropdown">
<template #overlay>
<a-menu>
<a-menu-item key="1" @click="exportExcel('maxRowCount', $event)">最大{{ item.caption }}1000行</a-menu-item>
<a-menu-item key="2" @click="exportExcel('activatedPage', $event)">{{ item.caption }}当前页</a-menu-item>
<a-menu-item key="3">
<span>
<a-input-number v-model:value="startPage" @change="onChange('start')" :min="1" @click.stop :controls="false" />
~
<a-input-number v-model:value="endPage" @change="onChange('end')" @click.stop :min="1" :controls="false" />
<a-button type="text" @click="exportExcel('custom', $event)">GO</a-button>
</span>
</a-menu-item>
</a-menu>
</template>
<a-button>
<i v-if="item.iconClass" :class="item.iconClass"></i>
<img v-if="item.imgPath" :src="item.imgPath" alt="" />
{{ item.caption }}
<DownOutlined />
</a-button>
</a-dropdown>
</template>
<script setup lang='ts'>
import { deepCopy, IParam } from '@core';
import { DownOutlined } from '@ant-design/icons-vue';
// 接口声明
interface exportExcelProps {
item: any;
}
interface exportExcelEmit {
(name: 'exportExcel', value: IParam): void;
}
const emit = defineEmits<exportExcelEmit>();
const props = withDefaults(defineProps<exportExcelProps>(), {});
// 初始化选择值
const startPage = ref(1);
const endPage = ref(10);
/**
* 导出数据
*
* @param {*} $event
* @param {string} type
* @returns {void}
* @memberof AppExportExcel
*/
const exportExcel = (type: string, $event: MouseEvent): void => {
const exportParams: any = { type: type };
if (Object.is(type, 'maxRowCount')) {
Object.assign(exportParams, { maxRowCount: 1000 });
} else if (Object.is(type, 'activatedPage')) {
} else if (Object.is(type, 'custom')) {
Object.assign(exportParams, { startPage: startPage.value, endPage: endPage.value });
}
emit('exportExcel', Object.assign(deepCopy(props.item), { event: { exportParams: exportParams, event: $event } }));
};
/**
* 计算自定义导出页数逻辑
*
* @memberof AppExportExcel
*/
const onChange = (type: string) => {
if (type === 'start') {
if (startPage.value >= endPage.value) {
startPage.value = endPage.value - 1;
}
}
if (type === 'end') {
if (endPage.value >= startPage.value) {
endPage.value = startPage.value + 1;
}
}
}
</script>
<style lang="scss">
.app-export-excel {
font-size: var(--app-font-size-md);
padding: 4px 12px;
i {
padding-right: 6px;
}
.anticon.anticon-down {
margin-left: 6px;
}
}
.app-export-excel__dropdown {
.ant-input-number {
width: 50px;
}
}
</style>
\ No newline at end of file
......@@ -56,13 +56,15 @@ const hasCounter = (item: any) => {
<!-- todo 无权限显示模式 -->
<template v-if="hasCounter(item)">
<a-badge :count="counterData[item.counterId]">
<AppExportExcel v-if="item.uIAction.uIActionTag === 'ExportExcel'" :item="item" @exportExcel="itemClick"/>
<a-button
v-else
v-show="item.visible"
:class="['toolbar-item', item.class]"
:disabled="item.disabled"
@click="itemClick(item)"
>
<AppIconText
<AppIconText
:text="item.showCaption ? item.caption : undefined"
:iconClass="item.showIcon ? item.iconClass : undefined"
:imgPath="item.showIcon ? item.imgPath : undefined"/>
......@@ -70,7 +72,9 @@ const hasCounter = (item: any) => {
</a-badge>
</template>
<template v-else>
<AppExportExcel v-if="item.uIAction.uIActionTag === 'ExportExcel'" :item="item" @exportExcel="itemClick"/>
<a-button
v-else
v-show="item.visible"
:class="['toolbar-item', item.class]"
:disabled="item.disabled"
......
......@@ -65,7 +65,7 @@ export class ControlVO extends ControlVOBase implements TreeControlVO {
enableQuickSearch: {{treeNode.enableQuickSearch}},
expandFirstOnly: {{treeNode.expandFirstOnly}},
expanded: {{treeNode.expanded}},
hasPSDETreeNodeRSs: {{treeNode.psDETreeNodeRSs}},
hasPSDETreeNodeRSs: {{#if treeNode.psDETreeNodeRSs}}true{{else}}{{#if treeNode.hasPSDETreeNodeRSs}}true{{else}}false{{/if}}{{/if}},
{{#if treeNode.leafFlagPSAppDEField}}
leafFlagPSAppDEField: { codeName: '{{treeNode.leafFlagPSAppDEField.codeName}}' },
{{/if}}
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册