|
@@ -11,6 +11,7 @@ const props = defineProps({
|
|
taskIds: Object,
|
|
taskIds: Object,
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+const taskIds = ref(null);
|
|
const tableColumns = ref([]);
|
|
const tableColumns = ref([]);
|
|
const tableData = ref([]);
|
|
const tableData = ref([]);
|
|
|
|
|
|
@@ -52,7 +53,7 @@ const gridOptions = reactive({
|
|
},
|
|
},
|
|
customConfig: {
|
|
customConfig: {
|
|
storage: {
|
|
storage: {
|
|
- visible:true,
|
|
|
|
|
|
+ visible: true,
|
|
}
|
|
}
|
|
},
|
|
},
|
|
toolbarConfig: {
|
|
toolbarConfig: {
|
|
@@ -205,6 +206,7 @@ async function fetchMainData(taskIds, resetPage = false) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+//排序
|
|
function handleSortChange({ column, order }) {
|
|
function handleSortChange({ column, order }) {
|
|
sortOrder.value = order === 'asc' ? 'smallfirst' : 'bigfirst';
|
|
sortOrder.value = order === 'asc' ? 'smallfirst' : 'bigfirst';
|
|
const sortField = column.field;
|
|
const sortField = column.field;
|
|
@@ -226,8 +228,38 @@ function handleSortChange({ column, order }) {
|
|
fetchMainData(props.taskIds, true);
|
|
fetchMainData(props.taskIds, true);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+// 导出数据接口
|
|
|
|
+async function handleExport() {
|
|
|
|
+ try {
|
|
|
|
+ gridOptions.loading = true;
|
|
|
|
+ const params = {
|
|
|
|
+ page: gridOptions.pagerConfig.currentPage,
|
|
|
|
+ limit: gridOptions.pagerConfig.pageSize,
|
|
|
|
+ task_ids: props.taskIds,
|
|
|
|
+ day_start_date: dayStartDate.value,
|
|
|
|
+ day_end_date: dayEndDate.value,
|
|
|
|
+ week_start_date: weekStart.value,
|
|
|
|
+ week_end_date: weekEnd.value,
|
|
|
|
+ month_start_date: monthStartDate.value,
|
|
|
|
+ month_end_date: monthEndDate.value,
|
|
|
|
+ };
|
|
|
|
+ const response = await exportData(params);
|
|
|
|
+ const url = window.URL.createObjectURL(new Blob([response.data]));
|
|
|
|
+ const link = document.createElement('a');
|
|
|
|
+ link.href = url;
|
|
|
|
+ link.setAttribute('download', '合并数据展示.xlsx');
|
|
|
|
+ document.body.appendChild(link);
|
|
|
|
+ link.click();
|
|
|
|
+ gridOptions.loading = false;
|
|
|
|
+ ElMessage.success('导出数据成功');
|
|
|
|
+ } catch (error) {
|
|
|
|
+ console.error('导出数据失败:', error);
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
// 监测 taskIds 变化
|
|
// 监测 taskIds 变化
|
|
watch(() => props.taskIds, (newTaskIds) => {
|
|
watch(() => props.taskIds, (newTaskIds) => {
|
|
|
|
+ taskIds.value = newTaskIds;
|
|
fetchMainData(newTaskIds, true);
|
|
fetchMainData(newTaskIds, true);
|
|
});
|
|
});
|
|
|
|
|
|
@@ -243,18 +275,14 @@ watch(() => props.dayDate, (newDayDate) => {
|
|
dayStartDate.value = dailyStartDate;
|
|
dayStartDate.value = dailyStartDate;
|
|
dayEndDate.value = dailyTime;
|
|
dayEndDate.value = dailyTime;
|
|
}
|
|
}
|
|
- //clearSorting();
|
|
|
|
});
|
|
});
|
|
|
|
|
|
-
|
|
|
|
watch(() => props.weekDate, (newWeekDate) => {
|
|
watch(() => props.weekDate, (newWeekDate) => {
|
|
if (newWeekDate) {
|
|
if (newWeekDate) {
|
|
const { weekStartDate, weekEndDate } = newWeekDate;
|
|
const { weekStartDate, weekEndDate } = newWeekDate;
|
|
weekStart.value = weekStartDate;
|
|
weekStart.value = weekStartDate;
|
|
weekEnd.value = weekEndDate;
|
|
weekEnd.value = weekEndDate;
|
|
- fetchMainData(props.taskIds);
|
|
|
|
}
|
|
}
|
|
- //clearSorting();
|
|
|
|
});
|
|
});
|
|
|
|
|
|
watch(() => props.monthDate, (newMonthDate) => {
|
|
watch(() => props.monthDate, (newMonthDate) => {
|
|
@@ -263,9 +291,12 @@ watch(() => props.monthDate, (newMonthDate) => {
|
|
monthStartDate.value = startDate;
|
|
monthStartDate.value = startDate;
|
|
monthEndDate.value = endDate;
|
|
monthEndDate.value = endDate;
|
|
}
|
|
}
|
|
- //clearSorting();
|
|
|
|
|
|
+ if (taskIds.value) {
|
|
|
|
+ fetchMainData(props.taskIds, true);
|
|
|
|
+ }
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+//以下是表格样式
|
|
const cellStyle = ({ columnIndex }) => {
|
|
const cellStyle = ({ columnIndex }) => {
|
|
if (columnIndex < 6) {
|
|
if (columnIndex < 6) {
|
|
return {
|
|
return {
|
|
@@ -296,34 +327,6 @@ const cellStyleHandler = ({ column }) => {
|
|
return { fontSize: '12px' };
|
|
return { fontSize: '12px' };
|
|
};
|
|
};
|
|
|
|
|
|
-async function handleExport() {
|
|
|
|
- try {
|
|
|
|
- gridOptions.loading = true;
|
|
|
|
- const params = {
|
|
|
|
- page: gridOptions.pagerConfig.currentPage,
|
|
|
|
- limit: gridOptions.pagerConfig.pageSize,
|
|
|
|
- task_ids: props.taskIds,
|
|
|
|
- day_start_date: dayStartDate.value,
|
|
|
|
- day_end_date: dayEndDate.value,
|
|
|
|
- week_start_date: weekStart.value,
|
|
|
|
- week_end_date: weekEnd.value,
|
|
|
|
- month_start_date: monthStartDate.value,
|
|
|
|
- month_end_date: monthEndDate.value,
|
|
|
|
- };
|
|
|
|
- const response = await exportData(params);
|
|
|
|
- const url = window.URL.createObjectURL(new Blob([response.data]));
|
|
|
|
- const link = document.createElement('a');
|
|
|
|
- link.href = url;
|
|
|
|
- link.setAttribute('download', '合并数据展示.xlsx');
|
|
|
|
- document.body.appendChild(link);
|
|
|
|
- link.click();
|
|
|
|
- gridOptions.loading = false;
|
|
|
|
- ElMessage.success('导出数据成功');
|
|
|
|
- } catch (error) {
|
|
|
|
- console.error('导出数据失败:', error);
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
function formatEmptyCell({ cellValue }) {
|
|
function formatEmptyCell({ cellValue }) {
|
|
if (cellValue === null || cellValue === undefined || cellValue === '') {
|
|
if (cellValue === null || cellValue === undefined || cellValue === '') {
|
|
return '--';
|
|
return '--';
|
|
@@ -357,7 +360,7 @@ onMounted(() => {
|
|
<div class="font-semibold" style="color: #0097f8">{{ row.platformName }}</div>
|
|
<div class="font-semibold" style="color: #0097f8">{{ row.platformName }}</div>
|
|
</template>
|
|
</template>
|
|
<template #brandName_default="{ row }">
|
|
<template #brandName_default="{ row }">
|
|
- <el-tag effect="plain" type="success" round>{{ row.brandName }}</el-tag>
|
|
|
|
|
|
+ <el-tag effect="plain" round type="success">{{ row.brandName }}</el-tag>
|
|
</template>
|
|
</template>
|
|
</vxe-grid>
|
|
</vxe-grid>
|
|
</template>
|
|
</template>
|