options.ts 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742
  1. import _ from 'lodash-es';
  2. import { Config } from './types';
  3. export const ModuleSizeMap = {
  4. 'width:450px;height:280px;': '标准尺寸(450*280)',
  5. 'width:450px;height:570px;': '纵向拉伸(450*570)',
  6. 'width:450px;height:860px;': '纵向填充(450*860)',
  7. 'width:1000px;height:280px;': '横向拉伸(1000*280)',
  8. 'width:1920px;height:280px;': '横向填充(1920*280)',
  9. };
  10. /** 默认的模块宽高选项 */
  11. export const ModuleSizeOptions = _.map(ModuleSizeMap, (v, k) => ({
  12. value: k,
  13. label: v,
  14. }));
  15. /** 默认的模块版本选项,即外边框样式 */
  16. export const ModuleVersionOptions = _.map(['原版', '新版'], (k) => ({
  17. value: k,
  18. label: k,
  19. }));
  20. export const ModulePositionMap = {
  21. 'display:none;': '不展示',
  22. 'top:60px;left:0;': '左上',
  23. 'top:350px;left:0;': '左中',
  24. 'top:640px;left:0;': '左下',
  25. 'top:60px;right:0;': '右上',
  26. 'top:350px;right:0;': '右中',
  27. 'top:640px;right:0;': '右下',
  28. 'top:640px;left:460px;': '中下',
  29. };
  30. /** 默认的模块定位选项 */
  31. export const ModulePositionOptions = _.map(ModulePositionMap, (v, k) => ({
  32. value: k,
  33. label: v,
  34. }));
  35. /** 默认的模块预设选项,每个预设对应着一种写好的配置 */
  36. export const ModulePresetOptions = _.map(
  37. [
  38. '告示版(1*1)',
  39. '折线图(1*1)',
  40. '面积图(1*1)',
  41. '饼状图(1*1)',
  42. '柱状图(2*1)',
  43. '画廊(1*1)',
  44. '列表(1*1)',
  45. '表格(1*1)',
  46. '爆炸三角形(1*1)',
  47. ],
  48. (k) => ({
  49. value: k,
  50. label: k,
  51. })
  52. );
  53. /** 默认的模块预设表 */
  54. export const ModulePresetMap: Record<
  55. string,
  56. {
  57. moduleData: Config['moduleData'];
  58. showStyle: Partial<Config['showStyle']>;
  59. }
  60. > = {
  61. '告示版(1*1)': {
  62. moduleData: {
  63. header: {
  64. show: true,
  65. showSelector: true,
  66. showSlot: true,
  67. selector: {
  68. value: '${strinstallpos}',
  69. },
  70. slot: {
  71. value: '${strinstallpos}',
  72. },
  73. },
  74. background: {
  75. show: false,
  76. type: 'image',
  77. link: '',
  78. },
  79. layout: ['board'],
  80. board: [
  81. {
  82. type: 'A',
  83. layout: 'val-top',
  84. readFrom: 'readData',
  85. items: [
  86. {
  87. value: '${Fan1StartStatus_str}',
  88. label: '一号机状态',
  89. },
  90. {
  91. value: '${Fan2StartStatus_str}',
  92. label: '二号机状态',
  93. },
  94. ],
  95. },
  96. ],
  97. list: [],
  98. chart: [],
  99. table: [],
  100. gallery: [],
  101. preset: [],
  102. complex_list: [],
  103. },
  104. showStyle: {
  105. size: 'width:450px;height:280px;',
  106. },
  107. },
  108. '折线图(1*1)': {
  109. moduleData: {
  110. header: {
  111. show: false,
  112. showSelector: true,
  113. showSlot: true,
  114. selector: {
  115. value: '${strinstallpos}',
  116. },
  117. slot: {
  118. value: '${strinstallpos}',
  119. },
  120. },
  121. background: {
  122. show: false,
  123. type: 'video',
  124. link: '',
  125. },
  126. layout: ['chart'],
  127. board: [],
  128. list: [],
  129. chart: [
  130. {
  131. type: 'line',
  132. readFrom: 'majorpath.paths',
  133. xAxis: [{ label: '${name}' }],
  134. yAxis: [
  135. { label: 'Drag', align: 'left' },
  136. { label: 'M3', align: 'right' },
  137. ],
  138. series: [
  139. { label: 'Drag', value: '${drag}' },
  140. { label: 'M3', value: '${m3}' },
  141. // { label: '回2', value: '${hui2}' },
  142. ],
  143. },
  144. ],
  145. gallery: [],
  146. table: [],
  147. preset: [],
  148. complex_list: [],
  149. },
  150. showStyle: {
  151. size: 'width:450px;height:280px;',
  152. },
  153. },
  154. '面积图(1*1)': {
  155. moduleData: {
  156. header: {
  157. show: false,
  158. showSelector: true,
  159. showSlot: true,
  160. selector: {
  161. value: '${strinstallpos}',
  162. },
  163. slot: {
  164. value: '${strinstallpos}',
  165. },
  166. },
  167. background: {
  168. show: false,
  169. type: 'video',
  170. link: '',
  171. },
  172. layout: ['chart'],
  173. board: [],
  174. list: [],
  175. chart: [
  176. {
  177. type: 'line_area',
  178. readFrom: 'majorpath.paths',
  179. xAxis: [{ label: '${name}' }],
  180. yAxis: [
  181. { label: 'Drag', align: 'left' },
  182. { label: 'M3', align: 'right' },
  183. ],
  184. series: [
  185. { label: 'Drag', value: '${drag}' },
  186. { label: 'M3', value: '${m3}' },
  187. // { label: '回2', value: '${hui2}' },
  188. ],
  189. },
  190. ],
  191. gallery: [],
  192. table: [],
  193. preset: [],
  194. complex_list: [],
  195. },
  196. showStyle: { size: 'width:450px;height:280px;' },
  197. },
  198. '饼状图(1*1)': {
  199. moduleData: {
  200. header: {
  201. show: false,
  202. showSelector: true,
  203. showSlot: true,
  204. selector: {
  205. value: '${strinstallpos}',
  206. },
  207. slot: {
  208. value: '${strinstallpos}',
  209. },
  210. },
  211. background: {
  212. show: false,
  213. type: 'video',
  214. link: '',
  215. },
  216. layout: ['chart'],
  217. board: [],
  218. list: [],
  219. chart: [
  220. {
  221. type: 'pie',
  222. readFrom: 'history',
  223. xAxis: [],
  224. yAxis: [],
  225. series: [
  226. { label: 'Drag', value: '${drag}' },
  227. { label: 'M3', value: '${m3}' },
  228. // { label: '回2', value: '${hui2}' },
  229. ],
  230. },
  231. ],
  232. gallery: [],
  233. table: [],
  234. preset: [],
  235. complex_list: [],
  236. },
  237. showStyle: { size: 'width:450px;height:280px;' },
  238. },
  239. '柱状图(2*1)': {
  240. moduleData: {
  241. header: {
  242. show: false,
  243. showSelector: false,
  244. showSlot: false,
  245. selector: {
  246. value: '${strinstallpos}',
  247. },
  248. slot: {
  249. value: '${strinstallpos}',
  250. },
  251. },
  252. background: {
  253. show: false,
  254. type: 'video',
  255. link: '',
  256. },
  257. layout: ['chart'],
  258. board: [],
  259. list: [],
  260. table: [],
  261. preset: [],
  262. gallery: [],
  263. complex_list: [],
  264. chart: [
  265. {
  266. type: 'bar',
  267. readFrom: 'sysdata.history',
  268. xAxis: [{ label: '${time}' }],
  269. yAxis: [{ label: '回1', align: 'left' }],
  270. series: [{ label: '回1', value: '${hui1}' }],
  271. },
  272. ],
  273. },
  274. showStyle: { size: 'width:450px;height:280px;' },
  275. },
  276. '画廊(1*1)': {
  277. moduleData: {
  278. header: {
  279. show: false,
  280. showSelector: false,
  281. showSlot: false,
  282. selector: {
  283. value: '${devicePos}',
  284. },
  285. slot: {
  286. value: '${devicePos}',
  287. },
  288. },
  289. background: {
  290. show: false,
  291. type: 'video',
  292. link: '',
  293. },
  294. layout: ['gallery'],
  295. board: [],
  296. gallery: [
  297. {
  298. type: 'A',
  299. readFrom: 'device',
  300. items: [
  301. {
  302. value: '${gate}',
  303. label: '风门',
  304. // label: '光纤预警',
  305. color: 'blue',
  306. },
  307. {
  308. value: '${window}',
  309. label: '风窗',
  310. // label: '喷雾开启数',
  311. color: 'blue',
  312. },
  313. {
  314. value: '${windrect}',
  315. label: '测风',
  316. // label: '联网数量',
  317. color: 'blue',
  318. },
  319. {
  320. value: '${stationtype}',
  321. label: '空位',
  322. // label: '断网数量',
  323. color: 'blue',
  324. },
  325. ],
  326. },
  327. ],
  328. list: [],
  329. table: [],
  330. chart: [],
  331. preset: [],
  332. complex_list: [],
  333. },
  334. showStyle: { size: 'width:450px;height:280px;' },
  335. },
  336. '列表(1*1)': {
  337. moduleData: {
  338. header: {
  339. show: false,
  340. showSelector: false,
  341. showSlot: true,
  342. selector: {
  343. value: '${strinstallpos}',
  344. },
  345. slot: {
  346. value: '${网络异常:}${netstatus.val} 台',
  347. },
  348. },
  349. background: {
  350. show: false,
  351. type: 'video',
  352. link: '',
  353. },
  354. layout: ['list'],
  355. board: [],
  356. chart: [],
  357. table: [],
  358. preset: [],
  359. complex_list: [],
  360. gallery: [],
  361. list: [
  362. {
  363. type: 'timeline',
  364. readFrom: '',
  365. items: [
  366. {
  367. label: '正常',
  368. value: '${blue}.val',
  369. color: 'blue',
  370. info: '',
  371. },
  372. {
  373. label: '告警',
  374. value: '${orange}.val',
  375. color: 'orange',
  376. info: '',
  377. },
  378. {
  379. label: '报警',
  380. value: '${yellow}.val',
  381. color: 'yellow',
  382. info: '',
  383. },
  384. {
  385. label: '危险',
  386. value: '${red}.val',
  387. color: 'red',
  388. info: '',
  389. },
  390. {
  391. label: '错误',
  392. value: '${alarm}.val',
  393. color: 'green',
  394. info: '',
  395. },
  396. ],
  397. },
  398. ],
  399. },
  400. showStyle: { size: 'width:450px;height:280px;' },
  401. },
  402. '表格(1*1)': {
  403. moduleData: {
  404. header: {
  405. show: false,
  406. showSelector: true,
  407. showSlot: true,
  408. selector: {
  409. value: '${devicePos}',
  410. },
  411. slot: {
  412. value: '${devicePos}',
  413. },
  414. },
  415. background: {
  416. show: false,
  417. type: 'video',
  418. link: '',
  419. },
  420. layout: ['table'],
  421. board: [],
  422. list: [],
  423. preset: [],
  424. gallery: [],
  425. complex_list: [],
  426. table: [
  427. {
  428. type: 'B',
  429. readFrom: 'history',
  430. columns: [
  431. {
  432. prop: 'cate',
  433. label: '类别',
  434. },
  435. {
  436. prop: 'temp',
  437. label: '温度',
  438. },
  439. {
  440. prop: 'wspd',
  441. label: '风速',
  442. },
  443. {
  444. prop: 'spst',
  445. label: '喷雾状态',
  446. },
  447. ],
  448. },
  449. ],
  450. chart: [],
  451. },
  452. showStyle: { size: 'width:450px;height:280px;' },
  453. },
  454. '爆炸三角形(1*1)': {
  455. moduleData: {
  456. header: {
  457. show: false,
  458. showSelector: true,
  459. showSlot: false,
  460. selector: {
  461. value: '${strinstallpos}',
  462. },
  463. slot: {
  464. value: '${strinstallpos}',
  465. },
  466. },
  467. background: {
  468. show: false,
  469. type: 'video',
  470. link: '',
  471. },
  472. layout: ['blast_delta'],
  473. board: [],
  474. gallery: [],
  475. list: [],
  476. table: [],
  477. chart: [],
  478. complex_list: [],
  479. preset: [{}],
  480. },
  481. showStyle: { size: 'width:450px;height:280px;' },
  482. },
  483. '采空区火情综合预警(1*1)': {
  484. moduleData: {
  485. header: {
  486. show: false,
  487. showSelector: false,
  488. showSlot: true,
  489. selector: {
  490. value: '${strinstallpos}',
  491. },
  492. slot: {
  493. value: '${网络异常:}${netstatus.val} 台',
  494. },
  495. },
  496. background: {
  497. show: false,
  498. type: 'video',
  499. link: '',
  500. },
  501. layout: ['complex_list', 'list'],
  502. // layout: ['list'],
  503. board: [],
  504. chart: [],
  505. gallery: [],
  506. table: [],
  507. list: [
  508. {
  509. type: 'B',
  510. readFrom: '',
  511. items: [
  512. {
  513. label: '堵塞状态',
  514. value: '${fsectarea}',
  515. color: 'yellow',
  516. info: '',
  517. },
  518. {
  519. label: '甲烷浓度',
  520. value: '${stationname}',
  521. color: 'yellow',
  522. info: '',
  523. },
  524. ],
  525. },
  526. ],
  527. complex_list: [
  528. {
  529. type: 'A',
  530. readFrom: '',
  531. items: [
  532. {
  533. label: '火情状态',
  534. value: '${fsectarea}',
  535. color: 'yellow',
  536. info: '',
  537. },
  538. {
  539. label: '回采位置',
  540. value: '${stationname}',
  541. color: 'white',
  542. info: '',
  543. },
  544. {
  545. label: '硐室火情',
  546. value: '${stationtype}',
  547. color: 'blue',
  548. info: '',
  549. },
  550. {
  551. label: '联动设备状态',
  552. value: '${typeName}',
  553. color: 'blue',
  554. info: '',
  555. },
  556. ],
  557. galleryItems: [
  558. {
  559. value: '${低风险}',
  560. label: '',
  561. color: 'white',
  562. },
  563. {
  564. value: '${CO}',
  565. label: '',
  566. color: 'white',
  567. },
  568. ],
  569. },
  570. ],
  571. preset: [],
  572. },
  573. showStyle: {
  574. size: 'width:450px;height:280px;',
  575. },
  576. },
  577. '重点区域实时火情(1*2)': {
  578. moduleData: {
  579. header: {
  580. show: false,
  581. showSelector: true,
  582. showSlot: true,
  583. selector: {
  584. value: '${devicePos}',
  585. },
  586. slot: {
  587. value: '${devicePos}',
  588. },
  589. },
  590. background: {
  591. show: false,
  592. type: 'video',
  593. link: '',
  594. },
  595. layout: ['complex_list', 'blast_delta', 'list'],
  596. board: [],
  597. gallery: [],
  598. list: [
  599. {
  600. type: 'E',
  601. readFrom: '',
  602. items: [
  603. {
  604. label: '火情状态',
  605. value: '${fsectarea}',
  606. color: 'yellow',
  607. info: '',
  608. },
  609. {
  610. label: '回采位置',
  611. value: '${stationname}',
  612. color: 'white',
  613. info: '',
  614. },
  615. {
  616. label: '硐室火情',
  617. value: '${stationtype}',
  618. color: 'blue',
  619. info: '',
  620. },
  621. {
  622. label: '联动设备状态',
  623. value: '${typeName}',
  624. color: 'blue',
  625. info: '',
  626. },
  627. {
  628. label: '火情状态',
  629. value: '${fsectarea}',
  630. color: 'yellow',
  631. info: '',
  632. },
  633. {
  634. label: '回采位置',
  635. value: '${stationname}',
  636. color: 'white',
  637. info: '',
  638. },
  639. {
  640. label: '硐室火情',
  641. value: '${stationtype}',
  642. color: 'blue',
  643. info: '',
  644. },
  645. {
  646. label: '联动设备状态',
  647. value: '${typeName}',
  648. color: 'blue',
  649. info: '',
  650. },
  651. // {
  652. // label: '火情状态',
  653. // value: '${fsectarea}',
  654. // color: 'yellow',
  655. // info: '',
  656. // },
  657. // {
  658. // label: '回采位置',
  659. // value: '${stationname}',
  660. // color: 'white',
  661. // info: '',
  662. // },
  663. // {
  664. // label: '硐室火情',
  665. // value: '${stationtype}',
  666. // color: 'blue',
  667. // info: '',
  668. // },
  669. // {
  670. // label: '联动设备状态',
  671. // value: '${typeName}',
  672. // color: 'blue',
  673. // info: '',
  674. // },
  675. ],
  676. },
  677. ],
  678. table: [],
  679. chart: [],
  680. preset: [{}],
  681. complex_list: [
  682. {
  683. type: 'B',
  684. readFrom: '',
  685. items: [
  686. {
  687. label: '火情状态',
  688. value: '${fsectarea}',
  689. color: 'yellow',
  690. info: '',
  691. },
  692. {
  693. label: '回采位置',
  694. value: '${stationname}',
  695. color: 'white',
  696. info: '',
  697. },
  698. {
  699. label: '硐室火情',
  700. value: '${stationtype}',
  701. color: 'blue',
  702. info: '',
  703. },
  704. {
  705. label: '联动设备状态',
  706. value: '${typeName}',
  707. color: 'blue',
  708. info: '',
  709. },
  710. ],
  711. galleryItems: [
  712. {
  713. value: '${低风险}',
  714. label: '风险等级',
  715. color: 'white',
  716. },
  717. ],
  718. },
  719. ],
  720. },
  721. showStyle: {
  722. size: 'width:450px;height:570px;',
  723. },
  724. },
  725. };
  726. // export const ModuleChartTypeMap = {
  727. // pie: '饼状图',
  728. // bar: '柱状图',
  729. // line: '折线图',
  730. // };
  731. // export const ModuleChartTypeOptions = _.map(ModuleChartTypeMap, (v, k) => ({
  732. // value: k,
  733. // label: v,
  734. // }));