Files
admin-govern/src/views/govern/device/control/analysisList/index.vue
2024-12-09 16:30:40 +08:00

176 lines
5.6 KiB
Vue

<!-- 补召日志 -->
<template>
<el-dialog modal-class="analysisList" v-model="dialogVisible" title="补召日志" width="70%" draggable @closed="close">
<TableHeader date-picker :showReset="false">
<template #operation>
<el-button type="primary" icon="el-icon-Connection" @click="handleImport">
离线补召
</el-button>
<el-button type="primary" icon="el-icon-Monitor" @click="handleaddDevice">
在线补召
</el-button>
</template>
</TableHeader>
<Table ref="tableRef" />
</el-dialog>
<popup ref="detailRef"></popup>
<!-- 离线数据导入组件 -->
<!-- <offLineDataImport ref="offLineDataImportRef"></offLineDataImport> -->
</template>
<script lang="ts" setup>
import { ref, onMounted, provide, onBeforeUnmount } from 'vue'
import TableStore from '@/utils/tableStore'
import Table from '@/components/table/index.vue'
import TableHeader from '@/components/table/header/index.vue'
import offLineDataImport from '../offLineDataImport/index.vue'
import popup from './popup.vue'
import { useRouter } from 'vue-router'
defineOptions({
name: 'offLineDataImport'
})
const emit = defineEmits(['back'])
const dialogVisible = ref(false)
const height = ref(0)
height.value = window.innerHeight < 1080 ? 230 : 450
const detailRef: any = ref()
const lineId = ref('')
const deviceId = ref('')
const deviceData = ref({})
const { push, options, currentRoute } = useRouter()
const tableStore: any = new TableStore({
url: '/cs-device-boot/portableOfflLog/queryMainLogPage',
publicHeight: 420,
method: 'POST',
column: [
// { width: '60', type: 'checkbox', fixed: 'left' },
{
title: '序号', width: 80, formatter: (row: any) => {
return (tableStore.table.params.pageNum - 1) * tableStore.table.params.pageSize + row.rowIndex + 1
}
},
{
field: 'projectName',
title: '工程名称',
minWidth: 170,
formatter: row => {
return row.cellValue ? row.cellValue : '/'
}
},
{ field: 'successCount', title: '成功解析数', minWidth: 150 },
{ field: 'startTime', title: '导入开始时间', minWidth: 170 },
{ field: 'endTime', title: '导入结束时间', minWidth: 170 },
{
title: '解析状态',
field: 'status',
width: 100,
render: 'tag',
custom: {
0: 'warning',
1: 'success',
2: 'danger',
3: 'primary'
},
replaceValue: {
0: '未解析',
1: '解析成功',
2: '解析失败',
3: '文件不存在'
}
// formatter: row => {
// return row.cellValue == 1 ? '未注册' : row.cellValue == 2 ? '注册' : '接入'
// },
},
{
title: '操作',
width: '100',
render: 'buttons',
buttons: [
{
name: 'edit',
title: '详情',
type: 'primary',
icon: 'el-icon-EditPen',
render: 'basicButton',
click: row => {
console.log(row.portableOfflLogList)
detailRef.value.open(row.portableOfflLogList)
}
}
]
}
],
beforeSearchFun: () => {
// tableStore.table.params.devId = tableParams.value.devId
// tableStore.table.params.lineId = tableParams.value.lineId
// tableStore.table.params.list = tableParams.value.list
// tableStore.table.params.type = 3
},
loadCallback: () => {
// tableStore.table.data=[]
tableStore.table.height = 400
console.log(tableStore.table.publicHeight, 'tableStore.table.data')
}
})
provide('tableStore', tableStore)
//返回
const handleBack = () => {
emit('back')
}
const open = (row: any) => {
lineId.value = row.lineId
deviceData.value = row.deviceData
deviceId.value = row.deviceId
dialogVisible.value = true
setTimeout(() => {
tableStore.index()
}, 10)
}
const close = () => {
dialogVisible.value = false
}
const updateViewportHeight = async () => {
// height.value = window.innerHeight;
height.value = window.innerHeight < 1080 ? 230 : 450
// tableStore.table.publicHeight = height.value
// await tableStore.index()
}
//设备补召
const handleaddDevice = () => {
push({
path: '/supplementaryRecruitment',
query: {
activeName: '0',
id: lineId.value,
ndid: deviceData.value?.ndid,
}
})
}
const offLineDataImportRef = ref()
const handleImport = () => {
//设备devId&监测点lineId带入组件
// offLineDataImportRef.value && offLineDataImportRef.value.open(deviceId.value, lineId.value)
push({
path: '/supplementaryRecruitment',
query: {
activeName: '1',
lineId: lineId.value,
deviceId: deviceId.value,
}
})
}
onMounted(() => {
updateViewportHeight() // 初始化视口高度
window.addEventListener('resize', updateViewportHeight) // 监听窗口大小变化
})
onBeforeUnmount(() => {
window.removeEventListener('resize', updateViewportHeight) // 移除监听
})
defineExpose({ open })
</script>
<style lang="scss" scoped></style>