feat: 设计师绩效排行榜增加部门筛选功能
This commit is contained in:
parent
5c60a73aff
commit
ec5a1317d9
@ -199,7 +199,23 @@
|
||||
|
||||
<!-- 设计师绩效排行榜 - 全宽显示 -->
|
||||
<div class="table-card full-width">
|
||||
<h3 class="chart-title">设计师绩效排行榜</h3>
|
||||
<div class="table-header">
|
||||
<h3 class="chart-title">设计师绩效排行榜</h3>
|
||||
<div class="filter-bar">
|
||||
<a-select
|
||||
v-model:value="selectedDeptId"
|
||||
placeholder="全部部门"
|
||||
style="width: 180px"
|
||||
allow-clear
|
||||
@change="handleDeptChange"
|
||||
:dropdown-style="{ background: '#1f1f1f', borderColor: '#303030' }"
|
||||
>
|
||||
<a-select-option v-for="dept in departmentList" :key="dept.id" :value="dept.id">
|
||||
{{ dept.deptName }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</div>
|
||||
</div>
|
||||
<a-table
|
||||
:columns="designerColumns"
|
||||
:data-source="designerPerformance.designerStats || []"
|
||||
@ -413,6 +429,7 @@ import { message } from 'ant-design-vue'
|
||||
import * as echarts from 'echarts'
|
||||
import Icon from '@/components/Icon.vue'
|
||||
import dayjs, { Dayjs } from 'dayjs'
|
||||
import { fetchDepartmentOverview } from '@/api/department'
|
||||
|
||||
const router = useRouter()
|
||||
const loading = ref(false)
|
||||
@ -494,6 +511,10 @@ const processEfficiency = reactive<ProcessEfficiency>({
|
||||
const warningTasks = ref<WarningTask[]>([])
|
||||
const warningFilter = ref('all')
|
||||
|
||||
// 部门筛选
|
||||
const selectedDeptId = ref<number | undefined>(undefined)
|
||||
const departmentList = ref<any[]>([])
|
||||
|
||||
// 图表引用
|
||||
const trendChartRef = ref<HTMLElement>()
|
||||
const typeChartRef = ref<HTMLElement>()
|
||||
@ -649,7 +670,7 @@ const loadAllData = async () => {
|
||||
// 并行加载所有数据
|
||||
const [demandData, designerData, efficiencyData, warningsData] = await Promise.all([
|
||||
getDemandStatistics(dateRange.value, undefined, undefined, month),
|
||||
getDesignerPerformance(month),
|
||||
getDesignerPerformance(month, selectedDeptId.value),
|
||||
getProcessEfficiency(month),
|
||||
getWarningTasks()
|
||||
])
|
||||
@ -912,7 +933,44 @@ const exportData = () => {
|
||||
message.success('报表导出成功')
|
||||
}
|
||||
|
||||
// 加载接单部门列表
|
||||
const loadDepartments = async () => {
|
||||
try {
|
||||
const res = await fetchDepartmentOverview()
|
||||
// 只显示接单部门
|
||||
departmentList.value = (res.data || []).filter((d: any) => d.deptType === 'receiving')
|
||||
} catch (error) {
|
||||
console.error('加载部门列表失败:', error)
|
||||
}
|
||||
}
|
||||
|
||||
// 部门筛选变化
|
||||
const handleDeptChange = (deptId: number | undefined) => {
|
||||
selectedDeptId.value = deptId
|
||||
loadDesignerData()
|
||||
}
|
||||
|
||||
// 单独加载设计师绩效数据(用于部门筛选)
|
||||
const loadDesignerData = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const month = selectedMonth.value || undefined
|
||||
const designerData = await getDesignerPerformance(month, selectedDeptId.value)
|
||||
Object.assign(designerPerformance, designerData)
|
||||
await nextTick()
|
||||
if (activeTab.value === 'designer') {
|
||||
renderWorkloadChart()
|
||||
}
|
||||
} catch (error) {
|
||||
message.error('加载设计师绩效数据失败')
|
||||
console.error('加载设计师绩效数据失败:', error)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
loadDepartments()
|
||||
loadAllData()
|
||||
})
|
||||
</script>
|
||||
@ -1055,6 +1113,23 @@ onMounted(() => {
|
||||
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
|
||||
margin-bottom: 24px;
|
||||
|
||||
.table-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: $space-lg;
|
||||
|
||||
.chart-title {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.filter-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
.chart-title {
|
||||
font-size: $font-size-lg;
|
||||
font-weight: 600;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user