add the pivot select radio for diff table

This commit is contained in:
geekgeekrun
2024-11-23 13:28:41 +08:00
parent 34a530fc3b
commit 52c0e53a7e
2 changed files with 25 additions and 4 deletions
@@ -9,7 +9,10 @@
:label="item.label" :label="item.label"
> >
<template #header> <template #header>
{{ dayjs(item.value).format('YYYY-MM-DD HH:mm:ss') }} <div class="diff-table-header">
{{ dayjs(item.value).format('YYYY-MM-DD HH:mm:ss') }}
<el-radio v-model="diffPivot" :label="index">作为diff基准</el-radio>
</div>
</template> </template>
<template #default="{ row }"> <template #default="{ row }">
<div class="of-auto"> <div class="of-auto">
@@ -22,7 +25,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { PropType, computed } from 'vue' import { PropType, computed, ref, watch } from 'vue'
import { type VChatStartupLog } from '@geekgeekrun/sqlite-plugin/src/entity/VChatStartupLog' import { type VChatStartupLog } from '@geekgeekrun/sqlite-plugin/src/entity/VChatStartupLog'
import { JobInfoChangeLog } from '@geekgeekrun/sqlite-plugin/src/entity/JobInfoChangeLog' import { JobInfoChangeLog } from '@geekgeekrun/sqlite-plugin/src/entity/JobInfoChangeLog'
import { ElTable, ElTableColumn } from 'element-plus' import { ElTable, ElTableColumn } from 'element-plus'
@@ -75,6 +78,18 @@ const dataForRender = computed(() => {
}) })
return newArr return newArr
}) })
const diffPivot = ref(0)
watch(
() => props.jobInfoHistoryList,
() => {
if (!props.jobInfoHistoryList.length) {
diffPivot.value = 0
return
}
diffPivot.value = props.jobInfoHistoryList.length - 1
}
)
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@@ -83,5 +98,11 @@ const dataForRender = computed(() => {
color: #999; color: #999;
} }
} }
.diff-table-header {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
</style> </style>
<style lang="scss"></style> <style lang="scss"></style>
@@ -187,7 +187,7 @@ async function handleViewJobHistoryButtonClick(record: VChatStartupLog) {
// return {} // return {}
// } // }
// })(), // })(),
// __ggr_updateTime: new Date(it.updateTime) // __ggr_updateTime: it.updateTime
// })) // }))
const { data: historyList } = await Promise.resolve({ const { data: historyList } = await Promise.resolve({
data: [ data: [
@@ -221,7 +221,7 @@ async function handleViewJobHistoryButtonClick(record: VChatStartupLog) {
return {} return {}
} }
})(), })(),
__ggr_updateTime: new Date(it.updateTime) __ggr_updateTime: it.updateTime
})) }))
}) })
historyDialogVisibleModelValue.value = true historyDialogVisibleModelValue.value = true