【招生用户端】 修复# 工作台-排名榜:点击查看更多后,切换岗位后强制更新表头名称
parent
3cf3a0624b
commit
6e1a9e0ce9
|
@ -38,7 +38,7 @@
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</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]">
|
<div class="flex justify-end mt-[10px]">
|
||||||
<pagination v-model="pager" @change="fetchData" layout="total, prev, pager, next, jumper" class="mb-[10px]" />
|
<pagination v-model="pager" @change="fetchData" layout="total, prev, pager, next, jumper" class="mb-[10px]" />
|
||||||
</div>
|
</div>
|
||||||
|
@ -50,6 +50,7 @@ import ProDialog, { type IParams } from '@/components/ProDialog/index.vue'
|
||||||
import { usePositionData, useWorkbench } from '@/hooks/useCommon'
|
import { usePositionData, useWorkbench } from '@/hooks/useCommon'
|
||||||
import { rankMoreListApi } from '@/api/workbench'
|
import { rankMoreListApi } from '@/api/workbench'
|
||||||
import { getCurDate, shortcuts } from '@/utils/util'
|
import { getCurDate, shortcuts } from '@/utils/util'
|
||||||
|
import { templateTypeEum } from '@/enums'
|
||||||
|
|
||||||
const { positionOptions, postId, fetchPostionData } = usePositionData()
|
const { positionOptions, postId, fetchPostionData } = usePositionData()
|
||||||
|
|
||||||
|
@ -62,33 +63,33 @@ const proDialogRef = ref<InstanceType<typeof ProDialog>>()
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const proTableRef = ref()
|
const proTableRef = ref()
|
||||||
const tableData = ref<any[]>([])
|
const tableData = ref<any[]>([])
|
||||||
const columns = reactive([
|
const parseLabel = computed(() => (postId.value === templateTypeEum.TELE ? '意向客户数' : '成交客户数'))
|
||||||
{ prop: 'rank', label: '排名' },
|
const columns = ref<any[]>([])
|
||||||
{ prop: 'username', label: '账号名称' },
|
|
||||||
{ prop: 'clueCount', label: '总数' }
|
|
||||||
])
|
|
||||||
const queryParams = ref()
|
const queryParams = ref()
|
||||||
const initialVal = ref()
|
const initialVal = ref()
|
||||||
const { defaultProps, CascaderProps, organizationList, userList, fetchOrganizationList, fetchAllUserList } = useWorkbench(id => {
|
const { defaultProps, CascaderProps, organizationList, userList, fetchOrganizationList, fetchAllUserList } = useWorkbench(id => {
|
||||||
initialVal.value = id
|
initialVal.value = id
|
||||||
})
|
})
|
||||||
const selectedUserId = ref([])
|
const selectedUserId = ref([])
|
||||||
|
const isRrefresh = ref(true) // 解决columns不更新
|
||||||
const openDialog = async (params: IParams) => {
|
const openDialog = async (params: IParams) => {
|
||||||
queryParams.value = params.data
|
queryParams.value = params.data
|
||||||
await fetchPostionData()
|
await fetchPostionData()
|
||||||
fetchOrganizationList()
|
fetchOrganizationList()
|
||||||
fetchAllUserList()
|
fetchAllUserList()
|
||||||
|
columns.value = generateColumns()
|
||||||
fetchData()
|
fetchData()
|
||||||
proDialogRef.value?.openDialog(params)
|
proDialogRef.value?.openDialog(params)
|
||||||
}
|
}
|
||||||
const fetchData = async () => {
|
const fetchData = async () => {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
|
isRrefresh.value = false
|
||||||
try {
|
try {
|
||||||
const newParams = {
|
const newParams = {
|
||||||
...queryParams.value,
|
...queryParams.value,
|
||||||
post: postId.value ?? queryParams.value.post
|
post: postId.value ?? queryParams.value.post
|
||||||
}
|
}
|
||||||
|
columns.value = generateColumns()
|
||||||
const result = await rankMoreListApi(newParams)
|
const result = await rankMoreListApi(newParams)
|
||||||
tableData.value = result.lists ?? []
|
tableData.value = result.lists ?? []
|
||||||
pager.value = {
|
pager.value = {
|
||||||
|
@ -98,13 +99,21 @@ const fetchData = async () => {
|
||||||
}
|
}
|
||||||
} catch (error) {}
|
} catch (error) {}
|
||||||
loading.value = false
|
loading.value = false
|
||||||
|
isRrefresh.value = true
|
||||||
}
|
}
|
||||||
const handleCancel = (callback: () => void) => {
|
const handleCancel = (callback: () => void) => {
|
||||||
callback()
|
callback()
|
||||||
}
|
}
|
||||||
|
const generateColumns = () => {
|
||||||
|
return [
|
||||||
|
{ prop: 'rank', label: '排名' },
|
||||||
|
{ prop: 'username', label: '账号名称' },
|
||||||
|
{ prop: 'clueCount', label: parseLabel.value }
|
||||||
|
]
|
||||||
|
}
|
||||||
watch(
|
watch(
|
||||||
() => postId.value,
|
() => postId.value,
|
||||||
(newVal, oldVal) => {
|
async (newVal, oldVal) => {
|
||||||
if (newVal !== oldVal) {
|
if (newVal !== oldVal) {
|
||||||
fetchData()
|
fetchData()
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
<el-table :data="tableData" v-loading="loading" style="min-height: 300px">
|
<el-table :data="tableData" v-loading="loading" style="min-height: 300px">
|
||||||
<el-table-column prop="rank" label="排名" width="70" />
|
<el-table-column prop="rank" label="排名" width="70" />
|
||||||
<el-table-column prop="username" label="负责人" width="180" />
|
<el-table-column prop="username" label="负责人" width="180" />
|
||||||
<el-table-column prop="clueCount" label="总数" />
|
<el-table-column prop="clueCount" :label="parseLabel" />
|
||||||
</el-table>
|
</el-table>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="!loading && tableData.length == 0">
|
<template v-if="!loading && tableData.length == 0">
|
||||||
|
@ -45,6 +45,7 @@ import card from './card.vue'
|
||||||
import rankListDialog from './rank-list-dialog.vue'
|
import rankListDialog from './rank-list-dialog.vue'
|
||||||
import type { IForm } from '../index.vue'
|
import type { IForm } from '../index.vue'
|
||||||
import { usePositionData } from '@/hooks/useCommon'
|
import { usePositionData } from '@/hooks/useCommon'
|
||||||
|
import { templateTypeEum } from '@/enums'
|
||||||
|
|
||||||
const { positionOptions, postId, fetchPostionData } = usePositionData()
|
const { positionOptions, postId, fetchPostionData } = usePositionData()
|
||||||
|
|
||||||
|
@ -54,6 +55,7 @@ const rankListDialogRef = ref<InstanceType<typeof rankListDialog>>()
|
||||||
const tableData = ref([])
|
const tableData = ref([])
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const queryParams = ref()
|
const queryParams = ref()
|
||||||
|
const parseLabel = computed(() => (postId.value == templateTypeEum.TELE ? '意向客户数' : '成交客户数'))
|
||||||
const fetchData = async (payload: IForm) => {
|
const fetchData = async (payload: IForm) => {
|
||||||
if (!positionOptions.value.length) await fetchPostionData()
|
if (!positionOptions.value.length) await fetchPostionData()
|
||||||
if (tableData.value.length > 0) tableData.value = []
|
if (tableData.value.length > 0) tableData.value = []
|
||||||
|
|
Loading…
Reference in New Issue