feat 异常警告详情
This commit is contained in:
@@ -1,15 +1,29 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
defineProps<{
|
const props = defineProps<{
|
||||||
deviceName: string
|
deviceName: string
|
||||||
tags: string[]
|
tags: string[]
|
||||||
time: string
|
time: string
|
||||||
trigger: string
|
trigger: string
|
||||||
status?: '未处理' | '已处理'
|
status?: '未处理' | '已处理'
|
||||||
|
index: number
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
|
function goToDetail() {
|
||||||
|
const data = encodeURIComponent(JSON.stringify({
|
||||||
|
deviceName: props.deviceName,
|
||||||
|
tags: props.tags,
|
||||||
|
time: props.time,
|
||||||
|
trigger: props.trigger,
|
||||||
|
status: props.status || '未处理',
|
||||||
|
}))
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `/pages/warning/detail/index?data=${data}`,
|
||||||
|
})
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<view class="warning-item">
|
<view class="warning-item" @tap="goToDetail">
|
||||||
<view class="item-header">
|
<view class="item-header">
|
||||||
<text class="device-name">
|
<text class="device-name">
|
||||||
{{ deviceName }}
|
{{ deviceName }}
|
||||||
@@ -41,7 +55,6 @@ defineProps<{
|
|||||||
background-color: #ffffff;
|
background-color: #ffffff;
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
padding: 16px;
|
padding: 16px;
|
||||||
/* border-left: 4px solid #ff4d4f; */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.item-header {
|
.item-header {
|
||||||
|
|||||||
55
src/pages/warning/detail/index.vue
Normal file
55
src/pages/warning/detail/index.vue
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
definePage({
|
||||||
|
layout: false,
|
||||||
|
style: {
|
||||||
|
navigationStyle: 'custom',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const warningData = ref<any>(null)
|
||||||
|
|
||||||
|
onLoad((options) => {
|
||||||
|
if (options?.data) {
|
||||||
|
warningData.value = JSON.parse(decodeURIComponent(options.data))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<view class="page">
|
||||||
|
<back-nav title="警告详情" />
|
||||||
|
|
||||||
|
<view class="content">
|
||||||
|
<view v-if="warningData" class="detail-raw">
|
||||||
|
<text class="raw-text">
|
||||||
|
{{ JSON.stringify(warningData, null, 2) }}
|
||||||
|
</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.page {
|
||||||
|
min-height: 100vh;
|
||||||
|
background-color: #EAEFF9;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
padding: 16px;
|
||||||
|
padding-top: 72px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-raw {
|
||||||
|
background-color: #ffffff;
|
||||||
|
border-radius: 12px;
|
||||||
|
padding: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.raw-text {
|
||||||
|
font-size: 18px;
|
||||||
|
color: #333;
|
||||||
|
font-family: monospace;
|
||||||
|
white-space: pre-wrap;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -35,6 +35,7 @@ const warnings = [
|
|||||||
<warning-item
|
<warning-item
|
||||||
v-for="(item, index) in warnings"
|
v-for="(item, index) in warnings"
|
||||||
:key="index"
|
:key="index"
|
||||||
|
:index="index"
|
||||||
:device-name="item.deviceName"
|
:device-name="item.deviceName"
|
||||||
:tags="item.tags"
|
:tags="item.tags"
|
||||||
:time="item.time"
|
:time="item.time"
|
||||||
|
|||||||
3
src/uni-pages.d.ts
vendored
3
src/uni-pages.d.ts
vendored
@@ -10,7 +10,8 @@ type _LocationUrl =
|
|||||||
"/pages/report/index" |
|
"/pages/report/index" |
|
||||||
"/pages/settings/index" |
|
"/pages/settings/index" |
|
||||||
"/pages/warning/index" |
|
"/pages/warning/index" |
|
||||||
"/pages/work/index";
|
"/pages/work/index" |
|
||||||
|
"/pages/warning/detail/index";
|
||||||
|
|
||||||
interface NavigateToOptions {
|
interface NavigateToOptions {
|
||||||
url: _LocationUrl;
|
url: _LocationUrl;
|
||||||
|
|||||||
Reference in New Issue
Block a user