|
@@ -3,49 +3,77 @@
|
|
<ContentWrap>
|
|
<ContentWrap>
|
|
<!-- 搜索工作栏 -->
|
|
<!-- 搜索工作栏 -->
|
|
<el-form
|
|
<el-form
|
|
- class="-mb-15px"
|
|
|
|
- :model="queryParams"
|
|
|
|
ref="queryFormRef"
|
|
ref="queryFormRef"
|
|
:inline="true"
|
|
:inline="true"
|
|
|
|
+ :model="queryParams"
|
|
|
|
+ class="-mb-15px"
|
|
label-width="68px"
|
|
label-width="68px"
|
|
>
|
|
>
|
|
<el-form-item label="时间范围" prop="orderDate">
|
|
<el-form-item label="时间范围" prop="orderDate">
|
|
<el-date-picker
|
|
<el-date-picker
|
|
v-model="queryParams.times"
|
|
v-model="queryParams.times"
|
|
|
|
+ :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
|
|
:shortcuts="defaultShortcuts"
|
|
:shortcuts="defaultShortcuts"
|
|
class="!w-240px"
|
|
class="!w-240px"
|
|
end-placeholder="结束日期"
|
|
end-placeholder="结束日期"
|
|
start-placeholder="开始日期"
|
|
start-placeholder="开始日期"
|
|
type="daterange"
|
|
type="daterange"
|
|
value-format="YYYY-MM-DD HH:mm:ss"
|
|
value-format="YYYY-MM-DD HH:mm:ss"
|
|
- :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
|
|
|
|
|
|
+ @change="handleQuery"
|
|
/>
|
|
/>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
+ <el-form-item label="时间间隔" prop="interval">
|
|
|
|
+ <el-select
|
|
|
|
+ v-model="queryParams.interval"
|
|
|
|
+ class="!w-240px"
|
|
|
|
+ placeholder="间隔类型"
|
|
|
|
+ @change="handleQuery"
|
|
|
|
+ >
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="dict in getIntDictOptions(DICT_TYPE.DATE_INTERVAL)"
|
|
|
|
+ :key="dict.value"
|
|
|
|
+ :label="dict.label"
|
|
|
|
+ :value="dict.value"
|
|
|
|
+ />
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
<el-form-item label="归属部门" prop="deptId">
|
|
<el-form-item label="归属部门" prop="deptId">
|
|
<el-tree-select
|
|
<el-tree-select
|
|
v-model="queryParams.deptId"
|
|
v-model="queryParams.deptId"
|
|
- class="!w-240px"
|
|
|
|
:data="deptList"
|
|
:data="deptList"
|
|
:props="defaultProps"
|
|
:props="defaultProps"
|
|
check-strictly
|
|
check-strictly
|
|
|
|
+ class="!w-240px"
|
|
node-key="id"
|
|
node-key="id"
|
|
placeholder="请选择归属部门"
|
|
placeholder="请选择归属部门"
|
|
- @change="queryParams.userId = undefined"
|
|
|
|
|
|
+ @change="(queryParams.userId = undefined), handleQuery()"
|
|
/>
|
|
/>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="员工" prop="userId">
|
|
<el-form-item label="员工" prop="userId">
|
|
- <el-select v-model="queryParams.userId" class="!w-240px" placeholder="员工" clearable>
|
|
|
|
|
|
+ <el-select
|
|
|
|
+ v-model="queryParams.userId"
|
|
|
|
+ class="!w-240px"
|
|
|
|
+ clearable
|
|
|
|
+ placeholder="员工"
|
|
|
|
+ @change="handleQuery"
|
|
|
|
+ >
|
|
<el-option
|
|
<el-option
|
|
v-for="(user, index) in userListByDeptId"
|
|
v-for="(user, index) in userListByDeptId"
|
|
|
|
+ :key="index"
|
|
:label="user.nickname"
|
|
:label="user.nickname"
|
|
:value="user.id"
|
|
:value="user.id"
|
|
- :key="index"
|
|
|
|
/>
|
|
/>
|
|
</el-select>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item>
|
|
<el-form-item>
|
|
- <el-button @click="handleQuery"> <Icon icon="ep:search" class="mr-5px" /> 搜索 </el-button>
|
|
|
|
- <el-button @click="resetQuery"> <Icon icon="ep:refresh" class="mr-5px" /> 重置 </el-button>
|
|
|
|
|
|
+ <el-button @click="handleQuery">
|
|
|
|
+ <Icon class="mr-5px" icon="ep:search" />
|
|
|
|
+ 查询
|
|
|
|
+ </el-button>
|
|
|
|
+ <el-button @click="resetQuery">
|
|
|
|
+ <Icon class="mr-5px" icon="ep:refresh" />
|
|
|
|
+ 重置
|
|
|
|
+ </el-button>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-form>
|
|
</el-form>
|
|
</ContentWrap>
|
|
</ContentWrap>
|
|
@@ -54,24 +82,28 @@
|
|
<el-col>
|
|
<el-col>
|
|
<el-tabs v-model="activeTab">
|
|
<el-tabs v-model="activeTab">
|
|
<!-- 客户总量分析 -->
|
|
<!-- 客户总量分析 -->
|
|
- <el-tab-pane label="客户总量分析" name="customerSummary" lazy>
|
|
|
|
- <CustomerSummary :query-params="queryParams" ref="customerSummaryRef" />
|
|
|
|
|
|
+ <el-tab-pane label="客户总量分析" lazy name="customerSummary">
|
|
|
|
+ <CustomerSummary ref="customerSummaryRef" :query-params="queryParams" />
|
|
</el-tab-pane>
|
|
</el-tab-pane>
|
|
<!-- 客户跟进次数分析 -->
|
|
<!-- 客户跟进次数分析 -->
|
|
- <el-tab-pane label="客户跟进次数分析" name="followupSummary" lazy>
|
|
|
|
- <CustomerFollowupSummary :query-params="queryParams" ref="followupSummaryRef" />
|
|
|
|
|
|
+ <el-tab-pane label="客户跟进次数分析" lazy name="followUpSummary">
|
|
|
|
+ <CustomerFollowUpSummary ref="followUpSummaryRef" :query-params="queryParams" />
|
|
</el-tab-pane>
|
|
</el-tab-pane>
|
|
<!-- 客户跟进方式分析 -->
|
|
<!-- 客户跟进方式分析 -->
|
|
- <el-tab-pane label="客户跟进方式分析" name="followupType" lazy>
|
|
|
|
- <CustomerFollowupType :query-params="queryParams" ref="followupTypeRef" />
|
|
|
|
|
|
+ <el-tab-pane label="客户跟进方式分析" lazy name="followUpType">
|
|
|
|
+ <CustomerFollowUpType ref="followUpTypeRef" :query-params="queryParams" />
|
|
</el-tab-pane>
|
|
</el-tab-pane>
|
|
<!-- 客户转化率分析 -->
|
|
<!-- 客户转化率分析 -->
|
|
- <el-tab-pane label="客户转化率分析" name="conversionStat" lazy>
|
|
|
|
- <CustomerConversionStat :query-params="queryParams" ref="conversionStatRef" />
|
|
|
|
|
|
+ <el-tab-pane label="客户转化率分析" lazy name="conversionStat">
|
|
|
|
+ <CustomerConversionStat ref="conversionStatRef" :query-params="queryParams" />
|
|
|
|
+ </el-tab-pane>
|
|
|
|
+ <!-- 公海客户分析 -->
|
|
|
|
+ <el-tab-pane label="公海客户分析" lazy name="poolSummary">
|
|
|
|
+ <CustomerPoolSummary ref="customerPoolSummaryRef" :query-params="queryParams" />
|
|
</el-tab-pane>
|
|
</el-tab-pane>
|
|
<!-- 成交周期分析 -->
|
|
<!-- 成交周期分析 -->
|
|
- <el-tab-pane label="成交周期分析" name="dealCycle" lazy>
|
|
|
|
- <CustomerDealCycle :query-params="queryParams" ref="dealCycleRef" />
|
|
|
|
|
|
+ <el-tab-pane label="成交周期分析" lazy name="dealCycle">
|
|
|
|
+ <CustomerDealCycle ref="dealCycleRef" :query-params="queryParams" />
|
|
</el-tab-pane>
|
|
</el-tab-pane>
|
|
</el-tabs>
|
|
</el-tabs>
|
|
</el-col>
|
|
</el-col>
|
|
@@ -81,17 +113,20 @@
|
|
import * as DeptApi from '@/api/system/dept'
|
|
import * as DeptApi from '@/api/system/dept'
|
|
import * as UserApi from '@/api/system/user'
|
|
import * as UserApi from '@/api/system/user'
|
|
import { useUserStore } from '@/store/modules/user'
|
|
import { useUserStore } from '@/store/modules/user'
|
|
|
|
+import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
|
|
import { beginOfDay, defaultShortcuts, endOfDay, formatDate } from '@/utils/formatTime'
|
|
import { beginOfDay, defaultShortcuts, endOfDay, formatDate } from '@/utils/formatTime'
|
|
import { defaultProps, handleTree } from '@/utils/tree'
|
|
import { defaultProps, handleTree } from '@/utils/tree'
|
|
-import CustomerSummary from './components/CustomerSummary.vue'
|
|
|
|
-import CustomerFollowupSummary from './components/CustomerFollowupSummary.vue'
|
|
|
|
-import CustomerFollowupType from './components/CustomerFollowupType.vue'
|
|
|
|
import CustomerConversionStat from './components/CustomerConversionStat.vue'
|
|
import CustomerConversionStat from './components/CustomerConversionStat.vue'
|
|
import CustomerDealCycle from './components/CustomerDealCycle.vue'
|
|
import CustomerDealCycle from './components/CustomerDealCycle.vue'
|
|
|
|
+import CustomerFollowUpSummary from './components/CustomerFollowUpSummary.vue'
|
|
|
|
+import CustomerFollowUpType from './components/CustomerFollowUpType.vue'
|
|
|
|
+import CustomerSummary from './components/CustomerSummary.vue'
|
|
|
|
+import CustomerPoolSummary from './components/CustomerPoolSummary.vue'
|
|
|
|
|
|
defineOptions({ name: 'CrmStatisticsCustomer' })
|
|
defineOptions({ name: 'CrmStatisticsCustomer' })
|
|
|
|
|
|
const queryParams = reactive({
|
|
const queryParams = reactive({
|
|
|
|
+ interval: 2, // WEEK, 周
|
|
deptId: useUserStore().getUser.deptId,
|
|
deptId: useUserStore().getUser.deptId,
|
|
userId: undefined,
|
|
userId: undefined,
|
|
times: [
|
|
times: [
|
|
@@ -104,50 +139,47 @@ const queryParams = reactive({
|
|
const queryFormRef = ref() // 搜索的表单
|
|
const queryFormRef = ref() // 搜索的表单
|
|
const deptList = ref<Tree[]>([]) // 部门树形结构
|
|
const deptList = ref<Tree[]>([]) // 部门树形结构
|
|
const userList = ref<UserApi.UserVO[]>([]) // 全量用户清单
|
|
const userList = ref<UserApi.UserVO[]>([]) // 全量用户清单
|
|
-// 根据选择的部门筛选员工清单
|
|
|
|
|
|
+
|
|
|
|
+/** 根据选择的部门筛选员工清单 */
|
|
const userListByDeptId = computed(() =>
|
|
const userListByDeptId = computed(() =>
|
|
queryParams.deptId
|
|
queryParams.deptId
|
|
? userList.value.filter((u: UserApi.UserVO) => u.deptId === queryParams.deptId)
|
|
? userList.value.filter((u: UserApi.UserVO) => u.deptId === queryParams.deptId)
|
|
: []
|
|
: []
|
|
)
|
|
)
|
|
|
|
|
|
-// 活跃标签
|
|
|
|
-const activeTab = ref('customerSummary')
|
|
|
|
-// 1.客户总量分析
|
|
|
|
-const customerSummaryRef = ref()
|
|
|
|
-// 2.客户跟进次数分析
|
|
|
|
-const followupSummaryRef = ref()
|
|
|
|
-// 3.客户跟进方式分析
|
|
|
|
-const followupTypeRef = ref()
|
|
|
|
-// 4.客户转化率分析
|
|
|
|
-const conversionStatRef = ref()
|
|
|
|
-// 5.公海客户分析
|
|
|
|
-// 缺 crm_owner_record 表
|
|
|
|
-// 6.成交周期分析
|
|
|
|
-const dealCycleRef = ref()
|
|
|
|
|
|
+const activeTab = ref('customerSummary') // 活跃标签
|
|
|
|
+const customerSummaryRef = ref() // 1. 客户总量分析
|
|
|
|
+const followUpSummaryRef = ref() // 2. 客户跟进次数分析
|
|
|
|
+const followUpTypeRef = ref() // 3. 客户跟进方式分析
|
|
|
|
+const conversionStatRef = ref() // 4. 客户转化率分析
|
|
|
|
+const customerPoolSummaryRef = ref() // 5. 客户公海分析
|
|
|
|
+const dealCycleRef = ref() // 6. 成交周期分析
|
|
|
|
|
|
/** 搜索按钮操作 */
|
|
/** 搜索按钮操作 */
|
|
const handleQuery = () => {
|
|
const handleQuery = () => {
|
|
switch (activeTab.value) {
|
|
switch (activeTab.value) {
|
|
- case 'customerSummary':
|
|
|
|
|
|
+ case 'customerSummary': // 客户总量分析
|
|
customerSummaryRef.value?.loadData?.()
|
|
customerSummaryRef.value?.loadData?.()
|
|
break
|
|
break
|
|
- case 'followupSummary':
|
|
|
|
- followupSummaryRef.value?.loadData?.()
|
|
|
|
|
|
+ case 'followUpSummary': // 客户跟进次数分析
|
|
|
|
+ followUpSummaryRef.value?.loadData?.()
|
|
break
|
|
break
|
|
- case 'followupType':
|
|
|
|
- followupTypeRef.value?.loadData?.()
|
|
|
|
|
|
+ case 'followUpType': // 客户跟进方式分析
|
|
|
|
+ followUpTypeRef.value?.loadData?.()
|
|
break
|
|
break
|
|
- case 'conversionStat':
|
|
|
|
|
|
+ case 'conversionStat': // 客户转化率分析
|
|
conversionStatRef.value?.loadData?.()
|
|
conversionStatRef.value?.loadData?.()
|
|
break
|
|
break
|
|
- case 'dealCycle':
|
|
|
|
|
|
+ case 'poolSummary': // 公海客户分析
|
|
|
|
+ customerPoolSummaryRef.value?.loadData?.()
|
|
|
|
+ break
|
|
|
|
+ case 'dealCycle': // 成交周期分析
|
|
dealCycleRef.value?.loadData?.()
|
|
dealCycleRef.value?.loadData?.()
|
|
break
|
|
break
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-// 当 activeTab 改变时,刷新当前活动的 tab
|
|
|
|
|
|
+/** 当 activeTab 改变时,刷新当前活动的 tab */
|
|
watch(activeTab, () => {
|
|
watch(activeTab, () => {
|
|
handleQuery()
|
|
handleQuery()
|
|
})
|
|
})
|
|
@@ -158,7 +190,7 @@ const resetQuery = () => {
|
|
handleQuery()
|
|
handleQuery()
|
|
}
|
|
}
|
|
|
|
|
|
-// 加载部门树
|
|
|
|
|
|
+/** 初始化 */
|
|
onMounted(async () => {
|
|
onMounted(async () => {
|
|
deptList.value = handleTree(await DeptApi.getSimpleDeptList())
|
|
deptList.value = handleTree(await DeptApi.getSimpleDeptList())
|
|
userList.value = handleTree(await UserApi.getSimpleUserList())
|
|
userList.value = handleTree(await UserApi.getSimpleUserList())
|