|
@@ -302,6 +302,7 @@ export default {
|
|
|
pilotPlans: [],
|
|
pilotPlans: [],
|
|
|
portList: [],
|
|
portList: [],
|
|
|
shipCompanyList: [],
|
|
shipCompanyList: [],
|
|
|
|
|
+ allShipCompanyList: [],
|
|
|
shipCompanyQuery: '',
|
|
shipCompanyQuery: '',
|
|
|
shipCompanyPage: 1,
|
|
shipCompanyPage: 1,
|
|
|
shipCompanyPageSize: 10,
|
|
shipCompanyPageSize: 10,
|
|
@@ -414,20 +415,10 @@ export default {
|
|
|
},
|
|
},
|
|
|
getShipCompanyListByPage(query, page) {
|
|
getShipCompanyListByPage(query, page) {
|
|
|
this.shipCompanyLoading = true;
|
|
this.shipCompanyLoading = true;
|
|
|
- this.$axios.get('/api/ship-company/list', {
|
|
|
|
|
- params: {
|
|
|
|
|
- companyName: query,
|
|
|
|
|
- page: page,
|
|
|
|
|
- pageSize: this.shipCompanyPageSize
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ this.$axios.get('/api/ship-company/list')
|
|
|
.then(response => {
|
|
.then(response => {
|
|
|
- if (page === 1) {
|
|
|
|
|
- this.shipCompanyList = response.data.content || [];
|
|
|
|
|
- } else {
|
|
|
|
|
- this.shipCompanyList = [...this.shipCompanyList, ...(response.data.content || [])];
|
|
|
|
|
- }
|
|
|
|
|
- this.shipCompanyHasMore = response.data.content && response.data.content.length >= this.shipCompanyPageSize;
|
|
|
|
|
|
|
+ this.allShipCompanyList = response.data || [];
|
|
|
|
|
+ this.filterShipCompanyList(query, page);
|
|
|
})
|
|
})
|
|
|
.catch(error => {
|
|
.catch(error => {
|
|
|
console.error('获取船公司列表失败:', error);
|
|
console.error('获取船公司列表失败:', error);
|
|
@@ -437,13 +428,28 @@ export default {
|
|
|
this.shipCompanyLoading = false;
|
|
this.shipCompanyLoading = false;
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
|
|
+ filterShipCompanyList(query, page) {
|
|
|
|
|
+ let filteredList = this.allShipCompanyList;
|
|
|
|
|
+
|
|
|
|
|
+ if (query && query.trim()) {
|
|
|
|
|
+ const queryLower = query.toLowerCase();
|
|
|
|
|
+ filteredList = filteredList.filter(company =>
|
|
|
|
|
+ company.companyName && company.companyName.toLowerCase().includes(queryLower)
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ const startIndex = (page - 1) * this.shipCompanyPageSize;
|
|
|
|
|
+ const endIndex = startIndex + this.shipCompanyPageSize;
|
|
|
|
|
+ this.shipCompanyList = filteredList.slice(startIndex, endIndex);
|
|
|
|
|
+ this.shipCompanyHasMore = endIndex < filteredList.length;
|
|
|
|
|
+ },
|
|
|
searchShipCompany(query) {
|
|
searchShipCompany(query) {
|
|
|
this.shipCompanyQuery = query || '';
|
|
this.shipCompanyQuery = query || '';
|
|
|
this.shipCompanyPage = 1;
|
|
this.shipCompanyPage = 1;
|
|
|
- this.getShipCompanyListByPage(this.shipCompanyQuery, this.shipCompanyPage);
|
|
|
|
|
|
|
+ this.filterShipCompanyList(this.shipCompanyQuery, this.shipCompanyPage);
|
|
|
},
|
|
},
|
|
|
handleShipCompanyVisibleChange(visible) {
|
|
handleShipCompanyVisibleChange(visible) {
|
|
|
- if (visible && !this.shipCompanyQuery) {
|
|
|
|
|
|
|
+ if (visible && !this.shipCompanyQuery && this.allShipCompanyList.length === 0) {
|
|
|
this.shipCompanyPage = 1;
|
|
this.shipCompanyPage = 1;
|
|
|
this.getShipCompanyListByPage('', this.shipCompanyPage);
|
|
this.getShipCompanyListByPage('', this.shipCompanyPage);
|
|
|
}
|
|
}
|
|
@@ -451,7 +457,7 @@ export default {
|
|
|
handleShipCompanyScroll() {
|
|
handleShipCompanyScroll() {
|
|
|
if (this.shipCompanyHasMore && !this.shipCompanyLoading) {
|
|
if (this.shipCompanyHasMore && !this.shipCompanyLoading) {
|
|
|
this.shipCompanyPage++;
|
|
this.shipCompanyPage++;
|
|
|
- this.getShipCompanyListByPage(this.shipCompanyQuery, this.shipCompanyPage);
|
|
|
|
|
|
|
+ this.filterShipCompanyList(this.shipCompanyQuery, this.shipCompanyPage);
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
getPilotPlans() {
|
|
getPilotPlans() {
|