提交 15a02cdc authored 作者: CRS's avatar CRS

合并分支 'crs' 到 'master'

new 查看合并请求 !1
......@@ -140,13 +140,16 @@ export default {
},
mounted(){
let val = this.$store.getters.getSidebar;
val.push(
{
name: '最新动态',
path: 'dynamicList'
}
)
this.$store.commit('changeSidebar', val);
console.log(val[val.length - 1])
if (val[val.length - 1].path !== 'dynamicList') {
val.push(
{
name: '最新动态',
path: 'dynamicList'
}
)
this.$store.commit('changeSidebar', val);
}
},
methods: {
// 点击表格
......
<template>
<div class="person">
<el-row>
<el-col :span="24">
<div class="content">
<p class="title">角色管理</p>
<p class="search">
<span class="searchVal">
<span>角色名称:</span>
<el-input v-model="searchVal" size="medium" placeholder="请输入"></el-input>
</span>
<span class="button" @click="search">搜索</span>
<span class="button new" @click="addrole">新增角色</span>
</p>
<div class="common-table">
<el-table
highlight-current-row
max-height="840"
:data="allData"
stripe
style="width: 100%;margin-bottom: 10px;">
<el-table-column
prop="name"
label="角色"
align="center">
</el-table-column>
<el-table-column
prop="id"
label="人员"
align="center">
<template slot-scope="scope">
<!-- <span class="change"><img src="./img/look.png">查看</span>-->
</template>
</el-table-column>
<el-table-column
prop="authorityList"
label="权限"
align="center">
<template slot-scope="scope">
<!-- <span class="change" @click="readAuthority(scope.row)"><img src="./img/look.png">查看</span>-->
</template>
</el-table-column>
</el-table>
</div>
<!-- 分页 -->
<div class="block" v-if="this.totleLength >= 10">
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page.sync="currentPage"
:page-size="pagesize"
background
layout="prev, pager, next"
:total="totleLength">
</el-pagination>
</div>
<!-- 分页 -->
</div>
</el-col>
</el-row>
<!-- 新增 / 编辑 公用弹窗 -->
<el-dialog :visible.sync="openModel" class="model">
<img src="../../../assets/img/close.png" class="closeModel" @click="reset()">
<component :is="components" @on-cancel="reset"></component>
</el-dialog>
</div>
</template>
<script>
export default {
data () {
return {
searchVal: '',
currentPage: 1, // 分页第一页
pagesize: 8, // 每页个数
totleLength: 0, // 获取后台传的所有数据的长度
openModel: false, // 弹框开关
components: '', // 当前弹框内容
rolename: '', // 角色名称
roleList: '',
allData:[] // 列表内容
}
},
created() {
},
mounted(){
let val = this.$store.getters.getSidebar;
if (val[val.length - 1].path !== 'person') {
val.push(
{
name: '人员管理',
path: 'person'
}
)
this.$store.commit('changeSidebar', val);
}
this.init()
},
methods: {
// 初始请求
init() {
let val;
if (this.searchVal !== '') {
val = {
'page': this.currentPage,
'pageSize': this.pagesize,
't': {
'name': this.searchVal
}
}
} else {
val = {
'page': this.currentPage,
'pageSize': this.pagesize
}
}
this.$server.postsearch(val).then((res) => { // 数据请求
if (res.data.code === 200) {
this.allData = res.data.data.rows;
this.totleLength = res.data.data.total;
}
})
},
// 搜索栏
search() {
this.init();
},
// 点击分页
handleSizeChange(val) {
console.log(`每页 ${val} 条`);
},
// 当前页数
handleCurrentChange(val) {
// console.log(`当前页: ${val}`);
this.currentPage = val;
this.init();
},
// 关闭弹框
reset() {
this.init();
this.openModel = false;
}
},
components: {
},
watch: {
}
}
</script>
<style scoped>
.person{
background: #ebf0f8;
width: 100%;
}
.person .content{
margin: 40px;
height: 841px;
background: #fff;
overflow: hidden;
}
.person .content .title{
padding: 30px 0 0 60px;
font-size: 20px;
color: #233b6e;
}
.person .content .search{
position: relative;
margin-top: 36px;
padding: 0px 70px 0px 70px;
display: flex;
}
.person .content .searchVal{
width: 280px;
display: flex;
font-size: 18px;
color: #4663a6;
}
.person .content .searchVal>span{
width: 140px;
display: inline-block;
line-height: 34px;
}
.person .content .change{
color: #4877e6;
cursor: pointer;
}
.person .content .change>img{
margin-right: 3px;
}
.person .content .common-table{
box-shadow: 4px 4px 5px rgba(72,119,230,0.1);
border: .5px solid transparent;
border-radius: 10px;
}
.person>>>.el-input__inner{
border: 1px solid rgba(8,104,157,.3);
border-radius: 2px;
font-size: 18px;
color: #999;
height: 34px;
line-height: 34px;
width: 180px;
}
.person .content .button{
display: inline-block;
width: 100px;
height: 34px;
line-height: 34px;
text-align: center;
background: #4877e6;
cursor: pointer;
margin-left: 100px;
border-radius: 2px;
color: #fff;
font-size: 18px;
}
.person .content .button:hover{
background: rgba(72,119,230,.6);
}
.person .content .new{
position: absolute;
right: 70px;
}
/*表格样式*/
.person .content .common-table{
margin: 24px 70px 0 70px;
}
.person .content .common-table>>>.el-table th > .cell{
font-size: 18px;
color: #333;
font-weight: normal;
}
.person .content .common-table>>>.el-table th.is-leaf{
height: 70px;
}
.person .content .common-table>>>.el-table tr{
font-size: 18px;
}
.person .content .common-table>>>.el-table{
color: #233b6e;
}
.person .content .common-table>>>.el-table--striped .el-table__body tr.el-table__row--striped.el-table__row--striped.el-table__row--striped td {
background-color: #fff;
}
.person .content .common-table>>>.el-table--enable-row-hover .el-table__body tr:hover>td{
background-color: #f5f8fd;
}
.person .content .common-table>>>.el-table th.is-leaf, .el-table td {
border-bottom: 1px solid #d5e3ff;
}
.person .content .common-table>>>.el-table__body tr, .el-table__body td {
padding: 0;
height: 60px;
background: #f5f8fd;
}
.person .content .block{
text-align: right;
padding: 30px 70px 0 0;
}
.person .content>>>.el-pagination.is-background .el-pager li{
background-image: linear-gradient(to bottom, #c5d5f7,#7a95e6);
color: #fff;
}
.person .content>>>.el-pagination.is-background .el-pager li:not(.disabled).active{
background-image: linear-gradient(to bottom, #7a9eeb,#274acf);
color: #fff;
}
.person .content>>>.el-table td{
border-bottom: 1px solid #d5e3ff;
}
.person .content>>>.btn-prev,.role .content>>>.btn-next{
background: #c5d5f7;
background-image: linear-gradient(to bottom, #c5d5f7,#7a95e6);
color: #fff;
}
.person .content>>>.btn-prev:disabled,.dynamicList .content>>>.btn-next:disabled{
color: #C0C4CC;
}
.person .content>>>.el-table__body tr.current-row > td{
background: #f5f8fd;
}
</style>
......@@ -35,48 +35,7 @@ export default {
props: ['name','list'],
data () {
return {
authority: [
{
"id": 1,
"name": "项目查看",
"des": "只具备查看对项目及项目内容功能,无法对具体内容进行操作"
},
{
"id": 2,
"name": "项目操作",
"des": "能对项目及项目内容进行操作,如文件上传、软替操作等。"
},
{
"id": 3,
"name": "项目管理",
"des": "能对项目及项目内容进行管理性质的操作,如项目新增、审核等。"
},
{
"id": 4,
"name": "系统配置",
"des": "可进入系统配制页面进行配置。"
},
{
"id": 5,
"name": "评价",
"des": "可评价所管理项目的所有参与人员及产品。"
},
{
"id": 6,
"name": "评价管理",
"des": "可查看所有评价。"
},
{
"id": 7,
"name": "用户管理",
"des": "可进入用户管理界面,管理用户。"
},
{
"id": 8,
"name": "态势感知",
"des": "查看态势管理。"
}
],
authority: [],
allAuthority: [],
nameVal: ''
}
......@@ -84,37 +43,66 @@ export default {
created() {
},
mounted(){
// this.$server.getfindAll().then((res) => { // 数据请求
// if (res.data.code === 200) {
// this.authority = res.data.data;
// }
// })
this.init();
this.$server.getfindAll().then((res) => { // 数据请求
if (res.data.code === 200) {
this.authority = res.data.data;
this.init();
}
})
},
methods: {
// 初始请求
init() {
if (this.list !== '') {
console.log(this.list);
this.nameVal = this.list.name;
this.allAuthority = [];
for (let item of this.list.authorities) {
this.allAuthority.push(item.id);
}
setTimeout(()=>{
for (let item of this.allAuthority) {
let val = '.authorityList>span:nth(' + (item - 1) + ')';
$(val).addClass('authorityListClick')
}
},300)
} else {
this.nameVal = this.name;
}
},
// 关闭弹框
cancel() {
this.$emit('on-cancel')
},
// 保存
save() {
console.log(this.nameVal,this.allAuthority);
let val = {
'authorityList': this.allAuthority,
'name': this.nameVal,
}
this.$server.postadd(val).then((res) => { // 数据请求
if (res.data.code === 200) {
this.$message.success('角色新增成功!');
this.cancel();
if (this.list === '') {
let val = {
'authorityList': this.allAuthority,
'name': this.nameVal,
}
this.$server.postadd(val).then((res) => { // 数据请求
if (res.data.code === 200) {
this.$message.success('角色新增成功!');
this.cancel();
}
})
} else {
let val = {
'authorityList': this.allAuthority,
'id': this.list.id,
}
})
this.$server.postupdate(val).then((res) => { // 数据请求
if (res.data.code === 200) {
this.$message.success('角色修改成功!');
this.cancel();
}
})
}
},
// 点击全选/全不选
selected(val) {
if (val === 'y') {
$('.selected').addClass('selectedClick');
......@@ -132,6 +120,7 @@ export default {
}
console.log(this.allAuthority)
},
// 点击选择
clickList(index,row) {
$('.selectedN').removeClass('selectedNClick')
let val = '.authorityList>span:nth(' + (index) + ')'
......
......@@ -75,39 +75,28 @@ export default {
searchVal: '',
currentPage: 1, // 分页第一页
pagesize: 8, // 每页个数
totleLength: 2, // 获取后台传的所有数据的长度
totleLength: 0, // 获取后台传的所有数据的长度
openModel: false, // 弹框开关
components: '', // 当前弹框内容
rolename: '', // 角色名称
roleList: '',
allData:[
{
"id": 2,
"name": "演示角色",
"status": 1,
"authorityList": null
},
{
"id": 1,
"name": "测试角色",
"status": 1,
"authorityList": null
}
]
roleList: '', // 角色内容
allData:[] // 列表内容
}
},
created() {
},
mounted(){
let val = this.$store.getters.getSidebar;
val.push(
{
name: '角色管理',
path: 'role'
}
)
this.$store.commit('changeSidebar', val);
// this.init()
if (val[val.length - 1].path !== 'role') {
val.push(
{
name: '角色管理',
path: 'role'
}
)
this.$store.commit('changeSidebar', val);
}
this.init()
},
methods: {
// 初始请求
......@@ -155,9 +144,11 @@ export default {
},
// 关闭弹框
reset() {
this.init();
this.openModel = false;
this.components = '';
this.rolename = ''
this.rolename = '';
this.roleList = '';
},
// 查看权限
readAuthority(row) {
......@@ -255,6 +246,8 @@ export default {
position: absolute;
right: 70px;
}
/*表格样式*/
.role .content .common-table{
margin: 24px 70px 0 70px;
}
......
......@@ -83,12 +83,6 @@ export default {
this.$router.push({name: path});
let arr = this.$store.getters.getSidebar;
this.$store.commit('changeSidebar', arr.slice(0,index + 1));
let that = this;
setTimeout(function () {
that.sidebar = arr.slice(0,index + 1);
},100)
}
},
computed: {
......
......@@ -126,13 +126,15 @@ export default {
},
mounted(){
let val = this.$store.getters.getSidebar;
val.push(
{
name: '最新动态',
path: 'ZdynamicList'
}
)
this.$store.commit('changeSidebar', val);
if (val[val.length - 1].path !== 'ZdynamicList') {
val.push(
{
name: '最新动态',
path: 'ZdynamicList'
}
)
this.$store.commit('changeSidebar', val);
}
},
methods: {
// 点击表格
......
......@@ -62,6 +62,12 @@ export default new Router({
name: 'role',
component: resolve => require(['../components/basicInformation/role/role.vue'], resolve)
},
// 基础资料管理-人员管理
{
path: '/person',
name: 'person',
component: resolve => require(['../components/basicInformation/person/person.vue'], resolve)
},
]
}
]
......
......@@ -26,6 +26,12 @@ const server = {
method: 'post',
data: data
});
},
postupdate(data) { // 获取角色列表分页
return axios('/role/update', {
method: 'put',
data: data
});
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论