feat(frontend):user列表增加角色字段;数据源添加报错fix

This commit is contained in:
junjie 2021-05-28 12:40:19 +08:00
parent 92549c13d4
commit e955d2bfff
6 changed files with 27 additions and 3 deletions

View File

@ -18,6 +18,7 @@ import io.dataease.datasource.provider.ProviderFactory;
import io.dataease.datasource.request.DatasourceRequest; import io.dataease.datasource.request.DatasourceRequest;
import io.dataease.dto.DatasourceDTO; import io.dataease.dto.DatasourceDTO;
import io.dataease.dto.dataset.DataTableInfoDTO; import io.dataease.dto.dataset.DataTableInfoDTO;
import io.dataease.i18n.Translator;
import io.dataease.service.dataset.DataSetGroupService; import io.dataease.service.dataset.DataSetGroupService;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -49,7 +50,7 @@ public class DatasourceService {
DatasourceExample example = new DatasourceExample(); DatasourceExample example = new DatasourceExample();
example.createCriteria().andNameEqualTo(datasource.getName()); example.createCriteria().andNameEqualTo(datasource.getName());
if (CollectionUtils.isNotEmpty(datasourceMapper.selectByExample(example))) { if (CollectionUtils.isNotEmpty(datasourceMapper.selectByExample(example))) {
DEException.throwException("Exist data connection with the same name "); DEException.throwException(Translator.get("i18n_ds_name_exists"));
} }
long currentTimeMillis = System.currentTimeMillis(); long currentTimeMillis = System.currentTimeMillis();
datasource.setId(UUID.randomUUID().toString()); datasource.setId(UUID.randomUUID().toString());

View File

@ -241,4 +241,5 @@ i18n_union_field_exists=The same field can't in two dataset
i18n_cron_time_error=Start time can't greater then end time i18n_cron_time_error=Start time can't greater then end time
i18n_auth_source_be_canceled=This Auth Resource Already Be Canceled i18n_auth_source_be_canceled=This Auth Resource Already Be Canceled
i18n_username_exists=ID is already exists i18n_username_exists=ID is already exists
i18n_ds_name_exists=Datasource name exists

View File

@ -243,3 +243,4 @@ i18n_union_field_exists=两个数据集之间关联不能出现多次相同字
i18n_cron_time_error=开始时间不能大于结束时间 i18n_cron_time_error=开始时间不能大于结束时间
i18n_auth_source_be_canceled=当前资源授权权限已经被取消 i18n_auth_source_be_canceled=当前资源授权权限已经被取消
i18n_username_exists=用户ID已存在 i18n_username_exists=用户ID已存在
i18n_ds_name_exists=数据源名称已存在

View File

@ -243,3 +243,4 @@ i18n_union_field_exists=兩個數據集之間關聯不能出現多次相同字
i18n_cron_time_error=開始時間不能大於結束時間 i18n_cron_time_error=開始時間不能大於結束時間
i18n_auth_source_be_canceled=當前資源授權權限已經被取消 i18n_auth_source_be_canceled=當前資源授權權限已經被取消
i18n_username_exists=用戶ID已存在 i18n_username_exists=用戶ID已存在
i18n_ds_name_exists=數據源名稱已存在

View File

@ -94,8 +94,10 @@ export default {
this.$refs.dsForm.validate(valid => { this.$refs.dsForm.validate(valid => {
if (valid) { if (valid) {
const method = this.formType === 'add' ? addDs : editDs const method = this.formType === 'add' ? addDs : editDs
this.form.configuration = JSON.stringify(this.form.configuration) // this.form.configuration = JSON.stringify(this.form.configuration)
method(this.form).then(res => { const form = JSON.parse(JSON.stringify(this.form))
form.configuration = JSON.stringify(form.configuration)
method(form).then(res => {
this.$success(this.$t('commons.save_success')) this.$success(this.$t('commons.save_success'))
this.backToList() this.backToList()
}) })

View File

@ -25,6 +25,24 @@
<div>{{ scope.row.dept && scope.row.dept.deptName }}</div> <div>{{ scope.row.dept && scope.row.dept.deptName }}</div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="roles" :label="$t('commons.role')">
<template slot-scope="scope">
<div v-if="scope.row.roles && scope.row.roles.length <= 2">
<div v-for="role in scope.row.roles" :key="role.roleId">{{ role.roleName }}</div>
</div>
<div v-if="scope.row.roles && scope.row.roles.length > 2">
<el-tooltip placement="top">
<div slot="content">
<div v-for="role in scope.row.roles" :key="role.roleId">{{ role.roleName }}</div>
</div>
<div>
<div v-for="(role,index) in scope.row.roles" v-if="index < 2" :key="role.roleId">{{ role.roleName }}</div>
<div>...</div>
</div>
</el-tooltip>
</div>
</template>
</el-table-column>
<el-table-column prop="status" :label="$t('commons.status')"> <el-table-column prop="status" :label="$t('commons.status')">
<template v-slot:default="scope"> <template v-slot:default="scope">
<el-switch v-model="scope.row.enabled" :active-value="1" :inactive-value="0" inactive-color="#DCDFE6" @change="changeSwitch(scope.row)" /> <el-switch v-model="scope.row.enabled" :active-value="1" :inactive-value="0" inactive-color="#DCDFE6" @change="changeSwitch(scope.row)" />