Skip to content

Commit

Permalink
feature: 回显添加路径title
Browse files Browse the repository at this point in the history
  • Loading branch information
lhzzforever committed May 9, 2023
1 parent 8ef6b42 commit 686f768
Show file tree
Hide file tree
Showing 9 changed files with 68 additions and 24 deletions.
6 changes: 4 additions & 2 deletions frontend/src/views/grading-admin/create/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -910,13 +910,15 @@
this.users.forEach(item => {
subjects.push({
type: 'user',
id: item.username
id: item.username,
full_name: item.full_name
});
});
this.departments.forEach(item => {
subjects.push({
type: 'department',
id: item.id
id: item.id,
full_name: item.full_name
});
});
}
Expand Down
9 changes: 6 additions & 3 deletions frontend/src/views/grading-admin/detail/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -188,19 +188,22 @@
departments.push({
name: item.name,
count: item.member_count,
fullName: item.full_name
fullName: item.full_name,
full_name: item.full_name || item.fullName
});
}
if (item.type === 'user') {
users.push({
name: item.name,
username: item.id
username: item.id,
full_name: item.full_name || item.fullName
});
}
if (item.id === '*' && item.type === '*') {
departments.push({
name: this.$t(`m.common['全员']`),
count: 'All'
count: 'All',
full_name: `${this.$t(`m.common['全员']`)}(All)`
});
}
});
Expand Down
18 changes: 11 additions & 7 deletions frontend/src/views/grading-admin/edit/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@
</bk-button>
<bk-button @click="handleCancel">{{ $t(`m.common['取消']`) }}</bk-button>
</div>

<add-member-dialog
:show.sync="isShowAddMemberDialog"
:users="users"
Expand All @@ -209,7 +208,7 @@
:all-checked="isAll"
show-limit
@on-cancel="handleCancelAdd"
@on-sumbit="handleSumbitAdd" />
@on-sumbit="handleSubmitAdd" />

<add-action-sideslider
:is-show.sync="isShowAddActionSideslider"
Expand Down Expand Up @@ -886,12 +885,13 @@
this.isShowMemberAdd = true;
},
handleSumbitAdd (payload) {
handleSubmitAdd (payload) {
window.changeDialog = true;
const { users, departments } = payload;
this.isAll = payload.isAll;
this.users = _.cloneDeep(users);
this.departments = _.cloneDeep(departments);
console.log(this.users, this.departments);
this.isShowMemberAdd = false;
this.isShowAddMemberDialog = false;
this.isShowMemberEmptyError = false;
Expand All @@ -916,13 +916,15 @@
this.users.forEach(item => {
subjects.push({
type: 'user',
id: item.username
id: item.username,
full_name: item.full_name
});
});
this.departments.forEach(item => {
subjects.push({
type: 'department',
id: item.id
id: item.id,
full_name: item.full_name || item.fullName
});
});
}
Expand Down Expand Up @@ -1003,13 +1005,15 @@
this.users.forEach(item => {
subjects.push({
type: 'user',
id: item.username
id: item.username,
full_name: item.full_name
});
});
this.departments.forEach(item => {
subjects.push({
type: 'department',
id: item.id
id: item.id,
full_name: item.full_name || item.fullName
});
});
}
Expand Down
31 changes: 29 additions & 2 deletions frontend/src/views/group/common/render-member-display.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,16 @@
<span class="name">{{ title }}</span>
</label>
<div class="content">
<!-- <div v-for="(item, index) in data"
:key="index"
class="member-item"
:title="isDepartment ? (
item.fullName ? item.fullName : `${item.name}`) :
item.name !== '' ? `${item.username}(${item.name})` : item.username"> -->
<div v-for="(item, index) in data"
:key="index"
class="member-item"
:title="isDepartment ? (item.fullName ? `${item.fullName}` : `${item.name}`) :
item.name !== '' ? `${item.username}(${item.name})` : item.username">
:title="nameType(item)">
<span class="member-name">
{{ isDepartment ? item.name : item.username }}
</span>
Expand Down Expand Up @@ -54,6 +59,28 @@
},
isEdit () {
return this.mode === 'edit';
},
nameType () {
return (payload) => {
console.log(5555, payload);
const { name, type, username, full_name: fullName } = payload;
const typeMap = {
user: () => {
if (fullName) {
return fullName;
} else {
return name ? `${username}(${name})` : username;
}
},
department: () => {
return fullName || payload.fullName || `${username}(${name})`;
},
depart: () => {
return fullName || payload.fullName || `${username}(${name})`;
}
};
return typeMap[type] ? typeMap[type]() : typeMap['user']();
};
}
},
methods: {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/views/group/components/iam-add-member.vue
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@
}
},
depart: () => {
return fullName || name;
return fullName || payload.fullName || name;
}
};
return typeMap[type] ? typeMap[type]() : typeMap['user']();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,19 +222,22 @@
departments.push({
name: item.name,
count: item.member_count,
fullName: item.full_name
fullName: item.full_name,
full_name: item.full_name || item.fullName
});
}
if (item.type === 'user') {
users.push({
name: item.name,
username: item.id
username: item.id,
full_name: item.full_name || item.fullName
});
}
if (item.id === '*' && item.type === '*') {
departments.push({
name: this.$t(`m.common['全员']`),
count: 'All'
count: 'All',
full_name: `${this.$t(`m.common['全员']`)}(All)`
});
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@
}
},
depart: () => {
return fullName || name;
return fullName || payload.fullName || name;
}
};
return typeMap[type] ? typeMap[type]() : typeMap['user']();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,19 +191,22 @@
departments.push({
name: item.name,
count: item.member_count,
fullName: item.full_name
fullName: item.full_name,
full_name: item.full_name || item.fullName
});
}
if (item.type === 'user') {
users.push({
name: item.name,
username: item.id
username: item.id,
full_name: item.full_name || item.fullName
});
}
if (item.id === '*' && item.type === '*') {
departments.push({
name: this.$t(`m.common['全员']`),
count: 'All'
count: 'All',
full_name: `${this.$t(`m.common['全员']`)}(All)`
});
}
});
Expand Down
6 changes: 4 additions & 2 deletions frontend/src/views/my-manage-space/create/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -896,13 +896,15 @@
this.users.forEach((item) => {
subjects.push({
type: 'user',
id: item.username
id: item.username,
full_name: item.full_name
});
});
this.departments.forEach((item) => {
subjects.push({
type: 'department',
id: item.id
id: item.id,
full_name: item.full_name || item.fullName
});
});
}
Expand Down

0 comments on commit 686f768

Please sign in to comment.