DbgdData.tsx 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568
  1. import React, {useState} from "react";
  2. import {Badge, Col, ConfigProvider, message, Modal, Row, Table, Timeline,} from "antd"
  3. export default function getGisSbleData(props: { height: string }) {
  4. // 添加图片预览相关状态
  5. const [previewImage, setPreviewImage] = useState<string | null>(null);
  6. const [previewVisible, setPreviewVisible] = useState(false);
  7. // 设备列表状态
  8. const [TodoWorkOrder, setTodoWorkOrder] = useState(false)
  9. const [TodoWorkOrderDevice, setTodoWorkOrderDevice] = useState(null)
  10. // 添加工单表格数据和列定义
  11. const todoWorkOrders = [
  12. {
  13. id: '1', // 添加唯一 id 作为 rowKey
  14. equipmentId: 'WO202309001',
  15. EventLevel: 'high',
  16. EventClassification: '污水井盖',
  17. Region: '区域一',
  18. ReportPerson: '张三',
  19. CurrentLink: '维护中',
  20. EventDescription: '井盖出现裂痕,需要维修',
  21. PictureBeforeDisposal: 'sunhuaiManhole.png',
  22. deviceName: '井盖一',
  23. createTime: '2023-09-15 08:30:00',
  24. status: 'pending',
  25. type: '故障维修',
  26. }, {
  27. id: '2', // 添加唯一 id 作为 rowKey
  28. equipmentId: 'WO202309002',
  29. EventLevel: 'low',
  30. EventClassification: '污水井盖',
  31. Region: '区域一',
  32. ReportPerson: '张三',
  33. CurrentLink: '维护中',
  34. EventDescription: '井盖出现裂痕,需要维修',
  35. PictureBeforeDisposal: 'sunhuaiManhole.png',
  36. deviceName: '井盖二',
  37. createTime: '2023-09-15 08:30:00',
  38. status: 'pending',
  39. type: '故障维修',
  40. }, {
  41. id: '3', // 添加唯一 id 作为 rowKey
  42. equipmentId: 'WO202309003',
  43. EventLevel: 'low',
  44. EventClassification: '污水井盖',
  45. Region: '区域一',
  46. ReportPerson: '张三',
  47. CurrentLink: '维护中',
  48. EventDescription: '井盖出现裂痕,需要维修',
  49. PictureBeforeDisposal: 'sunhuaiManhole.png',
  50. deviceName: '井盖三',
  51. createTime: '2023-09-15 08:30:00',
  52. status: 'pending',
  53. type: '故障维修',
  54. }, {
  55. id: '4', // 添加唯一 id 作为 rowKey
  56. equipmentId: 'WO202309004',
  57. EventLevel: 'low',
  58. EventClassification: '污水井盖',
  59. Region: '区域一',
  60. ReportPerson: '张三',
  61. CurrentLink: '维护中',
  62. EventDescription: '井盖出现裂痕,需要维修',
  63. PictureBeforeDisposal: 'sunhuaiManhole.png',
  64. deviceName: '井盖四',
  65. createTime: '2023-09-15 08:30:00',
  66. status: 'pending',
  67. type: '故障维修',
  68. }, {
  69. id: '5', // 添加唯一 id 作为 rowKey
  70. equipmentId: 'WO202309005',
  71. EventLevel: 'medium',
  72. EventClassification: '污水井盖',
  73. Region: '区域一',
  74. ReportPerson: '张三',
  75. CurrentLink: '维护中',
  76. EventDescription: '井盖出现裂痕,需要维修',
  77. PictureBeforeDisposal: 'sunhuaiManhole.png',
  78. deviceName: '井盖五',
  79. createTime: '2023-09-15 08:30:00',
  80. status: 'pending',
  81. type: '故障维修',
  82. }, {
  83. id: '6', // 添加唯一 id 作为 rowKey
  84. equipmentId: 'WO202309006',
  85. EventLevel: 'medium',
  86. EventClassification: '污水井盖',
  87. Region: '区域一',
  88. ReportPerson: '张三',
  89. CurrentLink: '维护中',
  90. EventDescription: '井盖出现裂痕,需要维修',
  91. PictureBeforeDisposal: 'sunhuaiManhole.png',
  92. deviceName: '井盖六',
  93. createTime: '2023-09-15 08:30:00',
  94. status: 'pending',
  95. type: '故障维修',
  96. }
  97. ];
  98. const workOrderColumns = [
  99. {
  100. title: '工单编号',
  101. dataIndex: 'equipmentId',
  102. key: 'equipmentId',
  103. width: '20%',
  104. ellipsis: true, // 添加省略号属性
  105. render: (text) => <span style={{color: 'white', fontWeight: 'bold'}}>{text}</span>
  106. },
  107. {
  108. title: '工单类型',
  109. dataIndex: 'type',
  110. key: 'type',
  111. width: '18%',
  112. ellipsis: true, // 添加省略号属性
  113. render: (text) => <span style={{color: 'white'}}>{text}</span>
  114. },
  115. {
  116. title: '设备名称',
  117. dataIndex: 'deviceName',
  118. key: 'deviceName',
  119. width: '18%',
  120. ellipsis: true, // 添加省略号属性
  121. render: (text) => <span style={{color: 'white'}}>{text}</span>
  122. },
  123. {
  124. title: '优先级',
  125. dataIndex: 'EventLevel',
  126. key: 'EventLevel',
  127. width: '14%',
  128. render: (priority) => {
  129. const colorMap = {
  130. high: '#f5222d',
  131. medium: '#faad14',
  132. low: '#52c41a'
  133. };
  134. const textMap = {
  135. high: '高',
  136. medium: '中',
  137. low: '低'
  138. };
  139. return (
  140. <Badge color={colorMap[priority]} text={
  141. <span style={{color: colorMap[priority]}}>{textMap[priority]}</span>
  142. }/>
  143. );
  144. }
  145. },
  146. ];
  147. // 添加工单行点击处理函数 - 修改为打开设备详情弹窗
  148. const handleWorkOrderRowClick = (record) => {
  149. // 根据工单中的设备名称查找对应的设备信息
  150. const device = todoWorkOrders.find(device => device.deviceName === record.deviceName);
  151. if (device) {
  152. // 设置选中设备并打开弹窗
  153. setTodoWorkOrderDevice(device);
  154. setTodoWorkOrder(true);
  155. } else {
  156. message.warning(`未找到设备: ${record.deviceName}`);
  157. }
  158. };
  159. return (
  160. <ConfigProvider
  161. theme={{
  162. components: {
  163. Table: {
  164. headerBorderRadius: 0,
  165. },
  166. },
  167. }}
  168. >
  169. <div style={{height: props.height}}>
  170. <Table
  171. className="custom-table"
  172. columns={workOrderColumns}
  173. dataSource={todoWorkOrders}
  174. rowKey="id"
  175. pagination={false}
  176. size="small"
  177. style={{backgroundColor: 'transparent', padding: '10px'}}
  178. // rowClassName={() => 'bg-[#3a3899]'}
  179. // 添加固定表头配置
  180. scroll={{x: 200, y: 180}}
  181. // 添加行点击事件
  182. onRow={(record) => ({
  183. onClick: () => handleWorkOrderRowClick(record),
  184. style: {
  185. cursor: 'pointer', // 鼠标悬停显示手型
  186. }
  187. })}
  188. />
  189. {/*待办工单详情*/}
  190. <Modal
  191. title="待办工单详情"
  192. open={TodoWorkOrder}
  193. onCancel={() => setTodoWorkOrder(false)}
  194. // footer={null}
  195. width={1000}
  196. className="custom-modal"
  197. style={{
  198. textAlign: 'center'
  199. }}
  200. >
  201. {TodoWorkOrderDevice && (
  202. <div className="space-y-4" style={{
  203. display: 'flex',
  204. justifyContent: 'space-between'
  205. }}>
  206. <div style={{
  207. width: '50%',
  208. }}>
  209. <div className="space-y-4" style={{textAlign: 'left'}}>
  210. <Row>
  211. <Col>
  212. <div>
  213. <strong style={{
  214. color: '#B0E0E6'
  215. }}>设备名称:</strong> {TodoWorkOrderDevice.deviceName}
  216. </div>
  217. </Col>
  218. </Row>
  219. <Row>
  220. <Col>
  221. <div>
  222. <strong style={{
  223. color: '#B0E0E6'
  224. }}>设备类型:</strong> {TodoWorkOrderDevice.EventClassification}
  225. </div>
  226. </Col>
  227. </Row>
  228. <Row>
  229. <Col>
  230. <div>
  231. <strong style={{
  232. color: '#B0E0E6'
  233. }}>事件类型:</strong> {TodoWorkOrderDevice.type}
  234. </div>
  235. </Col>
  236. </Row>
  237. <Row>
  238. <Col>
  239. <div>
  240. <strong style={{
  241. color: '#B0E0E6'
  242. }}>事件描述:</strong> {TodoWorkOrderDevice.EventDescription}
  243. </div>
  244. </Col>
  245. </Row>
  246. <Row>
  247. <Col>
  248. <div>
  249. <strong style={{
  250. color: '#B0E0E6'
  251. }}>所属区域:</strong> {TodoWorkOrderDevice.Region}
  252. </div>
  253. </Col>
  254. </Row>
  255. <Row>
  256. <Col>
  257. <div>
  258. <strong style={{
  259. color: '#B0E0E6'
  260. }}>当前环节:</strong> {TodoWorkOrderDevice.CurrentLink}
  261. </div>
  262. </Col>
  263. </Row>
  264. <Row>
  265. <Col>
  266. <div>
  267. <strong style={{
  268. color: '#B0E0E6'
  269. }}>优先级:</strong>
  270. <Badge
  271. style={{
  272. marginLeft: '10px'
  273. }}
  274. status={
  275. TodoWorkOrderDevice.EventLevel === "high" ? "error" :
  276. TodoWorkOrderDevice.EventLevel === "medium" ? "warning" : "success"
  277. }
  278. text={
  279. <span style={{
  280. color:
  281. TodoWorkOrderDevice.EventLevel === "high" ? "#f5222d" :
  282. TodoWorkOrderDevice.EventLevel === "medium" ? "#faad14" : "#52c41a"
  283. }}>
  284. {
  285. TodoWorkOrderDevice.EventLevel === "high" ? "高优先级" :
  286. TodoWorkOrderDevice.EventLevel === "medium" ? "中优先级" : "低优先级"
  287. }
  288. </span>
  289. }
  290. />
  291. </div>
  292. </Col>
  293. </Row>
  294. <Row>
  295. <Col>
  296. <div>
  297. <strong style={{
  298. color: '#B0E0E6'
  299. }}>上报人:</strong> {TodoWorkOrderDevice.ReportPerson}
  300. </div>
  301. </Col>
  302. </Row>
  303. <Row>
  304. <Col>
  305. <div>
  306. <strong style={{
  307. color: '#B0E0E6'
  308. }}>上报时间:</strong> {TodoWorkOrderDevice.createTime}
  309. </div>
  310. </Col>
  311. </Row>
  312. {/**/}
  313. <Row>
  314. <Col>
  315. <div style={{display: 'flex'}}>
  316. <strong style={{
  317. color: '#B0E0E6'
  318. }}>现场图片:</strong>
  319. <img
  320. src={TodoWorkOrderDevice.PictureBeforeDisposal}
  321. alt="现场图片"
  322. style={{width: '40%', marginLeft: '10px', cursor: 'pointer'}}
  323. onClick={() => {
  324. setPreviewImage(TodoWorkOrderDevice.PictureBeforeDisposal);
  325. setPreviewVisible(true);
  326. }}
  327. />
  328. </div>
  329. </Col>
  330. </Row>
  331. </div>
  332. </div>
  333. <div style={{width: '50%'}}>
  334. <div style={{
  335. backgroundSize: '100% 100%',
  336. textAlign: 'left',
  337. color: 'white',
  338. fontSize: '18px',
  339. fontWeight: 'bold',
  340. marginBottom: '10px' // 添加底部间距
  341. }}>
  342. 工单处理流程
  343. </div>
  344. <div style={{
  345. textAlign: 'left',
  346. height: '500px', // 设置固定高度
  347. overflowY: 'auto', // 垂直方向超出时显示滚动条
  348. padding: '10px' // 添加内边距,优化视觉效果
  349. }}>
  350. <Timeline
  351. items={[
  352. {
  353. color: 'green',
  354. children: (
  355. <div style={{color: 'white'}}>
  356. <p style={{
  357. fontSize: '16px',
  358. fontWeight: 'bold',
  359. color: '#B0E0E6'
  360. }}>【指挥协调上报】</p>
  361. <strong style={{
  362. color: '#B0E0E6'
  363. }}>办理时间:</strong> 2025-03-17 09:03:16 <p></p>
  364. <strong style={{
  365. color: '#B0E0E6'
  366. }}>处置单位:</strong> 数字化城市管理指挥中心 <p></p>
  367. <strong style={{
  368. color: '#B0E0E6'
  369. }}>经办人员:</strong> 张三 <p></p>
  370. <strong style={{
  371. color: '#B0E0E6'
  372. }}>办理意见:</strong> 无 <p></p>
  373. </div>
  374. ),
  375. },
  376. {
  377. color: 'green',
  378. children: (
  379. <div style={{color: 'white'}}>
  380. <p style={{
  381. fontSize: '16px',
  382. fontWeight: 'bold',
  383. color: '#B0E0E6'
  384. }}>【指挥协调待受理】</p>
  385. <strong style={{
  386. color: '#B0E0E6'
  387. }}>办理时间:</strong> 2025-03-17 09:15:19 <p></p>
  388. <strong style={{
  389. color: '#B0E0E6'
  390. }}>处置单位:</strong> 数字化城市管理指挥中心 <p></p>
  391. <strong style={{
  392. color: '#B0E0E6'
  393. }}>经办人员:</strong> 受理员 <p></p>
  394. <strong style={{
  395. color: '#B0E0E6'
  396. }}>办理意见:</strong> 无 <p></p>
  397. </div>
  398. ),
  399. },
  400. {
  401. children: (
  402. <div style={{color: 'white'}}>
  403. <p style={{
  404. fontSize: '16px',
  405. fontWeight: 'bold',
  406. color: '#B0E0E6'
  407. }}>【指挥协调案件立案】</p>
  408. <strong style={{
  409. color: '#B0E0E6'
  410. }}>办理时间:</strong> 2025-03-17 09:03:16 <p></p>
  411. <strong style={{
  412. color: '#B0E0E6'
  413. }}>处置单位:</strong> 数字化城市管理指挥中心 <p></p>
  414. <strong style={{
  415. color: '#B0E0E6'
  416. }}>经办人员:</strong> 值班长 <p></p>
  417. <strong style={{
  418. color: '#B0E0E6'
  419. }}>办理意见:</strong> 无 <p></p>
  420. </div>
  421. ),
  422. },
  423. {
  424. color: 'gray',
  425. children: (
  426. <div style={{color: 'white'}}>
  427. <p style={{
  428. fontSize: '16px',
  429. fontWeight: 'bold',
  430. color: '#B0E0E6'
  431. }}>【指挥协调待派遣】</p>
  432. <strong style={{
  433. color: '#B0E0E6'
  434. }}>办理时间:</strong> 2025-03-17 09:03:16 <p></p>
  435. <strong style={{
  436. color: '#B0E0E6'
  437. }}>处置单位:</strong> 数字化城市管理指挥中心 <p></p>
  438. <strong style={{
  439. color: '#B0E0E6'
  440. }}>经办人员:</strong> 派遣员 <p></p>
  441. <strong style={{
  442. color: '#B0E0E6'
  443. }}>办理意见:</strong> 派遣给:'二二路灯管理所,时限:4小时 <p></p>
  444. </div>
  445. ),
  446. },
  447. {
  448. color: 'gray',
  449. children: (
  450. <div style={{color: 'white'}}>
  451. <p style={{
  452. fontSize: '16px',
  453. fontWeight: 'bold',
  454. color: '#B0E0E6'
  455. }}>【指挥协调处理】</p>
  456. <strong style={{
  457. color: '#B0E0E6'
  458. }}>办理时间:</strong> 2025-03-17 09:03:16 <p></p>
  459. <strong style={{
  460. color: '#B0E0E6'
  461. }}>处置单位:</strong> 数字化城市管理指挥中心 <p></p>
  462. <strong style={{
  463. color: '#B0E0E6'
  464. }}>经办人员:</strong> 张三 <p></p>
  465. <strong style={{
  466. color: '#B0E0E6'
  467. }}>办理意见:</strong> 无 <p></p>
  468. </div>
  469. ),
  470. }, {
  471. color: '#00CCFF',
  472. children: <strong style={{
  473. color: '#00CCFF',
  474. fontWeight: 'bold',
  475. fontSize: '16px',
  476. }}>工单结束</strong>,
  477. },
  478. ]}
  479. />
  480. </div>
  481. </div>
  482. </div>
  483. )}
  484. </Modal>
  485. {/* 添加图片预览弹窗 */}
  486. <Modal
  487. visible={previewVisible}
  488. footer={null}
  489. onCancel={() => setPreviewVisible(false)}
  490. maskClosable={true}
  491. width="800px"
  492. height="500px"
  493. bodyStyle={{padding: 0}}
  494. closable={true}
  495. zIndex={10000}
  496. >
  497. {previewImage && (
  498. <img
  499. src={previewImage}
  500. alt="预览图片"
  501. style={{
  502. width: '700px',
  503. // maxWidth: '90vw',
  504. // maxHeight: '90vh',
  505. display: 'block',
  506. margin: '0 auto'
  507. }}
  508. />
  509. )}
  510. </Modal>
  511. {/* 添加全局样式覆盖表头背景色 */}
  512. <style jsx global>{`
  513. .custom-table .ant-table-thead > tr > th,
  514. .custom-table .ant-table-thead > tr > td {
  515. background-color: rgba(58, 56, 153, 1) !important; /* 目标背景色 */
  516. color: white !important; /* 表头文字颜色 */
  517. border: none !important; /* 移除边框 */
  518. }
  519. /* 新增:移除表头伪元素样式 */
  520. .custom-table .ant-table-thead > tr > th::before,
  521. .fixed-header .ant-table-thead > tr > th::after {
  522. content: none !important; /* 清除伪元素内容 */
  523. background: none !important; /* 清除背景 */
  524. }
  525. .custom-table .ant-table-cell-scrollbar {
  526. background-color: #3a3899 !important; /* 目标背景色 */
  527. color: white !important; /* 表头文字颜色 */
  528. box-shadow: 0 0 0 rgba(0, 0, 0, 0) !important;
  529. }
  530. .ant-table-wrapper .ant-table-tbody >tr >th, .ant-table-wrapper .ant-table-tbody >tr >td {
  531. background-color: rgba(58, 56, 153, 1) !important; /* 目标背景色 */
  532. color: white !important; /* 表头文字颜色 */
  533. border: none !important; /* 移除边框 */
  534. }
  535. /* 修改Modal背景色和添加渐变边框 */
  536. .custom-modal .ant-modal-content {
  537. background-color: rgba(58, 56, 153, 1) !important; /* 主背景色 */
  538. color: white; /* 文字颜色 */
  539. /* 添加由外向内的径向渐变边框 */
  540. border: 2px solid transparent;
  541. border-radius: 8px;
  542. background-clip: padding-box, border-box;
  543. background-origin: padding-box, border-box;
  544. background-image:
  545. linear-gradient( rgba(58, 56, 153, 1), rgba(58, 56, 153, 1)), /* 背景色 */
  546. radial-gradient(circle at center, #ff6b6b, #4ecdc4); /* 由外向内的径向渐变边框 */
  547. }
  548. /* 可选:修改Modal标题栏样式 */
  549. .custom-modal .ant-modal-header {
  550. background-color: rgba(58, 56, 153, 1) !important;
  551. border-bottom: none; /* 移除底部边框 */
  552. }
  553. .custom-modal .ant-modal-title{
  554. color:white !important;
  555. border-bottom:1px solid white;
  556. }
  557. `}</style>
  558. </div>
  559. </ConfigProvider>
  560. )
  561. }