无人机管理后台前端(已迁走)
shuishen
2025-06-26 2978f3f662e09cbe86e2c24417e83f665574c812
feat:用户管理页面样式调整
2 files modified
1 files added
497 ■■■■■ changed files
src/styles/base.scss 59 ●●●●● patch | view | raw | blame | history
src/styles/common.scss 1 ●●●● patch | view | raw | blame | history
src/views/system/user.vue 437 ●●●● patch | view | raw | blame | history
src/styles/base.scss
New file
@@ -0,0 +1,59 @@
.manage-flex {
    display: flex;
}
.manage-f-d-c {
    flex-direction: column;
}
.manage-flex-1 {
    flex: 1;
}
.manage-flex-2 {
    flex: 2;
}
.manage-flex-3 {
    flex: 3;
}
.manage-flex-4 {
    flex: 4;
}
.manage-flex-5 {
    flex: 5;
}
.manage-flex-6 {
    flex: 6;
}
.manage-flex-7 {
    flex: 7;
}
.manage-w-0 {
    width: 0;
}
.manage-w-100 {
    width: 100%;
}
.manage-h-0 {
    height: 0;
}
.manage-h-100 {
    height: 100%;
}
.manage-p-all-10 {
    padding: 10px;
}
.manage-p-t-0 {
    padding-top: 0;
}
src/styles/common.scss
@@ -1,5 +1,6 @@
// 全局变量
@import './variables.scss';
@import './base.scss';
a {
  text-decoration: none;
src/views/system/user.vue
@@ -1,6 +1,6 @@
<template>
  <el-row>
    <el-col :span="5">
  <div class="manage-p-all-10 manage-p-t-0 manage-h-0 manage-flex-1 manage-flex">
    <div class="manage-flex-2 manage-h-100">
      <div class="box">
        <el-scrollbar>
          <basic-container>
@@ -8,8 +8,9 @@
          </basic-container>
        </el-scrollbar>
      </div>
    </el-col>
    <el-col :span="19">
    </div>
    <div class="manage-flex-6 manage-h-100 manage-flex manage-f-d-c">
      <basic-container>
        <avue-crud :option="option" v-model:search="search" :table-loading="loading" :data="data" ref="crud"
          v-model="form" :permission="permissionList" @row-del="rowDel" @row-update="rowUpdate" @row-save="rowSave"
@@ -26,8 +27,8 @@
            <el-button type="primary" plain icon="el-icon-operation"
              v-if="userInfo.role_name.includes('admin') && !auditMode" @click="handleAudit">审 核
            </el-button>
            <el-button type="success" plain icon="el-icon-check" v-if="userInfo.role_name.includes('admin') && auditMode"
              @click="handleAuditPass">通 过
            <el-button type="success" plain icon="el-icon-check"
              v-if="userInfo.role_name.includes('admin') && auditMode" @click="handleAuditPass">通 过
            </el-button>
            <el-button type="danger" plain icon="el-icon-close" v-if="userInfo.role_name.includes('admin') && auditMode"
              @click="handleAuditRefuse">拒 绝
@@ -41,8 +42,8 @@
            <el-button type="info" plain v-if="permission.user_reset && !auditMode" icon="el-icon-refresh"
              @click="handleReset">密码重置
            </el-button>
            <el-button type="info" plain v-if="userInfo.role_name.includes('admin') && !auditMode" icon="el-icon-setting"
              @click="handlePlatform">平台配置
            <el-button type="info" plain v-if="userInfo.role_name.includes('admin') && !auditMode"
              icon="el-icon-setting" @click="handlePlatform">平台配置
            </el-button>
            <el-button type="info" plain v-if="userInfo.role_name.includes('admin') && !auditMode"
              icon="el-icon-coordinate" @click="handleLock">账号解封
@@ -104,8 +105,8 @@
          </avue-crud>
        </el-dialog>
      </basic-container>
    </el-col>
  </el-row>
    </div>
  </div>
</template>
<script>
@@ -122,37 +123,37 @@
  unlock,
  auditPass,
  auditRefuse,
} from '@/api/system/user';
import { exportBlob } from '@/api/common';
import { getDeptTree, getDeptLazyTree } from '@/api/system/dept';
import { getRoleTree } from '@/api/system/role';
import { getPostList } from '@/api/system/post';
import { mapGetters } from 'vuex';
import website from '@/config/website';
import { getToken } from '@/utils/auth';
import { downloadXls } from '@/utils/util';
import NProgress from 'nprogress';
import 'nprogress/nprogress.css';
import func from '@/utils/func';
} from '@/api/system/user'
import { exportBlob } from '@/api/common'
import { getDeptTree, getDeptLazyTree } from '@/api/system/dept'
import { getRoleTree } from '@/api/system/role'
import { getPostList } from '@/api/system/post'
import { mapGetters } from 'vuex'
import website from '@/config/website'
import { getToken } from '@/utils/auth'
import { downloadXls } from '@/utils/util'
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'
import func from '@/utils/func'
export default {
  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.form.password) {
        callback(new Error('两次输入密码不一致!'));
        callback(new Error('两次输入密码不一致!'))
      } else {
        callback();
        callback()
      }
    };
    }
    return {
      form: {
        flightStartTime: null, // 飞行事件开始时间
@@ -194,7 +195,7 @@
        nodeKey: 'id',
        lazy: true,
        treeLoad: function (node, resolve) {
          const parentId = node.level === 0 ? 0 : node.data.id;
          const parentId = node.level === 0 ? 0 : node.data.id
          console.log(node,666)
          const param = {
            parentId:parentId,
@@ -206,10 +207,10 @@
                return {
                  ...item,
                  leaf: !item.hasChildren,
                };
                }
              })
            );
          });
            )
          })
        },
        addBtn: false,
        menu: false,
@@ -683,18 +684,18 @@
          },
        ],
      },
    };
    }
  },
  watch: {
    'form.tenantId'() {
      if (this.form.tenantId !== '' && this.initFlag) {
        this.initData(this.form.tenantId);
        this.initData(this.form.tenantId)
      }
    },
    'excelForm.isCovered'() {
      if (this.excelForm.isCovered !== '') {
        const column = this.findObject(this.excelOption.column, 'excelFile');
        column.action = `/blade-system/user/import-user?isCovered=${this.excelForm.isCovered}`;
        const column = this.findObject(this.excelOption.column, 'excelFile')
        column.action = `/blade-system/user/import-user?isCovered=${this.excelForm.isCovered}`
      }
    },
  },
@@ -706,7 +707,7 @@
        viewBtn: this.validData(this.permission.user_view, false),
        delBtn: this.validData(this.permission.user_delete, false),
        editBtn: this.validData(this.permission.user_edit, false),
      };
      }
    },
    platformPermissionList() {
      return {
@@ -714,92 +715,92 @@
        viewBtn: false,
        delBtn: false,
        editBtn: this.validData(this.permission.user_edit, false),
      };
      }
    },
    ids() {
      let ids = [];
      let ids = []
      this.selectionList.forEach(ele => {
        ids.push(ele.id);
      });
      return ids.join(',');
        ids.push(ele.id)
      })
      return ids.join(',')
    },
  },
  mounted() {
    // 非租户模式默认加载管理组数据
    if (!website.tenantMode) {
      this.initData(website.tenantId);
      this.initData(website.tenantId)
    }
    this.initData(this.form.tenantId);
    this.initData(this.form.tenantId)
  },
  methods: {
    nodeClick(data) {
      this.treeDeptId = data.id;
      this.page.currentPage = 1;
      this.onLoad(this.page);
      this.treeDeptId = data.id
      this.page.currentPage = 1
      this.onLoad(this.page)
    },
    initData(tenantId) {
      tenantId = '000000';
      tenantId = '000000'
      getRoleTree(tenantId).then(res => {
        const column = this.findObject(this.option.group, 'roleId');
        column.dicData = res.data.data;
      });
        const column = this.findObject(this.option.group, 'roleId')
        column.dicData = res.data.data
      })
      getDeptTree(tenantId).then(res => {
        const column = this.findObject(this.option.group, 'deptId');
        column.dicData = res.data.data;
      });
        const column = this.findObject(this.option.group, 'deptId')
        column.dicData = res.data.data
      })
      // getPostList(tenantId).then(res => {
      //   const column = this.findObject(this.option.group, 'postId');
      //   column.dicData = res.data.data;
      // });
    },
    submitRole() {
      const roleList = this.$refs.treeRole.getCheckedKeys().join(',');
      const roleList = this.$refs.treeRole.getCheckedKeys().join(',')
      grant(this.ids, roleList).then(() => {
        this.roleBox = false;
        this.roleBox = false
        this.$message({
          type: 'success',
          message: '操作成功!',
        });
        this.onLoad(this.page);
      });
        })
        this.onLoad(this.page)
      })
    },
    rowSave(row, done, loading) {
      // 格式化时间数据
     
       if (row.flightStartTime && row.flightEndTime) {
    // 验证 flightEndTime 是否小于 flightStartTime
   const [startHours, startMinutes] = row.flightStartTime.split(':').map(Number);
    const [endHours, endMinutes] = row.flightEndTime.split(':').map(Number);
        const [startHours, startMinutes] = row.flightStartTime.split(':').map(Number)
        const [endHours, endMinutes] = row.flightEndTime.split(':').map(Number)
    const startTotalMinutes = startHours * 60 + startMinutes;
    const endTotalMinutes = endHours * 60 + endMinutes;
        const startTotalMinutes = startHours * 60 + startMinutes
        const endTotalMinutes = endHours * 60 + endMinutes
    if (endTotalMinutes < startTotalMinutes) {
        this.$message.error('飞行结束时间不能小于飞行开始时间');
            loading();
        return;
          this.$message.error('飞行结束时间不能小于飞行开始时间')
          loading()
          return
    }
       }
    
      row.deptId = func.join(row.deptId);
      row.roleId = func.join(row.roleId);
      row.postId = func.join(row.postId);
      row.deptId = func.join(row.deptId)
      row.roleId = func.join(row.roleId)
      row.postId = func.join(row.postId)
      row.name = row.realName
      add(row).then(
        () => {
          this.initFlag = false;
          this.onLoad(this.page);
          this.initFlag = false
          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) {
         // 格式化时间数据
@@ -811,38 +812,38 @@
      // }
       if (row.flightStartTime && row.flightEndTime) {
    // 验证 flightEndTime 是否小于 flightStartTime
   const [startHours, startMinutes] = row.flightStartTime.split(':').map(Number);
    const [endHours, endMinutes] = row.flightEndTime.split(':').map(Number);
        const [startHours, startMinutes] = row.flightStartTime.split(':').map(Number)
        const [endHours, endMinutes] = row.flightEndTime.split(':').map(Number)
    const startTotalMinutes = startHours * 60 + startMinutes;
    const endTotalMinutes = endHours * 60 + endMinutes;
        const startTotalMinutes = startHours * 60 + startMinutes
        const endTotalMinutes = endHours * 60 + endMinutes
    if (endTotalMinutes < startTotalMinutes) {
        this.$message.error('飞行结束时间不能小于飞行开始时间');
           loading();
        return ;
          this.$message.error('飞行结束时间不能小于飞行开始时间')
          loading()
          return
      }
       }
    
      row.deptId = func.join(row.deptId);
      row.roleId = func.join(row.roleId);
      row.postId = func.join(row.postId);
      row.deptId = func.join(row.deptId)
      row.roleId = func.join(row.roleId)
      row.postId = func.join(row.postId)
      row.name = row.realName
      update(row).then(
        () => {
          this.initFlag = false;
          this.onLoad(this.page);
          this.initFlag = false
          this.onLoad(this.page)
          this.$message({
            type: 'success',
            message: '操作成功!',
          });
          done();
          })
          done()
        },
        error => {
          window.console.log(error);
          loading();
          window.console.log(error)
          loading()
        }
      );
      )
    },
    rowDel(row) {
      this.$confirm('确定将选择数据删除?', {
@@ -851,38 +852,38 @@
        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.treeDeptId = '';
      this.onLoad(this.page);
      this.query = {}
      this.treeDeptId = ''
      this.onLoad(this.page)
    },
    searchChange(params, done) {
      this.query = params;
      this.page.currentPage = 1;
      this.onLoad(this.page, params);
      done();
      this.query = params
      this.page.currentPage = 1
      this.onLoad(this.page, params)
      done()
    },
    selectionChange(list) {
      this.selectionList = list;
      this.selectionList = list
    },
    selectionClear() {
      this.selectionList = [];
      this.$refs.crud.toggleSelection();
      this.selectionList = []
      this.$refs.crud.toggleSelection()
    },
    handleDelete() {
      if (this.selectionList.length === 0) {
        this.$message.warning('请选择至少一条数据');
        return;
        this.$message.warning('请选择至少一条数据')
        return
      }
      this.$confirm('确定将选择数据删除?', {
        confirmButtonText: '确定',
@@ -890,25 +891,25 @@
        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()
        })
    },
    handleAudit() {
      this.auditMode = true;
      this.onLoad(this.page, this.query);
      this.auditMode = true
      this.onLoad(this.page, this.query)
    },
    handleAuditPass() {
      if (this.selectionList.length === 0) {
        this.$message.warning('请选择至少一条数据');
        return;
        this.$message.warning('请选择至少一条数据')
        return
      }
      this.$confirm('确定将选择数据通过审核?', {
        confirmButtonText: '确定',
@@ -916,21 +917,21 @@
        type: 'warning',
      })
        .then(() => {
          return auditPass(this.ids);
          return auditPass(this.ids)
        })
        .then(() => {
          this.onLoad(this.page);
          this.onLoad(this.page)
          this.$message({
            type: 'success',
            message: '操作成功!',
          });
          this.$refs.crud.toggleSelection();
        });
          })
          this.$refs.crud.toggleSelection()
        })
    },
    handleAuditRefuse() {
      if (this.selectionList.length === 0) {
        this.$message.warning('请选择至少一条数据');
        return;
        this.$message.warning('请选择至少一条数据')
        return
      }
      this.$confirm('确定将选择数据拒绝审核?', {
        confirmButtonText: '确定',
@@ -938,25 +939,25 @@
        type: 'warning',
      })
        .then(() => {
          return auditRefuse(this.ids);
          return auditRefuse(this.ids)
        })
        .then(() => {
          this.onLoad(this.page);
          this.onLoad(this.page)
          this.$message({
            type: 'success',
            message: '操作成功!',
          });
          this.$refs.crud.toggleSelection();
        });
          })
          this.$refs.crud.toggleSelection()
        })
    },
    handleAuditBack() {
      this.auditMode = false;
      this.onLoad(this.page, this.query);
      this.auditMode = false
      this.onLoad(this.page, this.query)
    },
    handleReset() {
      if (this.selectionList.length === 0) {
        this.$message.warning('请选择至少一条数据');
        return;
        this.$message.warning('请选择至少一条数据')
        return
      }
      this.$confirm('确定将选择账号密码重置为123456?', {
        confirmButtonText: '确定',
@@ -964,37 +965,37 @@
        type: 'warning',
      })
        .then(() => {
          return resetPassword(this.ids);
          return resetPassword(this.ids)
        })
        .then(() => {
          this.$message({
            type: 'success',
            message: '操作成功!',
          });
          this.$refs.crud.toggleSelection();
        });
          })
          this.$refs.crud.toggleSelection()
        })
    },
    handleGrant() {
      if (this.selectionList.length === 0) {
        this.$message.warning('请选择至少一条数据');
        return;
        this.$message.warning('请选择至少一条数据')
        return
      }
      this.roleTreeObj = [];
      this.roleTreeObj = []
      if (this.selectionList.length === 1) {
        this.roleTreeObj = this.selectionList[0].roleId.split(',');
        this.roleTreeObj = this.selectionList[0].roleId.split(',')
      }
      getRoleTree().then(res => {
        this.roleGrantList = res.data.data;
        this.roleBox = true;
      });
        this.roleGrantList = res.data.data
        this.roleBox = true
      })
    },
    handlePlatform() {
      this.platformBox = true;
      this.platformBox = true
    },
    handleLock() {
      if (this.selectionList.length === 0) {
        this.$message.warning('请选择至少一条数据');
        return;
        this.$message.warning('请选择至少一条数据')
        return
      }
      this.$confirm('确定将选择账号解封?', {
        confirmButtonText: '确定',
@@ -1002,171 +1003,171 @@
        type: 'warning',
      })
        .then(() => {
          return unlock(this.ids);
          return unlock(this.ids)
        })
        .then(() => {
          this.$message({
            type: 'success',
            message: '操作成功!',
          });
        });
          })
        })
    },
    handleImport() {
      this.excelBox = true;
      this.excelBox = true
    },
    uploadAfter(res, done, loading, column) {
      window.console.log(column);
      this.excelBox = false;
      this.refreshChange();
      done();
      window.console.log(column)
      this.excelBox = false
      this.refreshChange()
      done()
    },
    handleExport() {
      const account = func.toStr(this.search.account);
      const realName = func.toStr(this.search.realName);
      const account = func.toStr(this.search.account)
      const realName = func.toStr(this.search.realName)
      this.$confirm('是否导出用户数据?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
      }).then(() => {
        NProgress.start();
        NProgress.start()
        exportBlob(
          `/blade-system/user/export-user?${this.website.tokenHeader
          }=${getToken()}&account=${account}&realName=${realName}`
        ).then(res => {
          downloadXls(res.data, `用户数据表${this.$dayjs().format('YYYY-MM-DD')}.xlsx`);
          NProgress.done();
        });
      });
          downloadXls(res.data, `用户数据表${this.$dayjs().format('YYYY-MM-DD')}.xlsx`)
          NProgress.done()
        })
      })
    },
    handleTemplate() {
      exportBlob(
        `/blade-system/user/export-template?${this.website.tokenHeader}=${getToken()}`
      ).then(res => {
        downloadXls(res.data, '用户数据模板.xlsx');
      });
        downloadXls(res.data, '用户数据模板.xlsx')
      })
    },
    beforeOpen(done, type) {
      if (['edit', 'view'].includes(type)) {
        getUser(this.form.id).then(res => {
          this.form = res.data.data;
          this.form = res.data.data
          if (this.form.hasOwnProperty('deptId')) {
            this.form.deptId = func.split(this.form.deptId);
            this.form.deptId = func.split(this.form.deptId)
          }
          if (this.form.hasOwnProperty('roleId')) {
            this.form.roleId = func.split(this.form.roleId);
            this.form.roleId = func.split(this.form.roleId)
          }
          if (this.form.hasOwnProperty('postId')) {
            this.form.postId = func.split(this.form.postId);
            this.form.postId = func.split(this.form.postId)
          }
        });
        })
      }
      this.initFlag = true;
      done();
      this.initFlag = true
      done()
    },
    currentChange(currentPage) {
      this.page.currentPage = currentPage;
      this.page.currentPage = currentPage
    },
    sizeChange(pageSize) {
      this.page.pageSize = pageSize;
      this.page.pageSize = pageSize
    },
    refreshChange() {
      this.onLoad(this.page, this.query);
      this.onLoad(this.page, this.query)
    },
    onLoad(page, params = {}) {
      this.loading = true;
      this.loading = true
      getList(
        page.currentPage,
        page.pageSize,
        Object.assign(params, this.query, { status: this.auditMode ? 0 : 1 }),
        this.treeDeptId
      ).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()
      })
    },
    platformRowUpdate(row, index, done, loading) {
      updatePlatform(row.id, row.userType, row.userExt).then(
        () => {
          this.platformOnLoad(this.platformPage);
          this.platformOnLoad(this.platformPage)
          this.$message({
            type: 'success',
            message: '操作成功!',
          });
          done();
          })
          done()
        },
        error => {
          window.console.log(error);
          loading();
          window.console.log(error)
          loading()
        }
      );
      )
    },
    platformBeforeOpen(done, type) {
      if (['edit', 'view'].includes(type)) {
        getUserPlatform(this.platformForm.id).then(res => {
          this.platformForm = res.data.data;
        });
          this.platformForm = res.data.data
        })
      }
      done();
      done()
    },
    platformSearchReset() {
      this.platformQuery = {};
      this.platformOnLoad(this.platformPage);
      this.platformQuery = {}
      this.platformOnLoad(this.platformPage)
    },
    platformSearchChange(params, done) {
      this.platformQuery = params;
      this.platformPage.currentPage = 1;
      this.platformOnLoad(this.platformPage, params);
      done();
      this.platformQuery = params
      this.platformPage.currentPage = 1
      this.platformOnLoad(this.platformPage, params)
      done()
    },
    platformSelectionChange(list) {
      this.platformSelectionList = list;
      this.platformSelectionList = list
    },
    platformSelectionClear() {
      this.platformSelectionList = [];
      this.$refs.platformCrud.toggleSelection();
      this.platformSelectionList = []
      this.$refs.platformCrud.toggleSelection()
    },
    platformCurrentChange(currentPage) {
      this.platformPage.currentPage = currentPage;
      this.platformPage.currentPage = currentPage
    },
    platformSizeChange(pageSize) {
      this.platformPage.pageSize = pageSize;
      this.platformPage.pageSize = pageSize
    },
    platformRefreshChange() {
      this.platformOnLoad(this.platformPage, this.platformQuery);
      this.platformOnLoad(this.platformPage, this.platformQuery)
    },
    platformOnLoad(page, params = {}) {
      this.platformLoading = true;
      this.platformLoading = true
      getList(
        page.currentPage,
        page.pageSize,
        Object.assign(params, this.query),
        this.treeDeptId
      ).then(res => {
        const data = res.data.data;
        this.platformPage.total = data.total;
        this.platformData = data.records;
        this.platformLoading = false;
        this.selectionClear();
      });
        const data = res.data.data
        this.platformPage.total = data.total
        this.platformData = data.records
        this.platformLoading = false
        this.selectionClear()
      })
    },
    formatTime(time) {
      // 格式化时间为 HH:mm
      const date = new Date(time);
      const hours = String(date.getHours()).padStart(2, '0');
      const minutes = String(date.getMinutes()).padStart(2, '0');
      return `${hours}:${minutes}`;
      const date = new Date(time)
      const hours = String(date.getHours()).padStart(2, '0')
      const minutes = String(date.getMinutes()).padStart(2, '0')
      return `${hours}:${minutes}`
    },
  },
};
}
</script>
<style lang="scss">
.box {
  height: 800px;
  height: 100%;
}
.el-scrollbar {
@@ -1176,6 +1177,4 @@
.box .el-scrollbar__wrap {
  overflow: scroll;
}
</style>