Files
admin-sjzx/src/views/pqs/supervise/retire/detail.vue

112 lines
3.0 KiB
Vue
Raw Normal View History

2024-05-13 18:36:19 +08:00
<template>
2024-06-04 18:36:17 +08:00
<!--工作流view的路径/pqs/supervise/retire/detail-->
<div class='default-main'>
<!-- <h1>详细信息回显</h1>-->
<el-descriptions :column='2' border>
<el-descriptions-item label='供电公司'>
{{ detailData.gdName }}
</el-descriptions-item>
<el-descriptions-item label='变电站'>
{{ detailData.subName }}
</el-descriptions-item>
<template v-if='detailData.deviceType == 1'>
<el-descriptions-item label='设备名称' :span='2'>
{{ detailData.deviceName }}
</el-descriptions-item>
</template>
<template v-else>
<el-descriptions-item label='母线'>
{{ detailData.volName }}
</el-descriptions-item>
<el-descriptions-item label='监测点'>
{{ detailData.deviceName }}
</el-descriptions-item>
</template>
<el-descriptions-item label='当前状态'>
<el-tag :type='getDeviceStatusType(detailData.deviceStatus)'>
{{ getDeviceStatus(detailData.deviceStatus) }}
</el-tag>
</el-descriptions-item>
<el-descriptions-item label='变更状态' >
<el-tag :type='getDeviceStatusType(detailData.devStatus)'>
{{ getDeviceStatus(detailData.devStatus) }}
</el-tag>
</el-descriptions-item>
<el-descriptions-item :span='2' label='变更原因'>
{{ detailData.propertyNo }}
</el-descriptions-item>
</el-descriptions>
</div>
2024-05-13 18:36:19 +08:00
</template>
<script setup lang='ts'>
2024-05-14 15:21:37 +08:00
import { onMounted, ref } from 'vue'
2024-05-22 16:05:51 +08:00
import { useRoute } from 'vue-router'
2024-05-14 15:21:37 +08:00
import { propTypes } from '@/utils/propTypes'
import { getRunningDeviceById } from '@/api/supervision-boot/device/quitRunningDev'
2024-05-22 16:05:51 +08:00
defineOptions({ name: 'QuitRunningDeviceDetail' })
2024-05-14 15:21:37 +08:00
const { query } = useRoute() // 查询参数
const props = defineProps({
2024-06-04 18:36:17 +08:00
id: propTypes.string.def(undefined)
2024-05-14 15:21:37 +08:00
})
const detailLoading = ref(false) // 表单的加载中
const detailData = ref({}) // 详情数据
const queryId = query.id// 从 URL 传递过来的 id 编号
const getDeviceStatus = (status: number) => {
2024-06-04 18:36:17 +08:00
if (status === 0) {
2024-05-14 15:21:37 +08:00
return '运行'
2024-06-04 18:36:17 +08:00
}
if (status === 1) {
return '检修'
}
if (status === 2) {
return '停运'
}
if (status === 3) {
return '调试'
}
if (status === 4) {
return '退运'
}
return '运行'
2024-05-14 15:21:37 +08:00
}
const getDeviceStatusType = (status: number) => {
2024-06-04 18:36:17 +08:00
if (status === 0) {
2024-05-14 15:21:37 +08:00
return 'success'
2024-06-04 18:36:17 +08:00
}
if (status === 1) {
return 'warning'
}
if (status === 2) {
return 'danger'
}
if (status === 3) {
return 'warning'
}
if (status === 4) {
return 'info'
}
return 'success'
2024-05-14 15:21:37 +08:00
}
/** 获得数据 */
const getInfo = async () => {
2024-06-04 18:36:17 +08:00
detailLoading.value = true
try {
await getRunningDeviceById(props.id || queryId).then(res => {
detailData.value = res.data
})
} finally {
detailLoading.value = false
}
2024-05-14 15:21:37 +08:00
}
defineExpose({ open: getInfo }) // 提供 open 方法,用于打开弹窗
/** 初始化 **/
onMounted(() => {
2024-06-04 18:36:17 +08:00
getInfo()
2024-05-14 15:21:37 +08:00
})
2024-05-13 18:36:19 +08:00
</script>