Merge branch 'main' of github.com:dataease/dataease into main

This commit is contained in:
taojinlong 2021-06-23 17:19:47 +08:00
commit 1b73e41063
23 changed files with 152 additions and 60 deletions

View File

@ -1,5 +1,6 @@
package io.dataease.auth.service.impl;
import com.google.gson.Gson;
import io.dataease.auth.api.dto.CurrentRoleDto;
import io.dataease.auth.entity.SysUserEntity;
import io.dataease.base.domain.SysUser;
@ -105,8 +106,11 @@ public class AuthUserServiceImpl implements AuthUserService {
@Transactional
public void syncPluginMenu() {
List<PluginSysMenu> pluginSysMenuList = PluginUtils.pluginMenus();
extPluginSysMenuMapper.deletePluginMenu();
int i = extPluginSysMenuMapper.deletePluginMenu();
LogUtil.info("删除插件菜单记录数{}", i);
if(CollectionUtils.isNotEmpty(pluginSysMenuList)){
LogUtil.info("待插入插件菜单记录是"+new Gson().toJson(pluginSysMenuList));
extPluginSysMenuMapper.savePluginMenu(pluginSysMenuList);
}
}

View File

@ -24,7 +24,8 @@
</select>
<select id="queryUnion" resultMap="BaseResultMapDTO">
select id , name , `desc` ,`type` , configuration ,create_time ,update_time
select id , name , `desc` ,`type` , configuration ,create_time ,update_time,
get_auths(id,'link',#{userId}) as `privileges`
from (select GET_V_AUTH_MODEL_ID_P_USE (#{userId}, 'link') cids) t,datasource
<where>
FIND_IN_SET(datasource.id,cids)

View File

@ -11,5 +11,5 @@ public interface ExtPluginSysMenuMapper {
void savePluginMenu(@Param("menuList") List<PluginSysMenu> menuList);
void deletePluginMenu();
int deletePluginMenu();
}

View File

@ -16,5 +16,8 @@ public interface ExtSysAuthMapper {
@Param("authTarget") String authTarget,
@Param("authTargetType") String authTargetType);
Boolean checkTreeNoManageCount(@Param("userId") Long userId , @Param("modelType") String modelType, @Param("nodeId") String nodeId);
}

View File

@ -70,4 +70,8 @@
select id from sys_auth where auth_source=#{authSource} and auth_source_type=#{authSourceType} and auth_target=#{authTarget} and auth_target_type=#{authTargetType} limit 1
</select>
<select id="checkTreeNoManageCount" resultType="Boolean">
select if(CHECK_TREE_NO_MANAGE_PRIVILEGE(#{userId},#{modelType},#{nodeId})>0,1,0)
</select>
</mapper>

View File

@ -11,10 +11,12 @@ import io.dataease.controller.request.chart.ChartGroupRequest;
import io.dataease.controller.request.dataset.DataSetTableRequest;
import io.dataease.dto.chart.ChartGroupDTO;
import io.dataease.i18n.Translator;
import io.dataease.service.sys.SysAuthService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
import javax.annotation.Resource;
import java.util.ArrayList;
@ -34,6 +36,8 @@ public class ChartGroupService {
private ExtChartGroupMapper extChartGroupMapper;
@Resource
private ExtDataSetGroupMapper extDataSetGroupMapper;
@Resource
private SysAuthService sysAuthService;
public ChartGroupDTO save(ChartGroup chartGroup) {
checkName(chartGroup);
@ -52,6 +56,9 @@ public class ChartGroupService {
}
public void delete(String id) {
Assert.notNull(id, "id cannot be null");
sysAuthService.checkTreeNoManageCount("chart",id);
ChartGroup cg = chartGroupMapper.selectByPrimaryKey(id);
ChartGroupRequest ChartGroup = new ChartGroupRequest();
BeanUtils.copyBean(ChartGroup, cg);

View File

@ -13,11 +13,13 @@ import io.dataease.controller.request.dataset.DataSetTableRequest;
import io.dataease.dto.dataset.DataSetGroupDTO;
import io.dataease.dto.dataset.DataSetTableDTO;
import io.dataease.i18n.Translator;
import io.dataease.service.sys.SysAuthService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
import javax.annotation.Resource;
import java.util.*;
@ -36,6 +38,8 @@ public class DataSetGroupService {
private DataSetTableService dataSetTableService;
@Resource
private ExtDataSetGroupMapper extDataSetGroupMapper;
@Resource
private SysAuthService sysAuthService;
public DataSetGroupDTO save(DatasetGroup datasetGroup) {
checkName(datasetGroup);
@ -54,6 +58,10 @@ public class DataSetGroupService {
}
public void delete(String id) throws Exception {
Assert.notNull(id, "id cannot be null");
sysAuthService.checkTreeNoManageCount("dataset",id);
DatasetGroup dg = datasetGroupMapper.selectByPrimaryKey(id);
DataSetGroupRequest datasetGroup = new DataSetGroupRequest();
BeanUtils.copyBean(datasetGroup, dg);

View File

@ -17,6 +17,7 @@ import io.dataease.dto.panel.PanelDesignDTO;
import io.dataease.dto.panel.PanelGroupDTO;
import io.dataease.i18n.Translator;
import io.dataease.service.chart.ChartViewService;
import io.dataease.service.sys.SysAuthService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
@ -57,6 +58,8 @@ public class PanelGroupService {
private ShareService shareService;
@Resource
private PanelLinkService panelLinkService;
@Resource
private SysAuthService sysAuthService;
public List<PanelGroupDTO> tree(PanelGroupRequest panelGroupRequest) {
String userId = String.valueOf(AuthUtils.getUser().getUserId());
@ -132,6 +135,7 @@ public class PanelGroupService {
public void deleteCircle(String id) {
Assert.notNull(id, "id cannot be null");
sysAuthService.checkTreeNoManageCount("panel",id);
// 同时会删除对应默认仪表盘
extPanelGroupMapper.deleteCircle(id);
storeService.removeByPanelId(id);

View File

@ -41,9 +41,11 @@ public class SysAuthService {
@Resource
private ExtVAuthModelMapper extVAuthModelMapper;
private static List<String> PRI_MODEL_TYPE = Arrays.asList("link", "dataset", "chart", "panel", "menu");
/**
* @Description: 查询可见授权数据的数据如果是管理员IsAdmin = true且modelType 为link dataset chart panel menu可以查询到所有的数据
* 如果是普通用户只能查询到自己的数据但是 node_type 为spine 节点也会返回
@ -137,5 +139,10 @@ public class SysAuthService {
return authId;
}
public void checkTreeNoManageCount(String modelType,String nodeId){
if(extSysAuthMapper.checkTreeNoManageCount(AuthUtils.getUser().getUserId(),modelType,nodeId)){
throw new RuntimeException(Translator.get("i18n_no_all_delete_privilege_folder"));
}
}
}

View File

@ -15,7 +15,6 @@ INSERT INTO `sys_menu` VALUES (16, 2, 0, 2, '删除用户', NULL, NULL, 999, NUL
INSERT INTO `sys_menu` VALUES (17, 2, 0, 2, '编辑用户', NULL, NULL, 999, NULL, NULL, b'0', b'0', b'0', 'user:edit', NULL, NULL, 1614930935529, 1614930935529);
INSERT INTO `sys_menu` VALUES (24, 34, 0, 2, '创建连接', NULL, NULL, 997, NULL, NULL, b'0', b'0', b'0', 'datasource:add', NULL, NULL, 1614931168956, 1615783705537);
INSERT INTO `sys_menu` VALUES (27, 34, 0, 2, '校验连接', NULL, NULL, 999, NULL, NULL, b'0', b'0', b'0', 'datasource:validate', NULL, NULL, 1614931268578, 1614931268578);
INSERT INTO `sys_menu` VALUES (28, 2, 0, 2, '修改密码', NULL, NULL, 999, NULL, NULL, b'0', b'0', b'0', 'user:editPwd', NULL, NULL, 1615275128262, 1615275128262);
INSERT INTO `sys_menu` VALUES (30, 0, 0, 1, '仪表板', 'panel', 'panel/index', 1, NULL, '/panel', b'0', b'0', b'0', NULL, NULL, NULL, NULL, 1619081449067);
INSERT INTO `sys_menu` VALUES (34, 0, 4, 1, '数据源', 'datasource', 'system/datasource/index', 4, NULL, '/datasource', b'0', b'0', b'0', 'datasource:read', NULL, NULL, NULL, NULL);

View File

@ -64,6 +64,31 @@ CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `v_auth_model` AS select
DROP VIEW IF EXISTS `v_auth_privilege`;
CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `v_auth_privilege` AS select `sys_auth`.`auth_source` AS `auth_source`,`sys_auth`.`auth_source_type` AS `auth_source_type`,group_concat(`sys_auth_detail`.`privilege_extend` separator ',') AS `privileges` from (`sys_auth` left join `sys_auth_detail` on((`sys_auth`.`id` = `sys_auth_detail`.`auth_id`))) where ((`sys_auth_detail`.`privilege_value` = 1) and (((`sys_auth`.`auth_target_type` = 'dept') and (`sys_auth`.`auth_target` = (select `sys_user`.`dept_id` from `sys_user` where (`sys_user`.`user_id` = '4')))) or ((`sys_auth`.`auth_target_type` = 'user') and (`sys_auth`.`auth_target` = '4')) or ((`sys_auth`.`auth_target_type` = 'role') and (`sys_auth`.`auth_target` = (select `sys_users_roles`.`role_id` from `sys_users_roles` where (`sys_users_roles`.`user_id` = '4')))))) group by `sys_auth`.`auth_source`,`sys_auth`.`auth_source_type`;
-- ----------------------------
-- Function structure for CHECK_TREE_NO_MANAGE_PRIVILEGE
-- ----------------------------
DROP FUNCTION IF EXISTS `CHECK_TREE_NO_MANAGE_PRIVILEGE`;
delimiter ;;
CREATE FUNCTION `CHECK_TREE_NO_MANAGE_PRIVILEGE`(userId varchar(255),modelType varchar(255),nodeId varchar(255))
RETURNS int(11)
READS SQL DATA
BEGIN
DECLARE privilegeType INTEGER;
DECLARE allTreeIds longtext;
DECLARE allPrivilegeTreeIds longtext;
DECLARE result INTEGER;
select privilege_type into privilegeType from sys_auth_detail where auth_id =modelType and privilege_extend ='manage';
select GET_V_AUTH_MODEL_WITH_CHILDREN( nodeId ,modelType) into allTreeIds;
select GET_V_AUTH_MODEL_WITH_PRIVILEGE(userId,modelType,privilegeType) into allPrivilegeTreeIds;
select count(id) into result from v_auth_model where v_auth_model.model_type=modelType and FIND_IN_SET(v_auth_model.id,allTreeIds) and (!FIND_IN_SET(v_auth_model.id,allPrivilegeTreeIds) or ISNULL(allPrivilegeTreeIds));
RETURN result;
END
;;
delimiter ;
-- ----------------------------
-- Function structure for copy_auth
-- ----------------------------
@ -372,37 +397,10 @@ BEGIN
DECLARE oTempLeafIds longtext;
DECLARE oTempAllIds longtext;
select GROUP_CONCAT(auth_source) into oTempLeafIds from (
SELECT
sys_auth.auth_source_type,
sys_auth.auth_source
FROM
sys_auth
LEFT JOIN sys_auth_detail ON sys_auth.id = sys_auth_detail.auth_id
WHERE
sys_auth_detail.privilege_type = 1
and sys_auth.auth_source_type = modelType
AND (
(
sys_auth.auth_target_type = 'dept'
AND sys_auth.auth_target in ( SELECT dept_id FROM sys_user WHERE user_id = userId )
)
OR (
sys_auth.auth_target_type = 'user'
AND sys_auth.auth_target = userId
)
OR (
sys_auth.auth_target_type = 'role'
AND sys_auth.auth_target in ( SELECT role_id FROM sys_users_roles WHERE user_id = userId )
)
OR (1 = ( SELECT is_admin FROM sys_user WHERE user_id = userId ))
)
GROUP BY
sys_auth.auth_source_type,
sys_auth.auth_source
having (sum( sys_auth_detail.privilege_value )> 0 or 1 = ( SELECT is_admin FROM sys_user WHERE user_id = userId ))) temp;
select GROUP_CONCAT(id) into oTempAllIds from (select GET_V_AUTH_MODEL_WITH_PARENT ( oTempLeafIds ,modelType) cids) t, v_auth_model where v_auth_model.model_type=modelType and FIND_IN_SET(v_auth_model.id,cids);
select GET_V_AUTH_MODEL_WITH_PRIVILEGE(userId,modelType,1) into oTempLeafIds;
select GROUP_CONCAT(id) into oTempAllIds from (select GET_V_AUTH_MODEL_WITH_PARENT ( oTempLeafIds ,modelType) cids) t, v_auth_model where v_auth_model.model_type=modelType and FIND_IN_SET(v_auth_model.id,cids) order by id asc;
RETURN oTempAllIds;
END
@ -433,7 +431,7 @@ DO
SET oTemp = CONCAT(oTemp,',',oTempChild);
SELECT GROUP_CONCAT(id) INTO oTempChild FROM V_AUTH_MODEL WHERE FIND_IN_SET(pid,oTempChild) > 0 and V_AUTH_MODEL.model_type=modelType;
SELECT GROUP_CONCAT(id) INTO oTempChild FROM V_AUTH_MODEL WHERE FIND_IN_SET(pid,oTempChild) > 0 and V_AUTH_MODEL.model_type=modelType order by id asc;
END WHILE;
@ -467,7 +465,7 @@ DO
SET oTemp = CONCAT(oTemp,',',oTempParent);
SELECT GROUP_CONCAT(pid) INTO oTempParent FROM V_AUTH_MODEL WHERE FIND_IN_SET(id,oTempParent) > 0 and V_AUTH_MODEL.model_type=modelType;
SELECT GROUP_CONCAT(distinct pid) INTO oTempParent FROM V_AUTH_MODEL WHERE FIND_IN_SET(id,oTempParent) > 0 and V_AUTH_MODEL.model_type=modelType order by pid asc;
END WHILE;
@ -477,6 +475,52 @@ END
;;
delimiter ;
-- ----------------------------
-- Function structure for GET_V_AUTH_MODEL_WITH_PRIVILEGE
-- ----------------------------
DROP FUNCTION IF EXISTS `GET_V_AUTH_MODEL_WITH_PRIVILEGE`;
delimiter ;;
CREATE FUNCTION `GET_V_AUTH_MODEL_WITH_PRIVILEGE`(userId longtext,modelType varchar(255),privilegeType varchar(255))
RETURNS longtext CHARSET utf8
READS SQL DATA
BEGIN
DECLARE oTempLeafIds longtext;
select GROUP_CONCAT(auth_source) into oTempLeafIds from (
SELECT
sys_auth.auth_source_type,
sys_auth.auth_source
FROM
sys_auth
LEFT JOIN sys_auth_detail ON sys_auth.id = sys_auth_detail.auth_id
WHERE
sys_auth_detail.privilege_type = privilegeType
and sys_auth.auth_source_type = modelType
AND (
(
sys_auth.auth_target_type = 'dept'
AND sys_auth.auth_target in ( SELECT dept_id FROM sys_user WHERE user_id = userId )
)
OR (
sys_auth.auth_target_type = 'user'
AND sys_auth.auth_target = userId
)
OR (
sys_auth.auth_target_type = 'role'
AND sys_auth.auth_target in ( SELECT role_id FROM sys_users_roles WHERE user_id = userId )
)
OR (1 = ( SELECT is_admin FROM sys_user WHERE user_id = userId ))
)
GROUP BY
sys_auth.auth_source_type,
sys_auth.auth_source
having (sum( sys_auth_detail.privilege_value )> 0 or 1 = ( SELECT is_admin FROM sys_user WHERE user_id = userId ))) temp;
RETURN oTempLeafIds;
END
;;
delimiter ;
DROP TRIGGER if exists`new_auth_link`;

View File

@ -258,4 +258,5 @@ i18n_excel_header_empty=Excel first row can not empty
i18n_custom_ds_delete=Custom dataset union data is deleted,can not display
i18n_sql_add_not_matching=The data column of incremental SQL does not match the dataset,
i18n_sql_delete_not_matching=The data column of incremental delete SQL does not match the dataset,
i18n_cst_ds_tb_or_field_deleted=Custom dataset union data is deleted or field changed,can not display
i18n_cst_ds_tb_or_field_deleted=Custom dataset union data is deleted or field changed,can not display
i18n_no_all_delete_privilege_folder=This folder have sources which have no manage or view privilege,Can Not Be Deleted.

View File

@ -258,4 +258,4 @@ i18n_custom_ds_delete=自定义数据集所关联数据被删除,无法正常
i18n_sql_add_not_matching=增量添加 sql 的数据列与数据集不匹配,
i18n_sql_delete_not_matching=增量删除 sql 的数据列与数据集不匹配,
i18n_cst_ds_tb_or_field_deleted=自定义数据集所关联数据被删除或字段发生变化,无法正常显示
i18n_no_all_delete_privilege_folder=该目录下存在没有管理权限或查看权限的资源,无法删除

View File

@ -260,4 +260,5 @@ i18n_excel_header_empty=Excel第一行為空
i18n_custom_ds_delete=自定義數據集所關聯數據被刪除,無法正常顯示
i18n_sql_add_not_matching=增量添加 sql 的數據列與數據集不匹配,
i18n_sql_delete_not_matching=增量刪除 sql 的數據列與數據集不匹配,
i18n_cst_ds_tb_or_field_deleted=自定義數據集所關聯數據被刪除或字段發生變化,無法正常顯示
i18n_cst_ds_tb_or_field_deleted=自定義數據集所關聯數據被刪除或字段發生變化,無法正常顯示
i18n_no_all_delete_privilege_folder=该目录下存在没有管理权限或查看权限的资源,无法删除

View File

@ -23,6 +23,7 @@ export default {
@import "~@/styles/variables.scss";
.app-main {
height: 100%;
/* topbar 56 */
// min-height: calc(100vh - 56px);
// width: 100%;

View File

@ -899,7 +899,7 @@ export default {
authModel(queryCondition).then(res => {
// this.highlights(res.data)
this.tData = this.buildTree(res.data)
console.log(this.tData)
// console.log(this.tData)
})
},

View File

@ -468,7 +468,7 @@ export default {
post('/dataset/table/incrementalConfig', { tableId: this.table.id }).then(response => {
this.incrementalConfig = response.data
this.incrementalUpdateType = 'incrementalAdd'
console.log(this.sql)
// console.log(this.sql)
if (this.incrementalConfig.incrementalAdd) {
this.sql = this.incrementalConfig.incrementalAdd
} else {

View File

@ -857,7 +857,7 @@ export default {
authModel(queryCondition).then(res => {
// this.highlights(res.data)
this.tData = this.buildTree(res.data)
console.log(this.tData)
// console.log(this.tData)
})
},

View File

@ -60,8 +60,7 @@ export default {
activeNames: ['panel'],
chart: null,
tableChart: null,
collapseShow: true,
tableChartShow: true
collapseShow: true
}
},
computed: mapState([
@ -74,7 +73,10 @@ export default {
mounted() {
bus.$on('onSubjectChange', () => {
this.collapseShow = false
this.$nextTick(() => (this.collapseShow = true))
this.$nextTick(() => {
this.init()
this.collapseShow = true
})
})
},
created() {
@ -100,8 +102,6 @@ export default {
// table color view
this.tableChart = deepCopy(this.chart)
this.tableChart.customAttr.color = this.tableChart.customAttr.tableColor
this.tableChartShow = false
this.$nextTick(() => (this.tableChartShow = true))
},
handleChange(val) {
// console.log(val)

View File

@ -84,7 +84,8 @@ export default {
currentTemplateType: 'system',
templateEditFormRules: {
name: [
{ required: true, message: this.$t('commons.input_content'), trigger: 'change' }
{ required: true, message: this.$t('commons.input_content'), trigger: 'change' },
{ max: 50, message: this.$t('commons.char_can_not_more_50'), trigger: 'change' }
]
},
templateEditForm: {},

View File

@ -5,7 +5,7 @@
<span class="title-text">
{{ $t('commons.datasource') }}
</span>
<el-button icon="el-icon-plus" type="text" size="mini" style="float: right;" @click="addFolder" />
<el-button v-permission="['datasource:add']" icon="el-icon-plus" type="text" size="mini" style="float: right;" @click="addFolder" />
</el-row>
<el-divider />
@ -47,18 +47,19 @@
</span>
<span class="child">
<span v-if="data.type ==='folder'" @click.stop>
<span class="el-dropdown-link">
<!-- <span class="el-dropdown-link">
<el-button
v-permission="['datasource:add']"
icon="el-icon-plus"
type="text"
size="small"
@click="addFolderWithType(data)"
/>
</span>
</span> -->
</span>
<span v-if="data.type !=='folder'" style="margin-left: 12px;" @click.stop>
<span class="el-dropdown-link">
<span v-if="hasDataPermission('manage',data.privileges)" class="el-dropdown-link">
<el-button
icon="el-icon-delete"
type="text"
@ -95,6 +96,7 @@
</template>
<script>
import { listDatasource, delDs } from '@/api/system/datasource'
export default {
name: 'DsTree',
data() {
@ -112,6 +114,7 @@ export default {
},
mounted() {
this.queryTreeDatas()
console.log('permis:' + JSON.stringify(this.$store.getters.permissions))
},
methods: {
filterNode(value, data) {

View File

@ -52,12 +52,12 @@
</el-form-item> -->
</el-form>
<div v-if="canEdit" slot="footer" class="dialog-footer">
<el-button @click="validaDatasource">{{ $t('commons.validate') }}</el-button>
<el-button type="primary" @click="save">{{ $t('commons.save') }}</el-button>
<el-button v-if="formType==='add'?true: hasDataPermission('manage',params.privileges)" @click="validaDatasource">{{ $t('commons.validate') }}</el-button>
<el-button v-if="formType==='add'?true: hasDataPermission('manage',params.privileges)" type="primary" @click="save">{{ $t('commons.save') }}</el-button>
</div>
<div v-else slot="footer" class="dialog-footer">
<el-button @click="validaDatasource">{{ $t('commons.validate') }}</el-button>
<el-button type="primary" @click="changeEdit">{{ $t('commons.edit') }}</el-button>
<el-button v-if="formType==='add'?true: hasDataPermission('manage',params.privileges)" @click="validaDatasource">{{ $t('commons.validate') }}</el-button>
<el-button v-if="formType==='add'?true: hasDataPermission('manage',params.privileges)" type="primary" @click="changeEdit">{{ $t('commons.edit') }}</el-button>
</div>
</div>
</layout-content>

View File

@ -20,19 +20,19 @@
<el-input v-model="form.confirmPassword" autocomplete="off" show-password />
</el-form-item>
<el-form-item :label="$t('commons.gender')">
<el-form-item :label="$t('commons.gender')" prop="gender">
<el-radio-group v-model="form.gender" style="width: 178px">
<el-radio :label="$t('commons.man')">{{ $t('commons.man') }}</el-radio>
<el-radio :label="$t('commons.woman')">{{ $t('commons.woman') }}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item :label="$t('commons.status')">
<el-form-item :label="$t('commons.status')" prop="enabled">
<el-radio-group v-model="form.enabled" :disabled="formType !== 'add' && form.isAdmin" style="width: 140px">
<el-radio :label="1">{{ $t('commons.enable') }}</el-radio>
<el-radio :label="0">{{ $t('commons.disable') }}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item :label="$t('commons.organization')" prop="dept">
<el-form-item :label="$t('commons.organization')" prop="deptId">
<treeselect
ref="deptTreeSelect"
v-model="form.deptId"
@ -148,7 +148,10 @@ export default {
trigger: 'blur'
}
],
roleIds: [{ required: true, message: this.$t('user.input_roles'), trigger: 'change' }]
roleIds: [{ required: true, message: this.$t('user.input_roles'), trigger: 'change' }],
deptId: [],
gender: [],
enable: []
},
defaultForm: { id: null, username: null, nickName: null, gender: '男', email: null, enabled: 1, deptId: null, phone: null, roleIds: [2] },
@ -285,6 +288,7 @@ export default {
save() {
this.$refs.createUserForm.validate(valid => {
if (valid) {
!this.form.deptId && (this.form.deptId = 0)
const method = this.formType === 'add' ? addUser : editUser
method(this.form).then(res => {
this.$success(this.$t('commons.save_success'))