超管后台 - 对接新建项目
This commit is contained in:
@@ -23,7 +23,7 @@ class CompanyController extends Controller
|
|||||||
public function create()
|
public function create()
|
||||||
{
|
{
|
||||||
// 获取参数
|
// 获取参数
|
||||||
$params = Request::only(['name', 'nickname', 'account', 'password', 'realName', 'memo']);
|
$params = Request::only(['name', 'nickname', 'account', 'password', 'realName', 'description']);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// 开启事务
|
// 开启事务
|
||||||
@@ -33,7 +33,7 @@ class CompanyController extends Controller
|
|||||||
// 1. 调用创建部门接口
|
// 1. 调用创建部门接口
|
||||||
$departmentResponse = $curl->setMethod('post')->send('v1/api/account/department/create', [
|
$departmentResponse = $curl->setMethod('post')->send('v1/api/account/department/create', [
|
||||||
'name' => $params['name'],
|
'name' => $params['name'],
|
||||||
'memo' => $params['memo'] ?: '',
|
'memo' => $params['description'] ?: '',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$departmentData = json_decode($departmentResponse, true);
|
$departmentData = json_decode($departmentResponse, true);
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle }
|
|||||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"
|
||||||
import { ArrowLeft } from "lucide-react"
|
import { ArrowLeft } from "lucide-react"
|
||||||
import Link from "next/link"
|
import Link from "next/link"
|
||||||
import { toast } from "sonner"
|
import { toast, Toaster } from "sonner"
|
||||||
|
|
||||||
export default function NewProjectPage() {
|
export default function NewProjectPage() {
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
@@ -67,10 +67,10 @@ export default function NewProjectPage() {
|
|||||||
toast.success("创建成功")
|
toast.success("创建成功")
|
||||||
router.push("/dashboard/projects")
|
router.push("/dashboard/projects")
|
||||||
} else {
|
} else {
|
||||||
toast.error(data.msg || "创建失败")
|
toast.error(data.msg)
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
toast.error("创建失败,请稍后重试")
|
toast.error("网络错误,请稍后重试")
|
||||||
} finally {
|
} finally {
|
||||||
setIsSubmitting(false)
|
setIsSubmitting(false)
|
||||||
}
|
}
|
||||||
@@ -78,6 +78,7 @@ export default function NewProjectPage() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="space-y-6">
|
<div className="space-y-6">
|
||||||
|
<Toaster richColors position="top-center" />
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<Button variant="outline" size="icon" asChild>
|
<Button variant="outline" size="icon" asChild>
|
||||||
<Link href="/dashboard/projects">
|
<Link href="/dashboard/projects">
|
||||||
|
|||||||
Reference in New Issue
Block a user