|
@@ -0,0 +1,127 @@
|
|
|
+<template>
|
|
|
+ <div class="statistics-order-hotspot-subclass-container layout-pd">
|
|
|
+ <!-- 搜索 -->
|
|
|
+ <el-card shadow="never">
|
|
|
+ <el-form :model="state.queryParams" ref="ruleFormRef" @submit.native.prevent inline>
|
|
|
+ <el-form-item prop="TypeId" label="类型">
|
|
|
+ <el-select v-model="state.queryParams.TypeId" placeholder="选择类型" @change="queryList">
|
|
|
+ <el-option label="全部" value="0" />
|
|
|
+ <el-option label="市民" value="1" />
|
|
|
+ <el-option label="企业" value="2" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item prop="crTime" label="时间段">
|
|
|
+ <el-date-picker
|
|
|
+ v-model="state.queryParams.crTime"
|
|
|
+ type="datetimerange"
|
|
|
+ unlink-panels
|
|
|
+ range-separator="至"
|
|
|
+ start-placeholder="开始时间"
|
|
|
+ end-placeholder="结束时间"
|
|
|
+ :shortcuts="shortcuts"
|
|
|
+ @change="queryList"
|
|
|
+ value-format="YYYY-MM-DD[T]HH:mm:ss"
|
|
|
+ :clearable="false"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="primary" @click="queryList" :loading="state.loading"> <SvgIcon name="ele-Search" class="mr5" />查询 </el-button>
|
|
|
+ <el-button @click="resetQuery(ruleFormRef)" class="default-button" :loading="state.loading">
|
|
|
+ <SvgIcon name="ele-Refresh" class="mr5" />重置
|
|
|
+ </el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </el-card>
|
|
|
+ <el-card shadow="never">
|
|
|
+ <!-- 表格 -->
|
|
|
+ <el-table
|
|
|
+ :data="state.tableData"
|
|
|
+ v-loading="state.loading"
|
|
|
+ row-key="hotspotCode"
|
|
|
+ lazy
|
|
|
+ :load="load"
|
|
|
+ :tree-props="{ children: 'children', hasChildren: 'sublevel' }"
|
|
|
+ show-summary
|
|
|
+ >
|
|
|
+ <el-table-column prop="hotspotName" label="热点名称" show-overflow-tooltip></el-table-column>
|
|
|
+ <el-table-column prop="sumCount" label="分类统计" show-overflow-tooltip width="120"> </el-table-column>
|
|
|
+ <template #empty>
|
|
|
+ <Empty />
|
|
|
+ </template>
|
|
|
+ </el-table>
|
|
|
+ </el-card>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+<script setup lang="ts" name="statisticsOrderHotspotSubclass">
|
|
|
+import { computed, onMounted, reactive, ref } from 'vue';
|
|
|
+import { ElButton, FormInstance } from 'element-plus';
|
|
|
+import { throttle } from '@/utils/tools';
|
|
|
+import { departmentHotSmall } from '@/api/statistics/order';
|
|
|
+import { shortcuts } from '@/utils/constants';
|
|
|
+import dayjs from 'dayjs';
|
|
|
+// 定义变量内容
|
|
|
+const ruleFormRef = ref<RefType>(); // 表单ref
|
|
|
+const state = reactive(<any>{
|
|
|
+ queryParams: {
|
|
|
+ // 查询条件
|
|
|
+ TypeId: '0', // 关键词
|
|
|
+ time: dayjs(new Date()).format('YYYY-MM-DD'), // 时间默认今天
|
|
|
+ crTime: [dayjs(new Date()).startOf('date').format('YYYY-MM-DD[T]HH:mm:ss'), dayjs(new Date()).endOf('date').format('YYYY-MM-DD[T]HH:mm:ss')], // 时间默认今天开始到今天结束
|
|
|
+ },
|
|
|
+ tableData: [], //表单
|
|
|
+ loading: false, // 加载
|
|
|
+ total: 0, // 总数
|
|
|
+});
|
|
|
+/** 获取列表 */
|
|
|
+const queryList = throttle(() => {
|
|
|
+ state.loading = true;
|
|
|
+ let StartDate = null;
|
|
|
+ let EndDate = null;
|
|
|
+ if (state.queryParams?.crTime) {
|
|
|
+ StartDate = state.queryParams?.crTime[0];
|
|
|
+ EndDate = state.queryParams?.crTime[1];
|
|
|
+ }
|
|
|
+ const request = {
|
|
|
+ TypeId: state.queryParams.TypeId,
|
|
|
+ StartDate,
|
|
|
+ EndDate,
|
|
|
+ };
|
|
|
+ departmentHotSmall(request)
|
|
|
+ .then((res: any) => {
|
|
|
+ state.tableData = res.result ?? [];
|
|
|
+ state.loading = false;
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ state.loading = false;
|
|
|
+ });
|
|
|
+}, 300);
|
|
|
+/** 重置按钮操作 */
|
|
|
+const resetQuery = throttle((formEl: FormInstance | undefined) => {
|
|
|
+ if (!formEl) return;
|
|
|
+ formEl.resetFields();
|
|
|
+ queryList();
|
|
|
+}, 300);
|
|
|
+// 懒加载
|
|
|
+const load = (row: any, treeNode: unknown, resolve: (date: any[]) => void) => {
|
|
|
+ let StartDate = null;
|
|
|
+ let EndDate = null;
|
|
|
+ if (state.queryParams?.crTime) {
|
|
|
+ StartDate = state.queryParams?.crTime[0];
|
|
|
+ EndDate = state.queryParams?.crTime[1];
|
|
|
+ }
|
|
|
+ const request = {
|
|
|
+ TypeId: state.queryParams.TypeId,
|
|
|
+ StartDate,
|
|
|
+ EndDate,
|
|
|
+ HotspotCode: row.hotspotCode,
|
|
|
+ };
|
|
|
+ departmentHotSmall(request)
|
|
|
+ .then((res: any) => {
|
|
|
+ resolve(res.result ?? []);
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
+};
|
|
|
+onMounted(() => {
|
|
|
+ queryList();
|
|
|
+});
|
|
|
+</script>
|