warning.data.ts 14 KB

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