!380 修改:商业智能-排行榜,合同金额排行和回款金额排行时间条件和接口修改

Merge pull request !380 from 安浩浩/dev
This commit is contained in:
芋道源码 2024-02-02 15:49:13 +00:00 committed by Gitee
commit d6438943b8
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
4 changed files with 52 additions and 20 deletions

View File

@ -14,7 +14,9 @@ export interface BiReceivablesRanKingRespVO {
export interface BiRankReqVO { export interface BiRankReqVO {
deptId: number deptId: number
type: string orderDate: Date[]
startTime: Date
endTime: Date
} }
// 排行 API // 排行 API
@ -22,14 +24,14 @@ export const RankingStatisticsApi = {
// 获得合同排行榜 // 获得合同排行榜
contractAmountRanking: (params: any) => { contractAmountRanking: (params: any) => {
return request.get({ return request.get({
url: '/bi/ranking/contract-ranking', url: '/crm/bi-ranking/contract-ranking',
params params
}) })
}, },
// 获得回款排行榜 // 获得回款排行榜
receivablesAmountRanking: (params: any) => { receivablesAmountRanking: (params: any) => {
return request.get({ return request.get({
url: '/bi/ranking/receivables-ranking', url: '/crm/bi-ranking/receivables-ranking',
params params
}) })
} }

View File

@ -18,14 +18,21 @@
<script setup lang="ts"> <script setup lang="ts">
import { RankingStatisticsApi, BiContractRanKingRespVO, BiRankReqVO } from '@/api/crm/bi/ranking' import { RankingStatisticsApi, BiContractRanKingRespVO, BiRankReqVO } from '@/api/crm/bi/ranking'
import { EChartsOption } from 'echarts' import { EChartsOption } from 'echarts'
import { beginOfDay, endOfDay, formatDate } from '@/utils/formatTime'
/** 合同金额排行 */ /** 合同金额排行 */
defineOptions({ name: 'RankingContractStatistics' }) defineOptions({ name: 'RankingContractStatistics' })
const params = reactive({
deptId: undefined,
startTime: undefined,
endTime: undefined
})
const trendLoading = ref(true) // const trendLoading = ref(true) //
const loading = ref(false) // const loading = ref(false) //
const list = ref<BiContractRanKingRespVO[]>([]) // const list = ref<BiContractRanKingRespVO[]>([]) //
const params = defineProps<{ queryParams: BiRankReqVO }>() // const queryParams = defineProps<{ queryParams: BiRankReqVO }>() //
/** 柱状图配置 横向 */ /** 柱状图配置 横向 */
const barChartOptions = reactive<EChartsOption>({ const barChartOptions = reactive<EChartsOption>({
@ -98,7 +105,10 @@ const barChartOptions = reactive<EChartsOption>({
const getRankingContractStatistics = async () => { const getRankingContractStatistics = async () => {
trendLoading.value = true trendLoading.value = true
loading.value = true loading.value = true
const rankingList = await RankingStatisticsApi.contractAmountRanking(params.queryParams) params.deptId = queryParams.queryParams.deptId
params.startTime = formatDate(beginOfDay(new Date(queryParams.queryParams.orderDate[0])))
params.endTime = formatDate(endOfDay(new Date(queryParams.queryParams.orderDate[1])))
const rankingList = await RankingStatisticsApi.contractAmountRanking(params)
let source = rankingList.map((item: BiContractRanKingRespVO) => { let source = rankingList.map((item: BiContractRanKingRespVO) => {
return { return {
name: item.nickname, name: item.nickname,

View File

@ -16,16 +16,23 @@
</el-card> </el-card>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { RankingStatisticsApi, BiReceivablesRanKingRespVO } from '@/api/crm/bi/ranking' import { RankingStatisticsApi, BiReceivablesRanKingRespVO, BiRankReqVO } from '@/api/crm/bi/ranking'
import { EChartsOption } from 'echarts' import { EChartsOption } from 'echarts'
import { beginOfDay, endOfDay, formatDate } from '@/utils/formatTime'
/** 回款金额排行 */ /** 回款金额排行 */
defineOptions({ name: 'RankingReceivablesStatistics' }) defineOptions({ name: 'RankingReceivablesStatistics' })
const params = reactive({
deptId: undefined,
startTime: undefined,
endTime: undefined
})
const trendLoading = ref(true) // const trendLoading = ref(true) //
const loading = ref(false) // const loading = ref(false) //
const list = ref<BiReceivablesRanKingRespVO[]>([]) // const list = ref<BiReceivablesRanKingRespVO[]>([]) //
const params = defineProps<{ queryParams: any }>() // const queryParams = defineProps<{ queryParams: BiRankReqVO }>() //
/** 柱状图配置 横向 */ /** 柱状图配置 横向 */
const barChartOptions = reactive<EChartsOption>({ const barChartOptions = reactive<EChartsOption>({
@ -98,7 +105,10 @@ const barChartOptions = reactive<EChartsOption>({
const getRankingReceivablesStatistics = async () => { const getRankingReceivablesStatistics = async () => {
trendLoading.value = true trendLoading.value = true
loading.value = true loading.value = true
const rankingList = await RankingStatisticsApi.receivablesAmountRanking(params.queryParams) params.deptId = queryParams.queryParams.deptId
params.startTime = formatDate(beginOfDay(new Date(queryParams.queryParams.orderDate[0])))
params.endTime = formatDate(endOfDay(new Date(queryParams.queryParams.orderDate[1])))
const rankingList = await RankingStatisticsApi.receivablesAmountRanking(params)
let source = rankingList.map((item: BiReceivablesRanKingRespVO) => { let source = rankingList.map((item: BiReceivablesRanKingRespVO) => {
return { return {
name: item.nickname, name: item.nickname,

View File

@ -8,15 +8,17 @@
:inline="true" :inline="true"
label-width="68px" label-width="68px"
> >
<el-form-item label="类型" prop="type"> <el-form-item label="时间" prop="orderDate">
<el-select v-model="queryParams.type" placeholder="请选择类型" clearable class="!w-240px"> <el-date-picker
<el-option v-model="queryParams.orderDate"
v-for="dict in getIntDictOptions(DICT_TYPE.BI_ANALYZE_TYPE)" :shortcuts="defaultShortcuts"
:key="dict.value" class="!w-240px"
:label="dict.label" end-placeholder="结束日期"
:value="dict.value" start-placeholder="开始日期"
type="daterange"
value-format="YYYY-MM-DD HH:mm:ss"
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
/> />
</el-select>
</el-form-item> </el-form-item>
<el-form-item label="归属部门" prop="deptId"> <el-form-item label="归属部门" prop="deptId">
<el-tree-select <el-tree-select
@ -54,15 +56,23 @@
import RankingContractStatistics from './components/RankingContractStatistics.vue' import RankingContractStatistics from './components/RankingContractStatistics.vue'
import { defaultProps, handleTree } from '@/utils/tree' import { defaultProps, handleTree } from '@/utils/tree'
import * as DeptApi from '@/api/system/dept' import * as DeptApi from '@/api/system/dept'
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict' import { beginOfDay, defaultShortcuts, endOfDay, formatDate } from '@/utils/formatTime'
import RankingReceivablesStatistics from '@/views/crm/bi/ranking/components/RankingReceivablesStatistics.vue'
/** 排行榜 */ /** 排行榜 */
defineOptions({ name: 'RankingStatistics' }) defineOptions({ name: 'RankingStatistics' })
const queryParams = reactive({ const queryParams = reactive({
type: 9, // type 9 deptId: undefined,
deptId: null //
orderDate: [
formatDate(beginOfDay(new Date(new Date().getTime() - 3600 * 1000 * 24 * 7))),
formatDate(endOfDay(new Date(new Date().getTime() - 3600 * 1000 * 24)))
],
startTime: undefined,
endTime: undefined
}) })
const queryFormRef = ref() // const queryFormRef = ref() //
const deptList = ref<Tree[]>([]) // const deptList = ref<Tree[]>([]) //
const activeTab = ref('contractAmountRanking') const activeTab = ref('contractAmountRanking')