monitor.data.ts 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606
  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. dataIndex: 'coVal',
  79. width: 100,
  80. },
  81. {
  82. title: 'CO2(%)',
  83. dataIndex: 'co2Val',
  84. width: 100,
  85. },
  86. {
  87. title: 'CH4(%)',
  88. dataIndex: 'ch4Val',
  89. width: 100,
  90. },
  91. {
  92. title: 'C2H2(ppm)',
  93. dataIndex: 'c2h2Val',
  94. width: 100,
  95. },
  96. {
  97. title: 'C2H4(ppm)',
  98. dataIndex: 'c2h4Val',
  99. width: 100,
  100. },
  101. {
  102. title: 'O2(%)',
  103. dataIndex: 'o2Val',
  104. width: 100,
  105. },
  106. {
  107. title: '温度(℃)',
  108. dataIndex: 'temperature',
  109. width: 100,
  110. },
  111. {
  112. title: '压差(Pa)',
  113. dataIndex: 'sourcePressure',
  114. width: 100,
  115. },
  116. {
  117. title: '自然发火隐患等级',
  118. dataIndex: 'fireAlarm',
  119. width: 100,
  120. customRender({ record }) {
  121. return alarmCellRender(record.fireAlarm, (r) => riskMap[r.alarmName] || r.alarmName);
  122. },
  123. },
  124. {
  125. title: '是否漏风',
  126. dataIndex: 'leakageAlarm',
  127. width: 100,
  128. customRender({ record }) {
  129. // return alarmTextRender(record.leakageAlarm?.alarmLevel, record.leakageAlarm?.split('-')[0]);
  130. return alarmCellRender(record.leakageAlarm, (r) => r.alarmName.split('-')[1]);
  131. },
  132. },
  133. {
  134. title: '压差隐患等级',
  135. dataIndex: 'sourcePressureAlarm',
  136. width: 100,
  137. customRender({ record }) {
  138. return alarmCellRender(record.sourcePressureAlarm, (r) => riskMap[r.alarmName] || r.alarmName);
  139. },
  140. },
  141. {
  142. title: '密闭启封判定',
  143. dataIndex: 'unsealAlarm',
  144. width: 100,
  145. customRender({ record }) {
  146. return alarmCellRender(record.unsealAlarm);
  147. },
  148. },
  149. {
  150. title: '设备状态',
  151. dataIndex: 'linkStatus',
  152. width: 100,
  153. customRender({ record }) {
  154. return alarmCellRender(
  155. record.linkStatus,
  156. (r) => linkMap[r],
  157. (r) => String(r)
  158. );
  159. },
  160. },
  161. // {
  162. // title: '爆炸危险性',
  163. // dataIndex: 'explosionHazard',
  164. // width: 80,
  165. // },
  166. {
  167. title: '更新时间',
  168. dataIndex: 'readTime',
  169. width: 100,
  170. },
  171. ];
  172. export const searchFormSchema: FormSchema[] = [
  173. // {
  174. // field: 'mineNameAbbr',
  175. // label: '煤矿简称',
  176. // component: 'Input',
  177. // colProps: { span: 6 },
  178. // },
  179. {
  180. field: 'gjMineStatus',
  181. label: '生产状态',
  182. component: 'JDictSelectTag',
  183. componentProps: {
  184. dictCode: 'mineProStatus',
  185. placeholder: '请选择生产状态',
  186. },
  187. colProps: { span: 6 },
  188. },
  189. {
  190. field: 'coalSeamLevel',
  191. label: '自燃倾向性',
  192. component: 'Select',
  193. componentProps: {
  194. options: [
  195. { label: 'Ⅰ类容易自燃', value: 'Ⅰ类容易自燃' },
  196. { label: 'Ⅱ类自燃', value: 'Ⅱ类自燃' },
  197. { label: 'Ⅲ类不易自燃', value: 'Ⅲ类不易自燃' },
  198. ],
  199. },
  200. colProps: { span: 6 },
  201. },
  202. {
  203. field: 'gasLevelName',
  204. label: '瓦斯等级',
  205. component: 'Select',
  206. componentProps: {
  207. options: [
  208. { label: '低瓦斯', value: '低瓦斯' },
  209. { label: '高瓦斯', value: '高瓦斯' },
  210. { label: '突出', value: '突出' },
  211. ],
  212. },
  213. colProps: { span: 6 },
  214. },
  215. ];
  216. export const modalDetailsData: {
  217. basicInfo: Record<string, any>[];
  218. board: Record<string, any>[];
  219. gasConcentrationConfig: ModuleDataChart;
  220. pressureConfig: ModuleDataChart;
  221. } = {
  222. basicInfo: [
  223. {
  224. label: '煤矿名称',
  225. value: 'mineName',
  226. },
  227. {
  228. label: '设备位置',
  229. value: 'devicePos',
  230. },
  231. // {
  232. // label: '所属煤层',
  233. // value: 'coalSeamName',
  234. // },
  235. // {
  236. // label: '自燃倾向性',
  237. // value: 'Ⅰ类容易自燃',
  238. // },
  239. {
  240. label: '自然发火隐患',
  241. value: 'fireAlarm',
  242. customRender({ record }) {
  243. return alarmCellRender(record.fireAlarm, (r) => riskMap[r.alarmName] || r.alarmName);
  244. },
  245. },
  246. {
  247. label: '是否漏风',
  248. value: 'leakageAlarm',
  249. customRender({ record }) {
  250. return alarmCellRender(record.leakageAlarm);
  251. },
  252. },
  253. {
  254. label: '压差隐患等级',
  255. value: 'sourcePressureAlarm',
  256. customRender({ record }) {
  257. return alarmCellRender(record.sourcePressureAlarm, (r) => riskMap[r.alarmName] || r.alarmName);
  258. },
  259. },
  260. {
  261. label: '密闭启封判定',
  262. value: 'unsealAlarm',
  263. customRender({ record }) {
  264. return alarmCellRender(record.unsealAlarm);
  265. },
  266. },
  267. ],
  268. board: [
  269. {
  270. label: 'CO(ppm)',
  271. value: 'coVal',
  272. },
  273. {
  274. label: 'CO2(%)',
  275. value: 'co2Val',
  276. },
  277. {
  278. label: 'O2(%)',
  279. value: 'o2Val',
  280. },
  281. {
  282. label: 'CH4(%)',
  283. value: 'ch4Val',
  284. },
  285. {
  286. label: 'C2H4(ppm)',
  287. value: 'c2h4Val',
  288. },
  289. {
  290. label: 'C2H2(ppm)',
  291. value: 'c2h2Val',
  292. },
  293. {
  294. label: '温度(℃)',
  295. value: 'temperature',
  296. },
  297. {
  298. label: '压差(Pa)',
  299. value: 'sourcePressure',
  300. },
  301. ],
  302. gasConcentrationConfig: {
  303. type: 'line_smooth', // 使用光滑曲线类型
  304. legend: { show: true },
  305. xAxis: [
  306. {
  307. show: true,
  308. name: '时间',
  309. axisLabel: { color: '#000000' },
  310. },
  311. ],
  312. yAxis: [
  313. {
  314. show: true,
  315. name: '浓度(%)',
  316. position: 'left',
  317. splitLine: { show: false },
  318. axisLine: {
  319. show: true,
  320. lineStyle: { color: '#333' },
  321. },
  322. axisLabel: { color: '#000000' },
  323. nameTextStyle: { color: '#000' },
  324. },
  325. ],
  326. series: [
  327. {
  328. label: '氧气浓度',
  329. readFrom: 'chartData',
  330. xprop: 'readTime',
  331. yprop: 'o2Val',
  332. },
  333. {
  334. label: '一氧化碳浓度',
  335. readFrom: 'chartData',
  336. xprop: 'readTime',
  337. yprop: 'coVal',
  338. },
  339. {
  340. label: '二氧化碳浓度',
  341. readFrom: 'chartData',
  342. xprop: 'readTime',
  343. yprop: 'co2Val',
  344. },
  345. ],
  346. readFrom: '',
  347. },
  348. pressureConfig: {
  349. type: 'line', // 使用普通折线图类型
  350. legend: { show: true },
  351. xAxis: [
  352. {
  353. show: true,
  354. name: '时间',
  355. axisLabel: { color: '#000000' },
  356. },
  357. ],
  358. yAxis: [
  359. {
  360. show: true,
  361. position: 'left',
  362. name: '压力(kPa)',
  363. axisLabel: { color: '#000000' },
  364. },
  365. ],
  366. series: [
  367. {
  368. label: '压差',
  369. readFrom: 'chartData',
  370. xprop: 'readTime',
  371. yprop: 'sourcePressure',
  372. },
  373. ],
  374. readFrom: '',
  375. },
  376. };
  377. // 历史数据相关
  378. export const historicalColumns: BasicColumn[] = [
  379. // {
  380. // title: '序号',
  381. // dataIndex: 'orderNo',
  382. // width: 60,
  383. // },
  384. // {
  385. // title: '区域',
  386. // dataIndex: 'enforcement',
  387. // width: 100,
  388. // },
  389. {
  390. title: '煤矿名称',
  391. dataIndex: 'mineName',
  392. width: 200,
  393. },
  394. {
  395. title: '密闭名称',
  396. dataIndex: 'devicePos',
  397. width: 100,
  398. },
  399. {
  400. title: '所属煤层',
  401. dataIndex: 'coalSeamName',
  402. width: 100,
  403. },
  404. {
  405. title: 'CO(ppm)',
  406. dataIndex: 'coVal',
  407. width: 100,
  408. },
  409. {
  410. title: 'CO2(%)',
  411. dataIndex: 'co2Val',
  412. width: 100,
  413. },
  414. {
  415. title: 'CH4(%)',
  416. dataIndex: 'ch4Val',
  417. width: 100,
  418. },
  419. {
  420. title: 'C2H2(ppm)',
  421. dataIndex: 'c2h2Val',
  422. width: 100,
  423. },
  424. {
  425. title: 'C2H4(ppm)',
  426. dataIndex: 'c2h4Val',
  427. width: 100,
  428. },
  429. {
  430. title: 'O2(%)',
  431. dataIndex: 'o2Val',
  432. width: 100,
  433. },
  434. {
  435. title: '温度(℃)',
  436. dataIndex: 'temperature',
  437. width: 100,
  438. },
  439. {
  440. title: '压差(Pa)',
  441. dataIndex: 'sourcePressure',
  442. width: 100,
  443. },
  444. // {
  445. // title: '爆炸危险性',
  446. // dataIndex: 'explosionHazard',
  447. // width: 100,
  448. // },
  449. {
  450. title: '更新时间',
  451. dataIndex: 'createTime',
  452. width: 100,
  453. },
  454. ];
  455. export const historicalFormSchema: FormSchema[] = [
  456. // {
  457. // field: 'mineCode',
  458. // label: '煤矿名称',
  459. // component: 'MineCascader',
  460. // slot: 'mine-cascader',
  461. // colProps: { span: 6 },
  462. // },
  463. // {
  464. // field: 'mineNameAbbr',
  465. // label: '煤矿简称',
  466. // component: 'Input',
  467. // colProps: { span: 6 },
  468. // },
  469. // {
  470. // field: 'productStatus',
  471. // label: '生产状态',
  472. // component: 'Select',
  473. // componentProps: {
  474. // options: [
  475. // { label: '拟建矿井', value: '0' },
  476. // { label: '正常生产矿井', value: '1' },
  477. // { label: '长期停产矿井', value: '1' },
  478. // ],
  479. // },
  480. // colProps: { span: 6 },
  481. // },
  482. // {
  483. // field: 'riskLevel',
  484. // label: '自燃倾向性',
  485. // component: 'Select',
  486. // componentProps: {
  487. // options: [
  488. // { label: 'Ⅰ类容易自燃', value: '0' },
  489. // { label: 'Ⅱ类自燃', value: '1' },
  490. // { label: 'Ⅲ类不易自燃', value: '2' },
  491. // ],
  492. // },
  493. // colProps: { span: 6 },
  494. // },
  495. // {
  496. // field: 'coalSeam',
  497. // label: '所属煤层',
  498. // component: 'Select',
  499. // componentProps: {
  500. // options: [
  501. // { label: '煤层1', value: '0' },
  502. // { label: '煤层2', value: '1' },
  503. // { label: '煤层3', value: '2' },
  504. // ],
  505. // },
  506. // colProps: { span: 6 },
  507. // },
  508. {
  509. field: 'goafId',
  510. label: '密闭名称',
  511. component: 'ApiSelect',
  512. slot: 'goaf-select',
  513. colProps: { span: 6 },
  514. },
  515. {
  516. field: 'startTime',
  517. label: '起始日期',
  518. component: 'DatePicker',
  519. componentProps: {
  520. //日期格式化,页面上显示的值
  521. format: 'YYYY-MM-DD',
  522. //返回值格式化(绑定值的格式)
  523. valueFormat: 'YYYY-MM-DD 00:00:00',
  524. },
  525. defaultValue: dayjs().add(-30, 'day').format('YYYY-MM-DD'),
  526. colProps: { span: 6 },
  527. },
  528. {
  529. field: 'endTime',
  530. label: '结束日期',
  531. component: 'DatePicker',
  532. componentProps: {
  533. //日期格式化,页面上显示的值
  534. format: 'YYYY-MM-DD',
  535. //返回值格式化(绑定值的格式)
  536. valueFormat: 'YYYY-MM-DD 23:59:59',
  537. },
  538. defaultValue: dayjs().format('YYYY-MM-DD'),
  539. colProps: { span: 6 },
  540. },
  541. ];
  542. export const treeData: TreeItem[] = [
  543. {
  544. title: '气体参数 ',
  545. key: '0-0',
  546. children: [
  547. { title: 'CO', key: '0-0-0' },
  548. { title: 'CH4', key: '0-0-1' },
  549. { title: 'C2H4', key: '0-0-2' },
  550. { title: 'C2H2', key: '0-0-3' },
  551. { title: 'CO2', key: '0-0-4' },
  552. { title: 'O2', key: '0-0-5' },
  553. ],
  554. },
  555. {
  556. title: '内外压力及压差',
  557. key: '1-1',
  558. children: [
  559. { title: '内压力', key: '1-1-0' },
  560. { title: '外压力', key: '1-1-1' },
  561. { title: '压差', key: '1-1-2' },
  562. ],
  563. },
  564. {
  565. title: '温度',
  566. key: '2-2',
  567. },
  568. ];
  569. function getTagColor(level: string) {
  570. switch (level) {
  571. case '4':
  572. return StatusColorEnum.red;
  573. case '3':
  574. return StatusColorEnum.gold;
  575. case '2':
  576. return StatusColorEnum.yellow;
  577. case '1':
  578. return StatusColorEnum.blue;
  579. case '0':
  580. return StatusColorEnum.red;
  581. default:
  582. return 'inhert';
  583. }
  584. }
  585. export function alarmCellRender(
  586. record: any,
  587. valFn: (record: any) => string = (r) => r.alarmName,
  588. lvFn: (record: any) => string = (r) => r.alarmLevel
  589. ) {
  590. // if (!record) return h(Tag, { bordered: false, color: 'default' }, () => '-');
  591. // return h(Tag, { bordered: false, color: getTagColor(record.alarmLevel) }, () => record.alarmName);
  592. if (!record) return h('span', '-');
  593. const val = valFn(record);
  594. const lv = lvFn(record);
  595. return h('span', { style: { color: getTagColor(lv) } }, val);
  596. }