gongchunyi
4 天以前 5b1500969cdf102a6db9e3f56faec5aa67f68496
src/views/reportAnalysis/dataDashboard/components/basic/left-bottom.vue
@@ -9,6 +9,8 @@
          placeholder="请选择客户"
          clearable
          filterable
          popper-class="customer-select-dropdown"
          :teleported="false"
          @change="handleFilterChange"
        >
          <el-option
@@ -44,6 +46,15 @@
import DateTypeSwitch from '../DateTypeSwitch.vue'
import { customerRevenueAnalysis } from '@/api/viewIndex.js'
import { listCustomer } from '@/api/basicData/customerFile.js'
/** 客户营收分析下拉默认选中该客户(不存在则退回列表第一项) */
const DEFAULT_REVENUE_CUSTOMER_NAME = '鑫鹤门窗'
const pickDefaultCustomerValue = (options) => {
  if (!options?.length) return null
  const matched = options.find((o) => o.label === DEFAULT_REVENUE_CUSTOMER_NAME)
  return matched ? matched.value : options[0].value
}
const dateType = ref(1) // 1=周 2=月 3=季度
const customerValue = ref(null)
@@ -106,7 +117,7 @@
  formatter: function (params) {
    let result = params[0].axisValueLabel + '<br/>'
    params.forEach((item) => {
      result += `<div style="color: #B8C8E0">${item.marker} ${item.seriesName}: ${item.value}</div>`
      result += `<div>${item.marker} ${item.seriesName}: ${item.value}</div>`
    })
    return result
  },
@@ -131,8 +142,7 @@
// 获取客户营收分析数据
const getCustomerRevenueAnalysis = () => {
  if (customerOptions.value.length > 0 && !customerValue.value) {
    // 默认选中第一个客户
    customerValue.value = customerOptions.value[0].value
    customerValue.value = pickDefaultCustomerValue(customerOptions.value)
  }
  if (!customerValue.value) return
@@ -161,7 +171,7 @@
const fetchCustomerOptions = async () => {
  try {
    const params = { pageNum: 1, pageSize: 200 }
    const params = { current: -1, size: -1 }
    const res = await listCustomer(params)
    const records = res?.records || res?.data?.records || res?.rows || []
    customerOptions.value = records.map((r) => ({
@@ -169,9 +179,9 @@
      value: r.id ?? r.customerId ?? r.customerCode ?? r.customerName,
    }))
    
    // 获取到选项后,如果还没选中,默认选中第一个
    // 获取到选项后,如果还没选中,默认「鑫鹤门窗」(无则第一项)
    if (customerOptions.value.length > 0 && !customerValue.value) {
      customerValue.value = customerOptions.value[0].value
      customerValue.value = pickDefaultCustomerValue(customerOptions.value)
      getCustomerRevenueAnalysis()
    }
  } catch (e) {
@@ -242,3 +252,17 @@
  height: 478px;
}
</style>
<style>
/* 全屏模式下下拉框层级修复 */
.customer-select-dropdown {
  z-index: 10001 !important;
}
/* 确保在全屏容器内的下拉框也能正常显示 */
.scale-container:fullscreen .customer-select-dropdown,
.scale-container:-webkit-full-screen .customer-select-dropdown,
.scale-container:-ms-fullscreen .customer-select-dropdown {
  z-index: 10001 !important;
}
</style>