From 02409bfbe15f22fc3b5dccadabfd860a660a49d9 Mon Sep 17 00:00:00 2001
From: 罗广辉 <guanghui.luo@foxmail.com>
Date: Sat, 11 Oct 2025 10:37:14 +0800
Subject: [PATCH] feat: 名称修改
---
src/views/device/airport.vue | 850 +++++++++++++++++++++++++++++++++++++++++++-------------
1 files changed, 648 insertions(+), 202 deletions(-)
diff --git a/src/views/device/airport.vue b/src/views/device/airport.vue
index 8b7203d..f3178d6 100644
--- a/src/views/device/airport.vue
+++ b/src/views/device/airport.vue
@@ -1,5 +1,5 @@
<template>
- <basic-container>
+ <basic-main-content>
<avue-crud :option="option" :table-loading="loading" :data="data" v-model:page="page" ref="crud" @row-del="rowDel"
v-model="form" :permission="permissionList" @row-update="rowUpdate" @row-save="rowSave" :before-open="beforeOpen"
@search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange"
@@ -45,29 +45,84 @@
:percentage="row.firmware_progress"></el-progress>
</div>
</template>
+ <template #domain="{ row }">
+ <span class="text">
+ {{ row.domain == 3 ? '机巢' : row.domain == 0 ? '无人机' : '其他' }}
+ </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-button type="primary" text icon="el-icon-paperclip" v-if="permission.oss_set"
- @click.stop="handleOpenOssSet(scope.row, scope.index)">存储配置
- </el-button>
- <el-button type="primary" text icon="el-icon-share" v-if="permission.per_share && scope.row.domain == 3"
- @click.stop="handleOpenDevicePerShare(scope.row, scope.index)">机场授权
- </el-button>
-
- <el-button type="primary" text icon="el-icon-position" :disabled="!scope.row.status"
- v-if="permission.rang_con && scope.row.domain == 3"
- @click.stop="handleOpenRemoteDebugging(scope.row, scope.index)">远程调试
- </el-button>
+ <el-dropdown>
+ <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">
+ <el-button type="primary" text icon="el-icon-paperclip" v-if="permission.oss_set" @click.stop="handleOpenOssSet(scope.row, scope.index)">存储配置</el-button>
+ </el-dropdown-item>
+ <el-dropdown-item command="b">
+ <el-button type="primary" text icon="el-icon-share" v-if="permission.per_share && scope.row.domain == 3"
+ @click.stop="handleOpenDevicePerShare(scope.row, scope.index)">机场授权</el-button>
+ </el-dropdown-item>
+ <el-dropdown-item command="c"> <el-button type="primary" text icon="el-icon-position" :disabled="!scope.row.status"
+ 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-collection" v-if="permission.fly_device_offline"
+ @click.stop="rollFirmware(scope.row)">固件版本管理</el-button>
+ </el-dropdown-item>
+ <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>
+ </template>
+ <template #dropdown v-else>
+ <el-dropdown-menu teleported>
+ <el-dropdown-item command="a">
+ <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-key" v-if="permission.operate_password_set" @click.stop="handleOperatePassword(scope.row, scope.index)">操控密码设置</el-button>
+ </el-dropdown-item>
+ </el-dropdown-menu>
+ </template>
+ </el-dropdown>
</template>
+
<!-- 添加行政区划显示模板 -->
<template #area_code="{ row }">
<span>{{ row.area_name }}</span>
</template>
</avue-crud>
+
+ <el-dialog title="操控密码设置" append-to-body v-model="operatePasswordSetBox" width="450px">
+ <el-form :model="passwordForm" ref="passwordForm" label-width="80px" :rules="rules" v-loading="loadingForm">
+ <el-form-item label="密码" prop="password">
+ <el-input type="password" v-model="passwordForm.password" placeholder="请输入密码" show-password></el-input>
+ </el-form-item>
+ <el-form-item label="确认密码" prop="password2">
+ <el-input type="password" v-model="passwordForm.password2" placeholder="请输入确认密码" show-password></el-input>
+ </el-form-item>
+ </el-form>
+ <template #footer>
+ <span class="dialog-footer">
+ <el-button @click="operatePasswordSetBox = false">取 消</el-button>
+ <el-button type="primary" @click="setOperatePasswordConfirm">确 定</el-button>
+ </span>
+ </template>
+ </el-dialog>
+
+ <el-dialog title="操控密码查看" append-to-body v-model="operatePasswordViewBox" width="455px">
+ <el-input v-model="operate_password" disabled></el-input>
+ </el-dialog>
<el-dialog title="固件升级" append-to-body v-model="firmwareBox" width="455px">
<div>升级固件版本:{{ firmwareVersion }}</div>
@@ -115,7 +170,8 @@
</template>
</el-dialog>
- <el-drawer title="机场授权管理" size="60%" append-to-body v-model="devicePerShareVisible" :direction="'rtl'">
+ <el-drawer class="ztzf-drawer-body-basic-container" title="机场授权管理" size="60%" append-to-body
+ v-model="devicePerShareVisible" :direction="'rtl'">
<DevicePerShare ref="devicePerShare" />
</el-drawer>
@@ -123,10 +179,12 @@
<DockControlPanel v-if="remoteDebuggingShow" :sn="curDeviceInfo.device_sn" :deviceInfo="curDeviceInfo">
</DockControlPanel>
</el-drawer>
- </basic-container>
+ </basic-main-content>
</template>
<script>
+import { ElMessage, ElMessageBox } from 'element-plus'
+import { pxToRem } from '@/utils/rem'
import {
getList,
remove,
@@ -137,6 +195,8 @@
ota,
getDeviceFirmwareList,
getDevices,
+ deviceOffline,
+ devicesUpdate
} from '@/api/device/device'
import { deleteByOssId, addOrUpdate as addOrUpdateOssBind } from '@/api/device/ossBind'
import { getListPage as getOssList } from '@/api/resource/oss'
@@ -146,8 +206,8 @@
import FirmwareManage from './components/firmwareManage.vue'
import DevicePerShare from './components/devicePerShare.vue'
import DockControlPanel from './components/DockControlPanel.vue'
-import { getWebsocketUrl } from '@/websocket/util/config'
-import ConnectWebSocket from '@/websocket'
+import { getWebsocketUrl } from '@/utils/websocket/config';
+import ConnectWebSocket from '@/utils/websocket';
export default {
components: {
FirmwareManage,
@@ -155,7 +215,35 @@
DockControlPanel,
},
data () {
+ const validatePass = (rule, value, callback) => {
+ if (value === '') {
+ callback(new Error('请输入密码'))
+ } else {
+ callback()
+ }
+ }
+ const validatePass2 = (rule, value, callback) => {
+ if (value === '') {
+ callback(new Error('请再次输入密码'))
+ } else if (value !== this.passwordForm.password) {
+ callback(new Error('两次输入密码不一致!'))
+ } else {
+ callback()
+ }
+ }
return {
+ rules: {
+ password: [{ required: true, validator: validatePass, trigger: 'blur' }],
+ password2: [{ required: true, validator: validatePass2, trigger: 'blur' }],
+ },
+ passwordForm: {
+ id: '',
+ password: '',
+ password2: '',
+ },
+ operatePasswordSetBox: false,
+ operatePasswordViewBox: false,
+ operate_password: '',
bindOssId: null,
deviceSn: '',
ossSetBox: false,
@@ -191,173 +279,133 @@
option: {
lazy: true,
tree: true,
- height: '460',
- calcHeight: 32,
+
dialogWidth: 1050,
+ searchGutter: 30,
tip: false,
searchShow: true,
searchMenuSpan: 6,
border: true,
index: true,
+ indexLabel: '序号',
+ indexWidth: 60,
viewBtn: true,
+ delBtn: false,
selection: true,
excelBtn: false,
addBtn: false,
dialogClickModal: false,
grid: false,
+
+ height: 'auto',
+ calcHeight: 180,
+
column: [
+ {
+ label: '设备类型',
+ prop: 'domain',
+ editDisabled: false,
+ editDisplay: false, //编辑显示
+ viewDisplay: false, //查看显示
+ search: false,
+ slot: true,
+ searchSpan: 4,
+ labelWidth: 145,
+ width: 120,
+ // formatter: (row) => row.domain == 3 ? '机巢' : '无人机'
+ // rules: [
+ // {
+ // required: true,
+ // message: '请输入设备类型',
+ // trigger: 'blur',
+ // },
+ // ],
+ },
+ {
+ label: '设备类型',
+ prop: 'domainTxt',
+ // editDisabled: true,
+ editDisplay: false, //编辑显示
+ viewDisplay: true, //查看显示
+ labelWidth: 145,
+ width: 120,
+ hide: true
+ },
{
label: '设备型号',
prop: 'device_name',
- editDisabled: true,
- search: true,
+ // editDisabled: true,
+ editDisplay: false, //编辑显示
+ viewDisplay: true, //查看显示
+ search: false,
searchSpan: 4,
- labelWidth: 130,
- rules: [
- {
- required: true,
- message: '请输入设备型号',
- trigger: 'blur',
- },
- ],
+ labelWidth: 145,
+ width: 120,
+ // rules: [
+ // {
+ // required: true,
+ // message: '请输入设备型号',
+ // trigger: 'blur',
+ // },
+ // ],
},
{
label: '设备SN',
prop: 'device_sn',
- labelWidth: 130,
- search: true,
+ labelWidth: 145,
+ width: 120,
+ overHidden: true,
searchSpan: 4,
- editDisabled: true,
- rules: [
- {
- required: true,
- message: '请输入设备SN',
- trigger: 'blur',
- },
- ],
+ // editDisabled: true,
+ editDisplay: false, //编辑显示
+ // rules: [
+ // {
+ // required: true,
+ // message: '请输入设备SN',
+ // trigger: 'blur',
+ // },
+ // ],
+ },
+ // {
+ // label: '机巢编号',
+ // prop: 'machine_nest_sn',
+ // labelWidth: 145,
+ // editDisabled: true,
+ // rules: [
+ // {
+ // required: false,
+ // message: '请输入机巢编号',
+ // trigger: 'blur',
+ // },
+ // ],
+ // },
+ {
+ label: '设备位置',// '行政区划',
+ prop: 'area_name',
+ // hide: true,
+ overHidden: true,
+ editDisplay: false, //编辑显示
+ viewDisplay: false, //查看显示
+ labelWidth: 145,
+ width: 200,
},
{
- label: '机巢编号',
- prop: 'machine_nest_sn',
- labelWidth: 130,
- editDisabled: true,
- rules: [
- {
- required: false,
- message: '请输入机巢编号',
- trigger: 'blur',
- },
- ],
- },
- {
- label: '设备组织名称',
- prop: 'nickname',
- labelWidth: 130,
- rules: [
- {
- required: true,
- message: '请输入设备组织名称',
- trigger: 'blur',
- },
- ],
- },
- {
- label: '固件版本',
- prop: 'firmware_version',
- labelWidth: 130,
- width: 100,
- editDisabled: true,
- rules: [
- {
- required: true,
- message: '请输入固件版本',
- trigger: 'blur',
- },
- ],
- },
- {
- label: '固件升级',
- prop: 'firmware_status',
- labelWidth: 130,
- width: 100,
- viewDisabled: true,
- addDisabled: true,
- editDisabled: true,
- addDisplay: false,
- editDisplay: false,
- viewDisplay: false,
- rules: [
- {
- required: true,
- message: '请输入固件升级',
- trigger: 'blur',
- },
- ],
- },
- {
- label: '所属单位',
- prop: 'dept_name',
- addDisplay: false,
- editDisplay: false,
- viewDisplay: false,
- labelWidth: 130,
- rules: [
- {
- required: true,
- message: '请输入所属单位',
- trigger: 'blur',
- },
- ],
- },
- {
- label: '所属单位',
- prop: 'dept_id',
- hide: true,
- type: 'tree',
- defaultExpandAll: true,
- labelWidth: 130,
- dicUrl: '/blade-system/dept/getTree',
- props: {
- label: 'name',
- value: 'id',
- },
- rules: [
- {
- required: true,
- message: '请输入所属单位',
- trigger: 'blur',
- },
- ],
- },
- {
- label: '加入组织时间',
- prop: 'bound_time',
- addDisplay: false,
- editDisplay: false,
- type: 'date',
- labelWidth: 130,
- width: 160,
- format: 'YYYY-MM-DD HH:mm:ss',
- // valueFormat: 'YYYY-MM-DD HH:mm:ss',
- rules: [
- {
- required: true,
- message: '请输入在线状态',
- trigger: 'blur',
- },
- ],
- },
- {
- label: '行政区划',
+ label: '设备位置',
prop: 'area_code',
type: 'cascader',
- labelWidth: 130,
+ labelWidth: 145,
+ searchSpan: 4,
hide: true,
+ search: true,
+ // overHidden: true,
+ editDisplay: true,
+ viewDisplay: true,
+ checkStrictly: true,
+
props: {
label: 'title',
value: 'value',
emitPath: false,
- checkStrictly: true,
multiple: false,
expandTrigger: 'hover',
},
@@ -365,22 +413,10 @@
rules: [
{
required: true,
- message: '请选择行政区划',
+ message: '请选择设备位置',
trigger: 'change',
},
],
- change: ({ value }) => {
- if (!value) {
- this.form.area_code = null
- } else {
- if (typeof value === 'string' && value.includes(',')) {
- const codes = value.split(',')
- this.form.area_code = codes[codes.length - 1]
- } else {
- this.form.area_code = value
- }
- }
- },
lazy: true,
lazyLoad (node, resolve) {
let level = node.level
@@ -415,13 +451,62 @@
}
},
},
+ {
+ label: '设备名称',
+ prop: 'nickname',
+ labelWidth: 145,
+ width: 160,
+ searchSpan: 4,
+ search: true,
+ overHidden: true,
+ editDisplay: true, //编辑显示
+ rules: [
+ {
+ required: true,
+ message: '请输入设备名称',
+ trigger: 'blur',
+ },
+ ],
+ },
+
+ // {
+ // label: '设备位置',
+ // prop: 'address',
+ // labelWidth: 145,
+ // width: 100,
+ // overHidden: true,
+ // rules: [
+ // {
+ // required: true,
+ // message: '请输入设备位置',
+ // trigger: 'blur',
+ // },
+ // ],
+ // },
{
- hide: true,
+ label: '负载设备',
+ prop: 'payload_str',
+ labelWidth: 145,
+ width: 160,
+ overHidden: true,
+ editDisplay: false, //编辑显示
+ // editDisabled: true,
+ // rules: [
+ // {
+ // required: true,
+ // message: '请输入负载设备',
+ // trigger: 'blur',
+ // },
+ // ],
+ },
+ {
+ // hide: true,
label: '保险有效期',
prop: 'duration_of_insurance',
- labelWidth: 130,
- type: "daterange",
+ labelWidth: 145,
+ width: 200,
+ type: 'daterange',
format: 'YYYY-MM-DD',
valueFormat: 'YYYY-MM-DD HH:mm:ss',
startPlaceholder: '保险开始日期',
@@ -434,34 +519,236 @@
},
],
},
-
+ // {
+ // label: '保险有效期',
+ // prop: 'insureExpiredTime',
+ // labelWidth: 145,
+ // width: 110,
+ // rules: [
+ // {
+ // required: true,
+ // message: '请输入保险有效期',
+ // trigger: 'blur',
+ // },
+ // ],
+ // },
{
- label: '在线时间',
- prop: 'login_time',
+ label: '流量剩余',
+ prop: 'traffic_remaining',
+ labelWidth: 145,
+ width: 100,
+ // editDisabled: true,
+ editDisplay: false, //编辑显示
+ // rules: [
+ // {
+ // required: true,
+ // message: '请输入流量剩余',
+ // trigger: 'blur',
+ // },
+ // ],
+ },
+ {
+ label: '流量到期时间',
+ prop: 'traffic_expire_time',
+ labelWidth: 145,
+ width: 120,
type: 'date',
+ format: 'YYYY-MM-DD',
+ editDisplay: false, //编辑显示
+ // editDisabled: true,
+ // rules: [
+ // {
+ // required: true,
+ // message: '请输入流量到期时间',
+ // trigger: 'blur',
+ // },
+ // ],
+ },
+ {
+ label: '固件版本',
+ prop: 'firmware_version',
+ labelWidth: 145,
+ width: 110,
+ editDisplay: false, //编辑显示
+ // editDisabled: true,
+ // rules: [
+ // {
+ // required: true,
+ // message: '请输入固件版本',
+ // trigger: 'blur',
+ // },
+ // ],
+ },
+ {
+ label: '固件升级',
+ prop: 'firmware_status',
+ labelWidth: 145,
+ width: 100,
+ hide: true,
+ viewDisabled: true,
+ addDisabled: true,
+ editDisplay: false, //编辑显示
+ // editDisabled: true,
addDisplay: false,
editDisplay: false,
- labelWidth: 130,
- width: 160,
- format: 'YYYY-MM-DD HH:mm:ss',
- // valueFormat: 'YYYY-MM-DD HH:mm:ss',
- startPlaceholder: '任务开始时间',
+ viewDisplay: false,
+ // rules: [
+ // {
+ // required: true,
+ // message: '请输入固件升级',
+ // trigger: 'blur',
+ // },
+ // ],
+ },
+ {
+ label: '所属单位',
+ prop: 'dept_name',
+ addDisplay: false,
+ editDisplay: false,
+ viewDisplay: false,
+ labelWidth: 145,
+ width: 180,
rules: [
{
required: true,
- message: '请输入在线时间',
+ message: '请输入所属单位',
trigger: 'blur',
},
],
},
{
- label: '在线状态',
+ label: '所属单位',
+ prop: 'dept_id',
+ hide: true,
+ type: 'tree',
+ defaultExpandAll: true,
+ search: true,
+ searchSpan: 4,
+ labelWidth: 145,
+ dicUrl: '/blade-system/dept/getTree',
+ props: {
+ label: 'name',
+ value: 'id',
+ },
+ rules: [
+ {
+ required: true,
+ message: '请输入所属单位',
+ trigger: 'blur',
+ },
+ ],
+ },
+ // {
+ // label: '加入组织时间',
+ // prop: 'bound_time',
+ // addDisplay: false,
+ // editDisplay: false,
+ // type: 'date',
+ // labelWidth: 145,
+ // width: 160,
+ // format: 'YYYY-MM-DD HH:mm:ss',
+ // // valueFormat: 'YYYY-MM-DD HH:mm:ss',
+ // rules: [
+ // {
+ // required: true,
+ // message: '请输入在线状态',
+ // trigger: 'blur',
+ // },
+ // ],
+ // },
+
+
+
+
+ {
+ label: '在线时间',
+ hide: true,
+ prop: 'login_time',
+ type: 'date',
+ editDisplay: false, //编辑显示
+ // editDisabled: true,
+ viewDisplay: false, //查看显示
+ addDisplay: true,
+ labelWidth: 145,
+ width: 160,
+ overHidden: true,
+ format: 'YYYY-MM-DD HH:mm:ss',
+ // valueFormat: 'YYYY-MM-DD HH:mm:ss',
+ startPlaceholder: '任务开始时间',
+ // rules: [
+ // {
+ // required: true,
+ // message: '请输入在线时间',
+ // trigger: 'blur',
+ // },
+ // ],
+ },
+ {
+ label: '设备最新在线时间',
+ hide: true,
+ prop: 'login_time',
+ type: 'date',
+ viewDisplay: true, //查看显示
+ labelWidth: 145,
+ overHidden: true,
+ format: 'YYYY-MM-DD HH:mm:ss',
+ },
+ {
+ label: '注册时间',
+ prop: 'create_time',
+ type: 'date',
+ hide: true,
+ editDisplay: false, //编辑显示
+ // editDisabled: true,
+ viewDisplay: false, //查看显示
+ addDisplay: true,
+ overHidden: true,
+ labelWidth: 145,
+ width: 160,
+ format: 'YYYY-MM-DD HH:mm:ss',
+ // valueFormat: 'YYYY-MM-DD HH:mm:ss',
+ startPlaceholder: '创建时间',
+ // rules: [
+ // {
+ // required: true,
+ // message: '请输入创建时间',
+ // trigger: 'blur',
+ // },
+ // ],
+ },
+ {
+ label: '设备注册时间',
+ prop: 'create_time',
+ type: 'date',
+ hide: true,
+ viewDisplay: true, //查看显示
+ overHidden: true,
+ labelWidth: 145,
+ width: 160,
+ format: 'YYYY-MM-DD HH:mm:ss',
+ },
+ {
+ label: '设备状态',
+ prop: 'cnstatus',
+ hide: true,
+ addDisplay: false,
+ editDisplay: false,
+ viewDisplay: false,
+ labelWidth: 145,
+ },
+ {
+ label: '设备状态',
prop: 'status',
addDisplay: false,
editDisplay: false,
- labelWidth: 130,
+ viewDisplay: false,
+ labelWidth: 100,
+ hide: true,
+ // searchSpan: 4,
+ // search: true,
slot: true,
width: 100,
+
rules: [
{
required: true,
@@ -471,13 +758,35 @@
],
},
{
- label: '机场状态',
+ label: '设备状态',
+ prop: 'cnmode_code',
+ hide: true,
+ addDisplay: false,
+ editDisplay: false,
+ viewDisplay: true,
+ labelWidth: 145,
+ width: 110,
+ },
+ {
+ label: '设备状态',
prop: 'mode_code',
addDisplay: false,
editDisplay: false,
- labelWidth: 130,
+ viewDisplay: false,
+ labelWidth: 145,
+ 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: 100,
+ width: 110,
+
rules: [
{
required: true,
@@ -507,10 +816,10 @@
...mapGetters(['permission']),
permissionList () {
return {
- addBtn: this.validData(this.permission.airport_add, true),
- viewBtn: this.validData(this.permission.airport_view, true),
- delBtn: this.validData(this.permission.airport_delete, true),
- editBtn: this.validData(this.permission.airport_edit, true),
+ addBtn: this.validData(this.permission.air_add, true),
+ viewBtn: this.validData(this.permission.air_view, true),
+ delBtn: this.validData(this.permission.air_delete, true),
+ editBtn: this.validData(this.permission.air_edit, true),
}
},
ids () {
@@ -530,9 +839,25 @@
}
})
},
+ mounted() {
+
+ },
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 () {
@@ -552,10 +877,10 @@
this.webSocketIdSet.add(webSocketId)
const webSorketUrl = getWebsocketUrl() + '&workspace-id=' + data.workspace_id
// 监听ws 消息
- this.useConnectWebSocket(webSocketId, webSorketUrl)
+ this.useConnectWebSocket1(webSocketId, webSorketUrl)
}
},
- useConnectWebSocket (webSocketId, url) {
+ useConnectWebSocket1 (webSocketId, url) {
const websocket = new ConnectWebSocket(url)
// 加入 webscoket map
this.websocketMap.set(webSocketId, websocket)
@@ -609,6 +934,28 @@
this.remoteDebuggingShow = true
this.operateTitle = row.nickname + ' - ' + row.device_sn
},
+
+ // 设备下线
+ handleDeviceOffline (row) {
+ ElMessageBox.confirm('确定注销该设备吗?', '提示', {
+ confirmButtonText: '确定',
+ cancelButtonText: '取消',
+ type: 'warning',
+ })
+ .then(() => {
+ deviceOffline(row.device_sn)
+ .then(res => {
+ ElMessage.success('注销成功')
+
+ this.init()
+ })
+ .catch(error => {
+ ElMessage.error('注销失败')
+ })
+ })
+ .catch(() => { })
+ },
+
// 打开存储对象配置页面
handleOpenOssSet (row) {
var that = this
@@ -632,6 +979,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) {
@@ -910,8 +1278,12 @@
area_code: row.area_code.split(',').pop(),
insure_start_time: row.duration_of_insurance[0],
insure_expired_time: row.duration_of_insurance[1],
+ deptId: row.dept_id,
+ areaCode: row.area_code.split(',').pop(),
}
-
+ if (submitData.traffic_expire_time === '') {
+ delete submitData.traffic_expire_time
+ }
delete submitData.duration_of_insurance
update(submitData).then(
@@ -985,7 +1357,7 @@
this.$refs.crud.toggleSelection()
})
},
- getFullAreaCode (areaCode) {
+ async getFullAreaCode (areaCode) {
if (!areaCode) return ''
const code = areaCode.toString()
@@ -1005,22 +1377,21 @@
},
beforeOpen (done, type) {
if (['edit', 'view'].includes(type)) {
- getDetail(this.form.id).then(res => {
+ getDetail(this.form.id).then(async res => {
const data = res.data.data
this.form = {
- duration_of_insurance: [data?.insure_start_time || '', data?.insure_expired_time || '']
+ ...data,
+ 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 ? '机巢' : '未知',
+ domainTxt: data.domain === 0 ? '无人机' : data.domain === 3 ? '机巢' : '未知',
+ cnstatus: this.form.status === false ? '离线' : '在线',
+ duration_of_insurance: [data?.insure_start_time || '', data?.insure_expired_time || ''],
}
- // {
- // ...data,
- // area_code: this.getFullAreaCode(data.area_code),
- // }
-
- console.log(this.form, this.data, 11111111111111, res)
-
done()
-
})
}
},
@@ -1049,6 +1420,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
@@ -1058,6 +1432,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
@@ -1072,6 +1447,55 @@
const data = res.data.data.records
resolve(data)
})
+ },
+ rowDel (row) {
+ this.$confirm('确定将选择数据删除?', {
+ confirmButtonText: '确定',
+ cancelButtonText: '取消',
+ type: 'warning',
+ })
+ .then(() => {
+ return remove(row.id)
+ })
+ .then(() => {
+ this.onLoad(this.page)
+ this.$message({
+ type: 'success',
+ message: '操作成功!',
+ })
+ })
+ },
+ // 设置无人机操作密码
+ setOperatePasswordConfirm () {
+ var that = this
+ this.$refs.passwordForm.validate(valid => {
+ if (valid) {
+ this.loadingForm = true
+ const data = {
+ id: this.passwordForm.id,
+ operate_password: this.passwordForm.password,
+ }
+ // 提交
+ operatePasswordUpdate(data).then(res => {
+ this.loadingForm = false
+ this.operatePasswordSetBox = false
+ that.passwordForm = {}
+ this.onLoad(this.page)
+ this.$message({
+ type: 'success',
+ message: '操作成功!',
+ })
+ })
+ } else {
+ console.log('error submit!!')
+ return false
+ }
+ })
+ },
+ // 操作密码设置
+ handleOperatePassword (row) {
+ this.operatePasswordSetBox = true
+ this.passwordForm.id = row.id
},
},
}
@@ -1098,6 +1522,8 @@
display: flex;
flex-direction: column;
align-items: center;
+ .el-tag:first-child{
+ margin-bottom: 5px;}
}
.onlineStatus {
@@ -1138,4 +1564,24 @@
border-color: #409eff;
}
}
+:deep(.avue-crud__menu) {
+ display: flex;
+}
+.more-container {
+ position: relative;
+}
+.show-more-do {
+ position: absolute;
+ background-color: #ffffff;
+ // border: 1px solid #409eff;
+ z-index: 9999;
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
+ width: 140px;
+ font-size: 12px;
+ // height: 140px;
+ height: 190px;
+ right: 0;
+}
+
+
</style>
--
Gitblit v1.9.3