guoyujia преди 1 година
родител
ревизия
54d0b1f385
променени са 2 файла, в които са добавени 112 реда и са изтрити 33 реда
  1. 30 11
      src/views/business/returnReceipt/DialogOutsourceDetails.vue
  2. 82 22
      src/views/business/returnReceipt/form.vue

+ 30 - 11
src/views/business/returnReceipt/DialogOutsourceDetails.vue

@@ -1,13 +1,27 @@
 <template>
 	<el-dialog title="添加收回明细" v-model="visible" width="800px" height="400px" @close="close" append-to-body draggable>
 		<el-form ref="dialogForm" :model="queryParams" :inline="true" style="padding-top: 16px">
-			<el-form-item label="批次号:" prop="lotCode" label-width="70">
-				<el-input v-model.trim="queryParams.lotCode" type="text" @keydown.enter.prevent style="width: 160px"
-					placeholder="请输入批次号" :clearable="true" @keyup.enter="handleSearch" />
+			<el-form-item label="产品描述:" prop="productDescription" label-width="100">
+				<el-input
+					v-model.trim="queryParams.productDescription"
+					type="text"
+					@keydown.enter.prevent
+					style="width: 140px"
+					placeholder="请输入产品描述"
+					:clearable="true"
+					@keyup.enter="handleSearch"
+				/>
 			</el-form-item>
-			<el-form-item label="产品描述:" prop="productDescription" label-width="90">
-				<el-input v-model.trim="queryParams.productDescription" type="text" @keydown.enter.prevent style="width: 160px"
-					placeholder="请输入关键字" :clearable="true" @keyup.enter="handleSearch" />
+			<el-form-item label="箱号:" prop="newCarrier" label-width="70">
+				<el-input
+					v-model.trim="queryParams.newCarrier"
+					type="text"
+					@keydown.enter.prevent
+					style="width: 140px"
+					placeholder="请输入箱号"
+					:clearable="true"
+					@keyup.enter="handleSearch"
+				/>
 			</el-form-item>
 			<el-form-item label-width="20px">
 				<el-button type="info" icon="Search" @click="handleSearch">搜索</el-button>
@@ -31,13 +45,12 @@
             " @click="handleShowFinishedDetail">+查看已完成明细</span>
 			</div>
 		</el-form>
-
-		<el-table ref="dialogTable" :data="dataList" size="small" v-loading="loading" border height="370px"
+		<div><span style="color: red;">注:如果选择框为灰色,外协厂已填写收回单</span></div>
+		<el-table ref="dialogTable" :data="dataList" row-key="id" size="small" v-loading="loading" border height="370px"
 			@selection-change="handleSelectionChange">
-			<el-table-column type="selection" width="40" align="center" />
+			<el-table-column type="selection" width="40" align="center" :selectable="handleAllowSelected"/>
 			<el-table-column type="index" label="行号" width="50" align="center" />
 			<el-table-column label="批次号" align="center" prop="lotCode" width="96" />
-			<el-table-column label="料号" align="center" prop="productCode" width="96" />
 			<el-table-column label="产品描述" align="center" prop="productDescription" />
 			<el-table-column label="箱号" align="center" prop="originalCarrier" width="220">
 				<template #default="scope">
@@ -62,6 +75,7 @@
 </template>
 <script setup>
 import { listDetailForReceipt, listDetailForAllReceipt } from '@/api/business/outsourcedOrderDetail'
+
 const { proxy } = getCurrentInstance()
 const total = ref(0)
 const props = defineProps({
@@ -109,6 +123,10 @@ function handleShowFinishedDetail() {
 	showAll.value = false
 	getList()
 }
+function handleAllowSelected(row) {
+  return row.returnReceiptDetailList.length >0?false:true
+}
+//查找分配给外协商的所有明细,除了已经德迈仕已经确认的批次
 function getAllList() {
 	loading.value = true
 	listDetailForAllReceipt(queryParams.value).then((res) => {
@@ -117,6 +135,7 @@ function getAllList() {
 		loading.value = false
 	})
 }
+
 function handleChangePageSize() {
 	if (showAll.value) {
 		console.log("1")
@@ -138,7 +157,7 @@ function close() {
 }
 
 /**
- * 加载数据
+ * 查看已完成的外协单明细(已完成代表分配给外协商的活,都报完工)
  */
 function getList() {
 	loading.value = true

+ 82 - 22
src/views/business/returnReceipt/form.vue

@@ -117,14 +117,14 @@
               prop="productNum"
               width="96"
             />
-            <el-table-column
+            <!-- <el-table-column
               label="原箱号"
               align="center"
               prop="originalCarrier"
               width="320"
-            />
+            /> -->
             <el-table-column
-              label="箱号"
+              label="箱号"
               align="center"
               prop="newCarrier"
               width="320"
@@ -133,7 +133,7 @@
               label="外协工序"
               align="center"
               prop="processAlias"
-              width="120"
+              width="200"
             />
             <el-table-column
               label="收回数量"
@@ -149,14 +149,20 @@
             >
               <template #default="scope">
                 <el-input-number
+                v-if=" scope.row.productionDeptId == 0"
                   v-model="scope.row.auditNum"
                   :min="0"
                   controls-position="right"
                   style="text-align: center"
                 />
+                <el-input v-model="scope.row.auditNum" v-else readonly />
               </template>
             </el-table-column>
             <el-table-column label="备注" align="center" prop="remark">
+              <template #default="scope">
+                <el-input v-model.trim="scope.row.remark" v-if="editStatus" />
+                <el-input v-model="scope.row.remark" v-else readonly />
+              </template>
             </el-table-column>
             <el-table-column
               label="审核状态"
@@ -256,6 +262,7 @@ const reset = () => {
     supplierName: "",
     remark: "",
     details: [],
+    detailInfo:[]
   };
   proxy.resetForm("formRef");
 };
@@ -315,12 +322,30 @@ const handleMultipleSelectedOutsourceDetails = (selection) => {
         processAlias: selection[i].processes[j].processAlias,
         processCode: selection[i].processes[j].processCode,
         processStepNumber: selection[i].processes[j].processStepNumber,
-        productionDeptId:selection[i].productionDeptId,
+        productionDeptId: selection[i].productionDeptId,
         status: 0,
         auditNum: 0,
       };
-      form.value.details.push(newDetail);
+      form.value.detailInfo.push(newDetail);
     }
+    //页面显示内容,一个批次一行
+    const detail = {
+      outsourceDetailId: selection[i].id,
+      productDescription: selection[i].productDescription,
+      lotCode: selection[i].lotCode,
+      productNum: selection[i].productNum,
+      receiptNum:
+      selection[i].processes[selection[i].processes.length - 1].qualifiedNum
+          ? selection[i].processes[selection[i].processes.length - 1].qualifiedNum
+          : 0,
+      newCarrier: selection[i].newCarrier,
+      remark: "",
+      processAlias: selection[i].processNames,
+      productionDeptId: selection[i].productionDeptId,
+      status: 0,
+      auditNum: 0,
+    };
+    form.value.details.push(detail);
   }
 };
 //审核状态按钮
@@ -368,6 +393,8 @@ function submitForm() {
       }
       console.log(form.value.details.length);
       if (flag) {
+        //赋值(因为收回明细是一个批次一条,所以后端传回来两个集合,一个页面显示,一个后端保存)
+        handleSetAuditStatus();
         console.log(form.value);
         if (confirmFlag) {
           proxy.$modal
@@ -415,25 +442,58 @@ function submitForm() {
 }
 //反选操作
 function handleDelReturnReceiveDetail(row) {
-  console.log(row)
-  if(form.value.id) {
-  if(row.productionDeptId!=0) {
-    proxy.$modal.msgError("该批次已周转,不能删除");
-  }else{
-  proxy.$modal
-    .confirm("是否确认删除选中的数据项,如果删除,同时删除该批次下所有工序?")
-    .then(function () {
-      form.value.details = form.value.details.filter((item) => {
-        return item.lotId != row.lotId;
-      });
-    });
+  console.log(row);
+  if (form.value.id) {
+    if (row.productionDeptId != 0) {
+      proxy.$modal.msgError("该批次已周转,不能删除");
+    } else {
+      proxy.$modal
+        .confirm(
+          "是否确认删除选中的数据项,如果删除,同时删除该批次下所有工序?"
+        )
+        .then(function () {
+          form.value.details = form.value.details.filter((item) => {
+            return item.lotCode != row.lotCode;
+          });
+          //修改存进数据库的数据
+          let index = [];
+          for (let i = 0; i < form.value.detailInfo.length; i++) {
+            if (form.value.detailInfo[i].lotCode == row.lotCode) {
+              index.push(i);
+            }
+          }
+          for (let i = index.length - 1; i >= 0; i--) {
+            form.value.detailInfo.splice(index[i], 1);
+          }
+        });
+    }
+  } else {
+    form.value.details.splice(form.value.details.indexOf(row), 1);
+       //修改存进数据库的数据
+       let index = [];
+          for (let i = 0; i < form.value.detailInfo.length; i++) {
+            if (form.value.detailInfo[i].lotCode == row.lotCode) {
+              index.push(i);
+            }
+          }
+          for (let i = index.length - 1; i >= 0; i--) {
+            form.value.detailInfo.splice(index[i], 1);
+          }
   }
+  console.log(form.value)
 }
-else{
-  form.value.details.splice(form.value.details.indexOf(row), 1)
-}
+//审核状态,备注,确定数量赋值
+function handleSetAuditStatus() {
+  for (let i = 0; i < form.value.details.length; i++) {
+    form.value.detailInfo.forEach((element) => {
+      if (form.value.details[i].lotCode == element.lotCode) {
+        element.remark = form.value.details[i].remark;
+        element.status = form.value.details[i].status;
+        element.auditNum = form.value.details[i].auditNum;
+      }
+    });
+  }
 }
-
 /** 暴露给父组件的方法 */
 defineExpose({
   open,