处理挂单测试问题

This commit is contained in:
2025-09-16 17:53:38 +08:00
parent 40da17b414
commit c38dc55dff
8 changed files with 238 additions and 29 deletions

View File

@@ -1146,6 +1146,10 @@
.then(res => {
this.resetAutomaticBedAllocation();
this.getGuadanOrderGuestByOrderNo();
}).catch((error) => {
this.$refs.messageModal.open({
message: (error.response?.data?.message || error.message)
});
});
},

View File

@@ -20,13 +20,13 @@
</div>
<div class="form-item">
<label>入住日期区间:</label>
<label>入住日期區間:</label>
<input type="date" v-model="search.searchCheckInDateStart"> -
<input type="date" v-model="search.searchCheckInDateEnd">
</div>
<div class="form-item">
<label>退房日期区间:</label>
<label>退房日期區間:</label>
<input type="date" v-model="search.searchCheckOutDateStart"> -
<input type="date" v-model="search.searchCheckOutDateEnd">
</div>
@@ -95,7 +95,7 @@
<asp:Content ID="Content4" ContentPlaceHolderID="offCanvasRight" Runat="Server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="footer_script" Runat="Server">
<style>
<style>
.search-bar {
display: flex;
align-items: center;
@@ -142,10 +142,10 @@ button:hover {
loading: false,
search: {
searchName: null,
searchCheckInDateStart: null,//入住日期
searchCheckInDateEnd: null,//入住日期的
searchCheckOutDateStart: null,//退房日期的
searchCheckOutDateEnd: null,//退房日期的
searchCheckInDateStart: null,//入住日期
searchCheckInDateEnd: null,//入住日期的
searchCheckOutDateStart: null,//退房日期的
searchCheckOutDateEnd: null,//退房日期的
searchCheckInDate: null,
searchCheckOutDate: null,

View File

@@ -6,16 +6,29 @@
<nav>
<a href="create.aspx" class="btn btn-primary" >新建掛單</a>
</nav>
<div class="me-10">
<button class="btn btn-primary" type="button">查询</button>
<div class="d-flex align-items-center gap-3">
<label class="mb-0">掛單登記人</label>
<input class="form-control w-auto" style="width:150px;" v-model="search.guadanUser" />
<label class="mb-0">開始時間</label>
<input class="form-control w-auto" style="width:150px;" type="date" v-model="search.startDate" />
<label class="mb-0">結束時間</label>
<input class="form-control w-auto" style="width:150px;" type="date" v-model="search.endDate" />
<button class="btn btn-primary" type="button" @click="handleSearch">查詢</button>
<button class="btn btn-outline-primary" type="button" @click="clearSearch">清除條件</button>
</div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div class="mx-5">
<v-data-table
:items="items"
:headers="headers">
:headers="headers"
hide-default-footer>
<template #item.actions="{item}">
<a :href="'create.aspx?orderId='+item.guaDanOrderNo" class="btn btn-secondary">編輯</a>
<a class="btn btn-outline-danger" @click="deleteGuadanOrder(item)">取消</a>
@@ -39,6 +52,41 @@
{{item.created_at | timeString('YYYY/MM/DD HH:mm')}}
</template>
</v-data-table>
<v-container>
<v-row class="align-baseline" wrap="false">
<v-col cols="12" md="8">
<v-pagination
v-model="options.page"
:length="pageCount">
</v-pagination>
</v-col>
<v-col class="text-truncate text-right" cols="12" md="2">
共 {{ total }} 筆, 頁數:
</v-col>
<v-col cols="6" md="1">
<v-text-field
v-model="options.page"
type="number"
hide-details
dense
min="1"
:max="pageCount"
@input="options.page = parseInt($event, 10)"
></v-text-field>
</v-col>
<!-- 每页条数选择 -->
<v-col cols="12" md="1">
<v-select
v-model="options.itemsPerPage"
:items="[5, 10, 20, 50]"
label="每頁條數"
dense
hide-details
style="width: 100px;"
></v-select>
</v-col>
</v-row>
</v-container>
</div>
<!-- 更新修改確認彈出視窗 -->
<message-modal ref="messageModal"></message-modal>
@@ -69,17 +117,74 @@
{ text: '備註', value: 'notes', align: 'center' },
{ text: '操作', value: 'actions', align: 'center' }
],
options: {
page: 1, // 當前頁
itemsPerPage: 10, // 每頁條數
sortBy: [],
sortDesc: []
},
search: {
startDate: null,
endDate: null,
guadanUser: null,
},
total: 0,
loading: false,
}
},
methods: {
resetTableOptions() {
this.options = {
page: 1,
itemsPerPage: 10,
sortBy: [],
sortDesc: []
};
},
handleSearch() {
const val = this.search.guadanUser;
// 驗證是否包含空格
if (val && /\s/.test(val)) {
this.$refs.messageModal.open({
message: '掛單登記人不能包含空格'
});
return;
}
// 驗證長度
if (val && val.length > 10) {
this.$refs.messageModal.open({
message: '掛單登記人不能超過 10 個字'
});
return;
}
this.resetTableOptions();
},
clearSearch() {
this.search.startDate = null;
this.search.endDate = null;
this.search.guadanUser = null;
this.resetTableOptions();
},
getGuadanOrder() {
axios.get('/api/guadan/list')
if (this.loading) return;
axios.post('/api/guadan/list', {
startDate: this.search.startDate,
endDate: this.search.endDate,
guadanUser: this.search.guadanUser,
page: this.options.page,
pageSize: this.options.itemsPerPage
})
.then((res) => {
this.items = res.data;
this.items = res.data.data;
this.total = res.data.total;
}).catch((err) => {
console.log(err);
})
}).finally(() => {
this.loading = false;
});
},
deleteGuadanOrder(order) {
this.$refs.confirmModal.open({
@@ -105,11 +210,21 @@
},
},
watch: {
options: {
handler() {
this.getGuadanOrder(); // 監聽分頁、排序變化,自動載入數據
},
deep: true,
}
},
mounted() {
this.getGuadanOrder();
},
computed: {
pageCount() {
return Math.ceil(this.total / this.options.itemsPerPage)
},
}
});
</script>
</asp:Content>