Commit 2462da16 by zhangxingmin

Merge remote-tracking branch 'origin/test' into test

parents 72694e0e 01d42804
......@@ -9,6 +9,16 @@ export function getPolicyFollowList(data) {
})
}
// 按当前筛选条件导出新单跟进清单(xlsx 文件流)
export function exportPolicyFollow(data) {
return request({
url: '/csf/api/policy_follow/export',
method: 'post',
data: data,
responseType: 'blob'
})
}
// 获取预计来佣列表
// /csf/api/commission/list/page/commission_expected
export function getExpectedCommissionList(data) {
......
......@@ -149,6 +149,7 @@ import useUserStore from '@/store/modules/user'
import { safeDownload } from '@/utils/safeDownload'
import {
getPolicyFollowList,
exportPolicyFollow,
getExpectedCommissionList,
changePolicyStatus,
policyFollowReport,
......@@ -341,8 +342,29 @@ const handleAdd = () => {
const handleImport = () => {
ElMessage.info('点击导入按钮')
}
const handleExport = () => {
ElMessage.info('点击导出按钮')
// 查询表单 → 请求体(列表查询与导出共用,保证筛选口径一致)
const buildQueryParams = () => {
const formData = searchFormRef.value?.getFormData() || {}
return {
...formData,
signDateStart: formData.signDate?.[0] || undefined,
signDateEnd: formData.signDate?.[1] || undefined,
signDate: undefined
}
}
const exporting = ref(false)
const handleExport = async () => {
exporting.value = true
try {
const response = await exportPolicyFollow(buildQueryParams())
const now = new Date()
const pad = n => String(n).padStart(2, '0')
const day = `${now.getFullYear()}${pad(now.getMonth() + 1)}${pad(now.getDate())}`
await safeDownload(response, `新单跟进清单_${day}.xlsx`)
} finally {
exporting.value = false
}
}
const handleReset = () => {
// 重置搜索表单
......@@ -356,9 +378,14 @@ const handleQuery = async () => {
currentPage.value = 1
loadTableData()
}
const visibleDefaultButtons = ref(['reset', 'query'])
// 按钮配置
const operationBtnList = ref([
const visibleDefaultButtons = ref(['export', 'reset', 'query'])
const operationBtnList = computed(() => [
{
key: 'export',
direction: 'right',
loading: exporting.value,
click: handleExport
},
{
key: 'reset',
direction: 'right',
......@@ -489,10 +516,7 @@ const loadTableData = async () => {
// console.log(searchParams.value)
try {
const params = {
...searchParams.value,
signDateStart: searchParams.value?.signDate[0] || undefined,
signDateEnd: searchParams.value?.signDate[1] || undefined,
signDate: undefined,
...buildQueryParams(),
pageNo: currentPage.value,
pageSize: pageSize.value
}
......
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