-
Notifications
You must be signed in to change notification settings - Fork 416
feat: 多租户计划任务启动时间限制随时区变化 --story=130283561 #8164
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: 多租户计划任务启动时间限制随时区变化 --story=130283561 #8164
Conversation
# Reviewed, transaction id: 72551
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
代码审查总结
本次 PR 重构了日期验证逻辑,提取了 isDateBeforeToday 方法并增加了时区感知能力。整体改进方向正确,但存在一个严重的运行时错误需要立即修复。
🚨 严重问题
- 行 271-272:箭头函数中的
this绑定错误,会导致运行时报错
✨ 改进建议
虽然新方法 isDateBeforeToday 的时区处理逻辑正确,但建议添加对无效日期输入的容错处理。
建议操作:修复箭头函数的 this 绑定问题后即可合并。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
代码审查总结
本次 PR 重构了日期验证逻辑,提取了 isDateBeforeToday 方法并增加了时区感知能力。整体改进方向正确,但存在一个严重的运行时错误需要立即修复。
🚨 严重问题
箭头函数中的 this 绑定:在 pickerOptions.disabledDate 中使用箭头函数会导致 this 无法正确绑定到组件实例,运行时会报错 Cannot read property 'isDateBeforeToday' of undefined。
修复建议:
pickerOptions: {
disabledDate (date) { // 使用普通函数
return this.isDateBeforeToday(date)
}
}✨ 改进建议
新增的 isDateBeforeToday 方法时区处理逻辑正确,但建议添加对无效日期输入的容错处理(如 null/undefined)。
建议操作:修复箭头函数的 this 绑定问题后即可合并。
frontend/desktop/src/pages/task/ClockedList/EditClockedTask.vue
Outdated
Show resolved
Hide resolved
# Reviewed, transaction id: 72565
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
代码审查总结
本次变更重构了日期选择器的禁用日期逻辑,将其提取为可复用的 isDateBeforeToday 方法,并将 pickerOptions 改为计算属性以支持响应式更新。整体改进了代码的可维护性。
主要问题:
🔒 时区处理安全性:isDateBeforeToday 方法依赖全局的 moment 对象但未做防御性检查,可能导致运行时错误
次要建议:
✨ 新方法的文档注释清晰,逻辑改进合理
审查的文件:
- frontend/desktop/src/pages/task/ClockedList/EditClockedTask.vue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
代码审查完成
本次变更重构了日期选择器逻辑,整体改进合理。主要建议加强时区处理的防御性编程。
✅ 代码结构改进良好
🔒 建议添加 moment 依赖检查
| */ | ||
| isDateBeforeToday (date) { | ||
| if (!date) { | ||
| return false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔒 建议在使用 moment 和 moment.tz 前检查其是否已加载,避免运行时错误:if (!moment || !moment.tz) return false
1344718
into
TencentBlueKing:dev_multi_tenant
Reviewed, transaction id: 72551