398 lines
9.0 KiB
Vue
Raw Normal View History

2024-04-20 17:26:03 +08:00
<template>
2024-04-21 14:15:04 +08:00
<div class="centerTop">
2024-04-27 13:41:36 +08:00
<div class="top-content">
<div class="content-div aq">
<div class="circle-box">
<span>20</span>
</div>
<span>安全隐患治理</span>
</div>
<div class="content-div wd">
<div class="circle-box">
<span>20</span>
</div>
<span>危大工程</span>
</div>
<div class="content-div jy">
<div class="circle-box">
<span>20</span>
</div>
<span>安全教育</span>
</div>
<div class="content-div fx">
<div class="circle-box">
<span>20</span>
</div>
<span>风险管理</span>
</div>
<div class="content-div zn">
<div class="circle-box">
<span>20</span>
</div>
<span>智能硬件分析</span>
</div>
<div class="count-div">
<div class="count-div-item">
<span>上月安全综合评分</span>
<span>65</span>
<span></span>
</div>
<div class="count-div-item">
<span>相较上月上升20%</span>
<span></span>
</div>
</div>
2024-05-11 15:11:04 +08:00
<div class="score-div" @click="openDialogData({index: 9, title: '月度安全综合评分'})">
2024-04-27 13:41:36 +08:00
<div class="score-part">
<span>78</span>
<span></span>
</div>
<span>安全评分</span>
</div>
<div class="classify-div">
2024-04-27 18:46:11 +08:00
<div class="classify-div-item" @click="openDialogData({index: 1, title: '危大工程'})">
2024-04-27 13:41:36 +08:00
<span>危大工程&nbsp;&nbsp;+20</span>
</div>
2024-04-27 18:46:11 +08:00
<div class="classify-div-item" @click="openDialogData({index: 2, title: '安全教育'})">
2024-04-27 13:41:36 +08:00
<span>安全教育&nbsp;&nbsp;+20</span>
</div>
2024-05-11 19:15:44 +08:00
<div class="classify-div-item" @click="openDialogData({index: 3, title: '影响进度的因素'})">
2024-04-27 13:41:36 +08:00
<span>极端恶劣天气&nbsp;&nbsp;+20</span>
</div>
2024-04-27 18:46:11 +08:00
<div class="classify-div-item" @click="openDialogData({index: 4, title: '风险统计'})">
2024-04-27 13:41:36 +08:00
<span>风险统计&nbsp;&nbsp;+20</span>
</div>
2024-04-27 18:46:11 +08:00
<div class="classify-div-item" @click="openDialogData({index: 5, title: '安全隐患'})">
2024-04-27 13:41:36 +08:00
<span>安全隐患&nbsp;&nbsp;+20</span>
</div>
2024-04-27 18:46:11 +08:00
<div class="classify-div-item" @click="openDialogData({index: 6, title: 'AI警报'})">
<span>AI警报&nbsp;&nbsp;+20</span>
2024-04-27 13:41:36 +08:00
</div>
</div>
2024-05-11 19:15:44 +08:00
<div class="background-title">
<span @click="openDialogData({index: 9, title: '月度安全综合评分'})">查看月度安全评分报告详情</span>
</div>
2024-04-27 13:41:36 +08:00
</div>
2024-04-20 17:26:03 +08:00
</div>
</template>
<script setup lang="ts">
import Card from "@/components/card.vue";
import { ref, onMounted, watch } from "vue";
import { GlobalStore } from "@/stores";
import { ElMessage } from "element-plus";
import { editProjectInfo, eidtProjectShowConfig, queryBySnData } from "@/api/modules/projectOverview";
import { selectLiveVideoListApi } from "@/api/modules/video";
import ckplayerComp from "./ckplayerComp.vue";
import { COMPANY } from "@/config/config";
2024-04-27 18:46:11 +08:00
const emits = defineEmits(["openDialog"])
2024-04-20 17:26:03 +08:00
const store = GlobalStore();
const videoList = ref([] as any);
// ts
type Props = {
projectData?: any; // 传入项目信息
};
// withDefaults 定义默认值(传入的数据类型同默认值)
const props = withDefaults(defineProps<Props>(), {
projectData: {}
});
// 项目信息
const projectData = ref({} as any);
2024-04-27 18:46:11 +08:00
// 打开弹窗
const openDialogData = (obj:any) => {
emits("openDialog",obj)
}
2024-04-20 17:26:03 +08:00
watch(
() => props.projectData,
newVal => {
// console.log(newVal, "newVal");
if (newVal) {
// props.xData = newVal;
projectData.value = newVal;
}
}
);
//效果图
const picUrl = ref("" as any);
const BASEURL = import.meta.env.VITE_API_URL;
// 显示视频
const showVideo = ref(1 as any);
// 显示更换图片
const showChangeImg = ref(false as any);
// 显示更换视频
const showChangeVideo = ref(false as any);
let topText2 = ref([
{ id: 1, title: "现场视频", isActive: true },
{ id: 2, title: "宣传视频", isActive: false },
{ id: 3, title: "效果图", isActive: false }
]);
let topText = ref([
// { id: 1, title: "现场视频", isActive: true },
{ id: 2, title: "宣传视频", isActive: false },
{ id: 3, title: "效果图", isActive: false }
]);
const getVideoList = async () => {
let res: any = await selectLiveVideoListApi({
projectSn: store.sn
});
console.log(res,'445566')
if(res.result && res.result.extend1){
videoList.value = JSON.parse(res.result.extend1).result.videoList;
console.log(videoList.value,'112233')
// 为了解决视频播放器渲染,第二个总是会默认显示一半,我动态设置样式让视图刷新,只要设置百分百就有问题,所以只能使用此方法
setTimeout(() => {
// 获取所有的 video 元素
var videos = document.querySelectorAll(".href-content video")
// var videos = document.getElementsByTagName("video");
// 遍历所有的 video 元素
for (var i = 0; i < videos.length; i++) {
// 修改视频元素的样式
videos[i].style.width = "99.9%";
videos[i].style.height = "99.9%";
}
}, 2000);
}
};
function boxStyle(item: any) {
if (item.isActive) {
let choiseStyle = {
color: "#fff"
};
return choiseStyle;
}
return {};
}
let tabIndex = ref(1 as any);
function activeBtn(item: any) {
let currentState = item.isActive;
if (!currentState) {
topText.value.forEach(el => {
el.isActive = false;
});
item.isActive = !currentState;
tabIndex.value = item.id;
}
showVideo.value = item.id;
console.log(showVideo.value)
}
const uploadFail = () => {
ElMessage({
showClose: true,
message: "上传失败,请重试",
type: "warning"
});
};
const fileTypeFail = (text: any) => {
ElMessage({
showClose: true,
message: text,
type: "warning"
});
};
const uploadSuccess = () => {
ElMessage({
showClose: true,
message: "上传成功",
type: "success"
});
};
// 查询效果图
function getQueryBySnData() {
queryBySnData({
projectSn: store.sn,
showType: 3
}).then((res: any) => {
console.log(res, "效果图");
if (res.result) {
picUrl.value = res.result.configValue;
}
});
}
// //保存或删除宣传视频
function saveOrDeleteVideo(url) {
editProjectInfo({
projectSn: store.sn,
videoUrl: url
}).then(res => {
console.log("保存成功", res);
uploadSuccess(); //"上传成功"
projectData.value.videoUrl = url;
});
}
//将方法暴露给父组件
defineExpose({
getQueryBySnData
})
onMounted(async () => {
await getVideoList();
getQueryBySnData();
});
</script>
<style lang="scss" scoped>
2024-04-21 14:15:04 +08:00
.centerTop {
2024-04-25 09:09:34 +08:00
// background-color: darkred;
2024-04-27 13:41:36 +08:00
.top-content{
height: 100%;
position: relative;
background-image: url("@/assets/images/commandScreen/top-bg.png");
background-position: center;
background-repeat: no-repeat;
.content-div{
2024-04-27 19:34:59 +08:00
width: 30%;
height: 30%;
2024-04-27 13:41:36 +08:00
position: absolute;
display: flex;
flex-direction: column;
align-items: center;
.circle-box{
2024-04-27 19:34:59 +08:00
width: 70px;
height: 70px;
2024-04-27 13:41:36 +08:00
color: white;
font-size: 14px;
text-align: center;
2024-04-27 19:34:59 +08:00
// padding: 23px 20px;
// border: 2px solid #318FF7;
background: url("@/assets/images/commandScreen/bg10.png") no-repeat;
background-size: 100% 100%;
2024-04-27 13:41:36 +08:00
border-radius: 50%;
2024-04-27 19:34:59 +08:00
display: flex;
justify-content: center;
span{
margin-top: 10px;
}
2024-04-27 13:41:36 +08:00
}
>span{
margin-top: 10px;
color: white;
}
}
.aq{
2024-04-27 18:46:11 +08:00
// left: 40px;
// top: 180px;
2024-04-27 19:34:59 +08:00
left: 0%;
top: 45%;
2024-04-27 13:41:36 +08:00
}
.wd{
2024-04-27 18:46:11 +08:00
// left: 200px;
// top: 80px;
2024-04-27 19:34:59 +08:00
left: 12%;
top: 20%;
2024-04-27 13:41:36 +08:00
}
.jy{
2024-04-27 18:46:11 +08:00
// left: 400px;
// top: 5px;
2024-04-27 19:34:59 +08:00
left: 35%;
2024-04-27 18:46:11 +08:00
top: 0%;
2024-04-27 13:41:36 +08:00
}
.fx{
2024-04-27 18:46:11 +08:00
// right: 180px;
// top: 80px;
2024-04-27 19:34:59 +08:00
right: 12%;
top: 20%;
2024-04-27 13:41:36 +08:00
}
.zn{
2024-04-27 18:46:11 +08:00
// right: 40px;
// top: 180px;
2024-04-27 19:34:59 +08:00
right: 0%;
top: 45%;
2024-04-27 13:41:36 +08:00
}
.count-div{
width: 60%;
color: white;
position: absolute;
2024-04-27 18:46:11 +08:00
// bottom: 95px;
// left: 170px;
bottom: 19%;
left: 18%;
2024-04-27 13:41:36 +08:00
display: flex;
align-items: center;
justify-content: space-between;
&-item{
font-size: 14px;
>span:nth-child(2){
color: #2983E1;
}
}
}
.score-div{
color: white;
position: absolute;
2024-04-27 18:46:11 +08:00
// bottom: 210px;
// left: 383px;
2024-05-11 15:11:04 +08:00
width: 30%;
height: 30%;
bottom: 33%;
left: 35.5%;
2024-04-27 13:41:36 +08:00
display: flex;
flex-direction: column;
align-items: center;
.score-part{
span:nth-child(1){
font-size: 72px;
}
span:nth-child(2){
font-size: 18px;
}
}
>span{
color: white;
font-size: 18px;
}
}
.classify-div{
width: 100%;
color: white;
position: absolute;
2024-05-11 19:15:44 +08:00
bottom: 10px;
2024-04-27 13:41:36 +08:00
left: 0px;
display: flex;
align-items: center;
justify-content: space-between;
&-item{
2024-04-27 19:34:59 +08:00
width: 180px;
height: 75px;
// background-color: #0090D8;
// padding: 10px 20px;
// border-radius: 24px;
background: url("@/assets/images/commandScreen/bg9.png") no-repeat;
background-size: 100% 100%;
display: flex;
align-items: center;
justify-content: center;
padding: 0 5px;
span{
margin-top: 10px;
}
2024-04-27 13:41:36 +08:00
}
}
2024-05-11 19:15:44 +08:00
.background-title{
width: 100%;
height: 40px;
position: absolute;
text-align: center;
line-height: 50px;
color: #00E2F9;
font-size: 14px;
bottom: -10px;
left: 0px;
background-image: url("@/assets/images/commandScreen/title-bg.png");
background-size: cover;
background-position: center;
background-repeat: no-repeat;
}
2024-04-27 13:41:36 +08:00
}
2024-04-20 17:26:03 +08:00
}
</style>