挂单查询
This commit is contained in:
@@ -221,17 +221,19 @@ public class ShuWenController : ApiController
|
||||
[HttpGet]
|
||||
[Route("api/shuwen/download")]
|
||||
public HttpResponseMessage DownloadShuWenWord(int? activitynum)
|
||||
{
|
||||
try
|
||||
{
|
||||
var data = _db.ShuWen.Where(a => a.ActivityNum == activitynum).FirstOrDefault();
|
||||
if (data == null)
|
||||
{
|
||||
//return;
|
||||
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;
|
||||
return Request.CreateErrorResponse(HttpStatusCode.BadRequest, "疏文列表为空,无法生成 Word");
|
||||
}
|
||||
string fileName = $"疏文名單_{DateTime.Now:yyyyMMddHHmmss}.docx";
|
||||
|
||||
@@ -251,6 +253,12 @@ public class ShuWenController : ApiController
|
||||
};
|
||||
return response;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void GenerateShuWenWord_OpenXml(string json, Stream outputStream, string ActivityName ="")
|
||||
{
|
||||
|
||||
@@ -105,8 +105,9 @@ public class regionController : ApiController
|
||||
.Where(s => s.TargetUuid == bed.Uuid
|
||||
&& s.IsDeleted == false
|
||||
&& (s.ScheduleDate == null
|
||||
|| (s.ScheduleDate >= startDate && s.ScheduleDate <= endDate)))
|
||||
|| (s.ScheduleDate >= startDate)))
|
||||
.Where(s => s.GuaDanOrderGuest.StatusCode != "403" && s.GuaDanOrderGuest.StatusCode != "404")
|
||||
.OrderByDescending(a => a.ScheduleDate)
|
||||
.Select(s => new
|
||||
{
|
||||
s.Uuid,
|
||||
|
||||
@@ -29,8 +29,33 @@ public class guadanGuestQueryController: ApiController
|
||||
{
|
||||
query = query.Where(guest => guest.followers.u_name.Contains(search.SearchName));
|
||||
}
|
||||
var data = await query.ToListAsync();
|
||||
var data1 = data.Select(a => new
|
||||
if(search.searchCheckInDate != null)
|
||||
{
|
||||
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,
|
||||
checkindate = a.CheckInAt,
|
||||
@@ -41,9 +66,8 @@ public class guadanGuestQueryController: ApiController
|
||||
return Ok(new
|
||||
{
|
||||
items = data1,
|
||||
total = data1.Count(),
|
||||
total = totalCount,
|
||||
});
|
||||
|
||||
}
|
||||
public string GetRoomAndBedString(RegionRoomBed bed)
|
||||
{
|
||||
@@ -66,5 +90,13 @@ public class guadanGuestQueryController: ApiController
|
||||
public class SearchGuestModel
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -6,22 +6,38 @@
|
||||
<nav class="search-bar">
|
||||
<div class="form-item">
|
||||
<label>姓名:</label>
|
||||
<input v-model="search.searchName" type="text" placeholder="请输入姓名">
|
||||
<input v-model="search.searchName" type="text" placeholder="請輸入姓名">
|
||||
</div>
|
||||
|
||||
<div class="form-item">
|
||||
<label>入住日期:</label>
|
||||
<input v-model="search.date" type="date">
|
||||
<input v-model="search.searchCheckInDate" type="date">
|
||||
</div>
|
||||
|
||||
<div class="form-item">
|
||||
<button @click="handleSearch" type="button">查询</button>
|
||||
<button type="button" @click="clearSearch">清除查询条件</button>
|
||||
<label>退房日期:</label>
|
||||
<input type="date" v-model="search.searchCheckOutDate">
|
||||
</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 ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
|
||||
<div>
|
||||
<v-data-table
|
||||
@@ -45,6 +61,9 @@
|
||||
<template #item.checkoutdate ="{item}">
|
||||
{{item.checkoutdate|timeString('YYYY-MM-DD')}}
|
||||
</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-container>
|
||||
<v-row class="align-baseline" wrap>
|
||||
@@ -123,23 +142,29 @@ button:hover {
|
||||
loading: false,
|
||||
search: {
|
||||
searchName: null,
|
||||
searchCheckInDateStart: null,//入住日期开始
|
||||
searchCheckInDateEnd: null,//入住日期的结束
|
||||
searchCheckOutDateStart: null,//退房日期的开始
|
||||
searchCheckOutDateEnd: null,//退房日期的结束
|
||||
searchCheckInDate: null,
|
||||
searchCheckOutDate: null,
|
||||
|
||||
},
|
||||
options: {
|
||||
page: 1, // 当前页
|
||||
itemsPerPage: 1, // 每页条数
|
||||
page: 1, // 當前頁
|
||||
itemsPerPage: 10, // 每頁條數
|
||||
sortBy: [],
|
||||
sortDesc: []
|
||||
},
|
||||
headers: [
|
||||
{ text: '姓名', value: 'name' },
|
||||
{ text: '挂单单号', value: 'guadanorderno'},
|
||||
{ text: '掛單單號', value: 'guadanorderno' },
|
||||
{ text: '入住日期', value: 'checkindate' },
|
||||
{ text: '退房日期', value: 'checkoutdate'},
|
||||
{ text: '房间号', value: 'roomName' },
|
||||
{ text: '退房日期', value: 'checkoutdate' },
|
||||
{ text: '房間號', value: 'roomName' },
|
||||
|
||||
],
|
||||
guests: [], // 表格数据
|
||||
guests: [], // 表格數據
|
||||
total: 0,
|
||||
}
|
||||
},
|
||||
@@ -157,9 +182,19 @@ button:hover {
|
||||
},
|
||||
clearSearch() {
|
||||
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();
|
||||
},
|
||||
fetchGuests() {
|
||||
if (this.search.searchName && this.search.searchName.includes(' ')) {
|
||||
alert('搜索內容不能包含空格');
|
||||
return; // 阻止繼續執行
|
||||
}
|
||||
if (this.loading) return;
|
||||
this.loading = true;
|
||||
axios.post('/api/guadan/guest/query/list',
|
||||
@@ -167,10 +202,16 @@ button:hover {
|
||||
page: this.options.page,
|
||||
pageSize: this.options.itemsPerPage,
|
||||
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 => {
|
||||
this.guests = res.data.items; // 数据
|
||||
this.total = res.data.total; // 总数
|
||||
this.guests = res.data.items; // 數據
|
||||
this.total = res.data.total; // 總數
|
||||
}).finally(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
@@ -179,7 +220,7 @@ button:hover {
|
||||
watch: {
|
||||
options: {
|
||||
handler() {
|
||||
this.fetchGuests(); // 监听分页、排序变化,自动加载数据
|
||||
this.fetchGuests(); // 監聽分頁、排序變化,自動載入數據
|
||||
},
|
||||
deep: true,
|
||||
}
|
||||
@@ -195,4 +236,3 @@ button:hover {
|
||||
})
|
||||
</script>
|
||||
</asp:Content>
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
<div class="">
|
||||
<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>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
|
||||
|
||||
Reference in New Issue
Block a user