Skip to content

Commit

Permalink
fix: 修复url参数回填丢失的问题 (#3763)
Browse files Browse the repository at this point in the history
  • Loading branch information
shan-shuo authored Nov 7, 2024
1 parent 6adda38 commit 791372a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
1 change: 0 additions & 1 deletion bklog/web/src/store/retrieve.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ export default {
state.filedSettingConfigID = payload;
},
updateIndexSetList(state, payload) {
console.log(payload);
state.indexSetList.length = 0;
state.indexSetList = [];
state.indexSetList.push(...payload);
Expand Down
8 changes: 4 additions & 4 deletions bklog/web/src/views/retrieve-v2/monitor/monitor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import { handleTransformToTimestamp } from '@/components/time-range/utils';
import useStore from '@/hooks/use-store';
import { updateTimezone } from '@/language/dayjs';
import { ConditionOperator } from '@/store/condition-operator';
import { RetrieveUrlResolver } from '@/store/url-resolver';
import RouteUrlResolver, { RetrieveUrlResolver } from '@/store/url-resolver';
import { isEqual } from 'lodash';
import { useRoute, useRouter } from 'vue-router/composables';
Expand Down Expand Up @@ -165,16 +165,15 @@ const setRouteParams = () => {
const params = isUnionIndex
? { indexId: undefined }
: { indexId: ids?.[0] ?? route.query?.indexId };
const query = { ...route.query, ...params };
const resolver = new RetrieveUrlResolver({
...routeQueryParams.value,
...route.query,
indexId: params.indexId,
bizId: String(window.bk_biz_id),
datePickerValue: store.state.indexItem.datePickerValue,
});
Object.assign(query, resolver.resolveParamsToUrl());
if (!isEqual(query, route.query)) {
router.replace({
query,
Expand All @@ -184,7 +183,8 @@ const setRouteParams = () => {
const init = () => {
const result = handleTransformToTimestamp(props.timeRange);
store.commit('resetIndexsetItemParams', { start_time: result[0], end_time: result[1], datePickerValue: props.timeRange, timezone: props.timezone });
const resolver = new RouteUrlResolver({ route });
store.commit('updateIndexItem', { ...resolver.convertQueryToStore(), start_time: result[0], end_time: result[1], datePickerValue: props.timeRange, });
store.commit('updateIndexId', '');
store.commit('updateUnionIndexList', []);
getIndexSetList();
Expand Down

0 comments on commit 791372a

Please sign in to comment.