Browse Source

维多利亚新需求

cz 1 year ago
parent
commit
d5165f5761

BIN
public/static/ProductImportTemplate.xlsx


+ 1 - 1
src/components/WDLY/process/SendSubscribeWDLY.vue

@@ -337,7 +337,7 @@ const aaa = () => {
     .then((res) => res.blob())
     .then((res) => {
       const url = window.URL.createObjectURL(res);
-      var filename = "申购明细导入模板.xlsx";
+      let filename = "申购明细导入模板.xlsx";
       const link = document.createElement("a");
       link.style.display = "none";
       link.href = url;

+ 68 - 1
src/views/WDLY/basic/product/index.vue

@@ -266,9 +266,29 @@
     <el-dialog
       title="Excel导入"
       v-model="openExcelDialog"
-      width="400"
+      width="600"
       v-loading="loading"
     >
+      <div v-loading="excelLoading">
+        <el-button
+          @click="downloadTemplate"
+          type="primary"
+          style="margin-bottom: 10px"
+          >Excel模板下载</el-button
+        >
+        <el-upload
+          :action="actionUrl + '/productInfo/excelImport'"
+          :headers="headers"
+          :on-success="handleSuccessOne"
+          :on-progress="handleProgress"
+          :show-file-list="false"
+          :on-error="handleError"
+          accept=".xls, .xlsx"
+        >
+          <el-button type="primary">点击导入</el-button>
+        </el-upload>
+      </div>
+
       <template #footer>
         <el-button @click="openExcelDialog = false" size="large"
           >取 消</el-button
@@ -332,6 +352,9 @@ import useUserStore from "@/store/modules/user";
 // 引入插件解决json.parse()会导致id值错误
 import { parse, stringify } from "lossless-json";
 import { computed, defineComponent, ref } from "vue";
+import { getToken } from "@/utils/auth";
+const headers = ref({ Authorization: "Bearer " + getToken() });
+const actionUrl = import.meta.env.VITE_APP_BASE_API;
 const tableHeight = window.innerHeight - 360;
 let openProduct = ref(false);
 const loading = ref(false);
@@ -1142,6 +1165,50 @@ const getDict = () => {
   });
 };
 getDict();
+const excelLoading = ref(false);
+const downloadTemplate = () => {
+  fetch("/static/ProductImportTemplate.xlsx")
+    .then((res) => res.blob())
+    .then((res) => {
+      const url = window.URL.createObjectURL(res);
+      let filename = "产品导入模板.xlsx";
+      const link = document.createElement("a");
+      link.style.display = "none";
+      link.href = url;
+      link.setAttribute("download", filename);
+      document.body.appendChild(link);
+      link.click();
+    });
+};
+const handleProgress = () => {
+  excelLoading.value = true;
+};
+const handleSuccessOne = (res) => {
+  if (res.code != 200) {
+    ElMessage({
+      message: `${res.msg},请重试!`,
+      type: "info",
+    });
+  } else {
+    ElMessage({
+      message: "导入成功!",
+      type: "success",
+    });
+    getList();
+    openExcelDialog.value = false;
+  }
+
+  excelLoading.value = false;
+};
+
+const handleError = (err) => {
+  ElMessage({
+    message: `${err},请重试!`,
+    type: "info",
+  });
+  openExcelDialog.value = false;
+  excelLoading.value = false;
+};
 </script>
 
 <style lang="scss" scoped>

+ 49 - 3
src/views/WDLY/outInBound/waitOutBound/index.vue

@@ -141,6 +141,19 @@
             </el-table>
           </div>
         </template>
+        <template #statisticsSlot>
+          <div style="width: 100%; display: flex">
+            <div style="margin-right: 20px">
+              应出库:{{ statistics("waitQuantity") }}
+            </div>
+            <div style="margin-right: 20px">
+              已出库:{{ statistics("receiptQuantity") }}
+            </div>
+            <div style="margin-right: 10px">
+              本次出库:{{ statistics("quantity") }}
+            </div>
+          </div>
+        </template>
       </byForm>
       <template #footer>
         <el-button @click="dialogVisible = false" size="large">取 消</el-button>
@@ -154,6 +167,7 @@
         </el-button>
       </template>
     </el-dialog>
+
     <el-dialog
       v-model="openProduct"
       title="选择产品"
@@ -520,6 +534,15 @@ const configData = computed(() => [
       type: "slot",
       slotName: "products",
     },
+    {
+      type: "title",
+      title: "出库统计",
+    },
+    {
+      type: "slot",
+      slotName: "statisticsSlot",
+      label: "",
+    },
   ],
   [
     {
@@ -608,6 +631,15 @@ const configData = computed(() => [
       type: "slot",
       slotName: "products",
     },
+    {
+      type: "title",
+      title: "出库统计",
+    },
+    {
+      type: "slot",
+      slotName: "statisticsSlot",
+      label: "",
+    },
   ],
   [
     {
@@ -828,7 +860,7 @@ const outBound = (row) => {
       res.jdOrderDetailsList = res.stockWaitDetailsList.map((x) => ({
         ...x,
         waitQuantity: x.quantity,
-        quantity: undefined,
+        quantity: null,
       }));
       res.businessType = res.businessType + "";
       if (res.purchaseBackInfo) {
@@ -864,7 +896,7 @@ const outBound = (row) => {
     proxy.post("/jdOrder/detail", { id: row.businessId }).then((res) => {
       res.jdOrderDetailsList = res.jdOrderDetailsList.map((x) => ({
         waitQuantity: x.quantity,
-        quantity: undefined,
+        quantity: null,
         productId: x.productId,
         id: x.id,
         productCustomCode: x.productCustomCode,
@@ -886,7 +918,7 @@ const outBound = (row) => {
       res.jdOrderDetailsList = res.stockWaitDetailsList.map((x) => ({
         ...x,
         waitQuantity: x.quantity,
-        quantity: undefined,
+        quantity: null,
       }));
       res.businessType = res.businessType + "";
       formData.data = res;
@@ -980,6 +1012,20 @@ onMounted(() => {
   selectConfig[0].data = businessType;
   selectConfig[1].data = outboundType.value;
 });
+
+const statistics = (att) => {
+  if (formData.data.jdOrderDetailsList.length > 0) {
+    const total = formData.data.jdOrderDetailsList.reduce(
+      (val, x) => (val += Number(x[att])),
+      0
+    );
+    if (total) {
+      return parseFloat(total).toFixed(2);
+    } else {
+      return 0;
+    }
+  }
+};
 </script>
   
 <style lang="scss" scoped>

+ 49 - 4
src/views/WDLY/purchaseManage/alreadyPurchase/index.vue

@@ -451,8 +451,17 @@
               <el-table-column
                 prop="defectiveQuantity"
                 label="次品数量"
-                width="100"
-              />
+                width="130"
+              >
+                <template #default="{ row, $index }">
+                  <div>
+                    {{ row.defectiveQuantity }}
+                    <span style="color: red"
+                      >({{ row.purchaseNoQualifiedCount }})</span
+                    >
+                  </div>
+                </template>
+              </el-table-column>
               <el-table-column
                 prop="quantity"
                 label="退货数量"
@@ -478,6 +487,19 @@
             </el-table>
           </div>
         </template>
+        <template #statisticsSlot>
+          <div style="width: 100%; display: flex">
+            <div style="margin-right: 20px">
+              采购数量:{{ statistics("count") }}
+            </div>
+            <div style="margin-right: 20px">
+              次品数量:{{ statistics("defectiveQuantity") }}
+            </div>
+            <div style="margin-right: 10px">
+              退货数量:{{ statistics("quantity") }}
+            </div>
+          </div>
+        </template>
 
         <template #countryId>
           <div>
@@ -1221,7 +1243,7 @@ let formConfigTwo = computed(() => [
   },
   {
     type: "title",
-    title: "采购明细",
+    title: "退货明细",
   },
   {
     type: "slot",
@@ -1230,6 +1252,15 @@ let formConfigTwo = computed(() => [
   },
   {
     type: "title",
+    title: "退货统计",
+  },
+  {
+    type: "slot",
+    slotName: "statisticsSlot",
+    label: "",
+  },
+  {
+    type: "title",
     title: "收货信息",
   },
   {
@@ -1512,7 +1543,7 @@ const handleEdit = (row, status) => {
     }
   ).then(() => {
     // 删除
-    proxy.post("/purchase/edit", data).then((res) => {
+    proxy.post("/purchase/editPurchaseStatus", data).then((res) => {
       ElMessage({
         message: `${purchaseStatusName}成功`,
         type: "success",
@@ -2090,6 +2121,20 @@ const submitUpdate = () => {
     });
   });
 };
+
+const statistics = (att) => {
+  if (formData.dataTwo.purchaseBackDetailsList.length > 0) {
+    const total = formData.dataTwo.purchaseBackDetailsList.reduce(
+      (val, x) => (val += Number(x[att])),
+      0
+    );
+    if (total) {
+      return parseFloat(total).toFixed(2);
+    } else {
+      return 0;
+    }
+  }
+};
 </script>
   
 <style lang="scss" scoped>

+ 8 - 0
src/views/purchaseSales/outAndInWarehouse/manualDelivery/index.vue

@@ -269,6 +269,13 @@ const formConfig = computed(() => {
       },
     },
     {
+      type: "input",
+      label: "备注",
+      itemType: "textarea",
+      prop: "remarks",
+      itemWidth: 50,
+    },
+    {
       type: "slot",
       slotName: "details",
       label: "出库明细",
@@ -278,6 +285,7 @@ const formConfig = computed(() => {
 const rules = ref({
   warehouseId: [{ required: true, message: "请选择仓库", trigger: "change" }],
   quantity: [{ required: true, message: "请输入出库数量", trigger: "blur" }],
+  remarks: [{ required: true, message: "请输入备注", trigger: "blur" }],
 });
 const openModal = () => {
   formData.data = {

+ 90 - 22
src/views/purchaseSales/outAndInWarehouse/manualWarehousing/index.vue

@@ -14,32 +14,80 @@
             action: () => openModal(),
           },
         ]"
-        @get-list="getList">
+        @get-list="getList"
+      >
       </byTable>
     </div>
 
-    <el-dialog title="手动入库" v-if="dialogVisible" v-model="dialogVisible" width="1000" v-loading="loadingDialog">
-      <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="submit">
+    <el-dialog
+      title="手动入库"
+      v-if="dialogVisible"
+      v-model="dialogVisible"
+      width="1000"
+      v-loading="loadingDialog"
+    >
+      <byForm
+        :formConfig="formConfig"
+        :formOption="formOption"
+        v-model="formData.data"
+        :rules="rules"
+        ref="submit"
+      >
         <template #details>
           <div style="width: 100%">
-            <el-button type="primary" @click="openProduct = true">添加明细</el-button>
-            <el-table :data="formData.data.list" style="width: 100%; margin-top: 16px">
-              <el-table-column prop="productCode" label="产品编码" width="140" />
-              <el-table-column prop="productName" label="产品名称" min-width="220" />
-              <el-table-column prop="productSpec" label="规格型号" min-width="220" />
+            <el-button type="primary" @click="openProduct = true"
+              >添加明细</el-button
+            >
+            <el-table
+              :data="formData.data.list"
+              style="width: 100%; margin-top: 16px"
+            >
+              <el-table-column
+                prop="productCode"
+                label="产品编码"
+                width="140"
+              />
+              <el-table-column
+                prop="productName"
+                label="产品名称"
+                min-width="220"
+              />
+              <el-table-column
+                prop="productSpec"
+                label="规格型号"
+                min-width="220"
+              />
               <el-table-column prop="productUnit" label="单位" width="100" />
               <el-table-column label="入库数量" width="160">
                 <template #default="{ row, $index }">
                   <div style="width: 100%">
-                    <el-form-item :prop="'list.' + $index + '.quantity'" :rules="rules.quantity" :inline-message="true">
-                      <el-input-number v-model="row.quantity" placeholder="请输入数量" style="width: 100%" :precision="0" :controls="false" :min="0" />
+                    <el-form-item
+                      :prop="'list.' + $index + '.quantity'"
+                      :rules="rules.quantity"
+                      :inline-message="true"
+                    >
+                      <el-input-number
+                        v-model="row.quantity"
+                        placeholder="请输入数量"
+                        style="width: 100%"
+                        :precision="0"
+                        :controls="false"
+                        :min="0"
+                      />
                     </el-form-item>
                   </div>
                 </template>
               </el-table-column>
-              <el-table-column align="center" label="操作" width="80" fixed="right">
+              <el-table-column
+                align="center"
+                label="操作"
+                width="80"
+                fixed="right"
+              >
                 <template #default="{ row, $index }">
-                  <el-button type="primary" link @click="handleDelete($index)">删除</el-button>
+                  <el-button type="primary" link @click="handleDelete($index)"
+                    >删除</el-button
+                  >
                 </template>
               </el-table-column>
             </el-table>
@@ -48,12 +96,22 @@
       </byForm>
       <template #footer>
         <el-button @click="dialogVisible = false" size="large">取 消</el-button>
-        <el-button type="primary" @click="submitForm()" size="large">确 定</el-button>
+        <el-button type="primary" @click="submitForm()" size="large"
+          >确 定</el-button
+        >
       </template>
     </el-dialog>
 
-    <el-dialog v-model="openProduct" title="选择商品" width="70%" append-to-body>
-      <SelectGoods @cancel="openProduct = false" @pushGoods="pushGoods"></SelectGoods>
+    <el-dialog
+      v-model="openProduct"
+      title="选择商品"
+      width="70%"
+      append-to-body
+    >
+      <SelectGoods
+        @cancel="openProduct = false"
+        @pushGoods="pushGoods"
+      ></SelectGoods>
     </el-dialog>
   </div>
 </template>
@@ -163,13 +221,15 @@ const getDict = () => {
 const getList = async (req) => {
   sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
   loading.value = true;
-  proxy.post("/stockJournalDetails/page", sourceList.value.pagination).then((res) => {
-    sourceList.value.data = res.rows;
-    sourceList.value.pagination.total = res.total;
-    setTimeout(() => {
-      loading.value = false;
-    }, 200);
-  });
+  proxy
+    .post("/stockJournalDetails/page", sourceList.value.pagination)
+    .then((res) => {
+      sourceList.value.data = res.rows;
+      sourceList.value.pagination.total = res.total;
+      setTimeout(() => {
+        loading.value = false;
+      }, 200);
+    });
 };
 getDict();
 getList();
@@ -199,6 +259,13 @@ const formConfig = computed(() => {
       data: warehouseList.value,
     },
     {
+      type: "input",
+      label: "备注",
+      itemType: "textarea",
+      prop: "remarks",
+      itemWidth: 50,
+    },
+    {
       type: "slot",
       slotName: "details",
       label: "入库明细",
@@ -207,6 +274,7 @@ const formConfig = computed(() => {
 });
 const rules = ref({
   warehouseId: [{ required: true, message: "请选择仓库", trigger: "change" }],
+  remarks: [{ required: true, message: "请输入备注", trigger: "blur" }],
 });
 const openModal = () => {
   formData.data = {