右键复制
This commit is contained in:
@@ -49,9 +49,12 @@
|
||||
已选 <b>{{ selectedReceipts.length }}</b> 笔收款,
|
||||
收款总额(本位币):<b class="money-in">CNY {{ selectedCnyTotal }}</b>
|
||||
<template v-if="selectedCurrencyText">,原币合计:{{ selectedCurrencyText }}</template>
|
||||
<span class="copy-tip">(勾选后在表格内<strong>右键</strong>可复制所选列的值)</span>
|
||||
</div>
|
||||
|
||||
<el-table :data="receiptList" border v-loading="receiptLoading" @selection-change="onReceiptSelectionChange">
|
||||
<el-table :data="receiptList" border v-loading="receiptLoading"
|
||||
@selection-change="onReceiptSelectionChange"
|
||||
@row-contextmenu="onReceiptRowContextmenu">
|
||||
<el-table-column type="selection" width="42" align="center" />
|
||||
<el-table-column label="收款单号" align="center" prop="receiptNo" width="180" show-overflow-tooltip />
|
||||
<el-table-column label="客户" align="center" min-width="180" show-overflow-tooltip>
|
||||
@@ -657,6 +660,14 @@
|
||||
<el-button @click="cancelWoDialog.visible = false">取 消</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<!-- ====================== 右键复制列菜单 ====================== -->
|
||||
<table-copy-menu
|
||||
ref="copyMenuRef"
|
||||
:columns="copyColumns"
|
||||
:selected-rows="selectedReceipts"
|
||||
entity-label="笔"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -785,6 +796,29 @@ function onReceiptSelectionChange(rows) {
|
||||
selectedReceipts.value = rows || []
|
||||
}
|
||||
|
||||
/* ================= 右键复制列值(复用全局 TableCopyMenu) ================= */
|
||||
// 可复制的列:label 为菜单显示名,get(row) 取该行列值
|
||||
const copyColumns = [
|
||||
{ key: 'receiptNo', label: '收款单号', get: r => r.receiptNo || '' },
|
||||
{ key: 'customerName', label: '客户名称', get: r => r.customerName || '' },
|
||||
{ key: 'customerCode', label: '客户编码', get: r => r.customerCode || '' },
|
||||
{ key: 'receivedAt', label: '收款时间', get: r => (r.receivedAt ? formatDateTime(r.receivedAt) : '') },
|
||||
{ key: 'amount', label: '原币金额', get: r => `${r.currency || ''} ${formatMoney(r.amount)}`.trim() },
|
||||
{ key: 'baseAmount', label: '本位币金额(CNY)', get: r => formatMoney(r.baseAmount) },
|
||||
{ key: 'payMethod', label: '收款方式', get: r => formatOption(payMethodOptions, r.payMethod) },
|
||||
{ key: 'bankTransactionNo', label: '流水号', get: r => r.bankTransactionNo || '' }
|
||||
]
|
||||
const copyMenuRef = ref(null)
|
||||
|
||||
/** 表格行右键:有勾选则复制勾选行,否则只复制当前右键行(逻辑在 TableCopyMenu 内) */
|
||||
function onReceiptRowContextmenu(row, column, event) {
|
||||
copyMenuRef.value && copyMenuRef.value.open(row, event)
|
||||
}
|
||||
|
||||
function closeContextMenu() {
|
||||
copyMenuRef.value && copyMenuRef.value.close()
|
||||
}
|
||||
|
||||
/** 选中收款的本位币总额(CNY) */
|
||||
const selectedCnyTotal = computed(() => {
|
||||
const sum = selectedReceipts.value.reduce((s, r) => s + (Number(r.baseAmount) || 0), 0)
|
||||
@@ -801,6 +835,7 @@ const selectedCurrencyText = computed(() => {
|
||||
})
|
||||
|
||||
function getReceiptList() {
|
||||
closeContextMenu()
|
||||
receiptLoading.value = true
|
||||
receiptQuery.pageNum = receiptQuery.pageNum || 1
|
||||
const params = proxy.addDateRange({ ...receiptQuery }, receiptDateRange.value)
|
||||
@@ -1368,4 +1403,9 @@ getReceiptList()
|
||||
font-weight: 600;
|
||||
margin: 12px 0 8px;
|
||||
}
|
||||
.copy-tip {
|
||||
color: var(--el-text-color-secondary);
|
||||
font-weight: normal;
|
||||
font-size: 12px;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user