"use client"
import {useState} from "react"
import {Button, Card, Col, Form, Input, Modal, Popconfirm, Row, Select, Space, Table, Tag} from "antd"
import {DeleteOutlined, EditOutlined, PlusOutlined} from "@ant-design/icons"
import globalMessage from "@/app/_modules/globalMessage";
const { Option } = Select
// 模拟管网数据
const mockPipelineData = [
{
id: "P001",
name: "解放路主干线",
type: "主干管",
material: "钢管",
diameter: "DN400",
pressure: "0.4MPa",
length: 1200,
installDate: "2020-03-15",
status: "正常",
location: "解放路段",
},
{
id: "P002",
name: "人民路支线",
type: "支管",
material: "PE管",
diameter: "DN200",
pressure: "0.2MPa",
length: 800,
installDate: "2021-06-20",
status: "维护中",
location: "人民路段",
},
{
id: "P003",
name: "建设路次高压管",
type: "次高压管",
material: "钢管",
diameter: "DN600",
pressure: "0.8MPa",
length: 2000,
installDate: "2019-11-10",
status: "正常",
location: "建设路段",
},
]
const mockNodeData = [
{
id: "N001",
name: "解放路调压站",
type: "调压站",
inletPressure: "0.4MPa",
outletPressure: "0.2MPa",
capacity: "5000m³/h",
status: "运行",
location: "解放路与建设路交叉口",
},
{
id: "N002",
name: "人民路阀门井",
type: "阀门井",
inletPressure: "0.2MPa",
outletPressure: "0.2MPa",
capacity: "-",
status: "正常",
location: "人民路中段",
},
]
const mockWellData = [
{
id: "W001",
name: "解放路窨井001",
type: "检查井",
depth: "2.5m",
material: "混凝土",
coverType: "铸铁井盖",
status: "正常",
location: "解放路北段",
lastInspection: "2024-01-15",
},
{
id: "W002",
name: "人民路窨井002",
type: "阀门井",
depth: "3.0m",
material: "砖砌",
coverType: "复合井盖",
status: "需维护",
location: "人民路南段",
lastInspection: "2024-01-10",
},
]
export default function PipelineDataManagement() {
const [activeTab, setActiveTab] = useState("pipeline")
const [isModalVisible, setIsModalVisible] = useState(false)
const [editingRecord, setEditingRecord] = useState(null)
const [form] = Form.useForm()
const handleAdd = () => {
setEditingRecord(null)
form.resetFields()
setIsModalVisible(true)
}
const handleEdit = (record: any) => {
setEditingRecord(record)
form.setFieldsValue(record)
setIsModalVisible(true)
}
const handleDelete = (id: string) => {
globalMessage.success("删除成功")
}
const handleModalOk = () => {
form.validateFields().then((values) => {
if (editingRecord) {
globalMessage.success("更新成功")
} else {
globalMessage.success("添加成功")
}
setIsModalVisible(false)
form.resetFields()
})
}
const pipelineColumns = [
{ title: "管线编号", dataIndex: "id", key: "id" },
{ title: "管线名称", dataIndex: "name", key: "name" },
{ title: "管线类型", dataIndex: "type", key: "type" },
{ title: "管材", dataIndex: "material", key: "material" },
{ title: "管径", dataIndex: "diameter", key: "diameter" },
{ title: "压力等级", dataIndex: "pressure", key: "pressure" },
{ title: "长度(m)", dataIndex: "length", key: "length" },
{ title: "安装日期", dataIndex: "installDate", key: "installDate" },
{
title: "状态",
dataIndex: "status",
key: "status",
render: (status: string) => (