手动检测功能修改、一键检测功能修改(均未完成)
This commit is contained in:
@@ -2,16 +2,16 @@
|
||||
<div class='table_info'>
|
||||
<!-- :request-api="getTableList" -->
|
||||
<ProTable
|
||||
ref='proTable'
|
||||
:columns='columns'
|
||||
@drag-sort='sortTable'
|
||||
:default-sort="{ prop: 'check_State', order: 'ascending' }"
|
||||
:stripe='true'
|
||||
:pagination='false'
|
||||
:key='tableKey'
|
||||
@selection-change='handleSelectionChange'
|
||||
:request-api='getTableList'
|
||||
:toolButton='false'
|
||||
ref='proTable'
|
||||
:columns='columns'
|
||||
@drag-sort='sortTable'
|
||||
:default-sort="{ prop: 'check_State', order: 'ascending' }"
|
||||
:stripe='true'
|
||||
:pagination='false'
|
||||
:key='tableKey'
|
||||
@selection-change='handleSelectionChange'
|
||||
:request-api='getTableList'
|
||||
:toolButton='false'
|
||||
>
|
||||
<!-- :height="tableHeight" -->
|
||||
<!-- 表格 header 按钮 -->
|
||||
@@ -23,35 +23,35 @@
|
||||
<el-form-item label='检测状态' v-if='form.activeTabs != 3 && form.activeTabs != 4 && form.activeTabs != 5'>
|
||||
<el-select v-model='form.checkStatus' clearable>
|
||||
<el-option
|
||||
v-for='(item, index) in checkStatus'
|
||||
:label='item.label'
|
||||
:value='item.id'
|
||||
:key='index'
|
||||
v-show='shouldShowOption(item)'
|
||||
v-for='(item, index) in checkStatus'
|
||||
:label='item.label'
|
||||
:value='item.id'
|
||||
:key='index'
|
||||
v-show='shouldShowOption(item)'
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label='检测结果'>
|
||||
<el-select v-model='form.checkResult' clearable>
|
||||
<el-option
|
||||
v-for='(item, index) in checkResult'
|
||||
:label='item.label'
|
||||
:value='item.id'
|
||||
v-for='(item, index) in checkResult'
|
||||
:label='item.label'
|
||||
:value='item.id'
|
||||
|
||||
:key='index'
|
||||
v-show='shouldShowOption(item)'
|
||||
:key='index'
|
||||
v-show='shouldShowOption(item)'
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label='报告状态'>
|
||||
<el-select v-model='form.checkReportStatus' clearable>
|
||||
<el-option
|
||||
v-for='(item, index) in checkReportStatus'
|
||||
:label='item.label'
|
||||
:value='item.id'
|
||||
v-for='(item, index) in checkReportStatus'
|
||||
:label='item.label'
|
||||
:value='item.id'
|
||||
|
||||
:key='index'
|
||||
v-show='shouldShowOption(item)'
|
||||
:key='index'
|
||||
v-show='shouldShowOption(item)'
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
@@ -61,36 +61,29 @@
|
||||
</el-button
|
||||
>
|
||||
<el-button :icon="Delete" @click="handleRefresh"
|
||||
>重置</el-button
|
||||
>重置
|
||||
</el-button
|
||||
>
|
||||
<!-- :disabled='!scope.isSelected' -->
|
||||
<el-button
|
||||
type='primary'
|
||||
:icon='Clock'
|
||||
@click="handleTest('手动检测')"
|
||||
v-if='form.activeTabs === 0'
|
||||
type='primary'
|
||||
:icon='Clock'
|
||||
@click="handleTest('手动检测')"
|
||||
v-if='form.activeTabs === 0'
|
||||
>手动检测
|
||||
</el-button
|
||||
>
|
||||
|
||||
<!-- :disabled='!scope.isSelected' -->
|
||||
<el-button
|
||||
type='primary'
|
||||
:icon='ChatLineRound'
|
||||
@click="handleTest('自动检测')"
|
||||
v-if='form.activeTabs === 0'
|
||||
>自动检测
|
||||
</el-button
|
||||
>
|
||||
<el-button type='primary' :icon='ChatLineSquare' @click="handleTest('不合格项复检')"
|
||||
v-if='form.activeTabs === 2'
|
||||
>不合格项复检
|
||||
</el-button
|
||||
>
|
||||
<el-button type='primary' :icon='ChatDotSquare' @click="handleTest('全部复检')" v-if='form.activeTabs === 2'
|
||||
>全部复检
|
||||
</el-button
|
||||
>
|
||||
type='primary'
|
||||
:icon='ChatLineRound'
|
||||
@click="handleTest('一键检测')"
|
||||
v-if='form.activeTabs === 0'
|
||||
>一键检测
|
||||
</el-button>
|
||||
<!-- <el-button type='primary' :icon='ChatLineSquare' @click="handleTest('不合格项复检')" v-if='form.activeTabs === 2'>不合格项复检</el-button>-->
|
||||
<!-- <el-button type='primary' :icon='ChatDotSquare' @click="handleTest('全部复检')" v-if='form.activeTabs === 2'>全部复检</el-button>-->
|
||||
|
||||
<!-- :disabled='!scope.isSelected' -->
|
||||
<!-- <el-button type="primary" :icon="Download" @click="handleTest('批量下载')" v-if="form.activeTabs === 3"
|
||||
@@ -102,9 +95,7 @@
|
||||
> -->
|
||||
|
||||
<!-- :disabled="!scope.isSelected || scope.selectedList.filter((item) => item.check_State === '检测完成').length === 0" -->
|
||||
<el-button type='primary' :icon='Notebook' @click="handleTest('批量归档')" v-if='form.activeTabs === 4'
|
||||
>归档
|
||||
</el-button>
|
||||
<el-button type='primary' :icon='Notebook' @click="handleTest('批量归档')" v-if='form.activeTabs === 4'>归档</el-button>
|
||||
<!-- <el-button type="primary" :icon="CirclePlus" @click="addDevice('设备新增')" v-if="form.activeTabs === 0"
|
||||
>设备新增</el-button> -->
|
||||
|
||||
@@ -118,11 +109,11 @@
|
||||
<!-- 表格操作 -->
|
||||
<template #operation='scope'>
|
||||
<el-button
|
||||
type='primary'
|
||||
link
|
||||
:icon='View'
|
||||
@click="openDrawer('查看', scope.row)"
|
||||
v-if='form.activeTabs === 3 && form.activeChildTabs === 1'
|
||||
type='primary'
|
||||
link
|
||||
:icon='View'
|
||||
@click="openDrawer('查看', scope.row)"
|
||||
v-if='form.activeTabs === 3 && form.activeChildTabs === 1'
|
||||
>查看
|
||||
</el-button>
|
||||
|
||||
@@ -142,21 +133,21 @@
|
||||
</el-dropdown>
|
||||
</div> -->
|
||||
|
||||
<el-button
|
||||
type='primary'
|
||||
link
|
||||
:icon='Download'
|
||||
@click="openDrawer('报告下载', scope.row)"
|
||||
v-if='form.activeTabs === 3 && form.activeChildTabs === 0 && scope.row.reportState === 1'
|
||||
<el-button
|
||||
type='primary'
|
||||
link
|
||||
:icon='Download'
|
||||
@click="openDrawer('报告下载', scope.row)"
|
||||
v-if='form.activeTabs === 3 && form.activeChildTabs === 0 && scope.row.reportState === 1'
|
||||
>报告下载
|
||||
</el-button>
|
||||
</el-button>
|
||||
|
||||
<el-button
|
||||
type='primary'
|
||||
link
|
||||
:icon='Postcard'
|
||||
@click="openDrawer('报告生成', scope.row)"
|
||||
v-if='form.activeTabs === 3 '
|
||||
type='primary'
|
||||
link
|
||||
:icon='Postcard'
|
||||
@click="openDrawer('报告生成', scope.row)"
|
||||
v-if='form.activeTabs === 3 '
|
||||
>报告生成
|
||||
</el-button>
|
||||
<!-- <el-button
|
||||
@@ -177,20 +168,20 @@
|
||||
</el-button>
|
||||
|
||||
<el-button
|
||||
type='primary'
|
||||
link
|
||||
:icon='PieChart'
|
||||
@click="openDrawer('检测数据查询', scope.row)"
|
||||
v-if='form.activeTabs === 5'
|
||||
type='primary'
|
||||
link
|
||||
:icon='PieChart'
|
||||
@click="openDrawer('检测数据查询', scope.row)"
|
||||
v-if='form.activeTabs === 5'
|
||||
>检测数据查询
|
||||
</el-button>
|
||||
|
||||
<el-button
|
||||
type='primary'
|
||||
link
|
||||
:icon='Switch'
|
||||
@click="openDrawer('误差体系更换', scope.row)"
|
||||
v-if='form.activeTabs === 5'
|
||||
type='primary'
|
||||
link
|
||||
:icon='Switch'
|
||||
@click="openDrawer('误差体系更换', scope.row)"
|
||||
v-if='form.activeTabs === 5'
|
||||
>误差体系更换
|
||||
</el-button>
|
||||
|
||||
@@ -225,37 +216,39 @@
|
||||
:dialogTitle="dialogTitle"
|
||||
@update:visible="dialogFormVisible = $event"
|
||||
/> -->
|
||||
<TestPopup ref='testPopup' @quitClicked='handleQuitClicked' ></TestPopup>
|
||||
<TestPopup ref='testPopup' @quitClicked='handleQuitClicked'></TestPopup>
|
||||
|
||||
<reportPopup
|
||||
:visible='reportDialogVisible'
|
||||
@update:visible='reportDialogVisible = $event'
|
||||
:visible='reportDialogVisible'
|
||||
@update:visible='reportDialogVisible = $event'
|
||||
></reportPopup>
|
||||
|
||||
<dataCheckPopup ref='dataCheckPopupRef' />
|
||||
<dataCheckPopup ref='dataCheckPopupRef'/>
|
||||
|
||||
<dataCheckChangeErrSysPopup
|
||||
:visible='dataCheckChangeErrSysDialogVisible'
|
||||
@update:visible='dataCheckChangeErrSysDialogVisible = $event'
|
||||
:visible='dataCheckChangeErrSysDialogVisible'
|
||||
@update:visible='dataCheckChangeErrSysDialogVisible = $event'
|
||||
></dataCheckChangeErrSysPopup>
|
||||
|
||||
<matchPopup
|
||||
:visible='matchDialogVisible'
|
||||
@update:visible='matchDialogVisible = $event'
|
||||
:visible='matchDialogVisible'
|
||||
@update:visible='matchDialogVisible = $event'
|
||||
></matchPopup>
|
||||
|
||||
<!--系数校准-->
|
||||
<ChannelsTest ref='channelsTest' :webMsgSend='webMsgSend' @quitClicked='handleQuitClicked' @submitClicked = 'handleSubmitClicked'></ChannelsTest>
|
||||
<ChannelsTest ref='channelsTest' :webMsgSend='webMsgSend' @quitClicked='handleQuitClicked' @submitClicked='handleSubmitClicked'></ChannelsTest>
|
||||
<!-- 手动检测-勾选检测项弹窗 -->
|
||||
<SelectTestItemPopup ref="selectTestItemPopupRef" @openTestDialog="openTestDialog"></SelectTestItemPopup>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang='tsx' name='useProTable'>
|
||||
import { useRouter } from 'vue-router'
|
||||
import type { Device } from '@/api/device/interface/device'
|
||||
import { useHandleData } from '@/hooks/useHandleData'
|
||||
import { ElMessage, ElMessageBox, ElLoading, Action } from 'element-plus'
|
||||
import {useRouter} from 'vue-router'
|
||||
import type {Device} from '@/api/device/interface/device'
|
||||
import {useHandleData} from '@/hooks/useHandleData'
|
||||
import {ElMessage, ElMessageBox, ElLoading, Action} from 'element-plus'
|
||||
import ProTable from '@/components/ProTable/index.vue'
|
||||
import { type ProTableInstance, type ColumnProps } from '@/components/ProTable/interface'
|
||||
import {type ProTableInstance, type ColumnProps} from '@/components/ProTable/interface'
|
||||
import {
|
||||
Search,
|
||||
View,
|
||||
@@ -273,27 +266,28 @@ import {
|
||||
CirclePlus,
|
||||
Odometer,
|
||||
} from '@element-plus/icons-vue'
|
||||
import { getPlanList } from '@/api/plan/planList'
|
||||
import {getPlanList} from '@/api/plan/planList'
|
||||
import deviceDataList from '@/api/device/device/deviceData'
|
||||
import TestPopup from './testPopup.vue'
|
||||
import reportPopup from './reportPopup.vue'
|
||||
import dataCheckPopup from './dataCheckSingleChannelSingleTestPopup.vue'
|
||||
import dataCheckChangeErrSysPopup from './dataCheckChangeErrSysPopup.vue'
|
||||
import { generateDevReport, getBoundPqDevList } from '@/api/plan/plan.ts'
|
||||
import { onBeforeMount, onMounted, reactive, ref, watch } from 'vue'
|
||||
import { useDictStore } from '@/stores/modules/dict'
|
||||
import {generateDevReport, getBoundPqDevList} from '@/api/plan/plan.ts'
|
||||
import {onBeforeMount, onMounted, reactive, ref, watch} from 'vue'
|
||||
import {useDictStore} from '@/stores/modules/dict'
|
||||
import ChannelsTest from './channelsTest.vue'
|
||||
import { useModeStore } from '@/stores/modules/mode' // 引入模式 store
|
||||
import { useCheckStore } from '@/stores/modules/check'
|
||||
import { CheckData } from '@/api/check/interface'
|
||||
import {useModeStore} from '@/stores/modules/mode' // 引入模式 store
|
||||
import {useCheckStore} from '@/stores/modules/check'
|
||||
import {CheckData} from '@/api/check/interface'
|
||||
import socketClient from '@/utils/webSocketClient'
|
||||
import auth from '@/directives/modules/auth'
|
||||
import { useAuthStore } from '@/stores/modules/auth'
|
||||
import { useDownload } from '@/hooks/useDownload'
|
||||
import { downloadDevData } from '@/api/plan/plan.ts'
|
||||
import { documentedPqDev } from '@/api/device/device'
|
||||
import { getPqDev } from '@/api/device/device/index.ts'
|
||||
import { ResultEnum } from '@/enums/httpEnum'
|
||||
import {useAuthStore} from '@/stores/modules/auth'
|
||||
import {useDownload} from '@/hooks/useDownload'
|
||||
import {downloadDevData} from '@/api/plan/plan.ts'
|
||||
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";
|
||||
|
||||
const dictStore = useDictStore()
|
||||
const checkStore = useCheckStore()
|
||||
@@ -309,6 +303,7 @@ const tableHeight = ref(0)
|
||||
const reportDialogVisible = ref(false)
|
||||
|
||||
const dataCheckPopupRef = ref<InstanceType<typeof dataCheckPopup>>()
|
||||
const selectTestItemPopupRef = ref<InstanceType<typeof SelectTestItemPopup>>()
|
||||
|
||||
const dataCheckChangeErrSysDialogVisible = ref(false)
|
||||
const matchDialogVisible = ref(false)
|
||||
@@ -337,8 +332,8 @@ const shouldShowOption = (item) => {
|
||||
|
||||
//开始创建webSocket客户端
|
||||
const dataSocket = reactive({
|
||||
socketServe: socketClient.Instance,
|
||||
});
|
||||
socketServe: socketClient.Instance,
|
||||
});
|
||||
|
||||
tableHeight.value = window.innerHeight - 600
|
||||
const deviceData = ref<Device.ResPqDev[]>([])
|
||||
@@ -513,7 +508,7 @@ const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
|
||||
return true
|
||||
},
|
||||
},
|
||||
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
|
||||
{type: 'index', fixed: 'left', width: 70, label: '序号'},
|
||||
{
|
||||
prop: 'name',
|
||||
label: '设备名称',
|
||||
@@ -556,7 +551,7 @@ const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
|
||||
isShow: checkStateShow,
|
||||
render: scope => {
|
||||
return (
|
||||
scope.row.checkState === 0 ? '未检' : scope.row.checkState === 1 ? '检测中' : '检测完成'
|
||||
scope.row.checkState === 0 ? '未检' : scope.row.checkState === 1 ? '检测中' : '检测完成'
|
||||
)
|
||||
},
|
||||
},
|
||||
@@ -609,12 +604,12 @@ const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
|
||||
return ''
|
||||
},
|
||||
},
|
||||
{ prop: 'operation', label: '操作', fixed: 'right', minWidth: 200, isShow: operationShow },
|
||||
{prop: 'operation', label: '操作', fixed: 'right', minWidth: 200, isShow: operationShow},
|
||||
])
|
||||
// 跳转详情页
|
||||
const toDetail = () => {
|
||||
router.push(
|
||||
`/proTable/useProTable/detail/${Math.random().toFixed(3)}?params=detail-page`,
|
||||
`/proTable/useProTable/detail/${Math.random().toFixed(3)}?params=detail-page`,
|
||||
)
|
||||
}
|
||||
//重置查询条件
|
||||
@@ -635,7 +630,7 @@ const handleSelectionChange = (selection: any[]) => {
|
||||
channelsSelection.value = selection
|
||||
devNum = selection.length
|
||||
devChannelsNum = 0
|
||||
|
||||
|
||||
for (let i = 0; i < selection.length; i++) {
|
||||
devChannelsNum += selection[i].devChns
|
||||
}
|
||||
@@ -651,8 +646,11 @@ const handleSelectionChange = (selection: any[]) => {
|
||||
return {
|
||||
deviceId: item.id,
|
||||
deviceName: item.name,
|
||||
deviceType: item.devType,
|
||||
chnNum: item.devChns,
|
||||
planId: item.planId,
|
||||
deviceType: item.devType,
|
||||
devVolt: item.devVolt,
|
||||
devCurr: item.devCurr,
|
||||
}
|
||||
})
|
||||
|
||||
@@ -845,17 +843,18 @@ const addDevice = (val: string) => {
|
||||
path: '/machine/device',
|
||||
})
|
||||
}
|
||||
|
||||
const handleTest = async (val: string) => {
|
||||
|
||||
if (devNum == 0) {
|
||||
ElMessageBox.confirm(
|
||||
'请先选择被检设备',
|
||||
'提示',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
},
|
||||
'请先选择被检设备',
|
||||
'提示',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
},
|
||||
)
|
||||
return
|
||||
}
|
||||
@@ -864,13 +863,13 @@ const handleTest = async (val: string) => {
|
||||
const isDevVoltConsistent = new Set(checkDevVolt).size === 1
|
||||
if (!isDevVoltConsistent) {
|
||||
ElMessageBox.confirm(
|
||||
'所勾选设备额定电压不一致,请重新选择',
|
||||
'提示',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
},
|
||||
'所勾选设备额定电压不一致,请重新选择',
|
||||
'提示',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
},
|
||||
)
|
||||
return
|
||||
}
|
||||
@@ -879,19 +878,19 @@ const handleTest = async (val: string) => {
|
||||
const isDevCurrConsistent = new Set(checkDevCurr).size === 1
|
||||
if (!isDevCurrConsistent) {
|
||||
ElMessageBox.confirm(
|
||||
'所勾选设备额定电流不一致,请重新选择',
|
||||
'提示',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
},
|
||||
'所勾选设备额定电流不一致,请重新选择',
|
||||
'提示',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
},
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
if (val === '手动检测' || val === '自动检测' || val === '不合格项复检' || val === '全部复检') {
|
||||
if (val === '手动检测' || val === '一键检测' || val === '系数校准') {
|
||||
// if (devNum > 6) {
|
||||
// ElMessageBox.confirm(
|
||||
// '每次检测最多只能选择6台设备,请重新选择',
|
||||
@@ -904,125 +903,115 @@ const handleTest = async (val: string) => {
|
||||
// )
|
||||
// return
|
||||
// }
|
||||
if (devChannelsNum > 12) {
|
||||
ElMessageBox.confirm(
|
||||
'每次检测最多只能检测12个设备通道,请重新选择',
|
||||
'提示',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
},
|
||||
)
|
||||
return
|
||||
}
|
||||
if (testType === 'reTest') {
|
||||
ElMessageBox.confirm(
|
||||
'请选择复检检测方式',
|
||||
'设备复检',
|
||||
{
|
||||
distinguishCancelAndClose: true,
|
||||
confirmButtonText: '不合格项复检',
|
||||
cancelButtonText: '全部复检',
|
||||
type: 'warning',
|
||||
},
|
||||
)
|
||||
.then(() => {
|
||||
ElMessage.success('不合格项复检')
|
||||
dialogTitle.value = val
|
||||
testPopup.value?.open(channelsSelection.value, dialogTitle.value, props.isTimeCheck)// 打开对话框
|
||||
})
|
||||
.catch((action: Action) => {
|
||||
ElMessage.success('全部复检')
|
||||
dialogTitle.value = val
|
||||
testPopup.value?.open(channelsSelection.value, dialogTitle.value, props.isTimeCheck) // 打开对话框
|
||||
})
|
||||
} else {
|
||||
dialogTitle.value = val
|
||||
testPopup.value?.open(channelsSelection.value, dialogTitle.value, props.isTimeCheck)
|
||||
}
|
||||
return
|
||||
|
||||
}
|
||||
|
||||
if (val === '系数校准') {
|
||||
// if (devTestedNum == 0) {
|
||||
// ElMessageBox.confirm('请先选择检测完成状态的被检设备', '提示',
|
||||
// {
|
||||
// confirmButtonText: '确定',
|
||||
// cancelButtonText: '取消',
|
||||
// type: 'warning',
|
||||
// })
|
||||
// return
|
||||
// }
|
||||
const checkStates = channelsSelection.value.map(item => item.checkState)
|
||||
const allCheckStatesEqual = new Set(checkStates).size <= 1
|
||||
|
||||
if (!allCheckStatesEqual) {
|
||||
ElMessageBox.confirm(
|
||||
'所勾选设备检测状态不一致,请重新选择',
|
||||
'提示',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
},
|
||||
'所勾选设备检测状态不一致,请重新选择',
|
||||
'提示',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
},
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
const factorFlagArray = ref<string[]>([]) // 初始化为空数组
|
||||
for (let i = 0; i < channelsSelection.value.length; i++) {
|
||||
const factorFlag = channelsSelection.value[i].factorFlag
|
||||
if (factorFlag !== undefined && factorFlag !== null && factorFlag === 0) {
|
||||
factorFlagArray.value.push(channelsSelection.value[i].name.toString())
|
||||
}
|
||||
}
|
||||
if (factorFlagArray.value.length > 0) {
|
||||
const factorFlags = factorFlagArray.value.join(', ')
|
||||
if (devChannelsNum > 12) {
|
||||
ElMessageBox.confirm(
|
||||
factorFlags + '设备不支持系数校准,请重新选择',
|
||||
'提示',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
},
|
||||
'每次检测最多只能检测12个设备通道,请重新选择',
|
||||
'提示',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
},
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
// // 检查 socketClient.Instance 是否存在
|
||||
// if (!socketClient.Instance) {
|
||||
// console.error('WebSocket 客户端实例不存在');
|
||||
// return;
|
||||
// }
|
||||
|
||||
|
||||
socketClient.Instance.connect();
|
||||
dataSocket.socketServe = socketClient.Instance;
|
||||
dataSocket.socketServe.registerCallBack('aaa', (res: { code: number; }) => {
|
||||
// 处理来自服务器的消息
|
||||
//console.log('Received message:', res)
|
||||
// 根据需要在这里添加更多的处理逻辑
|
||||
if (res.code === 20000) {
|
||||
ElMessage.error(message.message)
|
||||
loading.close()
|
||||
dialogTitle.value = val
|
||||
if (val === '手动检测') {
|
||||
if (testType === 'reTest') {
|
||||
ElMessageBox.confirm('请选择复检检测方式', '设备复检',
|
||||
{
|
||||
distinguishCancelAndClose: true,
|
||||
confirmButtonText: '不合格项复检',
|
||||
cancelButtonText: '全部复检',
|
||||
type: 'warning',
|
||||
})
|
||||
.then(() => {
|
||||
ElMessage.success('不合格项复检')
|
||||
selectTestItemPopupRef.value?.open()
|
||||
})
|
||||
.catch((action: Action) => {
|
||||
ElMessage.success('全部复检')
|
||||
selectTestItemPopupRef.value?.open()
|
||||
})
|
||||
} else {
|
||||
webMsgSend.value = res
|
||||
selectTestItemPopupRef.value?.open()
|
||||
}
|
||||
} else if (val === '系数校准') {
|
||||
const factorFlagArray = ref<string[]>([]) // 初始化为空数组
|
||||
for (let i = 0; i < channelsSelection.value.length; i++) {
|
||||
const factorFlag = channelsSelection.value[i].factorFlag
|
||||
if (factorFlag !== undefined && factorFlag !== null && factorFlag === 0) {
|
||||
factorFlagArray.value.push(channelsSelection.value[i].name.toString())
|
||||
}
|
||||
}
|
||||
if (factorFlagArray.value.length > 0) {
|
||||
const factorFlags = factorFlagArray.value.join(', ')
|
||||
ElMessageBox.confirm(
|
||||
factorFlags + '设备不支持系数校准,请重新选择',
|
||||
'提示',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
},
|
||||
)
|
||||
return
|
||||
}
|
||||
})
|
||||
|
||||
channelsTest.value?.open(channelsSelection.value, props.plan)
|
||||
return
|
||||
}
|
||||
// // 检查 socketClient.Instance 是否存在
|
||||
// if (!socketClient.Instance) {
|
||||
// console.error('WebSocket 客户端实例不存在');
|
||||
// return;
|
||||
// }
|
||||
|
||||
if (devTestedNum == 0) {
|
||||
ElMessageBox.confirm(
|
||||
'请先选择检测完成状态的被检设备',
|
||||
'提示',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
},
|
||||
)
|
||||
return
|
||||
socketClient.Instance.connect();
|
||||
dataSocket.socketServe = socketClient.Instance;
|
||||
dataSocket.socketServe.registerCallBack('aaa', (res: { code: number; }) => {
|
||||
// 处理来自服务器的消息
|
||||
//console.log('Received message:', res)
|
||||
// 根据需要在这里添加更多的处理逻辑
|
||||
if (res.code === 20000) {
|
||||
ElMessage.error(message.message)
|
||||
loading.close()
|
||||
} else {
|
||||
webMsgSend.value = res
|
||||
}
|
||||
})
|
||||
|
||||
channelsTest.value?.open(channelsSelection.value, props.plan)
|
||||
return
|
||||
} else {
|
||||
checkStore.initSelectTestItems()
|
||||
openTestDialog()
|
||||
}
|
||||
}
|
||||
if (val === '批量下载') {
|
||||
reportDialogVisible.value = true
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
@@ -1046,8 +1035,10 @@ const handleTest = async (val: string) => {
|
||||
|
||||
emit('batchGenerateClicked') // 触发事件
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const openTestDialog = () => {
|
||||
testPopup.value?.open(channelsSelection.value, dialogTitle.value)
|
||||
}
|
||||
|
||||
// 打开 drawer(新增、查看、编辑)
|
||||
@@ -1063,14 +1054,14 @@ const openDrawer = async (title: string, row: any) => {
|
||||
|
||||
|
||||
if (title === '报告生成') {
|
||||
await generateDevReport({ 'planId': checkStore.planId, 'devId': row.id })
|
||||
await generateDevReport({'planId': checkStore.plan.id, 'devId': row.id})
|
||||
emit('batchGenerateClicked') // 触发事件
|
||||
ElMessage.success({ message: `报告生成成功!` })
|
||||
ElMessage.success({message: `报告生成成功!`})
|
||||
}
|
||||
|
||||
if (title === '报告下载') {
|
||||
await useDownload(downloadDevData, row.createId, {
|
||||
planId: checkStore.planId,
|
||||
planId: checkStore.plan.id,
|
||||
devId: row.id,
|
||||
}, false, '.docx')
|
||||
emit('batchGenerateClicked') // 触发事件
|
||||
@@ -1116,12 +1107,12 @@ function formatDate(date: Date) {
|
||||
|
||||
// 监听 props.id 的变化
|
||||
watch(
|
||||
() => props.id,
|
||||
(newId) => {
|
||||
handleRefresh()
|
||||
// 调用获取数据的方法
|
||||
},
|
||||
{ immediate: true }, // 立即执行一次
|
||||
() => props.id,
|
||||
(newId) => {
|
||||
handleRefresh()
|
||||
// 调用获取数据的方法
|
||||
},
|
||||
{immediate: true}, // 立即执行一次
|
||||
)
|
||||
|
||||
onBeforeMount(async () => {
|
||||
@@ -1153,7 +1144,7 @@ const handleSubmitClicked = async (resolve: (value: boolean) => void) => {
|
||||
}
|
||||
};
|
||||
|
||||
defineExpose({ changeActiveTabs })
|
||||
defineExpose({changeActiveTabs})
|
||||
</script>
|
||||
<style lang='scss' scoped>
|
||||
/* 当屏幕宽度小于或等于1300像素时 */
|
||||
|
||||
Reference in New Issue
Block a user