Files
apt-nl/src/pages/shells/index/index.vue

536 lines
14 KiB
Vue
Raw Normal View History

2023-05-05 18:11:56 +08:00
<template>
<div class="index-container">
<div class="header-container">
<div class="title-container">
2023-06-12 10:21:42 +08:00
<img src="../../../images/aio/logo_0.png" alt="诺力">
2023-05-05 18:11:56 +08:00
</div>
<div class="horizontal-menu-container">
2023-05-30 14:04:57 +08:00
<el-menu :default-active="$route.meta.jumpPath" mode="horizontal" @select="handleSelect">
<el-menu-item :index="menu.index" v-for="menu in menus" :key="menu.index">{{menu.label}}</el-menu-item>
2023-05-05 18:11:56 +08:00
</el-menu>
</div>
2023-05-25 17:05:49 +08:00
<div class="header-wraper__right">
<div class="header_user_wraper">
<div class="header_user_wraper_inn">
2023-09-27 09:51:15 +08:00
<div class="state-item">{{ topInfo.agvrun_status_name }}</div>
2023-05-25 17:05:49 +08:00
<div class="state-line"></div>
2023-09-27 09:51:15 +08:00
<div class="state-item">{{ topInfo.automatic_status_name }}</div>
2023-06-01 09:34:14 +08:00
<!-- <div class="state-line"></div> -->
<!-- <div class="state-item">中文&nbsp;<i class="icon_dropdown"></i></div> -->
2023-05-25 17:05:49 +08:00
</div>
</div>
<div class="header_user_wraper">
<div class="header_user_wraper_inn">
<div class="elec-qty-wrap">
2023-09-27 09:51:15 +08:00
<div class="elec-qty" :style="{height: Number(topInfo.electric) + '%', backgroundColor: Number(topInfo.electric) <= 40 ? 'fa6400' : '#54c0b3'}"></div>
2023-05-25 20:29:25 +08:00
<div class="elec-qty-top"></div>
2023-05-25 17:05:49 +08:00
</div>
2023-09-27 09:51:15 +08:00
<div class="elec-txt">{{ topInfo.electric }}%</div>
2023-05-25 17:05:49 +08:00
</div>
2023-05-05 18:11:56 +08:00
</div>
2023-05-24 19:14:20 +08:00
<div class="header_user_wraper">
<div class="header_user_wraper_inn" @click="showDropdown">
<div class="iconfont icon_admin"></div>
<div class="elec-txt">{{ username }}</div>
</div>
<div v-show="dropdown" class="header_dropdown_wraper">
<ul>
<li @click="showDialog">修改密码</li>
<li @click="toEixt">退出</li>
</ul>
<div class="popper__arrow"></div>
</div>
</div>
2023-05-25 17:05:49 +08:00
<div class="time-container">
<jxTime></jxTime>
</div>
2023-05-05 18:11:56 +08:00
</div>
</div>
2023-05-30 14:04:57 +08:00
<div class="body-conatiner">
<div v-show="$route.path !== '/index/teach'" class="side-bar-container">
<el-menu :default-active="$route.meta.guidePath" @select="handleSelectChild">
<el-menu-item :index="menu.index" v-for="menu in childmenus" :key="menu.index">{{menu.label}}</el-menu-item>
</el-menu>
</div>
<router-view></router-view>
</div>
2023-05-24 19:14:20 +08:00
<jxDialog
ref="child"
title="修改密码"
:unclick="unclick"
@toSure="toSureDialog"
2023-06-19 18:23:45 +08:00
@toCancle="toCancle"
2023-05-24 19:14:20 +08:00
>
<div class="form_wraper">
<div class="form">
<div class="form_item">
<div class="form_item__label"><i>*</i>旧的密码</div>
<div class="form_item__content">
2023-06-19 18:23:45 +08:00
<input type="password" class="form_item__input" v-model="oldpassword" @focus="show" data-layout="normal">
2023-05-24 19:14:20 +08:00
</div>
</div>
</div>
<div class="form">
<div class="form_item">
<div class="form_item__label"><i>*</i>新的密码</div>
<div class="form_item__content">
2023-06-19 18:23:45 +08:00
<input type="password" class="form_item__input" v-model="newpassword1" @focus="show" data-layout="normal">
2023-05-24 19:14:20 +08:00
</div>
</div>
</div>
<div class="form">
<div class="form_item">
<div class="form_item__label"><i>*</i>新的密码</div>
<div class="form_item__content">
2023-06-19 18:23:45 +08:00
<input type="password" class="form_item__input" v-model="newpassword2" @focus="show" data-layout="normal">
2023-05-24 19:14:20 +08:00
</div>
</div>
</div>
</div>
</jxDialog>
2023-06-19 18:23:45 +08:00
<vue-touch-keyboard id="keyboard" :options="options" v-if="visible" :layout="layout" :cancel="hide" :accept="accept" :input="input" :next="next" />
2023-05-05 18:11:56 +08:00
</div>
</template>
<script>
2023-05-08 15:39:30 +08:00
import jxTime from '@components/time.vue'
2023-05-24 19:14:20 +08:00
import jxDialog from '@components/dialog.vue'
2023-07-03 20:10:05 +08:00
import { queryHomePage } from '@/config/getData.js'
2023-09-27 09:51:15 +08:00
import { updatePass, sysMenuBuild, authLogout } from '@config/getData2.js'
2023-06-01 09:34:14 +08:00
import {encrypt} from '../../../main.js'
2023-05-05 18:11:56 +08:00
export default {
2023-05-05 18:45:49 +08:00
components: {
2023-05-24 19:14:20 +08:00
jxTime,
jxDialog
2023-05-05 18:45:49 +08:00
},
2023-05-05 18:11:56 +08:00
data () {
return {
2023-09-27 09:51:15 +08:00
itime: this.$store.getters.setTime,
timer: null,
2023-05-24 09:58:28 +08:00
username: this.$store.getters.userInfo !== '' ? JSON.parse(this.$store.getters.userInfo).user.username : '',
2023-06-05 20:01:27 +08:00
menus: [] || JSON.parse(this.$store.getters.menus),
// menus: [{
// label: '首页',
// index: '1',
// router: '',
// children: [{
// label: '首页',
// index: '1',
// router: '/index/home'
// }]
// }, {
// label: '任务管理',
// index: '2',
// router: '',
// children: [{
// label: '搬运站点',
// index: '1',
// router: '/index/carrypoint'
// }, {
// label: '任务列表',
// index: '2',
// router: '/index/tasklists'
// }, {
// label: '任务操作',
// index: '3',
// router: '/index/taskoperates'
// }]
// }, {
// label: '故障管理',
// index: '3',
// router: '',
// children: [{
// label: '故障信息',
// index: '1',
// router: '/index/errorinfo'
// }, {
// label: '故障处理',
// index: '2',
// router: '/index/errordeal'
// }]
// }, {
// label: '车辆信息',
// index: '4',
// router: '',
// children: [{
// label: '车辆状态',
// index: '1',
// router: '/index/vehiclestatus'
// }, {
// label: '车辆控制',
// index: '2',
// router: '/index/vehiclecontrol'
// }]
// }, {
// label: '示教',
// index: '5',
// router: '/index/teach'
// }, {
// label: '系统管理',
// index: '6',
// router: '',
// children: [{
// label: '用户管理',
// index: '1',
// router: '/index/user'
// }, {
// label: '角色管理',
// index: '2',
// router: '/index/role'
// }, {
// label: '系统参数',
// index: '3',
// router: '/index/system'
// }, {
// label: '开发者选项',
// index: '4',
// router: '/index/developer'
// }]
// }],
2023-05-24 19:14:20 +08:00
dropdown: false,
oldpassword: '',
newpassword1: '',
newpassword2: '',
2023-06-19 18:23:45 +08:00
unclick: false,
visible: false,
layout: 'normal',
input: null,
options: {
useKbEvents: false,
preventClickEvent: false
2023-07-03 20:10:05 +08:00
},
2023-09-27 09:51:15 +08:00
topInfo: {}
2023-05-24 19:14:20 +08:00
}
},
2023-05-30 14:04:57 +08:00
computed: {
routerPath () {
return this.$route.meta.jumpPath
},
childmenus () {
2023-06-05 20:01:27 +08:00
let res = []
2023-07-03 19:29:18 +08:00
this.menus.map(el => {
if (el.index === this.$route.meta.jumpPath) {
res = el.children
}
})
2023-06-05 20:01:27 +08:00
return res
2023-05-30 14:04:57 +08:00
}
},
2023-05-24 19:14:20 +08:00
watch: {
oldpassword (val) {
if (val === '' || this.newpassword1 === '' || this.newpassword2 === '') {
this.unclick = true
} else {
this.unclick = false
}
},
newpassword1 (val) {
if (val === '' || this.oldpassword === '' || this.newpassword2 === '') {
this.unclick = true
} else {
this.unclick = false
}
},
newpassword2 (val) {
if (val === '' || this.oldpassword === '' || this.newpassword1 === '') {
this.unclick = true
} else {
this.unclick = false
}
2023-05-05 18:11:56 +08:00
}
2023-05-08 15:39:30 +08:00
},
2023-05-30 14:04:57 +08:00
created () {
2023-06-05 20:01:27 +08:00
this._sysMenuBuild()
2023-09-27 09:51:15 +08:00
this._queryHomePage()
this.timer = setInterval(() => {
this._queryHomePage()
}, this.itime)
2023-06-05 20:01:27 +08:00
if (this.menus.length) {
this.menus.map(el => {
if (el.router === this.$route.path) {
this.childmenus = el.children
}
})
}
2023-05-30 14:04:57 +08:00
},
2023-09-27 09:51:15 +08:00
beforeDestroy () {
clearInterval(this.timer)
},
destroyed () {
clearInterval(this.timer)
},
2023-05-08 15:39:30 +08:00
methods: {
handleSelect (key) {
2023-05-24 19:14:20 +08:00
this.dropdown = false
2023-05-30 14:04:57 +08:00
this.menus.map(el => {
if (el.router === '' && el.index === key) {
this.$router.push({ path: el.children[0].router })
}
if (key === '5') {
this.$router.push({ path: el.router })
}
})
},
handleSelectChild (key) {
this.dropdown = false
this.childmenus.map(el => {
if (el.index === key) {
this.$router.push({ path: el.router })
}
2023-05-08 15:39:30 +08:00
})
2023-05-24 19:14:20 +08:00
},
showDropdown () {
this.dropdown = !this.dropdown
},
showDialog () {
this.dropdown = false
this.$refs.child.active = true
this.oldpassword = ''
this.newpassword1 = ''
this.newpassword2 = ''
this.unclick = true
},
toSureDialog () {
this._updatePass()
2023-06-19 18:23:45 +08:00
this.hide()
},
toCancle () {
this.hide()
2023-05-24 19:14:20 +08:00
},
async _updatePass () {
this.$refs.child.disabled = true
if (!this.oldpassword) {
this.toast('旧密码不能为空')
this.$refs.child.disabled = false
return
}
if (!this.newpassword1) {
this.toast('新密码不能为空')
this.$refs.child.disabled = false
return
}
if (!this.newpassword2) {
this.toast('输入新密码')
this.$refs.child.disabled = false
return
}
if (this.newpassword1 !== this.newpassword2) {
this.toast('新密码输入不一致,请重新输入')
this.$refs.child.disabled = false
return
}
try {
2023-06-01 09:34:14 +08:00
let res = await updatePass(encrypt(this.newpassword1), encrypt(this.oldpassword))
2023-05-24 19:14:20 +08:00
this.toast(res.desc)
this.$refs.child.active = false
this.$refs.child.disabled = false
} catch (e) {
this.$refs.child.active = false
this.$refs.child.disabled = false
}
},
2023-06-05 20:01:27 +08:00
async _sysMenuBuild () {
let res = await sysMenuBuild()
this.menus = [...res]
res.map(el => {
if (el.router === this.$route.path) {
this.childmenus = el.children
}
})
this.$store.dispatch('getMenus', [...res])
},
async _authLogout () {
await authLogout()
},
2023-07-03 20:10:05 +08:00
async _queryHomePage () {
let res = await queryHomePage()
if (res.code === '1') {
2023-09-27 09:51:15 +08:00
this.topInfo = res.result
2023-07-03 20:10:05 +08:00
} else {
this.toast(res.desc)
}
},
2023-05-24 19:14:20 +08:00
toEixt () {
this.$store.dispatch('setSignOut')
2023-06-05 20:01:27 +08:00
this._authLogout()
2023-05-24 19:14:20 +08:00
this.$router.push('/login')
2023-06-19 18:23:45 +08:00
},
show (e) {
this.input = e.target
this.layout = e.target.dataset.layout
if (!this.visible) {
this.visible = true
}
},
hide () {
this.visible = false
},
accept () {
this.hide()
},
next () {
let inputs = document.querySelectorAll('input')
let found = false;
[].forEach.call(inputs, (item, i) => {
if (!found && item === this.input && i < inputs.length - 1) {
found = true
this.$nextTick(() => {
inputs[i + 1].focus()
})
}
})
if (!found) {
this.input.blur()
this.hide()
}
2023-05-08 15:39:30 +08:00
}
2023-05-05 18:11:56 +08:00
}
}
</script>
<style lang="stylus" scoped>
@import '~@style/mixin'
.index-container
2023-09-27 09:51:15 +08:00
position relative
2023-05-08 15:39:30 +08:00
_wh(100%, 100%)
2023-05-05 18:11:56 +08:00
.header-container
2023-10-08 10:52:53 +08:00
position fixed
2023-05-25 17:05:49 +08:00
left 0
top 0
z-index 150
2023-05-05 18:45:49 +08:00
_fj()
2023-05-25 17:05:49 +08:00
_wh(100%, 81px)
line-height 79px
2023-05-05 18:45:49 +08:00
padding 0 10px
2023-05-25 17:05:49 +08:00
border-bottom 1px solid #f1f1f1
background-color #fff
2023-05-05 18:11:56 +08:00
.title-container
2023-05-05 18:45:49 +08:00
_fj(center)
2023-05-25 17:05:49 +08:00
_wh(300px, 100%)
img
_wh(100%, auto)
2023-05-05 18:11:56 +08:00
.horizontal-menu-container
2023-05-25 17:05:49 +08:00
height 100%
padding 0 10px
>>>.el-menu--horizontal>.el-menu-item
2023-05-30 14:04:57 +08:00
line-height 80px
height 80px
2023-10-08 10:52:53 +08:00
font-size 18px
2023-05-30 14:04:57 +08:00
>>>.el-menu.el-menu--horizontal
border-bottom 0
2023-05-08 15:39:30 +08:00
.time-container
_fj()
2023-05-05 18:11:56 +08:00
.state-item
border 1px solid #54C0B3
border-radius 4px
2023-10-08 10:52:53 +08:00
_font(16px,32px,#54C0B3,,center)
padding 0 15px
2023-05-05 18:11:56 +08:00
.state-line
2023-10-08 10:52:53 +08:00
_wh(2px,32px)
2023-05-05 18:11:56 +08:00
opacity 0.3
background #8991A6
2023-07-03 18:05:45 +08:00
margin 0 20px
2023-05-05 18:11:56 +08:00
.elec-qty-wrap
position relative
2023-07-03 18:05:45 +08:00
width 30px
height 60px
2023-05-05 18:11:56 +08:00
border 1px solid #dddddd
2023-05-25 17:05:49 +08:00
margin-right 5px
2023-05-25 20:29:25 +08:00
border-radius 2px
z-index 151
2023-05-05 18:11:56 +08:00
.elec-qty
position absolute
width 100%
2023-10-08 10:52:53 +08:00
height 100%
2023-05-05 18:11:56 +08:00
left 0
bottom 0
2023-05-25 20:29:25 +08:00
.elec-qty-top
position absolute
_wh(8px, 3px)
top -3px
left 50%
transform translateX(-50%)
z-index 152
border 1px solid #ddd
2023-05-05 18:11:56 +08:00
.elec-txt
2023-10-08 10:52:53 +08:00
_font(16px, 60px, #909399,,left)
2023-05-05 18:11:56 +08:00
.icon_admin
2023-07-03 18:05:45 +08:00
_font(32px, 60px, #54C0B3,,left)
2023-05-08 15:39:30 +08:00
margin-right 2px
>>>.el-menu
border-right none
2023-05-25 17:05:49 +08:00
.header-wraper__right
height 100%
_fj(flex-end)
2023-05-24 19:14:20 +08:00
.header_user_wraper
padding 0 10px
2023-05-25 17:05:49 +08:00
height 100%
2023-05-24 19:14:20 +08:00
position relative
&:hover
background-color #f0f0f0
.header_user_wraper_inn
_fj()
_wh(100%, 100%)
2023-10-08 10:52:53 +08:00
padding 0 15px
2023-05-24 19:14:20 +08:00
.header_dropdown_wraper
position absolute
2023-05-25 17:05:49 +08:00
top 90%
2023-05-30 14:04:57 +08:00
left 50%
transform translateX(-50%)
2023-05-24 19:14:20 +08:00
z-index 1000
width 100%
2023-05-30 14:04:57 +08:00
min-width 100px
2023-05-24 19:14:20 +08:00
background-color #fff
border 1px solid #ebeef5
border-radius 4px
box-shadow 0 2px 12px 0 rgba(0,0,0,.1)
padding 10px 0
ul
width 100%
li
width 100%
2023-10-08 10:52:53 +08:00
_font(16px, 32px, #909399,,center)
2023-05-24 19:14:20 +08:00
padding 0 10px
&:hover
background-color #ffc3a7
color #fd6a35
.popper__arrow
position absolute
width: 0;
height: 0;
border-color: transparent;
border-style: solid;
border-width: 6px;
filter: drop-shadow(0 2px 12px rgba(0,0,0,.03))
top: -6px;
2023-05-30 14:04:57 +08:00
left: 50%;
transform: translateX(-6px)
2023-05-24 19:14:20 +08:00
margin-right: 3px;
border-top-width: 0;
border-bottom-color: #ebeef5;
&:after
position: absolute;
display: block;
width: 0;
height: 0;
border-color: transparent;
border-style: solid;
content: " ";
border-width: 6px;
top: 1px;
margin-left: -6px;
border-top-width: 0;
border-bottom-color: #fff;
2023-05-30 14:04:57 +08:00
.side-bar-container
>>>.el-menu-item a
color #909399
2023-07-03 18:05:45 +08:00
>>>.el-menu-item
2023-10-08 10:52:53 +08:00
font-size 18px
2023-07-03 18:05:45 +08:00
line-height 80px
height 80px
2023-05-30 14:04:57 +08:00
>>>.is-active
background-color: #ecf5ff
>>>.is-active a
color #409EFF
2023-05-05 18:11:56 +08:00
</style>