|
@@ -1,4 +1,4 @@
|
|
|
-<script setup lang="ts">
|
|
|
+<script lang="ts" setup>
|
|
|
import { ref, reactive, computed, inject, watch, Ref, onMounted, provide } from 'vue';
|
|
|
import { useRouter } from 'vue-router';
|
|
|
import { getDayData, getMonthData, getWeekData } from '/src/views/reportManage/dataCenter/api';
|
|
@@ -7,7 +7,7 @@ import dayjs from 'dayjs';
|
|
|
|
|
|
const router = useRouter();
|
|
|
const dateType = inject<Ref>('dateDimension');
|
|
|
-const currentDate = inject<Ref>('currentDate')
|
|
|
+const currentDate = inject<Ref>('currentDate');
|
|
|
const props = defineProps({
|
|
|
taskIds: Object,
|
|
|
});
|
|
@@ -88,19 +88,19 @@ const gridEvents = {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
-watch(currentDate,(newValue)=>{
|
|
|
+watch(currentDate, (newValue) => {
|
|
|
if (dateType.value === 'day') {
|
|
|
- dayStartDate.value = dayjs(newValue.dailyStartDate).format("YYYY-MM-DD");
|
|
|
- dayEndDate.value = dayjs(newValue.dailyTime).format("YYYY-MM-DD");
|
|
|
- }else if (dateType.value === 'week') {
|
|
|
- weekStartDate.value = dayjs(newValue.weekStartDate).format("YYYY-MM-DD");
|
|
|
- weekEndDate.value = dayjs(newValue.weekEndDate).format("YYYY-MM-DD");
|
|
|
- }else if(dateType.value === 'month'){
|
|
|
- monthStartDate.value = dayjs(newValue.startDate).format("YYYY-MM-DD");
|
|
|
- monthEndDate.value = dayjs(newValue.endDate).format("YYYY-MM-DD");
|
|
|
+ dayStartDate.value = dayjs(newValue.dailyStartDate).format('YYYY-MM-DD');
|
|
|
+ dayEndDate.value = dayjs(newValue.dailyTime).format('YYYY-MM-DD');
|
|
|
+ } else if (dateType.value === 'week') {
|
|
|
+ weekStartDate.value = dayjs(newValue.weekStartDate).format('YYYY-MM-DD');
|
|
|
+ weekEndDate.value = dayjs(newValue.weekEndDate).format('YYYY-MM-DD');
|
|
|
+ } else if (dateType.value === 'month') {
|
|
|
+ monthStartDate.value = dayjs(newValue.startDate).format('YYYY-MM-DD');
|
|
|
+ monthEndDate.value = dayjs(newValue.endDate).format('YYYY-MM-DD');
|
|
|
}
|
|
|
- fetchCurrentData(props.taskIds);
|
|
|
-})
|
|
|
+ fetchCurrentData(props.taskIds);
|
|
|
+});
|
|
|
|
|
|
async function fetchData(taskIds, apiFunc, startDate, endDate, dataColumns, dateTypeKey) {
|
|
|
try {
|
|
@@ -117,13 +117,13 @@ async function fetchData(taskIds, apiFunc, startDate, endDate, dataColumns, date
|
|
|
if (resp.data.length > 0) {
|
|
|
const firstRow = resp.data[0];
|
|
|
const dynamicColumns = [];
|
|
|
- dataColumns.value = dataColumns.value.filter(column => !/\d{2}-\d{2}的/.test(column.field)&&! column.field.includes('余额币种')&&! column.field.includes('退货率'));
|
|
|
+ dataColumns.value = dataColumns.value.filter(column => !/\d{2}-\d{2}的/.test(column.field) && !column.field.includes('余额币种') && !column.field.includes('退货率'));
|
|
|
for (const key in firstRow) {
|
|
|
- if (/\d{2}-\d{2}的/.test(key) || key.includes('余额币种') ||key.includes('退货率')) {
|
|
|
+ if (/\d{2}-\d{2}的/.test(key) || key.includes('余额币种') || key.includes('退货率')) {
|
|
|
dynamicColumns.push({
|
|
|
field: key,
|
|
|
title: key,
|
|
|
- minWidth:key.includes('~') ? 120 :/\d{4}-\d{2}的/.test(key)? 100 :113,
|
|
|
+ minWidth: key.includes('~') ? 120 : /\d{4}-\d{2}的/.test(key) ? 100 : 113,
|
|
|
align: 'center',
|
|
|
});
|
|
|
}
|
|
@@ -167,7 +167,7 @@ function fetchCurrentData(taskIds) {
|
|
|
|
|
|
watch(() => props.taskIds, (newTaskIds) => {
|
|
|
fetchCurrentData(newTaskIds);
|
|
|
-}, );
|
|
|
+},);
|
|
|
|
|
|
const handleImport = () => {
|
|
|
router.push({
|
|
@@ -187,30 +187,8 @@ onMounted(() => {
|
|
|
<div>
|
|
|
<vxe-grid v-bind="currentGridOptions" v-on="gridEvents">
|
|
|
<template #toolbar_buttons>
|
|
|
- <vxe-button status="primary" icon="vxe-icon-add" @click="handleImport" >数据录入</vxe-button>
|
|
|
- <!--<span v-if="dateType === 'day'" class="text-right">{{dayStartDate}}日数据</span>-->
|
|
|
- <!--<span v-else-if="dateType === 'week'" class="text-right">{{weekEndDate}}周数据</span>-->
|
|
|
- <!--<span v-else-if="dateType === 'month'" class="text-right">{{endDate}}月数据</span>-->
|
|
|
+ <vxe-button icon="vxe-icon-add" status="primary" @click="handleImport">数据录入</vxe-button>
|
|
|
</template>
|
|
|
- <!--<template #platformNumber_default="{ row }">-->
|
|
|
- <!-- <div>{{ row.task_info.platformNumber }}</div>-->
|
|
|
- <!--</template>-->
|
|
|
- <!--<template #platformName_default="{ row }">-->
|
|
|
- <!-- <div>{{ row.task_info.platformName }}</div>-->
|
|
|
- <!--</template>-->
|
|
|
- <!--<template #user_name_default="{ row }">-->
|
|
|
- <!-- <div>{{ row.task_info.user_name }}</div>-->
|
|
|
- <!--</template>-->
|
|
|
- <!--<template #country_default="{ row }">-->
|
|
|
- <!-- <div>{{ row.task_info.country }}</div>-->
|
|
|
- <!--</template>-->
|
|
|
- <!--<template #brandName_default="{ row }">-->
|
|
|
- <!-- <div>{{ row.task_info.brandName }}</div>-->
|
|
|
- <!--</template>-->
|
|
|
- <!--<template #currencyCode_default="{ row }">-->
|
|
|
- <!-- <div>{{ row.task_info.currencyCode }}</div>-->
|
|
|
- <!--</template>-->
|
|
|
-
|
|
|
</vxe-grid>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -219,7 +197,4 @@ onMounted(() => {
|
|
|
.vxe-grid {
|
|
|
border-radius: 10px;
|
|
|
}
|
|
|
-.text-right {
|
|
|
- margin-left: auto; /* 用于在不需要Flex布局时,将元素推到最右边 */
|
|
|
-}
|
|
|
</style>
|