feat: 亮灯表点击客户 → 周报自动按客户筛选
- WeeklyReport onMounted 新增 customer_id 路由参数处理 - 筛选栏新增「按客户筛选」下拉框(filterable搜索) - 加载客户列表供下拉选项
This commit is contained in:
@@ -4,6 +4,7 @@ import { useRoute } from 'vue-router'
|
||||
import { useAuthStore } from '@/stores/auth'
|
||||
import { dashboardApi } from '@/api/dashboard'
|
||||
import { uploadApi } from '@/api/upload'
|
||||
import { customersApi } from '@/api/customers'
|
||||
import { aiApi } from '@/api/ai'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import ImagePreview from '@/components/ImagePreview.vue'
|
||||
@@ -19,6 +20,7 @@ const activeTab = ref('visits')
|
||||
const filterManagerId = ref('')
|
||||
const filterCustomerId = ref('')
|
||||
const managers = ref<any[]>([])
|
||||
const customers = ref<any[]>([])
|
||||
const weekOffset = ref(0)
|
||||
|
||||
const isHistoricalWeek = computed(() => weekOffset.value < 0)
|
||||
@@ -35,10 +37,15 @@ const currentPhotoUrl = ref('')
|
||||
|
||||
onMounted(async () => {
|
||||
if (route.query.manager_id) filterManagerId.value = route.query.manager_id as string
|
||||
if (route.query.customer_id) filterCustomerId.value = route.query.customer_id as string
|
||||
await loadReport()
|
||||
try {
|
||||
const res = await api.get('/users/', { params: { role: 'manager' } })
|
||||
managers.value = res.data
|
||||
const [mRes, cRes] = await Promise.all([
|
||||
api.get('/users/', { params: { role: 'manager' } }),
|
||||
customersApi.list({ page_size: 500 }),
|
||||
])
|
||||
managers.value = mRes.data
|
||||
customers.value = cRes.data.items || cRes.data
|
||||
} catch (_) {}
|
||||
})
|
||||
|
||||
@@ -202,11 +209,16 @@ const notesByDate = computed(() => {
|
||||
<!-- Filters -->
|
||||
<el-card style="margin-bottom: 16px;">
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="8">
|
||||
<el-col :span="6">
|
||||
<el-select v-model="filterManagerId" placeholder="按客户经理筛选" clearable @change="loadReport" style="width:100%">
|
||||
<el-option v-for="m in managers" :key="m.id" :label="m.name" :value="m.id" />
|
||||
</el-select>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-select v-model="filterCustomerId" placeholder="按客户筛选" clearable filterable @change="loadReport" style="width:100%">
|
||||
<el-option v-for="c in customers" :key="c.id" :label="c.name" :value="c.id" />
|
||||
</el-select>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<el-button @click="loadReport">查询</el-button>
|
||||
</el-col>
|
||||
|
||||
Reference in New Issue
Block a user