改太多
This commit is contained in:
1 parent
be5352efed
commit
1cb2a7a35e
48 files changed
+17970
-485
No files matched your search
@@ -6,7 +6,7 @@
|
||||
<div class="mb-2 mb-sm-0 d-flex align-items-center gap-2">
|
||||
<v-text-field v-model="query.start_date" label="活動起始日" type="date" dense outlined></v-text-field>
|
||||
<v-text-field v-model="query.end_date" label="活動結束日" type="date" dense outlined></v-text-field>
|
||||
<button class="btn btn-primary" @click="queryActivity">查詢</button>
|
||||
<button class="btn btn-primary" @click.prevent="queryActivity">查詢</button>
|
||||
<%--<span>查看疏文</span>
|
||||
<select v-model="currentActivityNum" @change="onActivityChange" class="form-select" style="width: auto;">
|
||||
<option value="">請選擇要查看的活動</option>
|
||||
@@ -40,8 +40,80 @@
|
||||
<v-col cols="12" md="3">
|
||||
<v-text-field v-model="query.sStart" label="超薦列印編號前置" type="text" dense outlined></v-text-field>
|
||||
</v-col>
|
||||
<v-col cols="12" md="2">
|
||||
<button class="btn btn-primary" @click.prevent="processShuwen">產生疏文</button>
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
<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"
|
||||
show-select
|
||||
hide-default-footer
|
||||
:page.sync="data_table.page"
|
||||
:items-per-page.sync="data_table.pageSize"
|
||||
class="elevation-1">
|
||||
<template #item.up_time="{ item }" >
|
||||
{{ item.up_time|timeString('YYYY/MM/DD') }}
|
||||
</template>
|
||||
<template #item.u_name="{ item }" >
|
||||
{{ item.u_name }}
|
||||
</template>
|
||||
<template #item.status="{ item }" >
|
||||
<a v-if="item.f_num != null && item.activity_num != null && item.status == 0" @click="checkIn(item)" class="btn btn-outline-secondary btn-sm"><i class="mdi mdi-account"></i>報到</a>
|
||||
<a v-if="item.f_num != null && item.activity_num != null && item.status == 1" class="btn btn-outline-secondary btn-sm opacity-50" style="pointer-events: none" ><i class="mdi mdi-account-check"></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-container>
|
||||
|
||||
<v-snackbar
|
||||
v-model="snackbar.show"
|
||||
timeout="2000">
|
||||
{{ snackbar.text }}
|
||||
<template v-slot:action="{ attrs }">
|
||||
<v-btn
|
||||
text
|
||||
v-bind="attrs"
|
||||
@click="snackbar.show = false"
|
||||
>
|
||||
關閉
|
||||
</v-btn>
|
||||
</template>
|
||||
</v-snackbar>
|
||||
</template>
|
||||
<%--<div v-if="currentActivityNum">
|
||||
<div><h2 style="text-align:center">消災疏文</h2></div>
|
||||
@@ -76,6 +148,9 @@
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content5" 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),
|
||||
@@ -87,27 +162,124 @@
|
||||
ShuWenItem: '',
|
||||
updateShuWenLoading: false,
|
||||
latest: false,
|
||||
options: { multiSort: false },
|
||||
snackbar: {
|
||||
show: false,
|
||||
text: "",
|
||||
},
|
||||
data_table: {
|
||||
loading: false,
|
||||
list: [],
|
||||
selected: [],
|
||||
singleSelect: false,
|
||||
count: 0,
|
||||
page: 1,
|
||||
pageSize: 10,
|
||||
header: [
|
||||
|
||||
{ text: '法會名稱', value: 'subject', align: 'start' },
|
||||
{ text: '開始日期', value: 'startDate' },
|
||||
{ text: '結束日期', value: 'endDate' },
|
||||
//{ text: '', value: 'slot_btn', sortable: false, align: 'end' }
|
||||
],
|
||||
footer: {
|
||||
showFirstLastPage: true,
|
||||
itemsPerPageOptions: [5, 10, 20, 30],
|
||||
},
|
||||
},
|
||||
query: {
|
||||
start_date: '',
|
||||
end_date: '',
|
||||
xStart: '',//消災
|
||||
sSatrt: ''//超薦
|
||||
},
|
||||
search: {},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
queryActivity() {//列出區間內的活動/法會
|
||||
processShuwen() {
|
||||
// console.log(this.data_table.selected)
|
||||
if (this.query.xStart==="" || this.query.sStart==="") {
|
||||
this.snackbar.text = "請輸入消災及超薦牌位列印編號前置碼";
|
||||
this.snackbar.show = true;
|
||||
return;
|
||||
}
|
||||
if (this.data_table.selected.length===0) {
|
||||
this.snackbar.text = "請勾選要列印的法會";
|
||||
this.snackbar.show = true;
|
||||
return;
|
||||
}
|
||||
let activityNums = []
|
||||
this.data_table.selected.forEach((x) => {
|
||||
activityNums.push(x.num);
|
||||
});
|
||||
if (activityNums && activityNums.length>0) {
|
||||
axios.post(HTTP_HOST + 'api/shuwen/RenderShuWenByGong', {
|
||||
activitynum: activityNums.join(","),
|
||||
xStart: this.query.xStart,sStart:this.query.sStart
|
||||
})
|
||||
.then(res => {
|
||||
if (res.status == 200) {
|
||||
//const blob = new Blob([res.data.filePath]);
|
||||
//const url = window.URL.createObjectURL(blob);
|
||||
|
||||
// 2. Create a hidden anchoring element
|
||||
const link = document.createElement('a');
|
||||
link.href = res.data.filePath;
|
||||
|
||||
// 3. Define the desired filename
|
||||
link.setAttribute('download', 'template.docx');
|
||||
|
||||
// 4. Append to DOM, click it to trigger save, and clean up
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
|
||||
// Free up memory and remove temporary elements
|
||||
link.remove();
|
||||
//window.URL.revokeObjectURL(url);
|
||||
}
|
||||
this.data_table.loading = false;
|
||||
|
||||
|
||||
})
|
||||
.catch(err => {
|
||||
if (err.response && err.response.status === 400) {
|
||||
alert('錯誤訊息:' + err.response.data.Message);
|
||||
this.snackbar.text = '錯誤訊息:' + err.response.data.Message
|
||||
} else {
|
||||
//alert('發生錯誤:' + err.response.data.Message);
|
||||
//console.log(err);
|
||||
this.snackbar.text = '發生錯誤:'+err;// + err.response.data.Message
|
||||
}
|
||||
this.snackbar.show = true;
|
||||
});
|
||||
}
|
||||
},
|
||||
initActivity() {
|
||||
axios.get(HTTP_HOST + 'api/activity')
|
||||
queryActivity() {//列出區間內的活動/法會
|
||||
this.data_table.loading=true
|
||||
axios.post(HTTP_HOST + 'api/activity/GetListNew', { startDate_solar: this.query.start_date, endDate_solar: this.query.end_date }, { params: { page: 1, pageSize: 10000, sortDesc: false } })
|
||||
.then(response => {
|
||||
this.activityList = response.data;
|
||||
// console.log("queryActivity:", response.data.list);
|
||||
this.data_table.list = response.data.list;
|
||||
this.data_table.count = response.data.count;
|
||||
|
||||
})
|
||||
.catch(error => {
|
||||
console.log(error)
|
||||
this.snackbar.text = '發生錯誤:' + error.response.data.Message
|
||||
this.snackbar.show = true;
|
||||
}).finally(() => {
|
||||
this.data_table.loading = false;
|
||||
})
|
||||
},
|
||||
initActivity() {
|
||||
//axios.get(HTTP_HOST + 'api/activity')
|
||||
// .then(response => {
|
||||
// this.activityList = response.data;
|
||||
// })
|
||||
// .catch(error => {
|
||||
// console.log(error)
|
||||
// })
|
||||
},
|
||||
onActivityChange() {
|
||||
this.latest = false
|
||||
this.getShuWen();
|
||||
@@ -165,6 +337,11 @@
|
||||
this.getShuWen()
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
pageCount() {
|
||||
return Math.ceil(this.data_table.count / this.data_table.pageSize)
|
||||
},
|
||||
}
|
||||
})
|
||||
</script>
|
||||
</asp:Content>
|
||||
Reference in new issue
Block a user