Commit 8ce0d1e0 by wuqian

导出添加加载状态

parent fdc8ea89
......@@ -48,7 +48,7 @@ export function getOrderList(
currentPage: number,
pageSize: number,
) {
return axios.post<never, BasePaginationData<PodUsOrderListData[]>>(
return axios.post<never, BasePaginationData<PodUsOrderListData>>(
'/factory/podJomallOrderUs/list_page',
{
...params,
......
......@@ -286,7 +286,7 @@ const goodsColumns = computed(() => {
},
]
})
const tableData = ref<PodUsOrderListData[][]>([])
const tableData = ref<PodUsOrderListData[]>([])
const goodsData = ref<ProductList[]>([])
const searchVisible = ref(false)
const goodsLoading = ref(false)
......@@ -393,16 +393,11 @@ const submitExportForm = async () => {
idList: [],
}
// 使用函数封装映射逻辑
const mapIds = (items: PodUsOrderListData[][] | PodUsOrderListData[]) => {
// 如果是二维数组,先展平成一维数组
const flatItems = Array.isArray(items[0])
? (items as PodUsOrderListData[][]).flat()
: (items as PodUsOrderListData[])
return flatItems.map((el) => Number(el.id))
}
const mapIds = (items: PodUsOrderListData[]) =>
items.map((el) => Number(el.id))
switch (resourceType) {
case 0:
params.idList = mapIds(tableData.value.flat())
params.idList = mapIds(tableData.value as PodUsOrderListData[])
break
case 1:
params.idList = mapIds(selection.value)
......@@ -421,13 +416,11 @@ const submitExportForm = async () => {
})
window.open(filePath + res.message, '_blank')
exportVisible.value = false
// exportLoading.value = false
exportLoading.value = false
} catch (e) {
exportVisible.value = false
// exportLoading.value = false
} finally {
exportLoading.value = false
}
}
}
const handleSizeChange = (pageSize: number) => {
pagination.value.pageSize = pageSize
......@@ -944,12 +937,7 @@ onMounted(() => {
</span>
</ElFormItem>
<ElFormItem>
<ElButton
:loading="exportLoading"
type="success"
@click="exportData"
>导出</ElButton
>
<ElButton type="success" @click="exportData">导出</ElButton>
</ElFormItem>
</ElForm>
</el-card>
......@@ -1040,7 +1028,12 @@ onMounted(() => {
<template #footer>
<span class="dialog-footer">
<el-button @click="exportVisible = false">取消</el-button>
<el-button type="primary" @click="submitExportForm">确认</el-button>
<el-button
:loading="exportLoading"
type="primary"
@click="submitExportForm"
>确认</el-button
>
</span>
</template>
</ElDialog>
......
......@@ -489,12 +489,7 @@
</ElButton>
</span>
<span v-if="status === 'COMPLETE'" class="item">
<ElButton
:loading="exportLoading"
type="success"
@click="exportData"
>导出</ElButton
>
<ElButton type="success" @click="exportData">导出</ElButton>
</span>
</ElFormItem>
</ElForm>
......@@ -1967,7 +1962,12 @@
<template #footer>
<span class="dialog-footer">
<el-button @click="exportVisible = false">取消</el-button>
<el-button type="primary" @click="submitExportForm">确认</el-button>
<el-button
:loading="exportLoading"
type="primary"
@click="submitExportForm"
>确认</el-button
>
</span>
</template>
</ElDialog>
......@@ -2150,11 +2150,9 @@ const submitExportForm = async () => {
})
window.open(filePath + res.message, '_blank')
exportVisible.value = false
// exportLoading.value = false
exportLoading.value = false
} catch (e) {
exportVisible.value = false
// exportLoading.value = false
} finally {
exportLoading.value = false
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment