Files
sgxt_web/src/views/home/model/qingBaowbTable.vue
2025-12-12 16:27:30 +08:00

188 lines
4.3 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<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')">
优秀研判的列表
</div>
</div>
<div class="table-wrapper">
<el-table :data="tableData" style="width: 100%" height="calc(100% - 1px)" :header-cell-style="{
background: 'transparent',
color: '#0d4b8a',
borderColor: '#0d4b8a'
}" :row-style="{
background: 'transparent',
color: '#fff',
borderColor: '#0d4b8a'
}" stripe>
<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()
}
// 获取表格数据
const fetchData = () => {
const params = {
}
const url = activeTab.value === 'xxy' ? '/mosty-gsxt/xxcj/mjjf/cjrList' : '/mosty-gsxt/xxcj/mjjf/ypyList'
qcckGet(params, url).then(res => {
tableData.value = Array.isArray(res) ? res : []
tableData.value = tableData.value.slice(0, 100) // 取前100条数据避免卡顿
}).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;
.tab-buttons {
display: flex;
margin-bottom: 4px;
gap: 10px;
.tab-button {
padding: 0px 4px;
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;
&:hover {
background: rgba(0, 77, 167, 0.8);
}
&.active {
background: rgba(0, 244, 255, 0.8);
color: #000;
border-color: #00f4ff;
}
}
}
.table-wrapper {
height: calc(100% - 30px);
:deep(.el-table) {
background: transparent;
tr {
background-color: rgba(0, 78, 167, 0.041) !important;
}
.el-table__header-wrapper {
background: transparent;
}
.el-table__body-wrapper {
background: transparent;
}
.el-table__row {
background: transparent !important;
&:hover>td.el-table__cell {
background: transparent !important;
}
}
// 设置行高
.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;
}
.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;
}
}
}
}
</style>