add the view for display auto start chat record

This commit is contained in:
geekgeekrun
2024-03-31 12:51:44 +08:00
parent e24353aa06
commit 387bb60157
6 changed files with 103 additions and 9 deletions

View File

@@ -6,6 +6,7 @@ const { ViewEntity, ViewColumn } = requireTypeorm();
user_info.name as userName,
chat_startup_log.date,
boss_info.name AS bossName,
boss_info.title AS bossTitle,
company_info.name AS companyName
FROM
chat_startup_log
@@ -58,6 +59,9 @@ export class VChatStartupLog {
@ViewColumn()
bossName: string;
@ViewColumn()
bossTitle: string;
@ViewColumn()
companyName: string;
}

View File

@@ -261,6 +261,6 @@ export default function initIpc () {
ipcMain.handle('get-auto-start-chat-record', async () => {
const a = await getAutoStartChatRecord()
console.log(a)
return a
})
}

View File

@@ -52,10 +52,4 @@ onMounted(async () => {
}
})
})
electron.ipcRenderer.invoke('get-auto-start-chat-record').then(() => {
debugger
}, () => {
debugger
})
</script>

View File

@@ -0,0 +1,77 @@
<template>
<div class="page-wrap flex flex-col of-hidden">
<div class="flex-0"><el-button @click="getAutoStartChatRecord" :loading="isTableLoading">刷新</el-button></div>
<div class="flex-1 of-hidden" v-loading="isTableLoading">
<div ref="tableContainerEl" class="h-100% of-hidden">
<ElTable :data="tableData" :max-height="tableMaxHeight">
<ElTableColumn prop="companyName" label="公司" />
<ElTableColumn prop="jobName" label="职位名称" />
<ElTableColumn prop="positionName" label="职位分类" />
<ElTableColumn
prop="date"
label="开聊时间"
:formatter="(_row, _col, val) => dayjs(val).format('YYYY-MM-DD HH:mm:ss')"
/>
<ElTableColumn prop="experienceName" label="工作经验" />
<ElTableColumn
label="薪资"
:formatter="(row, _col, _val) => `${row.salaryLow}-${row.salaryHeight}k`"
/>
<ElTableColumn prop="bossName" label="BOSS" />
<ElTableColumn prop="bossTitle" label="BOSS身份" />
</ElTable>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted, onUnmounted, onBeforeUnmount } from 'vue'
import { ElTable, ElTableColumn, ElButton } from 'element-plus'
import { useRouter } from 'vue-router'
import { type VChatStartupLog } from '@geekgeekrun/sqlite-plugin/src/entity/VChatStartupLog'
import dayjs from 'dayjs'
const router = useRouter()
const tableData = ref<VChatStartupLog[]>([])
const isTableLoading = ref(false)
async function getAutoStartChatRecord() {
try {
isTableLoading.value = true
const res = (await electron.ipcRenderer.invoke('get-auto-start-chat-record')) as {
data: VChatStartupLog[]
}
tableData.value = res.data
} catch (err) {
console.log(err)
tableData.value = []
} finally {
isTableLoading.value = false
}
}
getAutoStartChatRecord()
const tableMaxHeight = ref<number | undefined>(undefined)
const tableContainerEl = ref<HTMLElement>()
const setTableMaxHeight = () =>
(tableMaxHeight.value = tableContainerEl.value?.clientHeight ?? undefined)
onMounted(() => {
setTableMaxHeight()
const ro = new ResizeObserver(() => setTableMaxHeight())
ro.observe(tableContainerEl.value!)
onBeforeUnmount(() => {
ro.disconnect()
})
})
</script>
<style scoped lang="scss">
.page-wrap {
margin: 0 auto;
max-width: 1000px;
max-height: 100vh;
overflow: hidden;
}
</style>

View File

@@ -1,4 +1,16 @@
<template><RouterView /></template>
<template>
<div class="flex h100vh">
<div class="flex flex-col w160px pt50px pl30px bg-#e8fffb">
<RouterLink to="./GeekAutoStartChatWithBoss">Boss炸弹</RouterLink>
<RouterLink to="./StartChatRecord">开聊记录</RouterLink>
</div>
<RouterView #default="{ Component }" class="flex-1">
<KeepAlive>
<component :is="Component" />
</KeepAlive>
</RouterView>
</div>
</template>
<script lang="ts" setup>
import { onMounted, onUnmounted } from 'vue'

View File

@@ -18,7 +18,14 @@ const routes: Array<RouteRecordRaw> = [
path: 'GeekAutoStartChatWithBoss',
component: () => import('@renderer/page/Configuration/GeekAutoStartChatWithBoss.vue'),
meta: {
title: '"BOSS炸弹" 设置'
title: 'BOSS炸弹'
}
},
{
path: 'StartChatRecord',
component: () => import('@renderer/page/Configuration/StartChatRecord.vue'),
meta: {
title: '开聊记录'
}
}
]