专案优化
This commit is contained in:
@@ -11,8 +11,7 @@ import {
|
||||
message,
|
||||
Select,
|
||||
DatePicker,
|
||||
Typography,
|
||||
Spin
|
||||
Typography
|
||||
} from 'antd';
|
||||
import {
|
||||
ArrowLeftOutlined,
|
||||
@@ -259,7 +258,6 @@ export default function ProjectDetail() {
|
||||
|
||||
return (
|
||||
<div className="bg-gradient-to-b from-gray-50 to-white dark:from-gray-800 dark:to-gray-900/90 min-h-screen p-2">
|
||||
<Spin spinning={loading}>
|
||||
<Card
|
||||
className="shadow-lg rounded-lg border-0"
|
||||
title={
|
||||
@@ -431,7 +429,6 @@ export default function ProjectDetail() {
|
||||
|
||||
</Form>
|
||||
</Card>
|
||||
</Spin>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { Card, Table, Button, message, Popconfirm, Tag, Space, Select } from 'antd';
|
||||
import { PlusOutlined, EditOutlined, DeleteOutlined, EyeOutlined } from '@ant-design/icons';
|
||||
import { Card, Table, Button, message, Popconfirm, Tag, Space, Select, Tooltip } from 'antd';
|
||||
import { PlusOutlined, EditOutlined, DeleteOutlined, EyeOutlined, ShareAltOutlined } from '@ant-design/icons';
|
||||
import { useResources } from "@/hooks/resource/useResource";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { supabase } from "@/config/supabase";
|
||||
import dayjs from 'dayjs';
|
||||
import { useCopyToClipboard } from 'react-use';
|
||||
|
||||
const ProjectPage = () => {
|
||||
const navigate = useNavigate();
|
||||
@@ -19,6 +20,7 @@ const ProjectPage = () => {
|
||||
const [tasks, setTasks] = useState([]);
|
||||
const [loadingTasks, setLoadingTasks] = useState(false);
|
||||
const [selectedTask, setSelectedTask] = useState(null);
|
||||
const [state, copyToClipboard] = useCopyToClipboard();
|
||||
|
||||
const {
|
||||
resources: projects,
|
||||
@@ -164,7 +166,8 @@ const ProjectPage = () => {
|
||||
title: "操作",
|
||||
key: "action",
|
||||
fixed: "right",
|
||||
render: (_, record) => (
|
||||
render: (_, record) => {
|
||||
return (
|
||||
<Space size={0} className="dark:text-gray-300">
|
||||
<Button
|
||||
size="small"
|
||||
@@ -175,6 +178,25 @@ const ProjectPage = () => {
|
||||
>
|
||||
查看
|
||||
</Button>
|
||||
<Tooltip title="复制查看链接">
|
||||
<Button
|
||||
size="small"
|
||||
type="link"
|
||||
icon={<ShareAltOutlined />}
|
||||
onClick={() => {
|
||||
const viewUrl = `${window.location.origin}/company/projectView/${record.id}`;
|
||||
copyToClipboard(viewUrl);
|
||||
if (!state.error) {
|
||||
message.success('链接已复制到剪贴板');
|
||||
} else {
|
||||
message.error('复制失败,请手动复制');
|
||||
}
|
||||
}}
|
||||
className="dark:text-gray-300 dark:hover:text-blue-400"
|
||||
>
|
||||
分享
|
||||
</Button>
|
||||
</Tooltip>
|
||||
<Button
|
||||
size="small"
|
||||
type="link"
|
||||
@@ -203,7 +225,8 @@ const ProjectPage = () => {
|
||||
</Button>
|
||||
</Popconfirm>
|
||||
</Space>
|
||||
),
|
||||
);
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { useParams } from 'react-router-dom';
|
||||
import { useParams, useNavigate } from 'react-router-dom';
|
||||
import { supabase } from "@/config/supabase";
|
||||
import { Spin, Tag, Empty, Button, Modal, Form, Input, Collapse, message, Upload,Tabs, Select, Divider } from 'antd';
|
||||
import { PlusOutlined, FolderOpenOutlined, ClockCircleOutlined, InboxOutlined } from '@ant-design/icons';
|
||||
@@ -8,6 +8,7 @@ import {supabaseService}from '@/hooks/supabaseService'
|
||||
const type="project"
|
||||
export default function ProjectInfo() {
|
||||
const { id } = useParams();
|
||||
const navigate = useNavigate();
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [projectData, setProjectData] = useState(null);
|
||||
const [form] = Form.useForm();
|
||||
@@ -496,7 +497,10 @@ export default function ProjectInfo() {
|
||||
<Input.TextArea rows={4} placeholder="请输入资源描述" />
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item className="mb-0 flex justify-end gap-3">
|
||||
<Form.Item >
|
||||
<div className="mb-0 flex justify-end w-full gap-3">
|
||||
|
||||
|
||||
<Button
|
||||
onClick={() => {
|
||||
setIsModalVisible(false);
|
||||
@@ -508,23 +512,42 @@ export default function ProjectInfo() {
|
||||
<Button type="primary" htmlType="submit">
|
||||
确定
|
||||
</Button>
|
||||
</div>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
</Modal>
|
||||
);
|
||||
|
||||
// 加载状态展示
|
||||
if (loading) {
|
||||
return (
|
||||
<div className="flex items-center justify-center min-h-screen">
|
||||
<Spin tip="加载中..." />
|
||||
<div className="min-h-screen bg-gray-50/40 flex items-center justify-center">
|
||||
<div className="text-center">
|
||||
<Spin size="large" />
|
||||
<div className="mt-4 text-gray-500">加载项目信息中...</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (!projectData) {
|
||||
// 无项目数据状态(包括无 ID 和未找到项目)
|
||||
if (!projectData || !id) {
|
||||
return (
|
||||
<div className="flex items-center justify-center min-h-screen">
|
||||
<Empty description="未找到项目信息" />
|
||||
<div className="min-h-screen bg-gray-50/40 flex items-center justify-center">
|
||||
<Empty
|
||||
description={
|
||||
<div className="text-gray-500">
|
||||
<p className="mb-4">未找到项目信息</p>
|
||||
<Button
|
||||
onClick={() => navigate(-1)}
|
||||
className="bg-blue-50 text-blue-600 hover:bg-blue-100 border-none
|
||||
transition-colors duration-200"
|
||||
>
|
||||
返回上一页
|
||||
</Button>
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user