diff --git a/frontend/src/api/check/interface/index.ts b/frontend/src/api/check/interface/index.ts index 099ec80..2550b7f 100644 --- a/frontend/src/api/check/interface/index.ts +++ b/frontend/src/api/check/interface/index.ts @@ -1,7 +1,7 @@ export namespace CheckData { export interface DataCheck { scriptName: string, - errorSysName: string, + errorSysId: string, dataRule: string, deviceName: string, chnNum: string, diff --git a/frontend/src/api/device/testScript/index.ts b/frontend/src/api/device/testScript/index.ts index 55bf0a3..383e733 100644 --- a/frontend/src/api/device/testScript/index.ts +++ b/frontend/src/api/device/testScript/index.ts @@ -45,7 +45,7 @@ export const updateDtls = (params: any) => { } // 根据通讯参数生成装置下发原始数据公式 export const scriptDtlsCheckDataList = (params: any) => { - return http.post(`/pqScript/scriptDtlsCheckDataList`, params) + return http.post(`/pqScript/scriptDtlsCheckDataList`, params,{loading: false}) } // 通讯脚本回显 export const checkDataList = (params: any) => { diff --git a/frontend/src/stores/modules/check.ts b/frontend/src/stores/modules/check.ts index 5339256..4710690 100644 --- a/frontend/src/stores/modules/check.ts +++ b/frontend/src/stores/modules/check.ts @@ -12,7 +12,8 @@ export const useCheckStore = defineStore("check", { plan: Object(), selectTestItems: Object({preTest: true, timeTest: true, channelsTest: false, test: true}), checkType:1, // 0:手动检测 1:自动检测 - reCheckType: 1 // 0:不合格项复检 1:全部复检 + reCheckType: 1, // 0:不合格项复检 1:全部复检 + showDetailType: 0 // 0:数据查询 1:误差体系跟换 }), getters: {}, @@ -40,6 +41,9 @@ export const useCheckStore = defineStore("check", { }, setReCheckType(reCheckType: number) { this.reCheckType = reCheckType + }, + setShowDetailType(showDetailType: number) { + this.showDetailType = showDetailType } } }); \ 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 ab859d3..7394290 100644 --- a/frontend/src/views/home/components/dataCheckSingleChannelSingleTestPopup.vue +++ b/frontend/src/views/home/components/dataCheckSingleChannelSingleTestPopup.vue @@ -8,7 +8,13 @@ - + + + @@ -21,6 +27,9 @@ + + 报告生成 + @@ -98,9 +107,10 @@ import DataCheckRawDataTable from './dataCheckRawDataTable.vue' import {CheckData} from "@/api/check/interface"; import {useDictStore} from "@/stores/modules/dict"; import {useCheckStore} from "@/stores/modules/check"; -import {getFormData, getTreeData, getTableData} from "@/api/check/test"; +import {exportRawData, getFormData, getTableData, getTreeData} from "@/api/check/test"; +import {getPqErrSysList} from '@/api/plan/plan' import {useDownload} from "@/hooks/useDownload"; -import {exportRawData} from "@/api/check/test" +import {Postcard} from "@element-plus/icons-vue"; const {appendToBody} = withDefaults(defineProps<{ appendToBody: boolean @@ -117,6 +127,7 @@ const checkStore = useCheckStore() const visible = ref(false) const treeRef = ref() const searchValue = ref('') +const pqErrorList = reactive<{ id: string; name: string; }[]>([]) watch(searchValue, (val) => { treeRef.value!.filter(val) }) @@ -127,7 +138,7 @@ const fixed = 4; // 表单数据 const formContent = reactive({ scriptName: '', - errorSysName: '', + errorSysId: '', dataRule: '', deviceName: '', chnNum: '', @@ -194,17 +205,24 @@ const handleNodeClick = async (data: any) => { scriptType = data.scriptType ?? scriptType console.log("点击左侧树节点触发事件handleNodeClick", checkIndex.value) - if (checkIndex.value!== '') { + if (checkIndex.value !== '') { await updateTableData() activeTab.value = 'resultTab' } } }; +watch(() => formContent.errorSysId, async (newVal, oldVal) => { + if (newVal != '') { + console.log("切换误差体系"); + formContent.chnNum = chnList[0].value + } +}) + watch(() => formContent.chnNum, async (newVal, oldVal) => { // console.log("通道号", newVal); - if (newVal) { + if (newVal != '') { // 发起请求,查询该测试项的检测结果 const {data: resTreeDataTemp}: { data: CheckData.TreeItem[] } = await getTreeData({ scriptId: checkStore.plan.scriptId, @@ -226,6 +244,7 @@ watch(() => formContent.chnNum, async (newVal, oldVal) => { activeTab.value = 'resultTab' }) + // watch(currentHarmNum, (newVal, oldVal) => { // console.log("谐波次数", newVal); // if (newVal !== '-1') { @@ -245,7 +264,7 @@ watch(() => formContent.chnNum, async (newVal, oldVal) => { watch(currentCheckItem, (newVal, oldVal) => { console.log("当前检测项", newVal); - if (newVal!== '') { + if (newVal !== '') { doCurrentCheckItemUpdate(newVal) } else { activeTab.value = 'resultTab' @@ -393,10 +412,17 @@ const open = async (_deviceId: string, chnNum: string, _scriptType: string | nul chnNum: chnList.length > 0 ? chnList[0].value : '', }) + pqErrorList.length = 0 + let {data: resPqErrorList} = await getPqErrSysList() + Object.assign(pqErrorList, resPqErrorList) visible.value = true; } +const handleGenerateReport = () => { + console.log("生成报告", checkStore.plan.id, deviceId) +} + const close = () => { //数据清空 Object.assign(formContent, { @@ -418,6 +444,7 @@ const close = () => { activeTab.value = 'resultTab' currentScriptTypeName.value = '' currentDesc.value = '' + pqErrorList.length = 0 visible.value = false; }; diff --git a/frontend/src/views/home/components/table.vue b/frontend/src/views/home/components/table.vue index f994f53..a7dd572 100644 --- a/frontend/src/views/home/components/table.vue +++ b/frontend/src/views/home/components/table.vue @@ -225,11 +225,6 @@ - - >() const selectTestItemPopupRef = ref>() -const dataCheckChangeErrSysDialogVisible = ref(false) const matchDialogVisible = ref(false) const dialogTitle = ref('手动检测') const checkStateTable = ref([0, 1, 2]) @@ -1082,10 +1076,12 @@ const openDrawer = async (title: string, row: any) => { } if (title === '检测数据查询') { + checkStore.setShowDetailType(0) dataCheckPopupRef.value?.open(row.id, '-1', null) } if (title === '误差体系更换') { - dataCheckChangeErrSysDialogVisible.value = true + checkStore.setShowDetailType(1) + dataCheckPopupRef.value?.open(row.id, '-1', null) } diff --git a/frontend/src/views/home/components/test.vue b/frontend/src/views/home/components/test.vue index 74359e7..076f710 100644 --- a/frontend/src/views/home/components/test.vue +++ b/frontend/src/views/home/components/test.vue @@ -1117,6 +1117,7 @@ const handleClick = (item: any, chnNum: number, scriptType: string) => { }) } if (flag === -1 || flag === 1) { + checkStore.setShowDetailType(0) dataCheckSingleChannelSingleTestPopupRef.value?.open(item.deviceId, chnNum + '', scriptType); } }; diff --git a/frontend/src/views/machine/testScript/components/testScriptDetail.vue b/frontend/src/views/machine/testScript/components/testScriptDetail.vue index e106767..5dafe63 100644 --- a/frontend/src/views/machine/testScript/components/testScriptDetail.vue +++ b/frontend/src/views/machine/testScript/components/testScriptDetail.vue @@ -200,7 +200,7 @@ import { type PropType, ref, nextTick } from 'vue' import Tree from './tree.vue' import Commun from './communication.vue' -import type { CascaderOption } from 'element-plus' +import {type CascaderOption, ElMessageBox} from 'element-plus' import { getTreeData } from '@/api/check/test' import { CirclePlus, Delete, Check, CopyDocument, View, EditPen } from '@element-plus/icons-vue' import type { TestScript } from '@/api/device/interface/testScript' @@ -357,33 +357,40 @@ const openDialog = (titleType: string, row: Partial = } // 复制 const copyRow = async (row: any) => { + ElMessageBox.confirm('是否复制当前检测项目?', '提示', { + confirmButtonText: "确定", + cancelButtonText: "取消", + type: 'warning', + draggable: true + }).then(async () => { let checkDataList: any = [] await communRef.value[0]?.getData().forEach((item: any) => { - item.children.forEach((k: any) => { - if (k.enable != 0 || k.errorFlag != 0) { - checkDataList.push({ - pid: k.pid, - valueType: k.id, - dataType: k.dataType, - enable: k.enable, - errorFlag: k.errorFlag - }) - } - }) + item.children.forEach((k: any) => { + if (k.enable != 0 || k.errorFlag != 0) { + checkDataList.push({ + pid: k.pid, + valueType: k.id, + dataType: k.dataType, + enable: k.enable, + errorFlag: k.errorFlag + }) + } + }) }) let { data } = await scriptDtlsCheckDataList({ checkDataList: checkDataList, ...row, retryCompute: true }) let copyRow = JSON.parse(JSON.stringify(row)) delete copyRow.index await addScriptDtls({ ...copyRow, scriptType: activeName.value, checkDataList: data }).then(res => { - if (res.code === 'A0000') { - ElMessage.success({ - message: '复制成功!', - type: 'success' - }) - getTree() - } + if (res.code === 'A0000') { + ElMessage.success({ + message: '复制成功!', + type: 'success' + }) + getTree() + } }) + }) } // 查看 const view = (row: Partial = {}) => {