Skip to content

Commit

Permalink
feat: 展示数据源用户所属部门组织路径
Browse files Browse the repository at this point in the history
  • Loading branch information
yuri0528 committed Dec 13, 2023
1 parent ff997c1 commit dc6f175
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
5 changes: 5 additions & 0 deletions src/pages/src/http/dataSourceFiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,8 @@ export const getSyncRecords = (params: SyncRecordsParams) => {
* 数据源更新日志
*/
export const getSyncLogs = (id: string) => http.get(`/api/v1/web/data-sources/sync-records/${id}/`);

/**
* 数据源用户所属部门组织路径
*/
export const getOrganizationPaths = (id: string) => http.get(`/api/v1/web/data-sources/users/${id}/organization-paths/`);
25 changes: 22 additions & 3 deletions src/pages/src/views/data-source/local-details/UserInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,15 @@
</bk-table-column>
<bk-table-column prop="departments" label="所属组织">
<template #default="{ row }">
<span>{{ formatConvert(row.departments) }}</span>
<span
v-bk-tooltips="{
content: tipsText,
delay: 300,
disabled: !tipsText,
}"
@mouseenter="tipsShowFn(row.id)">
{{ formatConvert(row.departments) }}
</span>
</template>
</bk-table-column>
<bk-table-column label="操作" v-if="pluginId === 'local'">
Expand Down Expand Up @@ -214,7 +222,7 @@

<script setup lang="ts">
import axios from 'axios';
import { Message } from 'bkui-vue';
import { bkTooltips as vBkTooltips, Message } from 'bkui-vue';
import { InfoLine } from 'bkui-vue/lib/icon';
import Cookies from 'js-cookie';
import { computed, defineProps, inject, onMounted, reactive, ref, watch } from 'vue';
Expand All @@ -224,7 +232,7 @@ import ViewUser from './ViewUser.vue';
import Empty from '@/components/Empty.vue';
import { useCustomFields } from '@/hooks/useCustomFields';
import { getDataSourceUserDetails, getDataSourceUsers } from '@/http/dataSourceFiles';
import { getDataSourceUserDetails, getDataSourceUsers, getOrganizationPaths } from '@/http/dataSourceFiles';
import { getFields } from '@/http/settingFiles';
import router from '@/router/index';
import { formatConvert } from '@/utils';
Expand Down Expand Up @@ -531,6 +539,17 @@ const closed = () => {
uploadInfo.overwrite = false;
uploadInfo.incremental = true;
};
const tipsText = ref('');
// hover展示数据源用户所属部门组织路径
const tipsShowFn = async (id: string) => {
try {
const res = await getOrganizationPaths(id);
tipsText.value = res.data?.organization_paths[0] || '';
} catch (e) {
tipsText.value = '';
}
};
</script>

<style lang="less" scoped>
Expand Down

0 comments on commit dc6f175

Please sign in to comment.