alertDetail.vue 4.92 KB
<template>
	<view class="alert-detail-page">
		<!-- 公共组件-每个页面必须引入 -->
		<public-module></public-module>
		<view style="border-radius: 20px;width: 688rpx;height: 573rpx;background-color: #FFFFFF;">
			<view class="u-flex" style="height: 573rpx;justify-content:space-between;flex-direction: column;align-items: center;">
				<view
					class="u-flex"
					style="flex-direction: row;justify-content: space-between;margin-top: 10rpx;line-height:68rpx;width: 614rpx;height:90rpx;text-align: left;border-bottom: 0.1rpx solid #F0F0F0;"
				>
					<text style="color:#333333;font-size: 15px;">{{ list.deviceName == null ? '暂无数据' : list.deviceName }}</text>
					<image style="width: 30rpx;height: 30rpx;" src="../../static/alert-detail.png" mode=""></image>
				</view>
				<view style="margin-top: 10rpx;line-height:68rpx;width: 614rpx;height:90rpx;text-align: left;border-bottom: 0.1rpx solid #F0F0F0;">
					<text style="color:#333333;font-size: 14px;">告警级别:</text>
					<text style="color:#DE4437">
						{{
							list.severity == 'CRITICAL'
								? '危险'
								: list.severity == 'MAJOR'
								? '重要'
								: list.severity == 'MINOR'
								? '次要'
								: list.severity == 'WARNING'
								? '警告'
								: '不确定'
						}}
					</text>
				</view>
				<view style="margin-top: 10rpx;line-height:68rpx;width: 614rpx;height:90rpx;text-align: left;border-bottom: 0.1rpx solid #F0F0F0;">
					<text style="color:#333333;font-size: 15px;">所属组织:</text>
					<text style="color:#666666;font-size: 14px;">{{ list.originatorType }}</text>
				</view>
				<view style="margin-top: 10rpx;line-height:68rpx;width: 614rpx;height:90rpx;text-align: left;border-bottom: 0.1rpx solid #F0F0F0;">
					<text style="color:#333333;font-size: 15px;">告警值:</text>
					<text style="color:#666666;font-size: 14px;">{{ list.details == null ? '暂无数据' : list.details.data }}</text>
				</view>
				<view style="margin-top: 10rpx;line-height:68rpx;width: 614rpx;height:90rpx;text-align: left;border-bottom: 0.1rpx solid #F0F0F0;">
					<text style="color:#333333;font-size: 15px;">告警时间:</text>
					<text style="color:#666666;font-size: 14px;">{{ list.createdTime }}</text>
				</view>
				<view style="margin-top: 10rpx;line-height:68rpx;width: 614rpx;height:90rpx;text-align: left;border-bottom: 0.1rpx solid #F0F0F0;">
					<text style="color:#333333;font-size: 15px;">告警状态:</text>
					<text style="color:#DE4437;font-size: 14px;">
						{{
							list.status == 'CLEARED_UNACK'
								? '清除未确认'
								: list.status == 'ACTIVE_UNACK'
								? '激活未确认'
								: list.status == 'CLEARED_ACK'
								? '清除已确认'
								: '激活已确认'
						}}
					</text>
				</view>
			</view>
		</view>
		<!-- #ifdef MP -->
		<view style="color:#333333,font-size:15px;margin-top: 20rpx;">处理结果</view>
		<view style="margin-top: 20rpx;;border-radius: 20px;width: 688rpx;height: 273rpx;background-color: #FFFFFF;">
			<u--form :label-style="{ 'font-size': '0rpx' }" style="padding-left: 26rpx;" labelPosition="left" :model="formModel" ref="form1">
				<u-form-item label="." prop="result" ref="item3">
					<view style="margin-left: -60rpx;"><u--textarea border="none" height="96" placeholder="请输入处理结果" v-model="formModel.result" count></u--textarea></view>
				</u-form-item>
			</u--form>
		</view>
		<!-- #endif -->
		<!-- #ifdef APP-PLUS -->
		<view style="color:#333333,font-size:15px;margin-top: 20rpx;">处理结果</view>
		<view style="margin-top: 20rpx;;border-radius: 20px;width: 688rpx;height: 273rpx;background-color: #FFFFFF;">
			<view><u--textarea border="none" height="96" placeholder="请输入处理结果" v-model="formModel.result" count></u--textarea></view>
		</view>
		<!-- #endif -->
		<view style="width: 500rpx;margin-left: 80rpx;margin-top: 44rpx;"><u-button @click="handleSubmit" type="primary" shape="circle" text="处理"></u-button></view>
		<f-tabbar></f-tabbar>
	</view>
</template>

<script>
import fTabbar from '@/components/module/f-tabbar/f-tabbar';
export default {
	components: {
		fTabbar
	},
	data() {
		return {
			formModel: {
				result: ''
			},
			list: {}
		};
	},
	onLoad(e) {
		if (e.data !== null) {
			let params = JSON.parse(e.data);
			this.list = params;
		}
		// 隐藏原生的tabbar
		uni.hideTabBar();
	},
	methods: {
		handleSubmit() {
			// console.log(this.formModel);
			uni.$u.http
				.post(`/alarm/${this.list.id}/ack`)
				.then(res => {
					uni.$u.toast('处理成功');
					let pages = getCurrentPages(); //获取所有页面栈实例列表
					let nowPage = pages[pages.length - 1]; //当前页页面实例
					let prevPage = pages[pages.length - 2]; //上一页页面实例
					prevPage.$vm.detailStatus = true;
					uni.navigateBack({
						delta: 1
					});
				})
				.catch(e => {
					uni.$u.toast(e.data?.message);
				});
		}
	}
};
</script>

<style lang="scss" scoped>
.alert-detail-page {
	padding: 30rpx;
}
</style>