feat: 授权国际化等

This commit is contained in:
wangjiahao 2021-05-18 18:39:18 +08:00
parent 533d466ca2
commit 1c48fc8848
20 changed files with 271 additions and 434 deletions

View File

@ -13,6 +13,8 @@ public class Datasource implements Serializable {
private String type;
private String createBy;
private Long createTime;
private Long updateTime;

View File

@ -384,6 +384,76 @@ public class DatasourceExample {
return (Criteria) this;
}
public Criteria andCreateByIsNull() {
addCriterion("create_by is null");
return (Criteria) this;
}
public Criteria andCreateByIsNotNull() {
addCriterion("create_by is not null");
return (Criteria) this;
}
public Criteria andCreateByEqualTo(String value) {
addCriterion("create_by =", value, "createBy");
return (Criteria) this;
}
public Criteria andCreateByNotEqualTo(String value) {
addCriterion("create_by <>", value, "createBy");
return (Criteria) this;
}
public Criteria andCreateByGreaterThan(String value) {
addCriterion("create_by >", value, "createBy");
return (Criteria) this;
}
public Criteria andCreateByGreaterThanOrEqualTo(String value) {
addCriterion("create_by >=", value, "createBy");
return (Criteria) this;
}
public Criteria andCreateByLessThan(String value) {
addCriterion("create_by <", value, "createBy");
return (Criteria) this;
}
public Criteria andCreateByLessThanOrEqualTo(String value) {
addCriterion("create_by <=", value, "createBy");
return (Criteria) this;
}
public Criteria andCreateByLike(String value) {
addCriterion("create_by like", value, "createBy");
return (Criteria) this;
}
public Criteria andCreateByNotLike(String value) {
addCriterion("create_by not like", value, "createBy");
return (Criteria) this;
}
public Criteria andCreateByIn(List<String> values) {
addCriterion("create_by in", values, "createBy");
return (Criteria) this;
}
public Criteria andCreateByNotIn(List<String> values) {
addCriterion("create_by not in", values, "createBy");
return (Criteria) this;
}
public Criteria andCreateByBetween(String value1, String value2) {
addCriterion("create_by between", value1, value2, "createBy");
return (Criteria) this;
}
public Criteria andCreateByNotBetween(String value1, String value2) {
addCriterion("create_by not between", value1, value2, "createBy");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;

View File

@ -6,6 +6,7 @@
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="desc" jdbcType="VARCHAR" property="desc" />
<result column="type" jdbcType="VARCHAR" property="type" />
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
<result column="create_time" jdbcType="BIGINT" property="createTime" />
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
</resultMap>
@ -71,7 +72,7 @@
</where>
</sql>
<sql id="Base_Column_List">
id, `name`, `desc`, `type`, create_time, update_time
id, `name`, `desc`, `type`, create_by, create_time, update_time
</sql>
<sql id="Blob_Column_List">
configuration
@ -126,11 +127,11 @@
</delete>
<insert id="insert" parameterType="io.dataease.base.domain.Datasource">
insert into datasource (id, `name`, `desc`,
`type`, create_time, update_time,
configuration)
`type`, create_by, create_time,
update_time, configuration)
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{desc,jdbcType=VARCHAR},
#{type,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
#{configuration,jdbcType=LONGVARCHAR})
#{type,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT},
#{updateTime,jdbcType=BIGINT}, #{configuration,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.dataease.base.domain.Datasource">
insert into datasource
@ -147,6 +148,9 @@
<if test="type != null">
`type`,
</if>
<if test="createBy != null">
create_by,
</if>
<if test="createTime != null">
create_time,
</if>
@ -170,6 +174,9 @@
<if test="type != null">
#{type,jdbcType=VARCHAR},
</if>
<if test="createBy != null">
#{createBy,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=BIGINT},
</if>
@ -202,6 +209,9 @@
<if test="record.type != null">
`type` = #{record.type,jdbcType=VARCHAR},
</if>
<if test="record.createBy != null">
create_by = #{record.createBy,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=BIGINT},
</if>
@ -222,6 +232,7 @@
`name` = #{record.name,jdbcType=VARCHAR},
`desc` = #{record.desc,jdbcType=VARCHAR},
`type` = #{record.type,jdbcType=VARCHAR},
create_by = #{record.createBy,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT},
configuration = #{record.configuration,jdbcType=LONGVARCHAR}
@ -235,6 +246,7 @@
`name` = #{record.name,jdbcType=VARCHAR},
`desc` = #{record.desc,jdbcType=VARCHAR},
`type` = #{record.type,jdbcType=VARCHAR},
create_by = #{record.createBy,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT}
<if test="_parameter != null">
@ -253,6 +265,9 @@
<if test="type != null">
`type` = #{type,jdbcType=VARCHAR},
</if>
<if test="createBy != null">
create_by = #{createBy,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=BIGINT},
</if>
@ -270,6 +285,7 @@
set `name` = #{name,jdbcType=VARCHAR},
`desc` = #{desc,jdbcType=VARCHAR},
`type` = #{type,jdbcType=VARCHAR},
create_by = #{createBy,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
configuration = #{configuration,jdbcType=LONGVARCHAR}
@ -280,6 +296,7 @@
set `name` = #{name,jdbcType=VARCHAR},
`desc` = #{desc,jdbcType=VARCHAR},
`type` = #{type,jdbcType=VARCHAR},
create_by = #{createBy,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT}
where id = #{id,jdbcType=VARCHAR}

View File

@ -4,6 +4,7 @@ import io.dataease.base.domain.SysAuth;
import io.dataease.base.domain.SysAuthDetail;
import io.dataease.base.domain.SysDept;
import io.dataease.controller.ResultHolder;
import io.dataease.controller.handler.annotation.I18n;
import io.dataease.controller.request.BaseTreeRequest;
import io.dataease.controller.request.SysAuthDetailRequest;
import io.dataease.controller.request.SysAuthRequest;
@ -49,6 +50,7 @@ public class SysAuthController {
@ApiOperation("查询授权模板")
@GetMapping("/authDetailsModel/{authType}")
@I18n
public List<SysAuthDetail>authDetailsModel(@PathVariable String authType){
return sysAuthService.searchAuthDetailsModel(authType);
}

View File

@ -51,6 +51,7 @@ public class DatasourceService {
datasource.setId(UUID.randomUUID().toString());
datasource.setUpdateTime(currentTimeMillis);
datasource.setCreateTime(currentTimeMillis);
datasource.setCreateBy(String.valueOf(AuthUtils.getUser().getUserId()));
datasourceMapper.insertSelective(datasource);
return datasource;
}

View File

@ -43,7 +43,7 @@ INSERT INTO `sys_menu` VALUES (37, 1, 0, 1, '组织表单', '组织表单', 'sys
INSERT INTO `sys_menu` VALUES (38, 1, 0, 1, '角色表单', '角色表单', 'system/role/form', 13, '', 'role-form', b'0', b'0', b'1', NULL, NULL, NULL, NULL, NULL);
INSERT INTO `sys_menu` VALUES (39, 0, 0, 1, '数据源表单', '数据源表单', 'system/datasource/form', 5, NULL, '/ds-form', b'0', b'0', b'1', NULL, NULL, NULL, NULL, NULL);
INSERT INTO `sys_menu` VALUES (40, 1, 0, 1, '模板管理', '模板管理', 'panel/template/index', 13, 'dashboard', 'panel/template/index', NULL, b'0', b'0', 'sysparam:read', NULL, NULL, NULL, 1620444227389);
INSERT INTO `sys_menu` VALUES (41, 1, 0, 1, '权限管理', '权限管理', 'system/permission/index', 14, 'password', 'system/permission/index', b'0', b'0', b'0', 'sysparam:read', NULL, NULL, NULL, 1620447312657);
INSERT INTO `sys_menu` VALUES (41, 1, 0, 1, '权限管理', '权限管理', 'system/authority/index', 14, 'password', 'system/authority/index', b'0', b'0', b'0', 'sysparam:read', NULL, NULL, NULL, 1620447312657);
INSERT INTO `sys_menu` VALUES (50, 0, 0, 1, '个人信息', '个人信息', 'system/user/privateForm', 999, NULL, '/person-info', b'0', b'0', b'1', NULL, NULL, NULL, NULL, NULL);
INSERT INTO `sys_menu` VALUES (51, 0, 0, 1, '重置密码', '重置密码', 'system/user/personPwd', 999, NULL, '/person-pwd', b'0', b'0', b'1', NULL, NULL, NULL, NULL, NULL);
INSERT INTO `sys_menu` VALUES (52, 1, 0, 1, '关于', '关于', 'system/about/index', 16, 'system', 'about', b'0', b'0', b'0', NULL, NULL, NULL, NULL, 1620897406691);

View File

@ -1,3 +1,18 @@
/*
Navicat Premium Data Transfer
Source Server : A-LOCAL-
Source Server Type : MySQL
Source Server Version : 50726
Source Host : localhost:3306
Source Schema : data_ease
Target Server Type : MySQL
Target Server Version : 50726
File Encoding : 65001
Date: 18/05/2021 18:37:45
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
@ -41,7 +56,7 @@ CREATE TABLE `sys_auth_detail` (
-- Records of sys_auth_detail
-- ----------------------------
BEGIN;
INSERT INTO `sys_auth_detail` VALUES ('chart_manage', 'chart', '管理', 3, 0, 'manage', '基础权限-管理', 'system', NULL, NULL), ('chart_use', 'chart', '使用', 1, 0, 'use', '基础权限-使用', 'system', NULL, NULL), ('dataset_manege', 'dataset', '管理', 3, 0, 'manage', '基础权限-管理', 'system', NULL, NULL), ('dataset_use', 'dataset', '使用', 1, 0, 'use', '基础权限-使用', 'system', NULL, NULL), ('link_manage', 'link', '管理', 3, 0, 'manage', '基础权限-管理', 'system', NULL, NULL), ('link_user', 'link', '使用', 1, 0, 'use', '基础权限-使用', 'system', NULL, NULL), ('panel_export', 'panel', '导出', 3, 0, 'export', '基础权限-导出', 'system', NULL, NULL), ('panel_manage', 'panel', '编辑', 5, 0, 'manage', '基础权限-管理', 'system', NULL, NULL), ('panel_user', 'panel', '查看', 1, 0, 'view', '基础权限-查看', 'system', NULL, NULL);
INSERT INTO `sys_auth_detail` VALUES ('chart_manage', 'chart', 'i18n_auth_manage', 3, 0, 'manage', '基础权限-管理', 'system', NULL, NULL), ('chart_use', 'chart', 'i18n_auth_use', 1, 0, 'use', '基础权限-使用', 'system', NULL, NULL), ('dataset_manege', 'dataset', 'i18n_auth_manage', 3, 0, 'manage', '基础权限-管理', 'system', NULL, NULL), ('dataset_use', 'dataset', 'i18n_auth_use', 1, 0, 'use', '基础权限-使用', 'system', NULL, NULL), ('link_manage', 'link', 'i18n_auth_manage', 3, 0, 'manage', '基础权限-管理', 'system', NULL, NULL), ('link_user', 'link', 'i18n_auth_use', 1, 0, 'use', '基础权限-使用', 'system', NULL, NULL), ('panel_export', 'panel', 'i18n_auth_export', 3, 0, 'export', '基础权限-导出', 'system', NULL, NULL), ('panel_manage', 'panel', 'i18n_auth_manage', 5, 0, 'manage', '基础权限-管理', 'system', NULL, NULL), ('panel_user', 'panel', 'i18n_auth_view', 1, 0, 'view', '基础权限-查看', 'system', NULL, NULL);
COMMIT;
-- ----------------------------
@ -114,7 +129,7 @@ VALUES
authId AS auth_id,
sys_auth_detail.privilege_name,
sys_auth_detail.privilege_type,
if(sys_auth_detail.privilege_type=1,1,sys_auth_detail.privilege_value),
1,
sys_auth_detail.privilege_extend,
sys_auth_detail.remark,
'auto' AS create_user,
@ -143,7 +158,7 @@ select id from sys_auth where sys_auth.auth_source=authSource and sys_auth.auth
delete from sys_auth where sys_auth.auth_source=authSource and sys_auth.auth_source_type=authSourceType;
RETURN 'success';
RETURN 'sucess';
END
;;
@ -165,7 +180,7 @@ select id from sys_auth where sys_auth.auth_target=authTarget and sys_auth.auth
delete from sys_auth where sys_auth.auth_target=authTarget and sys_auth.auth_target_type=authTargetType;
RETURN 'success';
RETURN 'sucess';
END
;;
@ -465,42 +480,3 @@ END
delimiter ;
SET FOREIGN_KEY_CHECKS = 1;
DROP TRIGGER if exists`new_auth_link`;
DROP TRIGGER if exists`delete_auth_link`;
CREATE TRIGGER `new_auth_link` AFTER INSERT ON `datasource` FOR EACH ROW select copy_auth(NEW.id,'link',NEW.create_by) into @ee;
CREATE TRIGGER `delete_auth_link` AFTER DELETE ON `datasource` FOR EACH ROW select delete_auth_source(OLD.id,'link') into @ee;
DROP TRIGGER if exists`new_auth_dataset_group`;
DROP TRIGGER if exists`delete_auth_dataset_group`;
DROP TRIGGER if exists`new_auth_dataset_table`;
DROP TRIGGER if exists`delete_auth_dataset_table`;
CREATE TRIGGER `new_auth_dataset_group` AFTER INSERT ON `dataset_group` FOR EACH ROW select copy_auth(NEW.id,'dataset',NEW.create_by) into @ee;
CREATE TRIGGER `delete_auth_dataset_group` AFTER DELETE ON `dataset_group` FOR EACH ROW select delete_auth_source(OLD.id,'dataset') into @ee;
CREATE TRIGGER `new_auth_dataset_table` AFTER INSERT ON `dataset_table` FOR EACH ROW select copy_auth(NEW.id,'dataset',NEW.create_by) into @ee;
CREATE TRIGGER `delete_auth_dataset_table` AFTER DELETE ON `dataset_table` FOR EACH ROW select delete_auth_source(OLD.id,'dataset') into @ee;
DROP TRIGGER if exists `new_auth_chart_group`;
DROP TRIGGER if exists`delete_auth_chart_group`;
DROP TRIGGER if exists`new_auth_chart_view`;
DROP TRIGGER if exists`delete_auth_chart_view`;
CREATE TRIGGER `new_auth_chart_group` AFTER INSERT ON `chart_group` FOR EACH ROW select copy_auth(NEW.id,'chart',NEW.create_by) into @ee;
CREATE TRIGGER `delete_auth_chart_group` AFTER DELETE ON `chart_group` FOR EACH ROW select delete_auth_source(OLD.id,'chart') into @ee;
CREATE TRIGGER `new_auth_chart_view` AFTER INSERT ON `chart_view` FOR EACH ROW select copy_auth(NEW.id,'chart',NEW.create_by) into @ee;
CREATE TRIGGER `delete_auth_chart_view` AFTER DELETE ON `chart_view` FOR EACH ROW select delete_auth_source(OLD.id,'chart') into @ee;
DROP TRIGGER if exists`new_auth_panel`;
DROP TRIGGER if exists`delete_auth_panel`;
CREATE TRIGGER `new_auth_panel` AFTER INSERT ON `panel_group` FOR EACH ROW select copy_auth(NEW.id,'panel',NEW.create_by) into @ee;
CREATE TRIGGER `delete_auth_panel` AFTER DELETE ON `panel_group` FOR EACH ROW select delete_auth_source(OLD.id,'panel') into @ee;
DROP TRIGGER if exists`delete_auth_user_target`;
DROP TRIGGER if exists`delete_auth_role_target`;
DROP TRIGGER if exists`delete_auth_dept_target`;
CREATE TRIGGER `delete_auth_user_target` AFTER DELETE ON `sys_user` FOR EACH ROW select delete_auth_target(OLD.user_id,'user') into @ee;
CREATE TRIGGER `delete_auth_role_target` AFTER DELETE ON `sys_role` FOR EACH ROW select delete_auth_target(OLD.role_id,'role') into @ee;
CREATE TRIGGER `delete_auth_dept_target` AFTER DELETE ON `sys_dept` FOR EACH ROW select delete_auth_target(OLD.dept_id,'dept') into @ee;

View File

@ -64,14 +64,14 @@
<!--要生成的数据库表 -->
<!-- <table tableName="datasource"/>-->
<table tableName="datasource"/>
<!-- <table tableName="sys_dict"/>-->
<!-- <table tableName="sys_dict_item"/>-->
<!-- <table tableName="dataset_table_field"/>-->
<!-- <table tableName="v_chart">-->
<!-- </table>-->
<table tableName="v_auth_model">
</table>
<!-- <table tableName="v_auth_model">-->
<!-- </table>-->
<!-- <table tableName="v_dataset"/>-->
<!-- <table tableName="sys_auth_detail"/>-->

View File

@ -220,4 +220,9 @@ authsource_configuration_is_null=Authentication source configuration cannot be e
视图=View
角色管理=Role management
角色表单=Role Form
重置密码=Reset Password
重置密码=Reset Password
i18n_auth_view=View
i18n_auth_use=Use
i18n_auth_export=Export
i18n_auth_manage=Manage

View File

@ -222,3 +222,8 @@ authsource_configuration_is_null=认证源配置不能为空
角色管理=角色管理
角色表单=角色表单
重置密码=重置密码
i18n_auth_view=查看
i18n_auth_use=使用
i18n_auth_export=导出
i18n_auth_manage=管理

View File

@ -222,3 +222,8 @@ authsource_configuration_is_null=認證源配置不能為空
角色管理=角色管理
角色表单=角色表單
重置密码=重置密碼
i18n_auth_view=查看
i18n_auth_use=使用
i18n_auth_export=導出
i18n_auth_manage=管理

View File

@ -894,5 +894,27 @@ export default {
loginImage: 'Picture on the right side of the login page',
loginTitle: 'Login page title',
title: 'System name'
},
auth: {
authConfig: 'Auth Config',
authQuickConfig: 'Auth Quick Config',
dept: 'Dept',
role: 'Role',
user: 'User',
linkAuth: 'Datasource Permissions',
datasetAuth: 'Data Permissions',
chartAuth: 'Chart Permissions',
panelAuth: 'Panel Permissions',
deptHead: 'All Dept',
roleHead: 'All Role',
userHead: 'All User',
linkAuthHead: 'All Datasource',
datasetAuthHead: 'All Data',
chartAuthHead: 'All Chart',
panelAuthHead: 'All Chart',
view: 'View',
use: 'Use',
export: 'Export',
manage: 'Manage'
}
}

View File

@ -894,5 +894,27 @@ export default {
loginImage: '登陸頁面右側圖片',
loginTitle: '登陸頁面標題',
title: '系統名稱'
},
auth: {
authConfig: '權限配置',
authQuickConfig: '權限快捷配置',
dept: '部門',
role: '角色',
user: '用戶',
linkAuth: '數據源權限',
datasetAuth: '數據權限',
chartAuth: '視圖權限',
panelAuth: '儀表盤權限',
deptHead: '所有部門',
roleHead: '所有角色',
userHead: '所有用戶',
linkAuthHead: '所有數據源',
datasetAuthHead: '所有數據',
chartAuthHead: '所有視圖',
panelAuthHead: '所有儀表盤',
view: '查看',
use: '使用',
export: '導出',
manage: '管理'
}
}

View File

@ -895,5 +895,27 @@ export default {
loginImage: '登录页面右侧图片',
loginTitle: '登录页面标题',
title: '系统名称'
},
auth: {
authConfig: '权限配置',
authQuickConfig: '权限快捷配置',
dept: '部门',
role: '角色',
user: '用户',
linkAuth: '数据源权限',
datasetAuth: '数据权限',
chartAuth: '视图权限',
panelAuth: '仪表盘权限',
deptHead: '所有部门',
roleHead: '所有角色',
userHead: '所有用户',
linkAuthHead: '所有数据源',
datasetAuthHead: '所有数据',
chartAuthHead: '所有视图',
panelAuthHead: '所有仪表盘',
view: '查看',
use: '使用',
export: '导出',
manage: '管理'
}
}

View File

@ -1,6 +1,6 @@
<template>
<de-container>
<de-aside-container>
<de-container style="height: auto">
<de-aside-container style="height: auto">
<el-button v-show="!showTargetSearchInput" class="de-icon" icon="el-icon-search" circle size="mini" @click="showTargetSearchWidget" />
<div v-show="showTargetSearchInput" class="de-input">
<el-input v-model="targetFilterText">
@ -63,46 +63,46 @@ export default {
targetInfoArray:
[
{
tabName: '部门',
head: '所有部门',
tabName: this.$t('auth.dept'),
head: this.$t('auth.deptHead'),
direction: 'target',
authType: 'dept'
},
{
tabName: '角色',
head: '所有角色',
tabName: this.$t('auth.role'),
head: this.$t('auth.roleHead'),
direction: 'target',
authType: 'role'
},
{
tabName: '用户',
head: '所有用户',
tabName: this.$t('auth.user'),
head: this.$t('auth.userHead'),
direction: 'target',
authType: 'user'
}],
sourceInfoArray:
[
{
tabName: '数据源权限',
head: '所有数据源',
tabName: this.$t('auth.linkAuth'),
head: this.$t('auth.linkAuthHead'),
direction: 'source',
authType: 'link'
},
{
tabName: '数据集权限',
head: '所有数据集',
tabName: this.$t('auth.datasetAuth'),
head: this.$t('auth.datasetAuthHead'),
direction: 'source',
authType: 'dataset'
},
{
tabName: '视图权限',
head: '所有视图',
tabName: this.$t('auth.chartAuth'),
head: this.$t('auth.linkAuthHead'),
direction: 'source',
authType: 'chart'
},
{
tabName: '仪表盘权限',
head: '所有仪表板',
tabName: this.$t('auth.panelAuth'),
head: this.$t('auth.panelAuthHead'),
direction: 'source',
authType: 'panel'
}],
@ -182,6 +182,7 @@ export default {
}
.de-main-container-auth{
border: 1px solid #E6E6E6;
height: auto;
}
// ::-webkit-scrollbar {

View File

@ -1,44 +1,45 @@
<template>
<de-container>
<de-aside-container>
<el-button v-show="!showSourceSearchInput" class="de-icon" icon="el-icon-search" circle size="mini" @click="showSourceSearchWidget" />
<div v-show="showSourceSearchInput" class="de-input">
<el-input v-model="sourceFilterText">
<el-button slot="append" icon="el-icon-close" @click="closeSourceSearchWidget" />
</el-input>
</div>
<el-tabs v-model="sourceActiveName" :class="{'de-search-header': showSourceSearchInput}" @tab-click="handleClick">
<el-tab-pane v-for="(sourceInfo, index) in sourceInfoArray" :key="index" :lazy="true" :label="sourceInfo.tabName" :name="sourceInfo.authType">
<lazy-tree
v-if="authCondition"
:active-name="sourceActiveName"
:filter-text="sourceFilterText"
:data-info="sourceInfo"
highlight-current
@nodeClick="authNodeClick"
/>
</el-tab-pane>
</el-tabs>
</de-aside-container>
<de-main-container class="de-main-container-auth">
<el-button v-show="!showTargetSearchInput" class="de-icon" icon="el-icon-search" circle size="mini" @click="showTargetSearchWidget" />
<div v-show="showTargetSearchInput" class="de-input">
<el-input v-model="targetFilterText">
<el-button slot="append" icon="el-icon-close" @click="closeTargetSearchWidget" />
</el-input>
</div>
<el-tabs v-model="targetActiveName" :class="{'de-search-header': showTargetSearchInput}" @tab-click="handleClick">
<el-tab-pane v-for="(targetInfo, index) in targetInfoArray" :key="index" :lazy="true" :label="targetInfo.tabName" :name="targetInfo.authType">
<lazy-tree
:active-name="targetActiveName"
:filter-text="targetFilterText"
:data-info="targetInfo"
show-extent
:auth-condition="authCondition"
/>
</el-tab-pane>
</el-tabs>
</de-main-container>
<span>敬请期待</span>
<!-- <de-aside-container>-->
<!-- <el-button v-show="!showSourceSearchInput" class="de-icon" icon="el-icon-search" circle size="mini" @click="showSourceSearchWidget" />-->
<!-- <div v-show="showSourceSearchInput" class="de-input">-->
<!-- <el-input v-model="sourceFilterText">-->
<!-- <el-button slot="append" icon="el-icon-close" @click="closeSourceSearchWidget" />-->
<!-- </el-input>-->
<!-- </div>-->
<!-- <el-tabs v-model="sourceActiveName" :class="{'de-search-header': showSourceSearchInput}" @tab-click="handleClick">-->
<!-- <el-tab-pane v-for="(sourceInfo, index) in sourceInfoArray" :key="index" :lazy="true" :label="sourceInfo.tabName" :name="sourceInfo.authType">-->
<!-- <lazy-tree-->
<!-- v-if="authCondition"-->
<!-- :active-name="sourceActiveName"-->
<!-- :filter-text="sourceFilterText"-->
<!-- :data-info="sourceInfo"-->
<!-- highlight-current-->
<!-- @nodeClick="authNodeClick"-->
<!-- />-->
<!-- </el-tab-pane>-->
<!-- </el-tabs>-->
<!-- </de-aside-container>-->
<!-- <de-main-container class="de-main-container-auth">-->
<!-- <el-button v-show="!showTargetSearchInput" class="de-icon" icon="el-icon-search" circle size="mini" @click="showTargetSearchWidget" />-->
<!-- <div v-show="showTargetSearchInput" class="de-input">-->
<!-- <el-input v-model="targetFilterText">-->
<!-- <el-button slot="append" icon="el-icon-close" @click="closeTargetSearchWidget" />-->
<!-- </el-input>-->
<!-- </div>-->
<!-- <el-tabs v-model="targetActiveName" :class="{'de-search-header': showTargetSearchInput}" @tab-click="handleClick">-->
<!-- <el-tab-pane v-for="(targetInfo, index) in targetInfoArray" :key="index" :lazy="true" :label="targetInfo.tabName" :name="targetInfo.authType">-->
<!-- <lazy-tree-->
<!-- :active-name="targetActiveName"-->
<!-- :filter-text="targetFilterText"-->
<!-- :data-info="targetInfo"-->
<!-- show-extent-->
<!-- :auth-condition="authCondition"-->
<!-- />-->
<!-- </el-tab-pane>-->
<!-- </el-tabs>-->
<!-- </de-main-container>-->
</de-container>
</template>

View File

@ -1,160 +0,0 @@
<template xmlns:el-col="http://www.w3.org/1999/html">
<el-col>
<el-row style="margin-top: 5px">
<el-tree
ref="templateTree"
:props="defaultProps"
:load="loadNodes"
:data="treeData"
node-key="deptId"
:highlight-current="true"
:default-expanded-keys="expandedKey"
lazy
@node-click="nodeClick"
/>
</el-row>
</el-col>
</template>
<script>
import { getDeptTree, loadTable } from '@/api/system/dept'
export default {
name: 'AuthDept',
components: { },
props: {
filterText: {
type: String,
required: false,
default: ''
},
activeName: {
type: String,
required: true
}
},
data() {
return {
treeData: [],
changeIndex: 0,
timeMachine: null,
expandedKey: [],
defaultCondition: {
field: 'pid',
operator: 'eq',
value: 0
},
defaultProps: {
children: 'children',
label: 'name',
id: 'deptId',
parentId: 'pid',
isLeaf: 'leaf'
}
}
},
computed: {
},
watch: {
filterText(val) {
// activeName
if (this.$options.name === this.activeName) {
this.destroyTimeMachine()
this.changeIndex++
this.filterNode(this.changeIndex)
}
}
},
methods: {
loadNodes(node, resolve) {
if (node.level === 0) {
getDeptTree(0).then(res => {
const data = res.data
resolve(data)
})
} else {
getDeptTree(node.data.deptId).then(res => {
const data = res.data
resolve(data)
})
}
},
filterNode(index) {
this.timeMachine = setTimeout(() => {
if (index === this.changeIndex) {
const condition = {
field: 'name',
operator: 'like',
value: this.filterText
}
this.search(condition)
}
this.destroyTimeMachine()
}, 1500)
},
nodeClick(data, node) {
this.$emit('nodeClick', { id: data.deptId, type: 'dept' })
},
destroyTimeMachine() {
this.timeMachine && clearTimeout(this.timeMachine)
this.timeMachine = null
},
search(condition) {
let param = {}
if (condition && condition.value) {
param = { conditions: [condition] }
} else {
param = { conditions: [this.defaultCondition] }
}
loadTable(param).then(res => {
this.expandedKey = []
this.treeData = []
const data = res.data
this.treeData = this.buildTree(data)
console.log('===>' + JSON.stringify(this.treeData))
})
},
buildTree(arrs) {
const idMapping = arrs.reduce((acc, el, i) => {
acc[el.deptId] = i
return acc
}, {})
console.log('idMapping>' + JSON.stringify(idMapping))
const roots = []
arrs.forEach(el => {
//
if (el.pid === null || el.pid === 0) {
roots.push(el)
return
}
debugger
//
const parentEl = arrs[idMapping[el.pid]]
console.log('parentEl>' + JSON.stringify(parentEl))
// `children`
parentEl.children = [...(parentEl.children || []), el]
console.log('parentEl>' + JSON.stringify(parentEl))
//
if (parentEl.children.length > 0) {
this.expandedKey.push(parentEl.deptId)
}
})
return roots
}
}
}
</script>
<style scoped>
.custom-tree-node {
flex: 1;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 14px;
padding-right: 8px;
}
</style>

View File

@ -1,78 +0,0 @@
<template>
<div class="my_table">
<el-table
:data="data.filter(node => !filterText || node[fieldName].toLowerCase().includes(filterText.toLowerCase()))"
:show-header="false"
style="width: 100%"
:row-style="{height: '26px'}"
highlight-current-row
@current-change="nodeClick"
>
<el-table-column :column-key="fieldName" :prop="fieldName" filter-placement="right-start" />
</el-table>
</div>
</template>
<script>
import { roleGrid } from '@/api/system/role'
import { formatCondition } from '@/utils/index'
export default {
name: 'AuthRole',
props: {
resourceId: {
type: String,
default: null
},
filterText: {
type: String,
default: ''
}
},
data() {
return {
data: [],
fieldName: 'name',
type: 1, // 1
shares: []
}
},
created() {
this.search()
},
methods: {
search(condition) {
const temp = formatCondition(condition)
const param = temp || {}
roleGrid(1, 0, param).then(response => {
const data = response.data
this.data = data.listObject
})
},
cancel() {
console.log('role cancel')
},
nodeClick(val) {
// role authTarget
this.$emit('nodeClick', { id: val.roleId, type: 'role' })
}
}
}
</script>
<style scoped>
.my_table >>> .el-table__row>td{
/* 去除表格线 */
border: none;
padding: 0 0;
}
.my_table >>> .el-table th.is-leaf {
/* 去除上边框 */
border: none;
}
.my_table >>> .el-table::before{
/* 去除下边框 */
height: 0;
}
</style>

View File

@ -1,74 +0,0 @@
<template>
<div class="my_table">
<el-table
:data="data.filter(node => !filterText || node[fieldName].toLowerCase().includes(filterText.toLowerCase()))"
:show-header="false"
style="width: 100%"
:row-style="{height: '26px'}"
highlight-current-row
@current-change="handleCurrentChange"
>
<el-table-column :column-key="fieldName" :prop="fieldName" filter-placement="right-start" />
</el-table>
</div>
</template>
<script>
import { userLists } from '@/api/system/user'
import { formatCondition } from '@/utils/index'
export default {
name: 'AuthUser',
props: {
filterText: {
type: String,
default: ''
}
},
data() {
return {
data: [],
fieldName: 'nickName',
type: 0, // 0
shares: []
}
},
created() {
this.search()
},
methods: {
search(condition) {
const temp = formatCondition(condition)
const param = temp || {}
userLists(1, 0, param).then(response => {
debugger
const data = response.data
this.data = data.listObject
})
},
cancel() {
console.log('role cancel')
},
handleCurrentChange(val) {
console.log('handleCurrentChange')
}
}
}
</script>
<style scoped>
.my_table >>> .el-table__row>td{
/* 去除表格线 */
border: none;
padding: 0 0;
}
.my_table >>> .el-table th.is-leaf {
/* 去除上边框 */
border: none;
}
.my_table >>> .el-table::before{
/* 去除下边框 */
height: 0;
}
</style>

View File

@ -1,18 +1,16 @@
<template>
<de-container>
<de-main-container>
<el-tabs v-model="authorityType" @tab-click="handleClick">
<el-tab-pane name="authConfig">
<span slot="label">权限配置</span>
<auth-config />
</el-tab-pane>
<el-tab-pane name="authQuickConfig">
<span slot="label">权限快捷配置</span>
<auth-quick-config />
</el-tab-pane>
</el-tabs>
</de-main-container>
</de-container>
<de-main-container style="height: calc(100vh - 56px)">
<el-tabs v-model="authorityType" @tab-click="handleClick">
<el-tab-pane name="authConfig">
<span slot="label">{{$t('auth.authConfig')}}</span>
<auth-config />
</el-tab-pane>
<el-tab-pane name="authQuickConfig">
<span slot="label">{{$t('auth.authQuickConfig')}}</span>
<auth-quick-config />
</el-tab-pane>
</el-tabs>
</de-main-container>
</template>
<script>
import DeMainContainer from '@/components/dataease/DeMainContainer'