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

399 lines
9.6 KiB
Vue
Raw Normal View History

2025-08-01 17:16:03 +08:00
<template>
<div class="comom-title">
2025-10-26 12:25:50 +08:00
<div class="title">预警列表</div>
2025-11-22 21:59:58 +08:00
<div class="expand-btn" @click="changeTab">
2025-10-26 12:25:50 +08:00
<el-icon size="20">
<ArrowDownBold v-if="isExpanded" />
<ArrowUpBold v-else />
</el-icon>
</div>
2025-08-01 17:16:03 +08:00
</div>
2025-11-22 21:59:58 +08:00
<div class="zdryBox" v-show="isExpanded">
2025-10-26 12:25:50 +08:00
<div>
<CheckBox :data="checkDatas" @changeData="changeDatas"></CheckBox>
</div>
<div v-if="typeS">
2025-08-01 17:16:03 +08:00
<CheckBox :data="checkData" @changeData="changeData"></CheckBox>
</div>
2025-10-26 12:25:50 +08:00
<ul class="ryBox" ref="scrollTableRef" @mouseenter="stopAutoScroll" @mouseleave="startAutoScroll"
v-loading="loading" v-infinite-scroll="loadList">
2025-08-01 17:16:03 +08:00
<li v-for="item in personList" :key="item.id" @click="chooseItem(item)">
2025-10-26 12:25:50 +08:00
<DeployControlItem :item="item" :dict="{ D_BZ_HPZL }" />
2025-08-01 17:16:03 +08:00
</li>
<MOSTY.Empty :show="!loading && personList.length <= 0" :imgSize="100"></MOSTY.Empty>
</ul>
</div>
</template>
<script setup>
import emitter from "@/utils/eventBus.js";
2025-11-22 21:59:58 +08:00
// import { qcckPost } from "@/api/qcckApi.js";
2025-11-28 22:25:58 +08:00
import { getPageAllList, yjzxXwyjId, tbYjxxGetInfo,yjzxyjzxSfyjSelectList,yjzxZhyjSelectList } from '@/api/yj.js'
2025-08-01 17:16:03 +08:00
import DeployControlItem from "@/views/home/components/deployControlItem.vue";
import * as MOSTY from "@/components/MyComponents/index";
import CheckBox from "@/components/checkBox/index.vue";
2025-10-26 12:25:50 +08:00
import { ref, reactive, onMounted, onUnmounted, getCurrentInstance } from 'vue';
import { ArrowDownBold, ArrowUpBold } from '@element-plus/icons-vue';
2025-08-01 17:16:03 +08:00
const { proxy } = getCurrentInstance();
2025-10-26 12:25:50 +08:00
const { D_BZ_HPZL } = proxy.$dict('D_BZ_HPZL')
2025-08-01 17:16:03 +08:00
const checkData = reactive({
list: ["一级", "二级", "三级", "四级"],
hasChoose: ["一级", "二级", "三级", "四级"]
});
2025-10-26 12:25:50 +08:00
const checkDatas = reactive({
list: ["布控", "行为", "身份", "组合"],
2025-11-22 21:59:58 +08:00
hasChoose: ["布控"]
2025-10-26 12:25:50 +08:00
});
2025-08-01 17:16:03 +08:00
const total = ref(0);
2025-11-27 14:27:59 +08:00
const yjJb = ref(['01', '02', '03', '04']);
2025-11-22 21:59:58 +08:00
const yjLx = ref(['01']);
2025-08-01 17:16:03 +08:00
const pageNum = ref(1);
const loading = ref(false); // 加载中
const personList = ref([]);
2025-10-26 12:25:50 +08:00
const scrollTableRef = ref(null);
const isAutoScrolling = ref(false);
let scrollTimer = null;
onMounted(() => {
getList();
// 数据加载完成后启动自动滚动
setTimeout(() => {
if (personList.value.length > 0) {
startAutoScroll();
2025-08-29 14:30:58 +08:00
}
2025-10-26 12:25:50 +08:00
}, 1000);
2025-11-22 21:59:58 +08:00
emitter.on("yjDetail", (res) => {
chooseItem(res)
})
2025-10-26 12:25:50 +08:00
})
2025-08-01 17:16:03 +08:00
// 复选框切换
2025-10-26 12:25:50 +08:00
function changeData(val) {
2025-08-01 17:16:03 +08:00
pageNum.value = 1;
personList.value = [];
checkData.hasChoose = val;
let ids = [];
val.forEach(it => {
2025-11-27 14:27:59 +08:00
if (it == '一级') ids.push('01');
if (it == '二级') ids.push('02');
if (it == '三级') ids.push('03');
if (it == '四级') ids.push('04');
2025-08-01 17:16:03 +08:00
});
2025-11-22 21:59:58 +08:00
yjJb.value = ids
2025-10-26 12:25:50 +08:00
if (val.length == 0) personList.value = [];
2025-08-01 17:16:03 +08:00
else getList();
}
2025-11-22 21:59:58 +08:00
const typeS = ref(true)
2025-10-26 12:25:50 +08:00
function changeDatas(val) {
pageNum.value = 1;
personList.value = [];
checkDatas.hasChoose = val;
let ids = [];
if (val.includes('布控')) {
2025-11-22 21:59:58 +08:00
typeS.value = true
2025-11-27 14:27:59 +08:00
yjJb.value = ['01', '02', '03', '04']
2025-10-26 12:25:50 +08:00
} else {
2025-11-22 21:59:58 +08:00
yjJb.value = []
typeS.value = false
}
2025-10-26 12:25:50 +08:00
val.forEach(it => {
if (it == '布控') {
2025-11-22 21:59:58 +08:00
ids.push('01')
typeS.value = true
2025-10-26 12:25:50 +08:00
};
2025-11-22 21:59:58 +08:00
if (it == '行为') ids.push('02');
if (it == '身份') ids.push('03');
if (it == '组合') ids.push('04');
2025-10-26 12:25:50 +08:00
});
2025-11-22 21:59:58 +08:00
yjLx.value = ids
2025-10-26 12:25:50 +08:00
if (val.length == 0) personList.value = [];
else getList();
}
2025-11-27 14:27:59 +08:00
const isExpanded = ref(false); // 控制展开/收缩状态
2025-10-26 12:25:50 +08:00
const changeTab = () => {
// 切换展开/收缩状态
isExpanded.value = !isExpanded.value;
// 如果是收缩状态,停止自动滚动
if (!isExpanded.value) {
stopAutoScroll();
} else if (personList.value.length > 0) {
// 如果是展开状态并且有数据,启动自动滚动
startAutoScroll();
}
}
// 自动滚动函数
const autoScroll = () => {
if (!scrollTableRef.value || !isAutoScrolling.value) return;
const container = scrollTableRef.value;
const speed = 1; // 滚动速度
// 滚动容器
container.scrollTop += speed;
// 判断是否滚动到底部,如果是则回到顶部重新开始
if (container.scrollTop >= container.scrollHeight - container.clientHeight - 5) {
container.scrollTop = 0;
}
};
// 开始自动滚动
const startAutoScroll = () => {
if (isAutoScrolling.value || !scrollTableRef.value) return;
isAutoScrolling.value = true;
// 清除可能存在的定时器
if (scrollTimer) {
clearInterval(scrollTimer);
}
// 设置新的定时器,控制滚动速度
scrollTimer = setInterval(autoScroll, 30);
};
// 停止自动滚动
const stopAutoScroll = () => {
isAutoScrolling.value = false;
if (scrollTimer) {
clearInterval(scrollTimer);
scrollTimer = null;
}
};
onUnmounted(() => {
// 组件卸载时清理定时器
stopAutoScroll();
});
2025-08-01 17:16:03 +08:00
// 触底加载
2025-10-26 12:25:50 +08:00
const loadList = () => {
if (personList.value.length == total.value) return;
2025-08-01 17:16:03 +08:00
pageNum.value++;
getList()
}
2025-11-22 21:59:58 +08:00
const ORDIMG = 'https://89.40.7.122:38496/image'
const IMGYM = 'https://sg.lz.dsj.xz/dhimage'
2025-10-26 12:25:50 +08:00
const getList = (type) => {
2025-11-22 21:59:58 +08:00
let data = { pageSize: 30, pageCurrent: pageNum.value, yjjbList: yjJb.value, yjlxList: yjLx.value };
2025-08-29 14:30:58 +08:00
loading.value = !type ? true : false;
2025-11-22 21:59:58 +08:00
getPageAllList(data).then(res => {
2025-08-01 17:16:03 +08:00
loading.value = false;
2025-11-22 21:59:58 +08:00
let arr = res.records.map(item => {
return {
...item,
yjtp:item.yjlx=='01'? item.yjtp.replace(ORDIMG, IMGYM) : item.yjtp
}
}) || [];
2025-08-01 17:16:03 +08:00
personList.value = pageNum.value == 1 ? arr : personList.value.concat(arr);
total.value = res.total;
2025-10-26 12:25:50 +08:00
}).catch(() => {
2025-08-01 17:16:03 +08:00
loading.value = false;
})
}
2025-11-22 21:59:58 +08:00
const content = ref({
ryxm: "",
rysfzh: "",
yjsj: "",
yjdz: "",
yjtp: "",
yjnr: "",
jd: 0,
wd: 0,
yjbq: "",
yjjb: "",
yjlx: "",
ssbmdm: "",
ssbm: "",
yjlb: "",
cph: "",
hplx: null
})
2025-10-26 12:25:50 +08:00
const chooseItem = (item) => {
2025-11-28 22:25:58 +08:00
console.log(item.yjlx);
2025-11-22 21:59:58 +08:00
switch (item.yjlx) {
2025-11-28 22:25:58 +08:00
2025-11-22 21:59:58 +08:00
case '01':
tbYjxxGetInfo(item.id).then(res => {
content.value = {
id: item.id,
ryxm: res.yjRyxm || '',
rysfzh: res.yjRysfzh,
yjsj: res.yjSj || '',
yjdz: res.yjDz || '',
yjtp: res.yjXtp .replace(ORDIMG, IMGYM) || '',
yjnr: res.yjNr || '',
yjbq: res.yjbqmc || '',
yjlx: item.yjlx || '',
jd: res.jd || 0,
wd: res.wd || 0,
yjjb: item.yjjb || '',
czzt: res.czzt || '',
yjbt: res.yjBt || '',
}
emitter.emit('showHomeYJ', [content.value]);
})
break;
case '02':
yjzxXwyjId(item.id).then(res => {
content.value = {
id: item.id,
ryxm: res.xm || '',
rysfzh: res.sfzh,
yjsj: res.yjsj || '',
yjdz: "",
yjtp: "",
yjbq: res.xwms || '',
yjlb: item.yjlb || '',
czzt: res.czzt || '',
yjbt: res.yjBt || '',
2025-11-28 22:25:58 +08:00
yjlx:item.yjlx
2025-11-22 21:59:58 +08:00
}
emitter.emit('showHomeYJ', [content.value]);
})
break;
2025-11-27 14:27:59 +08:00
case '03':
2025-11-28 22:25:58 +08:00
yjzxyjzxSfyjSelectList(item.id).then(res => {
content.value = {
2025-11-27 14:27:59 +08:00
id: item.id,
ryxm: res.xm || '',
rysfzh: res.sfzh,
yjsj: res.yjsj || '',
yjdz: "",
yjtp: "",
yjbq: res.xwms || '',
yjlb: item.yjlb || '',
czzt: res.czzt || '',
2025-11-28 22:25:58 +08:00
yjbt: res.yjBt || '',
yjlx:item.yjlx
2025-11-27 14:27:59 +08:00
}
emitter.emit('showHomeYJ', [content.value]);
2025-11-28 22:25:58 +08:00
})
2025-11-22 21:59:58 +08:00
break;
case '04':
2025-11-28 22:25:58 +08:00
yjzxZhyjSelectList(item.id).then(res => {
content.value = {
2025-11-27 14:27:59 +08:00
id: item.id,
ryxm: res.xm || '',
rysfzh: res.sfzh,
yjsj: res.yjsj || '',
yjdz: "",
yjtp: "",
yjbq: res.xwms || '',
yjlb: item.yjlb || '',
czzt: res.czzt || '',
2025-11-28 22:25:58 +08:00
yjbt: res.yjBt || '',
yjlx:item.yjlx
2025-11-27 14:27:59 +08:00
}
emitter.emit('showHomeYJ', [content.value]);
2025-11-28 22:25:58 +08:00
})
2025-11-22 21:59:58 +08:00
break;
}
2025-08-01 17:16:03 +08:00
}
</script>
<style>
2025-10-26 12:25:50 +08:00
.el-loading-mask {
background: rgba(0, 0, 0, 0.5);
2025-08-01 17:16:03 +08:00
}
</style>
<style lang="scss" scoped>
@import "@/assets/css/homeScreen.scss";
2025-10-26 12:25:50 +08:00
.zdryBox {
2025-08-01 17:16:03 +08:00
background: #052249;
2025-10-26 12:25:50 +08:00
height: 560px;
.ryBox {
height: calc(100% - 80px);
2025-08-01 17:16:03 +08:00
overflow: hidden;
overflow-y: auto;
}
}
2025-10-26 12:25:50 +08:00
::v-deep .el-checkbox {
margin-right: 10px;
}
2025-08-01 17:16:03 +08:00
::-webkit-scrollbar {
background-color: #263b70;
}
2025-10-26 12:25:50 +08:00
2025-08-01 17:16:03 +08:00
::-webkit-scrollbar-thumb {
background-color: #146bbe;
}
2025-10-26 12:25:50 +08:00
2025-08-01 17:16:03 +08:00
::-webkit-scrollbar-track {
background-color: #263b70;
}
2025-10-26 12:25:50 +08:00
2025-08-01 17:16:03 +08:00
::-webkit-scrollbar-corner {
background-color: #142141;
}
2025-10-26 12:25:50 +08:00
::v-deep .el-checkbox__label {
color: #fff;
2025-08-01 17:16:03 +08:00
}
2025-10-26 12:25:50 +08:00
::v-deep .el-checkbox__input.is-checked+.el-checkbox__label {
color: #00FFFF;
2025-08-01 17:16:03 +08:00
}
2025-10-26 12:25:50 +08:00
::v-deep .el-checkbox__inner {
background: rgba(0, 144, 255, 0.2);
border: 1px solid #0072FF;
2025-08-01 17:16:03 +08:00
}
2025-10-26 12:25:50 +08:00
::v-deep .el-checkbox__input.is-checked .el-checkbox__inner {
2025-08-01 17:16:03 +08:00
background-color: #00FFFF;
2025-10-26 12:25:50 +08:00
border-color: #00FFFF;
2025-08-01 17:16:03 +08:00
}
2025-10-26 12:25:50 +08:00
::v-deep .el-checkbox__input.is-indeterminate .el-checkbox__inner {
2025-08-01 17:16:03 +08:00
background-color: #00FFFF;
2025-10-26 12:25:50 +08:00
border-color: #00FFFF;
2025-08-01 17:16:03 +08:00
}
2025-10-26 12:25:50 +08:00
::v-deep .el-checkbox__inner::after {
border: 2px solid #000;
border-left: 0;
border-top: 0;
left: 3px;
top: 0px;
2025-08-01 17:16:03 +08:00
}
2025-10-26 12:25:50 +08:00
::v-deep .el-checkbox__input.is-indeterminate .el-checkbox__inner::before {
2025-08-01 17:16:03 +08:00
background: #000;
}
2025-10-26 12:25:50 +08:00
.comom-title {
display: flex;
justify-content: space-between;
align-items: center;
}
.expand-btn {
display: flex;
align-items: center;
justify-content: center;
// background: linear-gradient(135deg, #0072FF 0%, #00B4FF 100%);
// border-radius: 50%;
color: white;
cursor: pointer;
transition: all 0.3s ease;
box-shadow: 0 2px 8px rgba(0, 114, 255, 0.3);
}
.expand-btn:hover {
transform: scale(1.1);
box-shadow: 0 4px 12px rgba(0, 114, 255, 0.5);
}
.expand-btn:active {
transform: scale(0.95);
}
2025-08-01 17:16:03 +08:00
</style>