This commit is contained in:
sjl
2025-01-13 18:13:55 +08:00
9 changed files with 78 additions and 44 deletions

View File

@@ -46,3 +46,7 @@ export const getTableData = (params: {
}) => { }) => {
return http.post("/result/resultData/", params, {loading: false}); return http.post("/result/resultData/", params, {loading: false});
} }
export const exportRawData= () => {
return http.download("/result/exportRawData", {loading: false});
}

View File

@@ -74,3 +74,8 @@ export const downloadTemplate = () => {
export const importPlan=(params: Device.ReqPqDevParams)=>{ export const importPlan=(params: Device.ReqPqDevParams)=>{
return http.upload(`/adPlan/import`, params) return http.upload(`/adPlan/import`, params)
} }
//导出被检设备
export const downloadDevData=(params: Device.ReqPqDevParams)=>{
return http.download(`/report/generateReport`, params)
}

View File

@@ -22,7 +22,7 @@ export const startTest = (params) => {
* @param params * @param params
*/ */
export const pauseTest = () => { export const pauseTest = () => {
return http.get(`/test/closePreTest`, params, {loading: false}) return http.get(`/prepare/closePreTest`, {loading: false})
} }
/** /**

View File

@@ -1,18 +1,18 @@
<template> <template>
<el-button v-if="tableData.length > 0" type="primary" @click="exportData" style="margin-bottom: 10px">导出</el-button>
<div class="table-main"> <div class="table-main">
<el-table v-if="tableData.length > 0" :data="tableData" stripe border :header-cell-style="{ textAlign: 'center' } " <el-table v-if="tableData.length > 0" :data="tableData" stripe border :header-cell-style="{ textAlign: 'center' } "
:cell-style="{ textAlign: 'center' }" height="335px" :cell-style="{ textAlign: 'center' }" height="315px"
style="width: 100%;"> style="width: 100%;">
<el-table-column type="index" label="序号" width="70" fixed="left"/> <el-table-column type="index" label="序号" width="70" fixed="left"/>
<el-table-column prop="time" label="数据时间"/> <el-table-column prop="time" label="数据时间"/>
<template v-if="phaseT === 0"> <template v-if="phaseT === 0">
<el-table-column prop="dataA" :label="`A${unit}`"/> <el-table-column prop="dataA" :label="'A'+(unit==''?'':''+unit+'')"/>
<el-table-column prop="dataB" :label="`B${unit}`"/> <el-table-column prop="dataB" :label="'B'+(unit==''?'':''+unit+'')"/>
<el-table-column prop="dataC" :label="`C${unit}`"/> <el-table-column prop="dataC" :label="'C'+(unit==''?'':''+unit+'')"/>
</template> </template>
<template v-if="phaseT === 1"> <template v-if="phaseT === 1">
<el-table-column prop="dataT" :label="`T${unit}`"/> <el-table-column prop="dataT" :label="'T'+(unit==''?'':''+unit+'')"/>
</template> </template>
</el-table> </el-table>
</div> </div>
@@ -20,9 +20,10 @@
</template> </template>
<script lang="tsx" setup> <script lang="tsx" setup>
import {CheckData} from "@/api/check/interface"; import {CheckData} from "@/api/check/interface";
import { computed } from "vue"; import { computed } from "vue";
import {useDownload} from "@/hooks/useDownload";
import {exportRawData} from "@/api/check/test"
const {tableData} = defineProps<{ const {tableData} = defineProps<{
tableData: CheckData.RawDataItem[] tableData: CheckData.RawDataItem[]
@@ -36,7 +37,9 @@ const phaseT = computed(() => {
return tableData[0].dataT == '/' ? 0 : 1 return tableData[0].dataT == '/' ? 0 : 1
}) })
const exportData = () => {
useDownload(exportRawData, '原始数据.xlsx', {}, false, '.xlsx')
}
</script> </script>
<style scoped> <style scoped>

View File

@@ -1,7 +1,7 @@
<template> <template>
<div class="table-main"> <div class="table-main">
<el-table v-if="tableData.length > 0" :data="tableData" height="335px" :header-cell-style="{ textAlign: 'center' } " <el-table v-if="tableData.length > 0" :data="tableData" height="357px" :header-cell-style="{ textAlign: 'center' } "
:cell-style="{ textAlign: 'center' }"> :cell-style="{ textAlign: 'center' }">
<!-- <el-table-column prop="chnNum" label="通道号" width="80">--> <!-- <el-table-column prop="chnNum" label="通道号" width="80">-->
<!-- <template #default="{row}">--> <!-- <template #default="{row}">-->
@@ -9,14 +9,14 @@
<!-- </template>--> <!-- </template>-->
<!-- </el-table-column>--> <!-- </el-table-column>-->
<template v-if="phaseT === 0"> <template v-if="phaseT === 0">
<el-table-column :label="`A${unit}`"> <el-table-column :label="'A'+(unit==''?'':''+unit+'')">
<el-table-column prop="stdA" width="100" label="标准值"/> <el-table-column prop="stdA" width="100" label="标准值"/>
<el-table-column prop="dataA" width="100" label="被检值"/> <el-table-column prop="dataA" width="100" label="被检值"/>
<el-table-column prop="isDataA" label="检测结果"> <el-table-column prop="isDataA" label="检测结果">
<template #default="scope"> <template #default="scope">
<el-tooltip effect="dark" placement="bottom"> <el-tooltip effect="dark" placement="bottom">
<template #content> <template #content>
最大误差{{ scope.row.maxErrorA }} <br/> 误差范围{{ scope.row.maxErrorA }} <br/>
误差值{{ scope.row.errorA }} {{ scope.row.errorA !== '/' ? unit : '' }} 误差值{{ scope.row.errorA }} {{ scope.row.errorA !== '/' ? unit : '' }}
</template> </template>
<el-tag type="success" v-if="scope.row.isDataA === 1">符合</el-tag> <el-tag type="success" v-if="scope.row.isDataA === 1">符合</el-tag>
@@ -26,14 +26,14 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table-column> </el-table-column>
<el-table-column :label="`B${unit}`"> <el-table-column :label="'B'+(unit==''?'':''+unit+'')">
<el-table-column prop="stdB" width="100" label="标准值"/> <el-table-column prop="stdB" width="100" label="标准值"/>
<el-table-column prop="dataB" width="100" label="被检值"/> <el-table-column prop="dataB" width="100" label="被检值"/>
<el-table-column prop="isDataB" label="检测结果"> <el-table-column prop="isDataB" label="检测结果">
<template #default="scope"> <template #default="scope">
<el-tooltip effect="dark" placement="bottom"> <el-tooltip effect="dark" placement="bottom">
<template #content> <template #content>
最大误差{{ scope.row.maxErrorB }}<br/> 误差范围{{ scope.row.maxErrorB }}<br/>
误差值{{ scope.row.errorB }} {{ scope.row.errorB !== '/' ? unit : '' }} 误差值{{ scope.row.errorB }} {{ scope.row.errorB !== '/' ? unit : '' }}
</template> </template>
<el-tag type="success" v-if="scope.row.isDataB === 1">符合</el-tag> <el-tag type="success" v-if="scope.row.isDataB === 1">符合</el-tag>
@@ -43,14 +43,14 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table-column> </el-table-column>
<el-table-column :label="`C${unit}`"> <el-table-column :label="'C'+(unit==''?'':''+unit+'')">
<el-table-column prop="stdC" width="100" label="标准值"/> <el-table-column prop="stdC" width="100" label="标准值"/>
<el-table-column prop="dataC" width="100" label="被检值"/> <el-table-column prop="dataC" width="100" label="被检值"/>
<el-table-column prop="isDataC" label="检测结果"> <el-table-column prop="isDataC" label="检测结果">
<template #default="scope"> <template #default="scope">
<el-tooltip effect="dark" placement="bottom"> <el-tooltip effect="dark" placement="bottom">
<template #content> <template #content>
最大误差 {{ scope.row.maxErrorC }}<br/> 误差范围 {{ scope.row.maxErrorC }}<br/>
误差值{{ scope.row.errorC }} {{ scope.row.errorC !== '/' ? unit : '' }} 误差值{{ scope.row.errorC }} {{ scope.row.errorC !== '/' ? unit : '' }}
</template> </template>
<el-tag type="success" v-if="scope.row.isDataC === 1">符合</el-tag> <el-tag type="success" v-if="scope.row.isDataC === 1">符合</el-tag>
@@ -63,14 +63,14 @@
</template> </template>
<template v-if="phaseT === 1"> <template v-if="phaseT === 1">
<el-table-column :label="`T${unit}`"> <el-table-column :label="'T'+(unit==''?'':''+unit+'')">
<el-table-column prop="stdT" label="标准值"/> <el-table-column prop="stdT" label="标准值"/>
<el-table-column prop="dataT" label="被检值"/> <el-table-column prop="dataT" label="被检值"/>
<el-table-column prop="isDataT" label="检测结果"> <el-table-column prop="isDataT" label="检测结果">
<template #default="scope"> <template #default="scope">
<el-tooltip effect="dark" placement="bottom"> <el-tooltip effect="dark" placement="bottom">
<template #content> <template #content>
最大误差 {{ scope.row.maxErrorT }}<br/> 误差范围 {{ scope.row.maxErrorT }}<br/>
误差值{{ scope.row.errorT }} {{ scope.row.errorT !== '/' ? unit : '' }} 误差值{{ scope.row.errorT }} {{ scope.row.errorT !== '/' ? unit : '' }}
</template> </template>
<el-tag type="success" v-if="scope.row.isDataT === 1">符合</el-tag> <el-tag type="success" v-if="scope.row.isDataT === 1">符合</el-tag>
@@ -80,7 +80,7 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table-column> </el-table-column>
<!-- <el-table-column prop="maxError" label="最大误差"/>--> <!-- <el-table-column prop="maxError" label="误差范围"/>-->
<!-- <el-table-column prop="result" label="检测结果">--> <!-- <el-table-column prop="result" label="检测结果">-->
<!-- <template #default="scope">--> <!-- <template #default="scope">-->
<!-- <span v-if="scope.row.result === 1">符合</span>--> <!-- <span v-if="scope.row.result === 1">符合</span>-->

View File

@@ -1,6 +1,6 @@
<template> <template>
<el-dialog :append-to-body="appendToBody" class="dialog" title="数据查询" :model-value='visible' @close="close" <el-dialog :append-to-body="appendToBody" class="dialog" title="数据查询" :model-value='visible' @close="close"
v-bind="dialogBig" :draggable="false" style="margin-left: 20%;"> v-bind="dialogBig" :draggable="false">
<div class="data-check-dialog"> <div class="data-check-dialog">
<div class="data-check-head"> <div class="data-check-head">
<el-form :model='formContent' label-width="auto" class="form-three "> <el-form :model='formContent' label-width="auto" class="form-three ">
@@ -63,7 +63,7 @@
</el-popover> </el-popover>
</span> </span>
</div> </div>
<el-form-item style="margin-left: 0px;margin-bottom:0px !important;width: 210px;" v-if="harmNumList.length" label='谐波次数'> <el-form-item style="margin-left: 0px;margin-bottom:0px !important;width: 210px;" v-if="harmNumList.length" label='次数'>
<el-select v-model="currentHarmNum"> <el-select v-model="currentHarmNum">
<el-option v-for="item in harmNumList" :key="item.value" :label="item.label" :value="item.value"/> <el-option v-for="item in harmNumList" :key="item.value" :label="item.label" :value="item.value"/>
</el-select> </el-select>
@@ -202,7 +202,7 @@ watch(() => formContent.chnNum, async (newVal, oldVal) => {
scriptId: checkStore.scriptId, scriptId: checkStore.scriptId,
devId: deviceId, devId: deviceId,
devNum: formContent.chnNum + '', devNum: formContent.chnNum + '',
scriptType: scriptType, scriptType,
code: parseInt(checkStore.planCode) code: parseInt(checkStore.planCode)
}) })
updateTreeFly(resTreeDataTemp, 2) updateTreeFly(resTreeDataTemp, 2)
@@ -267,7 +267,7 @@ const defaultOperate = () => {
defaultExpandedKeys = [node.index] defaultExpandedKeys = [node.index]
treeRef.value?.setCurrentKey(node.index); treeRef.value?.setCurrentKey(node.index);
scriptType = node.scriptType ?? scriptType
} else { } else {
currentScriptTypeName.value = '' currentScriptTypeName.value = ''
currentDesc.value = '' currentDesc.value = ''
@@ -341,7 +341,10 @@ const updateTableData = async () => {
} else if (keys1.length != 0) { } else if (keys1.length != 0) {
let tempHarmNumList: { value: string, label: string }[] = [] let tempHarmNumList: { value: string, label: string }[] = []
for (let [key, value] of resTableData.resultData) { for (let [key, value] of resTableData.resultData) {
tempHarmNumList.push({value: key, label: value.isData === '1' ? key : value.isData === '4' ? `${key}/` : `${key}(不符合)`}) tempHarmNumList.push({
value: key,
label: value.isData === 1 ? key : value.isData === 4 ? `${formatHarmNum(key)}/` : `${formatHarmNum(key)}(不符合)`
})
} }
Object.assign(harmNumList, tempHarmNumList) Object.assign(harmNumList, tempHarmNumList)
@@ -357,7 +360,6 @@ const updateTableData = async () => {
} }
const open = async (_deviceId: string, chnNum: string, _scriptType: string | null) => { const open = async (_deviceId: string, chnNum: string, _scriptType: string | null) => {
// console.log(checkStore.scriptId, _deviceId, chnNum, _scriptType);
deviceId = _deviceId deviceId = _deviceId
scriptType = _scriptType scriptType = _scriptType
@@ -455,6 +457,14 @@ const setCheckResultData = (data: CheckData.ResCheckResult) => {
Object.assign(checkResultData, result) Object.assign(checkResultData, result)
} }
const formatHarmNum = (num: string) => {
if (num.includes('.5')) {
return num
} else {
return num.replace('.0', '')
}
}
const setRawData = (data: CheckData.RawDataItem[]) => { const setRawData = (data: CheckData.RawDataItem[]) => {
console.log("原始数据", data) console.log("原始数据", data)
data.forEach((item: CheckData.RawDataItem) => { data.forEach((item: CheckData.RawDataItem) => {
@@ -605,7 +615,7 @@ defineExpose({
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
max-height: 473px; max-height: 495px;
padding: 10px 0.5% 0px 0.5%; padding: 10px 0.5% 0px 0.5%;
border: 1px solid #ccc; border: 1px solid #ccc;

View File

@@ -260,6 +260,8 @@ import {CheckData} from '@/api/check/interface'
import socketClient from '@/utils/webSocketClient'; import socketClient from '@/utils/webSocketClient';
import auth from "@/directives/modules/auth"; import auth from "@/directives/modules/auth";
import { useAuthStore } from "@/stores/modules/auth"; import { useAuthStore } from "@/stores/modules/auth";
import { useDownload } from '@/hooks/useDownload'
import {downloadDevData} from '@/api/plan/plan.ts'
const dictStore = useDictStore() const dictStore = useDictStore()
const checkStore = useCheckStore() const checkStore = useCheckStore()
@@ -1004,7 +1006,8 @@ const openDrawer = (title: string, row: any) => {
if(title === '生成') if(title === '生成')
{ {
reportDialogVisible.value = true; //reportDialogVisible.value = true;
useDownload(downloadDevData,'调试报告'+formatDate(new Date()), {planId:checkStore.planId,devId:row.id}, false,'.docx')
} }
if(title === '检测数据查询') if(title === '检测数据查询')
@@ -1031,6 +1034,17 @@ const openDrawer = (title: string, row: any) => {
} }
} }
function formatDate(date : Date) {
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从0开始需要加1
const day = String(date.getDate()).padStart(2, '0');
const hours = String(date.getHours()).padStart(2, '0');
const minutes = String(date.getMinutes()).padStart(2, '0');
const seconds = String(date.getSeconds()).padStart(2, '0');
return `${year}${month}${day}${hours}${minutes}${seconds}`;
}
// 监听 props.id 的变化 // 监听 props.id 的变化
watch( watch(
() => props.id, () => props.id,

View File

@@ -306,7 +306,7 @@ watch(testStatus, function (newValue, oldValue) {
percentage.value = 0 percentage.value = 0
} }
emit('update:testStatus', 'test_init') emit('update:testStatus', 'test_init')
// startTimer() // todo 可移除 //startTimer() // todo 可移除
testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:初始化开始!`}) testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:初始化开始!`})
} }
}) })
@@ -414,7 +414,7 @@ watch(webMsgSend, function (newValue, oldValue) {
percentage.value = 3 percentage.value = 3
activeIndex = getNextActiveIndex() + 2 activeIndex = getNextActiveIndex() + 2
// startTimer() //startTimer()
emit('update:testStatus', 'process') emit('update:testStatus', 'process')
} }
@@ -448,7 +448,7 @@ watch(webMsgSend, function (newValue, oldValue) {
updateLog(false) updateLog(false)
if (testStatus.value != 'paused') { if (testStatus.value != 'paused') {
activeIndex = getNextActiveIndex('FREQ') activeIndex = getNextActiveIndex('FREQ')
// startTimer() //startTimer()
} }
break; break;
case 'V_Start': case 'V_Start':
@@ -462,7 +462,7 @@ watch(webMsgSend, function (newValue, oldValue) {
updateLog(false) updateLog(false)
if (testStatus.value != 'paused') { if (testStatus.value != 'paused') {
activeIndex = getNextActiveIndex('V') activeIndex = getNextActiveIndex('V')
// startTimer() //startTimer()
} }
break; break;
case 'HV_Start': case 'HV_Start':
@@ -476,7 +476,7 @@ watch(webMsgSend, function (newValue, oldValue) {
updateLog(false) updateLog(false)
if (testStatus.value != 'paused') { if (testStatus.value != 'paused') {
activeIndex = getNextActiveIndex('HV') activeIndex = getNextActiveIndex('HV')
// startTimer() //startTimer()
} }
break; break;
case 'HI_Start': case 'HI_Start':
@@ -490,7 +490,7 @@ watch(webMsgSend, function (newValue, oldValue) {
updateLog(false) updateLog(false)
if (testStatus.value != 'paused') { if (testStatus.value != 'paused') {
activeIndex = getNextActiveIndex('HI') activeIndex = getNextActiveIndex('HI')
// startTimer() //startTimer()
} }
break; break;
case 'HP_Start': case 'HP_Start':
@@ -504,7 +504,7 @@ watch(webMsgSend, function (newValue, oldValue) {
updateLog(false) updateLog(false)
if (testStatus.value != 'paused') { if (testStatus.value != 'paused') {
activeIndex = getNextActiveIndex('HP') activeIndex = getNextActiveIndex('HP')
// startTimer() //startTimer()
} }
break; break;
case 'HSV_Start': case 'HSV_Start':
@@ -518,7 +518,7 @@ watch(webMsgSend, function (newValue, oldValue) {
updateLog(false) updateLog(false)
if (testStatus.value != 'paused') { if (testStatus.value != 'paused') {
activeIndex = getNextActiveIndex('HSV') activeIndex = getNextActiveIndex('HSV')
// startTimer() //startTimer()
} }
break; break;
case 'HSI_Start': case 'HSI_Start':
@@ -532,7 +532,7 @@ watch(webMsgSend, function (newValue, oldValue) {
updateLog(false) updateLog(false)
if (testStatus.value != 'paused') { if (testStatus.value != 'paused') {
activeIndex = getNextActiveIndex('HSI') activeIndex = getNextActiveIndex('HSI')
// startTimer() //startTimer()
} }
break; break;
case 'VOLTAGE_Start': case 'VOLTAGE_Start':
@@ -546,7 +546,7 @@ watch(webMsgSend, function (newValue, oldValue) {
updateLog(false) updateLog(false)
if (testStatus.value != 'paused') { if (testStatus.value != 'paused') {
activeIndex = getNextActiveIndex('VOLTAGE') activeIndex = getNextActiveIndex('VOLTAGE')
// startTimer() //startTimer()
} }
break; break;
case 'I_Start': case 'I_Start':
@@ -560,7 +560,7 @@ watch(webMsgSend, function (newValue, oldValue) {
updateLog(false) updateLog(false)
if (testStatus.value != 'paused') { if (testStatus.value != 'paused') {
activeIndex = getNextActiveIndex('I') activeIndex = getNextActiveIndex('I')
// startTimer() //startTimer()
} }
break; break;
case 'IMBV_Start': case 'IMBV_Start':
@@ -574,7 +574,7 @@ watch(webMsgSend, function (newValue, oldValue) {
updateLog(false) updateLog(false)
if (testStatus.value != 'paused') { if (testStatus.value != 'paused') {
activeIndex = getNextActiveIndex('IMBV') activeIndex = getNextActiveIndex('IMBV')
// startTimer() //startTimer()
} }
break; break;
case 'IMBA_Start': case 'IMBA_Start':
@@ -588,7 +588,7 @@ watch(webMsgSend, function (newValue, oldValue) {
updateLog(false) updateLog(false)
if (testStatus.value != 'paused') { if (testStatus.value != 'paused') {
activeIndex = getNextActiveIndex('IMBA') activeIndex = getNextActiveIndex('IMBA')
// startTimer() //startTimer()
} }
break; break;
case 'F_Start': case 'F_Start':
@@ -602,7 +602,7 @@ watch(webMsgSend, function (newValue, oldValue) {
updateLog(false) updateLog(false)
if (testStatus.value != 'paused') { if (testStatus.value != 'paused') {
activeIndex = getNextActiveIndex('F') activeIndex = getNextActiveIndex('F')
// startTimer() //startTimer()
} }
break; break;
case 'Quit': case 'Quit':
@@ -1222,7 +1222,7 @@ const handleResumeTest = () => {
type: 'info', type: 'info',
log: `${new Date().toLocaleString()}:继续检测`, log: `${new Date().toLocaleString()}:继续检测`,
}) })
// startTimer() //startTimer()
console.log('开始继续检测') console.log('开始继续检测')
}; };

View File

@@ -377,8 +377,6 @@ const sendResume = () => {
userPageId: "cdf", userPageId: "cdf",
devIds: checkStore.devices.map((item) => item.deviceId), devIds: checkStore.devices.map((item) => item.deviceId),
planId: checkStore.planId, planId: checkStore.planId,
errorSysId: 'cb407009f9894a8a8933b5d9b1e2f71d',
scriptId: "a303b2224845fcc6f60198b8ca23dca9",
operateType: '2' // '1'为预检测、2为正式检测 operateType: '2' // '1'为预检测、2为正式检测
}).then(res => { }).then(res => {
Object.assign(webMsgSend.value, { Object.assign(webMsgSend.value, {