【招生用户端】 修复# 工作台-排名榜:点击查看更多后,切换岗位后强制更新表头名称

main
kaeery 2025-03-06 21:27:45 +08:00
parent 3cf3a0624b
commit 6e1a9e0ce9
2 changed files with 20 additions and 9 deletions

View File

@ -38,7 +38,7 @@
</el-form-item>
</el-form>
</div>
<ProTable ref="proTableRef" :columns="columns" :tableData="tableData" :loading="loading" :maxHeight="530"></ProTable>
<ProTable v-if="isRrefresh" ref="proTableRef" :columns="columns" :tableData="tableData" :loading="loading" :maxHeight="530"></ProTable>
<div class="flex justify-end mt-[10px]">
<pagination v-model="pager" @change="fetchData" layout="total, prev, pager, next, jumper" class="mb-[10px]" />
</div>
@ -50,6 +50,7 @@ import ProDialog, { type IParams } from '@/components/ProDialog/index.vue'
import { usePositionData, useWorkbench } from '@/hooks/useCommon'
import { rankMoreListApi } from '@/api/workbench'
import { getCurDate, shortcuts } from '@/utils/util'
import { templateTypeEum } from '@/enums'
const { positionOptions, postId, fetchPostionData } = usePositionData()
@ -62,33 +63,33 @@ const proDialogRef = ref<InstanceType<typeof ProDialog>>()
const loading = ref(false)
const proTableRef = ref()
const tableData = ref<any[]>([])
const columns = reactive([
{ prop: 'rank', label: '排名' },
{ prop: 'username', label: '账号名称' },
{ prop: 'clueCount', label: '总数' }
])
const parseLabel = computed(() => (postId.value === templateTypeEum.TELE ? '意向客户数' : '成交客户数'))
const columns = ref<any[]>([])
const queryParams = ref()
const initialVal = ref()
const { defaultProps, CascaderProps, organizationList, userList, fetchOrganizationList, fetchAllUserList } = useWorkbench(id => {
initialVal.value = id
})
const selectedUserId = ref([])
const isRrefresh = ref(true) // columns
const openDialog = async (params: IParams) => {
queryParams.value = params.data
await fetchPostionData()
fetchOrganizationList()
fetchAllUserList()
columns.value = generateColumns()
fetchData()
proDialogRef.value?.openDialog(params)
}
const fetchData = async () => {
loading.value = true
isRrefresh.value = false
try {
const newParams = {
...queryParams.value,
post: postId.value ?? queryParams.value.post
}
columns.value = generateColumns()
const result = await rankMoreListApi(newParams)
tableData.value = result.lists ?? []
pager.value = {
@ -98,13 +99,21 @@ const fetchData = async () => {
}
} catch (error) {}
loading.value = false
isRrefresh.value = true
}
const handleCancel = (callback: () => void) => {
callback()
}
const generateColumns = () => {
return [
{ prop: 'rank', label: '排名' },
{ prop: 'username', label: '账号名称' },
{ prop: 'clueCount', label: parseLabel.value }
]
}
watch(
() => postId.value,
(newVal, oldVal) => {
async (newVal, oldVal) => {
if (newVal !== oldVal) {
fetchData()
}

View File

@ -28,7 +28,7 @@
<el-table :data="tableData" v-loading="loading" style="min-height: 300px">
<el-table-column prop="rank" label="排名" width="70" />
<el-table-column prop="username" label="负责人" width="180" />
<el-table-column prop="clueCount" label="总数" />
<el-table-column prop="clueCount" :label="parseLabel" />
</el-table>
</template>
<template v-if="!loading && tableData.length == 0">
@ -45,6 +45,7 @@ import card from './card.vue'
import rankListDialog from './rank-list-dialog.vue'
import type { IForm } from '../index.vue'
import { usePositionData } from '@/hooks/useCommon'
import { templateTypeEum } from '@/enums'
const { positionOptions, postId, fetchPostionData } = usePositionData()
@ -54,6 +55,7 @@ const rankListDialogRef = ref<InstanceType<typeof rankListDialog>>()
const tableData = ref([])
const loading = ref(false)
const queryParams = ref()
const parseLabel = computed(() => (postId.value == templateTypeEum.TELE ? '意向客户数' : '成交客户数'))
const fetchData = async (payload: IForm) => {
if (!positionOptions.value.length) await fetchPostionData()
if (tableData.value.length > 0) tableData.value = []