|
@@ -5,20 +5,23 @@
|
|
|
* @Author: Cheney
|
|
|
*/
|
|
|
|
|
|
-import { Download, Refresh, Search } from '@element-plus/icons-vue';
|
|
|
-import { nextTick, onBeforeMount, reactive, ref, watch } from 'vue';
|
|
|
+import { Refresh, Search } from '@element-plus/icons-vue';
|
|
|
+import { onBeforeMount, reactive, ref, watch } from 'vue';
|
|
|
import dayjs from 'dayjs';
|
|
|
-import { getTableData, postDownload } from './api';
|
|
|
+import { getTableData } from './api';
|
|
|
import { ElMessage } from 'element-plus';
|
|
|
import { asinColumns } from './useColumns';
|
|
|
-import { brandColumns } from '/@/views/searchTerm/brandView/useColumns';
|
|
|
+import { usePublicData } from '/@/stores/publicData';
|
|
|
+import { storeToRefs } from 'pinia';
|
|
|
|
|
|
+const publicData = usePublicData();
|
|
|
+const { dateRange } = storeToRefs(publicData);
|
|
|
const reportTypeSelect = ref('monthly');
|
|
|
const searchTermInp = ref('');
|
|
|
const asinInp = ref('B0');
|
|
|
const tableLoading = ref(false);
|
|
|
const downloadLoading = ref(false);
|
|
|
-const date = ref(calculateLastWeek());
|
|
|
+const date = ref([dateRange.value[0], dateRange.value[1]]);
|
|
|
|
|
|
const gridOptions: any = reactive({
|
|
|
height: 'auto',
|
|
@@ -64,7 +67,6 @@ async function handleSelectChange() {
|
|
|
} else {
|
|
|
await fetchTableData();
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
async function refreshTable() {
|
|
@@ -136,16 +138,6 @@ function validateAsinInput(input: string) {
|
|
|
const regex = /^[Bb]0[A-Za-z0-9\s]*$/i;
|
|
|
return regex.test(input);
|
|
|
}
|
|
|
-
|
|
|
-/**
|
|
|
- * 计算上周的周日到周六的日期范围
|
|
|
- */
|
|
|
-function calculateLastWeek() {
|
|
|
- const today = dayjs();
|
|
|
- const lastDay = today.subtract(1, 'day'); // 昨天
|
|
|
- const firstDay = lastDay.subtract(6, 'day'); // 一周前
|
|
|
- return [firstDay.format('YYYY-MM-DD'), lastDay.format('YYYY-MM-DD')];
|
|
|
-}
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
@@ -215,7 +207,7 @@ function calculateLastWeek() {
|
|
|
<template #toolbar_buttons></template>
|
|
|
<template v-for="col in asinColumns" #[`${col.field}_default`]="{ row }">
|
|
|
<div v-if="col.field === 'clickedItemName'">
|
|
|
- <el-tooltip effect="dark" :content="row.clickedItemName" placement="top" :show-after="300" >
|
|
|
+ <el-tooltip effect="dark" :content="row.clickedItemName" placement="top" :show-after="300">
|
|
|
<div class="line-text font-medium">
|
|
|
{{ row.clickedItemName }}
|
|
|
</div>
|