fix: 🧩 修复数字条码打印最后一位无法显示

This commit is contained in:
2025-06-03 10:22:14 +08:00
parent e37305fa19
commit c5646c9b3c
7 changed files with 45 additions and 7 deletions

View File

@@ -32,6 +32,7 @@
return routeName === 'boxCode' || routeName === 'boxMarkIndex' ? row.detailId + '' + row.id : row.id;
}
"
:cell-class-name="tableRowClassName"
@selection-change="selectionChange"
:style="!isBoxClass ? 'height: 400px; overflow-y: auto' : ''"
>
@@ -120,6 +121,7 @@ export interface ProTableProps {
rowKey?: string; // 行数据的 Key用来优化 Table 的渲染,当表格数据多选时,所指定的 id ==> 非必传(默认为 id
searchCol?: number | Record<BreakPoint, number>; // 表格搜索项 每列占比配置 ==> 非必传 { xs: 1, sm: 2, md: 2, lg: 3, xl: 4 }
pageSizes?: any;
tableRowClassName?: any;
}
// 接受父组件参数,配置默认值
@@ -134,9 +136,18 @@ const props = withDefaults(defineProps<ProTableProps>(), {
toolButton: true,
// rowKey: `id${index}`,
searchCol: () => ({ xs: 1, sm: 2, md: 2, lg: 3, xl: 4 }),
pageSizes: [50, 100, 150, 200]
pageSizes: [50, 100, 150, 200],
tableRowClassName: ""
});
// const tableRowClassName = ({ row, rowIndex }: { row: any; rowIndex: number }) => {
// console.log(row, "========row=========");
// if (rowIndex === 1) {
// return "warning-row";
// } else if (rowIndex === 3) {
// return "success-row";
// }
// return "";
// };
// 是否显示搜索模块
const isShowSearch = ref(true);
// 表格 DOM 元素
@@ -225,3 +236,13 @@ defineExpose({
selectedListIds
});
</script>
<style lang="scss">
.warning-row {
--el-table-tr-bg-color: var(--el-color-warning-light-8) !important;
background-color: #faecd8 !important;
}
.success-row {
background-color: #e1f3d8 !important;
}
</style>

View File

@@ -30,6 +30,7 @@ export const barCOdePrintFunctionObj = (val, list, callBack) => {
oneCodePrint(list, callBack);
}
if (val === 13 || val === 14) {
console.log(val, "========val==========");
oneNumberCodePrint(list, callBack);
}
};

View File

@@ -62,7 +62,7 @@ function printContent(item, code69Img) {
LODOP.ADD_PRINT_IMAGE(82, 15, 198, 42, '<img src="' + codeSN(numberCode) + '">'); // 添加图片
LODOP.SET_PRINT_STYLEA(0, "Stretch", 1);
//底部文字(SN码)
LODOP.ADD_PRINT_TEXT(126, 50, 150, 10, numberCode);
LODOP.ADD_PRINT_TEXT(126, 50, "100%", 10, numberCode);
LODOP.SET_PRINT_STYLEA(0, "LetterSpacing", 4);
//底部文字(日期)
// LODOP.ADD_PRINT_TEXT(131, 183, 60, 10, date);

View File

@@ -81,7 +81,7 @@ function printLeftContent(item, code69Img) {
//规格型号 左边
if (specifications) {
//上,左,内容宽度,内容高度
LODOP.ADD_PRINT_TEXT(6, 11, 160, 10, specifications);
LODOP.ADD_PRINT_TEXT(6, 11, "100%", 10, specifications);
LODOP.SET_PRINT_STYLEA(0, "TextOverflow", 2);
//border:1px solid red
// const HTMLL = `<div

View File

@@ -131,6 +131,7 @@
:orgCode="datas.printCodeRuleFormData.orgCode"
:isBoxClass="false"
:pageSizes="[50, 100, 150, 200, 300, 500]"
:tableRowClassName="tableRowClassName"
>
</ProTable>
<!-- :request-api="" -->
@@ -393,6 +394,21 @@ const handlerPrintBarCode = (row: any) => {
}
};
const tableRowClassName = ({ row, rowIndex }: { row: any; rowIndex: number }) => {
if (row.isTwo == 1) {
return "";
}
// 计算当前行所在的组每组2行
let groupIndex = Math.floor(rowIndex / 2);
// 根据组索引的奇偶性决定使用哪种颜色
if (groupIndex % 2 === 0) {
return "warning-row";
} else {
return "success-row";
}
return "";
};
// 删除文件
const handleRemoveFiles = () => {
datas.uploadProgress = "";

View File

@@ -4,11 +4,12 @@ import { msgHtml } from "./msgHtml";
//刪除接口
const getDeleteBox = async (datas: any, index: any) => {
const { boxId, materialNumber, serialNumber } = datas.formTableData[index];
const { boxId, materialNumber, serialNumber, twoSerialNumber } = datas.formTableData[index];
const result = await getDeleteBoxApi({
boxId,
materialNumber,
serialNumber
serialNumber,
twoSerialNumber
});
if (result.status === 200) {
datas.formTableData.splice(index, 1);

View File

@@ -83,7 +83,6 @@ const handleParentCallback = (result?: any) => {
});
return;
}
datas.ruleForm = cloneDeep(RULEFORM);
proTable!.value.getTableList(datas.initParam);
};