Browse Source

Merge branch 'master' into 测试

lxf 1 year ago
parent
commit
a981aa00cf

+ 132 - 0
src/views/group/data-board/sales-volume/index.vue

@@ -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("/salesBoard/bzSkuSpecSalesExportExcel", 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>

+ 2 - 1
src/views/subsidiary/order/management/index.vue

@@ -447,7 +447,8 @@ watch(refreshStore().refresh, (val) => {
 const judgeRoles = () => {
   let status = false;
   if (proxy.useUserStore().user.roles && proxy.useUserStore().user.roles.length > 0) {
-    let list = proxy.useUserStore().user.roles.filter((item) => ["purchasingOfficer", "sypurchasing", "bzpurchasing"].includes(item.roleKey));
+    // let list = proxy.useUserStore().user.roles.filter((item) => ["purchasingOfficer", "sypurchasing", "bzpurchasing"].includes(item.roleKey));
+    let list = proxy.useUserStore().user.roles.filter((item) => item.roleName.includes('采购'));
     if (list && list.length > 0) {
       status = true;
     }

+ 3 - 3
src/views/system/user2/index.vue

@@ -92,6 +92,7 @@ const roomDialogVisible = ref(false);
 const selectConfig = computed(() => {
   return [];
 });
+const deptList = ref([]);
 const config = computed(() => {
   return [
     {
@@ -241,7 +242,7 @@ const formConfig = computed(() => {
       type: "treeSelect",
       prop: "deptId",
       label: "部门名称",
-      data: [],
+      data: deptList.value,
     },
     {
       type: "input",
@@ -423,8 +424,7 @@ const getDept = () => {
     })
     .then((message) => {
       recursive(message.data);
-      formConfig.value[0].data = proxy.handleTree(message.data, "deptId");
-      console.log(formConfig.value[0].data);
+      deptList.value = message.data;
     });
 };