5 Star 1 Fork 0

已达七 / violet-admin-web

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
administrator.html 15.73 KB
一键复制 编辑 原始数据 按行查看 历史
已达七 提交于 2023-07-04 03:07 . 全代码结构优化,权限完成
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script src="js/vue.js"></script>
<script src="js/axios.min.js"></script>
<script src="js/element-lib/index.js"></script>
<link rel="stylesheet" href="js/element-lib/theme-chalk/index.css">
<link rel="stylesheet" href="css/main.css">
<script src="js/main.js"></script>
</head>
<body>
<div id="app">
<el-container class="home-container">
<el-container class="box">
<el-aside :width="isCollapse ? '64px' : '200px'">
<div class="toggle-button" @click="toggleCollapse">
<i :class="isCollapse ? 'el-icon-s-unfold' : 'el-icon-s-fold'"></i>
</div>
<!-- 导航栏 -->
<el-menu :default-active="menuActive" class="el-menu-vertical-demo" :collapse="isCollapse"
unique-opened>
<!-- 一级菜单 -->
<a :href="menu.permissionUrl" v-if="menu.children == null" v-for="menu in menuList"
:key="menu.id">
<el-menu-item :index="menu.id+''">
<i :class="menu.menuIcon"></i>
<span>{{menu.permissionName}}</span>
</el-menu-item>
</a>
<el-submenu v-if="menu.children != null" :index="menu.id+''" v-for="menu in menuList"
:key="menu.id">
<template slot="title">
<i :class="menu.menuIcon"></i>
<span slot="title">{{menu.permissionName}}</span>
</template>
<!-- 二级菜单 -->
<a :href="secondaryMenu.permissionUrl" v-for="secondaryMenu in menu.children"
:key="secondaryMenu.id">
<el-menu-item :index="secondaryMenu.id+''">
<i :class="secondaryMenu.menuIcon"></i>
<span>{{secondaryMenu.permissionName}}</span>
</el-menu-item>
</a>
</el-submenu>
</el-menu>
</el-aside>
<el-container>
<el-header>
<div>
<img src="img/logo.png" class="log">
<span>紫罗兰后台管理系统</span>
</div>
<el-button type="danger" @click="logOff()">退出</el-button>
</el-header>
<el-main>
<div style="padding: 10px;width: 97%;height:90px;border: 1px solid rgb(223, 223, 239);">
<i class="el-icon-search" style="float: left;">筛选搜索</i>
<form style="float: right;">
<el-button type="primary" @click="getAdministratorInfoPagingList"
icon="el-icon-search">搜索</el-button>
<el-button @click="Reset()">重置</el-button>
</form>
<form id="search-box">
管理员状态:
<el-select v-model="enable" placeholder="选择管理员状态">
<el-option label="所有"></el-option>
<el-option label="已启用" value=true></el-option>
<el-option label="未启用" value=false></el-option>
</el-select>
管理员姓名:
<el-input style="width: 150px;" v-model="administratorInfoName" placeholder="请输入管理员姓名"
clearable></el-input>
创建时间:
<el-date-picker type="date" v-model="administratorAddTime" value-format="yyyy-MM-dd"
placeholder="选择日期"></el-date-picker>
</form>
</div>
<el-table :data="administratorInfoData" stripe style="width: 100%">
<el-table-column prop="id" label="编号" width="50" align="center">
</el-table-column>
<el-table-column prop="administratorInfoName" label="管理员姓名" width="160" align="center">
<template slot-scope="scope">
<el-popover trigger="hover" placement="top">
<p>电话号码: {{ scope.row.administratorInfoPhoneNumber }}</p>
<p>邮箱: {{ scope.row.administratorInfoEmail }}</p>
<div slot="reference" class="name-wrapper">
<el-tag size="medium">{{ scope.row.administratorInfoName }}</el-tag>
</div>
</el-popover>
</template>
</el-table-column>
<el-table-column prop="administratorUserName" label="管理员账号" width="150" align="center">
</el-table-column>
<el-table-column prop="pwd" label="管理员密码" width="150" align="center">
</el-table-column>
<el-table-column prop="administratorAddTime" label="创建时间" width="160" align="center">
</el-table-column>
<el-table-column prop="administratorLastLoginTime" label="上次登录时间" width="160"
align="center">
</el-table-column>
<el-table-column prop="enable" label="是否启用" width="80" align="center">
<template slot-scope="scope">
<el-switch v-model="scope.row.enable">
</el-switch>
</template>
</el-table-column>
<el-table-column label="操作" width="150" align="center">
<template slot-scope="scope">
<el-row style="text-align: center;">
<!-- <el-col>
<el-link type="primary" @click="jumpPermission(scope.row.id)">分配菜单</el-link>
<el-link type="primary">分配资源</el-link>
</el-col> -->
<el-col>
<el-link type="primary"
@click="displayAssigningRoles(scope.row.id)">分配角色</el-link>
<el-link type="primary">编辑</el-link>
<el-popconfirm title="确定删除吗?" @confirm="deleteById(scope.row.id)">
<el-link slot="reference" type="primary">删除</el-link>
</el-popconfirm>
</el-col>
</el-row>
</template>
</el-table-column>
</el-table>
<el-dialog title="分配角色" :visible.sync="assigningRolesDialog " width="30%"
:before-close="handleClose">
<el-select v-model="selectedAdministratorTypes" multiple placeholder="请选择">
<el-option v-for="item in administratorTypes" :key="item.id"
:label="item.administratorTypeName" :value="item.id">
</el-option>
</el-select>
<span slot="footer" class="dialog-footer">
<el-button @click="assigningRolesDialog = false">取 消</el-button>
<el-button type="primary" @click="assigningRoles()">
</el-button>
</span>
</el-dialog>
</el-main>
<el-footer>
<div style="float: left;">
<el-button type="primary">批量删除</el-button>
</div>
<div class="block" style="float: right;">
<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
:current-page="pageNo" :page-sizes="pageSizes" :page-size="pageSize"
layout="total, sizes, prev, pager, next, jumper" :total="totalCount">
</el-pagination>
</div>
</el-footer>
</el-container>
</el-container>
</el-container>
</div>
<script>
let vm = new Vue({
el: "#app",
data() {
return {
isCollapse: false,
menuList: [],
administratorInfoData: [],
menuActive: 0,
pageNo: 1,
pageSize: 2,
pageSizes: [2, 4, 8],
totalCount: 1,
assigningRolesDialog: false,
administratorTypes: [],
selectedAdministratorTypes: [],
waitAssigningRolesId: ""
}
}, created() {
this.getMenuList();
this.getMenuIdByUrl();
this.getAdministratorInfoPagingList(this.pageNo, this.pageSize)
this.getAdministratorTypeIdAndName()
}, methods: {
logOff() {
localStorage.removeItem('nfLoginJwt');
location.href = "login.html"
},
toggleCollapse() {
vm.isCollapse = !vm.isCollapse
},
getMenuList() {
axios({
url: "/menu/get/menu/by/jwt",
method: "GET",
}).then(function (resp) {
if (resp.data.code == 200) {
vm.menuList = resp.data.data
}
})
}, getMenuIdByUrl() {
var strUrl = location.href;
var arrUrl = strUrl.split("/");
var strPage = arrUrl[arrUrl.length - 1];
axios({
url: "/menu/get/menu/id/by/url",
method: "GET",
params: { url: strPage }
}).then(function (resp) {
if (resp.data.code == 200) {
vm.menuActive = resp.data.data
}
})
}, getAdministratorInfoPagingList() {
axios({
url: "/administrator/info/paging/query",
method: "GET",
params: {
pageNo: this.pageNo,
pageSize: this.pageSize,
enable: this.enable == "" ? this.enable = undefined : this.enable,
administratorInfoName: this.administratorInfoName,
administratorAddTime: this.administratorAddTime
}
}).then(function (resp) {
console.log(resp);
if (resp.data.code == 200) {
vm.administratorInfoData = resp.data.data.list
vm.totalCount = resp.data.data.count
}
})
},
handleSizeChange(size) {
this.pageSize = size
this.getAdministratorInfoPagingList()
this.pageNo = 1
},
handleCurrentChange(no) {
this.pageNo = no
this.getAdministratorInfoPagingList(no, this.pageSize,)
}, getAdministratorTypeIdAndName() {
axios({
url: "/administrator/type/get/id/and/name",
method: "GET"
}).then(function (resp) {
vm.administratorTypes = resp.data.data
})
}, displayAssigningRoles(id) {
vm.waitAssigningRolesId = id;
vm.assigningRolesDialog = true;
axios({
url: "/administrator/type/get/id/by/administrator/id",
method: "GET",
params: { administratorId: id }
}).then(resp => {
vm.selectedAdministratorTypes = resp.data.data
})
}, assigningRoles() {
axios({
url: "/administrator/info/assigning/roles",
method: "POST",
data: {
administratorId: vm.waitAssigningRolesId,
administratorTypeIds: vm.selectedAdministratorTypes
}
}).then(resp => {
vm.assigningRolesDialog = false;
})
}, deleteById(id) {
axios({
url: "/administrator/info/delete",
methods: "GET",
params: {
id: id
}
}).then(resp => {
if (resp.data.code == 200) {
this.$message({
message: '删除成功',
type: 'success'
});
this.getAdministratorInfoPagingList(this.pageNo, this.pageSize)
}
})
}, displayAssigningRoles(id) {
vm.waitAssigningRolesId = id;
vm.assigningRolesDialog = true;
axios({
url: "/administrator/type/get/id/by/administrator/id",
method: "GET",
params: { administratorId: id }
}).then(resp => {
vm.selectedAdministratorTypes = resp.data.data
})
}, getAdministratorTypeIdAndName() {
axios({
url: "/administrator/type/get/id/and/name",
method: "GET"
}).then(function (resp) {
vm.administratorTypes = resp.data.data
})
}
}
})
</script>
</body>
</html>
1
https://gitee.com/liu-xuejing/front-end-of-violet.git
git@gitee.com:liu-xuejing/front-end-of-violet.git
liu-xuejing
front-end-of-violet
violet-admin-web
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891