Skip to content

Commit

Permalink
feature: 1、审计日志中新增人员全名列&导出列表优化 TencentBlueKing#618 2、通过excel导入用户组织支持全…
Browse files Browse the repository at this point in the history
…量更新 TencentBlueKing#728 (TencentBlueKing#855)

Co-authored-by: huacao <[email protected]>
  • Loading branch information
caohua and huacao authored Dec 16, 2022
1 parent 42e889a commit a11c21c
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 5 deletions.
17 changes: 17 additions & 0 deletions src/pages/src/components/catalog/home/ImportUser.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@
<span class="text">{{$t('仅支持xls、xlsx格式文件')}}</span>
<span class="template" @click="downloadTemplate"><i class="icon-user-download"></i>{{$t('下载模板')}}</span>
</p>
<p class="tip-wrapper">
<bk-checkbox
v-model="uploadInfo.isOverwrite">
允许对同名用户覆盖更新
</bk-checkbox>
<i class="tip-icon icon-user--l" v-bk-tooltips="{ width: 310, content: $t('导入覆盖提升') }"></i>
</p>
</div>
</template>

Expand All @@ -69,6 +76,7 @@ export default {
name: '',
size: '',
type: false,
isOverwrite: false,
},
};
},
Expand Down Expand Up @@ -116,6 +124,7 @@ export default {
name: '',
size: '',
type: false,
isOverwrite: false,
};
},
// 上传
Expand Down Expand Up @@ -307,4 +316,12 @@ export default {
cursor: pointer;
}
}

.tip-wrapper {
margin-top: 10px;
.tip-icon {
display: inline-block;
transform: translateY(4px);
}
}
</style>
2 changes: 1 addition & 1 deletion src/pages/src/store/modules/catalog.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export default {
},
// eslint-disable-next-line no-unused-vars
ajaxImportUser(_context, params, _config = {}) {
return http.post(`api/v1/web/categories/${params.id}/operations/sync_or_import/`, params.data);
return http.post(`api/v1/web/categories/${params.id}/operations/sync_or_import/?is_overwrite=${params.isOverwrite}`, params.data);
// const mockUrl = `?mock-file=catalog`
// return http.get(mockUrl, config)
},
Expand Down
8 changes: 6 additions & 2 deletions src/pages/src/views/audit/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
v-if="panelActive === 'operate'"
class="king-input-search"
style="width: 400px;"
:placeholder="$t('搜索操作人员、操作对象、操作类型')"
:placeholder="$t('搜索操作用户、操作对象、操作类型')"
:clearable="true"
:left-icon="'bk-icon icon-search'"
@clear="handleClear"
Expand Down Expand Up @@ -71,6 +71,7 @@
<tr v-for="(item, index) in auditList" :key="index">
<template v-if="isOperate">
<td><div class="text-overflow-hidden" v-bk-overflow-tips>{{item.operator}}</div></td>
<td><div class="text-overflow-hidden" v-bk-overflow-tips>{{item.display_name || '--'}}</div></td>
<td><div class="text-overflow-hidden">{{item.datetime | convertIsoTime}}</div></td>
<td><div class="text-overflow-hidden" v-bk-overflow-tips>{{item.client_ip}}</div></td>
<td><div class="text-overflow-hidden">{{item.operation}}</div></td>
Expand All @@ -79,6 +80,7 @@
</template>
<template v-else>
<td><div class="text-overflow-hidden">{{item.username}}</div></td>
<td><div class="text-overflow-hidden">{{item.display_name || '--'}}</div></td>
<td><div class="text-overflow-hidden">{{item.datetime | convertIsoTime}}</div></td>
<td><div class="text-overflow-hidden">{{item.client_ip}}</div></td>
<td><div class="text-overflow-hidden" v-bk-tooltips="errorTips(item)">
Expand Down Expand Up @@ -191,7 +193,8 @@ export default {
],
panelActive: 'operate',
auditHead: [
{ key: 'operater', name: this.$t('操作人员') },
{ key: 'operater', name: this.$t('操作用户') },
{ key: 'operater', name: this.$t('用户全名') },
{ key: 'time', name: this.$t('时间') },
{ key: 'IP', name: this.$t('来源 IP') },
{ key: 'type', name: this.$t('操作类型') },
Expand All @@ -201,6 +204,7 @@ export default {
/** 登录审计表头 */
loginHead: [
{ key: 'user', name: this.$t('登录用户') },
{ key: 'user', name: this.$t('用户全名') },
{ key: 'time', name: this.$t('登录时间') },
{ key: 'IP', name: this.$t('登录来源IP') },
{ key: 'status', name: this.$t('登录状态') },
Expand Down
6 changes: 4 additions & 2 deletions src/pages/src/views/catalog/PageHome.vue
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,9 @@ export default {
return;
}
const formData = new FormData();
formData.append('file', this.$refs.importUserRef.uploadInfo.fileInfo);
formData.append('file_name', this.$refs.importUserRef.uploadInfo.name);
const uploadInfo = this.$refs.importUserRef.uploadInfo;
formData.append('file', uploadInfo.fileInfo);
formData.append('file_name', uploadInfo.name);
formData.append('department_id', this.$refs.importUserRef.id);

// 如果同时有两个目录正在导入,this.importId 会变化,影响 splice loading,所以必须加个变量
Expand All @@ -380,6 +381,7 @@ export default {
try {
await this.$store.dispatch('catalog/ajaxImportUser', {
id: this.importId,
isOverwrite: uploadInfo.isOverwrite,
data: formData,
});
await this.getDepartments();
Expand Down

0 comments on commit a11c21c

Please sign in to comment.