bxztApp/packages/screen/src/views/RiskWarning/Dialog/tongnanResponsibleDialog.vue

389 lines
8.8 KiB
Vue
Raw Normal View History

<template>
<div v-if="visible" class="responsible-dialog-overlay" @click="handleOverlayClick">
<div class="responsible-dialog" @click.stop>
<!-- 标题栏 -->
<div class="dialog-header">
<div class="header-title">潼南建设项目责任人明细</div>
<div class="close-btn" @click="handleClose">
<el-icon><Close /></el-icon>
</div>
</div>
<!-- 数据表格 -->
<div class="table-section">
<div class="table-header">
2026-04-02 16:35:45 +08:00
<div
v-for="(column, index) in tableColumns"
:key="index"
class="th"
:style="{ width: column.width, flex: column.flex || 'none' }"
>
{{ column.label }}
</div>
</div>
<div class="table-body">
<div
v-for="(item, index) in tableData"
:key="item.id"
class="table-row"
:class="{ 'row-even': index % 2 === 1 }"
>
<div class="td" style="width: 60px">{{ item.id }}</div>
<div class="td" style="width: 100px">{{ item.region }}</div>
<div class="td" style="width: 70px">{{ item.totalCount }}</div>
<div class="td" style="width: 70px">{{ item.whistleblower }}</div>
<div class="td" style="width: 130px">{{ item.constructionUnit }}</div>
<div class="td" style="width: 130px">{{ item.contractorUnit }}</div>
<div class="td" style="width: 120px">{{ item.stationed }}</div>
<div class="td" style="width: 120px">{{ item.districtLevel }}</div>
<div class="td" style="width: 120px">{{ item.cityLevel }}</div>
<div class="td" style="width: 60px">
<span class="detail-link" @click="handleDetail(item)">详情</span>
</div>
</div>
</div>
</div>
<!-- 分页 -->
<div class="pagination">
<span class="total">{{ total }}条数据</span>
<div class="page-btns">
<div class="page-btn" :class="{ disabled: currentPage === 1 }" @click="prevPage">
<el-icon><ArrowLeft /></el-icon>
</div>
<div
v-for="page in visiblePages"
:key="page"
class="page-btn"
:class="{ active: currentPage === page }"
@click="goToPage(page)"
>
{{ page }}
</div>
<div class="page-btn" :class="{ disabled: currentPage === totalPages }" @click="nextPage">
<el-icon><ArrowRight /></el-icon>
</div>
</div>
</div>
</div>
</div>
</template>
<script setup>
import { ref, computed, watch } from "vue";
import { Close, ArrowLeft, ArrowRight } from "@element-plus/icons-vue";
const props = defineProps({
visible: {
type: Boolean,
default: false,
},
});
const emit = defineEmits(["update:visible", "close", "detail"]);
2026-04-02 16:35:45 +08:00
// 表格列配置
const tableColumns = ref([
{ label: "序号", width: "60px" },
{ label: "区县/镇街", width: "100px" },
{ label: "总人数", width: "70px" },
{ label: "吹哨人", width: "70px" },
{ label: "建设单位包保责任人", width: "130px" },
{ label: "施工单位包保责任人", width: "130px" },
{ label: "驻地包保责任人", width: "120px" },
{ label: "区县级包保责任人", width: "120px" },
{ label: "市级包保责任人", width: "120px" },
{ label: "操作", width: "60px" },
]);
// 表格数据
const tableData = ref([
{
id: 1,
region: "万州区",
totalCount: 6,
whistleblower: 2,
constructionUnit: 2,
contractorUnit: 2,
stationed: 2,
districtLevel: 2,
cityLevel: 2,
},
{
id: 2,
region: "柏梓镇",
totalCount: 6,
whistleblower: 2,
constructionUnit: 2,
contractorUnit: 2,
stationed: 2,
districtLevel: 2,
cityLevel: 2,
},
]);
// 分页
const currentPage = ref(1);
const pageSize = ref(10);
const total = ref(36);
const totalPages = computed(() => Math.ceil(total.value / pageSize.value));
const visiblePages = computed(() => {
const pages = [];
const maxVisible = 4;
let start = Math.max(1, currentPage.value - Math.floor(maxVisible / 2));
let end = Math.min(totalPages.value, start + maxVisible - 1);
if (end - start + 1 < maxVisible) {
start = Math.max(1, end - maxVisible + 1);
}
for (let i = start; i <= end; i++) {
pages.push(i);
}
return pages;
});
// 关闭对话框
const handleClose = () => {
emit("update:visible", false);
emit("close");
};
// 点击遮罩关闭
const handleOverlayClick = () => {
handleClose();
};
// 查看详情
const handleDetail = (item) => {
emit("detail", item);
};
// 分页操作
const prevPage = () => {
if (currentPage.value > 1) {
currentPage.value--;
fetchData();
}
};
const nextPage = () => {
if (currentPage.value < totalPages.value) {
currentPage.value++;
fetchData();
}
};
const goToPage = (page) => {
currentPage.value = page;
fetchData();
};
// 获取数据
const fetchData = () => {
console.log("获取第", currentPage.value, "页数据");
// 实际项目中调用API获取数据
};
// 监听visible变化
watch(
() => props.visible,
(newVal) => {
if (newVal) {
currentPage.value = 1;
fetchData();
}
}
);
</script>
<style lang="scss" scoped>
.responsible-dialog-overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.6);
display: flex;
align-items: center;
justify-content: center;
z-index: 1000;
}
.responsible-dialog {
2026-04-02 16:35:45 +08:00
width: 80vw;
max-width: 1100px;
background: linear-gradient(135deg, rgba(20, 50, 90, 0.95) 0%, rgba(10, 30, 60, 0.98) 100%);
border: 1px solid rgba(64, 169, 255, 0.3);
border-radius: 12px;
padding: 24px;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}
// 标题栏
.dialog-header {
display: flex;
align-items: center;
justify-content: center;
position: relative;
margin-bottom: 20px;
.header-title {
font-size: 20px;
font-weight: 600;
color: #fff;
padding: 8px 40px;
background: linear-gradient(90deg, transparent 0%, rgba(64, 169, 255, 0.2) 20%, rgba(64, 169, 255, 0.2) 80%, transparent 100%);
border-bottom: 2px solid #40a9ff;
}
.close-btn {
position: absolute;
right: 0;
top: 0;
width: 32px;
height: 32px;
display: flex;
align-items: center;
justify-content: center;
color: rgba(255, 255, 255, 0.7);
cursor: pointer;
font-size: 20px;
transition: color 0.3s;
&:hover {
color: #fff;
}
}
}
// 表格区域
.table-section {
background-color: rgba(30, 70, 120, 0.3);
border-radius: 8px;
overflow: hidden;
margin-bottom: 20px;
.table-header {
display: flex;
background-color: rgba(64, 169, 255, 0.2);
padding: 12px 16px;
.th {
font-size: 13px;
font-weight: 500;
color: #fff;
text-align: center;
}
}
.table-body {
2026-04-02 16:35:45 +08:00
max-height: 40vh;
overflow-y: auto;
.table-row {
display: flex;
padding: 14px 16px;
align-items: center;
transition: background-color 0.3s;
&:hover {
background-color: rgba(64, 169, 255, 0.1);
}
&.row-even {
background-color: rgba(30, 70, 120, 0.2);
}
.td {
font-size: 13px;
color: rgba(255, 255, 255, 0.85);
text-align: center;
.detail-link {
color: #40a9ff;
cursor: pointer;
font-size: 13px;
&:hover {
color: #69c0ff;
text-decoration: underline;
}
}
}
}
}
}
// 分页
.pagination {
display: flex;
align-items: center;
justify-content: flex-end;
gap: 16px;
.total {
font-size: 13px;
color: rgba(255, 255, 255, 0.6);
}
.page-btns {
display: flex;
gap: 8px;
.page-btn {
min-width: 28px;
height: 28px;
display: flex;
align-items: center;
justify-content: center;
background-color: rgba(64, 169, 255, 0.1);
border: 1px solid rgba(64, 169, 255, 0.2);
border-radius: 4px;
font-size: 12px;
color: rgba(255, 255, 255, 0.8);
cursor: pointer;
transition: all 0.3s;
&:hover:not(.disabled):not(.active) {
background-color: rgba(64, 169, 255, 0.2);
border-color: rgba(64, 169, 255, 0.4);
}
&.active {
background-color: #40a9ff;
border-color: #40a9ff;
color: #fff;
}
&.disabled {
opacity: 0.4;
cursor: not-allowed;
}
}
}
}
// 滚动条样式
.table-body::-webkit-scrollbar {
width: 6px;
}
.table-body::-webkit-scrollbar-track {
background: rgba(0, 0, 0, 0.2);
border-radius: 3px;
}
.table-body::-webkit-scrollbar-thumb {
background: linear-gradient(180deg, #40a9ff 0%, #1890ff 100%);
border-radius: 3px;
}
.table-body::-webkit-scrollbar-thumb:hover {
background: linear-gradient(180deg, #69c0ff 0%, #40a9ff 100%);
}
</style>