实现客户余额查看账单跳转至应收账单列表,带上客户id条件
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
<basic-table ref="tableRef" :columns="columns" :search-columns="searchColumns" :search-label-width="82" :query="queryList" :default-params="defaultSearchParams" row-key="arBillId" :selection="false">
|
||||
<template #toolbar>
|
||||
<el-col :span="1.5"><el-button type="primary" plain icon="Plus" v-hasPermi="['ar:bill:generate']" @click="generateOpen = true">生成账单</el-button></el-col>
|
||||
<el-col v-if="customerScoped" :span="1.5"><el-button type="info" plain icon="Close" @click="clearCustomerFilter">清除客户条件</el-button></el-col>
|
||||
</template>
|
||||
<template #search-customerId="{ model }">
|
||||
<customer-select v-model="model.customerId" placeholder="请选择客户" :page-size="1000" />
|
||||
@@ -45,6 +46,7 @@ const detailLoading = ref(false)
|
||||
const detail = ref(null)
|
||||
const generateOpen = ref(false)
|
||||
const statusOptions = AR_BILL_STATUS_OPTIONS
|
||||
const customerScoped = computed(() => Boolean(route.query.customerId))
|
||||
const columns = [
|
||||
{ label: '账单号', prop: 'billNo', minWidth: 180, showOverflowTooltip: true }, { label: '账单名称', prop: 'billName', minWidth: 180, showOverflowTooltip: true }, { label: '客户名称', prop: 'customerName', minWidth: 130, showOverflowTooltip: true }, { label: '客户编码', prop: 'customerCode', minWidth: 120, showOverflowTooltip: true },
|
||||
{ label: '账单截止日', prop: 'billPeriodEnd', minWidth: 120, formatter: row => `截至 ${date(row.billPeriodEnd)}` }, { label: '订单数', prop: 'orderCount', width: 80 },
|
||||
@@ -64,6 +66,22 @@ function confirmBill(row) { proxy.$modal.confirm(`确认账单「${row.billNo}
|
||||
function voidBill(row) { proxy.$prompt(`请输入账单「${row.billNo}」的作废原因`, '作废账单', { inputPattern: /\S+/, inputErrorMessage: '作废原因不能为空' }).then(({ value }) => voidArBill(row.arBillId, { remark: value })).then(() => { proxy.$modal.msgSuccess('账单已作废'); tableRef.value.refresh(); viewBill(row) }).catch(() => {}) }
|
||||
function exportBill(row) { if (!row?.arBillId) return; exportArBill(row.arBillId).then(res => { proxy.$modal.msgSuccess('导出成功'); tableRef.value.refresh(); if (detailOpen.value) viewBill(row); if (res.data?.exportId) downloadExport(res.data) }) }
|
||||
function downloadExport(row) { downloadArBillExport(row.exportId).then(blob => saveAs(blob, row.fileName || `账单_${row.exportId}.xlsx`)) }
|
||||
function clearCustomerFilter() {
|
||||
const query = { ...route.query }
|
||||
delete query.customerId
|
||||
router.replace({ path: route.path, query })
|
||||
}
|
||||
|
||||
// 从客户余额页重复进入不同客户时,路由组件会被复用,需同步更新表格内部查询条件
|
||||
watch(() => route.query.customerId, (newId, oldId) => {
|
||||
if (String(newId || '') === String(oldId || '')) return
|
||||
tableRef.value?.setQueryParams({
|
||||
customerId: newId ? Number(newId) : undefined,
|
||||
pageNum: 1
|
||||
})
|
||||
tableRef.value?.handleQuery()
|
||||
})
|
||||
|
||||
function canGoWriteoff(row) {
|
||||
if (!row?.customerId) return false
|
||||
const canWriteoffStatus = row.status === AR_BILL_STATUS.CONFIRMED
|
||||
|
||||
Reference in New Issue
Block a user