|
@@ -48,29 +48,23 @@
|
|
|
orgList: []
|
|
|
}
|
|
|
},
|
|
|
- // watch: {
|
|
|
- // orgId: function (newValues) {
|
|
|
- // this.dataForm.orgId = newValues
|
|
|
- // }
|
|
|
- // },
|
|
|
+ watch: {
|
|
|
+ orgId (val) {
|
|
|
+ this.dataForm.orgId = val
|
|
|
+ this.init()
|
|
|
+ }
|
|
|
+ },
|
|
|
methods: {
|
|
|
async init () {
|
|
|
- let orgId = this.orgId
|
|
|
+ // let that = this
|
|
|
this.$http({
|
|
|
url: this.$http.adornUrl(`/user-service/org/queryTree`),
|
|
|
method: 'get'
|
|
|
}).then(({data}) => {
|
|
|
this.orgList = data && data.code === '200' ? data.data : []
|
|
|
}).then(() => {
|
|
|
- if (orgId) {
|
|
|
- this.$http({
|
|
|
- url: this.$http.adornUrl(`/user-service/org/info/${orgId}`),
|
|
|
- method: 'get'
|
|
|
- }).then(({data}) => {
|
|
|
- if (data && data.code === '200') {
|
|
|
- this.menuListTreeSetCurrentNode()
|
|
|
- }
|
|
|
- })
|
|
|
+ if (this.dataForm.orgId) {
|
|
|
+ this.menuListTreeSetCurrentNode()
|
|
|
}
|
|
|
})
|
|
|
},
|
|
@@ -78,6 +72,14 @@
|
|
|
this.dataForm.orgId = data.orgId
|
|
|
this.dataForm.orgName = data.name
|
|
|
this.$emit('orgSelected', data.orgId)
|
|
|
+ },
|
|
|
+ menuListTreeSetCurrentNode () {
|
|
|
+ this.$refs.menuListTree.setCurrentKey(this.dataForm.orgId)
|
|
|
+ if (this.dataForm.orgId === '0') {
|
|
|
+ this.dataForm.orgName = ''
|
|
|
+ } else {
|
|
|
+ this.dataForm.orgName = (this.$refs.menuListTree.getCurrentNode() || {})['name']
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|