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.getTree()
this.modalshowflag = false this.modalshowflag = false
this.$message.success('成功') this.$message.success('成功')
} else {
this.$message.warning(res.message)
} }
}) })
}, },
Add () { Add () {
this.NewForm.menuName = ''
this.modalshowflag = true this.modalshowflag = true
}, },
closeDialog () { closeDialog () {
+18 -1
View File
@@ -34,7 +34,7 @@
width="170px"> width="170px">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="" prop="NameList"
label="绑定角色"> label="绑定角色">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
@@ -88,7 +88,9 @@
v-if="modalRole" v-if="modalRole"
:props="props" :props="props"
:data="roleList" :data="roleList"
:default-checked-keys="nodeList"
check-strictly check-strictly
default-expand-all
show-checkbox> show-checkbox>
</el-tree> </el-tree>
<div id="roleFormButton" class="demo-drawer-footer"> <div id="roleFormButton" class="demo-drawer-footer">
@@ -111,6 +113,7 @@
name: 'PostManage', name: 'PostManage',
data () { data () {
return { return {
nodeList: [],
submitLoading: false, submitLoading: false,
selectList: [], selectList: [],
data: [], data: [],
@@ -161,6 +164,7 @@
this.selectList = val this.selectList = val
}, },
addRole () { // 点击配置角色按钮 addRole () { // 点击配置角色按钮
this.nodeList = this.selectList[0].idList
if (this.selectList.length === 1) { if (this.selectList.length === 1) {
this.modalRole = true this.modalRole = true
} else if (this.selectList.length === 0) { } else if (this.selectList.length === 0) {
@@ -174,6 +178,19 @@
_this: this, _this: this,
loading: 'Loading' loading: 'Loading'
}, res=> { }, 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 this.data = res.data
}) })
}, },
+40 -11
View File
@@ -80,18 +80,25 @@
title="系统菜单" title="系统菜单"
:visible.sync="modalshowflag" :visible.sync="modalshowflag"
:wrapperClosable="false" :wrapperClosable="false"
@close="closeDialog"
size="800px"> size="800px">
<el-tree <div class="myDialog">
node-key="id" <el-tree
class="filter-tree" v-if="modalshowflag"
:data="treeData2" node-key="id"
:props="defaultProps2" class="filter-tree"
:default-checked-keys="nodeList" :data="treeData2"
default-expand-all :props="defaultProps2"
check-strictly :default-checked-keys="nodeList"
show-checkbox default-expand-all
ref="tree"> show-checkbox
</el-tree> 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> </el-dialog>
</div> </div>
</template> </template>
@@ -122,6 +129,22 @@ export default {
} }
}, },
methods: { 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 () { getTree2 () {
this.$http.get('lawss/sarMenu', {}, {}, res=> { this.$http.get('lawss/sarMenu', {}, {}, res=> {
if (res.ok) { if (res.ok) {
@@ -243,6 +266,12 @@ export default {
} }
} }
} }
.myDialog {
/deep/.el-tree {
height: 300px;
overflow: auto;
}
}
/deep/.el-select__tags { /deep/.el-select__tags {
overflow-x: hidden; overflow-x: hidden;
} }