379 lines
17 KiB
Plaintext
379 lines
17 KiB
Plaintext
<%@ Page Title="" Language="C#" MasterPageFile="~/admin/Templates/TBS5ADM001/MasterPage.master" AutoEventWireup="true" CodeFile="yulan.aspx.cs" Inherits="admin_printpw_yulan" %>
|
|
<%@ Register Src="~/admin/_uc/alert.ascx" TagPrefix="uc1" TagName="alert" %>
|
|
|
|
<asp:Content ID="Content1" ContentPlaceHolderID="page_header" Runat="Server">
|
|
</asp:Content>
|
|
<asp:Content ID="Content3" ContentPlaceHolderID="page_nav" runat="Server">
|
|
<div class="mb-2 mb-sm-0">
|
|
<label>請選擇需要預覽的活動</label>
|
|
<div class="input-group mb-3" data-search-control="search2" @click="search_show(search_dialog.controls.search2)">
|
|
<input class="form-control search-text" type="text" readonly
|
|
id="activity_txt" runat="server" placeholder="活動(法會)" value="">
|
|
<asp:HiddenField ID="activity" runat="server" Value="" />
|
|
<button class="btn btn-outline-secondary" type="button">
|
|
<i class="mdi mdi-view-list-outline"></i>
|
|
</button>
|
|
</div>
|
|
<%-- <select class="form-select" v-model="selected_activity">
|
|
<option value="-1">請選擇活動</option>
|
|
<option v-for="item in activity_list" :key="item.activity_num" :value="item.num">
|
|
{{item.subject}}
|
|
</option>
|
|
</select>--%>
|
|
</div>
|
|
<div>
|
|
<a @click="yulan_print" class="btn btn-primary">列印預覽牌位</a>
|
|
</div>
|
|
|
|
<v-dialog v-model="search_dialog.show" max-width="700px">
|
|
<v-card>
|
|
<v-card-title class="justify-space-between grey lighten-2">
|
|
查詢:{{search_dialog.current.title}}
|
|
<v-btn icon @click="search_dialog.show=false; search_dialog.page = 1;"><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-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="options"
|
|
@click:row="search_select"
|
|
:loading="search_dialog.loading"
|
|
></v-data-table>
|
|
</v-card-text>
|
|
<v-card-actions>
|
|
</v-card-actions>
|
|
</v-card>
|
|
</v-dialog>
|
|
</asp:Content>
|
|
|
|
<asp:Content ID="Script_Content" ContentPlaceHolderID="footer_script" runat="server">
|
|
<script>
|
|
Vue.filter('timeString', function (value, myFormat) {
|
|
return value == null || value == "" ? "" : moment(value).format(myFormat || 'YYYY-MM-DD, HH:mm:ss');
|
|
});
|
|
let VueApp = new Vue({
|
|
el: '#app',
|
|
vuetify: new Vuetify(vuetify_options),
|
|
data() {
|
|
return {
|
|
activity_list: [],
|
|
options: {},
|
|
order_data: {
|
|
loading: false,
|
|
list: [],
|
|
selected: [],
|
|
count: 0,
|
|
header: [
|
|
{ text: '單號', value: 'order_no' },
|
|
{ text: '姓名', value: 'u_name' },
|
|
{ text: '報名日期', value: 'up_time' },
|
|
{ text: '報名活動', value: 'subject', align: 'start' },
|
|
{ text: '單據狀態', value: 'keyin1_txt' },
|
|
{ text: '牌位数量', value: 'detail.count' },
|
|
|
|
{ text: '預覽', value: 'print'}
|
|
],
|
|
|
|
},
|
|
search_dialog: {
|
|
controls: {
|
|
search2: {
|
|
id: 'search2',
|
|
title: '活動(法會)',
|
|
text_prop: 'subject',
|
|
value_prop: 'num',
|
|
keys: [
|
|
{ id: 'num', title: '編號', value: '' },
|
|
{ id: 'subject', title: '活動(法會)名稱', value: '' },
|
|
],
|
|
api_url: HTTP_HOST + 'api/activity/GetList',
|
|
columns: [
|
|
{ id: 'num', title: '編號' },
|
|
{ id: 'subject', title: '活動(法會)名稱' },
|
|
],
|
|
selected: {},
|
|
select(item, t) {
|
|
|
|
|
|
}
|
|
},
|
|
},
|
|
show: false,
|
|
current: {},
|
|
list: [],
|
|
count: 0,
|
|
page: 1,
|
|
loading: false,
|
|
footer: {
|
|
showFirstLastPage: true,
|
|
disableItemsPerPage: true,
|
|
itemsPerPageAllText: '',
|
|
itemsPerPageText: '',
|
|
//'items-per-page-options': [10, 20, 30, 40, 50, 100]
|
|
},
|
|
},
|
|
selected_activity: '-1',
|
|
search: {
|
|
kind: 0,
|
|
subject: '',
|
|
}
|
|
}
|
|
},
|
|
methods: {
|
|
get_activity() {
|
|
//const { sortBy, sortDesc, page, itemsPerPage } = this.options
|
|
const params = {
|
|
page: 1, pageSize: 10
|
|
};
|
|
//this.data_table.loading = true
|
|
this.order_data.loading = true
|
|
axios
|
|
.post(HTTP_HOST + 'api/activity/GetList', this.search, { params: params })
|
|
.then(response => {
|
|
this.activity_list = response.data.list
|
|
//this.data_table.count = response.data.count;
|
|
//this.data_table.loading = false
|
|
this.order_data.loading = false
|
|
})
|
|
.catch(error => console.log(error))
|
|
},
|
|
yulan_print() {
|
|
_url = HTTP_HOST + 'admin/printpw/index.aspx';
|
|
var form = document.createElement("form");
|
|
form.method = "POST";
|
|
form.action = _url;
|
|
form.target = "_blank"; // Open the result in a new tab
|
|
|
|
// Helper function to add hidden fields
|
|
const addHiddenField = (name, value) => {
|
|
const hiddenField = document.createElement("input");
|
|
hiddenField.type = "hidden";
|
|
hiddenField.name = name;
|
|
hiddenField.value = value;
|
|
form.appendChild(hiddenField);
|
|
};
|
|
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
|
|
form.submit();
|
|
document.body.removeChild(form);
|
|
},
|
|
yulan_single(item) {
|
|
_url = HTTP_HOST + '/admin/printpw/index.aspx';
|
|
var form = document.createElement("form");
|
|
form.method = "POST";
|
|
form.action = _url;
|
|
form.target = "_blank"; // Open the result in a new tab
|
|
|
|
// Helper function to add hidden fields
|
|
const addHiddenField = (name, value) => {
|
|
const hiddenField = document.createElement("input");
|
|
hiddenField.type = "hidden";
|
|
hiddenField.name = name;
|
|
hiddenField.value = value;
|
|
form.appendChild(hiddenField);
|
|
};
|
|
addHiddenField("order_no", item.order_no);
|
|
document.body.appendChild(form); // Not entirely sure if this is necessary
|
|
form.submit();
|
|
document.body.removeChild(form);
|
|
},
|
|
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.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;
|
|
});
|
|
if (this.search_dialog.current.id == 'search5') {
|
|
search['num'] = this.activity_id;
|
|
}
|
|
if (this.search_dialog.current.id == 'search4') {
|
|
search['num'] = this.follower_id;
|
|
}
|
|
if (this.search_dialog.current.id == 'search6') {
|
|
search['num'] = this.follower_id;
|
|
}
|
|
if (this.search_dialog.current.id == 'search7' || this.search_dialog.current.id == 'search8') {
|
|
search['num'] = this.follower_id;
|
|
}
|
|
//console.log("search_get", api_url, search, params, this.options);
|
|
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 => {
|
|
console.log(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) => {
|
|
//console.log("search_headers:", t, i);
|
|
r.push({
|
|
text: t.title,
|
|
width: t.width,
|
|
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;
|
|
//牌位
|
|
if (curr.id == 'search7') {
|
|
this.editedItem.f_num_tablet = curr.selected[curr.text_prop];
|
|
} else if (curr.id == 'search8') {
|
|
this.editedItem.from_id_tablet = curr.selected[curr.text_prop];
|
|
} else {
|
|
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(this.editedItem, row);
|
|
}
|
|
this.search_dialog.show = false;
|
|
this.search_dialog.page = 1;
|
|
this.selected_activity = row.num
|
|
//this.get_activity()
|
|
//console.log(row, row["u_name"], row["f_number"], curr.id, target);
|
|
},
|
|
|
|
//get_activity() {
|
|
// const params = {
|
|
// page: 1, pageSize: 1000
|
|
// };
|
|
// let curr = this.search_dialog.current;
|
|
// let target = $(`[data-search-control=${curr.id}]`)
|
|
// this.search = { num: target.children("input:hidden").val() }
|
|
// this.order_data.loading = true
|
|
// axios
|
|
// .post(HTTP_HOST + 'api/activity/GetActRelaList', this.search, { params: params })
|
|
// .then(response => {
|
|
// let dd=response.data
|
|
// this.order_data.list = dd.list
|
|
|
|
// this.order_data.list.forEach(val => {
|
|
|
|
// val.files.forEach(y => {
|
|
// y.list.forEach(z => {
|
|
|
|
// if (z.printed_files!=null && z.printed_files.includes(y.num.toString())) {
|
|
// z.isPrinted = true
|
|
// }
|
|
// }
|
|
// )
|
|
|
|
// })
|
|
|
|
// //if(val.files.list) val.files.num
|
|
// });
|
|
// this.order_data.count = dd.count;
|
|
// this.order_data.loading = false
|
|
// })
|
|
// .catch(error => console.log(error))
|
|
//},
|
|
},
|
|
mounted() {
|
|
this.get_activity()
|
|
},
|
|
watch: {
|
|
options: {
|
|
handler() {
|
|
this.search_get()
|
|
},
|
|
deep: true,
|
|
},
|
|
selected_activity(newValue, oldValue) {
|
|
const params = {
|
|
page: 1, pageSize: 100
|
|
};
|
|
console.log(newValue)
|
|
if (newValue !== oldValue) {
|
|
axios
|
|
.post(HTTP_HOST + 'api/orderdetail/GetList', { activity_num: this.selected_activity }, { params: params })
|
|
.then(response => {
|
|
this.order_data.list = response.data.list
|
|
})
|
|
.catch(error => console.log(error))
|
|
}
|
|
},
|
|
'order_data.selected'(newValue, oldValue){
|
|
console.log(newValue)
|
|
}
|
|
}
|
|
})
|
|
</script>
|
|
</asp:Content>
|
|
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
|
|
<div id="content" class="container-md">
|
|
<v-data-table
|
|
v-model="order_data.selected"
|
|
:items="order_data.list"
|
|
item-key="order_no"
|
|
show-select
|
|
:headers="order_data.header"
|
|
:loading="order_data.loading"
|
|
class="elevation-1">
|
|
|
|
<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
|
|
</v-icon>
|
|
</template>
|
|
</v-data-table>
|
|
</div>
|
|
</asp:Content> |