diff --git a/bms-front/src/components/TableCopyMenu/index.vue b/bms-front/src/components/TableCopyMenu/index.vue new file mode 100644 index 00000000..8630feba --- /dev/null +++ b/bms-front/src/components/TableCopyMenu/index.vue @@ -0,0 +1,206 @@ + + + + + diff --git a/bms-front/src/main.js b/bms-front/src/main.js index 932565fc..0bff19d8 100644 --- a/bms-front/src/main.js +++ b/bms-front/src/main.js @@ -61,6 +61,8 @@ import ChannelSelect from '@/components/ChannelSelect' import MultiValueInput from '@/components/MultiValueInput' // 表格列设置组件(自定义列显隐) import ColumnSettings from '@/components/ColumnSettings' +// 表格右键复制列值菜单 +import TableCopyMenu from '@/components/TableCopyMenu' const app = createApp(App) @@ -93,6 +95,7 @@ app.component('ProductSelect', ProductSelect) app.component('ChannelSelect', ChannelSelect) app.component('MultiValueInput', MultiValueInput) app.component('ColumnSettings', ColumnSettings) +app.component('TableCopyMenu', TableCopyMenu) app.use(router) app.use(store) diff --git a/bms-front/src/views/ar/receipt/index.vue b/bms-front/src/views/ar/receipt/index.vue index a826c7e8..14c31e24 100644 --- a/bms-front/src/views/ar/receipt/index.vue +++ b/bms-front/src/views/ar/receipt/index.vue @@ -49,9 +49,12 @@ 已选 {{ selectedReceipts.length }} 笔收款, 收款总额(本位币):CNY {{ selectedCnyTotal }} + (勾选后在表格内右键可复制所选列的值) - + @@ -657,6 +660,14 @@ 取 消 + + + @@ -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; +} diff --git a/bms-front/src/views/customersuppliermanagement/customerinfo/index.vue b/bms-front/src/views/customersuppliermanagement/customerinfo/index.vue index 3eef90d5..1c2e95ee 100644 --- a/bms-front/src/views/customersuppliermanagement/customerinfo/index.vue +++ b/bms-front/src/views/customersuppliermanagement/customerinfo/index.vue @@ -129,7 +129,9 @@ - + @@ -285,13 +287,22 @@ :customer-name="logCustomer.customerName" :customer-code="logCustomer.customerCode" /> + + + -