# Conflicts:
#	frontend/src/views/machine/testScript/components/testScriptPopup.vue
#	frontend/src/views/machine/testScript/index.vue
This commit is contained in:
GGJ
2025-02-17 16:46:20 +08:00
6 changed files with 134 additions and 70 deletions

View File

@@ -86,7 +86,7 @@ export const downloadDevData = (params: Device.ReqDevReportParams) => {
return http.download(`/report/downloadReport`, params)
}
export const staticsAnalyse = (params: { planId: string }) => {
return http.download(`/adPlan/analyse?planId=${params.planId}`)
export const staticsAnalyse = (params: { id: string[] }) => {
return http.download('/adPlan/analyse', params)
}

View File

@@ -27,64 +27,64 @@ export const staticRouter: RouteRecordRaw[] = [
name: "plan",
redirect: "/plan/planList",
children: [
{
path: "/plan/planList",
name: "planList",
component: () => import("@/views/plan/planList/index.vue"),
meta: {
title: "检测计划列表",
icon: "List",
isLink: "",
isHide: false,
isFull: false,
isAffix: false,
isKeepAlive: true,//缓存改成true
},
},
{
path: "/plan/singlePlanList",
name: "singlePlanList",
component: () => import("@/views/plan/singlePlanList/index.vue"),
meta: {
title: "单个计划列表",
icon: "List",
isLink: "",
isHide: false,
isFull: false,
isAffix: false,
isKeepAlive: true,
},
},
{
path: "/plan/preTest",
name: "preTest",
component: () => import("@/views/plan/preTest/index.vue"),
meta: {
title: "预检测",
icon: "List",
isLink: "",
isHide: false,
isFull: false,
isAffix: false,
isKeepAlive: false,
},
},
{
path: "/plan/autoTest",
name: "autoTest",
component: () => import("@/views/plan/autoTest/index.vue"),
meta: {
title: "自动检测",
icon: "List",
isLink: "",
hideTab:true,
parentPath:'/system/proTable',
isHide: false,
isFull: false,
isAffix: false,
isKeepAlive: true,
},
},
// {
// path: "/plan/planList",
// name: "planList",
// component: () => import("@/views/plan/planList/index.vue"),
// meta: {
// title: "检测计划列表",
// icon: "List",
// isLink: "",
// isHide: false,
// isFull: false,
// isAffix: false,
// isKeepAlive: true,//缓存改成true
// },
// },
// {
// path: "/plan/singlePlanList",
// name: "singlePlanList",
// component: () => import("@/views/plan/singlePlanList/index.vue"),
// meta: {
// title: "单个计划列表",
// icon: "List",
// isLink: "",
// isHide: false,
// isFull: false,
// isAffix: false,
// isKeepAlive: true,
// },
// },
// {
// path: "/plan/preTest",
// name: "preTest",
// component: () => import("@/views/plan/preTest/index.vue"),
// meta: {
// title: "预检测",
// icon: "List",
// isLink: "",
// isHide: false,
// isFull: false,
// isAffix: false,
// isKeepAlive: false,
// },
// },
// {
// path: "/plan/autoTest",
// name: "autoTest",
// component: () => import("@/views/plan/autoTest/index.vue"),
// meta: {
// title: "自动检测",
// icon: "List",
// isLink: "",
// hideTab:true,
// parentPath:'/system/proTable',
// isHide: false,
// isFull: false,
// isAffix: false,
// isKeepAlive: true,
// },
// },
{
path: "/machine/testScriptAdd",
name: "testScriptAdd",

View File

@@ -2,10 +2,17 @@
<div class="dialog" v-bind="dialogBig">
<div class="dialog-title">
<el-progress
style="width: 90%"
style="width: 65%"
:percentage="percentage"
:color="customColors"/>
<el-button type="primary" v-if="testStatus=='test_init'" disabled @click="handlePause()">
<el-icon class="loading-box" style="color: #fff;margin-right: 8px;">
<component :is="Refresh"/>
</el-icon>
初始化中
</el-button>
<el-button
type="primary"
v-if="testStatus=='process' && percentage < 100"
@@ -54,6 +61,7 @@
@click="emit('sendResume')"
>继续检测
</el-button>
<div type="text" :icon="Timer" disabled>检测用时{{ timeView }}</div>
<el-button type="text" :icon="InfoFilled" @click="showTestLog">检测项进度</el-button>
</div>
@@ -143,7 +151,7 @@
<dataCheckSingleChannelSingleTestPopup ref="dataCheckSingleChannelSingleTestPopupRef"/>
</template>
<script lang="tsx" setup name="test">
import {Check, Failed, InfoFilled, Loading, Refresh, RefreshLeft, VideoPause, VideoPlay} from '@element-plus/icons-vue'
import {Check, Failed, InfoFilled, Loading, Timer,Refresh, RefreshLeft, VideoPause, VideoPlay} from '@element-plus/icons-vue'
import resultPopup from './resultPopup.vue'
import dataCheckSingleChannelSingleTestPopup from './dataCheckSingleChannelSingleTestPopup.vue'
import {computed, reactive, ref, toRef, watch} from "vue";
@@ -152,7 +160,6 @@ import {CheckData} from "@/api/check/interface"
import {useCheckStore} from "@/stores/modules/check";
import {ElMessage, ElMessageBox} from "element-plus";
import {getBigTestItem} from "@/api/check/test";
import {tryHideFullScreenLoading} from "@/components/Loading/fullScreen";
const checkStore = useCheckStore()
@@ -187,6 +194,10 @@ const deviceList = reactive<CheckData.Device[]>([])
let activeIndex = 0
// 百分比
const percentage = ref(0);
// 时间计数器
let timer: any = null
const timeCount = ref(0)
const timeView = ref('00:00:00')
//测试项开始检测时间(或继续检测时间)
const startData = ref(new Date())
//测试项检测结束时间(或暂停时的时间)
@@ -303,6 +314,7 @@ const checkResultView: ComputedRef<CheckData.ScriptChnViewItem[]> = computed(()
watch(testStatus, function (newValue, oldValue) {
if (newValue == 'start') {
ElMessage.success('初始化开始!')
startTimeCount()
showTestLog()
@@ -855,6 +867,7 @@ const updateLog = (isStart: boolean) => {
type: 'info',
log: currentTime.value + ' :检测结束,总用时' + getTimeDifference(timeDifference.value),
})
stopTimeCount()
}
}
}
@@ -1222,6 +1235,7 @@ const pauseSuccessCallback = () => {
type: 'info',
log: `${new Date().toLocaleString()}:暂停检测`,
})
stopTimeCount()
console.log('暂停中')
};
@@ -1314,6 +1328,7 @@ const handleResumeTest = () => {
log: `${new Date().toLocaleString()}:继续检测`,
})
//startTimer()
resumeTimeCount()
console.log('开始继续检测')
};
@@ -1347,7 +1362,44 @@ const getNextActiveIndex = (code: string = ''): number => {
}
return -1
}
const startTimeCount = () => {
timer = setInterval(() => {
timeCount.value = timeCount.value + 1
timeView.value = secondToTime(timeCount.value)
}, 1000)
}
const stopTimeCount = () => {
if (timer) {
clearInterval(timer)
}
}
const resumeTimeCount = () => {
timer = setInterval(() => {
timeCount.value = timeCount.value + 1
timeView.value = secondToTime(timeCount.value)
}, 1000)
}
const secondToTime = (second: number) => {
//将秒数转换成时分秒
let h: string | number = Math.floor(second / 3600)
let m: string | number = Math.floor((second - h * 3600) / 60)
let s: string | number = Math.floor(second % 60);
h = h < 10 ? '0' + h : h;
m = m < 10 ? '0' + m : m;
s = s < 10 ? '0' + s : s;
return h + ':' + m + ':' + s;
}
onBeforeUnmount(() => {
if (timer) {
clearInterval(timer)
}
})
</script>
<style scoped lang="scss">

View File

@@ -69,6 +69,8 @@ const filterMethod = (query: string, item: { label?: string }) => {
dialogVisible.value = true
planData.value = data
console.log('123')
const pqDevList_Result1 = await getUnboundPqDevList(data);
unboundPqDevList.value = pqDevList_Result1.data as Device.ReqPqDevParams[];
@@ -76,9 +78,11 @@ const filterMethod = (query: string, item: { label?: string }) => {
boundPqDevList.value = pqDevList_Result2.data as Device.ReqPqDevParams[];
value.value = boundPqDevList.value.map((i: { id: { toString: () => any } }) => i.id.toString());
console.log('123',value.value)
}
const close = () => {
dialogVisible.value = false
}
const save = async () => {

View File

@@ -214,6 +214,7 @@ const rules: Ref<Record<string, Array<FormItemRule>>> = ref({
// 关闭弹窗
const close = () => {
value.value = []
dialogVisible.value = false
// 清空dialogForm中的值
resetFormContent()
@@ -279,6 +280,7 @@ const open = async (sign: string,
data: Plan.ReqPlan,
currentMode: string,) => {
value.value = []
//处理异步调用
const patternId = dictStore.getDictData('Pattern').find(item=>item.name=== currentMode)?.id ?? ''
data.pattern = patternId

View File

@@ -13,9 +13,11 @@
合并
</el-button>
<el-button type='primary' v-auth.plan="'add'" :icon='CirclePlus' @click="openDialog('add')">新增</el-button>
<el-button type='primary' v-auth.plan="'analysis'" :icon='List' @click='statisticalAnalysisMore(scope.selectedListIds)'>统计分析</el-button>
<el-button type='danger' v-auth.plan="'delete'" :icon='Delete' plain :disabled='!scope.isSelected' @click='batchDelete(scope.selectedListIds)'>
删除
</el-button>
</template>
<!-- 表格操作 -->
<template #operation='scope'>
@@ -394,8 +396,12 @@ const showDeviceOpen = (row: Partial<Plan.ReqPlan> = {}) => {
const myDict = new Map<string, any[]>();
const statisticalAnalysisMore = async (id: string[]) =>{
useDownload(staticsAnalyse,'分析结果', id, false,'.xlsx')
}
const statisticalAnalysis = async (row: Partial<Plan.ReqPlan> = {}) => {
useDownload(staticsAnalyse,row.name+'分析结果', {planId:row.id}, false,'.xlsx')
useDownload(staticsAnalyse,'分析结果', [row.id], false,'.xlsx')
// const response = await getTestConfig() as unknown as Base.ResTestConfig
// const maxTime= response.data.maxTime//检测最大次数