Skip to content

Commit

Permalink
feat: 进一步优化重构资源表格
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlmac committed Aug 27, 2024
1 parent 8339e6c commit 3551aad
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 415 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</bk-table-column>
<!-- 认证方式列 -->
<bk-table-column
:label="() => renderAuthConfigColLabel('add')"
:label="() => renderAuthConfigColLabel()"
:show-overflow-tooltip="false"
width="100"
>
Expand All @@ -37,7 +37,7 @@
</bk-table-column>
<!-- “是否公开”列 -->
<bk-table-column
:label="() => renderIsPublicColLabel('add')"
:label="() => renderIsPublicColLabel()"
width="100"
>
<template #default="{ row }: { row: ILocalImportedResource }">
Expand Down Expand Up @@ -169,7 +169,12 @@
</template>

<script lang="tsx" setup>
import { IAuthConfig, ILocalImportedResource, IPublicConfig } from '@/views/resource/setting/types';
import {
ActionType,
IAuthConfig,
ILocalImportedResource,
IPublicConfig,
} from '@/views/resource/setting/types';
import { ref, toRefs } from 'vue';
import { useI18n } from 'vue-i18n';
import { MethodsEnum } from '@/types';
Expand All @@ -185,16 +190,16 @@ const {
const { t } = useI18n();
const methodsEnum = Object.freeze(MethodsEnum);
type ActionType = 'add' | 'update';
interface IProps {
tableData: ILocalImportedResource[];
showDoc: boolean;
action: ActionType;
}
const props = withDefaults(defineProps<IProps>(), {
tableData: () => [],
showDoc: true,
action: 'add',
});
const emit = defineEmits<{
Expand All @@ -217,6 +222,7 @@ const tempPublicConfig = defineModel<IPublicConfig>('tempPublicConfig', {
const {
tableData,
showDoc,
action,
} = toRefs(props);
const pagination = ref({
Expand All @@ -241,8 +247,8 @@ const toggleRowUnchecked = (row: ILocalImportedResource) => {
};
// 批量修改认证方式确认后
const handleConfirmAuthConfig = (action: ActionType) => {
emit('confirm-auth-config', action);
const handleConfirmAuthConfig = () => {
emit('confirm-auth-config', action.value);
};
// 批量修改认证方式取消后
Expand All @@ -255,8 +261,8 @@ const handleCancelAuthConfig = () => {
};
// 批量修改公开设置确认后
const handleConfirmPublicConfig = (action: ActionType) => {
emit('confirm-pub-config', action);
const handleConfirmPublicConfig = () => {
emit('confirm-pub-config', action.value);
};
// 批量修改公开设置取消后
Expand All @@ -267,7 +273,7 @@ const handleCancelPublicConfig = () => {
}
};
const renderAuthConfigColLabel = (action: ActionType) => {
const renderAuthConfigColLabel = () => {
return (
<div>
<div class="auth-config-col-label">
Expand Down Expand Up @@ -309,7 +315,7 @@ const renderAuthConfigColLabel = (action: ActionType) => {
</bk-form>
</div>
}
onConfirm={() => handleConfirmAuthConfig(action)}
onConfirm={() => handleConfirmAuthConfig()}
onCancel={() => handleCancelAuthConfig()}
>
<i
Expand All @@ -329,7 +335,7 @@ const renderAuthConfigColLabel = (action: ActionType) => {
};
// 公开设置列 TSX
const renderIsPublicColLabel = (action: ActionType) => {
const renderIsPublicColLabel = () => {
return (
<div>
<div class="public-config-col-label">
Expand Down Expand Up @@ -367,7 +373,7 @@ const renderIsPublicColLabel = (action: ActionType) => {
</bk-form>
</div>
}
onConfirm={() => handleConfirmPublicConfig(action)}
onConfirm={() => handleConfirmPublicConfig()}
onCancel={() => handleCancelPublicConfig()}
>
<i
Expand Down
Loading

0 comments on commit 3551aad

Please sign in to comment.