feat(shopOrder): 按当前标签筛选状态导出订单
- 搜索组件增加 statusFilter 属性以支持导出时传入筛选状态 - 在 shopOrder 页面通过计算属性传递当前标签的筛选状态给搜索组件 - 导出时订单列表请求中带入当前标签对应的筛选状态,避免混入其它状态订单 - 优化导出功能的状态一致性,提升使用体验
This commit is contained in:
@@ -104,6 +104,8 @@ const props = withDefaults(
|
|||||||
defineProps<{
|
defineProps<{
|
||||||
// 选中的订单
|
// 选中的订单
|
||||||
selection?: ShopOrder[];
|
selection?: ShopOrder[];
|
||||||
|
// 当前列表标签对应的筛选状态(如待发货=1),导出时一并带入
|
||||||
|
statusFilter?: number;
|
||||||
}>(),
|
}>(),
|
||||||
{}
|
{}
|
||||||
);
|
);
|
||||||
@@ -253,7 +255,7 @@ const handleExport = async () => {
|
|||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
await listShopOrder(where)
|
await listShopOrder({ ...where, statusFilter: props.statusFilter })
|
||||||
.then((list) => {
|
.then((list) => {
|
||||||
orders.value = list;
|
orders.value = list;
|
||||||
list?.forEach((d: ShopOrder) => {
|
list?.forEach((d: ShopOrder) => {
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
<template>
|
<template>
|
||||||
<a-page-header :title="getPageTitle()" @back="() => $router.go(-1)">
|
<a-page-header :title="getPageTitle()" @back="() => $router.go(-1)">
|
||||||
<a-card style="margin-bottom: 20px">
|
<a-card style="margin-bottom: 20px">
|
||||||
<search
|
<search
|
||||||
@search="reload"
|
@search="reload"
|
||||||
:selection="selection"
|
:selection="selection"
|
||||||
@add="openEdit"
|
:status-filter="statusFilterForExport"
|
||||||
|
@add="openEdit"
|
||||||
@remove="removeBatch"
|
@remove="removeBatch"
|
||||||
@batchMove="openMove"
|
@batchMove="openMove"
|
||||||
/>
|
/>
|
||||||
@@ -390,7 +391,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { createVNode, ref, onMounted, onActivated } from 'vue';
|
import { createVNode, ref, onMounted, onActivated, computed } from 'vue';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import type { EleProTable } from 'ele-admin-pro';
|
import type { EleProTable } from 'ele-admin-pro';
|
||||||
import type {
|
import type {
|
||||||
@@ -487,6 +488,11 @@
|
|||||||
return filterMap[key];
|
return filterMap[key];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 导出时跟随当前标签的筛选状态(如「待发货」=1),避免导出混入其它状态的订单
|
||||||
|
const statusFilterForExport = computed(() =>
|
||||||
|
getStatusFilterByTab(activeKey.value)
|
||||||
|
);
|
||||||
|
|
||||||
// 表格数据源
|
// 表格数据源
|
||||||
const datasource: DatasourceFunction = ({
|
const datasource: DatasourceFunction = ({
|
||||||
page,
|
page,
|
||||||
|
|||||||
Reference in New Issue
Block a user