|
@@ -1,20 +1,28 @@
|
|
<script lang="ts" setup>
|
|
<script lang="ts" setup>
|
|
-import { defineProps, onMounted, reactive, ref, watch, inject, Ref } from 'vue';
|
|
|
|
-import { getMainData, getMonthlyData } from '/@/views/reportManage/dataCenter/api';
|
|
|
|
|
|
+import { reactive, ref } from 'vue';
|
|
|
|
+import { getMonthlyData } from '/@/views/reportManage/dataCenter/api';
|
|
|
|
+import { getLineData, getLineForMonth, getLineForWeek, } from '/src/views/reportManage/dataCenter/api';
|
|
import { universal } from '../../../utils/columns';
|
|
import { universal } from '../../../utils/columns';
|
|
-
|
|
|
|
-const props = defineProps({
|
|
|
|
- taskIds: Object,
|
|
|
|
- monthCurrentDate: Object,
|
|
|
|
|
|
+import MonthlyDatePicker from '/src/views/reportManage/dataCenter/combinedDisplay/components/monthDatePicker/index.vue';
|
|
|
|
+import { monthCompareMetricsEnum } from '/src/views/reportManage/dataCenter/utils/enum';
|
|
|
|
+import chartDateTendency
|
|
|
|
+ from '/src/views/reportManage/dataCenter/combinedDisplay/components/chartDateTendency/index.vue';
|
|
|
|
+import Selector from '/@/views/reportManage/dataCenter/normalDisplay/components/Selector/index.vue';
|
|
|
|
+
|
|
|
|
+const selectorRef = ref(null);
|
|
|
|
+const taskIds = ref({});
|
|
|
|
+const monthCurrentDate = ref({});
|
|
|
|
+
|
|
|
|
+const monthQueryParams = ref({
|
|
|
|
+ taskIds,
|
|
|
|
+ monthCurrentDate,
|
|
});
|
|
});
|
|
|
|
|
|
const tableColumns = ref([]);
|
|
const tableColumns = ref([]);
|
|
const tableData = ref([]);
|
|
const tableData = ref([]);
|
|
|
|
|
|
-// const taskIds = ref(props.taskIds);
|
|
|
|
const monthStartDate = ref(null);
|
|
const monthStartDate = ref(null);
|
|
const monthEndDate = ref(null);
|
|
const monthEndDate = ref(null);
|
|
-const taskIdsAvailable = ref(false);
|
|
|
|
|
|
|
|
const gridOptions = reactive({
|
|
const gridOptions = reactive({
|
|
border: 'inner',
|
|
border: 'inner',
|
|
@@ -25,7 +33,7 @@ const gridOptions = reactive({
|
|
id: 'monthlyCustomStorage',
|
|
id: 'monthlyCustomStorage',
|
|
customConfig: {
|
|
customConfig: {
|
|
storage: {
|
|
storage: {
|
|
- visible:true,
|
|
|
|
|
|
+ visible: true,
|
|
}
|
|
}
|
|
},
|
|
},
|
|
columnConfig: {
|
|
columnConfig: {
|
|
@@ -54,7 +62,7 @@ const gridOptions = reactive({
|
|
|
|
|
|
// 分页
|
|
// 分页
|
|
const gridEvents = {
|
|
const gridEvents = {
|
|
- pageChange({currentPage, pageSize}) {
|
|
|
|
|
|
+ pageChange({ currentPage, pageSize }) {
|
|
if (gridOptions.pagerConfig) {
|
|
if (gridOptions.pagerConfig) {
|
|
gridOptions.pagerConfig.currentPage = currentPage;
|
|
gridOptions.pagerConfig.currentPage = currentPage;
|
|
gridOptions.pagerConfig.pageSize = pageSize;
|
|
gridOptions.pagerConfig.pageSize = pageSize;
|
|
@@ -113,25 +121,23 @@ async function fetchMonthlyData(taskIds, resetPage = false) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-watch(() => props.monthCurrentDate, (newMonthDate) => {
|
|
|
|
- if (newMonthDate) {
|
|
|
|
- monthStartDate.value = newMonthDate.startDate;
|
|
|
|
- monthEndDate.value = newMonthDate.endDate;
|
|
|
|
- fetchMonthlyData(props.taskIds);
|
|
|
|
|
|
+const handelDateChange = (date) => {
|
|
|
|
+ monthCurrentDate.value = date;
|
|
|
|
+ monthStartDate.value = date.startDate;
|
|
|
|
+ monthEndDate.value = date.endDate;
|
|
|
|
+ if (taskIds.value && Object.keys(taskIds.value).length > 0) {
|
|
|
|
+ fetchMonthlyData(taskIds.value, true);
|
|
}
|
|
}
|
|
-});
|
|
|
|
|
|
+};
|
|
|
|
|
|
-watch(() => props.taskIds, (newTaskIds) => {
|
|
|
|
- if (newTaskIds) {
|
|
|
|
- taskIdsAvailable.value = true;
|
|
|
|
|
|
+function updateDataChange(newId) {
|
|
|
|
+ if (selectorRef.value) {
|
|
|
|
+ taskIds.value = newId.value;
|
|
|
|
+ fetchMonthlyData(newId.value, true);
|
|
}
|
|
}
|
|
- if (taskIdsAvailable.value && newTaskIds) {
|
|
|
|
- fetchMonthlyData(newTaskIds, true);
|
|
|
|
- taskIdsAvailable.value = false; // 调用后重置标记
|
|
|
|
- }
|
|
|
|
-});
|
|
|
|
|
|
+}
|
|
|
|
|
|
-function formatEmptyCell({cellValue}) {
|
|
|
|
|
|
+function formatEmptyCell({ cellValue }) {
|
|
if (cellValue === null || cellValue === undefined || cellValue === '') {
|
|
if (cellValue === null || cellValue === undefined || cellValue === '') {
|
|
return '--';
|
|
return '--';
|
|
}
|
|
}
|
|
@@ -161,17 +167,40 @@ const headerCellStyle = () => {
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<template>
|
|
<template>
|
|
- <vxe-grid :cell-style="cellStyle" :header-cell-style="headerCellStyle" v-bind="gridOptions" v-on="gridEvents">
|
|
|
|
- <template #platformNumber_default="{ row }">
|
|
|
|
- <div class="font-semibold">{{ row.platformNumber }}</div>
|
|
|
|
- </template>
|
|
|
|
- <template #platformName_default="{ row }">
|
|
|
|
- <div class="font-semibold" style="color: #164285">{{ row.platformName }}</div>
|
|
|
|
- </template>
|
|
|
|
- <template #brandName_default="{ row }">
|
|
|
|
- {{ row.brandName }}
|
|
|
|
- </template>
|
|
|
|
- </vxe-grid>
|
|
|
|
|
|
+ <div class="px-3.5">
|
|
|
|
+ <el-card body-style="padding: 10px" class="mb-3.5 mt-3.5">
|
|
|
|
+ <div class="custom-card-style flex gap-1.5 justify-between my-1.5 mx-2"
|
|
|
|
+ style="display: flex; align-items: center;">
|
|
|
|
+ <Selector ref="selectorRef" @update:updateData="updateDataChange" />
|
|
|
|
+ <MonthlyDatePicker @monthDateChange="handelDateChange"></MonthlyDatePicker>
|
|
|
|
+ </div>
|
|
|
|
+ </el-card>
|
|
|
|
+ <el-card>
|
|
|
|
+ <chartDateTendency
|
|
|
|
+ :fetch-line-month="getLineForMonth"
|
|
|
|
+ :fetch-line-week="getLineForWeek"
|
|
|
|
+ :fetchLine="getLineData"
|
|
|
|
+ :metricEnum="monthCompareMetricsEnum"
|
|
|
|
+ :query="monthQueryParams"
|
|
|
|
+ >
|
|
|
|
+ </chartDateTendency>
|
|
|
|
+ </el-card>
|
|
|
|
+ <el-card class="mt-3">
|
|
|
|
+ <slot name="table-header"></slot>
|
|
|
|
+ <vxe-grid :cell-style="cellStyle" :header-cell-style="headerCellStyle" v-bind="gridOptions" v-on="gridEvents">
|
|
|
|
+ <template #platformNumber_default="{ row }">
|
|
|
|
+ <div class="font-semibold">{{ row.platformNumber }}</div>
|
|
|
|
+ </template>
|
|
|
|
+ <template #platformName_default="{ row }">
|
|
|
|
+ <div class="font-semibold" style="color: #164285">{{ row.platformName }}</div>
|
|
|
|
+ </template>
|
|
|
|
+ <template #brandName_default="{ row }">
|
|
|
|
+ {{ row.brandName }}
|
|
|
|
+ </template>
|
|
|
|
+ </vxe-grid>
|
|
|
|
+ </el-card>
|
|
|
|
+ </div>
|
|
|
|
+
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<style scoped>
|
|
<style scoped>
|
|
@@ -180,4 +209,11 @@ const headerCellStyle = () => {
|
|
padding-left: 5px !important;
|
|
padding-left: 5px !important;
|
|
padding-right: 0 !important;
|
|
padding-right: 0 !important;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+.el-card {
|
|
|
|
+ border: none;
|
|
|
|
+ border-radius: 12px;
|
|
|
|
+ background-color: #fff;
|
|
|
|
+ box-shadow: 0px 0px 12px rgba(51, 89, 181, 0.16);
|
|
|
|
+}
|
|
</style>
|
|
</style>
|