Browse Source

Merge branch '采购入库明细'

lxf 1 year ago
parent
commit
0f68caecd5

+ 54 - 0
src/utils/date.js

@@ -24,3 +24,57 @@ export function getMonthBetween(starDay, endDay) {
   }
   return dates;
 }
+
+/**
+ * 日期格式化
+ */
+export function dateFormat(date, format) {
+  format = format || "yyyy-MM-dd hh:mm:ss";
+  if (date !== "Invalid Date") {
+    let o = {
+      "M+": date.getMonth() + 1, //month
+      "d+": date.getDate(), //day
+      "h+": date.getHours(), //hour
+      "m+": date.getMinutes(), //minute
+      "s+": date.getSeconds(), //second
+      "q+": Math.floor((date.getMonth() + 3) / 3), //quarter
+      S: date.getMilliseconds(), //millisecond
+    };
+    if (/(y+)/.test(format)) format = format.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
+    for (let k in o)
+      if (new RegExp("(" + k + ")").test(format)) format = format.replace(RegExp.$1, RegExp.$1.length === 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length));
+    return format;
+  }
+  return "";
+}
+
+//本年第一天
+export function getYearFirstDay() {
+  var date1 = new Date();
+  var year1 = date1.getFullYear();
+  var firstMonth = year1 + "-" + "01" + "-" + "01";
+
+  return firstMonth;
+}
+
+//本年最后一天
+export function getYearLastDay() {
+  var date = new Date();
+  var year1 = date.getFullYear();
+  var lastDay = year1 + "-" + "12" + "-" + "31";
+  return lastDay;
+}
+
+export function getDaysNoTime(num) {
+  // 如果包括今天,如需获取当前日期的近7天,days应该为6
+  let oneDay = 24 * 60 * 60 * 1000;
+  let endTime = new Date(Date.now()); //当前时间为结束时间
+  endTime = dateFormat(endTime, "yyyy-MM-dd");
+  let startTime = new Date(Date.now() - num * oneDay);
+  startTime = dateFormat(startTime, "yyyy-MM-dd");
+  const days = {
+    startTime,
+    endTime,
+  };
+  return days;
+}

+ 29 - 4
src/views/group/finance/check-bill/ExcelFile.vue

@@ -5,12 +5,13 @@
       :pagination="sourceList.pagination"
       :config="config"
       :loading="loading"
+      :searchConfig="searchConfig"
       highlight-current-row
       :action-list="[
-        {
-          text: '刷新',
-          action: () => getList(),
-        },
+        // {
+        //   text: '刷新',
+        //   action: () => getList(),
+        // },
       ]"
       @get-list="getList">
     </byTable>
@@ -54,9 +55,33 @@ const sourceList = ref({
     departmentId: "",
     beginTime: "",
     endTime: "",
+    type: "",
   },
 });
 const loading = ref(false);
+const searchConfig = computed(() => {
+  return [
+    {
+      type: "select",
+      prop: "type",
+      label: "业务类型",
+      data: [
+        {
+          dictKey: "1",
+          dictValue: "对账单",
+        },
+        {
+          dictKey: "2",
+          dictValue: "对账单报表",
+        },
+        {
+          dictKey: "3",
+          dictValue: "采购入库",
+        },
+      ],
+    },
+  ];
+});
 const config = computed(() => {
   return [
     {

+ 285 - 0
src/views/group/finance/purchase-warehousing/index.vue

@@ -0,0 +1,285 @@
+<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: () => clickExcel(),
+        },
+        {
+          text: 'Excel文件',
+          action: () => clickExcelFile(),
+        },
+      ]"
+      @get-list="getList"
+      @clickReset="clickReset"
+      @changeRadioGroup="changeRadioGroup">
+    </byTable>
+
+    <el-dialog title="Excel文件" v-if="openFileList" v-model="openFileList" width="60%">
+      <ExcelFile></ExcelFile>
+      <template #footer>
+        <el-button @click="openFileList = false" size="large">关 闭</el-button>
+      </template>
+    </el-dialog>
+  </el-card>
+</template>
+
+<script setup>
+import byTable from "/src/components/byTable/index";
+import * as date from "/src/utils/date";
+import { ElMessage } from "element-plus";
+import ExcelFile from "/src/views/group/finance/check-bill/ExcelFile.vue";
+
+const { proxy } = getCurrentInstance();
+const sourceList = ref({
+  data: [],
+  pagination: {
+    total: 0,
+    pageNum: 1,
+    pageSize: 10,
+    purchaseCode: "",
+    supplierName: "",
+    bomSpecCode: "",
+    bomSpecName: "",
+    beginTime: "",
+    endTime: "",
+    type: 1,
+  },
+});
+const loading = ref(false);
+const searchConfig = computed(() => {
+  return [
+    {
+      type: "input",
+      prop: "purchaseCode",
+      label: "采购单号",
+    },
+    {
+      type: "input",
+      prop: "supplierName",
+      label: "供应商",
+    },
+    {
+      type: "input",
+      prop: "bomSpecCode",
+      label: "BOM品号",
+    },
+    {
+      type: "input",
+      prop: "bomSpecName",
+      label: "BOM品名",
+    },
+    {
+      type: "radio-group",
+      prop: "type",
+      label: "维度",
+      data: [
+        {
+          dictKey: 1,
+          dictValue: "本年度",
+        },
+        {
+          dictKey: 2,
+          dictValue: "近365天",
+        },
+        {
+          dictKey: 3,
+          dictValue: "近180天",
+        },
+        {
+          dictKey: 4,
+          dictValue: "近90天",
+        },
+      ],
+    },
+    {
+      type: "date",
+      propList: ["beginTime", "endTime"],
+      label: "日期",
+    },
+  ];
+});
+const config = computed(() => {
+  return [
+    {
+      attrs: {
+        label: "入库日期",
+        prop: "outboundTime",
+        width: 160,
+      },
+    },
+    {
+      attrs: {
+        label: "采购订单号",
+        prop: "purchaseCode",
+        width: 160,
+      },
+    },
+    {
+      attrs: {
+        label: "入库单号",
+        prop: "outboundCode",
+        width: 160,
+      },
+    },
+    {
+      attrs: {
+        label: "仓库名称",
+        prop: "warehouseName",
+        width: 160,
+      },
+    },
+    {
+      attrs: {
+        label: "供应商名称",
+        prop: "supplierName",
+        width: 160,
+      },
+    },
+    {
+      attrs: {
+        label: "品号",
+        prop: "bomSpecCode",
+        width: 140,
+      },
+    },
+    {
+      attrs: {
+        label: "品名",
+        prop: "bomSpecName",
+        "min-width": 240,
+      },
+    },
+    {
+      attrs: {
+        label: "入库数量",
+        prop: "outboundQuantity",
+        width: 120,
+      },
+    },
+    {
+      attrs: {
+        label: "单位",
+        prop: "bomSpecUnit",
+        width: 120,
+      },
+    },
+    {
+      attrs: {
+        label: "含税单价",
+        prop: "outboundUnitPrice",
+        width: 120,
+      },
+    },
+    // {
+    //   attrs: {
+    //     label: "未税金额",
+    //     prop: "dimensionality",
+    //     width: 160,
+    //   },
+    //   render(val) {
+    //     return proxy.moneyFormat(val);
+    //   },
+    // },
+    // {
+    //   attrs: {
+    //     label: "税额",
+    //     prop: "dimensionality",
+    //     width: 160,
+    //   },
+    //   render(val) {
+    //     return proxy.moneyFormat(val);
+    //   },
+    // },
+    // {
+    //   attrs: {
+    //     label: "价税合计金额",
+    //     prop: "dimensionality",
+    //     width: 160,
+    //   },
+    //   render(val) {
+    //     return proxy.moneyFormat(val);
+    //   },
+    // },
+    // {
+    //   attrs: {
+    //     label: "税率",
+    //     prop: "dimensionality",
+    //     width: 160,
+    //   },
+    // },
+  ];
+});
+const getList = async (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("/purchaseWarehousing/page", sourceList.value.pagination).then((res) => {
+    if (res.rows && res.rows.length > 0) {
+      sourceList.value.data = res.rows.map((item) => {
+        return {
+          ...item,
+          isCheck: true,
+        };
+      });
+    } else {
+      sourceList.value.data = [];
+    }
+    sourceList.value.pagination.total = res.total;
+    setTimeout(() => {
+      loading.value = false;
+    }, 200);
+  });
+};
+const clickReset = () => {
+  sourceList.value.pagination.type = 1;
+  changeRadioGroup();
+};
+const changeRadioGroup = () => {
+  let beginTime = "";
+  let endTime = "";
+  if (sourceList.value.pagination.type == 1) {
+    beginTime = date.getYearFirstDay();
+    endTime = date.getYearLastDay();
+  } else if (sourceList.value.pagination.type == 2) {
+    let days = date.getDaysNoTime(365);
+    beginTime = days.startTime;
+    endTime = days.endTime;
+  } else if (sourceList.value.pagination.type == 3) {
+    let days = date.getDaysNoTime(180);
+    beginTime = days.startTime;
+    endTime = days.endTime;
+  } else if (sourceList.value.pagination.type == 4) {
+    let days = date.getDaysNoTime(90);
+    beginTime = days.startTime;
+    endTime = days.endTime;
+  }
+  getList({ beginTime: beginTime, endTime: endTime });
+};
+changeRadioGroup();
+const openFileList = ref(false);
+const clickExcel = () => {
+  proxy.postFile("/purchaseWarehousing/exportExcel", sourceList.value.pagination).then(() => {
+    ElMessage({ message: "导出成功", type: "success" });
+    openFileList.value = true;
+  });
+};
+const clickExcelFile = () => {
+  openFileList.value = true;
+};
+</script>
+
+<style lang="scss" scoped></style>