diff --git a/frontend/src/api/check/test/index.ts b/frontend/src/api/check/test/index.ts index 53d7055..6bc5cf2 100644 --- a/frontend/src/api/check/test/index.ts +++ b/frontend/src/api/check/test/index.ts @@ -2,7 +2,7 @@ import http from "@/api"; import {CheckData} from "@/api/check/interface"; export const getBigTestItem = (params: { - reCheckType:number, + reCheckType: number, planId: string, devId: string, }) => { @@ -31,7 +31,7 @@ export const getTreeData = (params: { devId?: string, devNum?: string, scriptType?: string | null, - code?: number, + code?: string, }) => { return http.post("/result/treeData/", params, {loading: true}); } @@ -45,7 +45,7 @@ export const getTableData = (params: { scriptId: string, devId: string, devNum: string, - code: number, + code: string, index: number, }) => { return http.post("/result/resultData/", params, {loading: false}); @@ -56,8 +56,30 @@ export const exportRawData = (params: { scriptId: string, devId: string, devNum: string, - code: number, + code: string, index: number, }) => { 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}) } \ No newline at end of file diff --git a/frontend/src/views/home/components/dataCheckSingleChannelSingleTestPopup.vue b/frontend/src/views/home/components/dataCheckSingleChannelSingleTestPopup.vue index e166f87..b22eead 100644 --- a/frontend/src/views/home/components/dataCheckSingleChannelSingleTestPopup.vue +++ b/frontend/src/views/home/components/dataCheckSingleChannelSingleTestPopup.vue @@ -8,7 +8,8 @@ - + ({ deviceName: '', chnNum: '', }) -// 当前选中的谐波次数 -// const currentHarmNum = ref("-1") +// 原始误差体系id +let originErrorSysId: string = '' +let planCode: string = '' // 谐波次数列表 // const harmNumList = reactive<{ value: string, label: string }[]>([]) // 当前选中的检测项 @@ -212,38 +214,57 @@ const handleNodeClick = async (data: any) => { } }; -watch(() => formContent.errorSysId, async (newVal, oldVal) => { - if (newVal != '') { - console.log("切换误差体系"); - formContent.chnNum = chnList[0].value +const handleErrorSysChange = async () => { + console.log("切换误差体系", formContent.errorSysId); + // await changeErrorSystem({ + // 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) => { // console.log("通道号", newVal); - if (newVal != '') { - // 发起请求,查询该测试项的检测结果 - 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() + handleChnNumChange() } - 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) => { // console.log("谐波次数", newVal); @@ -301,7 +322,7 @@ const updateTableData = async () => { scriptId: checkStore.plan.scriptId, devId: deviceId, devNum: formContent.chnNum + '', - code: parseInt(checkStore.plan.code), + code: planCode, index: parseInt(checkIndex.value), }) @@ -341,7 +362,7 @@ const updateTableData = async () => { setCheckResultData(resCheckResult) setRawData(resRawData) 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) { doCurrentCheckItemUpdate(checkList[0].value) } else { @@ -391,6 +412,7 @@ const doCurrentCheckItemUpdate = (newVal: string) => { } const open = async (_deviceId: string, chnNum: string, _scriptType: string | null) => { + planCode = checkStore.plan.code + '' deviceId = _deviceId originScriptType = _scriptType scriptType = _scriptType @@ -416,6 +438,7 @@ const open = async (_deviceId: string, chnNum: string, _scriptType: string | nul dataRule: dataRuleName, chnNum: chnList.length > 0 ? chnList[0].value : '', }) + originErrorSysId = formContent.errorSysId pqErrorList.length = 0 let {data: resPqErrorList} = await getPqErrSysList() @@ -428,7 +451,7 @@ const handleGenerateReport = () => { console.log("生成报告", checkStore.plan.id, deviceId) } -const close = () => { +const close = async () => { //数据清空 Object.assign(formContent, { scriptName: '', @@ -450,8 +473,13 @@ const close = () => { currentScriptTypeName.value = '' currentDesc.value = '' pqErrorList.length = 0 + planCode = '' visible.value = false; + + if (checkStore.showDetailType === 1) { + await deleteTempTable(checkStore.plan.code + '') + } }; const setCheckResultData = (data: CheckData.ResCheckResult | null) => { @@ -507,7 +535,7 @@ const exportRawDataHandler = () => { scriptId: checkStore.plan.scriptId, devId: deviceId, devNum: formContent.chnNum + '', - code: parseInt(checkStore.plan.code), + code: checkStore.plan.code + '', index: parseInt(checkIndex.value), }, false, '.xlsx') }