增加导出

This commit is contained in:
zhx 2026-06-09 15:42:57 +08:00
parent 1995f9b078
commit c22cff97c3
2 changed files with 38 additions and 11 deletions

View File

@ -241,6 +241,17 @@ export async function listInAppPurchase(params: Record<string, any>) {
); );
} }
export async function exportInAppPurchaseDetails(
params: Record<string, any>,
filename = 'InAppPurchaseOrders',
) {
return downloadLegacyExcel(
'/order/in-app-purchase/details/export',
params,
filename,
);
}
export async function getInAppPurchase(id: number | string) { export async function getInAppPurchase(id: number | string) {
return requestClient.get<Record<string, any>>( return requestClient.get<Record<string, any>>(
'/order/in-app-purchase/details', '/order/in-app-purchase/details',

View File

@ -1,33 +1,30 @@
<script lang="ts" setup> <script lang="ts" setup>
import { import { computed, reactive, ref, watch } from 'vue';
computed,
reactive,
ref,
watch } from 'vue';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import { Page } from '@vben/common-ui'; import { Page } from '@vben/common-ui';
import { useAccessStore } from '@vben/stores'; import { useAccessStore } from '@vben/stores';
import { import {
exportInAppPurchaseDetails,
getOrderAmount, getOrderAmount,
listInAppPurchase, listInAppPurchase,
} from '#/api/legacy/operate'; } from '#/api/legacy/operate';
import { regionConfigTable } from '#/api/legacy/system'; import { regionConfigTable } from '#/api/legacy/system';
import AccountInput from '#/components/account-input.vue'; import AccountInput from '#/components/account-input.vue';
import SysOriginTag from '#/components/sys-origin-tag.vue'; import SysOriginTag from '#/components/sys-origin-tag.vue';
import { formatDate, import { formatDate, getAllowedSysOrigins } from '#/views/system/shared';
getAllowedSysOrigins } from '#/views/system/shared';
import { import {
Button, Button,
Card, Card,
DatePicker, DatePicker,
Input, Input,
message,
Select, Select,
Space, Space,
Table, Table,
Tag Tag,
} from 'antdv-next'; } from 'antdv-next';
import { import {
@ -50,6 +47,7 @@ const sysOriginOptions = computed(() => {
const loading = ref(false); const loading = ref(false);
const loadMoreLoading = ref(false); const loadMoreLoading = ref(false);
const exporting = ref(false);
const list = ref<Array<Record<string, any>>>([]); const list = ref<Array<Record<string, any>>>([]);
const regions = ref<Array<Record<string, any>>>([]); const regions = ref<Array<Record<string, any>>>([]);
const totalInfo = ref<Record<string, any>>({}); const totalInfo = ref<Record<string, any>>({});
@ -137,10 +135,15 @@ async function loadData(reset = false) {
} }
} }
function buildQueryParams() { function buildQueryParams(includePaging = true) {
query.sysOrigins = getEffectiveSysOrigin(); query.sysOrigins = getEffectiveSysOrigin();
const params = { ...query };
if (!includePaging) {
delete params.lastId;
delete params.limit;
}
return Object.fromEntries( return Object.fromEntries(
Object.entries({ ...query }).filter(([, value]) => { Object.entries(params).filter(([, value]) => {
if (Array.isArray(value)) { if (Array.isArray(value)) {
return value.length > 0; return value.length > 0;
} }
@ -153,6 +156,16 @@ function handleSearch() {
void loadData(true); void loadData(true);
} }
async function handleExport() {
exporting.value = true;
try {
await exportInAppPurchaseDetails(buildQueryParams(false));
message.success('导出成功');
} finally {
exporting.value = false;
}
}
function openDetails(record: Record<string, any>) { function openDetails(record: Record<string, any>) {
activeOrderId.value = record.details?.id || ''; activeOrderId.value = record.details?.id || '';
detailsOpen.value = true; detailsOpen.value = true;
@ -233,6 +246,9 @@ void loadData(true);
<Button :loading="loading" type="primary" @click="handleSearch"> <Button :loading="loading" type="primary" @click="handleSearch">
搜索 搜索
</Button> </Button>
<Button :loading="exporting" @click="handleExport">
导出
</Button>
</div> </div>
<div class="summary"> <div class="summary">