|
@@ -217,8 +217,23 @@ export default {
|
|
|
async getStationCode() {
|
|
|
await this.$axios({url: '/electricfield/all', method: 'get'}).then(response => {
|
|
|
this.stationList = response.data
|
|
|
- this.stationList.push({value: 'all', label: '全部'})
|
|
|
if (this.stationList.length > 0) {
|
|
|
+ // 默认查全部
|
|
|
+ this.stationList.push({value: 'all', label: '全部'})
|
|
|
+ const sortItems = (arr, sortValue) => {
|
|
|
+ return arr.sort((a, b) => {
|
|
|
+ if (a.value === sortValue) {
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+ if (b.value === sortValue) {
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ return a.value - b.value; // 示例:按id升序排序
|
|
|
+ });
|
|
|
+ };
|
|
|
+ const sortValue = 'all';
|
|
|
+ const sortedItems = sortItems(this.stationList, sortValue);
|
|
|
+ this.stationList = sortedItems
|
|
|
this.stationCode = this.stationList[0].value
|
|
|
this.dataQuery()
|
|
|
}
|