无人机管理后台前端(已迁走)
shuishen
2025-07-05 35fd04ad837ad074c509cfdbdc7c2b1e04187d5d
feat:设备管理---机场授权显示异常修复
3 files modified
300 ■■■■ changed files
src/styles/element-ui.scss 77 ●●●●● patch | view | raw | blame | history
src/views/device/airport.vue 13 ●●●● patch | view | raw | blame | history
src/views/device/components/devicePerShare.vue 210 ●●●● patch | view | raw | blame | history
src/styles/element-ui.scss
@@ -31,12 +31,20 @@
  padding: 0 !important;
}
.el-dropdown-menu__item--divided:before, .el-menu, .el-menu--horizontal > .el-menu-item:not(.is-disabled):focus, .el-menu--horizontal > .el-menu-item:not(.is-disabled):hover, .el-menu--horizontal > .el-sub-menu .el-sub-menu__title:hover {
.el-dropdown-menu__item--divided:before,
.el-menu,
.el-menu--horizontal>.el-menu-item:not(.is-disabled):focus,
.el-menu--horizontal>.el-menu-item:not(.is-disabled):hover,
.el-menu--horizontal>.el-sub-menu .el-sub-menu__title:hover {
  background-color: transparent;
}
.el-dropdown-menu__item--divided:before, .el-menu, .el-menu--horizontal > .el-menu-item:not(.is-disabled):focus, .el-menu--horizontal > .el-menu-item:not(.is-disabled):hover, .el-menu--horizontal > .el-sub-menu .el-sub-menu__title:hover {
.el-dropdown-menu__item--divided:before,
.el-menu,
.el-menu--horizontal>.el-menu-item:not(.is-disabled):focus,
.el-menu--horizontal>.el-menu-item:not(.is-disabled):hover,
.el-menu--horizontal>.el-sub-menu .el-sub-menu__title:hover {
  background-color: transparent !important;
}
@@ -49,11 +57,13 @@
  background-color: transparent;
}
.el-button.is-text:not(.is-disabled):focus, .el-button.is-text:not(.is-disabled):hover {
.el-button.is-text:not(.is-disabled):focus,
.el-button.is-text:not(.is-disabled):hover {
  background-color: transparent;
}
.avue-icon i, .avue-icon svg {
.avue-icon i,
.avue-icon svg {
  line-height: 20px;
}
@@ -66,36 +76,43 @@
  justify-content: space-between;
  .el-dialog {
      position: relative;
      padding: 0;
    position: relative;
    padding: 0;
    overflow: hidden;
    .el-dialog__body {
      width: 100%;
      height: 100%;
      iframe {
        width: 100%;
        height: 100%;
      }
    }
    .el-dialog__header {
      height: 0;
      overflow: hidden;
      padding: 0;
      .el-dialog__body {
          width: 100%;
          height: 100%;
      .el-dialog__headerbtn {
        position: absolute;
        left: 0;
        top: 14px;
          iframe {
              width: 100%;
              height: 100%;
          }
        .el-dialog__close {
          color: #fff;
          font-size: 35px;
          z-index: 99;
        }
      }
    }
  }
}
      .el-dialog__header {
          height: 0;
          overflow: hidden;
          padding: 0;
          .el-dialog__headerbtn {
              position: absolute;
              left: 0;
              top: 14px;
              .el-dialog__close {
                  color: #fff;
                  font-size: 35px;
                  z-index: 99;
              }
          }
      }
.ztzf-drawer-body-basic-container {
  .el-drawer__body {
    display: flex;
    flex-direction: column;
  }
}
src/views/device/airport.vue
@@ -115,7 +115,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>
@@ -350,7 +351,7 @@
              },
            ],
          },
           {
          {
            label: '行政区划',
            prop: 'area_name',
            hide: true,
@@ -364,8 +365,8 @@
            type: 'cascader',
            labelWidth: 130,
            hide: true,
          editDisplay: true,
            viewDisplay: false,
            editDisplay: true,
            viewDisplay: false,
            props: {
              label: 'title',
              value: 'value',
@@ -1023,10 +1024,10 @@
          this.form = {
            ...data,
            area_code: this.getFullAreaCode(data.area_code),
            area_name:this.form.area_name,
            area_name: this.form.area_name,
            duration_of_insurance: [data?.insure_start_time || '', data?.insure_expired_time || '']
          }
console.log('this.form',this.form);
          console.log('this.form', this.form)
          done()
        })
src/views/device/components/devicePerShare.vue
@@ -1,35 +1,20 @@
<template>
  <basic-container>
    <avue-crud
      :option="option"
      :table-loading="loading"
      :data="data"
      v-model:page="page"
      ref="crud"
      @row-del="rowDel"
      v-model="form"
      :permission="permissionList"
      @row-save="rowSave"
      @row-update="rowUpdate"
      :before-open="beforeOpen"
      @search-change="searchChange"
      @search-reset="searchReset"
      @selection-change="selectionChange"
      @current-change="currentChange"
      @size-change="sizeChange"
      @refresh-change="refreshChange"
    >
    <avue-crud :option="option" :table-loading="loading" :data="data" v-model:page="page" ref="crud" @row-del="rowDel"
      v-model="form" :permission="permissionList" @row-save="rowSave" @row-update="rowUpdate" :before-open="beforeOpen"
      @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange"
      @current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange">
    </avue-crud>
  </basic-container>
</template>
<script>
import { getList, remove, add, update } from '@/api/device/devicePerShare';
import { getDeptTreeByNotItself } from '@/api/system/dept';
import { mapGetters } from 'vuex';
import { getList, remove, add, update } from '@/api/device/devicePerShare'
import { getDeptTreeByNotItself } from '@/api/system/dept'
import { mapGetters } from 'vuex'
export default {
  data() {
  data () {
    return {
      deptId: '',
      deviceSn: '',
@@ -58,6 +43,10 @@
        excelBtn: false,
        dialogClickModal: false,
        grid: false,
        height: 'auto',
        calcHeight: 20,
        column: [
          {
            label: '授权单位',
@@ -136,118 +125,118 @@
        ],
      },
      data: [],
    };
    }
  },
  computed: {
    ...mapGetters(['permission']),
    permissionList() {
    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),
      };
      }
    },
    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: {
    init(data) {
      this.deptId = data.dept_id;
      this.deviceSn = data.device_sn;
      this.getDeptTreeInfo();
      this.getLoadPage(this.page);
    init (data) {
      this.deptId = data.dept_id
      this.deviceSn = data.device_sn
      this.getDeptTreeInfo()
      this.getLoadPage(this.page)
    },
    getDeptTreeInfo() {
    getDeptTreeInfo () {
      getDeptTreeByNotItself(this.deptId, this.deviceSn).then(res => {
        const column = this.findObject(this.option.column, 'deptId');
        this.deptTreeData = res.data.data;
        column.dicData = res.data.data;
      });
        const column = this.findObject(this.option.column, 'deptId')
        this.deptTreeData = res.data.data
        column.dicData = res.data.data
      })
    },
    rowSave(row, done, loading) {
    rowSave (row, done, loading) {
      // 添加毫秒级时间戳
      row['createTime'] = Date.now();
      row['deviceSn'] = this.deviceSn;
      row['createTime'] = Date.now()
      row['deviceSn'] = this.deviceSn
      add(row).then(
        () => {
          this.initFlag = false;
          this.getLoadPage(this.page);
          this.getDeptTreeInfo();
          this.initFlag = false
          this.getLoadPage(this.page)
          this.getDeptTreeInfo()
          this.$message({
            type: 'success',
            message: '操作成功!',
          });
          done();
          })
          done()
        },
        error => {
          window.console.log(error);
          loading();
          window.console.log(error)
          loading()
        }
      );
      )
    },
    rowUpdate(row, index, done, loading) {
      row['device_sn'] = this.deviceSn;
    rowUpdate (row, index, done, loading) {
      row['device_sn'] = this.deviceSn
      update(row).then(
        () => {
          this.getLoadPage(this.page);
          this.getLoadPage(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.getDeptTreeInfo();
          this.getLoadPage(this.page);
          this.getDeptTreeInfo()
          this.getLoadPage(this.page)
          this.$message({
            type: 'success',
            message: '操作成功!',
          });
        });
          })
        })
    },
    searchReset() {
      this.query = {};
      this.getLoadPage(this.page);
    searchReset () {
      this.query = {}
      this.getLoadPage(this.page)
    },
    searchChange(params, done) {
      this.query = params;
      this.page.currentPage = 1;
      this.getLoadPage(this.page, params);
      done();
    searchChange (params, done) {
      this.query = params
      this.page.currentPage = 1
      this.getLoadPage(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: '确定',
@@ -255,48 +244,48 @@
        type: 'warning',
      })
        .then(() => {
          return remove(this.ids);
          return remove(this.ids)
        })
        .then(() => {
          this.getLoadPage(this.page);
          this.getLoadPage(this.page)
          this.$message({
            type: 'success',
            message: '操作成功!',
          });
          this.$refs.crud.toggleSelection();
        });
          })
          this.$refs.crud.toggleSelection()
        })
    },
    beforeOpen(done, type) {
      done();
    beforeOpen (done, type) {
      done()
    },
    currentChange(currentPage) {
      this.page.currentPage = currentPage;
      this.getLoadPage(this.page, this.query); // 添加数据刷新
    currentChange (currentPage) {
      this.page.currentPage = currentPage
      this.getLoadPage(this.page, this.query) // 添加数据刷新
    },
    sizeChange(pageSize) {
      this.page.pageSize = pageSize;
      this.page.currentPage = 1; // 每页条数改变时,重置到第一页
      this.getLoadPage(this.page, this.query); // 添加数据刷新
    sizeChange (pageSize) {
      this.page.pageSize = pageSize
      this.page.currentPage = 1 // 每页条数改变时,重置到第一页
      this.getLoadPage(this.page, this.query) // 添加数据刷新
    },
    refreshChange() {
      this.getLoadPage(this.page, this.query);
    refreshChange () {
      this.getLoadPage(this.page, this.query)
    },
    getLoadPage(page, params = {}) {
      params['deviceSn'] = this.deviceSn;
      this.loading = true;
    getLoadPage (page, params = {}) {
      params['deviceSn'] = this.deviceSn
      this.loading = true
      getList(page.currentPage, page.pageSize, params).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()
      }).catch(err => {
        console.error('加载数据失败:', err);
        this.loading = false;
      });
        console.error('加载数据失败:', err)
        this.loading = false
      })
    },
  },
};
}
</script>
<style>
@@ -304,6 +293,7 @@
  background-color: aqua;
  border-radius: 4px;
}
.firmware_status:hover {
  cursor: pointer;
}