This commit is contained in:
zlwu committed 2026-07-05 10:07:24 +08:00
1 parent 33c038b8d9
commit 54b27a3f0e
253 files changed
+30060 -14298

No files matched your search

+118 -175
View File
@@ -2,13 +2,6 @@
<!-- eslint-disable vue/no-v-model-argument -->
<template>
<div class="page-container">
<div class="stats">
<div v-for="item in stats" :key="item.name" class="stat" :class="{ 'stat-money': item.name.includes('金额') }">
<p class="k">{{ item.name }}</p>
<p class="v">{{ item.value }}</p>
</div>
</div>
<section class="panel">
<div class="panel-top">
<h2 class="title-bar-heading">备用金申请列表</h2>
@@ -42,35 +35,17 @@
style="width: 100%"
/>
</el-form-item>
</div>
<div v-show="showMoreFilters" id="advance-apply-filter-extra" class="filter-extra">
<div class="filter-grid">
<el-form-item label="当前节点">
<el-select v-model="filterForm.currentNode" placeholder="全部" clearable>
<el-option label="草稿" value="草稿" />
<el-option label="发起人主管审批" value="发起人主管审批" />
<el-option label="财务复核" value="财务复核" />
<el-option label="总经理审批" value="总经理审批" />
</el-select>
</el-form-item>
</div>
<el-form-item label="当前节点">
<el-select v-model="filterForm.currentNode" placeholder="全部" clearable>
<el-option label="草稿" value="草稿" />
<el-option label="发起人主管审批" value="发起人主管审批" />
<el-option label="财务复核" value="财务复核" />
<el-option label="总经理审批" value="总经理审批" />
</el-select>
</el-form-item>
</div>
<div class="filter-actions">
<div class="filter-actions-start">
<button
type="button"
class="btn-link btn-filter-toggle"
:aria-expanded="showMoreFilters"
aria-controls="advance-apply-filter-extra"
@click="toggleMoreFilters"
>
{{ showMoreFilters ? '收起更多' : '展开更多' }}
<el-icon>
<ArrowUpBold v-if="showMoreFilters" />
<ArrowDownBold v-else />
</el-icon>
</button>
</div>
<div class="filter-actions-start" />
<div class="filter-actions-end">
<el-button class="btn-ghost" :loading="loading" @click="handleReset">
<el-icon><RefreshLeft /></el-icon>重置
@@ -88,6 +63,12 @@
<div class="list-toolbar-selected">
已选 <span class="sel-num">{{ selectedRows.length }}</span> 项
</div>
<ListQuickSearchInput
v-model="quickSearchKeyword"
placeholder="申请单号/申请原因"
@search="handleQuickSearch"
@clear="handleQuickSearchClear"
/>
<el-button class="btn-main" type="primary" @click="openAdd">
<el-icon><Plus /></el-icon>新增备用金申请
</el-button>
@@ -117,13 +98,21 @@
<el-button class="btn-ghost" @click="openFlowDialog()">
<el-icon><View /></el-icon>查看审批流
</el-button>
<ListToolbarEndActions :loading="loading" @refresh="handleSearch" />
<ListToolbarEndActions
:loading="loading"
:column-defs="listColumnDefs"
v-model:visible-columns="visibleColumns"
v-model:check-all="checkAll"
:is-indeterminate="isIndeterminate"
@refresh="handleSearch"
@reset-columns="resetToDefault"
/>
</div>
</div>
<div class="list-body list-wrap">
<div class="table-scroll table-page-summary advance-apply-summary-merge">
<div class="table-scroll table-page-summary">
<el-table
class="list-table"
:data="rows"
@@ -138,6 +127,7 @@
<el-table-column type="selection" min-width="48" align="center" header-align="center" />
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
<el-table-column
v-if="isColumnVisible('applyTime')"
prop="applyTime"
label="申请时间"
min-width="160"
@@ -148,6 +138,7 @@
<el-table-column
prop="applyCode"
label="申请单号"
class-name="col-apply-code"
min-width="140"
align="center"
header-align="center"
@@ -158,6 +149,7 @@
</template>
</el-table-column>
<el-table-column
v-if="isColumnVisible('applicantName')"
prop="applicantName"
label="申请人"
min-width="100"
@@ -165,6 +157,7 @@
header-align="center"
/>
<el-table-column
v-if="isColumnVisible('reason')"
prop="reason"
label="申请原因"
min-width="160"
@@ -173,6 +166,7 @@
show-overflow-tooltip
/>
<el-table-column
v-if="isColumnVisible('amount')"
prop="amount"
label="申请金额(元)"
:formatter="moneyTableFormatter"
@@ -182,6 +176,8 @@
header-align="center"
/>
<el-table-column
v-if="isColumnVisible('actualAmount')"
prop="actualAmount"
label="实际发放金额(元)"
class-name="col-money"
min-width="130"
@@ -197,6 +193,8 @@
</template>
</el-table-column>
<el-table-column
v-if="isColumnVisible('offsetAmount')"
prop="offsetAmount"
label="冲抵总金额(元)"
class-name="col-money"
min-width="130"
@@ -207,14 +205,28 @@
{{ formatMoney(row.offsetAmount || 0) }}
</template>
</el-table-column>
<el-table-column prop="status" label="状态" min-width="110" align="center" header-align="center">
<el-table-column
v-if="isColumnVisible('status')"
prop="status"
label="状态"
min-width="110"
align="center"
header-align="center"
>
<template #default="{ row }">
<el-tag :type="statusTagType(row.status)" size="small">
{{ statusLabel(row.status) }}
</el-tag>
</template>
</el-table-column>
<el-table-column prop="currentNode" label="当前节点" min-width="120" align="center" header-align="center">
<el-table-column
v-if="isColumnVisible('currentNode')"
prop="currentNode"
label="当前节点"
min-width="120"
align="center"
header-align="center"
>
<template #default="{ row }">
<el-tag
v-if="shouldShowWorkflowNodeTag(row.currentNode, row.status)"
@@ -257,7 +269,9 @@
ref="addFormRef"
:model="addForm"
:rules="addFormRules"
label-position="top"
label-position="right"
label-width="100px"
class="bx-dialog-form"
scroll-to-error
:scroll-into-view-options="{ behavior: 'smooth', block: 'center' }"
>
@@ -379,25 +393,12 @@
</el-table>
</BaseDetailTableSection>
<div class="dlg-view-section">
<h4 class="dlg-view-section-title">审批进度</h4>
<div class="flow-scroll">
<ApprovalFlowView :nodes="viewFlowNodes" :loading="viewFlowLoading" />
</div>
</div>
<div class="dlg-view-section">
<h4 class="dlg-view-section-title">审批历史</h4>
<div class="flow-scroll">
<ApprovalHistoryView :items="viewApprovalHistory" :loading="viewFlowLoading" />
</div>
</div>
<BxApprovalFlowTabs
:nodes="viewFlowNodes"
:history="viewApprovalHistory"
:loading="viewFlowLoading"
/>
</div>
<template #footer>
<el-button class="btn-ghost" @click="dialogs.view = false">
<el-icon><Close /></el-icon>关闭
</el-button>
</template>
</el-dialog>
<el-dialog
@@ -408,30 +409,16 @@
align-center
destroy-on-close
>
<div class="dlg-view-section">
<h4 class="dlg-view-section-title">审批进度</h4>
<div class="flow-scroll">
<ApprovalFlowView :nodes="flowNodes" :loading="flowLoading" />
</div>
</div>
<div class="dlg-view-section">
<h4 class="dlg-view-section-title">审批历史</h4>
<div class="flow-scroll">
<ApprovalHistoryView :items="flowHistory" :loading="flowLoading" />
</div>
</div>
<template #footer>
<el-button class="btn-ghost" @click="dialogs.viewFlow = false">
<el-icon><Close /></el-icon>关闭
</el-button>
</template>
<BxApprovalFlowTabs :nodes="flowNodes" :history="flowHistory" :loading="flowLoading" />
</el-dialog>
</div>
</template>
<script setup lang="ts">
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
import { reactive, ref, computed, onMounted, nextTick, watch } from 'vue'
import { usePersistedListColumns } from '@/composables/usePersistedListColumns'
import ListQuickSearchInput from '@/components/business/list-quick-search-input/index.vue'
import { reactive, ref, computed, onMounted } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import type { FormInstance } from 'element-plus'
import {
@@ -443,16 +430,13 @@ import {
Delete,
Check,
Search,
RefreshLeft,
ArrowUpBold,
ArrowDownBold
RefreshLeft
} from '@element-plus/icons-vue'
import { advanceApi, paymentApi } from '@/api/bx'
import { canDeleteByCreator, allRowsDeletableByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
import {
statusLabel,
statusTagType,
formatSumMoney,
formatMoney,
formatMoneyYuan,
moneyTableFormatter,
@@ -462,16 +446,15 @@ import {
shouldShowWorkflowNodeTag
} from '@/utils/bx/format'
import { useServerPaged } from '@/hooks/bx/useServerPaged'
import ApprovalFlowView from '@/components/bx/base/ApprovalFlowView.vue'
import ApprovalHistoryView from '@/components/bx/base/ApprovalHistoryView.vue'
import BxApprovalFlowTabs from '@/components/bx/base/BxApprovalFlowTabs.vue'
import BxViewKvTable from '@/components/bx/base/BxViewKvTable.vue'
import BaseDetailTableSection from '@/components/bx/base/BaseDetailTableSection.vue'
import type { ViewField } from '@/components/business/system-view-dialog/types'
import { bxViewKv, bxViewKvLong, bxViewKvMoney } from '@/utils/bx/view-kv'
import { bxViewKv, bxViewKvMoney } from '@/utils/bx/view-kv'
import { buildPageSummaryMethod, sumField } from '@/utils/bx/table-summary'
type DialogKey = 'add' | 'view' | 'viewFlow'
const showMoreFilters = ref(false)
const loadingMap = reactive<Record<string, boolean>>({})
const dialogs = reactive<Record<DialogKey, boolean>>({
add: false,
@@ -485,40 +468,26 @@ const { rows, total, currentPage, pageSize, rangeText, loading, refresh, search,
return res.data
})
const myAdvanceStats = ref({
pendingCount: 0,
monthApplyAmount: 0,
issuedAmount: 0,
offsetTotal: 0,
pendingIssueCount: 0
})
const quickSearchKeyword = ref('')
async function loadMyAdvanceStats() {
try {
const res: any = await advanceApi.myStats()
const d = res.data || {}
myAdvanceStats.value = {
pendingCount: Number(d.pendingCount ?? 0),
monthApplyAmount: Number(d.monthApplyAmount ?? 0),
issuedAmount: Number(d.issuedAmount ?? 0),
offsetTotal: Number(d.offsetTotal ?? 0),
pendingIssueCount: Number(d.pendingIssueCount ?? 0)
}
} catch {
/* 拦截器已提示 */
}
}
const listColumnDefs = [
{ prop: 'applyTime', label: '申请时间' },
{ prop: 'applicantName', label: '申请人' },
{ prop: 'reason', label: '申请原因' },
{ prop: 'amount', label: '申请金额(元)' },
{ prop: 'actualAmount', label: '实际发放金额(元)' },
{ prop: 'offsetAmount', label: '冲抵总金额(元)', defaultVisible: false },
{ prop: 'status', label: '状态' },
{ prop: 'currentNode', label: '当前节点', defaultVisible: false }
]
const stats = computed(() => {
const s = myAdvanceStats.value
return [
{ name: '待审批申请', value: String(s.pendingCount) },
{ name: '本月申请金额(元)', value: formatMoney(s.monthApplyAmount) },
{ name: '已发放金额(元)', value: formatMoney(s.issuedAmount) },
{ name: '累计已冲抵金额(元)', value: formatMoney(s.offsetTotal) },
{ name: '待发放申请', value: String(s.pendingIssueCount) }
]
})
const {
visibleColumns,
checkAll,
isIndeterminate,
isColumnVisible,
resetToDefault
} = usePersistedListColumns('bx-advance-apply-list-columns', listColumnDefs)
const filterForm = reactive({
keyword: '',
@@ -554,7 +523,7 @@ const viewMainKvFields = computed<ViewField[]>(() => {
bxViewKvMoney('冲抵总金额(元)', formatMoneyYuan(d.offsetAmount || 0)),
bxViewKv('当前节点', workflowNodeDisplay(d.currentNode, d.status)),
bxViewKv('申请时间', d.applyTime),
bxViewKvLong('申请原因', d.reason)
bxViewKv('申请原因', d.reason, { long: false })
]
})
const selectedRows = ref<any[]>([])
@@ -567,56 +536,47 @@ const viewApprovalHistory = ref<any[]>([])
const viewFlowLoading = ref(false)
const viewOffsetRecords = ref<any[]>([])
const ADVANCE_APPLY_SUMMARY_COLS = 11
const ADVANCE_APPLY_SUMMARY_LABEL_COLSPAN = 4
function mergeAdvanceApplySummaryFooter() {
nextTick(() => {
const root = document.querySelector('.advance-apply-summary-merge .el-table__footer-wrapper')
if (!root) return
const tr = root.querySelector('tfoot tr') || root.querySelector('table tr')
if (!tr) return
const cells = Array.from(tr.querySelectorAll('td')) as HTMLTableCellElement[]
if (cells.length !== ADVANCE_APPLY_SUMMARY_COLS) return
const first = cells[0]
if (first.colSpan === ADVANCE_APPLY_SUMMARY_LABEL_COLSPAN) return
first.colSpan = ADVANCE_APPLY_SUMMARY_LABEL_COLSPAN
for (let i = ADVANCE_APPLY_SUMMARY_LABEL_COLSPAN - 1; i >= 1; i--) {
cells[i].remove()
}
})
}
function onSelectionChange(rows: any[]) {
selectedRows.value = rows
}
async function refreshListAndStats() {
async function refreshList() {
await refresh()
await loadMyAdvanceStats()
}
onMounted(() => {
refreshListAndStats()
refreshList()
})
watch([rows, loading], () => mergeAdvanceApplySummaryFooter(), { flush: 'post' })
function toggleMoreFilters() {
showMoreFilters.value = !showMoreFilters.value
function buildSearchQuery() {
const q: Record<string, string> = {}
const kw = (quickSearchKeyword.value.trim() || filterForm.keyword.trim())
if (kw) q.keyword = kw
if (filterForm.status) q.status = filterForm.status
if (filterForm.applyDate) q.applyDate = filterForm.applyDate
return q
}
function handleSearch() {
const q: Record<string, string> = { keyword: filterForm.keyword, status: filterForm.status }
if (filterForm.applyDate) q.applyDate = filterForm.applyDate
search(q)
quickSearchKeyword.value = ''
search(buildSearchQuery())
}
function handleReset() {
quickSearchKeyword.value = ''
Object.assign(filterForm, { keyword: '', status: '', amountRange: '', applyDate: null, currentNode: '' })
search()
}
function handleQuickSearch() {
search(buildSearchQuery())
}
function handleQuickSearchClear() {
quickSearchKeyword.value = ''
search(buildSearchQuery())
}
function isDraftEditable(row?: any) {
if (!row) return false
return row.status === 'draft' || row.status === 'rejected'
@@ -659,7 +619,7 @@ async function handleToolbarDelete() {
await advanceApi.delete(row.id)
}
ElMessage.success('删除成功')
await refreshListAndStats()
await refreshList()
} catch (e: any) {
if (e !== 'cancel') {
ElMessage.error(e?.message || '删除失败')
@@ -717,7 +677,7 @@ async function handleToolbarSubmit() {
await advanceApi.submit(row.id)
}
ElMessage.success('提交成功')
await refreshListAndStats()
await refreshList()
} catch (e: any) {
ElMessage.error(e?.message || '提交失败')
} finally {
@@ -754,7 +714,7 @@ async function submitAdd() {
dialogs.add = false
Object.assign(addForm, { reason: '', amount: '', remark: '' })
editingId.value = null
await refreshListAndStats()
await refreshList()
} catch (e: any) {
ElMessage.error(e.message || (editingId.value ? '保存失败' : '新增失败'))
} finally {
@@ -819,7 +779,7 @@ async function handleSubmit(row: any) {
try {
await advanceApi.submit(row.id)
ElMessage.success('提交成功')
await refreshListAndStats()
await refreshList()
} catch (e: any) {
ElMessage.error(e.message || '提交失败')
} finally {
@@ -841,7 +801,7 @@ async function handleDelete(row: any) {
loadingMap[`del_${row.id}`] = true
await advanceApi.delete(row.id)
ElMessage.success('删除成功')
await refreshListAndStats()
await refreshList()
} catch (e: any) {
if (e !== 'cancel') {
ElMessage.error(e?.message || '删除失败')
@@ -851,28 +811,11 @@ async function handleDelete(row: any) {
}
}
function summaryMethod(params: { data: any[] }) {
const data = params.data
const n = data.length
const totalApply = data.reduce((s, r) => s + Number(r.amount || 0), 0)
const totalActual = data.reduce((s, r) => {
if (r.actualAmount != null && r.actualAmount !== '') return s + Number(r.actualAmount)
return s
}, 0)
const totalOffset = data.reduce((s, r) => s + Number(r.offsetAmount || 0), 0)
const lbl = `本页合计(${n}单)`
return [
lbl,
'',
'',
'',
'',
'',
formatSumMoney(totalApply),
formatSumMoney(totalActual),
formatSumMoney(totalOffset),
'',
''
]
}
const summaryMethod = buildPageSummaryMethod({
sumByProp: {
amount: (data) => sumField(data, 'amount'),
actualAmount: (data) => sumField(data, 'actualAmount', true),
offsetAmount: (data) => sumField(data, 'offsetAmount')
}
})
</script>
+146 -63
View File
@@ -2,13 +2,6 @@
<!-- eslint-disable vue/no-v-model-argument -->
<template>
<div class="page-container">
<div class="stats">
<div v-for="item in stats" :key="item.name" class="stat" :class="{ 'stat-money': item.name.includes('金额') }">
<p class="k">{{ item.name }}</p>
<p class="v">{{ item.value }}</p>
</div>
</div>
<section class="panel">
<div class="panel-top">
<h2 class="title-bar-heading">备用金审批</h2>
@@ -16,7 +9,7 @@
<el-tabs
v-model="activeTab"
class="panel-pill-tabs panel-pill-tabs--lg"
class="panel-tabs"
@tab-change="handleTabChange"
>
<!-- 待我审批 -->
@@ -67,6 +60,12 @@
<div class="list-toolbar-selected">
已选 <span class="sel-num">{{ selectedRows.length }}</span> 项
</div>
<ListQuickSearchInput
v-model="pendingQuickSearchKeyword"
placeholder="申请单号/申请原因"
@search="handlePendingQuickSearch"
@clear="handlePendingQuickSearchClear"
/>
<el-button class="btn-main" type="primary" @click="handleBatchApprove">
<el-icon><Check /></el-icon>通过
</el-button>
@@ -74,7 +73,15 @@
<el-icon><Close /></el-icon>驳回
</el-button>
<ListToolbarEndActions :loading="pendingLoading" @refresh="refreshPending" />
<ListToolbarEndActions
:loading="pendingLoading"
:column-defs="listColumnDefs"
v-model:visible-columns="visibleColumns"
v-model:check-all="checkAll"
:is-indeterminate="isIndeterminate"
@refresh="refreshPending"
@reset-columns="resetToDefault"
/>
</div>
</div>
@@ -94,6 +101,7 @@
<el-table-column type="selection" min-width="48" align="center" header-align="center" />
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
<el-table-column
v-if="isColumnVisible('applyTime')"
prop="applyTime"
label="申请时间"
min-width="160"
@@ -104,6 +112,7 @@
<el-table-column
prop="applyCode"
label="申请单号"
class-name="col-apply-code"
min-width="140"
align="center"
header-align="center"
@@ -113,8 +122,16 @@
<el-link type="primary" @click="openView(row)">{{ row.applyCode }}</el-link>
</template>
</el-table-column>
<el-table-column prop="applicantName" label="申请人" min-width="100" align="center" header-align="center" />
<el-table-column
v-if="isColumnVisible('applicantName')"
prop="applicantName"
label="申请人"
min-width="100"
align="center"
header-align="center"
/>
<el-table-column
v-if="isColumnVisible('reason')"
prop="reason"
label="申请原因"
min-width="160"
@@ -123,6 +140,7 @@
show-overflow-tooltip
/>
<el-table-column
v-if="isColumnVisible('amount')"
prop="amount"
label="申请金额(元)"
:formatter="moneyTableFormatter"
@@ -131,7 +149,14 @@
align="right"
header-align="center"
/>
<el-table-column prop="currentNode" label="当前节点" min-width="120" align="center" header-align="center">
<el-table-column
v-if="isColumnVisible('currentNode')"
prop="currentNode"
label="当前节点"
min-width="120"
align="center"
header-align="center"
>
<template #default="{ row }">
<el-tag
v-if="shouldShowWorkflowNodeTag(row.currentNode, row.status)"
@@ -203,6 +228,26 @@
</el-form>
</div>
<div class="list-toolbar">
<div class="list-toolbar-row">
<ListQuickSearchInput
v-model="approvedQuickSearchKeyword"
placeholder="申请单号/申请原因"
@search="handleApprovedQuickSearch"
@clear="handleApprovedQuickSearchClear"
/>
<ListToolbarEndActions
:loading="approvedLoading"
:column-defs="listColumnDefs"
v-model:visible-columns="visibleColumns"
v-model:check-all="checkAll"
:is-indeterminate="isIndeterminate"
@refresh="handleApprovedSearch"
@reset-columns="resetToDefault"
/>
</div>
</div>
<div class="list-body list-wrap">
<div class="table-scroll table-page-summary">
<el-table
@@ -217,6 +262,7 @@
>
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
<el-table-column
v-if="isColumnVisible('applyTime')"
prop="applyTime"
label="申请时间"
min-width="160"
@@ -227,6 +273,7 @@
<el-table-column
prop="applyCode"
label="申请单号"
class-name="col-apply-code"
min-width="140"
align="center"
header-align="center"
@@ -236,8 +283,16 @@
<el-link type="primary" @click="openView(row)">{{ row.applyCode }}</el-link>
</template>
</el-table-column>
<el-table-column prop="applicantName" label="申请人" min-width="100" align="center" header-align="center" />
<el-table-column
v-if="isColumnVisible('applicantName')"
prop="applicantName"
label="申请人"
min-width="100"
align="center"
header-align="center"
/>
<el-table-column
v-if="isColumnVisible('reason')"
prop="reason"
label="申请原因"
min-width="160"
@@ -246,6 +301,7 @@
show-overflow-tooltip
/>
<el-table-column
v-if="isColumnVisible('amount')"
prop="amount"
label="申请金额(元)"
:formatter="moneyTableFormatter"
@@ -254,14 +310,28 @@
align="right"
header-align="center"
/>
<el-table-column prop="status" label="状态" min-width="100" align="center" header-align="center">
<el-table-column
v-if="isColumnVisible('status')"
prop="status"
label="状态"
min-width="100"
align="center"
header-align="center"
>
<template #default="{ row }">
<el-tag :type="statusTagType(row.status)" size="small">
{{ statusLabel(row.status) }}
</el-tag>
</template>
</el-table-column>
<el-table-column prop="currentNode" label="当前节点" min-width="120" align="center" header-align="center">
<el-table-column
v-if="isColumnVisible('currentNode')"
prop="currentNode"
label="当前节点"
min-width="120"
align="center"
header-align="center"
>
<template #default="{ row }">
<el-tag
v-if="shouldShowWorkflowNodeTag(row.currentNode, row.status)"
@@ -329,25 +399,12 @@
<BxViewKvTable :fields="viewMainKvFields" mode="dual" />
</div>
<div class="dlg-view-section">
<h4 class="dlg-view-section-title">审批进度</h4>
<div class="flow-scroll">
<ApprovalFlowView :nodes="viewFlowNodes" :loading="viewFlowLoading" />
</div>
</div>
<div class="dlg-view-section">
<h4 class="dlg-view-section-title">审批历史</h4>
<div class="flow-scroll">
<ApprovalHistoryView :items="viewApprovalHistory" :loading="viewFlowLoading" />
</div>
</div>
<BxApprovalFlowTabs
:nodes="viewFlowNodes"
:history="viewApprovalHistory"
:loading="viewFlowLoading"
/>
</div>
<template #footer>
<el-button class="btn-ghost" @click="dialogs.view = false">
<el-icon><Close /></el-icon>关闭
</el-button>
</template>
</el-dialog>
<!-- 审批确认 -->
@@ -360,7 +417,7 @@
destroy-on-close
:close-on-click-modal="false"
>
<el-form label-position="top">
<el-form label-position="right" label-width="100px" class="bx-dialog-form">
<div class="form-grid-2">
<el-form-item label="审批时间">
<el-input :model-value="approveTime" disabled />
@@ -394,16 +451,16 @@
<script setup lang="ts">
import { reactive, ref, computed, onMounted } from 'vue'
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
import ListQuickSearchInput from '@/components/business/list-quick-search-input/index.vue'
import { usePersistedListColumns } from '@/composables/usePersistedListColumns'
import { ElMessage } from 'element-plus'
import { Check, Close, Search, RefreshLeft } from '@element-plus/icons-vue'
import { advanceApi } from '@/api/bx'
import { advanceApproverStats, refreshApproveMenuBadges } from '@/hooks/bx/useApproveMenuBadge'
import { refreshApproveMenuBadges } from '@/hooks/bx/useApproveMenuBadge'
import { useMenuStore } from '@/store/modules/menu'
import {
statusLabel,
statusTagType,
formatSumMoney,
formatMoney,
formatMoneyYuan,
moneyTableFormatter,
workflowNodeDisplay,
@@ -413,14 +470,31 @@ import {
} from '@/utils/bx/format'
import { useServerPaged } from '@/hooks/bx/useServerPaged'
import { useApplicantOptions } from '@/hooks/bx/useApplicantOptions'
import ApprovalFlowView from '@/components/bx/base/ApprovalFlowView.vue'
import ApprovalHistoryView from '@/components/bx/base/ApprovalHistoryView.vue'
import BxApprovalFlowTabs from '@/components/bx/base/BxApprovalFlowTabs.vue'
import BxViewKvTable from '@/components/bx/base/BxViewKvTable.vue'
import type { ViewField } from '@/components/business/system-view-dialog/types'
import { bxViewKv, bxViewKvLong, bxViewKvMoney } from '@/utils/bx/view-kv'
import { buildPageSummaryMethod, sumField } from '@/utils/bx/table-summary'
type DialogKey = 'view' | 'approve'
const listColumnDefs = [
{ prop: 'applyTime', label: '申请时间' },
{ prop: 'applicantName', label: '申请人' },
{ prop: 'reason', label: '申请原因' },
{ prop: 'amount', label: '申请金额(元)' },
{ prop: 'status', label: '状态', defaultVisible: false },
{ prop: 'currentNode', label: '当前节点', defaultVisible: false }
]
const {
visibleColumns,
checkAll,
isIndeterminate,
isColumnVisible,
resetToDefault
} = usePersistedListColumns('bx-advance-approve-list-columns', listColumnDefs)
const loadingMap = reactive<Record<string, boolean>>({})
const dialogs = reactive<Record<DialogKey, boolean>>({
view: false,
@@ -459,15 +533,10 @@ const {
const tabLoaded = reactive({ pending: false, approved: false })
const activeTab = ref('pending')
const menuStore = useMenuStore()
const pendingQuickSearchKeyword = ref('')
const approvedQuickSearchKeyword = ref('')
const stats = computed(() => {
const s = advanceApproverStats.value
return [
{ name: '待审批', value: String(s.pendingTotal) },
{ name: '本月审批金额(元)', value: formatMoney(s.monthPendingAmount) }
]
})
const menuStore = useMenuStore()
const viewData = ref<Record<string, any>>({})
@@ -520,7 +589,7 @@ const approvedFilterForm = reactive({
function buildPendingQuery() {
const q: Record<string, string | number> = {}
const code = pendingFilterForm.code.trim()
const code = (pendingQuickSearchKeyword.value.trim() || pendingFilterForm.code.trim())
if (code) q.keyword = code
if (pendingFilterForm.applicantId != null) q.applicantId = pendingFilterForm.applicantId
if (pendingFilterForm.applyDate) q.applyDate = pendingFilterForm.applyDate
@@ -529,7 +598,7 @@ function buildPendingQuery() {
function buildApprovedQuery() {
const q: Record<string, string | number> = {}
const code = approvedFilterForm.code.trim()
const code = (approvedQuickSearchKeyword.value.trim() || approvedFilterForm.code.trim())
if (code) q.keyword = code
if (approvedFilterForm.applicantId != null) q.applicantId = approvedFilterForm.applicantId
if (approvedFilterForm.applyDate) q.applyDate = approvedFilterForm.applyDate
@@ -544,23 +613,45 @@ onMounted(async () => {
})
function handlePendingSearch() {
pendingQuickSearchKeyword.value = ''
searchPending(buildPendingQuery())
}
function handlePendingReset() {
pendingQuickSearchKeyword.value = ''
Object.assign(pendingFilterForm, { code: '', applicantId: undefined, applyDate: null })
searchPending()
}
function handlePendingQuickSearch() {
searchPending(buildPendingQuery())
}
function handlePendingQuickSearchClear() {
pendingQuickSearchKeyword.value = ''
searchPending(buildPendingQuery())
}
function handleApprovedSearch() {
approvedQuickSearchKeyword.value = ''
searchApproved(buildApprovedQuery())
}
function handleApprovedReset() {
approvedQuickSearchKeyword.value = ''
Object.assign(approvedFilterForm, { code: '', applicantId: undefined, applyDate: null })
searchApproved()
}
function handleApprovedQuickSearch() {
searchApproved(buildApprovedQuery())
}
function handleApprovedQuickSearchClear() {
approvedQuickSearchKeyword.value = ''
searchApproved(buildApprovedQuery())
}
function handleTabChange(tab: string | number) {
if (tab === 'pending' && !tabLoaded.pending) {
searchPending()
@@ -619,21 +710,13 @@ async function openView(row: any) {
}
}
function pendingSummaryMethod(params: { data: any[] }) {
const data = params.data
const n = data.length
const t = data.reduce((s, r) => s + Number(r.amount || 0), 0)
const lbl = `本页合计(${n}单)`
return ['', '', '', lbl, '', '', formatSumMoney(t), '', '', '']
}
function approvedSummaryMethod(params: { data: any[] }) {
const data = params.data
const n = data.length
const t = data.reduce((s, r) => s + Number(r.amount || 0), 0)
const lbl = `本页合计(${n}单)`
return ['', '', '', lbl, '', formatSumMoney(t), '', '', '', '']
}
const amountSummary = buildPageSummaryMethod({
sumByProp: {
amount: (data) => sumField(data, 'amount')
}
})
const pendingSummaryMethod = amountSummary
const approvedSummaryMethod = amountSummary
async function handleConfirmApprove() {
const key = approveAction.value === 'approve' ? 'approvePass' : 'approveReject'
+136 -74
View File
@@ -2,13 +2,6 @@
<!-- eslint-disable vue/no-v-model-argument -->
<template>
<div class="page-container">
<div class="stats">
<div v-for="item in stats" :key="item.name" class="stat" :class="{ 'stat-money': item.name.includes('金额') }">
<p class="k">{{ item.name }}</p>
<p class="v">{{ item.value }}</p>
</div>
</div>
<section class="panel">
<div class="panel-top">
<h2 class="title-bar-heading">备用金发放</h2>
@@ -16,7 +9,7 @@
<el-tabs
v-model="activeTab"
class="panel-pill-tabs panel-pill-tabs--lg"
class="panel-tabs"
@tab-change="handleTabChange"
>
<el-tab-pane label="待发放" name="pending">
@@ -66,13 +59,27 @@
<div class="list-toolbar-selected">
已选 <span class="sel-num">{{ selectedRows.length }}</span> 项
</div>
<ListQuickSearchInput
v-model="quickSearchKeyword"
placeholder="申请单号/申请原因"
@search="handleQuickSearch"
@clear="handleQuickSearchClear"
/>
<el-button class="btn-main" type="primary" @click="handleToolbarIssue">
<el-icon><Check /></el-icon>发放
</el-button>
<el-button class="btn-ghost" :loading="loadingMap.export" @click="handleExport">
<el-icon><Download /></el-icon>导出
</el-button>
<ListToolbarEndActions :loading="loading" @refresh="handleSearch" />
<ListToolbarEndActions
:loading="loading"
:column-defs="listColumnDefs"
v-model:visible-columns="visibleColumns"
v-model:check-all="checkAll"
:is-indeterminate="isIndeterminate"
@refresh="handleSearch"
@reset-columns="resetToDefault"
/>
</div>
</div>
@@ -93,6 +100,7 @@
<el-table-column type="selection" min-width="48" align="center" header-align="center" />
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
<el-table-column
v-if="isColumnVisible('applyTime')"
prop="applyTime"
label="申请时间"
min-width="160"
@@ -103,6 +111,7 @@
<el-table-column
prop="applyCode"
label="申请单号"
class-name="col-apply-code"
min-width="140"
align="center"
header-align="center"
@@ -112,8 +121,16 @@
<el-link type="primary" @click="openView(row)">{{ row.applyCode }}</el-link>
</template>
</el-table-column>
<el-table-column prop="applicantName" label="申请人" min-width="100" align="center" header-align="center" />
<el-table-column
v-if="isColumnVisible('applicantName')"
prop="applicantName"
label="申请人"
min-width="100"
align="center"
header-align="center"
/>
<el-table-column
v-if="isColumnVisible('reason')"
prop="reason"
label="申请原因"
min-width="160"
@@ -122,6 +139,7 @@
show-overflow-tooltip
/>
<el-table-column
v-if="isColumnVisible('amount')"
prop="amount"
label="申请金额(元)"
:formatter="moneyTableFormatter"
@@ -131,6 +149,8 @@
header-align="center"
/>
<el-table-column
v-if="isColumnVisible('actualAmount')"
prop="actualAmount"
label="实际发放金额(元)"
class-name="col-money"
min-width="130"
@@ -146,6 +166,8 @@
</template>
</el-table-column>
<el-table-column
v-if="isColumnVisible('offsetAmount')"
prop="offsetAmount"
label="冲抵总金额(元)"
class-name="col-money"
min-width="130"
@@ -157,6 +179,7 @@
</template>
</el-table-column>
<el-table-column
v-if="isColumnVisible('approveTime')"
prop="approveTime"
label="审批通过时间"
min-width="140"
@@ -225,11 +248,25 @@
<div class="list-toolbar">
<div class="list-toolbar-row">
<ListQuickSearchInput
v-model="quickSearchKeyword"
placeholder="申请单号/申请原因"
@search="handleQuickSearch"
@clear="handleQuickSearchClear"
/>
<el-button class="btn-ghost" :loading="loadingMap.export" @click="handleExport">
<el-icon><Download /></el-icon>导出
</el-button>
<ListToolbarEndActions :loading="loading" @refresh="handleSearch" />
<ListToolbarEndActions
:loading="loading"
:column-defs="listColumnDefs"
v-model:visible-columns="visibleColumns"
v-model:check-all="checkAll"
:is-indeterminate="isIndeterminate"
@refresh="handleSearch"
@reset-columns="resetToDefault"
/>
</div>
</div>
@@ -247,6 +284,7 @@
>
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
<el-table-column
v-if="isColumnVisible('applyTime')"
prop="applyTime"
label="申请时间"
min-width="160"
@@ -257,6 +295,7 @@
<el-table-column
prop="applyCode"
label="申请单号"
class-name="col-apply-code"
min-width="140"
align="center"
header-align="center"
@@ -266,8 +305,16 @@
<el-link type="primary" @click="openView(row)">{{ row.applyCode }}</el-link>
</template>
</el-table-column>
<el-table-column prop="applicantName" label="申请人" min-width="100" align="center" header-align="center" />
<el-table-column
v-if="isColumnVisible('applicantName')"
prop="applicantName"
label="申请人"
min-width="100"
align="center"
header-align="center"
/>
<el-table-column
v-if="isColumnVisible('reason')"
prop="reason"
label="申请原因"
min-width="160"
@@ -276,6 +323,7 @@
show-overflow-tooltip
/>
<el-table-column
v-if="isColumnVisible('amount')"
prop="amount"
label="申请金额(元)"
:formatter="moneyTableFormatter"
@@ -285,6 +333,8 @@
header-align="center"
/>
<el-table-column
v-if="isColumnVisible('actualAmount')"
prop="actualAmount"
label="实际发放金额(元)"
class-name="col-money"
min-width="130"
@@ -300,6 +350,8 @@
</template>
</el-table-column>
<el-table-column
v-if="isColumnVisible('offsetAmount')"
prop="offsetAmount"
label="冲抵总金额(元)"
class-name="col-money"
min-width="130"
@@ -310,8 +362,22 @@
{{ formatSumMoney(Number(row.offsetAmount ?? 0)) }}
</template>
</el-table-column>
<el-table-column prop="issueTime" label="发放时间" min-width="140" align="center" header-align="center" />
<el-table-column prop="issueUserName" label="发放操作人" min-width="110" align="center" header-align="center" />
<el-table-column
v-if="isColumnVisible('issueTime')"
prop="issueTime"
label="发放时间"
min-width="140"
align="center"
header-align="center"
/>
<el-table-column
v-if="isColumnVisible('issueUserName')"
prop="issueUserName"
label="发放操作人"
min-width="110"
align="center"
header-align="center"
/>
</el-table>
</div>
@@ -341,7 +407,7 @@
destroy-on-close
:close-on-click-modal="false"
>
<el-form label-position="top">
<el-form label-position="right" label-width="100px" class="bx-dialog-form">
<div class="form-grid-2">
<el-form-item label="发放金额(元)" class="field-amount">
<el-input :model-value="String(currentRow.amount || '')" disabled placeholder="发放金额" />
@@ -439,31 +505,20 @@
<BxAttachmentReadonly :files="viewAttachments" />
</div>
<div class="dlg-view-section">
<h4 class="dlg-view-section-title">审批进度</h4>
<div class="flow-scroll">
<ApprovalFlowView :nodes="approvalNodes" :loading="approvalLoading" />
</div>
</div>
<div class="dlg-view-section">
<h4 class="dlg-view-section-title">审批历史</h4>
<div class="flow-scroll">
<ApprovalHistoryView :items="approvalHistory" :loading="approvalLoading" />
</div>
</div>
<BxApprovalFlowTabs
:nodes="approvalNodes"
:history="approvalHistory"
:loading="approvalLoading"
/>
</div>
<template #footer>
<el-button class="btn-ghost" @click="dialogs.view = false">
<el-icon><Close /></el-icon>关闭
</el-button>
</template>
</el-dialog>
</div>
</template>
<script setup lang="ts">
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
import { usePersistedListColumns } from '@/composables/usePersistedListColumns'
import ListQuickSearchInput from '@/components/business/list-quick-search-input/index.vue'
import { reactive, ref, computed, onMounted } from 'vue'
import { ElMessage } from 'element-plus'
import { Check, Download, Close, Search, RefreshLeft } from '@element-plus/icons-vue'
@@ -472,17 +527,37 @@ import { type BxAttachmentItem, loadBxAttachments } from '@/utils/bx/attachment'
import { formatSumMoney, formatMoney, formatMoneyYuan, moneyTableFormatter } from '@/utils/bx/format'
import { useServerPaged } from '@/hooks/bx/useServerPaged'
import { useApplicantOptions } from '@/hooks/bx/useApplicantOptions'
import ApprovalFlowView from '@/components/bx/base/ApprovalFlowView.vue'
import ApprovalHistoryView from '@/components/bx/base/ApprovalHistoryView.vue'
import BxApprovalFlowTabs from '@/components/bx/base/BxApprovalFlowTabs.vue'
import BxViewKvTable from '@/components/bx/base/BxViewKvTable.vue'
import BaseDetailTableSection from '@/components/bx/base/BaseDetailTableSection.vue'
import BxAttachmentUpload from '@/components/bx/base/BxAttachmentUpload.vue'
import BxAttachmentReadonly from '@/components/bx/base/BxAttachmentReadonly.vue'
import type { ViewField } from '@/components/business/system-view-dialog/types'
import { bxViewKv } from '@/utils/bx/view-kv'
import { buildPageSummaryMethod, sumField } from '@/utils/bx/table-summary'
type DialogKey = 'issue' | 'view'
const listColumnDefs = [
{ prop: 'applyTime', label: '申请时间' },
{ prop: 'applicantName', label: '申请人' },
{ prop: 'reason', label: '申请原因' },
{ prop: 'amount', label: '申请金额(元)' },
{ prop: 'actualAmount', label: '实际发放金额(元)' },
{ prop: 'offsetAmount', label: '冲抵总金额(元)', defaultVisible: false },
{ prop: 'approveTime', label: '审批通过时间', defaultVisible: false },
{ prop: 'issueTime', label: '发放时间', defaultVisible: false },
{ prop: 'issueUserName', label: '发放操作人', defaultVisible: false }
]
const {
visibleColumns,
checkAll,
isIndeterminate,
isColumnVisible,
resetToDefault
} = usePersistedListColumns('bx-advance-issue-list-columns', listColumnDefs)
const loadingMap = reactive<Record<string, boolean>>({})
const dialogs = reactive<Record<DialogKey, boolean>>({
issue: false,
@@ -511,28 +586,7 @@ const { rows, total, currentPage, pageSize, rangeText, loading, refresh, search,
}
)
const stats = ref([
{ name: '待发放', value: '-' },
{ name: '已发放', value: '-' },
{ name: '本月发放金额(元)', value: '-' },
{ name: '待发放金额(元)', value: '-' }
])
async function loadAdvanceIssueStats() {
try {
const res: any = await paymentApi.advanceIssueStats()
const d = res.data
if (!d) return
stats.value = [
{ name: '待发放', value: String(d.pendingCount ?? 0) },
{ name: '已发放', value: String(d.issuedCount ?? 0) },
{ name: '本月发放金额(元)', value: formatMoney(d.issuedMonthAmount ?? 0) },
{ name: '待发放金额(元)', value: formatMoney(d.pendingAmount ?? 0) }
]
} catch {
/* interceptor */
}
}
const quickSearchKeyword = ref('')
const currentRow = ref<Record<string, any>>({})
const selectedRows = ref<any[]>([])
@@ -574,24 +628,17 @@ function issueStatusTagType(status: string): 'success' | 'warning' {
return status === 'issued' ? 'success' : 'warning'
}
function advanceIssueSummary(params: { data: any[] }) {
const data = params.data
const n = data.length
const tAmt = data.reduce((s, r) => s + Number(r.amount || 0), 0)
const tAct = data.reduce((s, r) => s + Number(r.actualAmount ?? 0), 0)
const tOff = data.reduce((s, r) => s + Number(r.offsetAmount ?? 0), 0)
const lbl = `本页合计(${n}单)`
const body = ['', '', '', lbl, '', '', formatSumMoney(tAmt), formatSumMoney(tAct), formatSumMoney(tOff)]
if (activeTab.value === 'pending') {
return [...body, '', '']
const advanceIssueSummary = buildPageSummaryMethod({
sumByProp: {
amount: (data) => sumField(data, 'amount'),
actualAmount: (data) => sumField(data, 'actualAmount'),
offsetAmount: (data) => sumField(data, 'offsetAmount')
}
return [...body, '', '', '']
}
})
onMounted(() => {
loadApplicantOptions()
refresh()
loadAdvanceIssueStats()
})
function onSelectionChange(rows: any[]) {
@@ -608,24 +655,40 @@ function handleToolbarIssue() {
function handleTabChange(tab: string | number) {
activeTab.value = String(tab)
quickSearchKeyword.value = ''
Object.assign(filterForm, { keyword: '', applicantId: undefined, applyDate: null })
search()
}
function handleSearch() {
function buildSearchQuery() {
const q: Record<string, string | number> = {}
const kw = filterForm.keyword.trim()
const kw = (quickSearchKeyword.value.trim() || filterForm.keyword.trim())
if (kw) q.keyword = kw
if (filterForm.applicantId != null) q.applicantId = filterForm.applicantId
if (filterForm.applyDate) q.applyDate = filterForm.applyDate
search(q)
return q
}
function handleSearch() {
quickSearchKeyword.value = ''
search(buildSearchQuery())
}
function handleReset() {
quickSearchKeyword.value = ''
Object.assign(filterForm, { keyword: '', applicantId: undefined, applyDate: null })
search()
}
function handleQuickSearch() {
search(buildSearchQuery())
}
function handleQuickSearchClear() {
quickSearchKeyword.value = ''
search(buildSearchQuery())
}
async function handleExport() {
loadingMap.export = true
try {
@@ -678,7 +741,6 @@ async function submitIssue() {
ElMessage.success('发放成功')
dialogs.issue = false
await refresh()
await loadAdvanceIssueStats()
} catch (e: any) {
ElMessage.error(e.message || '发放失败')
} finally {
+93 -9
View File
@@ -48,6 +48,12 @@
<div class="list-toolbar-selected">
已选 <span class="sel-num">{{ selectedRows.length }}</span> 项
</div>
<ListQuickSearchInput
v-model="quickSearchKeyword"
placeholder="项目名称/项目编码"
@search="handleQuickSearch"
@clear="handleQuickSearchClear"
/>
<el-button class="btn-main" type="primary" @click="openAddDialog">
<el-icon><Plus /></el-icon>新增一级项目
</el-button>
@@ -84,7 +90,15 @@
<el-icon><SortUp /></el-icon>收起全部
</el-button>
<ListToolbarEndActions :loading="loading" @refresh="handleSearch" />
<ListToolbarEndActions
:loading="loading"
:column-defs="listColumnDefs"
v-model:visible-columns="visibleColumns"
v-model:check-all="checkAll"
:is-indeterminate="isIndeterminate"
@refresh="handleSearch"
@reset-columns="resetToDefault"
/>
</div>
</div>
@@ -98,6 +112,7 @@
row-key="id"
:tree-props="{ children: 'children', hasChildren: 'childCount > 0' }"
@selection-change="onSelectionChange"
@row-dblclick="openEditDialog"
>
<el-table-column type="selection" min-width="48" align="center" header-align="center" />
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
@@ -111,6 +126,7 @@
show-overflow-tooltip
/>
<el-table-column
v-if="isColumnVisible('itemCode')"
prop="itemCode"
label="项目编码"
min-width="160"
@@ -118,7 +134,14 @@
header-align="center"
show-overflow-tooltip
/>
<el-table-column prop="level" label="层级" min-width="100" align="center" header-align="center">
<el-table-column
v-if="isColumnVisible('level')"
prop="level"
label="层级"
min-width="100"
align="center"
header-align="center"
>
<template #default="{ row }">
<el-tag :type="row.level === 1 ? 'primary' : 'info'" size="small">
{{ row.level === 1 ? '一级' : '二级' }}
@@ -126,14 +149,29 @@
</template>
</el-table-column>
<el-table-column
v-if="isColumnVisible('childCount')"
prop="childCount"
label="子项数量"
min-width="100"
align="center"
header-align="center"
/>
<el-table-column prop="sortOrder" label="排序号" min-width="80" align="center" header-align="center" />
<el-table-column prop="status" label="状态" min-width="100" align="center" header-align="center">
<el-table-column
v-if="isColumnVisible('sortOrder')"
prop="sortOrder"
label="排序号"
min-width="80"
align="center"
header-align="center"
/>
<el-table-column
v-if="isColumnVisible('status')"
prop="status"
label="状态"
min-width="100"
align="center"
header-align="center"
>
<template #default="{ row }">
<el-tag :type="statusTagType(row.status)" size="small">
{{ statusLabel(row.status) }}
@@ -159,7 +197,9 @@
ref="addFormRef"
:model="formData"
:rules="formRules"
label-position="top"
label-position="right"
label-width="100px"
class="bx-dialog-form"
scroll-to-error
:scroll-into-view-options="{ behavior: 'smooth', block: 'center' }"
>
@@ -211,7 +251,9 @@
ref="editFormRef"
:model="formData"
:rules="formRules"
label-position="top"
label-position="right"
label-width="100px"
class="bx-dialog-form"
scroll-to-error
:scroll-into-view-options="{ behavior: 'smooth', block: 'center' }"
>
@@ -277,7 +319,9 @@
ref="addChildFormRef"
:model="formData"
:rules="formRules"
label-position="top"
label-position="right"
label-width="100px"
class="bx-dialog-form"
scroll-to-error
:scroll-into-view-options="{ behavior: 'smooth', block: 'center' }"
>
@@ -321,6 +365,8 @@
<script setup lang="ts">
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
import ListQuickSearchInput from '@/components/business/list-quick-search-input/index.vue'
import { usePersistedListColumns } from '@/composables/usePersistedListColumns'
import { reactive, ref, onMounted, computed, watch } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import type { FormInstance } from 'element-plus'
@@ -349,6 +395,24 @@ const dialogs = reactive<Record<DialogKey, boolean>>({
addChild: false
})
const listColumnDefs = [
{ prop: 'itemCode', label: '项目编码' },
{ prop: 'level', label: '层级' },
{ prop: 'childCount', label: '子项数量' },
{ prop: 'sortOrder', label: '排序号', defaultVisible: false },
{ prop: 'status', label: '状态' }
]
const {
visibleColumns,
checkAll,
isIndeterminate,
isColumnVisible,
resetToDefault
} = usePersistedListColumns('bx-expense-item-list-columns', listColumnDefs)
const quickSearchKeyword = ref('')
const searchForm = reactive({
name: '',
code: '',
@@ -396,6 +460,7 @@ function buildSubmitPayload() {
}
function filterTreeNodes(nodes: any[]): any[] {
const qk = quickSearchKeyword.value.trim().toLowerCase()
return nodes
.map((node) => {
const children = node.children?.length ? filterTreeNodes(node.children) : []
@@ -403,7 +468,15 @@ function filterTreeNodes(nodes: any[]): any[] {
const codeOk = !searchForm.code || String(node.itemCode || '').includes(searchForm.code)
const levelOk = !searchForm.level || String(node.level) === searchForm.level
const statusOk = !searchForm.status || String(node.status) === searchForm.status
const selfMatch = nameOk && codeOk && levelOk && statusOk
const quickOk =
!qk ||
String(node.itemName || '')
.toLowerCase()
.includes(qk) ||
String(node.itemCode || '')
.toLowerCase()
.includes(qk)
const selfMatch = nameOk && codeOk && levelOk && statusOk && quickOk
if (selfMatch || children.length) {
return { ...node, children: children.length ? children : node.children?.length ? [] : undefined }
}
@@ -413,7 +486,8 @@ function filterTreeNodes(nodes: any[]): any[] {
}
const filteredTree = computed(() => {
const hasFilter = searchForm.name || searchForm.code || searchForm.level || searchForm.status
const hasFilter =
searchForm.name || searchForm.code || searchForm.level || searchForm.status || quickSearchKeyword.value.trim()
if (!hasFilter) return expenseTree.value
return filterTreeNodes(expenseTree.value)
})
@@ -597,10 +671,12 @@ function collapseAll() {
}
function handleSearch() {
quickSearchKeyword.value = ''
loadTree()
}
function handleReset() {
quickSearchKeyword.value = ''
searchForm.name = ''
searchForm.code = ''
searchForm.level = ''
@@ -608,6 +684,14 @@ function handleReset() {
loadTree()
}
function handleQuickSearch() {
/* filteredTree reacts to quickSearchKeyword */
}
function handleQuickSearchClear() {
quickSearchKeyword.value = ''
}
watch(
() => formData.level,
(level) => {
+192 -93
View File
@@ -2,13 +2,6 @@
<!-- eslint-disable vue/no-v-model-argument -->
<template>
<div class="page-container">
<div class="stats">
<div v-for="item in stats" :key="item.name" class="stat" :class="{ 'stat-money': item.name.includes('金额') }">
<p class="k">{{ item.name }}</p>
<p class="v">{{ item.value }}</p>
</div>
</div>
<section class="panel">
<div class="panel-top">
<h2 class="title-bar-heading">支付管理</h2>
@@ -16,7 +9,7 @@
<el-tabs
v-model="activeTab"
class="panel-pill-tabs panel-pill-tabs--lg"
class="panel-tabs"
@tab-change="handleTabChange"
>
<!-- 待处理 -->
@@ -67,13 +60,27 @@
<div class="list-toolbar-selected">
已选 <span class="sel-num">{{ selectedRows.length }}</span> 项
</div>
<ListQuickSearchInput
v-model="quickSearchKeyword"
placeholder="单号/报销标题"
@search="handleQuickSearch"
@clear="handleQuickSearchClear"
/>
<el-button class="btn-main" type="primary" @click="handleToolbarIssue">
<el-icon><Money /></el-icon>发放
</el-button>
<el-button class="btn-ghost" @click="handleToolbarOffset">
<el-icon><Switch /></el-icon>冲抵备用金
</el-button>
<ListToolbarEndActions :loading="loading" @refresh="handleSearch" />
<ListToolbarEndActions
:loading="loading"
:column-defs="listColumnDefs"
v-model:visible-columns="visibleColumns"
v-model:check-all="checkAll"
:is-indeterminate="isIndeterminate"
@refresh="handleSearch"
@reset-columns="resetToDefault"
/>
</div>
</div>
@@ -94,6 +101,7 @@
<el-table-column type="selection" min-width="48" align="center" header-align="center" />
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
<el-table-column
v-if="isColumnVisible('applyTime')"
prop="applyTime"
label="申请时间"
min-width="160"
@@ -104,6 +112,7 @@
<el-table-column
prop="applyCode"
label="单号"
class-name="col-apply-code"
min-width="140"
align="center"
header-align="center"
@@ -113,8 +122,16 @@
<el-link type="primary" @click="openView(row)">{{ row.applyCode }}</el-link>
</template>
</el-table-column>
<el-table-column prop="applicantName" label="申请人" min-width="100" align="center" header-align="center" />
<el-table-column
v-if="isColumnVisible('applicantName')"
prop="applicantName"
label="申请人"
min-width="100"
align="center"
header-align="center"
/>
<el-table-column
v-if="isColumnVisible('title')"
prop="title"
label="报销标题"
min-width="180"
@@ -123,6 +140,7 @@
show-overflow-tooltip
/>
<el-table-column
v-if="isColumnVisible('amount')"
prop="amount"
label="报销金额(元)"
:formatter="moneyTableFormatter"
@@ -131,12 +149,28 @@
align="right"
header-align="center"
/>
<el-table-column label="冲抵金额(元)" class-name="col-money" min-width="120" align="right" header-align="center">
<el-table-column
v-if="isColumnVisible('offsetAmount')"
prop="offsetAmount"
label="冲抵金额(元)"
class-name="col-money"
min-width="120"
align="right"
header-align="center"
>
<template #default="{ row }">
{{ formatSumMoney(Number(row.offsetAmount || 0)) }}
</template>
</el-table-column>
<el-table-column label="发放金额(元)" class-name="col-money" min-width="120" align="right" header-align="center">
<el-table-column
v-if="isColumnVisible('payAmount')"
prop="actualAmount"
label="发放金额(元)"
class-name="col-money"
min-width="120"
align="right"
header-align="center"
>
<template #default="{ row }">
{{
row.actualAmount != null && row.actualAmount !== ''
@@ -215,6 +249,26 @@
</el-form>
</div>
<div class="list-toolbar">
<div class="list-toolbar-row">
<ListQuickSearchInput
v-model="processedQuickSearchKeyword"
placeholder="单号/报销标题"
@search="handleProcessedQuickSearch"
@clear="handleProcessedQuickSearchClear"
/>
<ListToolbarEndActions
:loading="processedLoading"
:column-defs="listColumnDefs"
v-model:visible-columns="visibleColumns"
v-model:check-all="checkAll"
:is-indeterminate="isIndeterminate"
@refresh="handleProcessedSearch"
@reset-columns="resetToDefault"
/>
</div>
</div>
<div class="list-body list-wrap">
<div class="table-scroll table-page-summary">
<el-table
@@ -229,6 +283,7 @@
>
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
<el-table-column
v-if="isColumnVisible('applyTime')"
prop="applyTime"
label="申请时间"
min-width="160"
@@ -239,6 +294,7 @@
<el-table-column
prop="applyCode"
label="单号"
class-name="col-apply-code"
min-width="140"
align="center"
header-align="center"
@@ -248,8 +304,16 @@
<el-link type="primary" @click="openProcessedView(row)">{{ row.applyCode }}</el-link>
</template>
</el-table-column>
<el-table-column prop="applicantName" label="申请人" min-width="100" align="center" header-align="center" />
<el-table-column
v-if="isColumnVisible('applicantName')"
prop="applicantName"
label="申请人"
min-width="100"
align="center"
header-align="center"
/>
<el-table-column
v-if="isColumnVisible('title')"
prop="title"
label="标题"
min-width="180"
@@ -258,6 +322,7 @@
show-overflow-tooltip
/>
<el-table-column
v-if="isColumnVisible('amount')"
prop="amount"
label="报销金额(元)"
:formatter="moneyTableFormatter"
@@ -266,12 +331,28 @@
align="right"
header-align="center"
/>
<el-table-column label="冲抵金额(元)" class-name="col-money" min-width="120" align="right" header-align="center">
<el-table-column
v-if="isColumnVisible('offsetAmount')"
prop="offsetAmount"
label="冲抵金额(元)"
class-name="col-money"
min-width="120"
align="right"
header-align="center"
>
<template #default="{ row }">
{{ formatSumMoney(Number(row.offsetAmount || 0)) }}
</template>
</el-table-column>
<el-table-column label="发放金额(元)" class-name="col-money" min-width="120" align="right" header-align="center">
<el-table-column
v-if="isColumnVisible('payAmount')"
prop="actualAmount"
label="发放金额(元)"
class-name="col-money"
min-width="120"
align="right"
header-align="center"
>
<template #default="{ row }">
{{
row.actualAmount != null && row.actualAmount !== ''
@@ -280,14 +361,27 @@
}}
</template>
</el-table-column>
<el-table-column label="处理状态" min-width="100" align="center" header-align="center">
<el-table-column
v-if="isColumnVisible('processStatus')"
label="处理状态"
min-width="100"
align="center"
header-align="center"
>
<template #default="{ row }">
<el-tag :type="processedStatusTagType(row.status, row.payStatus)" size="small">
{{ processedStatusLabel(row.status, row.payStatus) }}
</el-tag>
</template>
</el-table-column>
<el-table-column prop="payTime" label="处理时间" min-width="160" align="center" header-align="center">
<el-table-column
v-if="isColumnVisible('payTime')"
prop="payTime"
label="处理时间"
min-width="160"
align="center"
header-align="center"
>
<template #default="{ row }">
{{ row.payTime || '-' }}
</template>
@@ -355,11 +449,6 @@
<BxAttachmentReadonly :files="viewAttachments" />
</div>
</div>
<template #footer>
<el-button class="btn-ghost" @click="dialogs.viewDetail = false">
<el-icon><Close /></el-icon>关闭
</el-button>
</template>
</el-dialog>
<!-- 标记已发放 -->
@@ -372,7 +461,7 @@
destroy-on-close
:close-on-click-modal="false"
>
<el-form label-position="top">
<el-form label-position="right" label-width="100px" class="bx-dialog-form">
<div class="form-grid-2">
<el-form-item label="发放金额(元)" class="field-amount">
<el-input :model-value="String(currentRow.amount || '')" disabled placeholder="发放金额" />
@@ -417,7 +506,7 @@
destroy-on-close
:close-on-click-modal="false"
>
<el-form label-position="top">
<el-form label-position="right" label-width="100px" class="bx-dialog-form">
<h4 class="dialog-section-title">报销单信息</h4>
<div class="form-grid-2">
<el-form-item label="报销单号">
@@ -485,7 +574,7 @@
/>
</div>
<el-form-item label="备注" style="margin-top: 16px">
<el-form-item label="备注">
<el-input v-model="offsetRemark" type="textarea" :rows="3" placeholder="请输入备注" />
</el-form-item>
@@ -577,31 +666,20 @@
</BaseDetailTableSection>
</div>
<div class="dlg-view-section">
<h4 class="dlg-view-section-title">审批进度</h4>
<div class="flow-scroll">
<ApprovalFlowView :nodes="processedApprovals" :loading="processedApprovalLoading" />
</div>
</div>
<div class="dlg-view-section">
<h4 class="dlg-view-section-title">审批历史</h4>
<div class="flow-scroll">
<ApprovalHistoryView :items="processedApprovalHistory" :loading="processedApprovalLoading" />
</div>
</div>
<BxApprovalFlowTabs
:nodes="processedApprovals"
:history="processedApprovalHistory"
:loading="processedApprovalLoading"
/>
</div>
<template #footer>
<el-button class="btn-ghost" @click="dialogs.processedDetail = false">
<el-icon><Close /></el-icon>关闭
</el-button>
</template>
</el-dialog>
</div>
</template>
<script setup lang="ts">
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
import { usePersistedListColumns } from '@/composables/usePersistedListColumns'
import ListQuickSearchInput from '@/components/business/list-quick-search-input/index.vue'
import { reactive, ref, computed, onMounted } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import {
@@ -618,8 +696,7 @@ import { type BxAttachmentItem, loadBxAttachments } from '@/utils/bx/attachment'
import { statusLabel, statusTagType, formatSumMoney, formatMoney, formatMoneyYuan, moneyTableFormatter } from '@/utils/bx/format'
import { useServerPaged } from '@/hooks/bx/useServerPaged'
import { useApplicantOptions } from '@/hooks/bx/useApplicantOptions'
import ApprovalFlowView from '@/components/bx/base/ApprovalFlowView.vue'
import ApprovalHistoryView from '@/components/bx/base/ApprovalHistoryView.vue'
import BxApprovalFlowTabs from '@/components/bx/base/BxApprovalFlowTabs.vue'
import BxViewKvGrid from '@/components/bx/base/BxViewKvGrid.vue'
import BxViewKvTable from '@/components/bx/base/BxViewKvTable.vue'
import BaseDetailTableSection from '@/components/bx/base/BaseDetailTableSection.vue'
@@ -627,9 +704,29 @@ import BxAttachmentUpload from '@/components/bx/base/BxAttachmentUpload.vue'
import BxAttachmentReadonly from '@/components/bx/base/BxAttachmentReadonly.vue'
import type { ViewField } from '@/components/business/system-view-dialog/types'
import { bxViewKv, bxViewKvMoney } from '@/utils/bx/view-kv'
import { buildPageSummaryMethod, sumField } from '@/utils/bx/table-summary'
type DialogKey = 'viewDetail' | 'issue' | 'offset' | 'processedDetail'
const listColumnDefs = [
{ prop: 'applyTime', label: '申请时间' },
{ prop: 'applicantName', label: '申请人' },
{ prop: 'title', label: '报销标题' },
{ prop: 'amount', label: '报销金额(元)' },
{ prop: 'offsetAmount', label: '冲抵金额(元)', defaultVisible: false },
{ prop: 'payAmount', label: '发放金额(元)' },
{ prop: 'processStatus', label: '处理状态', defaultVisible: false },
{ prop: 'payTime', label: '处理时间', defaultVisible: false }
]
const {
visibleColumns,
checkAll,
isIndeterminate,
isColumnVisible,
resetToDefault
} = usePersistedListColumns('bx-payment-list-columns', listColumnDefs)
const { applicantOptions, loadApplicantOptions } = useApplicantOptions()
const loadingMap = reactive<Record<string, boolean>>({})
const dialogs = reactive<Record<DialogKey, boolean>>({
@@ -652,28 +749,8 @@ const { rows, total, currentPage, pageSize, rangeText, loading, refresh, search,
}
)
const stats = ref([
{ name: '待处理单据', value: '-' },
{ name: '已打款', value: '-' },
{ name: '冲抵备用金', value: '-' },
{ name: '本月处理金额(元)', value: '-' }
])
async function loadPaymentFinanceStats() {
try {
const res: any = await paymentApi.financeStats()
const d = res.data
if (!d) return
stats.value = [
{ name: '待处理单据', value: String(d.pendingCount ?? 0) },
{ name: '已打款', value: String(d.paidCount ?? 0) },
{ name: '冲抵备用金', value: String(d.offsetCount ?? 0) },
{ name: '本月处理金额(元)', value: formatMoney(d.monthProcessedAmount ?? 0) }
]
} catch {
/* interceptor */
}
}
const quickSearchKeyword = ref('')
const processedQuickSearchKeyword = ref('')
const filterForm = reactive({
code: '',
@@ -836,7 +913,6 @@ const processedOffsetRecords = ref<any[]>([])
onMounted(() => {
loadApplicantOptions()
refresh()
loadPaymentFinanceStats()
})
function onSelectionChange(rows: any[]) {
@@ -859,20 +935,35 @@ function handleToolbarOffset() {
openOffsetDialog(selectedRows.value[0])
}
function handleSearch() {
function buildPendingQuery() {
const q: Record<string, string | number> = {}
const kw = filterForm.code.trim()
const kw = (quickSearchKeyword.value.trim() || filterForm.code.trim())
if (kw) q.keyword = kw
if (filterForm.applicantId != null) q.applicantId = filterForm.applicantId
if (filterForm.applyDate) q.applyDate = filterForm.applyDate
search(q)
return q
}
function handleSearch() {
quickSearchKeyword.value = ''
search(buildPendingQuery())
}
function handleReset() {
quickSearchKeyword.value = ''
Object.assign(filterForm, { code: '', applicantId: undefined, applyDate: null, status: '' })
search()
}
function handleQuickSearch() {
search(buildPendingQuery())
}
function handleQuickSearchClear() {
quickSearchKeyword.value = ''
search(buildPendingQuery())
}
function handleTabChange(tab: string | number) {
if (tab === 'processed' && !tabLoaded.processed) {
processedSearch()
@@ -880,15 +971,35 @@ function handleTabChange(tab: string | number) {
}
}
function buildProcessedQuery() {
const q: Record<string, string | number> = {}
const kw = (processedQuickSearchKeyword.value.trim() || processedFilterForm.code.trim())
if (kw) q.keyword = kw
if (processedFilterForm.applicantId != null) q.applicantId = processedFilterForm.applicantId
if (processedFilterForm.applyDate) q.applyDate = processedFilterForm.applyDate
return q
}
function handleProcessedSearch() {
processedSearch()
processedQuickSearchKeyword.value = ''
processedSearch(buildProcessedQuery())
}
function handleProcessedReset() {
processedQuickSearchKeyword.value = ''
Object.assign(processedFilterForm, { code: '', applicantId: undefined, applyDate: null, status: '' })
processedSearch()
}
function handleProcessedQuickSearch() {
processedSearch(buildProcessedQuery())
}
function handleProcessedQuickSearchClear() {
processedQuickSearchKeyword.value = ''
processedSearch(buildProcessedQuery())
}
async function openView(row: any) {
viewData.value = row
viewAttachments.value = []
@@ -928,7 +1039,6 @@ async function submitIssue() {
ElMessage.success('发放成功')
dialogs.issue = false
await refresh()
await loadPaymentFinanceStats()
} catch (e: any) {
ElMessage.error(e.message || '发放失败')
} finally {
@@ -1071,7 +1181,6 @@ async function submitOffset() {
ElMessage.success('冲抵成功')
dialogs.offset = false
await refresh()
await loadPaymentFinanceStats()
} catch (e: any) {
ElMessage.error(e.message || '冲抵失败')
} finally {
@@ -1079,25 +1188,15 @@ async function submitOffset() {
}
}
function summaryMethod(params: { data: any[] }) {
const data = params.data
const n = data.length
const tr = data.reduce((s, r) => s + Number(r.amount || 0), 0)
const toff = data.reduce((s, r) => s + Number(r.offsetAmount || 0), 0)
const tpay = data.reduce((s, r) => s + Number(r.actualAmount ?? 0), 0)
const lbl = `本页合计(${n}单)`
return ['', '', '', lbl, '', '', formatSumMoney(tr), formatSumMoney(toff), formatSumMoney(tpay), '']
}
function processedSummaryMethod(params: { data: any[] }) {
const data = params.data
const n = data.length
const tr = data.reduce((s, r) => s + Number(r.amount || 0), 0)
const toff = data.reduce((s, r) => s + Number(r.offsetAmount || 0), 0)
const tpay = data.reduce((s, r) => s + Number(r.actualAmount ?? 0), 0)
const lbl = `本页合计(${n}单)`
return ['', '', '', lbl, '', formatSumMoney(tr), formatSumMoney(toff), formatSumMoney(tpay), '', '', '']
}
const paymentSummary = buildPageSummaryMethod({
sumByProp: {
amount: (data) => sumField(data, 'amount'),
offsetAmount: (data) => sumField(data, 'offsetAmount'),
actualAmount: (data) => sumField(data, 'actualAmount')
}
})
const summaryMethod = paymentSummary
const processedSummaryMethod = paymentSummary
async function openProcessedView(row: any) {
processedViewData.value = row
@@ -2,13 +2,6 @@
<!-- eslint-disable vue/no-v-model-argument -->
<template>
<div class="page-container">
<div class="stats">
<div v-for="item in stats" :key="item.name" class="stat" :class="{ 'stat-money': item.name.includes('金额') }">
<p class="k">{{ item.name }}</p>
<p class="v">{{ item.value }}</p>
</div>
</div>
<section class="panel">
<div class="panel-top">
<h2 class="title-bar-heading">报销申请列表</h2>
@@ -60,6 +53,12 @@
<div class="list-toolbar-selected">
已选 <span class="sel-num">{{ selectedRows.length }}</span> 项
</div>
<ListQuickSearchInput
v-model="quickSearchKeyword"
placeholder="报销单号/标题/费用项目"
@search="handleQuickSearch"
@clear="handleQuickSearchClear"
/>
<el-button class="btn-main" type="primary" @click="openAddDialog">
<el-icon><Plus /></el-icon>新增报销申请
</el-button>
@@ -89,7 +88,15 @@
<el-button class="btn-ghost" @click="openFlowDialog()">
<el-icon><View /></el-icon>查看审批流
</el-button>
<ListToolbarEndActions :loading="loading" @refresh="handleSearch" />
<ListToolbarEndActions
:loading="loading"
:column-defs="listColumnDefs"
v-model:visible-columns="visibleColumns"
v-model:check-all="checkAll"
:is-indeterminate="isIndeterminate"
@refresh="handleSearch"
@reset-columns="resetToDefault"
/>
</div>
</div>
@@ -110,6 +117,7 @@
<el-table-column type="selection" min-width="48" align="center" header-align="center" />
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
<el-table-column
v-if="isColumnVisible('applyTime')"
prop="applyTime"
label="申请时间"
min-width="160"
@@ -120,6 +128,7 @@
<el-table-column
prop="applyCode"
label="报销单号"
class-name="col-apply-code"
min-width="140"
align="center"
header-align="center"
@@ -130,6 +139,7 @@
</template>
</el-table-column>
<el-table-column
v-if="isColumnVisible('title')"
prop="title"
label="报销标题"
min-width="180"
@@ -138,6 +148,7 @@
show-overflow-tooltip
/>
<el-table-column
v-if="isColumnVisible('expenseName')"
prop="expenseName"
label="费用项目"
min-width="140"
@@ -146,6 +157,7 @@
show-overflow-tooltip
/>
<el-table-column
v-if="isColumnVisible('amount')"
prop="amount"
label="报销金额(元)"
:formatter="moneyTableFormatter"
@@ -154,14 +166,28 @@
align="right"
header-align="center"
/>
<el-table-column prop="status" label="状态" min-width="110" align="center" header-align="center">
<el-table-column
v-if="isColumnVisible('status')"
prop="status"
label="状态"
min-width="110"
align="center"
header-align="center"
>
<template #default="{ row }">
<el-tag :type="statusTagType(row.status)" size="small">
{{ statusLabel(row.status) }}
</el-tag>
</template>
</el-table-column>
<el-table-column prop="currentNode" label="当前节点" min-width="120" align="center" header-align="center">
<el-table-column
v-if="isColumnVisible('currentNode')"
prop="currentNode"
label="当前节点"
min-width="120"
align="center"
header-align="center"
>
<template #default="{ row }">
<el-tag
v-if="shouldShowWorkflowNodeTag(row.currentNode, row.status)"
@@ -202,7 +228,7 @@
>
<p class="dlg-note">提交后进入顺序审批流程,可在「查看审批流」中确认节点与审批人。</p>
<el-form label-position="top">
<el-form label-position="right" label-width="100px" class="bx-dialog-form">
<div class="form-grid-2">
<el-form-item label="报销日期">
<el-date-picker
@@ -299,7 +325,7 @@
/>
</div>
<el-form label-position="top">
<el-form label-position="right" label-width="100px" class="bx-dialog-form">
<el-form-item label="备注说明">
<el-input v-model="addForm.remark" type="textarea" :rows="4" placeholder="请输入报销说明" />
</el-form-item>
@@ -424,25 +450,12 @@
<BxAttachmentReadonly :files="viewOffsetAttachments" />
</div>
<div class="dlg-view-section">
<h4 class="dlg-view-section-title">审批进度</h4>
<div class="flow-scroll">
<ApprovalFlowView :nodes="viewFlowNodes" :loading="viewFlowLoading" />
</div>
</div>
<div class="dlg-view-section">
<h4 class="dlg-view-section-title">审批历史</h4>
<div class="flow-scroll">
<ApprovalHistoryView :items="viewApprovalHistory" :loading="viewFlowLoading" />
</div>
</div>
<BxApprovalFlowTabs
:nodes="viewFlowNodes"
:history="viewApprovalHistory"
:loading="viewFlowLoading"
/>
</div>
<template #footer>
<el-button class="btn-ghost" @click="dialogs.view = false">
<el-icon><Close /></el-icon>关闭
</el-button>
</template>
</el-dialog>
<el-dialog
@@ -453,29 +466,15 @@
align-center
destroy-on-close
>
<div class="dlg-view-section">
<h4 class="dlg-view-section-title">审批进度</h4>
<div class="flow-scroll">
<ApprovalFlowView :nodes="flowNodes" :loading="flowLoading" />
</div>
</div>
<div class="dlg-view-section">
<h4 class="dlg-view-section-title">审批历史</h4>
<div class="flow-scroll">
<ApprovalHistoryView :items="flowHistory" :loading="flowLoading" />
</div>
</div>
<template #footer>
<el-button class="btn-ghost" @click="dialogs.viewFlow = false">
<el-icon><Close /></el-icon>关闭
</el-button>
</template>
<BxApprovalFlowTabs :nodes="flowNodes" :history="flowHistory" :loading="flowLoading" />
</el-dialog>
</div>
</template>
<script setup lang="ts">
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
import { usePersistedListColumns } from '@/composables/usePersistedListColumns'
import ListQuickSearchInput from '@/components/business/list-quick-search-input/index.vue'
import { reactive, ref, computed, onMounted } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import {
@@ -496,8 +495,6 @@ import { useExpenseItemTree, type ExpenseItem } from '@/hooks/bx/useExpenseItemT
import {
statusLabel,
statusTagType,
formatSumMoney,
formatMoney,
formatMoneyYuan,
moneyTableFormatter,
workflowNodeDisplay,
@@ -506,14 +503,14 @@ import {
shouldShowWorkflowNodeTag
} from '@/utils/bx/format'
import { useServerPaged } from '@/hooks/bx/useServerPaged'
import ApprovalFlowView from '@/components/bx/base/ApprovalFlowView.vue'
import ApprovalHistoryView from '@/components/bx/base/ApprovalHistoryView.vue'
import BxApprovalFlowTabs from '@/components/bx/base/BxApprovalFlowTabs.vue'
import BxViewKvGrid from '@/components/bx/base/BxViewKvGrid.vue'
import BxViewKvTable from '@/components/bx/base/BxViewKvTable.vue'
import BxAttachmentUpload from '@/components/bx/base/BxAttachmentUpload.vue'
import BxAttachmentReadonly from '@/components/bx/base/BxAttachmentReadonly.vue'
import type { ViewField } from '@/components/business/system-view-dialog/types'
import { bxViewKv, bxViewKvLong, bxViewKvMoney } from '@/utils/bx/view-kv'
import { buildPageSummaryMethod, sumField } from '@/utils/bx/table-summary'
type DialogKey = 'add' | 'view' | 'viewFlow'
@@ -549,37 +546,24 @@ function markDisabledExpenseNodes(tree: ExpenseItem[]): ExpenseItem[] {
const expenseTreeForSelect = computed(() => markDisabledExpenseNodes(expenseTree.value))
const myReimburseStats = ref({
pendingCount: 0,
monthApplyAmount: 0,
approvedAmount: 0,
approvedCount: 0
})
const quickSearchKeyword = ref('')
async function loadMyReimburseStats() {
try {
const res: any = await reimburseApi.myStats()
const d = res.data || {}
myReimburseStats.value = {
pendingCount: Number(d.pendingCount ?? 0),
monthApplyAmount: Number(d.monthApplyAmount ?? 0),
approvedAmount: Number(d.approvedAmount ?? 0),
approvedCount: Number(d.approvedCount ?? 0)
}
} catch {
/* 拦截器已提示 */
}
}
const listColumnDefs = [
{ prop: 'applyTime', label: '申请时间' },
{ prop: 'title', label: '报销标题' },
{ prop: 'expenseName', label: '费用项目' },
{ prop: 'amount', label: '报销金额(元)' },
{ prop: 'status', label: '状态' },
{ prop: 'currentNode', label: '当前节点', defaultVisible: false }
]
const stats = computed(() => {
const s = myReimburseStats.value
return [
{ name: '待审批申请', value: String(s.pendingCount) },
{ name: '本月申请金额(元)', value: formatMoney(s.monthApplyAmount) },
{ name: '已审批金额(元)', value: formatMoney(s.approvedAmount) },
{ name: '已通过申请', value: String(s.approvedCount) }
]
})
const {
visibleColumns,
checkAll,
isIndeterminate,
isColumnVisible,
resetToDefault
} = usePersistedListColumns('bx-reimburse-apply-list-columns', listColumnDefs)
const filterForm = reactive({
keyword: '',
@@ -730,7 +714,7 @@ async function handleToolbarDelete() {
await reimburseApi.delete(row.id)
}
ElMessage.success('删除成功')
await refreshListAndStats()
await refreshList()
} catch (e: any) {
if (e !== 'cancel') {
ElMessage.error(e?.message || '删除失败')
@@ -796,26 +780,44 @@ function onSelectionChange(rows: any[]) {
selectedRows.value = rows
}
async function refreshListAndStats() {
async function refreshList() {
await refresh()
await loadMyReimburseStats()
}
onMounted(() => {
refreshListAndStats()
refreshList()
})
function handleSearch() {
const q: Record<string, string> = { keyword: filterForm.keyword, status: filterForm.status }
function buildSearchQuery() {
const q: Record<string, string> = {}
const kw = (quickSearchKeyword.value.trim() || filterForm.keyword.trim())
if (kw) q.keyword = kw
if (filterForm.status) q.status = filterForm.status
if (filterForm.expenseName) q.expenseName = filterForm.expenseName
if (filterForm.applyDate) q.applyDate = filterForm.applyDate
search(q)
return q
}
function handleSearch() {
quickSearchKeyword.value = ''
search(buildSearchQuery())
}
function handleReset() {
quickSearchKeyword.value = ''
Object.assign(filterForm, { keyword: '', status: '', expenseName: '', applyDate: null })
search()
}
function handleQuickSearch() {
search(buildSearchQuery())
}
function handleQuickSearchClear() {
quickSearchKeyword.value = ''
search(buildSearchQuery())
}
async function handleToolbarSubmit() {
if (selectedRows.value.length === 0) {
ElMessage.warning('请先勾选要提交的报销单')
@@ -827,7 +829,7 @@ async function handleToolbarSubmit() {
await reimburseApi.submit(row.id)
}
ElMessage.success('提交成功')
await refreshListAndStats()
await refreshList()
} catch (e: any) {
ElMessage.error(e?.message || '提交失败')
} finally {
@@ -894,7 +896,7 @@ async function submitAdd() {
addForm.details = [{ expenseItemId: '', amount: '', remark: '' }]
uploadedFiles.value = []
editingId.value = null
await refreshListAndStats()
await refreshList()
} catch (e: any) {
ElMessage.error(e.message || (editingId.value ? '保存失败' : '新增失败'))
} finally {
@@ -982,7 +984,7 @@ async function handleSubmit(row: any) {
try {
await reimburseApi.submit(row.id)
ElMessage.success('提交成功')
await refreshListAndStats()
await refreshList()
} catch (e: any) {
ElMessage.error(e.message || '提交失败')
} finally {
@@ -1004,7 +1006,7 @@ async function handleDelete(row: any) {
loadingMap[`del_${row.id}`] = true
await reimburseApi.delete(row.id)
ElMessage.success('删除成功')
await refreshListAndStats()
await refreshList()
} catch (e: any) {
if (e !== 'cancel') {
ElMessage.error(e?.message || '删除失败')
@@ -1014,13 +1016,11 @@ async function handleDelete(row: any) {
}
}
function summaryMethod(params: { data: any[] }) {
const data = params.data
const n = data.length
const totalAmt = data.reduce((s, r) => s + Number(r.amount || 0), 0)
const lbl = `本页合计(${n}单)`
return ['', '', '', lbl, '', '', formatSumMoney(totalAmt), '', '']
}
const summaryMethod = buildPageSummaryMethod({
sumByProp: {
amount: (data) => sumField(data, 'amount')
}
})
function viewDetailSummary({ columns, data }: { columns: any[]; data: any[] }) {
const sums: string[] = []
+172 -134
View File
@@ -2,13 +2,6 @@
<!-- eslint-disable vue/no-v-model-argument -->
<template>
<div class="page-container">
<div class="stats">
<div v-for="item in stats" :key="item.name" class="stat" :class="{ 'stat-money': item.name.includes('金额') }">
<p class="k">{{ item.name }}</p>
<p class="v">{{ item.value }}</p>
</div>
</div>
<section class="panel">
<div class="panel-top">
<h2 class="title-bar-heading">报销审批</h2>
@@ -16,7 +9,7 @@
<el-tabs
v-model="activeTab"
class="panel-pill-tabs panel-pill-tabs--lg"
class="panel-tabs"
@tab-change="handleTabChange"
>
<!-- 待我审批 -->
@@ -64,41 +57,19 @@
style="width: 100%"
/>
</el-form-item>
</div>
<div
v-show="showMorePendingFilters"
id="reimburse-approve-pending-filter-extra"
class="filter-extra"
>
<div class="filter-grid">
<el-form-item label="当前节点">
<el-select v-model="pendingFilterForm.currentNode" placeholder="请选择节点" clearable>
<el-option label="发起人主管审批" value="发起人主管审批" />
<el-option label="财务复核" value="财务复核" />
<el-option label="总经理审批" value="总经理审批" />
</el-select>
</el-form-item>
<el-form-item label="金额区间(元)">
<el-input v-model="pendingFilterForm.amountRange" placeholder="如 1000-5000" clearable />
</el-form-item>
</div>
<el-form-item label="当前节点">
<el-select v-model="pendingFilterForm.currentNode" placeholder="请选择节点" clearable>
<el-option label="发起人主管审批" value="发起人主管审批" />
<el-option label="财务复核" value="财务复核" />
<el-option label="总经理审批" value="总经理审批" />
</el-select>
</el-form-item>
<el-form-item label="金额区间(元)">
<el-input v-model="pendingFilterForm.amountRange" placeholder="如 1000-5000" clearable />
</el-form-item>
</div>
<div class="filter-actions">
<div class="filter-actions-start">
<button
type="button"
class="btn-link btn-filter-toggle"
:aria-expanded="showMorePendingFilters"
aria-controls="reimburse-approve-pending-filter-extra"
@click="showMorePendingFilters = !showMorePendingFilters"
>
{{ showMorePendingFilters ? '收起更多' : '展开更多' }}
<el-icon>
<ArrowUpBold v-if="showMorePendingFilters" />
<ArrowDownBold v-else />
</el-icon>
</button>
</div>
<div class="filter-actions-start" />
<div class="filter-actions-end">
<el-button class="btn-ghost" :loading="pendingLoading" @click="handlePendingReset">
<el-icon><RefreshLeft /></el-icon>重置
@@ -116,6 +87,12 @@
<div class="list-toolbar-selected">
已选 <span class="sel-num">{{ selectedRows.length }}</span> 项
</div>
<ListQuickSearchInput
v-model="pendingQuickSearchKeyword"
placeholder="报销单号/报销标题"
@search="handlePendingQuickSearch"
@clear="handlePendingQuickSearchClear"
/>
<el-button class="btn-main" type="primary" @click="handleBatchPass">
<el-icon><Check /></el-icon>通过
</el-button>
@@ -123,7 +100,15 @@
<el-icon><Close /></el-icon>驳回
</el-button>
<ListToolbarEndActions :loading="pendingLoading" @refresh="refreshPending" />
<ListToolbarEndActions
:loading="pendingLoading"
:column-defs="listColumnDefs"
v-model:visible-columns="visibleColumns"
v-model:check-all="checkAll"
:is-indeterminate="isIndeterminate"
@refresh="refreshPending"
@reset-columns="resetToDefault"
/>
</div>
</div>
@@ -143,6 +128,7 @@
<el-table-column type="selection" min-width="48" align="center" header-align="center" />
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
<el-table-column
v-if="isColumnVisible('applyTime')"
prop="applyTime"
label="申请时间"
min-width="160"
@@ -153,6 +139,7 @@
<el-table-column
prop="applyCode"
label="报销单号"
class-name="col-apply-code"
min-width="140"
align="center"
header-align="center"
@@ -162,8 +149,16 @@
<el-link type="primary" @click="openView(row)">{{ row.applyCode }}</el-link>
</template>
</el-table-column>
<el-table-column prop="applicantName" label="申请人" min-width="100" align="center" header-align="center" />
<el-table-column
v-if="isColumnVisible('applicantName')"
prop="applicantName"
label="申请人"
min-width="100"
align="center"
header-align="center"
/>
<el-table-column
v-if="isColumnVisible('title')"
prop="title"
label="报销标题"
min-width="180"
@@ -172,6 +167,7 @@
show-overflow-tooltip
/>
<el-table-column
v-if="isColumnVisible('expenseName')"
prop="expenseName"
label="费用项目"
min-width="140"
@@ -180,6 +176,7 @@
show-overflow-tooltip
/>
<el-table-column
v-if="isColumnVisible('amount')"
prop="amount"
label="报销金额(元)"
:formatter="moneyTableFormatter"
@@ -188,7 +185,14 @@
align="right"
header-align="center"
/>
<el-table-column prop="currentNode" label="当前节点" min-width="120" align="center" header-align="center">
<el-table-column
v-if="isColumnVisible('currentNode')"
prop="currentNode"
label="当前节点"
min-width="120"
align="center"
header-align="center"
>
<template #default="{ row }">
<el-tag
v-if="shouldShowWorkflowNodeTag(row.currentNode, row.status)"
@@ -262,41 +266,19 @@
style="width: 100%"
/>
</el-form-item>
</div>
<div
v-show="showMoreApprovedFilters"
id="reimburse-approve-approved-filter-extra"
class="filter-extra"
>
<div class="filter-grid">
<el-form-item label="当前节点">
<el-select v-model="approvedFilterForm.currentNode" placeholder="请选择节点" clearable>
<el-option label="发起人主管审批" value="发起人主管审批" />
<el-option label="财务复核" value="财务复核" />
<el-option label="总经理审批" value="总经理审批" />
</el-select>
</el-form-item>
<el-form-item label="金额区间(元)">
<el-input v-model="approvedFilterForm.amountRange" placeholder="如 1000-5000" clearable />
</el-form-item>
</div>
<el-form-item label="当前节点">
<el-select v-model="approvedFilterForm.currentNode" placeholder="请选择节点" clearable>
<el-option label="发起人主管审批" value="发起人主管审批" />
<el-option label="财务复核" value="财务复核" />
<el-option label="总经理审批" value="总经理审批" />
</el-select>
</el-form-item>
<el-form-item label="金额区间(元)">
<el-input v-model="approvedFilterForm.amountRange" placeholder="如 1000-5000" clearable />
</el-form-item>
</div>
<div class="filter-actions">
<div class="filter-actions-start">
<button
type="button"
class="btn-link btn-filter-toggle"
:aria-expanded="showMoreApprovedFilters"
aria-controls="reimburse-approve-approved-filter-extra"
@click="showMoreApprovedFilters = !showMoreApprovedFilters"
>
{{ showMoreApprovedFilters ? '收起更多' : '展开更多' }}
<el-icon>
<ArrowUpBold v-if="showMoreApprovedFilters" />
<ArrowDownBold v-else />
</el-icon>
</button>
</div>
<div class="filter-actions-start" />
<div class="filter-actions-end">
<el-button class="btn-ghost" :loading="approvedLoading" @click="handleApprovedReset">
<el-icon><RefreshLeft /></el-icon>重置
@@ -309,6 +291,26 @@
</el-form>
</div>
<div class="list-toolbar">
<div class="list-toolbar-row">
<ListQuickSearchInput
v-model="approvedQuickSearchKeyword"
placeholder="报销单号/报销标题"
@search="handleApprovedQuickSearch"
@clear="handleApprovedQuickSearchClear"
/>
<ListToolbarEndActions
:loading="approvedLoading"
:column-defs="listColumnDefs"
v-model:visible-columns="visibleColumns"
v-model:check-all="checkAll"
:is-indeterminate="isIndeterminate"
@refresh="handleApprovedSearch"
@reset-columns="resetToDefault"
/>
</div>
</div>
<div class="list-body list-wrap">
<div class="table-scroll table-page-summary">
<el-table
@@ -323,6 +325,7 @@
>
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
<el-table-column
v-if="isColumnVisible('applyTime')"
prop="applyTime"
label="申请时间"
min-width="160"
@@ -333,6 +336,7 @@
<el-table-column
prop="applyCode"
label="报销单号"
class-name="col-apply-code"
min-width="140"
align="center"
header-align="center"
@@ -342,8 +346,16 @@
<el-link type="primary" @click="openView(row)">{{ row.applyCode }}</el-link>
</template>
</el-table-column>
<el-table-column prop="applicantName" label="申请人" min-width="100" align="center" header-align="center" />
<el-table-column
v-if="isColumnVisible('applicantName')"
prop="applicantName"
label="申请人"
min-width="100"
align="center"
header-align="center"
/>
<el-table-column
v-if="isColumnVisible('title')"
prop="title"
label="报销标题"
min-width="180"
@@ -352,6 +364,7 @@
show-overflow-tooltip
/>
<el-table-column
v-if="isColumnVisible('expenseName')"
prop="expenseName"
label="费用项目"
min-width="140"
@@ -360,6 +373,7 @@
show-overflow-tooltip
/>
<el-table-column
v-if="isColumnVisible('amount')"
prop="amount"
label="报销金额(元)"
:formatter="moneyTableFormatter"
@@ -368,14 +382,28 @@
align="right"
header-align="center"
/>
<el-table-column prop="status" label="状态" min-width="110" align="center" header-align="center">
<el-table-column
v-if="isColumnVisible('status')"
prop="status"
label="状态"
min-width="110"
align="center"
header-align="center"
>
<template #default="{ row }">
<el-tag :type="statusTagType(row.status)" size="small">
{{ statusLabel(row.status) }}
</el-tag>
</template>
</el-table-column>
<el-table-column prop="currentNode" label="当前节点" min-width="120" align="center" header-align="center">
<el-table-column
v-if="isColumnVisible('currentNode')"
prop="currentNode"
label="当前节点"
min-width="120"
align="center"
header-align="center"
>
<template #default="{ row }">
<el-tag
v-if="shouldShowWorkflowNodeTag(row.currentNode, row.status)"
@@ -473,25 +501,12 @@
<BxAttachmentReadonly :files="viewAttachments" />
</div>
<div class="dlg-view-section">
<h4 class="dlg-view-section-title">审批进度</h4>
<div class="flow-scroll">
<ApprovalFlowView :nodes="viewFlowNodes" :loading="viewFlowLoading" />
</div>
</div>
<div class="dlg-view-section">
<h4 class="dlg-view-section-title">审批历史</h4>
<div class="flow-scroll">
<ApprovalHistoryView :items="viewApprovalHistory" :loading="viewFlowLoading" />
</div>
</div>
<BxApprovalFlowTabs
:nodes="viewFlowNodes"
:history="viewApprovalHistory"
:loading="viewFlowLoading"
/>
</div>
<template #footer>
<el-button class="btn-ghost" @click="dialogs.viewDetail = false">
<el-icon><Close /></el-icon>关闭
</el-button>
</template>
</el-dialog>
<!-- 审批确认 -->
@@ -504,7 +519,7 @@
destroy-on-close
:close-on-click-modal="false"
>
<el-form label-position="top">
<el-form label-position="right" label-width="100px" class="bx-dialog-form">
<div class="form-grid-2">
<el-form-item label="审批时间">
<el-input :model-value="approveTime" disabled />
@@ -538,25 +553,23 @@
<script setup lang="ts">
import { reactive, ref, computed, onMounted } from 'vue'
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
import { usePersistedListColumns } from '@/composables/usePersistedListColumns'
import ListQuickSearchInput from '@/components/business/list-quick-search-input/index.vue'
import { ElMessage } from 'element-plus'
import {
View,
Check,
Close,
Search,
RefreshLeft,
ArrowUpBold,
ArrowDownBold
RefreshLeft
} from '@element-plus/icons-vue'
import { reimburseApi } from '@/api/bx'
import { type BxAttachmentItem, loadBxAttachments } from '@/utils/bx/attachment'
import { reimburseApproverStats, refreshApproveMenuBadges } from '@/hooks/bx/useApproveMenuBadge'
import { refreshApproveMenuBadges } from '@/hooks/bx/useApproveMenuBadge'
import { useMenuStore } from '@/store/modules/menu'
import {
statusLabel,
statusTagType,
formatSumMoney,
formatMoney,
formatMoneyYuan,
moneyTableFormatter,
workflowNodeDisplay,
@@ -567,17 +580,36 @@ import {
import { useServerPaged } from '@/hooks/bx/useServerPaged'
import { useExpenseItemTree } from '@/hooks/bx/useExpenseItemTree'
import { useApplicantOptions } from '@/hooks/bx/useApplicantOptions'
import ApprovalFlowView from '@/components/bx/base/ApprovalFlowView.vue'
import ApprovalHistoryView from '@/components/bx/base/ApprovalHistoryView.vue'
import BxApprovalFlowTabs from '@/components/bx/base/BxApprovalFlowTabs.vue'
import BxViewKvTable from '@/components/bx/base/BxViewKvTable.vue'
import BxAttachmentReadonly from '@/components/bx/base/BxAttachmentReadonly.vue'
import type { ViewField } from '@/components/business/system-view-dialog/types'
import { bxViewKv, bxViewKvLong } from '@/utils/bx/view-kv'
import { buildPageSummaryMethod, sumField } from '@/utils/bx/table-summary'
type DialogKey = 'viewDetail' | 'approve'
const showMorePendingFilters = ref(false)
const showMoreApprovedFilters = ref(false)
const listColumnDefs = [
{ prop: 'applyTime', label: '申请时间' },
{ prop: 'applicantName', label: '申请人' },
{ prop: 'title', label: '报销标题' },
{ prop: 'expenseName', label: '费用项目' },
{ prop: 'amount', label: '报销金额(元)' },
{ prop: 'status', label: '状态', defaultVisible: false },
{ prop: 'currentNode', label: '当前节点', defaultVisible: false }
]
const {
visibleColumns,
checkAll,
isIndeterminate,
isColumnVisible,
resetToDefault
} = usePersistedListColumns('bx-reimburse-approve-list-columns', listColumnDefs)
const pendingQuickSearchKeyword = ref('')
const approvedQuickSearchKeyword = ref('')
const { applicantOptions, loadApplicantOptions } = useApplicantOptions()
const { expenseTree } = useExpenseItemTree()
const loadingMap = reactive<Record<string, boolean>>({})
@@ -619,14 +651,6 @@ const tabLoaded = reactive({ pending: false, approved: false })
const activeTab = ref('pending')
const menuStore = useMenuStore()
const stats = computed(() => {
const s = reimburseApproverStats.value
return [
{ name: '待审批', value: String(s.pendingTotal) },
{ name: '本月审批金额(元)', value: formatMoney(s.monthPendingAmount) }
]
})
const viewData = ref<Record<string, any>>({})
const viewMainKvFields = computed<ViewField[]>(() => {
@@ -684,7 +708,7 @@ const approvedFilterForm = reactive({
function buildPendingQuery() {
const q: Record<string, string | number> = {}
const code = pendingFilterForm.code.trim()
const code = (pendingQuickSearchKeyword.value.trim() || pendingFilterForm.code.trim())
if (code) q.keyword = code
if (pendingFilterForm.applicantId != null) q.applicantId = pendingFilterForm.applicantId
if (pendingFilterForm.applyDate) q.applyDate = pendingFilterForm.applyDate
@@ -693,7 +717,7 @@ function buildPendingQuery() {
function buildApprovedQuery() {
const q: Record<string, string | number> = {}
const code = approvedFilterForm.code.trim()
const code = (approvedQuickSearchKeyword.value.trim() || approvedFilterForm.code.trim())
if (code) q.keyword = code
if (approvedFilterForm.applicantId != null) q.applicantId = approvedFilterForm.applicantId
if (approvedFilterForm.applyDate) q.applyDate = approvedFilterForm.applyDate
@@ -719,10 +743,12 @@ function handleTabChange(tab: string | number) {
}
function handlePendingSearch() {
pendingQuickSearchKeyword.value = ''
searchPending(buildPendingQuery())
}
function handlePendingReset() {
pendingQuickSearchKeyword.value = ''
Object.assign(pendingFilterForm, {
code: '',
applicantId: undefined,
@@ -734,11 +760,22 @@ function handlePendingReset() {
searchPending()
}
function handlePendingQuickSearch() {
searchPending(buildPendingQuery())
}
function handlePendingQuickSearchClear() {
pendingQuickSearchKeyword.value = ''
searchPending(buildPendingQuery())
}
function handleApprovedSearch() {
approvedQuickSearchKeyword.value = ''
searchApproved(buildApprovedQuery())
}
function handleApprovedReset() {
approvedQuickSearchKeyword.value = ''
Object.assign(approvedFilterForm, {
code: '',
applicantId: undefined,
@@ -750,6 +787,15 @@ function handleApprovedReset() {
searchApproved()
}
function handleApprovedQuickSearch() {
searchApproved(buildApprovedQuery())
}
function handleApprovedQuickSearchClear() {
approvedQuickSearchKeyword.value = ''
searchApproved(buildApprovedQuery())
}
const selectedRows = ref<any[]>([])
function onSelectionChange(rows: any[]) {
@@ -823,21 +869,13 @@ async function handleConfirmApprove() {
}
}
function pendingSummaryMethod(params: { data: any[] }) {
const data = params.data
const n = data.length
const t = data.reduce((s, r) => s + Number(r.amount || 0), 0)
const lbl = `本页合计(${n}单)`
return ['', '', '', lbl, '', '', '', formatSumMoney(t), '', '']
}
function approvedSummaryMethod(params: { data: any[] }) {
const data = params.data
const n = data.length
const t = data.reduce((s, r) => s + Number(r.amount || 0), 0)
const lbl = `本页合计(${n}单)`
return ['', '', '', lbl, '', '', formatSumMoney(t), '', '', '']
}
const amountSummary = buildPageSummaryMethod({
sumByProp: {
amount: (data) => sumField(data, 'amount')
}
})
const pendingSummaryMethod = amountSummary
const approvedSummaryMethod = amountSummary
function viewDetailSummary({ columns, data }: { columns: any[]; data: any[] }) {
const sums: string[] = []
+79 -124
View File
@@ -2,13 +2,6 @@
<!-- eslint-disable vue/no-v-model-argument -->
<template>
<div class="page-container">
<div class="stats">
<div v-for="item in stats" :key="item.name" class="stat" :class="{ 'stat-money': item.name.includes('金额') }">
<p class="k">{{ item.name }}</p>
<p class="v">{{ item.value }}</p>
</div>
</div>
<section class="panel">
<div class="panel-top">
<h2 class="title-bar-heading">全部申请单</h2>
@@ -40,45 +33,27 @@
<el-option v-for="s in statusOptions" :key="s" :label="s" :value="s" />
</el-select>
</el-form-item>
</div>
<div v-show="showMoreFilters" id="all-apply-filter-extra" class="filter-extra">
<div class="filter-grid">
<el-form-item label="申请时间">
<el-date-picker
v-model="filterForm.applyDate"
type="date"
value-format="YYYY-MM-DD"
placeholder="选择日期"
clearable
style="width: 100%"
/>
</el-form-item>
<el-form-item label="金额区间(元)">
<el-input v-model="filterForm.amountRange" placeholder="如 1000-5000" clearable />
</el-form-item>
<el-form-item label="当前节点">
<el-select v-model="filterForm.currentNode" placeholder="全部" clearable>
<el-option v-for="n in nodeOptions" :key="n" :label="n" :value="n" />
</el-select>
</el-form-item>
</div>
<el-form-item label="申请时间">
<el-date-picker
v-model="filterForm.applyDate"
type="date"
value-format="YYYY-MM-DD"
placeholder="选择日期"
clearable
style="width: 100%"
/>
</el-form-item>
<el-form-item label="金额区间(元)">
<el-input v-model="filterForm.amountRange" placeholder="如 1000-5000" clearable />
</el-form-item>
<el-form-item label="当前节点">
<el-select v-model="filterForm.currentNode" placeholder="全部" clearable>
<el-option v-for="n in nodeOptions" :key="n" :label="n" :value="n" />
</el-select>
</el-form-item>
</div>
<div class="filter-actions">
<div class="filter-actions-start">
<button
type="button"
class="btn-link btn-filter-toggle"
:aria-expanded="showMoreFilters"
aria-controls="all-apply-filter-extra"
@click="toggleMoreFilters"
>
{{ showMoreFilters ? '收起更多' : '展开更多' }}
<el-icon>
<ArrowUpBold v-if="showMoreFilters" />
<ArrowDownBold v-else />
</el-icon>
</button>
</div>
<div class="filter-actions-start" />
<div class="filter-actions-end">
<el-button class="btn-ghost" :loading="loading" @click="handleReset">
<el-icon><RefreshLeft /></el-icon>重置
@@ -93,6 +68,12 @@
<div class="list-toolbar">
<div class="list-toolbar-row">
<ListQuickSearchInput
v-model="quickSearchKeyword"
placeholder="单号/标题/申请人"
@search="handleQuickSearch"
@clear="handleQuickSearchClear"
/>
<ListToolbarEndActions
:loading="loading"
:column-defs="listColumnDefs"
@@ -106,7 +87,7 @@
</div>
<div class="list-body list-wrap">
<div class="table-scroll table-page-summary">
<div class="table-scroll table-page-summary table-page-summary-biz-split">
<el-table
class="list-table"
:data="pager.pagedRows.value"
@@ -115,7 +96,10 @@
show-summary
:summary-method="summaryMethod"
:max-height="'min(520px, calc(100vh - 300px))'"
@row-dblclick="openViewDetail"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" min-width="55" align="center" header-align="center" />
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
<el-table-column
v-if="isColumnVisible('applyTime')"
@@ -129,6 +113,7 @@
<el-table-column
prop="applyCode"
label="申请单号"
class-name="col-apply-code"
min-width="140"
align="center"
header-align="center"
@@ -175,7 +160,7 @@
label="申请金额(元)"
:formatter="moneyTableFormatter"
class-name="col-money"
min-width="120"
min-width="240"
align="right"
header-align="center"
/>
@@ -259,41 +244,28 @@
<h4 class="dlg-view-section-title">基础信息</h4>
<BxViewKvTable :fields="viewDetailKvFields" mode="triple" />
</div>
<div class="dlg-view-section">
<h4 class="dlg-view-section-title">审批进度</h4>
<div class="flow-scroll">
<ApprovalFlowView :nodes="viewFlowNodes" :loading="viewFlowLoading" />
</div>
</div>
<div class="dlg-view-section">
<h4 class="dlg-view-section-title">审批历史</h4>
<div class="flow-scroll">
<ApprovalHistoryView :items="viewApprovalHistory" :loading="viewFlowLoading" />
</div>
</div>
<BxApprovalFlowTabs
:nodes="viewFlowNodes"
:history="viewApprovalHistory"
:loading="viewFlowLoading"
/>
</div>
<template #footer>
<el-button class="btn-ghost" @click="dialogs.viewDetail = false">
<el-icon><Close /></el-icon>关闭
</el-button>
</template>
</el-dialog>
</div>
</template>
<script setup lang="ts">
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
import ListQuickSearchInput from '@/components/business/list-quick-search-input/index.vue'
import { usePersistedListColumns } from '@/composables/usePersistedListColumns'
import { computed, onMounted, reactive, ref } from 'vue'
import { ElMessage } from 'element-plus'
import { Close, Search, RefreshLeft, ArrowUpBold, ArrowDownBold } from '@element-plus/icons-vue'
import { Close, Search, RefreshLeft } from '@element-plus/icons-vue'
import { advanceApi, reimburseApi } from '@/api/bx'
import {
bizTypeTagType,
statusLabel,
statusTagType,
formatSumMoney,
formatMoneyYuan,
moneyTableFormatter,
workflowNodeDisplay,
@@ -301,18 +273,18 @@ import {
workflowNodeTagType,
shouldShowWorkflowNodeTag
} from '@/utils/bx/format'
import ApprovalFlowView from '@/components/bx/base/ApprovalFlowView.vue'
import ApprovalHistoryView from '@/components/bx/base/ApprovalHistoryView.vue'
import BxApprovalFlowTabs from '@/components/bx/base/BxApprovalFlowTabs.vue'
import BxViewKvTable from '@/components/bx/base/BxViewKvTable.vue'
import type { ViewField } from '@/components/business/system-view-dialog/types'
import { bxViewKv, bxViewKvMoney } from '@/utils/bx/view-kv'
import { buildPageSummaryMethod, sumFieldByBizType } from '@/utils/bx/table-summary'
import { usePagedTable } from '@/hooks/bx/usePagedTable'
import { useApplicantOptions } from '@/hooks/bx/useApplicantOptions'
type DialogKey = 'viewDetail'
const showMoreFilters = ref(false)
const loading = ref(false)
const selectedRows = ref<any[]>([])
const dialogs = reactive<Record<DialogKey, boolean>>({
viewDetail: false
})
@@ -338,6 +310,8 @@ const {
resetToDefault
} = usePersistedListColumns('bx-view-all-list-columns', listColumnDefs)
const quickSearchKeyword = ref('')
const filterForm = reactive({
code: '',
bizType: '' as string,
@@ -350,6 +324,21 @@ const filterForm = reactive({
function filterMergedRows(rows: any[]) {
let list = [...rows]
const quickKw = quickSearchKeyword.value.trim().toLowerCase()
if (quickKw) {
list = list.filter(
(r: any) =>
String(r.applyCode || '')
.toLowerCase()
.includes(quickKw) ||
String(r.title || '')
.toLowerCase()
.includes(quickKw) ||
String(r.applicantName || '')
.toLowerCase()
.includes(quickKw)
)
}
const code = filterForm.code.trim()
if (code) list = list.filter((r: any) => String(r.applyCode || '').includes(code))
if (filterForm.bizType && filterForm.bizType !== '全部') {
@@ -415,35 +404,16 @@ const viewFlowNodes = ref<any[]>([])
const viewApprovalHistory = ref<any[]>([])
const viewFlowLoading = ref(false)
const stats = ref([
{ name: '全部单据', value: '-' },
{ name: '审批中', value: '-' },
{ name: '已通过', value: '-' },
{ name: '已发放', value: '-' },
{ name: '已驳回', value: '-' }
])
const bizTypeOptions = ['全部', '报销单', '备用金']
const statusOptions = ['全部', '待提交', '审批中', '审批通过', '审批驳回', '已发放']
const nodeOptions = ['全部', '草稿', '发起人主管审批', '财务复核', '总经理审批', '已完成', '已驳回', '已发放']
function countStatus(m: Record<string, number> | undefined, key: string) {
return Number(m?.[key] ?? 0)
}
function sumStatusMap(m: Record<string, number> | undefined) {
if (!m) return 0
return Object.values(m).reduce((acc, v) => acc + Number(v || 0), 0)
}
async function loadData() {
loading.value = true
try {
const [advRes, reimRes, advCntRes, reimCntRes]: any[] = await Promise.all([
const [advRes, reimRes]: any[] = await Promise.all([
advanceApi.list({ page: 1, pageSize: 999 }),
reimburseApi.list({ page: 1, pageSize: 999 }),
advanceApi.statusCounts(),
reimburseApi.statusCounts()
reimburseApi.list({ page: 1, pageSize: 999 })
])
const advRows = (advRes.data?.rows || []).map((r: any) => ({
...r,
@@ -462,24 +432,6 @@ async function loadData() {
applicantId: r.applicantId
}))
mergedRows.value = [...advRows, ...reimRows]
const ac = advCntRes.data as Record<string, number> | undefined
const rc = reimCntRes.data as Record<string, number> | undefined
const totalAll = sumStatusMap(rc) + sumStatusMap(ac)
const pending = countStatus(rc, 'pending') + countStatus(ac, 'pending')
const approved = countStatus(rc, 'approved') + countStatus(ac, 'approved')
const issued =
countStatus(rc, 'processed') +
countStatus(rc, 'paid') +
countStatus(rc, 'offset') +
countStatus(ac, 'issued')
const rejected = countStatus(rc, 'rejected') + countStatus(ac, 'rejected')
stats.value = [
{ name: '全部单据', value: String(totalAll) },
{ name: '审批中', value: String(pending) },
{ name: '已通过', value: String(approved) },
{ name: '已发放', value: String(issued) },
{ name: '已驳回', value: String(rejected) }
]
} catch {
// error handled by interceptor
} finally {
@@ -487,15 +439,13 @@ async function loadData() {
}
}
function toggleMoreFilters() {
showMoreFilters.value = !showMoreFilters.value
}
function handleSearch() {
quickSearchKeyword.value = ''
pager.currentPage.value = 1
}
function handleReset() {
quickSearchKeyword.value = ''
Object.assign(filterForm, {
code: '',
bizType: '',
@@ -508,18 +458,23 @@ function handleReset() {
pager.currentPage.value = 1
}
function summaryMethod(params: { columns: { property?: string; type?: string }[]; data: Array<{ amount?: number }> }) {
const totalAmount = params.data.reduce((sum, row) => sum + Number(row.amount || 0), 0)
let labelPlaced = false
return params.columns.map((col) => {
if (col.type === 'index') return ''
if (!labelPlaced) {
labelPlaced = true
return `本页合计(${params.data.length}单)`
}
if (col.property === 'amount') return formatSumMoney(totalAmount)
return ''
})
function handleQuickSearch() {
pager.currentPage.value = 1
}
function handleQuickSearchClear() {
quickSearchKeyword.value = ''
pager.currentPage.value = 1
}
const summaryMethod = buildPageSummaryMethod({
sumByProp: {
amount: (data) => sumFieldByBizType(data, 'amount')
}
})
function handleSelectionChange(rows: any[]) {
selectedRows.value = rows
}
async function openViewDetail(row: any) {
+63 -80
View File
@@ -2,13 +2,6 @@
<!-- eslint-disable vue/no-v-model-argument -->
<template>
<div class="page-container">
<div class="stats">
<div v-for="item in stats" :key="item.name" class="stat" :class="{ 'stat-money': item.name.includes('金额') }">
<p class="k">{{ item.name }}</p>
<p class="v">{{ item.value }}</p>
</div>
</div>
<section class="panel">
<div class="panel-top">
<h2 class="title-bar-heading">我的申请单</h2>
@@ -47,30 +40,12 @@
style="width: 100%"
/>
</el-form-item>
</div>
<div v-show="showMoreFilters" id="mine-apply-filter-extra" class="filter-extra">
<div class="filter-grid">
<el-form-item label="金额区间(元)">
<el-input v-model="filterForm.amountRange" placeholder="如 1000-5000" clearable />
</el-form-item>
</div>
<el-form-item label="金额区间(元)">
<el-input v-model="filterForm.amountRange" placeholder="如 1000-5000" clearable />
</el-form-item>
</div>
<div class="filter-actions">
<div class="filter-actions-start">
<button
type="button"
class="btn-link btn-filter-toggle"
:aria-expanded="showMoreFilters"
aria-controls="mine-apply-filter-extra"
@click="toggleMoreFilters"
>
{{ showMoreFilters ? '收起更多' : '展开更多' }}
<el-icon>
<ArrowUpBold v-if="showMoreFilters" />
<ArrowDownBold v-else />
</el-icon>
</button>
</div>
<div class="filter-actions-start" />
<div class="filter-actions-end">
<el-button native-type="button" class="btn-ghost" :loading="searchLoading" @click="handleReset">
<el-icon><RefreshLeft /></el-icon>重置
@@ -85,6 +60,12 @@
<div class="list-toolbar">
<div class="list-toolbar-row">
<ListQuickSearchInput
v-model="quickSearchKeyword"
placeholder="单号/申请标题"
@search="handleQuickSearch"
@clear="handleQuickSearchClear"
/>
<ListToolbarEndActions
:loading="tableLoading"
:column-defs="listColumnDefs"
@@ -98,14 +79,19 @@
</div>
<div class="list-body list-wrap">
<div class="table-scroll">
<div class="table-scroll table-page-summary table-page-summary-biz-split">
<el-table
class="list-table"
:data="pagedRows"
v-loading="tableLoading"
stripe
show-summary
:summary-method="summaryMethod"
:max-height="'min(520px, calc(100vh - 300px))'"
@row-dblclick="openViewDetail"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" min-width="55" align="center" header-align="center" />
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
<el-table-column
v-if="isColumnVisible('applyTime')"
@@ -157,7 +143,7 @@
label="申请金额(元)"
:formatter="moneyTableFormatter"
class-name="col-money"
min-width="120"
min-width="240"
align="right"
header-align="center"
/>
@@ -240,35 +226,23 @@
<h4 class="dlg-view-section-title">基础信息</h4>
<BxViewKvTable :fields="viewDetailKvFields" mode="triple" />
</div>
<div class="dlg-view-section">
<h4 class="dlg-view-section-title">审批进度</h4>
<div class="flow-scroll">
<ApprovalFlowView :nodes="viewFlowNodes" :loading="viewFlowLoading" />
</div>
</div>
<div class="dlg-view-section">
<h4 class="dlg-view-section-title">审批历史</h4>
<div class="flow-scroll">
<ApprovalHistoryView :items="viewApprovalHistory" :loading="viewFlowLoading" />
</div>
</div>
<BxApprovalFlowTabs
:nodes="viewFlowNodes"
:history="viewApprovalHistory"
:loading="viewFlowLoading"
/>
</div>
<template #footer>
<el-button class="btn-ghost" @click="dialogs.viewDetail = false">
<el-icon><Close /></el-icon>关闭
</el-button>
</template>
</el-dialog>
</div>
</template>
<script setup lang="ts">
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
import ListQuickSearchInput from '@/components/business/list-quick-search-input/index.vue'
import { usePersistedListColumns } from '@/composables/usePersistedListColumns'
import { computed, onActivated, onMounted, reactive, ref } from 'vue'
import { ElMessage } from 'element-plus'
import { Close, Search, RefreshLeft, ArrowUpBold, ArrowDownBold } from '@element-plus/icons-vue'
import { Close, Search, RefreshLeft } from '@element-plus/icons-vue'
import { advanceApi, reimburseApi } from '@/api/bx'
import {
bizTypeTagType,
@@ -281,18 +255,18 @@ import {
workflowNodeTagType,
shouldShowWorkflowNodeTag
} from '@/utils/bx/format'
import ApprovalFlowView from '@/components/bx/base/ApprovalFlowView.vue'
import ApprovalHistoryView from '@/components/bx/base/ApprovalHistoryView.vue'
import BxApprovalFlowTabs from '@/components/bx/base/BxApprovalFlowTabs.vue'
import BxViewKvTable from '@/components/bx/base/BxViewKvTable.vue'
import type { ViewField } from '@/components/business/system-view-dialog/types'
import { bxViewKv, bxViewKvMoney } from '@/utils/bx/view-kv'
import { buildPageSummaryMethod, sumFieldByBizType } from '@/utils/bx/table-summary'
import { usePagedTable } from '@/hooks/bx/usePagedTable'
type DialogKey = 'viewDetail'
const showMoreFilters = ref(false)
const tableLoading = ref(false)
const searchLoading = ref(false)
const selectedRows = ref<any[]>([])
const dialogs = reactive<Record<DialogKey, boolean>>({
viewDetail: false
})
@@ -316,6 +290,8 @@ const {
resetToDefault
} = usePersistedListColumns('bx-view-mine-list-columns', listColumnDefs)
const quickSearchKeyword = ref('')
const filterForm = reactive({
code: '',
bizType: '' as string,
@@ -338,6 +314,13 @@ function syncAppliedFilter() {
function filterMineRows(rows: any[]) {
let list = [...rows]
const kw = appliedFilter.code.trim()
if (kw) {
list = list.filter(
(r: any) =>
String(r.applyCode || '').includes(kw) || String(r.title || '').includes(kw)
)
}
if (appliedFilter.bizType) {
list = list.filter((r: any) => r.bizType === appliedFilter.bizType)
}
@@ -383,13 +366,6 @@ const viewFlowNodes = ref<any[]>([])
const viewApprovalHistory = ref<any[]>([])
const viewFlowLoading = ref(false)
const stats = ref([
{ name: '全部申请', value: '-' },
{ name: '审批中', value: '-' },
{ name: '已通过', value: '-' },
{ name: '已驳回', value: '-' }
])
function buildApiQuery() {
const q: Record<string, string> = {}
const code = appliedFilter.code.trim()
@@ -421,17 +397,21 @@ function sortMergedRows(rows: any[]) {
return [...rows].sort((a, b) => String(b.applyTime || '').localeCompare(String(a.applyTime || '')))
}
const summaryMethod = buildPageSummaryMethod({
sumByProp: {
amount: (data) => sumFieldByBizType(data, 'amount')
}
})
async function loadData(options: { buttonLoading?: boolean } = {}) {
if (options.buttonLoading) searchLoading.value = true
tableLoading.value = true
try {
const apiQuery = buildApiQuery()
const listParams = { page: 1, pageSize: 9999, ...apiQuery }
const [advRes, reimRes, advSt, reimSt] = await Promise.allSettled([
const [advRes, reimRes] = await Promise.allSettled([
advanceApi.my(listParams),
reimburseApi.my(listParams),
advanceApi.myStats(),
reimburseApi.myStats()
reimburseApi.my(listParams)
])
const advRows =
advRes.status === 'fulfilled'
@@ -442,19 +422,6 @@ async function loadData(options: { buttonLoading?: boolean } = {}) {
? (reimRes.value.data?.rows || []).map(mapReimburseMineRow)
: []
mergedRows.value = sortMergedRows([...advRows, ...reimRows])
const a = advSt.status === 'fulfilled' ? advSt.value.data || {} : {}
const r = reimSt.status === 'fulfilled' ? reimSt.value.data || {} : {}
const totalCount = Number(r.totalCount ?? 0) + Number(a.totalCount ?? 0)
const pending = Number(r.pendingCount ?? 0) + Number(a.pendingCount ?? 0)
const approved =
Number(r.approvedCount ?? 0) + Number(a.approvedPassCount ?? 0) + Number(a.issuedCount ?? 0)
const rejected = Number(r.rejectedCount ?? 0) + Number(a.rejectedCount ?? 0)
stats.value = [
{ name: '全部申请', value: String(totalCount) },
{ name: '审批中', value: String(pending) },
{ name: '已通过', value: String(approved) },
{ name: '已驳回', value: String(rejected) }
]
} catch {
// error handled by interceptor
} finally {
@@ -463,23 +430,39 @@ async function loadData(options: { buttonLoading?: boolean } = {}) {
}
}
function toggleMoreFilters() {
showMoreFilters.value = !showMoreFilters.value
}
function handleSearch() {
quickSearchKeyword.value = ''
syncAppliedFilter()
currentPage.value = 1
loadData({ buttonLoading: true })
}
function handleReset() {
quickSearchKeyword.value = ''
Object.assign(filterForm, { code: '', bizType: '', status: '', applyDate: null, amountRange: '' })
Object.assign(appliedFilter, { code: '', bizType: '', status: '', applyDate: null, amountRange: '' })
currentPage.value = 1
loadData({ buttonLoading: true })
}
function handleQuickSearch() {
appliedFilter.code = quickSearchKeyword.value.trim()
currentPage.value = 1
loadData()
}
function handleQuickSearchClear() {
quickSearchKeyword.value = ''
appliedFilter.code = ''
currentPage.value = 1
loadData()
}
function handleSelectionChange(rows: any[]) {
selectedRows.value = rows
}
async function openViewDetail(row: any) {
currentRow.value = row
viewFlowNodes.value = []
+105 -84
View File
@@ -2,13 +2,6 @@
<!-- eslint-disable vue/no-v-model-argument -->
<template>
<div class="page-container">
<div class="stats">
<div v-for="item in stats" :key="item.name" class="stat" :class="{ 'stat-money': item.name.includes('金额') }">
<p class="k">{{ item.name }}</p>
<p class="v">{{ item.value }}</p>
</div>
</div>
<section class="panel">
<div class="panel-top">
<h2 class="title-bar-heading">待我审批</h2>
@@ -46,30 +39,12 @@
style="width: 100%"
/>
</el-form-item>
</div>
<div v-show="showMoreFilters" id="todo-approve-filter-extra" class="filter-extra">
<div class="filter-grid">
<el-form-item label="金额区间(元)">
<el-input v-model="filterForm.amountRange" placeholder="如 1000-5000" clearable />
</el-form-item>
</div>
<el-form-item label="金额区间(元)">
<el-input v-model="filterForm.amountRange" placeholder="如 1000-5000" clearable />
</el-form-item>
</div>
<div class="filter-actions">
<div class="filter-actions-start">
<button
type="button"
class="btn-link btn-filter-toggle"
:aria-expanded="showMoreFilters"
aria-controls="todo-approve-filter-extra"
@click="toggleMoreFilters"
>
{{ showMoreFilters ? '收起更多' : '展开更多' }}
<el-icon>
<ArrowUpBold v-if="showMoreFilters" />
<ArrowDownBold v-else />
</el-icon>
</button>
</div>
<div class="filter-actions-start" />
<div class="filter-actions-end">
<el-button native-type="button" class="btn-ghost" :loading="searchLoading" @click="handleReset">
<el-icon><RefreshLeft /></el-icon>重置
@@ -87,6 +62,12 @@
<div class="list-toolbar-selected">
已选 <span class="sel-num">{{ selectedRows.length }}</span> 项
</div>
<ListQuickSearchInput
v-model="quickSearchKeyword"
placeholder="单号/标题/申请人"
@search="handleQuickSearch"
@clear="handleQuickSearchClear"
/>
<el-button class="btn-main" type="primary" :loading="loadingMap.batchPass" @click="handleBatchPass">
<el-icon><Check /></el-icon>批量通过
</el-button>
@@ -94,7 +75,15 @@
<el-icon><Close /></el-icon>批量驳回
</el-button>
<ListToolbarEndActions :loading="tableLoading" @refresh="loadData" />
<ListToolbarEndActions
:loading="tableLoading"
:column-defs="listColumnDefs"
v-model:visible-columns="visibleColumns"
v-model:check-all="checkAll"
:is-indeterminate="isIndeterminate"
@refresh="loadData"
@reset-columns="resetToDefault"
/>
</div>
</div>
@@ -114,6 +103,7 @@
<el-table-column type="selection" min-width="48" align="center" header-align="center" />
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
<el-table-column
v-if="isColumnVisible('applyTime')"
prop="applyTime"
label="申请时间"
min-width="160"
@@ -124,6 +114,7 @@
<el-table-column
prop="applyCode"
label="申请单号"
class-name="col-apply-code"
min-width="140"
align="center"
header-align="center"
@@ -133,15 +124,30 @@
<el-link type="primary" @click="openViewDetail(row)">{{ row.applyCode }}</el-link>
</template>
</el-table-column>
<el-table-column prop="bizType" label="业务类型" min-width="100" align="center" header-align="center">
<el-table-column
v-if="isColumnVisible('bizType')"
prop="bizType"
label="业务类型"
min-width="100"
align="center"
header-align="center"
>
<template #default="{ row }">
<el-tag :type="bizTypeTagType(row.bizType)" size="small">
{{ row.bizType }}
</el-tag>
</template>
</el-table-column>
<el-table-column prop="applicantName" label="申请人" min-width="100" align="center" header-align="center" />
<el-table-column
v-if="isColumnVisible('applicantName')"
prop="applicantName"
label="申请人"
min-width="100"
align="center"
header-align="center"
/>
<el-table-column
v-if="isColumnVisible('title')"
prop="title"
label="申请标题"
min-width="180"
@@ -150,6 +156,7 @@
show-overflow-tooltip
/>
<el-table-column
v-if="isColumnVisible('amount')"
prop="amount"
label="申请金额(元)"
:formatter="moneyTableFormatter"
@@ -158,7 +165,14 @@
align="right"
header-align="center"
/>
<el-table-column prop="currentNode" label="当前节点" min-width="120" align="center" header-align="center">
<el-table-column
v-if="isColumnVisible('currentNode')"
prop="currentNode"
label="当前节点"
min-width="120"
align="center"
header-align="center"
>
<template #default="{ row }">
<el-tag
v-if="shouldShowWorkflowNodeTag(row.currentNode, row.status)"
@@ -234,25 +248,12 @@
<h4 class="dlg-view-section-title">基础信息</h4>
<BxViewKvTable :fields="viewDetailKvFields" mode="triple" />
</div>
<div class="dlg-view-section">
<h4 class="dlg-view-section-title">审批进度</h4>
<div class="flow-scroll">
<ApprovalFlowView :nodes="viewFlowNodes" :loading="viewFlowLoading" />
</div>
</div>
<div class="dlg-view-section">
<h4 class="dlg-view-section-title">审批历史</h4>
<div class="flow-scroll">
<ApprovalHistoryView :items="viewApprovalHistory" :loading="viewFlowLoading" />
</div>
</div>
<BxApprovalFlowTabs
:nodes="viewFlowNodes"
:history="viewApprovalHistory"
:loading="viewFlowLoading"
/>
</div>
<template #footer>
<el-button class="btn-ghost" @click="dialogs.viewDetail = false">
<el-icon><Close /></el-icon>关闭
</el-button>
</template>
</el-dialog>
<el-dialog
@@ -264,7 +265,7 @@
destroy-on-close
:close-on-click-modal="false"
>
<el-form label-position="top">
<el-form label-position="right" label-width="100px" class="bx-dialog-form">
<el-form-item label="审批意见">
<el-input v-model="approveOpinion" type="textarea" :rows="4" placeholder="请输入审批意见" />
</el-form-item>
@@ -286,20 +287,19 @@
<script setup lang="ts">
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
import { usePersistedListColumns } from '@/composables/usePersistedListColumns'
import ListQuickSearchInput from '@/components/business/list-quick-search-input/index.vue'
import { computed, onActivated, onMounted, reactive, ref } from 'vue'
import { ElMessage } from 'element-plus'
import {
Check,
Close,
Search,
RefreshLeft,
ArrowUpBold,
ArrowDownBold
RefreshLeft
} from '@element-plus/icons-vue'
import { advanceApi, reimburseApi } from '@/api/bx'
import {
bizTypeTagType,
formatSumMoney,
formatMoneyYuan,
moneyTableFormatter,
workflowNodeDisplay,
@@ -307,17 +307,16 @@ import {
workflowNodeLabel,
workflowNodeTagType
} from '@/utils/bx/format'
import ApprovalFlowView from '@/components/bx/base/ApprovalFlowView.vue'
import ApprovalHistoryView from '@/components/bx/base/ApprovalHistoryView.vue'
import BxApprovalFlowTabs from '@/components/bx/base/BxApprovalFlowTabs.vue'
import BxViewKvTable from '@/components/bx/base/BxViewKvTable.vue'
import type { ViewField } from '@/components/business/system-view-dialog/types'
import { bxViewKv, bxViewKvMoney } from '@/utils/bx/view-kv'
import { buildPageSummaryMethod, sumField } from '@/utils/bx/table-summary'
import { usePagedTable } from '@/hooks/bx/usePagedTable'
import { useApplicantOptions } from '@/hooks/bx/useApplicantOptions'
type DialogKey = 'viewDetail' | 'approve'
const showMoreFilters = ref(false)
const tableLoading = ref(false)
const searchLoading = ref(false)
const loadingMap = reactive<Record<string, boolean>>({})
@@ -329,6 +328,25 @@ const dialogs = reactive<Record<DialogKey, boolean>>({
const mergedRows = ref<any[]>([])
const { applicantOptions, loadApplicantOptions } = useApplicantOptions()
const quickSearchKeyword = ref('')
const listColumnDefs = [
{ prop: 'applyTime', label: '申请时间' },
{ prop: 'bizType', label: '业务类型' },
{ prop: 'applicantName', label: '申请人' },
{ prop: 'title', label: '申请标题' },
{ prop: 'amount', label: '申请金额(元)' },
{ prop: 'currentNode', label: '当前节点', defaultVisible: false }
]
const {
visibleColumns,
checkAll,
isIndeterminate,
isColumnVisible,
resetToDefault
} = usePersistedListColumns('bx-view-todo-list-columns', listColumnDefs)
const filterForm = reactive({
code: '',
bizType: '' as string,
@@ -351,6 +369,15 @@ function syncAppliedFilter() {
function filterTodoRows(rows: any[]) {
let list = [...rows]
const kw = appliedFilter.code.trim()
if (kw) {
list = list.filter(
(r: any) =>
String(r.applyCode || '').includes(kw) ||
String(r.title || '').includes(kw) ||
String(r.applicantName || '').includes(kw)
)
}
if (appliedFilter.bizType) {
list = list.filter((r: any) => r.bizType === appliedFilter.bizType)
}
@@ -397,14 +424,6 @@ const viewFlowNodes = ref<any[]>([])
const viewApprovalHistory = ref<any[]>([])
const viewFlowLoading = ref(false)
const stats = ref([
{ name: '待审批报销', value: '-' },
{ name: '待审批备用金', value: '-' },
{ name: '待审批合计', value: '-' },
{ name: '紧急单据', value: '0' }
])
function buildApiQuery() {
const q: Record<string, string | number> = {}
const code = appliedFilter.code.trim()
@@ -452,16 +471,6 @@ async function loadData(options: { buttonLoading?: boolean } = {}) {
const reimRows =
reimRes.status === 'fulfilled' ? (reimRes.value.data?.rows || []).map(mapReimburseTodoRow) : []
mergedRows.value = [...advRows, ...reimRows]
const reimTotal =
reimRes.status === 'fulfilled' ? Number(reimRes.value.data?.total ?? reimRows.length) : 0
const advTotal =
advRes.status === 'fulfilled' ? Number(advRes.value.data?.total ?? advRows.length) : 0
stats.value = [
{ name: '待审批报销', value: String(reimTotal) },
{ name: '待审批备用金', value: String(advTotal) },
{ name: '待审批合计', value: String(reimTotal + advTotal) },
{ name: '紧急单据', value: '0' }
]
} catch {
// error handled by interceptor
} finally {
@@ -523,10 +532,6 @@ async function handleDialogReject() {
}
}
function toggleMoreFilters() {
showMoreFilters.value = !showMoreFilters.value
}
const selectedRows = ref<any[]>([])
function onSelectionChange(rows: any[]) {
@@ -574,12 +579,14 @@ async function handleBatchReject() {
}
function handleSearch() {
quickSearchKeyword.value = ''
syncAppliedFilter()
currentPage.value = 1
loadData({ buttonLoading: true })
}
function handleReset() {
quickSearchKeyword.value = ''
Object.assign(filterForm, {
code: '',
bizType: '',
@@ -598,11 +605,25 @@ function handleReset() {
loadData({ buttonLoading: true })
}
function summaryMethod(params: { data: Array<{ amount?: number }> }) {
const totalAmount = params.data.reduce((sum, row) => sum + Number(row.amount || 0), 0)
return ['', '', `本页合计(${params.data.length}单)`, '', '', '', '', formatSumMoney(totalAmount), '', '']
function handleQuickSearch() {
appliedFilter.code = quickSearchKeyword.value.trim()
currentPage.value = 1
loadData()
}
function handleQuickSearchClear() {
quickSearchKeyword.value = ''
appliedFilter.code = ''
currentPage.value = 1
loadData()
}
const summaryMethod = buildPageSummaryMethod({
sumByProp: {
amount: (data) => sumField(data, 'amount')
}
})
function openViewDetailFromRow(row: any) {
openViewDetail(row)
}
@@ -22,6 +22,12 @@
<div class="list-toolbar-selected">
已选 <span class="sel-num">{{ selectedRows.length }}</span> 项
</div>
<ListQuickSearchInput
v-model="quickSearchKeyword"
placeholder="节点名称/审批人"
@search="handleQuickSearch"
@clear="handleQuickSearchClear"
/>
<el-button class="btn-main" type="primary" @click="openAddDialog">
<el-icon><Plus /></el-icon>新增节点
</el-button>
@@ -52,17 +58,26 @@
<el-icon><Upload /></el-icon>保存配置
</el-button>
<ListToolbarEndActions :loading="loading" @refresh="loadWfDef" />
<ListToolbarEndActions
:loading="loading"
:column-defs="listColumnDefs"
v-model:visible-columns="visibleColumns"
v-model:check-all="checkAll"
:is-indeterminate="isIndeterminate"
@refresh="loadWfDef"
@reset-columns="resetToDefault"
/>
</div>
</div>
<div class="list-body list-wrap">
<el-table
class="list-table"
:data="nodes"
:data="filteredNodes"
v-loading="loading"
stripe
@selection-change="onSelectionChange"
@row-dblclick="openEditDialog"
>
<el-table-column type="selection" min-width="48" align="center" header-align="center" />
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
@@ -74,8 +89,16 @@
header-align="center"
show-overflow-tooltip
/>
<el-table-column prop="nodeOrder" label="节点顺序" min-width="100" align="center" header-align="center" />
<el-table-column
v-if="isColumnVisible('nodeOrder')"
prop="nodeOrder"
label="节点顺序"
min-width="100"
align="center"
header-align="center"
/>
<el-table-column
v-if="isColumnVisible('approverName')"
prop="approverName"
label="审批人"
min-width="120"
@@ -83,7 +106,13 @@
header-align="center"
show-overflow-tooltip
/>
<el-table-column label="配置状态" min-width="110" align="center" header-align="center">
<el-table-column
v-if="isColumnVisible('configStatus')"
label="配置状态"
min-width="110"
align="center"
header-align="center"
>
<template #default="{ row }">
<el-tag :type="(row.approverId ?? row.approver_id) ? 'success' : 'warning'" size="small">
{{ (row.approverId ?? row.approver_id) ? '已配置' : '未配置' }}
@@ -107,7 +136,9 @@
ref="addFormRef"
:model="formData"
:rules="formRules"
label-position="top"
label-position="right"
label-width="100px"
class="bx-dialog-form"
scroll-to-error
:scroll-into-view-options="{ behavior: 'smooth', block: 'center' }"
>
@@ -155,7 +186,9 @@
ref="editFormRef"
:model="formData"
:rules="formRules"
label-position="top"
label-position="right"
label-width="100px"
class="bx-dialog-form"
scroll-to-error
:scroll-into-view-options="{ behavior: 'smooth', block: 'center' }"
>
@@ -195,6 +228,8 @@
<script setup lang="ts">
import { reactive, ref, computed, onMounted } from 'vue'
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
import ListQuickSearchInput from '@/components/business/list-quick-search-input/index.vue'
import { usePersistedListColumns } from '@/composables/usePersistedListColumns'
import { canDeleteByCreator, filterDeletableByCreator, allRowsDeletableByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
import { ElMessage, ElMessageBox } from 'element-plus'
import type { FormInstance } from 'element-plus'
@@ -220,10 +255,39 @@ const dialogs = reactive<Record<DialogKey, boolean>>({
editNode: false
})
const quickSearchKeyword = ref('')
const listColumnDefs = [
{ prop: 'nodeOrder', label: '节点顺序' },
{ prop: 'approverName', label: '审批人' },
{ prop: 'configStatus', label: '配置状态' }
]
const {
visibleColumns,
checkAll,
isIndeterminate,
isColumnVisible,
resetToDefault
} = usePersistedListColumns('bx-workflow-advance-list-columns', listColumnDefs)
const loading = ref(false)
const selectedRows = ref<Record<string, any>[]>([])
const wfDef = ref<Record<string, any>>({})
const nodes = computed(() => wfDef.value.nodes || [])
const allNodes = computed(() => wfDef.value.nodes || [])
const filteredNodes = computed(() => {
const kw = quickSearchKeyword.value.trim().toLowerCase()
if (!kw) return allNodes.value
return allNodes.value.filter(
(n: any) =>
String(n.nodeName || '')
.toLowerCase()
.includes(kw) ||
String(n.approverName || '')
.toLowerCase()
.includes(kw)
)
})
const nodes = allNodes
const userOptions = ref<
{ id: string; realName: string; username: string; roles: string; displayName: string }[]
>([])
@@ -283,6 +347,14 @@ function onSelectionChange(rows: Record<string, any>[]) {
selectedRows.value = rows
}
function handleQuickSearch() {
/* filteredNodes reacts to quickSearchKeyword */
}
function handleQuickSearchClear() {
quickSearchKeyword.value = ''
}
function handleToolbarEdit() {
if (selectedRows.value.length !== 1) {
ElMessage.warning('请先勾选一条节点')
@@ -22,6 +22,12 @@
<div class="list-toolbar-selected">
已选 <span class="sel-num">{{ selectedRows.length }}</span> 项
</div>
<ListQuickSearchInput
v-model="quickSearchKeyword"
placeholder="节点名称/审批人"
@search="handleQuickSearch"
@clear="handleQuickSearchClear"
/>
<el-button class="btn-main" type="primary" @click="openAddDialog">
<el-icon><Plus /></el-icon>新增节点
</el-button>
@@ -52,17 +58,26 @@
<el-icon><Upload /></el-icon>保存配置
</el-button>
<ListToolbarEndActions :loading="loading" @refresh="loadWfDef" />
<ListToolbarEndActions
:loading="loading"
:column-defs="listColumnDefs"
v-model:visible-columns="visibleColumns"
v-model:check-all="checkAll"
:is-indeterminate="isIndeterminate"
@refresh="loadWfDef"
@reset-columns="resetToDefault"
/>
</div>
</div>
<div class="list-body list-wrap">
<el-table
class="list-table"
:data="nodes"
:data="filteredNodes"
v-loading="loading"
stripe
@selection-change="onSelectionChange"
@row-dblclick="openEditDialog"
>
<el-table-column type="selection" min-width="48" align="center" header-align="center" />
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
@@ -74,8 +89,16 @@
header-align="center"
show-overflow-tooltip
/>
<el-table-column prop="nodeOrder" label="节点顺序" min-width="100" align="center" header-align="center" />
<el-table-column
v-if="isColumnVisible('nodeOrder')"
prop="nodeOrder"
label="节点顺序"
min-width="100"
align="center"
header-align="center"
/>
<el-table-column
v-if="isColumnVisible('approverName')"
prop="approverName"
label="审批人"
min-width="120"
@@ -83,7 +106,13 @@
header-align="center"
show-overflow-tooltip
/>
<el-table-column label="配置状态" min-width="110" align="center" header-align="center">
<el-table-column
v-if="isColumnVisible('configStatus')"
label="配置状态"
min-width="110"
align="center"
header-align="center"
>
<template #default="{ row }">
<el-tag :type="(row.approverId ?? row.approver_id) ? 'success' : 'warning'" size="small">
{{ (row.approverId ?? row.approver_id) ? '已配置' : '未配置' }}
@@ -107,7 +136,9 @@
ref="addFormRef"
:model="formData"
:rules="formRules"
label-position="top"
label-position="right"
label-width="100px"
class="bx-dialog-form"
scroll-to-error
:scroll-into-view-options="{ behavior: 'smooth', block: 'center' }"
>
@@ -155,7 +186,9 @@
ref="editFormRef"
:model="formData"
:rules="formRules"
label-position="top"
label-position="right"
label-width="100px"
class="bx-dialog-form"
scroll-to-error
:scroll-into-view-options="{ behavior: 'smooth', block: 'center' }"
>
@@ -195,6 +228,8 @@
<script setup lang="ts">
import { reactive, ref, computed, onMounted } from 'vue'
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
import ListQuickSearchInput from '@/components/business/list-quick-search-input/index.vue'
import { usePersistedListColumns } from '@/composables/usePersistedListColumns'
import { canDeleteByCreator, filterDeletableByCreator, allRowsDeletableByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
import { ElMessage, ElMessageBox } from 'element-plus'
import type { FormInstance } from 'element-plus'
@@ -220,10 +255,39 @@ const dialogs = reactive<Record<DialogKey, boolean>>({
editNode: false
})
const quickSearchKeyword = ref('')
const listColumnDefs = [
{ prop: 'nodeOrder', label: '节点顺序' },
{ prop: 'approverName', label: '审批人' },
{ prop: 'configStatus', label: '配置状态' }
]
const {
visibleColumns,
checkAll,
isIndeterminate,
isColumnVisible,
resetToDefault
} = usePersistedListColumns('bx-workflow-reimburse-list-columns', listColumnDefs)
const loading = ref(false)
const selectedRows = ref<Record<string, any>[]>([])
const wfDef = ref<Record<string, any>>({})
const nodes = computed(() => wfDef.value.nodes || [])
const allNodes = computed(() => wfDef.value.nodes || [])
const filteredNodes = computed(() => {
const kw = quickSearchKeyword.value.trim().toLowerCase()
if (!kw) return allNodes.value
return allNodes.value.filter(
(n: any) =>
String(n.nodeName || '')
.toLowerCase()
.includes(kw) ||
String(n.approverName || '')
.toLowerCase()
.includes(kw)
)
})
const nodes = allNodes
const userOptions = ref<
{ id: string; realName: string; username: string; roles: string; displayName: string }[]
>([])
@@ -283,6 +347,14 @@ function onSelectionChange(rows: Record<string, any>[]) {
selectedRows.value = rows
}
function handleQuickSearch() {
/* filteredNodes reacts to quickSearchKeyword */
}
function handleQuickSearchClear() {
quickSearchKeyword.value = ''
}
function handleToolbarEdit() {
if (selectedRows.value.length !== 1) {
ElMessage.warning('请先勾选一条节点')