2025-12-17 15:09:15 +08:00

836 lines
21 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>
<view class="addIssue">
<view class="fixedheader">
<headers :showBack="false">
<view class="headerName">
AI预警中心
</view>
</headers>
<!-- <view class="uni-form-item">
<u-search class="uni-input" placeholder="搜索工作票编号名称" :show-action="false" @change="onRefresh"
v-model="searchInfo.workTicketNumber"></u-search>
<view @click="constructionTimeShow = true" class="calendar_box">
<view :class="{'calendar_active': constructionTimeShow}" class="calendar"></view>
</view>
</view> -->
<u-dropdown
:class="{'dropdownFlag': !dropdownFlag,'dropdown-active4': searchInfo.applicationTime_begin, 'dropdown-active3': searchInfo.alarmType[0], 'dropdown-active2': searchInfo.location[0], 'dropdown-active1': searchInfo.projectId[0]}"
ref="uDropdown" @open="onOpen" @close="onClose">
<u-dropdown-item>
<view class="slot-content">
<scroll-view scroll-y="true" class="scroll-view">
<TreeView :multiple="false" :data="projectList" :children-key="'children'"
:label-key="'label'" :id-key="'value'" v-model="searchInfo.projectId"
@node-click="onVideoItemChange(1)" />
</scroll-view>
</view>
</u-dropdown-item>
<u-dropdown-item>
<view class="slot-content">
<scroll-view scroll-y="true" class="scroll-view">
<TreeView :multiple="false" :data="projectVideoList" :children-key="'children'"
:label-key="'label'" :id-key="'value'" v-model="searchInfo.location"
@node-click="onVideoItemChange(2)" />
</scroll-view>
</view>
</u-dropdown-item>
<u-dropdown-item>
<view class="slot-content">
<scroll-view scroll-y="true" class="scroll-view">
<TreeView :multiple="false" :data="alarmTypeList" :children-key="'children'"
:label-key="'label'" :id-key="'value'" v-model="searchInfo.alarmType"
@node-click="onVideoItemChange(3)" />
</scroll-view>
</view>
</u-dropdown-item>
<u-dropdown-item></u-dropdown-item>
</u-dropdown>
</view>
<view class="content" :style="{paddingTop: mobileTopHeight + 44 + 44 + 'px'}">
<scroll-view scroll-y="true" class="content_main" :class="{'content_main2': pageType=='backend'}">
<view class="main-box" v-if="workTicketList.length > 0">
<u-collapse :accordion="false">
<u-collapse-item :title="item.date" v-for="(item, index) in workTicketList" :key="item.date"
:open="true">
<scroll-view @scrolltolower="onScrollTolower(item)" class="collapse-scroll" scroll-y="true">
<view class="item-box" @click="onNavigateToDetail(ele)"
v-for="(ele, eIndex) in item.records" :key="eIndex">
<image :src="url_config + 'image/' + ele.imageUrl" mode=""></image>
<view class="item-box_right">
<view class="box_right-header">
{{alarmTypeName(ele.alarmType)}}
</view>
<view>
<image src="/static/aiWarn/time-icon.png" mode=""></image>
<view class="">
{{ele.createTime}}
</view>
</view>
<view>
<image src="/static/aiWarn/location-icon.png" mode=""></image>
<view class="">
{{ele.location}}
</view>
</view>
<view>
<image src="/static/aiWarn/project-icon.png" mode=""></image>
<view class="">
{{projectSnName(ele.projectSn)}}
</view>
</view>
</view>
</view>
<u-loadmore :status="item.status" />
</scroll-view>
</u-collapse-item>
</u-collapse>
</view>
<view class="new-nodata-height" v-else>
<view class="new-nodata">
<view></view>
<text>暂无数据...</text>
</view>
</view>
</scroll-view>
</view>
<u-calendar v-model="constructionTimeShow" mode="range" :max-date="'2300-01-01'"
@change="onConstructionTimeChange"></u-calendar>
<u-popup v-model="detailShow" mode="bottom" :closeable="true">
<view class="popup-main">
<view class="popup-box_header">{{alarmTypeName(detailInfo.alarmType)}}</view>
<view class="popup-box_item">
<view>时间</view>
<view>{{detailInfo.createTime}}</view>
</view>
<view class="popup-box_item">
<view>摄像头</view>
<view>{{detailInfo.location}}</view>
</view>
<view class="popup-box_item">
<view>施工场站</view>
<view>{{projectSnName(detailInfo.projectSn)}}</view>
</view>
<view class="popup-box_item">
<view></view>
<view class="item-box_state">
<!-- <view class="box_state" :class="{'box_state-color': detailInfo.handleResult==1}">
{{!detailInfo.handleResult?'未处置':detailInfo.handleResult==1?'已处置':'误报忽略'}}
</view> -->
<view></view>
<view @click="downloadReport">
<image src="/static/aiWarn/download.png" mode=""></image>
</view>
</view>
</view>
<image :src="url_config + 'image/' + detailInfo.imageUrl" mode=""></image>
</view>
</u-popup>
<footers :activeTab="'aIEarlyWarn'"></footers>
</view>
</template>
<script>
import TreeView from '@/components/tree-view/TreeView.vue';
import footers from "@/components/footers/footers.vue"
export default {
components: {
footers,
TreeView,
},
data() {
return {
mobileTopHeight: 0,
projectDetail: {},
workTicketList: [],
userInfo: {},
dropdownFlag: false,
pageType: "",
pageNo: 1,
pageSize: 10,
searchInfo: {
projectId: [""],
projectName: "全部项目",
location: [""],
locationName: "全部摄像头",
alarmType: [""],
alarmTypeName: "全部事件",
applicationTime_begin: "",
applicationTime_end: "",
},
projectList: [],
constructionTimeShow: false,
defaultType: "",
projectVideoList: [],
alarmTypeList: [],
detailInfo: {},
detailShow: false,
}
},
onLoad(opts) {
// this.projectDetail = JSON.parse(uni.getStorageSync('projectDetail'))
this.userInfo = JSON.parse(uni.getStorageSync('userInfo'));
this.pageType = opts.type;
if (opts.default == 1) {
this.defaultType = opts.default;
this.searchInfo.riskType = 2;
this.searchInfo.riskTypeName = "高风险";
this.searchInfo.projectName = "全部区域";
}
this.getSelectAllProjectInfoList();
this.getQualityRegionListFn();
this.getAlarmTypeList();
this.getPoliceCameraItemListFn();
},
mounted() {
var that = this
uni.getSystemInfo({
success(res) {
that.mobileTopHeight = res.statusBarHeight ? res.statusBarHeight : 0;
uni.setStorageSync('systemInfo', res)
console.log(res)
}
})
},
onReachBottom() {
console.log(1)
if (!this.isLoadMore) { //此处判断,上锁,防止重复请求
this.isLoadMore = true
this.pageNo += 1
this.getPoliceCameraItemListFn()
}
},
onPullDownRefresh() {
console.log(2)
this.pageNo = 1
this.workTicketList = []
this.getPoliceCameraItemListFn()
},
methods: {
onScrollTolower(row) {
if (row.records >= row.total) return row.status = 'nomore';
row.status = 'loading';
row.page = ++row.page;
this.getSelectPageListFn(row);
},
getSelectPageListFn(row) {
let data = {
pageNo: row.page,
pageSize: this.pageSize,
startTime: this.$dayjs(row.date).format("YYYY-MM-DD 00:00:00"),
endTime: this.$dayjs(row.date).format("YYYY-MM-DD 23:59:59"),
projectSn: this.searchInfo.projectId.length > 0 ? this.searchInfo.projectId[0] : "",
location: this.searchInfo.location.length > 0 ? this.searchInfo.location[0] : "",
alarmType: this.searchInfo.alarmType.length > 0 ? this.searchInfo.alarmType[0] : "",
}
this.sendRequest({
url: 'xmgl/aiAnalyseHardWareAlarmRecord/selectPageList',
method: 'POST',
data: data,
success: res => {
uni.hideLoading()
if (res.code == 200) {
const resultList = res.result.records;
const find = this.workTicketList.find(item => item.date == row.date);
if (find) {
find.total = res.result.total;
find.records = find.records.concat(resultList);
if (res.result.length < this.pageSize) { //判断接口返回数据量小于请求数据量,则表示此为最后一页
find.status = 'nomore'
}
}
}
}
})
},
// 获取时间
onConstructionTimeChange(event) {
this.searchInfo.applicationTime_begin = event.startDate;
this.searchInfo.applicationTime_end = event.endDate;
this.onRefresh();
},
// 打开详情
onNavigateToDetail(row) {
this.detailInfo = row;
this.detailShow = true;
},
onOpen(index) {
console.log(index)
if (index == 3) {
this.constructionTimeShow = true;
}
this.$refs.uDropdown.highlight();
this.dropdownFlag = true;
},
onClose(index) {
this.$refs.uDropdown.highlight(index);
this.dropdownFlag = false;
},
onVideoItemChange(type) {
console.log("选择", type);
if (type == 1) {
const find = this.projectList.find(item => this.searchInfo.projectId.includes(item.value));
this.searchInfo.projectName = find && find.value ? find.label : "全部项目"
this.searchInfo.location = [""];
this.searchInfo.locationName = "全部摄像头";
this.getQualityRegionListFn();
} else if (type == 2) {
const find = this.projectVideoList.find(item => this.searchInfo.location.includes(item.value));
this.searchInfo.locationName = find && find.value ? find.label : "全部摄像头";
} else if (type == 3) {
const find = this.alarmTypeList.find(item => this.searchInfo.alarmType.includes(item.value));
this.searchInfo.alarmTypeName = find && find.value ? find.label : "全部事件"
}
this.$refs.uDropdown.close();
this.onRefresh();
},
onRefresh() {
this.pageNo = 1
this.workTicketList = []
this.getPoliceCameraItemListFn()
},
// 获取工作票列表
getPoliceCameraItemListFn() {
let data = {
pageNo: this.pageNo,
pageSize: this.pageSize,
// projectSn: this.projectDetail.projectSn,
startTime: this.searchInfo.applicationTime_begin,
endTime: this.searchInfo.applicationTime_end,
projectSn: this.searchInfo.projectId.length > 0 ? this.searchInfo.projectId[0] : "",
location: this.searchInfo.location[0] ? this.searchInfo.locationName : "",
alarmType: this.searchInfo.alarmType.length > 0 ? this.searchInfo.alarmType[0] : "",
}
this.sendRequest({
url: 'xmgl/aiAnalyseHardWareAlarmRecord/getRecent10DayRecords',
method: 'POST',
data: data,
success: res => {
uni.hideLoading()
if (res.code == 200) {
console.log("workList======================", res)
const resultList = res.result.map(item => {
return {
...item,
status: item.records.length == 10 ? 'loadmore' : 'nomore',
page: 1,
}
})
this.workTicketList = this.workTicketList.concat(resultList)
if (res.result.length < this.pageSize) { //判断接口返回数据量小于请求数据量,则表示此为最后一页
this.isLoadMore = true
this.loadStatus = 'nomore'
} else {
this.isLoadMore = false
// that.loadStatus='more'
}
uni.stopPullDownRefresh()
}
}
})
},
// 获取所有项目
getSelectAllProjectInfoList() {
let data = {
sn: this.userInfo.sn,
}
this.sendRequest({
url: 'xmgl/project/selectAllProjectInfoList',
method: 'post',
data: data,
success: res => {
uni.hideLoading()
if (res.code == 200) {
this.projectList = [{
label: "全部项目",
value: ""
}, ...res.result.map(item => {
return {
...item,
label: item.projectName,
value: item.projectSn
}
})];
}
}
})
},
// 获取视频监控
getQualityRegionListFn() {
let that = this;
let data = {
all: 1,
projectSn: this.searchInfo.projectId.length > 0 ? this.searchInfo.projectId[0] : "",
};
this.sendRequest({
url: 'xmgl/videoItem/selectProjectVideoList',
method: 'POST',
data: data,
success: res => {
if (res.code == 200) {
that.projectVideoList = [{
label: "全部摄像头",
value: ""
}, ...res.result.videoList.map(item => {
return {
...item,
label: item.videoName,
value: item.itemId
}
})];
}
}
})
},
// 获取预警事件
getAlarmTypeList() {
this.sendRequest({
url: 'xmgl/dictionaryItem/list',
data: {
projectSn: this.userInfo.sn,
dictionaryEncoding: "ai_analyse_hard_ware_alarm_record_type"
},
success: res => {
if (res.code == 200) {
console.log('alarmTypeList', res)
this.alarmTypeList = [{
label: "全部事件",
value: ""
}, ...res.result.map(item => {
return {
...item,
label: item.name,
value: item.data
}
})]
}
}
})
},
downloadReport(row) {
console.log(1111111111111, row);
const url = this.detailInfo.imageUrl.includes("http") ? this.detailInfo.imageUrl : this.url_config +
'image/' + this.detailInfo.imageUrl;
if (!url) {
uni.showToast({
title: "暂无下载文件!",
icon: "none"
})
return
}
// #ifdef APP-PLUS
uni.showLoading({
title: "保存中..."
})
uni.downloadFile({
url: url, //网络路径,下载下来
success: (res) => {
if (res.statusCode === 200) {
uni.saveImageToPhotosAlbum({ // 然后调用这个方法
filePath: res.tempFilePath,
success: (res) => {
uni.hideLoading(); //关闭提示
uni.showToast({
title: '保存成功'
})
},
fail: (e) => {
console.log(e);
},
})
}
},
});
// #endif
// #ifdef H5
fetch(url)
.then(response => response.blob())
.then(blob => {
const link = document.createElement('a');
link.href = URL.createObjectURL(blob);
// link.download = fileName;
link.target = "_blank"; // 可选,如果希望在新窗口中下载文件,请取消注释此行
link.click();
});
// #endif
},
},
watch: {
constructionTimeShow(val) {
console.log(val);
if (!val) {
this.$refs.uDropdown.close();
}
}
},
computed: {
projectSnName() {
return (projectSn) => {
const find = this.projectList.find((item) => item.projectSn == projectSn);
return find ? find.projectName : "";
}
},
alarmTypeName() {
return (alarmType) => {
const find = this.alarmTypeList.find((item) => item.data == alarmType);
return find ? find.name : "";
}
},
}
}
</script>
<style scoped lang="scss">
/deep/ .u-drawer .u-icon__icon {
color: white !important;
}
.popup-main {
height: 100vh;
padding-top: 164rpx;
background: #000000;
.popup-box_item {
display: flex;
font-size: 26rpx;
color: rgba(255, 255, 255, 0.8);
margin-bottom: 20rpx;
padding: 0 26rpx;
.item-box_state {
display: flex;
justify-content: space-between;
flex: 1;
.box_state {
padding: 6rpx 20rpx;
background: #FFFFFF;
border-radius: 8rpx;
font-size: 26rpx;
color: #4D4D4D;
}
.box_state-color {
background-color: #88CF65;
color: #FFFFFF;
}
uni-image {
width: 40rpx;
height: 40rpx;
}
}
}
.popup-box_header {
font-weight: 500;
font-size: 28rpx;
color: #FFFFFF;
margin-bottom: 26rpx;
padding: 0 26rpx;
}
>uni-image {
width: 100%;
height: 460rpx;
}
}
.preview-btn {
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 20rpx;
width: 360rpx;
height: 84rpx;
background: #FFFFFF;
box-shadow: 0rpx 8rpx 8rpx 0rpx rgba(0, 0, 0, 0.25);
border-radius: 76rpx;
position: fixed;
left: 50%;
bottom: 0;
transform: translateX(-50%);
>uni-image {
width: 28rpx;
height: 28rpx;
margin-right: 16rpx;
}
}
.preview-btn2 {
bottom: 120rpx;
}
.main-box {
padding: 26rpx 26rpx 0;
background-color: #F2F3F7;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
/deep/ .u-collapse {
width: 100%;
.u-collapse-item {
margin-top: 26rpx;
background: #FFFFFF;
box-shadow: 0rpx 4rpx 10rpx 0rpx rgba(3, 92, 181, 0.1), 0rpx 8rpx 40rpx 0rpx rgba(0, 0, 0, 0.05);
padding-bottom: 26rpx;
.u-collapse-head {
padding: 40rpx 26rpx 22rpx;
border-bottom: 2rpx solid #F2F2F2;
}
.u-collapse-body {
padding: 26rpx 24rpx 0;
}
.collapse-scroll {
max-height: 600rpx;
padding-bottom: 26rpx;
}
.item-box {
margin-bottom: 26rpx;
display: flex;
// justify-content: space-between;
.item-box_right {
margin-left: 26rpx;
>view {
display: flex;
align-items: center;
font-size: 22rpx;
color: #808080;
>uni-image {
width: 25rpx;
height: 25rpx;
margin-right: 14rpx;
}
}
>.box_right-header {
font-weight: 500;
font-size: 28rpx;
color: #171717;
margin-bottom: 20rpx;
}
}
>uni-image {
width: 300rpx;
height: 180rpx;
border-radius: 16rpx;
}
}
}
}
}
.content_main {
padding-bottom: 130rpx;
}
.content_main2 {
padding-bottom: 220rpx;
}
/deep/ .dropdownFlag {
.u-dropdown__content {
display: none;
}
}
/deep/ .dropdown-active1 {
.u-dropdown__menu__item:nth-child(1) .u-dropdown__menu__item__text {
background-image: url("@/static/aiWarn/project-icon_active.png") !important;
}
}
/deep/ .dropdown-active2 {
.u-dropdown__menu__item:nth-child(2) .u-dropdown__menu__item__text {
background-image: url("@/static/aiWarn/location-icon_active.png") !important;
}
}
/deep/ .dropdown-active3 {
.u-dropdown__menu__item:nth-child(3) .u-dropdown__menu__item__text {
background-image: url("@/static/aiWarn/incident-icon_active.png") !important;
}
}
/deep/ .dropdown-active4 {
.u-dropdown__menu__item:nth-child(4) .u-dropdown__menu__item__text {
background-image: url("@/static/aiWarn/time-icon_active.png") !important;
}
}
/deep/ .u-dropdown {
background-color: white;
.u-dropdown__content__popup {
padding: 20rpx 26rpx;
}
.u-dropdown__menu {
flex-wrap: wrap;
// height: 166rpx !important;
box-shadow: none;
padding: 0 26rpx;
justify-content: space-between;
// justify-content: center;
.u-dropdown__menu__item {
// height: 82rpx;
width: 25%;
flex: initial;
.u-flex {
width: 100%;
justify-content: center;
}
}
}
.u-dropdown__menu__item:nth-child(1) .u-dropdown__menu__item__text {
background-image: url("@/static/aiWarn/project-icon.png");
}
.u-dropdown__menu__item:nth-child(2) .u-dropdown__menu__item__text {
background-image: url("@/static/aiWarn/location-icon.png");
}
.u-dropdown__menu__item:nth-child(3) .u-dropdown__menu__item__text {
background-image: url("@/static/aiWarn/incident-icon.png");
}
.u-dropdown__menu__item:nth-child(4) .u-dropdown__menu__item__text {
background-image: url("@/static/aiWarn/time-icon.png");
}
.u-dropdown__menu__item__text {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
// font-weight: 800;
// font-size: 32rpx !important;
// color: #1A1A1A !important;
width: 40rpx;
height: 40rpx;
background-repeat: no-repeat;
background-size: 100% 100%;
display: inline-block;
}
.u-dropdown__menu__item__arrow {
// display: none;
}
}
.new-nodata {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
>view {
width: 300rpx;
height: 300rpx;
background-image: url('@/static/staffAttendance/nodata.png');
background-repeat: no-repeat;
background-size: 100% 100%;
}
>text {
font-size: 22rpx;
color: #808080;
margin-top: 60rpx;
}
}
.addIssue {
min-height: 100vh;
background-color: #F2F3F7;
}
.fixedheader {
position: fixed;
top: 0;
left: 0;
width: 100%;
z-index: 999;
/deep/ .headerBox {
border-bottom: none;
}
.headerName {
z-index: 1;
}
.uni-form-item {
padding: 0 26rpx;
position: relative;
background-color: white;
display: flex;
.uni-input {
border: 2rpx solid #E4E4E4;
border-radius: 68rpx;
padding: 0;
font-size: 30rpx;
color: #444444;
width: 548rpx;
/deep/ .u-content {
background-color: #F2F3F8 !important;
.u-input {
background-color: #F2F3F8 !important;
color: #444444 !important;
font-size: 30rpx;
}
}
}
}
.calendar_box {
width: 130rpx;
height: 66rpx;
background: #F2F3F8;
border-radius: 68rpx;
margin-left: 20rpx;
display: flex;
align-items: center;
justify-content: center;
.calendar {
width: 40rpx;
height: 40rpx;
background-image: url('@/static/workTicketManage/calendar.png');
background-repeat: no-repeat;
background-size: 100% 100%;
}
.calendar_active {
background-image: url('@/static/workTicketManage/calendar-active.png');
}
}
}
</style>