141 lines
6.1 KiB
Plaintext
141 lines
6.1 KiB
Plaintext
<%@ Page Title="" Language="C#" MasterPageFile="~/admin/Templates/TBS5ADM001/MasterPage.master" AutoEventWireup="true" CodeFile="shuwen.aspx.cs" Inherits="admin_shuwen_shuwen" %>
|
|
|
|
<asp:Content ID="Content1" ContentPlaceHolderID="page_header" Runat="Server">
|
|
</asp:Content>
|
|
<asp:Content ID="Content2" ContentPlaceHolderID="page_nav" Runat="Server">
|
|
<div class="mb-2 mb-sm-0 d-flex align-items-center gap-2">
|
|
<span>查看疏文</span>
|
|
<select v-model="currentActivityNum" @change="onActivityChange" class="form-select" style="width: auto;">
|
|
<option value="">請選擇要查看的活動</option>
|
|
<option v-for="activity in activityList" :value="activity.num" :key="activity.num">
|
|
{{activity.subject}}
|
|
</option>
|
|
</select>
|
|
<h4>
|
|
<span v-if="currentActivityNum">{{latest ? '當前疏文是最新版本': '當前疏文不是最新版本'}}</span>
|
|
</h4>
|
|
</div>
|
|
|
|
<div class="">
|
|
<a class="btn btn-outline-primary btn-print" @click="updateShuWen" v-if="currentActivityNum&&!latest">{{updateShuWenLoading ? '更新中': '更新疏文'}}</a>
|
|
<a :href="'<%=ResolveUrl("~/api/shuwen/download")%>?activitynum='+currentActivityNum" class="btn btn-outline-primary btn-print">下載疏文Word檔</a>
|
|
</div>
|
|
</asp:Content>
|
|
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
|
|
<div v-if="currentActivityNum">
|
|
<div><h2 style="text-align:center">消災疏文</h2></div>
|
|
<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>
|
|
</ul>
|
|
<hr />
|
|
</div>
|
|
<div><h2 style="text-align:center">超薦疏文</h2></div>
|
|
<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>
|
|
<div v-for="cdItem in item[Object.keys(item)[0]].entry">
|
|
<p>
|
|
{{cdItem.biaoti.join(' ')}}
|
|
</p>
|
|
<p>
|
|
陽上---{{cdItem.yangshang}}
|
|
</p>
|
|
<hr />
|
|
</div></li>
|
|
</ul>
|
|
<hr/>
|
|
</div>
|
|
</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 {
|
|
currentActivityNum: '<%= Request["num"]%>',
|
|
activityList: [],
|
|
ShuWenJson: {},
|
|
ShuWenItem: '',
|
|
updateShuWenLoading: false,
|
|
latest: false
|
|
}
|
|
},
|
|
methods: {
|
|
initActivity() {
|
|
axios.get(HTTP_HOST + 'api/activity')
|
|
.then(response => {
|
|
this.activityList = response.data;
|
|
})
|
|
.catch(error => {
|
|
console.log(error)
|
|
})
|
|
},
|
|
onActivityChange() {
|
|
this.latest = false
|
|
this.getShuWen();
|
|
},
|
|
updateShuWen() {
|
|
this.updateShuWenLoading = true;
|
|
axios.get(HTTP_HOST + 'api/shuwen/StartGenerate', {
|
|
params: {
|
|
activitynum: this.currentActivityNum
|
|
}
|
|
})
|
|
.then(res => {
|
|
this.getShuWen();
|
|
})
|
|
.catch(err => {
|
|
alert('發生錯誤:' + (err.response?.data?.Message || '無法啟動任務'));
|
|
}).finally(() => {
|
|
this.updateShuWenLoading = false;
|
|
});
|
|
},
|
|
getShuWen() {
|
|
if (this.currentActivityNum) {
|
|
axios.get(HTTP_HOST + 'api/shuwen/getshuwen', {
|
|
params: {
|
|
activitynum: this.currentActivityNum
|
|
}
|
|
})
|
|
.then(res => {
|
|
var data = res.data
|
|
this.ShuWenItem = data.data
|
|
this.latest = data.latest
|
|
if (this.ShuWenItem == null) {
|
|
this.ShuWenJson = {}
|
|
return;
|
|
}
|
|
this.ShuWenJson = this.ShuWenItem?.shuWenList
|
|
? JSON.parse(this.ShuWenItem.shuWenList)
|
|
: { xiaozai: [], chaodu: [] }; // 默认空对象
|
|
|
|
})
|
|
.catch(err => {
|
|
if (err.response && err.response.status === 400) {
|
|
alert('錯誤訊息:' + err.response.data.Message);
|
|
} else {
|
|
alert('發生錯誤');
|
|
}
|
|
});
|
|
}
|
|
|
|
}
|
|
},
|
|
mounted() {
|
|
this.initActivity();
|
|
if (this.currentActivityNum) {
|
|
this.getShuWen()
|
|
}
|
|
},
|
|
})
|
|
</script>
|
|
</asp:Content>
|