This commit is contained in:
sjl
2025-03-07 10:17:14 +08:00
7 changed files with 71 additions and 36 deletions

View File

@@ -1,7 +1,7 @@
export namespace CheckData {
export interface DataCheck {
scriptName: string,
errorSysName: string,
errorSysId: string,
dataRule: string,
deviceName: string,
chnNum: string,

View File

@@ -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) => {

View File

@@ -12,7 +12,8 @@ export const useCheckStore = defineStore("check", {
plan: Object<Plan.ResPlan>(),
selectTestItems: Object<CheckData.SelectTestItem>({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
}
}
});

View File

@@ -8,7 +8,13 @@
<el-input v-model='formContent.scriptName' :disabled="true"/>
</el-form-item>
<el-form-item label="误差体系">
<el-input v-model='formContent.errorSysName' :disabled="true"/>
<el-select v-model="formContent.errorSysId" placeholder="请选择误差体系" autocomplete="off" :disabled="checkStore.showDetailType===0">
<el-option
v-for="(option) in pqErrorList"
:key="option.id"
:label="option.name"
:value="option.id"/>
</el-select>
</el-form-item>
<el-form-item label="数据原则">
<el-input v-model='formContent.dataRule' :disabled="true"/>
@@ -21,6 +27,9 @@
<el-option v-for="item in chnList" :key="item.value" :label="item.label" :value="item.value"/>
</el-select>
</el-form-item>
<el-form-item label=" ">
<el-button type="primary" :icon="Postcard" v-if="checkStore.showDetailType===1" @click="handleGenerateReport">报告生成</el-button>
</el-form-item>
</el-form>
</div>
@@ -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<string>('')
const pqErrorList = reactive<{ id: string; name: string; }[]>([])
watch(searchValue, (val) => {
treeRef.value!.filter(val)
})
@@ -127,7 +138,7 @@ const fixed = 4;
// 表单数据
const formContent = reactive<CheckData.DataCheck>({
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;
};

View File

@@ -225,11 +225,6 @@
<dataCheckPopup ref='dataCheckPopupRef'/>
<dataCheckChangeErrSysPopup
:visible='dataCheckChangeErrSysDialogVisible'
@update:visible='dataCheckChangeErrSysDialogVisible = $event'
></dataCheckChangeErrSysPopup>
<matchPopup
:visible='matchDialogVisible'
@update:visible='matchDialogVisible = $event'
@@ -305,7 +300,6 @@ const reportDialogVisible = ref(false)
const dataCheckPopupRef = ref<InstanceType<typeof dataCheckPopup>>()
const selectTestItemPopupRef = ref<InstanceType<typeof SelectTestItemPopup>>()
const dataCheckChangeErrSysDialogVisible = ref(false)
const matchDialogVisible = ref(false)
const dialogTitle = ref('手动检测')
const checkStateTable = ref<number[]>([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)
}

View File

@@ -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);
}
};

View File

@@ -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<TestScript.ResTestScript> =
}
// 复制
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<TestScript.ResTestScript> = {}) => {