This commit is contained in:
caozehui
2025-03-12 15:01:58 +08:00
parent d7cfcc7855
commit a122e9e1b3
2 changed files with 86 additions and 36 deletions

View File

@@ -2,7 +2,7 @@ import http from "@/api";
import {CheckData} from "@/api/check/interface"; import {CheckData} from "@/api/check/interface";
export const getBigTestItem = (params: { export const getBigTestItem = (params: {
reCheckType:number, reCheckType: number,
planId: string, planId: string,
devId: string, devId: string,
}) => { }) => {
@@ -31,7 +31,7 @@ export const getTreeData = (params: {
devId?: string, devId?: string,
devNum?: string, devNum?: string,
scriptType?: string | null, scriptType?: string | null,
code?: number, code?: string,
}) => { }) => {
return http.post<CheckData.TreeItem[]>("/result/treeData/", params, {loading: true}); return http.post<CheckData.TreeItem[]>("/result/treeData/", params, {loading: true});
} }
@@ -45,7 +45,7 @@ export const getTableData = (params: {
scriptId: string, scriptId: string,
devId: string, devId: string,
devNum: string, devNum: string,
code: number, code: string,
index: number, index: number,
}) => { }) => {
return http.post("/result/resultData/", params, {loading: false}); return http.post("/result/resultData/", params, {loading: false});
@@ -56,8 +56,30 @@ export const exportRawData = (params: {
scriptId: string, scriptId: string,
devId: string, devId: string,
devNum: string, devNum: string,
code: number, code: string,
index: number, index: number,
}) => { }) => {
return http.download("/result/exportRawData", params, {loading: false}); return http.download("/result/exportRawData", params, {loading: false});
}
/**
* 更换误差体系
* @param params
*/
export const changeErrorSystem = (params: {
planId: string,
scriptId: string,
errorSysId: string,
deviceId: string,
code: string
}) => {
return http.post("/result/changeErrorSystem", params, {loading: false});
}
/**
* 删除(误差体系切换时产生的)临时表
* @param code
*/
export const deleteTempTable = (code: string) => {
return http.get(`/result/deleteTempTable?code=${code}`, null, {loading: false})
} }

View File

@@ -8,7 +8,8 @@
<el-input v-model='formContent.scriptName' :disabled="true"/> <el-input v-model='formContent.scriptName' :disabled="true"/>
</el-form-item> </el-form-item>
<el-form-item label="误差体系"> <el-form-item label="误差体系">
<el-select v-model="formContent.errorSysId" placeholder="请选择误差体系" autocomplete="off" :disabled="checkStore.showDetailType===0"> <el-select v-model="formContent.errorSysId" placeholder="请选择误差体系" autocomplete="off" :disabled="checkStore.showDetailType===0"
@change="handleErrorSysChange">
<el-option <el-option
v-for="(option) in pqErrorList" v-for="(option) in pqErrorList"
:key="option.id" :key="option.id"
@@ -107,7 +108,7 @@ import DataCheckRawDataTable from './dataCheckRawDataTable.vue'
import {CheckData} from "@/api/check/interface"; import {CheckData} from "@/api/check/interface";
import {useDictStore} from "@/stores/modules/dict"; import {useDictStore} from "@/stores/modules/dict";
import {useCheckStore} from "@/stores/modules/check"; import {useCheckStore} from "@/stores/modules/check";
import {exportRawData, getFormData, getTableData, getTreeData} from "@/api/check/test"; import {deleteTempTable, exportRawData, getFormData, getTableData, getTreeData} from "@/api/check/test";
import {getPqErrSysList} from '@/api/plan/plan' import {getPqErrSysList} from '@/api/plan/plan'
import {useDownload} from "@/hooks/useDownload"; import {useDownload} from "@/hooks/useDownload";
import {Postcard} from "@element-plus/icons-vue"; import {Postcard} from "@element-plus/icons-vue";
@@ -143,8 +144,9 @@ const formContent = reactive<CheckData.DataCheck>({
deviceName: '', deviceName: '',
chnNum: '', chnNum: '',
}) })
// 当前选中的谐波次数 // 原始误差体系id
// const currentHarmNum = ref<string>("-1") let originErrorSysId: string = ''
let planCode: string = ''
// 谐波次数列表 // 谐波次数列表
// const harmNumList = reactive<{ value: string, label: string }[]>([]) // const harmNumList = reactive<{ value: string, label: string }[]>([])
// 当前选中的检测项 // 当前选中的检测项
@@ -212,38 +214,57 @@ const handleNodeClick = async (data: any) => {
} }
}; };
watch(() => formContent.errorSysId, async (newVal, oldVal) => { const handleErrorSysChange = async () => {
if (newVal != '') { console.log("切换误差体系", formContent.errorSysId);
console.log("切换误差体系"); // await changeErrorSystem({
formContent.chnNum = chnList[0].value // planId: checkStore.plan.id,
// scriptId: checkStore.plan.scriptId,
// errorSysId: formContent.errorSysId,
// deviceId: deviceId,
// code: parseInt(checkStore.plan.code),
// })
if (originErrorSysId != formContent.errorSysId) {
planCode = checkStore.plan.code + "_temp"
} else {
planCode = checkStore.plan.code + ''
} }
}) if (formContent.chnNum != chnList[0].value) {
formContent.chnNum = chnList[0].value
} else {
handleChnNumChange()
}
}
watch(() => formContent.chnNum, async (newVal, oldVal) => { watch(() => formContent.chnNum, async (newVal, oldVal) => {
// console.log("通道号", newVal); // console.log("通道号", newVal);
if (newVal != '') { if (newVal != '') {
// 发起请求,查询该测试项的检测结果 handleChnNumChange()
const {data: resTreeDataTemp}: { data: CheckData.TreeItem[] } = await getTreeData({
scriptId: checkStore.plan.scriptId,
devId: deviceId,
devNum: formContent.chnNum + '',
scriptType: originScriptType,
code: parseInt(checkStore.plan.code)
})
updateTreeFly(resTreeDataTemp, 4)
updateTreeFly(resTreeDataTemp, 2)
treeDataAll.length = 0
Object.assign(treeDataAll, resTreeDataTemp)
defaultOperate()
await updateTableData()
} }
activeTab.value = 'resultTab'
}) })
const handleChnNumChange = async () => {
console.log("通道号", formContent.chnNum);
// 发起请求,查询该测试项的检测结果
const {data: resTreeDataTemp}: { data: CheckData.TreeItem[] } = await getTreeData({
scriptId: checkStore.plan.scriptId,
devId: deviceId,
devNum: formContent.chnNum + '',
scriptType: originScriptType,
code: planCode
})
updateTreeFly(resTreeDataTemp, 4)
updateTreeFly(resTreeDataTemp, 2)
treeDataAll.length = 0
Object.assign(treeDataAll, resTreeDataTemp)
defaultOperate()
await updateTableData()
activeTab.value = 'resultTab'
}
// watch(currentHarmNum, (newVal, oldVal) => { // watch(currentHarmNum, (newVal, oldVal) => {
// console.log("谐波次数", newVal); // console.log("谐波次数", newVal);
@@ -301,7 +322,7 @@ const updateTableData = async () => {
scriptId: checkStore.plan.scriptId, scriptId: checkStore.plan.scriptId,
devId: deviceId, devId: deviceId,
devNum: formContent.chnNum + '', devNum: formContent.chnNum + '',
code: parseInt(checkStore.plan.code), code: planCode,
index: parseInt(checkIndex.value), index: parseInt(checkIndex.value),
}) })
@@ -341,7 +362,7 @@ const updateTableData = async () => {
setCheckResultData(resCheckResult) setCheckResultData(resCheckResult)
setRawData(resRawData) setRawData(resRawData)
checkList.length = 0 checkList.length = 0
checkList.push({value: keys1[0], label: resCheckResult.isData === 1? `${keys1[0]}`:resCheckResult.isData === 4? `${keys1[0]}/` :`${keys1[0]}(不符合)`}) checkList.push({value: keys1[0], label: resCheckResult.isData === 1 ? `${keys1[0]}` : resCheckResult.isData === 4 ? `${keys1[0]}/` : `${keys1[0]}(不符合)`})
if (currentCheckItem.value == checkList[0].value) { if (currentCheckItem.value == checkList[0].value) {
doCurrentCheckItemUpdate(checkList[0].value) doCurrentCheckItemUpdate(checkList[0].value)
} else { } else {
@@ -391,6 +412,7 @@ const doCurrentCheckItemUpdate = (newVal: string) => {
} }
const open = async (_deviceId: string, chnNum: string, _scriptType: string | null) => { const open = async (_deviceId: string, chnNum: string, _scriptType: string | null) => {
planCode = checkStore.plan.code + ''
deviceId = _deviceId deviceId = _deviceId
originScriptType = _scriptType originScriptType = _scriptType
scriptType = _scriptType scriptType = _scriptType
@@ -416,6 +438,7 @@ const open = async (_deviceId: string, chnNum: string, _scriptType: string | nul
dataRule: dataRuleName, dataRule: dataRuleName,
chnNum: chnList.length > 0 ? chnList[0].value : '', chnNum: chnList.length > 0 ? chnList[0].value : '',
}) })
originErrorSysId = formContent.errorSysId
pqErrorList.length = 0 pqErrorList.length = 0
let {data: resPqErrorList} = await getPqErrSysList() let {data: resPqErrorList} = await getPqErrSysList()
@@ -428,7 +451,7 @@ const handleGenerateReport = () => {
console.log("生成报告", checkStore.plan.id, deviceId) console.log("生成报告", checkStore.plan.id, deviceId)
} }
const close = () => { const close = async () => {
//数据清空 //数据清空
Object.assign(formContent, { Object.assign(formContent, {
scriptName: '', scriptName: '',
@@ -450,8 +473,13 @@ const close = () => {
currentScriptTypeName.value = '' currentScriptTypeName.value = ''
currentDesc.value = '' currentDesc.value = ''
pqErrorList.length = 0 pqErrorList.length = 0
planCode = ''
visible.value = false; visible.value = false;
if (checkStore.showDetailType === 1) {
await deleteTempTable(checkStore.plan.code + '')
}
}; };
const setCheckResultData = (data: CheckData.ResCheckResult | null) => { const setCheckResultData = (data: CheckData.ResCheckResult | null) => {
@@ -507,7 +535,7 @@ const exportRawDataHandler = () => {
scriptId: checkStore.plan.scriptId, scriptId: checkStore.plan.scriptId,
devId: deviceId, devId: deviceId,
devNum: formContent.chnNum + '', devNum: formContent.chnNum + '',
code: parseInt(checkStore.plan.code), code: checkStore.plan.code + '',
index: parseInt(checkIndex.value), index: parseInt(checkIndex.value),
}, false, '.xlsx') }, false, '.xlsx')
} }