From 56fe5da07bf822f86ce4d0e8b32a7941b1451091 Mon Sep 17 00:00:00 2001
From: 张含笑 <zhx18749296735@163.com>
Date: Sat, 28 Jun 2025 09:24:25 +0800
Subject: [PATCH] Merge branch 'refs/heads/test' into feature/v3.0.0/帮助中心

---
 src/views/device/fly.vue |  303 ++++++++++++++++++++++----------------------------
 1 files changed, 134 insertions(+), 169 deletions(-)

diff --git a/src/views/device/fly.vue b/src/views/device/fly.vue
index 2fd28b2..eb7fdb0 100644
--- a/src/views/device/fly.vue
+++ b/src/views/device/fly.vue
@@ -1,34 +1,13 @@
 <template>
-  <basic-container>
-    <avue-crud
-      id="device"
-      :option="option"
-      :table-loading="loading"
-      :data="data"
-      :page="page"
-      @update:page="handlePageChange"
-      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"
-      @current-change="currentChange"
-      @size-change="sizeChange"
-      @refresh-change="refreshChange"
-    >
+  <basic-main-content>
+    <avue-crud id="device" :option="option" :table-loading="loading" :data="data" :page="page"
+      @update:page="handlePageChange" 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" @current-change="currentChange"
+      @size-change="sizeChange" @refresh-change="refreshChange">
       <template #menu-left>
-        <el-button
-          type="danger"
-          icon="el-icon-delete"
-          plain
-          v-if="permission.workspace_delete"
-          @click="handleDelete"
-          >删 除
+        <el-button type="danger" icon="el-icon-delete" plain v-if="permission.workspace_delete" @click="handleDelete">删
+          除
         </el-button>
       </template>
       <template #dept_name="{ row }">
@@ -37,7 +16,7 @@
       <template #status="{ row }">
         <div v-if="row.status == true" class="onlineStatus">
           <div class="onlineStatus-dot"></div>
-          <span class="online" >在线</span>
+          <span class="online">在线</span>
         </div>
         <div v-if="row.status == false" class="onlineStatus">
           <div class="onlineStatus-dot1"></div>
@@ -45,13 +24,8 @@
         </div>
       </template>
       <template #menu="scope">
-        <el-button
-          type="primary"
-          text
-          icon="el-icon-setting"
-          v-if="permission.operate_password_set"
-          @click.stop="handleOperatePassword(scope.row, scope.index)"
-          >操控密码设置
+        <el-button type="primary" text icon="el-icon-setting" v-if="permission.operate_password_set"
+          @click.stop="handleOperatePassword(scope.row, scope.index)">操控密码设置
         </el-button>
         <!-- <el-button
           type="primary"
@@ -64,28 +38,12 @@
       </template>
     </avue-crud>
     <el-dialog title="操控密码设置" append-to-body v-model="operatePasswordSetBox" width="455px">
-      <el-form
-        :model="passwordForm"
-        ref="passwordForm"
-        label-width="80px"
-        :rules="rules"
-        v-loading="loadingForm"
-      >
+      <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-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-input type="password" v-model="passwordForm.password2" placeholder="请输入确认密码" show-password></el-input>
         </el-form-item>
       </el-form>
       <template #footer>
@@ -98,7 +56,7 @@
     <el-dialog title="操控密码查看" append-to-body v-model="operatePasswordViewBox" width="455px">
       <el-input v-model="operate_password" disabled></el-input>
     </el-dialog>
-  </basic-container>
+  </basic-main-content>
 </template>
 
 <script>
@@ -110,27 +68,27 @@
   getDetail,
   getOperatePassword,
   operatePasswordUpdate,
-} from '@/api/device/device';
-import { mapGetters } from 'vuex';
+} from '@/api/device/device'
+import { mapGetters } from 'vuex'
 
 export default {
-  data() {
+  data () {
     const validatePass = (rule, value, callback) => {
       if (value === '') {
-        callback(new Error('请输入密码'));
+        callback(new Error('请输入密码'))
       } else {
-        callback();
+        callback()
       }
-    };
+    }
     const validatePass2 = (rule, value, callback) => {
       if (value === '') {
-        callback(new Error('请再次输入密码'));
+        callback(new Error('请再次输入密码'))
       } else if (value !== this.passwordForm.password) {
-        callback(new Error('两次输入密码不一致!'));
+        callback(new Error('两次输入密码不一致!'))
       } else {
-        callback();
+        callback()
       }
-    };
+    }
     return {
       loadingForm: false,
       rules: {
@@ -155,8 +113,6 @@
       },
       selectionList: [],
       option: {
-        // height: '460',
-        // calcHeight: 32,
         // dialogWidth: 950,
         tip: false,
         searchShow: true,
@@ -169,6 +125,10 @@
         excelBtn: false,
         dialogClickModal: false,
         grid: false,
+
+        height: 'auto',
+        calcHeight: 180,
+
         column: [
           {
             label: '设备型号',
@@ -331,144 +291,144 @@
         ],
       },
       data: [],
-    };
+    }
   },
   computed: {
     ...mapGetters(['permission']),
-    permissionList() {
+    permissionList () {
       return {
         addBtn: this.validData(this.permission.fly_add, true),
         viewBtn: this.validData(this.permission.fly_view, true),
         delBtn: this.validData(this.permission.fly_delete, true),
         editBtn: this.validData(this.permission.fly_edit, true),
-      };
+      }
     },
-    ids() {
-      let ids = [];
+    ids () {
+      let ids = []
       this.selectionList.forEach(ele => {
-        ids.push(ele.id);
-      });
-      return ids.join(',');
+        ids.push(ele.id)
+      })
+      return ids.join(',')
     },
   },
   methods: {
     // 设置无人机操作密码
-    setOperatePasswordConfirm() {
-      var that = this;
+    setOperatePasswordConfirm () {
+      var that = this
       this.$refs.passwordForm.validate(valid => {
         if (valid) {
-          this.loadingForm = true;
+          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.loadingForm = false
+            this.operatePasswordSetBox = false
+            that.passwordForm = {}
+            this.onLoad(this.page)
             this.$message({
               type: 'success',
               message: '操作成功!',
-            });
-          });
+            })
+          })
         } else {
-          console.log('error submit!!');
-          return false;
+          console.log('error submit!!')
+          return false
         }
-      });
+      })
     },
     // 操作密码设置
-    handleOperatePassword(row) {
-      this.operatePasswordSetBox = true;
-      this.passwordForm.id = row.id;
+    handleOperatePassword (row) {
+      this.operatePasswordSetBox = true
+      this.passwordForm.id = row.id
     },
-    viewOperatePassword(row) {
-      this.operatePasswordViewBox = true;
+    viewOperatePassword (row) {
+      this.operatePasswordViewBox = true
       // 查询密码
       getOperatePassword(row.id).then(res => {
-        this.operate_password = res.data.data;
-      });
+        this.operate_password = res.data.data
+      })
     },
-    init() {
+    init () {
       (this.page = {
         pageSize: 10,
         currentPage: 1,
         total: 0,
       }),
-        this.onLoad(this.page);
+        this.onLoad(this.page)
     },
-    rowSave(row, done, loading) {
+    rowSave (row, done, loading) {
       add(row).then(
         () => {
-          this.onLoad(this.page);
+          this.onLoad(this.page)
           this.$message({
             type: 'success',
             message: '操作成功!',
-          });
-          done();
+          })
+          done()
         },
         error => {
-          window.console.log(error);
-          loading();
+          window.console.log(error)
+          loading()
         }
-      );
+      )
     },
-    rowUpdate(row, index, done, loading) {
+    rowUpdate (row, index, done, loading) {
       update(row).then(
         () => {
-          this.onLoad(this.page);
+          this.onLoad(this.page)
           this.$message({
             type: 'success',
             message: '操作成功!',
-          });
-          done();
+          })
+          done()
         },
         error => {
-          window.console.log(error);
-          loading();
+          window.console.log(error)
+          loading()
         }
-      );
+      )
     },
-    rowDel(row) {
+    rowDel (row) {
       this.$confirm('确定将选择数据删除?', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
         type: 'warning',
       })
         .then(() => {
-          return remove(row.id);
+          return remove(row.id)
         })
         .then(() => {
-          this.onLoad(this.page);
+          this.onLoad(this.page)
           this.$message({
             type: 'success',
             message: '操作成功!',
-          });
-        });
+          })
+        })
     },
-    searchReset() {
-      this.query = {};
-      this.onLoad(this.page);
+    searchReset () {
+      this.query = {}
+      this.onLoad(this.page)
     },
-    searchChange(params, done) {
-      this.query = params;
-      this.page.currentPage = 1;
-      this.onLoad(this.page, params);
-      done();
+    searchChange (params, done) {
+      this.query = params
+      this.page.currentPage = 1
+      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()
     },
-    handleDelete() {
+    handleDelete () {
       if (this.selectionList.length === 0) {
-        this.$message.warning('请选择至少一条数据');
-        return;
+        this.$message.warning('请选择至少一条数据')
+        return
       }
       this.$confirm('确定将选择数据删除?', {
         confirmButtonText: '确定',
@@ -476,67 +436,67 @@
         type: 'warning',
       })
         .then(() => {
-          return remove(this.ids);
+          return remove(this.ids)
         })
         .then(() => {
-          this.onLoad(this.page);
+          this.onLoad(this.page)
           this.$message({
             type: 'success',
             message: '操作成功!',
-          });
-          this.$refs.crud.toggleSelection();
-        });
+          })
+          this.$refs.crud.toggleSelection()
+        })
     },
-    beforeOpen(done, type) {
+    beforeOpen (done, type) {
       if (['edit', 'view'].includes(type)) {
         getDetail(this.form.id).then(res => {
-          this.form = res.data.data;
-        });
+          this.form = res.data.data
+        })
       }
-      done();
+      done()
     },
-    handlePageChange(val) {
-      this.page = val;
-      this.onLoad(this.page);
+    handlePageChange (val) {
+      this.page = val
+      this.onLoad(this.page)
     },
-    currentChange(currentPage) {
-      this.page.currentPage = currentPage;
-      this.onLoad(this.page);
+    currentChange (currentPage) {
+      this.page.currentPage = currentPage
+      this.onLoad(this.page)
     },
-    sizeChange(pageSize) {
-      this.page.pageSize = pageSize;
-      this.page.currentPage = 1;
-      this.onLoad(this.page);
+    sizeChange (pageSize) {
+      this.page.pageSize = pageSize
+      this.page.currentPage = 1
+      this.onLoad(this.page)
     },
-    refreshChange() {
-      this.onLoad(this.page, this.query);
+    refreshChange () {
+      this.onLoad(this.page, this.query)
     },
-    onLoad(page, params = {}) {
-      const { releaseTimeRange } = this.query;
+    onLoad (page, params = {}) {
+      const { releaseTimeRange } = this.query
       let values = {
         ...params,
         ...this.query,
-      };
+      }
       if (releaseTimeRange) {
         values = {
           ...values,
           releaseTime_datege: releaseTimeRange[0],
           releaseTime_datelt: releaseTimeRange[1],
-        };
-        values.releaseTimeRange = null;
+        }
+        values.releaseTimeRange = null
       }
-      values['domain'] = 0;
-      this.loading = true;
+      values['domain'] = 0
+      this.loading = true
       getList(page.currentPage, page.pageSize, values).then(res => {
-        const data = res.data.data;
-        this.page.total = data.total;
-        this.data = data.records;
-        this.loading = false;
-        this.selectionClear();
-      });
+        const data = res.data.data
+        this.page.total = data.total
+        this.data = data.records
+        this.loading = false
+        this.selectionClear()
+      })
     },
   },
-};
+}
 </script>
 
 <style lang="scss" scoped>
@@ -544,25 +504,30 @@
   height: 655px !important;
   overflow: auto;
 }
+
 .online {
   margin-left: 5px;
 }
+
 .onlineStatus1 {
   display: flex;
   flex-direction: column;
   align-items: center;
 }
+
 .onlineStatus {
   display: flex;
   flex-direction: row;
   align-items: center;
 }
+
 .onlineStatus-dot {
   width: 15px;
   height: 15px;
   background-color: #40cb8b;
   border-radius: 50%;
 }
+
 .onlineStatus-dot1 {
   width: 15px;
   height: 15px;

--
Gitblit v1.9.3