Merge remote-tracking branch 'origin/master'
6 files modified
2 files added
| | |
| | | export default { |
| | | tabs: true, |
| | | tabsActive: 1, |
| | | // 全局禁用自动填充 |
| | | formAttrs: { |
| | | autocomplete: 'off' |
| | | }, |
| | | group: [ |
| | | { |
| | | label: '个人信息', |
| | |
| | | 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, |
| New file |
| | |
| | | /* |
| | | * @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) |
| | | }) |
| New file |
| | |
| | | /* |
| | | * @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) |
| | | }) |
| | |
| | | * @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' |
| | |
| | | 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) { |
| | | //如果系统激活锁屏,全部跳转到锁屏页 |
| | |
| | | token: getStore({ name: 'token' }) || '', |
| | | refreshToken: getStore({ name: 'refreshToken' }) || '', |
| | | parentDeptInfo: getStore({ name: 'parentDeptInfo' }) || '', |
| | | defaultAva: defaultAva, // 将图片路径存入 state(可选) |
| | | |
| | | }, |
| | | actions: { |
| | | //根据用户名登录 |
| | |
| | | <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" |
| | |
| | | } |
| | | }; |
| | | return { |
| | | form: {}, |
| | | form: { |
| | | flightStartTime: null, // 飞行事件开始时间 |
| | | flightEndTime: null, // 飞行事件结束时间 |
| | | }, |
| | | search: {}, |
| | | roleBox: false, |
| | | excelBox: false, |
| | |
| | | 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', |
| | | }, |
| | | |
| | | ], |
| | | }, |
| | | { |
| | |
| | | }, |
| | | ], |
| | | }, |
| | | // { |
| | | // 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', |
| | | }, |
| | | ], |
| | | }, |
| | | |
| | | |
| | | |
| | | ], |
| | | }, |
| | | ], |
| | |
| | | }); |
| | | }, |
| | | 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); |
| | |
| | | ); |
| | | }, |
| | | 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); |
| | |
| | | if (this.form.hasOwnProperty('postId')) { |
| | | this.form.postId = func.split(this.form.postId); |
| | | } |
| | | |
| | | }); |
| | | } |
| | | this.initFlag = true; |
| | |
| | | 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> |
| | |
| | | <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> |
| | |
| | | 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() { |
| | |
| | | methods: { |
| | | handleSubmit(form, done) { |
| | | if (this.index === 0) { |
| | | form.name = form.realName |
| | | form.name = form.realName; |
| | | updateInfo(form).then( |
| | | res => { |
| | | if (res.data.success) { |
| | |
| | | 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; |
| | |
| | | |
| | | 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) { |
| | |
| | | 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; |