This commit is contained in:
sjl
2025-01-15 20:23:05 +08:00
parent c2b63a7a3f
commit d02f85cea5
7 changed files with 92 additions and 54 deletions

View File

@@ -32,7 +32,7 @@ export const exportPqDev=(params: Device.ReqPqDevParams)=>{
export const downloadTemplate = () => { export const downloadTemplate = () => {
return http.download(`/pqDev/downloadTemplate`) return http.download(`/pqDev/downloadTemplate`)
} }
//导入被检设备 //导入被检设备(比对)
export const importPqDev=(params: Device.ReqPqDevParams)=>{ export const importPqDev=(params: Device.ReqPqDevParams)=>{
return http.upload(`/pqDev/import`, params) return http.upload(`/pqDev/import`, params)
} }

View File

@@ -67,12 +67,13 @@ const handelOpen = async (item: string) => {
await authStore.setShowMenu(); await authStore.setShowMenu();
modeStore.setCurrentMode(item); // 将模式code存入 store modeStore.setCurrentMode(item); // 将模式code存入 store
if (router.currentRoute.value.path === '/home/index') { //if (router.currentRoute.value.path === '/home/index') {
// 强制刷新页面 // 强制刷新页面
window.location.reload(); window.location.reload();
} else { //} else {
router.push({ path: '/home/index' }); // router.push({ path: '/home/index' });
} //}
}; };
</script> </script>

View File

@@ -145,13 +145,20 @@ watch(webMsgSend,function (newValue,oldValue){
switch (newValue.requestId){ switch (newValue.requestId){
case 'yjc_ytxjy': case 'yjc_ytxjy':
switch (newValue.operateCode) { switch (newValue.operateCode) {
case'INIT GATHER': case'INIT_GATHER':
if(newValue.code ==-1){ if(newValue.code ==-1){
ElMessageBox.alert('源未知异常', '初始化失败', { ElMessageBox.alert('源未知异常', '初始化失败', {
confirmButtonText: '确定', confirmButtonText: '确定',
type: 'error', type: 'error',
}) })
} TableInit();
}else if (newValue.code == 10523) {
ElMessageBox.alert('源连接失败', '源连接失败', {
confirmButtonText: '确定',
type: 'error',
})
TableInit();
}
} }
break; break;
case 'YJC_xujy': case 'YJC_xujy':
@@ -162,13 +169,14 @@ watch(webMsgSend,function (newValue,oldValue){
confirmButtonText: '确定', confirmButtonText: '确定',
type: 'error', type: 'error',
}) })
TableInit();
} else if (newValue.code == 10520) { } else if (newValue.code == 10520) {
ElMessageBox.alert('解析报文异常,执行自动关闭,请重新发起检测', '解析报文异常', { ElMessageBox.alert('解析报文异常,执行自动关闭,请重新发起检测', '解析报文异常', {
confirmButtonText: '确定', confirmButtonText: '确定',
type: 'error', type: 'error',
}) })
TableInit();
} }
TableInit();
break; break;
case 'DATA_REQUEST$02': case 'DATA_REQUEST$02':
if (newValue.code == 25003) { if (newValue.code == 25003) {
@@ -176,8 +184,8 @@ watch(webMsgSend,function (newValue,oldValue){
confirmButtonText: '确定', confirmButtonText: '确定',
type: 'error', type: 'error',
}) })
TableInit();
} }
TableInit();
break; break;
} }
break; break;
@@ -189,6 +197,7 @@ watch(webMsgSend,function (newValue,oldValue){
confirmButtonText: '确定', confirmButtonText: '确定',
type: 'error', type: 'error',
}) })
TableInit();
}else if (newValue.code == 10551) { }else if (newValue.code == 10551) {
ElMessageBox.alert('设备触发报告异常', '设备触发报告异常', { ElMessageBox.alert('设备触发报告异常', '设备触发报告异常', {
confirmButtonText: '确定', confirmButtonText: '确定',
@@ -200,17 +209,20 @@ watch(webMsgSend,function (newValue,oldValue){
confirmButtonText: '确定', confirmButtonText: '确定',
type: 'error', type: 'error',
}) })
TableInit();
} else if (newValue.code == 10520) { } else if (newValue.code == 10520) {
ElMessageBox.alert('解析报文异常,执行自动关闭,请重新发起检测', '解析报文异常', { ElMessageBox.alert('解析报文异常,执行自动关闭,请重新发起检测', '解析报文异常', {
confirmButtonText: '确定', confirmButtonText: '确定',
type: 'error', type: 'error',
}) })
TableInit();
} }
TableInit();
break; break;
} }
break; break;
case 'Coefficient_Check': case 'Coefficient_Check':
console.log("Coefficient_Checkactive",active.value);
switch (newValue.operateCode){ switch (newValue.operateCode){
case 'big_end'://大电压,电流下装 case 'big_end'://大电压,电流下装
active.value++; active.value++;
@@ -363,29 +375,41 @@ watch(webMsgSend,function (newValue,oldValue){
confirmButtonText: '确定', confirmButtonText: '确定',
type: 'error', type: 'error',
}) })
TableInit();
break; break;
case "Dev": case "Dev":
ElMessageBox.alert('设备服务端连接失败', '设备服务端连接失败', { ElMessageBox.alert('设备服务端连接失败', '设备服务端连接失败', {
confirmButtonText: '确定', confirmButtonText: '确定',
type: 'error', type: 'error',
}) })
TableInit();
break; break;
} }
TableInit();
break; break;
} }
}) })
//出错系数检测初始化 //出错系数检测初始化
const TableInit = () => { const TableInit = () => {
console.log("TableInitactive",active.value);
isButtonDisabled.value = false; // 恢复按钮 isButtonDisabled.value = false; // 恢复按钮
for (let i = 0; i < channel.value.length; i++) { for (let i = 0; i < channel.value.length; i++) {
const currentTableData = initializeTableData(dataTemplates, i); const currentTableData = initializeTableData(dataTemplates, i);
tableDataMap.set(i,currentTableData) tableDataMap.set(i,currentTableData)
// const targetArrayRef = tableDataMap.get(i);
// if (targetArrayRef) {
// const targetArray = targetArrayRef.value;
// if (targetArray.length > 0) {
// targetArray.forEach(item => item.loading =false)
// }
// }
} }
activeIndex.value = 0 activeIndex.value = 0
qualified.value = 0 qualified.value = 0
active.value = 0 active.value = 0
} }
//按行图标转动 //按行图标转动
@@ -679,7 +703,7 @@ const handleSubmit = async () => {
operateType:'0' // '0'为预检测、1为正式检测 operateType:'0' // '0'为预检测、1为正式检测
}) })
active.value++; active.value++;
console.log("handleSubmitactive",active.value);
// 初始化 loadingStates 为 true // 初始化 loadingStates 为 true
// loadingStates.value = new Array(name.value.length).fill(true); // loadingStates.value = new Array(name.value.length).fill(true);

View File

@@ -29,8 +29,8 @@
placement="bottom-start" placement="bottom-start"
> >
<template #content> <template #content>
误差范围 {{ (-0.1 * props.curV).toFixed(4) + '~' + (0.1 * props.curV).toFixed(4)}}<br/> 误差范围 {{ (-0.001 * props.curV).toFixed(4) + 'V~' + (0.001 * props.curV).toFixed(4)+ 'V'}}<br/>
误差值{{ scope.row.aV }} 误差值{{ scope.row.aV + 'V'}}
</template> </template>
<el-tag type="danger" class="tooltip-content"> <el-tag type="danger" class="tooltip-content">
{{ scope.row.aVuXi }} {{ scope.row.aVuXi }}
@@ -43,8 +43,8 @@
placement="bottom-start" placement="bottom-start"
> >
<template #content> <template #content>
误差范围 {{ (-0.1 * props.curV).toFixed(4) + '~' + (0.1 * props.curV).toFixed(4)}}<br/> 误差范围 {{ (-0.001 * props.curV).toFixed(4) + 'V~' + (0.001 * props.curV).toFixed(4)+ 'V'}}<br/>
误差值{{ scope.row.aV }} 误差值{{ scope.row.aV + 'V'}}
</template> </template>
<el-tag type="success" class="tooltip-content">{{ scope.row.aVuXi }}</el-tag> <el-tag type="success" class="tooltip-content">{{ scope.row.aVuXi }}</el-tag>
</el-tooltip> </el-tooltip>
@@ -80,8 +80,8 @@
placement="bottom-start" placement="bottom-start"
> >
<template #content> <template #content>
误差范围 {{ (-0.1 * props.curV).toFixed(4) + '~' + (0.1 * props.curV).toFixed(4)}}<br/> 误差范围 {{ (-0.001 * props.curV).toFixed(4) + 'V~' + (0.001 * props.curV).toFixed(4)+ 'V'}}<br/>
误差值{{ scope.row.bV }} 误差值{{ scope.row.bV + 'V'}}
</template> </template>
<el-tag type="danger" class="tooltip-content"> <el-tag type="danger" class="tooltip-content">
{{ scope.row.bVuXi }} {{ scope.row.bVuXi }}
@@ -94,8 +94,8 @@
placement="bottom-start" placement="bottom-start"
> >
<template #content> <template #content>
误差范围 {{ (-0.1 * props.curV).toFixed(4) + '~' + (0.1 * props.curV).toFixed(4)}}<br/> 误差范围 {{ (-0.001 * props.curV).toFixed(4) + 'V~' + (0.001 * props.curV).toFixed(4)+ 'V'}}<br/>
误差值{{ scope.row.bV }} 误差值{{ scope.row.bV + 'V'}}
</template> </template>
<el-tag type="success" class="tooltip-content">{{ scope.row.bVuXi }}</el-tag> <el-tag type="success" class="tooltip-content">{{ scope.row.bVuXi }}</el-tag>
</el-tooltip> </el-tooltip>
@@ -125,8 +125,8 @@
placement="bottom-start" placement="bottom-start"
> >
<template #content> <template #content>
误差范围 {{ (-0.1 * props.curV).toFixed(4) + '~' + (0.1 * props.curV).toFixed(4)}}<br/> 误差范围 {{ (-0.001 * props.curV).toFixed(4) + 'V~' + (0.001 * props.curV).toFixed(4)+ 'V'}}<br/>
误差值{{ scope.row.cV }} 误差值{{ scope.row.cV + 'V'}}
</template> </template>
<el-tag type="danger" class="tooltip-content"> <el-tag type="danger" class="tooltip-content">
{{ scope.row.cVuXi }} {{ scope.row.cVuXi }}
@@ -139,8 +139,8 @@
placement="bottom-start" placement="bottom-start"
> >
<template #content> <template #content>
误差范围 {{ (-0.1 * props.curV).toFixed(4) + '~' + (0.1 * props.curV).toFixed(4)}}<br/> 误差范围 {{ (-0.001 * props.curV).toFixed(4) + 'V~' + (0.001 * props.curV).toFixed(4) + 'V'}}<br/>
误差值{{ scope.row.cV }} 误差值{{ scope.row.cV + 'V'}}
</template> </template>
<el-tag type="success" class="tooltip-content">{{ scope.row.cVuXi }}</el-tag> <el-tag type="success" class="tooltip-content">{{ scope.row.cVuXi }}</el-tag>
</el-tooltip> </el-tooltip>
@@ -172,8 +172,8 @@
placement="bottom-start" placement="bottom-start"
> >
<template #content> <template #content>
误差范围 {{ -0.5 + "~" +0.5 }}<br/> 误差范围 {{-0.5 + "%~" +0.5 + "%" }}<br/>
误差值{{ scope.row.aI }} 误差值{{ scope.row.aI + '%'}}
</template> </template>
<el-tag type="danger" class="tooltip-content"> <el-tag type="danger" class="tooltip-content">
{{ scope.row.aIeXi }} {{ scope.row.aIeXi }}
@@ -186,8 +186,8 @@
placement="bottom-start" placement="bottom-start"
> >
<template #content> <template #content>
误差范围 {{ -0.5 + "~" +0.5 }}<br/> 误差范围 {{ -0.5 + "%~" +0.5 + "%" }}<br/>
误差值{{ scope.row.aI }} 误差值{{ scope.row.aI + '%'}}
</template> </template>
<el-tag type="success" class="tooltip-content">{{ scope.row.aIeXi }}</el-tag> <el-tag type="success" class="tooltip-content">{{ scope.row.aIeXi }}</el-tag>
</el-tooltip> </el-tooltip>
@@ -217,8 +217,8 @@
placement="bottom-start" placement="bottom-start"
> >
<template #content> <template #content>
误差范围 {{ -0.5 + "~" +0.5 }}<br/> 误差范围 {{ -0.5 + "%~" +0.5 + "%" }}<br/>
误差值{{ scope.row.bI }} 误差值{{ scope.row.bI + '%'}}
</template> </template>
<el-tag type="danger" class="tooltip-content"> <el-tag type="danger" class="tooltip-content">
{{ scope.row.bIeXi }} {{ scope.row.bIeXi }}
@@ -231,8 +231,8 @@
placement="bottom-start" placement="bottom-start"
> >
<template #content> <template #content>
误差范围 {{ -0.5 + "~" +0.5 }}<br/> 误差范围 {{ -0.5 + "%~" +0.5 + "%" }}<br/>
误差值{{ scope.row.bI }} 误差值{{ scope.row.bI + '%'}}
</template> </template>
<el-tag type="success" class="tooltip-content">{{ scope.row.bIeXi }}</el-tag> <el-tag type="success" class="tooltip-content">{{ scope.row.bIeXi }}</el-tag>
</el-tooltip> </el-tooltip>
@@ -262,8 +262,8 @@
placement="bottom-start" placement="bottom-start"
> >
<template #content> <template #content>
误差范围 {{ -0.5 + "~" +0.5 }}<br/> 误差范围 {{ -0.5 + "%~" +0.5 + "%" }}<br/>
误差值{{ scope.row.cI }} 误差值{{ scope.row.cI + '%'}}
</template> </template>
<el-tag type="danger" class="tooltip-content"> <el-tag type="danger" class="tooltip-content">
{{ scope.row.cIeXi }} {{ scope.row.cIeXi }}
@@ -276,8 +276,8 @@
placement="bottom-start" placement="bottom-start"
> >
<template #content> <template #content>
误差范围 {{ -0.5 + "~" +0.5 }}<br/> 误差范围 {{ -0.5 + "%~" +0.5 + "%" }}<br/>
误差值{{ scope.row.cI }} 误差值{{ scope.row.cI + '%'}}
</template> </template>
<el-tag type="success" class="tooltip-content">{{ scope.row.cIeXi }}</el-tag> <el-tag type="success" class="tooltip-content">{{ scope.row.cIeXi }}</el-tag>
</el-tooltip> </el-tooltip>

View File

@@ -756,6 +756,7 @@ function tableHeaderInit(val: number) {
break; break;
} }
//console.log("test",columns); //console.log("test",columns);
handleRefresh()
} }
function refreshStatusList(){ function refreshStatusList(){
@@ -968,7 +969,7 @@ const handleTest = async (val:string) => {
const data = reactive({ const data = reactive({
socketServe: socketClient.Instance, socketServe: socketClient.Instance,
}); });
const url = 'ws://localhost:7777/hello?name=cdf'; const url = 'ws://192.168.1.127:7777/hello?name=cdf';
socketClient.Instance.connect(url); socketClient.Instance.connect(url);
data.socketServe = socketClient.Instance; data.socketServe = socketClient.Instance;
data.socketServe.registerCallBack('aaa', (res: { code: number; }) => { data.socketServe.registerCallBack('aaa', (res: { code: number; }) => {
@@ -1092,9 +1093,9 @@ function formatDate(date : Date) {
watch( watch(
() => props.id, () => props.id,
(newId) => { (newId) => {
handleRefresh()
// 调用获取数据的方法 // 调用获取数据的方法
handleSearch(); //handleSearch();
}, },
{ immediate: true } // 立即执行一次 { immediate: true } // 立即执行一次
); );

View File

@@ -5,8 +5,8 @@
<div > <div >
<el-form :model='formContent' ref='dialogFormRef' :rules='rules' :disabled="false" label-width="auto" class="form-three"> <el-form :model='formContent' ref='dialogFormRef' :rules='rules' :disabled="false" label-width="auto" class="form-three">
<el-divider >设备信息</el-divider> <el-divider >设备信息</el-divider>
<el-form-item label="设备序列号" prop="createId" > <el-form-item label="装置编号" prop="createId" >
<el-input v-model="formContent.createId" placeholder="请输入设备序列号" @input="handleInput" /> <el-input v-model="formContent.createId" placeholder="请输入装置编号" @input="handleInput" />
</el-form-item> </el-form-item>
<el-form-item label="设备名称" prop="name" > <el-form-item label="设备名称" prop="name" >
<el-input v-model='formContent.name' placeholder="请输入设备名称" :disabled="scene === '1'"/> <el-input v-model='formContent.name' placeholder="请输入设备名称" :disabled="scene === '1'"/>
@@ -274,7 +274,7 @@ const baseRules: Record<string, Array<FormItemRule>> = {
{ required: true, message: '额定电流必填!', trigger: 'blur' }, { required: true, message: '额定电流必填!', trigger: 'blur' },
{ pattern: /^\d+(\.\d+)?$/, message: '额定电流格式错误', trigger: 'blur' } { pattern: /^\d+(\.\d+)?$/, message: '额定电流格式错误', trigger: 'blur' }
], ],
createId: [{ required: true, message: '设备序列号必填!', trigger: 'blur' }], createId: [{ required: true, message: '装置编号必填!', trigger: 'blur' }],
ip: [ ip: [
{ required: true, message: 'IP地址必填', trigger: 'blur' }, { required: true, message: 'IP地址必填', trigger: 'blur' },
{ pattern: /^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/, message: 'IP地址格式错误', trigger: 'blur' } { pattern: /^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/, message: 'IP地址格式错误', trigger: 'blur' }

View File

@@ -10,7 +10,8 @@
<template #tableHeader='scope'> <template #tableHeader='scope'>
<el-button v-auth.device="'add'" type='primary' :icon='CirclePlus' @click="openDialog('add')">新增</el-button> <el-button v-auth.device="'add'" type='primary' :icon='CirclePlus' @click="openDialog('add')">新增</el-button>
<el-button v-auth.device="'export'" type='primary' :icon='Upload' plain @click='downloadFile()'>导出</el-button> <el-button v-auth.device="'export'" type='primary' :icon='Upload' plain @click='downloadFile()'>导出</el-button>
<el-button v-auth.device="'import'" type='primary' :icon='Download' plain @click='importFile()' v-if='modeStore.currentMode === "比对式"'>导入</el-button> <el-button v-auth.device="'import'" type='primary' :icon='Download' plain @click="importFile('')" v-if='modeStore.currentMode != "比对式"'>导入</el-button>
<el-button v-auth.device="'import'" type='primary' :icon='Download' plain @click="importFile('比对式')" v-if='modeStore.currentMode === "比对式"'>导入</el-button>
<el-button v-auth.device="'delete'" type='danger' :icon='Delete' plain :disabled='!scope.isSelected' <el-button v-auth.device="'delete'" type='danger' :icon='Delete' plain :disabled='!scope.isSelected'
@click='batchDelete(scope.selectedListIds)'> @click='batchDelete(scope.selectedListIds)'>
删除 删除
@@ -52,8 +53,6 @@ const appSceneStore = useAppSceneStore()
// ProTable 实例 // ProTable 实例
const proTable = ref<ProTableInstance>() const proTable = ref<ProTableInstance>()
const devicePopup = ref() const devicePopup = ref()
const boundPqDevList=ref<Device.ReqPqDevParams[]>([])//根据检测计划id查询出所有已绑定的设备 const boundPqDevList=ref<Device.ReqPqDevParams[]>([])//根据检测计划id查询出所有已绑定的设备
// 存储设备类型选项 // 存储设备类型选项
const devTypeOptions = ref<Device.ResDev[]>([]) const devTypeOptions = ref<Device.ResDev[]>([])
@@ -205,15 +204,28 @@ const downloadFile = async () => {
//导入设备 //导入设备
const deviceImportExcel = ref<InstanceType<typeof ImportExcel> | null>(null) const deviceImportExcel = ref<InstanceType<typeof ImportExcel> | null>(null)
const importFile = async () => { const importFile = async (pattern:string) => {
const params = {
title: '被检设备', if(pattern === '比对式'){
showCover: false, const params = {
tempApi: downloadTemplate, title: '被检设备',
importApi: importPqDev, showCover: false,
getTableList: proTable.value?.getTableList, tempApi: downloadTemplate,
importApi: importPqDev,
getTableList: proTable.value?.getTableList,
}
deviceImportExcel.value?.acceptParams(params)
}else{
const params = {
title: '被检设备',
showCover: false,
tempApi: downloadTemplate,
getTableList: proTable.value?.getTableList,
}
deviceImportExcel.value?.acceptParams(params)
} }
deviceImportExcel.value?.acceptParams(params)
} }
onBeforeMount(async () => { onBeforeMount(async () => {