feat(product): 实现产品需求管理模块(后端 + 前端)

后端:Product Module(CRUD)、Requirement Module(CRUD + 状态机流转)、PrismaService
前端:产品列表页、产品详情页(含需求池 Tab)、Zustand Store、API 封装

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Script Generator
2026-06-08 11:06:16 +08:00
parent 8de1f93fd3
commit e261c3d0b8
27 changed files with 6993 additions and 3 deletions

View File

@@ -0,0 +1,62 @@
'use client';
import { useState } from 'react';
interface Props {
initialData?: { name: string; description: string };
onSubmit: (data: { name: string; description: string }) => void;
onCancel: () => void;
}
export function ProductForm({ initialData, onSubmit, onCancel }: Props) {
const [name, setName] = useState(initialData?.name || '');
const [description, setDescription] = useState(initialData?.description || '');
const handleSubmit = (e: React.FormEvent) => {
e.preventDefault();
if (!name.trim()) return;
onSubmit({ name: name.trim(), description: description.trim() });
};
return (
<form onSubmit={handleSubmit} className="space-y-4">
<div>
<label className="block text-sm font-medium text-gray-700">
<span className="text-red-500">*</span>
</label>
<input
type="text"
value={name}
onChange={(e) => setName(e.target.value)}
className="mt-1 block w-full rounded-md border border-gray-300 px-3 py-2 text-sm focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500"
placeholder="输入产品名称"
/>
</div>
<div>
<label className="block text-sm font-medium text-gray-700"></label>
<textarea
value={description}
onChange={(e) => setDescription(e.target.value)}
rows={3}
className="mt-1 block w-full rounded-md border border-gray-300 px-3 py-2 text-sm focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500"
placeholder="输入产品描述"
/>
</div>
<div className="flex justify-end gap-3">
<button
type="button"
onClick={onCancel}
className="rounded-md border border-gray-300 px-4 py-2 text-sm text-gray-700 hover:bg-gray-50"
>
</button>
<button
type="submit"
className="rounded-md bg-blue-600 px-4 py-2 text-sm text-white hover:bg-blue-700"
>
{initialData ? '保存' : '创建'}
</button>
</div>
</form>
);
}