| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353 |
- <template>
- <div id="menu">
- <div style="width: 100%; height: 100%; display: flex;flex-direction: row">
- <div style="height: 100vh;background-color: rgb(84,92,100); ">
- <el-menu
- class="el-menu-vertical-demo"
- :collapse="isCollapse"
- background-color="#545c64"
- text-color="#fff"
- active-text-color="#993333"
- :router=true
- :default-active="$route.name"
- @open="handleOpen"
- @close="handleClose">
- <div class="logo" style="height: 50px; background-color:rgb(84,92,100)">
- <div class="img">
- <img src="" alt="" style="height: 100%">
- </div>
- </div>
- <el-menu-item index="/">
- <i class="el-icon-location"></i>
- <span slot="title">数据可视化大屏</span>
- </el-menu-item>
- <el-menu-item index="/operator">
- <i class="el-icon-location"></i>
- <span slot="title">运营商管理</span>
- </el-menu-item>
- <el-menu-item index="/project">
- <i class="el-icon-location"></i>
- <span slot="title">项目管理</span>
- </el-menu-item>
- <el-menu-item index="/gateway">
- <i class="el-icon-location"></i>
- <span slot="title">网关管理</span>
- </el-menu-item>
- <el-submenu index="3-2" style="display: flex;flex-direction:column">
- <template slot="title">
- <i class="el-icon-location"></i>
- <span @click="device(index)">设备管理</span>
- </template>
- <el-menu-item-group>
- <el-menu-item index="/">运行状态</el-menu-item>
- <el-menu-item index="/">数据曲线</el-menu-item>
- <el-menu-item index="/">参数设定</el-menu-item>
- <el-menu-item index="/">系统参数</el-menu-item>
- <el-menu-item index="/deviceAlarmConfig">报警设置</el-menu-item>
- <el-menu-item index="/detail">报警记录</el-menu-item>
- <el-menu-item index="/deviceAlarmRepairRecord">维保记录</el-menu-item>
- </el-menu-item-group>
- </el-submenu>
- <el-menu-item index="/deviceAlarmRecord">
- <i class="el-icon-location"></i>
- <span slot="title">报警管理</span>
- </el-menu-item>
- <el-menu-item index="/operatorLog">
- <i class="el-icon-location"></i>
- <span slot="title">操作日志</span>
- </el-menu-item>
- <el-menu-item index="/user">
- <i class="el-icon-location"></i>
- <span slot="title">用户管理</span>
- </el-menu-item>
- <el-submenu index="7" style="display: flex;flex-direction:column">
- <template slot="title">
- <i class="el-icon-location"></i>
- <span>权限设置</span>
- </template>
- <el-menu-item-group>
- <el-menu-item index="/role">角色管理</el-menu-item>
- <el-menu-item index="/power">权限管理</el-menu-item>
- <el-menu-item index="/rolePower">关联角色权限</el-menu-item>
- </el-menu-item-group>
- </el-submenu>
- </el-menu>
- </div>
- <div style="width: 90% ; float: right">
- <el-header class="header" style="height: 80px;">
- <!-- 点击展开收起导航和切换对应图标 -->
- <i class="el-icon-s-fold" @click="isC" v-show="block"></i>
- <i class="el-icon-s-unfold" @click="isC" v-show="toggle"></i>
- <!-- <el-radio-group v-model="isCollapse" style="margin-top: 15px;">-->
- <!-- <el-radio-button :label="false">展开</el-radio-button>-->
- <!-- <el-radio-button :label="true">收起</el-radio-button>-->
- <!-- </el-radio-group>-->
- <el-dropdown style="margin-right: 20px;float: right;margin-top: 10px">
- <i class="el-icon-setting"></i>
- <el-dropdown-menu slot="dropdown">
- <el-dropdown-item @click.native="userInfo">个人中心</el-dropdown-item>
- <el-dropdown-item @click.native="showUpdatePassword">修改密码</el-dropdown-item>
- <el-dropdown-item @click.native="logout">退出登录</el-dropdown-item>
- </el-dropdown-menu>
- </el-dropdown>
- <el-dialog title="修改密码" :visible.sync="dialogFormVisible" style="width: 71% ; margin-left: 300px ;">
- <el-form label-position="left" :model="formData" :rules="rules" ref="formData">
- <el-row style="margin-left: 15px">
- <el-form-item label="原密码" style="margin-left: 0px" prop="oldPassword">
- <el-input v-model="formData.oldPassword"></el-input>
- </el-form-item>
- <el-form-item label="新密码" style="" prop="newPassword">
- <el-input v-model="formData.newPassword"></el-input>
- </el-form-item>
- </el-row>
- </el-form>
- <div slot="footer" class="dialog-footer" style="text-align: center">
- <el-button @click="cancel()">取 消</el-button>
- <el-button type="primary" @click="updatePassword('formData')">确 定</el-button>
- </div>
- </el-dialog>
- <span style="float: right; margin-right: 20px; margin-top: 10px">用户名:{{ realname }}</span>
- </el-header>
- <el-main style="background-color: rgb(245,247,249);height: 100vh">
- <router-view></router-view>
- </el-main>
- </div>
- </div>
- </div>
- </template>
- <script>
- export default {
- name: "menu",
- data() {
- return {
- realname: '',
- dialogFormVisible: false,
- index: '1',
- isCollapse: false,
- toggle: false,//第二个图标默认隐藏
- block: true,//默认显示第一个图标
- formData: {
- oldPassword: '',
- newPassword: ''
- },
- rules: {
- oldPassword: [
- {required: true, message: '请输入原密码', trigger: 'blur'}
- ],
- newPassword: [
- {required: true, message: '请输入新密码', trigger: 'blur'}
- ],
- },
- }
- },
- created: function () {
- let vm = this;
- var userBean = this.$route.query.userBean
- this.realname = userBean.realname
- console.log(this.realname)
- if (this.realname) {
- vm.$router.push('/operator')
- }
- },
- methods: {
- isC() {
- this.isCollapse = !this.isCollapse;
- this.toggle = !this.toggle;
- this.block = !this.block;
- },
- handleOpen(key, keyPath) {
- console.log(key, keyPath);
- }
- ,
- handleClose(key, keyPath) {
- console.log(key, keyPath);
- },
- device() {
- let vm = this;
- vm.$router.push('/device')
- },
- logout() {
- const vm = this;
- vm.$http.get(vm.$api.auth.logout).then((resp) => {
- console.log(resp)
- vm.$router.push('/login')
- this.$message({
- type: 'success',
- showClose: true,
- message: resp.data.desc
- })
- })
- },
- userInfo() {
- const vm = this;
- vm.$http.get(vm.$api.auth.userInfo).then((resp) => {
- vm.$router.push({
- path: '/userInfo',
- query: {data: resp.data.data}
- })
- })
- },
- showUpdatePassword() {
- this.dialogFormVisible = true;
- },
- updatePassword(formName) {
- this.$refs[formName].validate((valid) => {
- if (valid) {
- const vm = this;
- vm.$http.get(vm.$api.auth.updateUserPassword, {
- params: {
- oldPassword: '',
- newPassword: ''
- }
- }).then((resp) => {
- console.log(resp)
- })
- } else {
- console.log('error submit!!');
- return false;
- }
- });
- },
- cancel() {
- this.$message({
- message: '操作取消',
- showClose: true,
- type: 'info'
- });
- this.$refs.formData.clearValidate();
- this.dialogFormVisible = false;
- },
- }
- }
- </script>
- <style>
- .img {
- background-color: darkgrey;
- height: 40px;
- width: 40px;
- margin: auto;
- text-align: center;
- line-height: 100px;
- align-items: center;
- }
- .header {
- height: 64px;
- line-height: 64px;
- /*background-color: darkgrey;*/
- padding: 0 20px;
- position: relative
- }
- /*.el-aside {*/
- /* float: left;*/
- /* background-color: #545c64;*/
- /* text-color: #fff;*/
- /* active-text-color: #993333*/
- /*}*/
- .el-menu {
- float: left;
- background-color: #545c64;
- text-color: #fff;
- }
- .el-menu-vertical-demo:not(.el-menu--collapse) {
- width: 240px;
- }
- .el-main {
- padding: 5px 5px 5px 5px
- }
- .logo {
- margin-top: 20px;
- margin-bottom: 10px;
- }
- .el-icon-s-fold {
- margin-top: 30px;
- width: 20px;
- height: 20px;
- }
- .el-icon-s-unfold {
- margin-top: 30px;
- width: 20px;
- height: 20px;
- }
- .el-button {
- color: black;
- }
- </style>
|