|
@@ -36,12 +36,17 @@
|
|
|
:style="{ visibility }"
|
|
|
:columns="customRendererColumns"
|
|
|
:data="dealedTableData"
|
|
|
+ row-key="rowKey"
|
|
|
:width="width"
|
|
|
:height="height"
|
|
|
:fixed="isDeparture"
|
|
|
:footer-height="60"
|
|
|
- :row-class="rowClassV2"
|
|
|
+ :row-class="rowClass"
|
|
|
:cell-props="cellPropsGetter"
|
|
|
+ :row-event-handlers="rowEventHandlers"
|
|
|
+ :h-scrollbar-size="12"
|
|
|
+ :w-scrollbar-size="12"
|
|
|
+ scrollbar-always-on
|
|
|
@scroll="tableScrollHandler"
|
|
|
>
|
|
|
<template #footer>
|
|
@@ -79,9 +84,9 @@ import { useTableStyle } from '../../hooks/useTableStyle'
|
|
|
import { useTableCellClick } from '../../hooks/useTableCellClick'
|
|
|
import { useTableFilterAndSort } from '@/hooks/useTableFilterAndSort'
|
|
|
import { useCount } from './useCount'
|
|
|
-import { ElTableV2, TableV2Instance } from 'element-plus'
|
|
|
+import { ElTableV2, RowEventHandlers, TableV2Instance } from 'element-plus'
|
|
|
import { CommonData } from '~/common'
|
|
|
-import type { HeaderRenderProps, CellRenderProps, ScrollParams } from '../../type'
|
|
|
+import type { HeaderRenderProps, CellRenderProps, RowClassGetter, ScrollParams } from '../../type'
|
|
|
import { useLoop } from '@/hooks/useLoop'
|
|
|
|
|
|
const props = defineProps({
|
|
@@ -139,6 +144,19 @@ const { rowClassV2, cellClassV2 } = useTableStyle(props.name)
|
|
|
const cellPropsGetter = params => ({
|
|
|
class: cellClassV2(params),
|
|
|
})
|
|
|
+const rowClass: RowClassGetter = (params) => {
|
|
|
+ const selectedRowClass = (selectedRowKey.value && params.rowData.rowKey === selectedRowKey.value) ? 'is-selected' : ''
|
|
|
+ return `${rowClassV2(params)} ${selectedRowClass}`
|
|
|
+}
|
|
|
+const selectedRowKey = ref('')
|
|
|
+watch(formData, () => {
|
|
|
+ selectedRowKey.value = ''
|
|
|
+})
|
|
|
+const rowEventHandlers:RowEventHandlers = {
|
|
|
+ onClick: (params) => {
|
|
|
+ selectedRowKey.value = params.rowKey as string
|
|
|
+ }
|
|
|
+}
|
|
|
|
|
|
const tableDataCount = computed(() =>
|
|
|
tableData.value.reduce(
|