From c509e19e5e3cd38e0ca23fa8996477cad38bca20 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Thu, 26 Jun 2025 17:28:20 +0800
Subject: [PATCH] feat:设备管理、任务管理、资源管理二级菜单页面样式调整
---
src/option/job/jobserver.js | 4
src/views/odm/task.vue | 2
src/views/resource/oss.vue | 2
src/views/monitor/log/api.vue | 2
src/views/device/addDevice.vue | 11
src/views/resource/attach.vue | 2
src/views/resource/waylineFile.vue | 182 ++++++------
src/views/system/user.vue | 2
src/option/job/jobinfo.js | 2
src/views/resource/wayline.vue | 233 ++++++++--------
src/views/device/components/firmwareManage.vue | 2
src/views/resource/media.vue | 338 ++++++++++++------------
12 files changed, 379 insertions(+), 403 deletions(-)
diff --git a/src/option/job/jobinfo.js b/src/option/job/jobinfo.js
index 3341564..ec35b22 100644
--- a/src/option/job/jobinfo.js
+++ b/src/option/job/jobinfo.js
@@ -131,7 +131,7 @@
tabs: true,
height: 'auto',
- calcHeight: 0,
+ calcHeight: 20,
column: [
{
diff --git a/src/option/job/jobserver.js b/src/option/job/jobserver.js
index d887770..ebf0fc2 100644
--- a/src/option/job/jobserver.js
+++ b/src/option/job/jobserver.js
@@ -2,7 +2,7 @@
* @Author : yuan
* @Date : 2025-06-14 15:19:16
* @LastEditors : yuan
- * @LastEditTime : 2025-06-26 11:23:15
+ * @LastEditTime : 2025-06-26 17:24:02
* @FilePath : \src\option\job\jobserver.js
* @Description :
* Copyright 2025 OBKoro1, All Rights Reserved.
@@ -22,7 +22,7 @@
dialogClickModal: false,
height: 'auto',
- calcHeight: 0,
+ calcHeight: 20,
column: [
{
label: '服务名称',
diff --git a/src/views/device/addDevice.vue b/src/views/device/addDevice.vue
index 1faac8d..88a8a89 100644
--- a/src/views/device/addDevice.vue
+++ b/src/views/device/addDevice.vue
@@ -80,7 +80,7 @@
grid: false,
height: 'auto',
- calcHeight: 0,
+ calcHeight: 20,
column: [
{
label: '工作空间名称',
@@ -425,15 +425,6 @@
</script>
<style lang="scss" scoped>
-:deep() {
- .avue-crud__body {
- .el-form {
- height: 745px;
- overflow: auto;
- }
- }
-}
-
.firmware_status {
background-color: aqua;
border-radius: 4px;
diff --git a/src/views/device/components/firmwareManage.vue b/src/views/device/components/firmwareManage.vue
index fcbf36f..95e8534 100644
--- a/src/views/device/components/firmwareManage.vue
+++ b/src/views/device/components/firmwareManage.vue
@@ -115,7 +115,7 @@
grid: false,
height: 'auto',
- calcHeight: 0,
+ calcHeight: 20,
column: [
{
label: '设备名称',
diff --git a/src/views/monitor/log/api.vue b/src/views/monitor/log/api.vue
index a8e6a22..159ec99 100644
--- a/src/views/monitor/log/api.vue
+++ b/src/views/monitor/log/api.vue
@@ -40,7 +40,7 @@
dialogType: 'drawer',
height: 'auto',
- calcHeight: 0,
+ calcHeight: 20,
column: [
{
diff --git a/src/views/odm/task.vue b/src/views/odm/task.vue
index b0500ec..63e57f4 100644
--- a/src/views/odm/task.vue
+++ b/src/views/odm/task.vue
@@ -68,7 +68,7 @@
menuWidth: 260,
height: 'auto',
- calcHeight: 0,
+ calcHeight: 20,
column: [
{
diff --git a/src/views/resource/attach.vue b/src/views/resource/attach.vue
index db81f6c..29bebe0 100644
--- a/src/views/resource/attach.vue
+++ b/src/views/resource/attach.vue
@@ -56,7 +56,7 @@
dialogClickModal: false,
height: 'auto',
- calcHeight: 0,
+ calcHeight: 20,
column: [
{
label: '附件地址',
diff --git a/src/views/resource/media.vue b/src/views/resource/media.vue
index 1bce90d..52aade7 100644
--- a/src/views/resource/media.vue
+++ b/src/views/resource/media.vue
@@ -28,19 +28,19 @@
</template>
<script>
-import JSZip from 'jszip';
-import { getMedia, deleteAllFile } from '@/api/resource/media';
-import { getAirportList } from '@/api/device/device';
-import { mapGetters } from 'vuex';
-import func from '@/utils/func';
+import JSZip from 'jszip'
+import { getMedia, deleteAllFile } from '@/api/resource/media'
+import { getAirportList } from '@/api/device/device'
+import { mapGetters } from 'vuex'
+import func from '@/utils/func'
export default {
- data() {
- const endDate = new Date();
- const startDate = new Date();
- startDate.setMonth(startDate.getMonth() - 1);
- const defaultStartDate = `${startDate.getFullYear()}-${String(startDate.getMonth() + 1).padStart(2, '0')}-${String(startDate.getDate()).padStart(2, '0')}`;
- const defaultEndDate = `${endDate.getFullYear()}-${String(endDate.getMonth() + 1).padStart(2, '0')}-${String(endDate.getDate()).padStart(2, '0')}`;
+ data () {
+ const endDate = new Date()
+ const startDate = new Date()
+ startDate.setMonth(startDate.getMonth() - 1)
+ const defaultStartDate = `${startDate.getFullYear()}-${String(startDate.getMonth() + 1).padStart(2, '0')}-${String(startDate.getDate()).padStart(2, '0')}`
+ const defaultEndDate = `${endDate.getFullYear()}-${String(endDate.getMonth() + 1).padStart(2, '0')}-${String(endDate.getDate()).padStart(2, '0')}`
return {
form: {},
@@ -66,6 +66,9 @@
selection: true,
dialogClickModal: false,
delBtn: false,
+
+ height: 'auto',
+ calcHeight: 20,
column: [
{ label: '机场选择', prop: 'airportNickname', type: 'select', search: true, searchSpan: 5, dicData: [], props: { label: 'nickname', value: 'nickname' }, hide: true },
{ label: '创建日期', prop: 'daterange', type: 'daterange', search: true, searchRange: true, searchSpan: 6, format: 'YYYY-MM-DD', valueFormat: 'YYYY-MM-DD', startPlaceholder: '开始时间', endPlaceholder: '结束时间', viewDisplay: false, hide: true, searchValue: [defaultStartDate, defaultEndDate] },
@@ -87,152 +90,152 @@
},
domainUrl: '',
isDownloading: false, // 控制按钮加载状态
- };
+ }
},
computed: {
- func() { return func; },
+ func () { return func },
...mapGetters(['permission']),
- permissionList() {
+ permissionList () {
return {
addBtn: false,
editBtn: false,
viewBtn: this.validData(this.permission.attach_view, false),
delBtn: this.validData(this.permission.attach_delete, false),
- };
+ }
},
- ids() { return this.selectionList.map(ele => ele.id).join(','); },
+ ids () { return this.selectionList.map(ele => ele.id).join(',') },
},
- mounted() {
- this.loadAirportList();
- this.$refs.crud.setSearch({ daterange: this.query.daterange });
- this.onLoad(this.page, this.query);
+ mounted () {
+ this.loadAirportList()
+ this.$refs.crud.setSearch({ daterange: this.query.daterange })
+ this.onLoad(this.page, this.query)
},
methods: {
- loadAirportList() {
+ loadAirportList () {
getAirportList().then(res => {
- const airportData = res.data.data || [];
- const airportColumn = this.option.column.find(col => col.prop === 'airportNickname');
+ const airportData = res.data.data || []
+ const airportColumn = this.option.column.find(col => col.prop === 'airportNickname')
if (airportColumn) {
airportColumn.dicData = airportData.map(item => ({
nickname: item.nickname,
workspace_id: item.workspace_id,
- }));
+ }))
}
}).catch(error => {
- console.error('加载机场列表时出错:', error);
- });
+ console.error('加载机场列表时出错:', error)
+ })
},
- handleUpload() {
- this.taskBox = true;
+ handleUpload () {
+ this.taskBox = true
},
- uploadAfter(res, done) {
- this.taskBox = false;
- this.refreshChange();
- done();
+ uploadAfter (res, done) {
+ this.taskBox = false
+ this.refreshChange()
+ done()
},
- async handleRowDownload(row) {
- const mediaUrl = this.domainUrl + row.object_key;
+ async handleRowDownload (row) {
+ const mediaUrl = this.domainUrl + row.object_key
try {
- const response = await fetch(mediaUrl);
- if (!response.ok) throw new Error('文件下载失败');
- const blob = await response.blob();
- const url = window.URL.createObjectURL(blob);
- const link = document.createElement('a');
- link.href = url;
- link.download = row.file_name || 'download';
- document.body.appendChild(link);
- link.click();
- document.body.removeChild(link);
- window.URL.revokeObjectURL(url);
- this.$message({ type: 'success', message: '文件下载成功: ' + row.file_name });
+ const response = await fetch(mediaUrl)
+ if (!response.ok) throw new Error('文件下载失败')
+ const blob = await response.blob()
+ const url = window.URL.createObjectURL(blob)
+ const link = document.createElement('a')
+ link.href = url
+ link.download = row.file_name || 'download'
+ document.body.appendChild(link)
+ link.click()
+ document.body.removeChild(link)
+ window.URL.revokeObjectURL(url)
+ this.$message({ type: 'success', message: '文件下载成功: ' + row.file_name })
} catch (error) {
- console.error('下载文件时出错:', error);
- this.$message({ type: 'error', message: '下载失败: ' + error.message });
+ console.error('下载文件时出错:', error)
+ this.$message({ type: 'error', message: '下载失败: ' + error.message })
}
},
- handleRowDelete(row) {
+ handleRowDelete (row) {
this.$confirm('确定删除此文件?', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' })
.then(() => deleteAllFile(row.id))
.then(() => {
- this.onLoad(this.page);
- this.$message({ type: 'success', message: '删除成功!' });
+ this.onLoad(this.page)
+ this.$message({ type: 'success', message: '删除成功!' })
})
.catch(error => {
- console.error('删除文件时出错:', error);
- this.$message({ type: 'error', message: '删除失败,请稍后重试!' });
- });
+ console.error('删除文件时出错:', error)
+ this.$message({ type: 'error', message: '删除失败,请稍后重试!' })
+ })
},
- rowDel(row) {
+ rowDel (row) {
this.$confirm('确定将选择数据及对应的文件删除?', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' })
.then(() => deleteAllFile(row.id))
.then(() => {
- this.onLoad(this.page);
- this.$message({ type: 'success', message: '操作成功!' });
- });
+ this.onLoad(this.page)
+ this.$message({ type: 'success', message: '操作成功!' })
+ })
},
- searchReset() {
- const endDate = new Date();
- const startDate = new Date();
- startDate.setMonth(startDate.getMonth() - 1);
- const defaultStartDate = `${startDate.getFullYear()}-${String(startDate.getMonth() + 1).padStart(2, '0')}-${String(startDate.getDate()).padStart(2, '0')}`;
- const defaultEndDate = `${endDate.getFullYear()}-${String(endDate.getMonth() + 1).padStart(2, '0')}-${String(endDate.getDate()).padStart(2, '0')}`;
- this.query = { daterange: [defaultStartDate, defaultEndDate] };
- this.selectedWorkspaceId = null;
- this.$refs.crud.setSearch({ daterange: this.query.daterange });
- this.onLoad(this.page, this.query);
+ searchReset () {
+ const endDate = new Date()
+ const startDate = new Date()
+ startDate.setMonth(startDate.getMonth() - 1)
+ const defaultStartDate = `${startDate.getFullYear()}-${String(startDate.getMonth() + 1).padStart(2, '0')}-${String(startDate.getDate()).padStart(2, '0')}`
+ const defaultEndDate = `${endDate.getFullYear()}-${String(endDate.getMonth() + 1).padStart(2, '0')}-${String(endDate.getDate()).padStart(2, '0')}`
+ this.query = { daterange: [defaultStartDate, defaultEndDate] }
+ this.selectedWorkspaceId = null
+ this.$refs.crud.setSearch({ daterange: this.query.daterange })
+ this.onLoad(this.page, this.query)
},
- searchChange(params, done) {
- this.query = params;
- this.page.currentPage = 1;
- const airportColumn = this.option.column.find(col => col.prop === 'airportNickname');
- const selectedAirport = airportColumn.dicData.find(item => item.nickname === params.airportNickname);
- this.selectedWorkspaceId = selectedAirport ? selectedAirport.workspace_id : null;
- this.onLoad(this.page, params);
- done();
+ searchChange (params, done) {
+ this.query = params
+ this.page.currentPage = 1
+ const airportColumn = this.option.column.find(col => col.prop === 'airportNickname')
+ const selectedAirport = airportColumn.dicData.find(item => item.nickname === params.airportNickname)
+ this.selectedWorkspaceId = selectedAirport ? selectedAirport.workspace_id : null
+ this.onLoad(this.page, params)
+ done()
},
- selectionChange(list) {
- this.selectionList = list;
+ selectionChange (list) {
+ this.selectionList = list
},
- selectionClear() {
- this.selectionList = [];
- this.$refs.crud.toggleSelection();
+ selectionClear () {
+ this.selectionList = []
+ this.$refs.crud.toggleSelection()
},
- currentChange(currentPage) {
- this.page.currentPage = currentPage;
- this.onLoad(this.page, this.query);
+ currentChange (currentPage) {
+ this.page.currentPage = currentPage
+ this.onLoad(this.page, this.query)
},
- sizeChange(pageSize) {
- this.page.pageSize = pageSize;
- this.onLoad(this.page, this.query);
+ sizeChange (pageSize) {
+ this.page.pageSize = pageSize
+ this.onLoad(this.page, this.query)
},
- refreshChange() {
- this.onLoad(this.page, this.query);
+ refreshChange () {
+ this.onLoad(this.page, this.query)
},
- onLoad(page, params = {}) {
- this.loading = true;
- const { daterange } = params;
- let create_time = null;
- let end_time = null;
+ onLoad (page, params = {}) {
+ this.loading = true
+ const { daterange } = params
+ let create_time = null
+ let end_time = null
if (daterange && Array.isArray(daterange) && daterange.length === 2) {
- const startStr = daterange[0];
- const endStr = daterange[1];
- const startDate = new Date(startStr + ' 00:00:00').getTime();
- const endDate = new Date(endStr + ' 23:59:59').getTime();
+ const startStr = daterange[0]
+ const endStr = daterange[1]
+ const startDate = new Date(startStr + ' 00:00:00').getTime()
+ const endDate = new Date(endStr + ' 23:59:59').getTime()
if (!isNaN(startDate) && !isNaN(endDate)) {
- create_time = startDate;
- end_time = endDate;
+ create_time = startDate
+ end_time = endDate
}
}
- let values = { ...params, ...this.query };
- if (daterange) values.daterange = null;
+ let values = { ...params, ...this.query }
+ if (daterange) values.daterange = null
getMedia(page.currentPage, page.pageSize, this.selectedWorkspaceId || null, create_time, end_time)
.then(res => {
- const data = res.data;
+ const data = res.data
if (data && data.data && data.data.list) {
- this.page.total = data.data.pagination.total;
+ this.page.total = data.data.pagination.total
this.data = data.data.list.map(item => ({
job_name: item.job_name,
file_name: item.file_name,
@@ -241,110 +244,109 @@
payload: item.payload,
airportNickname: item.airportNickname,
id: item.id,
- }));
- this.domainUrl = data.data.list.length > 0 ? data.data.list[0].domain_url : 'http://localhost:2888/manage/resource';
+ }))
+ this.domainUrl = data.data.list.length > 0 ? data.data.list[0].domain_url : 'http://localhost:2888/manage/resource'
} else {
- this.data = [];
+ this.data = []
}
- this.loading = false;
- this.selectionClear();
- this.$refs.crud.refreshTable();
+ this.loading = false
+ this.selectionClear()
+ this.$refs.crud.refreshTable()
})
.catch(error => {
- this.loading = false;
- console.error('加载媒体数据时出错:', error);
- });
+ this.loading = false
+ console.error('加载媒体数据时出错:', error)
+ })
},
- formatCreateTime(createTime) {
- if (typeof createTime !== 'number' || isNaN(createTime)) return '';
- const timestamp = createTime < 10000000000 ? createTime * 1000 : createTime;
- const date = new Date(timestamp);
- if (isNaN(date.getTime())) return '';
- const year = date.getFullYear();
- const month = String(date.getMonth() + 1).padStart(2, '0');
- const day = String(date.getDate()).padStart(2, '0');
- const hours = String(date.getHours()).padStart(2, '0');
- const minutes = String(date.getMinutes()).padStart(2, '0');
- const seconds = String(date.getSeconds()).padStart(2, '0');
- return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
+ formatCreateTime (createTime) {
+ if (typeof createTime !== 'number' || isNaN(createTime)) return ''
+ const timestamp = createTime < 10000000000 ? createTime * 1000 : createTime
+ const date = new Date(timestamp)
+ if (isNaN(date.getTime())) return ''
+ const year = date.getFullYear()
+ const month = String(date.getMonth() + 1).padStart(2, '0')
+ const day = String(date.getDate()).padStart(2, '0')
+ const hours = String(date.getHours()).padStart(2, '0')
+ const minutes = String(date.getMinutes()).padStart(2, '0')
+ const seconds = String(date.getSeconds()).padStart(2, '0')
+ return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
},
- handleRowView(row) {
- const mediaUrl = this.domainUrl + row.object_key;
- const mediaType = this.getMediaType(row.object_key);
+ handleRowView (row) {
+ const mediaUrl = this.domainUrl + row.object_key
+ const mediaType = this.getMediaType(row.object_key)
if (mediaType === 'image' || mediaType === 'video') {
- window.open(mediaUrl, '_blank');
+ window.open(mediaUrl, '_blank')
}
},
- getMediaType(objectKey) {
- const extension = objectKey.split('.').pop().toLowerCase();
- if (['jpg', 'jpeg', 'png', 'gif'].includes(extension)) return 'image';
- if (['mp4', 'avi', 'mov'].includes(extension)) return 'video';
- return 'unknown';
+ getMediaType (objectKey) {
+ const extension = objectKey.split('.').pop().toLowerCase()
+ if (['jpg', 'jpeg', 'png', 'gif'].includes(extension)) return 'image'
+ if (['mp4', 'avi', 'mov'].includes(extension)) return 'video'
+ return 'unknown'
},
- showVideo(url) {
- this.taskBox = true;
- this.taskForm = { videoUrl: url };
+ showVideo (url) {
+ this.taskBox = true
+ this.taskForm = { videoUrl: url }
this.taskOption = {
submitBtn: false,
emptyBtn: false,
column: [
{ label: '视频播放', prop: 'videoUrl', type: 'video', span: 24, props: { controls: true, autoplay: false } },
],
- };
+ }
},
- validData(val, def) {
- return typeof val !== 'undefined' ? val : def;
+ validData (val, def) {
+ return typeof val !== 'undefined' ? val : def
},
- async handleZipDownload() {
+ async handleZipDownload () {
if (this.selectionList.length === 0) {
- this.$message({ type: 'warning', message: '请先选择需要下载的文件' });
- return;
+ this.$message({ type: 'warning', message: '请先选择需要下载的文件' })
+ return
}
- this.isDownloading = true;
+ this.isDownloading = true
try {
- const zip = new JSZip();
+ const zip = new JSZip()
const files = this.selectionList.map(item => ({
url: this.domainUrl + item.object_key,
name: item.file_name
- }));
+ }))
const fetchPromises = files.map(async file => {
- const response = await fetch(file.url, { cache: 'force-cache' });
- if (!response.ok) throw new Error(`下载文件 ${file.name} 失败`);
- const blob = await response.blob();
- zip.file(file.name, blob);
- });
+ const response = await fetch(file.url, { cache: 'force-cache' })
+ if (!response.ok) throw new Error(`下载文件 ${file.name} 失败`)
+ const blob = await response.blob()
+ zip.file(file.name, blob)
+ })
- await Promise.all(fetchPromises);
+ await Promise.all(fetchPromises)
const content = await zip.generateAsync({
type: 'blob',
compression: 'DEFLATE',
compressionOptions: { level: 1 }
- });
+ })
- const url = window.URL.createObjectURL(content);
- const link = document.createElement('a');
- link.href = url;
- link.download = `media_files_${new Date().toISOString().slice(0, 10)}_${new Date().getTime()}.zip`;
- document.body.appendChild(link);
- link.click();
- document.body.removeChild(link);
- window.URL.revokeObjectURL(url);
+ const url = window.URL.createObjectURL(content)
+ const link = document.createElement('a')
+ link.href = url
+ link.download = `media_files_${new Date().toISOString().slice(0, 10)}_${new Date().getTime()}.zip`
+ document.body.appendChild(link)
+ link.click()
+ document.body.removeChild(link)
+ window.URL.revokeObjectURL(url)
- this.$message({ type: 'success', message: `成功下载 ${this.selectionList.length} 个文件` });
+ this.$message({ type: 'success', message: `成功下载 ${this.selectionList.length} 个文件` })
} catch (error) {
- console.error('压缩下载失败:', error);
- this.$message({ type: 'error', message: '压缩下载失败: ' + error.message });
+ console.error('压缩下载失败:', error)
+ this.$message({ type: 'error', message: '压缩下载失败: ' + error.message })
} finally {
- this.isDownloading = false;
+ this.isDownloading = false
}
},
},
-};
+}
</script>
-<style scoped lang="scss">
-</style>
+<style scoped lang="scss"></style>
diff --git a/src/views/resource/oss.vue b/src/views/resource/oss.vue
index af6ba3c..4e86013 100644
--- a/src/views/resource/oss.vue
+++ b/src/views/resource/oss.vue
@@ -65,7 +65,7 @@
dialogClickModal: false,
height: 'auto',
- calcHeight: 0,
+ calcHeight: 20,
column: [
{
label: '分类',
diff --git a/src/views/resource/wayline.vue b/src/views/resource/wayline.vue
index a26e0a3..57551c1 100644
--- a/src/views/resource/wayline.vue
+++ b/src/views/resource/wayline.vue
@@ -1,40 +1,29 @@
<template>
<basic-container>
- <avue-crud
- :option="option"
- :table-loading="loading"
- :data="data"
- v-model:page="page"
- :permission="permissionList"
- v-model="form"
- ref="crud"
- @search-change="searchChange"
- @search-reset="searchReset"
- @selection-change="selectionChange"
- @current-change="currentChange"
- @size-change="sizeChange"
- @refresh-change="refreshChange"
- @on-load="onLoad">
+ <avue-crud :option="option" :table-loading="loading" :data="data" v-model:page="page" :permission="permissionList"
+ v-model="form" ref="crud" @search-change="searchChange" @search-reset="searchReset"
+ @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
+ @refresh-change="refreshChange" @on-load="onLoad">
</avue-crud>
</basic-container>
</template>
<script>
-import { getJobsByUser } from '@/api/resource/wayline';
-import { getAirportList } from '@/api/device/device';
-import { mapGetters } from 'vuex';
-import func from '@/utils/func';
+import { getJobsByUser } from '@/api/resource/wayline'
+import { getAirportList } from '@/api/device/device'
+import { mapGetters } from 'vuex'
+import func from '@/utils/func'
export default {
- data() {
+ data () {
// 计算默认的开始和结束日期
- const endDate = new Date(); // 当前日期
- const startDate = new Date(); // 一个月前的日期
- startDate.setMonth(startDate.getMonth() - 1);
+ const endDate = new Date() // 当前日期
+ const startDate = new Date() // 一个月前的日期
+ startDate.setMonth(startDate.getMonth() - 1)
// 格式化为 YYYY-MM-DD 字符串
- const defaultStartDate = `${startDate.getFullYear()}-${String(startDate.getMonth() + 1).padStart(2, '0')}-${String(startDate.getDate()).padStart(2, '0')}`;
- const defaultEndDate = `${endDate.getFullYear()}-${String(endDate.getMonth() + 1).padStart(2, '0')}-${String(endDate.getDate()).padStart(2, '0')}`;
+ const defaultStartDate = `${startDate.getFullYear()}-${String(startDate.getMonth() + 1).padStart(2, '0')}-${String(startDate.getDate()).padStart(2, '0')}`
+ const defaultEndDate = `${endDate.getFullYear()}-${String(endDate.getMonth() + 1).padStart(2, '0')}-${String(endDate.getDate()).padStart(2, '0')}`
return {
form: {},
@@ -59,6 +48,9 @@
selection: true,
dialogClickModal: false,
menu: false, // 禁用默认操作列
+
+ height: 'auto',
+ calcHeight: 20,
column: [
{
label: '机场选择',
@@ -115,131 +107,131 @@
label: '错误原因',
prop: 'reason',
formatter: (row) => {
- return [4, 5].includes(row.status) ? row.reason || '未知' : '';
+ return [4, 5].includes(row.status) ? row.reason || '未知' : ''
},
},
],
},
data: [],
- };
+ }
},
computed: {
...mapGetters(['permission']),
- permissionList() {
+ permissionList () {
return {
addBtn: false,
editBtn: false,
viewBtn: this.validData(this.permission.attach_view, false),
delBtn: this.validData(this.permission.attach_delete, false),
- };
+ }
},
- ids() {
- let ids = [];
+ ids () {
+ let ids = []
this.selectionList.forEach(ele => {
- ids.push(ele.job_id);
- });
- return ids.join(',');
+ ids.push(ele.job_id)
+ })
+ return ids.join(',')
},
},
- mounted() {
- this.loadAirportList();
+ mounted () {
+ this.loadAirportList()
// 初始化时手动触发搜索,以确保默认值生效
- this.$refs.crud.searchChange(this.query);
- this.onLoad(this.page, this.query);
+ this.$refs.crud.searchChange(this.query)
+ this.onLoad(this.page, this.query)
},
methods: {
- loadAirportList() {
+ loadAirportList () {
getAirportList().then(res => {
- const airportData = res.data.data || [];
- const airportColumn = this.option.column.find(col => col.prop === 'dock_name');
+ 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 => {
// 处理错误
- });
+ })
},
- searchReset() {
+ searchReset () {
// 重置时恢复默认时间范围
- const endDate = new Date();
- const startDate = new Date();
- startDate.setMonth(startDate.getMonth() - 1);
- const defaultStartDate = `${startDate.getFullYear()}-${String(startDate.getMonth() + 1).padStart(2, '0')}-${String(startDate.getDate()).padStart(2, '0')}`;
- const defaultEndDate = `${endDate.getFullYear()}-${String(endDate.getMonth() + 1).padStart(2, '0')}-${String(endDate.getDate()).padStart(2, '0')}`;
+ const endDate = new Date()
+ const startDate = new Date()
+ startDate.setMonth(startDate.getMonth() - 1)
+ const defaultStartDate = `${startDate.getFullYear()}-${String(startDate.getMonth() + 1).padStart(2, '0')}-${String(startDate.getDate()).padStart(2, '0')}`
+ const defaultEndDate = `${endDate.getFullYear()}-${String(endDate.getMonth() + 1).padStart(2, '0')}-${String(endDate.getDate()).padStart(2, '0')}`
this.query = {
daterange: [defaultStartDate, defaultEndDate]
- };
- this.selectedWorkspaceId = null;
+ }
+ this.selectedWorkspaceId = null
// 更新 searchValue 以确保界面重置后显示默认值
- const daterangeColumn = this.option.column.find(col => col.prop === 'daterange');
- daterangeColumn.searchValue = [defaultStartDate, defaultEndDate];
- this.onLoad(this.page, this.query);
+ const daterangeColumn = this.option.column.find(col => col.prop === 'daterange')
+ daterangeColumn.searchValue = [defaultStartDate, defaultEndDate]
+ this.onLoad(this.page, this.query)
},
- searchChange(params, done) {
- this.query = params;
- this.page.currentPage = 1;
+ searchChange (params, done) {
+ this.query = params
+ this.page.currentPage = 1
- 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;
+ 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
- const { daterange } = params;
- let startTime = null;
- let endTime = null;
+ const { daterange } = params
+ let startTime = null
+ let endTime = null
if (daterange && Array.isArray(daterange) && daterange.length === 2) {
- startTime = this.formatTime(daterange[0]);
- endTime = this.formatTime(daterange[1]);
+ startTime = this.formatTime(daterange[0])
+ endTime = this.formatTime(daterange[1])
}
if (startTime && isNaN(new Date(startTime).getTime())) {
- startTime = null;
+ startTime = null
}
if (endTime && isNaN(new Date(endTime).getTime())) {
- endTime = null;
+ endTime = null
}
- this.onLoad(this.page, params);
- if (done) done();
+ this.onLoad(this.page, params)
+ if (done) done()
},
- selectionChange(list) {
- this.selectionList = list;
+ selectionChange (list) {
+ this.selectionList = list
},
- selectionClear() {
- this.selectionList = [];
- this.$refs.crud.toggleSelection();
+ selectionClear () {
+ this.selectionList = []
+ this.$refs.crud.toggleSelection()
},
- currentChange(currentPage) {
- this.page.currentPage = currentPage;
- this.onLoad(this.page, this.query);
+ currentChange (currentPage) {
+ this.page.currentPage = currentPage
+ this.onLoad(this.page, this.query)
},
- sizeChange(pageSize) {
- this.page.pageSize = pageSize;
- this.onLoad(this.page, this.query);
+ sizeChange (pageSize) {
+ this.page.pageSize = pageSize
+ this.onLoad(this.page, this.query)
},
- refreshChange() {
- this.onLoad(this.page, this.query);
+ refreshChange () {
+ this.onLoad(this.page, this.query)
},
- onLoad(page, params = {}) {
- this.loading = true;
+ onLoad (page, params = {}) {
+ this.loading = true
- const workspaceId = this.selectedWorkspaceId || null;
- const { daterange } = params;
- let startTime = null;
- let endTime = null;
+ const workspaceId = this.selectedWorkspaceId || null
+ const { daterange } = params
+ let startTime = null
+ let endTime = null
if (daterange && Array.isArray(daterange) && daterange.length === 2) {
- startTime = this.formatTime(daterange[0]);
- endTime = this.formatTime(daterange[1]);
+ startTime = this.formatTime(daterange[0])
+ endTime = this.formatTime(daterange[1])
}
if (startTime && isNaN(new Date(startTime).getTime())) {
- startTime = null;
+ startTime = null
}
if (endTime && isNaN(new Date(endTime).getTime())) {
- endTime = null;
+ endTime = null
}
getJobsByUser(
@@ -251,10 +243,10 @@
endTime,
params.job_name || null
).then(res => {
- const responseData = res.data;
+ const responseData = res.data
if (responseData && responseData.data && Array.isArray(responseData.data.list)) {
- this.page.total = responseData.data.pagination.total || responseData.data.list.length;
+ this.page.total = responseData.data.pagination.total || responseData.data.list.length
this.data = responseData.data.list.map(item => ({
job_id: item.job_id,
job_name: item.job_name,
@@ -265,45 +257,44 @@
reason: item.reason,
begin_time: item.begin_time,
completed_time: item.completed_time,
- }));
+ }))
} else {
- this.data = [];
- this.page.total = 0;
+ this.data = []
+ this.page.total = 0
}
- this.loading = false;
- this.selectionClear();
+ this.loading = false
+ this.selectionClear()
}).catch(error => {
- this.loading = false;
- this.data = [];
- this.page.total = 0;
- });
+ this.loading = false
+ this.data = []
+ this.page.total = 0
+ })
},
- formatTime(time) {
- if (!time) return '';
- let date;
+ formatTime (time) {
+ if (!time) return ''
+ let date
if (typeof time === 'number') {
- date = new Date(time < 10000000000 ? time * 1000 : time);
+ date = new Date(time < 10000000000 ? time * 1000 : time)
} else if (typeof time === 'string') {
- date = new Date(time);
+ date = new Date(time)
}
if (isNaN(date.getTime())) {
- return null;
+ return null
}
- const year = date.getFullYear();
- const month = String(date.getMonth() + 1).padStart(2, '0');
- const day = String(date.getDate()).padStart(2, '0');
- const hours = String(date.getHours()).padStart(2, '0');
- const minutes = String(date.getMinutes()).padStart(2, '0');
- const seconds = String(date.getSeconds()).padStart(2, '0');
- return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
+ const year = date.getFullYear()
+ const month = String(date.getMonth() + 1).padStart(2, '0')
+ const day = String(date.getDate()).padStart(2, '0')
+ const hours = String(date.getHours()).padStart(2, '0')
+ const minutes = String(date.getMinutes()).padStart(2, '0')
+ const seconds = String(date.getSeconds()).padStart(2, '0')
+ return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
},
- validData(val, def) {
- return typeof val !== 'undefined' ? val : def;
+ validData (val, def) {
+ return typeof val !== 'undefined' ? val : def
},
},
-};
+}
</script>
-<style scoped lang="scss">
-</style>
+<style scoped lang="scss"></style>
diff --git a/src/views/resource/waylineFile.vue b/src/views/resource/waylineFile.vue
index cbaf3ca..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,73 +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;
}
-
</style>
diff --git a/src/views/system/user.vue b/src/views/system/user.vue
index 89fbc7f..09c1674 100644
--- a/src/views/system/user.vue
+++ b/src/views/system/user.vue
@@ -237,7 +237,7 @@
dialogClickModal: false,
height: 'auto',
- calcHeight: 0,
+ calcHeight: 20,
column: [
{
label: '登录账号',
--
Gitblit v1.9.3