Files
sgxt_web/src/views/home/model/qingBaowbTable.vue

200 lines
4.5 KiB
Vue
Raw Normal View History

2025-12-12 16:04:04 +08:00
<template>
<div class="qingbao-table-container">
<div class="tab-buttons">
<div class="tab-button" :class="{ active: activeTab === 'xxy' }" @click="switchTab('xxy')">
优秀信息员
</div>
<div class="tab-button" :class="{ active: activeTab === 'ypy' }" @click="switchTab('ypy')">
2025-12-18 11:58:26 +08:00
优秀研判员
2025-12-12 16:04:04 +08:00
</div>
</div>
2025-12-12 16:04:04 +08:00
<div class="table-wrapper">
2025-12-19 15:54:20 +08:00
<el-table
:data="tableData"
2025-12-19 11:41:05 +08:00
style="width: 100%"
stripe
2025-12-19 15:54:20 +08:00
height="calc(100% - 1px)"
2025-12-19 11:41:05 +08:00
:header-cell-style="{
background: 'transparent',
color: '#ffffff',
borderColor: '#0d4b8a'
2025-12-19 15:54:20 +08:00
}"
2025-12-19 11:41:05 +08:00
:row-style="{
background: 'transparent',
color: '#fff',
borderColor: '#0d4b8a'
2025-12-19 15:54:20 +08:00
}"
2025-12-19 11:41:05 +08:00
>
2025-12-12 16:04:04 +08:00
<el-table-column prop="ssbm" label="部门名称" min-width="120" show-overflow-tooltip />
<el-table-column prop="xm" label="姓名" min-width="80" show-overflow-tooltip />
<!-- 信息员积分 研判员积分 -->
<el-table-column :prop="scoreField" :label="scoreLabel" min-width="80" show-overflow-tooltip />
</el-table>
</div>
</div>
</template>
<script setup>
import { ref, onMounted, computed } from 'vue'
import { qcckGet } from "@/api/qcckApi.js"
const activeTab = ref('xxy') // 默认选中优秀信息员
const tableData = ref([])
const tableHeight = ref(300)
// 根据当前标签页确定积分字段和标签
const scoreField = computed(() => {
return activeTab.value === 'xxy' ? 'xxyjf' : 'ypyjf'
})
const scoreLabel = computed(() => {
return activeTab.value === 'xxy' ? '信息员积分' : '研判员积分'
})
// 切换标签页
const switchTab = (tab) => {
activeTab.value = tab
fetchData()
}
2025-12-12 16:04:04 +08:00
// 获取表格数据
const fetchData = () => {
const params = {
2025-12-12 16:04:04 +08:00
}
const url = activeTab.value === 'xxy' ? '/mosty-gsxt/xxcj/mjjf/cjrList' : '/mosty-gsxt/xxcj/mjjf/ypyList'
qcckGet(params, url).then(res => {
2025-12-12 16:27:30 +08:00
tableData.value = Array.isArray(res) ? res : []
tableData.value = tableData.value.slice(0, 100) // 取前100条数据避免卡顿
2025-12-12 16:04:04 +08:00
}).catch(error => {
tableData.value = []
})
}
onMounted(() => {
// 设置表格高度
// tableHeight.value = calc(100% - 50px)
fetchData()
})
// 暴露方法给父组件,用于时间查询
defineExpose({
fetchData
})
</script>
<style lang="scss" scoped>
.qingbao-table-container {
height: 100%;
padding: 2px 10px;
2025-12-12 16:04:04 +08:00
.tab-buttons {
display: flex;
margin-bottom: 4px;
2025-12-12 16:04:04 +08:00
gap: 10px;
.tab-button {
2025-12-19 11:41:05 +08:00
padding: 0px 10px;
2025-12-12 16:04:04 +08:00
background: rgba(0, 77, 167, 0.6);
color: #fff;
border: 1px solid #0099ff;
border-radius: 4px;
cursor: pointer;
transition: all 0.3s ease;
font-size: 14px;
2025-12-19 15:54:20 +08:00
opacity: 0.3;
2025-12-12 16:04:04 +08:00
&:hover {
2025-12-19 15:54:20 +08:00
// background: rgba(0, 77, 167, 0.8);
opacity: 0.4;
2025-12-12 16:04:04 +08:00
}
&.active {
2025-12-19 15:54:20 +08:00
opacity: 1;
// background: rgba(0, 244, 255, 0.8);
// color: #0072ff;
// border-color: #00f4ff;
2025-12-12 16:04:04 +08:00
}
}
}
.table-wrapper {
height: calc(100% - 30px);
2025-12-12 16:04:04 +08:00
:deep(.el-table) {
background: transparent;
tr {
background-color: rgba(0, 78, 167, 0.041) !important;
}
2025-12-12 16:04:04 +08:00
.el-table__header-wrapper {
background: transparent;
}
.el-table__body-wrapper {
background: transparent;
}
.el-table__row {
background: transparent !important;
2025-12-12 16:04:04 +08:00
&:hover>td.el-table__cell {
background: transparent !important;
2025-12-12 16:04:04 +08:00
}
}
// 设置行高
.el-table__row td {
height: 32px !important;
line-height: 32px !important;
}
// 设置表头行高
.el-table__header th {
height: 36px !important;
line-height: 36px !important;
padding: 0 !important;
background: transparent !important;
}
// 去掉所有白色背景
&::before {
display: none;
}
.el-table__cell {
background: transparent !important;
}
.el-table__header th.el-table__cell {
background: transparent !important;
}
2025-12-12 16:04:04 +08:00
.el-table__cell {
border-bottom: 1px solid #0d4b8a;
padding: 0 12px;
}
// 去掉表格的白色背景
.el-table__inner {
background-color: transparent !important;
}
.el-table__header {
background-color: transparent !important;
}
.el-table__body {
background-color: transparent !important;
2025-12-12 16:04:04 +08:00
}
}
}
}
2025-12-19 13:15:06 +08:00
::v-deep .el-table .cell.el-tooltip{
color: #fff;
}
2025-12-12 16:04:04 +08:00
</style>