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
const buttonConfig = reactive({ autoInsertSpace: false });
</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
export {}
declare global {
const EffectScope: typeof import('vue')['EffectScope']
const computed: typeof import('vue')['computed']
const createApp: typeof import('vue')['createApp']
const customRef: typeof import('vue')['customRef']
const defineAsyncComponent: typeof import('vue')['defineAsyncComponent']
const defineComponent: typeof import('vue')['defineComponent']
const effectScope: typeof import('vue')['effectScope']
const getCurrentInstance: typeof import('vue')['getCurrentInstance']
const getCurrentScope: typeof import('vue')['getCurrentScope']
const h: typeof import('vue')['h']
const inject: typeof import('vue')['inject']
const isProxy: typeof import('vue')['isProxy']
const isReactive: typeof import('vue')['isReactive']
const isReadonly: typeof import('vue')['isReadonly']
const isRef: typeof import('vue')['isRef']
const markRaw: typeof import('vue')['markRaw']
const nextTick: typeof import('vue')['nextTick']
const onActivated: typeof import('vue')['onActivated']
const onBeforeMount: typeof import('vue')['onBeforeMount']
const onBeforeRouteLeave: typeof import('vue-router')['onBeforeRouteLeave']
const onBeforeRouteUpdate: typeof import('vue-router')['onBeforeRouteUpdate']
const onBeforeUnmount: typeof import('vue')['onBeforeUnmount']
const onBeforeUpdate: typeof import('vue')['onBeforeUpdate']
const onDeactivated: typeof import('vue')['onDeactivated']
const onErrorCaptured: typeof import('vue')['onErrorCaptured']
const onMounted: typeof import('vue')['onMounted']
const onRenderTracked: typeof import('vue')['onRenderTracked']
const onRenderTriggered: typeof import('vue')['onRenderTriggered']
const onScopeDispose: typeof import('vue')['onScopeDispose']
const onServerPrefetch: typeof import('vue')['onServerPrefetch']
const onUnmounted: typeof import('vue')['onUnmounted']
const onUpdated: typeof import('vue')['onUpdated']
const provide: typeof import('vue')['provide']
const reactive: typeof import('vue')['reactive']
const readonly: typeof import('vue')['readonly']
const ref: typeof import('vue')['ref']
const resolveComponent: typeof import('vue')['resolveComponent']
const shallowReactive: typeof import('vue')['shallowReactive']
const shallowReadonly: typeof import('vue')['shallowReadonly']
const shallowRef: typeof import('vue')['shallowRef']
const toRaw: typeof import('vue')['toRaw']
const toRef: typeof import('vue')['toRef']
const toRefs: typeof import('vue')['toRefs']
const toValue: typeof import('vue')['toValue']
const triggerRef: typeof import('vue')['triggerRef']
const unref: typeof import('vue')['unref']
const useAttrs: typeof import('vue')['useAttrs']
const useCssModule: typeof import('vue')['useCssModule']
const useCssVars: typeof import('vue')['useCssVars']
const useLink: typeof import('vue-router')['useLink']
const useRoute: typeof import('vue-router')['useRoute']
const useRouter: typeof import('vue-router')['useRouter']
const useSlots: typeof import('vue')['useSlots']
const watch: typeof import('vue')['watch']
const watchEffect: typeof import('vue')['watchEffect']
const watchPostEffect: typeof import('vue')['watchPostEffect']
const watchSyncEffect: typeof import('vue')['watchSyncEffect']
const EffectScope: typeof import("vue")["EffectScope"];
const ElMessageBox: typeof import("element-plus/es")["ElMessageBox"];
const computed: typeof import("vue")["computed"];
const createApp: typeof import("vue")["createApp"];
const customRef: typeof import("vue")["customRef"];
const defineAsyncComponent: typeof import("vue")["defineAsyncComponent"];
const defineComponent: typeof import("vue")["defineComponent"];
const effectScope: typeof import("vue")["effectScope"];
const getCurrentInstance: typeof import("vue")["getCurrentInstance"];
const getCurrentScope: typeof import("vue")["getCurrentScope"];
const h: typeof import("vue")["h"];
const inject: typeof import("vue")["inject"];
const isProxy: typeof import("vue")["isProxy"];
const isReactive: typeof import("vue")["isReactive"];
const isReadonly: typeof import("vue")["isReadonly"];
const isRef: typeof import("vue")["isRef"];
const markRaw: typeof import("vue")["markRaw"];
const nextTick: typeof import("vue")["nextTick"];
const onActivated: typeof import("vue")["onActivated"];
const onBeforeMount: typeof import("vue")["onBeforeMount"];
const onBeforeRouteLeave: typeof import("vue-router")["onBeforeRouteLeave"];
const onBeforeRouteUpdate: typeof import("vue-router")["onBeforeRouteUpdate"];
const onBeforeUnmount: typeof import("vue")["onBeforeUnmount"];
const onBeforeUpdate: typeof import("vue")["onBeforeUpdate"];
const onDeactivated: typeof import("vue")["onDeactivated"];
const onErrorCaptured: typeof import("vue")["onErrorCaptured"];
const onMounted: typeof import("vue")["onMounted"];
const onRenderTracked: typeof import("vue")["onRenderTracked"];
const onRenderTriggered: typeof import("vue")["onRenderTriggered"];
const onScopeDispose: typeof import("vue")["onScopeDispose"];
const onServerPrefetch: typeof import("vue")["onServerPrefetch"];
const onUnmounted: typeof import("vue")["onUnmounted"];
const onUpdated: typeof import("vue")["onUpdated"];
const provide: typeof import("vue")["provide"];
const reactive: typeof import("vue")["reactive"];
const readonly: typeof import("vue")["readonly"];
const ref: typeof import("vue")["ref"];
const resolveComponent: typeof import("vue")["resolveComponent"];
const shallowReactive: typeof import("vue")["shallowReactive"];
const shallowReadonly: typeof import("vue")["shallowReadonly"];
const shallowRef: typeof import("vue")["shallowRef"];
const toRaw: typeof import("vue")["toRaw"];
const toRef: typeof import("vue")["toRef"];
const toRefs: typeof import("vue")["toRefs"];
const toValue: typeof import("vue")["toValue"];
const triggerRef: typeof import("vue")["triggerRef"];
const unref: typeof import("vue")["unref"];
const useAttrs: typeof import("vue")["useAttrs"];
const useCssModule: typeof import("vue")["useCssModule"];
const useCssVars: typeof import("vue")["useCssVars"];
const useLink: typeof import("vue-router")["useLink"];
const useRoute: typeof import("vue-router")["useRoute"];
const useRouter: typeof import("vue-router")["useRouter"];
const useSlots: typeof import("vue")["useSlots"];
const watch: typeof import("vue")["watch"];
const watchEffect: typeof import("vue")["watchEffect"];
const watchPostEffect: typeof import("vue")["watchPostEffect"];
const watchSyncEffect: typeof import("vue")["watchSyncEffect"];
}
// for type re-export
declare global {
// @ts-ignore
export type { Component, ComponentPublicInstance, ComputedRef, InjectionKey, PropType, Ref, VNode } from 'vue'
// @ts-ignore
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"];
Add: typeof import("./components/DetailsBtns/components/Add.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"];
DetailsBtns: typeof import("./components/DetailsBtns/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", "请选择要下载的数据 !");
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) => {
ids.push(item.id);
});
const result = await operationButtonsApi(URLS[name.value], { ids });
let params: any = {
antiCode: { ids },
barCode: { ids, isTwo }
};
const result = await operationButtonsApi(URLS[name.value], params[name.value]);
if (result.status === 200 && result.isSuccess) {
useMsg("success", "导出成功请前往导出列表中进行下载 ");
} else {

View File

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

View File

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

View File

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

View File

@@ -27,7 +27,6 @@ export const boxMarkListPrint = (printData, printNumber) => {
LODOP.SET_PRINT_STYLE("FontSize", 9.3);
LODOP.SET_PRINT_STYLE("Bold", 1);
LODOP.SET_PRINT_STYLE("FontName", "黑体");
let logs = [];
let printDataClone = [];
let resultArray = [];
@@ -110,6 +109,7 @@ function AddPrintContent(obj) {
LODOP.SET_PRINT_STYLEA(0, "LineSpacing", -5);
//防止文字未满进行换行
LODOP.SET_PRINT_STYLEA(0, "TextNeatRow", 1);
LODOP.SET_PRINT_STYLEA(0, "FontName", "Times New Roman");
}
} else {
if (specifications.length > 25) {
@@ -119,12 +119,14 @@ function AddPrintContent(obj) {
//防止文字未满进行换行
LODOP.SET_PRINT_STYLEA(0, "TextNeatRow", 1);
LODOP.SET_PRINT_STYLEA(0, "LineSpacing", -5);
LODOP.SET_PRINT_STYLEA(0, "FontName", "Times New Roman");
} else {
LODOP.ADD_PRINT_TEXT(8, 8, "20mm", "10mm", "产品型号:");
LODOP.ADD_PRINT_TEXT(8, 64, "45mm", "100%", `${specifications}`);
//防止文字未满进行换行
LODOP.SET_PRINT_STYLEA(0, "TextNeatRow", 1);
LODOP.SET_PRINT_STYLEA(0, "LineSpacing", -5);
LODOP.SET_PRINT_STYLEA(0, "FontName", "Times New Roman");
}
}
logStr = `规格型号${specifications}`;
@@ -167,13 +169,13 @@ function AddPrintContent(obj) {
let str3 = str.substring(7, 14);
//224
LODOP.ADD_PRINT_TEXT(130, 231, "10mm", "10mm", `${str1}`);
LODOP.SET_PRINT_STYLEA(0, "FontName", "SourceHanSansCN-Bold");
LODOP.SET_PRINT_STYLEA(0, "FontName", "");
//238
LODOP.ADD_PRINT_TEXT(130, 245, "15mm", "10mm", `${str2}`);
LODOP.SET_PRINT_STYLEA(0, "FontName", "SourceHanSansCN-Bold");
LODOP.SET_PRINT_STYLEA(0, "FontName", "");
//283
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.SET_PRINT_STYLEA(0, "TextOverflow", 2);
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 jsonData: any = utils.sheet_to_json(worksheet);
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) => {
if (e.lengthComputable) {
@@ -734,6 +748,7 @@ const getSerialNumberDownLoad = async () => {
return;
}
let serialNumbers: any[] = [];
let isTwo = datas.codePrintSelectionList[0].isTwo;
datas.codePrintSelectionList.forEach((item: any) => {
serialNumbers.push(item.serialNumber);
});
@@ -742,7 +757,8 @@ const getSerialNumberDownLoad = async () => {
const result = await getSerialNumberDownLoadApi({
orgCode,
serialNumbers,
generateRecordId
generateRecordId,
isTwo
});
if (result.status === 200 && result.isSuccess) {
useMsg("success", "导出成功请前往导出列表中进行下载 ");

View File

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