|
@@ -0,0 +1,132 @@
|
|
|
+<template>
|
|
|
+ <el-card class="box-card">
|
|
|
+ <byTable
|
|
|
+ :source="sourceList.data"
|
|
|
+ :pagination="sourceList.pagination"
|
|
|
+ :config="config"
|
|
|
+ :loading="loading"
|
|
|
+ :searchConfig="searchConfig"
|
|
|
+ highlight-current-row
|
|
|
+ :action-list="[
|
|
|
+ {
|
|
|
+ text: '导出Excel',
|
|
|
+ action: () => deriveExcel(),
|
|
|
+ },
|
|
|
+ ]"
|
|
|
+ :tableHeight="'calc(100vh - 294px)'"
|
|
|
+ @get-list="getList"
|
|
|
+ @clickReset="clickReset">
|
|
|
+ </byTable>
|
|
|
+ </el-card>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script setup>
|
|
|
+import byTable from "/src/components/byTable/index";
|
|
|
+import { ElMessage, ElMessageBox } from "element-plus";
|
|
|
+import moment from "moment";
|
|
|
+
|
|
|
+const { proxy } = getCurrentInstance();
|
|
|
+const sourceList = ref({
|
|
|
+ data: [],
|
|
|
+ pagination: {
|
|
|
+ total: 0,
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ skuSpecCode: "",
|
|
|
+ skuSpecName: "",
|
|
|
+ },
|
|
|
+});
|
|
|
+const loading = ref(false);
|
|
|
+const searchConfig = computed(() => {
|
|
|
+ return [
|
|
|
+ {
|
|
|
+ type: "input",
|
|
|
+ prop: "skuSpecCode",
|
|
|
+ label: "SKU品号",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "input",
|
|
|
+ prop: "skuSpecName",
|
|
|
+ label: "SKU品号",
|
|
|
+ },
|
|
|
+ ];
|
|
|
+});
|
|
|
+const config = computed(() => {
|
|
|
+ return [
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "SKU品号",
|
|
|
+ prop: "skuSpecCode",
|
|
|
+ width: 160,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "SKU品名",
|
|
|
+ prop: "skuSpecName",
|
|
|
+ "min-width": 320,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "日销售量",
|
|
|
+ prop: "dailySales",
|
|
|
+ width: 160,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "30天销量",
|
|
|
+ prop: "salesQuantity",
|
|
|
+ width: 160,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ];
|
|
|
+});
|
|
|
+const getList = (req, status) => {
|
|
|
+ if (status) {
|
|
|
+ sourceList.value.pagination = {
|
|
|
+ pageNum: sourceList.value.pagination.pageNum,
|
|
|
+ pageSize: sourceList.value.pagination.pageSize,
|
|
|
+ };
|
|
|
+ } else {
|
|
|
+ sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
|
|
|
+ }
|
|
|
+ loading.value = true;
|
|
|
+ proxy.post("/salesBoard/getBzSkuSpecSalesPage", sourceList.value.pagination).then((res) => {
|
|
|
+ sourceList.value.data = res.rows;
|
|
|
+ sourceList.value.pagination.total = res.total;
|
|
|
+ setTimeout(() => {
|
|
|
+ loading.value = false;
|
|
|
+ }, 200);
|
|
|
+ });
|
|
|
+};
|
|
|
+getList();
|
|
|
+const clickReset = () => {
|
|
|
+ getList("", true);
|
|
|
+};
|
|
|
+const deriveExcel = () => {
|
|
|
+ ElMessageBox.confirm("你是否确认此操作", "提示", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning",
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ proxy.postFile("/skuSpecQuotationBoard/exportExcel", sourceList.value.pagination).then((res) => {
|
|
|
+ if (res.type === "application/json") {
|
|
|
+ const fileReader = new FileReader();
|
|
|
+ fileReader.onloadend = () => {
|
|
|
+ const jsonData = JSON.parse(fileReader.result);
|
|
|
+ ElMessage({ message: jsonData.msg, type: "error" });
|
|
|
+ };
|
|
|
+ fileReader.readAsText(res);
|
|
|
+ } else {
|
|
|
+ proxy.downloadFile(res, "三十天销量看板-" + moment().format("yyyy-MM-DD") + ".xlsx");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped></style>
|