This commit is contained in:
caozehui
2025-09-25 08:53:32 +08:00
parent 4fe239c86f
commit 039a67c35a

View File

@@ -156,12 +156,12 @@
归档
</el-button>
<!-- 数据操作模式下的功能 -->
<div v-if="form.activeTabs === 5" style="overflow-x: auto;width: 260px; display: flex; justify-content: center;align-items: center;">
<el-button
type="primary"
link
icon="PieChart"
@click="openDrawer('检测数据查询', scope.row)"
v-if="form.activeTabs === 5"
>
检测数据查询
</el-button>
@@ -171,10 +171,10 @@
link
icon="Switch"
@click="openDrawer('误差体系更换', scope.row)"
v-if="form.activeTabs === 5"
>
误差体系更换
</el-button>
</div>
</template>
</ProTable>
@@ -182,7 +182,7 @@
<!-- 检测过程显示弹窗 -->
<TestPopup ref="testPopup" @quitClicked="handleQuitClicked"></TestPopup>
<!-- 检测数据查询弹窗 -->
<dataCheckPopup ref="dataCheckPopupRef" :append-to-body="true" />
<dataCheckPopup ref="dataCheckPopupRef" :append-to-body="true"/>
<!-- 手动检测检测项选择弹窗 -->
<SelectTestItemPopup ref="selectTestItemPopupRef" @openTestDialog="openTestDialog"></SelectTestItemPopup>
<!-- 省平台模式下的温度湿度填写弹窗 -->
@@ -195,35 +195,34 @@
:append-to-body="true"
/>
<!-- 报告生成弹框 -->
<ReportResultPopup ref="reportPopup" @reportGenerated="handleReportGenerated"></ReportResultPopup>
<ReportResultPopup ref="reportPopup"></ReportResultPopup>
</div>
</template>
<script setup lang="tsx" name="useProTable">
import { onBeforeMount, onMounted, type PropType, reactive, ref, watch } from 'vue'
import { type Action, ElMessage, ElMessageBox } from 'element-plus'
import {onBeforeMount, onMounted, type PropType, reactive, ref, watch} from 'vue'
import {type Action, ElMessage, ElMessageBox} from 'element-plus'
import TestPopup from './testPopup.vue'
import dataCheckPopup from './dataCheckSingleChannelSingleTestPopup.vue'
import CompareDataCheckSingleChannelSingleTestPopup
from '@/views/home/components/compareDataCheckSingleChannelSingleTestPopup.vue'
import CompareDataCheckSingleChannelSingleTestPopup from '@/views/home/components/compareDataCheckSingleChannelSingleTestPopup.vue'
import ProTable from '@/components/ProTable/index.vue'
import SelectTestItemPopup from '@/views/home/components/selectTestItemPopup.vue'
import WriteTHPopup from '@/views/home/components/writeTHPopup.vue'
import DeviceConnectionPopup from '@/views/home/components/deviceConnectionPopup.vue'
import { type Device } from '@/api/device/interface/device'
import { type ColumnProps, type ProTableInstance } from '@/components/ProTable/interface'
import { type Plan } from '@/api/plan/interface'
import { type StandardDevice } from '@/api/device/interface/standardDevice'
import { downloadDevData, downloadDevDataWithHeaders, generateDevReport, getBoundPqDevList } from '@/api/plan/plan'
import { getPqDev } from '@/api/device/device'
import { useAppSceneStore, useModeStore } from '@/stores/modules/mode' // 引入模式 store
import { useCheckStore } from '@/stores/modules/check'
import { CheckData } from '@/api/check/interface'
import { useAuthStore } from '@/stores/modules/auth'
import { useDownload, useDownloadWithServerFileName } from '@/hooks/useDownload'
import { documentedPqDev } from '@/api/device/report'
import { ResultEnum } from '@/enums/httpEnum'
import { getPqMonList } from '@/api/device/monitor/index.ts'
import {type Device} from '@/api/device/interface/device'
import {type ColumnProps, type ProTableInstance} from '@/components/ProTable/interface'
import {type Plan} from '@/api/plan/interface'
import {type StandardDevice} from '@/api/device/interface/standardDevice'
import {downloadDevData, generateDevReport, getBoundPqDevList} from '@/api/plan/plan'
import {getPqDev} from '@/api/device/device'
import {useAppSceneStore, useModeStore} from '@/stores/modules/mode' // 引入模式 store
import {useCheckStore} from '@/stores/modules/check'
import {CheckData} from '@/api/check/interface'
import {useAuthStore} from '@/stores/modules/auth'
import {useDownload} from '@/hooks/useDownload'
import {documentedPqDev} from '@/api/device/report'
import {ResultEnum} from '@/enums/httpEnum'
import {getPqMonList} from '@/api/device/monitor/index.ts'
import ReportResultPopup from '@/views/home/components/reportResultPopup.vue'
const checkStore = useCheckStore()
@@ -419,7 +418,7 @@ const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
return true
}
},
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
{type: 'index', fixed: 'left', width: 70, label: '序号'},
{
prop: 'name',
label: '设备名称',
@@ -535,7 +534,7 @@ const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
}
}
},
{ prop: 'operation', label: '操作', fixed: 'right', minWidth: 200, isShow: operationShow }
{prop: 'operation', label: '操作', fixed: 'right', minWidth: 200, isShow: operationShow}
])
let testType = 'test' // 检测类型:'test'-检测 'reTest'-复检
@@ -597,7 +596,7 @@ const handleRefresh = () => {
}
// 表格排序
const sortTable = ({ newIndex, oldIndex }: { newIndex?: number; oldIndex?: number }) => {
const sortTable = ({newIndex, oldIndex}: { newIndex?: number; oldIndex?: number }) => {
console.log(newIndex, oldIndex) // 避免未使用参数警告
ElMessage.success('修改列表排序成功')
}
@@ -636,9 +635,9 @@ function tableHeaderInit(val: number) {
case 2: // 设备复检模式
break
case 3: // 报告生成模式
if(modeStore.currentMode === '比对式'){
checkStateTable.value = [1,2, 3] // 显示检测中,检测完成和归档状态
}else{
if (modeStore.currentMode === '比对式') {
checkStateTable.value = [1, 2, 3] // 显示检测中,检测完成和归档状态
} else {
checkStateTable.value = [2, 3] // 显示检测完成和归档状态
}
columns[columns.length - 1].minWidth = 180
@@ -747,7 +746,7 @@ const handleTest2 = async (val: string) => {
return
}
const devBindMonList = await getPqMonList({ devIds: channelsSelection.value.map(d => d.id) })
const devBindMonList = await getPqMonList({devIds: channelsSelection.value.map(d => d.id)})
// 创建一个映射来存储每个设备的监测点信息(支持多个监测点)
const deviceMonitoringMap = new Map<string, any[]>()
devBindMonList.data.forEach((item: any) => {
@@ -774,7 +773,7 @@ const handleTest2 = async (val: string) => {
if (device) {
allUncheckedDevices.push(device.name);
}
}else {
} else {
// 过滤掉checkFlag === 0的监测点只保留参与检测的监测点
const filteredPoints = monitoringPoints.filter(point => point.checkFlag !== 0);
filteredDeviceMonitoringMap.set(deviceId, filteredPoints);
@@ -833,7 +832,7 @@ const handleTest2 = async (val: string) => {
// 检查数组长度是否为1且唯一元素是'wave_data'
const isOnlyWave = targetPlan.datasourceIds.length === 1 && targetPlan.datasourceIds[0] === 'wave_data';
deviceConnectionPopupRef.value?.open(filteredChannelsSelection, pqStandardDevList.value, props.id,filteredDeviceMonitoringMap,val,isOnlyWave)
deviceConnectionPopupRef.value?.open(filteredChannelsSelection, pqStandardDevList.value, props.id, filteredDeviceMonitoringMap, val, isOnlyWave)
}
/**
@@ -928,7 +927,7 @@ const handleTest = async (val: string) => {
}
})
checkStore.setSelectTestItems({ preTest: false, timeTest: false, channelsTest: false, test: true })
checkStore.setSelectTestItems({preTest: false, timeTest: false, channelsTest: false, test: true})
} else {
selectTestItemPopupRef.value?.open()
checkStore.setReCheckType(1)
@@ -965,12 +964,12 @@ const handleTest = async (val: string) => {
}
}
})
checkStore.setSelectTestItems({ preTest: false, timeTest: false, channelsTest: false, test: true })
checkStore.setSelectTestItems({preTest: false, timeTest: false, channelsTest: false, test: true})
} else {
checkStore.setReCheckType(1)
if(modeStore.currentMode == '比对式'){
if (modeStore.currentMode == '比对式') {
handleTest2('一键检测')
}else{
} else {
openTestDialog(true)
}
}
@@ -1002,7 +1001,7 @@ const handleTest = async (val: string) => {
pageNum: 1,
pageSize: 999
})
ElMessage.success({ message: `报告生成成功!` })
ElMessage.success({message: `报告生成成功!`})
}
}
@@ -1032,10 +1031,9 @@ const openTestDialog2 = () => {
const openDrawer = async (title: string, row: any) => {
// 单个设备报告生成
if (title === '报告生成') {
if (modeStore.currentMode == '比对式'){
console.log(row)
if (modeStore.currentMode == '比对式') {
reportPopup.value?.open(row)
}else{
} else {
await generateDevReport({
planId: checkStore.plan.id,
devIdList: [row.id],
@@ -1045,14 +1043,14 @@ const openDrawer = async (title: string, row: any) => {
pageSize: 999
})
emit('batchGenerateClicked') // 触发事件
ElMessage.success({ message: `报告生成成功!` })
ElMessage.success({message: `报告生成成功!`})
}
}
if (title === '报告下载') {
await useDownloadWithServerFileName(
downloadDevDataWithHeaders,
row.createId, // 备用文件名
await useDownload(
downloadDevData,
row.createId,
{
planId: checkStore.plan.id,
devId: row.id
@@ -1096,7 +1094,7 @@ watch(
() => {
handleRefresh()
},
{ immediate: true }
{immediate: true}
)
onBeforeMount(async () => {
@@ -1122,12 +1120,7 @@ const handleQuitClicked = () => {
emit('batchGenerateClicked') // 触发事件
}
// 处理报告生成完成事件
const handleReportGenerated = () => {
emit('batchGenerateClicked') // 触发事件通知父组件刷新数据
}
defineExpose({ changeActiveTabs })
defineExpose({changeActiveTabs})
</script>
<style lang="scss" scoped>
/* 当屏幕宽度小于或等于1300像素时 */