data.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863
  1. import echarts from "echarts"
  2. const rowLimit = (params, max) => {
  3. let result = ''
  4. //一行显示几个字
  5. let rowMax = max
  6. let rowNumber = Math.ceil(params.length / rowMax)
  7. // 超过 3 个字换行
  8. if (params.length > 3) {
  9. for (let p = 0; p < rowNumber; p++) {
  10. let tempStr = ''
  11. let start = p * rowMax
  12. let end = start + rowMax
  13. if (p == rowNumber - 1) {
  14. tempStr = params.substring(start, params.length);
  15. } else {
  16. tempStr = params.substring(start, end) + '\n'
  17. }
  18. result += tempStr
  19. }
  20. } else {
  21. result = params
  22. }
  23. return result
  24. }
  25. export const acceptOption1 = {
  26. // 图表标题
  27. title: {
  28. show: true,
  29. text: '检测受理类型',
  30. textStyle: {
  31. color: '#fff',
  32. fontSize: 20,
  33. fontWeight: '600'
  34. },
  35. textAlign: 'center',
  36. left: '50%',
  37. top: '5px'
  38. },
  39. grid: {
  40. top: '80px'
  41. },
  42. xAxis: {
  43. type: 'category',
  44. data: ['理化', '微生物', '细胞活率', '残留检测', '细胞鉴别'],
  45. axisTick: {
  46. alignWithLabel: true
  47. },
  48. axisLabel: {
  49. style: {
  50. fill: '#fff'
  51. },
  52. formatter (params) {
  53. return rowLimit(params, 2)
  54. }
  55. },
  56. axisLine: {
  57. lineStyle: {
  58. color: '#fff'
  59. }
  60. }
  61. // axisLabel: {
  62. // inside: true,
  63. // color: "#000",
  64. // },
  65. // axisTick: {
  66. // show: true,
  67. // },
  68. // axisLine: {
  69. // show: true,
  70. // },
  71. // z: 10
  72. },
  73. yAxis: {
  74. type: 'value',
  75. name: '',
  76. nameTextStyle: {
  77. color: '#fff',
  78. fontSize: 14
  79. },
  80. splitLine: {
  81. show: false
  82. },
  83. axisLine: {
  84. lineStyle: {
  85. color: '#fff'
  86. }
  87. }
  88. },
  89. series: [{
  90. type: 'bar',
  91. name: '',
  92. data: [],
  93. barMaxWidth: '35px',
  94. itemStyle: {
  95. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  96. { offset: 0, color: "#83bff6" },
  97. { offset: 0.5, color: "#188df0" },
  98. { offset: 1, color: "#188df0" },
  99. ]),
  100. label: {
  101. show: true,
  102. position: 'top',
  103. textStyle: {
  104. color: '#fff',
  105. fontSize: 14
  106. },
  107. formatter (params) {
  108. return params.value ? params.value : ''
  109. }
  110. }
  111. },
  112. emphasis: {
  113. itemStyle: {
  114. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  115. { offset: 0, color: "#2378f7" },
  116. { offset: 0.7, color: "#2378f7" },
  117. { offset: 1, color: "#83bff6" },
  118. ])
  119. }
  120. }
  121. }],
  122. tooltip: {
  123. show: true,
  124. trigger: 'axis'
  125. }
  126. }
  127. export const colors = [
  128. '#d20962',
  129. '#f47721',
  130. '#7ac143',
  131. '#00a78e',
  132. '#00bce4',
  133. '#7d3f98',
  134. '#037ef3',
  135. '#f85a40',
  136. '#00c16e',
  137. '#12CBC4',
  138. '#b4a996',
  139. '#7552cc',
  140. '#67809f',
  141. '#f19066'
  142. ]
  143. export function* getRandomColor (shuffledColors) {
  144. let index = 0
  145. while (index < shuffledColors.length) {
  146. yield shuffledColors[index]
  147. index++
  148. }
  149. }
  150. let colorList = []
  151. export const acceptOption = {
  152. title: {
  153. show: true,
  154. text: '检测任务类型(月度)',
  155. textStyle: {
  156. color: '#fff',
  157. fontSize: 20,
  158. fontWeight: '600'
  159. },
  160. textAlign: 'center',
  161. left: '50%',
  162. top: '5px'
  163. },
  164. legend: {
  165. type: 'scroll',
  166. orient: 'vertical',
  167. show: true,
  168. // left: 'center',
  169. // bottom: 10,
  170. right: 10,
  171. formatter (params) {
  172. let l = 7
  173. if (params.length > l) {
  174. return params.substring(0, l) + '\n' + params.substring(l)
  175. }
  176. return params
  177. },
  178. z: 3,
  179. itemWidth: 25,
  180. itemHeight: 14,
  181. itemGap: 10,
  182. data: []
  183. },
  184. series: [
  185. {
  186. name: '任务完成情况',
  187. type: 'pie',
  188. radius: '55%',
  189. center: ['35%', '50%'],
  190. data: [],
  191. itemStyle: {
  192. emphasis: {
  193. shadowBlur: 10,
  194. shadowOffsetX: 0,
  195. shadowColor: 'rgba(0, 0, 0, 0.5)'
  196. },
  197. normal: {
  198. label: {
  199. show: true,
  200. position: 'outer',
  201. formatter: `数量:{c} 占比:{d}%`,
  202. // formatter: `{b}:{c}`,
  203. fontSize: 14
  204. },
  205. labelLine: {
  206. show: true
  207. }
  208. }
  209. }
  210. }
  211. ],
  212. color: colorList,
  213. tooltip: {
  214. show: true,
  215. trigger: 'item',
  216. formatter: '任务情况<br/>{b}:{c}<br/>占比:{d}%'
  217. }
  218. }
  219. // 原任务统计
  220. export const taskOptionOld = {
  221. // 图表标题
  222. title: {
  223. show: true,
  224. text: '检测过程数据(月度)',
  225. textStyle: {
  226. color: '#fff',
  227. fontSize: 20,
  228. fontWeight: '600'
  229. },
  230. textAlign: 'center',
  231. left: '50%',
  232. top: '5px'
  233. },
  234. grid: {
  235. top: '80px',
  236. bottom: '30px'
  237. },
  238. xAxis: {
  239. type: 'category',
  240. data: ['委托', '样品分配', '检测', '报告'],
  241. axisTick: {
  242. alignWithLabel: true
  243. },
  244. axisLabel: {
  245. style: {
  246. fill: '#fff'
  247. },
  248. formatter (params) {
  249. return rowLimit(params, 2)
  250. }
  251. },
  252. axisLine: {
  253. lineStyle: {
  254. color: '#fff'
  255. }
  256. }
  257. },
  258. yAxis: {
  259. type: 'value',
  260. name: '',
  261. nameTextStyle: {
  262. color: '#fff',
  263. fontSize: 14
  264. },
  265. splitLine: {
  266. show: false
  267. },
  268. axisLine: {
  269. lineStyle: {
  270. color: '#fff'
  271. }
  272. }
  273. },
  274. series: [{
  275. type: 'bar',
  276. name: '',
  277. data: [],
  278. barWidth: '24px',
  279. barGap: '20%',
  280. barMaxWidth: '35px',
  281. itemStyle: {
  282. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  283. { offset: 0, color: "#83bff6" },
  284. { offset: 0.5, color: "#188df0" },
  285. { offset: 1, color: "#188df0" },
  286. ])
  287. },
  288. emphasis: {
  289. itemStyle: {
  290. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  291. { offset: 0, color: "#2378f7" },
  292. { offset: 0.7, color: "#2378f7" },
  293. { offset: 1, color: "#83bff6" },
  294. ])
  295. }
  296. },
  297. label: {
  298. show: true,
  299. position: 'top',
  300. textStyle: {
  301. color: '#fff',
  302. fontSize: 14
  303. },
  304. formatter (params) {
  305. return params.value ? params.value : ''
  306. }
  307. }
  308. }],
  309. tooltip: {
  310. show: true,
  311. trigger: 'axis'
  312. }
  313. }
  314. // 任务及时完成率
  315. export const taskOption = {
  316. title: {
  317. show: true,
  318. text: '检测任务及时完成率(月度)',
  319. textStyle: {
  320. color: '#fff',
  321. fontSize: 20,
  322. fontWeight: '600'
  323. },
  324. textAlign: 'center',
  325. left: '50%',
  326. top: '5px'
  327. },
  328. legend: {
  329. orient: 'horizontal',
  330. show: true,
  331. left: 'center',
  332. bottom: 10,
  333. z: 3,
  334. itemWidth: 25,
  335. itemHeight: 14,
  336. itemGap: 10,
  337. data: [
  338. {
  339. name: '及时',
  340. textStyle: {
  341. color: '#00a78e'
  342. }
  343. },
  344. {
  345. name: '不及时',
  346. textStyle: {
  347. color: '#d20962'
  348. }
  349. },
  350. {
  351. name: '未完成',
  352. textStyle: {
  353. color: '#f47721'
  354. }
  355. }
  356. ]
  357. },
  358. series: [
  359. {
  360. name: '任务完成情况',
  361. type: 'pie',
  362. // radius: ['40%', '70%'],
  363. avoidLabelOverlap: true,
  364. // startAngle: 180,
  365. radius: '55%',
  366. // center: ['50%', '70%'],
  367. data: [],
  368. itemStyle: {
  369. emphasis: {
  370. shadowBlur: 10,
  371. shadowOffsetX: 0,
  372. shadowColor: 'rgba(0, 0, 0, 0.5)'
  373. },
  374. normal: {
  375. label: {
  376. show: true,
  377. position: 'outer',
  378. // formatter: `占比:{d}%\t{b}:{c}`,
  379. formatter: `数量:{c} 占比:{d}%`,
  380. fontSize: 14
  381. },
  382. labelLine: {
  383. show: true
  384. }
  385. }
  386. },
  387. // label: {
  388. // alignTo: 'edge',
  389. // minMargin: 5,
  390. // edgeDistance: 10,
  391. // lineHeight: 15
  392. // },
  393. // labelLine: {
  394. // length: -5,
  395. // length2: 0,
  396. // maxSurfaceAngle: 80
  397. // },
  398. // labelLayout (params) {
  399. // const isLeft = params.labelRect.x < myChart.getWidth() / 2
  400. // const points = params.labelLinePoints
  401. // // Update the end point.
  402. // points[2][0] = isLeft ? params.labelRect.x : params.labelRect.x + params.labelRect.width
  403. // return {
  404. // labelLinePoints: points
  405. // }
  406. // }
  407. }
  408. ],
  409. color: ['#00a78e', '#d20962', '#f47721'],
  410. tooltip: {
  411. show: true,
  412. trigger: 'item',
  413. formatter: '任务情况<br/>{b}:{c}<br/>占比:{d}%'
  414. }
  415. }
  416. export const trustOption = {
  417. legend: {
  418. data: [
  419. {
  420. name: '委托',
  421. itemStyle: {
  422. color: '#00baff'
  423. }
  424. },
  425. {
  426. name: '受理',
  427. itemStyle: {
  428. color: '#f5d94e'
  429. }
  430. }
  431. ],
  432. textStyle: {
  433. color: '#fff',
  434. },
  435. bottom: 10
  436. },
  437. title: {
  438. show: true,
  439. text: '检测委托受理量(月度)',
  440. textStyle: {
  441. color: '#fff',
  442. fontSize: 20,
  443. fontWeight: '600'
  444. },
  445. textAlign: 'center',
  446. left: '50%',
  447. top: '5px'
  448. },
  449. grid: {
  450. top: '80px'
  451. },
  452. xAxis: {
  453. type: 'category',
  454. data: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
  455. axisTick: {
  456. alignWithLabel: true
  457. },
  458. axisLabel: {
  459. style: {
  460. fill: '#fff'
  461. }
  462. },
  463. axisLine: {
  464. lineStyle: {
  465. color: '#fff'
  466. }
  467. }
  468. },
  469. yAxis: {
  470. type: 'value',
  471. name: '',
  472. nameTextStyle: {
  473. color: '#fff',
  474. fontSize: 14
  475. },
  476. splitLine: {
  477. show: false
  478. },
  479. axisLabel: {
  480. style: {
  481. fill: '#fff'
  482. }
  483. },
  484. axisLine: {
  485. lineStyle: {
  486. color: '#fff'
  487. }
  488. }
  489. },
  490. series: [
  491. {
  492. type: 'bar',
  493. name: '委托',
  494. data: [],
  495. barMaxWidth: '35px',
  496. barStyle: {
  497. fill: 'rgba(0, 186, 255, 0.4)'
  498. },
  499. itemStyle: {
  500. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  501. { offset: 0, color: "#83bff6" },
  502. { offset: 0.5, color: "#188df0" },
  503. { offset: 1, color: "#188df0" },
  504. ])
  505. },
  506. emphasis: {
  507. itemStyle: {
  508. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  509. { offset: 0, color: "#2378f7" },
  510. { offset: 0.7, color: "#2378f7" },
  511. { offset: 1, color: "#83bff6" },
  512. ])
  513. }
  514. },
  515. label: {
  516. show: true,
  517. position: 'top',
  518. textStyle: {
  519. color: '#fff',
  520. fontSize: 14
  521. },
  522. formatter (params) {
  523. return params.value ? params.value : ''
  524. }
  525. }
  526. },
  527. {
  528. type: 'line',
  529. name: '受理',
  530. data: [],
  531. symbol: 'circle',
  532. symbolSize: 10,
  533. lineArea: {
  534. show: true,
  535. gradient: ['rgba(245, 217, 79, 0.8)', 'rgba(245, 217, 79, 0.2)']
  536. },
  537. itemStyle: {
  538. color: '#f5d94e'
  539. },
  540. label: {
  541. show: true,
  542. position: 'right',
  543. textStyle: {
  544. color: '#f5d94e',
  545. fontSize: 14
  546. },
  547. formatter (params) {
  548. return params.value ? params.value : ''
  549. }
  550. }
  551. }
  552. ],
  553. tooltip: {
  554. show: true,
  555. trigger: 'axis'
  556. }
  557. }
  558. export const sampleOption = {
  559. title: {
  560. show: true,
  561. text: '样品受理情况',
  562. textStyle: {
  563. color: '#fff',
  564. fontSize: 20,
  565. fontWeight: '600'
  566. },
  567. textAlign: 'center',
  568. left: '50%',
  569. top: '5px'
  570. },
  571. grid: {
  572. top: '80px'
  573. },
  574. xAxis: {
  575. type: 'category',
  576. data: ['已委托未收样', '已收样', '已收不合格', '留样'],
  577. axisTick: {
  578. alignWithLabel: true
  579. },
  580. axisLabel: {
  581. style: {
  582. fill: '#fff'
  583. },
  584. formatter (params) {
  585. return rowLimit(params, 3)
  586. }
  587. },
  588. axisLine: {
  589. lineStyle: {
  590. color: '#fff'
  591. }
  592. }
  593. },
  594. yAxis: {
  595. type: 'value',
  596. name: '',
  597. nameTextStyle: {
  598. color: '#fff',
  599. fontSize: 14
  600. },
  601. splitLine: {
  602. show: false
  603. },
  604. axisLine: {
  605. lineStyle: {
  606. color: '#fff'
  607. }
  608. }
  609. },
  610. series: [{
  611. type: 'bar',
  612. name: '',
  613. data: [],
  614. barMaxWidth: '35px',
  615. itemStyle: {
  616. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  617. { offset: 0, color: "#83bff6" },
  618. { offset: 0.5, color: "#188df0" },
  619. { offset: 1, color: "#188df0" },
  620. ])
  621. },
  622. emphasis: {
  623. itemStyle: {
  624. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  625. { offset: 0, color: "#2378f7" },
  626. { offset: 0.7, color: "#2378f7" },
  627. { offset: 1, color: "#83bff6" },
  628. ])
  629. }
  630. }
  631. }],
  632. tooltip: {
  633. show: true,
  634. trigger: 'axis'
  635. }
  636. }
  637. export const monthOption = {
  638. legend: {
  639. data: [
  640. {
  641. name: '任务总数',
  642. itemStyle: {
  643. color: '#00baff'
  644. }
  645. },
  646. {
  647. name: '已完成',
  648. itemStyle: {
  649. color: '#f5d94e'
  650. }
  651. }
  652. ],
  653. textStyle: {
  654. color: '#fff',
  655. },
  656. bottom: 10
  657. },
  658. title: {
  659. show: true,
  660. text: '检测任务完成量(月度)',
  661. textStyle: {
  662. color: '#fff',
  663. fontSize: 20,
  664. fontWeight: '600'
  665. },
  666. textAlign: 'center',
  667. left: '50%',
  668. top: '5px'
  669. },
  670. grid: {
  671. top: '80px'
  672. },
  673. xAxis: {
  674. type: 'category',
  675. data: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
  676. axisTick: {
  677. alignWithLabel: true
  678. },
  679. axisLabel: {
  680. style: {
  681. fill: '#fff'
  682. }
  683. },
  684. axisLine: {
  685. lineStyle: {
  686. color: '#fff'
  687. }
  688. }
  689. },
  690. yAxis: {
  691. type: 'value',
  692. name: '',
  693. nameTextStyle: {
  694. color: '#fff',
  695. fontSize: 14
  696. },
  697. splitLine: {
  698. show: false
  699. },
  700. axisLabel: {
  701. style: {
  702. fill: '#fff'
  703. }
  704. },
  705. axisLine: {
  706. lineStyle: {
  707. color: '#fff'
  708. }
  709. }
  710. },
  711. series: [
  712. {
  713. type: 'bar',
  714. name: '任务总数',
  715. data: [],
  716. barMaxWidth: '35px',
  717. barStyle: {
  718. fill: 'rgba(0, 186, 255, 0.4)'
  719. },
  720. itemStyle: {
  721. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  722. { offset: 0, color: "#83bff6" },
  723. { offset: 0.5, color: "#188df0" },
  724. { offset: 1, color: "#188df0" },
  725. ])
  726. },
  727. emphasis: {
  728. itemStyle: {
  729. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  730. { offset: 0, color: "#2378f7" },
  731. { offset: 0.7, color: "#2378f7" },
  732. { offset: 1, color: "#83bff6" },
  733. ])
  734. }
  735. },
  736. label: {
  737. show: true,
  738. position: 'top',
  739. textStyle: {
  740. color: '#fff',
  741. fontSize: 14
  742. },
  743. formatter (params) {
  744. return params.value ? params.value : ''
  745. }
  746. }
  747. },
  748. {
  749. type: 'line',
  750. name: '已完成',
  751. data: [],
  752. symbol: 'circle',
  753. symbolSize: 10,
  754. lineArea: {
  755. show: true,
  756. gradient: ['rgba(245, 217, 79, 0.8)', 'rgba(245, 217, 79, 0.2)']
  757. },
  758. itemStyle: {
  759. color: '#f5d94e'
  760. },
  761. label: {
  762. show: true,
  763. position: 'right',
  764. textStyle: {
  765. color: '#f5d94e',
  766. fontSize: 14
  767. },
  768. formatter (params) {
  769. return params.value ? params.value : ''
  770. }
  771. }
  772. }
  773. ],
  774. tooltip: {
  775. show: true,
  776. trigger: 'axis'
  777. }
  778. }
  779. export const yearOption = {
  780. title: {
  781. show: true,
  782. text: '检测任务完成量(年度)',
  783. textStyle: {
  784. color: '#fff',
  785. fontSize: 20,
  786. fontWeight: '600'
  787. },
  788. textAlign: 'center',
  789. left: '50%',
  790. top: '5px'
  791. },
  792. legend: {
  793. orient: 'horizontal',
  794. show: true,
  795. left: 'center',
  796. bottom: 10,
  797. z: 3,
  798. itemWidth: 25,
  799. itemHeight: 14,
  800. itemGap: 10,
  801. data: [
  802. {
  803. name: '已完成',
  804. textStyle: {
  805. color: '#00a78e'
  806. }
  807. },
  808. {
  809. name: '未完成',
  810. textStyle: {
  811. color: '#d20962'
  812. }
  813. }
  814. ]
  815. },
  816. series: [
  817. {
  818. name: '任务完成情况',
  819. type: 'pie',
  820. radius: '55%',
  821. center: ['50%', '50%'],
  822. data: [],
  823. itemStyle: {
  824. emphasis: {
  825. shadowBlur: 10,
  826. shadowOffsetX: 0,
  827. shadowColor: 'rgba(0, 0, 0, 0.5)'
  828. },
  829. normal: {
  830. label: {
  831. show: true,
  832. position: 'outer',
  833. // formatter: `占比:{d}%\t{b}:{c}`,
  834. formatter: `数量:{c} 占比:{d}%`,
  835. fontSize: 14
  836. },
  837. labelLine: {
  838. show: true
  839. }
  840. }
  841. }
  842. }
  843. ],
  844. color: ['#00a78e', '#d20962'],
  845. tooltip: {
  846. show: true,
  847. trigger: 'item',
  848. formatter: '任务情况<br/>{b}:{c}<br/>占比:{d}%'
  849. }
  850. }