Skip to content

Commit

Permalink
Merge branch 'main' into add-async-operation-for-import-data-sources
Browse files Browse the repository at this point in the history
  • Loading branch information
rolin999 committed Sep 3, 2024
2 parents 5009422 + e6d333c commit 2388f66
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 6 deletions.
3 changes: 3 additions & 0 deletions src/pages/src/language/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,9 @@
"等": "",
"请选择租户或输入租户ID": "Please select a tenant or enter a tenant ID",
"当前租户未启用账密登录,无法修改密码": "The current tenant has not enabled password login and cannot change the password",
"非本地数据源,无法重置密码": "Non local data source, unable to reset password",
"非本地数据源,无法移动至组织": "Non local data source, unable to move to organization",
"非本地数据源,无法删除": "Non local data source, unable to delete",
"停用成功": "Deactivation successful",
"启用成功": "Activation successful",
"唯一的管理员不能停用": "The only administrator cannot be deactivated",
Expand Down
3 changes: 3 additions & 0 deletions src/pages/src/language/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,9 @@
"等": "",
"请选择租户或输入租户ID": "请选择租户或输入租户ID",
"当前租户未启用账密登录,无法修改密码": "当前租户未启用账密登录,无法修改密码",
"非本地数据源,无法重置密码": "非本地数据源,无法重置密码",
"非本地数据源,无法移动至组织": "非本地数据源,无法移动至组织",
"非本地数据源,无法删除": "非本地数据源,无法删除",
"停用成功": "停用成功",
"启用成功": "启用成功",
"唯一的管理员不能停用": "唯一的管理员不能停用",
Expand Down
35 changes: 29 additions & 6 deletions src/pages/src/views/organization/components/batch-operation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
:key="item"
:class="{ 'disabled': item.disabled }"
v-bk-tooltips="{
content: $t('当前租户未启用账密登录,无法修改密码'),
content: item.tips,
disabled: !item.disabled
}"
@click.prevent="() => {
Expand Down Expand Up @@ -89,7 +89,7 @@
<bk-dropdown-item
v-for="(item, index) in userInfoOptions"
:key="index"
:class="{ 'is-selected': item.selected }"
:class="{ 'is-selected': item.selected, 'is-disabled': item.disabled }"
@click.native="selectOption(item)"
>
{{ item.text }}
Expand Down Expand Up @@ -142,7 +142,7 @@
import { clickoutside as vClickoutside, InfoBox, Message } from 'bkui-vue';
import { AngleDown } from 'bkui-vue/lib/icon';
import dayjs from 'dayjs';
import { onMounted, reactive, ref, watch } from 'vue';
import { computed, onMounted, reactive, ref, watch } from 'vue';
import CustomFields from '@/components/custom-fields/index.vue';
import passwordInput from '@/components/passwordInput.vue';
Expand All @@ -163,6 +163,11 @@ const props = defineProps({
},
});
/** 是否为本地数据源 */
const isLocalDataSource = computed(() => {
return appStore.currentTenant?.data_source?.plugin_id === 'local';
});
const formData = ref({
newPassword: '',
confirmPassword: '',
Expand Down Expand Up @@ -193,6 +198,8 @@ const dropdownList = ref<any[]>([
{
label: t('移动至组织'),
isShow: true,
disabled: !isLocalDataSource.value,
tips: t('非本地数据源,无法移动至组织'),
confirmFn: batchCreate,
handle: (item: any) => {
emits('moveOrg', item);
Expand All @@ -201,7 +208,8 @@ const dropdownList = ref<any[]>([
{
label: t('重置密码'),
key: 'password',
disabled: !props.isEnabledPassword,
disabled: !props.isEnabledPassword && !isLocalDataSource.value,
tips: !props.isEnabledPassword ? t('当前租户未启用账密登录,无法修改密码') : !isLocalDataSource.value ? t('非本地数据源,无法重置密码') : '',
handle: () => {
const userIds = props.selectList.map(item => item.id);
batchPasswordDialogShow.value = true;
Expand Down Expand Up @@ -238,15 +246,17 @@ const dropdownList = ref<any[]>([
{
label: t('删除'),
isShow: true,
disabled: !isLocalDataSource.value,
tips: t('非本地数据源,无法删除'),
handle: () => {
confirmBatchAction('delete');
},
},
]);
const userInfoOptions = ref([
{ text: t('续期'), type: 'date', selected: false },
{ text: t('直属上级'), type: 'leader', selected: false },
{ text: t('续期'), type: 'date', selected: false, disabled: false },
{ text: t('直属上级'), type: 'leader', selected: false, disabled: !isLocalDataSource.value },
]);
onMounted(async () => {
Expand All @@ -270,6 +280,10 @@ watch(infoFormData, (val) => {
}, { deep: true, immediate: true });
const selectOption = (selectedItem) => {
if (selectedItem.disabled) {
userInfoVisible.value = false;
return;
}
userInfoOptions.value.forEach(item => item.selected = false);
selectedItem.selected = true;
userInfoVisible.value = false;
Expand Down Expand Up @@ -431,6 +445,15 @@ const confirmBatchAction = (actionType) => {
justify-content: space-between;
align-items: center;
}
.is-disabled {
color: #c4c6cc !important;
cursor: not-allowed;
display: flex;
justify-content: space-between;
align-items: center;
}
.icon-check-line {
font-size: 14px
}
Expand Down

0 comments on commit 2388f66

Please sign in to comment.