add the pivot select radio for diff table

This commit is contained in:
geekgeekrun
2024-10-08 18:58:31 +08:00
parent 34a530fc3b
commit 52c0e53a7e
2 changed files with 25 additions and 4 deletions

View File

@@ -9,7 +9,10 @@
:label="item.label"
>
<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 #default="{ row }">
<div class="of-auto">
@@ -22,7 +25,7 @@
</template>
<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 { JobInfoChangeLog } from '@geekgeekrun/sqlite-plugin/src/entity/JobInfoChangeLog'
import { ElTable, ElTableColumn } from 'element-plus'
@@ -75,6 +78,18 @@ const dataForRender = computed(() => {
})
return newArr
})
const diffPivot = ref(0)
watch(
() => props.jobInfoHistoryList,
() => {
if (!props.jobInfoHistoryList.length) {
diffPivot.value = 0
return
}
diffPivot.value = props.jobInfoHistoryList.length - 1
}
)
</script>
<style lang="scss" scoped>
@@ -83,5 +98,11 @@ const dataForRender = computed(() => {
color: #999;
}
}
.diff-table-header {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
</style>
<style lang="scss"></style>

View File

@@ -187,7 +187,7 @@ async function handleViewJobHistoryButtonClick(record: VChatStartupLog) {
// return {}
// }
// })(),
// __ggr_updateTime: new Date(it.updateTime)
// __ggr_updateTime: it.updateTime
// }))
const { data: historyList } = await Promise.resolve({
data: [
@@ -221,7 +221,7 @@ async function handleViewJobHistoryButtonClick(record: VChatStartupLog) {
return {}
}
})(),
__ggr_updateTime: new Date(it.updateTime)
__ggr_updateTime: it.updateTime
}))
})
historyDialogVisibleModelValue.value = true