无人机管理后台前端(已迁走)
linwei
2025-06-06 c16a877107360f8e3c5ed0ec10e8332a22a90645
Merge remote-tracking branch 'origin/master'
6 files modified
2 files added
472 ■■■■■ changed files
src/option/user/info.js 15 ●●●●● patch | view | raw | blame | history
src/permission copy 2.js 71 ●●●●● patch | view | raw | blame | history
src/permission copy.js 133 ●●●●● patch | view | raw | blame | history
src/permission.js 62 ●●●●● patch | view | raw | blame | history
src/store/modules/user.js 2 ●●● patch | view | raw | blame | history
src/views/system/user.vue 131 ●●●● patch | view | raw | blame | history
src/views/system/userinfo.vue 31 ●●●● patch | view | raw | blame | history
src/views/tickets/orderLog.vue 27 ●●●●● patch | view | raw | blame | history
src/option/user/info.js
@@ -1,6 +1,10 @@
export default {
  tabs: true,
  tabsActive: 1,
  // 全局禁用自动填充
  formAttrs: {
    autocomplete: 'off'
  },
  group: [
    {
      label: '个人信息',
@@ -25,14 +29,25 @@
          span: 12,
          row: true,
          prop: 'realName',
          rules: [
            {
              required: true,
              message: '姓名不能为空',
              trigger: 'blur'
            }
          ],
          required: true
        },
        {
          label: '手机号',
          span: 12,
          row: true,
          prop: 'phone',
        },
        {
          slot: true,
          label: '邮箱',
          prop: 'email',
          span: 12,
src/permission copy 2.js
New file
@@ -0,0 +1,71 @@
/*
 * @Author: GuLiMmo 2820890765@qq.com
 * @Date: 2024-08-23 10:51:53
 * @LastEditors: GuLiMmo 2820890765@qq.com
 * @LastEditTime: 2024-08-29 14:10:56
 * @FilePath: /drone-web-manage/src/permission.js
 * @Description:
 * Copyright (c) 2024 by GuLiMmo, All Rights Reserved.
 */
import router from './router/'
import store from './store'
import { getToken } from '@/utils/auth'
import { getUrlParams } from './utils/validate'
import NProgress from 'nprogress' // progress bar
import 'nprogress/nprogress.css' // progress bar style
NProgress.configure({ showSpinner: false })
const lockPage = '/lock' //锁屏页
const urlParams = getUrlParams(window.location.href)
router.beforeEach((to, from, next) => {
  const meta = to.meta || {}
  const isMenu = meta.menu === undefined ? to.query.menu : meta.menu
  store.commit('SET_IS_MENU', isMenu === undefined)
  if (getToken()) {
    if (store.getters.isLock && to.path !== lockPage) {
      //如果系统激活锁屏,全部跳转到锁屏页
      next({ path: lockPage })
    } else if (to.path === '/login') {
      //如果登录成功访问登录页跳转到主页
      next({ path: '/' })
    } else {
      const systemToken = store.getters.token || urlParams?.token
      if (systemToken === 0) {
        store.dispatch('FedLogOut').then(() => {
          next({ path: '/login' })
        })
      } else {
        const meta = to.meta || {}
        const query = to.query || {}
        if (meta.target) {
          window.open(query.url.replace(/#/g, '&'))
          return
        } else if (meta.isTab !== false) {
          store.commit('ADD_TAG', {
            name: query.name || to.name,
            path: to.path,
            fullPath: to.path,
            params: to.params,
            query: to.query,
            meta: meta,
          })
        }
        next()
      }
    }
  } else {
    //判断是否需要认证,没有登录访问去登录页
    if (meta.isAuth === false) {
      next()
    } else {
      next('/login')
    }
  }
})
router.afterEach(to => {
  NProgress.done()
  let title = router.$avueRouter.generateTitle(to, { label: 'name' })
  router.$avueRouter.setTitle(title)
  store.commit('SET_IS_SEARCH', false)
})
src/permission copy.js
New file
@@ -0,0 +1,133 @@
/*
 * @Author: GuLiMmo 2820890765@qq.com
 * @Date: 2024-08-23 10:51:53
 * @LastEditors: GuLiMmo 2820890765@qq.com
 * @LastEditTime: 2024-08-29 14:10:56
 * @FilePath: /drone-web-manage/src/permission.js
 * @Description:
 * Copyright (c) 2024 by GuLiMmo, All Rights Reserved.
 */
import { getStore } from '@/utils/store'
import router from './router/'
import store from './store'
import { getToken } from '@/utils/auth'
import { getUrlParams } from './utils/validate'
import NProgress from 'nprogress' // progress bar
import 'nprogress/nprogress.css' // progress bar style
NProgress.configure({ showSpinner: false })
const lockPage = '/lock' //锁屏页
const urlParams = getUrlParams(window.location.href)
function findRouteByPath (routes, targetPath) {
  // 遍历数组中的每个路由对象
  for (const route of routes) {
    // 如果当前路由的path匹配目标路径,直接返回
    if (route.path === targetPath) {
      return route
    }
    // 如果有子路由,递归查找
    if (route.children && route.children.length > 0) {
      const foundInChildren = findRouteByPath(route.children, targetPath)
      if (foundInChildren) {
        return foundInChildren
      }
    }
  }
  // 遍历完所有路由都没找到,返回null
  return null
}
router.beforeEach((to, from, next) => {
  const meta = to.meta || {}
  const isMenu = meta.menu === undefined ? to.query.menu : meta.menu
  store.commit('SET_IS_MENU', isMenu === undefined)
  const menuAll = getStore({ name: 'menuAll' })
  if (!menuAll) {
    store.dispatch('GetMenu').then(data => {
      if (data.length !== 0) {
        router.$avueRouter.formatRoutes(data, true)
        let newMenu = getStore({ name: 'menuAll' })
        let firstMenu = newMenu[0]
        let toMenu = findRouteByPath(newMenu, to.path)
        store.commit('ADD_TAG', {
          name: firstMenu.name,
          path: firstMenu.path,
          fullPath: firstMenu.path,
          params: firstMenu.params || {},
          query: firstMenu.query || {},
          meta: firstMenu.meta || {},
        })
        store.commit('ADD_TAG', {
          name: toMenu.name,
          path: toMenu.path,
          fullPath: toMenu.path,
          params: toMenu.params || {},
          query: toMenu.query || {},
          meta: toMenu.meta || {},
        })
        next(to.fullPath)
      }
    })
    return
  }
  if (getToken()) {
    if (store.getters.isLock && to.path !== lockPage) {
      //如果系统激活锁屏,全部跳转到锁屏页
      next({ path: lockPage })
    } else if (to.path === '/login') {
      //如果登录成功访问登录页跳转到主页
      next({ path: '/' })
    } else {
      const systemToken = store.getters.token || urlParams?.token
      if (systemToken === 0) {
        store.dispatch('FedLogOut').then(() => {
          next({ path: '/login' })
        })
      } else {
        const meta = to.meta || {}
        const query = to.query || {}
        if (meta.target) {
          window.open(query.url.replace(/#/g, '&'))
          return
        } else if (meta.isTab !== false) {
          store.commit('ADD_TAG', {
            name: query.name || to.name,
            path: to.path,
            fullPath: to.path,
            params: to.params,
            query: to.query,
            meta: meta,
          })
        }
        next()
      }
    }
  } else {
    //判断是否需要认证,没有登录访问去登录页
    if (meta.isAuth === false) {
      next()
    } else {
      next('/login')
    }
  }
})
router.afterEach(to => {
  NProgress.done()
  let title = router.$avueRouter.generateTitle(to, { label: 'name' })
  router.$avueRouter.setTitle(title)
  store.commit('SET_IS_SEARCH', false)
})
src/permission.js
@@ -7,6 +7,8 @@
 * @Description:
 * Copyright (c) 2024 by GuLiMmo, All Rights Reserved.
 */
import { getStore } from '@/utils/store'
import router from './router/'
import store from './store'
import { getToken } from '@/utils/auth'
@@ -17,10 +19,70 @@
const lockPage = '/lock' //锁屏页
const urlParams = getUrlParams(window.location.href)
function findRouteByPath (routes, targetPath) {
  // 遍历数组中的每个路由对象
  for (const route of routes) {
    // 如果当前路由的path匹配目标路径,直接返回
    if (route.path === targetPath) {
      return route
    }
    // 如果有子路由,递归查找
    if (route.children && route.children.length > 0) {
      const foundInChildren = findRouteByPath(route.children, targetPath)
      if (foundInChildren) {
        return foundInChildren
      }
    }
  }
  // 遍历完所有路由都没找到,返回null
  return null
}
router.beforeEach((to, from, next) => {
  const meta = to.meta || {}
  const isMenu = meta.menu === undefined ? to.query.menu : meta.menu
  store.commit('SET_IS_MENU', isMenu === undefined)
  const menuAll = getStore({ name: 'menuAll' })
  if (!menuAll) {
    store.dispatch('GetMenu').then(data => {
      if (data.length !== 0) {
        router.$avueRouter.formatRoutes(data, true)
        let newMenu = getStore({ name: 'menuAll' })
        let firstMenu = newMenu[0]
        let toMenu = findRouteByPath(newMenu, to.path)
        store.commit('ADD_TAG', {
          name: firstMenu.name,
          path: firstMenu.path,
          fullPath: firstMenu.path,
          params: firstMenu.params || {},
          query: firstMenu.query || {},
          meta: firstMenu.meta || {},
        })
        store.commit('ADD_TAG', {
          name: toMenu.name,
          path: toMenu.path,
          fullPath: toMenu.path,
          params: toMenu.params || {},
          query: toMenu.query || {},
          meta: toMenu.meta || {},
        })
        next(to.fullPath)
      }
    })
    return
  }
  if (getToken()) {
    if (store.getters.isLock && to.path !== lockPage) {
      //如果系统激活锁屏,全部跳转到锁屏页
src/store/modules/user.js
@@ -39,7 +39,7 @@
    token: getStore({ name: 'token' }) || '',
    refreshToken: getStore({ name: 'refreshToken' }) || '',
    parentDeptInfo: getStore({ name: 'parentDeptInfo' }) || '',
    defaultAva: defaultAva, // 将图片路径存入 state(可选)
  },
  actions: {
    //根据用户名登录
src/views/system/user.vue
@@ -66,6 +66,7 @@
          <template #userTypeName="{ row }">
            <el-tag>{{ row.userTypeName }}</el-tag>
          </template>
        </avue-crud>
        <el-dialog title="用户角色配置" append-to-body v-model="roleBox" width="345px">
          <el-tree :data="roleGrantList" show-checkbox check-strictly default-expand-all node-key="id" ref="treeRole"
@@ -153,7 +154,10 @@
      }
    };
    return {
      form: {},
      form: {
        flightStartTime: null, // 飞行事件开始时间
        flightEndTime: null, // 飞行事件结束时间
      },
      search: {},
      roleBox: false,
      excelBox: false,
@@ -363,13 +367,7 @@
                viewDisplay: false,
                rules: [{ required: true, validator: validatePass2, trigger: 'blur' }],
              },
              {
                label: '到期时间',
                prop: 'expireTime',
                type: 'datetime',
                format: 'YYYY-MM-DD HH:mm:ss',
                valueFormat: 'YYYY-MM-DD HH:mm:ss',
              },
            ],
          },
          {
@@ -503,24 +501,58 @@
                  },
                ],
              },
              // {
              //   label: '所属岗位',
              //   prop: 'postId',
              //   type: 'tree',
              //   multiple: true,
              //   dicData: [],
              //   props: {
              //     label: 'postName',
              //     value: 'id',
              //   },
              //   rules: [
              //     {
              //       required: true,
              //       message: '请选择所属岗位',
              //       trigger: 'click',
              //     },
              //   ],
              // },
            ],
          },
           {
            label: '登录限制',
            prop: '',
            icon: 'el-icon-s-custom',
            column: [
               {
                label: '到期时间',
                prop: 'expireTime',
                type: 'datetime',
                format: 'YYYY-MM-DD HH:mm:ss',
                valueFormat: 'YYYY-MM-DD HH:mm:ss',
              },
                {
                label: '次数限制',
                prop: 'maxLoginNum',
                type: 'input',
              },
               {
                label: '飞行开始时间',
                prop: 'flightStartTime',
               type: 'time',
                 format: 'HH:mm',
                valueFormat: 'HH:mm',
                rules: [
                  {
                    required: false,
                    message: '请输入飞行开始时间',
                    trigger: 'blur',
                  },
                ],
              },
              {
                label: '飞行结束时间',
                prop: 'flightEndTime',
                type: 'time',
                format: 'HH:mm',
                valueFormat: 'HH:mm',
                rules: [
                  {
                    required: false,
                    message: '请输入飞行结束时间',
                    trigger: 'blur',
                  },
                ],
              },
            ],
          },
        ],
@@ -732,6 +764,23 @@
      });
    },
    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 startTotalMinutes = startHours * 60 + startMinutes;
    const endTotalMinutes = endHours * 60 + endMinutes;
    if (endTotalMinutes < startTotalMinutes) {
        this.$message.error('飞行结束时间不能小于飞行开始时间');
            loading();
        return;
    }
       }
      row.deptId = func.join(row.deptId);
      row.roleId = func.join(row.roleId);
      row.postId = func.join(row.postId);
@@ -753,6 +802,28 @@
      );
    },
    rowUpdate(row, index, done, loading) {
         // 格式化时间数据
      // if (row.flightStartTime) {
      //   row.flightStartTime = this.formatTime(row.flightStartTime);
      // }
      // if (row.flightEndTime) {
      //   row.flightEndTime = this.formatTime(row.flightEndTime);
      // }
       if (row.flightStartTime && row.flightEndTime) {
    // 验证 flightEndTime 是否小于 flightStartTime
   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;
    if (endTotalMinutes < startTotalMinutes) {
        this.$message.error('飞行结束时间不能小于飞行开始时间');
           loading();
        return ;
      }
       }
      row.deptId = func.join(row.deptId);
      row.roleId = func.join(row.roleId);
      row.postId = func.join(row.postId);
@@ -987,6 +1058,7 @@
          if (this.form.hasOwnProperty('postId')) {
            this.form.postId = func.split(this.form.postId);
          }
        });
      }
      this.initFlag = true;
@@ -1081,6 +1153,13 @@
        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}`;
    },
  },
};
</script>
src/views/system/userinfo.vue
@@ -2,11 +2,27 @@
  <div>
    <basic-container>
      <avue-form
        ref="form"
        :option="option"
        v-model="form"
        @tab-click="handleTabClick"
        @submit="handleSubmit"
      ></avue-form>
      >
        <template #email="{ disabled, size }">
            <el-input
            id="adfsdafdsf"
              type="text"
              :disabled="disabled"
              :size="size"
              v-model="form.email"
              placeholder="请输入邮箱"
              :readonly="readonly"
              @focus="readonly = false"
            >
            </el-input>
        </template>
      </avue-form>
    </basic-container>
  </div>
</template>
@@ -17,13 +33,14 @@
import md5 from 'js-md5';
import func from '@/utils/func';
import { validatenull } from '@/utils/validate';
import defaultAva from '@/assets/images/defaultava.png';
export default {
  data() {
    return {
      index: 0,
      option: option,
      form: {},
      form: {  },
      readonly: true
    };
  },
  created() {
@@ -32,7 +49,7 @@
  methods: {
    handleSubmit(form, done) {
      if (this.index === 0) {
        form.name = form.realName
        form.name = form.realName;
        updateInfo(form).then(
          res => {
            if (res.data.success) {
@@ -82,15 +99,17 @@
          const user = res.data.data;
          this.form = {
            id: user.id,
            avatar: user.avatar,
            avatar: user.avatar ? user.avatar :defaultAva,
            name: user.name,
            realName: user.realName,
            phone: user.phone,
            email: user.email,
          };
          };
        });
      }
    },
    handleTabClick(tabs) {
      if (validatenull(tabs.index)) {
        return;
src/views/tickets/orderLog.vue
@@ -1189,6 +1189,20 @@
      this.detailVisible = true;
  // 更新航线列表,追加 wayline_file_region_vo 数据
  if (data.wayline_file_region_vo) {
    const newWayline = data.wayline_file_region_vo;
    // 检查是否已经存在于 this.wayLineList 中
    const isDuplicate = this.wayLineList.some(
      (item) => item.wayline_id === newWayline.wayline_id
    );
    if (!isDuplicate) {
      this.wayLineList.push(newWayline);
    }
  }
      this.initMapLine(data.device_map_infos);
    },
    async handleCheckDetail(row) {
@@ -1197,7 +1211,20 @@
      this.form = {
        ...data,
      };
  // 更新航线列表,追加 wayline_file_region_vo 数据
  // 更新航线列表,追加 wayline_file_region_vo 数据
  if (data.wayline_file_region_vo) {
    const newWayline = data.wayline_file_region_vo;
    // 检查是否已经存在于 this.wayLineList 中
    const isDuplicate = this.wayLineList.some(
      (item) => item.wayline_id === newWayline.wayline_id
    );
    if (!isDuplicate) {
      this.wayLineList.push(newWayline);
    }
  }
      // 更新机巢列表
      this.device_sns = data.device_list;
      this.detailVisibleCopy = true;