2025-09-01 16:55:44 +08:00
|
|
|
<template>
|
2025-09-02 17:05:10 +08:00
|
|
|
<div class="comtable">
|
2025-09-01 16:55:44 +08:00
|
|
|
<div class="table" ref="comtable">
|
|
|
|
|
<a-table
|
2025-09-02 17:05:10 +08:00
|
|
|
bordered
|
|
|
|
|
:loading="loading"
|
|
|
|
|
:columns="columns"
|
|
|
|
|
:scroll="scroll"
|
|
|
|
|
:data-source="data.realTableData"
|
|
|
|
|
:pagination="false"
|
|
|
|
|
:row-class-name="rowClassName"
|
|
|
|
|
row-key="id"
|
|
|
|
|
:expand-icon="expandIcon"
|
|
|
|
|
:row-selection="
|
|
|
|
|
data.newTableOpt.select
|
|
|
|
|
? {
|
|
|
|
|
selectedRowKeys: data.selectedRowKeys,
|
|
|
|
|
onChange: onSelectChange
|
|
|
|
|
}
|
|
|
|
|
: false
|
|
|
|
|
"
|
|
|
|
|
:expanded-row-keys="data.newTableOpt.expand ? data.expandedKeys : null"
|
|
|
|
|
size="middle"
|
|
|
|
|
:indent-size="30"
|
|
|
|
|
@resizeColumn="handleResizeColumn"
|
|
|
|
|
>
|
|
|
|
|
<template #bodyCell="{ column, record }">
|
|
|
|
|
<template v-if="column.scopedSlots">
|
|
|
|
|
<slot
|
|
|
|
|
v-bind="record"
|
|
|
|
|
:name="column.scopedSlots ? column.scopedSlots.customRender : ''"
|
|
|
|
|
></slot>
|
|
|
|
|
</template>
|
2025-09-01 16:55:44 +08:00
|
|
|
</template>
|
2025-09-02 17:05:10 +08:00
|
|
|
<template v-if="data.newTableOpt.expand" #expandedRowRender="{ record }">
|
|
|
|
|
<a-table
|
|
|
|
|
size="small"
|
|
|
|
|
:columns="innerColumns"
|
|
|
|
|
:data-source="record.currentLimitList"
|
|
|
|
|
:pagination="false"
|
|
|
|
|
>
|
2025-09-04 13:42:48 +08:00
|
|
|
<!-- <template #bodyCell="{ column, record_ }">
|
2025-09-02 17:05:10 +08:00
|
|
|
<template v-if="column.key === 'type'">
|
|
|
|
|
<span>
|
|
|
|
|
{{ getType(record_.type) }}
|
|
|
|
|
</span>
|
2025-09-01 16:55:44 +08:00
|
|
|
</template>
|
2025-09-04 13:42:48 +08:00
|
|
|
</template> -->
|
2025-09-02 17:05:10 +08:00
|
|
|
</a-table>
|
|
|
|
|
</template>
|
|
|
|
|
</a-table>
|
2025-09-01 16:55:44 +08:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="pagination" v-if="data.newTableOpt.page">
|
|
|
|
|
<a-pagination
|
2025-09-05 09:26:14 +08:00
|
|
|
v-model:current="data.newPageOption.page"
|
|
|
|
|
:total="data.newPageOption.count"
|
2025-09-01 16:55:44 +08:00
|
|
|
:page-size="data.newPageOption.pageSize"
|
|
|
|
|
@change="onChange"
|
|
|
|
|
show-size-changer
|
|
|
|
|
show-quick-jumper
|
|
|
|
|
:page-size-options="data.pageSizeOptions"
|
|
|
|
|
>
|
|
|
|
|
</a-pagination>
|
2025-09-02 17:05:10 +08:00
|
|
|
<div style="color: #7f8fa4; height: 30px; line-height: 30px; margin: 0 10px">
|
|
|
|
|
共<span style="color: aqua; font-size: 18px; margin: 0 2px">{{
|
2025-09-05 09:26:14 +08:00
|
|
|
data.newPageOption.count
|
2025-09-02 17:05:10 +08:00
|
|
|
}}</span
|
2025-09-05 09:26:14 +08:00
|
|
|
>条
|
2025-09-02 17:05:10 +08:00
|
|
|
</div>
|
2025-09-01 16:55:44 +08:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup>
|
|
|
|
|
// <a-select :dropdownMatchSelectWidth="false" size="small" placement="top" />
|
|
|
|
|
import {
|
|
|
|
|
nextTick,
|
|
|
|
|
ref,
|
|
|
|
|
toRefs,
|
|
|
|
|
reactive,
|
|
|
|
|
onMounted,
|
|
|
|
|
watch,
|
|
|
|
|
defineProps,
|
|
|
|
|
defineEmits,
|
2025-09-02 17:05:10 +08:00
|
|
|
defineExpose
|
2025-09-01 16:55:44 +08:00
|
|
|
} from 'vue'
|
|
|
|
|
|
|
|
|
|
const comtable = ref('')
|
|
|
|
|
const props = defineProps({
|
2025-09-02 17:05:10 +08:00
|
|
|
columns: { type: Array, default: () => [] },
|
|
|
|
|
tableData: { type: Array, default: () => [] },
|
2025-09-01 16:55:44 +08:00
|
|
|
tableOption: {
|
|
|
|
|
type: Object,
|
|
|
|
|
default: () => {
|
|
|
|
|
return {
|
|
|
|
|
loading: false,
|
|
|
|
|
page: true,
|
|
|
|
|
align: 'center',
|
|
|
|
|
expand: false,
|
|
|
|
|
select: true,
|
|
|
|
|
scroll: { y: 750 }
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
pageOption: {
|
|
|
|
|
type: Object,
|
|
|
|
|
default: () => {
|
|
|
|
|
return {
|
2025-09-05 09:26:14 +08:00
|
|
|
count: 1,
|
2025-09-01 16:55:44 +08:00
|
|
|
pageSize: 10,
|
2025-09-05 09:26:14 +08:00
|
|
|
page: 1
|
2025-09-01 16:55:44 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
selectField: {
|
|
|
|
|
type: Array,
|
|
|
|
|
default: () => {
|
|
|
|
|
return []
|
|
|
|
|
}
|
2025-09-02 17:05:10 +08:00
|
|
|
}
|
|
|
|
|
// rowClick: {
|
|
|
|
|
// default: () => {}
|
|
|
|
|
// },
|
|
|
|
|
// tableH: {
|
|
|
|
|
// type: Number,
|
2025-09-01 16:55:44 +08:00
|
|
|
|
2025-09-02 17:05:10 +08:00
|
|
|
// },
|
2025-09-01 16:55:44 +08:00
|
|
|
})
|
|
|
|
|
function handleResizeColumn(w, col) {
|
|
|
|
|
col.width = w
|
|
|
|
|
}
|
|
|
|
|
const mountedScroll = () => {
|
2025-09-02 17:05:10 +08:00
|
|
|
// data.newColumns = [...props.columns]
|
|
|
|
|
// data.realTableData = [...props.tableData]
|
|
|
|
|
// // tableScoll()
|
2025-09-01 16:55:44 +08:00
|
|
|
}
|
|
|
|
|
const emit = defineEmits(['handlePagesizeChange'])
|
|
|
|
|
const data = reactive({
|
|
|
|
|
expandedKeys: [],
|
|
|
|
|
newColumns: [],
|
|
|
|
|
selectedRowKeys: [],
|
|
|
|
|
realColumns: [],
|
|
|
|
|
realTableData: [],
|
|
|
|
|
selectedRows: [],
|
|
|
|
|
defaultTabOpt: {
|
|
|
|
|
page: true,
|
|
|
|
|
align: 'center',
|
|
|
|
|
expand: false,
|
|
|
|
|
select: true
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
newPageOption: {},
|
|
|
|
|
newTableOpt: {},
|
2025-09-05 16:41:50 +08:00
|
|
|
pageSizeOptions: ['10', '20', '30', '40', '50', '100'],
|
2025-09-01 16:55:44 +08:00
|
|
|
mountedScroll
|
|
|
|
|
})
|
|
|
|
|
const loading = ref(false)
|
|
|
|
|
const scroll = ref({})
|
|
|
|
|
|
2025-09-02 17:05:10 +08:00
|
|
|
onMounted(async () => {
|
2025-09-01 16:55:44 +08:00
|
|
|
data.newColumns = [...props.columns]
|
|
|
|
|
data.realTableData = [...props.tableData]
|
|
|
|
|
await nextTick()
|
|
|
|
|
// console.log(props.tableH, 'props.tableH');
|
|
|
|
|
|
|
|
|
|
scroll.value = { y: comtable.value.offsetHeight - 56 }
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
watch(
|
|
|
|
|
() => props.tableData,
|
|
|
|
|
(n, o) => {
|
|
|
|
|
if (n) {
|
|
|
|
|
data.realTableData = [...n]
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{ deep: true, immediate: true }
|
|
|
|
|
)
|
|
|
|
|
watch(
|
|
|
|
|
() => props.pageOption,
|
|
|
|
|
(n, o) => {
|
|
|
|
|
data.newPageOption = { ...n }
|
|
|
|
|
},
|
|
|
|
|
{ deep: true, immediate: true }
|
|
|
|
|
)
|
|
|
|
|
watch(
|
|
|
|
|
() => props.tableOption,
|
|
|
|
|
(n, o) => {
|
|
|
|
|
data.newTableOpt = { ...data.defaultTabOpt, ...n }
|
|
|
|
|
},
|
|
|
|
|
{ deep: true, immediate: true }
|
|
|
|
|
)
|
|
|
|
|
watch(
|
|
|
|
|
() => props.tableH,
|
|
|
|
|
(n, o) => {
|
|
|
|
|
if (n && n !== o) {
|
|
|
|
|
const pageH = data.newTableOpt.page ? 42 : 0
|
|
|
|
|
scroll.value = { y: n - pageH - 56 }
|
|
|
|
|
}
|
2025-09-02 17:05:10 +08:00
|
|
|
}
|
2025-09-01 16:55:44 +08:00
|
|
|
// { deep: true, immediate: true }
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
function rowClassName(record, index) {
|
|
|
|
|
return 'table-row'
|
|
|
|
|
}
|
|
|
|
|
function expandIcon(props) {}
|
|
|
|
|
function onChange(page, pageSize) {
|
2025-09-05 09:26:14 +08:00
|
|
|
data.newPageOption.page = page
|
2025-09-01 16:55:44 +08:00
|
|
|
data.newPageOption.pageSize = pageSize
|
|
|
|
|
emit('handlePagesizeChange', data.newPageOption)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function onSelectChange(selectedRowKeys, selectedRows) {
|
|
|
|
|
data.selectedRowKeys = selectedRowKeys
|
|
|
|
|
data.selectedRows = selectedRows
|
|
|
|
|
}
|
|
|
|
|
defineExpose({ ...toRefs(data), loading, mountedScroll, scroll: data.scroll })
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
.comtable {
|
|
|
|
|
border-radius: 8px;
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100%;
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
justify-content: space-between;
|
2025-09-02 17:05:10 +08:00
|
|
|
.table {
|
|
|
|
|
flex: 1;
|
2025-09-01 16:55:44 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.pagination {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: flex-end;
|
|
|
|
|
margin-top: 10px;
|
|
|
|
|
// margin-bottom: 10px;
|
|
|
|
|
min-width: 420px;
|
|
|
|
|
height: 32px;
|
|
|
|
|
}
|
|
|
|
|
|
2025-09-02 17:05:10 +08:00
|
|
|
:deep(.ant-table) {
|
|
|
|
|
border-radius:20px 20px 0 0 !important;
|
|
|
|
|
overflow: hidden; /* 确保圆角生效 */
|
2025-09-01 16:55:44 +08:00
|
|
|
}
|
2025-09-02 17:05:10 +08:00
|
|
|
:deep(.ant-table-wrapper .ant-table.ant-table-bordered >.ant-table-container){
|
|
|
|
|
border-inline-start:none!important;
|
2025-09-01 16:55:44 +08:00
|
|
|
}
|
2025-09-02 17:05:10 +08:00
|
|
|
:deep(.ant-table-thead ){
|
|
|
|
|
background: linear-gradient(0deg, rgba(61, 254, 250, 0.2), rgba(61, 254, 250, 0.2)),
|
|
|
|
|
linear-gradient(
|
|
|
|
|
90deg,
|
|
|
|
|
rgba(61, 254, 250, 0) 0%,
|
|
|
|
|
rgba(0, 255, 251, 0.15) 50.17%,
|
|
|
|
|
rgba(61, 254, 250, 0) 100%
|
|
|
|
|
)!important;
|
|
|
|
|
}
|
|
|
|
|
:deep(.ant-table-thead > tr > th) {
|
|
|
|
|
border-inline: 1px solid transparent !important;
|
|
|
|
|
background: transparent;
|
|
|
|
|
color: #fff !important;
|
|
|
|
|
border-bottom: none !important; /* 可选:去除底部边框 */
|
2025-09-01 16:55:44 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
:deep(
|
2025-09-02 17:05:10 +08:00
|
|
|
.ant-table-wrapper
|
|
|
|
|
.ant-table.ant-table-bordered
|
|
|
|
|
> .ant-table-container
|
|
|
|
|
> .ant-table-header
|
|
|
|
|
> table
|
|
|
|
|
) {
|
2025-09-01 16:55:44 +08:00
|
|
|
border-top: none !important;
|
2025-09-02 17:05:10 +08:00
|
|
|
border-inline-start: none !important;
|
2025-09-01 16:55:44 +08:00
|
|
|
}
|
|
|
|
|
:deep(.ant-checkbox-checked .ant-checkbox-inner) {
|
|
|
|
|
background-color: var(--table-header-bg) !important;
|
|
|
|
|
border: none !important;
|
|
|
|
|
}
|
|
|
|
|
:deep(.ant-checkbox-indeterminate .ant-checkbox-inner:after) {
|
|
|
|
|
background-color: var(--table-header-bg) !important;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
:deep(.ant-pagination) {
|
2025-09-02 17:05:10 +08:00
|
|
|
.ant-pagination-item-link {
|
|
|
|
|
color: #fff !important;
|
|
|
|
|
height: 100% !important;
|
|
|
|
|
display: block !important;
|
|
|
|
|
}
|
2025-09-01 16:55:44 +08:00
|
|
|
.ant-pagination-prev,
|
|
|
|
|
.ant-pagination-next {
|
2025-09-02 17:05:10 +08:00
|
|
|
background: transparent !important;
|
|
|
|
|
color: #fff !important;
|
|
|
|
|
border: 1px solid $page-border;
|
|
|
|
|
button {
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
}
|
2025-09-01 16:55:44 +08:00
|
|
|
}
|
|
|
|
|
.ant-select-selector {
|
|
|
|
|
border: none !important;
|
|
|
|
|
}
|
|
|
|
|
.ant-select-arrow {
|
2025-09-02 17:05:10 +08:00
|
|
|
color: #fff !important;
|
2025-09-01 16:55:44 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
span.ant-input-affix-wrapper,
|
|
|
|
|
.ant-select,
|
|
|
|
|
.ant-picker {
|
|
|
|
|
width: 110px !important;
|
|
|
|
|
}
|
|
|
|
|
.ant-select-selection-item {
|
2025-09-02 17:05:10 +08:00
|
|
|
color: #fff !important;
|
|
|
|
|
border: 1px solid $page-border;
|
2025-09-01 16:55:44 +08:00
|
|
|
}
|
|
|
|
|
.ant-select-single:not(.ant-select-customize-input) .ant-select-selector {
|
2025-09-02 17:05:10 +08:00
|
|
|
background-color: transparent !important;
|
2025-09-01 16:55:44 +08:00
|
|
|
}
|
|
|
|
|
.ant-pagination-total-text,
|
|
|
|
|
.ant-pagination-options-quick-jumper {
|
2025-09-02 17:05:10 +08:00
|
|
|
color: #fff !important;
|
2025-09-01 16:55:44 +08:00
|
|
|
margin-inline-end: 9px !important;
|
|
|
|
|
}
|
|
|
|
|
.ant-pagination-options-quick-jumper input {
|
2025-09-02 17:05:10 +08:00
|
|
|
background-color: transparent !important;
|
|
|
|
|
// border: none !important;
|
|
|
|
|
color: #fff !important;
|
2025-09-01 16:55:44 +08:00
|
|
|
}
|
|
|
|
|
.ant-pagination-options .ant-pagination-options-size-changer .ant-select-selector {
|
2025-09-02 17:05:10 +08:00
|
|
|
padding: 0px !important;
|
|
|
|
|
color: #fff !important;
|
|
|
|
|
background-color: transparent !important;
|
|
|
|
|
|
|
|
|
|
.ant-select-selection-item {
|
|
|
|
|
padding: 0 10px;
|
|
|
|
|
}
|
2025-09-01 16:55:44 +08:00
|
|
|
}
|
|
|
|
|
.ant-select-dropdown {
|
|
|
|
|
top: -210px !important;
|
|
|
|
|
}
|
2025-09-02 17:05:10 +08:00
|
|
|
.ant-pagination-item {
|
|
|
|
|
&:not(.ant-pagination-item-active):hover {
|
|
|
|
|
background: #1c797a !important;
|
2025-09-01 16:55:44 +08:00
|
|
|
}
|
2025-09-02 17:05:10 +08:00
|
|
|
a {
|
|
|
|
|
color: #fff;
|
|
|
|
|
border-radius: 2px;
|
|
|
|
|
background: #1c797a !important;
|
2025-09-01 16:55:44 +08:00
|
|
|
}
|
|
|
|
|
}
|
2025-09-02 17:05:10 +08:00
|
|
|
|
2025-09-01 16:55:44 +08:00
|
|
|
.ant-pagination-item-active {
|
2025-09-02 17:05:10 +08:00
|
|
|
border: 1px solid transparent;
|
|
|
|
|
color: #fff;
|
|
|
|
|
background: #1c797a !important;
|
2025-09-01 16:55:44 +08:00
|
|
|
}
|
|
|
|
|
}
|
2025-09-02 17:05:10 +08:00
|
|
|
:deep(.ant-table-wrapper .ant-table.ant-table-bordered >.ant-table-container >.ant-table-body >table >tbody>tr>td){
|
|
|
|
|
border-inline-end: none!important;
|
2025-09-01 16:55:44 +08:00
|
|
|
}
|
|
|
|
|
//表格样式
|
|
|
|
|
:deep(.ant-table-tbody) {
|
|
|
|
|
color: var(--theme-text-default) !important;
|
|
|
|
|
|
|
|
|
|
> tr {
|
|
|
|
|
&:hover {
|
|
|
|
|
> .ant-table-cell {
|
2025-09-02 17:05:10 +08:00
|
|
|
|
|
|
|
|
// background-color: red !important;
|
2025-09-01 16:55:44 +08:00
|
|
|
}
|
|
|
|
|
}
|
2025-09-02 17:05:10 +08:00
|
|
|
|
2025-09-01 16:55:44 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
:deep(.ant-table-body) {
|
2025-09-02 17:05:10 +08:00
|
|
|
color:#fff;
|
|
|
|
|
background: $table-bg !important;
|
|
|
|
|
border: 1px solid $table-border;
|
|
|
|
|
border-radius: 0px 0px 20px 20px;
|
2025-09-01 16:55:44 +08:00
|
|
|
.ant-table-cell {
|
|
|
|
|
background: var(--theme-bg) !important;
|
|
|
|
|
}
|
|
|
|
|
.ant-table-row-selected {
|
|
|
|
|
td {
|
|
|
|
|
background-color: var(--table-select) !important;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.ant-table-cell-fix-right.ant-table-cell-fix-right-first,
|
|
|
|
|
.ant-table-cell-fix-left {
|
|
|
|
|
box-shadow: none !important;
|
|
|
|
|
padding: 8px !important;
|
|
|
|
|
margin: 0 !important;
|
|
|
|
|
}
|
|
|
|
|
|
2025-09-02 17:05:10 +08:00
|
|
|
.ant-empty-description{
|
|
|
|
|
color:#fff;
|
2025-09-01 16:55:44 +08:00
|
|
|
}
|
|
|
|
|
}
|
2025-09-02 17:05:10 +08:00
|
|
|
|
2025-09-01 16:55:44 +08:00
|
|
|
:deep(.ant-table-wrapper) {
|
|
|
|
|
.ant-table-cell-scrollbar,
|
|
|
|
|
.ant-table.ant-table-bordered > .ant-table-container {
|
|
|
|
|
box-shadow: none !important;
|
|
|
|
|
|
2025-09-02 17:05:10 +08:00
|
|
|
&>.ant-table-body >table >tbody>tr>td{
|
|
|
|
|
border-bottom: none !important;
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-09-01 16:55:44 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
:deep(.ant-table-wrapper .ant-table) {
|
|
|
|
|
background-color: transparent !important;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
:deep(
|
2025-09-02 17:05:10 +08:00
|
|
|
.ant-table-wrapper
|
|
|
|
|
.ant-table.ant-table-bordered
|
|
|
|
|
> .ant-table-container
|
|
|
|
|
> .ant-table-body
|
|
|
|
|
> table
|
|
|
|
|
> tbody
|
|
|
|
|
> tr
|
|
|
|
|
> .ant-table-cell-fix-right-first::after
|
|
|
|
|
) {
|
|
|
|
|
// border-inline-end: 1px solid var(--theme-bg) !important;
|
2025-09-01 16:55:44 +08:00
|
|
|
}
|
|
|
|
|
:deep(
|
2025-09-02 17:05:10 +08:00
|
|
|
.ant-table-wrapper
|
|
|
|
|
.ant-table.ant-table-bordered
|
|
|
|
|
> .ant-table-container
|
|
|
|
|
> .ant-table-header
|
|
|
|
|
> table
|
|
|
|
|
> thead
|
|
|
|
|
> tr
|
|
|
|
|
> .ant-table-cell-fix-right-first::after
|
|
|
|
|
) {
|
|
|
|
|
// border-inline-end: 1px solid var(--theme-bg) !important;
|
2025-09-01 16:55:44 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
:deep(.ant-table-wrapper .ant-table-thead th.ant-table-column-has-sorters:hover) {
|
|
|
|
|
background: var(--table-select) !important;
|
|
|
|
|
}
|
|
|
|
|
</style>
|