Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat:用户个人视角 权限管理优化 #11138 #11365

Merged
merged 12 commits into from
Jan 6, 2025

Conversation

useryuyu
Copy link
Collaborator

@useryuyu useryuyu commented Jan 2, 2025

:resource-name="item.resourceTypeName"
:loading="item.tableLoading"
:group-name="item.resourceTypeName"
:type="'AUTHORIZATION'"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

没必要多余写个变量,直接type="AUTHORIZATION"就行

<i :class="{
'manage-icon manage-icon-down-shape': item.activeFlag,
'manage-icon manage-icon-right-shape': !item.activeFlag,
'shape-icon': true,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个可以把manage-icon放到下面

<span
:class="{
'resource-name': true,
'hover-link': ['codecc_task', 'pipeline', 'pipeline_group'].includes(row.resourceType)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

['codecc_task', 'pipeline', 'pipeline_group'].includes(row.resourceType)

你下面已经有个computed了这个可以在处理数据的时候就用个字段存起来的

const refTable = ref(null);
const resourceType = computed(() => props.resourceType);
const projectId = computed(() => route.params?.projectCode || route.query?.projectCode);
const tableList = computed(() => props.data);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个没有意义,不过你可以data里面加一些字段方便上面的template用

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里怎么还是没改,你直接用Props.data就行

const route = useRoute();
const { t } = useI18n();
const refTable = ref(null);
const resourceType = computed(() => props.resourceType);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个直接用props就行,没必要再弄个computed

* 跳转页面
*/
function handleToResourcePage (row) {
if (!(['codecc_task', 'pipeline', 'pipeline_group'].includes(row.resourceType))) return
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里这个判断还重复了

case 'pipeline_group':
window.open(`${location.origin}/console/pipeline/${projectId.value}/list/listAuth/${row.resourceCode}/${row.resourceName}?groupId=${row.groupId}`)
return
case 'codecc_task':
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

像这几个很多地方用到的,用枚举来维护,不要到处写的都是'codecc_task', 'pipeline', 'pipeline_group'

const { t } = useI18n();
const detailGroupTable = userDetailGroupTable();
const projectTable = computed(() => props.sourceList.filter(item => item.type === "AUTHORIZATION"));
const sourceTable= computed(() => props.sourceList.filter(item => item.type === "GROUP"));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我看你下面HandoverType有这个枚举,怎么不用?

<span
:class="{
'resource-name': true,
'hover-link': LINKABLE_RESOURCE_TYPES.includes(row.resourceType)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我说的是这个表达式,可以直接放到下面的computed提前声明

const refTable = ref(null);
const resourceType = computed(() => props.resourceType);
const projectId = computed(() => route.params?.projectCode || route.query?.projectCode);
const tableList = computed(() => props.data);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里

* 跳转页面
*/
function handleToResourcePage (row) {
if (!LINKABLE_RESOURCE_TYPES.includes(row.resourceType)) return
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这样就没必要在这里再计算一次了

:resource-name="item.resourceTypeName"
:loading="item.tableLoading"
:group-name="item.resourceTypeName"
type="AUTHORIZATION"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个枚举已经有了,直接用

>
<bk-collapse-panel
v-model="item.activeFlag"
:item-click="(type) => collapseClick(type, 'GROUP')"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里也是

:resource-name="item.resourceTypeName"
:loading="item.tableLoading"
:group-name="item.resourceTypeName"
type="GROUP"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里

const refTable = ref(null);
const resourceType = computed(() => props.resourceType);
const projectId = computed(() => route.params?.projectCode || route.query?.projectCode);
const tableList = computed(() => props.data);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里怎么还是没改,你直接用Props.data就行

return {
'permission-icon permission-icon-down-shape': activeFlag,
'permission-icon permission-icon-right-shape': !activeFlag,
'shape-icon': true
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里也是permission-icon 放下面去

@@ -47,7 +43,7 @@
:resource-name="item.resourceTypeName"
:loading="item.tableLoading"
:group-name="item.resourceTypeName"
:type="'AUTHORIZATION'"
type="AUTHORIZATION"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

枚举

@@ -97,7 +89,7 @@
:resource-name="item.resourceTypeName"
:loading="item.tableLoading"
:group-name="item.resourceTypeName"
:type="'GROUP'"
type="GROUP"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

枚举


if (currentRequestId === requestId) {
detailSourceList.value.forEach(item => {
if (authorizationList && item === authorizationItem) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

你这里authorizationList其实是个object,这种命名是有歧义的,如果是返回的空对象,这个if还是有可能可以进去的,这个会导致item.tableData是undefined,这个异常你有处理不?

@useryuyu useryuyu closed this Jan 3, 2025
@useryuyu useryuyu reopened this Jan 3, 2025
@bkci-bot bkci-bot merged commit d37c587 into TencentBlueKing:master Jan 6, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants