feat(版本详情): 接入计划时间与日期选择
This commit is contained in:
@@ -9,14 +9,22 @@ import { useRequirementStore } from '@/stores/useRequirementStore';
|
||||
import { useMemberStore } from '@/stores/useMemberStore';
|
||||
import { useAuthStore } from '@/stores/useAuthStore';
|
||||
import { resolveMemberDisplayName } from '@/lib/member-system';
|
||||
import { WorkDateTimePicker } from '@/components/WorkDateTimePicker';
|
||||
import type { Priority } from '@/lib/derive';
|
||||
import type { BugSeverity } from '@/lib/bug';
|
||||
import { isoToLocal, localToISO } from '@/lib/work-hours';
|
||||
|
||||
interface Props {
|
||||
testCaseId: string;
|
||||
onClose: () => void;
|
||||
}
|
||||
|
||||
function defaultPlannedFixLocal(): string {
|
||||
const d = new Date();
|
||||
d.setHours(18, 0, 0, 0);
|
||||
return isoToLocal(d.toISOString());
|
||||
}
|
||||
|
||||
export function BugCreateModal({ testCaseId, onClose }: Props) {
|
||||
const { createBug } = useBugStore();
|
||||
const { testCases } = useTestCaseStore();
|
||||
@@ -42,10 +50,12 @@ export function BugCreateModal({ testCaseId, onClose }: Props) {
|
||||
const [severity, setSeverity] = useState<BugSeverity>('major');
|
||||
const [priority, setPriority] = useState<Priority>(tc?.priority || 'P1');
|
||||
const [assigneeId, setAssigneeId] = useState(defaultAssignee);
|
||||
const [plannedFixLocal, setPlannedFixLocal] = useState(defaultPlannedFixLocal);
|
||||
const [images, setImages] = useState<string[]>([]);
|
||||
const fileRef = useRef<HTMLInputElement>(null);
|
||||
|
||||
const canSubmit = title.trim() && description.trim() && assigneeId;
|
||||
const plannedFixAt = localToISO(plannedFixLocal);
|
||||
const canSubmit = title.trim() && description.trim() && assigneeId && Boolean(plannedFixAt);
|
||||
|
||||
const handleFiles = (files: FileList | null) => {
|
||||
if (!files) return;
|
||||
@@ -72,6 +82,7 @@ export function BugCreateModal({ testCaseId, onClose }: Props) {
|
||||
priority,
|
||||
reportedBy: operator,
|
||||
assigneeId,
|
||||
plannedFixAt,
|
||||
images: images.length > 0 ? images : undefined,
|
||||
}, operator);
|
||||
onClose();
|
||||
@@ -154,6 +165,15 @@ export function BugCreateModal({ testCaseId, onClose }: Props) {
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-[12px] text-[var(--ink-soft)] mb-1">计划修复时间 *</label>
|
||||
<WorkDateTimePicker
|
||||
value={plannedFixLocal}
|
||||
onChange={setPlannedFixLocal}
|
||||
placeholder="选择计划修复时间"
|
||||
defaultHour={18}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex justify-end gap-2 pt-4 border-t border-[var(--line)] mt-4">
|
||||
<button onClick={onClose} className="h-8 px-3 rounded-lg text-[12px] font-medium border border-[var(--line)] text-[var(--ink-soft)] hover:bg-[var(--bg-subtle)]">取消</button>
|
||||
|
||||
Reference in New Issue
Block a user