24282 6 months ago
parent
commit
e4813df8c5

+ 49 - 2
src/views/WDLY/jd/refund/index.vue

@@ -2,7 +2,7 @@
   <div class="tenant">
     <byTable :source="sourceList.data" :pagination="sourceList.pagination" :config="config" :loading="loading"
              :selectConfig="selectConfig" :action-list="actionConfig" @get-list="getList"
-             @moreSearch="() => queryDialogVisible = true">
+             @moreSearch="() => queryDialogVisible = true" :table-events="tableEvents">
     </byTable>
 
     <!--高级搜索-->
@@ -58,6 +58,8 @@ const openExcelDialog = ref(false);
 const excelLoading = ref(false);
 const headers = computed(() => useImportExcelStore().requestHeaders);
 
+const selectData = ref([]);
+
 const sourceList = ref({
   data: [],
   pagination: {
@@ -67,6 +69,14 @@ const sourceList = ref({
   },
 });
 
+const tableEvents = computed(() => {
+  return {
+    'selection-change': (val) => {
+      selectData.value = val;
+    },
+  }
+})
+
 const actionConfig = computed(() => {
   return [
     {
@@ -74,7 +84,32 @@ const actionConfig = computed(() => {
       action: () => {
         openExcelDialog.value = true;
       },
-    }]
+    },
+    {
+      text: '批量确认收货',
+      disabled: selectData.value.length === 0,
+      action: () => {
+        ElMessageBox.confirm("是否确认批量收货?", "提示", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning",
+        }).then(() => {
+          const ids = selectData.value.map(item => item.jdRefundDetailId);
+
+          console.log(ids)
+          loading.value = true;
+          proxy.post("/jdRefund/confirms", {ids})
+              .then(() => {
+                ElMessage.success("批量确认收货成功")
+                getList()
+              })
+              .catch(err => {
+                loading.value = false;
+              })
+        })
+      },
+    }
+  ]
 })
 
 const selectConfig = computed(() => {
@@ -99,6 +134,12 @@ const selectConfig = computed(() => {
 const config = computed(() => {
   return [
     {
+      type: "selection",
+      attrs: {
+        checkAtt: "isCheck",
+      },
+    },
+    {
       attrs: {
         label: "审核状态",
         prop: "statusName",
@@ -286,6 +327,12 @@ const getList = async (req) => {
       .then(({data}) => {
         sourceList.value.data = data.rows;
         sourceList.value.pagination.total = data.total;
+
+        for (let item of sourceList.value.data) {
+          if (item.status === 0) {
+            item.isCheck = true
+          }
+        }
       })
       .finally(_ => {
         loading.value = false;

+ 35 - 0
src/views/WDLY/salesMange/jdReGoodsInspection/CheckProduct.vue

@@ -12,6 +12,10 @@
         导入产品
       </el-button>
 
+      <el-button type="primary" @click="handleExportExcel" style="margin-bottom: 10px">
+        导出待质检产品
+      </el-button>
+
       <el-table :data="list">
         <el-table-column prop="productCustomCode" label="物品编码"/>
         <el-table-column prop="productName" label="物品名称"/>
@@ -310,5 +314,36 @@ const handleError = (err) => {
   excelLoading.value = false;
 };
 
+const handleExportExcel = () => {
+  proxy.postTwo("/jdRefundNotQualityCheck/exportExcel", {}).then(
+      (res) => {
+        exportData(res, "待质检产品.xlsx");
+      },
+      (err) => {
+        ElMessage.error(`导出失败,请联系管理员`);
+      }
+  );
+}
+
+const exportData = (res, name) => {
+  const content = res;
+  const blob = new Blob([content], { type: "application/ms-excel" });
+  const fileName = name;
+  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);
+  }
+};
+
+
 defineExpose({open})
 </script>

+ 153 - 9
src/views/WDLY/salesMange/jdScrappedHandle/index.vue

@@ -2,7 +2,7 @@
   <div class="tenant">
     <byTable :source="sourceList.data" :pagination="sourceList.pagination" :config="config" :loading="loading"
              :selectConfig="selectConfig" :action-list="actionList" @get-list="getList"
-             @moreSearch="() => queryDialogVisible = true">
+             @moreSearch="() => queryDialogVisible = true" :table-events="tableEvents">
     </byTable>
 
     <!--高级搜索-->
@@ -24,7 +24,8 @@
 
       <el-form label-position="right" label-width="auto">
         <el-form-item label="报废数量">
-          <el-input-number v-model="formData.scrappedCount" style="width: 100%" :controls="false" disabled></el-input-number>
+          <el-input-number v-model="formData.scrappedCount" style="width: 100%" :controls="false"
+                           disabled></el-input-number>
         </el-form-item>
         <el-form-item label="转良品数量">
           <el-input-number v-model="formData.scrappedToQualifiedCount" style="width: 100%" :controls="false" :min="0"
@@ -46,6 +47,39 @@
       </template>
     </el-dialog>
 
+    <el-dialog title="批量处理" v-model="batchVisible" width="1200px" destroy-on-close>
+
+      <el-table :data="handleSelectData">
+        <el-table-column prop="code" label="质检单号"/>
+        <el-table-column prop="productCustomCode" label="物品编码"/>
+        <el-table-column prop="productName" label="物品名称"/>
+        <el-table-column prop="scrappedCount" label="报废数量"/>
+        <el-table-column prop="scrappedToQualifiedCount" label="报废转良品数量">
+          <template #default="scope">
+            <el-input-number v-model="scope.row.scrappedToQualifiedCount" style="width: 100%" :controls="false" :min="0"
+                             :max="scope.row.scrappedCount" :precision="0"/>
+          </template>
+        </el-table-column>
+        <el-table-column prop="scrappedToDefectiveCount" label="报废转次品数量">
+          <template #default="scope">
+            <el-input-number v-model="scope.row.scrappedToDefectiveCount" style="width: 100%" :controls="false" :min="0"
+                             :max="scope.row.scrappedCount" :precision="0"/>
+          </template>
+        </el-table-column>
+        <el-table-column prop="resultScrappedCount" label="最终报废数量">
+          <template #default="scope">
+            <el-input-number v-model="scope.row.resultScrappedCount" style="width: 100%" :controls="false" :min="0"
+                             :max="scope.row.scrappedCount" :precision="0"/>
+          </template>
+        </el-table-column>
+      </el-table>
+
+      <template #footer>
+        <el-button @click="batchVisible = false" size="large">取消</el-button>
+        <el-button @click="batchSubmit" type="primary" size="large">确定</el-button>
+      </template>
+    </el-dialog>
+
   </div>
 </template>
 
@@ -58,30 +92,86 @@ const {proxy} = getCurrentInstance();
 const loading = ref(false);
 
 const visible = ref(false);
+const batchVisible = ref(false);
 const queryDialogVisible = ref(false);
 
 const formData = ref({})
 
+const selectData = ref([]);
+const handleSelectData = ref([]);
+
 const sourceList = ref({
   data: [],
   pagination: {
     total: 0,
     pageNum: 1,
     pageSize: 10,
+    scrappedHandleStatus: undefined
   },
 });
 
-const selectConfig = computed(() => {
-  return [];
-});
+const tableEvents = computed(() => {
+  return {
+    'selection-change': (val) => {
+      selectData.value = val;
+
+      handleSelectData.value = []
+      selectData.value.forEach(item => {
+        handleSelectData.value.push({...item, resultScrappedCount: item.scrappedCount})
+      });
+    },
+  }
+})
+
+const selectConfig = ref([
+  {
+    label: "状态",
+    prop: "scrappedHandleStatus",
+    data: [
+      {
+        label: "待处理",
+        value: "1",
+      },
+      {
+        label: "待验证",
+        value: "2",
+      },
+      {
+        label: "已验证",
+        value: "3",
+      },
+    ],
+  },
+
+  {
+    label: "项目组",
+    prop: "deptId",
+  },
+
+]);
+
 
 const actionList = computed(() => {
-  return []
+  return [
+    {
+      text: '批量处理',
+      disabled: selectData.value.length === 0,
+      action: () => {
+        batchVisible.value = true;
+      }
+    }
+  ]
 });
 
 const config = computed(() => {
   return [
     {
+      type: "selection",
+      attrs: {
+        checkAtt: "isCheck",
+      },
+    },
+    {
       attrs: {
         label: "质检单号",
         prop: "code",
@@ -155,15 +245,31 @@ const config = computed(() => {
           case 1:
             return '待处理'
           case 2:
-            return '待确认'
+            return '待验证'
           case 3:
-            return '已确认'
+            return '已验证'
         }
         return '未知状态';
       },
     },
     {
       attrs: {
+        label: "生成时间",
+        prop: "createTime",
+        align: "left",
+        width: 160
+      },
+    },
+    {
+      attrs: {
+        label: "处理时间",
+        prop: "scrappedHandleTime",
+        align: "left",
+        width: 160
+      },
+    },
+    {
+      attrs: {
         label: "操作",
         align: "center",
         fixed: "right",
@@ -190,6 +296,22 @@ const config = computed(() => {
   ];
 });
 
+const getDeptList = () => {
+  proxy.get("/jdRefundQualityCheck/deptList", {})
+      .then(({data}) => {
+        console.log(data)
+        selectConfig.value[1].data = data.map((item) => {
+          return {
+            label: item.deptName,
+            value: item.deptId,
+          };
+        });
+      })
+
+  selectConfig.value = JSON.parse(JSON.stringify(selectConfig.value));
+}
+getDeptList();
+
 const getList = async (req) => {
   loading.value = true;
 
@@ -207,6 +329,12 @@ const getList = async (req) => {
       .then(({data}) => {
         sourceList.value.data = data.rows;
         sourceList.value.pagination.total = data.total;
+
+        for (let item of sourceList.value.data) {
+          if (item.scrappedHandleStatus === 1) {
+            item.isCheck = true
+          }
+        }
       })
       .finally(_ => {
         loading.value = false;
@@ -228,7 +356,7 @@ const handleQuery = () => {
 };
 
 const submit = () => {
-  const {scrappedCount,scrappedToQualifiedCount,scrappedToDefectiveCount,resultScrappedCount} = formData.value
+  const {scrappedCount, scrappedToQualifiedCount, scrappedToDefectiveCount, resultScrappedCount} = formData.value
   if (scrappedCount !== scrappedToQualifiedCount + scrappedToDefectiveCount + resultScrappedCount) {
     ElMessage.error("转良品数量+转次品数量+最终报废数量 必须等于 报废数量")
     return
@@ -241,6 +369,22 @@ const submit = () => {
       })
 }
 
+const batchSubmit = () => {
+  for (let item of handleSelectData.value) {
+    const {scrappedCount, scrappedToQualifiedCount, scrappedToDefectiveCount, resultScrappedCount} = item
+    if (scrappedCount !== scrappedToQualifiedCount + scrappedToDefectiveCount + resultScrappedCount) {
+      ElMessage.error(`产品【${item.productCustomCode}】转良品数量+转次品数量+最终报废数量 必须等于 报废数量`)
+      return
+    }
+  }
+  proxy.post("/jdRefundQualityCheck/batchHandle", handleSelectData.value)
+      .then(() => {
+        ElMessage.success("批量处理成功")
+        batchVisible.value = false;
+        getList()
+      })
+}
+
 getList();
 
 </script>

+ 144 - 12
src/views/WDLY/salesMange/jdScrappedVerify/index.vue

@@ -2,7 +2,7 @@
   <div class="tenant">
     <byTable :source="sourceList.data" :pagination="sourceList.pagination" :config="config" :loading="loading"
              :selectConfig="selectConfig" :action-list="actionList" @get-list="getList"
-             @moreSearch="() => queryDialogVisible = true">
+             @moreSearch="() => queryDialogVisible = true" :table-events="tableEvents">
     </byTable>
 
     <!--高级搜索-->
@@ -30,8 +30,12 @@ import {ElMessage, ElMessageBox} from "element-plus";
 const {proxy} = getCurrentInstance();
 const loading = ref(false);
 
+const query = ref({})
+
 const queryDialogVisible = ref(false);
 
+const selectData = ref([]);
+
 const sourceList = ref({
   data: [],
   pagination: {
@@ -41,17 +45,108 @@ const sourceList = ref({
   },
 });
 
-const selectConfig = computed(() => {
-  return [];
-});
+const tableEvents = computed(() => {
+  return {
+    'selection-change': (val) => {
+      selectData.value = val;
+    },
+  }
+})
+
+const selectConfig = ref([
+  {
+    label: "状态",
+    prop: "scrappedHandleStatus",
+    data: [
+      {
+        label: "待验证",
+        value: "2",
+      },
+      {
+        label: "已验证",
+        value: "3",
+      },
+    ],
+  },
+  {
+    label: "项目组",
+    prop: "deptId",
+  },
+
+]);
 
 const actionList = computed(() => {
-  return []
+  return [
+    {
+      text: '批量验证',
+      disabled: selectData.value.length === 0,
+      action: () => {
+        const ids = selectData.value.map(item => item.id);
+
+        ElMessageBox.confirm("是否确认批量验证?", "提示", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning",
+        }).then(() => {
+          loading.value = true;
+          proxy.post("/jdRefundQualityCheck/batchVerify", {ids})
+              .then(() => {
+                ElMessage.success("验证成功")
+                getList()
+              })
+              .catch(err => {
+                loading.value = false;
+              })
+        })
+      }
+    },
+    {
+      text: '导出',
+      action: () => {
+        proxy.postTwo("/jdRefundQualityCheck/exportExcel", {
+          ...sourceList.value.pagination, ...query.value,
+          status: [2, 3]
+        }).then(
+            (res) => {
+              exportData(res, "质检报废验证.xlsx");
+            },
+            (err) => {
+              ElMessage.error(`导出失败,请联系管理员`);
+            }
+        );
+      }
+    }
+  ]
 });
 
+const exportData = (res, name) => {
+  const content = res;
+  const blob = new Blob([content], {type: "application/ms-excel"});
+  const fileName = name;
+  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 config = computed(() => {
   return [
     {
+      type: "selection",
+      attrs: {
+        checkAtt: "isCheck",
+      },
+    },
+    {
       attrs: {
         label: "质检单号",
         prop: "code",
@@ -122,18 +217,32 @@ const config = computed(() => {
       },
       render(scrappedHandleStatus) {
         switch (scrappedHandleStatus) {
-          case 1:
-            return '待处理'
           case 2:
-            return '待确认'
+            return '待验证'
           case 3:
-            return '已确认'
+            return '已验证'
         }
         return '未知状态';
       },
     },
     {
       attrs: {
+        label: "生成时间",
+        prop: "scrappedHandleTime",
+        align: "left",
+        width: 160
+      },
+    },
+    {
+      attrs: {
+        label: "验证时间",
+        prop: "scrappedVerifyTime",
+        align: "left",
+        width: 160
+      },
+    },
+    {
+      attrs: {
         label: "操作",
         align: "center",
         fixed: "right",
@@ -143,13 +252,13 @@ const config = computed(() => {
         if (row.scrappedHandleStatus === 2) {
           return [{
             attrs: {
-              label: "确认",
+              label: "验证",
               type: "primary",
               text: true,
             },
             el: "button",
             click() {
-              ElMessageBox.confirm("是否确认?", "提示", {
+              ElMessageBox.confirm("是否确认验证?", "提示", {
                 confirmButtonText: "确定",
                 cancelButtonText: "取消",
                 type: "warning",
@@ -157,7 +266,7 @@ const config = computed(() => {
                 loading.value = true;
                 proxy.post("/jdRefundQualityCheck/verify", {id: row.id})
                     .then(() => {
-                      ElMessage.success("确认成功")
+                      ElMessage.success("验证成功")
                       getList()
                     })
                     .catch(err => {
@@ -173,9 +282,26 @@ const config = computed(() => {
   ];
 });
 
+const getDeptList = () => {
+  proxy.get("/jdRefundQualityCheck/deptList", {})
+      .then(({data}) => {
+        console.log(data)
+        selectConfig.value[1].data = data.map((item) => {
+          return {
+            label: item.deptName,
+            value: item.deptId,
+          };
+        });
+      })
+
+  selectConfig.value = JSON.parse(JSON.stringify(selectConfig.value));
+}
+getDeptList();
+
 const getList = async (req) => {
   loading.value = true;
 
+  query.value = {...req}
   sourceList.value.pagination = {...sourceList.value.pagination, ...req}
 
   const queryData = {...sourceList.value.pagination, ...req, status: [2, 3]};
@@ -190,6 +316,12 @@ const getList = async (req) => {
       .then(({data}) => {
         sourceList.value.data = data.rows;
         sourceList.value.pagination.total = data.total;
+
+        for (let item of sourceList.value.data) {
+          if (item.scrappedHandleStatus === 2) {
+            item.isCheck = true
+          }
+        }
       })
       .finally(_ => {
         loading.value = false;