This commit is contained in:
2026-07-22 18:04:17 +08:00
parent 07c5027ad8
commit da58dc92d0
19 changed files with 2105 additions and 148 deletions
+1 -1
View File
@@ -170,7 +170,7 @@ public partial class admin_activity_item_reg : MyWeb.config
Model.actItem_files file=new Model.actItem_files();
file.actItem_num= _id;
file.files_num = 211;
file.file.reg_time=DateTime.Now;
file.reg_time=DateTime.Now;
_db.actItem_files.Add(file);
_db.SaveChanges();
Model.admin_log admin_log = new Model.admin_log();
+70 -29
View File
@@ -511,11 +511,11 @@
await axios
.post(HTTP_HOST + 'api/tablet/GetTabletElement', {})
.then(response => {
console.log(response)
//console.log(response)
//if (response.result=="Y") {
if (response.status == "200") {
let data = response.data;
console.log("data:",data)
//console.log("data:",data)
if (data.result == "Y") {
data.data.forEach(x => {
self.tabletElements.push(x);
@@ -826,9 +826,18 @@
createEl(el, slice) {
let html = '';
let fontSize = el.style.fontSize;
// 1. 智慧名單渲染
if (el.type === 'roster') {
html = this.renderRoster(slice, el);
let perRow = Math.floor(Number(el.height) / Number(el.textHeight));
let rows = Math.ceil(Number(slice.length) / Number(perRow));//總行數
let rowWidth = Math.floor(Number(el.width) / rows);
let fontSize = Math.floor(rowWidth / 2);
if (fontSize > el.style.fontSize) {
fontSize = el.style.fontSize;
rowWidth = fontSize * 2;
}
html = this.renderRoster(slice, el, rowWidth);
}
// 2. 正名合併置中
else if (el.type === 'combined-center') {
@@ -843,11 +852,27 @@
html = el.text.replace(/(\d+)/g, '<span class="tate-chu-yoko">$1</span>');
}
else if (el.id === 'title1') {
html = this.renderNameList(slice, el);
let perRow = Math.floor(Number(el.height) / Number(el.textHeight));
let rows = Math.ceil(Number(slice.length) / Number(perRow));//總行數
let rowWidth = Math.floor(Number(el.width) / rows);
fontSize = Math.floor(rowWidth / 2);
//console.log(el.height, el.textHeight, perRow, rows, rowWidth, fontSize)
if (fontSize > el.style.fontSize) {
fontSize = el.style.fontSize;
rowWidth = fontSize * 2;
}
html = this.renderNameList(slice, el, rowWidth);
}
else if (el.id === 'alive') {
console.log("createEl:",slice,el)
html = this.renderLiveList(slice, el);
let perRow = Math.floor(Number(el.height) / Number(el.textHeight));
let rows = Math.ceil(Number(slice.length) / Number(perRow));//總行數
let rowWidth = Math.floor(Number(el.width) / rows);
fontSize = Math.floor(rowWidth / 2);
if (fontSize > el.style.fontSize) {
fontSize = el.style.fontSize;
rowWidth = fontSize * 2;
}
html = this.renderLiveList(slice, el, rowWidth);
}
else {
html = el.text;
@@ -855,12 +880,12 @@
return $(`<div class="tablet-element vertical-text ${this.activeId === el.id ? 'selected' : ''}" id="${el.id}"></div>`)
.css({
position: "absolute", left: el.x + "mm", top: el.y + "mm", fontSize: el.style.fontSize + 'pt', fontFamily: el.style.fontFamily, "z-index": 9999, visibility: el.style.visibility
position: "absolute", left: el.x + "mm", top: el.y + "mm", fontSize: fontSize + 'pt', fontFamily: el.style.fontFamily, "z-index": 9999, visibility: el.style.visibility
//position: "absolute", left: el.startX + "mm", top: el.startY + "mm", fontSize: el.fontSize + 'pt', fontFamily: el.fontFamily, "z-index": 9999, visibility: el.isActive
})
.html(html);
},
renderNameList(names, el) {
renderNameList(names, el,rowWidth) {
let $namelist = $(`<div class='nameList'></div>`).css({
"writing-mode": "vertical rl",
display: "flex",
@@ -880,16 +905,16 @@
//"row-gap": "1px",
let self = this;
names.forEach(n => {
$namelist.append(self.renderNameSpan(n, el))
$namelist.append(self.renderNameSpan(n, el,rowWidth))
})
return $namelist;
},
renderNameSpan(name, el) {
renderNameSpan(name, el,rowWidth) {
return $(`<span>${name}</span>`).css({
display: "block",
"min-height": `${el.textHeight}px`,
"max-height": `${el.height}px`,
width: `${el.textWidth}px`,
width: `${rowWidth}px`,
"text-align": "justify",
"text-align-last": "justify",
@@ -897,8 +922,8 @@
"text-justify": "inter-character",
});// "margin-bottom": `${el.textSpan}px`,
},
renderLiveList(names, el) {
console.log("renderLiveList:",names);
renderLiveList(names, el,rowWidth) {
//console.log("renderLiveList:",names);
//$("#imp-text").updateActive("text",names)
let $namelist = $(`<div class='liveList'></div>`).css({
"writing-mode": "vertical rl",
@@ -919,18 +944,17 @@
//"row-gap": "1px",
let self = this;
names.forEach(n => {
$namelist.append(self.renderLiveSpan(n, el))
$namelist.append(self.renderLiveSpan(n, el,rowWidth))
})
return $namelist;
},
renderLiveSpan(name, el) {
console.log("renderLiveSpan:", name, el
);
renderLiveSpan(name, el, rowWidth) {
//console.log("renderLiveSpan:", name, el );
return $(`<span>${name}</span>`).css({
display: "block",
"min-height": `${el.textHeight}px`,
"max-height": `${el.height}px`,
width: `${el.textWidth}px`,
width: `${rowWidth}px`,
"text-align": "justify",
"text-align-last": "justify",
@@ -1000,9 +1024,9 @@
},
select(id) {
console.log("QQ:",id);
//console.log("QQ:",id);
this.activeId = id;
console.log("QQ:",this.elements);
//console.log("QQ:",this.elements);
const el = this.elements.find(x => x.id === id);
const el1 = this.elements.find(x => x.id === "titletriangle");
$('#attr-box').removeClass('d-none');
@@ -1024,7 +1048,7 @@
},
updateActive(key, val) {
console.log("updateActive:",key, val)
//console.log("updateActive:",key, val)
const el = this.elements.find(x => x.id === this.activeId);
if (key === 'fontSize') el.style.fontSize = parseFloat(val);
@@ -1042,7 +1066,7 @@
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");
//console.log("combined-center");
const parts = el.text.split('\n');
html = `<div class="ancestor-wrapper" style='width:${el.width}px !important;height:${el.height}px !important' >
@@ -1058,16 +1082,33 @@
} else if (this.activeId === "title1") {
let names = el.text.split('\n').filter(s => s.trim());
let slice = names.slice(0 * this.rosterLimit, (0 + 1) * this.rosterLimit);
html = this.renderNameList(slice, el);
let perRow = Math.floor(Number(el.height) / Number(el.textHeight));
let rows = Math.ceil(Number(slice.length) / Number(perRow));//總行數
let rowWidth = Math.floor(Number(el.width) / rows);
let fontSize = Math.floor(rowWidth / 2);
if (fontSize > el.style.fontSize) {
fontSize = el.style.fontSize;
rowWidth = fontSize * 2;
}
//console.log(el.height, el.textHeight, perRow, rows, rowWidth, fontSize)
html = this.renderNameList(slice, el, rowWidth);//el.style.fontSize
$(`.tablet-element[id="${this.activeId}"]`).css({
position: "absolute", left: el.x + "mm", top: el.y + "mm", fontSize: el.style.fontSize + 'pt', fontFamily: el.style.fontFamily, "z-index": 9999, visibility: el.style.visibility
position: "absolute", left: el.x + "mm", top: el.y + "mm", fontSize: fontSize + 'pt', fontFamily: el.style.fontFamily, "z-index": 9999, visibility: el.style.visibility
}).html(html);
} else if (this.activeId === "alive") {
let names = el.text.split('\n').filter(s => s.trim());
let slice = names.slice(0 * this.rosterLimit, (0 + 1) * this.rosterLimit);
html = this.renderLiveList(slice, el);
let perRow = Math.floor(Number(el.height) / Number(el.textHeight));
let rows = Math.ceil(Number(slice.length) / Number(perRow));//總行數
let rowWidth = Math.floor(Number(el.width) / rows);
let fontSize = Math.floor(rowWidth / 2);
if (fontSize > el.style.fontSize) {
fontSize = el.style.fontSize;
rowWidth = fontSize * 2;
}
html = this.renderLiveList(slice, el, rowWidth);
$(`.tablet-element[id="${this.activeId}"]`).css({
position: "absolute", left: el.x + "mm", top: el.y + "mm", fontSize: el.style.fontSize + 'pt', fontFamily: el.style.fontFamily, "z-index": 9999, visibility: el.style.visibility
position: "absolute", left: el.x + "mm", top: el.y + "mm", fontSize: fontSize + 'pt', fontFamily: el.style.fontFamily, "z-index": 9999, visibility: el.style.visibility
}).html(html);
} else if (this.activeId==="righttitle") {
$(`.tablet-element[id="${this.activeId}"]`).css({
@@ -1095,11 +1136,11 @@
//this.render();
},
displayItem(id) {
console.log("displayItem:", this.elements, id);
//console.log("displayItem:", this.elements, id);
let el = this.elements.find(x => x.id === id);
el.style.visibility = el.style.visibility === "hidden" ? "" : "hidden";
//要判斷如果所在位置超出範圍,要拉回來放
console.log("displayItem:", this.paper, el)
//console.log("displayItem:", this.paper, el)
if (el.x > this.paper.width) {
el.x = this.paper.width/2
}
@@ -1197,7 +1238,7 @@
orientation: $("#paperOrientation").val(), printPageCount: $("#perpage").val(), rosterLimit: 8,
detail: detail
}
console.log(master);
//console.log(master);
let path = "SavDegignerData";
if (this.styleID != null && this.styleID != "") {
path = "UpdateDegignerData"
+6 -6
View File
@@ -386,10 +386,10 @@
return "";
}
let data = JSON.parse(item.f_num_tablet)
let left = data.left_items
let mid = data.mid_items
let mid_right = data.mid_right
let mid_left=data.mid_left
let left = data?.left_items
let mid = data?.mid_items
let mid_right = data?.mid_right
let mid_left=data?.mid_left
let returnVal = ""
if (left) {
returnVal = "陽上:" + left.map(x => x.fam_name).join("、")
@@ -418,7 +418,7 @@
this.tablet_list.forEach(x => {
if (x.actitem_num_checked && x.actitem_num_checked == true) {
console.log("OOQ:", x)
//console.log("OOQ:", x)
//console.log("OOQ:", x.num)
let actItem = this.act_items.find(y => y.act_item_selected.val == x.actitem_num_selected.val)
detail.push({
@@ -456,7 +456,7 @@
this.message_dialog.show_confirm = false
this.message_dialog.show = true
this.message_dialog.message =error
console.log(error)
//console.log(error)
});
}
}
+38 -15
View File
@@ -4,8 +4,8 @@
<v-card-title class="bg-primary white--text text-center">
<h4>快速報名</h4>
<div class="ms-auto">
<v-btn @click.prevent="addOrderWithDetail()">儲存</v-btn>
<v-btn @click.prevent="back01()">返回</v-btn>
<v-btn @click.prevent="addOrderWithDetail()" :disabled="statusAfterClick">儲存</v-btn>
<v-btn @click.prevent="back01()" :disabled="statusAfterClick">返回</v-btn>
</div>
</v-card-title>
<v-card-text>
@@ -24,13 +24,13 @@
</v-col>
<v-col cols="2" md="2">
e <v-select :items="countrys" :rules="requiredrules"
label="*國籍"
item-text="name_zh"
item-value="id" v-model="follower.country">
<v-select :items="countrys" :rules="requiredrules"
label="*國籍"
item-text="name_zh"
item-value="id" v-model="follower.country">
</v-select>
<!--<v-text-field v-model="follower.country" :rules="requiredrules"
label="*國籍"></v-text-field>-->
label="*國籍"></v-text-field>-->
</v-col>
<v-col cols="2" md="2">
<v-text-field v-model="follower.id_code"
@@ -47,7 +47,7 @@
item-value="val" v-model="follower.sex">
</v-select>
<!--<v-text-field v-model="follower.sex" :rules="[rules.required]"
label="*性別"></v-text-field>-->
label="*性別"></v-text-field>-->
</v-col>
<v-col cols="2" md="2">
<v-select :items="identity_items" :rules="requiredrules"
@@ -56,7 +56,7 @@
item-value="val" v-model="follower.identity_type">
</v-select>
<!--<v-text-field v-model="follower.identity_type" :rules="[rules.required]"
label="*身分別"></v-text-field>-->
label="*身分別"></v-text-field>-->
</v-col>
<v-col cols="2" md="2">
<v-menu v-model="menu"
@@ -77,9 +77,9 @@
@input="menu = false"></v-date-picker>
</v-menu>
<!--<v-date-picker v-model="follower.birthday"
label="生日"></v-date-picker>-->
label="生日"></v-date-picker>-->
<!--<v-text-field v-model="follower.birthday"
label="生日"></v-text-field>-->
label="生日"></v-text-field>-->
</v-col>
<v-col cols="2" md="2">
<v-checkbox v-model="follower.send_receipt"
@@ -135,7 +135,7 @@
item-value="val" v-model="title_new.islive">
</v-select>
<!--<v-text-field v-model="title_new.islive"
label="存/歿"></v-text-field>-->
label="存/歿"></v-text-field>-->
</v-col>
<v-col>
<v-btn @click.prevent="addTitle(item)">加入</v-btn>
@@ -165,7 +165,7 @@
item-value="val" v-model="alive_new.islive">
</v-select>
<!--<v-text-field v-model="alive_new.islive"
label="存/歿"></v-text-field>-->
label="存/歿"></v-text-field>-->
</v-col>
<v-col>
<v-btn @click.prevent="addLive(item)">加入</v-btn>
@@ -187,7 +187,14 @@
</v-row>
</v-card-text>
</v-card>
</div>
<v-snackbar v-model="snackbar.show" :timeout="3000" top color="error">
{{ snackbar.text }}
<template v-slot:action="{ attrs }">
<v-btn dark text v-bind="attrs" @click="snackbar.show = false">關閉</v-btn>
</template>
</v-snackbar>
</div>
</template>
<script>
@@ -199,6 +206,11 @@
},
data() {
return {
statusAfterClick:false,
snackbar: {
show: false,
text: ''
},
follower: {
u_name: "", sex: "", identity_type: "", phone: "",
cellphone: "", country: "", address: "",
@@ -252,7 +264,8 @@
addOrderWithDetail() {
//組資料,信眾資料,報名資料,功德資料
let details = []
let self = this
this.statusAfterClick = true;
this.tablets.forEach(x => {
let mid_items = []
@@ -313,6 +326,16 @@
.post(HTTP_HOST + 'api/order/AddOrderWithDetail', order)
.then(response => {
console.log(response);
this.snackbar.text = response.data.message
this.snackbar.show = true;
if (response.data.result == "Y") {
//
setTimeout(() => {
self.back01()
}, 2000);
} else {
this.statusAfterClick = true;
}
})
},
renderContent(titles) {
+94 -41
View File
@@ -317,13 +317,13 @@
<div class="row">
<div class="col-6">
<div class="form-floating mb-3">
<input type="number" id="xPosition" class="form-control form-control-sm mb-2" onchange="changePosition()">
<input type="number" id="xPosition" class="form-control form-control-sm mb-2" @change.prevent="changePosition">
<label class="small" for="xPosition">X</label>
</div>
</div>
<div class="col-6">
<div class="form-floating mb-3">
<input type="number" id="yPosition" class="form-control form-control-sm mb-2" onchange="changePosition()">
<input type="number" id="yPosition" class="form-control form-control-sm mb-2" @change.prevent="changePosition">
<label class="small" for="yPosition">Y</label>
</div>
</div>
@@ -518,7 +518,7 @@
},
methods: {
onTabsResize(e) {
console.log(e)
//console.log(e)
// 當畫面變動時,呼叫 Vuetify 內部的呼叫方法重新計算寬度
//if (this.$refs.myTabs) {
// this.$refs.myTabs.onResize();
@@ -781,7 +781,7 @@
await axios
.post(HTTP_HOST + 'api/tablet/GetTabletElement', {})
.then(response => {
console.log(response)
//console.log(response)
//if (response.result=="Y") {
if (response.status == "200") {
let data = response.data;
@@ -932,7 +932,7 @@
changePaper1(val) {
//$("#paperSize").val(val)
this.paperSize = val.id
console.log("changePaper1:",val)
//console.log("changePaper1:",val)
this.changePaper()
},
changePaper() {
@@ -985,7 +985,7 @@
async removePaper() {
this.removeDialog = true;
this.removeTarget = "paper";
console.log("QQOO", this.removeStyle)
//console.log("QQOO", this.removeStyle)
},
async confirmRemoveStyle() {
let self = this;
@@ -1012,7 +1012,7 @@
async removeStyle() {
this.removeDialog = true;
this.removeTarget = "style";
console.log("QQOO",this.removeStyle)
//console.log("QQOO",this.removeStyle)
},
async newPaperSize() {
this.paperDialog = true
@@ -1049,8 +1049,8 @@
changeRosterLimit() {
//this.rosterLimit = parseInt(this.rosterLimit) //parseInt($("#rosterLimit").val());
},
changePrintMode() {
changePrintMode(printMode) {
this.printMode = printMode
},
bindEvents() {
// 文字變更連動渲染
@@ -1123,9 +1123,18 @@
createEl(el, slice) {
let html = '';
let fontSize = el.style.fontSize;
// 1. 智慧名單渲染
if (el.type === 'roster') {
html = this.renderRoster(slice, el);
let perRow = Math.floor(Number(el.height) / Number(el.textHeight));
let rows = Math.ceil(Number(slice.length) / Number(perRow));//總行數
let rowWidth = Math.floor(Number(el.width) / rows);
let fontSize = Math.floor(rowWidth / 2);
if (fontSize > el.style.fontSize) {
fontSize = el.style.fontSize;
rowWidth = fontSize * 2;
}
html = this.renderRoster(slice, el, rowWidth);
}
// 2. 正名合併置中
else if (el.type === 'combined-center') {
@@ -1140,24 +1149,43 @@
html = el.text.replace(/(\d+)/g, '<span class="tate-chu-yoko">$1</span>');
}
else if (el.id === 'title1') {
html = this.renderNameList(slice, el);
//要先去算出需要縮到多小字,根據總寬度跟行數,這樣才會在正中間
//字體大小*2如果大於行數就要縮字體
let perRow = Math.floor(Number(el.height) / Number(el.textHeight));
let rows = Math.ceil(Number(slice.length) / Number(perRow));//總行數
let rowWidth = Math.floor(Number(el.width) / rows);
fontSize = Math.floor(rowWidth / 2);
//console.log(el.height, el.textHeight, perRow, rows, rowWidth, fontSize)
if (fontSize > el.style.fontSize) {
fontSize = el.style.fontSize;
rowWidth = fontSize * 2;
}
html = this.renderNameList(slice, el, rowWidth);
}
else if (el.id === 'alive') {
console.log("createEl:", slice, el)
html = this.renderLiveList(slice, el);
//console.log("createEl:", slice, el)
let perRow = Math.floor(Number(el.height) / Number(el.textHeight));
let rows = Math.ceil(Number(slice.length) / Number(perRow));//總行數
let rowWidth = Math.floor(Number(el.width) / rows);
fontSize = Math.floor(rowWidth / 2);
if (fontSize > el.style.fontSize) {
fontSize = el.style.fontSize;
rowWidth = fontSize * 2;
}
html = this.renderLiveList(slice, el, rowWidth);
}
else {
html = el.text;
}
//el.style.fontSize
return $(`<div class="tablet-element vertical-text ${this.activeId === el.id ? 'selected' : ''}" id="${el.id}"></div>`)
.css({
position: "absolute", left: el.x + "mm", top: el.y + "mm", fontSize: el.style.fontSize + 'pt', fontFamily: el.style.fontFamily, "z-index": 9999, visibility: el.style.visibility
position: "absolute", left: el.x + "mm", top: el.y + "mm", fontSize: fontSize + 'pt', fontFamily: el.style.fontFamily, "z-index": 9999, visibility: el.style.visibility
//position: "absolute", left: el.startX + "mm", top: el.startY + "mm", fontSize: el.fontSize + 'pt', fontFamily: el.fontFamily, "z-index": 9999, visibility: el.isActive
})
.html(html);
},
renderNameList(names, el) {
renderNameList(names, el,rowWidth) {
let $namelist = $(`<div class='nameList'></div>`).css({
"writing-mode": "vertical rl",
display: "flex",
@@ -1177,16 +1205,16 @@
//"row-gap": "1px",
let self = this;
names.forEach(n => {
$namelist.append(self.renderNameSpan(n, el))
$namelist.append(self.renderNameSpan(n, el, rowWidth))
})
return $namelist;
},
renderNameSpan(name, el) {
renderNameSpan(name, el, rowWidth) {
return $(`<span>${name}</span>`).css({
display: "block",
"min-height": `${el.textHeight}px`,
"max-height": `${el.height}px`,
width: `${el.textWidth}px`,
width: `${rowWidth}px`,
"text-align": "justify",
"text-align-last": "justify",
@@ -1194,8 +1222,8 @@
"text-justify": "inter-character",
});// "margin-bottom": `${el.textSpan}px`,
},
renderLiveList(names, el) {
console.log("renderLiveList:", names);
renderLiveList(names, el, rowWidth) {
//console.log("renderLiveList:", names);
//$("#imp-text").updateActive("text",names)
let $namelist = $(`<div class='liveList'></div>`).css({
"writing-mode": "vertical rl",
@@ -1216,18 +1244,17 @@
//"row-gap": "1px",
let self = this;
names.forEach(n => {
$namelist.append(self.renderLiveSpan(n, el))
$namelist.append(self.renderLiveSpan(n, el, rowWidth))
})
return $namelist;
},
renderLiveSpan(name, el) {
console.log("renderLiveSpan:", name, el
);
renderLiveSpan(name, el, rowWidth) {
//console.log("renderLiveSpan:", name, el );
return $(`<span>${name}</span>`).css({
display: "block",
"min-height": `${el.textHeight}px`,
"max-height": `${el.height}px`,
width: `${el.textWidth}px`,
width: `${rowWidth}px`,
"text-align": "justify",
"text-align-last": "justify",
@@ -1236,7 +1263,7 @@
});//"margin-bottom": `${el.textSpan}px`,
},
// 品字佈局邏輯:一上二下
renderRoster(names, el) {
renderRoster(names, el,rowWidth) {
if (!names.length) return '';
const mid = names.length === 1 ? 1 : Math.floor(names.length / 2);
const top = names.slice(0, mid);
@@ -1297,9 +1324,9 @@
},
select(id) {
console.log("QQ:", id);
//console.log("QQ:", id);
this.activeId = id;
console.log("QQ:", this.elements);
//console.log("QQ:", this.elements);
const el = this.elements.find(x => x.id === id);
const el1 = this.elements.find(x => x.id === "titletriangle");
$('#attr-box').removeClass('d-none');
@@ -1321,7 +1348,7 @@
},
updateActive(key, val) {
console.log("updateActive:", key, val)
//console.log("updateActive:", key, val)
const el = this.elements.find(x => x.id === this.activeId);
if (key === 'fontSize') el.style.fontSize = parseFloat(val);
@@ -1334,12 +1361,19 @@
else el[key] = val;
if (el.type == "roster") {
const names = el.text.split('\n').filter(s => s.trim());
let perRow = Math.floor(Number(el.height) / Number(el.textHeight));
let rows = Math.ceil(Number(names.length) / Number(perRow));//總行數
let rowWidth = Math.floor(Number(el.width) / rows);
let fontSize = Math.floor(rowWidth / 2);
if (fontSize > el.style.fontSize) {
fontSize = el.style.fontSize;
rowWidth = fontSize * 2;
}
$(`.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
}).html(this.renderRoster(names.slice(0 * this.rosterLimit, (0 + 1) * this.rosterLimit), el));
position: "absolute", left: el.startX + "mm", top: el.startY + "mm", fontSize: 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, rowWidth));
} else if (el.type == "combined-center") {
console.log("combined-center");
//console.log("combined-center");
const parts = el.text.split('\n');
html = `<div class="ancestor-wrapper" style='width:${el.width}px !important;height:${el.height}px !important' >
@@ -1353,18 +1387,37 @@
}).html(html);
} else if (this.activeId === "title1") {
let names = el.text.split('\n').filter(s => s.trim());
let slice = names.slice(0 * this.rosterLimit, (0 + 1) * this.rosterLimit);
html = this.renderNameList(slice, el);
let perRow = Math.floor(Number(el.height) / Number(el.textHeight));
let rows = Math.ceil(Number(slice.length) / Number(perRow));//總行數
let rowWidth = Math.floor(Number(el.width) / rows);
let fontSize = Math.floor(rowWidth / 2);
if (fontSize > el.style.fontSize) {
fontSize = el.style.fontSize;
rowWidth = fontSize * 2;
}
//console.log(el.height, el.textHeight, perRow, rows, rowWidth, fontSize)
html = this.renderNameList(slice, el, rowWidth);//el.style.fontSize
$(`.tablet-element[id="${this.activeId}"]`).css({
position: "absolute", left: el.x + "mm", top: el.y + "mm", fontSize: el.style.fontSize + 'pt', fontFamily: el.style.fontFamily, "z-index": 9999, visibility: el.style.visibility
position: "absolute", left: el.x + "mm", top: el.y + "mm", fontSize: fontSize + 'pt', fontFamily: el.style.fontFamily, "z-index": 9999, visibility: el.style.visibility
}).html(html);
} else if (this.activeId === "alive") {
let names = el.text.split('\n').filter(s => s.trim());
let slice = names.slice(0 * this.rosterLimit, (0 + 1) * this.rosterLimit);
html = this.renderLiveList(slice, el);
let perRow = Math.floor(Number(el.height) / Number(el.textHeight));
let rows = Math.ceil(Number(slice.length) / Number(perRow));//總行數
let rowWidth = Math.floor(Number(el.width) / rows);
let fontSize = Math.floor(rowWidth / 2);
if (fontSize > el.style.fontSize) {
fontSize = el.style.fontSize;
rowWidth = fontSize * 2;
}
html = this.renderLiveList(slice, el, rowWidth);
$(`.tablet-element[id="${this.activeId}"]`).css({
position: "absolute", left: el.x + "mm", top: el.y + "mm", fontSize: el.style.fontSize + 'pt', fontFamily: el.style.fontFamily, "z-index": 9999, visibility: el.style.visibility
position: "absolute", left: el.x + "mm", top: el.y + "mm", fontSize: fontSize + 'pt', fontFamily: el.style.fontFamily, "z-index": 9999, visibility: el.style.visibility
}).html(html);
} else if (this.activeId === "righttitle") {
$(`.tablet-element[id="${this.activeId}"]`).css({
@@ -1392,11 +1445,11 @@
//this.render();
},
displayItem(id) {
console.log("displayItem:", this.elements, id);
//console.log("displayItem:", this.elements, id);
let el = this.elements.find(x => x.id === id);
el.style.visibility = el.style.visibility === "hidden" ? "" : "hidden";
//要判斷如果所在位置超出範圍,要拉回來放
console.log("displayItem:", this.paper, el)
//console.log("displayItem:", this.paper, el)
if (el.x > this.paper.width) {
el.x = this.paper.width / 2
}
@@ -1494,7 +1547,7 @@
orientation:"", printPageCount:this.perPage, rosterLimit: 8,
detail: detail
}
console.log(master);
//console.log(master);
let path = "SavDegignerData";
if (this.styleID != null && this.styleID != "") {
path = "UpdateDegignerData"
+27 -10
View File
@@ -368,12 +368,20 @@
details.forEach(d => {
if (d.isActive != "hidden") {
let newFontSize = self.scaleFontSize(mid, d.fontSize, d.width);
let html = "";
let alive = "";
let yang = "";
let bi = "";
if (d.elementID === 'title1') {
let perRow = Math.floor(Number(d.height) / Number(d.textHeight));
let rows = Math.ceil(Number(mid.length) / Number(perRow));//總行數
let rowWidth = Math.floor(Number(d.width) / rows);
newFontSize = Math.floor(rowWidth / 2);
if (newFontSize > d.fontSize) {
newFontSize = d.fontSize;
rowWidth = newFontSize * 2;
}
let $namelist = $(`<div class='nameList'></div>`).css({
"writing-mode": "vertical rl",
display: "flex",
@@ -396,14 +404,14 @@
let info = self.getTextInfo(z, newFontSize);
let spanWidth = mid.length > 1 ? newFontSize : d.width
let height = d.textHeight;
if (info.width >= d.textHeight) {
if (info.height >= d.textHeight) {//width
height = d.height;
}
let $span = $(`<span class="nameSpan">${z}</span>`).css({
display: "block",
"min-height": `${height}px`,
"max-height": `${d.height}px`,
"max-width": `${spanWidth}px`,
"max-width": `${rowWidth}px`,
//width: `${newFontSize}px`,
"text-align": "justify",
"text-align-last": "justify",
@@ -418,9 +426,18 @@
html = $namelist;
} else if (d.elementID === "alive") {
html = self.renderLiveList(left, d);
let perRow = Math.floor(Number(d.height) / Number(d.textHeight));
let rows = Math.ceil(Number(left.length) / Number(perRow));//總行數
let rowWidth = Math.floor(Number(d.width) / rows);
newFontSize = Math.floor(rowWidth / 2);
if (newFontSize > d.fontSize) {
newFontSize = d.fontSize;
rowWidth = newFontSize * 2;
}
console.log(d.height,d.width,d.textHeight,perRow,rows,rowWidth,newFontSize,d)
html = self.renderLiveList(left, d, rowWidth);
newFontSize = d.fontSize;
//newFontSize = d.fontSize;
} else if (d.elementID === "titletriangle") {
html = self.renderRoster(mid, d)
} else if (d.elementID === "combined") {
@@ -798,7 +815,7 @@
fix2(val) {
return Number.parseFloat(val).toFixed(2);
},
renderLiveList(names, el) {
renderLiveList(names, el,rowWidth) {
let $namelist = $(`<div class='liveList'></div>`).css({
"writing-mode": "vertical rl",
display: "flex",
@@ -817,17 +834,17 @@
});
let self = this;
names.forEach(n => {
$namelist.append(self.renderLiveSpan(n, el))
$namelist.append(self.renderLiveSpan(n, el,rowWidth))
})
return $namelist;
},
renderLiveSpan(name, el) {
renderLiveSpan(name, el,rowWidth) {
return $(`<span class="liveSpan">${name}</span>`).css({
display: "block",
"min-height": `${el.textHeight}px`,
"max-height": `${el.height}px`,
width: `${el.textWidth}px`,
height: `${el.textHeight}px`,
width: `${rowWidth}px`,
"text-align": "justify",
"text-align-last": "justify",
"margin-bottom": "10px",
+60 -24
View File
@@ -239,7 +239,7 @@
this.defaultStyle = response.data.data.defaultStyle;
this.selected.style = response.data.data.defaultStyle;
this.selectStyle.style = response.data.data.defaultStyle;
console.log("GetActItem:",this.defaultStyle)
//console.log("GetActItem:",this.defaultStyle)
$("#styleSel").val(this.defaultStyle);
//this.getStyle();
@@ -334,7 +334,7 @@
if (response.status == 200) {
self.printData = response.data;
self.printData.forEach(x => {
console.log("GetDetailToPrint:",x.style);
//console.log("GetDetailToPrint:",x.style);
if (x.style != null && x.style != undefined) {
self.selectStyle.style = x.style;
self.selected.style = x.style;
@@ -460,15 +460,33 @@
if (mid.length == 0) {
mid.push("請選擇")
}
html = self.renderNameList(mid, d, newFontSize, style);
let perRow = Math.floor(Number(d.height) / Number(d.textHeight));
let rows = Math.ceil(Number(mid.length) / Number(perRow));//總行數
let rowWidth = Math.floor(Number(d.width) / rows);
newFontSize = Math.floor(rowWidth / 2);
if (newFontSize > d.fontSize) {
newFontSize = d.fontSize;
rowWidth = newFontSize * 2;
}
//console.log(perRow, rows, rowWidth, newFontSize)
html = self.renderNameList(mid, d, newFontSize, style, rowWidth);
} else if (d.elementID === "alive") {
self.tabletType = "B";
if (left.length == 0) {
left.push("請選擇");
}
newFontSize = self.scaleFontSize(left, d.fontSize, d.Width);
let perRow = Math.floor(Number(d.height) / Number(d.textHeight));
let rows = Math.ceil(Number(left.length) / Number(perRow));//總行數
let rowWidth = Math.floor(Number(d.width) / rows);
newFontSize = Math.floor(rowWidth / 2);
if (newFontSize > d.fontSize) {
newFontSize = d.fontSize;
rowWidth = newFontSize * 2;
}
//console.log(perRow, rows, rowWidth, newFontSize)
//newFontSize = d.fontSize;
html = self.renderLiveList(left, d);
html = self.renderLiveList(left, d, rowWidth);
} else if (d.elementID === "titletriangle") {
if (mid.length == 0) {
@@ -748,7 +766,7 @@
});
} else if (element.hasClass("address")) {//地址
console.log(self.address);
//console.log(self.address);
$(".selectedItem").append(`<li><span style="opacity:0.5">卍</span>
<span class="selected">${self.address==undefined?"":self.address}</span>
<span class="itemRemove" style="float:right ;margin-left:2rem;cursor:pointer;" >&minus;</span>`);
@@ -866,7 +884,7 @@
self.bindEvent();
},
async addNewItem() {//已選輸入框按加號
console.log("addNewItem:",$("#custom_txt").val())
//console.log("addNewItem:",$("#custom_txt").val())
if ($("#custom_txt").val()=="") {
alert("名稱不可空白")
@@ -1246,8 +1264,16 @@
let left = []
Object.assign(left, self.alive);
//this.printData.forEach(x => {
let d = details.find(y => y.elementID == "alive");
let perRow = Math.floor(Number(d.height) / Number(d.textHeight));
let rows = Math.ceil(Number(left.length) / Number(perRow));//總行數
let rowWidth = Math.floor(Number(d.width) / rows);
let newFontSize = Math.floor(rowWidth / 2);
if (newFontSize > d.fontSize) {
newFontSize = d.fontSize;
rowWidth = newFontSize * 2;
}
self.selectedElement.css("font-size", newFontSize+"px");
let html = self.renderLiveList(left, d);
$(self.selectedElement).append(html);
} else if ($(self.selectedElement).children().first().hasClass("lefttitle") ||
@@ -1284,11 +1310,21 @@
$(self.selectedElement).empty();
let d = details.find(y => y.elementID == "title1");
let newfontSize = self.scaleFontSize(mid, d.fontSize, d.textWidth)
let perRow = Math.floor(Number(d.height) / Number(d.textHeight));
let rows = Math.ceil(Number(mid.length) / Number(perRow));//總行數
let rowWidth = Math.floor(Number(d.width) / rows);
newfontSize = Math.floor(rowWidth / 2);
if (newfontSize > d.fontSize) {
newfontSize = d.fontSize;
rowWidth = newfontSize * 2;
}
if (newfontSize < 10) {
newfontSize = 10;
}
$(self.selectedElement).css("font-size", newfontSize);
let html = self.renderNameList(mid, d, style.fontSize, style);
//console.log(self.selectedElement,perRow, rows, rowWidth, newfontSize)
self.selectedElement.css("font-size", newfontSize+"px");
let html = self.renderNameList(mid, d, style.fontSize, style,rowWidth);
$(self.selectedElement).append(html);
} else if ($(self.selectedElement).children().first().hasClass("rosterList")) {
$(self.selectedElement).empty();
@@ -1297,7 +1333,7 @@
if (newfontSize < 10) {
newfontSize = 10;
}
$(self.selectedElement).css("font-size", newfontSize);
self.selectedElement.css("font-size", newfontSize+"px");
let html = self.renderRoster(mid, d);
$(self.selectedElement).append(html);
} else if ($(self.selectedElement).children().first().hasClass("ancestor-wrapper")) {
@@ -1307,7 +1343,7 @@
if (newfontSize < 10) {
newfontSize = 10;
}
$(self.selectedElement).css("font-size", newfontSize);
self.selectedElement.css("font-size", newfontSize+"px");
let html = self.renderCombined(mid, d);
$(self.selectedElement).append(html);
}
@@ -1365,7 +1401,7 @@
});
return txt;
},
renderNameList(mid, d, newFontSize, style) {
renderNameList(mid, d, newFontSize, style,rowWidth) {
let self = this;
let $namelist = $(`<div class='nameList'></div>`).css({
"writing-mode": "vertical rl",
@@ -1396,7 +1432,7 @@
display: "block",
"min-height": `${height}px`,
"max-height": `${d.height}px`,
"max-width": `${spanWidth}px`,
"max-width": `${rowWidth}px`,
//width: `${newFontSize}px`,
"text-align": "justify",
"text-align-last": "justify",
@@ -1410,7 +1446,7 @@
});
return $namelist;
},
renderLiveList(names, el) {
renderLiveList(names, el,rowWidth) {
let $namelist = $(`<div class='liveList'></div>`).css({
"writing-mode": "vertical rl",
display: "flex",
@@ -1429,16 +1465,16 @@
});
let self = this;
names.forEach(n => {
$namelist.append(self.renderLiveSpan(n, el))
$namelist.append(self.renderLiveSpan(n, el,rowWidth))
})
return $namelist;
},
renderLiveSpan(name, el) {
renderLiveSpan(name, el,rowWidth) {
return $(`<span class="liveSpan">${name}</span>`).css({
display: "block",
"min-height": `${el.textHeight}px`,
"max-height": `${el.height}px`,
width: `${el.textWidth}px`,
width: `${rowWidth}px`,
height: `${el.textHeight}px`,
"text-align": "justify",
"text-align-last": "justify",
@@ -1559,7 +1595,7 @@
async saveFamily() {
let self = this;
if (this.follower_id == "") {
console.log("follower_id:", this.follower_id);
//console.log("follower_id:", this.follower_id);
return false
}
@@ -1611,7 +1647,7 @@
event.preventDefault()
//console.log("tabletItem:", designer.tabletItem);
//拚牌位的內容
console.log("AA")
//console.log("AA")
let self = this;
let tablet = {
mid_items: designer.family_deceased_N_selected,
@@ -1621,7 +1657,7 @@
mid_right: designer.family_right_title,
addr_items: designer.family_address
}
console.log("BB")
//console.log("BB")
var pro_order_detail =
{
num: designer.tabletItem.num <= 0 ? null : designer.tabletItem.num,
@@ -1647,7 +1683,7 @@
customize_data: designer.tabletItem.customize_data,
style: designer.selectStyle.style
}
console.log("CC")
//console.log("CC")
await axios
.post('/api/order/SaveDetailData', pro_order_detail)
.then(response => {
@@ -1742,7 +1778,7 @@
//designer.toast.show();
//designer.reset();
let e = event.originalEvent;
console.log("QOO");
//console.log("QOO");
if (e.origin === window.parent.location.origin) {
//console.log('editor.html - origin check passed');
//console.log('editor.html - received data:', event.data);
@@ -1753,7 +1789,7 @@
designer.family_right_title = [];
designer.http_host = receivedData.host;
designer.follower_id = receivedData.follower_id;
console.log("三小:", receivedData.tabletItem)
//console.log("三小:", receivedData.tabletItem)
if (receivedData.tabletItem) {
//console.log('editor.html - updating tabletItem:', receivedData.tabletItem);
designer.tabletItem = receivedData.tabletItem;
@@ -1824,7 +1860,7 @@
}
}
console.log(e.origin, window.parent.location.origin)
//console.log(e.origin, window.parent.location.origin)
})
);
function delay(ms) {
+419
View File
@@ -0,0 +1,419 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/admin/Templates/TBS5ADM001/MasterPage.master" AutoEventWireup="true" CodeFile="index.aspx.cs" Inherits="admin_receipt_index" %>
<asp:Content ID="Content1" ContentPlaceHolderID="page_header" Runat="Server">
<script src="/js//httpVueLoader.js"></script>
<style>
.modify_modal{
width:80vw !important;
}
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="page_nav" Runat="Server">
<div class="mb-2 mb-sm-0">
<a @click.prevent="newReceipt" class="btn btn-primary">
<i class="mdi mdi-plus"></i>新增
</a>
<%--<a @click="deleteAll" class="btn btn-outline-danger" title="刪除勾選的資料" ><i class="mdi mdi-trash-can"></i> 刪除勾選</a>--%>
</div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div id="content" class="container-fluid">
<v-data-table
v-model="data_table.selected"
:items="data_table.list"
:search-props="search"
item-key="num"
:options.sync="options"
:headers="data_table.header"
:footer-props="data_table.footer"
:server-items-length="data_table.count"
:loading="data_table.loading"
:single-select="data_table.singleSelect"
hide-default-footer
:page.sync="data_table.page"
:items-per-page.sync="data_table.pageSize"
class="elevation-1">
<template #item.source="{ item }">
{{ getSourceName(item.source) }}
</template>
<template #item.slot_btn="{ item }">
<a @click.prevent="viewReceipt(item)" class="btn btn-outline-secondary btn-sm"><i class="mdi mdi-pencil-box-outline"></i>明細</a>
<a @click.prevent="editReceipt(item)" class="btn btn-outline-secondary btn-sm"><i class="mdi mdi-printer"></i>編輯</a>
<a @click.prevent="printReceipt(item)" class="btn btn-outline-secondary btn-sm"><i class="mdi mdi-printer"></i>列印</a>
<%--<a :href="'reg.aspx?order_no='+item.order_no" class="btn btn-outline-secondary btn-sm"><i class="mdi mdi-pencil-box-outline"></i>編輯</a>--%>
<%--<a @click="deleteItem(item)" class="btn btn-outline-secondary btn-sm"><i class="mdi mdi-trash-can"></i>刪除</a>--%>
</template>
</v-data-table>
<v-container>
<v-row class="align-baseline" wrap>
<v-col cols="12" md="9">
<v-pagination
v-model="data_table.page"
:length="pageCount">
</v-pagination>
</v-col>
<v-col class="text-truncate text-right" cols="12" md="2">
共 {{ data_table.count }} 筆, 頁數:
</v-col>
<v-col cols="6" md="1">
<v-text-field
v-model="data_table.page"
type="number"
hide-details
dense
min="1"
:max="pageCount"
@input="data_table.page = parseInt($event, 10)"
></v-text-field>
</v-col>
</v-row>
</v-container>
<v-dialog v-model="search_dialog.show" max-width="500px">
<v-card>
<v-card-title class="justify-space-between grey lighten-2">
查詢:{{search_dialog.current.title}}
<v-btn icon @click="search_dialog.show=false"><v-icon>mdi-close</v-icon></v-btn>
</v-card-title>
<v-card-text >
<v-row>
<v-col v-for="item in search_dialog.current.keys"
:cols="search_dialog.current.keys.length>1?6:12" v-bind:key="item.value">
<v-text-field v-model="item.value" :label="item.title" v-if="item.visible===undefined || item.visible==true "></v-text-field>
</v-col>
<v-col cols="12" class="text-end">
<v-btn color="primary" elevation="0" @click="search_get()">查詢</v-btn>
<v-btn elevation="0" @click="search_clear()">清除條件</v-btn>
</v-col>
</v-row>
<v-data-table
:headers="search_headers()"
:items="search_dialog.list"
:footer-props="search_dialog.footer"
:items-per-page="10"
:server-items-length="search_dialog.count"
:page.sync="search_dialog.page"
:options.sync="search_options"
@click:row="search_select"
></v-data-table>
</v-card-text>
<v-card-actions>
</v-card-actions>
</v-card>
</v-dialog>
<v-dialog v-model="modify_dialog.show" class="modify_modal">
<template>
<keep-alive>
<component :is="currentView" :num="twoData" :mode="modify_dialog.mode" @close-dialog="changeModifyDialog($event)"></component>
</keep-alive>
</template>
</v-dialog>
</div>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="offCanvasRight" Runat="Server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="footer_script" Runat="Server">
<script>
let VueApp = new Vue({
el: '#app',
vuetify: new Vuetify(vuetify_options),
data() {
return {
options: { multiSort: false },
search_options: { multiSort: false },
twoData:0,
data_table: {
loading: true,
list: [],
selected: [],
singleSelect: false,
count: 0,
page: 1,
pageSize: 10,
header: [
{ text: '序號', value: 'num' },
{ text: '來源', value: 'source' },
{ text: '開立日期', value: 'receipt_date' },
{ text: '報名單號', value: 'order_no', align: 'start' },
{ text: '信眾', value: 'follower.u_name' },
{ text: '總金額', value: 'total_amt' },
{ text: '收據張數', value: 'receipt_count' },
{ text: '', value: 'slot_btn', sortable: false, align: 'end' }
],
footer: {
showFirstLastPage: true,
itemsPerPageOptions: [5, 10, 20, 30],
},
},
modify_dialog: {
show: false,
mode: ""
},
search_dialog: {
controls: {
search2: {
id: 'search2',
title: '報名活動',
text_prop: 'subject',
value_prop: 'num',
keys: [
{ id: 'subject', title: '活動名稱', value: '' },
{ id: 'kindTxt', title: '活動分類' },
],
api_url: HTTP_HOST + 'api/activity/GetList',
columns: [
{ id: 'subject', title: '活動名稱' },
{ id: 'kindTxt', title: '活動分類' },
],
selected: {},
select(item, t) {
t.print_search.select_act = item.num;
}
},
},
show: false,
current: {},
list: [],
count: 0,
page: 1,
loading: false,
footer: {
showFirstLastPage: true,
disableItemsPerPage: true,
itemsPerPageAllText: '',
itemsPerPageText: '',
},
},
search: {
source: '',
order_no: '',
},
currentView: 'receipt-component'
}
},
mounted() {
},
components: {
'receipt-component': httpVueLoader('./receipt.vue'),
},
watch: {
options: {
handler() {
this.getDefault()
},
deep: true,
},
search_options: {
handler() {
this.search_get()
},
deep: true,
},
},
methods: {
changeModifyDialog(event) {
this.modify_dialog.show = false
this.modify_dialog.mode = ""
this.currentView = "";
if (event === "reload") {
this.getDefault()
}
},
getSourceName(id) {
return id=="1"?"活動/法會":"其他"
},
viewReceipt(item) {
this.twoData = item.num;
this.modify_dialog.show = true;
this.modify_dialog.mode = "view";
this.currentView = "receipt-component";
},
editReceipt(item) {
this.twoData = item.num;
this.modify_dialog.show = true;
this.modify_dialog.mode = "edit";
this.currentView = "receipt-component";
},
printReceipt(item) {
try {
let searchData = { num: item.num }
axios
.post(HTTP_HOST + 'api/receipt/PrintReceipt', searchData, { responseType: 'blob' })
.then(response => {
// 1. Create a dynamic URL object from the binary blob
const blob = new Blob([response.data], {
type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
});
const fileUrl = window.URL.createObjectURL(blob);
// 2. Create a temporary 'a' element to trigger download
const link = document.createElement('a');
link.href = fileUrl;
// 3. Set desired file name
link.setAttribute('download', `${searchData.activity_num}_${searchData.mode}.docx`);
// 4. Append, click and cleanup
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
window.URL.revokeObjectURL(fileUrl); // Free up memory allocation
})
} catch (error) {
//alert('Failed to download file.');
this.showSnack('Failed to download file.');
} finally {
this.loading = false;
}
},
newReceipt() {
this.modify_dialog.show = true;
this.modify_dialog.mode = "add";
this.twoData = 0;
this.currentView = "receipt-component";
},
search_show(curr) {
this.search_dialog.current = curr;
this.search_clear()
//this.search_get()//清除完自動會重抓, 故取消
this.search_dialog.show = true;
},
search_clear() {
if (!this.search_dialog.current.keys) return;
this.search_dialog.current.keys.forEach((t, i) => { t.value = '' })
this.search_get()
},
search_get() {
if (!this.search_dialog.current.keys) return;
let api_url = this.search_dialog.current.api_url;
let keys = this.search_dialog.current.keys;
//const { page, itemsPerPage } = this.options
//const { sortBy, sortDesc, page, itemsPerPage } = this.options
this.search_dialog.page = this.search_options.page ?? 1
let params = { page: this.search_dialog.page, pageSize: 10 };//url params
var search = {};//post body
keys.forEach((t, i) => {
search[t.id] = t.value;
});
//necessary parameter===
if (this.search_dialog.current.id == 'search2') {
params = { sortBy: 'startDate_solar', sortDesc: true, page: this.search_dialog.page, pageSize: 10 };//url params
}
this.search_dialog.loading = true
axios.post(api_url, search, { params: params })
.then(response => {
this.search_dialog.list = response.data.list
this.search_dialog.count = response.data.count
this.search_dialog.loading = false
})
.catch(error => {
this.search_dialog.list = []
this.search_dialog.count = 0
this.search_dialog.loading = false
this.snackbar.text = "錯誤:" + error
this.snackbar.show = true
})
},
search_headers() {
if (!this.search_dialog.current.columns) return;
r = [];
this.search_dialog.current.columns.forEach((t, i) => {
r.push({
text: t.title,
align: 'start',
sortable: false,
value: t.id,
})
})
return r
},
search_select(row) {
let curr = this.search_dialog.current;
let target = $(`[data-search-control=${curr.id}]`);
curr.selected = row;
target.children("input.search-text").val(curr.selected[curr.text_prop])//text
target.children("input:hidden").val(curr.selected[curr.value_prop])//value
if (curr.select instanceof Function) {
curr.select(row, this);
}
this.search_dialog.show = false;
//console.log(row, row["u_name"], row["f_number"], curr.id, target);
},
getDefault(clearpage = false) {
const { sortBy, sortDesc, page, itemsPerPage } = this.options
//page = this.data_table.page;
const params = {
sortBy: sortBy[0], sortDesc: sortDesc[0],
page: clearpage ? '1' : page, pageSize: itemsPerPage
};
this.data_table.loading = true
//sessionStorage.setItem('orderpage', clearpage ? '1' : page);
axios
.post(HTTP_HOST + 'api/receipt/GetList', this.search, { params: params })
.then(response => {
this.data_table.list = response.data.list
this.data_table.count = response.data.count;
this.data_table.loading = false
const dataToStore = JSON.stringify(this.data_table);
//sessionStorage.setItem("order_list_cache", dataToStore);
})
.catch(error => console.log(error))
},
editItem(item) {
console.log("edit", item);
},
deleteItem(item) {
if (confirm('是否確定刪除此筆資料?')) {
const index = this.data_table.list.indexOf(item)
if (index != -1) {
axios
.delete(HTTP_HOST + 'api/receipt/' + item.order_no)
.then(response => {
console.log("del", item);
this.data_table.list.splice(index, 1);
this.data_table.count = this.data_table.list.length
})
.catch(error => console.log(error))
}
}
},
deleteAll() {
if (confirm('是否確定刪除已勾選的資料?')) {
axios
.delete(HTTP_HOST + 'api/receipt/DeleteAll/' + this.data_table.selected.map(x => x.order_no))
.then(response => {
this.getDefault();
})
.catch(error => console.log(error))
}
},
btn_search() {
this.isSearched = true;
this.search.activity_num = '';
this.getDefault(true)
bootstrap.Offcanvas.getInstance(document.getElementById("offcanvasRight")).hide()
},
},
computed: {
pageCount() {
return Math.ceil(this.data_table.count / this.data_table.pageSize)
},
}
})
</script>
</asp:Content>
+14
View File
@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class admin_receipt_index : MyWeb.config
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
+539
View File
@@ -0,0 +1,539 @@
<template>
<div class="row justify-content-center">
<div class="col-12 col-md-10 col-lg-10">
<div class="card shadow">
<div class="card-header bg-primary text-white text-center">
<h4 class="mb-0">收款收據開立作業</h4>
</div>
<div class="card-body">
<div class="row">
<div class="mb-3 col-12 col-md-6">
<label for="source" class="form-label">來源 <span class="text-danger">*</span></label>
<select class="form-select" id="source" v-model="formData.source" required :disabled="mode=='view'||mode=='edit'">
<option value="">請選擇</option>
<option v-for="(desc, value) in sources" :key="value" :value="value">
{{desc}}
</option>
</select>
</div>
<div class="mb-3 col-12 col-md-6">
<!--source=1 就要有-->
<label for="order_no" class="form-label">報名單號 <span class="text-danger" v-show="order_no_need">*</span></label>
<div class="input-group mb-3"
@click.prevent="showPickOrder" :disabled="mode=='view'||mode=='edit'">
<input class="form-control search-text" type="text" readonly
id="order_no" runat="server" placeholder="報名單號" v-model="formData.order_no">
<button class="btn btn-outline-secondary" type="button">
<i class="mdi mdi-view-list-outline"></i>
</button>
</div>
</div>
<div class="mb-3 col-12 col-md-6">
<label for="" class="form-label">開立日期 <span class="text-danger">*</span></label>
<v-menu ref="menu"
v-model="menu"
:close-on-content-click="false"
:return-value.sync="formData.receipt_date"
transition="scale-transition"
offset-y
min-width="auto"
:disabled="mode=='view'||mode=='edit'">
<template v-slot:activator="{ on, attrs }">
<v-text-field v-model="formData.receipt_date"
prepend-icon="mdi-calendar"
readonly
v-bind="attrs"
v-on="on"></v-text-field>
</template>
<v-date-picker v-model="formData.receipt_date"
:active-picker.sync="activePicker"
:max="(new Date(Date.now() - (new Date()).getTimezoneOffset() * 60000)).toISOString().substring(0, 10)"
min="1950-01-01">
<v-spacer></v-spacer>
<v-btn text
color="primary"
@click.prevent="menu = false">
Cancel
</v-btn>
<v-btn text
color="primary"
@click.prevent="$refs.menu.save(formData.receipt_date)">
OK
</v-btn>
</v-date-picker>
</v-menu>
</div>
<div class="mb-3 col-12 col-md-6">
<label for="receiptStyle" class="form-label">收據格式 <span class="text-danger">*</span></label>
<select class="form-select" id="receiptStyle" v-model="formData.style_num" required
:disabled="mode=='view'||mode=='edit'">
<option value="">請選擇</option>
<option v-for="r in receiptStyles" :key="r.num" :value="r.num">
{{r.name}}
</option>
</select>
</div>
<div class="mb-3 col-12 col-md-6">
<v-text-field v-model="formData.total_amt" label="應收總金額"
:disabled="mode=='view'||mode=='edit'||formData.source=='1'"></v-text-field><!--從報名來的不能改總金額-->
</div>
<div class="mb-3 col-12 col-md-6">
<v-text-field v-model="alreadyAmt" label="已收總金額"
:disabled="mode=='view'||mode=='edit'||formData.source=='1'"></v-text-field>
</div>
</div>
</div>
</div>
<div class="card">
<div class="card-title bg-primary text-white">
<h4>收據明細</h4>
</div>
<div class="card-body">
<div class="row" v-show="mode!='view'">
<!--<div class="col-12 col-md-2">
<v-text-field v-model="newDetail.receipt_no" label="編號" :readonly="true"></v-text-field>
</div>-->
<div class="col-12 col-md-2">
<v-text-field v-model="newDetail.title" label="抬頭"></v-text-field>
</div>
<div class="col-12 col-md-2">
<v-text-field v-model="newDetail.amt" label="金額"></v-text-field>
</div>
<div class="col-12 col-md-4">
<v-text-field v-model="newDetail.addr" label="地址"></v-text-field>
</div>
<div class="col-12 col-md-2">
<v-text-field v-model="newDetail.caseofficer" label="經手人"></v-text-field>
</div>
<div class="col-12 col-md-2">
<button class="btn btn-info" @click.prevent="addDetail">新增</button>
</div>
</div>
<div class="row" v-for="d in formDetail">
<div class="row">
<!--<div class="col-12 col-md-2">
<v-text-field v-model="d.receipt_no" label="編號"></v-text-field>
</div>-->
<div class="col-12 col-md-2">
<v-text-field v-model="d.title" label="抬頭" :disabled="mode=='view'"></v-text-field>
</div>
<div class="col-12 col-md-2">
<v-text-field v-model="d.amt" label="金額" :disabled="mode=='view'"></v-text-field>
</div>
<div class="col-12 col-md-4">
<v-text-field v-model="d.addr" label="地址" :disabled="mode=='view'"></v-text-field>
</div>
<div class="col-12 col-md-2">
<v-text-field v-model="d.caseofficer" label="經手人" :disabled="mode=='view'"></v-text-field>
</div>
<div class="col-12 col-md-2">
<v-text-field v-model="d.receipt_no" label="收據編號" v-show="mode=='view'" :disabled="mode=='view'"></v-text-field>
</div>
</div>
</div>
<div class="row">
<div class="col-12 col-md-2">
收據已開立總金額 {{ countReceiptTotal() }}
</div>
</div>
</div>
</div>
<div class="card">
<div class="card-footer">
<button class="btn btn-primary" @click.prevent="saveReceipt" v-show="mode!='view'">存檔</button>
<button class="btn btn-primary" @click.prevent="printReceipt" v-show="mode=='view'">列印</button>
<button class="btn btn-primary" @click.prevent="closeWindow('')">取消</button>
</div>
</div>
</div>
<v-dialog v-model="order_dialog.show" max-width="800px">
<v-card>
<v-card-title class="grey lighten-2">
選擇報名表
<v-spacer></v-spacer>
<v-btn icon @click.prevent="order_dialog.show = false">
<v-icon>mdi-close</v-icon>
</v-btn>
</v-card-title>
<v-card-text class="pt-4">
<v-row>
<v-col cols="12">
<v-text-field v-model="order_dialog.search"
label="依法會名稱搜尋報名表 (按 Enter 搜尋)"
prepend-icon="mdi-magnify"
@keydown.enter.prevent="searchOrders"
clearable></v-text-field>
</v-col>
</v-row>
<v-data-table :headers="order_dialog.headers"
:items="order_dialog.list"
:loading="order_dialog.loading"
item-key="num"
:server-items-length="order_dialog.count"
:page.sync="order_dialog.page"
:items-per-page.sync="order_dialog.pageSize"
:options.sync="options"
class="elevation-1"
@click:row="selectOrder">
<template v-slot:item.actions="{ item }">
<v-btn small color="primary" @click.stop="selectOrder(item)">
選擇
</v-btn>
</template>
</v-data-table>
</v-card-text>
</v-card>
</v-dialog>
<v-snackbar v-model="snackbar.show" :timeout="3000" top color="error">
{{ snackbar.text }}
<template v-slot:action="{ attrs }">
<v-btn dark text v-bind="attrs" @click="snackbar.show = false">關閉</v-btn>
</template>
</v-snackbar>
</div>
</template>
<script>
module.exports = {
props: {
num: {
type: Number // num
},
mode: {
type: String,
default:''
}
},
data() {
return {
snackbar: {
show: false,
text: ''
},
options: { multiSort: false },
formData: {
source: '',
order_no: '',
receipt_date: null,
receipt_style: "",
total_amt: 0,
style_num: 0,
num:0
},
alreadyAmt:0,
order_no_need:false,
newDetail: {
num:0,
receipt_no: "",
title: "",
addr: "",
amt: 0,
caseofficer: ""
},
formDetail: [
],
sources: {
'1': '活動/法會',
'2':'其他'
},
orders: [],
receiptStyles:[],
activePicker: null,
date: null,
menu: false,
order_dialog: {
show: false,
search: '',
headers: [
{ text: '活動/法會', value: 'subject' },
{ text: '單號', value: 'order_no' },
{ text: '姓名', value: 'u_name' },
],
loading: false,
items: [],
list: [],
count: 0,
page: 1,
pageSize: 10,
options: { multiSort: false },
}
}
},
watch: {
options: {
handler() {
this.searchOrders()
},
deep: true,
},
formData: {
handler(newVal) {
if (newVal.source === "1") {
this.order_no_need = true;
} else {
this.order_no_need = false;
}
},
deep:true,
},
num: {
handler() {
this.formData = {
source: '',
order_no: '',
receipt_date: null,
receipt_style: "",
total_amt: 0,
style_num: 0,
num: 0
}
if (this.mode == "view"||this.mode=="edit") {
this.getReceipt();
}
},
deep: true,
immediate: true
}
},
methods: {
showPickOrder() {
this.order_dialog.show = true;
},
selectOrder(item) {
//console.log(item)
this.formData.order_no = item.order_no
this.formData.total_amt = item.amt
this.order_dialog.show=false
},
searchOrders() {
const { sortBy, sortDesc, page, itemsPerPage } = this.options
//page = this.data_table.page;
let self = this;
const params = {
page: page == null ? 1 : page, pageSize: itemsPerPage == null ? 10 : itemsPerPage,
sortBy: sortBy[0], sortDesc: sortDesc[0],
};
this.order_dialog.loading = true
let search = { subject: this.order_dialog.search }
//sessionStorage.setItem('orderpage', clearpage ? '1' : page);
axios
.post(HTTP_HOST + 'api/order/GetList', search, { params: params })
.then(response => {
console.log(response)
self.order_dialog.list = response.data.list
self.order_dialog.count = response.data.count;
self.order_dialog.loading = false
//sessionStorage.setItem("order_list_cache", dataToStore);
})
.catch(error => console.log(error))
},
getReceiptStyles() {
axios
.post(HTTP_HOST + 'api/receipt/GetAllStyle')
.then(response => {
let data = response.data.list;
this.receiptStyles = data;
});
},
getOrders() {
},
getReceipt() {
let search = { num: this.num }
axios
.post(HTTP_HOST + 'api/receipt/GetData', search)
.then(response => {
let data = response.data.data;
this.formData = {
source: data.source,
order_no: data.order_no,
receipt_date: data.receipt_date,
style_num: data.style_num,
total_amt: data.total_amt,
num: data.num
}
data.orderdetails.forEach(x => {
x.records.forEach(y => {
this.alreadyAmt = Number(this.alreadyAmt) + (isNaN(y.price) ? 0 : Number(y.price))
})
})
this.formDetail=[...data.receipt_detail]
})
.catch(error => console.log(error))
},
addDetail() {
this.formDetail.push({ ...this.newDetail })
this.newDetail = {
receipt_no: "",
title: "",
addr: "",
amt: 0,
caseofficer: "",
num: 0,
receipt_num:0
}
},
showSnack(message) {
this.snackbar.text = message;
this.snackbar.show = true;
},
saveReceipt() {
if (this.formDetail.length === 0) {
this.showSnack("沒有明細資料");
return false;
}
if (this.formData.source == "") {
this.showSnack("請選擇來源");
return false;
}
if (this.formData.source === "1" && this.formData.order_no== "") {
this.showSnack("請選擇活動/法會");
return false;
}
if (this.formData.receipt_date == "") {
this.showSnack("請選擇開立日期");
return false;
}
if (this.formData.style_num==0) {
this.showSnack("請選擇收據格式");
return false;
}
if (this.formData.total_amt == 0) {
this.showSnack("總金額不可為0");
return false;
}
let total=0
let detail = []
this.formDetail.forEach(x => {
detail.push({ ...x })
total=total+Number(x.amt)
})
if (total > this.formData.total_amt) {
this.showSnack("收據總金額超過應收總金額!!!");
return false
}
let master = {
...this.formData, list: detail
}
let targetUrl = "SaveReceiptWithDetail";
if (this.mode === "edit")
targetUrl = "UpdateReceiptWithDetail";
axios
.post(HTTP_HOST + `api/receipt/${targetUrl}`, master)
.then(response => {
this.snackbar.text = response.data.message;
this.snackbar.show = true;
if (response.data.result == "Y") {
this.closeWindow('reload');
}
})
.catch(error => console.log(error))
},
closeWindow(param) {
this.formDetail.length = 0
this.formData = {
source: '',
order_no: '',
receipt_date: null,
receipt_style: "",
total_amt: 0,
style_num: 0,
num: 0
}
this.$emit('close-dialog', param);
},
printReceipt() {
try {
let searchData = {num:this.formData.num}
axios
.post(HTTP_HOST + 'api/receipt/PrintReceipt', searchData, { responseType: 'blob' })
.then(response => {
// 1. Create a dynamic URL object from the binary blob
const blob = new Blob([response.data], {
type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
});
const fileUrl = window.URL.createObjectURL(blob);
// 2. Create a temporary 'a' element to trigger download
const link = document.createElement('a');
link.href = fileUrl;
// 3. Set desired file name
link.setAttribute('download', `${searchData.activity_num}_${searchData.mode}.docx`);
// 4. Append, click and cleanup
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
window.URL.revokeObjectURL(fileUrl); // Free up memory allocation
})
} catch (error) {
console.error('Error downloading the file:', error);
//alert('Failed to download file.');
this.showSnack('Failed to download file.');
} finally {
this.loading = false;
}
},
countReceiptTotal() {
let total=0
this.formDetail.forEach(x => {
total=Number(total)+Number(x.amt)
})
return total
}
},
deactivated() {
this.formData = {
source: '',
order_no: '',
receipt_date: null,
receipt_style: "",
total_amt: 0,
style_num: 0,
num: 0
}
this.formDetail.length = 0;
this.alreadyAmt = 0;
},
activated() {
this.getReceiptStyles();
this.formData = {
source: '',
order_no: '',
receipt_date: null,
receipt_style: "",
total_amt: 0,
style_num: 0,
num: 0
}
this.formDetail.length = 0;
this.alreadyAmt = 0;
},
mounted() {
//this.formDetail.push()
},
computed: {
pageCount() {
return Math.ceil(this.order_dialog.count / (this.options.itemsPerPage??10))
},
}
}
</script>