/* * @Author: your name * @Date: 2021-12-22 17:00:22 * @LastEditTime: 2022-02-15 10:16:36 * @LastEditors: Please set LastEditors * @Description: 获取权限树 * @FilePath: \Foshan4A2.0\src\views\authorityManagement\minixs\treeData.js */ import { translateDataToTreeAll } from "@/utils/validate"; import { GetAuthTree } from "@/api/apiAuthority"; import { Query } from "@/api/dataIntegration"; export default { data() { return { dataList: {}, searchinfo: "", }; }, created() { // this.getAuthTree() }, methods: { async getAuthTree() { try { const result = await Query({ id: DATACONTENT_ID.authTreeNewId, dataContent: [sessionStorage.getItem("User_Id")], }); if (result.code == 0 && result.returnData.listValues) { const obj = { auth_id: -1, auth_name: "所有权限", auth_status: true, up_auth_id: -1, auth_type: 0, disabled: true, children: translateDataToTreeAll(result.returnData.listValues, "up_auth_id", "auth_id"), }; this.dataList = obj; this.dataArr = result.returnData.listValues; this.dataArr.push({ auth_id: -1, auth_name: "所有权限", auth_status: true, up_auth_id: -1, auth_type: 0, disabled: true, children: [], }); } else { const obj = { auth_id: -1, auth_name: "所有权限", auth_status: true, up_auth_id: -1, auth_type: 0, disabled: true, children: [], }; this.dataList = obj; this.dataArr.push({ auth_id: -1, auth_name: "所有权限", auth_status: true, up_auth_id: -1, auth_type: 0, disabled: true, children: [], }); } } catch (error) { const obj = { auth_id: -1, auth_name: "所有权限", auth_status: true, up_auth_id: -1, auth_type: 0, disabled: true, children: [], }; this.dataList = obj; this.dataArr.push({ auth_id: -1, auth_name: "所有权限", auth_status: true, up_auth_id: -1, auth_type: 0, disabled: true, children: [], }); } }, }, };