warning.data.ts 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740
  1. import { BasicColumn, FormSchema } from '/@/components/Table';
  2. import { initDictOptions } from '/@/utils/dict';
  3. import type { TableColumnType } from 'ant-design-vue';
  4. import { workFaceDeviceList } from './warning.api';
  5. export const levelColumns: BasicColumn[] = [
  6. {
  7. title: '下限',
  8. width: 100,
  9. editRow: true,
  10. dataIndex: 'fmin',
  11. editComponent: 'InputNumber',
  12. },
  13. {
  14. title: '上限',
  15. dataIndex: 'fmax',
  16. width: 100,
  17. editRow: true,
  18. editComponent: 'InputNumber',
  19. },
  20. {
  21. title: '持续时间(s)',
  22. dataIndex: 'timelength',
  23. editRow: true,
  24. width: 100,
  25. editComponent: 'InputNumber',
  26. },
  27. {
  28. title: '报警等级',
  29. dataIndex: 'leveltype',
  30. editRow: true,
  31. editRule: true,
  32. width: 100,
  33. editComponent: 'ApiSelect',
  34. editComponentProps: {
  35. api: initDictOptions.bind(null, 'leveltype'),
  36. labelField: 'label',
  37. valueField: 'value',
  38. },
  39. },
  40. {
  41. title: '报警描述',
  42. width: 180,
  43. editRow: true,
  44. dataIndex: 'des',
  45. editComponent: 'Input',
  46. },
  47. ];
  48. export const warningColumns: BasicColumn[] = [
  49. {
  50. title: '',
  51. dataIndex: 'id',
  52. ifShow: false,
  53. },
  54. {
  55. title: '监测参数',
  56. dataIndex: 'monitorcode',
  57. width: 150,
  58. editRow: true,
  59. editComponent: 'Input',
  60. editRule: async (text) => {
  61. if (!text) {
  62. return '请选择';
  63. }
  64. return '';
  65. },
  66. },
  67. {
  68. title: '模拟最小值',
  69. width: 150,
  70. dataIndex: 'ftestmin',
  71. editRow: true,
  72. editComponent: 'InputNumber',
  73. },
  74. {
  75. title: '模拟最大值',
  76. dataIndex: 'ftestmax',
  77. editRow: true,
  78. width: 150,
  79. editComponent: 'InputNumber',
  80. },
  81. {
  82. title: '备注',
  83. dataIndex: 'des',
  84. editRow: true,
  85. width: 200,
  86. editComponent: 'Input',
  87. },
  88. ];
  89. export const deviceColumns: BasicColumn[] = [
  90. {
  91. title: '名称',
  92. dataIndex: 'deviceName',
  93. align: 'center',
  94. width: 120,
  95. },
  96. {
  97. title: '安装位置',
  98. dataIndex: 'devicePos',
  99. align: 'center',
  100. width: 100,
  101. },
  102. {
  103. title: '设备类型',
  104. dataIndex: 'deviceType',
  105. align: 'center',
  106. width: 100,
  107. },
  108. {
  109. title: '所属分站',
  110. width: 150,
  111. align: 'center',
  112. dataIndex: 'subStationName',
  113. },
  114. ];
  115. export const workFaceColumns: BasicColumn[] = [
  116. {
  117. title: '安装位置',
  118. dataIndex: 'devicePos',
  119. width: 100,
  120. },
  121. {
  122. title: '排序',
  123. width: 100,
  124. dataIndex: 'sort',
  125. edit: true,
  126. editComponent: 'InputNumber',
  127. },
  128. {
  129. title: '是否在关键通风路线上',
  130. width: 100,
  131. dataIndex: 'pathflag',
  132. edit: true,
  133. editComponent: 'Switch',
  134. editValueMap: (value) => {
  135. return value ? '是' : '否';
  136. },
  137. },
  138. {
  139. title: '传感器类型',
  140. width: 100,
  141. dataIndex: 'sensorType',
  142. edit: true,
  143. editComponent: 'Select',
  144. editComponentProps: {
  145. options: [
  146. {
  147. label: '多参',
  148. value: '1',
  149. },
  150. {
  151. label: '测风',
  152. value: '2',
  153. },
  154. ],
  155. },
  156. },
  157. {
  158. title: '风向',
  159. width: 100,
  160. dataIndex: 'winddir',
  161. edit: true,
  162. editComponent: 'Select',
  163. editComponentProps: {
  164. options: [
  165. {
  166. label: '多参',
  167. value: '1',
  168. },
  169. {
  170. label: '测风',
  171. value: '2',
  172. },
  173. ],
  174. },
  175. },
  176. {
  177. title: '是否参与计算风量',
  178. width: 100,
  179. dataIndex: 'windflag',
  180. edit: true,
  181. editComponent: 'Switch',
  182. editValueMap: (value) => {
  183. return value ? '是' : '否';
  184. },
  185. },
  186. ];
  187. export const workFaceWarningColumns: BasicColumn[] = [
  188. {
  189. title: '报警条目',
  190. dataIndex: 'alarmName',
  191. align: 'center',
  192. },
  193. {
  194. title: '预警等级',
  195. dataIndex: 'alarmLevel',
  196. align: 'center',
  197. },
  198. {
  199. title: '所属系统',
  200. dataIndex: 'systemType',
  201. align: 'center',
  202. },
  203. {
  204. title: '创建人',
  205. dataIndex: 'createBy',
  206. align: 'center',
  207. },
  208. {
  209. title: '创建日期',
  210. dataIndex: 'createTime',
  211. align: 'center',
  212. },
  213. ];
  214. export const workFaceWarningFormSchemas: FormSchema[] = [
  215. {
  216. label: 'ID',
  217. field: 'id',
  218. component: 'Input',
  219. show: false,
  220. },
  221. {
  222. label: '预警名称',
  223. field: 'alarmName',
  224. component: 'Input',
  225. required: true,
  226. },
  227. {
  228. label: '预警等级',
  229. field: 'alarmLevel',
  230. component: 'JDictSelectTag',
  231. componentProps: { dictCode: 'leveltype' },
  232. },
  233. {
  234. label: '所属系统',
  235. field: 'systemType',
  236. component: 'JDictSelectTag',
  237. componentProps: { dictCode: 'kindtype' },
  238. },
  239. ];
  240. export const manageWarningPointColumns: BasicColumn[] = [
  241. {
  242. title: '设备名称',
  243. dataIndex: 'deviceName',
  244. align: 'center',
  245. },
  246. {
  247. title: '报警条目',
  248. dataIndex: 'alarmName',
  249. align: 'center',
  250. },
  251. {
  252. title: '报警下限',
  253. dataIndex: 'fmin',
  254. align: 'center',
  255. edit: true,
  256. editComponent: 'InputNumber',
  257. },
  258. {
  259. title: '报警上限',
  260. dataIndex: 'fmax',
  261. align: 'center',
  262. edit: true,
  263. editComponent: 'InputNumber',
  264. },
  265. {
  266. title: '报警持续时间(s)',
  267. dataIndex: 'cxTime',
  268. align: 'center',
  269. edit: true,
  270. editComponent: 'InputNumber',
  271. },
  272. {
  273. title: '更新人',
  274. dataIndex: 'updateBy',
  275. align: 'center',
  276. width: 100,
  277. },
  278. ];
  279. export const controlFormSchemas = (param) =>
  280. <FormSchema[]>[
  281. {
  282. label: 'ID',
  283. field: 'id',
  284. component: 'Input',
  285. show: false,
  286. },
  287. {
  288. label: '点表',
  289. field: 'strtype',
  290. component: 'Input',
  291. show: false,
  292. },
  293. {
  294. label: '设备名称',
  295. field: 'deviceId',
  296. component: 'ApiSelect',
  297. required: true,
  298. componentProps: ({ formModel }) => {
  299. return {
  300. api: workFaceDeviceList.bind(null, param),
  301. labelField: 'strname',
  302. valueField: 'id',
  303. onChange: (e, option) => {
  304. if (option) formModel['strtype'] = option['strtype'];
  305. },
  306. };
  307. },
  308. },
  309. {
  310. label: '点位',
  311. field: 'monitorId',
  312. component: 'Select',
  313. slot: 'monitor',
  314. required: true,
  315. },
  316. {
  317. label: '执行顺序',
  318. field: 'orderNum',
  319. component: 'InputNumber',
  320. },
  321. ];
  322. export const controlDevicePointColumns: BasicColumn[] = [
  323. {
  324. title: '报警条目',
  325. dataIndex: 'alarmName',
  326. align: 'center',
  327. },
  328. {
  329. title: '设备安装位置',
  330. dataIndex: 'devicePos',
  331. align: 'center',
  332. },
  333. {
  334. title: '控制点位描述',
  335. dataIndex: 'monitorName',
  336. align: 'center',
  337. },
  338. {
  339. title: '值',
  340. dataIndex: 'value',
  341. align: 'center',
  342. },
  343. // {
  344. // title: '审批状态',
  345. // dataIndex: 'bpmStatus',
  346. // align: 'center',
  347. // edit: true,
  348. // editComponent: 'Select',
  349. // editComponentProps: {
  350. // options: [
  351. // {
  352. // label: '审批',
  353. // value: '1',
  354. // },
  355. // {
  356. // label: '不审批',
  357. // value: '0',
  358. // },
  359. // ],
  360. // },
  361. // },
  362. {
  363. title: '执行顺序',
  364. dataIndex: 'orderNum',
  365. align: 'center',
  366. },
  367. {
  368. title: '更新人',
  369. dataIndex: 'updateBy',
  370. align: 'center',
  371. width: 100,
  372. },
  373. {
  374. title: '操作',
  375. dataIndex: 'operation',
  376. width: 100,
  377. },
  378. ];
  379. export const monitorWarningFormSchemas = (param) =>
  380. <FormSchema[]>[
  381. {
  382. label: 'ID',
  383. field: 'id',
  384. component: 'Input',
  385. show: false,
  386. },
  387. {
  388. label: '点表',
  389. field: 'strtype',
  390. component: 'Input',
  391. show: false,
  392. },
  393. {
  394. label: '设备名称',
  395. field: 'deviceId',
  396. component: 'ApiSelect',
  397. required: true,
  398. componentProps: ({ formModel }) => {
  399. return {
  400. api: workFaceDeviceList.bind(null, param),
  401. labelField: 'strname',
  402. valueField: 'id',
  403. onChange: (e, option) => {
  404. if (option) formModel['strtype'] = option['strtype'];
  405. },
  406. };
  407. },
  408. },
  409. {
  410. label: '且关系关联id',
  411. field: 'relId',
  412. component: 'Input',
  413. show: false,
  414. },
  415. {
  416. label: '点位',
  417. field: 'monitorId',
  418. component: 'Select',
  419. slot: 'monitor',
  420. required: true,
  421. },
  422. {
  423. label: '报警上限值',
  424. field: 'fmax',
  425. component: 'InputNumber',
  426. },
  427. {
  428. label: '报警下限值',
  429. field: 'fmin',
  430. component: 'InputNumber',
  431. },
  432. {
  433. label: '报警持续时间(s)',
  434. field: 'cxTime',
  435. component: 'InputNumber',
  436. },
  437. ];
  438. export const controlWarningFormSchemas: FormSchema[] = [
  439. {
  440. label: 'ID',
  441. field: 'id',
  442. component: 'Input',
  443. show: false,
  444. },
  445. {
  446. label: '设备名称',
  447. field: 'deviceName',
  448. component: 'Input',
  449. required: true,
  450. },
  451. {
  452. label: '控制点位描述',
  453. field: 'monitorName',
  454. component: 'Input',
  455. },
  456. {
  457. label: '值',
  458. field: 'value',
  459. component: 'Input',
  460. },
  461. {
  462. label: '执行顺序',
  463. field: 'orderNum',
  464. component: 'Input',
  465. },
  466. ];
  467. export const BackWindDevicePointColumns: BasicColumn[] = [
  468. {
  469. title: '设备名称',
  470. dataIndex: 'deviceName',
  471. align: 'center',
  472. },
  473. {
  474. title: '设备安装位置',
  475. dataIndex: 'devicePos',
  476. align: 'center',
  477. },
  478. {
  479. title: '控制点位描述',
  480. dataIndex: 'monitorName',
  481. align: 'center',
  482. },
  483. {
  484. title: '值',
  485. dataIndex: 'value',
  486. edit: true,
  487. editComponent: 'Input',
  488. align: 'center',
  489. },
  490. // {
  491. // title: '审批状态',
  492. // dataIndex: 'bpmStatus',
  493. // align: 'center',
  494. // edit: true,
  495. // editComponent: 'Select',
  496. // editComponentProps: {
  497. // options: [
  498. // {
  499. // label: '审批',
  500. // value: '1',
  501. // },
  502. // {
  503. // label: '不审批',
  504. // value: '0',
  505. // },
  506. // ],
  507. // },
  508. // },
  509. {
  510. title: '执行顺序',
  511. dataIndex: 'orderNum',
  512. align: 'center',
  513. edit: true,
  514. editComponent: 'InputNumber',
  515. },
  516. {
  517. title: '更新人',
  518. dataIndex: 'updateBy',
  519. align: 'center',
  520. width: 100,
  521. },
  522. ];
  523. export const rowOrColSpanMap = new Map();
  524. const sharedOnCell = (record, rowIndex, column) => {
  525. const arr = rowOrColSpanMap.get(record.id);
  526. if (arr) {
  527. const col = arr.find((item) => {
  528. return item.code === column.dataIndex;
  529. });
  530. if (col) return { rowSpan: col.rowSpan, colSpan: col.colSpan };
  531. }
  532. };
  533. export const MonitorColumns: TableColumnType[] = [
  534. {
  535. title: '组合',
  536. dataIndex: 'key',
  537. customCell: sharedOnCell,
  538. },
  539. {
  540. title: '预警名称',
  541. dataIndex: 'alarmName',
  542. customCell: sharedOnCell,
  543. },
  544. {
  545. title: '设备名称',
  546. dataIndex: 'deviceName',
  547. customCell: sharedOnCell,
  548. },
  549. {
  550. title: '监测点位',
  551. dataIndex: 'monitorName',
  552. customCell: sharedOnCell,
  553. },
  554. {
  555. title: '报警下限值',
  556. dataIndex: 'fmin',
  557. customCell: sharedOnCell,
  558. },
  559. {
  560. title: '报警上限值',
  561. dataIndex: 'fmax',
  562. customCell: sharedOnCell,
  563. },
  564. {
  565. title: '报警持续时间',
  566. dataIndex: 'cxTime',
  567. customCell: sharedOnCell,
  568. },
  569. {
  570. title: '操作',
  571. colSpan: 2,
  572. dataIndex: 'operation',
  573. width: 120,
  574. customCell: sharedOnCell,
  575. },
  576. {
  577. title: '操作',
  578. colSpan: 0,
  579. dataIndex: 'operation1',
  580. width: 80,
  581. customCell: sharedOnCell,
  582. },
  583. ];
  584. export const controlColumns: TableColumnType[] = [
  585. {
  586. title: '预警名称',
  587. dataIndex: 'alarmName',
  588. align: 'center',
  589. },
  590. {
  591. title: '设备名称',
  592. dataIndex: 'deviceName',
  593. align: 'center',
  594. },
  595. {
  596. title: '控制点位',
  597. dataIndex: 'monitorName',
  598. align: 'center',
  599. },
  600. {
  601. title: '执行顺序',
  602. dataIndex: 'orderNum',
  603. align: 'center',
  604. },
  605. {
  606. title: '操作',
  607. colSpan: 2,
  608. dataIndex: 'operation',
  609. width: 120,
  610. align: 'center',
  611. },
  612. ];
  613. export const testData = [
  614. {
  615. key: '1',
  616. name: '气源压力超限',
  617. age: 32,
  618. tel: '0571-22098909',
  619. phone: 18889898989,
  620. address: 'New York No. 1 Lake Park',
  621. rowSpan: 1,
  622. colSpan: 1,
  623. },
  624. {
  625. key: '2',
  626. name: '气源压力超限',
  627. tel: '0571-22098333',
  628. phone: 18889898888,
  629. age: 42,
  630. address: 'London No. 1 Lake Park',
  631. rowSpan: 1,
  632. colSpan: 1,
  633. },
  634. {
  635. key: '3',
  636. name: '气源压力超限',
  637. age: 32,
  638. tel: '0575-22098909',
  639. phone: 18900010002,
  640. address: 'Sidney No. 1 Lake Park',
  641. rowSpan: 1,
  642. colSpan: 1,
  643. },
  644. {
  645. key: '4',
  646. name: '气源压力超限',
  647. age: 18,
  648. tel: '0575-22098909',
  649. phone: 18900010002,
  650. address: 'London No. 2 Lake Park',
  651. rowSpan: 1,
  652. colSpan: 1,
  653. },
  654. {
  655. key: '5',
  656. name: '气源压力超限',
  657. age: 18,
  658. tel: '0575-22098909',
  659. phone: 18900010002,
  660. address: 'Dublin No. 2 Lake Park',
  661. rowSpan: 1,
  662. colSpan: 1,
  663. },
  664. ];
  665. export const testData1 = [
  666. {
  667. key: '1',
  668. alarmName: '气源压力超限',
  669. devicePos: 32,
  670. monitorName: '0571-22098909',
  671. value: 18889898989,
  672. orderNum: '1',
  673. updateBy: 'New York No. 1 Lake Park',
  674. },
  675. {
  676. key: '2',
  677. alarmName: '气源压力超限',
  678. devicePos: 42,
  679. monitorName: '0571-22098333',
  680. value: 18889898888,
  681. orderNum: '2',
  682. updateBy: 'London No. 1 Lake Park',
  683. },
  684. {
  685. key: '3',
  686. alarmName: '气源压力超限',
  687. devicePos: 32,
  688. monitorName: '0575-22098909',
  689. value: 18900010002,
  690. orderNum: '3',
  691. updateBy: 'Sidney No. 1 Lake Park',
  692. },
  693. {
  694. key: '4',
  695. alarmName: '气源压力超限',
  696. devicePos: 18,
  697. monitorName: '0575-22098909',
  698. value: 18900010002,
  699. orderNum: '4',
  700. updateBy: 'London No. 2 Lake Park',
  701. },
  702. {
  703. key: '5',
  704. alarmName: '气源压力超限',
  705. devicePos: 18,
  706. monitorName: '0575-22098909',
  707. value: 18900010002,
  708. orderNum: '5',
  709. updateBy: 'Dublin No. 2 Lake Park',
  710. },
  711. {
  712. key: '6',
  713. alarmName: '气源压力超限',
  714. devicePos: 18,
  715. monitorName: '0575-22098909',
  716. value: 18900010002,
  717. orderNum: '5',
  718. updateBy: 'Dublin No. 2 Lake Park',
  719. },
  720. ];