Commit 1184bd1a authored by wangwenjie's avatar wangwenjie

高亮

parent 909d8df0
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
v-for="(item, index) in currentPageList" v-for="(item, index) in currentPageList"
:key="item.BrandId || index" :key="item.BrandId || index"
:class="{ :class="{
'selected-item': fieldValue && item.boxBarProductLineDeviceCode === fieldValue, 'selected-item': isSelectedItem(item),
'scanned-item': isScannedItem(item) 'scanned-item': isScannedItem(item)
}" }"
> >
...@@ -173,16 +173,16 @@ export default { ...@@ -173,16 +173,16 @@ export default {
if (!this.data.childrenList || this.data.childrenList.length === 0) { if (!this.data.childrenList || this.data.childrenList.length === 0) {
return [{ text: "暂无机台号" }]; // 兜底提示,避免选择器为空 return [{ text: "暂无机台号" }]; // 兜底提示,避免选择器为空
} }
// 过滤掉 boxBarProductLineDeviceCode 为空/undefined 的项,再去重 // 过滤掉 boxBarProductLineDeviceName 为空/undefined 的项,再去重
const numList = this.data.childrenList const numList = this.data.childrenList
.map(item => item.boxBarProductLineDeviceName) .map(item => item.boxBarProductLineDeviceName)
.filter(code => code && code.trim() !== ""); // 过滤空值 .filter(name => name && name.trim() !== ""); // 过滤空值
const uniqueNums = Array.from(new Set(numList)); const uniqueNums = Array.from(new Set(numList));
// 去重后仍为空,返回兜底提示 // 去重后仍为空,返回兜底提示
if (uniqueNums.length === 0) { if (uniqueNums.length === 0) {
return [{ text: "暂无机台号" }]; return [{ text: "暂无机台号" }];
} }
return uniqueNums.map(code => ({ text: code })); return uniqueNums.map(name => ({ text: name }));
}, },
// 总页数 // 总页数
totalPages() { totalPages() {
...@@ -260,7 +260,7 @@ export default { ...@@ -260,7 +260,7 @@ export default {
// 格式化条码:截取后10位,前面拼接... // 格式化条码:截取后10位,前面拼接...
formatQrCode(qrCode) { formatQrCode(qrCode) {
if (!qrCode) return ""; if (!qrCode) return "";
// 截取后10位,前面拼接... // 截取后4位,前面拼接...
return `...${qrCode.slice(-4)}`; return `...${qrCode.slice(-4)}`;
}, },
// 扫码确认:校验并标记状态 // 扫码确认:校验并标记状态
...@@ -300,6 +300,10 @@ export default { ...@@ -300,6 +300,10 @@ export default {
Notify({type: 'warning', message: '条码已扫描'}); Notify({type: 'warning', message: '条码已扫描'});
} }
}, },
// 新增:判断是否属于选中机台号的条码
isSelectedItem(item) {
return this.fieldValue && item.boxBarProductLineDeviceName === this.fieldValue;
},
// 判断是否高亮:条码是否在已扫描列表中 // 判断是否高亮:条码是否在已扫描列表中
isScannedItem(item) { isScannedItem(item) {
return this.scannedCodes.includes(item.qrCode); return this.scannedCodes.includes(item.qrCode);
...@@ -496,4 +500,4 @@ export default { ...@@ -496,4 +500,4 @@ export default {
.query-btns { .query-btns {
bottom: 1.2rem; bottom: 1.2rem;
} }
</style> </style>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment