add the schema of MarkAsNotSuitLog, VMarkAsNotSuitLog schema

This commit is contained in:
geekgeekrun
2024-10-20 00:28:01 +08:00
parent 512fc94b1a
commit 7f0ae45758
9 changed files with 321 additions and 2 deletions

View File

@@ -0,0 +1,28 @@
import { requireTypeorm } from "../utils/module-loader";
import { ChatStartupFrom } from "./ChatStartupLog";
const { Entity, Column, PrimaryGeneratedColumn } = requireTypeorm()
@Entity()
export class MarkAsNotSuitLog {
@PrimaryGeneratedColumn()
id: number;
@Column()
encryptJobId: string;
@Column()
encryptCurrentUserId: string;
@Column()
date: Date;
@Column({
nullable: true
})
markFrom?: ChatStartupFrom;
@Column({
nullable: true
})
autoStartupChatRecordId?: number;
}

View File

@@ -0,0 +1,67 @@
import { requireTypeorm } from "../utils/module-loader";
const { ViewEntity, ViewColumn } = requireTypeorm();
@ViewEntity({
expression: `SELECT
job_info.*,
user_info.name as userName,
mark_as_not_suit_log.date,
boss_info.name AS bossName,
boss_info.title AS bossTitle,
company_info.name AS companyName
FROM
mark_as_not_suit_log
LEFT JOIN job_info ON mark_as_not_suit_log.encryptJobId = job_info.encryptJobId
LEFT JOIN user_info ON mark_as_not_suit_log.encryptCurrentUserId = user_info.encryptUserId
LEFT JOIN boss_info ON boss_info.encryptBossId = job_info.encryptBossId
LEFT JOIN company_info ON company_info.encryptCompanyId = job_info.encryptCompanyId
`,
})
export class VMarkAsNotSuitLog {
@ViewColumn()
encryptJobId: number;
@ViewColumn()
jobName: string;
@ViewColumn()
positionName: string;
@ViewColumn()
salaryLow: number | null;
@ViewColumn()
salaryHigh: number | null;
@ViewColumn()
salaryMonth: number | null;
@ViewColumn()
experienceName: number | null;
@ViewColumn()
publishDate: Date | null;
@ViewColumn()
degreeName: string;
@ViewColumn()
address: string;
@ViewColumn()
description: string;
@ViewColumn()
userName: string;
@ViewColumn()
date: string;
@ViewColumn()
bossName: string;
@ViewColumn()
bossTitle: string;
@ViewColumn()
companyName: string;
}

View File

@@ -12,10 +12,12 @@ import { JobInfoChangeLog } from "./entity/JobInfoChangeLog";
import { BossActiveStatusRecord } from "./entity/BossActiveStatusRecord";
import { UserInfo } from "./entity/UserInfo";
import { AutoStartChatRunRecord } from './entity/AutoStartChatRunRecord';
import { MarkAsNotSuitLog } from "./entity/MarkAsNotSuitLog"
import { VChatStartupLog } from "./entity/VChatStartupLog";
import { VBossLibrary } from "./entity/VBossLibrary";
import { VJobLibrary } from "./entity/VJobLibrary";
import { VCompanyLibrary } from "./entity/VCompanyLibrary"
import { VMarkAsNotSuitLog } from "./entity/VMarkAsNotSuitLog"
import sqlite3 from 'sqlite3';
import * as cliHighlight from 'cli-highlight';
@@ -47,7 +49,9 @@ export function initDb(dbFilePath) {
VChatStartupLog,
VBossLibrary,
VJobLibrary,
VCompanyLibrary
VCompanyLibrary,
MarkAsNotSuitLog,
VMarkAsNotSuitLog,
],
migrations: [
UpdateChatStartupLogTable1729182577167

View File

@@ -22,7 +22,8 @@ import {
getBossLibrary,
getCompanyLibrary,
getJobLibrary,
getJobHistoryByEncryptId
getJobHistoryByEncryptId,
getMarkAsNotSuitRecord
} from '../utils/db/index'
import { PageReq } from '../../../../common/types/pagination'
import { pipeWriteRegardlessError } from '../../utils/pipe'
@@ -276,6 +277,10 @@ export default function initIpc() {
const a = await getAutoStartChatRecord(payload)
return a
})
ipcMain.handle('get-mark-as-not-suit-record', async (ev, payload: PageReq) => {
const a = await getMarkAsNotSuitRecord(payload)
return a
})
ipcMain.handle('get-job-library', async (ev, payload: PageReq) => {
const a = await getJobLibrary(payload)
return a

View File

@@ -59,6 +59,15 @@ export const getAutoStartChatRecord = async ({ pageNo, pageSize }: Partial<PageR
return res
}
export const getMarkAsNotSuitRecord = async ({ pageNo, pageSize }: Partial<PageReq> = {}) => {
const res = await createWorkerPromise({
type: 'getMarkAsNotSuitRecord',
pageNo,
pageSize
})
return res
}
export const getBossLibrary = async ({ pageNo, pageSize }: Partial<PageReq> = {}) => {
const res = await createWorkerPromise({
type: 'getBossLibrary',

View File

@@ -7,6 +7,7 @@ import { VChatStartupLog } from '@geekgeekrun/sqlite-plugin/dist/entity/VChatSta
import { VJobLibrary } from '@geekgeekrun/sqlite-plugin/dist/entity/VJobLibrary'
import { VCompanyLibrary } from '@geekgeekrun/sqlite-plugin/dist/entity/VCompanyLibrary'
import { VBossLibrary } from '@geekgeekrun/sqlite-plugin/dist/entity/VBossLibrary'
import { VMarkAsNotSuitLog } from '@geekgeekrun/sqlite-plugin/dist/entity/VMarkAsNotSuitLog'
import { measureExecutionTime } from '../../../../../../common/utils/performance'
import { PageReq, PagedRes } from '../../../../../../common/types/pagination'
import { JobInfoChangeLog } from '@geekgeekrun/sqlite-plugin/dist/entity/JobInfoChangeLog'
@@ -55,6 +56,28 @@ const payloadHandler = {
totalItemCount
}
},
async getMarkAsNotSuitRecord({ pageNo, pageSize }: Partial<PageReq> = {}): Promise<
PagedRes<VMarkAsNotSuitLog>
> {
if (!pageNo) {
pageNo = 1
}
if (!pageSize) {
pageSize = 10
}
const recordRepository = dataSource!.getRepository(VMarkAsNotSuitLog)!
const [data, totalItemCount] = await measureExecutionTime(
recordRepository.findAndCount({
skip: (pageNo - 1) * pageSize,
take: pageSize
})
)
return {
data,
pageNo,
totalItemCount
}
},
async getJobLibrary({ pageNo, pageSize }: Partial<PageReq> = {}): Promise<PagedRes<VJobLibrary>> {
if (!pageNo) {
pageNo = 1

View File

@@ -0,0 +1,175 @@
<template>
<div class="page-wrap flex flex-col of-hidden">
<div v-loading="isTableLoading" class="flex-1 of-hidden">
<div ref="tableContainerEl" class="h-100% of-hidden">
<ElTable
ref="tableRef"
:max-height="tableMaxHeight"
:data="tableData"
:row-key="getRowKey"
size="small"
table-layout="auto"
highlight-current-row
>
<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.salaryHigh}k` +
(row.salaryMonth ? `* ${row.salaryMonth}薪` : '')
"
/>
<ElTableColumn prop="bossName" label="BOSS" />
<ElTableColumn prop="bossTitle" label="标记原因" />
<ElTableColumn label="职位信息" fixed="right" :width="120">
<template #default="{ row }">
<ElButton
link
type="primary"
size="small"
@click="handleViewJobSnapshotButtonClick(row)"
>快照</ElButton
>
<ElButton
link
type="primary"
size="small"
@click="handleViewJobOnlineButtonClick(row.encryptJobId)"
>线上</ElButton
>
</template>
</ElTableColumn>
</ElTable>
</div>
</div>
<div class="flex flex-0 flex-justify-between pt10px pb10px">
<div class="w100px">
<el-button :loading="isTableLoading" size="small" @click="getMarkAsNotSuitRecord"
>刷新</el-button
>
</div>
<ElPagination
v-model:current-page="pagination.pageNo"
v-model:page-size="pagination.pageSize"
:page-sizes="pageSizeList"
small
:disabled="isTableLoading"
layout="total, sizes, prev, pager, next, jumper"
:total="pagination.totalItemCount"
@size-change="getMarkAsNotSuitRecord"
@current-change="getMarkAsNotSuitRecord"
/>
<div class="w100px" />
</div>
<ElDrawer v-model="drawVisibleModelValue" size="400px">
<JobInfoSnapshot
v-if="selectedJobInfoForViewSnapshot"
:job-info="selectedJobInfoForViewSnapshot"
@closed="selectedJobInfoForViewSnapshot = null"
/>
</ElDrawer>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted, onBeforeUnmount } from 'vue'
import { ElTable, ElTableColumn, ElButton, ElPagination, ElDrawer } from 'element-plus'
import { type VMarkAsNotSuitLog } from '@geekgeekrun/sqlite-plugin/src/entity/VMarkAsNotSuitLog'
import dayjs from 'dayjs'
import { PageReq, PagedRes } from '../../../../common/types/pagination'
import JobInfoSnapshot from '../../features/JobInfoSnapshot/index.vue'
const tableData = ref<VMarkAsNotSuitLog[]>([])
const pageSizeList = ref<number[]>([100, 200, 300, 400])
const pagination = ref<Omit<PageReq & PagedRes<unknown>, 'data'>>({
pageNo: 1,
pageSize: pageSizeList.value[0],
totalItemCount: 0
})
const getRowKey = (row: VMarkAsNotSuitLog) => {
return `${row.encryptJobId}@${row.date}`
}
const tableRef = ref<InstanceType<typeof ElTable>>()
const isTableLoading = ref(false)
async function getMarkAsNotSuitRecord() {
try {
isTableLoading.value = true
const { data: res } = (await electron.ipcRenderer.invoke('get-mark-as-not-suit-record', {
pageNo: pagination.value.pageNo,
pageSize: pagination.value.pageSize
})) as { data: PagedRes<VMarkAsNotSuitLog> }
tableData.value = res.data
pagination.value = {
totalItemCount: res.totalItemCount,
pageNo: res.pageNo,
pageSize: pagination.value.pageSize
}
} catch (err) {
console.log(err)
tableData.value = []
} finally {
tableRef.value?.setScrollTop(0)
isTableLoading.value = false
}
}
getMarkAsNotSuitRecord()
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()
})
})
async function handleViewJobOnlineButtonClick(encryptJobId: string) {
return await electron.ipcRenderer.invoke('open-site-with-boss-cookie', {
url: `https://www.zhipin.com/job_detail/${encryptJobId}.html`
})
}
const drawVisibleModelValue = ref(false)
const selectedJobInfoForViewSnapshot = ref<VMarkAsNotSuitLog | null>(null)
function handleViewJobSnapshotButtonClick(record: VMarkAsNotSuitLog) {
selectedJobInfoForViewSnapshot.value = record
drawVisibleModelValue.value = true
}
</script>
<style scoped lang="scss">
.page-wrap {
margin: 0 auto;
max-width: 1000px;
max-height: 100vh;
overflow: hidden;
padding-left: 20px;
padding-top: 20px;
:deep(.el-drawer) {
.el-drawer__header {
padding: 16px 20px;
margin-bottom: 0;
}
.el-drawer__body {
padding: 0;
margin: 0 0 20px 20px;
padding-right: 20px;
}
}
}
</style>

View File

@@ -7,6 +7,7 @@
手动逛Boss<el-icon><TopRight /></el-icon>
</a>
<RouterLink to="./StartChatRecord">开聊记录</RouterLink>
<RouterLink to="./MarkAsNotSuitRecord">标记不合适记录</RouterLink>
<RouterLink to="./JobLibrary">职位库</RouterLink>
<RouterLink to="./BossLibrary">Boss库</RouterLink>
<RouterLink to="./CompanyLibrary">公司库</RouterLink>

View File

@@ -35,6 +35,13 @@ const routes: Array<RouteRecordRaw> = [
title: '开聊记录'
}
},
{
path: 'MarkAsNotSuitRecord',
component: () => import('@renderer/page/Configuration/MarkAsNotSuitRecord.vue'),
meta: {
title: '标记不合适记录'
}
},
{
path: 'JobLibrary',
component: () => import('@renderer/page/Configuration/JobLibrary.vue'),