Explorar el Código

物料采集功能

dy hace 5 meses
padre
commit
60aba816d0

+ 1 - 0
src/api/prosteps/index.ts

@@ -31,3 +31,4 @@ export function getunProcessedList(processId: string) {
     method: "get",
   });
 }
+

+ 7 - 0
src/api/prosteps/wuliaocaiji.ts

@@ -58,3 +58,10 @@ export function getCollectHistory(data: any) {
     data,
   });
 }
+export function saveBatch(data: any) {
+  return request({
+    url: `/api/v1/process/itemRecord/saveBatch`,
+    method: "post",
+    data,
+  });
+}

+ 9 - 10
src/views/pro-steps/components/wuliaocaiji.vue

@@ -13,7 +13,8 @@
   </div>
   <div v-else class="materialInfoBody">
     <div
-      v-for="item in opCompentDataList"
+      v-for="(item, index) in opCompentDataList"
+      :key="index"
       :class="
         item.needNum - item.realNum == 0 ? 'infoMsg infoMsgImg' : 'infoMsg'
       "
@@ -36,19 +37,17 @@
       <svg-icon class="svgStyle" icon-class="jiaobiao" size="25" />
     </div>
   </div>
-  <xiangqingPopUp v-model="showXQ" :showInfo="seqInfoList" />
-  <seqPopUp v-model="showSEQ" :showInfoData="showSeqData" />
-  <caijiRightPopUp
-    ref="caijiRef"
-    v-model="showCJ"
-    :seqNo="scanCode"
-    @submit="submit"
+  <xiangqingPopUp
+    v-model="showXQ"
+    :showInfo="seqInfoList"
+    @data-list="getOpCompentData"
   />
+  <seqPopUp v-model="showSEQ" :showInfoData="showSeqData" />
 </template>
 
 <script setup>
 import ScanCodeInput from "@/components/ScanCodeInput/index.vue";
-import caijiRightPopUp from "../popUpView/caijiRightPopUp.vue";
+
 import xiangqingPopUp from "../popUpView/xiangqingPopUp.vue";
 import seqPopUp from "../popUpView/seqPopUp.vue";
 import {
@@ -234,7 +233,7 @@ onMounted(() => {
       .info {
         display: flex;
         justify-content: space-between;
-        aligh-items: center;
+        align-items: center;
       }
       .sum {
         font-size: $f24;

+ 0 - 178
src/views/pro-steps/popUpView/caijiRightPopUp.vue

@@ -1,178 +0,0 @@
-<template>
-  <div class="rightFullPopUp" v-if="modelValue" @click="handleClose">
-    <div class="container" @click.stop>
-      <div class="headerTittle">物料采集</div>
-      <div class="header">
-        <div class="inputBox">
-          <ScanCodeInput v-model="scanSum" @keyup.enter="enterfnc" />
-        </div>
-      </div>
-      <el-scrollbar>
-        <div class="body">
-          <div
-            class="infoBox"
-            v-for="(item, index) in scanData"
-            @click="setSelectIndex(index)"
-            :key="index"
-          >
-            <div class="leftInfo">
-              <div class="titleText">{{ item.materialName }}</div>
-              <div class="describeText">规格:{{ item.spec }}</div>
-              <!-- <div class="describeText">批次号:xxx</div>
-              <div class="describeText">计划编号:xxx</div>
-              <div class="describeText">订单编号:xxx</div>
-              <div class="describeText">入库单号:xxx</div> -->
-            </div>
-            <div class="rightInput">
-              <div></div>
-              <div class="operate">
-                <div class="describeText operateText">录入数量</div>
-                <template v-if="selectIndex == index">
-                  <NumberInput v-model="item.scanNum" :max="item.needNum" />
-                </template>
-                <div v-else class="titleText">{{ item.scanNum }}</div>
-              </div>
-            </div>
-          </div>
-          <Empty v-if="scanData.length == 0" />
-        </div>
-      </el-scrollbar>
-      <div class="bottomBtn">
-        <el-button class="leftBtn" @click="handleClose">取消</el-button>
-        <el-button class="rightBtn" @click="emits('submit')" type="primary"
-          >确认</el-button
-        >
-      </div>
-    </div>
-  </div>
-</template>
-
-<script setup>
-import { useProcessStore } from "@/store";
-import { searchMaterial } from "@/api/prosteps/wuliaocaiji";
-const store = useProcessStore();
-const emits = defineEmits(["update:modelValue", "submit"]);
-const props = defineProps({
-  modelValue: {
-    type: Boolean,
-    default: false,
-  },
-  seqNo: {
-    type: String,
-    default: "",
-  },
-});
-const selectIndex = ref();
-const setSelectIndex = (index) => {
-  selectIndex.value = index;
-};
-const scanData = inject("scanData");
-const scanSum = ref("");
-const enterfnc = async () => {
-  let str = scanSum.value;
-  if (str.length < 1) {
-    ElMessage.error("请扫码采集物料");
-    return;
-  }
-  scanSum.value = "";
-  const { code, data } = await searchMaterial({
-    operationId: store.odersData.operationId,
-    processId: store.scanInfo.id,
-    seqNo: store.scanInfo.seqNo,
-    scanCode: str,
-    workOrderCode: store.odersData.workOrderCode,
-  });
-  if (code == "200") {
-    scanData.value.push(data[0]);
-  }
-};
-const handleClose = () => {
-  emits("update:modelValue", false);
-};
-const showSeqNo = computed(() => {
-  return props.seqNo;
-});
-defineExpose({
-  selectIndex,
-});
-</script>
-
-<style lang="scss" scoped>
-.header {
-  @include flex;
-  width: 100%;
-  margin: $p10 0;
-
-  .inputBox {
-    width: 75%;
-  }
-}
-
-.describeText {
-  line-height: 25px !important;
-}
-
-.body {
-  .infoBox {
-    width: 100%;
-    height: 200px;
-    background-color: white;
-    border-radius: 16px;
-    display: flex;
-    justify-content: space-between;
-    padding: $p20;
-    background-color: white;
-    border-radius: 16px;
-    margin-bottom: $f10;
-
-    .leftInfo {
-      display: flex;
-      flex-direction: column;
-      justify-content: space-between;
-
-      div {
-        text-align: left;
-      }
-    }
-
-    .rightInput {
-      display: flex;
-      flex-direction: column;
-      justify-content: space-between;
-
-      .operate {
-        .operateText {
-          text-align: left;
-        }
-      }
-    }
-  }
-}
-
-.bottomBtn {
-  width: 100%;
-  height: 70px;
-  display: flex;
-  align-items: center;
-  justify-content: space-between;
-  padding: $p10 10% 0 10%;
-
-  .leftBtn {
-    height: 55px;
-    width: 45%;
-    border-radius: 16px;
-    font-size: $f20;
-    color: #0a59f7;
-    background-color: #00000015;
-    border: 0px;
-  }
-
-  .rightBtn {
-    height: 55px;
-    width: 45%;
-    border-radius: 16px;
-    font-size: $f20;
-    color: white;
-  }
-}
-</style>

+ 218 - 0
src/views/pro-steps/popUpView/saveBatchInfoPop.vue

@@ -0,0 +1,218 @@
+<template>
+  <div class="midPopUp" v-if="modelValue" @click.stop="handleClose">
+    <div class="container" @click.stop>
+      <div class="headerTittle">本次绑定详情</div>
+      <div class="describeText">绑定数量不足的管号已经过滤</div>
+      <el-divider />
+      <el-scrollbar>
+        <div class="body">
+          <el-table
+            border
+            :span-method="objectSpanMethod"
+            class="seqTable"
+            :data="showData"
+            style="flex: 1"
+          >
+            <el-table-column label="管号" prop="seqNo" />
+            <el-table-column label="批次号" prop="batchNo" />
+            <el-table-column label="数量" prop="num" />
+          </el-table>
+        </div>
+      </el-scrollbar>
+      <div class="btns">
+        <el-button type="primary" @click="submit">绑定</el-button>
+        <el-button @click="handleClose">取消</el-button>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script setup>
+import { saveBatch } from "@/api/prosteps/wuliaocaiji.ts";
+import { includes } from "lodash-es";
+import { useProcessStore } from "@/store";
+import { useUserStore } from "@/store";
+const emits = defineEmits(["update:modelValue", "close", "dataList"]);
+const store = useProcessStore();
+const store1 = useUserStore();
+const props = defineProps({
+  modelValue: {
+    type: Boolean,
+    default: false,
+  },
+  showInfo: {
+    type: Object,
+  },
+});
+
+//现选中List
+const seqSubmitTableData = inject("seqSubmitTableData");
+
+const submit = async () => {
+  const array = ref([]);
+  seqSubmitTableData.value
+    .filter((item) => item.status == true)
+    .forEach((item) => {
+      array.value.push({
+        itemCode: props.showInfo.materialCode,
+        itemModel: props.showInfo.spec,
+        itemName: props.showInfo.materialName,
+        operationId: store.scanInfo.operationId,
+        operationName: store.scanInfo.operationName,
+        processId: store.scanInfo.id,
+        workOrderCode: store.odersData.workOrderCode,
+        trackBy: store1.user.username,
+        batchList: item.batchNo,
+        seqNo: item.seqNo,
+      });
+    });
+  if (array.value.length < 1) {
+    ElMessage.error("请先绑定物料!");
+    return;
+  }
+  const { code } = await saveBatch(array.value);
+  if (code == "200") {
+    ElMessage.success("采集成功!");
+    handleClose();
+    emits("dataList");
+    emits("close");
+  }
+};
+const showData = computed(() => {
+  const array = ref([]);
+  seqSubmitTableData.value.forEach((el) => {
+    if (el.status == true) {
+      el.batchNo.forEach((item) => {
+        array.value.push({ ...item, seqNo: el.seqNo });
+      });
+    }
+  });
+  return array.value;
+});
+const handleClose = () => {
+  emits("update:modelValue", false);
+};
+const objectSpanMethod = ({ row, column, rowIndex, columnIndex }) => {
+  if (columnIndex === 0) {
+    return spanMethod.value[rowIndex];
+  }
+};
+const spanMethod = ref([]);
+const setSpanMethod = () => {
+  spanMethod.value = [];
+  const array = ref([]);
+  seqSubmitTableData.value.forEach((obj) => {
+    if (!includes(array.value, obj.seqNo)) {
+      array.value.push(obj.seqNo);
+      if (obj.batchNoNum) {
+        spanMethod.value.push({
+          rowspan: obj.batchNoNum.length,
+          colspan: 1,
+        });
+      }
+    }
+    if (obj.batchNoNum) {
+      obj.batchNoNum.forEach((i, index) => {
+        if (index != 0) {
+          spanMethod.value.push({
+            rowspan: 0,
+            colspan: 0,
+          });
+        }
+      });
+    }
+  });
+};
+watch(
+  seqSubmitTableData,
+  () => {
+    setSpanMethod();
+  },
+  { deep: true }
+);
+</script>
+
+<style lang="scss" scoped>
+.btns {
+  height: 8vh;
+  display: flex;
+  justify-content: space-evenly;
+  align-items: center;
+}
+.el-divider {
+  margin-top: 0;
+}
+.seqTable {
+  border-radius: 16px;
+}
+.header {
+  @include flex;
+  width: 100%;
+  margin: $p10 0;
+
+  .inputBox {
+    width: 75%;
+  }
+}
+
+.describeText {
+  line-height: 25px !important;
+}
+
+.infoBox {
+  width: 100%;
+  height: 200px;
+  border-radius: 16px;
+  display: flex;
+  justify-content: space-between;
+  padding: $p20;
+  border-radius: 16px;
+
+  .leftInfo {
+    display: flex;
+    flex-direction: column;
+    justify-content: space-between;
+
+    div {
+      text-align: left !important;
+    }
+  }
+
+  .rightBox {
+    display: flex;
+    flex-direction: column;
+    justify-content: space-between;
+
+    .sumBox {
+      width: 180px;
+      height: 80px;
+      padding-bottom: 40px;
+      text-align: left;
+
+      .describeText {
+        text-align: left;
+        line-height: 30px;
+      }
+
+      .sum {
+        font-size: $f38;
+        font-weight: bold;
+        line-height: 20px;
+      }
+    }
+  }
+}
+
+.body {
+  padding: 0 $p20;
+
+  .info {
+    width: 100%;
+    height: 70px;
+    padding: 0 $p20;
+    background-color: white;
+    border-radius: 16px;
+    line-height: 70px;
+  }
+}
+</style>

+ 1 - 0
src/views/pro-steps/popUpView/seqPopUp.vue

@@ -114,6 +114,7 @@ const handleClose = () => {
     background-color: white;
     border-radius: 16px;
     line-height: 70px;
+    margin-bottom: 10px;
   }
 }
 </style>

+ 414 - 53
src/views/pro-steps/popUpView/xiangqingPopUp.vue

@@ -1,5 +1,5 @@
 <template>
-  <div class="popUp" v-if="modelValue" @click.stop="handleClose">
+  <div class="popUp" v-if="modelValue">
     <div class="header">
       <div class="headerTittle">物料采集详情</div>
     </div>
@@ -10,11 +10,17 @@
             需采集物料:{{ showInfo.materialName }}
           </div>
           <div class="describeText">型号:{{ showInfo.materialCode }}</div>
-          <div class="describeText">单管需要:{{ showInfo.needNum }}</div>
+          <div class="describeText">单管需要:{{ showInfo.totalNum }}</div>
         </div>
         <div class="boxItem">
-          <div class="describeText">需要管号数:</div>
-          <div class="describeText">完成采集管号数:</div>
+          <div class="describeText">
+            完成采集管号数:<span class="sumOk">{{ okSum }}</span>
+          </div>
+          <div class="describeText">
+            未完成采集管号数:<span style="color: red">{{
+              seqSubmitTableData.length - okSum
+            }}</span>
+          </div>
         </div>
       </div>
     </div>
@@ -34,58 +40,143 @@
               clearable
             />
           </div>
-          <el-button type="primary">已绑定</el-button>
-          <el-button>未绑定</el-button>
+
+          <el-button
+            :type="!isShowOK ? 'primary' : ''"
+            @click="isShowOK = !isShowOK"
+            >未绑定</el-button
+          >
+          <el-button
+            @click="isShowOK = !isShowOK"
+            :type="isShowOK ? 'primary' : ''"
+            >已绑定</el-button
+          >
         </div>
 
-        <el-table id="seqTable" :data="seqSubmitTableData" style="flex: 1">
+        <el-table border class="seqTable" :data="tableData" style="flex: 1">
           <el-table-column label="管号" prop="seqNo" />
-          <el-table-column label="已绑定批次" prop="spec" />
-          <el-table-column label="绑定管号">
+          <el-table-column label="绑定批次号">
             <template #default="scope">
-              <el-select v-model="value" placeholder="Select">
+              <el-select
+                multiple
+                clearable
+                filterable
+                :disabled="scope.row.ok"
+                placeholder="批次号/剩余可绑数量"
+                v-model="seqSubmitTableData[scope.row.index].batchNoNum"
+                @change="setBatchNo(scope.row.index)"
+                @remove-tag="(name) => removeTag(name, scope.row.index)"
+                @clear="clear(scope.row.index)"
+              >
                 <el-option
-                  v-for="item in options"
-                  :key="item.value"
-                  :label="item.label"
-                  :value="item.value"
-                />
+                  v-for="item in neeBatchNoOptions"
+                  :key="item"
+                  :label="item.batchNo"
+                  :value="item.batchNo"
+                  @click="
+                    clickBatchNo = item.batchNo;
+                    removeTag(item.batchNo, scope.row.index);
+                  "
+                  :disabled="
+                    item.num <= 0 &&
+                    !includes(
+                      seqSubmitTableData[scope.row.index].batchNoNum,
+                      item.batchNo
+                    )
+                  "
+                >
+                  <span style="float: left">{{ item.batchNo }}</span>
+                  <span
+                    style="
+                      float: right;
+
+                      font-size: 13px;
+                    "
+                    :style="{
+                      color:
+                        item.num < 1 ? 'red' : 'var(--el-text-color-secondary)',
+                    }"
+                  >
+                    {{ item.num }}
+                  </span></el-option
+                >
               </el-select>
             </template>
           </el-table-column>
-          <el-table-column label="还需采集" prop="completeNum">
+          <el-table-column label="已绑定批次">
             <template #default="scope">
-              <span
-                :class="
-                  scope.row.totalMaterial - scope.row.completeNum < 0
-                    ? 'sumOk'
-                    : 'sumFail'
-                "
-                >{{
-                  scope.row.totalMaterial - scope.row.completeNum < 1
-                    ? 0
-                    : scope.row.totalMaterial - scope.row.completeNum
-                }}</span
+              <el-form
+                :model="item"
+                v-for="(item, index) in scope.row.batchNo"
+                :key="index"
               >
+                <el-form-item
+                  :rules="{
+                    message: '该选项为必选',
+                    trigger: 'change',
+                  }"
+                  label="批次号:"
+                  prop="batchNo"
+                  >{{ item.batchNo }}
+                </el-form-item>
+                <el-form-item
+                  :rules="{
+                    required: true,
+                    message: '该选项为必选',
+                    trigger: 'change',
+                  }"
+                  label="数量:"
+                  prop="num"
+                >
+                  <el-input-number
+                    :disabled="scope.row.ok"
+                    v-model="item.num"
+                    @change="
+                      (currentValue) =>
+                        numberInputChange(
+                          currentValue,
+                          scope.row.index,
+                          item.batchNo
+                        )
+                    "
+                    :min="0"
+                    :max="
+                      item.num +
+                        (getNowBatchMax(item.batchNo) <
+                        getNowBatchMaxByIndex(item.batchNo, scope.row.index)
+                          ? getNowBatchMax(item.batchNo)
+                          : getNowBatchMaxByIndex(
+                              item.batchNo,
+                              scope.row.index
+                            )) >
+                      showInfo.totalNum
+                        ? showInfo.totalNum
+                        : item.num +
+                          (getNowBatchMax(item.batchNo) <
+                          getNowBatchMaxByIndex(item.batchNo, scope.row.indexx)
+                            ? getNowBatchMax(item.batchNo)
+                            : getNowBatchMaxByIndex(
+                                item.batchNo,
+                                scope.row.index
+                              ))
+                    "
+                  />
+                </el-form-item>
+              </el-form>
             </template>
           </el-table-column>
-          <el-table-column label="还需装箱数量" prop="">
+
+          <el-table-column label="还需采集">
             <template #default="scope">
               <span
                 :class="
-                  scope.row.totalMaterial - scope.row.completeNum < 0
-                    ? 'sumOk'
-                    : 'sumFail'
+                  getRowNeedNum(scope.row.index) <= 0 ? 'sumOk' : 'sumFail'
                 "
-                >{{
-                  scope.row.totalMaterial - scope.row.completeNum < 1
-                    ? 0
-                    : scope.row.totalMaterial - scope.row.completeNum
-                }}</span
+              >
+                {{ !isShowOK ? getRowNeedNum(scope.row.index) : "-" }}</span
               >
             </template>
           </el-table-column>
-
           <!-- <el-table-column label="操作">
             <template #default="scope">
               <span class="opera" @click="showInfoPop(scope.row)"
@@ -100,7 +191,9 @@
           </template>
         </el-table>
         <div class="btns">
-          <el-button type="primary" @click="handleClose">绑定</el-button>
+          <el-button type="primary" @click="batchInfoStatus = true"
+            >绑定确认</el-button
+          >
           <el-button @click="handleClose">取消</el-button>
         </div>
       </div>
@@ -110,7 +203,7 @@
         <div style="display: flex; margin-bottom: 20px; align-items: center">
           <div class="seqSearchInput">
             <el-input
-              v-model="scanCode"
+              v-model="scanCodeNo"
               placeholder="搜索批次号"
               class="searchInput"
               clearable
@@ -118,16 +211,23 @@
           </div>
           <div class="seqSearchInput">
             <el-input
-              v-model="scanCode"
-              placeholder="搜索管号"
+              v-model="scanCodeNum"
+              placeholder="搜索现可采集数量"
               class="searchInput"
               clearable
             />
           </div>
         </div>
-        <el-table id="seqTable" :data="showInfo.batchList" style="flex: 1">
+        <el-table
+          border
+          class="seqTable"
+          :row-class-name="tableRowClassName"
+          :data="haveTableData"
+          style="flex: 1"
+        >
           <el-table-column label="批次号" prop="batchNo" />
-          <el-table-column label="可采集数量" prop="surplusNum" />
+          <el-table-column label="总可采集数量" sortable prop="surplusNum" />
+          <el-table-column label="现可采集数量" sortable prop="num" />
           <template #empty>
             <div class="empty">
               <Empty />
@@ -136,14 +236,25 @@
         </el-table>
       </div>
     </div>
+    <saveBatchInfoPop
+      v-model="batchInfoStatus"
+      :showInfo="showInfo"
+      @close="handleClose"
+      @data-list="dataList"
+    />
   </div>
 </template>
 
 <script setup>
+import saveBatchInfoPop from "./saveBatchInfoPop.vue";
 import { useProcessStore } from "@/store";
 import { getunProcessedList } from "@/api/prosteps";
-const store = useProcessStore();
-const emits = defineEmits(["update:modelValue"]);
+import { includes } from "lodash-es";
+
+const emits = defineEmits(["update:modelValue", "dataList"]);
+const dataList = () => {
+  emits("dataList");
+};
 const props = defineProps({
   modelValue: {
     type: Boolean,
@@ -153,44 +264,291 @@ const props = defineProps({
     type: Object,
   },
 });
-//可绑物料
-const showBatchList = computed(() => {
-  props.showInfo.batchList.forEach((item) => {});
-  return 0;
-});
+//展示是否绑定
+const isShowOK = ref(false);
+const batchInfoStatus = ref(false);
+//搜索管号
 const scanCode = ref("");
+const scanCodeNo = ref("");
+const scanCodeNum = ref("");
+const clickBatchNo = ref(null);
+const okSum = ref(0);
+const store = useProcessStore();
+const tableRowClassName = ({ row, rowIndex }) => {
+  if (row.num == 0) {
+    return "warning-row";
+  } else {
+    return "success-row";
+  }
+};
+//input点击事件
+const numberInputChange = (currentValue, index, batchNo) => {
+  if (currentValue == 0) {
+    seqSubmitTableData.value[index].batchNoNum = seqSubmitTableData.value[
+      index
+    ].batchNoNum.filter((item) => item != batchNo);
+    seqSubmitTableData.value[index].batchNo = seqSubmitTableData.value[
+      index
+    ].batchNo.filter((item) => item.batchNo != batchNo);
+  }
+};
+const haveTableData = computed(() => {
+  const filterValue1 = scanCodeNo.value?.toLowerCase() || "";
+  const filterValue2 = scanCodeNum.value?.toLowerCase() || "";
+
+  return neeBatchNoOptions.value.filter((item) => {
+    // 检查是否需要应用过滤条件
+    const matchesBatchNo =
+      !filterValue1 || item.batchNo?.toLowerCase().includes(filterValue1);
+    const matchesNum =
+      !filterValue2 || (item.num + "")?.toLowerCase().includes(filterValue2);
+
+    // 只有当两项都匹配时才保留该项
+    return matchesBatchNo && matchesNum;
+  });
+});
+const tableData = computed(() => {
+  const filterValue = scanCode.value?.toLowerCase() || "";
+  return seqSubmitTableData.value
+    .filter((item) => item.ok == isShowOK.value)
+    .filter((item) => {
+      return item.seqNo?.toLowerCase().includes(filterValue);
+    });
+});
 const seqSubmitTableData = ref([]);
+provide("seqSubmitTableData", seqSubmitTableData);
+
+const clear = (index) => {
+  seqSubmitTableData.value[index].batchNo = [];
+};
+const removeTag = (no, index) => {
+  seqSubmitTableData.value[index].batchNo = seqSubmitTableData.value[
+    index
+  ].batchNo.filter((item) => item.batchNo != no);
+};
+//点击绑定时触发->更新seqSubmitTableData 的绑定数据
+const setBatchNo = (index) => {
+  setTimeout(() => {
+    const isHave = ref(false);
+    seqSubmitTableData.value[index].batchNoNum.forEach((item, index2) => {
+      seqSubmitTableData.value[index].batchNo.forEach((batchNoItem) => {
+        if (batchNoItem.batchNo == item) {
+          isHave.value = true;
+        }
+      });
+
+      if (isHave.value == false) {
+        seqSubmitTableData.value[index].batchNo.push({
+          batchNo: item,
+          num: getNowBatchMaxByIndex(item, index),
+          nowStatus: true,
+          index: index,
+        });
+      }
+      isHave.value = false;
+    });
+  }, 0);
+  setTimeout(() => {
+    if (seqSubmitTableData.value[index].batchNo.length > 1) {
+      if (
+        seqSubmitTableData.value[index].batchNo[
+          seqSubmitTableData.value[index].batchNo.length - 1
+        ].num < 1
+      ) {
+        seqSubmitTableData.value[index].batchNoNum = seqSubmitTableData.value[
+          index
+        ].batchNoNum.filter((item) => item != clickBatchNo.value);
+        seqSubmitTableData.value[index].batchNo.pop();
+        selectBatchNo.value.pop();
+        ElMessage.error("采集数量已经足够!");
+      }
+    }
+  }, 0);
+};
+//设置初始表格数据
 const setSeqSubmitTableData = () => {
+  okSum.value = 0;
   seqSubmitTableData.value = [];
-  seqList.value.forEach((item) => {
+  seqList.value.forEach((item, index) => {
     seqSubmitTableData.value.push({
       seqNo: item,
       batchNo: [],
+      //该管号是否完成收集
+      status: false,
+      ok: false,
+      index: index,
     });
   });
+  // 回显当前绑定情况
+  if (props.showInfo.collectList) {
+    props.showInfo.collectList.forEach((item) => {
+      seqSubmitTableData.value.forEach((obj) => {
+        if (obj.seqNo == item.seqNo) {
+          okSum.value = okSum.value + 1;
+          obj.ok = true;
+          obj.batchNo = item.batchNo;
+          let array = ref([]);
+          item.batchNo.forEach((el) => {
+            array.value.push(el.batchNo);
+          });
+        }
+      });
+    });
+  }
 };
+
 const handleClose = () => {
   emits("update:modelValue", false);
 };
 const seqList = ref([]);
-
 const getSeqList = async () => {
   const { data } = await getunProcessedList(store.scanInfo.id);
   seqList.value = data;
 };
+//存放现在总可绑批次号
+const allBatchNoOptions = ref([]);
+//存放本次绑定List
+const selectBatchNo = ref([]);
+
+//设置已选中的List
+const setSelectBatchNo = () => {
+  selectBatchNo.value = [];
+  seqSubmitTableData.value.forEach((item) => {
+    item.batchNo.forEach((obj) => {
+      if (obj.nowStatus == true) {
+        selectBatchNo.value.push(obj);
+      }
+    });
+  });
+};
+//获取当前批次号最大新增数
+const getNowBatchMax = (no) => {
+  const array1 = JSON.parse(JSON.stringify(allBatchNoOptions.value));
+  const array2 = JSON.parse(JSON.stringify(selectBatchNo.value));
+  let max = 0;
+  for (let i = 0; i < array1.length; i++) {
+    if (array1[i].batchNo === no) {
+      max = array1[i].surplusNum;
+      break;
+    }
+  }
+  for (let j = 0; j < array2.length; j++) {
+    if (array2[j].batchNo === no) {
+      max -= array2[j].num;
+    }
+  }
+  return max;
+};
+const getRowNeedNum = (index) => {
+  const array2 = JSON.parse(JSON.stringify(selectBatchNo.value));
+  let max = props.showInfo.totalNum;
+  for (let j = 0; j < array2.length; j++) {
+    if (array2[j].index == index) {
+      max -= array2[j].num;
+    }
+  }
+  return max;
+};
+//获取当前批次号 在某row中最大数量
+const getNowBatchMaxByIndex = (no, index) => {
+  const array2 = JSON.parse(JSON.stringify(selectBatchNo.value));
+  //需要的总数
+  let num = props.showInfo.totalNum;
+  let max = getNowBatchMax(no);
+  //计算目前还需要的总数
+  let res = 0;
+  for (let j = 0; j < array2.length; j++) {
+    if (array2[j].index == index) {
+      num -= array2[j].num;
+    }
+  }
+
+  if (max > num) {
+    res = num;
+  } else {
+    res = max;
+  }
+  return res;
+};
+
+const neeBatchNoOptions = computed(() => {
+  const array = JSON.parse(JSON.stringify(allBatchNoOptions.value));
+  array.forEach((el) => {
+    el.num = el.surplusNum;
+  });
+  selectBatchNo.value.forEach((obj) => {
+    array.forEach((el) => {
+      if (el.batchNo == obj.batchNo) {
+        const res = el.num - obj.num;
+        el.num = res;
+        el.index = obj.index;
+      }
+    });
+  });
+  return array;
+});
+
+const setAllBatchNoOptions = () => {
+  allBatchNoOptions.value = [];
+  if (props.showInfo.batchList) {
+    props.showInfo.batchList.forEach((item) => {
+      allBatchNoOptions.value.push({
+        ...item,
+      });
+    });
+  }
+};
+const setRowStatus = () => {
+  seqSubmitTableData.value.forEach((item, index) => {
+    if (getRowNeedNum(index) == 0) {
+      seqSubmitTableData.value[index].status = true;
+    } else {
+      seqSubmitTableData.value[index].status = false;
+    }
+  });
+};
 watch(
   () => props.showInfo,
   async () => {
     if (props.showInfo) {
       await getSeqList();
       await setSeqSubmitTableData();
+      setAllBatchNoOptions();
     }
   },
   { immediate: true }
 );
+watch(
+  seqSubmitTableData,
+  () => {
+    setSelectBatchNo();
+    setRowStatus();
+  },
+  { deep: true }
+);
 </script>
 
+<style>
+.el-table .warning-row {
+  --el-table-tr-bg-color: var(--el-color-warning-light-9);
+}
+.el-table .success-row {
+  --el-table-tr-bg-color: var(--el-color-success-light-9);
+}
+</style>
 <style lang="scss" scoped>
+:deep(.el-form-item) {
+  margin-bottom: 5px !important;
+}
+:deep(.el-table__cell) {
+  vertical-align: top;
+}
+.sumFail {
+  color: black;
+}
+.sumOk {
+  color: green;
+}
 .describeText {
   font-size: 20px;
   font-weight: bolder;
@@ -205,7 +563,7 @@ watch(
 .describeText {
   line-height: 25px !important;
 }
-#seqTable {
+.seqTable {
   border-radius: 16px;
 }
 .boxTittle {
@@ -237,6 +595,9 @@ watch(
         display: flex;
         justify-content: space-between;
         padding: 0 5%;
+        .describeText {
+          font-size: 26px;
+        }
       }
     }
   }