瀏覽代碼

物控采购看板

lxf 1 年之前
父節點
當前提交
9391124b39

+ 19 - 1
src/components/process/subscribe.vue

@@ -54,6 +54,7 @@ import { useRoute } from "vue-router";
 import moment from "moment";
 import SelectBOM from "/src/views/group/BOM/management/index";
 import { ElMessage } from "element-plus";
+import subscribeStore from "/src/store/modules/subscribe";
 
 const route = useRoute();
 // 接收父组件的传值
@@ -195,7 +196,24 @@ watch(
     deep: true,
   }
 );
-onMounted(() => {});
+onMounted(() => {
+  if (route.query.subscribeStatus) {
+    if (subscribeStore().subscribe.list && subscribeStore().subscribe.list.length > 0) {
+      formData.data.applyBuyBomList = subscribeStore().subscribe.list.map((item) => {
+        return {
+          bomSpecId: item.bomSpecId,
+          bomSpecCode: item.bomSpecCode,
+          bomSpecName: item.bomSpecName,
+          bomSpecColour: item.colour,
+          bomSpecLength: item.length,
+          bomSpecWidth: item.width,
+          bomSpecHeight: item.height,
+          quantity: undefined,
+        };
+      });
+    }
+  }
+});
 // 向父组件暴露
 defineExpose({ getFormData, handleSubmit });
 </script>

+ 14 - 0
src/store/modules/subscribe.js

@@ -0,0 +1,14 @@
+const subscribeStore = defineStore("subscribeStore_sd", {
+  state: () => ({
+    subscribe: {
+      list: [],
+    },
+  }),
+  actions: {
+    setSubscribe(data) {
+      this.subscribe.list = data;
+    },
+  },
+});
+
+export default subscribeStore;

+ 145 - 32
src/views/group/data-board/material-control-purchasing/index.vue

@@ -8,10 +8,14 @@
         :loading="loading"
         :searchConfig="searchConfig"
         highlight-current-row
+        :table-events="{
+          select: selectRow,
+          'select-all': selectRow,
+        }"
         :action-list="[
           {
-            text: '导出Excel',
-            action: () => deriveExcel(),
+            text: '一键申购',
+            action: () => oneKeySubscribe(),
           },
         ]"
         @get-list="getList"
@@ -24,7 +28,7 @@
 
 <script setup>
 import byTable from "/src/components/byTable/index";
-import moment from "moment";
+import subscribeStore from "/src/store/modules/subscribe";
 
 const { proxy } = getCurrentInstance();
 const sourceList = ref({
@@ -33,7 +37,6 @@ const sourceList = ref({
     total: 0,
     pageNum: 1,
     pageSize: 10,
-    purchaseCode: "",
     bomSpecCode: "",
     bomSpecName: "",
   },
@@ -43,11 +46,6 @@ const searchConfig = computed(() => {
   return [
     {
       type: "input",
-      prop: "purchaseCode",
-      label: "采购单号",
-    },
-    {
-      type: "input",
       prop: "bomSpecCode",
       label: "品号",
     },
@@ -61,6 +59,12 @@ const searchConfig = computed(() => {
 const config = computed(() => {
   return [
     {
+      type: "selection",
+      attrs: {
+        checkAtt: "isCheck",
+      },
+    },
+    {
       attrs: {
         label: "品号",
         prop: "bomSpecCode",
@@ -76,38 +80,108 @@ const config = computed(() => {
     },
     {
       attrs: {
-        label: "采购单号",
-        prop: "purchaseCode",
-        width: 160,
+        label: "当前库存",
+        prop: "inventoryQuantity",
+        align: "center",
+        width: 100,
       },
     },
     {
       attrs: {
-        label: "供应商",
-        prop: "supplierName",
-        width: 220,
+        label: "40天安全库存",
+        prop: "safetyInventoryQuantity",
+        align: "center",
+        width: 110,
       },
     },
     {
       attrs: {
-        label: "采购数量",
-        prop: "purchaseQuantity",
-        width: 120,
+        label: "近七天消耗量",
+        prop: "outStorageQuantitySevenDays",
+        align: "center",
+        width: 110,
       },
     },
     {
       attrs: {
-        label: "在途数量",
-        prop: "inTransitQuantity",
-        width: 120,
+        label: "近15天消耗量",
+        prop: "outStorageQuantityFifteenDays",
+        align: "center",
+        width: 110,
       },
     },
     {
       attrs: {
-        label: "交期",
-        prop: "deliveryDate",
-        width: 160,
+        label: "近30天消耗量",
+        prop: "outStorageQuantityThirtyDays",
+        align: "center",
+        width: 110,
+      },
+    },
+    {
+      attrs: {
+        label: "近60天消耗量",
+        prop: "outStorageQuantitySixtyDays",
+        align: "center",
+        width: 110,
+      },
+    },
+    {
+      attrs: {
+        label: "周环比销量",
+        prop: "outStorageWeekOnWeekRatio",
+        align: "center",
+        width: 100,
+      },
+      render(val) {
+        return val * 100 + "%";
+      },
+    },
+    {
+      attrs: {
+        label: "预计消耗天数",
+        prop: "predictOutStorageDays",
         align: "center",
+        width: 110,
+      },
+    },
+    {
+      attrs: {
+        label: "在途总数",
+        prop: "inTransitSum",
+        align: "center",
+        width: 100,
+      },
+    },
+    {
+      attrs: {
+        label: "下一批到货天数",
+        prop: "nextDeliveryDays",
+        align: "center",
+        width: 130,
+      },
+    },
+    {
+      attrs: {
+        label: "操作",
+        width: 100,
+        align: "center",
+        fixed: "right",
+      },
+      renderHTML(row) {
+        return [
+          {
+            attrs: {
+              label: "发起申购",
+              type: "primary",
+              text: true,
+            },
+            el: "button",
+            click() {
+              clickSubscribe(row);
+            },
+          },
+        ];
       },
     },
   ];
@@ -122,8 +196,17 @@ const getList = async (req, status) => {
     sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
   }
   loading.value = true;
-  proxy.post("/purchaseInTransitBom/page", sourceList.value.pagination).then((res) => {
-    sourceList.value.data = res.rows;
+  proxy.post("/purchaseBomBoard/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;
@@ -134,16 +217,46 @@ getList();
 const clickReset = () => {
   getList("", true);
 };
-const deriveExcel = () => {
-  proxy.postFile("/purchaseInTransitBom/export", sourceList.value.pagination).then((res) => {
-    proxy.downloadFile(res, "在途物料.xlsx");
-  });
+const selectData = ref([]);
+const selectRow = (data) => {
+  selectData.value = data;
 };
-const cellClassName = (val) => {
-  if (val.row.deliveryDate < moment().format("yyyy-MM-DD HH:mm:ss")) {
+const cellClassName = ({ columnIndex, row }) => {
+  if (columnIndex === 3 && row.inventoryQuantity < row.safetyInventoryQuantity) {
+    return "colorDim";
+  }
+  if (columnIndex === 10 && row.predictOutStorageDays < 40) {
     return "colorDim";
   }
 };
+const clickSubscribe = (row) => {
+  subscribeStore().setSubscribe([row]);
+  proxy.$router.replace({
+    path: "/platform_manage/process/processApproval",
+    query: {
+      flowKey: "apply_buy",
+      flowName: "申购流程",
+      random: proxy.random(),
+      subscribeStatus: true,
+    },
+  });
+};
+const oneKeySubscribe = () => {
+  if (selectData.value && selectData.value.length > 0) {
+    subscribeStore().setSubscribe(selectData.value);
+    proxy.$router.replace({
+      path: "/platform_manage/process/processApproval",
+      query: {
+        flowKey: "apply_buy",
+        flowName: "申购流程",
+        random: proxy.random(),
+        subscribeStatus: true,
+      },
+    });
+  } else {
+    return ElMessage("请选择需要申购的数据");
+  }
+};
 </script>
 
 <style lang="scss" scoped>