|
@@ -26,11 +26,21 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<div>
|
|
|
- <el-button circle :icon="Download" plain @click="handleDownload"></el-button>
|
|
|
+ <el-button :icon="Download" circle plain @click="handleDownload"></el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
<el-card body-style="padding: 0" shadow="never">
|
|
|
- <vxe-grid :cell-style="cellStyle" :header-cell-style="headerStyle" v-bind="gridOptions" v-on="gridEvents" show-overflow="tooltip"></vxe-grid>
|
|
|
+ <vxe-grid :cell-style="cellStyle" :header-cell-style="headerStyle" show-overflow="tooltip" v-bind="gridOptions" v-on="gridEvents">
|
|
|
+ <template #avg_score="{ row }">
|
|
|
+ <template v-if="row.avg_score !== null && row.avg_score !== undefined && row.avg_score !== ''">
|
|
|
+ <el-rate v-if="row.avg_score > 0" v-model="row.avg_score" show-score :colors="['#FF0000', '#FF9900', '#67C23A']" disabled text-color="#1e293b" />
|
|
|
+ <span v-else>{{ row.avg_score }}</span>
|
|
|
+ </template>
|
|
|
+ <template v-else>
|
|
|
+ <span>-</span>
|
|
|
+ </template>
|
|
|
+ </template>
|
|
|
+ </vxe-grid>
|
|
|
</el-card>
|
|
|
</el-card>
|
|
|
</div>
|
|
@@ -59,7 +69,7 @@ const gridOptions = reactive({
|
|
|
data: [],
|
|
|
});
|
|
|
|
|
|
-const asinMonthDate = ref(dayjs().subtract(1, 'month').startOf('month').format('YYYY-MM-DD'))
|
|
|
+const asinMonthDate = ref(dayjs().subtract(1, 'month').startOf('month').format('YYYY-MM-DD'));
|
|
|
|
|
|
const disabledDate = (time: Date) => {
|
|
|
// 禁用当前月和当前月之后的日期
|
|
@@ -74,7 +84,6 @@ const searchAsin = ref('');
|
|
|
const searchSku = ref('');
|
|
|
const averageData = ref([]);
|
|
|
|
|
|
-
|
|
|
const gridEvents = {
|
|
|
pageChange({ pageSize, currentPage }) {
|
|
|
gridOptions.pagerConfig.currentPage = currentPage;
|
|
@@ -90,8 +99,8 @@ async function fetchData() {
|
|
|
limit: gridOptions.pagerConfig.pageSize,
|
|
|
page: gridOptions.pagerConfig.currentPage,
|
|
|
review_date: asinMonthDate.value,
|
|
|
- asin : searchAsin.value,
|
|
|
- sku : searchSku.value,
|
|
|
+ asin: searchAsin.value,
|
|
|
+ sku: searchSku.value,
|
|
|
};
|
|
|
|
|
|
const resp = await getTableData(params);
|
|
@@ -109,10 +118,9 @@ async function handleDownload() {
|
|
|
try {
|
|
|
const params = {
|
|
|
review_date: asinMonthDate.value,
|
|
|
- asin : searchAsin.value,
|
|
|
- sku : searchSku.value,
|
|
|
+ asin: searchAsin.value,
|
|
|
+ sku: searchSku.value,
|
|
|
};
|
|
|
-console.log(asinMonthDate.value);
|
|
|
const resp = await getTableDownloadData(params);
|
|
|
const url = window.URL.createObjectURL(resp.data);
|
|
|
const link = document.createElement('a');
|
|
@@ -149,18 +157,16 @@ function headerStyle() {
|
|
|
}
|
|
|
|
|
|
watch(asinMonthDate, (newVal) => {
|
|
|
- const date = dayjs(newVal).startOf('month').format('YYYY-MM-DD');
|
|
|
- if (date !== asinMonthDate.value) {
|
|
|
- asinMonthDate.value = date;
|
|
|
- fetchData();
|
|
|
- }
|
|
|
+ const date = dayjs(newVal).startOf('month').format('YYYY-MM-DD');
|
|
|
+ if (date !== asinMonthDate.value) {
|
|
|
+ asinMonthDate.value = date;
|
|
|
+ fetchData();
|
|
|
}
|
|
|
-);
|
|
|
+});
|
|
|
|
|
|
onMounted(() => {
|
|
|
fetchData();
|
|
|
});
|
|
|
-
|
|
|
</script>
|
|
|
|
|
|
<style scoped>
|