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 namespace CheckData {
export interface DataCheck { export interface DataCheck {
scriptName: string, scriptName: string,
errorSysName: string, errorSysId: string,
dataRule: string, dataRule: string,
deviceName: string, deviceName: string,
chnNum: string, chnNum: string,

View File

@@ -45,7 +45,7 @@ export const updateDtls = (params: any) => {
} }
// 根据通讯参数生成装置下发原始数据公式 // 根据通讯参数生成装置下发原始数据公式
export const scriptDtlsCheckDataList = (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) => { export const checkDataList = (params: any) => {

View File

@@ -12,7 +12,8 @@ export const useCheckStore = defineStore("check", {
plan: Object<Plan.ResPlan>(), plan: Object<Plan.ResPlan>(),
selectTestItems: Object<CheckData.SelectTestItem>({preTest: true, timeTest: true, channelsTest: false, test: true}), selectTestItems: Object<CheckData.SelectTestItem>({preTest: true, timeTest: true, channelsTest: false, test: true}),
checkType:1, // 0:手动检测 1:自动检测 checkType:1, // 0:手动检测 1:自动检测
reCheckType: 1 // 0:不合格项复检 1:全部复检 reCheckType: 1, // 0:不合格项复检 1:全部复检
showDetailType: 0 // 0:数据查询 1:误差体系跟换
}), }),
getters: {}, getters: {},
@@ -40,6 +41,9 @@ export const useCheckStore = defineStore("check", {
}, },
setReCheckType(reCheckType: number) { setReCheckType(reCheckType: number) {
this.reCheckType = reCheckType this.reCheckType = reCheckType
},
setShowDetailType(showDetailType: number) {
this.showDetailType = showDetailType
} }
} }
}); });

View File

@@ -8,7 +8,13 @@
<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-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>
<el-form-item label="数据原则"> <el-form-item label="数据原则">
<el-input v-model='formContent.dataRule' :disabled="true"/> <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-option v-for="item in chnList" :key="item.value" :label="item.label" :value="item.value"/>
</el-select> </el-select>
</el-form-item> </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> </el-form>
</div> </div>
@@ -98,9 +107,10 @@ 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 {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 {useDownload} from "@/hooks/useDownload";
import {exportRawData} from "@/api/check/test" import {Postcard} from "@element-plus/icons-vue";
const {appendToBody} = withDefaults(defineProps<{ const {appendToBody} = withDefaults(defineProps<{
appendToBody: boolean appendToBody: boolean
@@ -117,6 +127,7 @@ const checkStore = useCheckStore()
const visible = ref(false) const visible = ref(false)
const treeRef = ref() const treeRef = ref()
const searchValue = ref<string>('') const searchValue = ref<string>('')
const pqErrorList = reactive<{ id: string; name: string; }[]>([])
watch(searchValue, (val) => { watch(searchValue, (val) => {
treeRef.value!.filter(val) treeRef.value!.filter(val)
}) })
@@ -127,7 +138,7 @@ const fixed = 4;
// 表单数据 // 表单数据
const formContent = reactive<CheckData.DataCheck>({ const formContent = reactive<CheckData.DataCheck>({
scriptName: '', scriptName: '',
errorSysName: '', errorSysId: '',
dataRule: '', dataRule: '',
deviceName: '', deviceName: '',
chnNum: '', chnNum: '',
@@ -194,17 +205,24 @@ const handleNodeClick = async (data: any) => {
scriptType = data.scriptType ?? scriptType scriptType = data.scriptType ?? scriptType
console.log("点击左侧树节点触发事件handleNodeClick", checkIndex.value) console.log("点击左侧树节点触发事件handleNodeClick", checkIndex.value)
if (checkIndex.value!== '') { if (checkIndex.value !== '') {
await updateTableData() await updateTableData()
activeTab.value = 'resultTab' activeTab.value = 'resultTab'
} }
} }
}; };
watch(() => formContent.errorSysId, async (newVal, oldVal) => {
if (newVal != '') {
console.log("切换误差体系");
formContent.chnNum = chnList[0].value
}
})
watch(() => formContent.chnNum, async (newVal, oldVal) => { watch(() => formContent.chnNum, async (newVal, oldVal) => {
// console.log("通道号", newVal); // console.log("通道号", newVal);
if (newVal) { if (newVal != '') {
// 发起请求,查询该测试项的检测结果 // 发起请求,查询该测试项的检测结果
const {data: resTreeDataTemp}: { data: CheckData.TreeItem[] } = await getTreeData({ const {data: resTreeDataTemp}: { data: CheckData.TreeItem[] } = await getTreeData({
scriptId: checkStore.plan.scriptId, scriptId: checkStore.plan.scriptId,
@@ -226,6 +244,7 @@ watch(() => formContent.chnNum, async (newVal, oldVal) => {
activeTab.value = 'resultTab' activeTab.value = 'resultTab'
}) })
// watch(currentHarmNum, (newVal, oldVal) => { // watch(currentHarmNum, (newVal, oldVal) => {
// console.log("谐波次数", newVal); // console.log("谐波次数", newVal);
// if (newVal !== '-1') { // if (newVal !== '-1') {
@@ -245,7 +264,7 @@ watch(() => formContent.chnNum, async (newVal, oldVal) => {
watch(currentCheckItem, (newVal, oldVal) => { watch(currentCheckItem, (newVal, oldVal) => {
console.log("当前检测项", newVal); console.log("当前检测项", newVal);
if (newVal!== '') { if (newVal !== '') {
doCurrentCheckItemUpdate(newVal) doCurrentCheckItemUpdate(newVal)
} else { } else {
activeTab.value = 'resultTab' activeTab.value = 'resultTab'
@@ -393,10 +412,17 @@ const open = async (_deviceId: string, chnNum: string, _scriptType: string | nul
chnNum: chnList.length > 0 ? chnList[0].value : '', chnNum: chnList.length > 0 ? chnList[0].value : '',
}) })
pqErrorList.length = 0
let {data: resPqErrorList} = await getPqErrSysList()
Object.assign(pqErrorList, resPqErrorList)
visible.value = true; visible.value = true;
} }
const handleGenerateReport = () => {
console.log("生成报告", checkStore.plan.id, deviceId)
}
const close = () => { const close = () => {
//数据清空 //数据清空
Object.assign(formContent, { Object.assign(formContent, {
@@ -418,6 +444,7 @@ const close = () => {
activeTab.value = 'resultTab' activeTab.value = 'resultTab'
currentScriptTypeName.value = '' currentScriptTypeName.value = ''
currentDesc.value = '' currentDesc.value = ''
pqErrorList.length = 0
visible.value = false; visible.value = false;
}; };

View File

@@ -225,11 +225,6 @@
<dataCheckPopup ref='dataCheckPopupRef'/> <dataCheckPopup ref='dataCheckPopupRef'/>
<dataCheckChangeErrSysPopup
:visible='dataCheckChangeErrSysDialogVisible'
@update:visible='dataCheckChangeErrSysDialogVisible = $event'
></dataCheckChangeErrSysPopup>
<matchPopup <matchPopup
:visible='matchDialogVisible' :visible='matchDialogVisible'
@update:visible='matchDialogVisible = $event' @update:visible='matchDialogVisible = $event'
@@ -305,7 +300,6 @@ const reportDialogVisible = ref(false)
const dataCheckPopupRef = ref<InstanceType<typeof dataCheckPopup>>() const dataCheckPopupRef = ref<InstanceType<typeof dataCheckPopup>>()
const selectTestItemPopupRef = ref<InstanceType<typeof SelectTestItemPopup>>() const selectTestItemPopupRef = ref<InstanceType<typeof SelectTestItemPopup>>()
const dataCheckChangeErrSysDialogVisible = ref(false)
const matchDialogVisible = ref(false) const matchDialogVisible = ref(false)
const dialogTitle = ref('手动检测') const dialogTitle = ref('手动检测')
const checkStateTable = ref<number[]>([0, 1, 2]) const checkStateTable = ref<number[]>([0, 1, 2])
@@ -1082,10 +1076,12 @@ const openDrawer = async (title: string, row: any) => {
} }
if (title === '检测数据查询') { if (title === '检测数据查询') {
checkStore.setShowDetailType(0)
dataCheckPopupRef.value?.open(row.id, '-1', null) dataCheckPopupRef.value?.open(row.id, '-1', null)
} }
if (title === '误差体系更换') { 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) { if (flag === -1 || flag === 1) {
checkStore.setShowDetailType(0)
dataCheckSingleChannelSingleTestPopupRef.value?.open(item.deviceId, chnNum + '', scriptType); dataCheckSingleChannelSingleTestPopupRef.value?.open(item.deviceId, chnNum + '', scriptType);
} }
}; };

View File

@@ -200,7 +200,7 @@
import { type PropType, ref, nextTick } from 'vue' import { type PropType, ref, nextTick } from 'vue'
import Tree from './tree.vue' import Tree from './tree.vue'
import Commun from './communication.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 { getTreeData } from '@/api/check/test'
import { CirclePlus, Delete, Check, CopyDocument, View, EditPen } from '@element-plus/icons-vue' import { CirclePlus, Delete, Check, CopyDocument, View, EditPen } from '@element-plus/icons-vue'
import type { TestScript } from '@/api/device/interface/testScript' import type { TestScript } from '@/api/device/interface/testScript'
@@ -357,6 +357,12 @@ const openDialog = (titleType: string, row: Partial<TestScript.ResTestScript> =
} }
// 复制 // 复制
const copyRow = async (row: any) => { const copyRow = async (row: any) => {
ElMessageBox.confirm('是否复制当前检测项目?', '提示', {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: 'warning',
draggable: true
}).then(async () => {
let checkDataList: any = [] let checkDataList: any = []
await communRef.value[0]?.getData().forEach((item: any) => { await communRef.value[0]?.getData().forEach((item: any) => {
item.children.forEach((k: any) => { item.children.forEach((k: any) => {
@@ -384,6 +390,7 @@ const copyRow = async (row: any) => {
getTree() getTree()
} }
}) })
})
} }
// 查看 // 查看
const view = (row: Partial<TestScript.ResTestScript> = {}) => { const view = (row: Partial<TestScript.ResTestScript> = {}) => {