monitor.data.ts 12 KB

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