修正很多東西

This commit is contained in:
2026-07-10 17:35:02 +08:00
parent 266aeb4426
commit 2686506f9c
16 changed files with 249 additions and 58 deletions
+10 -7
View File
@@ -1,15 +1,16 @@
using System; using Newtonsoft.Json;
using System.Collections.Generic; using System;
using System.Linq;
using System.Web;
using System.Data;
using System.Configuration;
//using System.Data.OleDb; //using System.Data.OleDb;
//using System.Data.SqlClient; //using System.Data.SqlClient;
using System.Collections; using System.Collections;
using Newtonsoft.Json; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Configuration;
using System.Data;
using System.Globalization; using System.Globalization;
using System.Linq;
using System.Text.RegularExpressions;
using System.Web;
namespace Model.ViewModel namespace Model.ViewModel
{ {
@@ -96,5 +97,7 @@ namespace Model.ViewModel
public List<family_members> mid_items { get; set; } public List<family_members> mid_items { get; set; }
public List<family_members> left_items { get; set; } public List<family_members> left_items { get; set; }
} }
} }
+140 -1
View File
@@ -17,6 +17,7 @@ using System.Linq;
using System.Net; using System.Net;
using System.Net.Http; using System.Net.Http;
using System.Text; using System.Text;
using System.Text.RegularExpressions;
using System.Web.Helpers; using System.Web.Helpers;
using System.Web.Http; using System.Web.Http;
using static TreeView; using static TreeView;
@@ -224,6 +225,7 @@ public class orderController : ApiController
var act=_db.activities.Where(x=>x.num==po.activity_num).FirstOrDefault(); var act=_db.activities.Where(x=>x.num==po.activity_num).FirstOrDefault();
var hasList = _db.pro_order.AsNoTracking().Where(x => x.activity_num == po.activity_num).AsNoTracking().ToList(); var hasList = _db.pro_order.AsNoTracking().Where(x => x.activity_num == po.activity_num).AsNoTracking().ToList();
var actItemList=_db.activity_relating.AsNoTracking().Where(x=>x.activity_num==po.activity_num).AsNoTracking().ToList();
List<int> rp=new List<int>(); List<int> rp=new List<int>();
//要檢查是否已經報名 //要檢查是否已經報名
foreach (var item in list) foreach (var item in list)
@@ -257,6 +259,13 @@ public class orderController : ApiController
orders.Add(item); orders.Add(item);
foreach (var detail in item.pro_order_detail) foreach (var detail in item.pro_order_detail)
{ {
//要檢查功德項目在這次的法會有沒有
var actItem = actItemList.Where(y => y.actItem_num == detail.actItem_num).FirstOrDefault();
if (actItem==null)
{
continue;
}
//Model.pro_order_detail order_detail = new Model.pro_order_detail(); //Model.pro_order_detail order_detail = new Model.pro_order_detail();
//order_detail.order_no = order.order_no; //order_detail.order_no = order.order_no;
//order_detail.actItem_num = detail.actItem_num; //order_detail.actItem_num = detail.actItem_num;
@@ -276,6 +285,9 @@ public class orderController : ApiController
detail.UpdateTime= DateTime.Now; detail.UpdateTime= DateTime.Now;
detail.start_date= act.startDate_solar; detail.start_date= act.startDate_solar;
detail.due_date= act.endDate_solar; detail.due_date= act.endDate_solar;
detail.printed_files = "";
detail.print_id= GenerateSequentialId(detail, item);
_db.pro_order_detail.Add(detail); _db.pro_order_detail.Add(detail);
} }
@@ -988,11 +1000,12 @@ public class orderController : ApiController
detail.from_id = (item1.change_item_num != null && item1.change_item_num != 0) ? item.f_num: last_detail.from_id; detail.from_id = (item1.change_item_num != null && item1.change_item_num != 0) ? item.f_num: last_detail.from_id;
detail.price = (item1.change_item_num != null && item1.change_item_num != 0) ? item1.price : last_detail.price; detail.price = (item1.change_item_num != null && item1.change_item_num != 0) ? item1.price : last_detail.price;
detail.qty = (item1.change_item_num != null && item1.change_item_num != 0) ? item1.qty : last_detail.qty; detail.qty = (item1.change_item_num != null && item1.change_item_num != 0) ? item1.qty : last_detail.qty;
detail.printed_files = (item1.change_item_num != null && item1.change_item_num != 0) ? item1.printed_files : last_detail.printed_files; detail.printed_files = "";//(item1.change_item_num != null && item1.change_item_num != 0) ? item1.printed_files : last_detail.printed_files;
detail.style = (item1.change_item_num != null && item1.change_item_num != 0) ? item1.style : last_detail.style; detail.style = (item1.change_item_num != null && item1.change_item_num != 0) ? item1.style : last_detail.style;
detail.UpdateTime = DateTime.Now; detail.UpdateTime = DateTime.Now;
detail.start_date = DateTime.Now;//這兩個要用活動的 detail.start_date = DateTime.Now;//這兩個要用活動的
detail.due_date = DateTime.Now;// detail.due_date = DateTime.Now;//
detail.print_id= GenerateSequentialId(detail, new_pro_order);
_db.pro_order_detail.Add(detail); _db.pro_order_detail.Add(detail);
} }
_db.SaveChanges(); _db.SaveChanges();
@@ -1021,6 +1034,132 @@ public class orderController : ApiController
} }
} }
public string GenerateSequentialId(pro_order_detail detail,pro_order order)
{
Model.ezEntities _db = new Model.ezEntities();
string r = detail.print_id;
try
{
bool chk = true;
actItem actitem = null;
int? actitem_id = null;
// 處理子項目的ID生成
if (!(detail.parent_num == null || detail.parent_num == 0))
{
// 1. 查找父項目的資料
var parent_order_item = _db.pro_order_detail.Where(
q => q.num == detail.parent_num).FirstOrDefault();
// 2. 確認父項目存在且當前項目還沒有 print_id
if (parent_order_item != null && string.IsNullOrEmpty(detail.print_id))
{
actitem_id = parent_order_item.actItem_num;
string parent_print_id = parent_order_item.print_id;
// 1. 獲取當前子項目的品項前綴
var currentActItem = _db.actItems
.Where(q => q.num == detail.actItem_num)
.FirstOrDefault();
if (currentActItem != null && !string.IsNullOrEmpty(currentActItem.print_init))
{
var itemPrefix = currentActItem.print_init.Trim();
// 2. 獲取同父項目且同品項的子項目編號
var siblings = _db.pro_order_detail
.Where(q => q.parent_num == detail.parent_num) // 找出同一個父項目的子項目
.Where(q => q.actItem_num == detail.actItem_num) // 同品項
.Where(q => q.print_id != null) // Ensure print_id is not null
.Select(q => q.print_id) // Just select the print_id
.AsEnumerable() // ✅ 合理使用:EF 無法轉換 StartsWith/Contains/Replace 到 SQL
.Where(q => q.StartsWith(parent_print_id)) // Now do string operations in memory
.Where(q => q.Contains(itemPrefix))
.Select(q => q.Trim().Replace("\t", ""))
.Select(q => q.Replace($"{parent_print_id}-{itemPrefix}", ""))
.ToList();
// 3. 將所有序號轉換為數字陣列並過濾無效值
int[] intArray = siblings
.Select(s =>
{
int result;
return int.TryParse(s, out result) ? (int?)result : null;
})
.Where(i => i.HasValue && i.Value != 0)
.Select(i => i.Value)
.ToArray();
// 4. 生成新的序號(最大序號+1,並格式化為兩位數)
int maxNum = 1 + (intArray.Any() ? intArray.Max() : 0);
string formattedNum = maxNum < 10 ? "0" + maxNum : maxNum.ToString();
// 5. 組合新的 print_id(父項目ID-品項前綴序號)
r = $"{parent_print_id}-{itemPrefix}{formattedNum}";
}
}
}
// 處理主項目的ID生成
else
{
actitem_id = detail.actItem_num;
actitem = _db.actItems
.Where(q => q.num == actitem_id).FirstOrDefault();
//var proorder = _db.pro_order.Where(q => q.order_no == detail.order_no).FirstOrDefault();
// 檢查是否需要生成新的 print_id
chk = String.IsNullOrEmpty(r) &&
//actitem != null &&
//proorder != null &&
!string.IsNullOrEmpty(actitem.print_init);
if (chk)
{
// 1. 組合活動和品項的前綴
var print_init = string.IsNullOrEmpty(order?.activity?.print_init) ? "" : order?.activity?.print_init.Trim();
var actitem_print_init = actitem.print_init.Trim();
var combinedPrintInit = print_init + actitem_print_init;
// 2. 查找相同活動和品項的已存在編號
var actitems = _db.pro_order_detail
.Where(q => q.pro_order.activity_num == order.activity_num)
.Where(q => q.actItem_num == detail.actItem_num)
.Where(q => !string.IsNullOrEmpty(q.print_id))
.Where(q => q.print_id.StartsWith(combinedPrintInit))
.Where(q => q.parent_num == 0 || q.parent_num == null)
.Select(q => q.print_id)
.ToList();
// 3. 獲取最大序號
var maxNum = actitems
.Select(item =>
{
var match = Regex.Match(item, @"\d+");
return match.Success ? (int?)int.Parse(match.Value.TrimStart('0')) : null;
})
.Where(num => num.HasValue)
.DefaultIfEmpty(0)
.Max() ?? 0;
// 4. 生成新的序號(四位數格式)
int newNum = maxNum + 1;
string formattedNum = newNum.ToString().PadLeft(4, '0');
// 5. 組合最終的 print_id
r = $"{combinedPrintInit}{formattedNum}";
}
}
}
catch (Exception ex)
{
// 異常處理:記錄錯誤並返回原始 print_id
Console.WriteLine($"Error generating sequential ID: {ex.Message} {ex.StackTrace}");
r = detail.print_id;
}
return r;
}
protected string createOrderNumber() protected string createOrderNumber()
{ {
//Application.Lock(); //Application.Lock();
@@ -8,6 +8,7 @@ window.addEventListener('DOMContentLoaded', event => {
// document.body.classList.toggle('sb-sidenav-toggled'); // document.body.classList.toggle('sb-sidenav-toggled');
//} //}
sidebarToggle.addEventListener('click', event => { sidebarToggle.addEventListener('click', event => {
console.log("QQ");
event.preventDefault(); event.preventDefault();
document.body.classList.toggle('sb-sidenav-toggled'); document.body.classList.toggle('sb-sidenav-toggled');
localStorage.setItem('sb|sidebar-toggle', document.body.classList.contains('sb-sidenav-toggled')); localStorage.setItem('sb|sidebar-toggle', document.body.classList.contains('sb-sidenav-toggled'));
+1 -1
View File
@@ -1,7 +1,7 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="nav.ascx.cs" Inherits="admin_Templates_TBS5ADM001_uc_nav" %> <%@ Control Language="C#" AutoEventWireup="true" CodeFile="nav.ascx.cs" Inherits="admin_Templates_TBS5ADM001_uc_nav" %>
<nav class="sb-topnav navbar navbar-expand navbar-dark bg-dark ps-1 ps-md-2"> <nav class="sb-topnav navbar navbar-expand navbar-dark bg-dark ps-1 ps-md-2">
<!-- Sidebar Toggle--> <!-- Sidebar Toggle-->
<button class="btn btn-link btn-sm order-0 me-0 bg-white bg-opacity-10 rounded-circle" id="sidebarToggle" href="#!"> <button type="button" class="btn btn-link btn-sm order-0 me-0 bg-white bg-opacity-10 rounded-circle" id="sidebarToggle" href="#!">
<i class="mdi mdi-menu"></i> <i class="mdi mdi-menu"></i>
</button> </button>
<!-- Navbar Brand--> <!-- Navbar Brand-->
+1 -1
View File
@@ -233,7 +233,7 @@
checkStatusOptions: [ checkStatusOptions: [
{ text: '', value: '' }, { text: '', value: '' },
{ text: '未核對', value: '1' }, { text: '未核對', value: '1' },
{ text: '核對', value: '2' }, { text: '核對', value: '2' },
{ text: '金額不符', value: '3' }, { text: '金額不符', value: '3' },
{ text: '其他問題', value: '4' }, { text: '其他問題', value: '4' },
{ text: '作廢', value: '5' } { text: '作廢', value: '5' }
+5 -3
View File
@@ -151,7 +151,8 @@
<v-btn icon @click="followerDialog.show = false"><v-icon>mdi-close</v-icon></v-btn> <v-btn icon @click="followerDialog.show = false"><v-icon>mdi-close</v-icon></v-btn>
</v-card-title> </v-card-title>
<v-card-text class="mt-4"> <v-card-text class="mt-4">
<v-text-field v-model="followerDialog.search" label="搜尋信眾" dense outlined @keyup.enter="searchFollower"></v-text-field> <v-text-field v-model="followerDialog.search" label="搜尋信眾" dense outlined
@keydown.enter.prevent="searchFollower"></v-text-field>
<v-data-table :headers="followerDialog.headers" <v-data-table :headers="followerDialog.headers"
:items="followerDialog.items" :items="followerDialog.items"
:loading="followerDialog.loading" :loading="followerDialog.loading"
@@ -336,11 +337,12 @@
}, },
showFollowerDialog() { showFollowerDialog() {
this.followerDialog.show = true; this.followerDialog.show = true;
this.searchFollower(); //this.searchFollower();
}, },
searchFollower() { searchFollower() {
//event.preventDefault();
this.followerDialog.loading = true; this.followerDialog.loading = true;
axios.post('../..../..../../api/follower/GetList', { u_name: this.followerDialog.search }, { params: { page: 1, pageSize: 10 } }) axios.post('/api/follower/GetList', { u_name: this.followerDialog.search }, { params: { page: 1, pageSize: 10 } })
.then(res => { this.followerDialog.items = res.data.list; }) .then(res => { this.followerDialog.items = res.data.list; })
.catch(() => { this.followerDialog.items = []; }) .catch(() => { this.followerDialog.items = []; })
.finally(() => { this.followerDialog.loading = false; }); .finally(() => { this.followerDialog.loading = false; });
+8 -2
View File
@@ -381,6 +381,10 @@
.catch(error => console.log(error)) .catch(error => console.log(error))
}, },
renderTabletContent(item) { renderTabletContent(item) {
//console.log("renderTabletContent:", item, item.f_num_tablet)
if (item.f_num_tablet==="") {
return "";
}
let data = JSON.parse(item.f_num_tablet) let data = JSON.parse(item.f_num_tablet)
let left = data.left_items let left = data.left_items
let mid = data.mid_items let mid = data.mid_items
@@ -414,11 +418,12 @@
this.tablet_list.forEach(x => { this.tablet_list.forEach(x => {
if (x.actitem_num_checked && x.actitem_num_checked == true) { if (x.actitem_num_checked && x.actitem_num_checked == true) {
console.log("OOQ:", x)
//console.log("OOQ:", x.num) //console.log("OOQ:", x.num)
let actItem = this.act_items.find(y => y.act_item_selected.val == x.actitem_num_selected.val) let actItem = this.act_items.find(y => y.act_item_selected.val == x.actitem_num_selected.val)
detail.push({ detail.push({
num: x.num, order_no: x.order_no, change_item_num: x.changeActitem, num: x.num, order_no: x.order_no, change_item_num: x.changeActitem,
price: actItem.price, qty: 1, style: actItem.act_item_selected.style, printed_files: actItem.files[0].num price: actItem.price, qty: 1, style: actItem.act_item_selected.style, printed_files: ""//actItem.files[0].num
}) })
// console.log("saveOrder:", x, x.num, x.order_no) // console.log("saveOrder:", x, x.num, x.order_no)
} }
@@ -429,9 +434,10 @@
this.message_dialog.message = "沒有選擇功德項目,如果無法選擇,請使用一般報名程序" this.message_dialog.message = "沒有選擇功德項目,如果無法選擇,請使用一般報名程序"
return false return false
} }
//放主檔資料, //放主檔資料,
let main = { let main = {
activity_num: this.num, f_num: this.follower.num, activity_num: this.num, f_num: this.follower?.num,
details: detail details: detail
} }
//console.log("saveOrderDetail:",detail); //console.log("saveOrderDetail:",detail);
+13 -10
View File
@@ -270,14 +270,15 @@
}, },
watch: { watch: {
options: { options: {
handler() { handler() {
if (this.isSearched) { //if (this.isSearched) {
this.getDefault() this.getDefault()
} //}
else { //else {
this.data_table.loading = false; // this.data_table.loading = false;
} //}
}, },
deep: true, deep: true,
}, },
@@ -413,12 +414,14 @@
}, },
getDefault(clearpage = false) { getDefault(clearpage = false) {
const { sortBy, sortDesc, page, itemsPerPage } = this.options const { sortBy, sortDesc, page, itemsPerPage } = this.options
//page = this.data_table.page;
const params = { const params = {
sortBy: sortBy[0], sortDesc: sortDesc[0], sortBy: sortBy[0], sortDesc: sortDesc[0],
page: clearpage ? '1' : page, pageSize: itemsPerPage page: clearpage ? '1' : page, pageSize: itemsPerPage
}; };
this.data_table.loading = true this.data_table.loading = true
sessionStorage.setItem('orderpage', clearpage ? '1' : page); //sessionStorage.setItem('orderpage', clearpage ? '1' : page);
axios axios
.post(HTTP_HOST + 'api/order/GetList', this.search, { params: params }) .post(HTTP_HOST + 'api/order/GetList', this.search, { params: params })
.then(response => { .then(response => {
@@ -427,7 +430,7 @@
this.data_table.loading = false this.data_table.loading = false
const dataToStore = JSON.stringify(this.data_table); const dataToStore = JSON.stringify(this.data_table);
sessionStorage.setItem("order_list_cache", dataToStore); //sessionStorage.setItem("order_list_cache", dataToStore);
}) })
.catch(error => console.log(error)) .catch(error => console.log(error))
}, },
@@ -884,11 +887,11 @@
v-model="print_search.chk_noact" v-model="print_search.chk_noact"
:label="`非活動報名`" :label="`非活動報名`"
></v-checkbox> --%> ></v-checkbox> --%>
<v-checkbox <%-- <v-checkbox
v-model="print_search.chk_hasact" v-model="print_search.chk_hasact"
:label="`活動報名`" :label="`活動報名`"
@change="chk_hasact_change" @change="chk_hasact_change"
></v-checkbox> ></v-checkbox>--%>
<%-- <v-row densee class="pt-3" > <%-- <v-row densee class="pt-3" >
<v-col :cols="10" class="pt-5" > --%> <v-col :cols="10" class="pt-5" > --%>
<div class="input-group mb-3 single-line d-none" data-search-control="search2" @click="print_search.chk_hasact && search_show(search_dialog.controls.search2)" :disabled="!print_search.chk_hasact"> <div class="input-group mb-3 single-line d-none" data-search-control="search2" @click="print_search.chk_hasact && search_show(search_dialog.controls.search2)" :disabled="!print_search.chk_hasact">
@@ -957,7 +960,7 @@
<v-card-text > <v-card-text >
<v-row> <v-row>
<v-col v-for="item in search_dialog.current.keys" <v-col v-for="item in search_dialog.current.keys"
:cols="search_dialog.current.keys.length>1?6:12" > :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-text-field v-model="item.value" :label="item.title" v-if="item.visible===undefined || item.visible==true "></v-text-field>
</v-col> </v-col>
<v-col cols="12" class="text-end"> <v-col cols="12" class="text-end">
+10 -7
View File
@@ -900,6 +900,7 @@
//console.log("底家:",this.data_table.selected); //console.log("底家:",this.data_table.selected);
localStorage.setItem("item", item.actitem_num_selected.val); localStorage.setItem("item", item.actitem_num_selected.val);
localStorage.setItem("list", JSON.stringify(list)); localStorage.setItem("list", JSON.stringify(list));
localStorage.setItem("mode","preview");
document.body.appendChild(form); // Not entirely sure if this is necessary document.body.appendChild(form); // Not entirely sure if this is necessary
form.submit(); form.submit();
@@ -910,7 +911,7 @@
async editTabletNew(item) { async editTabletNew(item) {
this.editedIndex = this.desserts.indexOf(item); this.editedIndex = this.desserts.indexOf(item);
this.editedItem = $.extend(true, {}, item); this.editedItem = $.extend(true, {}, item);
console.log("editTabletNew:",this.editedItem,item)
try { try {
//document.getElementById("tablet_edit_new_iframe").contentWindow.location.reload(); //document.getElementById("tablet_edit_new_iframe").contentWindow.location.reload();
// 如果是新項目,先保存 // 如果是新項目,先保存
@@ -920,6 +921,7 @@
if (savedItem) { if (savedItem) {
this.$set(this.desserts, this.editedIndex, savedItem); this.$set(this.desserts, this.editedIndex, savedItem);
this.editedItem = $.extend(true, {}, savedItem); this.editedItem = $.extend(true, {}, savedItem);
console.log("savedItem:", this.editedItem)
} }
} }
// 先發送消息 // 先發送消息
@@ -1129,7 +1131,8 @@
async save(shouldClose = true) { async save(shouldClose = true) {
if (this.editedIndex > -1) { if (this.editedIndex > -1) {
if (this.order_no != '') { if (this.order_no != '') {
console.log("ok:",this.editedItem); this.editedItem.order_no=this.order_no
//console.log("ok:",this.editedItem);
//chcck necessary params //chcck necessary params
if (this.editedItem.actitem_num_selected.val != 0 && if (this.editedItem.actitem_num_selected.val != 0 &&
this.editedItem.keyin1_selected.val !=0 && this.editedItem.keyin1_selected.val !=0 &&
@@ -1137,11 +1140,11 @@
/* (this.editedItem.category=="1"? this.editedItem.from_id_selected.val != 0 : true) &&*/ /* (this.editedItem.category=="1"? this.editedItem.from_id_selected.val != 0 : true) &&*/
this.requireData(this.editedItem.qty, (this.editedItem.num == 0 ? false : true)) ) /* qty為0視為不需要此項目,不儲存此筆資料*/ this.requireData(this.editedItem.qty, (this.editedItem.num == 0 ? false : true)) ) /* qty為0視為不需要此項目,不儲存此筆資料*/
{ {
console.log(this.editedItem); //console.log(this.editedItem);
//check price //check price
if (this.editedItem.pay <= this.editedItem.price * this.editedItem.qty) { if (this.editedItem.pay <= this.editedItem.price * this.editedItem.qty) {
console.log(this.editedItem.f_num_selected.val); //console.log(this.editedItem.f_num_selected.val);
console.log(this.editedItem.from_id_selected.val); //console.log(this.editedItem.from_id_selected.val);
//check qty //check qty
//數量不可小於掛單明細的數量 //數量不可小於掛單明細的數量
if (this.editedItem.qty >= this.editedItem.writeBedQty + this.editedItem.notBedQty) { if (this.editedItem.qty >= this.editedItem.writeBedQty + this.editedItem.notBedQty) {
@@ -2176,9 +2179,9 @@
<v-icon title="刪除" color="red" class="mr-2" @click="deleteItem(item)"> <v-icon title="刪除" color="red" class="mr-2" @click="deleteItem(item)">
mdi-delete mdi-delete
</v-icon> </v-icon>
<%--<v-icon title="編輯牌位" color="blue" class="mr-2" @click="editTablet(item);"> <v-icon title="編輯牌位" color="blue" class="mr-2" @click="editTablet(item);">
mdi-file-document-edit-outline mdi-file-document-edit-outline
</v-icon> --%> </v-icon>
<v-icon title="編輯牌位New" color="blue" class="mr-2" @click="editTabletNew(item);"> <v-icon title="編輯牌位New" color="blue" class="mr-2" @click="editTabletNew(item);">
mdi-file-document-edit-outline mdi-file-document-edit-outline
</v-icon> </v-icon>
+3 -2
View File
@@ -246,7 +246,7 @@
if (this.search_dialog.current.id == 'search7' || this.search_dialog.current.id == 'search8') { if (this.search_dialog.current.id == 'search7' || this.search_dialog.current.id == 'search8') {
search['num'] = this.follower_id; search['num'] = this.follower_id;
} }
console.log("search_get", api_url, search, params, this.options); //console.log("search_get", api_url, search, params, this.options);
this.search_dialog.loading = true this.search_dialog.loading = true
axios.post(api_url, search, { params: params }) axios.post(api_url, search, { params: params })
.then(response => { .then(response => {
@@ -337,7 +337,7 @@
}, },
multiPrintNew() { multiPrintNew() {
let list = [] let list = []
console.log("print_data.selected:",this.print_data.item); //console.log("print_data.selected:",this.print_data.item);
this.print_data.selected.forEach(item => { this.print_data.selected.forEach(item => {
list.push({ list.push({
num: item.num, print_id: item.print_id, order_no: item.order_no, from_id: item.from_id, num: item.num, print_id: item.print_id, order_no: item.order_no, from_id: item.from_id,
@@ -406,6 +406,7 @@
addHiddenField("title", `${item.act_item_selected} / ${item.subject}`); addHiddenField("title", `${item.act_item_selected} / ${item.subject}`);
localStorage.setItem("item", item.act_item_selected?.val); localStorage.setItem("item", item.act_item_selected?.val);
localStorage.setItem("list", JSON.stringify(list)); localStorage.setItem("list", JSON.stringify(list));
localStorage.setItem("mode","print");
document.body.appendChild(form); // Not entirely sure if this is necessary document.body.appendChild(form); // Not entirely sure if this is necessary
form.submit(); form.submit();
+12 -3
View File
@@ -73,7 +73,7 @@
</div> </div>
</div> </div>
<span class="btn btn-primary no-print" onclick="Printer.print()">列印</span> <span class="btn btn-primary no-print" id="printBtn" onclick="Printer.print()">列印</span>
<select id="paperSizeSel" onchange="Printer.render()"> <select id="paperSizeSel" onchange="Printer.render()">
<!-- onchange="Printer.render()"--> <!-- onchange="Printer.render()"-->
<option value="">紙張尺寸</option> <option value="">紙張尺寸</option>
@@ -128,6 +128,7 @@
observer: null, observer: null,
isInit: true, isInit: true,
toast: null, toast: null,
mode:"",
bg: [ bg: [
{ name: "超薦1", path: "../../../admin/print/html/tablet-1_new.svg" }, { name: "超薦1", path: "../../../admin/print/html/tablet-1_new.svg" },
{ name: "超薦2", path: "../../../admin/print/html/tablet-1B_new.svg" }, { name: "超薦2", path: "../../../admin/print/html/tablet-1B_new.svg" },
@@ -138,6 +139,7 @@
this.toast = new bootstrap.Toast($('#liveToast')); this.toast = new bootstrap.Toast($('#liveToast'));
let HTTP_HOST = "<%=UrlHost()%>"; let HTTP_HOST = "<%=UrlHost()%>";
this.http_host = HTTP_HOST; this.http_host = HTTP_HOST;
// //
Promise.all([ Promise.all([
this.getActItem(), this.getActItem(),
@@ -283,6 +285,7 @@
this.printData.forEach(x => { this.printData.forEach(x => {
let style = self.allStyle.find(y => y.styleID == x.style); let style = self.allStyle.find(y => y.styleID == x.style);
//用來印內容的尺寸 //用來印內容的尺寸
console.log("style.paperSize:", style.paperSize)
let size = self.allSize.find(y => y.paperID == style.paperSize); let size = self.allSize.find(y => y.paperID == style.paperSize);
//包含空白用來折的尺寸 //包含空白用來折的尺寸
let printSize = self.allSize.find(y => y.paperID == style.printSize); let printSize = self.allSize.find(y => y.paperID == style.printSize);
@@ -384,7 +387,7 @@
"column-gap": "1px", "column-gap": "1px",
"row-gap": "1px", "row-gap": "1px",
"align-items": "center", "align-items": "center",
"justify-content": "space-between", "justify-content": "start",
}); });
mid.forEach(z => { mid.forEach(z => {
@@ -1192,10 +1195,16 @@
}, 1200); }, 1200);
}, },
} }
$(document).click(function (e) { $(document).ready(function (e) {
//if (!$("#customMenu").is(e.target) && $("#customMenu").has(e.target).length === 0) { //if (!$("#customMenu").is(e.target) && $("#customMenu").has(e.target).length === 0) {
// $("#customMenu").hide(); // $("#customMenu").hide();
//} //}
console.log(localStorage.getItem("mode"))
if (localStorage.getItem("mode") && localStorage.getItem("mode") == "preview") {
//this.mode = "preview"
$("#printBtn").attr("style", "display:none")
$("#customMenu").attr("style","display:none")
}
}); });
$(() => Printer.init()); $(() => Printer.init());
</script> </script>
+14 -9
View File
@@ -1249,7 +1249,7 @@
} else if ($(self.selectedElement).children().first().hasClass("lefttitle") || } else if ($(self.selectedElement).children().first().hasClass("lefttitle") ||
$(self.selectedElement).children().first().hasClass("righttitle") || $(self.selectedElement).children().first().hasClass("righttitle") ||
$(self.selectedElement).children().first().hasClass("address")) { $(self.selectedElement).children().first().hasClass("address")) {
//要重新render陽上
let data = [] let data = []
if ($(self.selectedElement).children().first().hasClass("lefttitle")) { if ($(self.selectedElement).children().first().hasClass("lefttitle")) {
$(self.selectedElement).empty(); $(self.selectedElement).empty();
@@ -1340,7 +1340,7 @@
"align-items": "flex-start", "align-items": "flex-start",
"justify-content": "start", "justify-content": "start",
}); });
console.log("吼優:",mid); //console.log("吼優:",mid);
mid.forEach(x => { mid.forEach(x => {
let dd = $(`<div>${x}</div>`).css({ let dd = $(`<div>${x}</div>`).css({
"margin-bottom": "10px", "margin-bottom": "10px",
@@ -1378,7 +1378,7 @@
"column-gap": "1px", "column-gap": "1px",
"row-gap": "1px", "row-gap": "1px",
"align-items": "center", "align-items": "center",
"justify-content": "space-between", "justify-content": "start",
}); });
mid.forEach(z => { mid.forEach(z => {
@@ -1594,6 +1594,9 @@
self.renderItem(element); self.renderItem(element);
} }
$("#toast_body").html(`${"新增成功"}`) $("#toast_body").html(`${"新增成功"}`)
$("#family_txt").val("");
$("#title_txt").val("");
$("#deceased_sel").val("False")
self.toast.show(); self.toast.show();
} else { } else {
@@ -1604,6 +1607,7 @@
event.preventDefault() event.preventDefault()
//console.log("tabletItem:", designer.tabletItem); //console.log("tabletItem:", designer.tabletItem);
//拚牌位的內容 //拚牌位的內容
console.log("AA")
let self = this; let self = this;
let tablet = { let tablet = {
mid_items: designer.family_deceased_N_selected, mid_items: designer.family_deceased_N_selected,
@@ -1613,7 +1617,7 @@
mid_right: designer.family_right_title, mid_right: designer.family_right_title,
addr_items: designer.family_address addr_items: designer.family_address
} }
//console.log(JSON.stringify(tablet)); console.log("BB")
var pro_order_detail = var pro_order_detail =
{ {
num: designer.tabletItem.num <= 0 ? null : designer.tabletItem.num, num: designer.tabletItem.num <= 0 ? null : designer.tabletItem.num,
@@ -1639,7 +1643,7 @@
customize_data: designer.tabletItem.customize_data, customize_data: designer.tabletItem.customize_data,
style: designer.selectStyle.style style: designer.selectStyle.style
} }
console.log("CC")
await axios await axios
.post('/api/order/SaveDetailData', pro_order_detail) .post('/api/order/SaveDetailData', pro_order_detail)
.then(response => { .then(response => {
@@ -1734,6 +1738,7 @@
//designer.toast.show(); //designer.toast.show();
//designer.reset(); //designer.reset();
let e = event.originalEvent; let e = event.originalEvent;
console.log("QOO");
if (e.origin === window.parent.location.origin) { if (e.origin === window.parent.location.origin) {
//console.log('editor.html - origin check passed'); //console.log('editor.html - origin check passed');
//console.log('editor.html - received data:', event.data); //console.log('editor.html - received data:', event.data);
@@ -1744,7 +1749,7 @@
designer.family_right_title = []; designer.family_right_title = [];
designer.http_host = receivedData.host; designer.http_host = receivedData.host;
designer.follower_id = receivedData.follower_id; designer.follower_id = receivedData.follower_id;
console.log("三小:", receivedData.tabletItem)
if (receivedData.tabletItem) { if (receivedData.tabletItem) {
//console.log('editor.html - updating tabletItem:', receivedData.tabletItem); //console.log('editor.html - updating tabletItem:', receivedData.tabletItem);
designer.tabletItem = receivedData.tabletItem; designer.tabletItem = receivedData.tabletItem;
@@ -1752,9 +1757,9 @@
designer.familyMembers = receivedData.familyMembers; // 更新 familyMembers designer.familyMembers = receivedData.familyMembers; // 更新 familyMembers
//console.log("app mounted, window message: ", this.familyMembers, receivedData); //console.log("app mounted, window message: ", this.familyMembers, receivedData);
} }
if (receivedData.tabletItem) { //if (receivedData.tabletItem) {
designer.tabletItem = receivedData.tabletItem; // designer.tabletItem = receivedData.tabletItem;
} //}
//console.log("actitem:", receivedData.tabletItem.actitem_num_selected.val); //console.log("actitem:", receivedData.tabletItem.actitem_num_selected.val);
if (receivedData.tabletItem.style) { if (receivedData.tabletItem.style) {
+4 -4
View File
@@ -175,7 +175,7 @@
class="checkbox-narrow d-inline-flex align-center" /> class="checkbox-narrow d-inline-flex align-center" />
</v-list-item-action> </v-list-item-action>
<v-list-item-content> <v-list-item-content>
<v-list-item-title> <v-list-item-title :title="member.fam_name">
<span class="badge-zero" v-if="member.num==0">0</span> <span class="badge-zero" v-if="member.num==0">0</span>
<span class="badge-deceased" v-if="member.deceased">{{ member.deceased ? '卍' : '' }}</span> <span class="badge-deceased" v-if="member.deceased">{{ member.deceased ? '卍' : '' }}</span>
{{ member.fam_name }} {{ member.fam_name }}
@@ -215,7 +215,7 @@
<v-list-item-group> <v-list-item-group>
<v-list-item v-for="member in family_deceased_Y_unselected" :key="member.fam_name"> <v-list-item v-for="member in family_deceased_Y_unselected" :key="member.fam_name">
<v-list-item-content> <v-list-item-content>
<v-list-item-title> <v-list-item-title :title="member.fam_name">
<span class="badge-deceased" v-if="member.deceased">{{ member.deceased ? '卍' : '' }}</span> <span class="badge-deceased" v-if="member.deceased">{{ member.deceased ? '卍' : '' }}</span>
{{ member.fam_name }} {{ member.fam_name }}
<v-chip v-if="member.fam_title" small> <v-chip v-if="member.fam_title" small>
@@ -265,7 +265,7 @@
class="checkbox-narrow d-inline-flex align-center" /> class="checkbox-narrow d-inline-flex align-center" />
</v-list-item-action> </v-list-item-action>
<v-list-item-content> <v-list-item-content>
<v-list-item-title> <v-list-item-title :title="member.fam_name">
<span class="badge-zero" v-if="member.num==0">0</span> <span class="badge-zero" v-if="member.num==0">0</span>
<span class="badge-deceased" v-if="member.deceased" >{{ member.deceased ? '卍' : '' }}</span> <span class="badge-deceased" v-if="member.deceased" >{{ member.deceased ? '卍' : '' }}</span>
{{ member.fam_name }} {{ member.fam_name }}
@@ -305,7 +305,7 @@
<v-list-item-group> <v-list-item-group>
<v-list-item v-for="member in family_deceased_N_unselected" :key="member.fam_name"> <v-list-item v-for="member in family_deceased_N_unselected" :key="member.fam_name">
<v-list-item-content> <v-list-item-content>
<v-list-item-title> <v-list-item-title :title="member.fam_name">
<span class="badge-deceased" v-if="member.deceased" >{{ member.deceased ? '卍' : '' }}</span> <span class="badge-deceased" v-if="member.deceased" >{{ member.deceased ? '卍' : '' }}</span>
{{ member.fam_name }} {{ member.fam_name }}
<v-chip v-if="member.fam_title" small> <v-chip v-if="member.fam_title" small>
+12
View File
@@ -37,6 +37,18 @@ public partial class admin_printpw_index : MyWeb.function
Repeater1.DataSource = oderList; Repeater1.DataSource = oderList;
Repeater1.DataBind(); Repeater1.DataBind();
} }
else if (!String.IsNullOrEmpty(Request["orders"]))
{
var orders = Request["orders"];
var oderList = _db.pro_order_detail
.Where(u =>orders.Contains( u.order_no))
.Where(u => (u.parent_num != null)
|| u.actItem.subject.Contains("牌")
|| !string.IsNullOrEmpty(u.f_num_tablet))
.Select(u => new { detail_num = u.num, actItem_num = u.actItem_num }).ToArray();
Repeater1.DataSource = oderList;
Repeater1.DataBind();
}
else else
{ {
Response.Clear(); Response.Clear();
+10 -3
View File
@@ -72,7 +72,7 @@
.catch(error => console.log(error)) .catch(error => console.log(error))
}, },
yulan_print() { yulan_print() {
_url = HTTP_HOST + '/admin/printpw/index.aspx'; _url = HTTP_HOST + 'admin/printpw/index.aspx';
var form = document.createElement("form"); var form = document.createElement("form");
form.method = "POST"; form.method = "POST";
form.action = _url; form.action = _url;
@@ -86,7 +86,14 @@
hiddenField.value = value; hiddenField.value = value;
form.appendChild(hiddenField); form.appendChild(hiddenField);
}; };
addHiddenField("activity_num", this.selected_activity); let orders=[]
this.order_data.selected.forEach(x => {
orders.push(x.order_no)
})
if (orders.length==0) {
return false;
}
addHiddenField("orders", orders);
document.body.appendChild(form); // Not entirely sure if this is necessary document.body.appendChild(form); // Not entirely sure if this is necessary
form.submit(); form.submit();
document.body.removeChild(form); document.body.removeChild(form);
@@ -143,9 +150,9 @@
v-model="order_data.selected" v-model="order_data.selected"
:items="order_data.list" :items="order_data.list"
item-key="order_no" item-key="order_no"
show-select
:headers="order_data.header" :headers="order_data.header"
:loading="order_data.loading" :loading="order_data.loading"
show-select
class="elevation-1"> class="elevation-1">
<template #item.detail ="{item}"> <template #item.detail ="{item}">
{{item.detail.count}} {{item.detail.count}}