`;
@@ -878,8 +878,8 @@
else if (key === '2offset') el.twoOffset = parseFloat(val);
else if (key === '3offset') el.threeOffset = parseFloat(val);
else if (key === '4offset') el.fourOffset = parseFloat(val);
+ else if (key === 'height') el.height = parseFloat(val);
else el[key] = val;
- console.log("activeId:",this.activeId)
if (el.type == "roster") {
const names = el.text.split('\n').filter(s => s.trim());
@@ -887,13 +887,18 @@
position: "absolute", left: el.startX + "mm", top: el.startY + "mm", fontSize: el.style.fontSize + 'pt', fontFamily: el.fontFamily, "z-index": 9999, visibility: el.style.isActive
}).html(this.renderRoster(names.slice(0 * this.rosterLimit, (0 + 1) * this.rosterLimit), el));
} else if (el.type == "combined-center") {
+ console.log("combined-center");
+
const parts = el.text.split('\n');
- html = `
+ html = `
${parts[0] || ''}
${parts[1] || ''}
`;
$(`.tablet-element[id="${this.activeId}"]`).css({
- position: "absolute", left: el.startX + "mm", top: el.startY + "mm", fontSize: el.style.fontSize + 'pt', fontFamily: el.fontFamily, "z-index": 9999, visibility: el.style.isActive
+ position: "absolute", left: el.startX + "mm", top: el.startY + "mm",
+ fontSize: el.style.fontSize + 'pt', fontFamily: el.fontFamily,
+ "z-index": 9999, visibility: el.style.isActive,
+
}).html(html);
} else if (this.activeId === "title1") {
let names = el.text.split('\n').filter(s => s.trim());
diff --git a/web/admin/item/css/tablet-design.css b/web/admin/item/css/tablet-design.css
index dbdf9eb..dcc5b5e 100644
--- a/web/admin/item/css/tablet-design.css
+++ b/web/admin/item/css/tablet-design.css
@@ -232,7 +232,7 @@
display: flex;
flex-direction: column;
align-items: center; /* 水平置中 */
- justify-content: center;
+ justify-content: flex-start;
width: fit-content;
}
diff --git a/web/admin/order/reg.aspx b/web/admin/order/reg.aspx
index fe1c0cd..a57b26d 100644
--- a/web/admin/order/reg.aspx
+++ b/web/admin/order/reg.aspx
@@ -464,6 +464,11 @@
initialized: false,
currentItem: {}
},
+ tablet_edit_new: {
+ show: false,
+ initialized: false,
+ currentItem: {}
+ },
//收款註記
cash_dialog: {
show: false,
@@ -547,6 +552,7 @@
// 關閉編輯對話框
this.tablet_edit.show = false;
+ thiw.tablet_edit_new.show = false;
// 顯示成功訊息
this.snackbar.text = '牌位資料已更新';
@@ -561,6 +567,13 @@
this.tablet_edit.initialized = true;
};
}
+
+ const iframe1 = document.querySelector('iframe#tablet_edit_new_iframe');
+ if (iframe1) {
+ iframe1.onload = () => {
+ this.tablet_edit_new.initialized = true;
+ };
+ }
},
watch: {
options: {
@@ -577,6 +590,14 @@
}
}
},
+ 'tablet_edit_new.show': {
+ handler(newVal) {
+ if (!newVal && this._savedEditedItem) {
+ this.editedItem = $.extend(true, {}, this._savedEditedItem);
+ this._savedEditedItem = null;
+ }
+ }
+ },
optionsDetail: {
handler() {
this.initialize();
@@ -819,6 +840,32 @@
this.editedItem = $.extend(true, {}, item);
this.file_dialog.show = true;
},
+ async editTabletNew(item) {
+ this.editedIndex = this.desserts.indexOf(item);
+ this.editedItem = $.extend(true, {}, item);
+
+ try {
+ // 如果是新項目,先保存
+ if (this.editedItem.num <= 0 || this.editedItem.num === null || this.editedItem.num === undefined) {
+ this.editedItem.qty = 1;
+ const savedItem = await this.save(false);
+ if (savedItem) {
+ this.$set(this.desserts, this.editedIndex, savedItem);
+ this.editedItem = $.extend(true, {}, savedItem);
+ }
+ }
+ // 先發送消息
+ await this.sendMessageToIframeNew();
+ // 保存當前的 editedItem 數據
+ const currentData = $.extend(true, {}, this.editedItem);
+ // 顯示對話框
+ this.tablet_edit_new.show = true;
+ // 立即恢復數據
+ this.editedItem = $.extend(true, {}, currentData);
+ } catch (error) {
+ console.error('Error in editTablet:', error);
+ }
+ },
async editTablet(item) {
this.editedIndex = this.desserts.indexOf(item);
this.editedItem = $.extend(true, {}, item);
@@ -845,6 +892,52 @@
console.error('Error in editTablet:', error);
}
},
+ async sendMessageToIframeNew() {
+ const iframe = document.querySelector('iframe#tablet_edit_new_iframe');
+
+ // 在這裡深度複製 editedItem,確保數據不會被修改
+ const itemToSend = $.extend(true, {}, this.editedItem);
+
+ if (iframe) {
+ try {
+ // 準備要發送的數據
+ let familyMembers = [];
+
+ try {
+ // 嘗試獲取家族成員數據
+ const response = await axios.get(HTTP_HOST + 'api/familymembers/follower/' + this.follower_id);
+ familyMembers = response.data;
+ } catch (error) {
+ console.warn('error:', error);
+ }
+
+ // 準備發送的數據
+ const itemInfo = {
+ source: 'order.btn.click',
+ tabletItem: {
+ ...itemToSend,
+ title: this.titleword() // 確保標題被包含
+ },
+ familyMembers: familyMembers
+ };
+
+ iframe.contentWindow.postMessage(itemInfo, '*');
+
+ // 發送後確認數據完整性
+
+ // 如果數據被清除,立即恢復
+ if (!this.editedItem.num && itemToSend.num) {
+ this.$nextTick(() => {
+ this.editedItem = $.extend(true, {}, itemToSend);
+ });
+ }
+ } catch (error) {
+ console.error('Error in sendMessageToIframe:', error);
+ }
+ } else {
+ console.error('iframe not found');
+ }
+ },
async sendMessageToIframe() {
const iframe = document.querySelector('iframe#tablet_edit_iframe');
@@ -2001,7 +2094,10 @@
mdi-file-document-edit-outline
-
+
+
+ mdi-file-document-edit-outline
+
mdi-printer
@@ -2569,6 +2665,17 @@
+
+
+
+ 編輯牌位 : {{editedItem.actitem_num_selected.text}} - {{editedItem.print_id}}
+ mdi-close
+
+
+
+
+
+
diff --git a/web/admin/print/print_multi_new.aspx b/web/admin/print/print_multi_new.aspx
index 75281f3..74461b1 100644
--- a/web/admin/print/print_multi_new.aspx
+++ b/web/admin/print/print_multi_new.aspx
@@ -260,7 +260,6 @@
let pageSize = self.allSize.find(y => y.paperID == $("#paperSizeSel").val());
this.printData.forEach(x => {
- console.log("x:", x)
let style = self.allStyle.find(y => y.styleID == x.style);
//用來印內容的尺寸
let size = self.allSize.find(y => y.paperID == style.paperSize);
@@ -271,7 +270,6 @@
let xCount = parseFloat(pageSize.width) / parseFloat(printSize.width);
let yCount = parseFloat(pageSize.height) / parseFloat(printSize.height);
let total = Math.floor(xCount) * Math.floor(yCount);
- console.log(xCount, yCount, total);
//if ((nowPageWidth + parseFloat(printSize.width)) > pageSize.width) {
if (nowPageWidth >= total) {
//$(canvas).css("width", printSize.width + "mm");
@@ -305,7 +303,6 @@
let left_items = tablet.left_items;
let details = this.allStyleDetails.filter(y => y.styleID == x.style);
- console.log("details:", details);
let mid = [];
mid_items.forEach(y => {
mid.push(y.fam_name);
@@ -316,7 +313,7 @@
left.push(y.fam_name);
});
}
-
+ let ancestorFontSize = 16;
details.forEach(d => {
if (d.isActive != "hidden") {
let newFontSize = self.scaleFontSize(mid, d.fontSize, d.width);
@@ -347,7 +344,6 @@
mid.forEach(z => {
let info = self.getTextInfo(z, newFontSize);
let spanWidth = mid.length > 1 ? newFontSize : d.width
- console.log("spanWidth:", spanWidth);
let height = d.textHeight;
if (info.width >= d.textHeight) {
height = d.height;
@@ -363,6 +359,7 @@
"margin-bottom": "20px",
"margin-left": "5px",
"text-justify": "inter-character",
+ "white-space": "pre-line",
//"justify-content":"center"
});
$namelist.append($span);
@@ -375,6 +372,13 @@
newFontSize = d.fontSize;
} else if (d.elementID === "titletriangle") {
html = self.renderRoster(mid, d)
+ } else if (d.elementID === "combined") {
+ ancestorFontSize = d.fontSize;
+ const parts =mid.join("\n").split('\n');
+ html = `
+ ${parts[0] || ''}
+ ${parts[1] || ''}
+
`;
}
if (newFontSize < 10) {
newFontSize = 10;
@@ -520,7 +524,7 @@
display: flex;
flex-direction: column;
align-items: center; /* 水平置中 */
- justify-content: center;
+ justify-content: felx-start;
width: fit-content;
}
@@ -530,7 +534,7 @@
}
.sub-text {
- font-size: 0.6em; /* 縮小字體 */
+ font-size: ${ancestorFontSize}px ;/*0.8em;*/ /* 縮小字體 */
line-height: 1.2;
margin-top: 4px; /* 與上方林張的間距 */
white-space: normal; /* 避免自動換行 */
@@ -613,16 +617,18 @@
let textWidth;//= $(this).css("width");//find("span").first().css("width");
let textHeight; //= $(this).css("height");
-
- if ($(this).find(".nameList").first()) {
+ if ($(this).find(".nameList").first().hasClass("nameList")) {
textWidth = $(this).find(".nameList").first().css("width");
textHeight = $(this).find(".nameList").first().css("height");
- } else if ($(this).find(".liveList").first()) {
+ } else if ($(this).find(".liveList").first().hasClass("liveList")) {
textWidth = $(this).find(".liveList").first().css("width");
textHeight = $(this).find(".liveList").first().css("height");
- } else if ($(this).find(".rosterList").first()) {
+ } else if ($(this).find(".rosterList").first().hasClass("rosterList")) {
textWidth = $(this).find(".rosterList").first().css("width");
textHeight = $(this).find(".rosterList").first().css("height");
+ } else if ($(this).find(".ancestor-wrapper").first().hasClass("ancestor-wrapper")) {
+ textWidth = $(this).find(".ancestor-wrapper").first().css("width");
+ textHeight = $(this).find(".ancestor-wrapper").first().css("height");
}
let left = $(this).css("left");
@@ -638,6 +644,10 @@
$("#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 span").on("click", function (e) {
@@ -647,6 +657,13 @@
let fontFamily = $(this).css("font-family");
let textWidth = $(this).css("max-width");
let textHeight = $(this).css("min-height");
+ if ($(this).hasClass("liveSpan")) {
+ textWidth = $(this).css("width");
+ } else if ($(this).hasClass("main-name") || $(this).hasClass("sub-text")) {
+ textWidth = "";
+ textHeight = "";
+ }
+
let left = $(this).css("left");
let top = $(this).css("top");
left = left.replace("px", "");
@@ -661,6 +678,16 @@
$("#textX").prop("readonly", true);
$("#textY").prop("readonly", true);
$("#fontSize").prop("readonly", true);
+ $("#textBreakCount").prop("readonly", false);
+ $("#textBreakWord").prop("readonly", false);
+ } else if ($(this).hasClass("main-name") || $(this).hasClass("sub-text")) {
+ $("#textX").prop("readonly", true);
+ $("#textY").prop("readonly", true);
+ $("#fontSize").prop("readonly", true);
+ $("#textBreakCount").prop("readonly", true);
+ $("#textBreakWord").prop("readonly", true);
+ $("#textWidth").prop("readonly", true);
+ $("#textHeight").prop("readonly", true);
}
});
@@ -704,6 +731,7 @@
"text-align-last": "justify",
"margin-bottom": "10px",
"text-justify": "inter-character",
+ "white-space": "pre-line"
});
},
// 品字佈局邏輯:一上二下
@@ -734,6 +762,7 @@
"flex-direction": "column",
"justify-content": "center",
"height": el.textHeight,
+ "white-space": "pre-line"
})
items.forEach(x => {
g.append($(`${x}
`))
@@ -782,7 +811,6 @@
//if (dStyle.elementID === 'title1') {//表示是一般正名,也就是牌位正中間的一般格式,排法是上下上下
if ((Math.ceil(txtContent.length / 2) * font.width) * 2 > parseFloat(elementWidth)) {
let newfontSize = parseInt(fontSize) - 1;
- console.log("newfontSize:", newfontSize);
if (newfontSize <= 8) {
return newfontSize;
}
@@ -836,7 +864,7 @@
} else if (this.selected.hasClass("liveSpan")) {
let spans = $(this.selected.parent().first()).find(".liveSpan");
spans.each(function (index, x) {
- $(x).css("max-width", $("#textWidth").val());
+ $(x).css("width", $("#textWidth").val());
});
} else if (this.selected.hasClass("rosterSpan")) {
let spans = $(this.selected.parent().first()).find(".rosterSpan");
@@ -860,13 +888,13 @@
} else if (this.selected.hasClass("nameSpan")) {
let spans = $(this.selected.parent().first()).find(".nameSpan");
spans.each(function (index, x) {
- console.log($(x))
$(x).css("min-height", $("#textHeight").val());
});
} else if (this.selected.hasClass("liveSpan")) {
let spans = $(this.selected.parent().first()).find(".liveSpan");
spans.each(function (index, x) {
$(x).css("min-height", $("#textHeight").val());
+ $(x).css("height", $("#textHeight").val());
});
} else if (this.selected.hasClass("rosterSpan")) {
let spans = $(this.selected.parent().first()).find(".rosterSpan");
diff --git a/web/admin/print/tablet_edit/editorNewOne.html b/web/admin/print/tablet_edit/editorNewOne.html
new file mode 100644
index 0000000..a7161f5
--- /dev/null
+++ b/web/admin/print/tablet_edit/editorNewOne.html
@@ -0,0 +1,835 @@
+
+
+
+
+
+ Document
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file