|
@@ -1,51 +1,32 @@
|
|
|
<template>
|
|
|
- <div class="statistics-order-hotspot-accept-container layout-padding">
|
|
|
- <div class="layout-padding-auto layout-padding-view pd20">
|
|
|
- <el-tabs v-model="state.queryParams.HotspotLevel" @tab-change="handleQuery">
|
|
|
- <el-tab-pane name="1" label="第一级别"></el-tab-pane>
|
|
|
- <el-tab-pane name="2" label="第二级别"></el-tab-pane>
|
|
|
- <el-tab-pane name="3" label="第三级别"></el-tab-pane>
|
|
|
- <el-tab-pane name="4" label="第四级别"></el-tab-pane>
|
|
|
- </el-tabs>
|
|
|
- <el-form :model="state.queryParams" ref="ruleFormRef" @submit.native.prevent inline class="search-form mb10">
|
|
|
+ <div class="statistics-order-hotspot-accept-container layout-padding">
|
|
|
+ <div class="layout-padding-auto layout-padding-view pd20">
|
|
|
+ <el-tabs v-model="state.queryParams.HotspotLevel" @tab-change="handleQuery">
|
|
|
+ <el-tab-pane name="1" label="第一级别"></el-tab-pane>
|
|
|
+ <el-tab-pane name="2" label="第二级别"></el-tab-pane>
|
|
|
+ <el-tab-pane name="3" label="第三级别"></el-tab-pane>
|
|
|
+ <el-tab-pane name="4" label="第四级别"></el-tab-pane>
|
|
|
+ </el-tabs>
|
|
|
+ <el-form :model="state.queryParams" ref="ruleFormRef" @submit.native.prevent inline class="search-form mb10">
|
|
|
<el-form-item prop="crTime">
|
|
|
- <statistical-time v-model="state.queryParams.crTime" @change="handleQuery" ref="statisticalTimeRef" :disabled="state.loading"/>
|
|
|
+ <statistical-time v-model="state.queryParams.crTime" @change="handleQuery" ref="statisticalTimeRef" :disabled="state.loading" />
|
|
|
</el-form-item>
|
|
|
- <el-form-item label-width="0">
|
|
|
- <el-button type="primary" @click="handleQuery" :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>
|
|
|
- <div class="tool-buttons">
|
|
|
- <el-button circle @click="queryList" title="刷新表格" :disabled="state.loading">
|
|
|
- <SvgIcon name="ele-Refresh" />
|
|
|
- </el-button>
|
|
|
- <el-button circle @click="exportAll" title="导出全部" :disabled="exportLoading">
|
|
|
- <SvgIcon name="iconfont icon-export" />
|
|
|
- </el-button>
|
|
|
- <el-button v-if="exportLoading" :loading="exportLoading">导出中,请稍后。。。</el-button>
|
|
|
- </div>
|
|
|
- </el-form>
|
|
|
- <!-- 表格 -->
|
|
|
- <el-auto-resizer class="table" v-loading="state.loading">
|
|
|
- <template #default="{ height, width }">
|
|
|
- <el-table-v2
|
|
|
- :columns="columns"
|
|
|
- :data="state.tableData"
|
|
|
- fixed
|
|
|
- :width="width"
|
|
|
- :height="height - 5"
|
|
|
- ref="virtuallyTableRef"
|
|
|
- :scrollbar-always-on="true"
|
|
|
- :row-height="40"
|
|
|
- :header-height="40"
|
|
|
- >
|
|
|
- </el-table-v2>
|
|
|
- </template>
|
|
|
- </el-auto-resizer>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
+ <el-form-item label-width="0">
|
|
|
+ <el-button type="primary" @click="handleQuery" :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>
|
|
|
+ <div style="overflow: hidden; width: 100%; height: 100%; flex: 1">
|
|
|
+ <vxe-grid v-bind="gridOptions" ref="tableRef">
|
|
|
+ <template #toolbar_tools>
|
|
|
+ <VxeButton title="导出全部" circle class="mr10" @click="exportAll"><SvgIcon name="iconfont icon-export" /></VxeButton>
|
|
|
+ </template>
|
|
|
+ </vxe-grid>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
<script setup lang="tsx" name="statisticsOrderHotspotAccept">
|
|
|
import { onMounted, reactive, ref, defineAsyncComponent } from 'vue';
|
|
@@ -55,8 +36,9 @@ import Other from '@/utils/other';
|
|
|
import { statisticsOrderHotAccept, statisticsOrderHotAcceptExport } from '@/api/statistics/order';
|
|
|
import { useRouter } from 'vue-router';
|
|
|
import { downloadFileByStream } from '@/utils/tools';
|
|
|
+import { VxeButton, VxeUI } from 'vxe-pc-ui';
|
|
|
+import XEUtils from 'xe-utils';
|
|
|
|
|
|
-const TextTooltip = defineAsyncComponent(() => import('@/components/TextTooltip/index.vue'));
|
|
|
const StatisticalTime = defineAsyncComponent(() => import('@/components/StatisticalTime/index.vue')); // 日期类型选择组件
|
|
|
|
|
|
// 表格配置项
|
|
@@ -64,298 +46,323 @@ const columns = ref<any[]>([]);
|
|
|
// 定义变量内容
|
|
|
const ruleFormRef = ref<RefType>(); // 表单ref
|
|
|
const state = reactive<any>({
|
|
|
- queryParams: {
|
|
|
- // 查询条件
|
|
|
- HotspotLevel: '1',
|
|
|
- crTime: defaultDate, //
|
|
|
- StartTime: null,
|
|
|
- EndTime: null,
|
|
|
- },
|
|
|
- tableData: [], //表单
|
|
|
- loading: false, // 加载
|
|
|
- total: 0, // 总数
|
|
|
- callForwardingSource: [],
|
|
|
+ queryParams: {
|
|
|
+ // 查询条件
|
|
|
+ HotspotLevel: '1',
|
|
|
+ crTime: defaultDate, //
|
|
|
+ StartTime: null,
|
|
|
+ EndTime: null,
|
|
|
+ },
|
|
|
+ tableData: [], //表单
|
|
|
+ loading: false, // 加载
|
|
|
+ total: 0, // 总数
|
|
|
+ callForwardingSource: [],
|
|
|
});
|
|
|
/** 搜索按钮操作 */
|
|
|
-const virtuallyTableRef = ref();
|
|
|
const handleQuery = () => {
|
|
|
- // state.queryParams.PageIndex = 1;
|
|
|
- queryList();
|
|
|
+ // state.queryParams.PageIndex = 1;
|
|
|
+ queryList();
|
|
|
};
|
|
|
-/** 获取列表 */
|
|
|
const requestParams = ref<EmptyObjectType>({});
|
|
|
+const gridOptions = reactive<any>({
|
|
|
+ loading: false,
|
|
|
+ border: true,
|
|
|
+ showOverflow: true,
|
|
|
+ printConfig: {},
|
|
|
+ columnConfig: {
|
|
|
+ resizable: true,
|
|
|
+ },
|
|
|
+ scrollY: {
|
|
|
+ enabled: true,
|
|
|
+ gt: 20,
|
|
|
+ mode: 'wheel',
|
|
|
+ },
|
|
|
+ toolbarConfig: {
|
|
|
+ zoom: true,
|
|
|
+ custom: true,
|
|
|
+ refresh: {
|
|
|
+ queryMethod: () => {
|
|
|
+ queryList();
|
|
|
+ },
|
|
|
+ },
|
|
|
+ slots: {
|
|
|
+ tools: 'toolbar_tools',
|
|
|
+ },
|
|
|
+ },
|
|
|
+ showHeaderOverflow: true,
|
|
|
+ customConfig: {
|
|
|
+ storage: true,
|
|
|
+ },
|
|
|
+ showFooter: true,
|
|
|
+ footerMethod: ({ columns, data }) => {
|
|
|
+ return [
|
|
|
+ columns.map((column: any, columnIndex: number) => {
|
|
|
+ if (columnIndex === 0) {
|
|
|
+ return '合计';
|
|
|
+ }
|
|
|
+ return XEUtils.sum(data, column.property);
|
|
|
+ }),
|
|
|
+ ];
|
|
|
+ },
|
|
|
+ id: 'statisticsOrderHotspotAccept',
|
|
|
+ rowConfig: { isHover: true, height: 30, isCurrent: true, useKey: true },
|
|
|
+ height: 'auto',
|
|
|
+ columns: [],
|
|
|
+ data: [],
|
|
|
+});
|
|
|
+/** 获取列表 */
|
|
|
const queryList = async () => {
|
|
|
- state.loading = true;
|
|
|
- try {
|
|
|
- requestParams.value = Other.deepClone(state.queryParams);
|
|
|
- requestParams.value.StartTime = state.queryParams.crTime === null ? null : state.queryParams.crTime[0];
|
|
|
- requestParams.value.EndTime = state.queryParams.crTime === null ? null : state.queryParams.crTime[1];
|
|
|
- Reflect.deleteProperty(requestParams.value, 'crTime');
|
|
|
- const { result } = await statisticsOrderHotAccept(requestParams.value);
|
|
|
- columns.value = result.areaList.map((item: any) => {
|
|
|
- return {
|
|
|
- key: item.dicDataValue,
|
|
|
- dataKey: item.dicDataValue,
|
|
|
- title: item.dicDataName,
|
|
|
- width: 100,
|
|
|
- align: 'center',
|
|
|
- cellRenderer: (data: any) => {
|
|
|
- return (
|
|
|
- <>
|
|
|
- {data.rowData.HotspotName1 !== '合计' ? (
|
|
|
- <el-button type="primary" link onClick={() => linkDetail(data)}>
|
|
|
- {data.rowData[item.dicDataValue]}
|
|
|
- </el-button>
|
|
|
- ) : (
|
|
|
- <span>{data.rowData[item.dicDataValue]}</span>
|
|
|
- )}
|
|
|
- </>
|
|
|
- );
|
|
|
- },
|
|
|
- };
|
|
|
- });
|
|
|
- state.tableData = result.data;
|
|
|
- state.tableData = state.tableData.map((item: any) => {
|
|
|
- // 取第一级名称
|
|
|
- item.HotspotName1 = item.HotspotName?.split('-')[0] ?? '';
|
|
|
- // 取第二级名称
|
|
|
- item.HotspotName2 = item.HotspotName?.split('-')[1] ?? '';
|
|
|
- // 取第三级名称
|
|
|
- item.HotspotName3 = item.HotspotName?.split('-')[2] ?? '';
|
|
|
- // 取第四级名称
|
|
|
- item.HotspotName4 = item.HotspotName?.split('-')[3] ?? '';
|
|
|
- return { ...item };
|
|
|
- });
|
|
|
- switch (state.queryParams.HotspotLevel) {
|
|
|
- case '1':
|
|
|
- // 分类级别
|
|
|
- columns.value.unshift({
|
|
|
- key: 'HotspotName1',
|
|
|
- dataKey: 'HotspotName1',
|
|
|
- title: `一级热点`,
|
|
|
- width: 150,
|
|
|
- align: 'center',
|
|
|
- cellRenderer: (data: any) => {
|
|
|
- return <TextTooltip content={data.rowData.HotspotName1} effect="dark" placement="top"></TextTooltip>;
|
|
|
- },
|
|
|
- });
|
|
|
- break;
|
|
|
- case '2':
|
|
|
- columns.value.unshift(
|
|
|
- {
|
|
|
- key: 'HotspotName1',
|
|
|
- dataKey: 'HotspotName1',
|
|
|
- title: `一级热点`,
|
|
|
- width: 150,
|
|
|
- align: 'center',
|
|
|
- cellRenderer: (data: any) => {
|
|
|
- return <TextTooltip content={data.rowData.HotspotName1} effect="dark" placement="top"></TextTooltip>;
|
|
|
- },
|
|
|
- },
|
|
|
- {
|
|
|
- key: 'HotspotName2',
|
|
|
- dataKey: 'HotspotName2',
|
|
|
- title: `二级热点`,
|
|
|
- width: 150,
|
|
|
- align: 'center',
|
|
|
- cellRenderer: (data: any) => {
|
|
|
- return <TextTooltip content={data.rowData.HotspotName2} effect="dark" placement="top"></TextTooltip>;
|
|
|
- },
|
|
|
- }
|
|
|
- );
|
|
|
- break;
|
|
|
- case '3':
|
|
|
- columns.value.unshift(
|
|
|
- {
|
|
|
- key: 'HotspotName1',
|
|
|
- dataKey: 'HotspotName1',
|
|
|
- title: `一级热点`,
|
|
|
- width: 150,
|
|
|
- align: 'center',
|
|
|
- cellRenderer: (data: any) => {
|
|
|
- return <TextTooltip content={data.rowData.HotspotName1} effect="dark" placement="top"></TextTooltip>;
|
|
|
- },
|
|
|
- },
|
|
|
- {
|
|
|
- key: 'HotspotName2',
|
|
|
- dataKey: 'HotspotName2',
|
|
|
- title: `二级热点`,
|
|
|
- width: 150,
|
|
|
- align: 'center',
|
|
|
- cellRenderer: (data: any) => {
|
|
|
- return <TextTooltip content={data.rowData.HotspotName2} effect="dark" placement="top"></TextTooltip>;
|
|
|
- },
|
|
|
- },
|
|
|
- {
|
|
|
- key: 'HotspotName3',
|
|
|
- dataKey: 'HotspotName3',
|
|
|
- title: `三级热点`,
|
|
|
- width: 150,
|
|
|
- align: 'center',
|
|
|
- cellRenderer: (data: any) => {
|
|
|
- return <TextTooltip content={data.rowData.HotspotName3} effect="dark" placement="top"></TextTooltip>;
|
|
|
- },
|
|
|
- }
|
|
|
- );
|
|
|
- break;
|
|
|
- case '4':
|
|
|
- columns.value.unshift(
|
|
|
- {
|
|
|
- key: 'HotspotName1',
|
|
|
- dataKey: 'HotspotName1',
|
|
|
- title: `一级热点`,
|
|
|
- width: 150,
|
|
|
- align: 'center',
|
|
|
- cellRenderer: (data: any) => {
|
|
|
- return <TextTooltip content={data.rowData.HotspotName1} effect="dark" placement="top"></TextTooltip>;
|
|
|
- },
|
|
|
- },
|
|
|
- {
|
|
|
- key: 'HotspotName2',
|
|
|
- dataKey: 'HotspotName2',
|
|
|
- title: `二级热点`,
|
|
|
- width: 150,
|
|
|
- align: 'center',
|
|
|
- cellRenderer: (data: any) => {
|
|
|
- return <TextTooltip content={data.rowData.HotspotName2} effect="dark" placement="top"></TextTooltip>;
|
|
|
- },
|
|
|
- },
|
|
|
- {
|
|
|
- key: 'HotspotName3',
|
|
|
- dataKey: 'HotspotName3',
|
|
|
- title: `三级热点`,
|
|
|
- width: 150,
|
|
|
- align: 'center',
|
|
|
- cellRenderer: (data: any) => {
|
|
|
- return <TextTooltip content={data.rowData.HotspotName3} effect="dark" placement="top"></TextTooltip>;
|
|
|
- },
|
|
|
- },
|
|
|
- {
|
|
|
- key: 'HotspotName4',
|
|
|
- dataKey: 'HotspotName4',
|
|
|
- title: `四级热点`,
|
|
|
- width: 150,
|
|
|
- align: 'center',
|
|
|
- cellRenderer: (data: any) => {
|
|
|
- return <TextTooltip content={data.rowData.HotspotName4} effect="dark" placement="top"></TextTooltip>;
|
|
|
- },
|
|
|
- }
|
|
|
- );
|
|
|
- break;
|
|
|
- default:
|
|
|
- break;
|
|
|
- }
|
|
|
+ state.loading = true;
|
|
|
+ gridOptions.loading = true;
|
|
|
+ try {
|
|
|
+ requestParams.value = Other.deepClone(state.queryParams);
|
|
|
+ requestParams.value.StartTime = state.queryParams.crTime === null ? null : state.queryParams.crTime[0];
|
|
|
+ requestParams.value.EndTime = state.queryParams.crTime === null ? null : state.queryParams.crTime[1];
|
|
|
+ Reflect.deleteProperty(requestParams.value, 'crTime');
|
|
|
+ const { result } = await statisticsOrderHotAccept(requestParams.value);
|
|
|
+ let columns = result.areaList.map((item: any) => {
|
|
|
+ return {
|
|
|
+ key: item.dicDataValue,
|
|
|
+ dataKey: item.dicDataValue,
|
|
|
+ title: item.dicDataName,
|
|
|
+ field: item.dicDataValue,
|
|
|
+ minWidth: 100,
|
|
|
+ align: 'center',
|
|
|
+ sortable: true,
|
|
|
+ slots: {
|
|
|
+ default(scope: any) {
|
|
|
+ return (
|
|
|
+ <>
|
|
|
+ {scope.row.HotspotName1 !== '合计' ? (
|
|
|
+ <el-button type="primary" link onClick={() => linkDetail(scope)}>
|
|
|
+ {scope.row[item.dicDataValue] ? scope.row[item.dicDataValue] : 0}
|
|
|
+ </el-button>
|
|
|
+ ) : (
|
|
|
+ <span>{scope.row[item.dicDataValue]}</span>
|
|
|
+ )}
|
|
|
+ </>
|
|
|
+ );
|
|
|
+ },
|
|
|
+ },
|
|
|
+ };
|
|
|
+ });
|
|
|
+ let tableData = result.data;
|
|
|
+ tableData.map((item: any) => {
|
|
|
+ // 取第一级名称
|
|
|
+ item.HotspotName1 = item.HotspotName?.split('-')[0] ?? '';
|
|
|
+ // 取第二级名称
|
|
|
+ item.HotspotName2 = item.HotspotName?.split('-')[1] ?? '';
|
|
|
+ // 取第三级名称
|
|
|
+ item.HotspotName3 = item.HotspotName?.split('-')[2] ?? '';
|
|
|
+ // 取第四级名称
|
|
|
+ item.HotspotName4 = item.HotspotName?.split('-')[3] ?? '';
|
|
|
+ return { ...item };
|
|
|
+ });
|
|
|
+ switch (state.queryParams.HotspotLevel) {
|
|
|
+ case '1':
|
|
|
+ // 分类级别
|
|
|
+ columns.unshift({
|
|
|
+ key: 'HotspotName1',
|
|
|
+ dataKey: 'HotspotName1',
|
|
|
+ title: `一级热点`,
|
|
|
+ field: 'HotspotName1',
|
|
|
+ width: 150,
|
|
|
+ align: 'center',
|
|
|
+ });
|
|
|
+ break;
|
|
|
+ case '2':
|
|
|
+ columns.unshift(
|
|
|
+ {
|
|
|
+ key: 'HotspotName1',
|
|
|
+ dataKey: 'HotspotName1',
|
|
|
+ title: `一级热点`,
|
|
|
+ field: 'HotspotName1',
|
|
|
+ width: 150,
|
|
|
+ align: 'center',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ key: 'HotspotName2',
|
|
|
+ dataKey: 'HotspotName2',
|
|
|
+ title: `二级热点`,
|
|
|
+ width: 150,
|
|
|
+ align: 'center',
|
|
|
+ field: 'HotspotName2',
|
|
|
+ }
|
|
|
+ );
|
|
|
+ break;
|
|
|
+ case '3':
|
|
|
+ columns.unshift(
|
|
|
+ {
|
|
|
+ key: 'HotspotName1',
|
|
|
+ dataKey: 'HotspotName1',
|
|
|
+ title: `一级热点`,
|
|
|
+ width: 150,
|
|
|
+ align: 'center',
|
|
|
+ field: 'HotspotName1',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ key: 'HotspotName2',
|
|
|
+ dataKey: 'HotspotName2',
|
|
|
+ title: `二级热点`,
|
|
|
+ width: 150,
|
|
|
+ align: 'center',
|
|
|
+ field: 'HotspotName2',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ key: 'HotspotName3',
|
|
|
+ dataKey: 'HotspotName3',
|
|
|
+ title: `三级热点`,
|
|
|
+ width: 150,
|
|
|
+ align: 'center',
|
|
|
+ field: 'HotspotName3',
|
|
|
+ }
|
|
|
+ );
|
|
|
+ break;
|
|
|
+ case '4':
|
|
|
+ columns.unshift(
|
|
|
+ {
|
|
|
+ key: 'HotspotName1',
|
|
|
+ dataKey: 'HotspotName1',
|
|
|
+ title: `一级热点`,
|
|
|
+ width: 150,
|
|
|
+ align: 'center',
|
|
|
+ field: 'HotspotName1',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ key: 'HotspotName2',
|
|
|
+ dataKey: 'HotspotName2',
|
|
|
+ field: 'HotspotName2',
|
|
|
+ title: `二级热点`,
|
|
|
+ width: 150,
|
|
|
+ align: 'center',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ key: 'HotspotName3',
|
|
|
+ dataKey: 'HotspotName3',
|
|
|
+ field: 'HotspotName3',
|
|
|
+ title: `三级热点`,
|
|
|
+ width: 150,
|
|
|
+ align: 'center',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ key: 'HotspotName4',
|
|
|
+ dataKey: 'HotspotName4',
|
|
|
+ field: 'HotspotName4',
|
|
|
+ title: `四级热点`,
|
|
|
+ width: 150,
|
|
|
+ align: 'center',
|
|
|
+ }
|
|
|
+ );
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
|
|
|
- // 计算横轴小计
|
|
|
- state.tableData = result.data.map((item: any) => {
|
|
|
- let subtotal = 0;
|
|
|
- for (let i of result.areaList) {
|
|
|
- const itemI = item[i.dicDataValue] ?? 0;
|
|
|
- subtotal += itemI;
|
|
|
- }
|
|
|
- return {
|
|
|
- ...item,
|
|
|
- subtotal,
|
|
|
- };
|
|
|
- });
|
|
|
- columns.value.push({
|
|
|
- align: 'center',
|
|
|
- key: 'subtotal',
|
|
|
- dataKey: 'subtotal',
|
|
|
- title: '小计',
|
|
|
- width: 100,
|
|
|
- });
|
|
|
- if (result.data.length) {
|
|
|
- const totals = {};
|
|
|
- // 计算纵轴合计
|
|
|
- state.tableData.forEach((row) => {
|
|
|
- Object.keys(row).forEach((key) => {
|
|
|
- // 获取每个对象的键名进行遍历
|
|
|
- if (!totals[key]) {
|
|
|
- totals[key] = 0;
|
|
|
- }
|
|
|
- if (typeof row[key] === 'number') {
|
|
|
- totals[key] += Number(row[key]);
|
|
|
- } else {
|
|
|
- totals[key] = '';
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
- totals.HotspotName1 = '合计';
|
|
|
- state.tableData.push({ ...totals });
|
|
|
- state.tableData = state.tableData.filter((item) => item.HotspotName1); // 筛选掉空对象
|
|
|
- }
|
|
|
- state.loading = false;
|
|
|
- } catch (e) {
|
|
|
- state.loading = false;
|
|
|
- console.log(e);
|
|
|
- }
|
|
|
+ // 计算横轴小计
|
|
|
+ tableData = result.data.map((item: any) => {
|
|
|
+ let subtotal = 0;
|
|
|
+ for (let i of result.areaList) {
|
|
|
+ const itemI = item[i.dicDataValue] ?? 0;
|
|
|
+ subtotal += itemI;
|
|
|
+ }
|
|
|
+ return {
|
|
|
+ ...item,
|
|
|
+ subtotal,
|
|
|
+ };
|
|
|
+ });
|
|
|
+ columns.push({
|
|
|
+ align: 'center',
|
|
|
+ key: 'subtotal',
|
|
|
+ dataKey: 'subtotal',
|
|
|
+ field: 'subtotal',
|
|
|
+ title: '小计',
|
|
|
+ sortable: true,
|
|
|
+ width: 100,
|
|
|
+ });
|
|
|
+ if (result.data.length) {
|
|
|
+ tableData = tableData.filter((item) => item.HotspotName1); // 筛选掉空对象
|
|
|
+ }
|
|
|
+ gridOptions.data = tableData;
|
|
|
+ gridOptions.columns = columns;
|
|
|
+ gridOptions.loading = false;
|
|
|
+ state.loading = false;
|
|
|
+ } catch (e) {
|
|
|
+ state.loading = false;
|
|
|
+ gridOptions.loading = false;
|
|
|
+ console.log(e);
|
|
|
+ }
|
|
|
};
|
|
|
/** 重置按钮操作 */
|
|
|
const statisticalTimeRef = ref<RefType>();
|
|
|
const resetQuery = (formEl: FormInstance | undefined) => {
|
|
|
- if (!formEl) return;
|
|
|
- formEl.resetFields();
|
|
|
+ if (!formEl) return;
|
|
|
+ formEl.resetFields();
|
|
|
statisticalTimeRef.value.reset();
|
|
|
- queryList();
|
|
|
+ queryList();
|
|
|
};
|
|
|
// 查看列表明细
|
|
|
const router = useRouter();
|
|
|
-const linkDetail = (data:any) => {
|
|
|
- router.push({
|
|
|
- path: '/statistics/order/detailHotspotArea',
|
|
|
- query: {
|
|
|
- AcceptTypeCode: data.column.dataKey,
|
|
|
- HotspotId: data.rowData.HotspotId,
|
|
|
- StartTime: requestParams.value.StartTime,
|
|
|
- EndTime: requestParams.value.EndTime,
|
|
|
- type: 'hotspotAccept',
|
|
|
- tagsViewName:`${data.rowData.HotspotName}-${data.column.title}`
|
|
|
- },
|
|
|
- });
|
|
|
+const linkDetail = (data: any) => {
|
|
|
+ router.push({
|
|
|
+ path: '/statistics/order/detailHotspotArea',
|
|
|
+ query: {
|
|
|
+ AcceptTypeCode: data.column.field,
|
|
|
+ HotspotId: data.row.HotspotId,
|
|
|
+ StartTime: requestParams.value.StartTime,
|
|
|
+ EndTime: requestParams.value.EndTime,
|
|
|
+ type: 'hotspotAccept',
|
|
|
+ tagsViewName: `${data.row.HotspotName}-${data.column.title}`,
|
|
|
+ },
|
|
|
+ });
|
|
|
};
|
|
|
-const exportLoading = ref(false);
|
|
|
// 导出
|
|
|
+const tableRef = ref();
|
|
|
const exportAll = () => {
|
|
|
- ElMessageBox.confirm(`您确定要导出全部数据,是否继续?`, '提示', {
|
|
|
- confirmButtonText: '确认',
|
|
|
- cancelButtonText: '取消',
|
|
|
- type: 'warning',
|
|
|
- draggable: true,
|
|
|
- cancelButtonClass: 'default-button',
|
|
|
- autofocus: false,
|
|
|
- })
|
|
|
- .then(() => {
|
|
|
- exportLoading.value = true;
|
|
|
- const AddColumnName = columns.value.map((item: any) => item.title).filter(item => !['一级热点', '二级热点', '三级热点', '四级热点'].includes(item))
|
|
|
- AddColumnName.unshift('热点分类');
|
|
|
- const specialRequest = {
|
|
|
- ...requestParams.value,
|
|
|
- AddColumnName
|
|
|
- };
|
|
|
- statisticsOrderHotAcceptExport(specialRequest)
|
|
|
- .then((res: any) => {
|
|
|
- downloadFileByStream(res);
|
|
|
- exportLoading.value = false;
|
|
|
- })
|
|
|
- .catch((e) => {
|
|
|
- console.log(`导出失败:${e}`);
|
|
|
- exportLoading.value = false;
|
|
|
- });
|
|
|
- })
|
|
|
- .catch(() => {});
|
|
|
+ const columns = tableRef.value.getColumns();
|
|
|
+ ElMessageBox.confirm(`您确定要导出全部数据,是否继续?`, '提示', {
|
|
|
+ confirmButtonText: '确认',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning',
|
|
|
+ draggable: true,
|
|
|
+ cancelButtonClass: 'default-button',
|
|
|
+ autofocus: false,
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ const AddColumnName = columns
|
|
|
+ .map((item: any) => item.title)
|
|
|
+ .filter((item: any) => !['一级热点', '二级热点', '三级热点', '四级热点'].includes(item));
|
|
|
+ AddColumnName.unshift('热点分类');
|
|
|
+ const specialRequest = {
|
|
|
+ ...requestParams.value,
|
|
|
+ AddColumnName,
|
|
|
+ };
|
|
|
+ VxeUI.modal.message({
|
|
|
+ content: `导出中,请稍等`,
|
|
|
+ status: 'loading',
|
|
|
+ id: 'exportAll',
|
|
|
+ duration: -1,
|
|
|
+ });
|
|
|
+ statisticsOrderHotAcceptExport(specialRequest)
|
|
|
+ .then((res: any) => {
|
|
|
+ downloadFileByStream(res);
|
|
|
+ VxeUI.modal.close('exportAll');
|
|
|
+ VxeUI.modal.message({
|
|
|
+ content: `导出成功`,
|
|
|
+ status: 'success',
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .catch((e) => {
|
|
|
+ console.log(`导出失败:${e}`);
|
|
|
+ VxeUI.modal.close('exportAll');
|
|
|
+ VxeUI.modal.message({
|
|
|
+ content: `导出失败`,
|
|
|
+ status: 'error',
|
|
|
+ });
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
};
|
|
|
onMounted(() => {
|
|
|
- queryList();
|
|
|
+ queryList();
|
|
|
});
|
|
|
</script>
|
|
|
-<style lang="scss" scoped>
|
|
|
-.search-form {
|
|
|
- position: relative;
|
|
|
- .tool-buttons {
|
|
|
- position: absolute;
|
|
|
- right: 0;
|
|
|
- top: 5px;
|
|
|
- }
|
|
|
-}
|
|
|
-</style>
|