|
@@ -750,7 +750,7 @@
|
|
|
async openUnqualifiedProductPrint() {
|
|
async openUnqualifiedProductPrint() {
|
|
|
try {
|
|
try {
|
|
|
const rows = this.selection.length ? this.selection : this.tableData;
|
|
const rows = this.selection.length ? this.selection : this.tableData;
|
|
|
- const ids = rows.map((item) => item.id).filter(Boolean);
|
|
|
|
|
|
|
+ const ids = [...new Set(rows.map((item) => item.id).filter(Boolean))];
|
|
|
if (!ids.length) {
|
|
if (!ids.length) {
|
|
|
this.$message.warning('未获取到可打印数据的ID');
|
|
this.$message.warning('未获取到可打印数据的ID');
|
|
|
return;
|
|
return;
|
|
@@ -767,7 +767,9 @@
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
buildUnqualifiedProductPrintData(res, rows = this.selection) {
|
|
buildUnqualifiedProductPrintData(res, rows = this.selection) {
|
|
|
- const list = Array.isArray(res) ? res : [];
|
|
|
|
|
|
|
+ const list = this.deduplicateUnqualifiedProductPrintData(
|
|
|
|
|
+ Array.isArray(res) ? res : []
|
|
|
|
|
+ );
|
|
|
if (!list.length) {
|
|
if (!list.length) {
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
@@ -778,6 +780,35 @@
|
|
|
)
|
|
)
|
|
|
);
|
|
);
|
|
|
},
|
|
},
|
|
|
|
|
+ deduplicateUnqualifiedProductPrintData(list) {
|
|
|
|
|
+ const identities = new Set();
|
|
|
|
|
+ return list.filter((item) => {
|
|
|
|
|
+ const identity = this.getUnqualifiedProductPrintIdentity(item);
|
|
|
|
|
+ if (!identity) {
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (identities.has(identity)) {
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ identities.add(identity);
|
|
|
|
|
+ return true;
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ getUnqualifiedProductPrintIdentity(item = {}) {
|
|
|
|
|
+ const code = this.getValue(
|
|
|
|
|
+ item.unqualifiedProductsCode,
|
|
|
|
|
+ item.disposeNo
|
|
|
|
|
+ );
|
|
|
|
|
+ if (code !== '') {
|
|
|
|
|
+ return `code:${code}`;
|
|
|
|
|
+ }
|
|
|
|
|
+ const id = this.getValue(
|
|
|
|
|
+ item.unqualifiedProductsId,
|
|
|
|
|
+ item.unqualifiedProductId,
|
|
|
|
|
+ item.id
|
|
|
|
|
+ );
|
|
|
|
|
+ return id === '' ? '' : `id:${id}`;
|
|
|
|
|
+ },
|
|
|
getSelectedUnqualifiedProduct(item = {}, index, rows = this.selection) {
|
|
getSelectedUnqualifiedProduct(item = {}, index, rows = this.selection) {
|
|
|
return (
|
|
return (
|
|
|
rows.find(
|
|
rows.find(
|