123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141 |
- /*
- * @Author: your name
- * @Date: 2021-12-24 11:36:07
- * @LastEditTime: 2022-01-17 10:05:35
- * @LastEditors: Please set LastEditors
- * @Description: 权限公用
- * @FilePath: \Foshan4A2.0\src\views\authorityManagement\minixs\roleData.js
- */
- import { organpop } from '@/api/postInterface'
- import { GetGroupByOrgan, GroupAuths } from '@/api/authGroupApi'
- import { GetGroupTree } from '@/api/AccountGroup'
- import { QueryRole } from '@/api/apiAuthority'
- import { sendSystem } from "@/api/postInterface"
- export default {
- data () {
- return {
- arrs: [],
- checkArr: [],
- checkList: [],
- }
- },
- methods: {
- // 根据组织获取角色
- async getRoleByOrgan (id) {
- try {
- const res = await organpop({
- OrganId: id
- })
- if (res.code === 0) {
- const arr = res.returnData
- if (id == -1) {
- arr.forEach(item => {
- item.name = item.RoleName
- });
- this.arrs = arr
- } else {
- const datas = []
- arr.forEach(item => {
- item.name = item.RoleName
- if (item.IsSelected == 1) {
- datas.push(item)
- }
- });
- this.arrs = datas
- }
- } else {
- this.$message.error(res.message)
- }
- } catch (error) {
- console.log('出错了', error)
- }
- },
- //根据组织获取岗位
- async getGroupByOrgan (id) {
- try {
- let params = {
- OrganId: id
- }
- const res = await GetGroupByOrgan(params)
- if (res.code === 0) {
- const arr = res.returnData
- arr.forEach(item => {
- item.name = item.GroupName
- });
- this.arrs = arr
- } else {
- this.$message.error(res.message)
- }
- } catch (error) {
- console.log('出错了', error)
- }
- },
- //根组织获取岗位
- async getGroupTree (name = '') {
- try {
- let params = {
- QueryName: name
- }
- const res = await GetGroupTree(params)
- if (res.code === 0) {
- const arr = res.returnData
- arr.forEach(item => {
- item.name = item.GroupName
- });
- this.arrs = arr
- } else {
- this.$message.error(res.message)
- }
- } catch (error) {
- console.log('出错了', error)
- }
- },
- //根据岗位查询权限列表
- async groupAuths (id) {
- try {
- let params = {
- GroupId: id
- }
- const res = await GroupAuths(params)
- if (res.code === 0) {
- this.RoleList = res.returnData
- } else {
- this.$message.error(res.message)
- }
- } catch (error) {
- console.log('出错了', error)
- }
- },
- //获取角色列表数据
- async gueryRole (name = '') {
- try {
- const res = await QueryRole({
- QueryName: name
- })
- if (res.code === 0) {
- const datas = res.returnData
- datas.forEach(item => {
- item.name = item.RoleName
- });
- this.arrs = datas
- } else {
- this.$message.error(res.message)
- }
- } catch (error) {
- console.log('出错了', error)
- }
- },
- //获取下发系统信息
- async getSendSystem () {
- const { code, message, returnData } = await sendSystem({
- userId: sessionStorage.getItem('User_Id'),
- userType: sessionStorage.getItem('UserType')
- })
- if (code == 0) {
- this.checkArr = returnData
- } else {
- this.$message.error(message)
- }
- },
- }
- }
|