|
@@ -15,6 +15,7 @@
|
|
|
:data="data"
|
|
|
show-checkbox
|
|
|
node-key="id"
|
|
|
+ @check="onTreeCheck"
|
|
|
ref="tree"
|
|
|
highlight-current
|
|
|
:props="defaultProps">
|
|
@@ -40,7 +41,7 @@ export default {
|
|
|
organId: store.getters.organ,
|
|
|
pageType: this.$route.query.type,
|
|
|
id: this.$route.query.id,
|
|
|
- isIndeterminate: true,
|
|
|
+ isIndeterminate: false,
|
|
|
data: [],
|
|
|
defaultProps: {
|
|
|
children: 'children',
|
|
@@ -66,7 +67,7 @@ export default {
|
|
|
roleName: this.result.roleName,
|
|
|
menuIds: this.$refs.tree.getCheckedKeys()
|
|
|
}).then(res => {
|
|
|
- console.log(res)
|
|
|
+ this.messageTips('修改', res)
|
|
|
})
|
|
|
} else if(this.pageType == 'create') {
|
|
|
roleAdd({
|
|
@@ -75,10 +76,21 @@ export default {
|
|
|
roleName: this.result.roleName,
|
|
|
menuIds: this.$refs.tree.getCheckedKeys()
|
|
|
}).then(res => {
|
|
|
- console.log(res)
|
|
|
+ this.messageTips('添加', res)
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
+ messageTips(title, res) {
|
|
|
+ if(res.code == 200) {
|
|
|
+ this.$message({
|
|
|
+ message: title + '成功',
|
|
|
+ type: 'success'
|
|
|
+ })
|
|
|
+ this.$router.push('/system/insideSetting/adminManager')
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.msg)
|
|
|
+ }
|
|
|
+ },
|
|
|
lookSilder () {
|
|
|
getSilder().then(res => {
|
|
|
if(res.code != 200) return
|
|
@@ -92,6 +104,11 @@ export default {
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
+ onTreeCheck() {
|
|
|
+ let checkTree = this.$refs.tree.getCheckedKeys()
|
|
|
+ this.checkAll = checkTree.length >= 38
|
|
|
+ this.isIndeterminate = checkTree.length > 0 && checkTree.length < 38
|
|
|
+ },
|
|
|
onCheckAll(val) {
|
|
|
if(val) {
|
|
|
this.$refs.tree.setCheckedNodes(this.data)
|
|
@@ -120,19 +137,6 @@ export default {
|
|
|
})
|
|
|
return list
|
|
|
},
|
|
|
- submitForm(formName) {
|
|
|
- this.$refs[formName].validate((valid) => {
|
|
|
- if (valid) {
|
|
|
- alert('submit!');
|
|
|
- } else {
|
|
|
- console.log('error submit!!');
|
|
|
- return false;
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
- resetForm(formName) {
|
|
|
- this.$refs[formName].resetFields()
|
|
|
- },
|
|
|
onCancel() {
|
|
|
this.$router.push('/system/insideSetting/adminManager')
|
|
|
}
|