修正調整很多東西

This commit is contained in:
2026-07-09 17:48:47 +08:00
parent 8d8cf9fed4
commit eeed2c8651
22 changed files with 825 additions and 66 deletions
+64 -10
View File
@@ -234,6 +234,7 @@
},
async getData() {
let list = localStorage.getItem("list")
let param = [];
let data = JSON.parse(list)
data.forEach(x => {
@@ -245,7 +246,15 @@
if (response.status == 200) {
this.printData = response.data;
//console.log("printData:",this.printData);
this.printData.sort(function (a,b) {
if (a.print_id < b.print_id) {
return -1
} else if (a.print_id > b.print_id) {
return 1
}
return 0
});
//this.render();
//this.print();
}
@@ -278,10 +287,18 @@
//包含空白用來折的尺寸
let printSize = self.allSize.find(y => y.paperID == style.printSize);
//用長根寬算出一張紙可以印幾張
let xCount = parseFloat(pageSize.width) / parseFloat(printSize.width);
let yCount = parseFloat(pageSize.height) / parseFloat(printSize.height);
let total = Math.floor(xCount) * Math.floor(yCount);
let xCount = 1;
let yCount = 1;
let total = 1;
if (style.printMode === "combine") {
//用長根寬算出一張紙可以印幾張
xCount=parseFloat(pageSize.width) / parseFloat(size.width);
yCount=parseFloat(pageSize.height) / parseFloat(size.height);
total=Math.floor(xCount) * Math.floor(yCount);
}
console.log("xCount,yCount:",xCount,yCount)
//if ((nowPageWidth + parseFloat(printSize.width)) > pageSize.width) {
if (nowPageWidth >= total) {
//$(canvas).css("width", printSize.width + "mm");
@@ -295,7 +312,7 @@
nowPageWidth = 0;
}
nowPageWidth = nowPageWidth + 1; //parseFloat(printSize.width);
tabletpaper = $(` <div class="tablet-paper">
tabletpaper = $(` <div class="tablet-paper" style="margin-top:2mm">
</div>`)
let img = self.bg.find(y => y.name == style.backendImg);
/*tabletpaper.css({
@@ -435,9 +452,9 @@
}
})
let content = $(`<div class="tablet-element "></div>`)
let content = $(`<div class="tablet-element print_id "></div>`)
.css({
position: "absolute", left: "4mm", top: "2mm", fontSize: '12px',
position: "absolute", left: "1mm", top: "4mm", fontSize: '12px',
"z-index": 9999,
"align-items": "center"
@@ -736,10 +753,35 @@
//$("#textBreakWord").prop("readonly", true);
$("#textWidth").prop("readonly", true);
$("#textHeight").prop("readonly", true);
} else if ($(parentElement).hasClass("print_id") ){
$("#textX").prop("readonly", false);
$("#textY").prop("readonly", false);
$("#fontSize").prop("readonly", false);
$("#textWidth").prop("readonly", false);
$("#textHeight").prop("readonly", false);
$("#textBreakCount").prop("readonly", true);
$("#textBreakWord").prop("readonly", true);
}
});
//$(".tablet-element .print_id").on("click", function (e) {
// let left = $(this).css("left");
// let top = $(this).css("top");
// left = left.replace("px", "");
// top = top.replace("px", "");
// $("#textX").val(self.fix2(left * 0.265));
// $("#textY").val(self.fix2(top * 0.265));
// $("#textX").prop("readonly", false);
// $("#textY").prop("readonly", false);
// $("#fontSize").prop("readonly", false);
// $("#textWidth").prop("readonly", false);
// $("#textHeight").prop("readonly", false);
// $("#textBreakCount").prop("readonly", true);
// $("#textBreakWord").prop("readonly", true);
//});
$(".tablet-element .rosterspan").on("click", function (e) {
$("#toast_body").html("此格式不提供單項物件修改");
self.toast.show();
@@ -826,7 +868,7 @@
renderNormal(mid, d) {
//sconsole.log("renderNormal:", d)
let self = this;
let txt = $(`<div class='${d.elementID}'>${mid}</div>`).css({
let txt = $(`<div class='${d.elementID}'>${mid==undefined?"":mid}</div>`).css({
"z-index": 9999, visibility: d.visibility,
width: d.width, height: d.height
});
@@ -889,17 +931,24 @@
},
async changeSetup(config) {
let classList = ["liveList", "nameList", "address", "ancestor-wrapper", "lefttitle", "righttitle", "rosterList"]
let classList = ["liveList", "nameList", "address", "ancestor-wrapper", "lefttitle", "righttitle", "rosterList", "print_id"]
console.log("changeSetup:",config);
switch (config) {
case "X":
if ($("#indivualSetup").prop("checked")) {
$(this.selected).css("left", $("#textX").val() + "mm");
} else if ($("#allSetup").prop("checked")) {
classList.forEach(w => {
if ($(this.selected.children()).first().hasClass(w)) {
$(`.${w}`).parent().each((index, y) => {
$(y).css("left", $("#textX").val() + "mm")
})
} else if ($(this.selected.hasClass(w))) {
console.log("QQ:",w,config);
$(`.${w}`).each((index, y) => {
$(y).css("left", $("#textX").val() + "mm")
})
}
});
}
@@ -913,6 +962,11 @@
$(`.${w}`).parent().each((index, y) => {
$(y).css("top", $("#textY").val() + "mm")
})
} else if ($(this.selected.hasClass(w))) {
console.log("QQ:", w, config);
$(`.${w}`).each((index, y) => {
$(y).css("top", $("#textY").val() + "mm")
})
}
});