|
@@ -14,26 +14,27 @@
|
|
|
|
|
|
<div style="margin: 10px 0">
|
|
<div style="margin: 10px 0">
|
|
<el-button type="primary" @click="handleAdd">新增<i class="el-icon-circle-plus"></i></el-button>
|
|
<el-button type="primary" @click="handleAdd">新增<i class="el-icon-circle-plus"></i></el-button>
|
|
- <el-popconfirm
|
|
|
|
- class="ml-5"
|
|
|
|
- confirm-button-text='好的'
|
|
|
|
- cancel-button-text='不用了'
|
|
|
|
- icon="el-icon-info"
|
|
|
|
- icon-color="red"
|
|
|
|
- title="确定删除吗?"
|
|
|
|
- @confirm="delBatch"
|
|
|
|
|
|
+<!-- <el-popconfirm-->
|
|
|
|
+<!-- class="ml-5"-->
|
|
|
|
+<!-- confirm-button-text='好的'-->
|
|
|
|
+<!-- cancel-button-text='不用了'-->
|
|
|
|
+<!-- icon="el-icon-info"-->
|
|
|
|
+<!-- icon-color="red"-->
|
|
|
|
+<!-- title="确定删除吗?"-->
|
|
|
|
+<!-- @confirm="delBatch"-->
|
|
|
|
+
|
|
|
|
+<!-- >-->
|
|
|
|
+<!-- <el-button type="danger" slot="reference">批量删除<i class="el-icon-delete"></i></el-button>-->
|
|
|
|
+<!-- </el-popconfirm>-->
|
|
|
|
|
|
- >
|
|
|
|
- <el-button type="danger" slot="reference">批量删除<i class="el-icon-delete"></i></el-button>
|
|
|
|
- </el-popconfirm>
|
|
|
|
<!-- <el-upload-->
|
|
<!-- <el-upload-->
|
|
<!-- action="http://localhost:9090/user/import" :show-file-list="false" accept=".xlsx" :on-success="handleImportSuccess" style="display: inline-block">-->
|
|
<!-- action="http://localhost:9090/user/import" :show-file-list="false" accept=".xlsx" :on-success="handleImportSuccess" style="display: inline-block">-->
|
|
<!-- <el-button type="primary" class="ml-5" >导入<i class="el-icon-upload2"></i></el-button>-->
|
|
<!-- <el-button type="primary" class="ml-5" >导入<i class="el-icon-upload2"></i></el-button>-->
|
|
<!-- </el-upload>-->
|
|
<!-- </el-upload>-->
|
|
- <el-button type="primary" @click="exp" class="ml-5">导出<i class="el-icon-download"></i></el-button>
|
|
|
|
|
|
+<!-- <el-button type="primary" @click="exp" class="ml-5">导出<i class="el-icon-download"></i></el-button>-->
|
|
|
|
|
|
</div>
|
|
</div>
|
|
- <el-table :data="tableData" border stripe :header-cell-class-name="'headerBg'" @selection-change="handleSelectionChange">
|
|
|
|
|
|
+ <el-table :data="tableData" border stripe :header-cell-style="{background: '#b1ee78' }" @selection-change="handleSelectionChange">
|
|
<el-table-column
|
|
<el-table-column
|
|
type="selection"
|
|
type="selection"
|
|
width="55">
|
|
width="55">
|
|
@@ -52,7 +53,7 @@
|
|
<!-- </el-table-column>-->
|
|
<!-- </el-table-column>-->
|
|
<el-table-column label="操作">
|
|
<el-table-column label="操作">
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
- <el-button type="success" @click="handleEdit(scope.row)" icon="el-icon-edit ">编辑</el-button>
|
|
|
|
|
|
+ <el-button type="success" @click="handleEdit(scope.row)" icon="el-icon-edit " :style="{display: authorizeVisible}">编辑</el-button>
|
|
<el-popconfirm
|
|
<el-popconfirm
|
|
class="ml-5"
|
|
class="ml-5"
|
|
confirm-button-text='好的'
|
|
confirm-button-text='好的'
|
|
@@ -60,11 +61,13 @@
|
|
icon="el-icon-info"
|
|
icon="el-icon-info"
|
|
icon-color="red"
|
|
icon-color="red"
|
|
title="确定删除吗?"
|
|
title="确定删除吗?"
|
|
- @confirm="del(scope.row.id)"
|
|
|
|
|
|
+ @confirm="del(scope.row)"
|
|
|
|
|
|
>
|
|
>
|
|
- <el-button type="danger" slot="reference" icon="el-icon-remove">删除</el-button>
|
|
|
|
|
|
+ <el-button type="danger" slot="reference" icon="el-icon-remove" :style="{display: authorizeVisible}">删除</el-button>
|
|
</el-popconfirm>
|
|
</el-popconfirm>
|
|
|
|
+ <el-button type="warning" disabled :style="{display: normalVisible}">对不起!您暂无权限</el-button>
|
|
|
|
+
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
</el-table>
|
|
</el-table>
|
|
@@ -84,11 +87,11 @@
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<el-dialog title="用户信息" :visible.sync="dialogFormVisible" width="30%">
|
|
<el-dialog title="用户信息" :visible.sync="dialogFormVisible" width="30%">
|
|
- <el-form label-width="80px" size="small">
|
|
|
|
- <el-form-item label="用户名" :label-width="formLabelWidth">
|
|
|
|
|
|
+ <el-form label-width="80px" size="small" :rules="rules" :model="form">
|
|
|
|
+ <el-form-item label="用户名" :label-width="formLabelWidth" prop="username">
|
|
<el-input v-model="form.username" autocomplete="off"></el-input>
|
|
<el-input v-model="form.username" autocomplete="off"></el-input>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
- <el-form-item label="角色" :label-width="formLabelWidth" >
|
|
|
|
|
|
+ <el-form-item label="角色" :label-width="formLabelWidth" v-show="form.nickname !== '超级管理员'">
|
|
<!-- <el-input v-model="form.nickname" autocomplete="off"></el-input>-->
|
|
<!-- <el-input v-model="form.nickname" autocomplete="off"></el-input>-->
|
|
<el-select v-model="form.nickname" placeholder="请选择">
|
|
<el-select v-model="form.nickname" placeholder="请选择">
|
|
<el-option
|
|
<el-option
|
|
@@ -145,6 +148,15 @@ export default {
|
|
}],
|
|
}],
|
|
user: {},
|
|
user: {},
|
|
|
|
|
|
|
|
+ rules:{
|
|
|
|
+ username:[
|
|
|
|
+ { required: true, message: '请输入用户名', trigger: 'blur' },
|
|
|
|
+ ]
|
|
|
|
+ },
|
|
|
|
+ authorizeVisible: '',
|
|
|
|
+ normalVisible: ''
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|
|
},
|
|
},
|
|
created() {
|
|
created() {
|
|
@@ -153,6 +165,12 @@ export default {
|
|
this.user = JSON.parse(user)
|
|
this.user = JSON.parse(user)
|
|
if (this.user.nickname === '员工'){
|
|
if (this.user.nickname === '员工'){
|
|
window.top.location.href = '/'
|
|
window.top.location.href = '/'
|
|
|
|
+ }else if (this.user.nickname === '超级管理员'){
|
|
|
|
+ this.authorizeVisible = ''
|
|
|
|
+ this.normalVisible = 'none'
|
|
|
|
+ }else {
|
|
|
|
+ this.authorizeVisible = 'none'
|
|
|
|
+ this.normalVisible = ''
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -178,6 +196,9 @@ export default {
|
|
},
|
|
},
|
|
|
|
|
|
save(){
|
|
save(){
|
|
|
|
+ // if (this.form.nickname === '超级管理员'){
|
|
|
|
+ //
|
|
|
|
+ // }else
|
|
if(this.form.id){
|
|
if(this.form.id){
|
|
this.request.post("/user",this.form).then(res =>{
|
|
this.request.post("/user",this.form).then(res =>{
|
|
if(res){
|
|
if(res){
|
|
@@ -232,15 +253,20 @@ export default {
|
|
this.form = Object.assign({},row)
|
|
this.form = Object.assign({},row)
|
|
this.dialogFormVisible = true
|
|
this.dialogFormVisible = true
|
|
},
|
|
},
|
|
- del(id){
|
|
|
|
- this.request.delete("/user/" + id).then(res =>{
|
|
|
|
- if(res){
|
|
|
|
- this.$message.success("删除成功")
|
|
|
|
- this.load()
|
|
|
|
- }else {
|
|
|
|
- this.$message.error("删除失败")
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
|
|
+ del(row){
|
|
|
|
+ if (row.nickname === "超级管理员"){
|
|
|
|
+ this.$message.error("超级管理员账号不可删除")
|
|
|
|
+ }else {
|
|
|
|
+ this.request.delete("/user/" + row.id).then(res =>{
|
|
|
|
+ if(res){
|
|
|
|
+ this.$message.success("删除成功")
|
|
|
|
+ this.load()
|
|
|
|
+ }else {
|
|
|
|
+ this.$message.error("删除失败")
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+
|
|
},
|
|
},
|
|
delBatch(){
|
|
delBatch(){
|
|
let ids = this.multipleSelection.map(v => v.id)
|
|
let ids = this.multipleSelection.map(v => v.id)
|
|
@@ -283,5 +309,7 @@ export default {
|
|
<style>
|
|
<style>
|
|
.headerBg{
|
|
.headerBg{
|
|
background:#409EFF
|
|
background:#409EFF
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|
|
</style>
|
|
</style>
|