|
@@ -1,9 +1,12 @@
|
|
|
<template>
|
|
|
<div class="popUp" v-if="modelValue">
|
|
|
<div class="header">
|
|
|
- <div class="headerTittle">物料采集详情</div>
|
|
|
+ <div class="headerTittle" style="font-weight: border">物料采集详情</div>
|
|
|
</div>
|
|
|
- <div class="header" style="display: flex; justify-content: center">
|
|
|
+ <div
|
|
|
+ class="header"
|
|
|
+ style="display: flex; justify-content: center; margin: 20px"
|
|
|
+ >
|
|
|
<div class="box" @click.stop>
|
|
|
<div class="boxItem">
|
|
|
<div class="describeText">
|
|
@@ -12,102 +15,85 @@
|
|
|
<div class="describeText">型号:{{ showInfo.materialCode }}</div>
|
|
|
<div class="describeText">单管需要:{{ showInfo.totalNum }}</div>
|
|
|
</div>
|
|
|
- <div class="boxItem">
|
|
|
- <div class="describeText">
|
|
|
- 完成采集管号数:<span class="sumOk">{{ okSum }}</span>
|
|
|
- </div>
|
|
|
- <div class="describeText">
|
|
|
- 未完成采集管号数:<span style="color: red">{{
|
|
|
- seqSubmitTableData.length - okSum
|
|
|
- }}</span>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="body">
|
|
|
<div class="container1" @click.stop>
|
|
|
- <div class="boxTittle">管号绑定详情</div>
|
|
|
+ <div class="boxTittle">
|
|
|
+ 批次号列表(共{{ batchNoTableData.length }}批次,完成绑定{{
|
|
|
+ batchNoOkSum
|
|
|
+ }}批次)
|
|
|
+ </div>
|
|
|
<el-divider />
|
|
|
- <!-- <el-scrollbar style="flex: 1">
|
|
|
- <div></div>
|
|
|
- </el-scrollbar> -->
|
|
|
<div style="display: flex; margin-bottom: 20px; align-items: center">
|
|
|
<div class="seqSearchInput">
|
|
|
<el-input
|
|
|
- v-model="scanCode"
|
|
|
- placeholder="搜索管号"
|
|
|
+ v-model="searchBatchNo"
|
|
|
+ placeholder="搜索批次号"
|
|
|
class="searchInput"
|
|
|
clearable
|
|
|
/>
|
|
|
</div>
|
|
|
-
|
|
|
<el-button
|
|
|
- :type="!isShowOK ? 'primary' : ''"
|
|
|
- @click="isShowOK = !isShowOK"
|
|
|
- >未绑定</el-button
|
|
|
+ @click="batchNoOk = true"
|
|
|
+ :type="batchNoOk ? 'primary' : ''"
|
|
|
+ >数量绑定完成</el-button
|
|
|
>
|
|
|
<el-button
|
|
|
- @click="isShowOK = !isShowOK"
|
|
|
- :type="isShowOK ? 'primary' : ''"
|
|
|
- >已绑定</el-button
|
|
|
+ :type="!batchNoOk ? 'primary' : ''"
|
|
|
+ @click="batchNoOk = false"
|
|
|
+ >还可绑定</el-button
|
|
|
>
|
|
|
</div>
|
|
|
|
|
|
- <el-table border class="seqTable" :data="tableData" style="flex: 1">
|
|
|
- <el-table-column label="管号" prop="seqNo" />
|
|
|
- <el-table-column label="绑定批次号">
|
|
|
+ <el-table
|
|
|
+ border
|
|
|
+ class="seqTable"
|
|
|
+ :data="tabledata"
|
|
|
+ :row-class-name="tableRowClassName1"
|
|
|
+ style="flex: 1"
|
|
|
+ >
|
|
|
+ <el-table-column width="80" label="批次号" prop="batchNo" />
|
|
|
+ <el-table-column label="总可绑数量" prop="surplusNum" />
|
|
|
+ <el-table-column label="已绑定管号" prop="seqNo">
|
|
|
+ <template #default="scope">
|
|
|
+ <template
|
|
|
+ v-if="scope.row.seqNo.length > 0"
|
|
|
+ v-for="item in scope.row.seqNo"
|
|
|
+ >
|
|
|
+ <div class="selectInfo">
|
|
|
+ <div class="batchNo">No:{{ item.seqNo }}</div>
|
|
|
+ <div class="num">Num:{{ item.num }}</div>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <span v-else>-</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="本次绑定管号">
|
|
|
<template #default="scope">
|
|
|
<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)"
|
|
|
+ placeholder="管号"
|
|
|
+ v-model="batchNoTableData[scope.$index].selectSeqNo"
|
|
|
+ @change="(value) => setSelectSeq(value, scope.$index)"
|
|
|
>
|
|
|
<el-option
|
|
|
- v-for="item in neeBatchNoOptions"
|
|
|
+ v-for="item in seqOption"
|
|
|
: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
|
|
|
+ :label="item.seqNo"
|
|
|
+ :value="item.seqNo"
|
|
|
>
|
|
|
+ </el-option>
|
|
|
</el-select>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="已绑定批次">
|
|
|
+ <el-table-column width="200" label="绑定管号详情">
|
|
|
<template #default="scope">
|
|
|
<el-form
|
|
|
:model="item"
|
|
|
- v-for="(item, index) in scope.row.batchNo"
|
|
|
+ v-for="(item, index) in scope.row.selectSeq"
|
|
|
:key="index"
|
|
|
>
|
|
|
<el-form-item
|
|
@@ -115,9 +101,9 @@
|
|
|
message: '该选项为必选',
|
|
|
trigger: 'change',
|
|
|
}"
|
|
|
- label="批次号:"
|
|
|
- prop="batchNo"
|
|
|
- >{{ item.batchNo }}
|
|
|
+ label="管号:"
|
|
|
+ prop="seqNo"
|
|
|
+ >{{ item.seqNo }}
|
|
|
</el-form-item>
|
|
|
<el-form-item
|
|
|
:rules="{
|
|
@@ -129,61 +115,23 @@
|
|
|
prop="num"
|
|
|
>
|
|
|
<el-input-number
|
|
|
- :disabled="scope.row.ok"
|
|
|
- v-model="item.num"
|
|
|
- @change="
|
|
|
- (currentValue) =>
|
|
|
- numberInputChange(
|
|
|
- currentValue,
|
|
|
- scope.row.index,
|
|
|
- item.batchNo
|
|
|
- )
|
|
|
+ v-model="
|
|
|
+ batchNoTableData[scope.$index].selectSeq[index].num
|
|
|
"
|
|
|
: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
|
|
|
- ))
|
|
|
+ batchNoTableData[scope.$index].selectSeq[index].num +
|
|
|
+ getMaxNum(
|
|
|
+ batchNoTableData[scope.$index].batchNo,
|
|
|
+ batchNoTableData[scope.$index].selectSeq[index].seqNo
|
|
|
+ )
|
|
|
"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
-
|
|
|
- <el-table-column label="还需采集">
|
|
|
- <template #default="scope">
|
|
|
- <span
|
|
|
- :class="
|
|
|
- getRowNeedNum(scope.row.index) <= 0 ? 'sumOk' : 'sumFail'
|
|
|
- "
|
|
|
- >
|
|
|
- {{ !isShowOK ? getRowNeedNum(scope.row.index) : "-" }}</span
|
|
|
- >
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <!-- <el-table-column label="操作">
|
|
|
- <template #default="scope">
|
|
|
- <span class="opera" @click="showInfoPop(scope.row)"
|
|
|
- >查询料箱</span
|
|
|
- >
|
|
|
- </template>
|
|
|
- </el-table-column> -->
|
|
|
+ <el-table-column label="剩余可绑数量" prop="num"> </el-table-column>
|
|
|
<template #empty>
|
|
|
<div class="empty">
|
|
|
<Empty />
|
|
@@ -191,43 +139,74 @@
|
|
|
</template>
|
|
|
</el-table>
|
|
|
<div class="btns">
|
|
|
- <el-button type="primary" @click="batchInfoStatus = true"
|
|
|
+ <el-button type="primary" @click="submitInfoStatus = true"
|
|
|
>绑定确认</el-button
|
|
|
>
|
|
|
<el-button @click="handleClose">取消</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="container2" @click.stop>
|
|
|
- <div class="boxTittle">可绑物料</div>
|
|
|
+ <div class="boxTittle">
|
|
|
+ 管号列表(共{{ seqList.length }}个,完成绑定{{ seqNoOkSum }}个)
|
|
|
+ </div>
|
|
|
<el-divider />
|
|
|
<div style="display: flex; margin-bottom: 20px; align-items: center">
|
|
|
<div class="seqSearchInput">
|
|
|
<el-input
|
|
|
- v-model="scanCodeNo"
|
|
|
- placeholder="搜索批次号"
|
|
|
- class="searchInput"
|
|
|
- clearable
|
|
|
- />
|
|
|
- </div>
|
|
|
- <div class="seqSearchInput">
|
|
|
- <el-input
|
|
|
- v-model="scanCodeNum"
|
|
|
- placeholder="搜索现可采集数量"
|
|
|
+ v-model="searchSeqNo"
|
|
|
+ placeholder="搜索管号"
|
|
|
class="searchInput"
|
|
|
clearable
|
|
|
/>
|
|
|
</div>
|
|
|
+ <el-button @click="seqNoOk = true" :type="seqNoOk ? 'primary' : ''"
|
|
|
+ >完成绑定</el-button
|
|
|
+ >
|
|
|
+ <el-button :type="!seqNoOk ? 'primary' : ''" @click="seqNoOk = false"
|
|
|
+ >未完成</el-button
|
|
|
+ >
|
|
|
</div>
|
|
|
<el-table
|
|
|
border
|
|
|
class="seqTable"
|
|
|
- :row-class-name="tableRowClassName"
|
|
|
- :data="haveTableData"
|
|
|
+ :row-class-name="tableRowClassName2"
|
|
|
+ :data="seqNoDataList"
|
|
|
style="flex: 1"
|
|
|
>
|
|
|
- <el-table-column label="批次号" prop="batchNo" />
|
|
|
- <el-table-column label="总可采集数量" sortable prop="surplusNum" />
|
|
|
- <el-table-column label="现可采集数量" sortable prop="num" />
|
|
|
+ <el-table-column label="管号" prop="seqNo" />
|
|
|
+ <el-table-column label="已绑定批次号及数量" prop="batchNo">
|
|
|
+ <template #default="scope">
|
|
|
+ <template
|
|
|
+ v-if="scope.row.batchNo.length > 0"
|
|
|
+ v-for="item in scope.row.batchNo"
|
|
|
+ >
|
|
|
+ <div class="selectInfo">
|
|
|
+ <div class="batchNo">No:{{ item.batchNo }}</div>
|
|
|
+ <div class="num">Num:{{ item.num }}</div>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <span v-else>-</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ label="剩余需要绑定数量"
|
|
|
+ sortable
|
|
|
+ prop="remainingNum"
|
|
|
+ />
|
|
|
+ <el-table-column label="本次绑定批次号及数量">
|
|
|
+ <template #default="scope">
|
|
|
+ <template
|
|
|
+ v-if="scope.row.selectList.length > 0"
|
|
|
+ v-for="item in scope.row.selectList"
|
|
|
+ >
|
|
|
+ <div class="selectInfo">
|
|
|
+ <div class="batchNo">No:{{ item.batchNo }}</div>
|
|
|
+ <div class="num">Num:{{ item.num }}</div>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <span v-else>-</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<template #empty>
|
|
|
<div class="empty">
|
|
|
<Empty />
|
|
@@ -237,7 +216,7 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<saveBatchInfoPop
|
|
|
- v-model="batchInfoStatus"
|
|
|
+ v-model="submitInfoStatus"
|
|
|
:showInfo="showInfo"
|
|
|
@close="handleClose"
|
|
|
@data-list="dataList"
|
|
@@ -250,11 +229,6 @@ import saveBatchInfoPop from "./saveBatchInfoPop.vue";
|
|
|
import { useProcessStore } from "@/store";
|
|
|
import { getunProcessedList } from "@/api/prosteps";
|
|
|
import { includes } from "lodash-es";
|
|
|
-
|
|
|
-const emits = defineEmits(["update:modelValue", "dataList"]);
|
|
|
-const dataList = () => {
|
|
|
- emits("dataList");
|
|
|
-};
|
|
|
const props = defineProps({
|
|
|
modelValue: {
|
|
|
type: Boolean,
|
|
@@ -264,267 +238,275 @@ const props = defineProps({
|
|
|
type: Object,
|
|
|
},
|
|
|
});
|
|
|
-//展示是否绑定
|
|
|
-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 batchNoOk = ref(false);
|
|
|
+const submitInfoStatus = ref(false);
|
|
|
+const seqNoOk = ref(false);
|
|
|
+const emits = defineEmits(["update:modelValue", "dataList"]);
|
|
|
const store = useProcessStore();
|
|
|
-const tableRowClassName = ({ row, rowIndex }) => {
|
|
|
- if (row.num == 0) {
|
|
|
- return "warning-row";
|
|
|
- } else {
|
|
|
- return "success-row";
|
|
|
+//批次号绑定
|
|
|
+const batchNoTableData = ref([]);
|
|
|
+const batchNoOkSum = computed(() => {
|
|
|
+ return batchNoTableData.value.filter((item) => item.ok).length;
|
|
|
+});
|
|
|
+provide("batchNoTableData", batchNoTableData);
|
|
|
+
|
|
|
+const setBatchNoTableData = () => {
|
|
|
+ batchNoTableData.value = JSON.parse(JSON.stringify(props.showInfo.batchList));
|
|
|
+ batchNoTableData.value.forEach((item) => {
|
|
|
+ //绑定管号字段
|
|
|
+ item.selectSeqNo = [];
|
|
|
+ //具体字段和数量
|
|
|
+ item.selectSeq = [];
|
|
|
+ item.seqNo = [];
|
|
|
+ });
|
|
|
+ // 设置回显现阶段绑定数据
|
|
|
+ if (props.showInfo.collectList.length > 0) {
|
|
|
+ const array = [];
|
|
|
+ for (let i = 0; i < props.showInfo.collectList.length; i++) {
|
|
|
+ array.push(...props.showInfo.collectList[i].batchNo);
|
|
|
+ }
|
|
|
+ for (let j = 0; j < array.length; j++) {
|
|
|
+ for (let i = 0; i < batchNoTableData.value.length; i++) {
|
|
|
+ if (array[j].batchNo == batchNoTableData.value[i].batchNo) {
|
|
|
+ batchNoTableData.value[i].seqNo.push(array[j]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
+ batchNoTableData.value.forEach((item) => {
|
|
|
+ item.num = item.surplusNum;
|
|
|
+ if (item.seqNo.length > 0) {
|
|
|
+ for (let i = 0; i < item.seqNo.length; i++) {
|
|
|
+ item.num = item.num - item.seqNo[i].num;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (item.num == 0) {
|
|
|
+ item.ok = true;
|
|
|
+ } else {
|
|
|
+ item.ok = false;
|
|
|
+ }
|
|
|
+ });
|
|
|
};
|
|
|
-//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 getMaxNum = (batchNo, seqNo) => {
|
|
|
+ let sum1 = 0;
|
|
|
+ let sum2 = 0;
|
|
|
+ for (let i = 0; i < showBatchNoTableData.value.length; i++) {
|
|
|
+ if (showBatchNoTableData.value[i].batchNo == batchNo) {
|
|
|
+ sum1 = showBatchNoTableData.value[i].num;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (let i = 0; i < seqNoDataList.value.length; i++) {
|
|
|
+ if (seqNoDataList.value[i].seqNo == seqNo) {
|
|
|
+ sum2 = seqNoDataList.value[i].remainingNum;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (sum1 > sum2) {
|
|
|
+ return sum2;
|
|
|
+ } else {
|
|
|
+ return sum1;
|
|
|
}
|
|
|
};
|
|
|
-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 searchBatchNo = ref("");
|
|
|
+const searchSeqNo = ref("");
|
|
|
+//批次号列表展示data
|
|
|
+const showBatchNoTableData = computed(() => {
|
|
|
+ let array = JSON.parse(JSON.stringify(batchNoTableData.value));
|
|
|
+ if (batchNoOk.value) {
|
|
|
+ return array.filter((item) => item.ok == true);
|
|
|
+ }
|
|
|
+ array.forEach((item) => {
|
|
|
+ item.num = item.surplusNum;
|
|
|
+ if (item.seqNo) {
|
|
|
+ for (let i = 0; i < item.seqNo.length; i++) {
|
|
|
+ item.num = item.num - item.seqNo[i].num;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (item.selectSeq) {
|
|
|
+ for (let i = 0; i < item.selectSeq.length; i++) {
|
|
|
+ item.num = item.num - item.selectSeq[i].num;
|
|
|
+ }
|
|
|
+ }
|
|
|
});
|
|
|
+
|
|
|
+ return array;
|
|
|
});
|
|
|
-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 tabledata = computed(() => {
|
|
|
+ let array = JSON.parse(JSON.stringify(showBatchNoTableData.value));
|
|
|
+ if (searchBatchNo.value) {
|
|
|
+ const lowerCaseSearchValue = searchBatchNo.value.toLowerCase();
|
|
|
+ array = array.filter(
|
|
|
+ (item) =>
|
|
|
+ item.batchNo &&
|
|
|
+ item.batchNo.toLowerCase().includes(lowerCaseSearchValue)
|
|
|
+ );
|
|
|
+ }
|
|
|
+ return array;
|
|
|
});
|
|
|
-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);
|
|
|
+const setSelectSeq = (value, index) => {
|
|
|
+ const array = ref([]);
|
|
|
+ batchNoTableData.value[index].selectSeq.forEach((item) => {
|
|
|
+ array.value.push(item.seqNo);
|
|
|
+ });
|
|
|
+ value.forEach((item) => {
|
|
|
+ if (!array.value.includes(item)) {
|
|
|
+ batchNoTableData.value[index].selectSeq.push({ seqNo: item, num: 0 });
|
|
|
+ }
|
|
|
+ });
|
|
|
};
|
|
|
-//点击绑定时触发->更新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;
|
|
|
+const seqNoList = ref([]);
|
|
|
+const seqNoOkSum = computed(() => {
|
|
|
+ return seqNoList.value.filter((item) => item.ok).length;
|
|
|
+});
|
|
|
+const setSeqNoList = (data) => {
|
|
|
+ const array = ref([]);
|
|
|
+ const selectSeqNoList = ref([]);
|
|
|
+ //设置过往已经绑定的数据
|
|
|
+ data.collectList.forEach((el) => {
|
|
|
+ el.batchNo.forEach((obj) => {
|
|
|
+ selectSeqNoList.value.push({ ...obj, seqNo: el.seqNo });
|
|
|
});
|
|
|
- }, 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("采集数量已经足够!");
|
|
|
+ });
|
|
|
+ for (let i = 0; i < seqList.value.length; i++) {
|
|
|
+ array.value.push({
|
|
|
+ seqNo: seqList.value[i],
|
|
|
+ //剩余可绑定数
|
|
|
+ remainingNum: 0,
|
|
|
+ //本次绑定数
|
|
|
+ selectNum: 0,
|
|
|
+ //本次绑定情况
|
|
|
+ selectList: 0,
|
|
|
+ //已绑定情况
|
|
|
+ batchNo: [],
|
|
|
+ });
|
|
|
+ const sum = ref(props.showInfo.totalNum);
|
|
|
+ selectSeqNoList.value.forEach((el) => {
|
|
|
+ if (seqList.value[i] == el.seqNo) {
|
|
|
+ array.value[i].batchNo.push(el);
|
|
|
+ sum.value = sum.value - el.num;
|
|
|
}
|
|
|
+ });
|
|
|
+ array.value[i].remainingNum = sum.value;
|
|
|
+ if (array.value[i].remainingNum == 0) {
|
|
|
+ array.value[i].ok = true;
|
|
|
+ } else {
|
|
|
+ array.value[i].ok = false;
|
|
|
}
|
|
|
- }, 0);
|
|
|
+ }
|
|
|
+ seqNoList.value = array.value;
|
|
|
};
|
|
|
-//设置初始表格数据
|
|
|
-const setSeqSubmitTableData = () => {
|
|
|
- okSum.value = 0;
|
|
|
- seqSubmitTableData.value = [];
|
|
|
- seqList.value.forEach((item, index) => {
|
|
|
- seqSubmitTableData.value.push({
|
|
|
- seqNo: item,
|
|
|
- batchNo: [],
|
|
|
- //该管号是否完成收集
|
|
|
- status: false,
|
|
|
- ok: false,
|
|
|
- index: index,
|
|
|
+//计算当前管号绑定情况
|
|
|
+const seqNoDataList = computed(() => {
|
|
|
+ const array = ref([]);
|
|
|
+ const selectSeqNoList = ref([]);
|
|
|
+ //设置过往已经绑定的数据
|
|
|
+ props.showInfo.collectList.forEach((el) => {
|
|
|
+ el.batchNo.forEach((obj) => {
|
|
|
+ selectSeqNoList.value.push({ ...obj, seqNo: el.seqNo });
|
|
|
});
|
|
|
});
|
|
|
- // 回显当前绑定情况
|
|
|
- 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);
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
+ for (let i = 0; i < seqList.value.length; i++) {
|
|
|
+ array.value.push({
|
|
|
+ seqNo: seqList.value[i],
|
|
|
+ //剩余可绑定数
|
|
|
+ remainingNum: 0,
|
|
|
+ //本次绑定数
|
|
|
+ selectNum: 0,
|
|
|
+ //本次绑定情况
|
|
|
+ selectList: 0,
|
|
|
+ //已绑定情况
|
|
|
+ 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 sum = ref(props.showInfo.totalNum);
|
|
|
+ selectSeqNoList.value.forEach((el) => {
|
|
|
+ if (seqList.value[i] == el.seqNo) {
|
|
|
+ array.value[i].batchNo.push(el);
|
|
|
+ sum.value = sum.value - el.num;
|
|
|
}
|
|
|
});
|
|
|
- });
|
|
|
-};
|
|
|
-//获取当前批次号最大新增数
|
|
|
-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;
|
|
|
+ array.value[i].remainingNum = sum.value;
|
|
|
+ if (array.value[i].remainingNum == 0) {
|
|
|
+ array.value[i].ok = true;
|
|
|
+ } else {
|
|
|
+ array.value[i].ok = false;
|
|
|
}
|
|
|
}
|
|
|
- for (let j = 0; j < array2.length; j++) {
|
|
|
- if (array2[j].batchNo === no) {
|
|
|
- max -= array2[j].num;
|
|
|
- }
|
|
|
+ if (seqNoOk.value) {
|
|
|
+ return array.value.filter((item) => item.ok == true);
|
|
|
+ } else {
|
|
|
+ array.value = array.value.filter((item) => item.ok != true);
|
|
|
}
|
|
|
- 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;
|
|
|
+ //对本次采集过滤
|
|
|
+ const selectArray = ref([]);
|
|
|
+ batchNoTableData.value.forEach((item) => {
|
|
|
+ item.selectSeq.forEach((el) => {
|
|
|
+ el.batchNo = item.batchNo;
|
|
|
+ });
|
|
|
+ selectArray.value.push(...item.selectSeq);
|
|
|
+ });
|
|
|
+ array.value.forEach((item) => {
|
|
|
+ item.selectList = [];
|
|
|
+ for (let i = 0; i < selectArray.value.length; i++) {
|
|
|
+ if (
|
|
|
+ item.seqNo == selectArray.value[i].seqNo &&
|
|
|
+ selectArray.value[i].num > 0
|
|
|
+ ) {
|
|
|
+ item.selectList.push(selectArray.value[i]);
|
|
|
+ item.selectNum += selectArray.value[i].num;
|
|
|
+ item.remainingNum -= selectArray.value[i].num;
|
|
|
+ }
|
|
|
}
|
|
|
+ });
|
|
|
+ if (searchSeqNo.value) {
|
|
|
+ const lowerCaseSearchValue = searchSeqNo.value.toLowerCase();
|
|
|
+ array.value = array.value.filter(
|
|
|
+ (item) =>
|
|
|
+ item.seqNo && item.seqNo.toLowerCase().includes(lowerCaseSearchValue)
|
|
|
+ );
|
|
|
}
|
|
|
- return max;
|
|
|
+ return array.value;
|
|
|
+});
|
|
|
+//当前可选管号
|
|
|
+const seqOption = computed(() => {
|
|
|
+ return seqNoDataList.value.filter((item) => item.remainingNum > 0);
|
|
|
+});
|
|
|
+//更新外部列表
|
|
|
+const dataList = () => {
|
|
|
+ emits("dataList");
|
|
|
};
|
|
|
-//获取当前批次号 在某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;
|
|
|
- }
|
|
|
+const tableRowClassName1 = ({ row, rowIndex }) => {
|
|
|
+ if (row.num == 0) {
|
|
|
+ return "success-row";
|
|
|
+ } else {
|
|
|
}
|
|
|
-
|
|
|
- if (max > num) {
|
|
|
- res = num;
|
|
|
+};
|
|
|
+const tableRowClassName2 = ({ row, rowIndex }) => {
|
|
|
+ if (row.remainingNum == 0) {
|
|
|
+ return "success-row";
|
|
|
} 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 handleClose = () => {
|
|
|
+ emits("update:modelValue", false);
|
|
|
};
|
|
|
-const setRowStatus = () => {
|
|
|
- seqSubmitTableData.value.forEach((item, index) => {
|
|
|
- if (getRowNeedNum(index) == 0) {
|
|
|
- seqSubmitTableData.value[index].status = true;
|
|
|
- } else {
|
|
|
- seqSubmitTableData.value[index].status = false;
|
|
|
- }
|
|
|
- });
|
|
|
+//当前所有管号
|
|
|
+const seqList = ref([]);
|
|
|
+//获取当前物料绑定管号
|
|
|
+const getSeqList = async () => {
|
|
|
+ const { data } = await getunProcessedList(store.scanInfo.id);
|
|
|
+ seqList.value = data;
|
|
|
};
|
|
|
watch(
|
|
|
() => props.showInfo,
|
|
|
- async () => {
|
|
|
+ () => {
|
|
|
if (props.showInfo) {
|
|
|
- await getSeqList();
|
|
|
- await setSeqSubmitTableData();
|
|
|
- setAllBatchNoOptions();
|
|
|
+ //函数执行有问题
|
|
|
+ getSeqList();
|
|
|
+ setSeqNoList(props.showInfo);
|
|
|
+ setBatchNoTableData();
|
|
|
}
|
|
|
- },
|
|
|
- { immediate: true }
|
|
|
-);
|
|
|
-watch(
|
|
|
- seqSubmitTableData,
|
|
|
- () => {
|
|
|
- setSelectBatchNo();
|
|
|
- setRowStatus();
|
|
|
- },
|
|
|
- { deep: true }
|
|
|
+ }
|
|
|
);
|
|
|
</script>
|
|
|
|
|
@@ -537,6 +519,9 @@ watch(
|
|
|
}
|
|
|
</style>
|
|
|
<style lang="scss" scoped>
|
|
|
+.selectInfo {
|
|
|
+ margin-bottom: 5px;
|
|
|
+}
|
|
|
:deep(.el-form-item) {
|
|
|
margin-bottom: 5px !important;
|
|
|
}
|
|
@@ -581,10 +566,10 @@ watch(
|
|
|
left: 0;
|
|
|
backdrop-filter: blur(5px);
|
|
|
.header {
|
|
|
- margin: 20px 0;
|
|
|
+ margin: 0;
|
|
|
.box {
|
|
|
width: 95vw;
|
|
|
- height: 15vh;
|
|
|
+ height: 10vh;
|
|
|
background-color: #f1f3f5;
|
|
|
border-radius: 16px;
|
|
|
padding: 10px;
|
|
@@ -603,7 +588,7 @@ watch(
|
|
|
}
|
|
|
.body {
|
|
|
width: 100vw;
|
|
|
- height: 70vh;
|
|
|
+ height: 74vh;
|
|
|
display: flex;
|
|
|
justify-content: space-evenly;
|
|
|
.container1 {
|