省级平台在正式检测时增加温度、相对湿度参数
This commit is contained in:
@@ -3,6 +3,7 @@ import {CHECK_STORE_KEY} from "@/stores/constant";
|
||||
import type {CheckData} from "@/api/check/interface";
|
||||
import type {Plan} from '@/api/plan/interface'
|
||||
import {useAppSceneStore} from "@/stores/modules/mode";
|
||||
import { set } from "lodash";
|
||||
|
||||
const AppSceneStore = useAppSceneStore()
|
||||
export const useCheckStore = defineStore("check", {
|
||||
@@ -14,7 +15,9 @@ export const useCheckStore = defineStore("check", {
|
||||
selectTestItems: Object<CheckData.SelectTestItem>({preTest: true, timeTest: false, channelsTest: false, test: true}),
|
||||
checkType:1, // 0:手动检测 1:自动检测
|
||||
reCheckType: 1, // 0:不合格项复检 1:全部复检
|
||||
showDetailType: 0 // 0:数据查询 1:误差体系跟换 2:正式检测
|
||||
showDetailType: 0 ,// 0:数据查询 1:误差体系跟换 2:正式检测
|
||||
temperature: 0,
|
||||
humidity: 0
|
||||
}),
|
||||
|
||||
getters: {},
|
||||
@@ -49,6 +52,12 @@ export const useCheckStore = defineStore("check", {
|
||||
},
|
||||
setShowDetailType(showDetailType: number) {
|
||||
this.showDetailType = showDetailType
|
||||
},
|
||||
setTemperature(temperature: number) {
|
||||
this.temperature = temperature
|
||||
},
|
||||
setHumidity(humidity: number) {
|
||||
this.humidity = humidity
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -89,7 +89,7 @@ const handleStart = () => {
|
||||
checkStore.setCheckType(0)
|
||||
checkStore.setSelectTestItems({...formContent})
|
||||
handleClose()
|
||||
emit('openTestDialog')
|
||||
emit('openTestDialog',checkStore.selectTestItems.test)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -234,6 +234,9 @@
|
||||
<ChannelsTest ref='channelsTest' :webMsgSend='webMsgSend' @quitClicked='handleQuitClicked' @submitClicked='handleSubmitClicked'></ChannelsTest>
|
||||
<!-- 手动检测-勾选检测项弹窗 -->
|
||||
<SelectTestItemPopup ref="selectTestItemPopupRef" @openTestDialog="openTestDialog"></SelectTestItemPopup>
|
||||
<!-- 省平台-填写温度湿度弹窗 -->
|
||||
<WriteTHPopup ref="writeTHPopupRef" @openTestDialog2="openTestDialog2"></WriteTHPopup>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -284,6 +287,8 @@ import {documentedPqDev} from '@/api/device/device'
|
||||
import {getPqDev} from '@/api/device/device/index.ts'
|
||||
import {ResultEnum} from '@/enums/httpEnum'
|
||||
import SelectTestItemPopup from "@/views/home/components/selectTestItemPopup.vue";
|
||||
import WriteTHPopup from "@/views/home/components/writeTHPopup.vue";
|
||||
import { fa } from 'element-plus/es/locale'
|
||||
|
||||
const dictStore = useDictStore()
|
||||
const checkStore = useCheckStore()
|
||||
@@ -300,6 +305,7 @@ const reportDialogVisible = ref(false)
|
||||
|
||||
const dataCheckPopupRef = ref<InstanceType<typeof dataCheckPopup>>()
|
||||
const selectTestItemPopupRef = ref<InstanceType<typeof SelectTestItemPopup>>()
|
||||
const writeTHPopupRef = ref<InstanceType<typeof WriteTHPopup>>()
|
||||
|
||||
const matchDialogVisible = ref(false)
|
||||
const dialogTitle = ref('手动检测')
|
||||
@@ -952,12 +958,11 @@ const handleTest = async (val: string) => {
|
||||
})
|
||||
.then(() => {
|
||||
ElMessage.success('不合格项复检')
|
||||
// if (checkStore.devices.length > 1) {
|
||||
// checkStore.setReCheckType(1)
|
||||
// } else {
|
||||
// checkStore.setReCheckType(0)
|
||||
// }
|
||||
checkStore.setReCheckType(0)
|
||||
if (checkStore.devices.length > 1) {
|
||||
checkStore.setReCheckType(1)
|
||||
} else {
|
||||
checkStore.setReCheckType(0)
|
||||
}
|
||||
selectTestItemPopupRef.value?.open()
|
||||
})
|
||||
.catch((action: Action) => {
|
||||
@@ -968,9 +973,11 @@ const handleTest = async (val: string) => {
|
||||
}
|
||||
})
|
||||
} else {
|
||||
|
||||
checkStore.setReCheckType(1)
|
||||
selectTestItemPopupRef.value?.open()
|
||||
}
|
||||
|
||||
} else if (val === '系数校准') {
|
||||
// 检查 socketClient.Instance 是否存在
|
||||
if (!socketClient.Instance) {
|
||||
@@ -1014,16 +1021,27 @@ const handleTest = async (val: string) => {
|
||||
} else {
|
||||
checkStore.setReCheckType(0)
|
||||
}
|
||||
openTestDialog()
|
||||
//openTestDialog(false)
|
||||
if(appSceneStore.currentScene === '0'){
|
||||
writeTHPopupRef.value?.open()
|
||||
}else{
|
||||
openTestDialog(false)
|
||||
}
|
||||
})
|
||||
.catch((action: Action) => {
|
||||
ElMessage.success('全部复检')
|
||||
checkStore.setReCheckType(1)
|
||||
openTestDialog()
|
||||
//openTestDialog(false)
|
||||
if(appSceneStore.currentScene === '0'){
|
||||
writeTHPopupRef.value?.open()
|
||||
}else{
|
||||
openTestDialog(false)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
openTestDialog()
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
if (val === '批量下载') {
|
||||
@@ -1053,8 +1071,19 @@ const handleTest = async (val: string) => {
|
||||
}
|
||||
}
|
||||
|
||||
const openTestDialog = () => {
|
||||
testPopup.value?.open(dialogTitle.value)
|
||||
const openTestDialog = (test:boolean) => {
|
||||
console.log('openTestDialog',test)
|
||||
if(dialogTitle.value === '手动检测' && appSceneStore.currentScene === '0' && test == true){
|
||||
writeTHPopupRef.value?.open()
|
||||
}else{
|
||||
testPopup.value?.open(dialogTitle.value)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
const openTestDialog2 = () => {
|
||||
testPopup.value?.open(dialogTitle.value)
|
||||
}
|
||||
|
||||
// 打开 drawer(新增、查看、编辑)
|
||||
@@ -1134,6 +1163,7 @@ watch(
|
||||
)
|
||||
|
||||
onBeforeMount(async () => {
|
||||
|
||||
const response = await getPqDev()
|
||||
devTypeOptions.value = response.data.map(item => ({
|
||||
id: item.id,
|
||||
|
||||
@@ -94,6 +94,7 @@ import socketClient from '@/utils/webSocketClient';
|
||||
import {useCheckStore} from "@/stores/modules/check";
|
||||
import {pauseTest, resumeTest, startPreTest} from '@/api/socket/socket'
|
||||
import {useUserStore} from "@/stores/modules/user";
|
||||
import { Device } from '@/api/device/interface/device';
|
||||
|
||||
const userStore = useUserStore()
|
||||
const checkStore = useCheckStore();
|
||||
@@ -111,6 +112,7 @@ const channelsTestStatus = ref('waiting');//通道系数校准执行状态
|
||||
const TestStatus = ref('waiting');//正式检测执行状态
|
||||
const webMsgSend = ref();//webSocket推送的数据
|
||||
|
||||
|
||||
const dialogTitle = ref('')
|
||||
const showComponent = ref(true)
|
||||
const preTestRef = ref(null)
|
||||
@@ -213,7 +215,9 @@ const handleSubmit = () => {
|
||||
devIds: deviceIds,
|
||||
planId: planId,
|
||||
operateType: '1', // '1'为预检测、‘2‘为正式检测、'8'为不合格项复检
|
||||
userId:userStore.userInfo.id
|
||||
userId:userStore.userInfo.id,
|
||||
temperature:checkStore.temperature,
|
||||
humidity:checkStore.humidity
|
||||
}).then(res => {
|
||||
if (res.code === 'A001014') {
|
||||
ElMessageBox.alert('装置配置异常', '检测失败', {
|
||||
@@ -242,7 +246,9 @@ const handleSubmit = () => {
|
||||
devIds: deviceIds,
|
||||
planId: planId,
|
||||
operateType: checkStore.reCheckType ==1 ?'2':'8', // '1'为预检测、‘2‘为正式检测、'8'为不合格项复检
|
||||
userId:userStore.userInfo.id
|
||||
userId:userStore.userInfo.id,
|
||||
temperature:checkStore.temperature,
|
||||
humidity:checkStore.humidity
|
||||
}).then(res => {
|
||||
console.log(res)
|
||||
if (res.code === 'A001014') {
|
||||
@@ -360,7 +366,9 @@ const sendResume = () => {
|
||||
devIds: checkStore.devices.map((item) => item.deviceId),
|
||||
planId: checkStore.plan.id,
|
||||
operateType: '2', // 0:'系数校验','1'为预检测、‘2‘为正式检测、'8'为不合格项复检
|
||||
userId:userStore.userInfo.id
|
||||
userId:userStore.userInfo.id,
|
||||
temperature:checkStore.temperature,
|
||||
humidity:checkStore.humidity
|
||||
})
|
||||
Object.assign(webMsgSend.value, {
|
||||
requestId: 'Resume_Success'
|
||||
@@ -374,7 +382,9 @@ const sendReCheck = () => {
|
||||
devIds: checkStore.devices.map((item) => item.deviceId),
|
||||
planId: checkStore.plan.id,
|
||||
operateType: '2', // 0:'系数校验','1'为预检测、‘2‘为正式检测、'8'为不合格项复检
|
||||
userId:userStore.userInfo.id
|
||||
userId:userStore.userInfo.id,
|
||||
temperature:checkStore.temperature,
|
||||
humidity:checkStore.humidity
|
||||
}).then(res => {
|
||||
console.log(res)
|
||||
if (res.code === 'A001014') {
|
||||
|
||||
95
frontend/src/views/home/components/writeTHPopup.vue
Normal file
95
frontend/src/views/home/components/writeTHPopup.vue
Normal file
@@ -0,0 +1,95 @@
|
||||
<template>
|
||||
<el-dialog title="填写环境条件" v-model='dialogVisible' @close="handleClose" v-bind="dialogSmall" >
|
||||
<div>
|
||||
<el-form ref="dialogFormRef" :model="formContent" :rules='rules'>
|
||||
<el-form-item label="温度(℃)" prop="temperature">
|
||||
<el-input v-model="formContent.temperature" placeholder="请输入温度"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="相对湿度(%)" prop="humidity">
|
||||
<el-input v-model="formContent.humidity" placeholder="请输入湿度"/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="handleClose">取消</el-button>
|
||||
<el-button type="primary" @click="handleStart">确定</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang='tsx' name='selectTestItemPopup'>
|
||||
import {dialogSmall} from "@/utils/elementBind";
|
||||
import {reactive, Ref, ref} from "vue";
|
||||
import type {Device} from "@/api/device/interface/device.ts";
|
||||
import {ElMessageBox, FormItemRule} from "element-plus";
|
||||
import {useCheckStore} from "@/stores/modules/check";
|
||||
|
||||
const emit = defineEmits(['openTestDialog2'])
|
||||
const dialogFormRef = ref()
|
||||
|
||||
|
||||
const dialogVisible = ref(false)
|
||||
const formContent = reactive<Device.ResTH>({temperature:0,humidity:0})
|
||||
const checkStore = useCheckStore();
|
||||
const open = async () => {
|
||||
resetFormContent()
|
||||
dialogVisible.value = true
|
||||
}
|
||||
|
||||
// 清空表单内容
|
||||
const resetFormContent = () => {
|
||||
Object.assign(formContent,{temperature:'',humidity:''})
|
||||
}
|
||||
|
||||
|
||||
//定义校验规则
|
||||
const rules: Ref<Record<string, Array<FormItemRule>>> = ref({
|
||||
temperature: [{ required: true, message: '温度必填!', trigger: 'blur' },
|
||||
// 指定正则,此处是数字正则
|
||||
{ pattern: /^(?:(?:-50)|-?[1-4][0-9]|-?[0-9]|[1-4][0-9]|50)(\.[0-9]+)?$/,
|
||||
message: '温度必须为 -50 到 50 之间的合法数字',
|
||||
trigger: 'blur'
|
||||
}],
|
||||
humidity: [{ required: true, message: '湿度必填!', trigger: 'blur' },
|
||||
{ pattern: /^(?:100(?:\.0+)?|\d{1,2}(?:\.\d+)?|0?\.\d+)$/ , message: '湿度必须为 0 到 100 之间的合法数字', trigger: 'blur' },
|
||||
],
|
||||
|
||||
})
|
||||
|
||||
|
||||
const handleStart = () => {
|
||||
try {
|
||||
dialogFormRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
|
||||
checkStore.setTemperature(formContent.temperature)
|
||||
checkStore.setHumidity(formContent.humidity)
|
||||
emit('openTestDialog2')
|
||||
handleClose()
|
||||
}
|
||||
})
|
||||
} catch (err) {
|
||||
console.error('验证过程中出现错误', err)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 关闭弹窗
|
||||
const handleClose = () => {
|
||||
dialogVisible.value = false
|
||||
// 清空dialogForm中的值
|
||||
resetFormContent()
|
||||
dialogFormRef.value?.resetFields()
|
||||
}
|
||||
|
||||
defineExpose({open})
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
</style>
|
||||
Reference in New Issue
Block a user