ezhizao_zx 3 月之前
父節點
當前提交
8d99882fed
共有 2 個文件被更改,包括 320 次插入499 次删除
  1. 130 113
      src/views/business/firstOutsource/form.vue
  2. 190 386
      src/views/business/outsource/form.vue

+ 130 - 113
src/views/business/firstOutsource/form.vue

@@ -122,13 +122,8 @@
         <el-button v-show="editStatus" type="primary" icon="Plus" @click="handleChoiceFurnaceNoInfo()">
           批量选择炉号
         </el-button>
-        <el-button
-          v-show="editStatus"
-          :disabled="selections.length === 0"
-          type="primary"
-          icon="Plus"
-          @click="handleShowMultiDialogProcesses"
-        >
+        <el-button v-show="editStatus" :disabled="selections.length === 0" type="primary" icon="Plus"
+          @click="handleShowMultiDialogProcesses">
           批量选择工序
         </el-button>
       </div>
@@ -165,13 +160,13 @@
               </template>
             </el-table-column>
             <el-table-column label="标识" width="300" align="center">
-            <template #default="scope">
-              <el-tag v-if="scope.row.isWaste == 1" class="spacing" type="danger">{{ "批废" }}</el-tag>
-              <el-tag v-if="scope.row.isAmend == 1" class="spacing" type="danger">{{ "工艺修改" }}</el-tag>
-              <el-tag v-if="scope.row.isWasteRecycling == 1" class="spacing" type="primary">{{ "废品回用" }}</el-tag>
-              <el-tag v-if="scope.row.isSuperaddition == 1" class="spacing" type="warning">{{ "追增" }}</el-tag>
-            </template>
-          </el-table-column>
+              <template #default="scope">
+                <el-tag v-if="scope.row.isWaste == 1" class="spacing" type="danger">{{ "批废" }}</el-tag>
+                <el-tag v-if="scope.row.isAmend == 1" class="spacing" type="danger">{{ "工艺修改" }}</el-tag>
+                <el-tag v-if="scope.row.isWasteRecycling == 1" class="spacing" type="primary">{{ "废品回用" }}</el-tag>
+                <el-tag v-if="scope.row.isSuperaddition == 1" class="spacing" type="warning">{{ "追增" }}</el-tag>
+              </template>
+            </el-table-column>
             <el-table-column label="外协工序" align="center" prop="processNames" width="320">
               <template #default="scope">
                 <el-input v-if="editStatus && scope.row.hasReturnReceiptDetailFlag" v-model="scope.row.processNames"
@@ -190,8 +185,8 @@
                 <span v-else>{{ scope.row.remark }}</span>
               </template>
             </el-table-column>
-            <el-table-column v-if="editStatus" label="操作" align="center" fixed="right" class-name="small-padding fixed-width"
-              width="64">
+            <el-table-column v-if="editStatus" label="操作" align="center" fixed="right"
+              class-name="small-padding fixed-width" width="64">
               <template #default="scope">
                 <el-button circle type="danger" v-if="scope.row.hasReturnReceiptDetailFlag" icon="Delete"
                   @click="handleDelete(scope.$index)" v-hasPermi="['business:firstOutsource:remove']" />
@@ -209,8 +204,8 @@
 
     <!-- 工序选择 -->
     <dialog-processes ref="dialogProcessesRef" :multiple-selected="handleMultipleSelectedProcesses" />
-        <!-- 批量工序选择 -->
-        <dialog-multiProcess ref="dialogMultiProcessRef" :multiple-selected="handleMultipleSetProcesses" />
+    <!-- 批量工序选择 -->
+    <dialog-multiProcess ref="dialogMultiProcessRef" :multiple-selected="handleMultipleSetProcesses" />
     <!-- 新箱号选择 -->
     <DialogFurnaceNoInfo ref="dialogFurnaceNoInfoRef" :singleSelected="handleSingleSelectFurnaceNoInfo" />
     <!-- 历史记录弹窗 -->
@@ -269,9 +264,11 @@ const multiple = ref(true);
 const visible = ref(false);
 const editStatus = ref(true);
 const hasReturnReceiptDetailFlag = ref(true);
-	// 创建一个引用来存储最后一次请求的时间戳
+// 创建一个引用来存储最后一次请求的时间戳
 const lastRequestTimestamp = ref(0);
 const totalCarriersNum = ref(0);
+import { ElLoading } from "element-plus";
+import { file } from "jszip";
 const detailInfo = ref({});
 const loadingCarrier = ref(false);
 const carriers = ref([]);
@@ -281,6 +278,8 @@ const selections = ref([]);
 // const formatDetails = ref([])
 const currentDetail = ref({});
 const dialogFurnaceNoInfoRef = ref(null);
+
+let submitValue = 0
 const rules = {
   supplierName: [
     { required: true, message: "外协商名称不能为空", trigger: "change" },
@@ -551,47 +550,65 @@ function handleSubmit() {
         return;
       })
       .then(() => {
-        if (!form.value.details || form.value.details.length == 0) {
-          proxy.$modal.msgError("请添加产品明细");
-          return;
-        }
+        if (submitValue == 0) {
+          submitValue++
+          if (!form.value.details || form.value.details.length == 0) {
+            proxy.$modal.msgError("请添加产品明细");
+            submitValue = 0
+            return;
+          }
 
-        proxy.$refs["formRef"].validate((valid) => {
-          for (const item of form.value.details) {
-            if (!item.processNames) {
-              proxy.$modal.msgError("请选择" + item.lotCode + "批次的工序");
+          proxy.$refs["formRef"].validate((valid) => {
+            for (const item of form.value.details) {
+              if (!item.processNames) {
+                proxy.$modal.msgError("请选择" + item.lotCode + "批次的工序");
+                submitValue = 0
+                return;
+              }
+            }
+            // 判断是否有批次没有炉号
+            const unfurnace = form.value.details.find(
+              (v) => v.furnaceNoInfo == null
+            );
+            if (unfurnace != null) {
+              proxy.$modal.msgError("请选择" + unfurnace.lotCode + "批次的炉号");
+              submitValue = 0
               return;
             }
-          }
-          // 判断是否有批次没有炉号
-          const unfurnace = form.value.details.find(
-            (v) => v.furnaceNoInfo == null
-          );
-          if (unfurnace != null) {
-            proxy.$modal.msgError("请选择" + unfurnace.lotCode + "批次的炉号");
-            return;
-          }
-          if (totalCarriersNum.value == null || totalCarriersNum.value == 0) {
-            proxy.$modal.msgError("请输入箱数");
-            return;
-          }
-          if (valid) {
-            const currentTime = Date.now();
-            // 检查是否已经过去了 2 秒
-        if (currentTime - lastRequestTimestamp.value < 2000) {
-          // 如果在 2 秒 内已经有请求发出,那么不执行
-          return;
+            if (totalCarriersNum.value == null || totalCarriersNum.value == 0) {
+              proxy.$modal.msgError("请输入箱数");
+              submitValue = 0
+              return;
+            }
+            if (valid) {
+              const currentTime = Date.now();
+              // 检查是否已经过去了 2 秒
+              // if (currentTime - lastRequestTimestamp.value < 2000) {
+              // 如果在 2 秒 内已经有请求发出,那么不执行
+              // return;
+              // }
+              lastRequestTimestamp.value = currentTime;
+              console.log(form.value);
+              // proxy.$modal.loading("正在保存...")
+              const fillloading = ElLoading.service({
+                lock: true,
+              });
+              console.log(fillloading)
+              submitDetailsOnFirst(form.value).then((response) => {
+                proxy.$modal.msgSuccess("提交成功");
+                visible.value = false;
+                getList.value();
+                submitValue = 0
+                fillloading.close()
+              }).catch(err => {
+                fileloading.close()
+              });
+            } else {
+              submitValue = 0
+            }
+          });
         }
-          lastRequestTimestamp.value = currentTime;
-            console.log(form.value);
-            submitDetailsOnFirst(form.value).then((response) => {
-              proxy.$modal.msgSuccess("提交成功");
-              visible.value = false;
-              getList.value();
-            });
-          }
-        });
-      }).catch(_ => {});
+      }).catch(_ => { });
   } else {
     if (!form.value.details || form.value.details.length == 0) {
       proxy.$modal.msgError("请添加产品明细");
@@ -618,12 +635,12 @@ function handleSubmit() {
       if (valid) {
         const currentTime = Date.now();
 
-// 检查是否已经过去了 2 秒
-    if (currentTime - lastRequestTimestamp.value < 2000) {
-      // 如果在 2 秒 内已经有请求发出,那么不执行
-      return;
-    }
-    lastRequestTimestamp.value = currentTime;
+        // 检查是否已经过去了 2 秒
+        if (currentTime - lastRequestTimestamp.value < 2000) {
+          // 如果在 2 秒 内已经有请求发出,那么不执行
+          return;
+        }
+        lastRequestTimestamp.value = currentTime;
         console.log(form.value);
         submitDetailsOnFirst(form.value).then((response) => {
           proxy.$modal.msgSuccess("提交成功");
@@ -700,7 +717,7 @@ const handleShowDialogProcesses = (row) => {
   currentDetail.value = row;
   proxy.$refs.dialogProcessesRef.open(row);
 };
-function handleShowMultiDialogProcesses (){
+function handleShowMultiDialogProcesses() {
   if (selections.value.every((item) => item.isWaste == 1)) {
     proxy.$message.error("批废不能再进行操作");
     return;
@@ -713,7 +730,7 @@ function handleShowMultiDialogProcesses (){
     ) &&
     selections.value.every(
       (item) => item.technologyVersion === selections.value[0].technologyVersion
-    )&&
+    ) &&
     selections.value.every(
       (item) => item.productId === selections.value[0].productId
     );
@@ -734,8 +751,8 @@ function handleShowMultiDialogProcesses (){
   }
   console.log(selections.value)
   if (selections.value.filter(
-      (item) => !item.hasReturnReceiptDetailFlag
-  ).length >0) {
+    (item) => !item.hasReturnReceiptDetailFlag
+  ).length > 0) {
     proxy.$modal.msgError("已经收回审核数据不能进行批量选择工序操作");
     return;
   }
@@ -782,56 +799,56 @@ const handleMultipleSelectedProcesses = (selection) => {
 const handleMultipleSetProcesses = (selection) => {
   console.log(selections.value)
   console.log(form.value.details)
-  for(let i = 0; i < selections.value.length; i++){
+  for (let i = 0; i < selections.value.length; i++) {
     console.log(selections.value[i])
-  let currentOriginal = form.value.details.filter(
-    (item) => (item.lotId == selections.value[i].lotId)
-  );
-  console.log(currentOriginal)
-  let flag = true;
-  if (
-    currentOriginal[0].returnReceiptDetailList &&
-    currentOriginal[0].returnReceiptDetailList.length > 0
-  ) {
-    selection.forEach((item) => {
-      if (
-        currentOriginal[0].processes.findIndex(
-          (info) => info.processStepNumber == item.processStepNumber
-        ) < 0
-      ) {
-        flag = false;
-      }
-    });
-  }
-  if (flag) {
-    const processNames = selection
-      .sort((a, b) => a.processStepNumber - b.processStepNumber)
-      .map((item) => item.processAlias);
-    // 使用join方法将数组转换为以逗号分隔的字符串
-    let commaSeparatedString = processNames.join(",");
-    currentOriginal.processes = [];
-    form.value.details.filter(
-    (item) => (item.lotId == selections.value[i].lotId)
-  )[0] .processNames = commaSeparatedString;
-    selection.forEach((item) => {
-      const newProcess = {
-        processId: item.processId,
-        processCode: item.processCode,
-        processAlias: item.processAlias,
-        processStepNumber: item.processStepNumber,
-        technologicalProcessDetailId: item.id,
-      };
-      currentOriginal.processes.push(newProcess);
-    });
-    form.value.details.filter(
-    (item) => (item.lotId == selections.value[i].lotId)
-  )[0] .processes = currentOriginal.processes;
-  console.log(form.value.details)
-  } else {
-    proxy.$modal.msgError("外协厂/德迈仕已收回,不可添加新工序");
+    let currentOriginal = form.value.details.filter(
+      (item) => (item.lotId == selections.value[i].lotId)
+    );
+    console.log(currentOriginal)
+    let flag = true;
+    if (
+      currentOriginal[0].returnReceiptDetailList &&
+      currentOriginal[0].returnReceiptDetailList.length > 0
+    ) {
+      selection.forEach((item) => {
+        if (
+          currentOriginal[0].processes.findIndex(
+            (info) => info.processStepNumber == item.processStepNumber
+          ) < 0
+        ) {
+          flag = false;
+        }
+      });
+    }
+    if (flag) {
+      const processNames = selection
+        .sort((a, b) => a.processStepNumber - b.processStepNumber)
+        .map((item) => item.processAlias);
+      // 使用join方法将数组转换为以逗号分隔的字符串
+      let commaSeparatedString = processNames.join(",");
+      currentOriginal.processes = [];
+      form.value.details.filter(
+        (item) => (item.lotId == selections.value[i].lotId)
+      )[0].processNames = commaSeparatedString;
+      selection.forEach((item) => {
+        const newProcess = {
+          processId: item.processId,
+          processCode: item.processCode,
+          processAlias: item.processAlias,
+          processStepNumber: item.processStepNumber,
+          technologicalProcessDetailId: item.id,
+        };
+        currentOriginal.processes.push(newProcess);
+      });
+      form.value.details.filter(
+        (item) => (item.lotId == selections.value[i].lotId)
+      )[0].processes = currentOriginal.processes;
+      console.log(form.value.details)
+    } else {
+      proxy.$modal.msgError("外协厂/德迈仕已收回,不可添加新工序");
+    }
   }
 }
-}
 
 function handleSelectionChange(selection) {
   selections.value = selection;

+ 190 - 386
src/views/business/outsource/form.vue

@@ -1,11 +1,5 @@
 <template>
-  <el-drawer
-    title="外协单信息"
-    :with-header="false"
-    v-model="visible"
-    direction="rtl"
-    size="100%"
-  >
+  <el-drawer title="外协单信息" :with-header="false" v-model="visible" direction="rtl" size="100%">
     <div class="form-container column-container">
       <div class="form-btns-container">
         <span class="title-label">
@@ -23,87 +17,42 @@
         >
           暂存
         </el-button> -->
-        <el-button
-          v-show="editStatus && form.isSubmit == 1"
-          type="primary"
-          icon="Download"
-          @click="handleExport"
-          v-hasPermi="['business:outsource:export']"
-          >导出</el-button
-        >
-        <el-button
-          v-show="editStatus && form.isSubmit == 1"
-          type="warning"
-          icon="Download"
-          @click="handlePrint"
-          v-hasPermi="['business:outsource:export']"
-        >
+        <el-button v-show="editStatus && form.isSubmit == 1" type="primary" icon="Download" @click="handleExport"
+          v-hasPermi="['business:outsource:export']">导出</el-button>
+        <el-button v-show="editStatus && form.isSubmit == 1" type="warning" icon="Download" @click="handlePrint"
+          v-hasPermi="['business:outsource:export']">
           打印
         </el-button>
-        <el-button
-          v-if="editStatus"
-          type="primary"
-          icon="Finished"
-          @click="handleSubmit"
-          >保存</el-button
-        >
-        <el-button
-          v-if="editStatus && form.isSubmit == 1"
-          type="info"
-          icon="Calendar"
-          @click="handleViewRecords"
-          >历史记录</el-button
-        >
+        <el-button v-if="editStatus" type="primary" icon="Finished" @click="handleSubmit">保存</el-button>
+        <el-button v-if="editStatus && form.isSubmit == 1" type="info" icon="Calendar"
+          @click="handleViewRecords">历史记录</el-button>
         <div class="close-btn" @click="cancel">
           <i class="fa fa-times" aria-hidden="true" />
           <!-- <span>关闭</span> -->
         </div>
       </div>
-      <el-form
-        ref="formRef"
-        class="master-container"
-        :model="form"
-        v-loading="loading"
-        :rules="rules"
-        label-width="120px"
-      >
+      <el-form ref="formRef" class="master-container" :model="form" v-loading="loading" :rules="rules"
+        label-width="120px">
         <el-row :gutter="20">
           <el-col :span="6">
             <el-form-item label="单据号" prop="formCode">
-              <el-input
-                v-if="editStatus"
-                v-model="form.formCode"
-                disabled
-                placeholder="系统自动生成"
-              />
+              <el-input v-if="editStatus" v-model="form.formCode" disabled placeholder="系统自动生成" />
               <span v-else>{{ form.formCode }}</span>
             </el-form-item>
           </el-col>
           <el-col :span="6">
             <el-form-item label="表单日期" prop="formDate">
-              <el-date-picker
-                v-if="editStatus && hasReturnReceiptDetailFlag"
-                :clearable="false"
-                v-model="form.formDate"
-                type="date"
-                value-format="YYYY-MM-DD"
-                placeholder="请选择表单日期"
-                style="width: 100%"
-              >
+              <el-date-picker v-if="editStatus && hasReturnReceiptDetailFlag" :clearable="false" v-model="form.formDate"
+                type="date" value-format="YYYY-MM-DD" placeholder="请选择表单日期" style="width: 100%">
               </el-date-picker>
               <span v-else>{{ parseTime(form.formDate, "{y}-{m}-{d}") }}</span>
             </el-form-item>
           </el-col>
           <el-col :span="6">
             <el-form-item label="外协商名称" prop="supplierName">
-              <el-input
-                v-if="
-                  editStatus && form.isSubmit == 0 && hasReturnReceiptDetailFlag
-                "
-                v-model="form.supplierName"
-                readonly
-                placeholder="请输入外协商名称"
-              >
+              <el-input v-if="
+                editStatus && form.isSubmit == 0 && hasReturnReceiptDetailFlag
+              " v-model="form.supplierName" readonly placeholder="请输入外协商名称">
                 <template #append>
                   <el-button icon="Search" @click="handleShowDialogSuppliers" />
                 </template>
@@ -113,42 +62,23 @@
           </el-col>
           <el-col :span="6" v-if="false">
             <el-form-item label="运费单价" prop="freightPrice">
-              <el-input-number
-                v-if="editStatus && hasReturnReceiptDetailFlag"
-                v-model="form.freightPrice"
-                :min="0"
-                :precision="2"
-                controls-position="right"
-              />
+              <el-input-number v-if="editStatus && hasReturnReceiptDetailFlag" v-model="form.freightPrice" :min="0"
+                :precision="2" controls-position="right" />
               <span v-else>{{ form.freightPrice }}</span>
             </el-form-item>
           </el-col>
           <el-col :span="6" v-if="false">
             <el-form-item label="运费总价" prop="freightAmount">
-              <el-input-number
-                v-if="editStatus && hasReturnReceiptDetailFlag"
-                v-model="form.freightAmount"
-                :min="0"
-                :precision="2"
-                controls-position="right"
-              />
+              <el-input-number v-if="editStatus && hasReturnReceiptDetailFlag" v-model="form.freightAmount" :min="0"
+                :precision="2" controls-position="right" />
               <span v-else>{{ form.freightAmount }}</span>
             </el-form-item>
           </el-col>
           <el-col :span="6">
             <el-form-item label="送货方式" prop="deliveryMethod">
-              <el-select
-                v-if="editStatus && hasReturnReceiptDetailFlag"
-                v-model="form.deliveryMethod"
-                placeholder="请选择"
-                @change="handleChangeDeliveryMethod"
-              >
-                <el-option
-                  v-for="dict in deliveryMethod"
-                  :key="dict.value"
-                  :label="dict.label"
-                  :value="dict.value"
-                />
+              <el-select v-if="editStatus && hasReturnReceiptDetailFlag" v-model="form.deliveryMethod" placeholder="请选择"
+                @change="handleChangeDeliveryMethod">
+                <el-option v-for="dict in deliveryMethod" :key="dict.value" :label="dict.label" :value="dict.value" />
               </el-select>
               <span v-else>{{
                 selectText(form.deliveryMethod, deliveryMethod)
@@ -157,18 +87,9 @@
           </el-col>
           <el-col :span="6">
             <el-form-item label="带箱方式" prop="packagingMethod">
-              <el-select
-                v-if="editStatus && hasReturnReceiptDetailFlag"
-                v-model="form.packagingMethod"
-                placeholder="请选择"
-                @change="handleChangePackagingMethod"
-              >
-                <el-option
-                  v-for="dict in packagingMethod"
-                  :key="dict.value"
-                  :label="dict.label"
-                  :value="dict.value"
-                />
+              <el-select v-if="editStatus && hasReturnReceiptDetailFlag" v-model="form.packagingMethod"
+                placeholder="请选择" @change="handleChangePackagingMethod">
+                <el-option v-for="dict in packagingMethod" :key="dict.value" :label="dict.label" :value="dict.value" />
               </el-select>
               <span v-else>{{
                 selectText(form.packagingMethod, packagingMethod)
@@ -177,17 +98,9 @@
           </el-col>
           <el-col :span="6">
             <el-form-item label="结算方式" prop="settlementType">
-              <el-select
-                v-if="editStatus && hasReturnReceiptDetailFlag"
-                v-model="form.settlementType"
-                placeholder="请选择"
-              >
-                <el-option
-                  v-for="dict in settlementType"
-                  :key="dict.value"
-                  :label="dict.label"
-                  :value="dict.value"
-                />
+              <el-select v-if="editStatus && hasReturnReceiptDetailFlag" v-model="form.settlementType"
+                placeholder="请选择">
+                <el-option v-for="dict in settlementType" :key="dict.value" :label="dict.label" :value="dict.value" />
               </el-select>
               <span v-else>{{
                 selectText(form.settlementType, settlementType)
@@ -196,11 +109,7 @@
           </el-col>
           <el-col :span="6">
             <el-form-item label="备注" prop="remark">
-              <el-input
-                v-if="editStatus"
-                v-model.trim="form.remark"
-                placeholder="请输入备注"
-              />
+              <el-input v-if="editStatus" v-model.trim="form.remark" placeholder="请输入备注" />
               <span v-else>{{ form.remark }}</span>
             </el-form-item>
           </el-col>
@@ -213,129 +122,48 @@
       </el-form>
       <!-- 渲染数据区 -->
       <div class="form-details-btns-container">
-        <el-button
-          v-show="editStatus"
-          type="primary"
-          icon="Plus"
-          @click="handleShowDialogProducts"
-          v-hasPermi="['business:outsource:add']"
-        >
+        <el-button v-show="editStatus" type="primary" icon="Plus" @click="handleShowDialogProducts"
+          v-hasPermi="['business:outsource:add']">
           添加外协产品明细
         </el-button>
-        <el-button
-          v-show="editStatus"
-          :disabled="selections.length === 0"
-          type="primary"
-          icon="Plus"
-          @click="handleShowMultiDialogProcesses"
-        >
+        <el-button v-show="editStatus" :disabled="selections.length === 0" type="primary" icon="Plus"
+          @click="handleShowMultiDialogProcesses">
           批量选择工序
         </el-button>
       </div>
       <div class="el-table-container">
         <div class="el-table-inner-container">
-          <el-table
-            v-loading="loading"
-            :data="form.details"
-            size="small"
-             @selection-change="handleSelectionChange"
-            border
-            height="100%"
-          >
-          <el-table-column
-          type="selection"
-          :selectable="checkSelectable"
-          width="50"
-          align="center"
-        />
-            <el-table-column
-              label="行号"
-              type="index"
-              align="center"
-              width="48"
-            />
-            <el-table-column
-              label="批次号"
-              align="center"
-              prop="lotCode"
-              width="104"
-            />
-            <el-table-column
-              label="产品描述"
-              align="center"
-              prop="productDescription"
-              width="320"
-            />
+          <el-table v-loading="loading" :data="form.details" size="small" @selection-change="handleSelectionChange"
+            border height="100%">
+            <el-table-column type="selection" :selectable="checkSelectable" width="50" align="center" />
+            <el-table-column label="行号" type="index" align="center" width="48" />
+            <el-table-column label="批次号" align="center" prop="lotCode" width="104" />
+            <el-table-column label="产品描述" align="center" prop="productDescription" width="320" />
             <el-table-column label="图纸版本" width="80" prop="technologyVersion" align="center" />
-            <el-table-column
-              label="产品数"
-              align="center"
-              width="160"
-              prop="productNum"
-            >
+            <el-table-column label="产品数" align="center" width="160" prop="productNum">
               <template #default="scope">
-                <el-input-number
-                  v-if="editStatus && scope.row.hasReturnReceiptDetailFlag"
-                  :min="0"
-                  v-model="scope.row.productNum"
-                  placeholder="产品数"
-                  :controls="false"
-                />
+                <el-input-number v-if="editStatus && scope.row.hasReturnReceiptDetailFlag" :min="0"
+                  v-model="scope.row.productNum" placeholder="产品数" :controls="false" />
                 <span v-else>{{ scope.row.productNum }}</span>
               </template>
             </el-table-column>
-            <el-table-column
-              label="箱数"
-              align="center"
-              prop="carrierNum"
-              width="70"
-            />
-            <el-table-column
-              :label="form.packagingMethod === '0' ? '箱号' : '原箱号'"
-              align="center"
-              prop="originalCarrier"
-              width="320"
-            />
-            <el-table-column
-              label="新箱号"
-              align="center"
-              prop="newCarrier"
-              width="320"
-            >
+            <el-table-column label="箱数" align="center" prop="carrierNum" width="70" />
+            <el-table-column :label="form.packagingMethod === '0' ? '箱号' : '原箱号'" align="center" prop="originalCarrier"
+              width="320" />
+            <el-table-column label="新箱号" align="center" prop="newCarrier" width="320">
               <template #default="scope">
-                <el-button
-                  link
-                  type="primary"
-                  icon="Refresh"
-                  v-if="!scope.row.editStatus && editStatus"
-                  @click="handleChangeCarrier(scope.row)"
-                  >换箱</el-button
-                >
-                <el-select
-                  v-if="
-                    editStatus &&
-                    scope.row.editStatus &&
-                    scope.row.hasReturnReceiptDetailFlag
-                  "
-                  v-model="scope.row.carrierIds"
-                  multiple
-                  filterable
-                  remote
-                  reserve-keyword
-                  placeholder="请选择箱号"
-                  :remote-method="
-                    (arg) =>
-                      remoteCarriers(arg, scope.row.newCarriers, scope.row)
-                  "
-                  :loading="loadingCarrier"
-                  @change="(arg) => handleCarrierChange(arg, scope.row)"
-                >
-                  <el-option
-                    v-for="item in scope.row.carriers"
-                    :key="item.value"
-                    :label="item.label"
-                    :value="item.value"
-                  />
+                <el-button link type="primary" icon="Refresh" v-if="!scope.row.editStatus && editStatus"
+                  @click="handleChangeCarrier(scope.row)">换箱</el-button>
+                <el-select v-if="
+                  editStatus &&
+                  scope.row.editStatus &&
+                  scope.row.hasReturnReceiptDetailFlag
+                " v-model="scope.row.carrierIds" multiple filterable remote reserve-keyword placeholder="请选择箱号"
+                  :remote-method="(arg) =>
+                    remoteCarriers(arg, scope.row.newCarriers, scope.row)
+                    " :loading="loadingCarrier" @change="(arg) => handleCarrierChange(arg, scope.row)">
+                  <el-option v-for="item in scope.row.carriers" :key="item.value" :label="item.label"
+                    :value="item.value" />
                 </el-select>
                 <span v-if="!editStatus">{{ scope.row.newCarrier }}</span>
                 <!-- <el-input
@@ -355,31 +183,19 @@
               </template>
             </el-table-column>
             <el-table-column label="标识" width="300" align="center">
-            <template #default="scope">
-              <el-tag v-if="scope.row.isWaste == 1" class="spacing" type="danger">{{ "批废" }}</el-tag>
-              <el-tag v-if="scope.row.isAmend == 1" class="spacing" type="danger">{{ "工艺修改" }}</el-tag>
-              <el-tag v-if="scope.row.isWasteRecycling == 1" class="spacing" type="primary">{{ "废品回用" }}</el-tag>
-              <el-tag v-if="scope.row.isSuperaddition == 1" class="spacing" type="warning">{{ "追增" }}</el-tag>
-            </template>
-          </el-table-column>
-            <el-table-column
-              label="外协工序"
-              align="center"
-              prop="processNames"
-              width="320"
-            >
               <template #default="scope">
-                <el-input
-                  v-if="editStatus && scope.row.hasReturnReceiptDetailFlag"
-                  v-model="scope.row.processNames"
-                  readonly
-                  placeholder="请选择工序"
-                >
+                <el-tag v-if="scope.row.isWaste == 1" class="spacing" type="danger">{{ "批废" }}</el-tag>
+                <el-tag v-if="scope.row.isAmend == 1" class="spacing" type="danger">{{ "工艺修改" }}</el-tag>
+                <el-tag v-if="scope.row.isWasteRecycling == 1" class="spacing" type="primary">{{ "废品回用" }}</el-tag>
+                <el-tag v-if="scope.row.isSuperaddition == 1" class="spacing" type="warning">{{ "追增" }}</el-tag>
+              </template>
+            </el-table-column>
+            <el-table-column label="外协工序" align="center" prop="processNames" width="320">
+              <template #default="scope">
+                <el-input v-if="editStatus && scope.row.hasReturnReceiptDetailFlag" v-model="scope.row.processNames"
+                  readonly placeholder="请选择工序">
                   <template #append>
-                    <el-button
-                      icon="Search"
-                      @click="handleShowDialogProcesses(scope.row)"
-                    />
+                    <el-button icon="Search" @click="handleShowDialogProcesses(scope.row)" />
                   </template>
                 </el-input>
                 <span v-else>{{ scope.row.processNames }}</span>
@@ -387,31 +203,16 @@
             </el-table-column>
             <el-table-column label="备注" align="center" prop="remark" width="300">
               <template #default="scope">
-                <el-input
-                  v-if="editStatus && scope.row.hasReturnReceiptDetailFlag"
-                  v-model="scope.row.remark"
-                  placeholder="备注"
-                />
+                <el-input v-if="editStatus && scope.row.hasReturnReceiptDetailFlag" v-model="scope.row.remark"
+                  placeholder="备注" />
                 <span v-else>{{ scope.row.remark }}</span>
               </template>
             </el-table-column>
-            <el-table-column
-              v-if="editStatus"
-              label="操作"
-              align="center"
-              class-name="small-padding fixed-width"
-              fixed="right"
-              width="64"
-            >
+            <el-table-column v-if="editStatus" label="操作" align="center" class-name="small-padding fixed-width"
+              fixed="right" width="64">
               <template #default="scope">
-                <el-button
-                  circle
-                  type="danger"
-                  v-if="scope.row.hasReturnReceiptDetailFlag"
-                  icon="Delete"
-                  @click="handleDelete(scope.$index)"
-                  v-hasPermi="['business:outsource:remove']"
-                />
+                <el-button circle type="danger" v-if="scope.row.hasReturnReceiptDetailFlag" icon="Delete"
+                  @click="handleDelete(scope.$index)" v-hasPermi="['business:outsource:remove']" />
               </template>
             </el-table-column>
           </el-table>
@@ -419,28 +220,16 @@
       </div>
     </div>
     <!-- 外协商选择 -->
-    <dialog-suppliers
-      ref="dialogSuppliersRef"
-      :single-selected="handleSingleSelectedSupplier"
-    />
+    <dialog-suppliers ref="dialogSuppliersRef" :single-selected="handleSingleSelectedSupplier" />
     <!-- 产品选择 -->
-    <dialog-products
-      ref="dialogProductsRef"
-      :supplier-id="form.supplierId"
-      :multiple-selected="handleMultipleSelectedProducts"
-    />
+    <dialog-products ref="dialogProductsRef" :supplier-id="form.supplierId"
+      :multiple-selected="handleMultipleSelectedProducts" />
     <!-- 工序选择 -->
-    <dialog-processes
-      ref="dialogProcessesRef"
-      :multiple-selected="handleMultipleSelectedProcesses"
-    />
+    <dialog-processes ref="dialogProcessesRef" :multiple-selected="handleMultipleSelectedProcesses" />
     <!-- 批量工序选择 -->
     <dialog-multiProcess ref="dialogMultiProcessRef" :multiple-selected="handleMultipleSetProcesses" />
     <!-- 新箱号选择 -->
-    <dialog-carrier
-      ref="dialogCarrierRef"
-      :multiple-selected="handleMultipleSelectedOutsourceCarriers"
-    />
+    <dialog-carrier ref="dialogCarrierRef" :multiple-selected="handleMultipleSelectedOutsourceCarriers" />
     <!-- 历史记录弹窗 -->
     <dialog-outsourced-records ref="dialogOutsourcedRecordsRef" />
     <!-- 收回明细带回 -->
@@ -461,6 +250,7 @@ import dialogCarrier from "./DialogCarrier";
 import dialogSuppliers from "./DialogSuppliers";
 import dialogProducts from "./DialogProducts";
 import dialogProcesses from "./DialogProcesses";
+import { ElLoading } from "element-plus";
 import dialogMultiProcess from "./multiSingleChangeDialog";
 import dialogOutsourcedRecords from "./DialogOutsourcedRecords";
 // import FormDetailsRecycling from "./detailsRecyclingForm";
@@ -469,7 +259,7 @@ const { proxy } = getCurrentInstance();
 const props = defineProps({
   getList: {
     type: Function,
-    default: () => {},
+    default: () => { },
   },
   deliveryMethod: {
     type: Array,
@@ -501,6 +291,7 @@ const carriers = ref([]);
 const details = ref([]);
 const form = ref({});
 const selections = ref([])
+let submitValue = 0
 // const formatDetails = ref([])
 const currentDetail = ref({});
 const rules = {
@@ -634,7 +425,7 @@ function handleChangePackagingMethod() {
     } else {
       form.value.details[i].carrierNum =
         form.value.details[i].newCarriers &&
-        form.value.details[i].newCarriers.length > 0
+          form.value.details[i].newCarriers.length > 0
           ? form.value.details[i].newCarriers.length
           : form.value.details[i].originalCarrier.split(",").length;
     }
@@ -678,7 +469,7 @@ const handleDelete = (index) => {
 };
 /** 是否可选 */
 function checkSelectable(row) {
-return row.hasReturnReceiptDetailFlag? true : false
+  return row.hasReturnReceiptDetailFlag ? true : false
 }
 
 /** 表单重置 */
@@ -777,7 +568,7 @@ function submitFrom() {
         }
       });
     })
-    .catch(() => {});
+    .catch(() => { });
 }
 //5.29保存
 function handleSubmit() {
@@ -788,36 +579,49 @@ function handleSubmit() {
         return;
       })
       .then(() => {
-        if (!form.value.details || form.value.details.length == 0) {
-          proxy.$modal.msgError("请添加产品明细");
-          return;
-        }
-
-        proxy.$refs["formRef"].validate((valid) => {
-          for (const item of form.value.details) {
-            if (!item.processNames) {
-              proxy.$modal.msgError("请选择" + item.lotCode + "批次的工序");
-              return;
-            }
+        if (submitValue == 0) {
+          submitValue++
+          if (!form.value.details || form.value.details.length == 0) {
+            proxy.$modal.msgError("请添加产品明细");
+            submitValue = 0
+            return;
           }
-          if (form.value.packagingMethod == 1) {
-            console.log("form.value.details", form.value.details);
+          proxy.$refs["formRef"].validate((valid) => {
             for (const item of form.value.details) {
-              if (item.newCarriers.length == 0) {
-                proxy.$modal.msgError("请选择" + item.lotCode + "批次的新箱号");
+              if (!item.processNames) {
+                proxy.$modal.msgError("请选择" + item.lotCode + "批次的工序");
+                submitValue = 0
                 return;
               }
             }
-          }
-          if (valid) {
-            console.log(form.value);
-            submitDetails(form.value).then((response) => {
-              proxy.$modal.msgSuccess("提交成功");
-              visible.value = false;
-              getList.value();
-            });
-          }
-        });
+            if (form.value.packagingMethod == 1) {
+              console.log("form.value.details", form.value.details);
+              for (const item of form.value.details) {
+                if (item.newCarriers.length == 0) {
+                  proxy.$modal.msgError("请选择" + item.lotCode + "批次的新箱号");
+                  submitValue = 0
+                  return;
+                }
+              }
+            }
+            if (valid) {
+              console.log(form.value);
+              const fillloading = ElLoading.service({
+                lock: true,
+              });
+              submitDetails(form.value).then((response) => {
+                proxy.$modal.msgSuccess("提交成功");
+                visible.value = false;
+                getList.value();
+                submitValue = 0
+                fillloading.close()
+              });
+            } else {
+
+              submitValue = 0
+            }
+          });
+        }
       });
   } else {
     if (!form.value.details || form.value.details.length == 0) {
@@ -879,7 +683,7 @@ const handleSingleSelectedSupplier = (data) => {
 function handleDetailsRecycling() {
   proxy.$refs.formDetailsRecyclingRef.open(row);
 }
-function handleSingleSelectedRecycling() {}
+function handleSingleSelectedRecycling() { }
 /***************************** 产品对话框相关 *****************************/
 // 打开产品选择对话框
 const handleShowDialogProducts = () => {
@@ -904,13 +708,13 @@ const handleMultipleSelectedProducts = (selection) => {
       originalCarrierList: item.originalCarrierList,
       productionPlanDetailId: item.productionPlanDetailId,
       productionPlanNo: item.productionPlanNo,
-      lineNumber:item.lineNumber,
+      lineNumber: item.lineNumber,
       productNum: item.productNum,
       productCode: item.productCode,
       isAmend: item.isAmend,
       isWasteRecycling: item.isWasteRecycling,
-      isSuperaddition:item.isSuperaddition,
-      isWaste:item.isWaste,
+      isSuperaddition: item.isSuperaddition,
+      isWaste: item.isWaste,
       newCarrier: "",
       carriers: [],
       newCarrierCount: 0,
@@ -935,7 +739,7 @@ const handleMultipleSelectedProducts = (selection) => {
 
 /***************************** 外协箱子对话框相关 *****************************/
 // 打开外协箱子选择对话框
-const handleShowDialogOutsourceCarriers = (row) => {};
+const handleShowDialogOutsourceCarriers = (row) => { };
 
 function remoteCarriers(code, newCarrier, row) {
   loadingCarrier.value = true;
@@ -955,19 +759,19 @@ function remoteCarriers(code, newCarrier, row) {
     return;
   }
   let hasAddCarrierIds = []
-  console.log("detail",form.value.details)
+  console.log("detail", form.value.details)
   form.value.details.forEach((item) => {
-    if(item.carriers){
-    item.carriers.forEach(v=>{
-      hasAddCarrierIds.push(v.value)
-    })
-  }
+    if (item.carriers) {
+      item.carriers.forEach(v => {
+        hasAddCarrierIds.push(v.value)
+      })
+    }
   });
   carrierForOutsource({
     categoryId: categoryId,
     code: code,
     dayworkId: row.dayworkId,
-    hasAddCarrierIds:hasAddCarrierIds
+    hasAddCarrierIds: hasAddCarrierIds
   }).then((res) => {
     if (res.code === 200) {
       carriers.value = res.rows.map((v) => ({ value: v.id, label: v.code }));
@@ -1092,9 +896,9 @@ const handleShowDialogProcesses = (row) => {
 };
 /** 多选框选中数据 */
 function handleSelectionChange(selection) {
-selections.value = selection
+  selections.value = selection
 }
-function handleShowMultiDialogProcesses (){
+function handleShowMultiDialogProcesses() {
   if (selections.value.every((item) => item.isWaste == 1)) {
     proxy.$message.error("批废不能再进行操作");
     return;
@@ -1107,7 +911,7 @@ function handleShowMultiDialogProcesses (){
     ) &&
     selections.value.every(
       (item) => item.technologyVersion === selections.value[0].technologyVersion
-    )&&
+    ) &&
     selections.value.every(
       (item) => item.productId === selections.value[0].productId
     );
@@ -1140,7 +944,7 @@ const handleMultipleSelectedProcesses = (selection) => {
     currentDetail.value.returnReceiptDetailList &&
     currentDetail.value.returnReceiptDetailList.length > 0
   ) {
-  
+
     selection.forEach((item) => {
       if (
         currentOriginal[0].processes.findIndex(
@@ -1176,58 +980,58 @@ const handleMultipleSelectedProcesses = (selection) => {
 const handleMultipleSetProcesses = (selection) => {
   console.log(selections.value)
   console.log(form.value.details)
-  for(let i = 0; i < selections.value.length; i++){
+  for (let i = 0; i < selections.value.length; i++) {
     console.log(selections.value[i])
-  let currentOriginal = form.value.details.filter(
-    (item) => (item.lotId == selections.value[i].lotId)
-  );
-  console.log(currentOriginal)
-  console.log(selection)
-  let flag = true;
-  console.log(currentOriginal[0].processes)
-  if (
-    currentOriginal[0].returnReceiptDetailList &&
-    currentOriginal[0].returnReceiptDetailList.length > 0
-  ) {
-    selection.forEach((item) => {
-      if (
-        currentOriginal[0].processes.findIndex(
-          (info) => info.processStepNumber == item.processStepNumber
-        ) < 0
-      ) {
-        flag = false;
-      }
-    });
-  }
-  if (flag) {
-    const processNames = selection
-      .sort((a, b) => a.processStepNumber - b.processStepNumber)
-      .map((item) => item.processAlias);
-    // 使用join方法将数组转换为以逗号分隔的字符串
-    let commaSeparatedString = processNames.join(",");
-    currentOriginal.processes = [];
-    form.value.details.filter(
-    (item) => (item.lotId == selections.value[i].lotId)
-  )[0] .processNames = commaSeparatedString;
-    selection.forEach((item) => {
-      const newProcess = {
-        processId: item.processId,
-        processCode: item.processCode,
-        processAlias: item.processAlias,
-        processStepNumber: item.processStepNumber,
-        technologicalProcessDetailId: item.id,
-      };
-      currentOriginal.processes.push(newProcess);
-    });
-    form.value.details.filter(
-    (item) => (item.lotId == selections.value[i].lotId)
-  )[0] .processes = currentOriginal.processes;
-  console.log(form.value.details)
-  } else {
-    proxy.$modal.msgError("外协厂/德迈仕已收回,不可添加新工序");
+    let currentOriginal = form.value.details.filter(
+      (item) => (item.lotId == selections.value[i].lotId)
+    );
+    console.log(currentOriginal)
+    console.log(selection)
+    let flag = true;
+    console.log(currentOriginal[0].processes)
+    if (
+      currentOriginal[0].returnReceiptDetailList &&
+      currentOriginal[0].returnReceiptDetailList.length > 0
+    ) {
+      selection.forEach((item) => {
+        if (
+          currentOriginal[0].processes.findIndex(
+            (info) => info.processStepNumber == item.processStepNumber
+          ) < 0
+        ) {
+          flag = false;
+        }
+      });
+    }
+    if (flag) {
+      const processNames = selection
+        .sort((a, b) => a.processStepNumber - b.processStepNumber)
+        .map((item) => item.processAlias);
+      // 使用join方法将数组转换为以逗号分隔的字符串
+      let commaSeparatedString = processNames.join(",");
+      currentOriginal.processes = [];
+      form.value.details.filter(
+        (item) => (item.lotId == selections.value[i].lotId)
+      )[0].processNames = commaSeparatedString;
+      selection.forEach((item) => {
+        const newProcess = {
+          processId: item.processId,
+          processCode: item.processCode,
+          processAlias: item.processAlias,
+          processStepNumber: item.processStepNumber,
+          technologicalProcessDetailId: item.id,
+        };
+        currentOriginal.processes.push(newProcess);
+      });
+      form.value.details.filter(
+        (item) => (item.lotId == selections.value[i].lotId)
+      )[0].processes = currentOriginal.processes;
+      console.log(form.value.details)
+    } else {
+      proxy.$modal.msgError("外协厂/德迈仕已收回,不可添加新工序");
+    }
   }
 }
-}
 
 /** 暴露给父组件的方法 */
 defineExpose({