feat(web-admin): 按采集大表导出预签约、自存、科研和客服表

市场人员需要把四张列表按采集大表对应工作表导出为 Excel 文本。补预签约列表的地区、医院、样本类型和转账时间,并沿用现有工具栏导出。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
zlwuandCursor committed 2026-11-06 10:05:11 +08:00
1 parent faef6adf94
commit a214a35f4f
9 files changed
+1118 -5

No files matched your search

@@ -56,6 +56,10 @@
<el-icon><Plus /></el-icon>
新增预签约
</el-button>
<el-button class="btn-ghost" :loading="exporting" @click="handleExport">
<el-icon><Download /></el-icon>
导出 Excel
</el-button>
</div>
</div>
@@ -196,7 +200,14 @@
const projectFilter = ref('')
const teamFilter = ref('')
import { onMounted, reactive, ref } from 'vue'
import { Plus, Search, RefreshLeft, Edit, Delete, Check } from '@element-plus/icons-vue'
import { Plus, Search, RefreshLeft, Edit, Delete, Check, Download } from '@element-plus/icons-vue'
import { ElMessage } from 'element-plus'
import {
buildPresignLedgerRows,
fetchAllPages,
PRESIGN_HEADERS,
saveCollectionLedgerWorkbook
} from '@/utils/collection-ledger-export'
import { formatDisplayOrDash } from '@/utils/datetime-display'
import { formatMoneyDisplay } from '@/utils/money-format'
import { presignOrderStatusLabel, presignOrderStatusTagType } from '@/utils/status-tag-registry'
@@ -213,6 +224,7 @@
const tableData = ref<Record<string, any>[]>([])
const selectedRows = ref<Record<string, any>[]>([])
const loading = ref(false)
const exporting = ref(false)
const pagination = reactive({ page: 1, pageSize: 10, total: 0 })
const dialogVisible = ref(false)
const editingId = ref<string | undefined>(undefined)
@@ -246,6 +258,40 @@
}
}
async function handleExport() {
if (exporting.value) return
exporting.value = true
try {
const rows = selectedRows.value.length
? selectedRows.value
: await fetchAllPages((page, pageSize) =>
fetchPresignOrderList({
page,
pageSize,
projectId: projectFilter.value || undefined,
teamId: teamFilter.value || undefined,
keyword: searchForm.keyword || undefined,
orderStatus: searchForm.orderStatus || undefined
})
)
if (!rows.length) {
ElMessage.warning('没有可导出的数据')
return
}
await saveCollectionLedgerWorkbook(
'预签约',
PRESIGN_HEADERS,
buildPresignLedgerRows(rows),
'预签约'
)
ElMessage.success('导出成功')
} catch {
ElMessage.error('导出失败,请重试')
} finally {
exporting.value = false
}
}
function handleSearch() {
pagination.page = 1
loadData()
@@ -75,6 +75,10 @@
<el-icon><Plus /></el-icon>
新增
</el-button>
<el-button class="btn-ghost" :loading="exporting" @click="handleExport">
<el-icon><Download /></el-icon>
导出 Excel
</el-button>
<el-button class="btn-ghost" :disabled="!selectedProtocolCount" @click="openAuditDialog()">
<el-icon><CircleCheck /></el-icon>
审核
@@ -422,6 +426,7 @@
Delete,
Search,
RefreshLeft,
Download,
CircleCheck,
CircleClose,
Select,
@@ -456,6 +461,12 @@
formatProtocolDocBatchDeleteConfirm
} from '@/utils/protocol-doc-label'
import { loadVoidTypeDict } from '@/utils/void-type-dict'
import {
RESEARCH_HEADERS,
buildResearchLedgerRows,
fetchAllPages,
saveCollectionLedgerWorkbook
} from '@/utils/collection-ledger-export'
import {
flattenProtocolAuditRows,
uniqueProtocolsFromFlatRows,
@@ -476,6 +487,7 @@
const sampleCollectTimeRange = ref<[string, string] | null>(null)
const tableData = ref<ResearchDonationRow[]>([])
const selectedFlatRows = ref<ProtocolAuditFlatRow[]>([])
const exporting = ref(false)
const loading = ref(false)
const pagination = reactive({ page: 1, pageSize: 10, total: 0 })
@@ -529,6 +541,46 @@
}
}
async function handleExport() {
if (exporting.value) return
exporting.value = true
try {
const rows = selectedFlatRows.value.length
? selectedFlatRows.value
: flattenProtocolAuditRows(
await fetchAllPages((page, pageSize) =>
fetchResearchDonationList({
page,
pageSize,
projectId: projectFilter.value || undefined,
teamId: teamFilter.value || undefined,
keyword: searchForm.keyword || undefined,
donationStatus: searchForm.donationStatus || undefined,
createTimeStart: createTimeRange.value?.[0] || undefined,
createTimeEnd: createTimeRange.value?.[1] || undefined,
sampleCollectTimeStart: sampleCollectTimeRange.value?.[0] || undefined,
sampleCollectTimeEnd: sampleCollectTimeRange.value?.[1] || undefined
})
)
)
if (!rows.length) {
ElMessage.warning('没有可导出的数据')
return
}
await saveCollectionLedgerWorkbook(
'科研表',
RESEARCH_HEADERS,
buildResearchLedgerRows(rows),
'科研表'
)
ElMessage.success('导出成功')
} catch {
ElMessage.error('导出失败,请重试')
} finally {
exporting.value = false
}
}
function handleSearch() {
pagination.page = 1
loadData()
@@ -79,6 +79,10 @@
<el-icon><Plus /></el-icon>
新增
</el-button>
<el-button class="btn-ghost" :loading="exporting" @click="handleExport">
<el-icon><Download /></el-icon>
导出 Excel
</el-button>
<el-button
class="btn-ghost"
:disabled="selectedProtocolCount !== 1"
@@ -396,7 +400,8 @@
Switch,
Timer,
Coin,
More
More,
Download
} from '@element-plus/icons-vue'
import ProtocolFormDialog from '../protocol/ProtocolFormDialog.vue'
import ProtocolViewDialog from '../protocol/ProtocolViewDialog.vue'
@@ -424,6 +429,12 @@
transportTypeLabel
} from '@/utils/status-tag-registry'
import { loadVoidTypeDict } from '@/utils/void-type-dict'
import {
CELL_STORAGE_HEADERS,
buildCellStorageLedgerRows,
fetchAllPages,
saveCollectionLedgerWorkbook
} from '@/utils/collection-ledger-export'
import {
flattenProtocolAuditRows,
uniqueProtocolsFromFlatRows,
@@ -442,6 +453,7 @@
const tableData = ref<CollectionProtocolRow[]>([])
const selectedFlatRows = ref<ProtocolAuditFlatRow[]>([])
const loading = ref(false)
const exporting = ref(false)
const pagination = reactive({ page: 1, pageSize: 10, total: 0 })
const flatRows = computed(() => flattenProtocolAuditRows(tableData.value))
@@ -494,6 +506,46 @@
}
}
async function handleExport() {
if (exporting.value) return
exporting.value = true
try {
const rows = selectedFlatRows.value.length
? selectedFlatRows.value
: flattenProtocolAuditRows(
await fetchAllPages((page, pageSize) =>
fetchCollectionProtocolList({
page,
pageSize,
projectId: projectFilter.value || undefined,
teamId: teamFilter.value || undefined,
keyword: searchForm.keyword || undefined,
protocolStatus: searchForm.protocolStatus || undefined,
createTimeStart: createTimeRange.value?.[0] || undefined,
createTimeEnd: createTimeRange.value?.[1] || undefined,
sampleCollectTimeStart: sampleCollectTimeRange.value?.[0] || undefined,
sampleCollectTimeEnd: sampleCollectTimeRange.value?.[1] || undefined
})
)
)
if (!rows.length) {
ElMessage.warning('没有可导出的数据')
return
}
await saveCollectionLedgerWorkbook(
'自存表',
CELL_STORAGE_HEADERS,
buildCellStorageLedgerRows(rows),
'自存表'
)
ElMessage.success('导出成功')
} catch {
ElMessage.error('导出失败,请重试')
} finally {
exporting.value = false
}
}
function handleSearch() {
pagination.page = 1
loadData()
@@ -92,6 +92,15 @@
<el-icon><Box /></el-icon>
登记入库
</el-button>
<el-button
v-if="isCellStorage"
class="btn-ghost"
:loading="exporting"
@click="handleExport"
>
<el-icon><Download /></el-icon>
导出 Excel
</el-button>
<el-button
v-if="isCellStorage"
class="btn-ghost"
@@ -473,6 +482,7 @@
ChatDotRound,
Collection,
Document,
Download,
EditPen,
Files,
Location,
@@ -511,6 +521,12 @@
sampleStorageFlagLabel,
sampleStorageFlagTagType
} from '@/utils/status-tag-registry'
import {
CUSTOMER_SERVICE_HEADERS,
buildCustomerServiceLedgerRows,
fetchAllPages,
saveCollectionLedgerWorkbook
} from '@/utils/collection-ledger-export'
defineOptions({ name: 'UnifiedSampleInfoPage' })
@@ -533,6 +549,7 @@
})
const tableData = ref<Record<string, unknown>[]>([])
const loading = ref(false)
const exporting = ref(false)
const pagination = reactive({ page: 1, pageSize: 10, total: 0 })
const selectedRows = ref<Record<string, unknown>[]>([])
const tableRef = ref<{ clearSelection?: () => void } | null>(null)
@@ -632,6 +649,43 @@
}
}
async function handleExport() {
if (exporting.value || !isCellStorage.value) return
exporting.value = true
try {
const rows = selectedRows.value.length
? selectedRows.value
: await fetchAllPages((page, pageSize) =>
fetchProtocolSampleCollectionList({
page,
pageSize,
keyword: searchForm.keyword || undefined,
collectionFlag: searchForm.collectionFlag || undefined,
receptionFlag: searchForm.receptionFlag || undefined,
qcFlag: searchForm.qcFlag || undefined,
storageFlag: searchForm.storageFlag || undefined,
storageCertHandled: searchForm.storageCertHandled || undefined,
insuranceHandled: searchForm.insuranceHandled || undefined
})
)
if (!rows.length) {
ElMessage.warning('没有可导出的数据')
return
}
await saveCollectionLedgerWorkbook(
'客服表',
CUSTOMER_SERVICE_HEADERS,
buildCustomerServiceLedgerRows(rows),
'客服表'
)
ElMessage.success('导出成功')
} catch {
ElMessage.error('导出失败,请重试')
} finally {
exporting.value = false
}
}
function handleSearch() {
pagination.page = 1
loadData()