|
@@ -15,6 +15,7 @@ import { ElMessage } from 'element-plus';
|
|
import dayjs from 'dayjs';
|
|
import dayjs from 'dayjs';
|
|
import enLocale from 'element-plus/es/locale/lang/en';
|
|
import enLocale from 'element-plus/es/locale/lang/en';
|
|
import { useTableHeight } from '/@/utils/useTableHeight';
|
|
import { useTableHeight } from '/@/utils/useTableHeight';
|
|
|
|
+import { useCustomHeight } from '/@/utils/useCustomHeight';
|
|
|
|
|
|
|
|
|
|
const router = useRouter();
|
|
const router = useRouter();
|
|
@@ -31,7 +32,10 @@ const dateDimension = ref(date.value[0]);
|
|
|
|
|
|
const titleContainer = ref();
|
|
const titleContainer = ref();
|
|
const queryContainer = ref();
|
|
const queryContainer = ref();
|
|
-const { tableHeight } = useTableHeight(titleContainer, queryContainer);
|
|
|
|
|
|
+const heightObj = {
|
|
|
|
+ a: 32 + 13 + 40 + 70 + 40 + 48 + 95
|
|
|
|
+}
|
|
|
|
+const { tableHeight } = useCustomHeight(heightObj);
|
|
|
|
|
|
onBeforeMount(() => {
|
|
onBeforeMount(() => {
|
|
pageSize.value = 7; // 将usePagination中的pageSize默认修改每页显示21条
|
|
pageSize.value = 7; // 将usePagination中的pageSize默认修改每页显示21条
|
|
@@ -78,7 +82,7 @@ function calculateEndDate(startDate: string) {
|
|
|
|
|
|
async function refreshTable() {
|
|
async function refreshTable() {
|
|
currentPage.value = 1;
|
|
currentPage.value = 1;
|
|
- pageSize.value = 21;
|
|
|
|
|
|
+ pageSize.value = 7;
|
|
asinInp.value = '';
|
|
asinInp.value = '';
|
|
searchTermInp.value = '';
|
|
searchTermInp.value = '';
|
|
reportTypeSelect.value = 'weekly';
|
|
reportTypeSelect.value = 'weekly';
|
|
@@ -86,8 +90,13 @@ async function refreshTable() {
|
|
await fetchTableData();
|
|
await fetchTableData();
|
|
}
|
|
}
|
|
|
|
|
|
-async function fetchTableData() {
|
|
|
|
|
|
+async function fetchTableData(isQuery = false) {
|
|
tableLoading.value = true;
|
|
tableLoading.value = true;
|
|
|
|
+
|
|
|
|
+ if (isQuery) {
|
|
|
|
+ currentPage.value = 1;
|
|
|
|
+ }
|
|
|
|
+
|
|
const query = {
|
|
const query = {
|
|
page: currentPage.value,
|
|
page: currentPage.value,
|
|
limit: pageSize.value * 3,
|
|
limit: pageSize.value * 3,
|
|
@@ -115,9 +124,9 @@ async function fetchTableData() {
|
|
/**
|
|
/**
|
|
* 下拉框值改变和input清空事件触发
|
|
* 下拉框值改变和input清空事件触发
|
|
*/
|
|
*/
|
|
-async function handleSelectChange() {
|
|
|
|
|
|
+function handleSelectChange() {
|
|
calculateDate();
|
|
calculateDate();
|
|
- await fetchTableData();
|
|
|
|
|
|
+ // await fetchTableData();
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -256,7 +265,7 @@ async function handlePageChange(newPage: number, newSize: number) {
|
|
<div ref="queryContainer" class="flex justify-between">
|
|
<div ref="queryContainer" class="flex justify-between">
|
|
<div class="flex gap-5 flex-wrap">
|
|
<div class="flex gap-5 flex-wrap">
|
|
<div>
|
|
<div>
|
|
- <span class="font-medium mr-0.5">市场 </span>
|
|
|
|
|
|
+ <span class="font-medium mr-0.5">市 场 </span>
|
|
<el-select v-model="marketplaceSelect" style="width: 90px" @change="handleSelectChange">
|
|
<el-select v-model="marketplaceSelect" style="width: 90px" @change="handleSelectChange">
|
|
<el-option
|
|
<el-option
|
|
v-for="item in marketplaceOptions"
|
|
v-for="item in marketplaceOptions"
|
|
@@ -279,10 +288,8 @@ async function handlePageChange(newPage: number, newSize: number) {
|
|
v-model="searchTermInp"
|
|
v-model="searchTermInp"
|
|
:prefix-icon="Search"
|
|
:prefix-icon="Search"
|
|
clearable
|
|
clearable
|
|
- placeholder="输入后回车查询"
|
|
|
|
- style="width: 240px"
|
|
|
|
- @clear="handleSelectChange"
|
|
|
|
- @keyup.enter="handleQueryChange"/>
|
|
|
|
|
|
+ placeholder="请输入"
|
|
|
|
+ style="width: 240px" />
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div>
|
|
<span class="font-medium mr-0.5">ASIN </span>
|
|
<span class="font-medium mr-0.5">ASIN </span>
|
|
@@ -290,10 +297,8 @@ async function handlePageChange(newPage: number, newSize: number) {
|
|
v-model="asinInp"
|
|
v-model="asinInp"
|
|
:prefix-icon="Search"
|
|
:prefix-icon="Search"
|
|
clearable
|
|
clearable
|
|
- placeholder="输入后回车查询"
|
|
|
|
- style="width: 180px"
|
|
|
|
- @clear="handleSelectChange"
|
|
|
|
- @keyup.enter="handleQueryChange"/>
|
|
|
|
|
|
+ placeholder="请输入"
|
|
|
|
+ style="width: 180px" />
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div>
|
|
<span class="font-medium mr-0.5">报告日期 </span>
|
|
<span class="font-medium mr-0.5">报告日期 </span>
|
|
@@ -321,23 +326,26 @@ async function handlePageChange(newPage: number, newSize: number) {
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="flex">
|
|
<div class="flex">
|
|
- <el-button :icon="TopRight" plain type="primary" @click="handleJump">搜索词管理</el-button>
|
|
|
|
- <el-button
|
|
|
|
- :disabled="!tableData.length"
|
|
|
|
- :icon="Download"
|
|
|
|
- :loading="downloadLoading"
|
|
|
|
- plain
|
|
|
|
- round
|
|
|
|
- type="success"
|
|
|
|
- @click="handleDownload"
|
|
|
|
- >下载表格
|
|
|
|
- </el-button>
|
|
|
|
- <el-button :icon="Refresh" circle @click="refreshTable"></el-button>
|
|
|
|
|
|
+ <el-button :icon="Search" type="primary" @click="fetchTableData(true)">查 询</el-button>
|
|
|
|
+ <el-button :icon="Refresh" @click="refreshTable">刷 新</el-button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
+ <div class="mt-6">
|
|
|
|
+ <el-button :icon="TopRight" plain type="primary" @click="handleJump">搜索词管理</el-button>
|
|
|
|
+ <el-button
|
|
|
|
+ :disabled="!tableData.length"
|
|
|
|
+ :icon="Download"
|
|
|
|
+ :loading="downloadLoading"
|
|
|
|
+ plain
|
|
|
|
+ round
|
|
|
|
+ type="success"
|
|
|
|
+ @click="handleDownload"
|
|
|
|
+ >下载表格
|
|
|
|
+ </el-button>
|
|
|
|
+ </div>
|
|
<!-- table -->
|
|
<!-- table -->
|
|
<el-card class="mt-5" shadow="never">
|
|
<el-card class="mt-5" shadow="never">
|
|
- <div >
|
|
|
|
|
|
+ <div>
|
|
<el-table :data="tableData" :span-method="arraySpanMethod" :height="tableHeight" stripe style="width: 100%">
|
|
<el-table :data="tableData" :span-method="arraySpanMethod" :height="tableHeight" stripe style="width: 100%">
|
|
<!-- 保持索引是1, 2, 3的顺序 不会收到合并单元格的影响 -->
|
|
<!-- 保持索引是1, 2, 3的顺序 不会收到合并单元格的影响 -->
|
|
<el-table-column :index="(index) => Math.floor(index / 3) + (currentPage - 1) * pageSize + 1" fixed
|
|
<el-table-column :index="(index) => Math.floor(index / 3) + (currentPage - 1) * pageSize + 1" fixed
|