From 2d812ec4fda5d177fa31b34ab4210b3739ec590c Mon Sep 17 00:00:00 2001 From: tangjie <122778500@qq.com> Date: Tue, 7 Jul 2026 10:49:43 +0800 Subject: [PATCH] feat --- .../EnterpriseInfo/EquipInfo/index.js | 281 ++++++++++++++---- 1 file changed, 227 insertions(+), 54 deletions(-) diff --git a/src/pages/Container/EnterpriseInfo/EquipInfo/index.js b/src/pages/Container/EnterpriseInfo/EquipInfo/index.js index 52eff83..5423c37 100644 --- a/src/pages/Container/EnterpriseInfo/EquipInfo/index.js +++ b/src/pages/Container/EnterpriseInfo/EquipInfo/index.js @@ -1,5 +1,20 @@ import React, { useEffect, useState } from "react"; -import { Button, Descriptions, Form, Input, InputNumber, message, Modal, Row, Col, Table, Tag, Select, Space } from "antd"; +import { + Button, + Descriptions, + Form, + Input, + InputNumber, + message, + Modal, + Row, + Col, + Table, + Tag, + Select, + Space, +} from "antd"; +import { PlusOutlined } from "@ant-design/icons"; import PageLayout from "@cqsjjb/jjb-react-admin-component/PageLayout"; import TableAction from "@cqsjjb/jjb-react-admin-component/TableAction"; import SearchForm from "@cqsjjb/jjb-react-admin-component/SearchForm"; @@ -19,7 +34,11 @@ function EquipInfoPage(props) { const [currentId, setCurrentId] = useState(""); const [searchForm] = Form.useForm(); const { equipInfo } = props; - const { equipInfoList: dataSource, equipInfoTotal: total, equipInfoLoading: loading } = equipInfo || {}; + const { + equipInfoList: dataSource, + equipInfoTotal: total, + equipInfoLoading: loading, + } = equipInfo || {}; const handleSearch = () => { props.equipInfoList({ @@ -57,7 +76,10 @@ function EquipInfoPage(props) { cancelText: "否", onOk: async () => { const nextFlag = enabled ? 2 : 1; - const res = await props.equipInfoToggleStatus({ id, enableFlag: nextFlag }); + const res = await props.equipInfoToggleStatus({ + id, + enableFlag: nextFlag, + }); if (res?.success !== false) { message.success("操作成功"); handleSearch(); @@ -69,23 +91,54 @@ function EquipInfoPage(props) { }; return ( - + } + onClick={() => { + setCurrentId(""); + setFormModalOpen(true); + }} + > + 新增装备 + + } + > - + , - + , - + , - + 启用 禁用 @@ -103,19 +156,33 @@ function EquipInfoPage(props) { { const enabled = record.enableFlag === 1; - return {enabled ? "启用" : "禁用"}; + return ( + + {enabled ? "启用" : "禁用"} + + ); }, }, { @@ -123,16 +190,41 @@ function EquipInfoPage(props) { width: 180, render: (_, record) => ( - - - - + ), }, @@ -184,7 +276,13 @@ function EquipInfoPage(props) { } function EquipFormModal({ - open, currentId, equipInfoGet, equipInfoAdd, equipInfoEdit, onCancel, onSuccess, + open, + currentId, + equipInfoGet, + equipInfoAdd, + equipInfoEdit, + onCancel, + onSuccess, }) { const [form] = Form.useForm(); const [submitting, setSubmitting] = useState(false); @@ -198,14 +296,18 @@ function EquipFormModal({ } let cancelled = false; setDetailLoading(true); - equipInfoGet({ id: currentId }).then((res) => { - if (cancelled) return; - const data = res?.data || {}; - form.setFieldsValue(data); - }).finally(() => { - if (!cancelled) setDetailLoading(false); - }); - return () => { cancelled = true; }; + equipInfoGet({ id: currentId }) + .then((res) => { + if (cancelled) return; + const data = res?.data || {}; + form.setFieldsValue(data); + }) + .finally(() => { + if (!cancelled) setDetailLoading(false); + }); + return () => { + cancelled = true; + }; }, [open, currentId]); const handleCancel = () => { @@ -217,7 +319,9 @@ function EquipFormModal({ try { setSubmitting(true); if (currentId) values.id = currentId; - const res = await (currentId ? equipInfoEdit(values) : equipInfoAdd(values)); + const res = await (currentId + ? equipInfoEdit(values) + : equipInfoAdd(values)); if (res?.success !== false) { message.success(currentId ? "编辑成功" : "添加成功"); handleCancel(); @@ -244,27 +348,47 @@ function EquipFormModal({ - + - + - + - + - + @@ -274,13 +398,27 @@ function EquipFormModal({ - - + + - - + + @@ -289,8 +427,15 @@ function EquipFormModal({ - - + + @@ -303,7 +448,10 @@ function EquipFormModal({