24282 8 ヶ月 前
コミット
f723f220be
1 ファイル変更108 行追加101 行削除
  1. 108 101
      src/views/WDLY/outInBound/waitInBound/index.vue

+ 108 - 101
src/views/WDLY/outInBound/waitInBound/index.vue

@@ -29,16 +29,18 @@
         <template #detail>
           <div style="width: 100%">
             <el-table :data="formData.data.stockWaitDetailsList" show-summary :summary-method="getSummaries">
-              <el-table-column prop="productCustomCode" label="物品编码" width="130" />
-              <el-table-column prop="productName" label="物品名称" />
-              <el-table-column prop="productSpec" label="规格" width="120" />
-              <el-table-column prop="purchaseQuantity" label="采购数量" width="100" />
-              <el-table-column prop="arrivalQuantity" label="本次发货" width="100" />
-              <el-table-column prop="receiptQuantity" label="已入库" width="100" />
+              <el-table-column prop="productCustomCode" label="物品编码" width="130"/>
+              <el-table-column prop="productName" label="物品名称"/>
+              <el-table-column prop="productSpec" label="规格" width="120"/>
+              <el-table-column prop="purchaseQuantity" label="采购数量" width="100"/>
+              <el-table-column prop="arrivalQuantity" label="本次发货" width="100"/>
+              <el-table-column prop="receiptQuantity" label="已入库" width="100"/>
               <el-table-column prop="quantity" label="本次入库" width="160">
                 <template #default="{ row, $index }">
-                  <el-form-item :prop="'stockWaitDetailsList.' + $index + '.quantity'" :rules="rules.quantity" :inline-message="true">
-                    <el-input-number v-model="row.quantity" :precision="0" :controls="false" :min="0" onmousewheel="return false;" />
+                  <el-form-item :prop="'stockWaitDetailsList.' + $index + '.quantity'" :rules="rules.quantity"
+                                :inline-message="true">
+                    <el-input-number v-model="row.quantity" :precision="0" :controls="false" :min="0"
+                                     onmousewheel="return false;"/>
                   </el-form-item>
                 </template>
               </el-table-column>
@@ -55,15 +57,15 @@
     </el-dialog>
   </div>
 </template>
-  
+
 <script setup>
 /* eslint-disable vue/no-unused-components */
-import { ElMessage, ElMessageBox } from "element-plus";
+import {ElMessage, ElMessageBox} from "element-plus";
 import byTable from "@/components/byTable/index";
 import byForm from "@/components/byForm/index";
-import { computed, defineComponent, ref } from "vue";
+import {computed, ref} from "vue";
 import useUserStore from "@/store/modules/user";
-import { getToken } from "@/utils/auth";
+
 const actionUrl = import.meta.env.VITE_APP_BASE_API;
 const loading = ref(false);
 const submitLoading = ref(false);
@@ -81,14 +83,14 @@ let roomDialogVisible = ref(false);
 let modalType = ref("add");
 let rules = ref({
   type: [
-    { required: true, message: "请选择仓库类型", trigger: ["blur", "change"] },
+    {required: true, message: "请选择仓库类型", trigger: ["blur", "change"]},
   ],
   warehouseId: [
-    { required: true, message: "请选择仓库名称", trigger: "change" },
+    {required: true, message: "请选择仓库名称", trigger: "change"},
   ],
-  quantity: [{ required: true, message: "请输入入库数量", trigger: "blur" }],
+  quantity: [{required: true, message: "请输入入库数量", trigger: "blur"}],
 });
-const { proxy } = getCurrentInstance();
+const {proxy} = getCurrentInstance();
 const selectConfig = reactive([
   {
     label: "数据来源",
@@ -114,6 +116,10 @@ const inboundType = ref([
     label: "入库完成",
     value: "2",
   },
+  {
+    label: "结束",
+    value: "3",
+  }
 ]);
 const config = computed(() => {
   return [
@@ -178,7 +184,7 @@ const config = computed(() => {
         width: 100,
       },
       render(status) {
-        return status == 0 ? "未入库" : status == 1 ? "部分入库" : "入库完成";
+        return status == 0 ? "未入库" : status == 1 ? "部分入库" : status == 1 ? "入库完成" : "结束";
       },
     },
     {
@@ -191,7 +197,7 @@ const config = computed(() => {
       renderHTML(row) {
         return [
           row.status < 2
-            ? {
+              ? {
                 attrs: {
                   label: "入库",
                   type: "primary",
@@ -202,7 +208,8 @@ const config = computed(() => {
                   getDtl(row);
                 },
               }
-            : {},
+              : {},
+          row.status < 3?
           {
             attrs: {
               label: "结束入库",
@@ -218,19 +225,19 @@ const config = computed(() => {
               }).then(() => {
                 // 删除
                 proxy
-                  .post("/stockWait/endInStock", {
-                    id: row.id,
-                  })
-                  .then((res) => {
-                    ElMessage({
-                      message: "操作成功",
-                      type: "success",
+                    .post("/stockWait/endInStock", {
+                      id: row.id,
+                    })
+                    .then((res) => {
+                      ElMessage({
+                        message: "操作成功",
+                        type: "success",
+                      });
+                      getList();
                     });
-                    getList();
-                  });
               });
             },
-          },
+          }: {},
         ];
       },
     },
@@ -311,21 +318,21 @@ const formConfig = reactive([
   },
 ]);
 const getList = async (req) => {
-  sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
+  sourceList.value.pagination = {...sourceList.value.pagination, ...req};
   loading.value = true;
   proxy
-    .post("/stockWait/pageByWdly", sourceList.value.pagination)
-    .then((message) => {
-      console.log(message);
-      sourceList.value.data = message.rows.map((x) => ({
-        ...x,
-        ...JSON.parse(x.victoriatouristJson),
-      }));
-      sourceList.value.pagination.total = message.total;
-      setTimeout(() => {
-        loading.value = false;
-      }, 200);
-    });
+      .post("/stockWait/pageByWdly", sourceList.value.pagination)
+      .then((message) => {
+        console.log(message);
+        sourceList.value.data = message.rows.map((x) => ({
+          ...x,
+          ...JSON.parse(x.victoriatouristJson),
+        }));
+        sourceList.value.pagination.total = message.total;
+        setTimeout(() => {
+          loading.value = false;
+        }, 200);
+      });
 };
 
 const openModal = () => {
@@ -355,26 +362,26 @@ const submitForm = () => {
     // }
     submitLoading.value = true;
     proxy.post("/stockWait/addByWdly", formData.data).then(
-      (res) => {
-        ElMessage({
-          message: "操作成功",
-          type: "success",
-        });
-        dialogVisible.value = false;
-        submitLoading.value = false;
-        getList();
-      },
-      (err) => (submitLoading.value = false)
+        (res) => {
+          ElMessage({
+            message: "操作成功",
+            type: "success",
+          });
+          dialogVisible.value = false;
+          submitLoading.value = false;
+          getList();
+        },
+        (err) => (submitLoading.value = false)
     );
   });
 };
 
 const getDtl = (row) => {
   modalType.value = "edit";
-  proxy.post("/stockWait/detailByWdly", { id: row.id }).then((res) => {
+  proxy.post("/stockWait/detailByWdly", {id: row.id}).then((res) => {
     const json = res.victoriatouristJson
-      ? JSON.parse(res.victoriatouristJson)
-      : {};
+        ? JSON.parse(res.victoriatouristJson)
+        : {};
     formData.data = {
       id: row.id,
       type: "1",
@@ -386,10 +393,10 @@ const getDtl = (row) => {
         ...x,
         arrivalQuantity: x.quantity,
         quantity: x.stockWaitDetailsCheckList
-          ? x.stockWaitDetailsCheckList
-              .filter((x) => x.status != 2)
-              .reduce((total, y) => (total += Number(y.quantity)), 0)
-          : 0,
+            ? x.stockWaitDetailsCheckList
+                .filter((x) => x.status != 2)
+                .reduce((total, y) => (total += Number(y.quantity)), 0)
+            : 0,
       })),
     };
     dialogVisible.value = true;
@@ -399,23 +406,23 @@ const warehouseType = ref([]);
 const getDict = () => {
   // // 币种数据
   proxy
-    .post("/dictTenantData/page", {
-      pageNum: 1,
-      pageSize: 999,
-      tenantId: useUserStore().user.tenantId,
-      dictCode: "warehouse_type",
-    })
-    .then((res) => {
-      warehouseType.value = res.rows;
-    });
+      .post("/dictTenantData/page", {
+        pageNum: 1,
+        pageSize: 999,
+        tenantId: useUserStore().user.tenantId,
+        dictCode: "warehouse_type",
+      })
+      .then((res) => {
+        warehouseType.value = res.rows;
+      });
 };
 
 const businessType = [
-  { label: "线边回仓", value: "1" },
-  { label: "完工入库", value: "2" },
-  { label: "采购到货", value: "3" },
-  { label: "退货出库", value: "4" },
-  { label: "多货处理", value: "23" },
+  {label: "线边回仓", value: "1"},
+  {label: "完工入库", value: "2"},
+  {label: "采购到货", value: "3"},
+  {label: "退货出库", value: "4"},
+  {label: "多货处理", value: "23"},
 ];
 
 getList();
@@ -438,32 +445,32 @@ const deriveExcel = () => {
     type: "success",
   });
   proxy
-    .postTwo(
-      "/stockWait/inStockWaitExportExcel",
-      selectData.value.map((x) => x.id)
-    )
-    .then((res) => {
-      const content = res;
-      const blob = new Blob([content], { type: "application/ms-excel" });
-      const fileName = "待入库.xlsx";
-      if ("download" in document.createElement("a")) {
-        // 非IE下载
-        const elink = document.createElement("a");
-        elink.download = fileName;
-        elink.style.display = "none";
-        elink.href = URL.createObjectURL(blob);
-        document.body.appendChild(elink);
-        elink.click();
-        URL.revokeObjectURL(elink.href); // 释放URL 对象
-        document.body.removeChild(elink);
-      } else {
-        navigator.msSaveBlob(blob, fileName);
-      }
-    });
+      .postTwo(
+          "/stockWait/inStockWaitExportExcel",
+          selectData.value.map((x) => x.id)
+      )
+      .then((res) => {
+        const content = res;
+        const blob = new Blob([content], {type: "application/ms-excel"});
+        const fileName = "待入库.xlsx";
+        if ("download" in document.createElement("a")) {
+          // 非IE下载
+          const elink = document.createElement("a");
+          elink.download = fileName;
+          elink.style.display = "none";
+          elink.href = URL.createObjectURL(blob);
+          document.body.appendChild(elink);
+          elink.click();
+          URL.revokeObjectURL(elink.href); // 释放URL 对象
+          document.body.removeChild(elink);
+        } else {
+          navigator.msSaveBlob(blob, fileName);
+        }
+      });
 };
 
 const getSummaries = (param) => {
-  const { columns, data } = param; //columns是每列的信息,data是每行的信息
+  const {columns, data} = param; //columns是每列的信息,data是每行的信息
   const sums = [];
   columns.forEach((column, index) => {
     if (index === 0) {
@@ -472,10 +479,10 @@ const getSummaries = (param) => {
     }
     const values = data.map((item) => Number(item[column.property]));
     if (
-      column.property === "purchaseQuantity" ||
-      column.property === "arrivalQuantity" ||
-      column.property === "receiptQuantity" ||
-      column.property === "quantity"
+        column.property === "purchaseQuantity" ||
+        column.property === "arrivalQuantity" ||
+        column.property === "receiptQuantity" ||
+        column.property === "quantity"
     ) {
       sums[index] = values.reduce((prev, curr) => {
         const value = Number(curr);
@@ -491,7 +498,7 @@ const getSummaries = (param) => {
   return sums;
 };
 </script>
-  
+
 <style lang="scss" scoped>
 .tenant {
   padding: 20px;