From 974394f7a0496fa8e37dd326b6f9313e14caa708 Mon Sep 17 00:00:00 2001
From: 张含笑 <zhx18749296735@163.com>
Date: Thu, 26 Jun 2025 17:35:37 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/all_setting_styles' into all_setting_styles
---
src/views/resource/waylineFile.vue | 189 +++++++++++++++++++++-------------------------
1 files changed, 87 insertions(+), 102 deletions(-)
diff --git a/src/views/resource/waylineFile.vue b/src/views/resource/waylineFile.vue
index 412fe53..597623d 100644
--- a/src/views/resource/waylineFile.vue
+++ b/src/views/resource/waylineFile.vue
@@ -1,30 +1,20 @@
<template>
<basic-container>
- <avue-crud
- :option="option"
- :table-loading="loading"
- :data="data"
- :page.sync="page"
- v-model="form"
- ref="crud"
- @search-change="searchChange"
- @search-reset="searchReset"
- @current-change="currentChange"
- @size-change="sizeChange"
- @refresh-change="refreshChange"
- >
+ <avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page" v-model="form" ref="crud"
+ @search-change="searchChange" @search-reset="searchReset" @current-change="currentChange"
+ @size-change="sizeChange" @refresh-change="refreshChange">
</avue-crud>
</basic-container>
</template>
<script>
-import { getWaylineFileByUser } from '@/api/resource/waylineFile';
-import { getAirportList } from '@/api/device/device';
+import { getWaylineFileByUser } from '@/api/resource/waylineFile'
+import { getAirportList } from '@/api/device/device'
export default {
name: 'WaylineFile',
- data() {
- const { defaultStartDate, defaultEndDate } = this.getDefaultDates();
+ data () {
+ const { defaultStartDate, defaultEndDate } = this.getDefaultDates()
return {
form: {},
query: { name: '', dock_name: '', daterange: [defaultStartDate, defaultEndDate] },
@@ -40,6 +30,9 @@
index: true,
menu: false,
page: true,
+
+ height: 'auto',
+ calcHeight: 20,
column: [
{
label: '机场选择',
@@ -86,53 +79,53 @@
},
],
},
- };
+ }
},
- mounted() {
- this.fetchAirports();
- this.fetchData(this.page, this.query); // 初次加载包含默认时间范围
+ mounted () {
+ this.fetchAirports()
+ this.fetchData(this.page, this.query) // 初次加载包含默认时间范围
},
methods: {
- getDefaultDates() {
- const endDate = new Date();
- const startDate = new Date();
- startDate.setMonth(startDate.getMonth() - 1);
+ getDefaultDates () {
+ const endDate = new Date()
+ const startDate = new Date()
+ startDate.setMonth(startDate.getMonth() - 1)
// 结束时间设定为当天 23:59:59
- endDate.setHours(23, 59, 59, 999);
+ endDate.setHours(23, 59, 59, 999)
return {
defaultStartDate: `${startDate.getFullYear()}-${String(startDate.getMonth() + 1).padStart(2, '0')}-${String(startDate.getDate()).padStart(2, '0')}`,
defaultEndDate: `${endDate.getFullYear()}-${String(endDate.getMonth() + 1).padStart(2, '0')}-${String(endDate.getDate()).padStart(2, '0')}`,
- };
+ }
},
- async fetchAirports() {
+ async fetchAirports () {
try {
- const res = await getAirportList();
- const airportData = res.data.data || [];
- const airportColumn = this.option.column.find((col) => col.prop === 'dock_name');
+ const res = await getAirportList()
+ const airportData = res.data.data || []
+ const airportColumn = this.option.column.find((col) => col.prop === 'dock_name')
if (airportColumn) {
airportColumn.dicData = airportData.map((item) => ({
nickname: item.nickname,
workspace_id: item.workspace_id,
- }));
+ }))
}
} catch (error) {
- console.error('加载机场列表失败:', error);
+ console.error('加载机场列表失败:', error)
}
},
- async fetchData(page, params = {}) {
- this.loading = true;
- const { name, dock_name, daterange } = params;
- const workspaceId = this.selectedWorkspaceId || null;
+ async fetchData (page, params = {}) {
+ this.loading = true
+ const { name, dock_name, daterange } = params
+ const workspaceId = this.selectedWorkspaceId || null
// 时间范围处理
- const startDate = new Date(daterange[0]);
- let endDate = new Date(daterange[1]);
+ const startDate = new Date(daterange[0])
+ let endDate = new Date(daterange[1])
// 结束时间始终设定为当天 23:59:59
- endDate.setHours(23, 59, 59, 999);
+ endDate.setHours(23, 59, 59, 999)
- const startTime = isNaN(startDate.getTime()) ? null : startDate.getTime();
- const endTime = isNaN(endDate.getTime()) ? null : endDate.getTime();
+ const startTime = isNaN(startDate.getTime()) ? null : startDate.getTime()
+ const endTime = isNaN(endDate.getTime()) ? null : endDate.getTime()
const requestParams = {
workspaceId,
@@ -141,9 +134,9 @@
endTime,
page: page.currentPage,
pageSize: page.pageSize,
- };
+ }
- console.log('请求参数:', requestParams);
+ console.log('请求参数:', requestParams)
try {
const res = await getWaylineFileByUser(
@@ -153,8 +146,8 @@
requestParams.endTime,
requestParams.page,
requestParams.pageSize
- );
- const responseData = res.data;
+ )
+ const responseData = res.data
if (responseData?.code === 0 && Array.isArray(responseData.data?.list)) {
this.data = responseData.data.list.map((item) => ({
@@ -163,80 +156,72 @@
wayline_type: item.wayline_type,
user_name: item.user_name,
update_time: item.update_time,
- }));
- this.page.total = responseData.data.pagination?.total || responseData.data.list.length;
- this.page.currentPage = page.currentPage;
- console.log('返回数据条数:', this.data.length);
- console.log('当前页码:', this.page.currentPage);
- console.log('总条数:', this.page.total);
+ }))
+ this.page.total = responseData.data.pagination?.total || responseData.data.list.length
+ this.page.currentPage = page.currentPage
+ console.log('返回数据条数:', this.data.length)
+ console.log('当前页码:', this.page.currentPage)
+ console.log('总条数:', this.page.total)
} else {
- this.data = [];
- this.page.total = 0;
+ this.data = []
+ this.page.total = 0
}
} catch (error) {
- console.error('加载数据失败:', error);
- this.data = [];
- this.page.total = 0;
+ console.error('加载数据失败:', error)
+ this.data = []
+ this.page.total = 0
} finally {
- this.loading = false;
+ this.loading = false
}
},
- searchChange(params, done) {
- this.query = { ...params };
- const airportColumn = this.option.column.find((col) => col.prop === 'dock_name');
- const selectedAirport = airportColumn.dicData.find((item) => item.nickname === params.dock_name);
- this.selectedWorkspaceId = selectedAirport ? selectedAirport.workspace_id : null;
- this.page.currentPage = 1;
- this.fetchData(this.page, this.query);
- done();
+ searchChange (params, done) {
+ this.query = { ...params }
+ const airportColumn = this.option.column.find((col) => col.prop === 'dock_name')
+ const selectedAirport = airportColumn.dicData.find((item) => item.nickname === params.dock_name)
+ this.selectedWorkspaceId = selectedAirport ? selectedAirport.workspace_id : null
+ this.page.currentPage = 1
+ this.fetchData(this.page, this.query)
+ done()
},
- searchReset() {
- const { defaultStartDate, defaultEndDate } = this.getDefaultDates();
- this.query = { name: '', dock_name: '', daterange: [defaultStartDate, defaultEndDate] };
- this.selectedWorkspaceId = null;
- const daterangeColumn = this.option.column.find((col) => col.prop === 'daterange');
- daterangeColumn.searchValue = [defaultStartDate, defaultEndDate];
- this.page.currentPage = 1;
- this.fetchData(this.page, this.query);
+ searchReset () {
+ const { defaultStartDate, defaultEndDate } = this.getDefaultDates()
+ this.query = { name: '', dock_name: '', daterange: [defaultStartDate, defaultEndDate] }
+ this.selectedWorkspaceId = null
+ const daterangeColumn = this.option.column.find((col) => col.prop === 'daterange')
+ daterangeColumn.searchValue = [defaultStartDate, defaultEndDate]
+ this.page.currentPage = 1
+ this.fetchData(this.page, this.query)
},
- currentChange(currentPage) {
- console.log('切换页码至:', currentPage);
- this.page.currentPage = currentPage;
- this.fetchData(this.page, this.query);
+ currentChange (currentPage) {
+ console.log('切换页码至:', currentPage)
+ this.page.currentPage = currentPage
+ this.fetchData(this.page, this.query)
},
- sizeChange(pageSize) {
- console.log('每页条数改为:', pageSize);
- this.page.pageSize = pageSize;
- this.page.currentPage = 1;
- this.fetchData(this.page, this.query);
+ sizeChange (pageSize) {
+ console.log('每页条数改为:', pageSize)
+ this.page.pageSize = pageSize
+ this.page.currentPage = 1
+ this.fetchData(this.page, this.query)
},
- refreshChange() {
- this.fetchData(this.page, this.query);
+ refreshChange () {
+ this.fetchData(this.page, this.query)
},
- formatTime(time) {
- if (!time) return '';
- const date = new Date(time < 10000000000 ? time * 1000 : time);
- if (isNaN(date.getTime())) return '无效时间';
- return date.toLocaleString('zh-CN', { hour12: false }).replace(/\//g, '-');
+ formatTime (time) {
+ if (!time) return ''
+ const date = new Date(time < 10000000000 ? time * 1000 : time)
+ if (isNaN(date.getTime())) return '无效时间'
+ return date.toLocaleString('zh-CN', { hour12: false }).replace(/\//g, '-')
},
- formatWaylineType(type) {
- const typeMap = { '0': '普通航线', '1': '图斑举证航线', '2': '航测航线', '3': '航点航线', '4': '正射举证航线' };
- return typeMap[type] || '未知';
+ formatWaylineType (type) {
+ const typeMap = { '0': '普通航线', '1': '图斑举证航线', '2': '航测航线', '3': '航点航线', '4': '正射举证航线' }
+ return typeMap[type] || '未知'
},
},
-};
+}
</script>
<style scoped lang="scss">
.avue-crud .el-table {
max-height: none !important;
}
- :deep(){
- .avue-crud__body{
- .el-form{
- height: 745px;
- overflow: auto;
- }
- }
- }
</style>
--
Gitblit v1.9.3