2025-02-25 10:17:33 +08:00
|
|
|
<template>
|
|
|
|
|
<el-dialog title="选择测试内容" v-model='dialogVisible' @close="handleClose" v-bind="dialogSmall">
|
|
|
|
|
<div>
|
|
|
|
|
<el-form ref="dialogFormRef" :model="formContent">
|
|
|
|
|
<el-form-item prop="preTest" :label-width="50">
|
|
|
|
|
<el-checkbox v-model="formContent.preTest" label="预检测"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item v-if="checkStore.plan.timeCheck===1" prop="timeTest" :label-width="50">
|
|
|
|
|
<el-checkbox v-model="formContent.timeTest" label="守时检测"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item prop="channelsTest" :label-width="50">
|
|
|
|
|
<el-checkbox v-model="formContent.channelsTest" label="系数校准"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item prop="test" :label-width="50">
|
|
|
|
|
<el-checkbox v-model="formContent.test" label="正式检测"/>
|
|
|
|
|
</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 {ref} from "vue";
|
|
|
|
|
import {useCheckStore} from "@/stores/modules/check";
|
|
|
|
|
import type {CheckData} from "@/api/check/interface";
|
|
|
|
|
|
|
|
|
|
const emit = defineEmits(['openTestDialog'])
|
|
|
|
|
const checkStore = useCheckStore();
|
|
|
|
|
|
|
|
|
|
const dialogFormRef = ref()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const dialogVisible = ref(false)
|
|
|
|
|
const formContent = reactive<CheckData.SelectTestItem>({preTest: true, timeTest: false, channelsTest: false, test: false})
|
|
|
|
|
|
|
|
|
|
const open = async () => {
|
|
|
|
|
resetFormContent()
|
|
|
|
|
checkStore.setSelectTestItems(formContent)
|
|
|
|
|
dialogVisible.value = true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 清空表单内容
|
|
|
|
|
const resetFormContent = () => {
|
|
|
|
|
Object.assign(formContent, {preTest: true, channelsTest: false, timeTest: false, test: false})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const handleStart = () => {
|
|
|
|
|
let count = 0
|
|
|
|
|
for (let key in formContent) {
|
|
|
|
|
if (formContent[key]) {
|
|
|
|
|
count++
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (count === 0) {
|
|
|
|
|
ElMessage.warning('请选择测试内容!')
|
|
|
|
|
} else {
|
2025-02-25 11:00:04 +08:00
|
|
|
checkStore.setCheckType(0)
|
2025-02-25 10:17:33 +08:00
|
|
|
checkStore.setSelectTestItems({...formContent})
|
|
|
|
|
handleClose()
|
|
|
|
|
emit('openTestDialog')
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 关闭弹窗
|
|
|
|
|
const handleClose = () => {
|
|
|
|
|
dialogVisible.value = false
|
|
|
|
|
// 清空dialogForm中的值
|
|
|
|
|
resetFormContent()
|
|
|
|
|
dialogFormRef.value?.resetFields()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
defineExpose({open})
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
|
|
|
|
|
|
</style>
|