diff --git a/frontend/src/views/home/components/timeTest.vue b/frontend/src/views/home/components/timeTest.vue index ee763f5..4ed156e 100644 --- a/frontend/src/views/home/components/timeTest.vue +++ b/frontend/src/views/home/components/timeTest.vue @@ -33,7 +33,17 @@
- + + + +
@@ -77,25 +87,25 @@ const activities = ref([ const deviceOperatorData = ref([ { - deviceName: '被检设备1', + deviceName: '240001', updataTime: '—', ErrorValue:'—', Result: '—', }, { - deviceName: '被检设备2', + deviceName: '240002', updataTime: '—', ErrorValue:'—', Result: '—', }, { - deviceName: '被检设备3', + deviceName: '240003', updataTime: '—', ErrorValue:'—', Result: '—', }, { - deviceName: '被检设备4', + deviceName: '240004', updataTime: '—', ErrorValue:'—', Result: '—', @@ -104,26 +114,26 @@ const deviceOperatorData = ref([ const deviceData = ref([ { - deviceName: '被检设备1', - updataTime: '10:30:08.136', + deviceName: '240001', + updataTime: '2024-12-05 10:30:08.136', ErrorValue:'148', Result: '合格', }, { - deviceName: '被检设备2', - updataTime: '10:30:08.136', + deviceName: '240002', + updataTime: '2024-12-05 10:30:08.136', ErrorValue:'136', Result: '合格', }, { - deviceName: '被检设备3', - updataTime: '10:30:09.006', + deviceName: '240003', + updataTime: '2024-12-05 10:30:09.006', ErrorValue:'1006', Result: '不合格', }, { - deviceName: '被检设备4', - updataTime: '10:30:08.736', + deviceName: '240004', + updataTime: '2024-12-05 10:30:08.736', ErrorValue:'736', Result: '合格', }, @@ -138,6 +148,44 @@ const currentStepStatus = ref<'error' | 'finish' | 'wait' | 'success' | 'process }) const testStatus = toRef(props, 'testStatus'); const ts = ref(''); + +// 表格配置项 +const columns = reactive([ + { type: 'index', fixed: 'left', width: 70, label: '序号' }, + { + prop: 'deviceName', + label: '设备名称', + }, + { + prop: 'updataTime', + label: '上送时刻', + width: 230, + }, + { + prop: 'ErrorValue', + label: '守时误差', + width: 100, + }, + { + prop: 'Result', + label: '检测结果', + width: 100, + render: (scope) => { + if(scope.row.Result === '不合格') + { + return ( + { scope.row.Result } + ) + } + else + { + return ( + { scope.row.Result } + ) + } + }, + }, +]) //监听testStatus的变化 watch(testStatus, function (newValue, oldValue) { ts.value = props.testStatus; @@ -161,58 +209,77 @@ watch(testStatus, function (newValue, oldValue) { }, 1000); } }) + +function formatDateTime(date) { + const year = date.getFullYear(); + const month = String(date.getMonth() + 1).padStart(2, '0'); + const day = String(date.getDate()).padStart(2, '0'); + const hours = String(date.getHours()).padStart(2, '0'); + const minutes = String(date.getMinutes()).padStart(2, '0'); + const seconds = String(date.getSeconds()).padStart(2, '0'); + const milliseconds = String(date.getMilliseconds()).padStart(3, '0'); + + return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}.${milliseconds}`; +} + watch(activeIndex, function (newValue, oldValue) { if(activeIndex.value === 1) { - activities.value.length = 0; - activities.value.push({ - content: '开始检测', - timestamp: '2018-04-12 20:46', - size: 'large', - color: '#0bbd87', - icon: SuccessFilled, - }); + startTime.value = formatDateTime(new Date()); + + // activities.value.length = 0; + // activities.value.push({ + // content: '开始检测', + // timestamp: '2018-04-12 20:46', + // size: 'large', + // color: '#0bbd87', + // icon: SuccessFilled, + // }); } if(activeIndex.value === 2) { - activities.value.push({ - content: 'GPS上送时刻', - timestamp: '2018-04-03 20:46', - color: '#0bbd87', - icon: SuccessFilled, - size: 'large', - }); + gpsTime.value = formatDateTime(new Date()); + // activities.value.push({ + // content: 'GPS上送时刻', + // timestamp: '2018-04-03 20:46', + // color: '#0bbd87', + // icon: SuccessFilled, + // size: 'large', + // }); } if(activeIndex.value === 3) { - activities.value.push({ - content: '设备最早上送时刻', - timestamp: '2018-04-03 20:46', - color: '#0bbd87', - icon: SuccessFilled, - size: 'large', - }); - + // activities.value.push({ + // content: '设备最早上送时刻', + // timestamp: '2018-04-03 20:46', + // color: '#0bbd87', + // icon: SuccessFilled, + // size: 'large', + // }); + devStartTime.value = formatDateTime(new Date()); deviceOperatorData.value.length = 0; deviceOperatorData.value = deviceData.value; } if(activeIndex.value > 3) { - activities.value.push({ - content: '设备最晚上送时刻', - timestamp: '2018-04-03 20:46', - color: '#0bbd87', - icon: SuccessFilled, - size: 'large', - }); - activities.value.push({ - content: '检测结束', - timestamp: '2018-04-03 20:46', - color: '#0bbd87', - icon: SuccessFilled, - size: 'large', - }); + devEndTime.value = formatDateTime(new Date()); + finishTime.value = formatDateTime(new Date()); + + // activities.value.push({ + // content: '设备最晚上送时刻', + // timestamp: '2018-04-03 20:46', + // color: '#0bbd87', + // icon: SuccessFilled, + // size: 'large', + // }); + // activities.value.push({ + // content: '检测结束', + // timestamp: '2018-04-03 20:46', + // color: '#0bbd87', + // icon: SuccessFilled, + // size: 'large', + // }); } }) const emit = defineEmits(['update:testStatus']);