Explorar o código

新增采购入库(非采购)

huang_an %!s(int64=2) %!d(string=hai) anos
pai
achega
5cba5cd5ac

+ 566 - 0
src/views/bpm/handleTask/components/outsourcedWarehousingNoProcurement/detailDialog.vue

@@ -0,0 +1,566 @@
+<template>
+  <div>
+    <div class="switch">
+      <div class="switch_left">
+        <ul>
+          <li
+            v-for="item in tabOptions"
+            :key="item.key"
+            :class="{ active: activeComp == item.key }"
+            @click="changeActive(item)"
+          >
+            {{ item.name }}
+          </li>
+        </ul>
+      </div>
+    </div>
+    <div v-show="activeComp == 'main'">
+      <el-form ref="form" :model="form" :rules="rules" label-width="130px">
+        <headerTitle title="收货信息"></headerTitle>
+        <el-row>
+          <el-col :span="12">
+            <el-form-item
+              label="供应商名称:"
+              prop="supplierName"
+              style="margin-bottom: 16px"
+            >
+              {{ form.supplierName }}
+            </el-form-item>
+            <el-form-item
+              label="供应商联系人:"
+              prop="linkName"
+              style="margin-bottom: 16px"
+            >
+              {{ form.linkName }}
+            </el-form-item>
+            <el-form-item
+              label="供应商电话:"
+              prop="linkPhone"
+              style="margin-bottom: 16px"
+            >
+              {{ form.linkPhone }}
+            </el-form-item>
+
+            <!-- <el-form-item
+            label="客户地址:"
+            prop="partaAddress"
+            style="margin-bottom: 16px"
+          >
+            {{ form.receiveAddress }}
+          </el-form-item> -->
+            <el-form-item
+              label="车牌号:"
+              prop="carNo"
+              style="margin-bottom: 16px"
+            >
+              {{ form.carNo }}
+            </el-form-item>
+
+            <el-form-item
+              label="附件:"
+              prop="receiveFiles"
+              style="margin-bottom: 16px"
+            >
+              <div v-if="detailData.sendFiles && detailData.sendFiles?.length">
+                <el-link
+                  v-for="link in detailData.sendFiles"
+                  :key="link.id"
+                  type="primary"
+                  :underline="false"
+                  @click="downloadFile(link)"
+                >
+                  {{ link.name }}</el-link
+                >
+              </div>
+            </el-form-item>
+          </el-col>
+
+          <el-col :span="12">
+            <!--            <el-form-item-->
+            <!--              label="采购单类型:"-->
+            <!--              prop="receiveTypeName"-->
+            <!--              style="margin-bottom: 16px"-->
+            <!--            >-->
+            <!--              {{ form.receiveTypeName }}-->
+            <!--            </el-form-item>-->
+
+            <el-form-item
+              label="收货单编码:"
+              prop="receiveNo"
+              style="margin-bottom: 16px"
+            >
+              {{ form.receiveNo }}
+            </el-form-item>
+            <el-form-item prop="orderNo" label="订单编码:">
+              {{ form.orderNo }}
+            </el-form-item>
+            <el-form-item prop="outsourceSendCode" label="委外发货单编码:">
+              {{ form.outsourceSendCode }}
+            </el-form-item>
+            <el-form-item prop="pricingWay" label="计价方式:">
+              {{ form.pricingWay == 1 ? '按数量计费' : '按重量计费' }}
+            </el-form-item>
+
+            <el-form-item
+              label="制单人:"
+              prop="makerName"
+              style="margin-bottom: 16px"
+            >
+              {{ form.makerName }}
+            </el-form-item>
+            <el-form-item
+              label="审核状态:"
+              prop="reviewStatus"
+              style="margin-bottom: 16px"
+            >
+              {{ reviewStatusEnum[form.reviewStatus]?.label }}
+            </el-form-item>
+            <!-- <el-form-item prop="replied" label="是否回执:">
+            {{ form.replied == 1 ? '是' : '否' }}
+          </el-form-item> -->
+          </el-col>
+        </el-row>
+      </el-form>
+
+      <headerTitle title="产品清单"></headerTitle>
+      <ele-pro-table
+        ref="table"
+        :needPage="false"
+        :columns="columns"
+        :toolkit="[]"
+        :datasource="detailData.productList"
+        row-key="id"
+      >
+        <!-- <template v-slot:toolbar>
+        <div class="headbox">
+        <span class="amount">总计:{{detailData.totalAmount}}元</span>
+        <span class="amount">应付金额:{{detailData.payAmount}}元</span>
+      </div>
+      </template> -->
+        <template v-slot:technicalDrawings="{ row }">
+          <div v-if="row.technicalDrawings && row.technicalDrawings?.length">
+            <el-link
+              v-for="link in row.technicalDrawings"
+              :key="link.id"
+              type="primary"
+              :underline="false"
+              @click="downloadFile(link)"
+            >
+              {{ link.name }}</el-link
+            >
+          </div>
+        </template>
+      </ele-pro-table>
+    </div>
+    <detailDialog
+      v-if="activeComp == 'inoutBoundView'"
+      :businessId="businessId"
+      :showQualityFile="showQualityFile"
+      ref="detailDialog"
+      :taskDefinitionKey="taskDefinitionKey"
+    ></detailDialog>
+    <procurementWarehousing
+      v-if="activeComp == 'inoutBoundEdit'"
+      :businessId="form.receiveNo"
+      type="sourceBizNo"
+      :infoData="form"
+      ref="procurementWarehousing"
+      :taskDefinitionKey="taskDefinitionKey"
+    >
+    </procurementWarehousing>
+    <add
+      ref="add"
+      v-if="activeComp == 'inoutBound'"
+      :inboundType="form.sourceType"
+      type="sourceBizNo"
+      @success="success"
+    ></add>
+    <!-- <add
+      ref="add"
+      v-if="activeComp == 'inoutBound'"
+      :inboundType="form.sourceType"
+      :form="form"
+      type="productiveOrUnproductiveStorage"
+      @success="success"
+    ></add> -->
+  </div>
+</template>
+
+<script>
+  import { getFile } from '@/api/system/file';
+  import dictMixins from '@/mixins/dictMixins';
+  import { reviewStatusEnum } from '@/enum/dict';
+  import { getById } from '@/api/bpm/components/outsourcedWarehousing';
+  import { getOutInByIdAPI } from '@/api/bpm/components/saleManage/saleorder';
+  import detailDialog from '@/views/bpm/handleTask/components/inoutBound/detailDialog.vue';
+  import procurementWarehousing from './procurementWarehousing.vue';
+  import add from './procurementStorage.vue';
+  import { getOutInBySourceBizNoOrError } from '@/api/classifyManage';
+
+  export default {
+    props: {
+      businessId: {
+        default: ''
+      },
+      taskId: {
+        default: ''
+      },
+      taskDefinitionKey: {
+        default: ''
+      }
+    },
+    components: {
+      detailDialog,
+      procurementWarehousing,
+      add
+    },
+    mixins: [dictMixins],
+    data() {
+      return {
+        showQualityFile: false,
+        activeComp: 'main',
+        // tabOptions: [{ key: 'main', name: '收货单详情' }],
+        tabOptions: [],
+        reviewStatusEnum,
+        visible: false,
+        detailId: '',
+        title: '详情',
+        row: {},
+        activeName: 'base',
+        form: {
+          orderFiles: [{ name: '222' }]
+        },
+        rules: {},
+        detailData: {},
+        columns: [
+          {
+            width: 45,
+            type: 'index',
+            columnKey: 'index',
+            align: 'center',
+            fixed: 'left'
+          },
+          {
+            width: 200,
+            prop: 'productName',
+            label: '名称',
+            slot: 'productName',
+            align: 'center'
+          },
+          {
+            width: 120,
+            prop: 'productCode',
+            label: '编码',
+            slot: 'productCode',
+            align: 'center'
+          },
+          {
+            width: 200,
+            prop: 'productCategoryName',
+            label: '类型',
+            slot: 'productCategoryName',
+            align: 'center'
+          },
+          {
+            width: 160,
+            prop: 'productBrand',
+            label: '牌号',
+            slot: 'productBrand',
+            align: 'center'
+          },
+          {
+            width: 120,
+            prop: 'modelType',
+            label: '型号',
+            slot: 'modelType',
+            align: 'center'
+          },
+          {
+            width: 120,
+            prop: 'specification',
+            label: '规格',
+            slot: 'specification',
+            align: 'center'
+          },
+          {
+            width: 200,
+            prop: 'warehouseName',
+            label: '仓库名称',
+            slot: 'warehouseName',
+            align: 'center'
+          },
+          {
+            width: 80,
+            prop: 'totalCount',
+            label: '进货数量',
+            slot: 'totalCount',
+            align: 'center'
+          },
+          {
+            width: 120,
+            prop: 'orderTotalCount',
+            label: '总数量',
+            slot: 'orderTotalCount',
+            align: 'center'
+          },
+          {
+            width: 80,
+            prop: 'measuringUnit',
+            label: '计量单位',
+            slot: 'measuringUnit',
+            align: 'center'
+          },
+          {
+            width: 120,
+            prop: 'singleWeight',
+            label: '单重',
+            slot: 'singleWeight',
+            align: 'center'
+          },
+          {
+            width: 200,
+            prop: 'sendTotalWeight',
+            label: '发货总重',
+            slot: 'sendTotalWeight',
+            align: 'center',
+            headerSlot: 'headerTotalCount'
+          },
+          {
+            width: 100,
+            prop: 'receiveTotalWeight',
+            label: '收货总重',
+            slot: 'receiveTotalWeight',
+            align: 'center'
+          },
+          {
+            width: 100,
+            prop: 'increaseTotalWeight',
+            label: '增重重量',
+            slot: 'increaseTotalWeight',
+            align: 'center'
+          },
+          {
+            width: 100,
+            prop: 'weightUnit',
+            label: '重量单位',
+            slot: 'weightUnit',
+            align: 'center'
+          },
+          {
+            width: 160,
+            prop: 'singlePrice',
+            label: '单价',
+            slot: 'singlePrice',
+            align: 'center'
+          },
+          {
+            width: 160,
+            prop: 'discountSinglePrice',
+            label: '折后单价',
+            slot: 'discountSinglePrice',
+            align: 'center'
+          },
+          {
+            width: 120,
+            prop: 'totalPrice',
+            label: '合计',
+            slot: 'totalPrice',
+            align: 'center'
+          },
+          {
+            width: 160,
+            prop: 'discountTotalPrice',
+            label: '折后合计',
+            slot: 'discountTotalPrice',
+            align: 'center'
+          },
+
+          {
+            width: 80,
+            prop: 'deliveryDays',
+            label: '交期(天)',
+            slot: 'deliveryDays',
+            align: 'center'
+          },
+          {
+            width: 160,
+            prop: 'deliveryDeadline',
+            label: '交期截止日期',
+            slot: 'deliveryDeadline',
+            align: 'center'
+          },
+          {
+            width: 200,
+            prop: 'guaranteePeriod',
+            label: '质保期',
+            slot: 'guaranteePeriod',
+            align: 'center'
+          },
+          {
+            width: 160,
+            prop: 'guaranteePeriodDeadline',
+            label: '质保截止日期',
+            slot: 'guaranteePeriodDeadline',
+            align: 'center'
+          },
+          {
+            width: 130,
+            prop: 'technicalAnswerName',
+            label: '技术答疑人',
+            slot: 'technicalAnswerName',
+            align: 'center'
+          },
+          {
+            width: 220,
+            prop: 'technicalParams',
+            label: '技术参数',
+            slot: 'technicalParams',
+            align: 'center'
+          },
+          {
+            width: 240,
+            prop: 'technicalDrawings',
+            label: '技术图纸',
+            slot: 'technicalDrawings',
+            align: 'center'
+          },
+          {
+            width: 220,
+            prop: 'remark',
+            label: '备注',
+            slot: 'remark',
+            align: 'center'
+          }
+        ]
+      };
+    },
+    async created() {
+      await this.getDetailData(this.businessId);
+      if (this.taskDefinitionKey === 'qualityInspection') {
+        this.tabOptions.push({
+          key: 'inoutBoundEdit',
+          name: '入库单详情(已入库)'
+        });
+        this.activeComp = 'inoutBoundEdit';
+      } else if (this.taskDefinitionKey === 'qualityInspectionFeedback') {
+        this.tabOptions.push({
+          key: 'inoutBoundEdit',
+          name: '入库单详情(已质检)'
+        });
+        this.activeComp = 'inoutBoundEdit';
+      } else {
+        this.tabOptions.push({ key: 'inoutBoundView', name: '入库单详情' });
+        this.activeComp = 'inoutBoundView';
+      }
+      // getOutInBySourceBizNoOrError(this.form.receiveNo)
+      //   .then(() => {
+      //     this.tabOptions.push({
+      //       key: 'inoutBoundEdit',
+      //       name: '入库单详情(已入库)'
+      //     });
+      //     this.activeComp = 'inoutBoundEdit';
+      //   })
+      //   .catch(() => {
+      //     // 未查询到相关信息(未入库)
+      //     if (
+      //       !['starter', 'deptLeaderApprove', 'storeManagerApprove'].includes(
+      //         this.taskDefinitionKey
+      //       )
+      //     ) {
+      //       this.tabOptions.push({ key: 'inoutBoundView', name: '入库单详情' });
+      //       this.activeComp = 'inoutBoundView';
+      //     }
+      //     if (this.taskDefinitionKey == 'storeManagerApprove') {
+      //       this.tabOptions.push({ key: 'inoutBound', name: '入库单' });
+      //       this.activeComp = 'inoutBound';
+      //       this.$emit('activeCompChange', 'inoutBound');
+      //       this.$nextTick(() => {
+      //         this.$refs.add.pickerSuccess(this.form);
+      //       });
+      //     }
+      //   });
+    },
+
+    methods: {
+      changeActive(item) {
+        this.activeComp = item.key;
+        this.$emit('activeCompChange', item.key);
+        if (
+          this.taskDefinitionKey == 'storeManagerApprove' &&
+          item.key == 'inoutBound'
+        ) {
+          this.$nextTick(() => {
+            this.$refs.add.pickerSuccess(this.form);
+          });
+        }
+      },
+      save(data) {
+        this.$refs.add.handleSave(data);
+      },
+      success() {
+        // console.log(this.$parent,'this.$parent')
+        // this.$parent.handleClose()
+        this.$emit('handleClose');
+      },
+      downloadFile(file) {
+        getFile({ objectName: file.storePath }, file.name);
+      },
+      // 判断质检状态是否全部已检
+      allListChecked() {
+        return (
+          this.$refs.procurementWarehousing &&
+          this.$refs.procurementWarehousing.getStatus()
+        );
+      },
+      async getTableValue() {
+        return {
+          form: this.form,
+          returnStorageData:
+            this.$refs.add && (await this.$refs.add.getReturnStorage()),
+          isAllChecked:
+            this.$refs.procurementWarehousing &&
+            this.$refs.procurementWarehousing.getStatus(),
+          statusList:
+            (this.$refs.detailDialog && this.$refs.detailDialog.getStatus()) ||
+            [],
+          qualityInspector:
+            (this.$refs.procurementWarehousing &&
+              this.$refs.procurementWarehousing.getQualityFile()) ||
+            {}
+          // qualityInspector:
+          //   (this.$refs.detailDialog &&
+          //     this.$refs.detailDialog.getQualityFile()) ||
+          //   {}
+        };
+      },
+      async getDetailData(id) {
+        this.loading = true;
+        const data = await getOutInByIdAPI(id);
+        this.loading = false;
+        if (data) {
+          this.form = data;
+          this.detailData = data;
+        }
+      }
+    }
+  };
+</script>
+
+<style scoped lang="scss">
+  .ele-dialog-form {
+    .el-form-item {
+      margin-bottom: 10px;
+    }
+  }
+
+  .headbox {
+    display: flex;
+    justify-content: flex-start;
+    align-items: center;
+    .amount {
+      font-size: 14px;
+      font-weight: bold;
+      margin-right: 20px;
+    }
+  }
+</style>

+ 2283 - 0
src/views/bpm/handleTask/components/outsourcedWarehousingNoProcurement/procurementStorage.vue

@@ -0,0 +1,2283 @@
+<!-- 采购入库(生产非生产性) 默认代入产品 -->
+<template>
+  <div class="procurementStorage">
+    <el-card shadow="never">
+      <header-title title="基本信息"></header-title>
+      <el-form
+        :model="formData"
+        ref="formName"
+        label-width="110px"
+        :rules="rules"
+      >
+        <el-row :gutter="20">
+          <el-col :span="8">
+            <el-form-item label="物品类型" prop="extInfo.assetType">
+              <selectTree
+                ref="tree"
+                class="form-ipt"
+                :isBindPlan="true"
+                disabled
+                size="medium"
+                style="width: 100%"
+                :value="formData.extInfo.assetType"
+                clearable
+                :options="codeList"
+                :props="{
+                  value: 'id',
+                  label: 'name',
+                  children: 'children'
+                }"
+                @getValue="codeListValue"
+                :isAll="false"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="入库类型" prop="bizType">
+              <el-select
+                @change="onClear"
+                filterable
+                placeholder="请选择"
+                v-model="formData.bizType"
+                clearable
+                :disabled="
+                  !!(warehousingMaterialList && warehousingMaterialList.length)
+                "
+              >
+                <el-option
+                  v-for="item in sceneState"
+                  :key="item.code"
+                  :value="item.code + ''"
+                  :label="item.label"
+                ></el-option>
+              </el-select> </el-form-item
+          ></el-col>
+          <el-col :span="8">
+            <el-form-item label="采购收货单" prop="documentSource">
+              <el-input
+                placeholder="请输入"
+                v-model="formData.extInfo.documentSource"
+                @click.native="handlePicker()"
+                :disabled="isTask"
+              >
+              </el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="权属部门" prop="deptName">
+              <el-input
+                placeholder="权属部门"
+                disabled
+                v-model="formData.extInfo.deptName"
+                clearable
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="入库登记人">
+              <el-input
+                placeholder="登记人"
+                disabled
+                v-model="formData.extInfo.createUserName"
+                clearable /></el-form-item
+          ></el-col>
+          <el-col :span="8" v-if="formData.bizType == 2">
+            <el-form-item label="供应商" prop="supplierName">
+              <el-input
+                placeholder="请输入"
+                clearable
+                v-model="formData.extInfo.supplierName"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="送货人" prop="fromUser">
+              <el-input
+                placeholder="请输入"
+                v-model="formData.fromUser"
+                clearable
+              /> </el-form-item
+          ></el-col>
+          <el-col :span="8">
+            <el-form-item label="送货人联系方式" prop="deliveryPhone">
+              <el-input
+                placeholder="请输入"
+                v-model="formData.extInfo.deliveryPhone"
+                clearable /></el-form-item
+          ></el-col>
+          <el-col :span="24">
+            <el-form-item label="备注" prop="remark">
+              <el-input
+                v-model="formData.remark"
+                clearable
+                type="textarea"
+                placeholder="请详细说明"
+                :rows="4"
+              ></el-input>
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-form>
+
+      <div class="material">
+        <header-title title="产品信息">
+          <el-button
+            type="primary"
+            @click="addStock"
+            v-if="!isTask || isOutsourcing"
+            >添加</el-button
+          >
+        </header-title>
+
+        <div class="mt10 form-table">
+          <el-form
+            ref="warehousingMaterialListRef"
+            :model="{ warehousingMaterialList: warehousingMaterialList }"
+            :show-message="false"
+          >
+            <el-button
+              v-if="warehousingMaterialList.length != 0"
+              type="success"
+              plain
+              style="margin-bottom: 20px; float: right; margin-right: 20px"
+              size="mini"
+              @click="listSaveArrs"
+              >批量保存</el-button
+            >
+            <el-table
+              v-if="isWeight"
+              :header-cell-style="rowClass"
+              ref="warehousingMaterialListTable"
+              :key="formData.extInfo.assetType"
+              :data="warehousingMaterialList"
+              tooltip-effect="dark"
+              style="width: 100%"
+              stripe
+            >
+              <el-table-column
+                label="序号"
+                type="index"
+                width="50"
+                align="center"
+              >
+              </el-table-column>
+
+              <el-table-column
+                label="编码"
+                prop="assetCode"
+                align="center"
+                width="130"
+              ></el-table-column>
+              <el-table-column
+                label="名称"
+                align="center"
+                width="200"
+                prop="assetName"
+              ></el-table-column>
+              <el-table-column
+                v-for="(item, index) in tableHeader"
+                :key="index"
+                align="center"
+                :label="item.label"
+                width="150"
+                :prop="item.prop"
+              >
+                <template slot-scope="{ row }">
+                  <template v-if="item.formatter">{{
+                    item.formatter(row)
+                  }}</template>
+                  <template v-else>{{ row[item.prop] }}</template>
+                </template>
+              </el-table-column>
+              <el-table-column label="批号" width="100" prop="assetName">
+                <template slot-scope="{ row, $index }">
+                  <template v-if="row.isSave">
+                    {{ row.manualBatchNo }}
+                  </template>
+                  <el-form-item v-else>
+                    <el-input v-model="row.manualBatchNo"> </el-input>
+                  </el-form-item>
+                </template>
+              </el-table-column>
+              <el-table-column
+                label="批次号"
+                prop="batchNo"
+                width="70"
+                align="center"
+              >
+                <template slot-scope="{ row, $index }">
+                  <template v-if="row.isSave">
+                    {{ row.batchNo }}
+                  </template>
+                  <el-form-item
+                    v-else
+                    :prop="`warehousingMaterialList.${$index}.batchNo`"
+                    required
+                  >
+                    <!-- <el-input v-model="row.batchNo"></el-input> -->
+                    {{ row.batchNo }}
+                  </el-form-item>
+                </template>
+              </el-table-column>
+
+              <el-table-column
+                label="最小包装单元"
+                align="center"
+                prop="minPackingCount"
+                width="100"
+              >
+                <el-table-column label="" prop="minPackingCount" width="100">
+                  <template slot-scope="{ row, $index }">
+                    <template v-if="row.isSave">
+                      {{ row.minPackingCount }}
+                    </template>
+                    <el-form-item
+                      v-else
+                      :prop="`warehousingMaterialList.${$index}.minPackingCount`"
+                      required
+                    >
+                      <el-input
+                        type="number"
+                        v-model="row.minPackingCount"
+                        @input="minPackingCountChange(row, $event)"
+                      >
+                      </el-input>
+                    </el-form-item>
+                  </template>
+                </el-table-column>
+                <el-table-column label="" prop="minPackingCount">
+                  <template slot-scope="{ row, $index }">
+                    {{ handleRowUnit(row) }} /{{ row.minPackUnit }}
+                  </template>
+                </el-table-column>
+              </el-table-column>
+              <el-table-column
+                label="包装数量"
+                prop="outInNum"
+                width="150"
+                align="center"
+              >
+                <template slot-scope="{ row, $index }">
+                  <template v-if="row.isSave || formData.bizType == 5">
+                    {{ row.outInNum }} {{ row.minPackUnit }}
+                  </template>
+                  <el-form-item
+                    v-else
+                    :prop="`warehousingMaterialList.${$index}.outInNum`"
+                    required
+                  >
+                    <el-input
+                      v-model="row.outInNum"
+                      @input="packNum(row, $event)"
+                    >
+                      <template slot="append">
+                        {{ row.minPackUnit ? row.minPackUnit : '/' }}
+                      </template>
+                    </el-input>
+                  </el-form-item>
+                </template>
+              </el-table-column>
+              <el-table-column label="计量数量" prop="counts">
+                <template slot-scope="{ row, $index }">
+                  {{ $math.format(row.minPackingCount * row.outInNum, 14) }}
+                </template>
+              </el-table-column>
+              <el-table-column
+                label="计量单位"
+                prop="batchNo"
+                width="100"
+                align="center"
+              >
+                <!-- v-if="formData.extInfo.assetType == 1" -->
+
+                <template slot-scope="{ row, $index }">
+                  <template>
+                    {{ row.measuringUnit }}
+                  </template>
+                </template>
+              </el-table-column>
+              <el-table-column
+                label="重量"
+                align="center"
+                prop="contentImage"
+                :show-overflow-tooltip="true"
+              >
+                <template slot-scope="{ row, $index }">
+                  {{ row.weight }}
+                  <template slot="append">
+                    {{ handleRowUnit(row) }}
+                  </template>
+                </template>
+              </el-table-column>
+              <el-table-column
+                label="重量单位"
+                align="center"
+                prop="contentImage"
+                :show-overflow-tooltip="true"
+              >
+                <template slot-scope="{ row, $index }">
+                  {{ row.weightUnit }}
+                  <template slot="append"> </template>
+                </template>
+              </el-table-column>
+              <el-table-column
+                label="单价"
+                prop="univalence"
+                width="150"
+                align="center"
+              >
+                <template slot-scope="{ row, $index }">
+                  <el-form-item
+                    :prop="`warehousingMaterialList.${$index}.univalence`"
+                  >
+                    <el-input
+                      v-model="row.univalence"
+                      placeholder="非必填"
+                      @input="
+                        (value) =>
+                          (row.univalence = value.replace(/[^0-9.]+/g, ''))
+                      "
+                    >
+                      <template slot="append">
+                        元/{{ handleRowUnit(row) }}
+                      </template>
+                    </el-input>
+                  </el-form-item>
+                </template>
+              </el-table-column>
+              <el-table-column
+                label="金额"
+                align="center"
+                prop="contentImage"
+                :show-overflow-tooltip="true"
+              >
+                <template slot-scope="{ row, $index }">
+                  {{
+                    calcSumTotal(
+                      row.outInNum,
+                      row.minPackingCount,
+                      row.univalence,
+                      row
+                    )
+                  }}
+                </template>
+              </el-table-column>
+              <el-table-column
+                label="货位"
+                prop="warehouseName"
+                :show-overflow-tooltip="true"
+                width="250"
+                required
+              >
+                <template slot-scope="{ row, $index }">
+                  <el-form-item
+                    :prop="`warehousingMaterialList.${$index}.houseList`"
+                    :required="true"
+                  >
+                    <div @click="handleWareHouse(row, $index)">
+                      <div
+                        style="color: #ff4949"
+                        v-if="row.houseList.length == 0"
+                      >
+                        ---(必填)
+                      </div>
+                      <div v-else>
+                        <div
+                          class="fontOmitted"
+                          v-for="(item, index) in row.houseList"
+                          :key="index"
+                        >
+                          {{ item.warehouseName }}- {{ item.areaName }}-
+                          {{ item.shelfCode }}- {{ item.cargoSpaceCode
+                          }}<span style="color: #ff4949" v-if="item.num">
+                            - {{ item.num }}(数)</span
+                          >
+                          <br />
+                        </div>
+                      </div>
+                    </div>
+                  </el-form-item>
+                </template>
+              </el-table-column>
+              <el-table-column
+                label="质检单"
+                v-if="formData.extInfo.assetType === 3"
+                prop="contentImage"
+                :show-overflow-tooltip="true"
+              >
+                <template slot-scope="{ row, $index }">
+                  <upload @on-success="(data) => (row.contentImage = [data])"
+                    ><template slot="placeholder">上传</template></upload
+                  >
+                </template>
+              </el-table-column>
+
+              <el-table-column
+                label="操作"
+                width="200"
+                fixed="right"
+                align="center"
+              >
+                <template slot="header" slot-scope="scope"> 操作 </template>
+                <template slot-scope="{ row, $index }">
+                  <el-button
+                    type="text"
+                    v-show="!row.isSave"
+                    @click="listSave(row, $index)"
+                    >保存</el-button
+                  >
+                  <el-button
+                    type="text"
+                    v-show="row.isSave"
+                    @click="listEdit(row, $index)"
+                    >编辑</el-button
+                  >
+                  <el-button type="text" @click="listDel(row, $index)"
+                    >删除</el-button
+                  >
+                </template>
+              </el-table-column>
+            </el-table>
+          </el-form>
+        </div>
+        <div class="mt20">
+          <header-title :title="`包装明细`">
+            <div class="switch_right">
+              <span v-if="materialCodeReqList.length != 0">
+                分拆<el-switch
+                  v-model="isSplit"
+                  active-color="#13ce66"
+                  inactive-color="#ff4949"
+                  @change="handleIsDetail"
+                  style="margin-left: 10px"
+                >
+                </el-switch>
+              </span>
+
+              <el-button
+                style="margin-left: 20px"
+                type="text"
+                @click="dateSetting"
+                v-if="formData.bizType != 5"
+                >批量设置{{
+                  curDateType === 'manufactureTime' ? '生产日期' : '采购日期'
+                }}</el-button
+              >
+            </div>
+          </header-title>
+          <el-button
+            v-if="materialCodeReqList.length != 0"
+            type="success"
+            plain
+            style="margin-bottom: 20px; float: right; margin-right: 20px"
+            size="mini"
+            @click="wrapListSave"
+            >批量保存</el-button
+          >
+          <el-table
+            v-if="isWrapTable"
+            ref="materialCodeReqListTable"
+            :data="materialCodeReqList"
+            tooltip-effect="dark"
+            :key="formData.bizType"
+            :header-cell-style="rowClass"
+            style="width: 100%"
+            stripe
+            height="300px"
+            @selection-change="handleSelectionChange"
+          >
+            <el-table-column
+              label=""
+              type="selection"
+              align="center"
+              width="50"
+              v-if="formData.bizType != 5"
+            >
+            </el-table-column>
+            <el-table-column label="序号" type="index" width="50">
+            </el-table-column>
+            <el-table-column
+              label="编码"
+              prop="assetCode"
+              width="130"
+              :show-overflow-tooltip="true"
+            ></el-table-column>
+            <el-table-column
+              label="名称"
+              prop="assetName"
+              width="150"
+              :show-overflow-tooltip="true"
+            ></el-table-column>
+            <el-table-column
+              label="批号"
+              prop="manualBatchNo"
+              width="100"
+            ></el-table-column>
+            <el-table-column
+              label="批次号"
+              prop="batchNo"
+              width="70"
+            ></el-table-column>
+            <el-table-column
+              :label="`包装编码`"
+              prop="onlyCode"
+              width="130"
+              :show-overflow-tooltip="true"
+            ></el-table-column>
+            <el-table-column
+              label="包装数量"
+              prop="packingCount"
+              width="80"
+            ></el-table-column>
+            <el-table-column
+              label="包装单位"
+              prop="packingUnit"
+            ></el-table-column>
+            <el-table-column
+              label="计量数量"
+              prop="minPackingCount"
+            ></el-table-column>
+            <el-table-column
+              label="计量单位"
+              prop="measuringUnit"
+            ></el-table-column>
+            <el-table-column label="物料代号" prop="materielCode" width="130">
+              <template slot-scope="{ row }">
+                <el-input
+                  v-if="!row.isPack"
+                  v-model="row.materielCode"
+                ></el-input>
+                <span v-else>{{ row.materielCode }}</span>
+              </template>
+            </el-table-column>
+            <el-table-column label="客户代号" prop="clientCode">
+              <template slot-scope="{ row }">
+                <el-input
+                  v-if="!row.isPack"
+                  v-model="row.clientCode"
+                ></el-input>
+                <span v-else> {{ row.clientCode }}</span>
+              </template>
+            </el-table-column>
+            <el-table-column label="刻码" prop="engrave">
+              <template slot-scope="{ row }">
+                <el-input v-if="!row.isPack" v-model="row.engrave"></el-input>
+                <span v-else>{{ row.engrave }}</span>
+              </template>
+            </el-table-column>
+            <el-table-column label="重量" prop="weight" width="100">
+              <template slot-scope="{ row }">
+                <el-input
+                  v-if="!row.isPack && row.measuringUnit != row.weightUtil"
+                  v-model="row.weight"
+                  @input="weightInput($event, row)"
+                ></el-input>
+                <span v-else>{{ row.weight }}</span>
+              </template>
+            </el-table-column>
+            <el-table-column label="重量单位" prop="weightUtil">
+              <template slot-scope="{ row }">
+                {{ row.weightUtil }}
+              </template>
+            </el-table-column>
+
+            <el-table-column label="质检结果" prop="result" width="120">
+              <template slot-scope="{ row }">
+                <DictSelection
+                  dictName="质检结果"
+                  clearable
+                  v-model="row.result"
+                  v-if="!row.isPack"
+                  @updateVal="changeWrapStatus($event, row)"
+                />
+                <span v-else>{{ qualityResults[row.result] }}</span>
+              </template>
+            </el-table-column>
+            <el-table-column label="质检状态" prop="status" width="120">
+              <template slot-scope="{ row }">
+                <span>{{ qualityStatus[row.status] }}</span>
+              </template>
+            </el-table-column>
+
+            <el-table-column
+              v-if="formData.bizType != 5"
+              label="生产日期"
+              prop=""
+              width="220"
+            >
+              <template slot="header" slot-scope="scope">
+                <el-select filterable v-model="curDateType">
+                  <el-option
+                    value="manufactureTime"
+                    label="生产日期"
+                  ></el-option>
+                  <el-option
+                    value="procurementTime"
+                    label="采购日期"
+                  ></el-option>
+                </el-select>
+              </template>
+              <template slot-scope="{ row }">
+                <template v-if="formData.bizType == 5">
+                  {{ row[curDateType] }}
+                </template>
+                <el-date-picker
+                  v-else
+                  :disabled="row.ispack"
+                  size="small"
+                  v-model="row[curDateType]"
+                  type="datetime"
+                  value-format="yyyy-MM-dd HH:mm:ss"
+                  placeholder="选择日期"
+                >
+                </el-date-picker>
+              </template>
+            </el-table-column>
+            <template v-else>
+              <el-table-column
+                label="生产日期"
+                prop="manufactureTime"
+                width="200"
+              ></el-table-column>
+              <el-table-column
+                label="采购日期"
+                prop="procurementTime"
+                width="200"
+              ></el-table-column>
+            </template>
+            <el-table-column label="操作" width="120" fixed="right">
+              <template slot-scope="{ row, $index }">
+                <el-button type="text" @click="packCout(row)">
+                  {{ !row.isPack ? '保存' : '编辑' }}
+                </el-button>
+                <el-button type="text" @click="wrapDelete(row, $index)">
+                  删除
+                </el-button>
+              </template>
+            </el-table-column>
+          </el-table>
+          <!-- </el-tab-pane>
+        </el-tabs> -->
+        </div>
+        <div class="mt20" v-if="isSplit">
+          <header-title :title="`物料明细`"> </header-title>
+          <el-button
+            v-if="resultArray.length != 0"
+            type="success"
+            plain
+            style="margin-bottom: 20px; float: right; margin-right: 20px"
+            size="mini"
+            @click="materialListSave"
+            >批量保存</el-button
+          >
+          <el-table
+            v-if="isMaterialTable"
+            ref="resultArrayTable"
+            :data="resultArray"
+            tooltip-effect="dark"
+            :key="formData.bizType"
+            :header-cell-style="rowClass"
+            style="width: 100%"
+            stripe
+            height="300px"
+            @selection-change="handleSelectionChange"
+          >
+            <el-table-column label="序号" type="index" width="50">
+            </el-table-column>
+            <el-table-column
+              label="编码"
+              prop="assetCode"
+              :show-overflow-tooltip="true"
+            ></el-table-column>
+            <el-table-column
+              label="名称"
+              prop="assetName"
+              width="200"
+              :show-overflow-tooltip="true"
+            ></el-table-column>
+            <el-table-column
+              label="批号"
+              prop="manualBatchNo"
+              width="100"
+            ></el-table-column>
+            <el-table-column
+              label="批次号"
+              prop="batchNo"
+              width="80"
+            ></el-table-column>
+            <el-table-column
+              label="物料编码"
+              prop="no"
+              width="200"
+              :show-overflow-tooltip="true"
+            ></el-table-column>
+            <el-table-column
+              label="计量数量"
+              prop="minPackingCount"
+              width="90"
+            ></el-table-column>
+            <el-table-column
+              width="80"
+              label="计量单位"
+              prop="measuringUnit"
+            ></el-table-column>
+            <el-table-column label="物料代号" prop="meterielCode" width="130">
+              <template slot-scope="{ row }">
+                <el-input
+                  v-model="row.materielCode"
+                  v-if="!row.isPack"
+                ></el-input>
+                <span v-else>{{ row.materialCode }}</span>
+              </template>
+            </el-table-column>
+            <el-table-column label="客户代号" prop="clientCode">
+              <template slot-scope="{ row }">
+                <el-input
+                  v-model="row.clientCode"
+                  v-if="!row.isPack"
+                ></el-input>
+                <span v-else> {{ row.clientCode }}</span>
+              </template>
+            </el-table-column>
+            <el-table-column label="刻码" prop="engrave">
+              <template slot-scope="{ row }">
+                <el-input v-model="row.engrave" v-if="!row.isPack"></el-input>
+                <span v-else> {{ row.engrave }}</span>
+              </template>
+            </el-table-column>
+            <el-table-column width="100" label="重量" prop="weight">
+              <template slot-scope="{ row }">
+                <el-input
+                  v-model="row.weight"
+                  v-if="!row.isPack && row.measuringUnit != row.weightUnit"
+                ></el-input>
+                <span v-else>{{ row.weight }}</span>
+              </template>
+            </el-table-column>
+            <el-table-column label="重量单位" prop="weightUnit" width="100">
+            </el-table-column>
+            <el-table-column label="质检结果" prop="result" width="120">
+              <template slot-scope="{ row }">
+                <DictSelection
+                  dictName="质检结果"
+                  clearable
+                  v-model="row.result"
+                  v-if="!row.isPack"
+                  @updateVal="changeWrapStatus($event, row)"
+                />
+                <span v-else>{{ qualityResults[row.result] }}</span>
+              </template>
+            </el-table-column>
+            <el-table-column label="质检状态" prop="status" width="120">
+              <template slot-scope="{ row }">
+                <span>{{ qualityStatus[row.status] }}</span>
+              </template>
+            </el-table-column>
+            <el-table-column label="操作" width="120" fixed="right">
+              <template slot-scope="{ row, $index }">
+                <el-button type="text" @click="materialBtn(row)">
+                  {{ !row.isPack ? '保存' : '编辑' }}
+                </el-button>
+                <el-button type="text" @click="materialDelete(row, $index)">
+                  删除
+                </el-button>
+              </template>
+            </el-table-column>
+          </el-table>
+        </div>
+      </div>
+    </el-card>
+    <selectType
+      :visibleDialog.sync="visibleDialog"
+      :title="title"
+      :tableHeader="tableHeader"
+      :bizScene="formData.bizType"
+      :type="[selectEquiType]"
+      :loadTree.sync="loadTree"
+      @selectTableData="addProduct"
+    />
+    <WareHouseDailog
+      ref="wareHouseDailogRef"
+      @houseData="houseData"
+    ></WareHouseDailog>
+    <el-dialog :visible.sync="dateVisible" title="选择日期" width="400px">
+      <el-date-picker
+        size="small"
+        v-model="batchTime"
+        type="datetime"
+        style="width: 320px"
+        value-format="yyyy-MM-dd HH:mm:ss"
+        placeholder="选择日期"
+      >
+      </el-date-picker>
+      <div style="text-align: right; margin-top: 20px">
+        <el-button @click="dateVisible = false">取消</el-button>
+        <el-button type="primary" @click="dateConfirm" :disabled="!batchTime"
+          >确认</el-button
+        >
+      </div>
+    </el-dialog>
+
+    <!-- 销售订单 -->
+    <picker ref="pickerRef" @success="pickerSuccess" />
+  </div>
+</template>
+
+<script>
+  import { getOutInBySourceBizNoOrError } from '@/api/classifyManage/index';
+  import { getProductList } from '@/api/bpm/components/saleManage/contact';
+  import { getLoginUser } from '@/api/login';
+  import picker from '@/views/bpm/stockManagement/components/picker.vue';
+  import outin from '@/api/warehouseManagement/outin';
+  import { getTreeByGroup, allCategoryLevel } from '@/api/classifyManage';
+  import warehouseDefinition from '@/api/warehouseManagement/warehouseDefinition';
+  import selectUpload from '@/components/selectUpload';
+  import upload from '@/components/uploadImg';
+  import { sceneState } from '@/utils/dict/index';
+  import selectTree from '@/components/selectTree';
+  import selectType from '@/views/bpm/stockManagement/components/selectType.vue';
+  import WareHouseDailog from '@/views/bpm/stockManagement/components/WareHouseDailog.vue';
+  import ReturnSelect from '@/views/bpm/stockManagement/components/ReturnSelect.vue';
+  import { tableHeader } from '@/views/bpm/handleTask/components/inoutBound/common';
+  import { getCode } from '@/api/codeManagement/index.js';
+  import { getReceiveSaleOrderrecordDetail } from '@/api/bpm/components/purchasingManage/purchaseorderreceive';
+  import { deepClone } from 'ele-admin/lib/utils/core';
+
+  export default {
+    components: {
+      selectUpload,
+      selectTree,
+      selectType,
+      WareHouseDailog,
+      upload,
+      ReturnSelect,
+      picker
+    },
+    data() {
+      return {
+        isWrapTable: true, // 包装表格显隐
+        isMaterialTable: true, // 物料表格显隐
+        isOutsourcing: false, // 是否委外
+        isSplit: false, // 是否拆分到物料明细
+        qualityStatus: {
+          0: '未检',
+          1: '已检',
+          2: '部分检'
+        }, // 质检状态 0未检 1已检
+        qualityResults: {
+          0: '合格',
+          1: '不合格',
+          3: '让步接收'
+        }, // 质检结果 0合格 1不合格 3让步接收
+        isTask: false,
+        isWeight: true,
+        resultArray: [],
+        pickerRow: {},
+        codeList: [],
+        sceneState,
+        visibleDialog: false,
+        curDateType: 'manufactureTime',
+        materialCodeReqListSelected: [],
+        title: '',
+        warehousingMaterialList: [],
+        loadTree: true,
+        selectEquiType: '',
+        batchTime: '',
+        dateVisible: false,
+        formData: {
+          extInfo: {
+            assetType: '', //物品类型
+            deptCode: '', //部门code
+            deptName: '', //部门名称
+            verifyDeptCode: '', //审核部门编码
+            verifyDeptName: '', //审核部门名称
+            deliveryName: '', //送货人名称
+            deliveryPhone: '', //送货人电话
+            documentSource: '', //销售订单
+            urgent: '', //紧急状态
+            supplierId: '', //供应商ID
+            supplierName: '', //供应商名称
+            createUserName: '', //创建人名字
+            contentImage: [] //图片数组
+          },
+          fromUser: '', //送货人
+          bizType: '', //物品类型
+          verifyId: '', //审核人Id
+          verifyName: '', //审核人名称
+          createUserId: '',
+          remark: ''
+        },
+        rules: {
+          'extInfo.assetType': {
+            required: true,
+            message: '请选择物品类型',
+            trigger: 'change'
+          },
+          bizType: {
+            required: true,
+            message: '请选择入库场景',
+            trigger: 'change'
+          }
+        }
+      };
+    },
+    props: ['inboundType'],
+    computed: {
+      // 条码信息
+      materialCodeReqList() {
+        return this.warehousingMaterialList
+          .map((i) => i.warehouseLedgerDetails || [])
+          .flat();
+      },
+      tableHeader() {
+        return tableHeader(this.selectEquiType);
+      }
+    },
+    created() {
+      this.initData();
+    },
+    methods: {
+      // 包装维度最小包装单元改变——>总重量
+      minPackingCountChange(row, value) {
+        if (value >= 0) {
+          row.minPackingCount = value;
+        } else {
+          row.minPackingCount = 0;
+        }
+        // row.minPackingCount = value.replace(/^(0+)|[^\d]+/g, '');
+        if (row.outInNum >= 0 && value >= 0) {
+          this.packNum(row, row.outInNum);
+        }
+      },
+      // 选择质检结果改变质检状态
+      changeWrapStatus(resultValue, row) {
+        switch (resultValue) {
+          case '':
+            // 清空质检状态
+            row.status = '0';
+            break;
+          default:
+            // 默认已检质检状态
+            row.status = '1';
+            break;
+        }
+      },
+      weightInput(value, row) {
+        const newValue = value.replace(/[^\d.]/g, ''); // 保留数字和小数点
+        const decimalCount = (newValue.match(/\./g) || []).length; // 计算小数点的个数
+        if (decimalCount > 1) {
+          // 如果小数点个数大于1,移除多余的小数点
+          const lastIndex = newValue.lastIndexOf('.');
+          row.weight =
+            newValue.slice(0, lastIndex) + newValue.slice(lastIndex + 1);
+        } else if (decimalCount === 1) {
+          // 如果小数点个数等于1,允许小数点的输入
+          row.weight = newValue;
+        } else {
+          row.weight = newValue === '' ? 0 : parseFloat(newValue); // 如果输入为空,则设为0
+        }
+      },
+      // 拆分物料
+      handleIsDetail(event) {
+        this.isSplit = event;
+        const list = this.materialCodeReqList;
+        if (event) {
+          let resultArray = [];
+          list.forEach((item) => {
+            // 包装维度改成已保存状态
+            item.isPack = true;
+            // 拆分物料维度并生成列表
+            for (let i = 1; i <= Number(item.minPackingCount); i++) {
+              resultArray.push({
+                onlyCode: item.onlyCode,
+                no: item.onlyCode + i.toString().padStart(4, '0'),
+                assetCode: item.assetCode,
+                assetName: item.assetName,
+                manualBatchNo: item.manualBatchNo,
+                batchNo: item.batchNo,
+                minPackingCount: 1,
+                measuringUnit: item.measuringUnit,
+                materielCode: item.materielCode,
+                clientCode: item.clientCode,
+                weight: this.$math.format(
+                  item.weight / Number(item.minPackingCount),
+                  14
+                ),
+                initWeight: this.$math.format(
+                  item.weight / Number(item.minPackingCount),
+                  14
+                ),
+                weightUnit: item.weightUnit,
+                engrave: item.engrave,
+                result: item.result,
+                status: item.status,
+                isPack: false
+              });
+            }
+          });
+
+          this.resultArray = resultArray;
+          // 批量修改包装明细
+          this.isWeight = false;
+          this.bulkEditingWrap();
+          this.$nextTick(() => {
+            this.isWeight = true;
+          });
+        } else {
+          // 包装维度改成编辑状态
+          list.forEach((item) => {
+            item.isPack = false;
+          });
+          // 清空物料维度列表
+          this.resultArray = [];
+        }
+      },
+      //包装明细保存
+      packCout(row) {
+        //true保存==》反之
+        if (!row.isPack) {
+          row.isPack = true;
+          const code = row.assetCode;
+          const batchNo = row.batchNo;
+          //做防护,防止weight字符串类型
+          this.materialCodeReqList.forEach((ele) => {
+            ele.weight = Number(ele.weight);
+          });
+          // 修改产品信息重量(包装维度累计)
+          this.isWeight = false;
+          this.warehousingMaterialList.forEach((item) => {
+            if (item.assetCode == code && item.batchNo == batchNo) {
+              let arr = [];
+              for (const key in this.materialCodeReqList) {
+                if (
+                  this.materialCodeReqList[key].assetCode == item.assetCode &&
+                  this.materialCodeReqList[key].batchNo == item.batchNo
+                ) {
+                  arr.push({ ...this.materialCodeReqList[key] });
+                }
+              }
+              const count = arr.reduce((acc, curr) => {
+                if (curr.isPack) {
+                  this.$set(curr, 'initWeight', +curr.weight);
+                  return Number(this.$math.format(+acc + +curr.weight, 14));
+                } else {
+                  return Number(this.$math.format(+acc + +curr.initWeight, 14));
+                }
+              }, 0);
+              this.$set(item, 'weight', count);
+            }
+          });
+          this.$nextTick(() => {
+            this.isWeight = true;
+          });
+        } else {
+          row.isPack = false;
+        }
+        this.$nextTick(() => {
+          this.isWrapTable = false;
+          this.$nextTick(() => {
+            this.isWrapTable = true;
+          });
+        });
+      },
+      // 批量修改包装明细
+      bulkEditingWrap() {
+        // 批量修改包装明细列表状态(已保存)
+        this.materialCodeReqList.forEach((item) => {
+          item.isPack = true;
+        });
+        // 改变产品明细重量
+        this.warehousingMaterialList.forEach((outItem) => {
+          let arr = [];
+          this.materialCodeReqList.forEach((inneritem) => {
+            if (
+              inneritem.assetCode == outItem.assetCode &&
+              inneritem.batchNo == outItem.batchNo
+            ) {
+              arr.push(inneritem);
+            }
+          });
+          const count = arr.reduce((acc, curr) => {
+            if (curr.isPack) {
+              this.$set(curr, 'initWeight', +curr.weight);
+              return Number(this.$math.format(+acc + +curr.weight, 14));
+            } else {
+              return Number(this.$math.format(+acc + +curr.initWeight, 14));
+            }
+          }, 0);
+          this.$set(outItem, 'weight', count);
+        });
+      },
+      // 批量修改物料明细
+      bulkEditingMaterial() {
+        // 批量修改物料明细列表状态(已保存)
+        this.resultArray.forEach((item) => {
+          item.isPack = true;
+        });
+        // 改变包装明细重量
+        this.materialCodeReqList.forEach((outItem) => {
+          let arr = [];
+          this.resultArray.forEach((inneritem) => {
+            if (
+              inneritem.assetCode == outItem.assetCode &&
+              inneritem.batchNo == outItem.batchNo
+            ) {
+              arr.push(inneritem);
+            }
+          });
+          const count = arr.reduce((acc, curr) => {
+            if (curr.isPack) {
+              this.$set(curr, 'initWeight', +curr.weight);
+              return Number(this.$math.format(+acc + +curr.weight, 14));
+            } else {
+              return Number(this.$math.format(+acc + +curr.initWeight, 14));
+            }
+          }, 0);
+          this.$set(outItem, 'weight', count);
+        });
+      },
+      // 物料明细保存
+      materialBtn(row) {
+        console.log(row.isPack);
+        // true保存 false编辑
+        if (!row.isPack) {
+          this.$set(row, 'isPack', true);
+          row.isPack = true;
+          // 物料维度修改质检改变包装维度质检(结果和状态)
+          this.materialCodeReqList.forEach((outItem) => {
+            let arr = [];
+            this.resultArray.forEach((inneritem) => {
+              if (inneritem.onlyCode == outItem.onlyCode) {
+                arr.push(inneritem);
+              }
+            });
+            console.log(arr);
+            // 首先判断是未填/合格不合格
+            let boolen = arr.every((item) => {
+              return (
+                item.result === '' ||
+                item.result === undefined ||
+                item.result === null
+              );
+            });
+            // 判断只要物料全部质检结果(未填)——>包装质检结果(未填) 状态(未检)
+            if (boolen) {
+              this.$set(outItem, 'result', '');
+              this.$set(outItem, 'status', '0');
+            } else {
+              // 判断只要物料有一个质检结果(不合格)——>包装质检结果(不合格) 状态(已检)
+              let boolen = arr.some((item) => {
+                return item.result === '1';
+              });
+              if (boolen) {
+                this.$set(outItem, 'result', '1');
+                this.$set(outItem, 'status', '1');
+              } else {
+                // 判断只要物料有一个质检结果(让步接收)——>包装质检结果(让步接收) 状态(已检)
+                let boolen = arr.some((item) => {
+                  return item.result === '3';
+                });
+                if (boolen) {
+                  // 让步接收 已检
+                  this.$set(outItem, 'result', '3');
+                  this.$set(outItem, 'status', '1');
+                } else {
+                  // 判断只要物料有全部质检结果(合格)——>包装质检结果(合格) 状态(已检)
+                  let boolen = arr.every((item) => {
+                    return item.result === '0';
+                  });
+                  if (boolen) {
+                    // 合格 已检
+                    this.$set(outItem, 'result', '0');
+                    this.$set(outItem, 'status', '1');
+                  } else {
+                    // 合格 部分检
+                    this.$set(outItem, 'result', '0');
+                    this.$set(outItem, 'status', '2');
+                  }
+                }
+              }
+            }
+            // this.$set(outItem, 'result', boolen ? '1' : '0');
+          });
+          // 物料维度修改重量改变包装维度重量
+          let onlyCode = row.onlyCode;
+          this.materialCodeReqList.forEach((item) => {
+            if (item.onlyCode === onlyCode) {
+              let arr = [];
+              for (const key in this.resultArray) {
+                if (this.resultArray[key].onlyCode == item.onlyCode) {
+                  arr.push(this.resultArray[key]);
+                }
+              }
+              const count = arr.reduce((acc, curr) => {
+                if (curr.isPack) {
+                  this.$set(curr, 'initWeight', +curr.weight);
+                  return Number(this.$math.format(+acc + +curr.weight, 14));
+                } else {
+                  return Number(this.$math.format(+acc + +curr.initWeight, 14));
+                }
+              }, 0);
+              this.$set(item, 'weight', count);
+            }
+          });
+          // 包装维度修改重量改变产品信息
+          this.isWeight = false;
+          // 批量修改包装明细
+          this.bulkEditingWrap();
+          this.$nextTick(() => {
+            this.isWeight = true;
+          });
+        } else {
+          row.isPack = false;
+        }
+        this.$nextTick(() => {
+          this.isWrapTable = false;
+          this.isMaterialTable = false;
+          this.$nextTick(() => {
+            this.isWrapTable = true;
+            this.isMaterialTable = true;
+          });
+        });
+      },
+      // 重量计算
+      packNum(row, value) {
+        const total = {
+          packingCount: Number(
+            row.minPackingCount > 0 ? row.minPackingCount : 0
+          ),
+          outInNum: Number(row.outInNum > 0 ? row.outInNum : 0)
+        };
+        if (row.measuringUnit == row.weightUnit) {
+          row.weight = Number(
+            this.$math.format(
+              total.packingCount * 1 * total.outInNum.toFixed(2),
+              14
+            )
+          );
+        } else {
+          const totals = Number(
+            this.$math.format(total.packingCount * total.outInNum, 14)
+          );
+          row.weight = Number(
+            this.$math.format(
+              totals * (row.netWeight > 0 ? row.netWeight.toFixed(2) : 0),
+              14
+            )
+          );
+        }
+        return (row.outInNum = value.replace(/^(0+)|[^\d]+/g, ''));
+      },
+      // 根据单据信息初始化产品信息(外部调用)
+      async pickerSuccess(row) {
+        console.log('---------------------');
+        console.log(row);
+        this.isTask = true;
+        this.pickerRow = row;
+        // this.codeListValue(row.categoryLevelTopId);
+        this.formData.bizType = '2';
+        this.formData.extInfo.documentSource = row.orderNo;
+        this.formData.extInfo.assetType = row.categoryLevelTopId;
+        this.selectEquiType = row.categoryLevelTopId;
+        this.formData.sourceBizNo = row.receiveNo;
+        this.formData.fromId = row.id;
+        this.formData.clientName = row.partaName;
+        this.formData.clientCode = row.partaId;
+        this.formData.extInfo.supplierName = row.supplierName;
+        this.formData.extInfo.supplierId = row.supplierId;
+        const data = await getReceiveSaleOrderrecordDetail(row.id);
+        if (this.warehousingMaterialList.length == 0) {
+          let list = data.productList.map((item) => {
+            return {
+              ...item,
+              assetName: item.productName,
+              assetCode: item.productCode,
+              categoryId: item.productCategoryId,
+              minPackUnit: item.packingUnit
+            };
+          });
+          await this.onSelectTableData(await this.serachMainCode(list));
+        }
+        // 委外发货入库(出库再入库)
+        if (row.outsourceSendCode) {
+          this.isOutsourcing = true;
+          this.formData.bizType = '8';
+          this.title = '半成品入库';
+          getOutInBySourceBizNoOrError(row.outsourceSendCode).then(
+            async (res) => {
+              if (res.outInDetailVOList && res.outInDetailVOList.length > 0) {
+                const batchNo = await getCode('lot_number_code');
+                this.warehousingMaterialList = [];
+                let arr = res.outInDetailVOList.map(async (goodsiItem) => {
+                  return new Promise(async (outResolve) => {
+                    goodsiItem.isSave = true;
+                    goodsiItem.houseList = [];
+                    goodsiItem.batchNo = batchNo;
+                    goodsiItem.assetName = goodsiItem.name;
+                    goodsiItem.assetCode = goodsiItem.categoryCode;
+                    goodsiItem.outInNum =
+                      goodsiItem.packingCount < 1 ? 1 : goodsiItem.packingCount;
+                    goodsiItem.minPackingCount = goodsiItem.minPackingCount;
+                    goodsiItem.minPackUnit = goodsiItem.packingUnit;
+                    this.warehousingMaterialList.push(goodsiItem);
+                    let res = await outin.getAssetNum({
+                      assetCode: goodsiItem.assetCode,
+                      batchNum: goodsiItem.batchNo,
+                      num: goodsiItem.outInNum < 1 ? 1 : goodsiItem.outInNum
+                    });
+                    let arr = goodsiItem.outInDetailRecordVOList.map(
+                      (wrapItem, index) => {
+                        return new Promise(async (resolve) => {
+                          wrapItem.onlyCode = res.shift().onlyCode;
+                          wrapItem.packingCount =
+                            wrapItem.packingCount < 1
+                              ? 1
+                              : wrapItem.packingCount;
+                          wrapItem.isPack = true;
+                          wrapItem.minPackingCount = wrapItem.totalCount;
+                          wrapItem.assetName = goodsiItem.name;
+                          wrapItem.assetCode = goodsiItem.categoryCode;
+                          wrapItem.batchNo = batchNo;
+                          wrapItem.result =
+                            wrapItem.result === null
+                              ? ''
+                              : String(wrapItem.result);
+                          // wrapItem.count =
+                          //   wrapItem.outInDetailRecordMaterialDetailVOList.length; // 增加包装计量数量
+                          // 增加内部重量(解决重量未保存同时参与计算问题)
+                          wrapItem.initWeight = wrapItem.weight;
+                          if (
+                            wrapItem.outInDetailRecordMaterialDetailVOList
+                              ?.length > 0
+                          ) {
+                            wrapItem.outInDetailRecordMaterialDetailVOList.forEach(
+                              (materialItem, index) => {
+                                materialItem.id = '';
+                                materialItem.onlyCode = wrapItem.onlyCode;
+                                materialItem.no =
+                                  materialItem.onlyCode +
+                                  index.toString().padStart(4, '0');
+                                materialItem.result =
+                                  materialItem.result === null
+                                    ? ''
+                                    : String(materialItem.result);
+                                materialItem.batchNo = batchNo;
+                                materialItem.minPackingCount = 1;
+                                materialItem.isPack = true;
+                                // 增加内部重量(解决重量未保存同时参与计算问题)
+                                materialItem.initWeight = materialItem.weight;
+                                this.resultArray.push(materialItem);
+                              }
+                            );
+                          }
+                          resolve(wrapItem);
+                        });
+                      }
+                    );
+                    Promise.all(arr).then((data) => {
+                      console.log(goodsiItem);
+                      goodsiItem.warehouseLedgerDetails = data;
+                      outResolve(goodsiItem);
+                      // console.log(this.resultArray);
+                      // goodsiItem.warehouseLedgerDetails =
+                      //   goodsiItem.outInDetailRecordVOList;
+                      // if (this.resultArray.length > 0) {
+                      //   this.isSplit = true;
+                      // }
+                    });
+                  });
+                });
+                Promise.all(arr).then((data) => {
+                  console.log(this.warehousingMaterialList);
+                  console.log(this.resultArray);
+                  this.warehousingMaterialList = data;
+                  if (this.resultArray.length > 0) {
+                    this.isSplit = true;
+                  }
+                });
+
+                // this.warehousingMaterialList.forEach((item, index) => {
+                //   item.manualBatchNo =
+                //     warehousingMaterialList[index].manualBatchNo;
+                //   item.minPackingCount = warehousingMaterialList[index].count;
+                //   item.outInNum = warehousingMaterialList[index].outInNum;
+                //   item.weight = warehousingMaterialList[index].weight;
+                // });
+                // this.listSaveArrs().then(() => {
+                //   this.materialCodeReqList.forEach((item, index) => {
+                //     item.materielCode = materialCodeReqList[index].materielCode;
+                //     item.clientCode = materialCodeReqList[index].clientCode;
+                //     item.engrave = materialCodeReqList[index].engrave;
+                //   });
+                //   if (resultArray.length > 0) {
+                //     this.handleIsDetail(true);
+                //     this.resultArray.forEach((item, index) => {
+                //       item.materielCode = resultArray[index].materielCode;
+                //       item.clientCode = resultArray[index].clientCode;
+                //       item.engrave = resultArray[index].engrave;
+                //     });
+                //   }
+                // });
+                // console.log(warehousingMaterialList);
+                // console.log(materialCodeReqListOrStorage);
+                // console.log(resultArray);
+              }
+            }
+          );
+        } else {
+          this.formData.bizType = '2';
+          this.title = '采购入库';
+        }
+      },
+      // 包装删除
+      wrapDelete(row, index) {
+        // 删除包装
+        this.materialCodeReqList.splice(index, 1);
+        let outIndex = 0;
+        let arr = this.warehousingMaterialList.filter((item, index) => {
+          if (item.assetCode == row.assetCode && item.batchNo == row.batchNo) {
+            outIndex = index;
+            return true;
+          }
+        });
+        // 修改产品
+        if (arr[0].minPackingCount * arr[0].outInNum === row.minPackingCount) {
+          this.warehousingMaterialList.splice(outIndex, 1);
+        } else {
+          this.$set(
+            this.warehousingMaterialList[outIndex],
+            'outInNum',
+            this.warehousingMaterialList[outIndex].outInNum - 1
+          );
+        }
+        // 删除物料
+        if (this.resultArray.length > 0) {
+          let indexs = [];
+          let arr = this.resultArray.filter((item, index) => {
+            if (
+              item.assetCode == row.assetCode &&
+              item.batchNo == row.batchNo
+            ) {
+              indexs.push(index);
+              return true;
+            }
+          });
+          console.log(indexs);
+          console.log(arr);
+          this.resultArray = this.resultArray.filter((item, index) => {
+            return !indexs.includes(index);
+          });
+        }
+      },
+      // 物料删除
+      materialDelete(row, index) {
+        let isBoolen = false;
+        // 删除物料
+        this.resultArray.splice(index, 1);
+        // 修改包装
+        let wrapOutIndex = 0;
+        let wrapArr = this.materialCodeReqList.filter((item, index) => {
+          if (item.assetCode == row.assetCode && item.batchNo == row.batchNo) {
+            wrapOutIndex = index;
+            return true;
+          }
+        });
+        if (wrapArr[0].minPackingCount === row.minPackingCount) {
+          isBoolen = true;
+          // 修改产品
+          let materialOutIndex = 0;
+          let materialArr = this.warehousingMaterialList.filter(
+            (item, index) => {
+              console.log(wrapOutIndex);
+              console.log(this.materialCodeReqList);
+              console.log(item.assetCode);
+              console.log(this.materialCodeReqList[wrapOutIndex]);
+              console.log(this.materialCodeReqList[wrapOutIndex].assetCode);
+              console.log('----------------');
+              if (
+                item.assetCode ==
+                  this.materialCodeReqList[wrapOutIndex].assetCode &&
+                item.batchNo == this.materialCodeReqList[wrapOutIndex].batchNo
+              ) {
+                materialOutIndex = index;
+                return true;
+              }
+            }
+          );
+          if (
+            materialArr[0].minPackingCount * materialArr[0].outInNum ===
+            this.materialCodeReqList[wrapOutIndex].minPackingCount
+          ) {
+            this.materialCodeReqList.splice(wrapOutIndex, 1);
+            this.warehousingMaterialList.splice(materialOutIndex, 1);
+          } else {
+            this.$set(
+              this.warehousingMaterialList[materialOutIndex],
+              'minPackingCount',
+              this.warehousingMaterialList[materialOutIndex].minPackingCount - 1
+            );
+          }
+        } else {
+          this.$set(
+            this.materialCodeReqList[wrapOutIndex],
+            'minPackingCount',
+            this.materialCodeReqList[wrapOutIndex].minPackingCount - 1
+          );
+        }
+        if (!isBoolen) {
+          // 修改产品
+          let materialOutIndex = 0;
+          let materialArr = this.warehousingMaterialList.filter(
+            (item, index) => {
+              console.log(wrapOutIndex);
+              console.log(this.materialCodeReqList);
+              console.log(item.assetCode);
+              console.log(this.materialCodeReqList[wrapOutIndex]);
+              console.log(this.materialCodeReqList[wrapOutIndex].assetCode);
+              console.log('----------------');
+              if (
+                item.assetCode ==
+                  this.materialCodeReqList[wrapOutIndex].assetCode &&
+                item.batchNo == this.materialCodeReqList[wrapOutIndex].batchNo
+              ) {
+                materialOutIndex = index;
+                return true;
+              }
+            }
+          );
+          if (
+            materialArr[0].minPackingCount * materialArr[0].outInNum ===
+            this.materialCodeReqList[wrapOutIndex].minPackingCount
+          ) {
+            this.warehousingMaterialList.splice(materialOutIndex, 1);
+          } else {
+            this.$set(
+              this.warehousingMaterialList[materialOutIndex],
+              'minPackingCount',
+              this.warehousingMaterialList[materialOutIndex].minPackingCount - 1
+            );
+          }
+        }
+      },
+      async serachMainCode(arr) {
+        let newArr = [];
+        // 使用 Promise.all 来等待所有异步操作完成
+        await Promise.all(
+          arr.map(async (item) => {
+            const data = await getProductList({
+              pageNum: 1,
+              size: 10,
+              categoryLevelId: item.categoryLevelPathIdParent,
+              codeEq: item.assetCode
+            });
+            newArr.push(data.list); // 将结果存储到 newArr 中
+          })
+        );
+        let re = [];
+        for (const item of newArr) {
+          for (const it of item) {
+            re.push(it);
+          }
+        }
+        return re.map((item) => {
+          return {
+            ...item,
+            minPackUnit: item.packingUnit,
+            assetCode: item.code,
+            assetName: item.name
+          };
+        });
+      },
+      onClear() {
+        this.formData.extInfo.documentSource = '';
+        this.pickerRow = {};
+        this.formData.clientName = '';
+        this.formData.clientCode = '';
+        this.formData.extInfo.supplierName = '';
+        this.formData.extInfo.supplierId = '';
+        this.$forceUpdate();
+      },
+      handlePicker() {
+        this.$refs.pickerRef.open();
+      },
+      // 物品类型选择
+      codeListValue(val) {
+        this.formData.extInfo.assetType = val.id || val;
+        this.$forceUpdate();
+        this.title = val?.name;
+        this.selectEquiType = val?.id || val;
+      },
+      //计算金额
+      calcSumTotal(PackingCount, outInNum, univalence) {
+        //最小包装单元,包装数量,单价
+        const total = {
+          PackingCount: Number(PackingCount > 0 ? PackingCount : 0),
+          outInNum: Number(outInNum > 0 ? outInNum : 0),
+          univalence: Number(univalence == undefined ? 0 : univalence)
+        };
+        return Number(
+          this.$math.format(
+            total.PackingCount * total.outInNum * total.univalence,
+            14
+          )
+        );
+      },
+      handleRowUnit(row) {
+        return row.measuringUnit;
+      },
+      rowClass({ row, column, rowIndex, columnIndex }) {
+        if (rowIndex === 1) {
+          return {
+            display: 'none',
+            background: '#EEEEEE',
+            border: 'none'
+          };
+        }
+        return { background: '#EEEEEE', border: 'none' };
+      },
+      // 仓库编辑
+      handleWareHouse(row, idx) {
+        this.$refs.wareHouseDailogRef.open(row, idx);
+      },
+      // 入库操作
+      listEdit(row) {
+        this.$set(row, 'isSave', false);
+        row.selfWarehouseLedgerDetails = row.warehouseLedgerDetails;
+        row.warehouseLedgerDetails = [];
+        // 重置重量
+        this.packNum(row, row.outInNum);
+        // 清空物料明细防止数据错乱
+        if (this.isSplit && this.resultArray?.length > 0) {
+          this.handleIsDetail(false);
+        }
+      },
+      // 产品单个保存
+      listSave(row, index) {
+        // 清空物料明细防止数据错乱
+        if (this.isSplit && this.resultArray?.length > 0) {
+          this.handleIsDetail(false);
+        }
+        const fileds = [
+          // `warehousingMaterialList.${index}.cargoSpaceCode`,
+          `warehousingMaterialList.${index}.batchNo`,
+          `warehousingMaterialList.${index}.houseList`
+        ];
+        if (this.formData.bizType == 1) {
+          // fileds.push(...[`warehousingMaterialList.${index}.customCode`]);
+        } else if (this.formData.bizType == 2) {
+          // fileds.push(...[`warehousingMaterialList.${index}.supplierCode`]);
+        }
+        if (this.formData.bizType != 5) {
+          fileds.push(
+            ...[
+              `warehousingMaterialList.${index}.outInNum`,
+              `warehousingMaterialList.${index}.minPackingCount`
+            ]
+          );
+        } else if (
+          this.warehousingMaterialList.some(
+            (i) => !i.selfWarehouseLedgerDetails?.length
+          )
+        ) {
+          this.$message.error('请选择资产编号!');
+          return;
+        }
+        Promise.all(
+          fileds.map(
+            (item) =>
+              new Promise(async (resolve, rej) => {
+                this.$refs.warehousingMaterialListRef.validateField(
+                  item,
+                  (err) => {
+                    if (err) {
+                      rej(err);
+                    } else {
+                      resolve();
+                    }
+                  }
+                );
+              })
+          )
+        )
+          .then((res) => {
+            this.$set(row, 'isSave', true);
+            this.createMaterialCode(row);
+          })
+          .catch((err) => {
+            this.$message.error('请填入必填项!');
+          });
+      },
+      // 产品批量保存
+      listSaveArrs() {
+        return new Promise((allResolve) => {
+          // 已经拆分(还原到未拆封编辑状态)
+          if (this.isSplit && this.resultArray.length > 0) {
+            this.handleIsDetail(false);
+          }
+          const rows = this.warehousingMaterialList;
+          const indexes = Array.from(
+            { length: this.warehousingMaterialList.length },
+            (_, index) => index
+          );
+          let showMessage = true;
+          rows.forEach((row, i) => {
+            const index = indexes[i];
+            let fileds = [
+              // `warehousingMaterialList.${index}.cargoSpaceCode`,
+              `warehousingMaterialList.${index}.batchNo`,
+              `warehousingMaterialList.${index}.houseList`
+            ];
+            if (this.formData.bizType == 1) {
+              // fileds.push(...[`warehousingMaterialList.${index}.customCode`]);
+            } else if (this.formData.bizType == 2) {
+              // fileds.push(...[`warehousingMaterialList.${index}.supplierCode`]);
+            }
+            if (this.formData.bizType != 5) {
+              fileds.push(
+                ...[
+                  `warehousingMaterialList.${index}.outInNum`,
+                  `warehousingMaterialList.${index}.minPackingCount`
+                ]
+              );
+            } else if (
+              this.warehousingMaterialList.some(
+                (i) => !i.selfWarehouseLedgerDetails?.length
+              )
+            ) {
+              this.$message.error('请选择资产编号!');
+              return;
+            }
+            Promise.all(
+              fileds.map(
+                (item) =>
+                  new Promise(async (resolve, rej) => {
+                    this.$refs.warehousingMaterialListRef.validateField(
+                      item,
+                      (err) => {
+                        if (err) {
+                          rej(err);
+                        } else {
+                          resolve();
+                        }
+                      }
+                    );
+                  })
+              )
+            )
+              .then(async (res) => {
+                this.$set(row, 'isSave', true);
+                await this.createMaterialCode(row);
+                allResolve();
+              })
+              .catch((err) => {
+                if (showMessage) {
+                  showMessage = false;
+                  this.$message.error('请填入必填项!');
+                }
+              });
+          });
+        });
+      },
+      // 批量设置生产日期
+      handleSelectionChange(val) {
+        this.materialCodeReqListSelected = val;
+      },
+      dateSetting() {
+        if (!this.materialCodeReqListSelected.length) {
+          return this.$message.error(`请选择${this.title}明细!`);
+        }
+        this.dateVisible = true;
+      },
+      dateConfirm() {
+        this.materialCodeReqListSelected.forEach((item) => {
+          this.$set(item, this.curDateType, this.batchTime);
+        });
+        this.dateVisible = false;
+      },
+      //入库明细删除
+      listDel(row, index) {
+        this.warehousingMaterialList.splice(index, 1);
+        if (this.isSplit && this.resultArray?.length > 0) {
+          this.handleIsDetail(false);
+        }
+      },
+      // 入库明细生成条码信息
+      async createMaterialCode(row) {
+        // 添加相同物品、批次号重新更新明细 原料编码
+        const list = this.warehousingMaterialList.filter(
+          (i) =>
+            i.assetCode === row.assetCode &&
+            i.batchNo === row.batchNo &&
+            i.isSave
+        );
+        const num = list.reduce((num, pre) => {
+          num += row.isUnpack
+            ? pre.outInNum * pre.minPackingCount
+            : pre.outInNum - 0;
+          return num;
+        }, 0);
+
+        const nums = list.reduce((num, pre) => {
+          num += pre.outInNum * pre.minPackingCount;
+
+          return num;
+        }, 0);
+
+        const res = await outin.getAssetNum({
+          assetCode: row.assetCode,
+          batchNum: row.batchNo,
+          num: num
+        });
+        // row.measuringUnit == 'PCS' ? nums :
+
+        list.forEach((item) => {
+          if (item.warehouseLedgerDetails?.length) {
+            item.warehouseLedgerDetails.forEach((i) => {
+              i.onlyCode = res.shift().onlyCode;
+            });
+          } else {
+            this.$set(
+              item,
+              'warehouseLedgerDetails',
+              Array.from(
+                new Array(
+                  item.isUnpack
+                    ? item.outInNum * item.minPackingCount
+                    : // : item.measuringUnit == 'PCS'
+                      // ? +item.outInNum * parseInt(item.minPackingCount)
+                      +item.outInNum
+                ),
+                (val, idx) => {
+                  return {
+                    ...item,
+                    onlyCode: res.shift().onlyCode,
+                    bizStatus: 1,
+                    contentImage: []
+                  };
+                }
+              )
+            );
+          }
+        });
+
+        // 添加相同物品,重复批次号 重新更新明细 包装编码
+        const batchList = this.warehousingMaterialList.filter(
+          (i) => i.batchNo === row.batchNo && i.isSave
+        );
+        if (batchList.length) {
+          const num = batchList.reduce((num, pre) => {
+            num += +pre.outInNum;
+            return num;
+          }, 0);
+          const res1 = await outin.getAssetNum({
+            batchNum: row.batchNo,
+            num
+          });
+          if (res1) {
+            batchList.forEach((item) => {
+              let num = res1.shift()?.num;
+              let minPackingCount = item.minPackingCount;
+              if (item.warehouseLedgerDetails?.length) {
+                item.warehouseLedgerDetails.forEach((i, index) => {
+                  this.$set(i, 'num', num);
+                  if (row.code == i.code) {
+                    if (item.measuringUnit == item.weightUnit) {
+                      this.$set(i, 'weight', item.minPackingCount);
+                      this.$set(i, 'initWeight', item.minPackingCount);
+                    } else {
+                      this.$set(
+                        i,
+                        'weight',
+                        Number(
+                          this.$math.format(
+                            1 * item.minPackingCount * item.netWeight,
+                            14
+                          )
+                        )
+                      );
+                      this.$set(
+                        i,
+                        'initWeight',
+                        Number(
+                          this.$math.format(
+                            1 * item.minPackingCount * item.netWeight,
+                            14
+                          )
+                        )
+                      );
+                    }
+                  }
+
+                  this.$set(i, 'weightUtil', item.weightUnit);
+
+                  this.$set(i, 'packingCount', 1);
+                  this.$set(i, 'packingUnit ', item.packingUnit);
+                  this.$set(i, 'minPackingCount ', item.minPackingCount);
+                  this.$set(i, 'measuringUnit', item.measuringUnit);
+                  this.$set(i, 'isPack', false);
+                  console.log('inboundType------------', this.inboundType);
+                  if (this.inboundType == '1') {
+                    // 生产性采购(未检)
+                    this.$set(i, 'result', '');
+                    this.$set(i, 'status', '0');
+                  } else {
+                    // 非生产性采购(已检合格)
+                    this.$set(i, 'result', '0');
+                    this.$set(i, 'status', '1');
+                  }
+                  if (!item.isUnpack) {
+                    if (index < item.warehouseLedgerDetails.length - 1) {
+                      num = res1.shift()?.num;
+                    }
+                  } else {
+                    // 拆包的包装编码一致
+                    minPackingCount--;
+                    if (
+                      minPackingCount === 0 &&
+                      index < item.warehouseLedgerDetails.length - 1
+                    ) {
+                      minPackingCount = item.minPackingCount;
+                      num = res1.shift()?.num;
+                    }
+                  }
+                });
+              }
+            });
+          }
+        }
+      },
+      // 包装批量保存
+      wrapListSave() {
+        // 批量修改包装明细
+        this.isWeight = false;
+        this.bulkEditingWrap();
+        this.$nextTick(() => {
+          this.isWeight = true;
+        });
+      },
+      // 物料批量保存
+      materialListSave() {
+        this.resultArray.forEach((item) => {
+          if (!item.isPack) {
+            this.materialBtn(item);
+          }
+        });
+      },
+      // 外部调用获取入库数据
+      getReturnStorage() {
+        return new Promise((resolve) => {
+          console.log(this.warehousingMaterialList);
+          if (this.isOutsourcing) {
+            let boolen = this.warehousingMaterialList.every(
+              (item) => item.houseList.length > 0
+            );
+            if (!boolen) {
+              this.$message.error('请选择产品仓库!');
+              return false;
+            }
+          }
+          this.$refs.formName.validate(async (valid) => {
+            if (valid) {
+              if (!this.warehousingMaterialList?.length) {
+                return this.$message.error('请添加入库明细!');
+              } else if (
+                this.warehousingMaterialList.some((item) => !item.isSave)
+              ) {
+                return this.$message.error('请保存入库明细!');
+              }
+              // 默认全部保存
+              if (this.resultArray?.length > 0) {
+                // 物料批量保存
+                this.materialListSave();
+              } else {
+                // 包装批量保存
+                this.wrapListSave();
+              }
+              this.formatWarehouseMaterialList();
+
+              let arr = this.warehousingMaterialList.map((item) => {
+                console.log(item, 'item');
+                return {
+                  netWeight: item.netWeight > 0 ? item.netWeight : 0,
+                  num: item.num > 0 ? item.num : 0,
+                  manualBatchNo: item.manualBatchNo,
+                  batchNo: item.batchNo,
+                  categoryId:
+                    this.formData.bizType == 2 || this.formData.bizType == 8
+                      ? item.categoryId
+                        ? item.categoryId
+                        : item.id
+                      : item.id,
+                  count:
+                    item.outInNum > 0 && item.minPackingCount > 0
+                      ? this.$math.format(
+                          parseInt(item.outInNum) *
+                            parseInt(item.minPackingCount),
+                          14
+                        )
+                      : 0,
+                  minPackingCount:
+                    item.minPackingCount > 0 ? item.minPackingCount : 0,
+                  packingCount: item.outInNum > 0 ? item.outInNum : 0,
+                  price: item.univalence > 0 ? item.univalence : 0,
+                  outInDetailRecordAddPOList: item.warehouseLedgerDetails,
+                  position: `${item.warehouseName}-${item.areaName}-${item.shelfCode}-${item.cargoSpaceCode}`,
+                  remark: '',
+                  pathIds: `${item.warehouseId},${item.areaId},${item.shelfId},${item.cargoSpaceId}`,
+                  pathName: `${item.warehouseName},${item.areaName},${item.shelfCode},${item.cargoSpaceCode}`,
+                  totalMoney:
+                    item.outInNum > 0 &&
+                    item.minPackingCount > 0 &&
+                    item.univalence > 0
+                      ? this.$math.format(
+                          item.outInNum *
+                            item.minPackingCount *
+                            item.univalence,
+                          14
+                        )
+                      : 0,
+                  weightUnit: item.weightUnit,
+                  customCode: item.customCode,
+                  supplierCode: item.supplierCode,
+                  weight: item.weight > 0 ? item.weight : 0,
+                  houseList: [
+                    `${item.warehouseName},${item.areaName},${item.shelfCode},${item.cargoSpaceCode}`
+                  ]
+                };
+              });
+              arr.forEach((item) => {
+                if (item.outInDetailRecordAddPOList.length > 0) {
+                  let list = item.outInDetailRecordAddPOList.map((it) => {
+                    return this.formatOutInDetailRecordAddPO(it, item);
+                  });
+                  item.outInDetailRecordAddPOList = list;
+                }
+              });
+
+              let obj = { ...this.formData, type: 1 };
+              obj.outInDetailAddPOList = arr;
+              resolve(obj);
+            }
+          });
+        });
+      },
+      // 格式化产品信息入库数据
+      formatWarehouseMaterialList() {
+        for (let key in this.warehousingMaterialList) {
+          for (let k in this.warehousingMaterialList[key].houseList) {
+            let house = this.warehousingMaterialList[key].houseList[k];
+            this.warehousingMaterialList[key].warehouseName =
+              house.warehouseName;
+            this.warehousingMaterialList[key].areaName = house.areaName;
+            this.warehousingMaterialList[key].shelfCode = house.shelfCode;
+            this.warehousingMaterialList[key].cargoSpaceCode =
+              house.cargoSpaceCode;
+            this.warehousingMaterialList[key].warehouseId = house.warehouseId;
+            this.warehousingMaterialList[key].areaId = house.areaId;
+            this.warehousingMaterialList[key].shelfId = house.shelfId;
+            this.warehousingMaterialList[key].cargoSpaceId = house.cargoSpaceId;
+            this.warehousingMaterialList[key].num = house.num;
+          }
+        }
+      },
+      // 格式化包装明细入库数据
+      formatOutInDetailRecordAddPO(it, item) {
+        return {
+          code: it.onlyCode,
+          dateType: this.curDateType === 'manufactureTime' ? 2 : 1,
+          dateValue: it[this.curDateType],
+          minUnit: it.minPackingCount,
+          minPositionId: it.cargoSpaceId,
+          minPackingCount: it.minPackingCount,
+          name: it.assetName,
+          pathIds: item.pathIds,
+          unit: it.unit,
+          packageNo: it.num > 0 ? it.num : '',
+          clientCode: it.clientCode,
+          materielCode: it.materielCode,
+          weight: it.weight,
+          weightUtil: it.weightUtil,
+          engrave: it.engrave,
+          materialDetails: this.materialDetails(it.onlyCode),
+          packingCount: it.packingCount,
+          status: it.status,
+          result: it.result
+        };
+      },
+      // 过滤物料明细入库数据
+      materialDetails(onlyCode) {
+        return this.resultArray.filter((item) => item.onlyCode === onlyCode);
+      },
+      // 添加物品明细
+      addProduct(val) {
+        // 已经拆分(还原到未拆封编辑状态)
+        if (this.isSplit && this.resultArray.length > 0) {
+          this.handleIsDetail(false);
+        }
+        this.onSelectTableData(val);
+      },
+      //添加产品明细
+      async onSelectTableData(val) {
+        const res = await getCode('lot_number_code');
+        this.warehousingMaterialList.push(
+          ...val.map((next) => {
+            next.batchNo = res;
+            let cur = {};
+            next.realInventoryAmount = next.realInventoryAmount || 0;
+            cur = {
+              ...next,
+              cargoSpaceCode: '', //货位编码
+              cargoSpaceId: '', //货位id
+              shelfId: '', //货架id
+              shelfCode: '', //货架名称
+              areaId: '', //库区id
+              areaName: '', //库区名称
+              warehouseId: '', //仓库id
+              warehouseName: '', //仓库名称
+              assetType: this.formData.extInfo.assetType,
+              expirationDate: '',
+              outInNum: '',
+              minPackingCount: '',
+              bizStatus: 1,
+              contentImage: [],
+              warehouseLedgerDetails: [],
+              houseList: []
+            };
+            return cur;
+          })
+        );
+      },
+      async initData() {
+        const { data } = await allCategoryLevel();
+        this.codeList = data;
+        const res = await warehouseDefinition.tree();
+        const info = await getLoginUser();
+        let obj = res.find(
+          (item) => item.id === info.deptId[info.deptId.length - 1]
+        );
+        if (!obj) return;
+        this.formData.extInfo.deptCode = obj.id;
+        this.formData.extInfo.deptName = obj.name;
+        this.formData.extInfo.createUserName = info.name;
+        this.formData.createUserId = info.id;
+      },
+      // 添加产品信息
+      addStock() {
+        if (!this.title) {
+          return this.$message.error('请选择入库产品类型');
+        }
+        if (!this.formData.bizType) {
+          return this.$message.error('请选择入库场景');
+        }
+        this.visibleDialog = true;
+      },
+      upload(data) {
+        this.formData.contentImage = data;
+        this.$refs.formName.validateField('contentImage');
+      },
+      houseData(argum, idx) {
+        console.log(argum);
+        this.$set(this.warehousingMaterialList[idx], 'houseList', argum);
+      }
+    },
+    watch: {
+      // 解决右侧悬浮操作栏不对称问题
+      warehousingMaterialList: {
+        handler() {
+          this.$nextTick(() => {
+            this.$refs.warehousingMaterialListTable?.doLayout();
+          });
+        },
+        deep: true
+      },
+      // 解决右侧悬浮操作栏不对称问题
+      materialCodeReqList: {
+        handler() {
+          this.$nextTick(() => {
+            this.$refs.materialCodeReqListTable?.doLayout();
+          });
+        },
+        deep: true
+      },
+      // 解决右侧悬浮操作栏不对称问题
+      resultArray: {
+        handler() {
+          this.$nextTick(() => {
+            this.$refs.resultArrayTable?.doLayout();
+          });
+        },
+        deep: true
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  ::v-deep.form-table {
+    .el-form-item {
+      margin-bottom: 0;
+    }
+    .el-input__inner {
+      padding: 0 10px;
+    }
+    ::-webkit-scrollbar {
+      width: 8px;
+      height: 8px;
+      background-color: transparent;
+    }
+  }
+  .p20 {
+    padding: 20px;
+  }
+  .el-select,
+  .el-date-editor {
+    width: 100%;
+  }
+  .el-form-item {
+    margin-bottom: 22px;
+  }
+  .material {
+    margin-top: 20px;
+    .flex {
+      display: flex;
+      justify-content: space-between;
+      font-size: 14px;
+      align-items: center;
+      .red {
+        color: #ff4949;
+      }
+    }
+  }
+  .mt10 {
+    margin-top: 10px;
+  }
+  .mt20 {
+    margin-top: 20px;
+  }
+  .center {
+    text-align: center;
+  }
+
+  .switch_left li {
+    border-right: 1px solid rgba(222, 222, 222, 1);
+    border-left: 1px solid rgba(222, 222, 222, 1);
+  }
+
+  .fontOmitted {
+    text-overflow: ellipsis;
+    overflow: hidden;
+    word-break: break-all;
+    white-space: nowrap;
+  }
+  .table-fixed {
+    .el-table__fixed-right {
+      height: 100% !important;
+    }
+    .el-table__fixed-left {
+      height: 100% !important;
+    }
+    .el-table__fixed {
+      height: 100% !important;
+    }
+  }
+</style>

+ 3119 - 0
src/views/bpm/handleTask/components/outsourcedWarehousingNoProcurement/procurementWarehousing.vue

@@ -0,0 +1,3119 @@
+<template>
+  <div class="ele-body">
+    <el-card shadow="never">
+      <header-title title="基本信息"></header-title>
+      <div class="mt20">
+        <el-form label-width="120px">
+          <el-col :span="8">
+            <el-form-item label="入库物品类型:">
+              <span>{{ handleAssetType(formData.extInfo.assetType) }}</span>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="入库场景:">
+              <span>{{ getSceneState(formData.bizType) }}</span>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item
+              :label="inboundTypeDocumentsMapping[formData.bizType] + ':'"
+            >
+              <span>{{ formData.sourceBizNo }}</span>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="权属部门:">
+              <span>{{ formData.extInfo.deptName }}</span>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="入库登记人:">
+              <span>{{ formData.extInfo.createUserName }}</span>
+            </el-form-item>
+          </el-col>
+          <!-- <el-col :span="8">
+                <el-form-item label="创建时间:">
+                  <span>{{ infoData.createTime }}</span>
+                </el-form-item>
+          </el-col> 
+           <el-col :span="8">
+            <el-form-item label="入库时间:">
+              <span>{{ formData.createTime }}</span>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="状态:">
+              <span>{{ getAuditStatus(formData.verifyStatus) }}</span>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="审核人:">
+              <span>{{ formData.verifyName }}</span>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8" v-if="formData.bizType == 2">
+            <el-form-item label="客户:">
+              <span>{{ formData.clientName }}</span>
+            </el-form-item>
+          </el-col> -->
+          <el-col :span="8" v-if="formData.bizType == 2">
+            <el-form-item label="供应商:">
+              <span>{{ formData.extInfo.supplierName }}</span>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="送货人:">
+              <el-input
+                v-if="!isConfig"
+                v-model="formData.fromUser"
+                placeholder="请输入内容"
+              ></el-input>
+              <span v-else>{{ formData.fromUser }}</span>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="送货人联系方式:">
+              <el-input
+                v-if="!isConfig"
+                v-model="formData.extInfo.deliveryPhone"
+                placeholder="请输入内容"
+              ></el-input>
+              <span v-else>{{ formData.extInfo.deliveryPhone }}</span>
+            </el-form-item>
+          </el-col>
+          <el-col
+            :span="12"
+            v-if="taskDefinitionKey === 'qualityInspectionFeedback'"
+          >
+            <el-form-item
+              prop="qualityFile"
+              label="回执附件"
+              :rules="{
+                required: true,
+                trigger: 'blur'
+              }"
+            >
+              <fileUpload
+                v-model="qualityFile"
+                module="main"
+                :showLib="false"
+                :limit="10"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="备注:">
+              <el-input
+                v-if="!isConfig"
+                v-model="formData.remark"
+                clearable
+                type="textarea"
+                placeholder="请详细说明"
+                :rows="4"
+              ></el-input>
+              <span v-else>{{ formData.remark }}</span>
+            </el-form-item>
+          </el-col>
+        </el-form>
+      </div>
+
+      <div class="material">
+        <header-title title="产品信息">
+          <!-- <el-button type="primary" @click="addStock" v-if="!isTask"
+            >添加</el-button
+          > -->
+        </header-title>
+
+        <div class="mt10 form-table">
+          <el-form
+            ref="warehousingMaterialListRef"
+            :model="{ warehousingMaterialList: warehousingMaterialList }"
+            :show-message="false"
+          >
+            <el-button
+              v-if="warehousingMaterialList.length != 0 && !isConfig"
+              type="success"
+              plain
+              style="margin-bottom: 20px; float: right; margin-right: 20px"
+              size="mini"
+              @click="listSaveArrs"
+              >批量保存</el-button
+            >
+            <el-table
+              v-if="isWeight"
+              :header-cell-style="rowClass"
+              ref="warehousingMaterialListTable"
+              :key="formData.extInfo.assetType"
+              :data="warehousingMaterialList"
+              tooltip-effect="dark"
+              style="width: 100%"
+              stripe
+            >
+              <el-table-column
+                label="序号"
+                type="index"
+                width="50"
+                align="center"
+              >
+              </el-table-column>
+
+              <el-table-column
+                label="编码"
+                prop="assetCode"
+                align="center"
+                width="130"
+              ></el-table-column>
+              <el-table-column
+                label="名称"
+                align="center"
+                width="200"
+                prop="assetName"
+              ></el-table-column>
+
+              <!-- <el-table-column
+                label="客户编码"
+                align="center"
+                width="150"
+                prop="customCode"
+                v-if="formData.bizType == 1"
+              >
+                <template slot-scope="{ row, $index }">
+                  <template v-if="row.isSave">
+                    {{ row.customCode }}
+                  </template>
+                  <el-form-item
+                    v-else
+                    :prop="`warehousingMaterialList.${$index}.customCode`"
+                    required
+                  >
+                    <el-input v-model="row.customCode"> </el-input>
+                  </el-form-item>
+                </template>
+              </el-table-column>
+              <el-table-column
+                label="供应商编码"
+                align="center"
+                width="150"
+                prop="customCode"
+                v-if="formData.bizType == 2"
+              >
+                <template slot-scope="{ row, $index }">
+                  <template v-if="row.isSave">
+                    {{ row.supplierCode }}
+                  </template>
+                  <el-form-item
+                    v-else
+                    :prop="`warehousingMaterialList.${$index}.supplierCode`"
+                    required
+                  >
+                    <el-input v-model="row.supplierCode"> </el-input>
+                  </el-form-item>
+                </template>
+              </el-table-column> -->
+              <el-table-column
+                v-for="(item, index) in tableHeader"
+                :key="index"
+                align="center"
+                :label="item.label"
+                width="150"
+                :prop="item.prop"
+              >
+                <template slot-scope="{ row }">
+                  <template v-if="item.formatter">{{
+                    item.formatter(row)
+                  }}</template>
+                  <template v-else>{{ row[item.prop] }}</template>
+                </template>
+              </el-table-column>
+              <el-table-column label="批号" width="100" prop="assetName">
+                <template slot-scope="{ row, $index }">
+                  <template v-if="row.isSave">
+                    {{ row.manualBatchNo }}
+                  </template>
+                  <el-form-item v-else>
+                    <el-input v-model="row.manualBatchNo"> </el-input>
+                  </el-form-item>
+                </template>
+              </el-table-column>
+              <el-table-column
+                label="批次号"
+                prop="batchNo"
+                width="70"
+                align="center"
+              >
+                <template slot-scope="{ row, $index }">
+                  <template v-if="row.isSave">
+                    {{ row.batchNo }}
+                  </template>
+                  <el-form-item
+                    v-else
+                    :prop="`warehousingMaterialList.${$index}.batchNo`"
+                    required
+                  >
+                    <!-- <el-input v-model="row.batchNo"></el-input> -->
+                    {{ row.batchNo }}
+                  </el-form-item>
+                </template>
+              </el-table-column>
+
+              <el-table-column
+                label="最小包装单元"
+                align="center"
+                prop="minPackingCount"
+                width="100"
+              >
+                <el-table-column label="" prop="minPackingCount" width="100">
+                  <template slot-scope="{ row, $index }">
+                    <template v-if="row.isSave">
+                      {{ row.minPackingCount }}
+                    </template>
+                    <el-form-item
+                      v-else
+                      :prop="`warehousingMaterialList.${$index}.minPackingCount`"
+                      required
+                    >
+                      <el-input
+                        type="number"
+                        v-model="row.minPackingCount"
+                        @input="minPackingCountChange(row, $event)"
+                      >
+                      </el-input>
+                    </el-form-item>
+                  </template>
+                </el-table-column>
+                <el-table-column label="" prop="minPackingCount">
+                  <template slot-scope="{ row, $index }">
+                    {{ handleRowUnit(row) }} /{{ row.minPackUnit }}
+                  </template>
+                </el-table-column>
+              </el-table-column>
+              <el-table-column
+                label="包装数量"
+                prop="outInNum"
+                width="150"
+                align="center"
+              >
+                <template slot-scope="{ row, $index }">
+                  <template v-if="row.isSave || formData.bizType == 5">
+                    {{ row.outInNum }} {{ row.minPackUnit }}
+                  </template>
+                  <el-form-item
+                    v-else
+                    :prop="`warehousingMaterialList.${$index}.outInNum`"
+                    required
+                  >
+                    <el-input
+                      v-model="row.outInNum"
+                      @input="packNum(row, $event)"
+                    >
+                      <template slot="append">
+                        {{ row.minPackUnit ? row.minPackUnit : '/' }}
+                      </template>
+                    </el-input>
+                  </el-form-item>
+                </template>
+              </el-table-column>
+              <el-table-column label="计量数量" prop="counts">
+                <template slot-scope="{ row, $index }">
+                  {{ $math.format(row.minPackingCount * row.outInNum, 14) }}
+                </template>
+              </el-table-column>
+              <el-table-column
+                label="计量单位"
+                prop="batchNo"
+                width="100"
+                align="center"
+              >
+                <!-- v-if="formData.extInfo.assetType == 1" -->
+
+                <template slot-scope="{ row, $index }">
+                  <template>
+                    {{ row.measuringUnit }}
+                  </template>
+                </template>
+              </el-table-column>
+              <!-- <el-table-column
+                label="计量单位"
+                prop="batchNo"
+                width="100"
+                align="center"
+                v-if="formData.extInfo.assetType == 4"
+              >
+                <template slot-scope="{ row, $index }">
+                  <template>
+                    {{ row.measuringUnit }}
+                  </template>
+                </template>
+              </el-table-column> -->
+
+              <!-- <el-table-column
+                label="数量"
+                prop="batchNo"
+                width="150"
+                align="center"
+                v-if="formData.extInfo.assetType == 1"
+              >
+                <template slot-scope="{ row, $index }">
+                  <template> {{ row.outInNum }} </template>
+                </template>
+              </el-table-column>
+              <el-table-column
+                label="数量"
+                prop="batchNo"
+                width="150"
+                align="center"
+                v-if="formData.extInfo.assetType == 4"
+              >
+                <template slot-scope="{ row, $index }">
+                  <template>
+                    {{ row.minPackingCount * row.outInNum }}
+                  </template>
+                </template>
+              </el-table-column> -->
+
+              <el-table-column
+                label="重量"
+                align="center"
+                prop="contentImage"
+                :show-overflow-tooltip="true"
+              >
+                <!-- v-if="formData.extInfo.assetType == 1" -->
+                <template slot-scope="{ row, $index }">
+                  {{ row.weight }}
+                  <template slot="append">
+                    {{ handleRowUnit(row) }}
+                    <!-- {{
+                          { yuan: '元', wanyuan: '万元' }[row.univalenceUnit]
+                        }} -->
+                  </template>
+                </template>
+              </el-table-column>
+              <!-- <el-table-column
+                label="重量"
+                align="center"
+                prop="contentImage"
+                :show-overflow-tooltip="true"
+                v-if="formData.extInfo.assetType == 4"
+              >
+                <template slot-scope="{ row, $index }">
+                  {{
+                    deviceWeight(
+                      row.roughWeight,
+                      row.minPackingCount * row.outInNum
+                    )
+                  }}
+                  <template slot="append"> -->
+              <!-- {{ handleRowUnit(row) }} -->
+              <!-- {{
+                          { yuan: '元', wanyuan: '万元' }[row.univalenceUnit]
+                        }} -->
+              <!-- </template>
+                </template>
+              </el-table-column> -->
+              <el-table-column
+                label="重量单位"
+                align="center"
+                prop="contentImage"
+                :show-overflow-tooltip="true"
+              >
+                <template slot-scope="{ row, $index }">
+                  {{ row.weightUnit }}
+                  <template slot="append"> </template>
+                </template>
+              </el-table-column>
+              <el-table-column
+                label="单价"
+                prop="univalence"
+                width="150"
+                align="center"
+              >
+                <template slot-scope="{ row, $index }">
+                  <!-- <template v-if="row.isSave || formData.bizType == 5">
+                    <template v-if="row.univalence || row.univalence === 0">
+                      {{ row.univalence
+                      }}{{
+                        { yuan: '元', wanyuan: '万元' }[row.univalenceUnit]
+                      }}
+                    </template>
+                  </template> -->
+                  <!-- v-else -->
+                  <el-form-item
+                    :prop="`warehousingMaterialList.${$index}.univalence`"
+                  >
+                    <el-input
+                      v-if="!row.isSave && !isConfig"
+                      v-model="row.univalence"
+                      placeholder="非必填"
+                      @input="
+                        (value) =>
+                          (row.univalence = value.replace(/[^0-9.]+/g, ''))
+                      "
+                    >
+                      <template slot="append">
+                        元/{{ handleRowUnit(row) }}
+                        <!-- {{
+                          { yuan: '元', wanyuan: '万元' }[row.univalenceUnit]
+                        }} -->
+                      </template>
+                    </el-input>
+                    <span v-else
+                      >{{ isStorage ? row.price : row.univalence }}元/{{
+                        handleRowUnit(row)
+                      }}</span
+                    >
+                  </el-form-item>
+                </template>
+              </el-table-column>
+              <el-table-column
+                label="金额"
+                align="center"
+                prop="contentImage"
+                :show-overflow-tooltip="true"
+              >
+                <template slot-scope="{ row, $index }">
+                  {{
+                    isStorage
+                      ? row.totalMoney
+                      : calcSumTotal(
+                          row.outInNum,
+                          row.minPackingCount,
+                          row.univalence,
+                          row
+                        )
+                  }}
+                </template>
+              </el-table-column>
+              <el-table-column
+                label="货位"
+                prop="warehouseName"
+                :show-overflow-tooltip="true"
+                width="250"
+                required
+              >
+                <template slot-scope="{ row, $index }">
+                  <el-form-item
+                    :prop="`warehousingMaterialList.${$index}.houseList`"
+                    :required="true"
+                  >
+                    <div
+                      v-if="!isStorage"
+                      @click="handleWareHouse(row, $index)"
+                    >
+                      <div
+                        style="color: #ff4949"
+                        v-if="row.houseList.length == 0"
+                      >
+                        ---(必填)
+                      </div>
+                      <div v-else>
+                        <div
+                          class="fontOmitted"
+                          v-for="(item, index) in row.houseList"
+                          :key="index"
+                        >
+                          {{ item.warehouseName }}- {{ item.areaName }}-
+                          {{ item.shelfCode }}- {{ item.cargoSpaceCode
+                          }}<span style="color: #ff4949" v-if="item.num">
+                            - {{ item.num }}(数)</span
+                          >
+                          <br />
+                        </div>
+                      </div>
+                    </div>
+                    <div v-else>{{ row.position }}</div>
+                  </el-form-item>
+                </template>
+              </el-table-column>
+              <el-table-column
+                label="质检单"
+                v-if="formData.extInfo.assetType === 3"
+                prop="contentImage"
+                :show-overflow-tooltip="true"
+              >
+                <template slot-scope="{ row, $index }">
+                  <upload @on-success="(data) => (row.contentImage = [data])"
+                    ><template slot="placeholder">上传</template></upload
+                  >
+                </template>
+              </el-table-column>
+
+              <el-table-column
+                v-if="!isConfig"
+                label="操作"
+                width="200"
+                fixed="right"
+                align="center"
+              >
+                <template slot="header" slot-scope="scope"> 操作 </template>
+                <template slot-scope="{ row, $index }">
+                  <el-button
+                    type="text"
+                    v-show="!row.isSave"
+                    @click="listSave(row, $index)"
+                    >保存</el-button
+                  >
+                  <el-button
+                    type="text"
+                    v-show="row.isSave"
+                    @click="listEdit(row, $index)"
+                    >编辑</el-button
+                  >
+                  <el-button
+                    type="text"
+                    v-if="formData.bizType == 5"
+                    v-show="!row.isSave"
+                    @click="chooseAssets(row, $index)"
+                    >选择资产编号</el-button
+                  >
+                  <el-button
+                    type="text"
+                    @click="listDel(row, $index)"
+                    v-if="!isTask"
+                    >删除</el-button
+                  >
+                </template>
+              </el-table-column>
+            </el-table>
+          </el-form>
+        </div>
+        <div class="mt20">
+          <header-title :title="`包装明细`">
+            <div class="switch_right">
+              <span v-if="materialCodeReqList.length != 0 && !isConfig">
+                分拆<el-switch
+                  v-model="isDetail"
+                  active-color="#13ce66"
+                  inactive-color="#ff4949"
+                  @change="handleIsDetail"
+                  style="margin-left: 10px"
+                >
+                </el-switch>
+              </span>
+
+              <el-button
+                style="margin-left: 20px"
+                type="text"
+                @click="dateSetting"
+                v-if="formData.bizType != 5 && !isConfig"
+                >批量设置{{
+                  curDateType === 'manufactureTime' ? '生产日期' : '采购日期'
+                }}</el-button
+              >
+            </div>
+          </header-title>
+          <el-button
+            v-if="
+              isStorage
+                ? materialCodeReqListOrStorage.length != 0 &&
+                  resultArray.length <= 0 &&
+                  taskDefinitionKey === 'qualityInspection'
+                : materialCodeReqList.length != 0 &&
+                  resultArray.length <= 0 &&
+                  taskDefinitionKey === 'qualityInspection'
+            "
+            type="success"
+            plain
+            style="margin-bottom: 20px; float: right; margin-right: 20px"
+            size="mini"
+            @click="wrapListSave"
+            >批量保存</el-button
+          >
+          <el-table
+            v-if="isWrapTable"
+            ref="materialCodeReqListTable"
+            :data="
+              isStorage ? materialCodeReqListOrStorage : materialCodeReqList
+            "
+            tooltip-effect="dark"
+            :key="formData.bizType"
+            :header-cell-style="rowClass"
+            style="width: 100%"
+            stripe
+            height="300px"
+            @selection-change="handleSelectionChange"
+          >
+            <el-table-column
+              label=""
+              type="selection"
+              align="center"
+              width="50"
+              fixed="left"
+              v-if="formData.bizType != 5 && !isConfig"
+            >
+            </el-table-column>
+            <el-table-column label="序号" type="index" width="50">
+            </el-table-column>
+            <el-table-column
+              label="编码"
+              prop="assetCode"
+              width="130"
+              :show-overflow-tooltip="true"
+            ></el-table-column>
+            <el-table-column
+              label="名称"
+              prop="assetName"
+              width="150"
+              :show-overflow-tooltip="true"
+            ></el-table-column>
+            <el-table-column
+              label="批号"
+              prop="manualBatchNo"
+              width="100"
+            ></el-table-column>
+            <el-table-column
+              label="批次号"
+              prop="batchNo"
+              width="70"
+            ></el-table-column>
+            <el-table-column
+              :label="`包装编码`"
+              prop="onlyCode"
+              width="130"
+              :show-overflow-tooltip="true"
+            ></el-table-column>
+            <el-table-column
+              label="包装数量"
+              prop="packingCount"
+              width="80"
+            ></el-table-column>
+            <el-table-column
+              label="包装单位"
+              prop="packingUnit"
+            ></el-table-column>
+            <el-table-column
+              label="计量数量"
+              prop="minPackingCount"
+            ></el-table-column>
+            <el-table-column
+              label="计量单位"
+              prop="measuringUnit"
+            ></el-table-column>
+            <el-table-column label="物料代号" prop="materielCode" width="130">
+              <template slot-scope="{ row, $index }">
+                <el-input
+                  v-if="!row.isPack"
+                  :ref="'materielCode' + $index"
+                  @keyup.native="
+                    moveFocus($event, $index, 'materielCode', '包装', row)
+                  "
+                  v-model="row.materielCode"
+                ></el-input>
+                <span v-else>{{ row.materielCode }}</span>
+              </template>
+            </el-table-column>
+            <el-table-column label="客户代号" prop="clientCode">
+              <template slot-scope="{ row, $index }">
+                <el-input
+                  v-if="!row.isPack"
+                  :ref="'clientCode' + $index"
+                  @keyup.native="
+                    moveFocus($event, $index, 'clientCode', '包装', row)
+                  "
+                  v-model="row.clientCode"
+                ></el-input>
+                <span v-else> {{ row.clientCode }}</span>
+              </template>
+            </el-table-column>
+            <el-table-column label="刻码" prop="engrave">
+              <template slot-scope="{ row, $index }">
+                <el-input
+                  v-if="!row.isPack"
+                  :ref="'engrave' + $index"
+                  @keyup.native="
+                    moveFocus($event, $index, 'engrave', '包装', row)
+                  "
+                  v-model="row.engrave"
+                ></el-input>
+                <span v-else>{{ row.engrave }}</span>
+              </template>
+            </el-table-column>
+            <el-table-column label="重量" prop="weight" width="100">
+              <template slot-scope="{ row, $index }">
+                <el-input
+                  v-if="!row.isPack && row.measuringUnit != row.weightUtil"
+                  :ref="'weight' + $index"
+                  @keyup.native="
+                    moveFocus($event, $index, 'weight', '包装', row)
+                  "
+                  v-model="row.weight"
+                  @input="weightInput($event, row)"
+                ></el-input>
+                <span v-else>{{ row.weight }}</span>
+              </template>
+            </el-table-column>
+            <el-table-column label="重量单位" prop="weightUtil">
+              <template slot-scope="{ row }">
+                {{ row.weightUtil }}
+              </template>
+            </el-table-column>
+
+            <el-table-column label="质检结果" prop="result" width="120">
+              <template slot-scope="{ row }">
+                <DictSelection
+                  dictName="质检结果"
+                  clearable
+                  v-model="row.result"
+                  v-if="!row.isPack"
+                  @updateVal="changeWrapStatus($event, row)"
+                />
+                <span v-else>{{ qualityResults[row.result] }}</span>
+              </template>
+            </el-table-column>
+            <el-table-column label="质检状态" prop="status" width="120">
+              <template slot-scope="{ row }">
+                <span>{{ qualityStatus[row.status] }}</span>
+              </template>
+            </el-table-column>
+
+            <el-table-column
+              v-if="formData.bizType != 5"
+              label="生产日期"
+              prop=""
+              width="220"
+            >
+              <template slot="header" slot-scope="scope">
+                <el-select v-if="!isConfig" filterable v-model="curDateType">
+                  <el-option
+                    value="manufactureTime"
+                    label="生产日期"
+                  ></el-option>
+                  <el-option
+                    value="procurementTime"
+                    label="采购日期"
+                  ></el-option>
+                </el-select>
+                <span v-else>{{ dateTypeOptions[curDateType] }}</span>
+              </template>
+              <template slot-scope="{ row }">
+                <template v-if="isConfig">
+                  {{ row[curDateType] }}
+                </template>
+                <el-date-picker
+                  v-else
+                  :disabled="row.ispack"
+                  size="small"
+                  v-model="row[curDateType]"
+                  type="datetime"
+                  value-format="yyyy-MM-dd HH:mm:ss"
+                  placeholder="选择日期"
+                >
+                </el-date-picker>
+              </template>
+            </el-table-column>
+            <template v-else>
+              <el-table-column
+                label="生产日期"
+                prop="manufactureTime"
+                width="200"
+              ></el-table-column>
+              <el-table-column
+                label="采购日期"
+                prop="procurementTime"
+                width="200"
+              ></el-table-column>
+            </template>
+            <el-table-column
+              v-if="!isConfig"
+              label="操作"
+              width="80"
+              fixed="right"
+            >
+              <template slot-scope="{ row }">
+                <el-button type="text" @click="packCout(row)">
+                  {{ !row.isPack ? '保存' : '编辑' }}
+                </el-button>
+              </template>
+            </el-table-column>
+            <el-table-column
+              v-if="taskDefinitionKey === 'qualityInspection' && wrapControl"
+              label="操作"
+              width="80"
+              fixed="right"
+            >
+              <template slot-scope="{ row }">
+                <el-button type="text" @click="packCout(row)">
+                  {{ !row.isPack ? '保存' : '编辑' }}
+                </el-button>
+              </template>
+            </el-table-column>
+          </el-table>
+          <!-- </el-tab-pane>
+        </el-tabs> -->
+        </div>
+        <div class="mt20" v-if="isDetail">
+          <header-title :title="`物料明细`"> </header-title>
+          <el-button
+            v-if="
+              resultArray.length > 0 &&
+              taskDefinitionKey === 'qualityInspection'
+            "
+            type="success"
+            plain
+            style="margin-bottom: 20px; float: right; margin-right: 20px"
+            size="mini"
+            @click="materialListSave"
+            >批量保存</el-button
+          >
+          <el-table
+            v-if="isMaterialTable"
+            ref="resultArrayTable"
+            :data="resultArray"
+            tooltip-effect="dark"
+            :header-cell-style="rowClass"
+            style="width: 100%"
+            stripe
+            height="300px"
+            @selection-change="handleSelectionChange"
+          >
+            <el-table-column label="序号" type="index" width="50">
+            </el-table-column>
+            <el-table-column
+              label="编码"
+              prop="assetCode"
+              :show-overflow-tooltip="true"
+            ></el-table-column>
+            <el-table-column
+              label="名称"
+              prop="assetName"
+              width="200"
+              :show-overflow-tooltip="true"
+            ></el-table-column>
+            <el-table-column
+              label="批号"
+              prop="manualBatchNo"
+              width="100"
+            ></el-table-column>
+            <el-table-column
+              label="批次号"
+              prop="batchNo"
+              width="80"
+            ></el-table-column>
+            <el-table-column
+              label="物料编码"
+              prop="no"
+              width="200"
+              :show-overflow-tooltip="true"
+            ></el-table-column>
+            <el-table-column
+              label="计量数量"
+              prop="minPackingCount"
+              width="90"
+            ></el-table-column>
+            <el-table-column
+              width="80"
+              label="计量单位"
+              prop="measuringUnit"
+            ></el-table-column>
+            <el-table-column label="物料代号" prop="materielCode" width="130">
+              <template slot-scope="{ row, $index }">
+                <el-input
+                  v-if="!row.isPack"
+                  :ref="'materielCode' + $index"
+                  @keyup.native="
+                    moveFocus($event, $index, 'materielCode', '物料', row)
+                  "
+                  v-model="row.materielCode"
+                ></el-input>
+                <span v-else>{{ row.materielCode }}</span>
+              </template>
+            </el-table-column>
+            <el-table-column label="客户代号" prop="clientCode">
+              <template slot-scope="{ row, $index }">
+                <el-input
+                  v-model="row.clientCode"
+                  v-if="!row.isPack"
+                  :ref="'clientCode' + $index"
+                  @keyup.native="
+                    moveFocus($event, $index, 'clientCode', '物料', row)
+                  "
+                ></el-input>
+                <span v-else> {{ row.clientCode }}</span>
+              </template>
+            </el-table-column>
+            <el-table-column label="刻码" prop="engrave">
+              <template slot-scope="{ row, $index }">
+                <el-input
+                  v-model="row.engrave"
+                  v-if="!row.isPack"
+                  :ref="'engrave' + $index"
+                  @keyup.native="
+                    moveFocus($event, $index, 'engrave', '物料', row)
+                  "
+                ></el-input>
+                <span v-else> {{ row.engrave }}</span>
+              </template>
+            </el-table-column>
+            <el-table-column width="100" label="重量" prop="weight">
+              <template slot-scope="{ row, $index }">
+                <el-input
+                  v-model="row.weight"
+                  v-if="!row.isPack && row.measuringUnit != row.weightUnit"
+                  :ref="'weight' + $index"
+                  @keyup.native="
+                    moveFocus($event, $index, 'weight', '物料', row)
+                  "
+                ></el-input>
+                <span v-else>{{ row.weight }}</span>
+              </template>
+            </el-table-column>
+            <el-table-column label="重量单位" prop="weightUnit" width="100">
+            </el-table-column>
+            <el-table-column label="质检结果" prop="result" width="120">
+              <template slot-scope="{ row }">
+                <DictSelection
+                  dictName="质检结果"
+                  clearable
+                  v-model="row.result"
+                  v-if="!row.isPack"
+                  @updateVal="changeWrapStatus($event, row)"
+                />
+                <span v-else>{{ qualityResults[row.result] }}</span>
+              </template>
+            </el-table-column>
+            <el-table-column label="质检状态" prop="status" width="120">
+              <template slot-scope="{ row }">
+                <span>{{ qualityStatus[row.status] }}</span>
+              </template>
+            </el-table-column>
+            <el-table-column
+              v-if="!isConfig"
+              label="操作"
+              width="80"
+              fixed="right"
+            >
+              <template slot-scope="{ row, $index }">
+                <el-button type="text" @click="materialBtn(row)">
+                  {{ !row.isPack ? '保存' : '编辑' }}
+                </el-button>
+              </template>
+            </el-table-column>
+            <el-table-column
+              v-if="
+                taskDefinitionKey === 'qualityInspection' && materialControl
+              "
+              label="操作"
+              width="80"
+              fixed="right"
+            >
+              <template slot-scope="{ row, $index }">
+                <el-button type="text" @click="materialBtn(row, $index)">
+                  {{ !row.isPack ? '保存' : '编辑' }}
+                </el-button>
+              </template>
+            </el-table-column>
+          </el-table>
+        </div>
+      </div>
+      <div class="center mt20">
+        <el-button
+          type="primary"
+          v-if="!isTask && !isConfig"
+          @click="handleSave"
+          :loading="saveLoading"
+          >保存</el-button
+        >
+      </div>
+    </el-card>
+
+    <selectType
+      :visibleDialog.sync="visibleDialog"
+      :title="title"
+      :tableHeader="tableHeader"
+      :bizScene="String(formData.bizType)"
+      :type="[selectEquiType]"
+      :loadTree.sync="loadTree"
+      @selectTableData="onSelectTableData"
+    />
+    <WareHouseDailog
+      ref="wareHouseDailogRef"
+      @houseData="houseData"
+    ></WareHouseDailog>
+    <ReturnSelect
+      ref="returnSelectRef"
+      :tableHeader="tableHeader"
+      :curDateType="curDateType"
+    ></ReturnSelect>
+    <el-dialog
+      :visible.sync="dateVisible"
+      append-to-body
+      title="选择日期"
+      width="400px"
+    >
+      <el-date-picker
+        size="small"
+        v-model="batchTime"
+        type="datetime"
+        style="width: 320px"
+        value-format="yyyy-MM-dd HH:mm:ss"
+        placeholder="选择日期"
+      >
+      </el-date-picker>
+      <div style="text-align: right; margin-top: 20px">
+        <el-button @click="dateVisible = false">取消</el-button>
+        <el-button type="primary" @click="dateConfirm" :disabled="!batchTime"
+          >确认</el-button
+        >
+      </div>
+    </el-dialog>
+
+    <!-- 销售订单 -->
+    <picker ref="pickerRef" @success="pickerSuccess" />
+  </div>
+</template>
+
+<script>
+  import fileUpload from '@/components/upload/fileUpload';
+  import { deepClone } from '@/utils';
+  import {
+    getOutInBySourceBizNoOrError,
+    updateOutInRecord,
+    updateMaterialById
+  } from '@/api/classifyManage/index';
+  import { mapGetters } from 'vuex';
+  import { getByCode } from '@/api/system/goods';
+  import { approveTaskWithVariables } from '@/api/bpm/task';
+  import { getProductList } from '@/api/bpm/components/saleManage/contact';
+  import { getLoginUser } from '@/api/login';
+  import picker from '@/views/bpm/stockManagement/components/picker.vue';
+  import outin from '@/api/warehouseManagement/outin';
+  import {
+    getTreeByPid,
+    getTreeByGroup,
+    allCategoryLevel
+  } from '@/api/classifyManage';
+  import warehouseDefinition from '@/api/warehouseManagement/warehouseDefinition';
+  import selectUpload from '@/components/selectUpload';
+  import upload from '@/components/uploadImg';
+  import { auditStatus } from '@/utils/dict/common';
+  import {
+    materialType,
+    warehousingType,
+    useDict,
+    useDictLabel,
+    inputStatus,
+    emergencyState,
+    sceneState
+  } from '@/utils/dict/index';
+  // import { getInfo, warehousingAdd, getAssetNum } from '@/api/stockManagement';
+  import selectTree from '@/components/selectTree';
+  import selectType from '@/views/bpm/stockManagement/components/selectType.vue';
+  import WareHouseDailog from '@/views/bpm/stockManagement/components/WareHouseDailog.vue';
+  import ReturnSelect from '@/views/bpm/stockManagement/components/ReturnSelect.vue';
+  // import supplier from '@/api/main/supplier';
+  // import org from '@/api/main/org';
+  // import user from '@/api/main/user';
+  import { tableHeader } from '@/views/bpm/handleTask/components/inoutBound/common';
+  import { getCode } from '@/api/codeManagement/index.js';
+  import { number } from 'echarts/core';
+  // import { purchaseorderGetById, contactlink } from '@/api/mes';
+  import { getReceiveSaleOrderrecordDetail } from '@/api/bpm/components/purchasingManage/purchaseorderreceive';
+
+  export default {
+    components: {
+      selectUpload,
+      selectTree,
+      selectType,
+      WareHouseDailog,
+      upload,
+      ReturnSelect,
+      picker,
+      fileUpload
+    },
+    props: {
+      businessId: {
+        default: ''
+      },
+      type: {
+        default: ''
+      },
+      taskDefinitionKey: {
+        default: ''
+      },
+      infoData: {
+        default: {}
+      }
+    },
+    data() {
+      return {
+        inboundTypeMapping: {},
+        inboundTypeDocumentsMapping: {},
+        isWrapTable: true, // 包装表格显隐
+        isMaterialTable: true, // 物料表格显隐
+        wrapControl: false, // 非生产性质检包装操作控制
+        materialControl: false, // 非生产性质检包装操作控制
+        isStorage: false, // 是否已经入库
+        dateTypeOptions: {
+          manufactureTime: '生产日期',
+          procurementTime: '采购日期'
+        },
+        isConfig: false, // 是否提交保存
+        formData: {
+          extInfo: {
+            assetType: 1, //物品类型
+            deptCode: '', //部门code
+            deptName: '', //部门名称
+            verifyDeptCode: '', //审核部门编码
+            verifyDeptName: '', //审核部门名称
+            deliveryName: '', //送货人名称
+            deliveryPhone: '', //送货人电话
+            documentSource: '', //销售订单
+            urgent: '', //紧急状态
+            supplierId: '', //供应商ID
+            supplierName: '', //供应商名称
+            createUserName: '', //创建人名字
+            contentImage: [] //图片数组
+          },
+          fromUser: '', //送货人
+          bizType: '', //物品类型
+          verifyId: '', //审核人Id
+          verifyName: '', //审核人名称
+          createUserId: '',
+          remark: ''
+        },
+        qualityFile: '', // 回执附件文件
+        auditStatus,
+        showMaterialTable: true, // 缓存包装明细列表
+        isSplit: false, // 是否拆分到物料明细
+        qualityStatus: {
+          0: '未检',
+          1: '已检',
+          2: '部分检'
+        }, // 质检状态 0未检 1已检
+        qualityResults: {
+          0: '合格',
+          1: '不合格',
+          3: '让步接收'
+        }, // 质检结果 0合格 1不合格 3让步接收
+        isTask: false,
+        isWeight: true,
+        isDetail: false,
+        contactList: [],
+        pickerRow: {},
+        fromUserList: [],
+        codeList: [],
+        materialType,
+        warehousingType,
+        sceneState,
+        emergencyState,
+        saveLoading: false,
+        visibleDialog: false,
+        curDateType: 'manufactureTime',
+        materialCodeReqListSelected: [],
+        // warehouseList: [], //仓库数组
+        // warehouse: {},
+        title: '',
+        tableData2: [],
+        uploadList: [],
+        supplierList: [],
+        warehousingMaterialList: [],
+        materialCodeReqListOrStorage: [],
+        resultArray: [],
+        activeName: 'a',
+        loadTree: true,
+        selectEquiType: '',
+        batchTime: '',
+        dateVisible: false,
+        treeList: [],
+        staffList: [],
+        rules: {
+          'extInfo.assetType': {
+            required: true,
+            message: '请选择物品类型',
+            trigger: 'change'
+          },
+          bizType: {
+            required: true,
+            message: '请选择入库场景',
+            trigger: 'change'
+          }
+        }
+      };
+    },
+    computed: {
+      // 获取用户信息
+      ...mapGetters(['user']),
+      // 条码信息
+      materialCodeReqList() {
+        return this.warehousingMaterialList
+          .map((i) => i.warehouseLedgerDetails || [])
+          .flat();
+      },
+      tableHeader() {
+        return tableHeader(this.selectEquiType);
+      }
+    },
+    created() {
+      this.getInboundTypeMapping();
+      // 获取入库产品类型列表
+      this.getAssetTypeList();
+      console.log(this.infoData);
+      this.selectEquiType = this.infoData.categoryLevelTopId;
+      this.isStorage = true; // 已经入库
+      this.isConfig = true;
+      this.formData = deepClone(this.infoData);
+      // 填充遍历数据
+      console.log('this.formData-----', this.formData);
+      if (this.formData.outInDetailVOList?.length > 0) {
+        this.warehousingMaterialList = []; // 物品列表
+        this.materialCodeReqListOrStorage = []; // 包装列表
+        this.resultArray = []; // 物料列表
+        this.formData.outInDetailVOList.forEach((goodsiItem) => {
+          goodsiItem.isSave = true;
+          goodsiItem.houseList = [];
+          goodsiItem.assetName = goodsiItem.name;
+          goodsiItem.assetCode = goodsiItem.categoryCode;
+          goodsiItem.outInNum = goodsiItem.packingCount;
+          this.warehousingMaterialList.push(goodsiItem);
+          goodsiItem.outInDetailRecordVOList.forEach((wrapItem) => {
+            if (this.taskDefinitionKey === 'qualityInspection') {
+              // 生产性采购
+              if (wrapItem.outInDetailRecordMaterialDetailVOList.length > 0) {
+                wrapItem.isPack = true;
+              } else {
+                this.wrapControl = true;
+              }
+            } else {
+              // 非生产性采购
+              wrapItem.isPack = true;
+            }
+            wrapItem.assetName = goodsiItem.name;
+            wrapItem.assetCode = goodsiItem.categoryCode;
+            wrapItem.result =
+              wrapItem.result === null ? '' : String(wrapItem.result);
+            wrapItem.count =
+              wrapItem.outInDetailRecordMaterialDetailVOList.length; // 增加包装计量数量
+            // 增加内部重量(解决重量未保存同时参与计算问题)
+            wrapItem.initWeight = wrapItem.weight;
+            this.materialCodeReqListOrStorage.push(wrapItem);
+            if (wrapItem.outInDetailRecordMaterialDetailVOList?.length > 0) {
+              wrapItem.outInDetailRecordMaterialDetailVOList.forEach(
+                (materialItem) => {
+                  materialItem.result =
+                    materialItem.result === null
+                      ? ''
+                      : String(materialItem.result);
+                  if (this.taskDefinitionKey === 'qualityInspection') {
+                    // 生产性采购
+                    materialItem.isPack = false;
+                    this.materialControl = true;
+                  } else {
+                    // 非生产性采购
+                    materialItem.isPack = true;
+                  }
+                  // 增加内部重量(解决重量未保存同时参与计算问题)
+                  materialItem.initWeight = materialItem.weight;
+                  this.resultArray.push(materialItem);
+                }
+              );
+            }
+          });
+        });
+        if (this.resultArray.length > 0) {
+          this.isDetail = true;
+        }
+      }
+    },
+    methods: {
+      // 入库类型和单据映射表
+      async getInboundTypeMapping() {
+        let obj = {};
+        let documents = {};
+        this.sceneState.forEach((item) => {
+          obj[item.code] = item.label;
+          documents[item.code] = item.documentsName;
+        });
+        this.inboundTypeMapping = obj;
+        this.inboundTypeDocumentsMapping = documents;
+      },
+      // 键盘移动
+      moveFocus(event, index, key, type, row) {
+        let keyfield = [];
+        let listLength = 0;
+        switch (type) {
+          case '产品':
+            listLength = this.warehousingMaterialList.length;
+            keyfield = [
+              'manualBatchNo',
+              'minPackingCount',
+              'outInNum',
+              'univalence'
+            ];
+            break;
+          case '包装':
+            listLength = this.materialCodeReqList.length;
+            if (row.measuringUnit != row.weightUtil) {
+              keyfield = ['materielCode', 'clientCode', 'engrave', 'weight'];
+            } else {
+              keyfield = ['materielCode', 'clientCode', 'engrave'];
+            }
+            break;
+          case '物料':
+            listLength = this.resultArray.length;
+            if (row.measuringUnit != row.weightUnit) {
+              keyfield = ['materielCode', 'clientCode', 'engrave', 'weight'];
+            } else {
+              keyfield = ['materielCode', 'clientCode', 'engrave'];
+            }
+            break;
+        }
+
+        if (event.keyCode === 13) {
+          // 回车
+          if (
+            index === listLength - 1 &&
+            key === keyfield[keyfield.length - 1]
+          ) {
+            // 最后一行最后一个
+            return;
+          }
+
+          this.$refs[key + index].blur();
+          if (key === keyfield[keyfield.length - 1]) {
+            // 当前行最后一个,跳转下一行第一个
+            this.$refs[keyfield[0] + (index + 1)].focus();
+          } else {
+            // 跳转下一个
+            const nextkeyindex = keyfield.findIndex((k) => k === key) + 1;
+            this.$nextTick(() => {
+              this.$refs[keyfield[nextkeyindex] + index].focus();
+            });
+          }
+        }
+
+        // 向上 =38
+        if (event.keyCode === 38) {
+          console.log('向上');
+          if (index === 0) {
+            // 第一行
+            console.log('第一行无法向上');
+            return;
+          }
+          this.$refs[key + index].blur();
+          this.$nextTick(() => {
+            this.$refs[key + (index - 1)].focus();
+          });
+        }
+
+        // 下 = 40
+        if (event.keyCode === 40) {
+          console.log('向下');
+          if (index === listLength - 1) {
+            // 最后一行
+            console.log('最后一行无法向下');
+            return;
+          }
+          this.$refs[key + index].blur();
+          this.$nextTick(() => {
+            this.$refs[key + (index + 1)].focus();
+          });
+        }
+
+        // 左 = 37
+        if (event.keyCode === 37) {
+          console.log('向左');
+          if (index === 0 && key === keyfield[0]) {
+            // 第一行第一个
+            console.log('第一行第一个无法向左');
+            return;
+          }
+          this.$refs[key + index].blur();
+          if (key === keyfield[0]) {
+            // 当前行第一个,跳转上一行最后一个
+            this.$refs[keyfield[keyfield.length - 1] + (index - 1)].focus();
+          } else {
+            // 跳转上一个
+            const prevkeyindex = keyfield.findIndex((k) => k === key) - 1;
+            this.$nextTick(() => {
+              this.$refs[keyfield[prevkeyindex] + index].focus();
+            });
+          }
+        }
+
+        // 右 = 39
+        if (event.keyCode === 39) {
+          console.log('向右');
+          if (
+            index === listLength - 1 &&
+            key === keyfield[keyfield.length - 1]
+          ) {
+            // 最后一行最后一个
+            console.log('最后一行最后一个无法向左');
+            return;
+          }
+          this.$refs[key + index].blur();
+          if (key === keyfield[keyfield.length - 1]) {
+            // 当前行最后一个,跳转下一行第一个
+            this.$refs[keyfield[0] + (index + 1)].focus();
+          } else {
+            // 跳转下一个
+            const nextkeyindex = keyfield.findIndex((k) => k === key) + 1;
+            this.$nextTick(() => {
+              this.$refs[keyfield[nextkeyindex] + index].focus();
+            });
+          }
+        }
+      },
+      //获取回执附件
+      getQualityFile() {
+        return { qualityFile: this.qualityFile, id: this.formData.id };
+      },
+      //获取质检状态(全部已检)
+      getStatus() {
+        if (this.resultArray.length > 0) {
+          let metailAllChecked = this.materialCodeReqListOrStorage.every(
+            (item) => item.status == 1
+          );
+          let resultAllChecked = this.resultArray.every(
+            (item) => item.status == 1
+          );
+          if (metailAllChecked && resultAllChecked) {
+            if (this.taskDefinitionKey === 'qualityInspection') {
+              // 物料批量保存
+              return this.materialListSave()
+                .then(() => {
+                  return true;
+                })
+                .catch(() => {
+                  return false;
+                });
+            } else {
+              return true;
+            }
+          } else {
+            return false;
+          }
+        } else {
+          let boolen = this.materialCodeReqListOrStorage.every(
+            (item) => item.status == 1
+          );
+          if (boolen) {
+            if (this.taskDefinitionKey === 'qualityInspection') {
+              // 包装批量保存
+              return this.wrapListSave()
+                .then(() => {
+                  return true;
+                })
+                .catch(() => {
+                  return false;
+                });
+            } else {
+              return true;
+            }
+          } else {
+            return false;
+          }
+        }
+      },
+      getSceneState: useDictLabel(sceneState),
+      // 物料批量保存
+      materialListSave() {
+        return new Promise((resolve, reject) => {
+          let boolen = this.resultArray.every((item) => item.status == 1);
+          console.log(boolen);
+          if (boolen) {
+            console.log(this.resultArray);
+            this.resultArray.forEach((item, index) => {
+              if (!item.isPack) {
+                console.log(item);
+                this.materialBtn(item, index, true);
+              }
+            });
+            // 更新数据
+            this.initFormData()
+              .then(() => {
+                this.resultArray.forEach((item) => {
+                  if (!item.isPack) {
+                    item.isPack = true;
+                  }
+                  // 生产性采购审核
+                  this.$nextTick(() => {
+                    if (this.taskDefinitionKey === 'qualityInspection') {
+                      this.isWrapTable = false;
+                      this.isMaterialTable = false;
+                      this.$nextTick(() => {
+                        this.isWrapTable = true;
+                        this.isMaterialTable = true;
+                      });
+                    }
+                  });
+                  resolve();
+                });
+              })
+              .catch(() => {
+                reject();
+              });
+          } else {
+            this.$message.error('请选择质检结果');
+          }
+        });
+      },
+      // 格式化数据并更新(用于质检员批量质检)
+      initFormData() {
+        return new Promise(async (resolve, reject) => {
+          console.log(this.warehousingMaterialList);
+          console.log(this.materialCodeReqListOrStorage);
+          console.log(this.resultArray);
+          this.warehousingMaterialList.forEach((goodsItem) => {
+            goodsItem.outInDetailRecordUpdatePOList =
+              this.materialCodeReqListOrStorage.filter(
+                (wrapItem) =>
+                  goodsItem.assetCode == wrapItem.assetCode &&
+                  goodsItem.batchNo == wrapItem.batchNo
+              );
+          });
+          this.warehousingMaterialList.forEach((goodsItem) => {
+            goodsItem.outInDetailRecordUpdatePOList.forEach((wrapItem) => {
+              wrapItem.materialDetails = this.resultArray.filter(
+                (metialItem) => metialItem.onlyCode == wrapItem.code
+              );
+            });
+          });
+          console.log(this.warehousingMaterialList);
+          const res = await outin.updateOutIn(this.warehousingMaterialList);
+          console.log(res);
+          if (res.code == 0) {
+            this.$message.success('保存成功');
+            resolve();
+          } else {
+            this.$message.success('保存失败');
+            reject();
+          }
+        });
+      },
+      async initData() {
+        const batchNo = await getCode('lot_number_code'); // 生成批次号编码
+        // 根据编码获取物品类别信息详情
+        this.formData.sourceBizNo = this.infoData.receiveNo; // 来源单号
+        this.formData.extInfo.assetType = this.infoData.categoryLevelTopId; // 入库物品类型
+        this.formData.bizType = '2'; // 入库场景(销售入库)
+        this.formData.type = '1'; // 出入库类型 2出库 1入库
+        this.formData.extInfo.deptName = this.user.info.deptName; // 权属部门
+        this.formData.extInfo.deptCode = this.user.info.deptId[0]; // 权属部门id
+        this.formData.extInfo.createUserName = this.user.info.name; // 入库登记人
+        this.formData.extInfo.supplierName = this.infoData.supplierName; // 供应商
+        this.formData.extInfo.contentImage = []; // 内容图片地址URL
+        this.formData.extInfo.deliveryPhone = ''; // 送货人联系方式
+        this.formData.fromUser = ''; // 送货人
+        this.formData.bizStatus = 1; // ??未知参数
+        this.formData.warehouseLedgerDetails = []; // ??未知参数
+        this.formData.remark = ''; // 备注
+        // this.formData.extInfo.documentSource = this.infoData.receiveNo // 销售订单
+        // this.formData.createTime = '' // 入库时间
+        // this.formData.verifyStatus = '' // 状态
+        // this.formData.verifyName = '' // 审核人
+        // this.formData.clientName = '' // 客户
+        // 添加物品明细
+        if (this.infoData.productList?.length > 0) {
+          this.infoData.productList.forEach(async (item) => {
+            let goodsInfo = await getByCode(item.productCode);
+            console.log(goodsInfo);
+            let obj = {};
+            obj.assetCode = item.productCode; // 编码
+            obj.assetName = item.productName; // 名称
+            obj.modelType = item.modelType; // 型号
+            obj.specification = item.specification; // 规格
+            obj.categoryId = goodsInfo.id; // 类别id
+            obj.brandNum = item.productBrand; // 牌号
+            obj.manualBatchNo = item.manualBatchNo;
+            obj.batchNo = batchNo; // 批次号
+            obj.minPackingCount = ''; // 最小包装单元
+            obj.measuringUnit = item.measuringUnit; // 包装单位
+            obj.minPackUnit = goodsInfo.packingUnit; // 最小包装单位
+            obj.outInNum = ''; // 包装数量
+            obj.weight = ''; // 重量
+            obj.weightUnit = goodsInfo.weightUnit; // 重量单位
+            obj.univalence = item.singlePrice; // 单价
+            obj.netWeight = goodsInfo.netWeight; // 净重
+            obj.warehouseId = ''; // 仓库id
+            obj.houseList = []; // 仓库信息(用户显示)
+            this.warehousingMaterialList.push(obj);
+          });
+        }
+      },
+      // 获取入库产品类型列表
+      async getAssetTypeList() {
+        const { data } = await allCategoryLevel();
+        this.codeList = data.map((item) => {
+          return { dictCode: item.id, dictValue: item.name };
+        });
+      },
+      // 获取入库产品类型
+      handleAssetType(r) {
+        const code = this.codeList.find((item) => item.dictCode == r);
+        return code?.dictValue;
+      },
+      getAuditStatus: useDictLabel(auditStatus),
+      // 包装维度最小包装单元改变——>总重量
+      minPackingCountChange(row, value) {
+        if (value >= 0) {
+          row.minPackingCount = value;
+        } else {
+          row.minPackingCount = 0;
+        }
+        // row.minPackingCount = value.replace(/^(0+)|[^\d]+/g, '');
+        if (row.outInNum > 0 && value > 0) {
+          this.packNum(row, row.outInNum);
+        }
+      },
+      // 选择质检结果改变质检状态
+      changeWrapStatus(resultValue, row) {
+        switch (resultValue) {
+          case '':
+            // 清空质检状态
+            row.status = '0';
+            break;
+          default:
+            // 默认已检质检状态
+            row.status = '1';
+            break;
+        }
+      },
+      cancel() {
+        this.$emit('cancel');
+      },
+      weightInput(value, row) {
+        const newValue = value.replace(/[^\d.]/g, ''); // 保留数字和小数点
+        const decimalCount = (newValue.match(/\./g) || []).length; // 计算小数点的个数
+        if (decimalCount > 1) {
+          // 如果小数点个数大于1,移除多余的小数点
+          const lastIndex = newValue.lastIndexOf('.');
+          row.weight =
+            newValue.slice(0, lastIndex) + newValue.slice(lastIndex + 1);
+        } else if (decimalCount === 1) {
+          // 如果小数点个数等于1,允许小数点的输入
+          row.weight = newValue;
+        } else {
+          row.weight = newValue === '' ? 0 : parseFloat(newValue); // 如果输入为空,则设为0
+        }
+      },
+      // 包装批量保存
+      wrapListSave() {
+        return new Promise((resolve, reject) => {
+          let materialCodeReqList = [];
+          // 生产性入库没入库用materialCodeReqList字段
+          if (
+            this.taskDefinitionKey === 'qualityInspection' &&
+            this.isStorage
+          ) {
+            materialCodeReqList = this.materialCodeReqListOrStorage;
+          } else {
+            materialCodeReqList = this.materialCodeReqList;
+          }
+          let boolen = materialCodeReqList.every((item) => item.status == 1);
+          if (boolen) {
+            // 批量修改包装明细
+            this.bulkEditingWrap(true);
+            this.$nextTick(() => {
+              // 更新数据
+              this.initFormData()
+                .then(() => {
+                  // 批量修改包装明细列表状态(已保存)
+                  this.materialCodeReqListOrStorage.forEach((item) => {
+                    if (!item.isPack) {
+                      item.isPack = true;
+                    }
+                  });
+                  this.$nextTick(() => {
+                    this.isWeight = false;
+                    this.isWrapTable = false;
+                    this.$nextTick(() => {
+                      this.isWeight = true;
+                      this.isWrapTable = true;
+                    });
+                  });
+                  resolve();
+                })
+                .catch(() => {
+                  reject();
+                });
+            });
+          } else {
+            this.$message.error('请选择质检结果');
+          }
+        });
+      },
+      handleIsDetail(event) {
+        this.isSplit = event;
+        const list = this.materialCodeReqList;
+        if (event) {
+          let resultArray = [];
+          list.forEach((item) => {
+            // 包装维度改成已保存状态
+            item.isPack = true;
+            // 拆分物料维度并生成列表
+            for (let i = 1; i <= Number(item.minPackingCount); i++) {
+              resultArray.push({
+                onlyCode: item.onlyCode,
+                no: item.onlyCode + i.toString().padStart(4, '0'),
+                assetCode: item.assetCode,
+                assetName: item.assetName,
+                manualBatchNo: item.manualBatchNo,
+                batchNo: item.batchNo,
+                minPackingCount: 1,
+                measuringUnit: item.measuringUnit,
+                materielCode: item.materielCode,
+                clientCode: item.clientCode,
+                weight: this.$math.format(
+                  item.weight / Number(item.minPackingCount),
+                  14
+                ),
+                initWeight: this.$math.format(
+                  item.weight / Number(item.minPackingCount),
+                  14
+                ),
+                weightUnit: item.weightUnit,
+                engrave: item.engrave,
+                result: item.result,
+                status: item.status,
+                isPack: false
+              });
+            }
+          });
+
+          this.resultArray = resultArray;
+          console.log(this.materialCodeReqList);
+          console.log(this.resultArray);
+          // 批量修改包装明细
+          this.isWeight = false;
+          this.bulkEditingWrap();
+          this.$nextTick(() => {
+            this.isWeight = true;
+          });
+        } else {
+          // 包装维度改成编辑状态
+          list.forEach((item) => {
+            item.isPack = false;
+          });
+          // 清空物料维度列表
+          this.resultArray = [];
+        }
+      },
+      //包装明细保存
+      packCout(row) {
+        // 生产性质检必须已检才能通过
+        if (
+          this.taskDefinitionKey === 'qualityInspection' &&
+          row.status != '1'
+        ) {
+          this.$message.error('请选择质检结果');
+          return false;
+        }
+        //true保存==》反之
+        if (!row.isPack) {
+          const code = row.assetCode;
+          const batchNo = row.batchNo;
+          //做防护,防止weight字符串类型
+          this.materialCodeReqList.forEach((ele) => {
+            ele.weight = Number(ele.weight);
+          });
+          // const count = this.materialCodeReqList.reduce(
+          //   (acc, curr) => acc + curr.weight,
+          //   0
+          // );
+          let materialCodeReqList = [];
+          // 生产性入库没入库用materialCodeReqList字段
+          if (
+            this.taskDefinitionKey === 'qualityInspection' &&
+            this.isStorage
+          ) {
+            materialCodeReqList = this.materialCodeReqListOrStorage;
+          } else {
+            materialCodeReqList = this.materialCodeReqList;
+          }
+          // 修改产品信息重量(包装维度累计)
+          this.isWeight = false;
+          row.isPack = true;
+          this.warehousingMaterialList.forEach((item) => {
+            if (item.assetCode == code && item.batchNo == batchNo) {
+              let arr = [];
+              for (const key in materialCodeReqList) {
+                if (
+                  materialCodeReqList[key].assetCode == item.assetCode &&
+                  materialCodeReqList[key].batchNo == item.batchNo
+                ) {
+                  arr.push({ ...materialCodeReqList[key] });
+                }
+              }
+              const count = arr.reduce((acc, curr) => {
+                if (curr.isPack) {
+                  this.$set(curr, 'initWeight', +curr.weight);
+                  return Number(this.$math.format(+acc + +curr.weight, 14));
+                } else {
+                  return Number(this.$math.format(+acc + +curr.initWeight, 14));
+                }
+              }, 0);
+              this.$set(item, 'weight', count);
+            }
+          });
+          row.isPack = false;
+          this.$nextTick(() => {
+            // 生产性包装保存
+            if (
+              this.taskDefinitionKey === 'qualityInspection' &&
+              this.isStorage
+            ) {
+              this.initFormData().then(() => {
+                row.isPack = true;
+                // 生产性采购审核
+                if (this.taskDefinitionKey === 'qualityInspection') {
+                  this.isWrapTable = false;
+                  this.$nextTick(() => {
+                    this.isWrapTable = true;
+                  });
+                }
+              });
+            }
+            this.isWeight = true;
+          });
+        } else {
+          // 生产性
+          if (this.taskDefinitionKey === 'qualityInspection') {
+            this.isWrapTable = false;
+            row.isPack = false;
+            this.$nextTick(() => {
+              this.isWrapTable = true;
+            });
+          } else {
+            row.isPack = false;
+          }
+        }
+        // setTimeout(() => {
+
+        // }, 100);
+      },
+      // 批量修改包装明细
+      bulkEditingWrap(changeEditStatus) {
+        let materialCodeReqList = [];
+        // 生产性入库没入库用materialCodeReqList字段
+        if (this.taskDefinitionKey === 'qualityInspection' && this.isStorage) {
+          materialCodeReqList = this.materialCodeReqListOrStorage;
+        } else {
+          materialCodeReqList = this.materialCodeReqList;
+        }
+        if (!changeEditStatus) {
+          // 批量修改包装明细列表状态(已保存)
+          materialCodeReqList.forEach((item) => {
+            item.isPack = true;
+          });
+        }
+        console.log(materialCodeReqList);
+        // 改变产品明细重量
+        this.warehousingMaterialList.forEach((outItem) => {
+          let arr = [];
+          materialCodeReqList.forEach((inneritem) => {
+            if (
+              inneritem.assetCode == outItem.assetCode &&
+              inneritem.batchNo == outItem.batchNo
+            ) {
+              arr.push(inneritem);
+            }
+          });
+          const count = arr.reduce((acc, curr) => {
+            if (curr.isPack) {
+              this.$set(curr, 'initWeight', +curr.weight);
+              return Number(this.$math.format(+acc + +curr.weight, 14));
+            } else {
+              return Number(this.$math.format(+acc + +curr.initWeight, 14));
+            }
+          }, 0);
+          this.$set(outItem, 'weight', count);
+        });
+      },
+      // 批量修改物料明细
+      bulkEditingMaterial() {
+        let materialCodeReqList = [];
+        // 生产性入库没入库用materialCodeReqList字段
+        if (this.taskDefinitionKey === 'qualityInspection' && this.isStorage) {
+          materialCodeReqList = this.materialCodeReqListOrStorage;
+        } else {
+          materialCodeReqList = this.materialCodeReqList;
+        }
+        // 批量修改物料明细列表状态(已保存)
+        this.resultArray.forEach((item) => {
+          item.isPack = true;
+        });
+        // 改变包装明细重量
+        materialCodeReqList.forEach((outItem) => {
+          let arr = [];
+          this.resultArray.forEach((inneritem) => {
+            if (
+              inneritem.assetCode == outItem.assetCode &&
+              inneritem.batchNo == outItem.batchNo
+            ) {
+              arr.push(inneritem);
+            }
+          });
+          const count = arr.reduce((acc, curr) => {
+            if (curr.isPack) {
+              this.$set(curr, 'initWeight', +curr.weight);
+              return Number(this.$math.format(+acc + +curr.weight, 14));
+            } else {
+              return Number(this.$math.format(+acc + +curr.initWeight, 14));
+            }
+          }, 0);
+          this.$set(outItem, 'weight', count);
+        });
+      },
+      // 物料明细保存(单独保存)
+      materialBtn(row, index, isLonely) {
+        console.log(row);
+        console.log(index);
+        console.log(this.resultArray);
+        console.log(this.materialCodeReqList);
+        // 是否单点
+        if (!isLonely) {
+          // 生产性质检必须已检才能通过
+          if (
+            this.taskDefinitionKey === 'qualityInspection' &&
+            row.status != '1'
+          ) {
+            this.$message.error('请选择质检结果');
+            return false;
+          }
+        }
+        let materialCodeReqList = [];
+        let code = 'onlyCode';
+        // 生产性入库没入库用materialCodeReqList字段
+        if (this.taskDefinitionKey === 'qualityInspection' && this.isStorage) {
+          materialCodeReqList = this.materialCodeReqListOrStorage;
+          code = 'code';
+        } else {
+          materialCodeReqList = this.materialCodeReqList;
+          code = 'onlyCode';
+        }
+        // true保存 false编辑
+        if (!row.isPack) {
+          // 物料维度修改质检改变包装维度质检(结果和状态)
+          this.materialCodeReqListOrStorage.forEach((outItem) => {
+            let arr = [];
+            this.resultArray.forEach((inneritem) => {
+              if (inneritem.onlyCode == outItem[code]) {
+                arr.push(inneritem);
+              }
+            });
+            console.log(arr);
+            // 首先判断是未填/合格不合格
+            let boolen = arr.every((item) => {
+              return (
+                item.result === '' ||
+                item.result === undefined ||
+                item.result === null
+              );
+            });
+            // 判断只要物料全部质检结果(未填)——>包装质检结果(未填) 状态(未检)
+            if (boolen) {
+              this.$set(outItem, 'result', '');
+              this.$set(outItem, 'status', '0');
+            } else {
+              // 判断只要物料有一个质检结果(不合格)——>包装质检结果(不合格) 状态(已检)
+              let boolen = arr.some((item) => {
+                return item.result === '1';
+              });
+              if (boolen) {
+                this.$set(outItem, 'result', '1');
+                this.$set(outItem, 'status', '1');
+              } else {
+                // 判断只要物料有一个质检结果(让步接收)——>包装质检结果(让步接收) 状态(已检)
+                let boolen = arr.some((item) => {
+                  return item.result === '3';
+                });
+                if (boolen) {
+                  // 让步接收 已检
+                  this.$set(outItem, 'result', '3');
+                  this.$set(outItem, 'status', '1');
+                } else {
+                  // 判断只要物料有全部质检结果(合格)——>包装质检结果(合格) 状态(已检)
+                  let boolen = arr.every((item) => {
+                    return item.result === '0';
+                  });
+                  if (boolen) {
+                    // 合格 已检
+                    this.$set(outItem, 'result', '0');
+                    this.$set(outItem, 'status', '1');
+                  } else {
+                    // 合格 部分检
+                    this.$set(outItem, 'result', '0');
+                    this.$set(outItem, 'status', '2');
+                  }
+                }
+              }
+            }
+            // this.$set(outItem, 'result', boolen ? '1' : '0');
+          });
+          // 物料维度修改重量改变包装维度重量
+          let onlyCode = row.onlyCode;
+          let warpRow = {};
+          // 解决接口未调用成功状态不改变
+          row.isPack = true;
+          this.materialCodeReqListOrStorage.forEach((item) => {
+            if (item[code] === onlyCode) {
+              warpRow = item; // 保存当前修改包装
+              let arr = [];
+              for (const key in this.resultArray) {
+                if (this.resultArray[key].onlyCode == item[code]) {
+                  arr.push(this.resultArray[key]);
+                }
+              }
+              const count = arr.reduce((acc, curr) => {
+                // 注意跟入库不一样这里取反(入库先修改状态再计算重量)
+                console.log(curr);
+                if (curr.isPack) {
+                  this.$set(curr, 'initWeight', +curr.weight);
+                  return Number(this.$math.format(+acc + +curr.weight, 14));
+                } else {
+                  return Number(this.$math.format(+acc + +curr.initWeight, 14));
+                }
+              }, 0);
+              this.$set(item, 'weight', count);
+            }
+          });
+          // 包装维度修改重量改变产品信息
+          this.isWeight = false;
+          // 批量修改包装明细
+          this.bulkEditingWrap();
+          // 解决接口未调用成功状态不改变
+          row.isPack = false;
+          this.$nextTick(() => {
+            if (!isLonely) {
+              // 更新数据
+              this.initFormData().then(() => {
+                row.isPack = true;
+                // 生产性采购审核
+                if (this.taskDefinitionKey === 'qualityInspection') {
+                  this.isWrapTable = false;
+                  this.isMaterialTable = false;
+                  this.$nextTick(() => {
+                    this.isWrapTable = true;
+                    this.isMaterialTable = true;
+                  });
+                }
+              });
+            }
+            this.isWeight = true;
+          });
+        } else {
+          // 生产性采购审核
+          if (this.taskDefinitionKey === 'qualityInspection') {
+            this.isMaterialTable = false;
+            this.isWrapTable = false;
+            row.isPack = false;
+            this.$nextTick(() => {
+              this.isWrapTable = true;
+              this.isMaterialTable = true;
+            });
+          } else {
+            row.isPack = false;
+          }
+        }
+      },
+      packNum(row, value) {
+        const total = {
+          packingCount: Number(
+            row.minPackingCount > 0 ? row.minPackingCount : 0
+          ),
+          outInNum: Number(row.outInNum > 0 ? row.outInNum : 0)
+        };
+        if (row.measuringUnit == row.weightUnit) {
+          row.weight = Number(
+            this.$math.format(
+              total.packingCount * 1 * total.outInNum.toFixed(2),
+              14
+            )
+          );
+        } else {
+          const totals = Number(
+            this.$math.format(total.packingCount * total.outInNum, 14)
+          );
+          row.weight = Number(
+            this.$math.format(
+              totals * (row.netWeight > 0 ? row.netWeight.toFixed(2) : 0),
+              14
+            )
+          );
+        }
+        return (row.outInNum = value.replace(/^(0+)|[^\d]+/g, ''));
+      },
+      async searchContact(id) {
+        const data = await contactlink({ contactId: id });
+        this.contactList = data.data;
+      },
+      async pickerSuccess(row) {
+        this.formData.bizType = '2';
+        this.codeListValue(row.categoryLevelTopId);
+        this.isTask = true;
+        this.pickerRow = row;
+        this.formData.extInfo.documentSource = row.orderNo;
+        this.formData.sourceBizNo = row.receiveNo;
+        this.formData.fromId = row.id;
+        this.formData.clientName = row.partaName;
+        this.formData.clientCode = row.partaId;
+        this.formData.extInfo.supplierName = row.supplierName;
+        this.formData.extInfo.supplierId = row.supplierId;
+        // await this.searchContact(row.partbId);
+        const data = await getReceiveSaleOrderrecordDetail(row.id);
+        if (this.warehousingMaterialList.length == 0) {
+          let list = data.productList.map((item) => {
+            return {
+              ...item,
+              assetName: item.productName,
+              assetCode: item.productCode,
+              categoryId: item.productCategoryId,
+              minPackUnit: item.packingUnit
+            };
+          });
+          this.onSelectTableData(await this.serachMainCode(list));
+        }
+      },
+      async serachMainCode(arr) {
+        let newArr = [];
+        // 使用 Promise.all 来等待所有异步操作完成
+        await Promise.all(
+          arr.map(async (item) => {
+            const data = await getProductList({
+              pageNum: 1,
+              size: 10,
+              categoryLevelId: item.categoryLevelPathIdParent,
+              codeEq: item.assetCode
+            });
+            newArr.push(data.list); // 将结果存储到 newArr 中
+          })
+        );
+        let re = [];
+        for (const item of newArr) {
+          for (const it of item) {
+            re.push(it);
+          }
+        }
+        return re.map((item) => {
+          return {
+            ...item,
+            minPackUnit: item.packingUnit,
+            assetCode: item.code,
+            assetName: item.name
+          };
+        });
+      },
+      onClear() {
+        this.formData.extInfo.documentSource = '';
+        this.pickerRow = {};
+        this.formData.clientName = '';
+        this.formData.clientCode = '';
+        this.formData.extInfo.supplierName = '';
+        this.formData.extInfo.supplierId = '';
+        this.$forceUpdate();
+      },
+      handlePicker() {
+        this.$refs.pickerRef.open();
+      },
+      codeListValue(val) {
+        this.formData.extInfo.assetType = val.id || val;
+        this.$forceUpdate();
+        this.title = val?.name;
+        this.selectEquiType = val?.id || val;
+      },
+      //计算生产设备重量
+      deviceWeight(row, num) {
+        if (row) {
+          return Number(row * num);
+        } else {
+          return row;
+        }
+      },
+
+      //计算金额
+      calcSumTotal(PackingCount, outInNum, univalence) {
+        //最小包装单元,包装数量,单价
+        const total = {
+          PackingCount: Number(PackingCount),
+          outInNum: Number(outInNum),
+          univalence: Number(univalence == undefined ? 0 : univalence)
+        };
+        return total.PackingCount * total.outInNum * total.univalence;
+      },
+      handleRowUnit(row) {
+        return row.measuringUnit;
+        // if (this.formData.extInfo.assetType == 1) {
+        //   return row.weightUnit;
+        // } else if (this.formData.extInfo.assetType == 4) {
+        //   return row.measuringUnit;
+        // } else {
+        //   return row.measuringUnit;
+        // }
+      },
+      changeVerfy(it) {
+        this.formData.verifyName = it.name;
+      },
+      //选择供应啥的操作
+      ChangeSupplier(data) {
+        this.formData.extInfo.supplierName = data.dictValue;
+      },
+      ChangeSuppliers(data) {
+        this.formData.clientName = data.dictValue;
+      },
+
+      rowClass({ row, column, rowIndex, columnIndex }) {
+        if (rowIndex === 1) {
+          return {
+            display: 'none',
+            background: '#EEEEEE',
+            border: 'none'
+          };
+        }
+
+        return { background: '#EEEEEE', border: 'none' };
+      },
+      calcSum(a, b, c, row) {
+        if (
+          (Number.isNaN(+a) && a !== '') ||
+          (Number.isNaN(+b) && b !== '') ||
+          (Number.isNaN(+c) && c !== '')
+        ) {
+          return '';
+        }
+
+        return a * b * c + { yuan: '元', wanyuan: '万元' }[row.univalenceUnit];
+        // return a * b * c;
+      },
+      // 部门 点击事件
+      async auditorDeptClick(data) {
+        this.formData.extInfo.verifyDeptCode = data?.id;
+        this.formData.extInfo.verifyDeptName = data?.name;
+        this.formData.verifyId = '';
+        this.formData.verifyName = '';
+
+        this.$refs.formName.validateField('verifyDeptName');
+        if (data) {
+          this.getStaffList(data);
+        }
+      },
+      async getStaffList(data) {
+        let res = await warehouseDefinition.getUserPage({
+          groupId: data.id,
+          size: 9999,
+          page: 1
+        });
+
+        this.staffList = res.list;
+      },
+      // 详情接口
+      // async _getInfo () {
+      //   const res = await getInfo({ id: this.$route.query.id })
+
+      //   if (res?.success) {
+      //     this.warehousingMaterialList = res.data.warehouseLedgerInfos.map(i => {
+      //       i.isSave = true
+      //       return i
+      //     })
+
+      //     this.formData = res.data.outInWarehouse
+
+      //     this.uploadList = this.formData.contentImage
+
+      //   }
+      // },
+      chooseAssets(row, index) {
+        this.$refs.returnSelectRef.open(row, (res) => {
+          row.outInNum = res.length;
+
+          this.$set(
+            row,
+            'selfWarehouseLedgerDetails',
+            res.map((i) => {
+              delete i.updateTime;
+              delete i.createTime;
+              return i;
+            })
+          );
+        });
+      },
+      // 仓库编辑
+      handleWareHouse(row, idx) {
+        this.$refs.wareHouseDailogRef.open(row, idx);
+      },
+      // 入库操作
+      listEdit(row) {
+        this.$set(row, 'isSave', false);
+        row.selfWarehouseLedgerDetails = row.warehouseLedgerDetails;
+        row.warehouseLedgerDetails = [];
+        // 清空物料明细防止数据错乱
+        this.resultArray = [];
+        this.isDetail = false;
+      },
+      listSave(row, index) {
+        const fileds = [
+          // `warehousingMaterialList.${index}.cargoSpaceCode`,
+          `warehousingMaterialList.${index}.batchNo`,
+          `warehousingMaterialList.${index}.houseList`
+        ];
+        if (this.formData.bizType == 1) {
+          // fileds.push(...[`warehousingMaterialList.${index}.customCode`]);
+        } else if (this.formData.bizType == 2) {
+          // fileds.push(...[`warehousingMaterialList.${index}.supplierCode`]);
+        }
+        if (this.formData.bizType != 5) {
+          fileds.push(
+            ...[
+              `warehousingMaterialList.${index}.outInNum`,
+              `warehousingMaterialList.${index}.minPackingCount`
+            ]
+          );
+        } else if (
+          this.warehousingMaterialList.some(
+            (i) => !i.selfWarehouseLedgerDetails?.length
+          )
+        ) {
+          this.$message.error('请选择资产编号!');
+          return;
+        }
+        Promise.all(
+          fileds.map(
+            (item) =>
+              new Promise(async (resolve, rej) => {
+                this.$refs.warehousingMaterialListRef.validateField(
+                  item,
+                  (err) => {
+                    if (err) {
+                      rej(err);
+                    } else {
+                      resolve();
+                    }
+                  }
+                );
+              })
+          )
+        )
+          .then((res) => {
+            this.$set(row, 'isSave', true);
+            if (this.formData.bizType != 5) {
+              this.createMaterialCode(row);
+            } else {
+              // 退还
+              this.createMaterialCodeReturn(row);
+            }
+          })
+          .catch((err) => {
+            this.$message.error('请填入必填项!');
+          });
+      },
+      listSaveArrs() {
+        const rows = this.warehousingMaterialList;
+        const indexes = Array.from(
+          { length: this.warehousingMaterialList.length },
+          (_, index) => index
+        );
+        console.log(indexes);
+        rows.forEach((row, i) => {
+          const index = indexes[i];
+          const fileds = [
+            `warehousingMaterialList.${index}.batchNo`,
+            `warehousingMaterialList.${index}.houseList`
+          ];
+          if (this.formData.bizType != 5) {
+            fileds.push(
+              ...[
+                `warehousingMaterialList.${index}.outInNum`,
+                `warehousingMaterialList.${index}.minPackingCount`
+              ]
+            );
+          } else if (
+            this.warehousingMaterialList.some(
+              (i) => !i.selfWarehouseLedgerDetails?.length
+            )
+          ) {
+            this.$message.error('请选择资产编号!');
+            return;
+          }
+          // 解决重复弹框
+          let showDioalog = false;
+          Promise.all(
+            fileds.map(
+              (item) =>
+                new Promise(async (resolve, rej) => {
+                  this.$refs.warehousingMaterialListRef.validateField(
+                    item,
+                    (err) => {
+                      if (err) {
+                        rej(err);
+                      } else {
+                        resolve();
+                      }
+                    }
+                  );
+                })
+            )
+          )
+            .then((res) => {
+              this.$set(row, 'isSave', true);
+              if (this.formData.bizType != 5) {
+                this.createMaterialCode(row);
+              } else {
+                // 退还
+                this.createMaterialCodeReturn(row);
+              }
+            })
+            .catch((err) => {
+              // this.$message.error('请填入必填项!');
+              if (!showDioalog) {
+                this.$message.error('请填入必填项!');
+                showDioalog = true;
+              }
+            });
+        });
+      },
+      // listSaveArrs() {
+      //   console.log(this.warehousingMaterialList);
+      // },
+      // 批量设置生产日期
+      handleSelectionChange(val) {
+        this.materialCodeReqListSelected = val;
+      },
+      dateSetting() {
+        if (!this.materialCodeReqListSelected.length) {
+          return this.$message.error(`请选择${this.title}明细!`);
+        }
+        this.dateVisible = true;
+      },
+      dateConfirm() {
+        this.materialCodeReqListSelected.forEach((item) => {
+          this.$set(item, this.curDateType, this.batchTime);
+        });
+        this.dateVisible = false;
+      },
+      //入库明细删除
+      listDel(row, index) {
+        this.warehousingMaterialList.splice(index, 1);
+        this.resultArray = [];
+        this.isDetail = false;
+      },
+      // 入库明细生成条码信息
+      async createMaterialCode(row) {
+        console.log(row);
+        // 添加相同物品、批次号重新更新明细 原料编码
+        const list = this.warehousingMaterialList.filter(
+          (i) =>
+            i.assetCode === row.assetCode &&
+            i.batchNo === row.batchNo &&
+            i.isSave
+        );
+        const num = list.reduce((num, pre) => {
+          num += row.isUnpack
+            ? pre.outInNum * pre.minPackingCount
+            : pre.outInNum - 0;
+          return num;
+        }, 0);
+
+        const nums = list.reduce((num, pre) => {
+          num += pre.outInNum * pre.minPackingCount;
+
+          return num;
+        }, 0);
+
+        const res = await outin.getAssetNum({
+          assetCode: row.assetCode,
+          batchNum: row.batchNo,
+          num: num
+        });
+        // row.measuringUnit == 'PCS' ? nums :
+
+        list.forEach((item) => {
+          if (item.warehouseLedgerDetails?.length) {
+            item.warehouseLedgerDetails.forEach((i) => {
+              i.onlyCode = res.shift().onlyCode;
+            });
+          } else {
+            this.$set(
+              item,
+              'warehouseLedgerDetails',
+              Array.from(
+                new Array(
+                  item.isUnpack
+                    ? item.outInNum * item.minPackingCount
+                    : // : item.measuringUnit == 'PCS'
+                      // ? +item.outInNum * parseInt(item.minPackingCount)
+                      +item.outInNum
+                ),
+                (val, idx) => {
+                  return {
+                    ...item,
+                    onlyCode: res.shift().onlyCode,
+                    bizStatus: 1,
+                    contentImage: []
+                  };
+                }
+              )
+            );
+          }
+        });
+
+        // 添加相同物品,重复批次号 重新更新明细 包装编码
+        const batchList = this.warehousingMaterialList.filter(
+          (i) => i.batchNo === row.batchNo && i.isSave
+        );
+        if (batchList.length) {
+          const num = batchList.reduce((num, pre) => {
+            num += +pre.outInNum;
+            return num;
+          }, 0);
+          const res1 = await outin.getAssetNum({
+            batchNum: row.batchNo,
+            num
+          });
+          if (res1) {
+            batchList.forEach((item) => {
+              let num = res1.shift()?.num;
+              let minPackingCount = item.minPackingCount;
+              if (item.warehouseLedgerDetails?.length) {
+                item.warehouseLedgerDetails.forEach((i, index) => {
+                  this.$set(i, 'num', num);
+                  if (row.code == i.code) {
+                    if (item.measuringUnit == item.weightUnit) {
+                      this.$set(i, 'weight', item.minPackingCount);
+                      this.$set(i, 'initWeight', item.minPackingCount);
+                    } else {
+                      this.$set(
+                        i,
+                        'weight',
+                        Number(
+                          this.$math.format(
+                            1 * item.minPackingCount * item.netWeight,
+                            14
+                          )
+                        )
+                      );
+                      this.$set(
+                        i,
+                        'initWeight',
+                        Number(
+                          this.$math.format(
+                            1 * item.minPackingCount * item.netWeight,
+                            14
+                          )
+                        )
+                      );
+                    }
+                  }
+
+                  this.$set(i, 'weightUtil', item.weightUnit);
+
+                  this.$set(i, 'packingCount', 1);
+                  this.$set(i, 'packingUnit ', item.packingUnit);
+                  this.$set(i, 'minPackingCount ', item.minPackingCount);
+                  this.$set(i, 'measuringUnit', item.measuringUnit);
+                  this.$set(i, 'isPack', false);
+                  if (this.formData.extInfo.assetType == 1) {
+                    this.$set(i, 'status', '0');
+                  } else {
+                    this.$set(i, 'result', '0');
+                    this.$set(i, 'status', '1');
+                  }
+
+                  if (!item.isUnpack) {
+                    if (index < item.warehouseLedgerDetails.length - 1) {
+                      num = res1.shift()?.num;
+                    }
+                  } else {
+                    // 拆包的包装编码一致
+                    minPackingCount--;
+                    if (
+                      minPackingCount === 0 &&
+                      index < item.warehouseLedgerDetails.length - 1
+                    ) {
+                      minPackingCount = item.minPackingCount;
+                      num = res1.shift()?.num;
+                    }
+                  }
+                });
+              }
+            });
+          }
+        }
+      },
+      // 入库明细生成条码信息 退还
+      async createMaterialCodeReturn(row) {
+        // 添加相同物品重新更新明细 原料编码
+        const list = this.warehousingMaterialList.filter(
+          (i) => i.batchNo === row.batchNo && i.isSave
+        );
+        // 退还
+        const res = await getAssetNum({
+          batchNo: row.batchNo,
+          num: list.reduce((num, pre) => {
+            num += pre.selfWarehouseLedgerDetails.length;
+            return num;
+          }, 0)
+        });
+        if (res?.success) {
+          list.forEach((item) => {
+            let num = res.data.shift().num;
+            let minPackingCount = item.minPackingCount;
+            if (item.warehouseLedgerDetails?.length) {
+              item.warehouseLedgerDetails.forEach((i, index) => {
+                Object.assign(i, {
+                  num,
+                  manualBatchNo: item.manualBatchNo,
+                  batchNo: item.batchNo,
+                  cargoSpaceCode: item.cargoSpaceCode, //货位编码
+                  cargoSpaceId: item.cargoSpaceId, //货位id
+                  shelfId: item.shelfId, //货架id
+                  shelfCode: item.shelfCode, //货架名称
+                  areaId: item.areaId, //库区id
+                  areaName: item.areaName, //库区名称
+                  warehouseId: item.warehouseId, //仓库id
+                  warehouseName: item.warehouseName //仓库名称
+                });
+
+                if (!item.isUnpack) {
+                  // 拆包的包装编码一致
+
+                  if (index < item.warehouseLedgerDetails.length - 1) {
+                    num = res.data.shift()?.num;
+                  }
+                } else {
+                  minPackingCount--;
+                  if (
+                    minPackingCount === 0 &&
+                    index < item.warehouseLedgerDetails.length - 1
+                  ) {
+                    minPackingCount = item.minPackingCount;
+                    num = res1.data.shift()?.num;
+                  }
+                }
+              });
+            } else {
+              this.$set(
+                item,
+                'warehouseLedgerDetails',
+                item.selfWarehouseLedgerDetails.map((val, idx) => {
+                  let obj = {
+                    ...val,
+                    bizStatus: 1,
+                    minPackingCount: item.minPackingCount,
+                    manualBatchNo: item.manualBatchNo,
+                    batchNo: item.batchNo,
+                    cargoSpaceCode: item.cargoSpaceCode, //货位编码
+                    cargoSpaceId: item.cargoSpaceId, //货位id
+                    shelfId: item.shelfId, //货架id
+                    shelfCode: item.shelfCode, //货架名称
+                    areaId: item.areaId, //库区id
+                    areaName: item.areaName, //库区名称
+                    warehouseId: item.warehouseId, //仓库id
+                    warehouseName: item.warehouseName, //仓库名称
+                    materialId: item.materialId,
+                    num
+                  };
+                  if (!item.isUnpack) {
+                    // 拆包的包装编码一致
+                    if (idx < item.warehouseLedgerDetails.length - 1) {
+                      num = res.data.shift()?.num;
+                    }
+                  } else {
+                    minPackingCount--;
+                    if (
+                      minPackingCount === 0 &&
+                      idx < item.warehouseLedgerDetails.length - 1
+                    ) {
+                      minPackingCount = item.minPackingCount;
+                      num = res1.data.shift()?.num;
+                    }
+                  }
+                  return obj;
+                })
+              );
+            }
+          });
+        }
+      },
+
+      async handleSave(data) {
+        // this.$refs.formName.validate(async (valid) => {
+        //   if (valid) {
+        // if (!this.warehousingMaterialList?.length) {
+        //   return this.$message.error('请添加入库明细!');
+        // } else if (
+        //   this.warehousingMaterialList.some((item) => !item.isSave)
+        // ) {
+        //   return this.$message.error('请保存入库明细!');
+        // }
+        console.log(this.warehousingMaterialList.length);
+        console.log(this.materialCodeReqList.length);
+        if (
+          this.warehousingMaterialList?.length <= 0 ||
+          this.materialCodeReqList?.length <= 0
+        ) {
+          this.$message.error('请添加产品信息和包装明细');
+          return false;
+        }
+        // // 默认全部保存(需要后台修改)
+        // if (this.resultArray?.length > 0) {
+        //   // 物料批量保存
+        //   this.materialListSave();
+        // } else {
+        //   // 包装批量保存
+        //   this.wrapListSave();
+        // }
+        this.formatWarehouseMaterialList();
+
+        let arr = this.warehousingMaterialList.map((item) => {
+          console.log(item, 'item');
+          return {
+            netWeight: item.netWeight > 0 ? item.netWeight : 0,
+            num: item.num > 0 ? item.num : 0,
+            manualBatchNo: item.manualBatchNo,
+            batchNo: item.batchNo,
+            categoryId:
+              this.formData.bizType == 2
+                ? item.categoryId
+                  ? item.categoryId
+                  : item.id
+                : item.id,
+            count:
+              item.outInNum > 0 && item.minPackingCount > 0
+                ? this.$math.format(
+                    parseInt(item.outInNum) * parseInt(item.minPackingCount),
+                    14
+                  )
+                : 0,
+            minPackingCount:
+              item.minPackingCount > 0 ? item.minPackingCount : 0,
+            packingCount: item.outInNum > 0 ? item.outInNum : 0,
+            price: item.univalence > 0 ? item.univalence : 0,
+            outInDetailRecordAddPOList: item.warehouseLedgerDetails,
+            position: `${item.warehouseName}-${item.areaName}-${item.shelfCode}-${item.cargoSpaceCode}`,
+            remark: '',
+            pathIds: `${item.warehouseId},${item.areaId},${item.shelfId},${item.cargoSpaceId}`,
+            pathName: `${item.warehouseName},${item.areaName},${item.shelfCode},${item.cargoSpaceCode}`,
+            totalMoney:
+              item.outInNum > 0 &&
+              item.minPackingCount > 0 &&
+              item.univalence > 0
+                ? this.$math.format(
+                    item.outInNum * item.minPackingCount * item.univalence,
+                    14
+                  )
+                : 0,
+            weightUnit: item.weightUnit,
+            customCode: item.customCode,
+            supplierCode: item.supplierCode,
+            weight: item.weight > 0 ? item.weight : 0
+          };
+        });
+        arr.forEach((item) => {
+          if (item.outInDetailRecordAddPOList.length > 0) {
+            let list = item.outInDetailRecordAddPOList.map((it) => {
+              return this.formatOutInDetailRecordAddPO(it, item);
+            });
+            item.outInDetailRecordAddPOList = list;
+          }
+        });
+
+        let obj = { ...this.formData, type: 1 };
+        obj.outInDetailAddPOList = arr;
+        this.saveLoading = true;
+        // 入库来源storageSource 0-正常  1-外部
+        obj.storageSource = 1;
+        try {
+          const res = await outin.updateOutIn(obj);
+          if (res.code == 0) {
+            this.isConfig = true;
+            this.$message.success('保存成功!');
+          } else {
+            this.isConfig = false;
+            this.$message.success('保存失败!');
+          }
+          // if (res.code == 0) {
+          // approveTaskWithVariables(data).then((res) => {
+          //   console.log(res);
+          //   if (res.data.code == 0) {
+          //     this.$message.success('保存成功!');
+          //     this.$emit('success');
+          //   }
+          // });
+          //   await outin.outApproves({ outInId: res.data });
+          //   this.$message.success('保存成功!');
+          //   this.$emit('success');
+          // }
+        } catch (error) {
+          console.error('保存失败:', error);
+        }
+        this.saveLoading = false;
+        // this.$router.push('/warehouseManagement/stockManagement');
+        //    }
+        //  });
+      },
+
+      formatWarehouseMaterialList() {
+        for (let key in this.warehousingMaterialList) {
+          for (let k in this.warehousingMaterialList[key].houseList) {
+            let house = this.warehousingMaterialList[key].houseList[k];
+            this.warehousingMaterialList[key].warehouseName =
+              house.warehouseName;
+            this.warehousingMaterialList[key].areaName = house.areaName;
+            this.warehousingMaterialList[key].shelfCode = house.shelfCode;
+            this.warehousingMaterialList[key].cargoSpaceCode =
+              house.cargoSpaceCode;
+            this.warehousingMaterialList[key].warehouseId = house.warehouseId;
+            this.warehousingMaterialList[key].areaId = house.areaId;
+            this.warehousingMaterialList[key].shelfId = house.shelfId;
+            this.warehousingMaterialList[key].cargoSpaceId = house.cargoSpaceId;
+            this.warehousingMaterialList[key].num = house.num;
+          }
+        }
+      },
+
+      formatOutInDetailRecordAddPO(it, item) {
+        return {
+          code: it.onlyCode,
+          dateType: this.curDateType === 'manufactureTime' ? 2 : 1,
+          dateValue: it[this.curDateType],
+          minUnit: it.minPackingCount,
+          minPositionId: it.cargoSpaceId,
+          name: it.assetName,
+          pathIds: item.pathIds,
+          minPackingCount: it.minPackingCount,
+          unit: it.unit,
+          packageNo: it.num,
+          clientCode: it.clientCode,
+          materielCode: it.materielCode,
+          weight: it.weight,
+          weightUtil: it.weightUtil,
+          engrave: it.engrave,
+          materialDetails: this.materialDetails(it.onlyCode),
+          packingCount: it.packingCount,
+          status: it.status,
+          result: it.result
+        };
+      },
+
+      materialDetails(onlyCode) {
+        return this.resultArray.filter((item) => item.onlyCode === onlyCode);
+      },
+      async getOrderCode() {
+        const data = await getCode('in_warehouse');
+        return data;
+      },
+      //添加明细
+      async onSelectTableData(val) {
+        console.log('===ssa', val);
+        const res = await getCode('lot_number_code');
+
+        this.warehousingMaterialList.push(
+          ...val.map((next) => {
+            next.batchNo = res;
+            let cur = {};
+
+            next.realInventoryAmount = next.realInventoryAmount || 0;
+            cur = {
+              ...next,
+              cargoSpaceCode: '', //货位编码
+              cargoSpaceId: '', //货位id
+              shelfId: '', //货架id
+              shelfCode: '', //货架名称
+              areaId: '', //库区id
+              areaName: '', //库区名称
+              warehouseId: '', //仓库id
+              warehouseName: '', //仓库名称
+              assetType: this.formData.extInfo.assetType,
+              expirationDate: '',
+              outInNum: '',
+              minPackingCount: '',
+              bizStatus: 1,
+              contentImage: [],
+              warehouseLedgerDetails: [],
+              houseList: []
+            };
+            return cur;
+          })
+        );
+      },
+      // async initData() {
+      //   const { data } = await getTreeByGroup({ type: 1 });
+      //   this.codeList = data;
+      //   // .map((item) => {
+      //   //   return { dictCode: item.id, dictValue: item.name };
+      //   // });
+      //   const res = await warehouseDefinition.tree();
+      //   this.treeList = this.$util.toTreeData({
+      //     data: res,
+      //     idField: 'id',
+      //     parentIdField: 'parentId'
+      //   });
+      //   // const res111 = await warehouseDefinition.list();
+      //   // this.warehouseList = res111.list;
+      //   let res22 = await warehouseDefinition.getUserPage({
+      //     size: -1,
+      //     page: 1
+      //   });
+      //   this.fromUserList = res22.list;
+      //   const info = await getLoginUser();
+      //   // const info = JSON.parse(localStorage.getItem('info'));
+      //   let obj = res.find(
+      //     (item) => item.id === info.deptId[info.deptId.length - 1]
+      //   );
+      //   if (!obj) return;
+      //   this.formData.extInfo.deptCode = obj.id;
+      //   this.formData.extInfo.deptName = obj.name;
+      //   this.formData.extInfo.createUserName = info.name;
+      //   this.formData.createUserId = info.id;
+
+      //   // this.treeList = res;
+      //   // this.formData.extInfo.deptCode =
+
+      //   // this.getTreeList().then((res) => {
+      //   //   if (res?.success) {
+      //   //     this.treeList = res.data;
+      //   //   }
+      //   // });
+      //   // this.getSupplier().then((res) => {
+      //   //   if (res?.success) {
+      //   //     this.supplierList = res.data.items;
+      //   //   }
+      //   // });
+      //   // this.getStaffList();
+      // },
+      addStock() {
+        // this.$refs.wareHouseDailogRef.open({});
+        // return;
+        if (!this.title) return this.$message.error('请选择入库产品类型');
+        if (!this.formData.bizType)
+          return this.$message.error('请选择入库场景');
+        this.visibleDialog = true;
+      },
+      handleChange(data) {
+        this.title = data?.dictValue;
+        this.selectEquiType = data?.dictCode;
+      },
+      handleChanges(code) {
+        const data = this.codeList.find((item) => item.dictCode == code);
+        this.title = data?.dictValue;
+        this.selectEquiType = data?.dictCode;
+      },
+      getSupplier() {
+        return new Promise((resolve, reject) => {
+          supplier.list({ page: 1, size: 999 }).then((res) => {
+            if (res.success) {
+              resolve(res);
+            }
+          });
+        });
+      },
+      getTreeList() {
+        return new Promise((resolve, reject) => {
+          org.tree().then((res) => {
+            if (res.success) {
+              resolve(res);
+            }
+          });
+        });
+      },
+      upload(data) {
+        this.formData.contentImage = data;
+        this.$refs.formName.validateField('contentImage');
+      },
+      houseData(argum, idx) {
+        this.$set(this.warehousingMaterialList[idx], 'houseList', argum);
+      }
+    },
+    watch: {
+      // 解决右侧悬浮操作栏不对称问题
+      warehousingMaterialList: {
+        handler() {
+          this.$nextTick(() => {
+            this.$refs.warehousingMaterialListTable?.doLayout();
+          });
+        },
+        deep: true
+      },
+      // 解决右侧悬浮操作栏不对称问题
+      materialCodeReqList: {
+        handler() {
+          this.$nextTick(() => {
+            this.$refs.materialCodeReqListTable?.doLayout();
+          });
+        },
+        deep: true
+      },
+      // 解决右侧悬浮操作栏不对称问题
+      resultArray: {
+        handler() {
+          this.$nextTick(() => {
+            this.$refs.resultArrayTable?.doLayout();
+          });
+        },
+        deep: true
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  ::v-deep.form-table {
+    .el-form-item {
+      margin-bottom: 0;
+    }
+    .el-input__inner {
+      padding: 0 10px;
+    }
+    ::-webkit-scrollbar {
+      width: 8px;
+      height: 8px;
+      background-color: transparent;
+    }
+  }
+  .p20 {
+    padding: 20px;
+  }
+  .el-select,
+  .el-date-editor {
+    width: 100%;
+  }
+  .el-form-item {
+    margin-bottom: 22px;
+  }
+  ::v-deep .material {
+    .title {
+      width: 100%;
+    }
+    margin-top: 20px;
+    .flex {
+      display: flex;
+      justify-content: space-between;
+      font-size: 14px;
+      align-items: center;
+      .red {
+        color: #ff4949;
+      }
+    }
+  }
+  .mt10 {
+    margin-top: 10px;
+  }
+  .mt20 {
+    margin-top: 20px;
+  }
+  .center {
+    text-align: center;
+  }
+
+  .switch_left li {
+    border-right: 1px solid rgba(222, 222, 222, 1);
+    border-left: 1px solid rgba(222, 222, 222, 1);
+  }
+
+  .fontOmitted {
+    text-overflow: ellipsis;
+    overflow: hidden;
+    word-break: break-all;
+    white-space: nowrap;
+  }
+  .table-fixed {
+    .el-table__fixed-right {
+      height: 100% !important;
+    }
+    .el-table__fixed-left {
+      height: 100% !important;
+    }
+    .el-table__fixed {
+      height: 100% !important;
+    }
+  }
+</style>

+ 354 - 0
src/views/bpm/handleTask/components/outsourcedWarehousingNoProcurement/submit.vue

@@ -0,0 +1,354 @@
+<template>
+  <el-col :span="16" :offset="6">
+    <el-form label-width="100px" ref="formRef" :model="form">
+      <el-form-item
+        label="质检员"
+        prop="qualityInspector"
+        style="margin-bottom: 20px"
+        :rules="{
+          required: true,
+          message: '请选择',
+          trigger: 'change'
+        }"
+        v-if="taskDefinitionKey == 'QCLeaderApprove'"
+      >
+        <el-select
+          v-model="form.qualityInspector"
+          clearable
+          style="width: 100%"
+          :filterable="true"
+        >
+          <el-option
+            v-for="item in userOptions"
+            :key="item.id"
+            :label="item.name"
+            :value="item.id"
+          />
+        </el-select>
+      </el-form-item>
+      <el-form-item
+        label="审批建议"
+        prop="reason"
+        style="margin-bottom: 20px"
+        :rules="{
+          required: true,
+          message: '请选择',
+          trigger: 'change'
+        }"
+      >
+        <el-input
+          type="textarea"
+          v-model="form.reason"
+          placeholder="请输入审批建议"
+        />
+      </el-form-item>
+    </el-form>
+    <div style="margin-left: 10%; margin-bottom: 20px; font-size: 14px">
+      <el-button
+        icon="el-icon-edit-outline"
+        type="success"
+        size="mini"
+        @click="handleAudit(1)"
+        v-if="
+          !['storeManagerApprove'].includes(taskDefinitionKey) ||
+          (['storeManagerApprove'].includes(taskDefinitionKey) &&
+            [2].includes(+outInData.flowableStatus))
+        "
+        >通过
+      </el-button>
+      <el-button
+        icon="el-icon-edit-outline"
+        type="success"
+        size="mini"
+        :loading="isSaveLoading"
+        @click="storeManagerApprove"
+        v-if="
+          ['storeManagerApprove'].includes(taskDefinitionKey) &&
+          activeComp == 'inoutBound' &&
+          ![1, 2].includes(+outInData.flowableStatus)
+        "
+        >申请入库
+      </el-button>
+      <el-button
+        icon="el-icon-circle-close"
+        type="danger"
+        size="mini"
+        @click="handleAudit(0)"
+        v-if="
+          !['starter', 'qualityInspectionFeedback', 'QCLeaderApprove'].includes(
+            taskDefinitionKey
+          ) && ![1, 2].includes(+outInData.flowableStatus)
+        "
+        >驳回
+      </el-button>
+
+      <el-dropdown
+        @command="(command) => handleCommand(command)"
+        style="margin-left: 30px"
+      >
+        <span class="el-dropdown-link"
+          >更多<i class="el-icon-arrow-down el-icon--right"></i
+        ></span>
+        <el-dropdown-menu slot="dropdown">
+          <el-dropdown-item command="cancel">作废</el-dropdown-item>
+        </el-dropdown-menu>
+      </el-dropdown>
+
+      <!-- <el-button
+        icon="el-icon-circle-close"
+        type="danger"
+        size="mini"
+        @click="handleBackList"
+        >退回
+      </el-button> -->
+      <!-- <el-button
+        icon="el-icon-circle-close"
+        type="danger"
+        size="mini"
+        @click="handleAudit(0)"
+        v-if="taskDefinitionKey != 'productionSupervisorApprove1'"
+        >不通过
+      </el-button>
+      <el-button
+        icon="el-icon-edit-outline"
+        type="primary"
+        size="mini"
+        v-if="taskDefinitionKey != 'productionSupervisorApprove1'"
+        @click="handleUpdateAssignee"
+        >转办
+      </el-button> -->
+      <ele-modal
+        custom-class="ele-dialog-form long-dialog-form"
+        :centered="true"
+        v-if="visible"
+        :visible.sync="visible"
+        :title="title"
+        :close-on-click-modal="false"
+        width="80%"
+        :modal="false"
+        @close="cancel"
+      >
+      </ele-modal>
+    </div>
+  </el-col>
+</template>
+
+<script>
+  import {
+    UpdateReceiveInformation,
+    getReceiveSaleOrderrecordDetail,
+    cancel
+  } from '@/api/bpm/components/purchasingManage/purchaseorderreceive';
+  import { approveTaskWithVariables } from '@/api/bpm/task';
+  import { getWarehouseListByIds } from '@/api/bpm/components/saleManage/saleorder';
+  import {
+    getOutInBySourceBizNo,
+    uploadQualityFile
+  } from '@/api/classifyManage';
+  import { listAllUserBind } from '@/api/system/organization';
+  import outin from '@/api/warehouseManagement/outin';
+
+  // 流程实例的详情页,可用于审批
+  export default {
+    name: '',
+    components: {},
+    props: {
+      businessId: {
+        default: ''
+      },
+      taskId: {
+        default: ''
+      },
+      id: {
+        default: ''
+      },
+      id: {
+        default: ''
+      },
+      taskDefinitionKey: {
+        default: ''
+      }
+    },
+    data() {
+      return {
+        isSaveLoading: false,
+        form: {
+          qualityInspector: '',
+          reason: ''
+        },
+        outInData: {
+          flowableStatus: ''
+        },
+        visible: false,
+        userOptions: [],
+        activeComp: ''
+      };
+    },
+    async created() {
+      this.userOptions = [];
+      listAllUserBind().then((data) => {
+        this.userOptions.push(...data);
+      });
+      if (this.taskDefinitionKey == 'storeManagerApprove') {
+        let data = await getReceiveSaleOrderrecordDetail(this.businessId);
+        try {
+          this.outInData = await getOutInBySourceBizNo(data.receiveNo);
+          console.log('outInData----------', this.outInData);
+        } catch (error) {}
+      }
+    },
+    mounted() {
+      console.log('taskDefinitionKey-------------', this.taskDefinitionKey);
+    },
+    methods: {
+      cancel() {
+        this.visible = false;
+      },
+      async storeManagerApprove() {
+        let res = await this.getTableValue();
+        let storageData = res.returnStorageData;
+        console.log(storageData);
+        // 入库来源storageSource 0-正常  1-外部(外部跳过内部审核流程)
+        storageData.storageSource = 1;
+        try {
+          this.isSaveLoading = true;
+          await outin.save(storageData);
+          approveTaskWithVariables({
+            id: this.taskId,
+            reason: this.form.reason,
+            variables: {
+              pass: true
+            }
+          }).then((res) => {
+            if (res.code != '-1') {
+              this.$emit('handleAudit', {
+                status: 1,
+                title: '入库'
+              });
+            }
+            this.isSaveLoading = false;
+          });
+        } catch (error) {
+          this.isSaveLoading = false;
+          this.$message.error('保存失败');
+        }
+      },
+      /** 处理转办审批人 */
+      handleUpdateAssignee() {
+        this.$emit('handleUpdateAssignee');
+      },
+      /** 退回 */
+      handleBackList() {
+        this.$emit('handleBackList');
+      },
+      activeCompChange(activeComp) {
+        this.activeComp = activeComp;
+      },
+      async handleAudit(status) {
+        let storemanIds = '';
+
+        //发起人补充
+        if (this.taskDefinitionKey === 'starter') {
+          let arr = await this.getTableValue();
+          if (!arr) {
+            return;
+          }
+          let data = await UpdateReceiveInformation(arr);
+          if (data.code != '0') {
+            return;
+          }
+        }
+        if (this.taskDefinitionKey === 'deptLeaderApprove') {
+          let arr = await this.getTableValue();
+          let ids = arr.form.productList.map((item) => item.warehouseId);
+          let data = await getWarehouseListByIds(ids || []);
+          storemanIds = data.map((item) => item.ownerId);
+        }
+        if (this.taskDefinitionKey === 'QCLeaderApprove' && status) {
+          if (!this.form.qualityInspector) {
+            return this.$message.error('请选择质检员!');
+          }
+        }
+        if (this.taskDefinitionKey === 'qualityInspection' && status) {
+          let arr = await this.getTableValue(); // 是否全部已检
+          if (!arr.isAllChecked) {
+            return this.$message.error('请完成质检!');
+          }
+        }
+        if (this.taskDefinitionKey === 'qualityInspectionFeedback' && status) {
+          let arr = await this.getTableValue();
+          console.log('arr.qualityInspector', arr);
+          if (arr.qualityInspector.qualityFile.length == 0) {
+            return this.$message.error('请上传回执附件!');
+          }
+          console.log(arr);
+          await uploadQualityFile(arr.qualityInspector);
+        }
+        this._approveTaskWithVariables(
+          status,
+          storemanIds.length > 0
+            ? Array.from(new Set(storemanIds)).toString()
+            : ''
+        );
+      },
+      async _approveTaskWithVariables(status, storemanIds) {
+        let variables = {
+          pass: !!status
+        };
+        if (storemanIds) {
+          variables['storemanIds'] = storemanIds;
+        }
+        if (this.form.qualityInspector) {
+          variables['qualityInspector'] = this.form.qualityInspector;
+        }
+
+        approveTaskWithVariables({
+          id: this.taskId,
+          reason: this.form.reason,
+          variables
+        }).then((res) => {
+          if (res.data.code != '-1') {
+            this.$emit('handleAudit', {
+              status,
+              title: status === 0 ? '驳回' : ''
+            });
+          }
+        });
+      },
+      getTableValue() {
+        return new Promise((resolve, reject) => {
+          this.$emit('getTableValue', async (data) => {
+            resolve(await data);
+          });
+        });
+      },
+
+      //更多
+      handleCommand(command) {
+        if (command === 'cancel') {
+          this.$confirm('是否确认作废?', {
+            type: 'warning',
+            cancelButtonText: '取消',
+            confirmButtonText: '确定'
+          })
+            .then(() => {
+              cancel({
+                id: this.taskId,
+                reason: this.form.reason,
+                businessId: this.businessId
+              })
+                .then(() => {
+                  this.$emit('handleClose');
+                })
+                .catch(() => {
+                  this.$message.error('流程作废失败');
+                });
+            })
+            .catch(() => {});
+        }
+      }
+    }
+  };
+</script>
+
+<style lang="scss"></style>