From 1a8a9ff4fd90e28bf33bca809c5ea0372db3dd48 Mon Sep 17 00:00:00 2001
From: chenyao <1219716595@qq.com>
Date: Thu, 04 Sep 2025 17:13:34 +0800
Subject: [PATCH] feat:设置间距
---
src/views/device/airport.vue | 261 +++++++++++++++++++++++++++++++++------------------
1 files changed, 168 insertions(+), 93 deletions(-)
diff --git a/src/views/device/airport.vue b/src/views/device/airport.vue
index b86179e..8411b2e 100644
--- a/src/views/device/airport.vue
+++ b/src/views/device/airport.vue
@@ -51,13 +51,13 @@
</span>
</template>
<template #mode_code="{ row }">
- <span class="text" v-if="row.domain == 3" :style="row.mode_code != '-1' ? 'color: #00ee8b' : 'color: #de5e5e'">
- {{ getDockModeText(row.mode_code) }}
+ <span class="text" v-if="row.domain == 3 || row.domain == 0" :style="row.mode_code != '-1' ? 'color: #00ee8b' : 'color: #de5e5e'">
+ {{ getModelText(row.mode_code) }}
</span>
</template>
<template #menu="scope">
<el-dropdown>
- <el-button type="primary" text icon="el-icon-paperclip" v-if="permission.oss_set">更 多</el-button>
+ <el-button type="primary" text icon="el-icon-folder-opened" v-if="permission.oss_set">更 多</el-button>
<template #dropdown v-if="scope.row.domain == 3">
<el-dropdown-menu teleported>
<el-dropdown-item command="a">
@@ -71,10 +71,15 @@
v-if="permission.rang_con && scope.row.domain == 3"
@click.stop="handleOpenRemoteDebugging(scope.row, scope.index)">远程调试</el-button>
</el-dropdown-item>
- <el-dropdown-item command="d"><el-button type="primary" text icon="el-icon-setting" v-if="permission.fly_device_offline"
+ <el-dropdown-item command="d"><el-button type="primary" text icon="el-icon-collection" v-if="permission.fly_device_offline"
@click.stop="rollFirmware(scope.row)">固件版本管理</el-button>
</el-dropdown-item>
- <el-dropdown-item command="e"><el-button type="primary" text icon="el-icon-setting" v-if="permission.fly_device_offline"
+ <el-dropdown-item command="d">
+ <el-button type="primary" text icon="el-icon-collection" v-if="!scope.row.status" @click.stop="dockNotLine(scope.row)">
+ {{ scope.row.hidden_flag == 1 ? '设备上线' : '设备下线'}}
+ </el-button>
+ </el-dropdown-item>
+ <el-dropdown-item command="e"><el-button type="primary" text icon="el-icon-document-delete" v-if="permission.fly_device_offline"
@click.stop="handleDeviceOffline(scope.row)">注销</el-button>
</el-dropdown-item>
</el-dropdown-menu>
@@ -82,10 +87,10 @@
<template #dropdown v-else>
<el-dropdown-menu teleported>
<el-dropdown-item command="a">
- <el-button type="primary" text icon="el-icon-paperclip" @click.stop="rowDel(scope.row, scope.index)">删除</el-button>
+ <el-button type="primary" text icon="el-icon-circle-close" @click.stop="rowDel(scope.row, scope.index)">删除</el-button>
</el-dropdown-item>
<el-dropdown-item command="a">
- <el-button type="primary" text icon="el-icon-paperclip" v-if="permission.operate_password_set" @click.stop="handleOperatePassword(scope.row, scope.index)">操控密码设置</el-button>
+ <el-button type="primary" text icon="el-icon-key" v-if="permission.operate_password_set" @click.stop="handleOperatePassword(scope.row, scope.index)">操控密码设置</el-button>
</el-dropdown-item>
</el-dropdown-menu>
</template>
@@ -190,7 +195,8 @@
ota,
getDeviceFirmwareList,
getDevices,
- deviceOffline
+ deviceOffline,
+ devicesUpdate
} from '@/api/device/device'
import { deleteByOssId, addOrUpdate as addOrUpdateOssBind } from '@/api/device/ossBind'
import { getListPage as getOssList } from '@/api/resource/oss'
@@ -275,11 +281,14 @@
tree: true,
dialogWidth: 1050,
+ searchGutter: 30,
tip: false,
searchShow: true,
searchMenuSpan: 6,
border: true,
index: true,
+ indexLabel: '序号',
+ indexWidth: 60,
viewBtn: true,
delBtn: false,
selection: true,
@@ -295,14 +304,15 @@
{
label: '设备类型',
prop: 'domain',
- editDisabled: true,
+ editDisabled: false,
editDisplay: false, //编辑显示
- viewDisplay: true, //查看显示
+ viewDisplay: false, //查看显示
search: false,
slot: true,
searchSpan: 4,
labelWidth: 130,
width: 120,
+ // formatter: (row) => row.domain == 3 ? '机巢' : '无人机'
// rules: [
// {
// required: true,
@@ -312,9 +322,20 @@
// ],
},
{
+ label: '设备类型',
+ prop: 'domainTxt',
+ // editDisabled: true,
+ editDisplay: false, //编辑显示
+ viewDisplay: true, //查看显示
+ labelWidth: 130,
+ width: 120,
+ hide: true
+ },
+ {
label: '设备型号',
prop: 'device_name',
- editDisabled: true,
+ // editDisabled: true,
+ editDisplay: false, //编辑显示
viewDisplay: true, //查看显示
search: false,
searchSpan: 4,
@@ -335,7 +356,8 @@
width: 120,
overHidden: true,
searchSpan: 4,
- editDisabled: true,
+ // editDisabled: true,
+ editDisplay: false, //编辑显示
// rules: [
// {
// required: true,
@@ -358,23 +380,6 @@
// ],
// },
{
- label: '设备名称',
- prop: 'nickname',
- labelWidth: 130,
- width: 100,
- searchSpan: 4,
- search: true,
- overHidden: true,
- editDisplay: true, //编辑显示
- rules: [
- {
- required: true,
- message: '请输入设备名称',
- trigger: 'blur',
- },
- ],
- },
- {
label: '设备位置',// '行政区划',
prop: 'area_name',
// hide: true,
@@ -382,7 +387,7 @@
editDisplay: false, //编辑显示
viewDisplay: false, //查看显示
labelWidth: 130,
- width: 100,
+ width: 200,
},
{
label: '设备位置',
@@ -445,6 +450,24 @@
}
},
},
+ {
+ label: '设备名称',
+ prop: 'nickname',
+ labelWidth: 130,
+ width: 160,
+ searchSpan: 4,
+ search: true,
+ overHidden: true,
+ editDisplay: true, //编辑显示
+ rules: [
+ {
+ required: true,
+ message: '请输入设备名称',
+ trigger: 'blur',
+ },
+ ],
+ },
+
// {
// label: '设备位置',
// prop: 'address',
@@ -459,14 +482,15 @@
// },
// ],
// },
-
+
{
label: '负载设备',
prop: 'payload_str',
labelWidth: 130,
- width: 100,
+ width: 160,
overHidden: true,
- editDisabled: true,
+ editDisplay: false, //编辑显示
+ // editDisabled: true,
// rules: [
// {
// required: true,
@@ -474,6 +498,25 @@
// trigger: 'blur',
// },
// ],
+ },
+ {
+ // hide: true,
+ label: '保险有效期',
+ prop: 'duration_of_insurance',
+ labelWidth: 130,
+ width: 200,
+ type: 'daterange',
+ format: 'YYYY-MM-DD',
+ valueFormat: 'YYYY-MM-DD HH:mm:ss',
+ startPlaceholder: '保险开始日期',
+ endPlaceholder: '保险结束日期',
+ rules: [
+ {
+ required: true,
+ message: '请选择保险有效期',
+ trigger: 'blur',
+ },
+ ],
},
// {
// label: '保险有效期',
@@ -493,7 +536,8 @@
prop: 'traffic_remaining',
labelWidth: 130,
width: 100,
- editDisabled: true,
+ // editDisabled: true,
+ editDisplay: false, //编辑显示
// rules: [
// {
// required: true,
@@ -509,7 +553,8 @@
width: 120,
type: 'date',
format: 'YYYY-MM-DD',
- editDisabled: true,
+ editDisplay: false, //编辑显示
+ // editDisabled: true,
// rules: [
// {
// required: true,
@@ -523,7 +568,8 @@
prop: 'firmware_version',
labelWidth: 130,
width: 110,
- editDisabled: true,
+ editDisplay: false, //编辑显示
+ // editDisabled: true,
// rules: [
// {
// required: true,
@@ -540,7 +586,8 @@
hide: true,
viewDisabled: true,
addDisabled: true,
- editDisabled: true,
+ editDisplay: false, //编辑显示
+ // editDisabled: true,
addDisplay: false,
editDisplay: false,
viewDisplay: false,
@@ -608,33 +655,17 @@
// },
// ],
// },
+
+
{
- hide: true,
- label: '保险有效期',
- prop: 'duration_of_insurance',
- labelWidth: 130,
- type: 'daterange',
- format: 'YYYY-MM-DD',
- valueFormat: 'YYYY-MM-DD HH:mm:ss',
- startPlaceholder: '保险开始日期',
- endPlaceholder: '保险结束日期',
- rules: [
- {
- required: true,
- message: '请选择保险有效期',
- trigger: 'blur',
- },
- ],
- },
-
- {
label: '在线时间',
+ hide: true,
prop: 'login_time',
type: 'date',
- editDisplay: true, //编辑显示
- editDisabled: true,
+ editDisplay: false, //编辑显示
+ // editDisabled: true,
viewDisplay: true, //查看显示
addDisplay: true,
labelWidth: 130,
@@ -655,8 +686,9 @@
label: '注册时间',
prop: 'create_time',
type: 'date',
- editDisplay: true, //编辑显示
- editDisabled: true,
+ hide: true,
+ editDisplay: false, //编辑显示
+ // editDisabled: true,
viewDisplay: true, //查看显示
addDisplay: true,
overHidden: true,
@@ -689,8 +721,9 @@
editDisplay: false,
viewDisplay: false,
labelWidth: 100,
- searchSpan: 4,
- search: true,
+ hide: true,
+ // searchSpan: 4,
+ // search: true,
slot: true,
width: 100,
@@ -712,24 +745,34 @@
labelWidth: 130,
width: 110,
},
- // {
- // label: '设备状态',
- // prop: 'mode_code',
- // addDisplay: false,
- // editDisplay: false,
- // viewDisplay: false,
- // labelWidth: 130,
- // slot: true,
- // width: 110,
+ {
+ label: '设备状态',
+ prop: 'mode_code',
+ addDisplay: false,
+ editDisplay: false,
+ viewDisplay: false,
+ labelWidth: 130,
+ searchSpan: 4,
+ search: true,
+ type: 'select',
+ dicData: [
+ { label: '在线', value: 0 },
+ { label: '离线', value: -1 },
+ { label: '远程调试', value: 2 },
+ { label: '现场调试', value: 1 },
+ { label: '固件升级中', value: 3 }
+ ],
+ slot: true,
+ width: 110,
- // rules: [
- // {
- // required: true,
- // message: '请输入机场状态',
- // trigger: 'blur',
- // },
- // ],
- // },
+ rules: [
+ {
+ required: true,
+ message: '请输入机场状态',
+ trigger: 'blur',
+ },
+ ],
+ },
],
},
data: [],
@@ -775,14 +818,24 @@
})
},
mounted() {
- document.addEventListener("click", this.handleClickOutside);
- },
- beforeDestroy() {
- document.removeEventListener("click", this.handleClickOutside);
+
},
methods: {
getDockModeText (value) {
return EDockModeText[value] || ''
+ },
+ getModelText (value) {
+ let txt = '离线'
+ if (value === 0 || value === 4) {
+ txt = '在线'
+ } else if(value === 1) {
+ txt = '现场调试'
+ } else if(value === 2) {
+ txt = '远程调试'
+ } else if(value === 3) {
+ txt = '固件升级中'
+ }
+ return txt
},
// 关闭所有的webscoket
closeAllWebsoket () {
@@ -881,14 +934,6 @@
.catch(() => { })
},
- handleClickOutside(event) {
- // 检查点击是否发生在 .more-container 内
- const moreContainer = document.querySelector('.more-container');
- if (moreContainer && moreContainer.contains(event.target)) {
- return; // 如果点击在容器内,什么都不做
- }
- },
-
// 打开存储对象配置页面
handleOpenOssSet (row) {
var that = this
@@ -912,6 +957,27 @@
this.$nextTick(() => {
that.$refs.firmwareManage.init(row)
})
+ },
+ // 设备下线
+ dockNotLine(row) {
+ let txt = row.hidden_flag === 1?'上线':'下线'
+ ElMessageBox.confirm(`确定${txt}该设备吗?`, '提示', {
+ confirmButtonText: '确定',
+ cancelButtonText: '取消',
+ type: 'warning',
+ })
+ .then(() => {
+ let hidden_flag = row.hidden_flag === 1?0:1
+ devicesUpdate({id:row.id, hidden_flag:hidden_flag})
+ .then(res => {
+ ElMessage.success('下线成功')
+ this.init()
+ })
+ .catch(error => {
+ ElMessage.error('下线失败')
+ })
+ })
+ .catch(() => { })
},
// 版本回退点击事件
rollFirmware (row) {
@@ -1191,7 +1257,9 @@
insure_start_time: row.duration_of_insurance[0],
insure_expired_time: row.duration_of_insurance[1],
}
-
+ if (submitData.traffic_expire_time === '') {
+ delete submitData.traffic_expire_time
+ }
delete submitData.duration_of_insurance
update(submitData).then(
@@ -1293,7 +1361,8 @@
area_code: await this.getFullAreaCode(data.area_code),
area_name: this.form.area_name,
cnmode_code: this.getDockModeText(this.form.mode_code),
- domain: data.domain === 0 ? '无人机' : data.domain === 3 ? '机巢' : '未知',
+ // domain: data.domain === 0 ? '无人机' : data.domain === 3 ? '机巢' : '未知',
+ domainTxt: data.domain === 0 ? '无人机' : data.domain === 3 ? '机巢' : '未知',
cnstatus: this.form.status === false ? '离线' : '在线',
duration_of_insurance: [data?.insure_start_time || '', data?.insure_expired_time || ''],
}
@@ -1327,6 +1396,9 @@
values.releaseTimeRange = null
}
values['type'] = 1
+ if (values.area_code) {
+ values['area_code'] = values.area_code.split(',').pop()
+ }
this.loading = true
getList(page.currentPage, page.pageSize, values).then(res => {
const data = res.data.data
@@ -1336,6 +1408,7 @@
if (e.firmware_status == 4) {
this.connectWebSocket(e)
}
+ e.duration_of_insurance = [e.insure_start_time || '', e.insure_expired_time || '']
})
this.data = data.records
this.loading = false
@@ -1425,6 +1498,8 @@
display: flex;
flex-direction: column;
align-items: center;
+ .el-tag:first-child{
+ margin-bottom: 5px;}
}
.onlineStatus {
--
Gitblit v1.9.3