feat: 🚀 打印箱唛规格型号字体切换

This commit is contained in:
2025-07-21 17:39:47 +08:00
parent 29fd5146e3
commit 00509601ba
13 changed files with 190 additions and 70 deletions

View File

@@ -27,3 +27,11 @@ const assemblySize = computed(() => globalStore.assemblySize);
// element button config // element button config
const buttonConfig = reactive({ autoInsertSpace: false }); const buttonConfig = reactive({ autoInsertSpace: false });
</script> </script>
<style>
@font-face {
font-family: MyCustomFont;
font-style: normal; /* 字体样式 */
font-weight: normal; /* 字体粗细 */
src: url("./assets/font/FiraCode-Light.ttf") format("truetype");
}
</style>

Binary file not shown.

Binary file not shown.

119
src/auto-import.d.ts vendored
View File

@@ -4,66 +4,67 @@
// Generated by unplugin-auto-import // Generated by unplugin-auto-import
export {} export {}
declare global { declare global {
const EffectScope: typeof import('vue')['EffectScope'] const EffectScope: typeof import("vue")["EffectScope"];
const computed: typeof import('vue')['computed'] const ElMessageBox: typeof import("element-plus/es")["ElMessageBox"];
const createApp: typeof import('vue')['createApp'] const computed: typeof import("vue")["computed"];
const customRef: typeof import('vue')['customRef'] const createApp: typeof import("vue")["createApp"];
const defineAsyncComponent: typeof import('vue')['defineAsyncComponent'] const customRef: typeof import("vue")["customRef"];
const defineComponent: typeof import('vue')['defineComponent'] const defineAsyncComponent: typeof import("vue")["defineAsyncComponent"];
const effectScope: typeof import('vue')['effectScope'] const defineComponent: typeof import("vue")["defineComponent"];
const getCurrentInstance: typeof import('vue')['getCurrentInstance'] const effectScope: typeof import("vue")["effectScope"];
const getCurrentScope: typeof import('vue')['getCurrentScope'] const getCurrentInstance: typeof import("vue")["getCurrentInstance"];
const h: typeof import('vue')['h'] const getCurrentScope: typeof import("vue")["getCurrentScope"];
const inject: typeof import('vue')['inject'] const h: typeof import("vue")["h"];
const isProxy: typeof import('vue')['isProxy'] const inject: typeof import("vue")["inject"];
const isReactive: typeof import('vue')['isReactive'] const isProxy: typeof import("vue")["isProxy"];
const isReadonly: typeof import('vue')['isReadonly'] const isReactive: typeof import("vue")["isReactive"];
const isRef: typeof import('vue')['isRef'] const isReadonly: typeof import("vue")["isReadonly"];
const markRaw: typeof import('vue')['markRaw'] const isRef: typeof import("vue")["isRef"];
const nextTick: typeof import('vue')['nextTick'] const markRaw: typeof import("vue")["markRaw"];
const onActivated: typeof import('vue')['onActivated'] const nextTick: typeof import("vue")["nextTick"];
const onBeforeMount: typeof import('vue')['onBeforeMount'] const onActivated: typeof import("vue")["onActivated"];
const onBeforeRouteLeave: typeof import('vue-router')['onBeforeRouteLeave'] const onBeforeMount: typeof import("vue")["onBeforeMount"];
const onBeforeRouteUpdate: typeof import('vue-router')['onBeforeRouteUpdate'] const onBeforeRouteLeave: typeof import("vue-router")["onBeforeRouteLeave"];
const onBeforeUnmount: typeof import('vue')['onBeforeUnmount'] const onBeforeRouteUpdate: typeof import("vue-router")["onBeforeRouteUpdate"];
const onBeforeUpdate: typeof import('vue')['onBeforeUpdate'] const onBeforeUnmount: typeof import("vue")["onBeforeUnmount"];
const onDeactivated: typeof import('vue')['onDeactivated'] const onBeforeUpdate: typeof import("vue")["onBeforeUpdate"];
const onErrorCaptured: typeof import('vue')['onErrorCaptured'] const onDeactivated: typeof import("vue")["onDeactivated"];
const onMounted: typeof import('vue')['onMounted'] const onErrorCaptured: typeof import("vue")["onErrorCaptured"];
const onRenderTracked: typeof import('vue')['onRenderTracked'] const onMounted: typeof import("vue")["onMounted"];
const onRenderTriggered: typeof import('vue')['onRenderTriggered'] const onRenderTracked: typeof import("vue")["onRenderTracked"];
const onScopeDispose: typeof import('vue')['onScopeDispose'] const onRenderTriggered: typeof import("vue")["onRenderTriggered"];
const onServerPrefetch: typeof import('vue')['onServerPrefetch'] const onScopeDispose: typeof import("vue")["onScopeDispose"];
const onUnmounted: typeof import('vue')['onUnmounted'] const onServerPrefetch: typeof import("vue")["onServerPrefetch"];
const onUpdated: typeof import('vue')['onUpdated'] const onUnmounted: typeof import("vue")["onUnmounted"];
const provide: typeof import('vue')['provide'] const onUpdated: typeof import("vue")["onUpdated"];
const reactive: typeof import('vue')['reactive'] const provide: typeof import("vue")["provide"];
const readonly: typeof import('vue')['readonly'] const reactive: typeof import("vue")["reactive"];
const ref: typeof import('vue')['ref'] const readonly: typeof import("vue")["readonly"];
const resolveComponent: typeof import('vue')['resolveComponent'] const ref: typeof import("vue")["ref"];
const shallowReactive: typeof import('vue')['shallowReactive'] const resolveComponent: typeof import("vue")["resolveComponent"];
const shallowReadonly: typeof import('vue')['shallowReadonly'] const shallowReactive: typeof import("vue")["shallowReactive"];
const shallowRef: typeof import('vue')['shallowRef'] const shallowReadonly: typeof import("vue")["shallowReadonly"];
const toRaw: typeof import('vue')['toRaw'] const shallowRef: typeof import("vue")["shallowRef"];
const toRef: typeof import('vue')['toRef'] const toRaw: typeof import("vue")["toRaw"];
const toRefs: typeof import('vue')['toRefs'] const toRef: typeof import("vue")["toRef"];
const toValue: typeof import('vue')['toValue'] const toRefs: typeof import("vue")["toRefs"];
const triggerRef: typeof import('vue')['triggerRef'] const toValue: typeof import("vue")["toValue"];
const unref: typeof import('vue')['unref'] const triggerRef: typeof import("vue")["triggerRef"];
const useAttrs: typeof import('vue')['useAttrs'] const unref: typeof import("vue")["unref"];
const useCssModule: typeof import('vue')['useCssModule'] const useAttrs: typeof import("vue")["useAttrs"];
const useCssVars: typeof import('vue')['useCssVars'] const useCssModule: typeof import("vue")["useCssModule"];
const useLink: typeof import('vue-router')['useLink'] const useCssVars: typeof import("vue")["useCssVars"];
const useRoute: typeof import('vue-router')['useRoute'] const useLink: typeof import("vue-router")["useLink"];
const useRouter: typeof import('vue-router')['useRouter'] const useRoute: typeof import("vue-router")["useRoute"];
const useSlots: typeof import('vue')['useSlots'] const useRouter: typeof import("vue-router")["useRouter"];
const watch: typeof import('vue')['watch'] const useSlots: typeof import("vue")["useSlots"];
const watchEffect: typeof import('vue')['watchEffect'] const watch: typeof import("vue")["watch"];
const watchPostEffect: typeof import('vue')['watchPostEffect'] const watchEffect: typeof import("vue")["watchEffect"];
const watchSyncEffect: typeof import('vue')['watchSyncEffect'] const watchPostEffect: typeof import("vue")["watchPostEffect"];
const watchSyncEffect: typeof import("vue")["watchSyncEffect"];
} }
// for type re-export // for type re-export
declare global { declare global {
// @ts-ignore // @ts-ignore
export type { Component, ComponentPublicInstance, ComputedRef, InjectionKey, PropType, Ref, VNode } from 'vue' export type { Component, ComponentPublicInstance, ComputedRef, InjectionKey, PropType, Ref, VNode } from "vue";
} }

1
src/components.d.ts vendored
View File

@@ -12,6 +12,7 @@ declare module "vue" {
500: typeof import("./components/ErrorMessage/500.vue")["default"]; 500: typeof import("./components/ErrorMessage/500.vue")["default"];
Add: typeof import("./components/DetailsBtns/components/Add.vue")["default"]; Add: typeof import("./components/DetailsBtns/components/Add.vue")["default"];
ColSetting: typeof import("./components/ProTable/components/ColSetting.vue")["default"]; ColSetting: typeof import("./components/ProTable/components/ColSetting.vue")["default"];
Convert: typeof import("./components/ListBtns/components/Convert.vue")["default"];
Del: typeof import("./components/ListBtns/components/Del.vue")["default"]; Del: typeof import("./components/ListBtns/components/Del.vue")["default"];
DetailsBtns: typeof import("./components/DetailsBtns/index.vue")["default"]; DetailsBtns: typeof import("./components/DetailsBtns/index.vue")["default"];
DetailsSearch: typeof import("./components/DetailsSearch/index.vue")["default"]; DetailsSearch: typeof import("./components/DetailsSearch/index.vue")["default"];

View File

@@ -0,0 +1,69 @@
<template>
<div class="common-btn-box1 font12" @click="handleBtnClick()">
<span>转两件装</span>
</div>
</template>
<script setup lang="ts">
// import { ElMessageBox } from "element-plus";
import { useMsg } from "@/hooks/useMsg";
// import { } from "@/api/modules/global";
// const $router = useRouter();
// 接口地址映射
// const URLS: Record<string, string> = {
// boxMarkIndex: "BoxMark/delete", //入库任务列表
// subscriptionIndex: "SubscribeNotification/Delete" //订阅列表
// };
const props: any = defineProps<{
selectionList?: any[];
handleChildBtnCallback?: () => void;
ruleForm: any;
}>();
// const emits = defineEmits<{
// (e: "handleChildBtnCallback", result: Record<string, any>): void;
// }>();
// 提交事件
const handleBtnClick = () => {
console.log(props.selectionList, "============>");
let isSome = props.selectionList.filter((item: any) => {
return item.useNumber;
});
console.log(isSome, "======isSome======");
if (isSome.length) {
let specifications = isSome[0].specifications;
useMsg("warning", `${specifications}序列码存在已使用, 不支持转两件装 `);
return;
}
let ids: number[] = [];
props.selectionList.forEach((item: any) => {
//只需要将一件装的id传过去就可以了
if (item.isTwo === 1) {
ids.push(item.id);
}
});
// ElMessageBox.confirm("确定数据转换为两件装, 一旦转换不可回退!", "温馨提示", {
// confirmButtonText: "确定",
// cancelButtonText: "取消",
// type: "warning"
// })
// .then(async () => {
// const result = await commitListApi(URLS[routeName], { ids: ids });
// if (result.status === 200) {
// useMsg("success", "删除成功 ");
// emits("handleChildBtnCallback", {
// type: "Convert"
// });
// } else {
// useMsg("error", result.message);
// }
// })
// .catch(() => {});
};
</script>
<style scoped>
@import "../index.scss";
</style>

View File

@@ -33,11 +33,28 @@ const handleBtnClick = async () => {
useMsg("warning", "请选择要下载的数据 !"); useMsg("warning", "请选择要下载的数据 !");
return; return;
} }
let isTwo1 = props.selectionList.some((item: any) => {
return item.isTwo == 1;
});
let isTwo2 = props.selectionList.some((item: any) => {
return item.isTwo == 2;
});
if (isTwo1 && isTwo2) {
useMsg("warning", "数据含有单件装和两件装条码, 请分开选择数据进行下载 !");
return;
}
let isTwo = props.selectionList[0].isTwo;
props.selectionList.forEach((item: any) => { props.selectionList.forEach((item: any) => {
ids.push(item.id); ids.push(item.id);
}); });
let params: any = {
const result = await operationButtonsApi(URLS[name.value], { ids }); antiCode: { ids },
barCode: { ids, isTwo }
};
const result = await operationButtonsApi(URLS[name.value], params[name.value]);
if (result.status === 200 && result.isSuccess) { if (result.status === 200 && result.isSuccess) {
useMsg("success", "导出成功请前往导出列表中进行下载 "); useMsg("success", "导出成功请前往导出列表中进行下载 ");
} else { } else {

View File

@@ -13,6 +13,7 @@ import PackingBox from "../components/PackingBox.vue";
import PrintBox from "../components/PrintBox.vue"; import PrintBox from "../components/PrintBox.vue";
import RefreshBox from "../components/RefreshBox.vue"; import RefreshBox from "../components/RefreshBox.vue";
import Generates from "../components/Generates.vue"; import Generates from "../components/Generates.vue";
import Convert from "../components/Convert.vue";
// const BTNS =[] // const BTNS =[]
// 路由跳转映射表 // 路由跳转映射表
@@ -44,16 +45,20 @@ export const BTNS_ROUTE = (routeName: any) => {
if (SHOW_BTBS[key][i] === "barCodeGenerate" && routeName === "barCode") { if (SHOW_BTBS[key][i] === "barCodeGenerate" && routeName === "barCode") {
btnsCom[key].push(Generate); btnsCom[key].push(Generate);
} }
if (SHOW_BTBS[key][i] === "barCodeGenerates" && routeName === "barCode") { if (SHOW_BTBS[key][i] === "barCodeGenerates" && routeName === "barCode") {
btnsCom[key].push(Generates); btnsCom[key].push(Generates);
} }
if (SHOW_BTBS[key][i] === "barCodeRefresh" && routeName === "barCode") { if (SHOW_BTBS[key][i] === "barCodeRefresh" && routeName === "barCode") {
btnsCom[key].push(Refresh); btnsCom[key].push(Refresh);
} }
if (SHOW_BTBS[key][i] === "barCodedownload" && routeName === "barCode") { if (SHOW_BTBS[key][i] === "barCodedownload" && routeName === "barCode") {
btnsCom[key].push(download); btnsCom[key].push(download);
} }
//两件装
if (routeName === "barCode" && SHOW_BTBS[key][i] === "barCodeConvert") {
btnsCom[key].push(Convert);
}
if (SHOW_BTBS[key][i] === "boxMarkAdd") { if (SHOW_BTBS[key][i] === "boxMarkAdd") {
btnsCom[key].push(Add); btnsCom[key].push(Add);
} }

View File

@@ -39,11 +39,12 @@ function printLeftContent(item) {
const { serialNumber } = item; const { serialNumber } = item;
// //SN码和底部文字 // //SN码和底部文字
if (serialNumber && serialNumber !== " ") { if (serialNumber && serialNumber !== " ") {
console.log("走到了这里,开新");
//SN码; //SN码;
LODOP.ADD_PRINT_IMAGE(7, 16, 140, 20, '<img src="' + codeSN(serialNumber) + '">'); // 添加图片 LODOP.ADD_PRINT_IMAGE(7, 16, 140, 20, '<img src="' + codeSN(serialNumber) + '">'); // 添加图片
LODOP.SET_PRINT_STYLEA(0, "Stretch", 1); LODOP.SET_PRINT_STYLEA(0, "Stretch", 1);
//底部文字(SN码) //底部文字(SN码)
LODOP.ADD_PRINT_TEXT(27, 26, 100, 10, serialNumber); LODOP.ADD_PRINT_TEXT(27, 26, 100, 10, "0oo0");
//底部文字(日期) //底部文字(日期)
LODOP.ADD_PRINT_TEXT(27, 125, 40, 10, dateCreate()); LODOP.ADD_PRINT_TEXT(27, 125, 40, 10, dateCreate());
} }

View File

@@ -38,7 +38,6 @@ export const set69Code = barCode => {
let barCode1 = barCode; let barCode1 = barCode;
let barCodeClone = barCode1 ? barCode1.replace(/\s/g, "") : barCode1; let barCodeClone = barCode1 ? barCode1.replace(/\s/g, "") : barCode1;
if (barCodeClone && barCodeClone.length === 13 && barCodeClone !== " ") { if (barCodeClone && barCodeClone.length === 13 && barCodeClone !== " ") {
console.log("走到了这里吗?");
barCodeClone = Number(barCodeClone); barCodeClone = Number(barCodeClone);
if (!isNaN(barCodeClone)) { if (!isNaN(barCodeClone)) {
// 创建一个canvas // 创建一个canvas

View File

@@ -27,7 +27,6 @@ export const boxMarkListPrint = (printData, printNumber) => {
LODOP.SET_PRINT_STYLE("FontSize", 9.3); LODOP.SET_PRINT_STYLE("FontSize", 9.3);
LODOP.SET_PRINT_STYLE("Bold", 1); LODOP.SET_PRINT_STYLE("Bold", 1);
LODOP.SET_PRINT_STYLE("FontName", "黑体"); LODOP.SET_PRINT_STYLE("FontName", "黑体");
let logs = []; let logs = [];
let printDataClone = []; let printDataClone = [];
let resultArray = []; let resultArray = [];
@@ -110,6 +109,7 @@ function AddPrintContent(obj) {
LODOP.SET_PRINT_STYLEA(0, "LineSpacing", -5); LODOP.SET_PRINT_STYLEA(0, "LineSpacing", -5);
//防止文字未满进行换行 //防止文字未满进行换行
LODOP.SET_PRINT_STYLEA(0, "TextNeatRow", 1); LODOP.SET_PRINT_STYLEA(0, "TextNeatRow", 1);
LODOP.SET_PRINT_STYLEA(0, "FontName", "Times New Roman");
} }
} else { } else {
if (specifications.length > 25) { if (specifications.length > 25) {
@@ -119,12 +119,14 @@ function AddPrintContent(obj) {
//防止文字未满进行换行 //防止文字未满进行换行
LODOP.SET_PRINT_STYLEA(0, "TextNeatRow", 1); LODOP.SET_PRINT_STYLEA(0, "TextNeatRow", 1);
LODOP.SET_PRINT_STYLEA(0, "LineSpacing", -5); LODOP.SET_PRINT_STYLEA(0, "LineSpacing", -5);
LODOP.SET_PRINT_STYLEA(0, "FontName", "Times New Roman");
} else { } else {
LODOP.ADD_PRINT_TEXT(8, 8, "20mm", "10mm", "产品型号:"); LODOP.ADD_PRINT_TEXT(8, 8, "20mm", "10mm", "产品型号:");
LODOP.ADD_PRINT_TEXT(8, 64, "45mm", "100%", `${specifications}`); LODOP.ADD_PRINT_TEXT(8, 64, "45mm", "100%", `${specifications}`);
//防止文字未满进行换行 //防止文字未满进行换行
LODOP.SET_PRINT_STYLEA(0, "TextNeatRow", 1); LODOP.SET_PRINT_STYLEA(0, "TextNeatRow", 1);
LODOP.SET_PRINT_STYLEA(0, "LineSpacing", -5); LODOP.SET_PRINT_STYLEA(0, "LineSpacing", -5);
LODOP.SET_PRINT_STYLEA(0, "FontName", "Times New Roman");
} }
} }
logStr = `规格型号${specifications}`; logStr = `规格型号${specifications}`;
@@ -167,13 +169,13 @@ function AddPrintContent(obj) {
let str3 = str.substring(7, 14); let str3 = str.substring(7, 14);
//224 //224
LODOP.ADD_PRINT_TEXT(130, 231, "10mm", "10mm", `${str1}`); LODOP.ADD_PRINT_TEXT(130, 231, "10mm", "10mm", `${str1}`);
LODOP.SET_PRINT_STYLEA(0, "FontName", "SourceHanSansCN-Bold"); LODOP.SET_PRINT_STYLEA(0, "FontName", "");
//238 //238
LODOP.ADD_PRINT_TEXT(130, 245, "15mm", "10mm", `${str2}`); LODOP.ADD_PRINT_TEXT(130, 245, "15mm", "10mm", `${str2}`);
LODOP.SET_PRINT_STYLEA(0, "FontName", "SourceHanSansCN-Bold"); LODOP.SET_PRINT_STYLEA(0, "FontName", "");
//283 //283
LODOP.ADD_PRINT_TEXT(130, 290, "15mm", "10mm", `${str3}`); LODOP.ADD_PRINT_TEXT(130, 290, "15mm", "10mm", `${str3}`);
LODOP.SET_PRINT_STYLEA(0, "FontName", "SourceHanSansCN-Bold"); LODOP.SET_PRINT_STYLEA(0, "FontName", "");
} }
} }
@@ -183,6 +185,7 @@ function AddPrintContent(obj) {
LODOP.ADD_PRINT_TEXT(37, 64, "45mm", 20, `${materialName}`); LODOP.ADD_PRINT_TEXT(37, 64, "45mm", 20, `${materialName}`);
LODOP.SET_PRINT_STYLEA(0, "TextOverflow", 2); LODOP.SET_PRINT_STYLEA(0, "TextOverflow", 2);
LODOP.SET_PRINT_STYLEA(0, "LineSpacing", -4); LODOP.SET_PRINT_STYLEA(0, "LineSpacing", -4);
LODOP.SET_PRINT_STYLEA(0, "FontName", "黑体");
} }
//二维码 //二维码

View File

@@ -452,7 +452,21 @@ const handleFilesChange = (file: any) => {
const worksheet: any = workbook.Sheets[sheetName]; const worksheet: any = workbook.Sheets[sheetName];
const jsonData: any = utils.sheet_to_json(worksheet); const jsonData: any = utils.sheet_to_json(worksheet);
datas.jsonData = jsonData; datas.jsonData = jsonData;
if (!datas.jsonData.length) {
return;
}
//大于1000只能是1000
datas.jsonData.forEach((item: any) => {
if (item["生成数量*"] > 1000) {
item["生成数量*"] = 1000;
}
});
//过滤为0的
datas.jsonData = datas.jsonData.filter((item: any) => {
return item["生成数量*"] > 0;
});
}; };
//进度条(假的,产品要进度条!),将文件上传到本地是很快的 //进度条(假的,产品要进度条!),将文件上传到本地是很快的
reader.onprogress = (e: any) => { reader.onprogress = (e: any) => {
if (e.lengthComputable) { if (e.lengthComputable) {
@@ -734,6 +748,7 @@ const getSerialNumberDownLoad = async () => {
return; return;
} }
let serialNumbers: any[] = []; let serialNumbers: any[] = [];
let isTwo = datas.codePrintSelectionList[0].isTwo;
datas.codePrintSelectionList.forEach((item: any) => { datas.codePrintSelectionList.forEach((item: any) => {
serialNumbers.push(item.serialNumber); serialNumbers.push(item.serialNumber);
}); });
@@ -742,7 +757,8 @@ const getSerialNumberDownLoad = async () => {
const result = await getSerialNumberDownLoadApi({ const result = await getSerialNumberDownLoadApi({
orgCode, orgCode,
serialNumbers, serialNumbers,
generateRecordId generateRecordId,
isTwo
}); });
if (result.status === 200 && result.isSuccess) { if (result.status === 200 && result.isSuccess) {
useMsg("success", "导出成功请前往导出列表中进行下载 "); useMsg("success", "导出成功请前往导出列表中进行下载 ");

View File

@@ -100,7 +100,7 @@ export const handleBtnClick = (result: any, datas: any, proTable: any) => {
if (type === "Generate") { if (type === "Generate") {
datas.generateCodeVisible = true; datas.generateCodeVisible = true;
} }
if (type === "Refresh") { if (type === "Refresh" || type === "Convert") {
proTable!.value.getTableList(); proTable!.value.getTableList();
} }
if (type === "Generates") { if (type === "Generates") {