Commit e4d24655 by 胡悦

提交角色和操作日志部分接口

1 parent a8f6e802
...@@ -285,7 +285,7 @@ export default { ...@@ -285,7 +285,7 @@ export default {
this.getListApi(params).then(res => { this.getListApi(params).then(res => {
var data = res.data var data = res.data
this.data = data[this.tableParams.listName] this.data = data[this.tableParams.listName]
this.total = data.total this.total = data.totalElements
this.loading = false this.loading = false
}).catch(() => { }).catch(() => {
this.loading = false this.loading = false
......
...@@ -97,8 +97,7 @@ ...@@ -97,8 +97,7 @@
node-key="id" node-key="id"
ref="tree" ref="tree"
highlight-current highlight-current
@getCheckedKeys="getCheckedKeys" check-strictly
@setCheckedNodes="setCheckedNodes"
> >
</el-tree> </el-tree>
</div> </div>
...@@ -142,7 +141,7 @@ export default { ...@@ -142,7 +141,7 @@ export default {
prop: 'roleName' prop: 'roleName'
}, { }, {
label: '创建时间', label: '创建时间',
prop: 'createDate' prop: 'createdDate'
}, { }, {
label: '备注', label: '备注',
prop: 'remark' prop: 'remark'
...@@ -194,7 +193,6 @@ export default { ...@@ -194,7 +193,6 @@ export default {
} }
}, },
mounted() { mounted() {
this.getMenuTree()
}, },
methods: { methods: {
// 重置搜索条件 // 重置搜索条件
...@@ -210,9 +208,21 @@ export default { ...@@ -210,9 +208,21 @@ export default {
let params = JSON.parse(JSON.stringify(this.roleForm)) let params = JSON.parse(JSON.stringify(this.roleForm))
params.enableStatus = this.roleForm.enableStatus ? 1 : 2 params.enableStatus = this.roleForm.enableStatus ? 1 : 2
let api = addRole let api = addRole
if (params.id) api = editRole if (params.id) {
api = editRole
delete params.maxUser
if (params.roleVisibility != 2) delete params.roleTenants
}
console.log(params)
api(params).then(res => { api(params).then(res => {
this.handleClose() if (res.code == '200') {
this.$message({
type: 'success',
message: '操作成功!'
})
this.handleClose()
this.$refs.roleTable.refreshTable()
}
}) })
} else { } else {
console.log('error') console.log('error')
...@@ -225,6 +235,7 @@ export default { ...@@ -225,6 +235,7 @@ export default {
this.$refs.roleForm.$children[0].resetFields() this.$refs.roleForm.$children[0].resetFields()
} }
this.roleVisible = !this.roleVisible this.roleVisible = !this.roleVisible
if (!this.roleVisible) this.$refs.tree.setCheckedKeys([])
}, },
// 按钮事件 // 按钮事件
btnClick(pType, scope) { btnClick(pType, scope) {
...@@ -236,6 +247,7 @@ export default { ...@@ -236,6 +247,7 @@ export default {
enableStatus: true, enableStatus: true,
menuIdList: [] menuIdList: []
} }
this.getMenuTree()
this.getTenantList() this.getTenantList()
this.handleClose() this.handleClose()
break break
...@@ -250,10 +262,11 @@ export default { ...@@ -250,10 +262,11 @@ export default {
}, },
// 编辑触发事件 // 编辑触发事件
editEvent(row) { editEvent(row) {
const that = this
roleInfo({ id: row.id }).then(res => { roleInfo({ id: row.id }).then(res => {
this.roleForm = JSON.parse(JSON.stringify(res.data)) this.roleForm = JSON.parse(JSON.stringify(res.data))
this.roleForm.enableStatus = res.data.enableStatus == 1 ? true : false this.roleForm.enableStatus = res.data.enableStatus == 1 ? true : false
this.getMenuTree({ roleId: row.id }) this.getMenuTree({ roleId: 1 })
this.handleClose(res.data) this.handleClose(res.data)
}) })
}, },
...@@ -286,7 +299,10 @@ export default { ...@@ -286,7 +299,10 @@ export default {
getMenuTree(params) { getMenuTree(params) {
getMenuTree(params).then(res => { getMenuTree(params).then(res => {
console.log(res) console.log(res)
this.treedata = res.data this.treedata = res.data.menuTree
setTimeout(() => {
this.$refs.tree.setCheckedKeys(res.data.checkedIds)
}, 1000 / 60)
}) })
}, },
// 获取选中菜单数组 // 获取选中菜单数组
...@@ -294,9 +310,6 @@ export default { ...@@ -294,9 +310,6 @@ export default {
this.roleForm.menuIdList = this.$refs.tree.getCheckedKeys() this.roleForm.menuIdList = this.$refs.tree.getCheckedKeys()
console.log(this.$refs.tree.getCheckedKeys()) console.log(this.$refs.tree.getCheckedKeys())
}, },
setCheckedNodes() {
this.$refs.tree.setCheckedNodes([])
},
// 获取租户列表 // 获取租户列表
getTenantList() { getTenantList() {
getTenantList().then(res => { getTenantList().then(res => {
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
>导出</el-button> >导出</el-button>
</div> </div>
<basic-table <basic-table
ref="worklogTable"
:tableParams="tableParams" :tableParams="tableParams"
:getListApi="getListApi" :getListApi="getListApi"
:beforeSearchFn="beforeSearchFn" :beforeSearchFn="beforeSearchFn"
...@@ -196,7 +197,9 @@ export default { ...@@ -196,7 +197,9 @@ export default {
}, },
// 导出列表 // 导出列表
exportTable() { exportTable() {
exportWorkLog().then(res => { console.log(this.$refs.worklogTable)
const params = this.$refs.worklogTable.page
exportWorkLog(params).then(res => {
}) })
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!