1992 lines
64 KiB
Vue
1992 lines
64 KiB
Vue
<!-- 报销申请 -->
|
||
<!-- eslint-disable vue/no-v-model-argument -->
|
||
<template>
|
||
<div class="page-container">
|
||
<section class="panel">
|
||
<div class="filter-block">
|
||
<el-form :model="filterForm" class="filter-form" @submit.prevent>
|
||
<div class="filter-grid">
|
||
<el-form-item label="报销单号">
|
||
<el-input v-model="filterForm.keyword" placeholder="请输入报销单号" clearable />
|
||
</el-form-item>
|
||
<el-form-item label="费用项目">
|
||
<el-input v-model="filterForm.expenseName" placeholder="请输入费用项目" clearable />
|
||
</el-form-item>
|
||
<el-form-item label="状态">
|
||
<el-select v-model="filterForm.status" placeholder="全部" clearable>
|
||
<el-option label="待提交" value="draft" />
|
||
<el-option label="审批中" value="pending" />
|
||
<el-option label="审批通过" value="approved" />
|
||
<el-option label="审批驳回" value="rejected" />
|
||
</el-select>
|
||
</el-form-item>
|
||
<el-form-item label="申请时间">
|
||
<el-date-picker
|
||
v-model="filterForm.applyDateRange"
|
||
type="daterange"
|
||
range-separator="-"
|
||
start-placeholder="开始日期"
|
||
end-placeholder="结束日期"
|
||
value-format="YYYY-MM-DD"
|
||
clearable
|
||
style="width: 100%"
|
||
/>
|
||
</el-form-item>
|
||
</div>
|
||
<div class="filter-actions">
|
||
<div class="filter-actions-end">
|
||
<el-button class="btn-ghost" :loading="loading" @click="handleReset">
|
||
<el-icon><RefreshLeft /></el-icon>重置
|
||
</el-button>
|
||
<el-button class="btn-main" type="primary" :loading="loading" @click="handleSearch">
|
||
<el-icon><Search /></el-icon>搜索
|
||
</el-button>
|
||
</div>
|
||
</div>
|
||
</el-form>
|
||
</div>
|
||
|
||
<div class="list-toolbar">
|
||
<div class="list-toolbar-row">
|
||
<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>
|
||
<el-button class="btn-ghost" :loading="templateLoading" @click="downloadImportTemplate">
|
||
<el-icon><Download /></el-icon>下载模板
|
||
</el-button>
|
||
<el-button class="btn-ghost" @click="openImportDialog">
|
||
<el-icon><FolderAdd /></el-icon>批量导入
|
||
</el-button>
|
||
<el-button
|
||
class="btn-ghost"
|
||
:disabled="selectedRows.length !== 1 || !isDraftEditable(selectedRows[0])"
|
||
@click="handleToolbarEdit"
|
||
>
|
||
<el-icon><EditPen /></el-icon>编辑
|
||
</el-button>
|
||
<el-button
|
||
class="btn-ghost"
|
||
type="danger"
|
||
:disabled="
|
||
selectedRows.length === 0 ||
|
||
!selectedRows.every(isDraftEditable) ||
|
||
!allRowsDeletableByCreator(selectedRows)
|
||
"
|
||
:title="allRowsDeletableByCreator(selectedRows) ? '' : CREATOR_DELETE_TIP"
|
||
@click="handleToolbarDelete"
|
||
>
|
||
<el-icon><Delete /></el-icon>删除
|
||
</el-button>
|
||
<el-button class="btn-ghost" :loading="loadingMap.submit" @click="handleToolbarSubmit">
|
||
<el-icon><Upload /></el-icon>提交审批
|
||
</el-button>
|
||
<el-button class="btn-ghost" @click="openFlowDialog()">
|
||
<el-icon><View /></el-icon>查看审批流
|
||
</el-button>
|
||
<el-button
|
||
v-if="hasActiveFilters"
|
||
class="btn-ghost"
|
||
@click="clearAllFilters"
|
||
>
|
||
<el-icon><Filter /></el-icon>清空列过滤
|
||
</el-button>
|
||
<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 ref="reimburseApplyTableWrapRef" class="table-scroll bx-list-table-wrap">
|
||
<ListTable table-key="bx-reimburse-apply"
|
||
class="list-table"
|
||
:data="filteredRows"
|
||
v-loading="loading"
|
||
stripe
|
||
@selection-change="onSelectionChange"
|
||
@row-dblclick="openView"
|
||
@header-dragend="onReimburseApplyHeaderDragEnd"
|
||
>
|
||
<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="140"
|
||
align="center"
|
||
header-align="center"
|
||
show-overflow-tooltip
|
||
>
|
||
<template #header>
|
||
<div class="col-header-with-filter">
|
||
<span class="col-header-with-filter__label">申请时间</span>
|
||
<ColumnHeaderFilter
|
||
prop="applyTime"
|
||
label="申请时间"
|
||
type="datetime"
|
||
:is-active="isFilterActive('applyTime')"
|
||
:model-value="filters.applyTime || null"
|
||
@update:model-value="(v) => setFilterState('applyTime', v)"
|
||
/>
|
||
</div>
|
||
</template>
|
||
<template #default="{ row }">
|
||
{{ formatApplyDateOnly(row.applyTime) }}
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column
|
||
prop="applyCode"
|
||
label="报销单号"
|
||
class-name="col-apply-code"
|
||
min-width="160"
|
||
align="center"
|
||
header-align="center"
|
||
show-overflow-tooltip
|
||
>
|
||
<template #header>
|
||
<div class="col-header-with-filter">
|
||
<span class="col-header-with-filter__label">报销单号</span>
|
||
<ColumnHeaderFilter
|
||
prop="applyCode"
|
||
label="报销单号"
|
||
type="text"
|
||
:is-active="isFilterActive('applyCode')"
|
||
:model-value="filters.applyCode || null"
|
||
:options="collectUniqueOptions('applyCode')"
|
||
@update:model-value="(v) => setFilterState('applyCode', v)"
|
||
/>
|
||
</div>
|
||
</template>
|
||
<template #default="{ row }">
|
||
<el-link type="primary" @click="openView(row)">{{ row.applyCode }}</el-link>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column
|
||
v-if="isColumnVisible('title')"
|
||
prop="title"
|
||
label="报销标题"
|
||
min-width="200"
|
||
align="left"
|
||
header-align="center"
|
||
show-overflow-tooltip
|
||
>
|
||
<template #header>
|
||
<div class="col-header-with-filter">
|
||
<span class="col-header-with-filter__label">报销标题</span>
|
||
<ColumnHeaderFilter
|
||
prop="title"
|
||
label="报销标题"
|
||
type="text"
|
||
:is-active="isFilterActive('title')"
|
||
:model-value="filters.title || null"
|
||
:options="collectUniqueOptions('title')"
|
||
@update:model-value="(v) => setFilterState('title', v)"
|
||
/>
|
||
</div>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column
|
||
v-if="isColumnVisible('expenseName')"
|
||
prop="expenseName"
|
||
label="费用项目"
|
||
min-width="280"
|
||
align="left"
|
||
header-align="center"
|
||
show-overflow-tooltip
|
||
>
|
||
<template #header>
|
||
<div class="col-header-with-filter">
|
||
<span class="col-header-with-filter__label">费用项目</span>
|
||
<ColumnHeaderFilter
|
||
prop="expenseName"
|
||
label="费用项目"
|
||
type="text"
|
||
:is-active="isFilterActive('expenseName')"
|
||
:model-value="filters.expenseName || null"
|
||
:options="collectUniqueOptions('expenseName')"
|
||
@update:model-value="(v) => setFilterState('expenseName', v)"
|
||
/>
|
||
</div>
|
||
</template>
|
||
<template #default="{ row }">
|
||
<div class="expense-items-lines">
|
||
<div
|
||
v-for="(line, idx) in getReimburseExpenseItemLines(row.details, row)"
|
||
:key="idx"
|
||
class="expense-items-line"
|
||
>
|
||
{{ line }}
|
||
</div>
|
||
</div>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column
|
||
v-if="isColumnVisible('amount')"
|
||
prop="amount"
|
||
label="报销金额(元)"
|
||
:formatter="moneyTableFormatter"
|
||
class-name="col-money"
|
||
min-width="150"
|
||
align="right"
|
||
header-align="center"
|
||
>
|
||
<template #header>
|
||
<div class="col-header-with-filter">
|
||
<span class="col-header-with-filter__label is-right">报销金额(元)</span>
|
||
<ColumnHeaderFilter
|
||
prop="amount"
|
||
label="报销金额(元)"
|
||
type="number"
|
||
:is-active="isFilterActive('amount')"
|
||
:model-value="filters.amount || null"
|
||
@update:model-value="(v) => setFilterState('amount', v)"
|
||
/>
|
||
</div>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column
|
||
v-if="isColumnVisible('status')"
|
||
prop="status"
|
||
label="状态"
|
||
min-width="130"
|
||
align="center"
|
||
header-align="center"
|
||
>
|
||
<template #header>
|
||
<div class="col-header-with-filter">
|
||
<span class="col-header-with-filter__label">状态</span>
|
||
<ColumnHeaderFilter
|
||
prop="status"
|
||
label="状态"
|
||
type="enum"
|
||
:is-active="isFilterActive('status')"
|
||
:model-value="filters.status || null"
|
||
:options="collectUniqueOptions('status')"
|
||
@update:model-value="(v) => setFilterState('status', v)"
|
||
/>
|
||
</div>
|
||
</template>
|
||
<template #default="{ row }">
|
||
<el-tag :type="statusTagType(row.status)" size="small">
|
||
{{ statusLabel(row.status) }}
|
||
</el-tag>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column
|
||
v-if="isColumnVisible('currentNode')"
|
||
prop="currentNode"
|
||
label="当前节点"
|
||
min-width="140"
|
||
align="center"
|
||
header-align="center"
|
||
>
|
||
<template #header>
|
||
<div class="col-header-with-filter">
|
||
<span class="col-header-with-filter__label">当前节点</span>
|
||
<ColumnHeaderFilter
|
||
prop="currentNode"
|
||
label="当前节点"
|
||
type="text"
|
||
:is-active="isFilterActive('currentNode')"
|
||
:model-value="filters.currentNode || null"
|
||
:options="collectUniqueOptions('currentNode')"
|
||
@update:model-value="(v) => setFilterState('currentNode', v)"
|
||
/>
|
||
</div>
|
||
</template>
|
||
<template #default="{ row }">
|
||
<el-tag
|
||
v-if="shouldShowWorkflowNodeTag(row.currentNode, row.status)"
|
||
:type="workflowNodeTagType(row.currentNode, row.status)"
|
||
size="small"
|
||
>
|
||
{{ workflowNodeLabel(row.currentNode, row.status) }}
|
||
</el-tag>
|
||
<span v-else>-</span>
|
||
</template>
|
||
</el-table-column>
|
||
</ListTable>
|
||
<ListColumnStatsRow
|
||
ref="reimburseApplyStatsRowRef"
|
||
storage-key="bx-reimburse-apply-column-stats"
|
||
:columns="reimburseApplyStatsRowColumns"
|
||
:data="filteredRows"
|
||
:table-wrap-el="reimburseApplyTableWrapRef"
|
||
:get-cell-value="getReimburseApplyStatCellValue"
|
||
/>
|
||
</div>
|
||
|
||
<div class="pagination list-pager-bar">
|
||
<div class="list-pager-selected">
|
||
已选 <span class="sel-num">{{ selectedRows.length }}</span> 项
|
||
</div>
|
||
|
||
<span class="list-range">{{ rangeText }}</span>
|
||
<el-pagination
|
||
v-model:current-page="currentPage"
|
||
v-model:page-size="pageSize"
|
||
:total="total"
|
||
layout="total, sizes, prev, pager, next"
|
||
:page-sizes="[10, 20, 100, 500]"
|
||
@size-change="onSizeChange"
|
||
/>
|
||
</div>
|
||
</div>
|
||
</section>
|
||
|
||
<!-- 新增/编辑 -->
|
||
<el-dialog
|
||
v-model="dialogs.add"
|
||
:title="editingId ? '编辑报销申请' : '新增报销申请'"
|
||
width="1040px"
|
||
class="dialog-form-layout"
|
||
align-center
|
||
destroy-on-close
|
||
:close-on-click-modal="false"
|
||
>
|
||
<el-form label-position="top" class="bx-dialog-form">
|
||
<div class="form-grid-3">
|
||
<el-form-item label="申请人">
|
||
<el-select
|
||
v-model="addForm.applicantId"
|
||
placeholder="请选择申请人"
|
||
filterable
|
||
style="width: 100%"
|
||
@change="onApplicantChange"
|
||
>
|
||
<el-option
|
||
v-for="opt in applicantOptions"
|
||
:key="opt.value"
|
||
:label="opt.label"
|
||
:value="opt.value"
|
||
/>
|
||
</el-select>
|
||
</el-form-item>
|
||
<el-form-item label="报销日期">
|
||
<el-date-picker
|
||
v-model="addForm.reimburseDate"
|
||
type="date"
|
||
value-format="YYYY-MM-DD"
|
||
placeholder="选择报销日期"
|
||
style="width: 100%"
|
||
@change="onReimburseDateChange"
|
||
/>
|
||
</el-form-item>
|
||
<el-form-item label="报销标题">
|
||
<el-input
|
||
v-model="addForm.title"
|
||
placeholder="不填则自动生成"
|
||
@input="onTitleInput"
|
||
/>
|
||
</el-form-item>
|
||
</div>
|
||
</el-form>
|
||
|
||
<div class="form-section">
|
||
<h4>报销明细</h4>
|
||
<div class="detail-table-wrap">
|
||
<table class="detail-table">
|
||
<thead>
|
||
<tr>
|
||
<th class="col-index">序号</th>
|
||
<th class="col-expense">费用项目<span class="th-required">*</span></th>
|
||
<th class="col-amount">金额(元)<span class="th-required">*</span></th>
|
||
<th class="col-remark">报销事由<span class="th-required">*</span></th>
|
||
<th class="col-occur">发生时间</th>
|
||
<th class="col-action">操作</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr v-for="(line, idx) in addForm.details" :key="idx">
|
||
<td class="col-index">{{ idx + 1 }}</td>
|
||
<td class="col-expense">
|
||
<el-tree-select
|
||
v-model="line.expenseItemId"
|
||
:data="expenseTreeForSelect"
|
||
:props="{ label: 'itemName', value: 'id', children: 'children', disabled: 'disabled' }"
|
||
placeholder="请选择费用项目"
|
||
check-strictly
|
||
:render-after-expand="false"
|
||
style="width: 100%"
|
||
/>
|
||
</td>
|
||
<td class="col-amount">
|
||
<el-input-number
|
||
v-model="line.amount"
|
||
:min="0"
|
||
:precision="2"
|
||
:controls="false"
|
||
placeholder="金额"
|
||
style="width: 100%"
|
||
/>
|
||
</td>
|
||
<td class="col-remark">
|
||
<el-input v-model="line.remark" placeholder="请输入报销事由" />
|
||
</td>
|
||
<td class="col-occur">
|
||
<el-date-picker
|
||
v-model="line.occurDate"
|
||
type="date"
|
||
value-format="YYYY-MM-DD"
|
||
placeholder="可选"
|
||
clearable
|
||
style="width: 100%"
|
||
/>
|
||
</td>
|
||
<td class="col-action">
|
||
<el-button
|
||
v-if="addForm.details.length > 1"
|
||
type="danger"
|
||
link
|
||
size="small"
|
||
@click="removeDetailLine(idx)"
|
||
>
|
||
<el-icon><Delete /></el-icon>删除
|
||
</el-button>
|
||
</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
<div class="detail-footer">
|
||
<el-button class="btn-ghost" size="small" @click="addDetailLine">
|
||
<el-icon><Plus /></el-icon>新增明细行
|
||
</el-button>
|
||
<span class="detail-total">
|
||
合计金额(元):<b>{{ formatMoneyYuan(detailTotalAmount) }}</b>
|
||
</span>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-section">
|
||
<h4>关联发票(可选)</h4>
|
||
<p class="invoice-balance-tip">
|
||
当前发票余额:<b>{{ formatMoneyYuan(walletBalance) }}</b>
|
||
;本次合计:<b>{{ formatMoneyYuan(detailTotalAmount) }}</b>
|
||
<span v-if="Number(walletBalance) < Number(detailTotalAmount)" class="invoice-balance-warn">
|
||
(余额不足,提交后余额将为负,请后续补发票)
|
||
</span>
|
||
</p>
|
||
<div class="invoice-select-toolbar">
|
||
<el-button class="btn-ghost" @click="invoiceSelectVisible = true">
|
||
<el-icon><FolderOpened /></el-icon>从发票夹选择
|
||
</el-button>
|
||
</div>
|
||
<div v-if="selectedInvoicePicks.length" class="invoice-selected-thumbs">
|
||
<div
|
||
v-for="pick in selectedInvoicePicks"
|
||
:key="pick.key"
|
||
class="invoice-selected-card"
|
||
:style="{ '--invoice-group-color': invoiceGroupColor(pick.invoiceId) }"
|
||
>
|
||
<button
|
||
type="button"
|
||
class="invoice-selected-card__remove"
|
||
title="移除"
|
||
@click="removeSelectedInvoice(pick.key)"
|
||
>
|
||
<el-icon :size="12"><Close /></el-icon>
|
||
</button>
|
||
<div class="invoice-selected-card__preview">
|
||
<template v-if="isBxImageFile(pick) && pick.previewUrl">
|
||
<img :src="pick.previewUrl" :alt="pick.fileName" />
|
||
</template>
|
||
<template v-else-if="isBxVideoFile(pick)">
|
||
<div class="invoice-selected-card__icon invoice-selected-card__icon--video">
|
||
<el-icon :size="20"><VideoPlay /></el-icon>
|
||
</div>
|
||
</template>
|
||
<template v-else>
|
||
<div class="invoice-selected-card__icon invoice-selected-card__icon--doc">
|
||
<el-icon :size="20"><Document /></el-icon>
|
||
</div>
|
||
</template>
|
||
</div>
|
||
<div class="invoice-selected-card__meta">
|
||
<span class="invoice-selected-card__name" :title="pick.fileName">
|
||
{{ pick.fileName || '发票附件' }}
|
||
</span>
|
||
<div class="invoice-selected-card__footer">
|
||
<span class="invoice-selected-card__amount">
|
||
整票 {{ formatMoneyYuan(pick.amount) }} 元
|
||
</span>
|
||
<el-icon
|
||
class="invoice-selected-card__download"
|
||
title="下载"
|
||
@click="downloadSelectedInvoice(pick)"
|
||
>
|
||
<Download />
|
||
</el-icon>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<el-form label-position="top" class="bx-dialog-form">
|
||
<el-form-item label="备注说明">
|
||
<el-input v-model="addForm.remark" type="textarea" :rows="4" placeholder="请输入报销说明" />
|
||
</el-form-item>
|
||
</el-form>
|
||
|
||
<template #footer>
|
||
<el-button class="btn-ghost" @click="dialogs.add = false">
|
||
<el-icon><Close /></el-icon>取消
|
||
</el-button>
|
||
<el-button
|
||
class="btn-ghost"
|
||
:loading="loadingMap.addSubmit"
|
||
:disabled="!!loadingMap.addApprove"
|
||
@click="submitAdd"
|
||
>
|
||
<el-icon><FolderChecked /></el-icon>保存草稿
|
||
</el-button>
|
||
<el-button
|
||
class="btn-main"
|
||
type="primary"
|
||
:loading="loadingMap.addApprove"
|
||
:disabled="!!loadingMap.addSubmit"
|
||
@click="submitAddAndApprove"
|
||
>
|
||
<el-icon><Promotion /></el-icon>提交审批
|
||
</el-button>
|
||
</template>
|
||
</el-dialog>
|
||
|
||
<BxInvoiceSelectDialog
|
||
v-model="invoiceSelectVisible"
|
||
:selected-keys="selectedInvoicePicks.map((p) => p.key)"
|
||
:owner-user-id="addForm.applicantId || undefined"
|
||
@confirm="onInvoicesPicked"
|
||
/>
|
||
|
||
<el-dialog
|
||
v-model="importDialogVisible"
|
||
title="批量导入报销申请"
|
||
width="720px"
|
||
class="dialog-form-layout"
|
||
align-center
|
||
destroy-on-close
|
||
:close-on-click-modal="false"
|
||
>
|
||
<p class="import-hint">
|
||
请先下载最新模板填写。灰色【示例】行导入时自动跳过。导入结果为「待提交」草稿,发票请事后在系统中关联。导入完成后可下载带「导入结果」列的结果表。
|
||
</p>
|
||
<el-upload
|
||
drag
|
||
:auto-upload="false"
|
||
:limit="1"
|
||
accept=".xlsx,.xls"
|
||
:file-list="importFileList"
|
||
:on-change="onImportFileChange"
|
||
:on-remove="onImportFileRemove"
|
||
>
|
||
<el-icon class="el-icon--upload"><UploadFilled /></el-icon>
|
||
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
||
</el-upload>
|
||
<div v-if="importResult" class="import-result">
|
||
<p v-if="importResult.tip" class="import-tip">{{ importResult.tip }}</p>
|
||
<p>
|
||
成功 {{ importResult.successGroups || 0 }} 组({{ importResult.successRows || 0 }} 行),失败
|
||
{{ importResult.failGroups || 0 }} 组({{ importResult.failRows || 0 }} 行)
|
||
<span v-if="importResult.skippedRows">,跳过 {{ importResult.skippedRows }} 行</span>
|
||
</p>
|
||
<el-table
|
||
v-if="importResult.rowResults?.length"
|
||
:data="importResult.rowResults"
|
||
size="small"
|
||
max-height="280"
|
||
>
|
||
<el-table-column prop="excelRow" label="行号" min-width="70" align="center" />
|
||
<el-table-column prop="groupNo" label="分组号" min-width="80" />
|
||
<el-table-column prop="status" label="导入结果" min-width="90" align="center">
|
||
<template #default="{ row }">
|
||
<el-tag
|
||
:type="row.status === '成功' ? 'success' : row.status === '失败' ? 'danger' : 'info'"
|
||
size="small"
|
||
>
|
||
{{ row.status }}
|
||
</el-tag>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column prop="message" label="说明" min-width="220" show-overflow-tooltip />
|
||
</el-table>
|
||
</div>
|
||
<template #footer>
|
||
<el-button class="btn-ghost" @click="importDialogVisible = false">
|
||
<el-icon><Close /></el-icon>关闭
|
||
</el-button>
|
||
<el-button
|
||
v-if="importResult?.resultFileBase64"
|
||
class="btn-ghost"
|
||
@click="downloadImportResultFile"
|
||
>
|
||
<el-icon><Download /></el-icon>下载结果表
|
||
</el-button>
|
||
<el-button
|
||
class="btn-main"
|
||
type="primary"
|
||
:loading="importLoading"
|
||
:disabled="!importFileList.length"
|
||
@click="submitImport"
|
||
>
|
||
<el-icon><Check /></el-icon>开始导入
|
||
</el-button>
|
||
</template>
|
||
</el-dialog>
|
||
|
||
<!-- 详情 -->
|
||
<el-dialog
|
||
v-model="dialogs.view"
|
||
title="报销单详情"
|
||
width="1040px"
|
||
class="dialog-form-layout dialog-view-xl"
|
||
align-center
|
||
destroy-on-close
|
||
>
|
||
<div class="dlg-view">
|
||
<div class="dlg-view-hero">
|
||
<div class="dlg-view-hero-top">
|
||
<h2 class="dlg-view-title">{{ viewData.applyCode || '-' }}</h2>
|
||
<div class="dlg-view-tags">
|
||
<el-tag :type="statusTagType(viewData.status)" size="small">
|
||
{{ statusLabel(viewData.status) }}
|
||
</el-tag>
|
||
</div>
|
||
</div>
|
||
<p class="dlg-view-meta">
|
||
报销金额(元):<b class="money-em">{{ formatMoneyYuan(viewData.amount || 0) }}</b>
|
||
</p>
|
||
<div v-if="isDraftEditable(viewData)" class="dlg-view-hero-actions">
|
||
<el-button class="btn-main" type="primary" @click="openEditDialog(viewData)">
|
||
<el-icon><EditPen /></el-icon>编辑
|
||
</el-button>
|
||
<el-button
|
||
class="btn-ghost"
|
||
:loading="loadingMap[`submit_${viewData.id}`]"
|
||
@click="handleViewSubmit"
|
||
>
|
||
<el-icon><Upload /></el-icon>提交
|
||
</el-button>
|
||
<el-button
|
||
v-if="canDeleteByCreator(viewData)"
|
||
class="btn-ghost"
|
||
type="danger"
|
||
:loading="loadingMap[`del_${viewData.id}`]"
|
||
@click="handleViewDelete"
|
||
>
|
||
<el-icon><Delete /></el-icon>删除
|
||
</el-button>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="dlg-view-section">
|
||
<h4 class="dlg-view-section-title">基础信息</h4>
|
||
<BxViewKvTable :fields="viewMainKvFields" mode="triple" />
|
||
</div>
|
||
|
||
<div class="dlg-view-section">
|
||
<h4 class="dlg-view-section-title">报销明细</h4>
|
||
<ListTable table-key="bx-reimburse-apply-2"
|
||
class="list-table view-detail-table"
|
||
:data="viewData.details || []"
|
||
stripe
|
||
size="small"
|
||
show-summary
|
||
:summary-method="viewDetailSummary"
|
||
>
|
||
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
|
||
<el-table-column prop="expenseName" label="费用项目" min-width="160" align="left" header-align="center" />
|
||
<el-table-column
|
||
prop="amount"
|
||
label="金额(元)"
|
||
min-width="120"
|
||
class-name="col-money"
|
||
align="right"
|
||
header-align="center"
|
||
>
|
||
<template #default="{ row }">{{ formatMoneyYuan(row.amount || 0) }}</template>
|
||
</el-table-column>
|
||
<el-table-column prop="remark" label="报销事由" min-width="140" align="left" header-align="center">
|
||
<template #default="{ row }">{{ row.remark || '-' }}</template>
|
||
</el-table-column>
|
||
<el-table-column prop="occurDate" label="发生时间" min-width="120" align="center" header-align="center">
|
||
<template #default="{ row }">{{ row.occurDate || '—' }}</template>
|
||
</el-table-column>
|
||
</ListTable>
|
||
</div>
|
||
|
||
<div v-if="viewLinkedInvoiceFiles.length" class="dlg-view-section">
|
||
<h4 class="dlg-view-section-title">关联发票</h4>
|
||
<BxAttachmentReadonly :files="viewLinkedInvoiceFiles" />
|
||
</div>
|
||
|
||
<div v-if="viewAttachments.length" class="dlg-view-section">
|
||
<h4 class="dlg-view-section-title">历史附件</h4>
|
||
<BxAttachmentReadonly :files="viewAttachments" />
|
||
</div>
|
||
|
||
<div class="dlg-view-section">
|
||
<BxViewKvGrid :fields="viewRemarkKvFields" />
|
||
</div>
|
||
|
||
<div
|
||
v-if="
|
||
['processed', 'paid', 'offset'].includes(String(viewData.status)) ||
|
||
viewData.payStatus ||
|
||
Number(viewData.offsetAmount || 0) > 0
|
||
"
|
||
class="dlg-view-section"
|
||
>
|
||
<h4 class="dlg-view-section-title">处理情况</h4>
|
||
<BxViewKvTable :fields="viewProcessKvFields" mode="triple" />
|
||
</div>
|
||
|
||
<div v-if="viewPayAttachments.length" class="dlg-view-section">
|
||
<h4 class="dlg-view-section-title">发放附件</h4>
|
||
<BxAttachmentReadonly :files="viewPayAttachments" />
|
||
</div>
|
||
|
||
<div v-if="viewOffsetAttachments.length" class="dlg-view-section">
|
||
<h4 class="dlg-view-section-title">冲抵附件</h4>
|
||
<BxAttachmentReadonly :files="viewOffsetAttachments" />
|
||
</div>
|
||
|
||
<BxApprovalFlowTabs
|
||
:nodes="viewFlowNodes"
|
||
:history="viewApprovalHistory"
|
||
:loading="viewFlowLoading"
|
||
/>
|
||
</div>
|
||
</el-dialog>
|
||
|
||
<el-dialog
|
||
v-model="dialogs.viewFlow"
|
||
title="审批流程"
|
||
width="1040px"
|
||
class="dialog-form-layout dialog-view-xl"
|
||
align-center
|
||
destroy-on-close
|
||
>
|
||
<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 ListColumnStatsRow from '@/components/business/list-column-stats-row/index.vue'
|
||
import ColumnHeaderFilter from '@/components/business/column-header-filter/index.vue'
|
||
import { useDbInstantSearch } from '@/composables/useDbInstantSearch'
|
||
import { usePersistedListColumns } from '@/composables/usePersistedListColumns'
|
||
import {
|
||
useClientColumnFilters,
|
||
type ColumnFilterDef
|
||
} from '@/composables/useClientColumnFilters'
|
||
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 {
|
||
Plus,
|
||
EditPen,
|
||
Upload,
|
||
View,
|
||
Close,
|
||
Delete,
|
||
Search,
|
||
RefreshLeft,
|
||
FolderOpened,
|
||
FolderChecked,
|
||
Promotion,
|
||
VideoPlay,
|
||
Document,
|
||
Download,
|
||
FolderAdd,
|
||
UploadFilled,
|
||
Check,
|
||
Filter
|
||
} from '@element-plus/icons-vue'
|
||
import type { UploadFile } from 'element-plus'
|
||
import { reimburseApi, invoiceWalletApi } from '@/api/bx'
|
||
import { buildApplyDateRangeQuery, type ApplyDateRange } from '@/utils/bx/apply-date-filter'
|
||
import { canDeleteByCreator, allRowsDeletableByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
|
||
import { useExpenseItemTree, type ExpenseItem } from '@/hooks/bx/useExpenseItemTree'
|
||
import { useApplicantOptions } from '@/hooks/bx/useApplicantOptions'
|
||
import { useUserStore } from '@/store/modules/user'
|
||
import {
|
||
statusLabel,
|
||
statusTagType,
|
||
formatMoneyYuan,
|
||
getReimburseExpenseItemLines,
|
||
moneyTableFormatter,
|
||
workflowNodeDisplay,
|
||
workflowNodeLabel,
|
||
workflowNodeTagType,
|
||
shouldShowWorkflowNodeTag
|
||
} from '@/utils/bx/format'
|
||
import { useServerPaged } from '@/hooks/bx/useServerPaged'
|
||
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 BxAttachmentReadonly from '@/components/bx/base/BxAttachmentReadonly.vue'
|
||
import BxInvoiceSelectDialog from '@/components/bx/base/BxInvoiceSelectDialog.vue'
|
||
import type { ViewField } from '@/components/business/system-view-dialog/types'
|
||
import { bxViewKv, bxViewKvLong, bxViewKvMoney } from '@/utils/bx/view-kv'
|
||
import type { StatsRowColumn } from '@/utils/list-column-stats'
|
||
import {
|
||
type BxAttachmentItem,
|
||
loadBxAttachments,
|
||
fillBxAttachmentPreviews,
|
||
downloadBxAttachment,
|
||
isBxImageFile,
|
||
isBxVideoFile
|
||
} from '@/utils/bx/attachment'
|
||
import { pickBxData } from '@/utils/http/bx'
|
||
|
||
type DialogKey = 'add' | 'view' | 'viewFlow'
|
||
|
||
interface DetailLine {
|
||
expenseItemId: string
|
||
amount: number | string
|
||
remark: string
|
||
occurDate: string
|
||
}
|
||
|
||
const loadingMap = reactive<Record<string, boolean>>({})
|
||
const dialogs = reactive<Record<DialogKey, boolean>>({
|
||
add: false,
|
||
view: false,
|
||
viewFlow: false
|
||
})
|
||
|
||
const { rows, total, currentPage, pageSize, rangeText, loading, refresh, search, onSizeChange } = useServerPaged(
|
||
async (params) => {
|
||
const res: any = await reimburseApi.my(params)
|
||
return res.data
|
||
}
|
||
)
|
||
|
||
const columnFilterDefs: ColumnFilterDef[] = [
|
||
{ prop: 'applyTime', label: '申请时间', type: 'datetime' },
|
||
{ prop: 'applyCode', label: '报销单号', type: 'text' },
|
||
{ prop: 'title', label: '报销标题', type: 'text' },
|
||
{
|
||
prop: 'expenseName',
|
||
label: '费用项目',
|
||
type: 'text',
|
||
getValue: (row) => {
|
||
const lines = getReimburseExpenseItemLines(row.details, row)
|
||
return lines?.length ? lines.join('\n') : row.expenseName || ''
|
||
}
|
||
},
|
||
{ prop: 'amount', label: '报销金额(元)', type: 'number' },
|
||
{
|
||
prop: 'status',
|
||
label: '状态',
|
||
type: 'enum',
|
||
enumOptions: [
|
||
{ value: 'draft', label: '待提交' },
|
||
{ value: 'pending', label: '审批中' },
|
||
{ value: 'approved', label: '审批通过' },
|
||
{ value: 'rejected', label: '审批驳回' }
|
||
]
|
||
},
|
||
{
|
||
prop: 'currentNode',
|
||
label: '当前节点',
|
||
type: 'text',
|
||
getValue: (row) => workflowNodeLabel(row.currentNode, row.status) || ''
|
||
}
|
||
]
|
||
|
||
const {
|
||
filters,
|
||
filteredRows,
|
||
hasActiveFilters,
|
||
setFilterState,
|
||
clearAllFilters,
|
||
isFilterActive,
|
||
collectUniqueOptions
|
||
} = useClientColumnFilters(rows, columnFilterDefs)
|
||
|
||
const { expenseTree } = useExpenseItemTree()
|
||
const { applicantOptions, loadApplicantOptions } = useApplicantOptions()
|
||
const userStore = useUserStore()
|
||
|
||
function currentUserId() {
|
||
return String(userStore.info?.userId || userStore.info?.id || '')
|
||
}
|
||
|
||
function markDisabledExpenseNodes(tree: ExpenseItem[]): ExpenseItem[] {
|
||
return tree.map((node) => ({
|
||
...node,
|
||
disabled: Number(node.status) === 0,
|
||
children: node.children?.length ? markDisabledExpenseNodes(node.children) : node.children
|
||
}))
|
||
}
|
||
|
||
const expenseTreeForSelect = computed(() => markDisabledExpenseNodes(expenseTree.value))
|
||
|
||
const quickSearchKeyword = ref('')
|
||
|
||
const listColumnDefs = [
|
||
{ prop: 'applyTime', label: '申请时间' },
|
||
{ prop: 'title', label: '报销标题' },
|
||
{ prop: 'expenseName', label: '费用项目' },
|
||
{ prop: 'amount', label: '报销金额(元)' },
|
||
{ prop: 'status', label: '状态' },
|
||
{ prop: 'currentNode', label: '当前节点', defaultVisible: false }
|
||
]
|
||
|
||
const {
|
||
visibleColumns,
|
||
checkAll,
|
||
isIndeterminate,
|
||
isColumnVisible,
|
||
resetToDefault
|
||
} = usePersistedListColumns('bx-reimburse-apply-list-columns', listColumnDefs)
|
||
|
||
const reimburseApplyTableWrapRef = ref<HTMLElement | null>(null)
|
||
const reimburseApplyStatsRowRef = ref<{ resync?: () => void } | null>(null)
|
||
|
||
const reimburseApplyStatsRowColumns = computed((): StatsRowColumn[] => {
|
||
const cols: StatsRowColumn[] = [
|
||
{ key: '__selection', interactive: false },
|
||
{ key: '__index', interactive: false }
|
||
]
|
||
if (isColumnVisible('applyTime')) {
|
||
cols.push({ key: 'applyTime', interactive: true, prop: 'applyTime' })
|
||
}
|
||
cols.push({ key: 'applyCode', interactive: true, prop: 'applyCode' })
|
||
for (const def of listColumnDefs) {
|
||
if (def.prop === 'applyTime') continue
|
||
if (!isColumnVisible(def.prop)) continue
|
||
cols.push({
|
||
key: def.prop,
|
||
interactive: true,
|
||
prop: def.prop,
|
||
money: def.prop === 'amount'
|
||
})
|
||
}
|
||
return cols
|
||
})
|
||
|
||
function formatApplyDateOnly(value: unknown): string {
|
||
const text = String(value ?? '').trim()
|
||
if (!text) return '-'
|
||
return text.slice(0, 10)
|
||
}
|
||
|
||
function getReimburseApplyStatCellValue(row: any, prop: string): unknown {
|
||
if (prop === 'expenseName') {
|
||
const lines = getReimburseExpenseItemLines(row.details, row)
|
||
return lines?.length ? lines.join('\n') : row.expenseName
|
||
}
|
||
if (prop === 'applyTime') {
|
||
return formatApplyDateOnly(row?.applyTime)
|
||
}
|
||
return row?.[prop]
|
||
}
|
||
|
||
function onReimburseApplyHeaderDragEnd() {
|
||
reimburseApplyStatsRowRef.value?.resync?.()
|
||
}
|
||
|
||
const filterForm = reactive({
|
||
keyword: '',
|
||
status: '',
|
||
expenseName: '',
|
||
applyDateRange: null as ApplyDateRange
|
||
})
|
||
|
||
function todayYmd() {
|
||
const d = new Date()
|
||
const y = d.getFullYear()
|
||
const m = String(d.getMonth() + 1).padStart(2, '0')
|
||
const day = String(d.getDate()).padStart(2, '0')
|
||
return `${y}-${m}-${day}`
|
||
}
|
||
|
||
const addForm = reactive({
|
||
applicantId: '' as string,
|
||
reimburseDate: todayYmd(),
|
||
title: '',
|
||
remark: '',
|
||
details: [{ expenseItemId: '', amount: '' as number | string, remark: '', occurDate: '' }] as DetailLine[]
|
||
})
|
||
|
||
const viewData = ref<Record<string, any>>({})
|
||
|
||
const viewMainKvFields = computed<ViewField[]>(() => {
|
||
const d = viewData.value
|
||
return [
|
||
bxViewKv('报销日期', d.reimburseDate, { long: false }),
|
||
bxViewKv('报销标题', d.title, { long: false }),
|
||
bxViewKv('申请人', d.applicantName, { long: false }),
|
||
bxViewKv('当前节点', workflowNodeDisplay(d.currentNode, d.status), { long: false }),
|
||
bxViewKv('申请时间', d.applyTime, { long: false })
|
||
]
|
||
})
|
||
|
||
const viewRemarkKvFields = computed<ViewField[]>(() => [
|
||
bxViewKvLong('报销说明', viewData.value.remark, { fullSpan: true })
|
||
])
|
||
|
||
const viewProcessKvFields = computed<ViewField[]>(() => {
|
||
const d = viewData.value
|
||
return [
|
||
bxViewKv('处理方式', viewProcessMode(d), { long: false }),
|
||
bxViewKvMoney('冲抵金额(元)', formatMoneyYuan(d.offsetAmount || 0), { long: false }),
|
||
bxViewKvMoney(
|
||
'发放金额(元)',
|
||
formatMoneyYuan(d.actualAmount ?? Number(d.amount || 0) - Number(d.offsetAmount || 0)),
|
||
{ long: false }
|
||
),
|
||
bxViewKv('处理时间', d.payTime, { long: false }),
|
||
bxViewKv('处理操作人', d.payUserName, { long: false })
|
||
]
|
||
})
|
||
const selectedRows = ref<any[]>([])
|
||
const flowNodes = ref<any[]>([])
|
||
const flowHistory = ref<any[]>([])
|
||
const flowLoading = ref(false)
|
||
const viewFlowNodes = ref<any[]>([])
|
||
const viewApprovalHistory = ref<any[]>([])
|
||
const viewFlowLoading = ref(false)
|
||
const viewAttachments = ref<BxAttachmentItem[]>([])
|
||
const viewPayAttachments = ref<BxAttachmentItem[]>([])
|
||
const viewOffsetAttachments = ref<BxAttachmentItem[]>([])
|
||
const viewLinkedInvoiceFiles = ref<BxAttachmentItem[]>([])
|
||
type SelectedInvoicePick = {
|
||
key: string
|
||
id: string | number
|
||
invoiceId: string | number
|
||
attachmentId: string | number
|
||
amount: number | string
|
||
fileName: string
|
||
fileType?: string
|
||
previewUrl?: string
|
||
createTime?: string
|
||
}
|
||
|
||
const selectedInvoicePicks = ref<SelectedInvoicePick[]>([])
|
||
const invoiceSelectVisible = ref(false)
|
||
const walletBalance = ref(0)
|
||
const editingId = ref<number | null>(null)
|
||
const titleAutoLinked = ref(true)
|
||
|
||
const templateLoading = ref(false)
|
||
const importDialogVisible = ref(false)
|
||
const importLoading = ref(false)
|
||
const importFileList = ref<UploadFile[]>([])
|
||
const importResult = ref<Record<string, any> | null>(null)
|
||
|
||
/** 同一发票共用边框色(与 BxInvoiceSelectDialog / bx-mobile 一致) */
|
||
const INVOICE_GROUP_COLORS = [
|
||
'#0891b2',
|
||
'#7c3aed',
|
||
'#d97706',
|
||
'#db2777',
|
||
'#2563eb',
|
||
'#059669',
|
||
'#ea580c',
|
||
'#4f46e5'
|
||
]
|
||
|
||
function invoiceGroupColor(invoiceId: string | number) {
|
||
const s = String(invoiceId || '')
|
||
let hash = 0
|
||
for (let i = 0; i < s.length; i++) hash = (hash * 31 + s.charCodeAt(i)) >>> 0
|
||
return INVOICE_GROUP_COLORS[hash % INVOICE_GROUP_COLORS.length]
|
||
}
|
||
|
||
/** 关联发票固定展示顺序:上传/创建时间从新到旧,同时间按附件 ID */
|
||
function sortInvoicePicksByFixedOrder<T extends { createTime?: string; attachmentId?: string | number; id?: string | number; key?: string }>(
|
||
items: T[]
|
||
): T[] {
|
||
return items.slice().sort((a, b) => {
|
||
const ta = String(a.createTime || '')
|
||
const tb = String(b.createTime || '')
|
||
if (ta !== tb) return tb.localeCompare(ta)
|
||
const ia = String(a.attachmentId ?? a.id ?? a.key ?? '')
|
||
const ib = String(b.attachmentId ?? b.id ?? b.key ?? '')
|
||
return ib.localeCompare(ia)
|
||
})
|
||
}
|
||
|
||
function isAutoReimburseTitle(title: string) {
|
||
return /报销单\d{11}$/.test(String(title || '').trim())
|
||
}
|
||
|
||
const detailTotalAmount = computed(() => {
|
||
return addForm.details.reduce((sum: number, d) => sum + Number(d.amount || 0), 0)
|
||
})
|
||
|
||
async function refreshGeneratedTitle() {
|
||
if (!addForm.reimburseDate) return
|
||
try {
|
||
const res: any = await reimburseApi.generateTitle(
|
||
addForm.reimburseDate,
|
||
editingId.value ?? undefined,
|
||
addForm.applicantId || undefined
|
||
)
|
||
addForm.title = res.data || ''
|
||
titleAutoLinked.value = true
|
||
} catch {
|
||
/* fallback: user can type manually */
|
||
}
|
||
}
|
||
|
||
function onTitleInput(value: string) {
|
||
titleAutoLinked.value = isAutoReimburseTitle(value)
|
||
}
|
||
|
||
async function onReimburseDateChange() {
|
||
if (!editingId.value || titleAutoLinked.value) {
|
||
await refreshGeneratedTitle()
|
||
}
|
||
}
|
||
|
||
async function onApplicantChange() {
|
||
selectedInvoicePicks.value = []
|
||
await Promise.all([refreshWalletBalance(), refreshGeneratedTitle()])
|
||
}
|
||
|
||
async function refreshWalletBalance(ownerUserId?: string) {
|
||
try {
|
||
const res: any = await invoiceWalletApi.mineSummary({
|
||
userId: ownerUserId || addForm.applicantId || undefined
|
||
})
|
||
const data: any = pickBxData(res) || {}
|
||
walletBalance.value = Number(data.balance ?? 0)
|
||
} catch {
|
||
walletBalance.value = 0
|
||
}
|
||
}
|
||
|
||
async function onInvoicesPicked(picks: any[]) {
|
||
const mapped: SelectedInvoicePick[] = (picks || []).map((pick) => {
|
||
const attachmentId = pick.attachmentId
|
||
return {
|
||
key: String(pick.key),
|
||
id: attachmentId,
|
||
invoiceId: pick.invoiceId,
|
||
attachmentId,
|
||
amount: pick.amount,
|
||
fileName: pick.file?.fileName || '',
|
||
fileType: pick.file?.fileType || '',
|
||
previewUrl: pick.file?.previewUrl || '',
|
||
createTime: pick.createTime || pick.invoice?.createTime || ''
|
||
}
|
||
})
|
||
await fillBxAttachmentPreviews(mapped)
|
||
selectedInvoicePicks.value = sortInvoicePicksByFixedOrder(mapped).map((p) => ({ ...p }))
|
||
}
|
||
|
||
function removeSelectedInvoice(key: string) {
|
||
selectedInvoicePicks.value = selectedInvoicePicks.value.filter((p) => p.key !== key)
|
||
}
|
||
|
||
function downloadSelectedInvoice(pick: SelectedInvoicePick) {
|
||
if (!pick.attachmentId) return
|
||
downloadBxAttachment({
|
||
id: pick.attachmentId,
|
||
fileName: pick.fileName || '发票附件'
|
||
})
|
||
}
|
||
|
||
async function loadSelectedPicksFromInvoices(invoices: any[]) {
|
||
const settled = await Promise.all(
|
||
(invoices || []).map(async (inv, idx) => {
|
||
const preferredId = inv.attachmentId || inv.attachment_id
|
||
try {
|
||
const files = await loadBxAttachments('invoice', inv.id)
|
||
const file =
|
||
(preferredId
|
||
? files.find((f) => String(f.id) === String(preferredId))
|
||
: undefined) || files[0]
|
||
if (file) {
|
||
return {
|
||
idx,
|
||
pick: {
|
||
key: `${inv.id}:${file.id}`,
|
||
id: file.id,
|
||
invoiceId: inv.id,
|
||
attachmentId: file.id,
|
||
amount: inv.amount,
|
||
fileName: file.fileName || inv.fileName || '',
|
||
fileType: file.fileType || inv.fileType || '',
|
||
previewUrl: file.previewUrl || '',
|
||
createTime: inv.createTime || ''
|
||
} as SelectedInvoicePick
|
||
}
|
||
}
|
||
} catch {
|
||
/* fallback below */
|
||
}
|
||
const fallbackId = preferredId || inv.id
|
||
return {
|
||
idx,
|
||
pick: {
|
||
key: `${inv.id}:${fallbackId}`,
|
||
id: fallbackId,
|
||
invoiceId: inv.id,
|
||
attachmentId: fallbackId,
|
||
amount: inv.amount,
|
||
fileName: inv.fileName || '',
|
||
fileType: inv.fileType || '',
|
||
previewUrl: '',
|
||
createTime: inv.createTime || ''
|
||
} as SelectedInvoicePick
|
||
}
|
||
})
|
||
)
|
||
const mapped = settled.sort((a, b) => a.idx - b.idx).map((item) => item.pick)
|
||
await fillBxAttachmentPreviews(mapped)
|
||
selectedInvoicePicks.value = sortInvoicePicksByFixedOrder(mapped).map((p) => ({ ...p }))
|
||
}
|
||
|
||
function invoicesToAttachmentFiles(invoices: any[]): BxAttachmentItem[] {
|
||
const sorted = sortInvoicePicksByFixedOrder(
|
||
(invoices || []).map((inv: any) => ({
|
||
...inv,
|
||
attachmentId: inv.attachmentId || inv.attachment_id,
|
||
createTime: inv.createTime || inv.create_time || ''
|
||
}))
|
||
)
|
||
return sorted
|
||
.map((inv: any) => {
|
||
const id = inv.attachmentId || inv.attachment_id
|
||
if (!id && !inv.fileName) return null
|
||
return {
|
||
id: id || inv.id,
|
||
fileName: inv.fileName || inv.file_name || '发票附件',
|
||
fileType: inv.fileType || inv.file_type || '',
|
||
_existing: true
|
||
} as BxAttachmentItem
|
||
})
|
||
.filter(Boolean) as BxAttachmentItem[]
|
||
}
|
||
|
||
async function openAddDialog() {
|
||
addForm.applicantId = currentUserId()
|
||
addForm.reimburseDate = todayYmd()
|
||
addForm.title = ''
|
||
addForm.remark = ''
|
||
addForm.details = [{ expenseItemId: '', amount: '', remark: '', occurDate: '' }]
|
||
selectedInvoicePicks.value = []
|
||
editingId.value = null
|
||
titleAutoLinked.value = true
|
||
dialogs.add = true
|
||
await Promise.all([
|
||
loadApplicantOptions(),
|
||
refreshGeneratedTitle(),
|
||
refreshWalletBalance()
|
||
])
|
||
}
|
||
|
||
function isDraftEditable(row?: any) {
|
||
if (!row) return false
|
||
return row.status === 'draft' || row.status === 'rejected'
|
||
}
|
||
|
||
function handleToolbarEdit() {
|
||
if (selectedRows.value.length !== 1) {
|
||
ElMessage.warning('请先勾选一条报销单')
|
||
return
|
||
}
|
||
openEditDialog(selectedRows.value[0])
|
||
}
|
||
|
||
async function handleToolbarDelete() {
|
||
if (selectedRows.value.length === 0) {
|
||
ElMessage.warning('请先勾选要删除的报销单')
|
||
return
|
||
}
|
||
const targets = selectedRows.value.filter(isDraftEditable)
|
||
if (targets.length !== selectedRows.value.length) {
|
||
ElMessage.warning('仅草稿或已驳回的报销单可删除')
|
||
return
|
||
}
|
||
if (!allRowsDeletableByCreator(targets)) {
|
||
ElMessage.warning(CREATOR_DELETE_TIP)
|
||
return
|
||
}
|
||
try {
|
||
await ElMessageBox.confirm(`确定删除选中的 ${targets.length} 条报销单吗?删除后不可恢复。`, '删除确认', {
|
||
confirmButtonText: '确定删除',
|
||
cancelButtonText: '取消',
|
||
type: 'warning'
|
||
})
|
||
for (const row of targets) {
|
||
await reimburseApi.delete(row.id)
|
||
}
|
||
ElMessage.success('删除成功')
|
||
await refreshList()
|
||
} catch (e: any) {
|
||
if (e !== 'cancel') {
|
||
ElMessage.error(e?.message || '删除失败')
|
||
}
|
||
}
|
||
}
|
||
|
||
async function handleViewSubmit() {
|
||
if (!viewData.value?.id) return
|
||
await handleSubmit(viewData.value)
|
||
try {
|
||
const res = await reimburseApi.getById(viewData.value.id)
|
||
viewData.value = res.data || res
|
||
} catch {
|
||
dialogs.view = false
|
||
}
|
||
}
|
||
|
||
async function handleViewDelete() {
|
||
if (!viewData.value?.id) return
|
||
await handleDelete(viewData.value)
|
||
dialogs.view = false
|
||
}
|
||
|
||
async function openEditDialog(row: any) {
|
||
try {
|
||
const res: any = await reimburseApi.getById(row.id)
|
||
const data = res.data || res
|
||
addForm.applicantId = String(data.applicantId || currentUserId())
|
||
addForm.title = data.title || ''
|
||
addForm.reimburseDate = data.reimburseDate || todayYmd()
|
||
titleAutoLinked.value = isAutoReimburseTitle(addForm.title)
|
||
addForm.remark = data.remark || ''
|
||
addForm.details = (data.details || []).map((d: any) => ({
|
||
// 费用项 id 可能是纯数字字符串;必须 String,否则 el-tree-select 对不上树节点会直接显示数字
|
||
expenseItemId: d.expenseId != null && d.expenseId !== '' ? String(d.expenseId) : '',
|
||
amount: d.amount,
|
||
remark: d.remark || '',
|
||
occurDate: d.occurDate || ''
|
||
}))
|
||
if (addForm.details.length === 0) {
|
||
addForm.details = [{ expenseItemId: '', amount: '', remark: '', occurDate: '' }]
|
||
}
|
||
editingId.value = row.id
|
||
const invoices = Array.isArray(data.invoices) ? data.invoices : []
|
||
dialogs.add = true
|
||
await Promise.all([
|
||
loadApplicantOptions(),
|
||
refreshWalletBalance(),
|
||
loadSelectedPicksFromInvoices(invoices)
|
||
])
|
||
} catch (e: any) {
|
||
ElMessage.error(e.message || '加载失败')
|
||
}
|
||
}
|
||
|
||
function addDetailLine() {
|
||
addForm.details.push({ expenseItemId: '', amount: '', remark: '', occurDate: '' })
|
||
}
|
||
|
||
function removeDetailLine(index: number) {
|
||
addForm.details.splice(index, 1)
|
||
}
|
||
|
||
function onSelectionChange(rows: any[]) {
|
||
selectedRows.value = rows
|
||
}
|
||
|
||
async function refreshList() {
|
||
await refresh()
|
||
}
|
||
|
||
async function downloadImportTemplate() {
|
||
templateLoading.value = true
|
||
try {
|
||
const res: any = await reimburseApi.downloadImportTemplate()
|
||
const blob =
|
||
res instanceof Blob
|
||
? res
|
||
: new Blob([res as BlobPart], {
|
||
type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
||
})
|
||
const url = URL.createObjectURL(blob)
|
||
const link = document.createElement('a')
|
||
link.href = url
|
||
link.download = '报销申请导入模板.xlsx'
|
||
link.click()
|
||
URL.revokeObjectURL(url)
|
||
} catch {
|
||
ElMessage.error('下载模板失败')
|
||
} finally {
|
||
templateLoading.value = false
|
||
}
|
||
}
|
||
|
||
function openImportDialog() {
|
||
importFileList.value = []
|
||
importResult.value = null
|
||
importDialogVisible.value = true
|
||
}
|
||
|
||
function onImportFileChange(_file: UploadFile, files: UploadFile[]) {
|
||
importFileList.value = files.slice(-1)
|
||
}
|
||
|
||
function onImportFileRemove() {
|
||
importFileList.value = []
|
||
}
|
||
|
||
async function submitImport() {
|
||
const raw = importFileList.value[0]?.raw
|
||
if (!raw) {
|
||
ElMessage.warning('请选择要导入的文件')
|
||
return
|
||
}
|
||
importLoading.value = true
|
||
importResult.value = null
|
||
try {
|
||
const res: any = await reimburseApi.importExcel(raw)
|
||
const data = pickBxData(res) || res?.data || res
|
||
importResult.value = data
|
||
const ok = Number(data?.successGroups || 0)
|
||
const fail = Number(data?.failGroups || 0)
|
||
if (data?.tip) {
|
||
ElMessage.warning(String(data.tip))
|
||
} else if (ok > 0 && fail === 0) {
|
||
ElMessage.success(`成功导入 ${ok} 组`)
|
||
} else if (ok > 0) {
|
||
ElMessage.warning(`部分成功:成功 ${ok} 组,失败 ${fail} 组`)
|
||
} else if (fail > 0) {
|
||
ElMessage.error('导入失败,请查看结果清单或下载结果表')
|
||
} else {
|
||
ElMessage.warning('没有导入任何数据')
|
||
}
|
||
if (ok > 0) await refreshList()
|
||
} finally {
|
||
importLoading.value = false
|
||
}
|
||
}
|
||
|
||
function downloadImportResultFile() {
|
||
const b64 = importResult.value?.resultFileBase64
|
||
if (!b64) {
|
||
ElMessage.warning('暂无结果文件可下载')
|
||
return
|
||
}
|
||
const binary = atob(String(b64))
|
||
const bytes = new Uint8Array(binary.length)
|
||
for (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i)
|
||
const blob = new Blob([bytes], {
|
||
type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
||
})
|
||
const url = URL.createObjectURL(blob)
|
||
const link = document.createElement('a')
|
||
link.href = url
|
||
link.download = String(importResult.value?.resultFileName || '报销申请导入结果.xlsx')
|
||
link.click()
|
||
URL.revokeObjectURL(url)
|
||
}
|
||
|
||
onMounted(() => {
|
||
refreshList()
|
||
})
|
||
|
||
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
|
||
buildApplyDateRangeQuery(filterForm.applyDateRange, q)
|
||
return q
|
||
}
|
||
|
||
function handleSearch() {
|
||
quickSearchKeyword.value = ''
|
||
search(buildSearchQuery())
|
||
}
|
||
|
||
useDbInstantSearch(
|
||
() => ({
|
||
keyword: filterForm.keyword,
|
||
status: filterForm.status,
|
||
expenseName: filterForm.expenseName,
|
||
applyDateRange: filterForm.applyDateRange
|
||
}),
|
||
handleSearch
|
||
)
|
||
|
||
function handleReset() {
|
||
quickSearchKeyword.value = ''
|
||
Object.assign(filterForm, { keyword: '', status: '', expenseName: '', applyDateRange: null })
|
||
search()
|
||
}
|
||
|
||
function handleQuickSearch() {
|
||
search(buildSearchQuery())
|
||
}
|
||
|
||
function handleQuickSearchClear() {
|
||
quickSearchKeyword.value = ''
|
||
search(buildSearchQuery())
|
||
}
|
||
|
||
async function handleToolbarSubmit() {
|
||
if (selectedRows.value.length === 0) {
|
||
ElMessage.warning('请先勾选要提交的报销单')
|
||
return
|
||
}
|
||
|
||
const validTargets = selectedRows.value.filter(isDraftEditable)
|
||
const skippedCount = selectedRows.value.length - validTargets.length
|
||
|
||
if (!validTargets.length) {
|
||
ElMessage.warning('所选报销单均不是草稿或已驳回状态,无法提交审批')
|
||
return
|
||
}
|
||
|
||
if (skippedCount > 0) {
|
||
ElMessage.warning(`已跳过 ${skippedCount} 条不可提交的报销单(仅草稿或已驳回可提交),将继续提交其余 ${validTargets.length} 条`)
|
||
}
|
||
|
||
loadingMap.submit = true
|
||
try {
|
||
const results = await Promise.allSettled(validTargets.map((row) => reimburseApi.submit(row.id)))
|
||
const successCount = results.filter((item) => item.status === 'fulfilled').length
|
||
const failedCount = results.length - successCount
|
||
const skipText = skippedCount > 0 ? `,跳过 ${skippedCount} 条` : ''
|
||
|
||
if (successCount === 0) {
|
||
ElMessage.error(`提交失败${skipText}`)
|
||
return
|
||
}
|
||
if (failedCount > 0) {
|
||
ElMessage.warning(`成功提交 ${successCount} 条,失败 ${failedCount} 条${skipText}`)
|
||
} else if (successCount === 1 && skippedCount === 0) {
|
||
ElMessage.success('提交成功')
|
||
} else {
|
||
ElMessage.success(`成功提交 ${successCount} 条${skipText}`)
|
||
}
|
||
await refreshList()
|
||
} finally {
|
||
loadingMap.submit = false
|
||
}
|
||
}
|
||
|
||
type AddPayload = {
|
||
applicantId?: string
|
||
reimburseDate: string
|
||
title?: string
|
||
remark: string
|
||
invoiceIds: string[]
|
||
invoiceLinks: { invoiceId: string; attachmentId: string }[]
|
||
details: { expenseItemId: string; amount: number; remark: string; occurDate?: string }[]
|
||
}
|
||
|
||
function buildAddPayload(): AddPayload | null {
|
||
const validDetails = addForm.details.filter((d) => d.expenseItemId && d.amount)
|
||
if (validDetails.length === 0) {
|
||
ElMessage.warning('请至少填写一条报销明细')
|
||
return null
|
||
}
|
||
const missingReason = validDetails.some((d) => !String(d.remark ?? '').trim())
|
||
if (missingReason) {
|
||
ElMessage.warning('请为每条报销明细填写报销事由')
|
||
return null
|
||
}
|
||
const invoiceLinks = selectedInvoicePicks.value.map((p) => ({
|
||
invoiceId: String(p.invoiceId),
|
||
attachmentId: String(p.attachmentId)
|
||
}))
|
||
const invoiceIds = Array.from(new Set(invoiceLinks.map((p) => p.invoiceId)))
|
||
return {
|
||
applicantId: addForm.applicantId || undefined,
|
||
reimburseDate: addForm.reimburseDate,
|
||
title: addForm.title || undefined,
|
||
remark: addForm.remark,
|
||
invoiceIds,
|
||
invoiceLinks,
|
||
details: validDetails.map((d) => ({
|
||
expenseItemId: String(d.expenseItemId),
|
||
amount: Number(d.amount),
|
||
remark: String(d.remark).trim(),
|
||
occurDate: d.occurDate ? String(d.occurDate) : undefined
|
||
}))
|
||
}
|
||
}
|
||
|
||
function resetAddForm() {
|
||
dialogs.add = false
|
||
addForm.applicantId = currentUserId()
|
||
addForm.reimburseDate = todayYmd()
|
||
addForm.title = ''
|
||
addForm.remark = ''
|
||
addForm.details = [{ expenseItemId: '', amount: '', remark: '', occurDate: '' }]
|
||
selectedInvoicePicks.value = []
|
||
editingId.value = null
|
||
}
|
||
|
||
/** 保存报销单,成功返回 id;校验失败返回 null */
|
||
async function saveAddForm(payload: AddPayload): Promise<string | null> {
|
||
if (editingId.value) {
|
||
await reimburseApi.update(editingId.value, payload)
|
||
return String(editingId.value)
|
||
}
|
||
const res: any = await reimburseApi.create(payload)
|
||
const data: any = pickBxData(res) || {}
|
||
const id = data.id != null ? String(data.id) : ''
|
||
return id || null
|
||
}
|
||
|
||
/** 保存草稿 */
|
||
async function submitAdd() {
|
||
const payload = buildAddPayload()
|
||
if (!payload) return
|
||
const wasEdit = !!editingId.value
|
||
loadingMap.addSubmit = true
|
||
try {
|
||
const id = await saveAddForm(payload)
|
||
if (!id) {
|
||
ElMessage.error('保存成功但未返回报销单 ID,请从列表重新操作')
|
||
await refreshList()
|
||
return
|
||
}
|
||
ElMessage.success(wasEdit ? '保存成功' : '新增成功')
|
||
resetAddForm()
|
||
await refreshList()
|
||
} catch (e: any) {
|
||
ElMessage.error(e.message || (wasEdit ? '保存失败' : '新增失败'))
|
||
} finally {
|
||
loadingMap.addSubmit = false
|
||
}
|
||
}
|
||
|
||
/** 保存并提交审批 */
|
||
async function submitAddAndApprove() {
|
||
const payload = buildAddPayload()
|
||
if (!payload) return
|
||
loadingMap.addApprove = true
|
||
try {
|
||
const id = await saveAddForm(payload)
|
||
if (!id) {
|
||
ElMessage.error('保存成功但未返回报销单 ID,请从列表重新提交审批')
|
||
await refreshList()
|
||
return
|
||
}
|
||
// 保存成功后记下 id,提交失败时再次操作会走更新而非重复新建
|
||
editingId.value = id
|
||
await reimburseApi.submit(id)
|
||
ElMessage.success('提交成功')
|
||
resetAddForm()
|
||
await refreshList()
|
||
} catch (e: any) {
|
||
ElMessage.error(e.message || '提交失败')
|
||
await refreshList()
|
||
} finally {
|
||
loadingMap.addApprove = false
|
||
}
|
||
}
|
||
|
||
async function openView(row: any) {
|
||
try {
|
||
const res = await reimburseApi.getById(row.id)
|
||
viewData.value = res.data || res
|
||
viewFlowNodes.value = []
|
||
viewApprovalHistory.value = []
|
||
viewAttachments.value = []
|
||
viewPayAttachments.value = []
|
||
viewOffsetAttachments.value = []
|
||
const linkedInvoices = Array.isArray(viewData.value?.invoices) ? viewData.value.invoices : []
|
||
viewLinkedInvoiceFiles.value = invoicesToAttachmentFiles(linkedInvoices)
|
||
dialogs.view = true
|
||
if (row.id) {
|
||
try {
|
||
const [applyFiles, payFiles, offsetFiles] = await Promise.all([
|
||
loadBxAttachments('reimburse_apply', row.id).catch(() => []),
|
||
loadBxAttachments('reimburse_pay', row.id).catch(() => []),
|
||
loadBxAttachments('reimburse_offset', row.id).catch(() => []),
|
||
fillBxAttachmentPreviews(viewLinkedInvoiceFiles.value).catch(() => undefined)
|
||
])
|
||
viewAttachments.value = applyFiles
|
||
viewPayAttachments.value = payFiles
|
||
viewOffsetAttachments.value = offsetFiles
|
||
} catch {
|
||
/* ignore attachment fetch error */
|
||
}
|
||
}
|
||
viewFlowLoading.value = true
|
||
try {
|
||
const [flowRes, historyRes]: any[] = await Promise.all([
|
||
reimburseApi.getApprovals(row.id),
|
||
reimburseApi.getApprovalHistory(row.id)
|
||
])
|
||
viewFlowNodes.value = (flowRes.data || []).sort((a: any, b: any) => a.nodeOrder - b.nodeOrder)
|
||
viewApprovalHistory.value = historyRes.data || []
|
||
} catch {
|
||
/* ignore flow fetch error in view */
|
||
} finally {
|
||
viewFlowLoading.value = false
|
||
}
|
||
} catch (e: any) {
|
||
ElMessage.error(e.message || '加载详情失败')
|
||
}
|
||
}
|
||
|
||
function viewProcessMode(data: Record<string, any>) {
|
||
const hasOffset = Number(data.offsetAmount || 0) > 0
|
||
const hasPay = Number(data.actualAmount ?? 0) > 0 || data.payStatus === 'paid'
|
||
if (hasOffset && hasPay) return '冲抵 + 发放'
|
||
if (hasOffset) return '仅冲抵'
|
||
if (hasPay) return '仅发放'
|
||
return '未处理'
|
||
}
|
||
|
||
async function openFlowDialog(row?: any) {
|
||
const target = row || selectedRows.value[0]
|
||
if (!target) {
|
||
ElMessage.warning('请先选择一条申请记录')
|
||
return
|
||
}
|
||
flowNodes.value = []
|
||
flowHistory.value = []
|
||
flowLoading.value = true
|
||
dialogs.viewFlow = true
|
||
try {
|
||
const [flowRes, historyRes]: any[] = await Promise.all([
|
||
reimburseApi.getApprovals(target.id),
|
||
reimburseApi.getApprovalHistory(target.id)
|
||
])
|
||
flowNodes.value = (flowRes.data || []).sort((a: any, b: any) => a.nodeOrder - b.nodeOrder)
|
||
flowHistory.value = historyRes.data || []
|
||
} catch (e: any) {
|
||
ElMessage.error(e.message || '加载审批流程失败')
|
||
} finally {
|
||
flowLoading.value = false
|
||
}
|
||
}
|
||
|
||
async function handleSubmit(row: any) {
|
||
loadingMap[`submit_${row.id}`] = true
|
||
try {
|
||
await reimburseApi.submit(row.id)
|
||
ElMessage.success('提交成功')
|
||
await refreshList()
|
||
} catch (e: any) {
|
||
ElMessage.error(e.message || '提交失败')
|
||
} finally {
|
||
loadingMap[`submit_${row.id}`] = false
|
||
}
|
||
}
|
||
|
||
async function handleDelete(row: any) {
|
||
if (!canDeleteByCreator(row)) {
|
||
ElMessage.warning(CREATOR_DELETE_TIP)
|
||
return
|
||
}
|
||
try {
|
||
await ElMessageBox.confirm('确定要删除该报销单吗?删除后不可恢复。', '删除确认', {
|
||
confirmButtonText: '确定删除',
|
||
cancelButtonText: '取消',
|
||
type: 'warning'
|
||
})
|
||
loadingMap[`del_${row.id}`] = true
|
||
await reimburseApi.delete(row.id)
|
||
ElMessage.success('删除成功')
|
||
await refreshList()
|
||
} catch (e: any) {
|
||
if (e !== 'cancel') {
|
||
ElMessage.error(e?.message || '删除失败')
|
||
}
|
||
} finally {
|
||
loadingMap[`del_${row.id}`] = false
|
||
}
|
||
}
|
||
|
||
function viewDetailSummary({ columns, data }: { columns: any[]; data: any[] }) {
|
||
const sums: string[] = []
|
||
columns.forEach((_: any, index: number) => {
|
||
if (index === 0) {
|
||
sums[index] = '合计'
|
||
return
|
||
}
|
||
if (index === 2) {
|
||
const total = data.reduce((sum: number, row: any) => sum + Number(row.amount || 0), 0)
|
||
sums[index] = formatMoneyYuan(total)
|
||
return
|
||
}
|
||
sums[index] = ''
|
||
})
|
||
return sums
|
||
}
|
||
</script>
|
||
|
||
<style scoped lang="scss">
|
||
.import-hint {
|
||
margin: 0 0 12px;
|
||
color: var(--mint-text-muted, #64748b);
|
||
font-size: 13px;
|
||
line-height: 1.5;
|
||
}
|
||
|
||
.import-tip {
|
||
margin: 0 0 8px;
|
||
color: #d97706;
|
||
font-size: 13px;
|
||
line-height: 1.5;
|
||
}
|
||
|
||
.import-result {
|
||
margin-top: 16px;
|
||
}
|
||
|
||
.invoice-balance-tip {
|
||
margin: 0 0 10px;
|
||
font-size: 13px;
|
||
color: var(--mint-text-muted, #64748b);
|
||
}
|
||
|
||
.invoice-balance-warn {
|
||
color: var(--el-color-danger);
|
||
}
|
||
|
||
.invoice-select-toolbar {
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
gap: 10px;
|
||
align-items: center;
|
||
margin-bottom: 10px;
|
||
}
|
||
|
||
.invoice-selected-thumbs {
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
gap: 8px;
|
||
}
|
||
|
||
.invoice-selected-card {
|
||
position: relative;
|
||
width: 96px;
|
||
border: 2px solid var(--invoice-group-color, var(--border, #d9e8e2));
|
||
border-radius: 6px;
|
||
background: var(--surface, #fff);
|
||
overflow: hidden;
|
||
}
|
||
|
||
.invoice-selected-card__remove {
|
||
position: absolute;
|
||
z-index: 2;
|
||
top: 4px;
|
||
right: 4px;
|
||
width: 18px;
|
||
height: 18px;
|
||
padding: 0;
|
||
border: none;
|
||
border-radius: 50%;
|
||
background: rgba(15, 23, 42, 0.55);
|
||
color: #fff;
|
||
display: inline-flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
cursor: pointer;
|
||
|
||
&:hover {
|
||
background: var(--el-color-danger);
|
||
}
|
||
}
|
||
|
||
.invoice-selected-card__preview {
|
||
width: 100%;
|
||
height: 64px;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
background: var(--table-head, #f8fafc);
|
||
overflow: hidden;
|
||
|
||
img {
|
||
width: 100%;
|
||
height: 100%;
|
||
object-fit: cover;
|
||
display: block;
|
||
}
|
||
}
|
||
|
||
.invoice-selected-card__icon {
|
||
width: 36px;
|
||
height: 36px;
|
||
border-radius: 8px;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
|
||
&--video {
|
||
background: #ede9fe;
|
||
color: #7c3aed;
|
||
}
|
||
|
||
&--doc {
|
||
background: #e0f2fe;
|
||
color: #0284c7;
|
||
}
|
||
}
|
||
|
||
.invoice-selected-card__meta {
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 1px;
|
||
padding: 4px 6px;
|
||
}
|
||
|
||
.invoice-selected-card__name {
|
||
display: -webkit-box;
|
||
-webkit-line-clamp: 1;
|
||
-webkit-box-orient: vertical;
|
||
overflow: hidden;
|
||
font-size: 10px;
|
||
line-height: 1.3;
|
||
color: var(--text, #1e293b);
|
||
word-break: break-all;
|
||
}
|
||
|
||
.invoice-selected-card__footer {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
gap: 4px;
|
||
}
|
||
|
||
.invoice-selected-card__amount {
|
||
font-size: 11px;
|
||
font-weight: 600;
|
||
color: var(--primary-dark, #059669);
|
||
}
|
||
|
||
.invoice-selected-card__download {
|
||
flex-shrink: 0;
|
||
width: 18px;
|
||
height: 18px;
|
||
border-radius: 4px;
|
||
color: var(--mint-text-muted, #64748b);
|
||
cursor: pointer;
|
||
|
||
&:hover {
|
||
background: var(--primary, #10b981);
|
||
color: #fff;
|
||
}
|
||
}
|
||
|
||
.bx-list-table-wrap {
|
||
min-width: 0;
|
||
}
|
||
</style>
|