初始化专案

This commit is contained in:
liamzi
2025-01-03 18:30:59 +08:00
parent f2773a0788
commit 276683d01c
4 changed files with 24 additions and 35 deletions

View File

@@ -15,8 +15,6 @@ export default function ChatAIDrawer({ open, onClose, onExport }) {
}); });
const messagesEndRef = useRef(null); const messagesEndRef = useRef(null);
// 当 messages 改变时,自动更新 session storage
useEffect(() => { useEffect(() => {
setStoredMessages(JSON.stringify(messages)); setStoredMessages(JSON.stringify(messages));
}, [messages, setStoredMessages]); }, [messages, setStoredMessages]);

View File

@@ -0,0 +1,7 @@
import React from 'react'
export default function ProjectDetail() {
return (
<div>ProjectDetail</div>
)
}

View File

@@ -14,10 +14,8 @@ import {
Divider, Divider,
} from "antd"; } from "antd";
import { import {
PlusOutlined,
ArrowLeftOutlined, ArrowLeftOutlined,
SaveOutlined, SaveOutlined,
DeleteOutlined,
} from "@ant-design/icons"; } from "@ant-design/icons";
import { supabase } from "@/config/supabase"; import { supabase } from "@/config/supabase";
import { useNavigate, useParams, useSearchParams } from "react-router-dom"; import { useNavigate, useParams, useSearchParams } from "react-router-dom";
@@ -42,17 +40,10 @@ const QuotationForm = () => {
const isView = id && !isEdit; const isView = id && !isEdit;
const [form] = Form.useForm(); const [form] = Form.useForm();
const navigate = useNavigate(); const navigate = useNavigate();
const [dataSource, setDataSource] = useState([{ id: Date.now() }]);
const [totalAmount, setTotalAmount] = useState(0);
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [currentCurrency, setCurrentCurrency] = useState("TWD"); const [currentCurrency, setCurrentCurrency] = useState("TWD");
const [customers, setCustomers] = useState([]); const [customers, setCustomers] = useState([]);
const [selectedCustomers, setSelectedCustomers] = useState([]);
const [formValues, setFormValues] = useState({}); const [formValues, setFormValues] = useState({});
const [templateModalVisible, setTemplateModalVisible] = useState(false);
const [availableSections, setAvailableSections] = useState([]);
const [editingSectionIndex, setEditingSectionIndex] = useState(null);
const [editingSectionName, setEditingSectionName] = useState("");
const [taxRate, setTaxRate] = useState(0); const [taxRate, setTaxRate] = useState(0);
const [discount, setDiscount] = useState(0); const [discount, setDiscount] = useState(0);
@@ -92,26 +83,6 @@ const QuotationForm = () => {
[calculateSectionTotal] [calculateSectionTotal]
); );
// 格式化货币
const formatCurrency = useMemo(
() =>
(amount, currency = currentCurrency) => {
const safeAmount = Number(amount) || 0;
return `${CURRENCY_SYMBOLS[currency] || ""}${safeAmount.toLocaleString(
"zh-CN",
{
minimumFractionDigits: 2,
maximumFractionDigits: 2,
}
)}`;
},
[currentCurrency]
);
useEffect(() => {
console.log(currentCurrency, 'currency');
}, [currentCurrency])
// 处理表单值变化
const handleValuesChange = (changedValues, allValues) => { const handleValuesChange = (changedValues, allValues) => {
setFormValues(allValues); setFormValues(allValues);
if (changedValues.currency) { if (changedValues.currency) {
@@ -182,9 +153,7 @@ const QuotationForm = () => {
setTaxRate(data.attributes.taxRate || 0); setTaxRate(data.attributes.taxRate || 0);
setDiscount(data.attributes.discount || 0); setDiscount(data.attributes.discount || 0);
if (data.attributes.customers) {
setSelectedCustomers(data.attributes.customers);
}
} }
} catch (error) { } catch (error) {
console.error("获取报价单详情失败:", error); console.error("获取报价单详情失败:", error);

View File

@@ -119,6 +119,21 @@ const companyRoutes = [
icon: "branches", icon: "branches",
roles: ["ADMIN", "OWNER"], roles: ["ADMIN", "OWNER"],
}, },
{
path: "project",
component: lazy(() => import("@/pages/company/project")),
name: "专案管理",
icon: "appstore",
roles: ["ADMIN", "OWNER"],
},
{
path: "projectInfo/:id?",
hidden: true,
component: lazy(() => import("@/pages/company/project/detail")),
name: "专案管理详情",
icon: "appstore",
roles: ["ADMIN", "OWNER"],
}
]; ];
const marketingRoutes = []; const marketingRoutes = [];