【更新】前端增加编辑机构判断登录者是否为超管而展示不同的树

This commit is contained in:
小诺 2021-07-20 17:31:39 +08:00 committed by 俞宝山
parent 7ea83d770a
commit ad69372226
2 changed files with 30 additions and 16 deletions

View File

@ -70,6 +70,7 @@
</template> </template>
<script> <script>
import store from '@/store'
import { sysOrgAdd, getOrgTree } from '@/api/modular/system/orgManage' import { sysOrgAdd, getOrgTree } from '@/api/modular/system/orgManage'
export default { export default {
data () { data () {
@ -106,14 +107,20 @@
this.orgTree = [] this.orgTree = []
return return
} }
this.orgTree = [{ const admintype = store.getters.admintype
'id': '-1', // eslint-disable-next-line eqeqeq
'parentId': '0', if (admintype == '1') {
'title': '顶级', this.orgTree = [{
'value': '0', 'id': '-1',
'pid': '0', 'parentId': '0',
'children': res.data 'title': '顶级',
}] 'value': '0',
'pid': '0',
'children': res.data
}]
} else {
this.orgTree = res.data
}
}) })
}, },

View File

@ -80,6 +80,7 @@
</template> </template>
<script> <script>
import store from '@/store'
import { sysOrgEdit, getOrgTree } from '@/api/modular/system/orgManage' import { sysOrgEdit, getOrgTree } from '@/api/modular/system/orgManage'
export default { export default {
data () { data () {
@ -128,14 +129,20 @@
this.orgTree = [] this.orgTree = []
return return
} }
this.orgTree = [{ const admintype = store.getters.admintype
'id': '-1', // eslint-disable-next-line eqeqeq
'parentId': '0', if (admintype == '1') {
'title': '顶级', this.orgTree = [{
'value': '0', 'id': '-1',
'pid': '0', 'parentId': '0',
'children': res.data 'title': '顶级',
}] 'value': '0',
'pid': '0',
'children': res.data
}]
} else {
this.orgTree = res.data
}
}) })
}, },