Sbledata.tsx 49 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071
  1. import React, {useMemo, useState} from "react";
  2. import {Badge, Button, Col, ConfigProvider, Modal, Row, Select, Table,} from "antd"
  3. export default function getGisSbleData(props: { height: string }) {
  4. // 添加设备类型筛选状态
  5. const [typeFilter, setTypeFilter] = useState('all');
  6. // 添加导航按钮状态管理
  7. const [activeNavButton, setActiveNavButton] = useState("realtime");
  8. // 设备列表状态
  9. const [GISdeviceModalVisible, setGISDeviceModalVisible] = useState(false)
  10. const [GISselectedDevice, setGISSelectedDevice] = useState(null)
  11. // 添加图片预览相关状态
  12. const [previewImage, setPreviewImage] = useState<string | null>(null);
  13. const [previewVisible, setPreviewVisible] = useState(false);
  14. //gis设备列表
  15. const EquipmentListData = {
  16. columns: [
  17. {
  18. title: () => (
  19. <div style={{
  20. textAlign: 'center',
  21. // color: 'white',
  22. // padding: '8px' // 保持内边距一致
  23. }}>
  24. 设备名称
  25. </div>
  26. ),
  27. dataIndex: "name",
  28. width: 100,
  29. ellipsis: true,
  30. render: (text, record) => ( // 添加record参数获取行数据
  31. <div
  32. style={{
  33. // backgroundColor: '#e8e8e8',
  34. textAlign: 'center',
  35. cursor: 'pointer', // 显示手型光标
  36. color: 'white', // 单元格字体颜色
  37. fontWeight: 'bold'
  38. // transition: 'background-color 0.2s' // 过渡效果
  39. }}
  40. onClick={() => {
  41. // 设置选中设备并打开弹窗
  42. setGISSelectedDevice(record);
  43. setGISDeviceModalVisible(true);
  44. }}
  45. onMouseOver={(e) => {
  46. e.currentTarget.style.backgroundColor = '#3b2e50'; // 鼠标悬停效果
  47. }}
  48. onMouseOut={(e) => {
  49. e.currentTarget.style.backgroundColor = 'transparent'; // 恢复原背景色
  50. }}
  51. >
  52. {text}
  53. </div>
  54. ),
  55. },
  56. {
  57. title: () => (
  58. <div style={{
  59. // padding: '8px',
  60. textAlign: 'center',
  61. // color: 'white' // 统一文字颜色
  62. }}>
  63. <div>设备类型</div>
  64. {/* 添加下拉筛选器 */}
  65. <Select
  66. defaultValue="all"
  67. style={{width: 100}}
  68. onChange={(value) => setTypeFilter(value)}
  69. size="small"
  70. >
  71. <Select.Option value="all">全部</Select.Option>
  72. <Select.Option value="电用井盖">电用井盖</Select.Option>
  73. <Select.Option value="供水井盖">供水井盖</Select.Option>
  74. <Select.Option value="通信井盖">通信井盖</Select.Option>
  75. <Select.Option value="燃气井盖">燃气井盖</Select.Option>
  76. <Select.Option value="污水井盖">污水井盖</Select.Option>
  77. <Select.Option value="雨水井盖">雨水井盖</Select.Option>
  78. <Select.Option value="路灯井盖">路灯井盖</Select.Option>
  79. <Select.Option value="网络井盖">网络井盖</Select.Option>
  80. <Select.Option value="电缆井盖">电缆井盖</Select.Option>
  81. <Select.Option value="园林井盖">园林井盖</Select.Option>
  82. <Select.Option value="化粪池井盖">化粪池井盖</Select.Option>
  83. </Select>
  84. </div>
  85. ),
  86. dataIndex: "type",
  87. width: 150,
  88. ellipsis: true,
  89. render: (text, record) => ( // 添加record参数获取行数据
  90. <div
  91. style={{
  92. // padding: '8px 0',
  93. textAlign: 'center',
  94. cursor: 'pointer',
  95. color: 'white', // 单元格字体颜色
  96. fontWeight: 'bold'
  97. // transition: 'background-color 0.2s'
  98. }}
  99. onClick={() => {
  100. // 设置选中设备并打开弹窗
  101. setGISSelectedDevice(record);
  102. setGISDeviceModalVisible(true);
  103. }}
  104. onMouseOver={(e) => {
  105. e.currentTarget.style.backgroundColor = '#3b2e50';
  106. }}
  107. onMouseOut={(e) => {
  108. e.currentTarget.style.backgroundColor = 'transparent';
  109. }}
  110. >
  111. {text}
  112. </div>
  113. ),
  114. },
  115. {
  116. title: () => ( // 将标题改为函数组件,自定义表头样式
  117. <div style={{
  118. // padding: '8px',
  119. textAlign: 'center',
  120. // color: 'white' // 统一文字颜色
  121. }}>
  122. 设备电量
  123. </div>
  124. ),
  125. dataIndex: "electricity",
  126. width: 100,
  127. render: (text) => {
  128. // 根据电量值设置背景色和文字色
  129. const bgColor = text < '30' ? '#fff1f0' : // 低电量:浅红背景
  130. text < '50' ? '#fffbe6' : // 中电量:浅黄背景
  131. '#f6ffed'; // 高电量:浅绿背景
  132. const textColor = text < '30' ? '#f5222d' : // 低电量:红色文字
  133. text < '50' ? '#faad14' : // 中电量:橙色文字
  134. '#52c41a'; // 高电量:绿色文字
  135. return (
  136. <div style={{
  137. backgroundColor: bgColor, // 单元格背景色
  138. color: textColor, // 文字颜色(确保与背景对比度)
  139. fontWeight: 'bold',
  140. textAlign: 'center', // 文字居中
  141. borderRadius: '4px' // 圆角边框(可选)
  142. }}>
  143. {text}%
  144. </div>
  145. );
  146. },
  147. }
  148. ],
  149. data: [{
  150. id: '1',
  151. name: '井盖一',
  152. type: '电用井盖',
  153. electricity: '80',
  154. facilityCode: '5001110103009062',
  155. region: '东三路米香街道',
  156. regionGrade: '暂无',
  157. locationDescription: '东三路A地铁口向西方向300米',
  158. competentDepartment: '东三路社区服务中心',
  159. ownershipUnit: 'A市住房和城乡建设委员会',
  160. maintenanceUnit: 'A市住房和城乡建设委员会',
  161. nameOfPersonInCharge: '张三',
  162. PhoneOfPersonInCharge: '15399665548',
  163. status: '1',
  164. manholeType: '1',
  165. manholeCover: '暂无',
  166. manholeShape: '圆形',
  167. constructionTime: '2025-09-15 20:57:42',
  168. longitude: '110.22252454',
  169. latitude: '27.1148554',
  170. manholeImage: 'manholeimg.png',
  171. QRCode: '/QRCode.jpg',
  172. }, {
  173. id: '2',
  174. name: '井盖二',
  175. type: '供水井盖',
  176. electricity: '80',
  177. facilityCode: '5001110103009062',
  178. region: '东三路米香街道',
  179. regionGrade: '暂无',
  180. locationDescription: '东三路A地铁口向西方向300米',
  181. competentDepartment: '东三路社区服务中心',
  182. ownershipUnit: 'A市住房和城乡建设委员会',
  183. maintenanceUnit: 'A市住房和城乡建设委员会',
  184. nameOfPersonInCharge: '张三',
  185. PhoneOfPersonInCharge: '15399665548',
  186. status: '0',
  187. manholeType: '1',
  188. manholeCover: '暂无',
  189. manholeShape: '圆形',
  190. constructionTime: '2025-09-15 20:57:42',
  191. longitude: '110.22252454',
  192. latitude: '27.1148554',
  193. manholeImage: 'manholeimg.png',
  194. QRCode: '/QRCode.jpg',
  195. }, {
  196. id: '3',
  197. name: '井盖三',
  198. type: '通信井盖',
  199. electricity: '80',
  200. facilityCode: '5001110103009062',
  201. region: '东三路米香街道',
  202. regionGrade: '暂无',
  203. locationDescription: '东三路A地铁口向西方向300米',
  204. competentDepartment: '东三路社区服务中心',
  205. ownershipUnit: 'A市住房和城乡建设委员会',
  206. maintenanceUnit: 'A市住房和城乡建设委员会',
  207. nameOfPersonInCharge: '张三',
  208. PhoneOfPersonInCharge: '15399665548',
  209. status: '1',
  210. manholeType: '1',
  211. manholeCover: '暂无',
  212. manholeShape: '圆形',
  213. constructionTime: '2025-09-15 20:57:42',
  214. longitude: '110.22252454',
  215. latitude: '27.1148554',
  216. manholeImage: 'manholeimg.png',
  217. QRCode: '/QRCode.jpg',
  218. }, {
  219. id: '4',
  220. name: '井盖四',
  221. type: '污水井盖',
  222. electricity: '80',
  223. facilityCode: '5001110103009062',
  224. region: '东三路米香街道',
  225. regionGrade: '暂无',
  226. locationDescription: '东三路A地铁口向西方向300米',
  227. competentDepartment: '东三路社区服务中心',
  228. ownershipUnit: 'A市住房和城乡建设委员会',
  229. maintenanceUnit: 'A市住房和城乡建设委员会',
  230. nameOfPersonInCharge: '张三',
  231. PhoneOfPersonInCharge: '15399665548',
  232. status: '1',
  233. manholeType: '1',
  234. manholeCover: '暂无',
  235. manholeShape: '圆形',
  236. constructionTime: '2025-09-15 20:57:42',
  237. longitude: '110.22252454',
  238. latitude: '27.1148554',
  239. manholeImage: 'manholeimg.png',
  240. QRCode: '/QRCode.jpg',
  241. }, {
  242. id: '5',
  243. name: '井盖五',
  244. type: '污水井盖',
  245. electricity: '80',
  246. facilityCode: '5001110103009062',
  247. region: '东三路米香街道',
  248. regionGrade: '暂无',
  249. locationDescription: '东三路A地铁口向西方向300米',
  250. competentDepartment: '东三路社区服务中心',
  251. ownershipUnit: 'A市住房和城乡建设委员会',
  252. maintenanceUnit: 'A市住房和城乡建设委员会',
  253. nameOfPersonInCharge: '张三',
  254. PhoneOfPersonInCharge: '15399665548',
  255. status: '1',
  256. manholeType: '1',
  257. manholeCover: '暂无',
  258. manholeShape: '圆形',
  259. constructionTime: '2025-09-15 20:57:42',
  260. longitude: '110.22252454',
  261. latitude: '27.1148554',
  262. manholeImage: 'manholeimg.png',
  263. QRCode: '/QRCode.jpg',
  264. }, {
  265. id: '6',
  266. name: '井盖六',
  267. type: '污水井盖',
  268. electricity: '80',
  269. facilityCode: '5001110103009062',
  270. region: '东三路米香街道',
  271. regionGrade: '暂无',
  272. locationDescription: '东三路A地铁口向西方向300米',
  273. competentDepartment: '东三路社区服务中心',
  274. ownershipUnit: 'A市住房和城乡建设委员会',
  275. maintenanceUnit: 'A市住房和城乡建设委员会',
  276. nameOfPersonInCharge: '张三',
  277. PhoneOfPersonInCharge: '15399665548',
  278. status: '1',
  279. manholeType: '1',
  280. manholeCover: '暂无',
  281. manholeShape: '圆形',
  282. constructionTime: '2025-09-15 20:57:42',
  283. longitude: '110.22252454',
  284. latitude: '27.1148554',
  285. manholeImage: 'manholeimg.png',
  286. QRCode: '/QRCode.jpg',
  287. }, {
  288. id: '7',
  289. name: '井盖七',
  290. type: '通信井盖',
  291. electricity: '80',
  292. facilityCode: '5001110103009062',
  293. region: '东三路米香街道',
  294. regionGrade: '暂无',
  295. locationDescription: '东三路A地铁口向西方向300米',
  296. competentDepartment: '东三路社区服务中心',
  297. ownershipUnit: 'A市住房和城乡建设委员会',
  298. maintenanceUnit: 'A市住房和城乡建设委员会',
  299. nameOfPersonInCharge: '张三',
  300. PhoneOfPersonInCharge: '15399665548',
  301. status: '1',
  302. manholeType: '1',
  303. manholeCover: '暂无',
  304. manholeShape: '圆形',
  305. constructionTime: '2025-09-15 20:57:42',
  306. longitude: '110.22252454',
  307. latitude: '27.1148554',
  308. manholeImage: 'manholeimg.png',
  309. QRCode: '/QRCode.jpg',
  310. }, , {
  311. id: '8',
  312. name: '井盖八',
  313. type: '通信井盖',
  314. electricity: '80',
  315. facilityCode: '5001110103009062',
  316. region: '东三路米香街道',
  317. regionGrade: '暂无',
  318. locationDescription: '东三路A地铁口向西方向300米',
  319. competentDepartment: '东三路社区服务中心',
  320. ownershipUnit: 'A市住房和城乡建设委员会',
  321. maintenanceUnit: 'A市住房和城乡建设委员会',
  322. nameOfPersonInCharge: '张三',
  323. PhoneOfPersonInCharge: '15399665548',
  324. status: '1',
  325. manholeType: '1',
  326. manholeCover: '暂无',
  327. manholeShape: '圆形',
  328. constructionTime: '2025-09-15 20:57:42',
  329. longitude: '110.22252454',
  330. latitude: '27.1148554',
  331. manholeImage: 'manholeimg.png',
  332. QRCode: '/QRCode.jpg',
  333. }, {
  334. id: '9',
  335. name: '井盖九',
  336. type: '通信井盖',
  337. electricity: '80',
  338. facilityCode: '5001110103009062',
  339. region: '东三路米香街道',
  340. regionGrade: '暂无',
  341. locationDescription: '东三路A地铁口向西方向300米',
  342. competentDepartment: '东三路社区服务中心',
  343. ownershipUnit: 'A市住房和城乡建设委员会',
  344. maintenanceUnit: 'A市住房和城乡建设委员会',
  345. nameOfPersonInCharge: '张三',
  346. PhoneOfPersonInCharge: '15399665548',
  347. status: '1',
  348. manholeType: '1',
  349. manholeCover: '暂无',
  350. manholeShape: '圆形',
  351. constructionTime: '2025-09-15 20:57:42',
  352. longitude: '110.22252454',
  353. latitude: '27.1148554',
  354. manholeImage: 'manholeimg.png',
  355. QRCode: '/QRCode.jpg',
  356. }, {
  357. id: '10',
  358. name: '井盖十',
  359. type: '通信井盖',
  360. electricity: '80',
  361. facilityCode: '5001110103009062',
  362. region: '东三路米香街道',
  363. regionGrade: '暂无',
  364. locationDescription: '东三路A地铁口向西方向300米',
  365. competentDepartment: '东三路社区服务中心',
  366. ownershipUnit: 'A市住房和城乡建设委员会',
  367. maintenanceUnit: 'A市住房和城乡建设委员会',
  368. nameOfPersonInCharge: '张三',
  369. PhoneOfPersonInCharge: '15399665548',
  370. status: '1',
  371. manholeType: '1',
  372. manholeCover: '暂无',
  373. manholeShape: '圆形',
  374. constructionTime: '2025-09-15 20:57:42',
  375. longitude: '110.22252454',
  376. latitude: '27.1148554',
  377. manholeImage: 'manholeimg.png',
  378. QRCode: '/QRCode.jpg',
  379. }, {
  380. id: '11',
  381. name: '井盖十一',
  382. type: '通信井盖',
  383. electricity: '80',
  384. facilityCode: '5001110103009062',
  385. region: '东三路米香街道',
  386. regionGrade: '暂无',
  387. locationDescription: '东三路A地铁口向西方向300米',
  388. competentDepartment: '东三路社区服务中心',
  389. ownershipUnit: 'A市住房和城乡建设委员会',
  390. maintenanceUnit: 'A市住房和城乡建设委员会',
  391. nameOfPersonInCharge: '张三',
  392. PhoneOfPersonInCharge: '15399665548',
  393. status: '1',
  394. manholeType: '1',
  395. manholeCover: '暂无',
  396. manholeShape: '圆形',
  397. constructionTime: '2025-09-15 20:57:42',
  398. longitude: '110.22252454',
  399. latitude: '27.1148554',
  400. manholeImage: 'manholeimg.png',
  401. QRCode: '/QRCode.jpg',
  402. }, {
  403. id: '12',
  404. name: '井盖十二',
  405. type: '通信井盖',
  406. electricity: '80',
  407. facilityCode: '5001110103009062',
  408. region: '东三路米香街道',
  409. regionGrade: '暂无',
  410. locationDescription: '东三路A地铁口向西方向300米',
  411. competentDepartment: '东三路社区服务中心',
  412. ownershipUnit: 'A市住房和城乡建设委员会',
  413. maintenanceUnit: 'A市住房和城乡建设委员会',
  414. nameOfPersonInCharge: '张三',
  415. PhoneOfPersonInCharge: '15399665548',
  416. status: '1',
  417. manholeType: '1',
  418. manholeCover: '暂无',
  419. manholeShape: '圆形',
  420. constructionTime: '2025-09-15 20:57:42',
  421. longitude: '110.22252454',
  422. latitude: '27.1148554',
  423. manholeImage: 'manholeimg.png',
  424. QRCode: '/QRCode.jpg',
  425. }],
  426. }
  427. // 使用 useMemo 动态计算筛选数据,依赖 typeFilter 和 EquipmentListData.data
  428. const filteredData = useMemo(() => {
  429. return typeFilter === 'all'
  430. ? EquipmentListData.data
  431. : EquipmentListData.data.filter(item => item.type === typeFilter);
  432. }, [typeFilter, EquipmentListData.data]); // 当筛选条件或原始数据变化时重新计算
  433. const popUpdata = {
  434. columns: [
  435. {
  436. title: () => (
  437. <div style={{
  438. textAlign: 'center',
  439. // color: 'white',
  440. // padding: '8px' // 保持内边距一致
  441. }}>
  442. 设备ID
  443. </div>
  444. ),
  445. dataIndex: "codeID",
  446. width: 150,
  447. ellipsis: true,
  448. render: (text, record) => ( // 添加record参数获取行数据
  449. <div
  450. style={{
  451. // backgroundColor: '#e8e8e8',
  452. textAlign: 'center',
  453. cursor: 'pointer', // 显示手型光标
  454. color: 'white', // 单元格字体颜色
  455. fontWeight: 'bold'
  456. // transition: 'background-color 0.2s' // 过渡效果
  457. }}
  458. >
  459. {text}
  460. </div>
  461. ),
  462. },
  463. {
  464. title: () => (
  465. <div style={{
  466. textAlign: 'center',
  467. // color: 'white',
  468. // padding: '8px' // 保持内边距一致
  469. }}>
  470. 检测时间
  471. </div>
  472. ),
  473. dataIndex: "date",
  474. ellipsis: true,
  475. render: (text, record) => ( // 添加record参数获取行数据
  476. <div
  477. style={{
  478. // backgroundColor: '#e8e8e8',
  479. textAlign: 'center',
  480. cursor: 'pointer', // 显示手型光标
  481. color: 'white', // 单元格字体颜色
  482. fontWeight: 'bold'
  483. // transition: 'background-color 0.2s' // 过渡效果
  484. }}
  485. >
  486. {text}
  487. </div>
  488. ),
  489. },
  490. {
  491. title: () => (
  492. <div style={{
  493. textAlign: 'center',
  494. // color: 'white',
  495. // padding: '8px' // 保持内边距一致
  496. }}>
  497. 温度(℃)
  498. </div>
  499. ),
  500. dataIndex: "temperature",
  501. ellipsis: true,
  502. render: (text, record) => ( // 添加record参数获取行数据
  503. <div
  504. style={{
  505. // backgroundColor: '#e8e8e8',
  506. textAlign: 'center',
  507. cursor: 'pointer', // 显示手型光标
  508. color: 'white', // 单元格字体颜色
  509. fontWeight: 'bold'
  510. // transition: 'background-color 0.2s' // 过渡效果
  511. }}
  512. >
  513. {text}
  514. </div>
  515. ),
  516. },
  517. {
  518. title: () => (
  519. <div style={{
  520. textAlign: 'center',
  521. // color: 'white',
  522. // padding: '8px' // 保持内边距一致
  523. }}>
  524. 角度(°)
  525. </div>
  526. ),
  527. dataIndex: "angle",
  528. ellipsis: true,
  529. render: (text, record) => ( // 添加record参数获取行数据
  530. <div
  531. style={{
  532. // backgroundColor: '#e8e8e8',
  533. textAlign: 'center',
  534. cursor: 'pointer', // 显示手型光标
  535. color: 'white', // 单元格字体颜色
  536. fontWeight: 'bold'
  537. // transition: 'background-color 0.2s' // 过渡效果
  538. }}
  539. >
  540. {text}
  541. </div>
  542. ),
  543. }, {
  544. title: () => (
  545. <div style={{
  546. textAlign: 'center',
  547. // color: 'white',
  548. // padding: '8px' // 保持内边距一致
  549. }}>
  550. 电压(V)
  551. </div>
  552. ),
  553. dataIndex: "voltage",
  554. ellipsis: true,
  555. render: (text, record) => ( // 添加record参数获取行数据
  556. <div
  557. style={{
  558. // backgroundColor: '#e8e8e8',
  559. textAlign: 'center',
  560. cursor: 'pointer', // 显示手型光标
  561. color: 'white', // 单元格字体颜色
  562. fontWeight: 'bold'
  563. // transition: 'background-color 0.2s' // 过渡效果
  564. }}
  565. >
  566. {text}
  567. </div>
  568. ),
  569. }
  570. ],
  571. data: [{
  572. id: '1', // 添加唯一 id 作为 rowKey
  573. date: '2016-05-02',
  574. codeID: '5001110103009062',
  575. temperature: '29',
  576. angle: '4',
  577. voltage: '3.6'
  578. }, {
  579. id: '1', // 添加唯一 id 作为 rowKey
  580. date: '2016-05-02',
  581. codeID: '5001110103009062',
  582. temperature: '29',
  583. angle: '4',
  584. voltage: '3.6'
  585. }, {
  586. id: '1', // 添加唯一 id 作为 rowKey
  587. date: '2016-05-02',
  588. codeID: '5001110103009062',
  589. temperature: '29',
  590. angle: '4',
  591. voltage: '3.6'
  592. }, {
  593. id: '1', // 添加唯一 id 作为 rowKey
  594. date: '2016-05-02',
  595. codeID: '5001110103009062',
  596. temperature: '29',
  597. angle: '4',
  598. voltage: '3.6'
  599. }, {
  600. id: '1', // 添加唯一 id 作为 rowKey
  601. date: '2016-05-02',
  602. codeID: '5001110103009062',
  603. temperature: '29',
  604. angle: '4',
  605. voltage: '3.6'
  606. }, {
  607. id: '1', // 添加唯一 id 作为 rowKey
  608. date: '2016-05-02',
  609. codeID: '5001110103009062',
  610. temperature: '29',
  611. angle: '4',
  612. voltage: '3.6'
  613. }, {
  614. id: '1', // 添加唯一 id 作为 rowKey
  615. date: '2016-05-02',
  616. codeID: '5001110103009062',
  617. temperature: '29',
  618. angle: '4',
  619. voltage: '3.6'
  620. }, {
  621. id: '1', // 添加唯一 id 作为 rowKey
  622. date: '2016-05-02',
  623. codeID: '5001110103009062',
  624. temperature: '29',
  625. angle: '4',
  626. voltage: '3.6'
  627. }, {
  628. id: '1', // 添加唯一 id 作为 rowKey
  629. date: '2016-05-02',
  630. codeID: '5001110103009062',
  631. temperature: '29',
  632. angle: '4',
  633. voltage: '3.6'
  634. }, {
  635. id: '1', // 添加唯一 id 作为 rowKey
  636. date: '2016-05-02',
  637. codeID: '5001110103009062',
  638. temperature: '29',
  639. angle: '4',
  640. voltage: '3.6'
  641. }, {
  642. id: '1', // 添加唯一 id 作为 rowKey
  643. date: '2016-05-02',
  644. codeID: '5001110103009062',
  645. temperature: '29',
  646. angle: '4',
  647. voltage: '3.6'
  648. }, {
  649. id: '1', // 添加唯一 id 作为 rowKey
  650. date: '2016-05-02',
  651. codeID: '5001110103009062',
  652. temperature: '29',
  653. angle: '4',
  654. voltage: '3.6'
  655. }, {
  656. id: '1', // 添加唯一 id 作为 rowKey
  657. date: '2016-05-02',
  658. codeID: '5001110103009062',
  659. temperature: '29',
  660. angle: '4',
  661. voltage: '3.6'
  662. }, {
  663. id: '1', // 添加唯一 id 作为 rowKey
  664. date: '2016-05-02',
  665. codeID: '5001110103009062',
  666. temperature: '29',
  667. angle: '4',
  668. voltage: '3.6'
  669. },]
  670. }
  671. return (
  672. <ConfigProvider
  673. theme={{
  674. components: {
  675. Table: {
  676. headerBorderRadius: 0,
  677. },
  678. },
  679. }}
  680. >
  681. <div style={{height: props.height}}>
  682. <Table
  683. className="custom-table"
  684. style={{
  685. width: '100%',
  686. height: '100%',
  687. // 可选:设置表格背景透明,避免覆盖容器背景
  688. backgroundColor: 'transparent'
  689. }}
  690. rowClassName={(record, index) => {
  691. // return 'bg-[#3a3899]';
  692. }}
  693. columns={EquipmentListData.columns}
  694. dataSource={filteredData}
  695. pagination={false}
  696. rowKey="id"
  697. size="small"
  698. scroll={{x: 200, y: 420}}
  699. />
  700. {/* GIS设备详情弹窗 */}
  701. <Modal
  702. title="GIS设备详情"
  703. open={GISdeviceModalVisible}
  704. onCancel={() => setGISDeviceModalVisible(false)}
  705. // footer={null}
  706. width={1200}
  707. className="custom-modal"
  708. style={{
  709. textAlign: 'center'
  710. }}
  711. >
  712. {GISselectedDevice && (
  713. <div className="space-y-4" style={{
  714. display: 'flex',
  715. justifyContent: 'space-between'
  716. }}>
  717. <div style={{
  718. width: '50%',
  719. }}>
  720. <div className="space-y-4" style={{textAlign: 'left'}}>
  721. <Row gutter={16}>
  722. <Col span={12}>
  723. <div>
  724. <strong style={{
  725. color: '#B0E0E6'
  726. }}>设备名称:</strong> {GISselectedDevice.name}
  727. </div>
  728. </Col>
  729. <Col span={12}>
  730. <div>
  731. <strong style={{
  732. color: '#B0E0E6'
  733. }}>设备类型:</strong> {GISselectedDevice.type}
  734. </div>
  735. </Col>
  736. </Row>
  737. <Row gutter={16}>
  738. <Col span={12}>
  739. <div>
  740. <strong style={{
  741. color: '#B0E0E6'
  742. }}>设备电量:</strong> {GISselectedDevice.electricity}%
  743. </div>
  744. </Col>
  745. <Col span={12}>
  746. <div>
  747. <strong style={{
  748. color: '#B0E0E6'
  749. }}>设备编号:</strong>{GISselectedDevice.facilityCode}
  750. </div>
  751. </Col>
  752. </Row>
  753. <Row gutter={16}>
  754. <Col span={12}>
  755. <div>
  756. <strong style={{
  757. color: '#B0E0E6'
  758. }}>所属区域:</strong> {GISselectedDevice.region}
  759. </div>
  760. </Col>
  761. <Col span={12}>
  762. <div>
  763. <strong style={{
  764. color: '#B0E0E6'
  765. }}>道路等级:</strong> {GISselectedDevice.regionGrade}
  766. </div>
  767. </Col>
  768. </Row>
  769. <Row gutter={16}>
  770. <Col span={12}>
  771. <div>
  772. <strong style={{
  773. color: '#B0E0E6'
  774. }}>位置描述:</strong> {GISselectedDevice.locationDescription}
  775. </div>
  776. </Col>
  777. <Col span={12}>
  778. <div>
  779. <strong style={{
  780. color: '#B0E0E6'
  781. }}>主管部门:</strong> {GISselectedDevice.competentDepartment}
  782. </div>
  783. </Col>
  784. </Row>
  785. <Row gutter={16}>
  786. <Col span={12}>
  787. <div>
  788. <strong style={{
  789. color: '#B0E0E6'
  790. }}>权属单位:</strong> {GISselectedDevice.ownershipUnit}
  791. </div>
  792. </Col>
  793. <Col span={12}>
  794. <div>
  795. <strong style={{
  796. color: '#B0E0E6'
  797. }}>养护单位:</strong> {GISselectedDevice.maintenanceUnit}
  798. </div>
  799. </Col>
  800. </Row>
  801. <Row gutter={16}>
  802. <Col span={12}>
  803. <div>
  804. <strong style={{
  805. color: '#B0E0E6'
  806. }}>负责人姓名:</strong> {GISselectedDevice.nameOfPersonInCharge}
  807. </div>
  808. </Col>
  809. <Col span={12}>
  810. <div>
  811. <strong style={{
  812. color: '#B0E0E6'
  813. }}>负责人电话:</strong> {GISselectedDevice.PhoneOfPersonInCharge}
  814. </div>
  815. </Col>
  816. </Row>
  817. <Row gutter={16}>
  818. <Col span={12}>
  819. <div>
  820. <strong style={{
  821. color: '#B0E0E6'
  822. }}>设施状态:</strong>
  823. <Badge
  824. style={{
  825. marginLeft: '10px'
  826. }}
  827. status={GISselectedDevice.status === "1" ? "success" : "error"}
  828. text={
  829. <span style={{
  830. color: GISselectedDevice.status === "1" ? "#52c41a" : "#f5222d"
  831. }}>
  832. {GISselectedDevice.status === "1" ? "正常" : "异常"}
  833. </span>
  834. }
  835. />
  836. </div>
  837. </Col>
  838. <Col span={12}>
  839. <div>
  840. <strong style={{
  841. color: '#B0E0E6'
  842. }}>是否智能井盖:</strong>
  843. <Badge
  844. style={{
  845. color: 'white'
  846. }}
  847. status={GISselectedDevice.manholeType === "0" ? "1" : "2"}
  848. text={GISselectedDevice.manholeType === "1" ? "是" : "否"}
  849. />
  850. </div>
  851. </Col>
  852. </Row>
  853. <Row gutter={16}>
  854. <Col span={12}>
  855. <div>
  856. <strong style={{
  857. color: '#B0E0E6'
  858. }}>井盖材质:</strong> {GISselectedDevice.manholeCover}
  859. </div>
  860. </Col>
  861. <Col span={12}>
  862. <div>
  863. <strong style={{
  864. color: '#B0E0E6'
  865. }}>井身形状:</strong> {GISselectedDevice.manholeShape}
  866. </div>
  867. </Col>
  868. </Row>
  869. <Row gutter={16}>
  870. <Col span={12}>
  871. <div>
  872. <strong style={{
  873. color: '#B0E0E6'
  874. }}>建设时问:</strong> {GISselectedDevice.constructionTime}
  875. </div>
  876. </Col>
  877. <Col span={12}>
  878. <div>
  879. <strong style={{
  880. color: '#B0E0E6'
  881. }}>经纬度:</strong> {GISselectedDevice.longitude}°N, {GISselectedDevice.latitude}°E
  882. </div>
  883. </Col>
  884. </Row>
  885. <Row gutter={16}>
  886. <Col span={12}>
  887. <div>
  888. <strong style={{
  889. color: '#B0E0E6'
  890. }}>井盖图片:</strong>
  891. <img
  892. src={GISselectedDevice.manholeImage}
  893. alt="井盖图片"
  894. style={{width: '60%', marginTop: '10px', cursor: 'pointer'}}
  895. onClick={() => {
  896. setPreviewImage(GISselectedDevice.manholeImage);
  897. setPreviewVisible(true);
  898. }}
  899. />
  900. </div>
  901. </Col>
  902. <Col span={12}>
  903. <div>
  904. <strong style={{
  905. color: '#B0E0E6'
  906. }}>二维码:</strong>
  907. {/* 二维码图片也添加点击放大功能 */}
  908. <img
  909. src={GISselectedDevice.QRCode}
  910. alt="二维码"
  911. style={{width: '60%', marginTop: '10px', cursor: 'pointer'}}
  912. onClick={() => {
  913. setPreviewImage(GISselectedDevice.QRCode);
  914. setPreviewVisible(true);
  915. }}
  916. />
  917. </div>
  918. </Col>
  919. </Row>
  920. </div>
  921. </div>
  922. {/*GIS井盖详情第二模块*/}
  923. {/*GIS井盖详情第二模块 - 修改为按钮式导航*/}
  924. <div style={{width: '50%'}}>
  925. {/* 按钮式导航 */}
  926. <div style={{marginBottom: '16px', textAlign: 'left'}}>
  927. <Button.Group>
  928. <Button
  929. type={activeNavButton === "realtime" ? "primary" : "default"}
  930. onClick={() => setActiveNavButton("realtime")}
  931. style={{minWidth: '120px'}}
  932. >
  933. 实时监测
  934. </Button>
  935. <Button
  936. type={activeNavButton === "history" ? "primary" : "default"}
  937. onClick={() => setActiveNavButton("history")}
  938. style={{minWidth: '120px'}}
  939. >
  940. 历史事件
  941. </Button>
  942. <Button
  943. type={activeNavButton === "inspection" ? "primary" : "default"}
  944. onClick={() => setActiveNavButton("inspection")}
  945. style={{minWidth: '120px'}}
  946. >
  947. 日常巡查
  948. </Button>
  949. </Button.Group>
  950. <div style={{
  951. marginTop: '10px',
  952. color: '#EEE',
  953. fontSize: '14px'
  954. }}>近15日数据
  955. </div>
  956. </div>
  957. {/* 内容区域 */}
  958. <div style={{
  959. padding: '20px',
  960. border: '1px solid #e8e8e8',
  961. borderRadius: '4px',
  962. height: '500px'
  963. }}>
  964. {activeNavButton === "realtime" && (
  965. <div>
  966. <Table
  967. className="RTM-Gis-table"
  968. style={{
  969. width: '100%',
  970. height: '100%',
  971. // 可选:设置表格背景透明,避免覆盖容器背景
  972. backgroundColor: 'transparent'
  973. }}
  974. columns={popUpdata.columns}
  975. dataSource={popUpdata.data}
  976. // pagination={false}
  977. rowKey="id"
  978. size="small"
  979. />
  980. </div>
  981. )}
  982. {activeNavButton === "history" && (
  983. <div>历史事件记录展示区域</div>
  984. )}
  985. {activeNavButton === "inspection" && (
  986. <div>日常巡查信息展示区域</div>
  987. )}
  988. </div>
  989. </div>
  990. </div>
  991. )}
  992. </Modal>
  993. {/* 添加图片预览弹窗 */}
  994. <Modal
  995. visible={previewVisible}
  996. footer={null}
  997. onCancel={() => setPreviewVisible(false)}
  998. maskClosable={true}
  999. width="800px"
  1000. height="500px"
  1001. bodyStyle={{padding: 0}}
  1002. closable={true}
  1003. zIndex={10000}
  1004. >
  1005. {previewImage && (
  1006. <img
  1007. src={previewImage}
  1008. alt="预览图片"
  1009. style={{
  1010. width: '700px',
  1011. // maxWidth: '90vw',
  1012. // maxHeight: '90vh',
  1013. display: 'block',
  1014. margin: '0 auto'
  1015. }}
  1016. />
  1017. )}
  1018. </Modal>
  1019. {/* 添加全局样式覆盖表头背景色 */}
  1020. <style jsx global>{`
  1021. .custom-table .ant-table-thead > tr > th,
  1022. .custom-table .ant-table-thead > tr > td {
  1023. background-color: rgba(58, 56, 153, 1) !important; /* 目标背景色 */
  1024. color: white !important; /* 表头文字颜色 */
  1025. border: none !important; /* 移除边框 */
  1026. }
  1027. .ant-table-wrapper .ant-table-tbody >tr >th, .ant-table-wrapper .ant-table-tbody >tr >td {
  1028. background-color: rgba(58, 56, 153, 1) !important; /* 目标背景色 */
  1029. color: white !important; /* 表头文字颜色 */
  1030. border: none !important; /* 移除边框 */
  1031. }
  1032. /* 修改Modal背景色和添加渐变边框 */
  1033. .custom-modal .ant-modal-content {
  1034. background-color: rgba(58, 56, 153, 1) !important; /* 主背景色 */
  1035. color: white; /* 文字颜色 */
  1036. /* 添加由外向内的径向渐变边框 */
  1037. border: 2px solid transparent;
  1038. border-radius: 8px;
  1039. background-clip: padding-box, border-box;
  1040. background-origin: padding-box, border-box;
  1041. background-image:
  1042. linear-gradient( rgba(58, 56, 153, 1), rgba(58, 56, 153, 1)), /* 背景色 */
  1043. radial-gradient(circle at center, #ff6b6b, #4ecdc4); /* 由外向内的径向渐变边框 */
  1044. }
  1045. /* 可选:修改Modal标题栏样式 */
  1046. .custom-modal .ant-modal-header {
  1047. background-color: rgba(58, 56, 153, 1) !important;
  1048. border-bottom: none; /* 移除底部边框 */
  1049. }
  1050. .custom-modal .ant-modal-title{
  1051. color:white !important;
  1052. border-bottom:1px solid white;
  1053. }
  1054. `}</style>
  1055. </div>
  1056. </ConfigProvider>
  1057. )
  1058. }