Skip to content

Commit

Permalink
fix: 修复修改标签名后资源列表不刷新数据的问题 (#869)
Browse files Browse the repository at this point in the history
* fix: 修复修改标签名后资源列表不刷新数据的问题

* fix: 修复i18n问题
# Reviewed, transaction id: 17348
  • Loading branch information
Carlmac authored Sep 4, 2024
1 parent a2c5a45 commit a6517e5
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/dashboard-front/src/language/lang.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1368,6 +1368,7 @@ const lang: ILANG = {
'发布日志': ['Release log'],
'校验应用权限': ['Validate application permissions'],
'(允许申请权限)': ['(Permission application allowed)'],
'(不允许申请权限)': ['(Permission application not allowed)'],
'公开': ['Public'],
'版本号须符合 Semver 规范': ['Version number must comply with Semver specification'],
'确认下架环境?': ['Confirm environment shutdown?'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,14 @@
</bk-select>
</template>
<script setup lang="ts">
import { ref, computed, toRefs, PropType, watch, toValue } from 'vue';
import {
ref,
computed,
toRefs,
PropType,
watch,
toValue,
} from 'vue';
import { Message } from 'bkui-vue';
import { useI18n } from 'vue-i18n';
import { cloneDeep } from 'lodash';
Expand Down Expand Up @@ -173,7 +180,9 @@ const handleToggle = async (v: boolean) => {
labelsData.value.forEach((item: any) => {
item.isEdited = false;
});
emit('close');
// 把新的标签数据传递出去
const newLabelData = labelsData.value.filter((label: any) => curLabelIds.value.includes(label.id));
emit('close', newLabelData);
}
}
}, 500);
Expand Down
17 changes: 14 additions & 3 deletions src/dashboard-front/src/views/resource/setting/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,9 @@
:labels-data="labelsData"
:width="selectCheckBoxParentRef?.offsetWidth"
force-focus
@close="handleCloseSelect"
@close="(newLabelData) => {
handleCloseSelect(row, newLabelData)
}"
@update-success="handleUpdateLabelSuccess"
@label-add-success="getLabelsData"></SelectCheckBox>
</section>
Expand Down Expand Up @@ -460,7 +462,7 @@
import { reactive, ref, watch, onMounted, onBeforeMount, shallowRef, h, computed, nextTick } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRouter, useRoute } from 'vue-router';
import { cloneDeep } from 'lodash';
import { cloneDeep, differenceBy } from 'lodash';
import { Message } from 'bkui-vue';
import { useQueryList, useSelection } from '@/hooks';
Expand Down Expand Up @@ -1120,10 +1122,19 @@ const getLabelsData = async () => {
};
// 未做变更关闭select下拉
const handleCloseSelect = () => {
const handleCloseSelect = (row: any, newLabelData: any = []) => {
tableData.value.forEach((item) => {
item.isEditLabel = false;
});
// 接收新的标签数据,检查标签的 name 是否有变化,有则重新获取列表数据
// 用于修复标签更改名称后,SelectCheckBox 组件的 update-success 不能触发,列表中的标签名没有相应更新的 bug
if (newLabelData.length > 0) {
const diff = differenceBy(row.labels, newLabelData, 'name');
if (diff.length > 0) {
getList();
init();
}
}
};
// 更新成功
Expand Down

0 comments on commit a6517e5

Please sign in to comment.