Prechádzať zdrojové kódy

feat(score-statistics):首页下载修改

xinyan 6 mesiacov pred
rodič
commit
4c2154b018

+ 3 - 6
src/views/score-statistics/components/MonthlyRating.vue

@@ -96,7 +96,6 @@ async function fetchData() {
 
 		const resp = await getTableData(params);
 		gridOptions.data = resp.data;
-		console.log("=>(MonthlyRating.vue:121) gridOptions.data", gridOptions.data);
 		gridOptions.pagerConfig.total = resp.total;
 	} catch (error) {
 		console.log(error);
@@ -113,12 +112,12 @@ async function handleDownload() {
 			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');
 		link.href = url;
-		link.setAttribute('download', asinMonthDate.slice(0, 7) + '平均评分.xlsx');
+		link.setAttribute('download', asinMonthDate.value + '平均评分.xlsx');
 		document.body.appendChild(link);
 		link.click();
 		document.body.removeChild(link);
@@ -126,7 +125,7 @@ async function handleDownload() {
 		gridOptions.loading = false;
 		ElMessage.success('下载成功!');
 	} catch (error) {
-		ElMessage.error('下载失败!');
+		console.log(error);
 	} finally {
 		gridOptions.loading = false;
 	}
@@ -151,10 +150,8 @@ function headerStyle() {
 
 watch(asinMonthDate, (newVal) => {
 		const date = dayjs(newVal).startOf('month').format('YYYY-MM-DD');
-		console.log("=>(MonthlyRating.vue:180) date", date);
 		if (date !== asinMonthDate.value) {
 			asinMonthDate.value = date;
-			console.log("=>(MonthlyRating.vue:183) asinMonthDate.value", asinMonthDate.value);
 			fetchData();
 		}
 	}

+ 3 - 7
src/views/score-statistics/components/Overview.vue

@@ -87,7 +87,6 @@ async function handelDownload(label: string) {
 	};
 		const fileName = `${dateRange.value[0]}至${dateRange.value[1]}${label}.xlsx`;
 		const resp = await getDownloadData(query);
-		if(resp.code === 2000){
 			const url = window.URL.createObjectURL(resp.data);
 			const link = document.createElement('a');
 			link.href = url;
@@ -95,12 +94,9 @@ async function handelDownload(label: string) {
 			document.body.appendChild(link);
 			link.click();
 			ElMessage.success('下载成功');
-		} else {
-			ElMessage.error('下载失败');
-		}
-		loading.value = false;
-	}catch (e) {
-		ElMessage.error('下载失败');
+			loading.value = false;
+		}catch (e) {
+		ElMessage.error('error');
 	}
 }