ylj20011123 f59a57b41b update
2025-07-10 20:47:10 +08:00

972 lines
42 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import React, { useRef, useState, Suspense, useImperativeHandle, useEffect } from 'react';
import moment from 'moment'; // 时间相关引用,没有使用可以删除
import numeral from "numeral"; // 数字相关引用,没有使用可以删除
import { connect } from 'umi';
import useRequest from '@ahooksjs/use-request'; // 请求数据的引用
import Draggable from 'react-draggable';
import SubMenu from "antd/lib/menu/SubMenu";
import ProTable from '@ant-design/pro-table';
import ProDescriptions from '@ant-design/pro-descriptions';
import ProForm, { ProFormDatePicker, ProFormDateTimePicker, ProFormDigit, ProFormMoney, ProFormSelect, ProFormText, ProFormTextArea, ProFormUploadButton } from '@ant-design/pro-form';
import { MenuFoldOutlined, PlusOutlined, ExclamationCircleOutlined } from '@ant-design/icons';
import { PageContainer } from '@ant-design/pro-layout';
import { Button, Col, Drawer, message, Row, Popconfirm, Space, Image, Modal, Form, Switch, Upload, Tooltip, Descriptions, TreeSelect, Divider, Radio, Tabs } from 'antd';
import type { CurrentUser } from "umi";
import type { ConnectState } from '@/models/connect';
import type { ActionType, ProColumns } from '@ant-design/pro-table';
import type { ProDescriptionsItemProps } from '@ant-design/pro-descriptions';
import type { FormInstance } from 'antd';
import { getFieldEnumTree, getFieldEnumName } from "@/services/options"; // 枚举的引用,没有使用可以删除
import { handleGetServerpartInfo, handleNewGetSERVERPARTDetail } from '@/pages/newDataAnalysis/service';
import session from '@/utils/session';
import { handleGetNOTICEINFOList } from '@/pages/basicManage/highwayHeadlines/service';
type DetailProps = {
currentRow?: any;
onShow?: boolean;
onRef?: any
pageType?: number
}
const SERVERPARTTable = ({ currentRow, onShow, onRef, pageType }: DetailProps) => {
const actionRef = useRef<ActionType>();
const formRef = useRef<FormInstance>();
const [modalVisible, handleModalVisible] = useState<boolean>();
const [confirmLoading, handleConfirmLoading] = useState<boolean>(false) // 弹出框的内容表单是否在提交
// 服务区类型
const [serverPartType, setServerPartType] = useState<number>(2)
// 表单请求服务区的详情
const [serverPartDetail, setServerPartDetail] = useState<any>()
// 表单请求服务区的详情
const [formDetailAll, setFormDetailAll] = useState<any>()
// 片区的tab
const [areaTabList, setAreaTabList] = useState<any>()
// 选择的tab
const [selectTab, setSelectTab] = useState<any>()
const LOADBEARINGList = session.get('LOADBEARINGList')
// 拖动结束
// 站点类型(服务区、加油站、单位部门)枚举解析
const { data: serverpartsite_typeTree = [] } = useRequest(async () => {
return await getFieldEnumTree({ FieldExplainField: 'SERVERPARTSITE_TYPE', sessionName: 'SERVERPARTSITE_TYPE' })
})
// 统计类型(1000正式2000测试3000替代)枚举解析
const { data: datastatistics_typeTree = [] } = useRequest(async () => {
return await getFieldEnumTree({ FieldExplainField: 'DATASTATISTICS_TYPE', sessionName: 'DATASTATISTICS_TYPE' })
})
// 服务区类型枚举解析
const { data: serverpart_typeTree = [] } = useRequest(async () => {
return await getFieldEnumTree({ FieldExplainField: 'SERVERPART_TYPE', sessionName: 'SERVERPART_TYPE' })
})
useImperativeHandle(onRef, () => ({
formRef,
serverPartDetail,
formDetailAll
}));
useEffect(() => {
if (onShow) {
}
}, [onShow])
useEffect(async () => {
if (pageType === 2) {
if (currentRow?.SERVERPART_ID) {
const req: any = {
ServerpartId: currentRow?.SERVERPART_ID
}
const regData = await handleNewGetSERVERPARTDetail(req)
const list: any = regData.ServerPartInfo
console.log('regData', regData);
console.log('formDetailAll', formDetailAll);
if (list && list.length > 0) {
const obj: any = session.get('shopregionObj')
const res: any = []
list.forEach((item: any, index: number) => {
if (item.SERVERPART_REGION) {
res.push({ label: obj[item.SERVERPART_REGION], value: item.SERVERPART_REGION.toString(), key: item.SERVERPART_REGION.toString() })
if (index === 0) {
setSelectTab(item.SERVERPART_REGION.toString())
}
}
})
console.log('resresresres', res);
setAreaTabList(res)
} else {
setAreaTabList([])
setSelectTab(null)
}
}
}
}, [])
useEffect(() => {
// 确保 areaTabList 更新后selectTab 也正确设置
if (areaTabList && areaTabList.length > 0 && !selectTab) {
setSelectTab(areaTabList[0].key);
}
}, [areaTabList, selectTab]);
return (
<div>
<ProForm
layout={'horizontal'}
wrapperCol={{ span: 18 }} // 表单项 填写部分所占的栅格数
labelCol={{ span: 6 }} // 表单项 标题所占的栅格数
formRef={formRef}
autoFocusFirstInput
submitter={false}
preserve={true}
request={async () => {
if (currentRow?.SERVERPART_ID) {
const req: any = {
ServerpartId: currentRow?.SERVERPART_ID
}
const data = await handleNewGetSERVERPARTDetail(req)
console.log('detaildsdas', data);
const carryReq: any = {
SearchParameter: {
NOTICEINFO_TYPES: "3020",
SERVERPART_ID: currentRow?.SERVERPART_ID
}
}
const carryData = await handleGetNOTICEINFOList(carryReq)
console.log('carryDatacarryData', carryData);
setServerPartDetail(data)
const regionInfoList: any = data.ServerPartInfo
const serviceA: any = {}
const serviceB: any = {}
if (regionInfoList && regionInfoList.length > 0) {
setServerPartType(regionInfoList.length === 1 ? 1 : 2)
regionInfoList.forEach((item: any, index: number) => {
if (index === 0) {
for (const key in item) {
serviceA[`${key}_A`] = item[key] ? item[key] : item[key] === 0 ? 0 : ''
}
} else {
for (const key in item) {
serviceB[`${key}_B`] = item[key] ? item[key] : item[key] === 0 ? 0 : ''
}
}
})
}
console.log('serviceA', serviceA);
console.log('serviceB', serviceB);
const obj: any = {
...data,
...data.RtServerPart,
...serviceA,
...serviceB,
carryingCapacity: carryData && carryData.length > 0 ? Number(carryData[0].FEEDBACK_CONTENT) : "",
carryingCapacityObj: carryData && carryData.length > 0 ? carryData[0] : ""
}
console.log('dataProForm', obj);
setFormDetailAll(obj)
return obj
}
return {}
}}
onFinish={async (values) => {
}}
>
<Divider orientation="left"></Divider>
<Row>
<Col span={8}>
<ProFormText
name="SERVERPART_NAME"
label="服务区名称"
/>
</Col>
<Col span={8}>
<Form.Item
name="SERVERPART_TYPE"
label="服务区类型"
>
<TreeSelect
placeholder="请选择服务区类型"
dropdownStyle={{ maxHeight: 300, overflow: 'auto' }}
treeData={serverpart_typeTree}
allowClear
/>
</Form.Item>
</Col>
<Col span={8}>
<ProFormText
name="SERVERPART_CODE"
label="服务区编码"
disabled
/>
</Col>
<Col span={8}>
<ProFormText
name="EXPRESSWAY_NAME"
label="所在高速"
/>
</Col>
<Col span={8}>
<ProFormText
name="CENTERSTAKE_NUM"
label="中心桩号"
/>
</Col>
<Col span={8}>
<ProFormDigit
width="lg"
name="SERVERPART_INDEX"
label="服务区索引"
/>
</Col>
<Col span={8}>
<ProFormSelect
name="carryingCapacity"
label="承载情况"
options={LOADBEARINGList}
/>
</Col>
<Col span={16}>
<ProFormTextArea
name="SERVERPART_DESC"
label="路段说明"
labelCol={{ span: 3 }}
wrapperCol={{ span: 21 }}
/>
</Col>
<Col span={8}>
<ProFormText
name="MANAGERCOMPANY"
label="管理单位"
/>
</Col>
<Col span={8}>
<ProFormText
name="SERVERPART_ADDRESS"
label="市区县镇"
/>
</Col>
<Col span={8}>
<ProFormDatePicker
name="STARTDATE"
label="运营时间"
/>
</Col>
<Col span={8}>
<ProFormText
name="SERVERPART_X"
label="经  度"
/>
</Col>
<Col span={8}>
<ProFormText
name="SERVERPART_Y"
label="纬  度"
/>
</Col>
<Col span={8}>
<ProFormSelect
name="WATERINTAKE_TYPE"
label="取水形式"
fieldProps={{
options: [{ label: '自来水', value: 1 }, { label: '井水', value: 2 }]
}}
/>
</Col>
<Col span={8}>
<ProFormText
name="OWNEDCOMPANY"
label="产权单位"
/>
</Col>
<Col span={8}>
<ProFormText
name="TAXPAYER_IDENTIFYCODE"
label="信用代码"
/>
</Col>
<Col span={8}>
<ProFormSelect
name="SEWAGEDISPOSAL_TYPE"
label="污水处理形式"
fieldProps={{
options: [{ label: '市政', value: 1 }, { label: '污水处理设备', value: 2 }]
}}
/>
</Col>
<Col span={24}>
<ProFormTextArea
name="SERVERPART_INFO"
label="服务区说明"
labelCol={{ span: 2 }}
wrapperCol={{ span: 22 }}
/>
</Col>
</Row>
<Divider orientation="left"></Divider>
<Row>
<Col span={8}>
<ProFormText
name="FLOORAREA"
label="占地面积"
/>
</Col>
<Col span={8}>
<ProFormText
name="SHAREAREA"
label="停车场面积"
/>
</Col>
<Col span={8}>
<ProFormText
name="SERVERPART_AREA"
label="建筑面积"
/>
</Col>
</Row>
<Row style={{ marginBottom: '8px' }}>
<Col span={1}>
</Col>
<Col span={21}>
<Radio.Group onChange={(e: any) => {
setServerPartType(Number(e.target.value))
}} value={serverPartType}>
<Radio value={1}></Radio>
<Radio value={2}></Radio>
</Radio.Group>
</Col>
</Row>
{
pageType === 2 ?
<div style={{ width: '100%', boxSizing: 'border-box', padding: "0 48px" }}>
<Tabs activeKey={selectTab} onChange={(e: any) => {
setSelectTab(e)
}} items={areaTabList} />
</div> : ''
}
<div style={{ display: 'none' }}>
<Row>
<Col span={1}>
</Col>
<Col span={5}>
<ProFormSelect
label={"当前分区"}
name={"currentArea"}
disabled={serverPartType === 2 && currentRow?.currentArea}
request={async () => {
if (currentRow?.SERVERPART_ID) {
const req: any = {
ServerpartId: currentRow?.SERVERPART_ID
}
const regData = await handleNewGetSERVERPARTDetail(req)
const list: any = regData.ServerPartInfo
console.log('regData', regData);
console.log('formDetailAll222', formDetailAll);
if (list && list.length > 0) {
const obj: any = session.get('shopregionObj')
const res: any = []
list.forEach((item: any) => {
if (item.SERVERPART_REGION) {
res.push({ label: obj[item.SERVERPART_REGION], value: item.SERVERPART_REGION })
}
})
console.log('res', res);
formRef.current?.setFieldsValue({ currentArea: res[0].value })
return res
}
}
}}
/>
</Col>
<Col span={17}>
</Col>
</Row>
</div>
<div style={{ display: areaTabList && areaTabList.length > 0 && selectTab === areaTabList[0].key ? 'block' : 'none' }}>
<Divider orientation="left"></Divider>
<Row>
<Col span={8}>
<ProFormText
name="FLOORAREA_A"
label="占地面积"
/>
</Col>
<Col span={8}>
<ProFormText
name="PARKINGAREA_A"
label="停车场面积"
/>
</Col>
<Col span={8}>
<ProFormText
name="BUILDINGAREA_A"
label="停车场面积"
/>
</Col>
</Row>
<Divider orientation="left"></Divider>
<Row>
<Col span={8}>
<ProFormText
name="REFUELINGGUN92_A"
label="92#加油枪"
/>
</Col>
<Col span={8}>
<ProFormText
name="REFUELINGGUN95_A"
label="95#加油枪"
/>
</Col>
<Col span={8}>
<ProFormText
name="REFUELINGGUN0_A"
label="0#加油枪"
/>
</Col>
</Row>
<Divider orientation="left"></Divider>
<Row>
<Col span={8}>
<ProFormText
name="STATEGRIDCHARGE_A"
label="国网数量"
/>
</Col>
<Col span={8}>
<ProFormText
name="LIAUTOCHARGE_A"
label="理想5C数量"
/>
</Col>
<Col span={8}>
<ProFormText
name="GACENERGYCHARGE_A"
label="广汽能源数量"
/>
</Col>
<Col span={8}>
<ProFormText
name="OTHERCHARGE_A"
label="其他品牌"
/>
</Col>
<Col span={8}>
<ProFormText
name="LIVESTOCKPACKING_A"
label="充电桩总数"
/>
</Col>
</Row>
<Divider orientation="left"></Divider>
<Row>
<Col span={8}>
<ProFormSelect
name="HASMOTHER_A"
label="母婴室"
fieldProps={{
options: [{ label: '有', value: 1 }, { label: '无', value: 0 }]
}}
/>
</Col>
<Col span={8}>
<ProFormSelect
width="lg"
fieldProps={{
options: [{ label: '有', value: 1 }, { label: '无', value: 0 }]
}}
name="HASTHIRDTOILETS_A"
label="第三卫生间"
/>
</Col>
<Col span={8}>
<ProFormText
name="HASWATERROOM_A"
label="开水器数量"
/>
</Col>
<Col span={8}>
<ProFormText
name="HASPANTRY_A"
label="男厕数量"
/>
</Col>
<Col span={8}>
<ProFormText
name="HASWIFI_A"
label="女厕数量"
/>
</Col>
<Col span={8}>
<ProFormText
name="TOILETCOUNT_A"
label="潮汐厕位数量"
/>
</Col>
<Col span={8}>
<ProFormSelect
width="lg"
fieldProps={{
options: [{ label: '有', value: 1 }, { label: '无', value: 0 }]
}}
name="HASCHILD_A"
label="车辆维修"
/>
</Col>
<Col span={8}>
<ProFormSelect
width="lg"
fieldProps={{
options: [{ label: '有', value: 1 }, { label: '无', value: 0 }]
}}
name="VEHICLEWATERFILLING_A"
label="车辆加水"
/>
</Col>
<Col span={8}>
<ProFormSelect
width="lg"
fieldProps={{
options: [{ label: '有', value: 1 }, { label: '无', value: 0 }]
}}
name="HASPILOTLOUNGE_A"
label="司机之家"
/>
</Col>
<Col span={8}>
<ProFormText
name="HASSHOWERROOM_A"
label="淋浴房数量"
/>
</Col>
<Col span={8}>
<ProFormText
name="MICROWAVEOVEN_A"
label="微波炉数量"
/>
</Col>
<Col span={8}>
<ProFormText
name="WASHERCOUNT_A"
label="洗衣机数量"
/>
</Col>
<Col span={8}>
<ProFormText
name="SLEEPINGPODS_A"
label="睡眠舱数量"
/>
</Col>
</Row>
<Divider orientation="left"></Divider>
<Row>
<Col span={8}>
<ProFormText
name="SMALLPARKING_A"
label="轿车车位"
/>
</Col>
<Col span={8}>
<ProFormText
name="PACKING_A"
label="客车车位"
/>
</Col>
<Col span={8}>
<ProFormText
name="TRUCKPACKING_A"
label="货车车位"
/>
</Col>
<Col span={8}>
<ProFormText
name="DANPACKING_A"
label="危化品车位"
/>
</Col>
<Col span={8}>
<ProFormText
name="LONGPACKING_A"
label="超长车位"
/>
</Col>
</Row>
<Divider orientation="left"></Divider>
<Row>
<Col span={8}>
<ProFormSelect
name="BUSINESSTYPE_A"
label="餐饮模式"
/>
</Col>
<Col span={8}>
<ProFormText
name="DININGROOMCOUNT_A"
label="餐饮店数量"
/>
</Col>
<Col span={8}>
<ProFormText
name="HASBACKGROUNDRADIO_A"
label="便利店数量"
/>
</Col>
<Col span={8}>
<ProFormText
name="DININGBXCOUNT_A"
label="商铺数量"
/>
</Col>
<Col span={8}>
<ProFormSelect
width="lg"
fieldProps={{
options: [{ label: '有', value: 1 }, { label: '无', value: 0 }]
}}
name="HASMESSAGESEARCH_A"
label="具备住宿"
/>
</Col>
<Col span={8}>
<ProFormText
name="POINTCONTROLCOUNT_A"
label="客房数量"
/>
</Col>
</Row>
</div>
<div style={{ display: areaTabList && areaTabList.length > 1 && selectTab === areaTabList[1].key ? 'block' : 'none' }}>
{/* <Divider orientation="left">对向信息</Divider> */}
<div style={{ display: 'none' }}>
<Row>
<Col span={1}></Col>
<Col span={5}>
<ProFormSelect
label={"对向分区"}
name={"otherArea"}
disabled={currentRow?.otherArea}
request={async () => {
// let list = session.get('shopregionList')
// return list
if (currentRow?.SERVERPART_ID) {
const req: any = {
ServerpartId: currentRow?.SERVERPART_ID
}
const regData = await handleNewGetSERVERPARTDetail(req)
const list: any = regData.ServerPartInfo
console.log('list', list);
if (list && list.length > 0) {
const obj: any = session.get('shopregionObj')
const res: any = []
list.forEach((item: any) => {
if (item.SERVERPART_REGION) {
res.push({ label: obj[item.SERVERPART_REGION], value: item.SERVERPART_REGION })
}
})
console.log('res', res);
const other: any = formRef.current?.getFieldValue('currentArea')
res.forEach((item: any) => {
if (Number(item.value) !== Number(other)) {
formRef.current?.setFieldsValue({ otherArea: res[1].value })
}
})
return res
}
}
}}
/>
</Col>
</Row>
</div>
<Divider orientation="left"></Divider>
<Row>
<Col span={8}>
<ProFormText
name="FLOORAREA_B"
label="占地面积"
/>
</Col>
<Col span={8}>
<ProFormText
name="PARKINGAREA_B"
label="停车场面积"
/>
</Col>
<Col span={8}>
<ProFormText
name="BUILDINGAREA_B"
label="停车场面积"
/>
</Col>
</Row>
<Divider orientation="left"></Divider>
<Row>
<Col span={8}>
<ProFormText
name="REFUELINGGUN92_B"
label="92#加油枪"
/>
</Col>
<Col span={8}>
<ProFormText
name="REFUELINGGUN95_B"
label="95#加油枪"
/>
</Col>
<Col span={8}>
<ProFormText
name="REFUELINGGUN0_B"
label="0#加油枪"
/>
</Col>
</Row>
<Divider orientation="left"></Divider>
<Row>
<Col span={8}>
<ProFormText
name="STATEGRIDCHARGE_B"
label="国网数量"
/>
</Col>
<Col span={8}>
<ProFormText
name="LIAUTOCHARGE_B"
label="理想5C数量"
/>
</Col>
<Col span={8}>
<ProFormText
name="GACENERGYCHARGE_B"
label="广汽能源数量"
/>
</Col>
<Col span={8}>
<ProFormText
name="OTHERCHARGE_B"
label="其他品牌"
/>
</Col>
<Col span={8}>
<ProFormText
name="LIVESTOCKPACKING_B"
label="充电桩总数"
/>
</Col>
</Row>
<Divider orientation="left"></Divider>
<Row>
<Col span={8}>
<ProFormSelect
name="HASMOTHER_B"
label="母婴室"
fieldProps={{
options: [{ label: '有', value: 1 }, { label: '无', value: 0 }]
}}
/>
</Col>
<Col span={8}>
<ProFormSelect
width="lg"
fieldProps={{
options: [{ label: '有', value: 1 }, { label: '无', value: 0 }]
}}
name="HASTHIRDTOILETS_B"
label="第三卫生间"
/>
</Col>
<Col span={8}>
<ProFormText
name="HASWATERROOM_B"
label="开水器数量"
/>
</Col>
<Col span={8}>
<ProFormText
name="HASPANTRY_B"
label="男厕数量"
/>
</Col>
<Col span={8}>
<ProFormText
name="HASWIFI_B"
label="女厕数量"
/>
</Col>
<Col span={8}>
<ProFormText
name="TOILETCOUNT_B"
label="潮汐厕位数量"
/>
</Col>
<Col span={8}>
<ProFormSelect
width="lg"
fieldProps={{
options: [{ label: '有', value: 1 }, { label: '无', value: 0 }]
}}
name="HASCHILD_B"
label="车辆维修"
/>
</Col>
<Col span={8}>
<ProFormSelect
width="lg"
fieldProps={{
options: [{ label: '有', value: 1 }, { label: '无', value: 0 }]
}}
name="VEHICLEWATERFILLING_B"
label="车辆加水"
/>
</Col>
<Col span={8}>
<ProFormSelect
width="lg"
fieldProps={{
options: [{ label: '有', value: 1 }, { label: '无', value: 0 }]
}}
name="HASPILOTLOUNGE_B"
label="司机之家"
/>
</Col>
<Col span={8}>
<ProFormText
name="HASSHOWERROOM_B"
label="淋浴房数量"
/>
</Col>
<Col span={8}>
<ProFormText
name="MICROWAVEOVEN_B"
label="微波炉数量"
/>
</Col>
<Col span={8}>
<ProFormText
name="WASHERCOUNT_B"
label="洗衣机数量"
/>
</Col>
<Col span={8}>
<ProFormText
name="SLEEPINGPODS_B"
label="睡眠舱数量"
/>
</Col>
</Row>
<Divider orientation="left"></Divider>
<Row>
<Col span={8}>
<ProFormText
name="SMALLPARKING_B"
label="轿车车位"
/>
</Col>
<Col span={8}>
<ProFormText
name="PACKING_B"
label="客车车位"
/>
</Col>
<Col span={8}>
<ProFormText
name="TRUCKPACKING_B"
label="货车车位"
/>
</Col>
<Col span={8}>
<ProFormText
name="DANPACKING_B"
label="危化品车位"
/>
</Col>
<Col span={8}>
<ProFormText
name="LONGPACKING_B"
label="超长车位"
/>
</Col>
</Row>
<Divider orientation="left"></Divider>
<Row>
<Col span={8}>
<ProFormSelect
name="BUSINESSTYPE_B"
label="餐饮模式"
/>
</Col>
<Col span={8}>
<ProFormText
name="DININGROOMCOUNT_B"
label="餐饮店数量"
/>
</Col>
<Col span={8}>
<ProFormText
name="HASBACKGROUNDRADIO_B"
label="便利店数量"
/>
</Col>
<Col span={8}>
<ProFormText
name="DININGBXCOUNT_B"
label="商铺数量"
/>
</Col>
<Col span={8}>
<ProFormSelect
width="lg"
fieldProps={{
options: [{ label: '有', value: 1 }, { label: '无', value: 0 }]
}}
name="HASMESSAGESEARCH_B"
label="具备住宿"
/>
</Col>
<Col span={8}>
<ProFormText
name="POINTCONTROLCOUNT_B"
label="客房数量"
/>
</Col>
</Row>
</div>
</ProForm>
</div >
);
};
export default connect(({ user }: ConnectState) => ({
currentUser: user.currentUser
}))(SERVERPARTTable);