This commit is contained in:
zhutianqi
2021-06-29 15:19:46 +08:00
parent 3e42e33914
commit 708cdd904f
3 changed files with 61 additions and 12 deletions
@@ -101,10 +101,13 @@ export default {
this.getTree()
this.modalshowflag = false
this.$message.success('成功')
} else {
this.$message.warning(res.message)
}
})
},
Add () {
this.NewForm.menuName = ''
this.modalshowflag = true
},
closeDialog () {
+18 -1
View File
@@ -34,7 +34,7 @@
width="170px">
</el-table-column>
<el-table-column
prop=""
prop="NameList"
label="绑定角色">
</el-table-column>
<el-table-column
@@ -88,7 +88,9 @@
v-if="modalRole"
:props="props"
:data="roleList"
:default-checked-keys="nodeList"
check-strictly
default-expand-all
show-checkbox>
</el-tree>
<div id="roleFormButton" class="demo-drawer-footer">
@@ -111,6 +113,7 @@
name: 'PostManage',
data () {
return {
nodeList: [],
submitLoading: false,
selectList: [],
data: [],
@@ -161,6 +164,7 @@
this.selectList = val
},
addRole () { // 点击配置角色按钮
this.nodeList = this.selectList[0].idList
if (this.selectList.length === 1) {
this.modalRole = true
} else if (this.selectList.length === 0) {
@@ -174,6 +178,19 @@
_this: this,
loading: 'Loading'
}, res=> {
res.data.forEach((item)=>{
var idList = []
var NameList = ''
item.roles.forEach((items)=>{
if (NameList.length > 0) {
NameList += ','
}
idList.push(items.id)
NameList += items.name
})
item.idList = idList
item.NameList = NameList
})
this.data = res.data
})
},
+40 -11
View File
@@ -80,18 +80,25 @@
title="系统菜单"
:visible.sync="modalshowflag"
:wrapperClosable="false"
@close="closeDialog"
size="800px">
<el-tree
node-key="id"
class="filter-tree"
:data="treeData2"
:props="defaultProps2"
:default-checked-keys="nodeList"
default-expand-all
check-strictly
show-checkbox
ref="tree">
</el-tree>
<div class="myDialog">
<el-tree
v-if="modalshowflag"
node-key="id"
class="filter-tree"
:data="treeData2"
:props="defaultProps2"
:default-checked-keys="nodeList"
default-expand-all
show-checkbox
ref="tree2">
</el-tree>
</div>
<div slot="footer">
<el-button class="common-button-default" size="mini" icon="el-icon-close" @click="closeDialog">取消</el-button>
<el-button class="common-button-primary" size="mini" icon="el-icon-check" type="primary" @click="confirmDialog">确定</el-button>
</div>
</el-dialog>
</div>
</template>
@@ -122,6 +129,22 @@ export default {
}
},
methods: {
closeDialog () {
this.nodeList = []
this.modalshowflag = false
},
confirmDialog () {
this.$http.postData('sarRole/role/menu', {
menuIds: this.$refs.tree2.getCheckedKeys().concat(this.$refs.tree2.getHalfCheckedKeys()),
roleId: this.id
}, {}, res=> {
console.log(res);
if (res.ok) {
this.$message.success('设置权限成功')
this.modalshowflag = false
}
})
},
getTree2 () {
this.$http.get('lawss/sarMenu', {}, {}, res=> {
if (res.ok) {
@@ -243,6 +266,12 @@ export default {
}
}
}
.myDialog {
/deep/.el-tree {
height: 300px;
overflow: auto;
}
}
/deep/.el-select__tags {
overflow-x: hidden;
}