From a1d7e81859f554f3a53680cc35f0f49bf1f77098 Mon Sep 17 00:00:00 2001
From: wwf <1971391498@qq.com>
Date: 星期四, 14 五月 2026 14:37:02 +0800
Subject: [PATCH] 导入项目

---
 src/views/crm/statistics/customer/components/CustomerDealCycleByUser.vue |  154 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 154 insertions(+), 0 deletions(-)

diff --git a/src/views/crm/statistics/customer/components/CustomerDealCycleByUser.vue b/src/views/crm/statistics/customer/components/CustomerDealCycleByUser.vue
new file mode 100644
index 0000000..e3d877e
--- /dev/null
+++ b/src/views/crm/statistics/customer/components/CustomerDealCycleByUser.vue
@@ -0,0 +1,154 @@
+<!-- 鎴愪氦鍛ㄦ湡鍒嗘瀽 -->
+<template>
+  <!-- Echarts鍥� -->
+  <el-card shadow="never">
+    <el-skeleton :loading="loading" animated>
+      <Echart :height="500" :options="echartsOption" />
+    </el-skeleton>
+  </el-card>
+
+  <!-- 缁熻鍒楄〃 -->
+  <el-card shadow="never" class="mt-16px">
+    <el-table v-loading="loading" :data="list">
+      <el-table-column label="搴忓彿" align="center" type="index" width="80" />
+      <el-table-column label="鏃ユ湡" align="center" prop="ownerUserName" min-width="200" />
+      <el-table-column
+        label="鎴愪氦鍛ㄦ湡(澶�)"
+        align="center"
+        prop="customerDealCycle"
+        min-width="200"
+      />
+      <el-table-column label="鎴愪氦瀹㈡埛鏁�" align="center" prop="customerDealCount" min-width="200" />
+    </el-table>
+  </el-card>
+</template>
+<script setup lang="ts">
+import {
+  StatisticsCustomerApi,
+  CrmStatisticsCustomerDealCycleByDateRespVO,
+  CrmStatisticsCustomerSummaryByDateRespVO
+} from '@/api/crm/statistics/customer'
+import { EChartsOption } from 'echarts'
+
+defineOptions({ name: 'CustomerDealCycleByUser' })
+
+const props = defineProps<{ queryParams: any }>() // 鎼滅储鍙傛暟
+
+const loading = ref(false) // 鍔犺浇涓�
+const list = ref<CrmStatisticsCustomerDealCycleByDateRespVO[]>([]) // 鍒楄〃鐨勬暟鎹�
+
+/** 鏌辩姸鍥鹃厤缃細绾靛悜 */
+const echartsOption = reactive<EChartsOption>({
+  grid: {
+    left: 20,
+    right: 40, // 璁� X 杞村彸渚ф樉绀哄畬鏁�
+    bottom: 20,
+    containLabel: true
+  },
+  legend: {},
+  series: [
+    {
+      name: '鎴愪氦鍛ㄦ湡(澶�)',
+      type: 'bar',
+      data: [],
+      yAxisIndex: 0
+    },
+    {
+      name: '鎴愪氦瀹㈡埛鏁�',
+      type: 'bar',
+      data: [],
+      yAxisIndex: 1
+    }
+  ],
+  toolbox: {
+    feature: {
+      dataZoom: {
+        xAxisIndex: false // 鏁版嵁鍖哄煙缂╂斁锛歒 杞翠笉缂╂斁
+      },
+      brush: {
+        type: ['lineX', 'clear'] // 鍖哄煙缂╂斁鎸夐挳銆佽繕鍘熸寜閽�
+      },
+      saveAsImage: { show: true, name: '鎴愪氦鍛ㄦ湡鍒嗘瀽' } // 淇濆瓨涓哄浘鐗�
+    }
+  },
+  tooltip: {
+    trigger: 'axis',
+    axisPointer: {
+      type: 'shadow'
+    }
+  },
+  yAxis: [
+    {
+      type: 'value',
+      name: '鎴愪氦鍛ㄦ湡(澶�)',
+      min: 0,
+      minInterval: 1 // 鏄剧ず鏁存暟鍒诲害
+    },
+    {
+      type: 'value',
+      name: '鎴愪氦瀹㈡埛鏁�',
+      min: 0,
+      minInterval: 1, // 鏄剧ず鏁存暟鍒诲害
+      splitLine: {
+        lineStyle: {
+          type: 'dotted', // 鍙充晶缃戞牸绾胯櫄鍖�, 鍑忓皯娣蜂贡
+          opacity: 0.7
+        }
+      }
+    }
+  ],
+  xAxis: {
+    type: 'category',
+    name: '鏃ユ湡',
+    data: []
+  }
+}) as EChartsOption
+
+/** 鑾峰彇鏁版嵁骞跺~鍏呭浘琛� */
+const fetchAndFill = async () => {
+  // 1. 鍔犺浇缁熻鏁版嵁
+  const customerDealCycleByDate = await StatisticsCustomerApi.getCustomerDealCycleByDate(
+    props.queryParams
+  )
+  const customerSummaryByDate = await StatisticsCustomerApi.getCustomerSummaryByDate(
+    props.queryParams
+  )
+  const customerDealCycleByUser = await StatisticsCustomerApi.getCustomerDealCycleByUser(
+    props.queryParams
+  )
+  // 2.1 鏇存柊 Echarts 鏁版嵁
+  if (echartsOption.xAxis && echartsOption.xAxis['data']) {
+    echartsOption.xAxis['data'] = customerDealCycleByDate.map(
+      (s: CrmStatisticsCustomerDealCycleByDateRespVO) => s.time
+    )
+  }
+  if (echartsOption.series && echartsOption.series[0] && echartsOption.series[0]['data']) {
+    echartsOption.series[0]['data'] = customerDealCycleByDate.map(
+      (s: CrmStatisticsCustomerDealCycleByDateRespVO) => s.customerDealCycle
+    )
+  }
+  if (echartsOption.series && echartsOption.series[1] && echartsOption.series[1]['data']) {
+    echartsOption.series[1]['data'] = customerSummaryByDate.map(
+      (s: CrmStatisticsCustomerSummaryByDateRespVO) => s.customerDealCount
+    )
+  }
+  // 2.2 鏇存柊鍒楄〃鏁版嵁
+  list.value = customerDealCycleByUser
+}
+
+/** 鑾峰彇缁熻鏁版嵁 */
+const loadData = async () => {
+  loading.value = true
+  try {
+    await fetchAndFill()
+  } finally {
+    loading.value = false
+  }
+}
+defineExpose({ loadData })
+
+/** 鍒濆鍖� */
+onMounted(() => {
+  loadData()
+})
+</script>

--
Gitblit v1.8.0