monitor.data.ts 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768
  1. import dayjs from 'dayjs';
  2. import { BasicColumn } from '/@/components/Table';
  3. import { FormSchema } from '/@/components/Table';
  4. import { TreeItem } from '/@/components/Tree/index';
  5. import { ModuleDataChart } from '/@/components/Configurable/types';
  6. import { h } from 'vue';
  7. import { StatusColorEnum } from '/@/enums/jeecgEnum';
  8. // import { getDictItemsByCode } from '/@/utils/dict';
  9. // import { get } from 'lodash-es';
  10. const riskMap = {
  11. '1': '低风险',
  12. '2': '一般风险',
  13. '3': '较高风险',
  14. '4': '高风险',
  15. };
  16. const linkMap = {
  17. '0': '断线',
  18. '1': '正常',
  19. '2': '标校',
  20. };
  21. // const dictMap = getDictItemsByCode('mineProStatus');
  22. // 实时数据相关
  23. export const columns: BasicColumn[] = [
  24. // {
  25. // title: '序号',
  26. // dataIndex: 'orderNo',
  27. // width: 60,
  28. // },
  29. // {
  30. // title: '区域',
  31. // dataIndex: 'coalSeamName',
  32. // width: 80,
  33. // },
  34. {
  35. title: '煤矿名称',
  36. dataIndex: 'mineName',
  37. width: 200,
  38. },
  39. {
  40. title: '密闭名称',
  41. dataIndex: 'devicePos',
  42. width: 100,
  43. },
  44. {
  45. title: '所属煤层',
  46. dataIndex: 'coalSeamName',
  47. width: 100,
  48. },
  49. {
  50. title: '自燃倾向性',
  51. dataIndex: 'coalSeamLevel',
  52. width: 100,
  53. },
  54. {
  55. title: '瓦斯等级',
  56. dataIndex: 'gasLevelName',
  57. width: 100,
  58. },
  59. {
  60. title: '生产状态',
  61. dataIndex: 'gjMineStatus',
  62. width: 100,
  63. // customRender({ text }) {
  64. // // 从动态映射取值,兜底未知状态
  65. // const label = dictMap.find((item) => item.value == text)?.label || '-';
  66. // // 渲染带颜色的文字
  67. // return h(
  68. // 'span',
  69. // {
  70. // color: get({ '0': StatusColorEnum.green, '1': StatusColorEnum.blue }, text),
  71. // },
  72. // label
  73. // );
  74. // },
  75. },
  76. {
  77. title: 'CO(ppm)',
  78. width: 100,
  79. children: [
  80. {
  81. title: '闭内',
  82. dataIndex: 'coVal',
  83. width: 100,
  84. },
  85. {
  86. title: '闭外',
  87. dataIndex: 'coValOut',
  88. width: 100,
  89. },
  90. ],
  91. },
  92. {
  93. title: 'CO2(%)',
  94. width: 100,
  95. children: [
  96. {
  97. title: '闭内',
  98. dataIndex: 'co2Val',
  99. width: 100,
  100. },
  101. {
  102. title: '闭外',
  103. dataIndex: 'co2ValOut',
  104. width: 100,
  105. },
  106. ],
  107. },
  108. {
  109. title: 'CH4(%)',
  110. width: 100,
  111. children: [
  112. {
  113. title: '闭内',
  114. dataIndex: 'ch4Val',
  115. width: 100,
  116. },
  117. {
  118. title: '闭外',
  119. dataIndex: 'ch4ValOut',
  120. width: 100,
  121. },
  122. ],
  123. },
  124. {
  125. title: 'C2H2(ppm)',
  126. width: 100,
  127. children: [
  128. {
  129. title: '闭内',
  130. dataIndex: 'c2h2Val',
  131. width: 100,
  132. },
  133. {
  134. title: '闭外',
  135. dataIndex: 'c2h2ValOut',
  136. width: 100,
  137. },
  138. ],
  139. },
  140. {
  141. title: 'C2H4(ppm)',
  142. width: 100,
  143. children: [
  144. {
  145. title: '闭内',
  146. dataIndex: 'c2h4Val',
  147. width: 100,
  148. },
  149. {
  150. title: '闭外',
  151. dataIndex: 'c2h4ValOut',
  152. width: 100,
  153. },
  154. ],
  155. },
  156. {
  157. title: 'O2(%)',
  158. width: 100,
  159. children: [
  160. {
  161. title: '闭内',
  162. dataIndex: 'o2Val',
  163. width: 100,
  164. },
  165. {
  166. title: '闭外',
  167. dataIndex: 'o2ValOut',
  168. width: 100,
  169. },
  170. ],
  171. },
  172. {
  173. title: '温度(℃)',
  174. width: 100,
  175. children: [
  176. {
  177. title: '闭内',
  178. dataIndex: 'temperature',
  179. width: 100,
  180. },
  181. {
  182. title: '闭外',
  183. dataIndex: 'temperatureOut',
  184. width: 100,
  185. },
  186. ],
  187. },
  188. {
  189. title: '压差(Pa)',
  190. dataIndex: 'sourcePressure',
  191. width: 100,
  192. },
  193. {
  194. title: '闭内自然发火隐患等级',
  195. dataIndex: 'fireAlarm',
  196. width: 100,
  197. customRender({ record }) {
  198. return alarmCellRender(record.fireAlarm, (r) => riskMap[r.alarmName] || r.alarmName);
  199. },
  200. },
  201. {
  202. title: '闭外自然发火隐患等级',
  203. dataIndex: 'fireAlarmOut',
  204. width: 100,
  205. customRender({ record }) {
  206. return alarmCellRender(record.fireAlarmOut, (r) => riskMap[r.alarmName] || r.alarmName);
  207. },
  208. },
  209. {
  210. title: '是否漏风',
  211. dataIndex: 'leakageAlarm',
  212. width: 100,
  213. customRender({ record }) {
  214. // return alarmTextRender(record.leakageAlarm?.alarmLevel, record.leakageAlarm?.split('-')[0]);
  215. return alarmCellRender(record.leakageAlarm, (r) => r.alarmName.split('-')[1]);
  216. },
  217. },
  218. {
  219. title: '压差隐患等级',
  220. dataIndex: 'sourcePressureAlarm',
  221. width: 100,
  222. customRender({ record }) {
  223. return alarmCellRender(record.sourcePressureAlarm, (r) => riskMap[r.alarmName] || r.alarmName);
  224. },
  225. },
  226. {
  227. title: '密闭启封判定',
  228. dataIndex: 'unsealAlarm',
  229. width: 100,
  230. customRender({ record }) {
  231. return alarmCellRender(record.unsealAlarm);
  232. },
  233. },
  234. {
  235. title: '设备状态',
  236. dataIndex: 'linkStatus',
  237. width: 100,
  238. customRender({ record }) {
  239. return alarmCellRender(
  240. record.linkStatus,
  241. (r) => linkMap[r],
  242. (r) => String(r)
  243. );
  244. },
  245. },
  246. // {
  247. // title: '爆炸危险性',
  248. // dataIndex: 'explosionHazard',
  249. // width: 80,
  250. // },
  251. {
  252. title: '更新时间',
  253. dataIndex: 'readTime',
  254. width: 100,
  255. },
  256. ];
  257. export const searchFormSchema: FormSchema[] = [
  258. // {
  259. // field: 'mineNameAbbr',
  260. // label: '煤矿简称',
  261. // component: 'Input',
  262. // colProps: { span: 6 },
  263. // },
  264. {
  265. field: 'gjMineStatus',
  266. label: '生产状态',
  267. component: 'JDictSelectTag',
  268. componentProps: {
  269. dictCode: 'mineProStatus',
  270. placeholder: '请选择生产状态',
  271. },
  272. colProps: { span: 6 },
  273. },
  274. {
  275. field: 'coalSeamLevel',
  276. label: '自燃倾向性',
  277. component: 'Select',
  278. componentProps: {
  279. options: [
  280. { label: 'Ⅰ类容易自燃', value: 'Ⅰ类容易自燃' },
  281. { label: 'Ⅱ类自燃', value: 'Ⅱ类自燃' },
  282. { label: 'Ⅲ类不易自燃', value: 'Ⅲ类不易自燃' },
  283. ],
  284. },
  285. colProps: { span: 6 },
  286. },
  287. {
  288. field: 'gasLevelName',
  289. label: '瓦斯等级',
  290. component: 'Select',
  291. componentProps: {
  292. options: [
  293. { label: '低瓦斯', value: '低瓦斯' },
  294. { label: '高瓦斯', value: '高瓦斯' },
  295. { label: '突出', value: '突出' },
  296. ],
  297. },
  298. colProps: { span: 6 },
  299. },
  300. ];
  301. export const modalDetailsData: {
  302. basicInfo: Record<string, any>[];
  303. board: Record<string, any>[];
  304. gasConcentrationConfig: ModuleDataChart;
  305. pressureConfig: ModuleDataChart;
  306. } = {
  307. basicInfo: [
  308. {
  309. label: '煤矿名称',
  310. value: 'mineName',
  311. },
  312. {
  313. label: '设备位置',
  314. value: 'devicePos',
  315. },
  316. // {
  317. // label: '所属煤层',
  318. // value: 'coalSeamName',
  319. // },
  320. // {
  321. // label: '自燃倾向性',
  322. // value: 'Ⅰ类容易自燃',
  323. // },
  324. {
  325. label: '自然发火隐患',
  326. value: 'fireAlarm',
  327. customRender({ record }) {
  328. return alarmCellRender(record.fireAlarm, (r) => riskMap[r.alarmName] || r.alarmName);
  329. },
  330. },
  331. {
  332. label: '是否漏风',
  333. value: 'leakageAlarm',
  334. customRender({ record }) {
  335. return alarmCellRender(record.leakageAlarm);
  336. },
  337. },
  338. {
  339. label: '压差隐患等级',
  340. value: 'sourcePressureAlarm',
  341. customRender({ record }) {
  342. return alarmCellRender(record.sourcePressureAlarm, (r) => riskMap[r.alarmName] || r.alarmName);
  343. },
  344. },
  345. {
  346. label: '密闭启封判定',
  347. value: 'unsealAlarm',
  348. customRender({ record }) {
  349. return alarmCellRender(record.unsealAlarm);
  350. },
  351. },
  352. ],
  353. board: [
  354. {
  355. label: 'CO(ppm)',
  356. value: 'coVal',
  357. },
  358. {
  359. label: 'CO2(%)',
  360. value: 'co2Val',
  361. },
  362. {
  363. label: 'O2(%)',
  364. value: 'o2Val',
  365. },
  366. {
  367. label: 'CH4(%)',
  368. value: 'ch4Val',
  369. },
  370. {
  371. label: 'C2H4(ppm)',
  372. value: 'c2h4Val',
  373. },
  374. {
  375. label: 'C2H2(ppm)',
  376. value: 'c2h2Val',
  377. },
  378. {
  379. label: '温度(℃)',
  380. value: 'temperature',
  381. },
  382. {
  383. label: '压差(Pa)',
  384. value: 'sourcePressure',
  385. },
  386. ],
  387. gasConcentrationConfig: {
  388. type: 'line_smooth', // 使用光滑曲线类型
  389. legend: { show: true },
  390. xAxis: [
  391. {
  392. show: true,
  393. name: '时间',
  394. axisLabel: { color: '#000000' },
  395. },
  396. ],
  397. yAxis: [
  398. {
  399. show: true,
  400. name: '浓度(%)',
  401. position: 'left',
  402. splitLine: { show: false },
  403. axisLine: {
  404. show: true,
  405. lineStyle: { color: '#333' },
  406. },
  407. axisLabel: { color: '#000000' },
  408. nameTextStyle: { color: '#000' },
  409. },
  410. ],
  411. series: [
  412. {
  413. label: '氧气浓度',
  414. readFrom: 'chartData',
  415. xprop: 'readTime',
  416. yprop: 'o2Val',
  417. },
  418. {
  419. label: '一氧化碳浓度',
  420. readFrom: 'chartData',
  421. xprop: 'readTime',
  422. yprop: 'coVal',
  423. },
  424. {
  425. label: '二氧化碳浓度',
  426. readFrom: 'chartData',
  427. xprop: 'readTime',
  428. yprop: 'co2Val',
  429. },
  430. ],
  431. readFrom: '',
  432. },
  433. pressureConfig: {
  434. type: 'line', // 使用普通折线图类型
  435. legend: { show: true },
  436. xAxis: [
  437. {
  438. show: true,
  439. name: '时间',
  440. axisLabel: { color: '#000000' },
  441. },
  442. ],
  443. yAxis: [
  444. {
  445. show: true,
  446. position: 'left',
  447. name: '压力(kPa)',
  448. axisLabel: { color: '#000000' },
  449. },
  450. ],
  451. series: [
  452. {
  453. label: '压差',
  454. readFrom: 'chartData',
  455. xprop: 'readTime',
  456. yprop: 'sourcePressure',
  457. },
  458. ],
  459. readFrom: '',
  460. },
  461. };
  462. // 历史数据相关
  463. export const historicalColumns: BasicColumn[] = [
  464. // {
  465. // title: '序号',
  466. // dataIndex: 'orderNo',
  467. // width: 60,
  468. // },
  469. // {
  470. // title: '区域',
  471. // dataIndex: 'enforcement',
  472. // width: 100,
  473. // },
  474. {
  475. title: '煤矿名称',
  476. dataIndex: 'mineName',
  477. width: 200,
  478. },
  479. {
  480. title: '密闭名称',
  481. dataIndex: 'devicePos',
  482. width: 100,
  483. },
  484. {
  485. title: '所属煤层',
  486. dataIndex: 'coalSeamName',
  487. width: 100,
  488. },
  489. {
  490. title: 'CO(ppm)',
  491. width: 100,
  492. children: [
  493. {
  494. title: '闭内',
  495. dataIndex: 'coVal',
  496. width: 100,
  497. },
  498. {
  499. title: '闭外',
  500. dataIndex: 'coValOut',
  501. width: 100,
  502. },
  503. ],
  504. },
  505. {
  506. title: 'CO2(%)',
  507. width: 100,
  508. children: [
  509. {
  510. title: '闭内',
  511. dataIndex: 'co2Val',
  512. width: 100,
  513. },
  514. {
  515. title: '闭外',
  516. dataIndex: 'co2ValOut',
  517. width: 100,
  518. },
  519. ],
  520. },
  521. {
  522. title: 'CH4(%)',
  523. width: 100,
  524. children: [
  525. {
  526. title: '闭内',
  527. dataIndex: 'ch4Val',
  528. width: 100,
  529. },
  530. {
  531. title: '闭外',
  532. dataIndex: 'ch4ValOut',
  533. width: 100,
  534. },
  535. ],
  536. },
  537. {
  538. title: 'C2H2(ppm)',
  539. width: 100,
  540. children: [
  541. {
  542. title: '闭内',
  543. dataIndex: 'c2h2Val',
  544. width: 100,
  545. },
  546. {
  547. title: '闭外',
  548. dataIndex: 'c2h2ValOut',
  549. width: 100,
  550. },
  551. ],
  552. },
  553. {
  554. title: 'C2H4(ppm)',
  555. width: 100,
  556. children: [
  557. {
  558. title: '闭内',
  559. dataIndex: 'c2h4Val',
  560. width: 100,
  561. },
  562. {
  563. title: '闭外',
  564. dataIndex: 'c2h4ValOut',
  565. width: 100,
  566. },
  567. ],
  568. },
  569. {
  570. title: 'O2(%)',
  571. width: 100,
  572. children: [
  573. {
  574. title: '闭内',
  575. dataIndex: 'o2Val',
  576. width: 100,
  577. },
  578. {
  579. title: '闭外',
  580. dataIndex: 'o2ValOut',
  581. width: 100,
  582. },
  583. ],
  584. },
  585. {
  586. title: '温度(℃)',
  587. width: 100,
  588. children: [
  589. {
  590. title: '闭内',
  591. dataIndex: 'temperature',
  592. width: 100,
  593. },
  594. {
  595. title: '闭外',
  596. dataIndex: 'temperatureOut',
  597. width: 100,
  598. },
  599. ],
  600. },
  601. {
  602. title: '压差(Pa)',
  603. dataIndex: 'sourcePressure',
  604. width: 100,
  605. },
  606. // {
  607. // title: '爆炸危险性',
  608. // dataIndex: 'explosionHazard',
  609. // width: 100,
  610. // },
  611. {
  612. title: '更新时间',
  613. dataIndex: 'createTime',
  614. width: 100,
  615. },
  616. ];
  617. export const historicalFormSchema: FormSchema[] = [
  618. // {
  619. // field: 'mineCode',
  620. // label: '煤矿名称',
  621. // component: 'MineCascader',
  622. // slot: 'mine-cascader',
  623. // colProps: { span: 6 },
  624. // },
  625. // {
  626. // field: 'mineNameAbbr',
  627. // label: '煤矿简称',
  628. // component: 'Input',
  629. // colProps: { span: 6 },
  630. // },
  631. // {
  632. // field: 'productStatus',
  633. // label: '生产状态',
  634. // component: 'Select',
  635. // componentProps: {
  636. // options: [
  637. // { label: '拟建矿井', value: '0' },
  638. // { label: '正常生产矿井', value: '1' },
  639. // { label: '长期停产矿井', value: '1' },
  640. // ],
  641. // },
  642. // colProps: { span: 6 },
  643. // },
  644. // {
  645. // field: 'riskLevel',
  646. // label: '自燃倾向性',
  647. // component: 'Select',
  648. // componentProps: {
  649. // options: [
  650. // { label: 'Ⅰ类容易自燃', value: '0' },
  651. // { label: 'Ⅱ类自燃', value: '1' },
  652. // { label: 'Ⅲ类不易自燃', value: '2' },
  653. // ],
  654. // },
  655. // colProps: { span: 6 },
  656. // },
  657. // {
  658. // field: 'coalSeam',
  659. // label: '所属煤层',
  660. // component: 'Select',
  661. // componentProps: {
  662. // options: [
  663. // { label: '煤层1', value: '0' },
  664. // { label: '煤层2', value: '1' },
  665. // { label: '煤层3', value: '2' },
  666. // ],
  667. // },
  668. // colProps: { span: 6 },
  669. // },
  670. {
  671. field: 'goafId',
  672. label: '密闭名称',
  673. component: 'ApiSelect',
  674. slot: 'goaf-select',
  675. colProps: { span: 6 },
  676. },
  677. {
  678. field: 'startTime',
  679. label: '起始日期',
  680. component: 'DatePicker',
  681. componentProps: {
  682. //日期格式化,页面上显示的值
  683. format: 'YYYY-MM-DD',
  684. //返回值格式化(绑定值的格式)
  685. valueFormat: 'YYYY-MM-DD 00:00:00',
  686. },
  687. defaultValue: dayjs().add(-30, 'day').format('YYYY-MM-DD'),
  688. colProps: { span: 6 },
  689. },
  690. {
  691. field: 'endTime',
  692. label: '结束日期',
  693. component: 'DatePicker',
  694. componentProps: {
  695. //日期格式化,页面上显示的值
  696. format: 'YYYY-MM-DD',
  697. //返回值格式化(绑定值的格式)
  698. valueFormat: 'YYYY-MM-DD 23:59:59',
  699. },
  700. defaultValue: dayjs().format('YYYY-MM-DD'),
  701. colProps: { span: 6 },
  702. },
  703. ];
  704. export const treeData: TreeItem[] = [
  705. {
  706. title: '气体参数 ',
  707. key: '0-0',
  708. children: [
  709. { title: 'CO', key: '0-0-0' },
  710. { title: 'CH4', key: '0-0-1' },
  711. { title: 'C2H4', key: '0-0-2' },
  712. { title: 'C2H2', key: '0-0-3' },
  713. { title: 'CO2', key: '0-0-4' },
  714. { title: 'O2', key: '0-0-5' },
  715. ],
  716. },
  717. {
  718. title: '内外压力及压差',
  719. key: '1-1',
  720. children: [
  721. { title: '内压力', key: '1-1-0' },
  722. { title: '外压力', key: '1-1-1' },
  723. { title: '压差', key: '1-1-2' },
  724. ],
  725. },
  726. {
  727. title: '温度',
  728. key: '2-2',
  729. },
  730. ];
  731. function getTagColor(level: string) {
  732. switch (level) {
  733. case '4':
  734. return StatusColorEnum.red;
  735. case '3':
  736. return StatusColorEnum.gold;
  737. case '2':
  738. return StatusColorEnum.yellow;
  739. case '1':
  740. return StatusColorEnum.blue;
  741. case '0':
  742. return StatusColorEnum.red;
  743. default:
  744. return 'inhert';
  745. }
  746. }
  747. export function alarmCellRender(
  748. record: any,
  749. valFn: (record: any) => string = (r) => r.alarmName,
  750. lvFn: (record: any) => string = (r) => r.alarmLevel
  751. ) {
  752. // if (!record) return h(Tag, { bordered: false, color: 'default' }, () => '-');
  753. // return h(Tag, { bordered: false, color: getTagColor(record.alarmLevel) }, () => record.alarmName);
  754. if (!record) return h('span', '-');
  755. const val = valFn(record);
  756. const lv = lvFn(record);
  757. return h('span', { style: { color: getTagColor(lv) } }, val);
  758. }