Skip to content

Commit

Permalink
fix: 时间选择器手动输入日期无效问题 (#823)
Browse files Browse the repository at this point in the history
* feat: 修复编辑基础信息弹框中维护人员不回显的问题
# Reviewed, transaction id: 10102

* feat: 全局配置
# Reviewed, transaction id: 10269

* feat: 修复基本信息编辑时,弹框中维护人员不显示的问题;获取全局配置 BK_APP_CODE 动态获取
# Reviewed, transaction id: 10784

* feat: 优化全局配置相关逻辑;全局配置增加本地开发 mock 接口
# Reviewed, transaction id: 10836

* feat: 修复编辑基础信息弹框中维护人员不回显的问题
# Reviewed, transaction id: 11294

* feat: 退出登录文案规范化
# Reviewed, transaction id: 11680

* deps(release-note): 更新release-note版本至beta14
# Reviewed, transaction id: 13772

* Merge remote-tracking branch 'base/release/1.13' into release/1.13
, # Reviewed, transaction id: 14655

* Feat 更改新LOGO (#81)

* feat: 更改新LOGO
# Reviewed, transaction id: 14692

* fix: 更正文本

* fix: 更正文本

* fix: 更正文本

* Merge remote-tracking branch 'base/release/1.13' into release/1.13
, # Reviewed, transaction id: 14922

* fix: 替换 favicon 和导航 title (#85)

# Reviewed, transaction id: 15075

* Fix 资源文档导入逻辑、样式优化和修复 (#92)

* fix: 调整文档勾选/覆盖/新增逻辑

* feat: 资源文档导入页逻辑优化和修正
# Reviewed, transaction id: 15312

* fix: 修复时间选择器手动输入无效的问题 (#90)

# Reviewed, transaction id: 15232

* Fix 时间选择器手动输入日期无效问题 (#95)

* fix: 修复时间选择器手动输入无效的问题
# Reviewed, transaction id: 15232

* fix: 修复日期选择器手动输入日期不生效的问题
# Reviewed, transaction id: 15344

* Merge remote-tracking branch 'base/release/1.13' into release/1.13
, # Reviewed, transaction id: 15533

* Merge branch 'release/1.13' of https://github.com/ielgnaw/blueking-apigateway into release/1.13
, # Reviewed, transaction id: 15534

---------

Co-authored-by: KDZhu <carlchu0113@gmail.com>
  • Loading branch information
ielgnaw and Carlmac authored Aug 16, 2024
1 parent 76e758a commit a45115b
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ import { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router';
import { getSyncHistory } from '@/http';
import TableEmpty from '@/components/table-empty.vue';
import { Message } from 'bkui-vue';
const router = useRouter();
const { t, locale } = useI18n();
Expand Down Expand Up @@ -270,10 +271,16 @@ const handleTimeClear = () => {
};
const handleTimeChange = () => {
pagination.current = 1;
nextTick(() => {
getComponents();
});
const internalValue = topDatePicker.value?.internalValue;
if (internalValue) {
dateTimeRange.value = internalValue;
pagination.current = 1;
nextTick(() => {
getComponents();
});
} else {
Message({ theme: 'warning', message: t('输入的时间错误'), delay: 2000, dismissable: false });
}
};
const init = () => {
Expand Down
31 changes: 20 additions & 11 deletions src/dashboard-front/src/views/monitor/alarm-history/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<bk-form class="flex-row">
<bk-form-item :label="t('选择时间')" class="ag-form-item-datepicker" label-width="85">
<bk-date-picker
ref="datePickerRef"
class="w320" v-model="initDateTimeRange" :key="dateKey"
:placeholder="t('选择日期时间范围')" :type="'datetimerange'"
:shortcuts="datepickerShortcuts" :shortcut-close="true" :use-shortcut-text="true" @clear="handleTimeClear"
Expand Down Expand Up @@ -150,6 +151,7 @@ import {
} from '@/http';
import { cloneDeep } from 'lodash';
import TableEmpty from '@/components/table-empty.vue';
import { Message } from 'bkui-vue';
const { t } = useI18n();
const common = useCommon();
Expand All @@ -163,6 +165,7 @@ const scrollLoading = ref<boolean>(false);
const initDateTimeRange = ref([]);
const alarmStrategies = ref([]);
const curStrategyCount = ref<number>(0);
const datePickerRef = ref(null);
const initParams = reactive({
limit: 10,
offset: 0,
Expand Down Expand Up @@ -225,17 +228,23 @@ const handleShortcutChange = (value: any, index: any) => {
};
// 日期快捷方式改变触发
const handleTimeChange = () => {
nextTick(async () => {
const startStr: any = (+new Date(`${initDateTimeRange.value[0]}`)) / 1000;
const endStr: any = (+new Date(`${initDateTimeRange.value[1]}`)) / 1000;
// eslint-disable-next-line radix
const satrt: any = parseInt(startStr);
// eslint-disable-next-line radix
const end: any = parseInt(endStr);
filterData.value.time_start = satrt;
filterData.value.time_end = end;
await fetchRefreshTable();
});
const internalValue = datePickerRef.value?.internalValue;
if (internalValue) {
initDateTimeRange.value = internalValue;
nextTick(async () => {
const startStr: any = (+new Date(`${initDateTimeRange.value[0]}`)) / 1000;
const endStr: any = (+new Date(`${initDateTimeRange.value[1]}`)) / 1000;
// eslint-disable-next-line radix
const satrt: any = parseInt(startStr);
// eslint-disable-next-line radix
const end: any = parseInt(endStr);
filterData.value.time_start = satrt;
filterData.value.time_end = end;
await fetchRefreshTable();
});
} else {
Message({ theme: 'warning', message: t('输入的时间错误'), delay: 2000, dismissable: false });
}
};
// 获取状态name
Expand Down
29 changes: 19 additions & 10 deletions src/dashboard-front/src/views/permission/record/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<bk-form class="flex-row">
<bk-form-item :label="t('选择时间')" class="ag-form-item-datepicker mb15" label-width="85">
<bk-date-picker
ref="datePickerRef"
class="w320" v-model="initDateTimeRange" :placeholder="t('选择日期时间范围')" :key="dateKey"
:type="'datetimerange'" :shortcuts="datepickerShortcuts" :shortcut-close="true" :use-shortcut-text="true"
@clear="handleTimeClear" :shortcut-selected-index="shortcutSelectedIndex"
Expand Down Expand Up @@ -179,6 +180,7 @@ import { useCommon } from '@/store';
import { useQueryList } from '@/hooks';
import { sortByKey } from '@/common/util';
import TableEmpty from '@/components/table-empty.vue';
import { Message } from 'bkui-vue';
const { t } = useI18n();
Expand All @@ -196,6 +198,7 @@ const initDateTimeRange = ref([]);
const resourceList = ref([]);
const shortcutSelectedIndex = ref<number>(-1);
const dateKey = ref('dateKey');
const datePickerRef = ref(null);
const curRecord = ref({
bk_app_code: '',
applied_by: '',
Expand Down Expand Up @@ -386,16 +389,22 @@ const handleShortcutChange = (value: any, index: any) => {
};
// 日期快捷方式改变触发
const handleTimeChange = () => {
nextTick(() => {
const startStr: any = (+new Date(`${initDateTimeRange.value[0]}`)) / 1000;
const endStr: any = (+new Date(`${initDateTimeRange.value[1]}`)) / 1000;
// eslint-disable-next-line radix
const satrt: any = parseInt(startStr);
// eslint-disable-next-line radix
const end: any = parseInt(endStr);
filterData.value.time_start = satrt;
filterData.value.time_end = end;
});
const internalValue = datePickerRef.value?.internalValue;
if (internalValue) {
initDateTimeRange.value = internalValue;
nextTick(() => {
const startStr: any = (+new Date(`${initDateTimeRange.value[0]}`)) / 1000;
const endStr: any = (+new Date(`${initDateTimeRange.value[1]}`)) / 1000;
// eslint-disable-next-line radix
const satrt: any = parseInt(startStr);
// eslint-disable-next-line radix
const end: any = parseInt(endStr);
filterData.value.time_start = satrt;
filterData.value.time_end = end;
});
} else {
Message({ theme: 'warning', message: t('输入的时间错误'), delay: 2000, dismissable: false });
}
};
// 展示详情
const handleShowRecord = (e: Event, data: any) => {
Expand Down
13 changes: 12 additions & 1 deletion src/dashboard-front/src/views/stage/published/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
:key="dateKey"
@change="handleChange"
@clear="handleClear"
@pick-success="handleComfirm">
@pick-success="handlePickSuccess">
</bk-date-picker>
</div>
<div class="flex-row justify-content-end">
Expand Down Expand Up @@ -114,6 +114,7 @@ import {
getReleaseHistories,
} from '@/http';
import TableEmpty from '@/components/table-empty.vue';
import { Message } from 'bkui-vue';
const router = useRouter();
Expand Down Expand Up @@ -206,6 +207,16 @@ watch(() => filterData.value, () => {
deep: true,
});
const handlePickSuccess = () => {
const internalValue = datePickerRef.value?.internalValue;
if (internalValue) {
dateValue.value = internalValue;
handleComfirm();
} else {
Message({ theme: 'warning', message: t('输入的时间错误'), delay: 2000, dismissable: false });
}
};
let timeId: any = null;
onMounted(() => {
Expand Down

0 comments on commit a45115b

Please sign in to comment.