修改舒文,牌位预览列印

This commit is contained in:
2025-09-17 17:31:34 +08:00
parent c38dc55dff
commit 104f95eaec
11 changed files with 214 additions and 187 deletions

View File

@@ -142,13 +142,15 @@
</template>
<template #item.todaytotalbookers="{item}">
<span>
{{item?.todaytotalbookers + '(男' + ')'}}
{{item?.todaytotalbookers + '(男: ' + item.bookmale + ', 女:' + item.bookfemale + ')'}}
</span>
<button type="button" class="btn btn-outline-primary" @click="showBookDialog(item, '已預約','booking')">查看預約人</button>
</template>
<template #item.checkin="{item}">
<span>
{{item?.checkin + '(男' + ')'}}
{{item?.checkin + '(男: ' + item.checkinmale + ', 女:' + item.checkinfemale + ')'}}
</span>
<button type="button" class="btn btn-outline-primary" @click="showBookDialog(item, '已入住', 'checkin')">查看入住人</button>
</template>
<template #item.bedusagerate="{ item }">
{{ ((item.todaytotalbookers / bedcount) * 100).toFixed(2) + '%' }}
@@ -161,6 +163,38 @@
</template>
</v-data-table>
</div>
<div>
<v-dialog v-model="bookerDialog.show" max-width="500">
<v-card
style="width: 40vw; height: 50vh; display: flex; flex-direction: column;"
>
<!-- 标题 -->
<v-card-title class="text-h5" style="flex: 0 0 auto; background-color: #1976D2; color: white; padding: 16px;">
{{ bookerDialog.title }}
</v-card-title>
<!-- 内容撑满 -->
<v-card-text
style="flex: 1; overflow-y: auto;"
>
<v-data-table
:items="bookerDialog.items"
:headers="bookerDialog.headers">
</v-data-table>
</v-card-text>
<!-- 底部按钮 -->
<v-card-actions>
<v-spacer></v-spacer>
<v-btn text @click="closeBookDialog">關閉</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</div>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="offCanvasRight" Runat="Server">
@@ -201,12 +235,60 @@
guadanPeopleCurrentMale: 0,
guadanPeopleCurrentFemale: 0
},
bookerDialog: {
title: "",
show: false,
items: [],
headers: [
{ text: '姓名', value: 'name' },
{ text: "性别", value: 'gender'}
]
}
}
},
methods: {
showBookDialog(item, title, type = null) {
this.bookerDialog.title = title;
this.bookerDialog.show = true;
if (type === 'booking') {
this.getBookerDialogBookingItems(item.date);
}
else if (type === 'checkin') {
this.getBookerDialogCheckInItems(item.date);
}
},
closeBookDialog() {
this.bookerDialog.show = false;
this.bookerDialog.title = "";
this.bookerDialog.items = [];
},
async getBookerDialogBookingItems(date) {
try {
const res = await axios.get(HTTP_HOST + 'api/guadan/guest/booking/list', {
params: {
date: date
}
});
this.bookerDialog.items = res.data;
} catch(error) {
}
},
async getBookerDialogCheckInItems(date) {
try {
const res = await axios.get(HTTP_HOST + 'api/guadan/guest/checkin/list', {
params: {
date: date
}
});
this.bookerDialog.items = res.data;
} catch (error) {
}
},
async getList() {
try {
const res = await axios.get('/api/guadan/guadanstatisticstable/list', {
const res = await axios.get(HTTP_HOST + 'api/guadan/guadanstatisticstable/list', {
params: {
start: this.startDate || '',
end: this.endDate || ''

View File

@@ -19,53 +19,24 @@ public partial class admin_printpw_index : MyWeb.function
private string previousOrderno = "";
protected void Page_Load(object sender, EventArgs e)
{
//Response.Write("item:"+Request["item"]+"<br>");
//Response.Write("file:"+Request["file"]+"<br>");
//Response.Write("list:"+Request["list"]+"<br>");
//if (!IsPostBack)
//{
this.Title = "預覽牌位";
if (Request.HttpMethod == "POST")
{
/*if (!String.IsNullOrEmpty(Request["item"]) &&
!String.IsNullOrEmpty(Request["file"]) &&
!String.IsNullOrEmpty(Request["list"])
)*/
if (!String.IsNullOrEmpty(Request["order_no"]))
{
var order_no = Request["order_no"];
var oderList = _db.pro_order_detail
.Where(u => u.order_no == order_no && u.printed_files != null)
.Where(u => u.order_no == order_no)
.Where(u => (u.parent_num != null)
|| u.actItem.subject.Contains("牌")
|| !string.IsNullOrEmpty(u.f_num_tablet))
//因為目前在[pro_order_detail]表中,沒有辦法區分那些項目是牌位,
//只有根據某些欄位來做部分篩選,可能會篩選錯
//但是為什麼沒有欄位可以區分一個項目是不是牌位呢?
.Select(u => new { detail_num = u.num, actItem_num = u.actItem_num }).ToArray();
Repeater1.DataSource = oderList;
Repeater1.DataBind();
}
else if (!String.IsNullOrEmpty(Request["activity_num"]))
{
//var _details = Newtonsoft.Json.JsonConvert.DeserializeObject<int[]>(Request["list"]);
//string json = "";
//using (System.IO.StreamReader oSR = new System.IO.StreamReader(Request.InputStream))
// json = oSR.ReadToEnd();
int activity_num = Convert.ToInt32(Request["activity_num"]);
//Repeater1.DataSource = _details;
var orderList = _db.pro_order.Where(u => u.activity_num == activity_num).Select(u => u.order_no).ToList();
var gdzOrderList = _db.pro_order_detail.Where(u => orderList.Contains(u.order_no) && u.print_id.Contains("主") ).Select(u=>u.order_no).Distinct().ToArray();
var datalist = _db.pro_order_detail
.Where(u => gdzOrderList.Contains(u.order_no) && u.print_id.Contains("主") && u.parent_num != null && u.printed_files != null)
.OrderBy(o => o.order_no)
.ThenBy(o => o.actItem_num)
.ThenBy(o=>o.print_id)
.Select(u => new {detail_num=u.num ,actItem_num=u.actItem_num})
.ToArray();
//List<int> ints = new List<int>();
//ints.Add(12133);
Repeater1.DataSource = datalist;
Repeater1.DataBind();
if (!String.IsNullOrEmpty(Request["title"]))
{
this.Title += " - " + Request["title"];
}
}
else
{
Response.Clear();
@@ -74,9 +45,6 @@ public partial class admin_printpw_index : MyWeb.function
}
}
//}
}
protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
@@ -248,8 +216,8 @@ public partial class admin_printpw_index : MyWeb.function
catch (Exception ex)
{
var msg = ex.Message;
ret[0] = "??:" + msg;
ret[1] = "??";
ret[0] = "";
ret[1] = "";
}
return ret;
}

View File

@@ -24,6 +24,8 @@
@page a4l {
size: a4 landscape;
margin: 0;
margin-top:6mm;
margin-left:6mm;
}
@page a5 {
@@ -133,6 +135,22 @@ pre {
line-height: calc(var(--fs_w) * 1.0);
}
.text-block.fit-text.add-space {
letter-spacing: 0.5em;
}
.text-block.fit-text.mid_text.add-space {
padding-top: 0.5em;
}
.text-block.fit-text.mid_text.add-space.add-space-3 {
letter-spacing: 1.5em;
padding-top: 1.5em;
}
body.tblt-m .left_text {
--font-max: 30pt;
}
body.tblt-m .top_text_2 {
right: 8mm;
}
.vertical {
writing-mode: vertical-rl;
/*text-orientation: upright;*/
@@ -367,6 +385,10 @@ pre {
left: 2mm;
}
.top_text_3 {
display: none;
}
/*舊式紙張*/
body.tablet-l {
--page-w: 274mm;
@@ -548,6 +570,9 @@ body.tblt-l.a3.l2b .mid_text {
--divh: 60mm;
top: 40%;
}
body.tblt-l.a3 .left_text {
--font-max: 36pt;
}
body.tblt-l.a3.l2b .mid_text_2 {
--divh: 180mm;
@@ -638,7 +663,8 @@ body.tblt-m.a4-mrg {
}
body.tblt-m.a4-mrg .page {
--page-w: 100mm;
--page-w: 95mm;
margin-left:5mm;
float: left;
}
@@ -763,9 +789,8 @@ body.tblt-xs {
}
body.tblt-xs.a3-mrg .page {
/*--page-w: 57mm;*/
--page-w: 59mm;
--page-h: 100mm;
--page-w: 57mm;
--page-h: 98mm;
page-break-after: auto;
float: left;
}
@@ -775,13 +800,11 @@ body.tblt-xs.a4l-mrg {
}
body.tblt-xs.a4l-mrg .page {
/* --page-w: 57mm; */
--page-w: 59mm;
--page-h: 100mm;
--page-w: 57mm;
--page-h: 98mm;
page-break-after: auto;
float: left;
}
body.tblt-xs .top_text_1 {
font-size: 8pt;
}
@@ -800,9 +823,9 @@ body.tblt-xs .mid_text_2 {
}
body.tblt-xs .right_text {
--divw: 12mm;
--divw: 10mm;
--divh: 60mm;
right: 0mm;
right: 2mm;
top: 25mm;
}
@@ -825,8 +848,7 @@ body.tblt-xs .top_text_2{
/*[標準X2B]隨喜牌位-佛力超薦-往生蓮位-A3(直)*/
right: 2mm;
right: 3.0mm;
right: 3.5mm;
/* right: 4.0mm; */
right: 5mm;
}
body.tblt-xs .txt_up {
@@ -1075,35 +1097,4 @@ body.prayer-h pre {
/*[標準X1A]隨喜牌位-佛光注照-長生祿位-A4(橫) */
* {
outline:0 none !important;
}
/*让自定义的分页生效在某个div后面产生class-page从而分页当牌位不是同一家人的时候就分页*/
@media print {
.page-break {
display: block !important;
width: 100%;
height: 1px;
visibility: hidden;
page-break-after: always;
}
.page {
page-break-inside: auto !important;
}
@page {
orphans: 1;
widows: 1;
}
.d-flex {
display: block !important;
}
.page-break::after {
content: "";
display: block;
height: 1px;
visibility: hidden;
}
}
}

View File

@@ -32,17 +32,25 @@ function init_print() {
//console.log(i, $(this).html(),$(this).text());
//console.log(i, txt==htm);
//console.log(i, txt_arr, line, line_len);
line_len = Math.ceil(line_len / 5) * 5;
line_len = Math.ceil(line_len / 3) * 3;
//if(line>1){
css = $(this).attr("style")||"";
if(css.length>0){
css += ";";
}
css += "--lines:" + line + ";--line_len:" + line_len + ";";
//debugger;
//字少時, 加空間
let allShort = txt_arr2.every(line => line.trim().length <= 7);
let addSpaceClass = allShort ? "add-space" : "";
allShort = txt_arr2.every(line => line.trim().length <= 3);
addSpaceClass += allShort ? " add-space-3" : "";
htm_lines = txt_arr2.join("<br>");
$(this).attr("style", css);
$(this).html(htm_lines);
$(this)
.attr("style", css)
.addClass(addSpaceClass)
.html(htm_lines);
//}
//console.log(i, line, line_len, css,txt);
});

View File

@@ -153,6 +153,9 @@
<template #item.slot_type ="{item}">
{{item.detail.actItem?.substring(0,3)}}
</template>
<template #item.up_time ="{item}">
{{item.up_time|timeString('YYYY-MM-DD')}}
</template>
<template #item.print="{item}">
<v-icon color="blue" class="mr-2" @click="yulan_single(item);" >
mdi-printer

View File

@@ -24,7 +24,7 @@
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div v-if="currentActivityNum">
<div><h2 style="text-align:center">消災疏文</h2></div>
<div v-for="item in ShuWenJson.xiaozai" :key="Object.keys(item)[0]">
<div v-for="(item, index) in ShuWenJson?.xiaozai" :key="Object.keys(item)[0] + 'xz' + index">
<h4>報名信眾:{{ item[Object.keys(item)[0]].user.name }}</h4>
<ul>
<li>{{ item[Object.keys(item)[0]]['biaoti'].join(' ') }}</li>
@@ -32,7 +32,7 @@
<hr />
</div>
<div><h2 style="text-align:center">超薦疏文</h2></div>
<div v-for="item in ShuWenJson.chaodu" :key="Object.keys(item)[0]">
<div v-for="(item, index) in ShuWenJson?.chaodu" :key="Object.keys(item)[0] + 'cj' + index">
<h4>報名信眾:{{ item[Object.keys(item)[0]].user.name }}</h4>
<ul>
<li>
@@ -113,7 +113,10 @@
this.ShuWenJson = {}
return;
}
this.ShuWenJson = JSON.parse(this.ShuWenItem.shuWenList)
this.ShuWenJson = this.ShuWenItem?.shuWenList
? JSON.parse(this.ShuWenItem.shuWenList)
: { xiaozai: [], chaodu: [] }; // 默认空对象
})
.catch(err => {
if (err.response && err.response.status === 400) {