挂单查询
This commit is contained in:
@@ -222,34 +222,42 @@ public class ShuWenController : ApiController
|
|||||||
[Route("api/shuwen/download")]
|
[Route("api/shuwen/download")]
|
||||||
public HttpResponseMessage DownloadShuWenWord(int? activitynum)
|
public HttpResponseMessage DownloadShuWenWord(int? activitynum)
|
||||||
{
|
{
|
||||||
var data = _db.ShuWen.Where(a => a.ActivityNum == activitynum).FirstOrDefault();
|
try
|
||||||
if (data == null)
|
|
||||||
{
|
{
|
||||||
//return;
|
var data = _db.ShuWen.Where(a => a.ActivityNum == activitynum).FirstOrDefault();
|
||||||
}
|
if (data == null)
|
||||||
string json = data.ShuWenList;
|
|
||||||
string ActivityName = _db.activities.Where(a => a.num == data.ActivityNum).FirstOrDefault().subject;
|
|
||||||
if (json == null)
|
|
||||||
{
|
|
||||||
//return;
|
|
||||||
}
|
|
||||||
string fileName = $"疏文名單_{DateTime.Now:yyyyMMddHHmmss}.docx";
|
|
||||||
|
|
||||||
var stream = new MemoryStream();
|
|
||||||
GenerateShuWenWord_OpenXml(json, stream, ActivityName);
|
|
||||||
stream.Position = 0;
|
|
||||||
var response = new HttpResponseMessage(HttpStatusCode.OK)
|
|
||||||
{
|
|
||||||
Content = new StreamContent(stream)
|
|
||||||
};
|
|
||||||
response.Content.Headers.ContentType =
|
|
||||||
new System.Net.Http.Headers.MediaTypeHeaderValue("application/vnd.openxmlformats-officedocument.wordprocessingml.document");
|
|
||||||
response.Content.Headers.ContentDisposition =
|
|
||||||
new System.Net.Http.Headers.ContentDispositionHeaderValue("attachment")
|
|
||||||
{
|
{
|
||||||
FileName = fileName
|
return Request.CreateErrorResponse(HttpStatusCode.BadRequest, "活動編號不能為空");
|
||||||
|
}
|
||||||
|
string json = data.ShuWenList;
|
||||||
|
string ActivityName = _db.activities.Where(a => a.num == data.ActivityNum).FirstOrDefault().subject;
|
||||||
|
if (json == null)
|
||||||
|
{
|
||||||
|
return Request.CreateErrorResponse(HttpStatusCode.BadRequest, "疏文列表为空,无法生成 Word");
|
||||||
|
}
|
||||||
|
string fileName = $"疏文名單_{DateTime.Now:yyyyMMddHHmmss}.docx";
|
||||||
|
|
||||||
|
var stream = new MemoryStream();
|
||||||
|
GenerateShuWenWord_OpenXml(json, stream, ActivityName);
|
||||||
|
stream.Position = 0;
|
||||||
|
var response = new HttpResponseMessage(HttpStatusCode.OK)
|
||||||
|
{
|
||||||
|
Content = new StreamContent(stream)
|
||||||
};
|
};
|
||||||
return response;
|
response.Content.Headers.ContentType =
|
||||||
|
new System.Net.Http.Headers.MediaTypeHeaderValue("application/vnd.openxmlformats-officedocument.wordprocessingml.document");
|
||||||
|
response.Content.Headers.ContentDisposition =
|
||||||
|
new System.Net.Http.Headers.ContentDispositionHeaderValue("attachment")
|
||||||
|
{
|
||||||
|
FileName = fileName
|
||||||
|
};
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void GenerateShuWenWord_OpenXml(string json, Stream outputStream, string ActivityName ="")
|
public void GenerateShuWenWord_OpenXml(string json, Stream outputStream, string ActivityName ="")
|
||||||
|
|||||||
@@ -105,8 +105,9 @@ public class regionController : ApiController
|
|||||||
.Where(s => s.TargetUuid == bed.Uuid
|
.Where(s => s.TargetUuid == bed.Uuid
|
||||||
&& s.IsDeleted == false
|
&& s.IsDeleted == false
|
||||||
&& (s.ScheduleDate == null
|
&& (s.ScheduleDate == null
|
||||||
|| (s.ScheduleDate >= startDate && s.ScheduleDate <= endDate)))
|
|| (s.ScheduleDate >= startDate)))
|
||||||
.Where(s => s.GuaDanOrderGuest.StatusCode != "403" && s.GuaDanOrderGuest.StatusCode != "404")
|
.Where(s => s.GuaDanOrderGuest.StatusCode != "403" && s.GuaDanOrderGuest.StatusCode != "404")
|
||||||
|
.OrderByDescending(a => a.ScheduleDate)
|
||||||
.Select(s => new
|
.Select(s => new
|
||||||
{
|
{
|
||||||
s.Uuid,
|
s.Uuid,
|
||||||
|
|||||||
@@ -29,8 +29,33 @@ public class guadanGuestQueryController: ApiController
|
|||||||
{
|
{
|
||||||
query = query.Where(guest => guest.followers.u_name.Contains(search.SearchName));
|
query = query.Where(guest => guest.followers.u_name.Contains(search.SearchName));
|
||||||
}
|
}
|
||||||
var data = await query.ToListAsync();
|
if(search.searchCheckInDate != null)
|
||||||
var data1 = data.Select(a => new
|
{
|
||||||
|
query = query.Where(guest => guest.CheckInAt == search.searchCheckInDate);
|
||||||
|
}
|
||||||
|
if(search.searchCheckInDateStart != null)
|
||||||
|
{
|
||||||
|
query = query.Where(guest => guest.CheckInAt >= search.searchCheckInDateStart);
|
||||||
|
}
|
||||||
|
if (search.searchCheckInDateEnd != null)
|
||||||
|
{
|
||||||
|
query = query.Where(guest => guest.CheckInAt <= search.searchCheckInDateEnd);
|
||||||
|
}
|
||||||
|
if (search.searchCheckOutDateStart != null)
|
||||||
|
{
|
||||||
|
query = query.Where(guest => guest.CheckOutAt >= search.searchCheckOutDateStart);
|
||||||
|
}
|
||||||
|
if (search.searchCheckOutDateEnd != null)
|
||||||
|
{
|
||||||
|
query = query.Where(guest => guest.CheckOutAt <= search.searchCheckOutDateEnd);
|
||||||
|
}
|
||||||
|
var totalCount = await query.CountAsync();
|
||||||
|
var pagedData = await query
|
||||||
|
.OrderByDescending(a => a.CheckInAt) // 可根据需要排序
|
||||||
|
.Skip((search.Page - 1) * search.PageSize)
|
||||||
|
.Take(search.PageSize)
|
||||||
|
.ToListAsync();
|
||||||
|
var data1 = pagedData.Select(a => new
|
||||||
{
|
{
|
||||||
name = a.followers != null ? a.followers.u_name : null,
|
name = a.followers != null ? a.followers.u_name : null,
|
||||||
checkindate = a.CheckInAt,
|
checkindate = a.CheckInAt,
|
||||||
@@ -41,9 +66,8 @@ public class guadanGuestQueryController: ApiController
|
|||||||
return Ok(new
|
return Ok(new
|
||||||
{
|
{
|
||||||
items = data1,
|
items = data1,
|
||||||
total = data1.Count(),
|
total = totalCount,
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
public string GetRoomAndBedString(RegionRoomBed bed)
|
public string GetRoomAndBedString(RegionRoomBed bed)
|
||||||
{
|
{
|
||||||
@@ -66,5 +90,13 @@ public class guadanGuestQueryController: ApiController
|
|||||||
public class SearchGuestModel
|
public class SearchGuestModel
|
||||||
{
|
{
|
||||||
public string SearchName = null;
|
public string SearchName = null;
|
||||||
|
public int Page = 1;
|
||||||
|
public int PageSize = 10;
|
||||||
|
public DateTime? searchCheckInDateStart = null;//入住日期的开始
|
||||||
|
public DateTime? searchCheckInDateEnd = null;//入住日期的结束
|
||||||
|
public DateTime? searchCheckOutDateStart = null;//退房日期的开始
|
||||||
|
public DateTime? searchCheckOutDateEnd = null;//退房日期的结束
|
||||||
|
public DateTime? searchCheckInDate = null;
|
||||||
|
public DateTime? searchCheckOutDate = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4,24 +4,40 @@
|
|||||||
</asp:Content>
|
</asp:Content>
|
||||||
<asp:Content ID="Content2" ContentPlaceHolderID="page_nav" Runat="Server">
|
<asp:Content ID="Content2" ContentPlaceHolderID="page_nav" Runat="Server">
|
||||||
<nav class="search-bar">
|
<nav class="search-bar">
|
||||||
<div class="form-item">
|
<div class="form-item">
|
||||||
<label>姓名:</label>
|
<label>姓名:</label>
|
||||||
<input v-model="search.searchName" type="text" placeholder="请输入姓名">
|
<input v-model="search.searchName" type="text" placeholder="請輸入姓名">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-item">
|
<div class="form-item">
|
||||||
<label>入住日期:</label>
|
<label>入住日期:</label>
|
||||||
<input v-model="search.date" type="date">
|
<input v-model="search.searchCheckInDate" type="date">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-item">
|
<div class="form-item">
|
||||||
<button @click="handleSearch" type="button">查询</button>
|
<label>退房日期:</label>
|
||||||
<button type="button" @click="clearSearch">清除查询条件</button>
|
<input type="date" v-model="search.searchCheckOutDate">
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
|
||||||
|
|
||||||
|
<div class="form-item">
|
||||||
|
<label>入住日期区间:</label>
|
||||||
|
<input type="date" v-model="search.searchCheckInDateStart"> -
|
||||||
|
<input type="date" v-model="search.searchCheckInDateEnd">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-item">
|
||||||
|
<label>退房日期区间:</label>
|
||||||
|
<input type="date" v-model="search.searchCheckOutDateStart"> -
|
||||||
|
<input type="date" v-model="search.searchCheckOutDateEnd">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-item buttons">
|
||||||
|
<button @click="handleSearch" type="button">查詢</button>
|
||||||
|
<button type="button" @click="clearSearch">清除查詢條件</button>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
</asp:Content>
|
</asp:Content>
|
||||||
|
|
||||||
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
|
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
|
||||||
<div>
|
<div>
|
||||||
<v-data-table
|
<v-data-table
|
||||||
@@ -45,6 +61,9 @@
|
|||||||
<template #item.checkoutdate ="{item}">
|
<template #item.checkoutdate ="{item}">
|
||||||
{{item.checkoutdate|timeString('YYYY-MM-DD')}}
|
{{item.checkoutdate|timeString('YYYY-MM-DD')}}
|
||||||
</template>
|
</template>
|
||||||
|
<template #item.guadanorderno="{item}">
|
||||||
|
{{item.guadanorderno}}<a :href="'/admin/guadan/create.aspx?orderId='+item.guadanorderno" class="btn btn-outline-primary">查看掛單</a>
|
||||||
|
</template>
|
||||||
</v-data-table>
|
</v-data-table>
|
||||||
<v-container>
|
<v-container>
|
||||||
<v-row class="align-baseline" wrap>
|
<v-row class="align-baseline" wrap>
|
||||||
@@ -67,7 +86,7 @@
|
|||||||
:max="pageCount"
|
:max="pageCount"
|
||||||
@input="options.page = parseInt($event, 10)"
|
@input="options.page = parseInt($event, 10)"
|
||||||
></v-text-field>
|
></v-text-field>
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
</v-container>
|
</v-container>
|
||||||
</div>
|
</div>
|
||||||
@@ -123,23 +142,29 @@ button:hover {
|
|||||||
loading: false,
|
loading: false,
|
||||||
search: {
|
search: {
|
||||||
searchName: null,
|
searchName: null,
|
||||||
|
searchCheckInDateStart: null,//入住日期开始
|
||||||
|
searchCheckInDateEnd: null,//入住日期的结束
|
||||||
|
searchCheckOutDateStart: null,//退房日期的开始
|
||||||
|
searchCheckOutDateEnd: null,//退房日期的结束
|
||||||
|
searchCheckInDate: null,
|
||||||
|
searchCheckOutDate: null,
|
||||||
|
|
||||||
},
|
},
|
||||||
options: {
|
options: {
|
||||||
page: 1, // 当前页
|
page: 1, // 當前頁
|
||||||
itemsPerPage: 1, // 每页条数
|
itemsPerPage: 10, // 每頁條數
|
||||||
sortBy: [],
|
sortBy: [],
|
||||||
sortDesc: []
|
sortDesc: []
|
||||||
},
|
},
|
||||||
headers: [
|
headers: [
|
||||||
{ text: '姓名', value: 'name' },
|
{ text: '姓名', value: 'name' },
|
||||||
{ text: '挂单单号', value: 'guadanorderno'},
|
{ text: '掛單單號', value: 'guadanorderno' },
|
||||||
{ text: '入住日期', value: 'checkindate' },
|
{ text: '入住日期', value: 'checkindate' },
|
||||||
{ text: '退房日期', value: 'checkoutdate'},
|
{ text: '退房日期', value: 'checkoutdate' },
|
||||||
{ text: '房间号', value: 'roomName' },
|
{ text: '房間號', value: 'roomName' },
|
||||||
|
|
||||||
],
|
],
|
||||||
guests: [], // 表格数据
|
guests: [], // 表格數據
|
||||||
total: 0,
|
total: 0,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -157,9 +182,19 @@ button:hover {
|
|||||||
},
|
},
|
||||||
clearSearch() {
|
clearSearch() {
|
||||||
this.search.searchName = null;
|
this.search.searchName = null;
|
||||||
|
this.search.searchCheckInDate = null;
|
||||||
|
this.search.searchCheckOutDate = null;
|
||||||
|
this.search.searchCheckInDateStart = null;
|
||||||
|
this.search.searchCheckInDateEnd = null;
|
||||||
|
this.search.searchCheckOutDateStart = null;
|
||||||
|
this.search.searchCheckOutDateEnd = null;
|
||||||
this.resetTableOptions();
|
this.resetTableOptions();
|
||||||
},
|
},
|
||||||
fetchGuests() {
|
fetchGuests() {
|
||||||
|
if (this.search.searchName && this.search.searchName.includes(' ')) {
|
||||||
|
alert('搜索內容不能包含空格');
|
||||||
|
return; // 阻止繼續執行
|
||||||
|
}
|
||||||
if (this.loading) return;
|
if (this.loading) return;
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
axios.post('/api/guadan/guest/query/list',
|
axios.post('/api/guadan/guest/query/list',
|
||||||
@@ -167,19 +202,25 @@ button:hover {
|
|||||||
page: this.options.page,
|
page: this.options.page,
|
||||||
pageSize: this.options.itemsPerPage,
|
pageSize: this.options.itemsPerPage,
|
||||||
searchName: this.search.searchName,
|
searchName: this.search.searchName,
|
||||||
date: this.search.date
|
searchCheckInDate: this.search.searchCheckInDate,
|
||||||
|
searchCheckOutDate: this.search.searchCheckOutDate,
|
||||||
|
searchCheckInDateStart: this.search.searchCheckInDateStart,
|
||||||
|
searchCheckInDateEnd: this.search.searchCheckInDateEnd,
|
||||||
|
searchCheckOutDateStart: this.search.searchCheckOutDateStart,
|
||||||
|
searchCheckOutDateEnd: this.search.searchCheckOutDateEnd,
|
||||||
|
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
this.guests = res.data.items; // 数据
|
this.guests = res.data.items; // 數據
|
||||||
this.total = res.data.total; // 总数
|
this.total = res.data.total; // 總數
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
options: {
|
options: {
|
||||||
handler() {
|
handler() {
|
||||||
this.fetchGuests(); // 监听分页、排序变化,自动加载数据
|
this.fetchGuests(); // 監聽分頁、排序變化,自動載入數據
|
||||||
},
|
},
|
||||||
deep: true,
|
deep: true,
|
||||||
}
|
}
|
||||||
@@ -194,5 +235,4 @@ button:hover {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
</asp:Content>
|
</asp:Content>
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
<div class="">
|
<div class="">
|
||||||
<a class="btn btn-outline-primary btn-print" @click="updateShuWen" v-if="currentActivityNum&&!latest">{{updateShuWenLoading ? '更新中': '更新疏文'}}</a>
|
<a class="btn btn-outline-primary btn-print" @click="updateShuWen" v-if="currentActivityNum&&!latest">{{updateShuWenLoading ? '更新中': '更新疏文'}}</a>
|
||||||
<a :href="'/api/shuwen/download?activitynum='+currentActivityNum" class="btn btn-outline-primary btn-print">下載疏文Word檔</a>
|
<a :href="'<%=ResolveUrl("~/api/shuwen/download")%>?activitynum='+currentActivityNum" class="btn btn-outline-primary btn-print">下載疏文Word檔</a>
|
||||||
</div>
|
</div>
|
||||||
</asp:Content>
|
</asp:Content>
|
||||||
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
|
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
|
||||||
|
|||||||
Reference in New Issue
Block a user