data.js 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760
  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: '20px'
  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: '20px'
  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: `占比:{d}%\n\n\r{b}:{c}`,
  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. export const taskOption = {
  220. // 图表标题
  221. title: {
  222. show: true,
  223. text: '检测任务情况',
  224. textStyle: {
  225. color: '#fff',
  226. fontSize: 20,
  227. fontWeight: '600'
  228. },
  229. textAlign: 'center',
  230. left: '50%',
  231. top: '20px'
  232. },
  233. grid: {
  234. top: '80px',
  235. bottom: '30px'
  236. },
  237. xAxis: {
  238. type: 'category',
  239. data: ['委托', '样品分配', '检测', '报告'],
  240. axisTick: {
  241. alignWithLabel: true
  242. },
  243. axisLabel: {
  244. style: {
  245. fill: '#fff'
  246. },
  247. formatter (params) {
  248. return rowLimit(params, 2)
  249. }
  250. },
  251. axisLine: {
  252. lineStyle: {
  253. color: '#fff'
  254. }
  255. }
  256. },
  257. yAxis: {
  258. type: 'value',
  259. name: '',
  260. nameTextStyle: {
  261. color: '#fff',
  262. fontSize: 14
  263. },
  264. splitLine: {
  265. show: false
  266. },
  267. axisLine: {
  268. lineStyle: {
  269. color: '#fff'
  270. }
  271. }
  272. },
  273. series: [{
  274. type: 'bar',
  275. name: '',
  276. data: [],
  277. barWidth: '24px',
  278. barGap: '20%',
  279. barMaxWidth: '35px',
  280. itemStyle: {
  281. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  282. { offset: 0, color: "#83bff6" },
  283. { offset: 0.5, color: "#188df0" },
  284. { offset: 1, color: "#188df0" },
  285. ])
  286. },
  287. emphasis: {
  288. itemStyle: {
  289. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  290. { offset: 0, color: "#2378f7" },
  291. { offset: 0.7, color: "#2378f7" },
  292. { offset: 1, color: "#83bff6" },
  293. ])
  294. }
  295. },
  296. label: {
  297. show: true,
  298. position: 'top',
  299. textStyle: {
  300. color: '#fff',
  301. fontSize: 14
  302. },
  303. formatter (params) {
  304. return params.value ? params.value : ''
  305. }
  306. }
  307. }],
  308. tooltip: {
  309. show: true,
  310. trigger: 'axis'
  311. }
  312. }
  313. export const trustOption = {
  314. legend: {
  315. data: [
  316. {
  317. name: '委托',
  318. itemStyle: {
  319. color: '#00baff'
  320. }
  321. },
  322. {
  323. name: '受理',
  324. itemStyle: {
  325. color: '#f5d94e'
  326. }
  327. }
  328. ],
  329. textStyle: {
  330. color: '#fff',
  331. },
  332. bottom: 10
  333. },
  334. title: {
  335. show: true,
  336. text: '检测委托受理量',
  337. textStyle: {
  338. color: '#fff',
  339. fontSize: 20,
  340. fontWeight: '600'
  341. },
  342. textAlign: 'center',
  343. left: '50%',
  344. top: '20px'
  345. },
  346. grid: {
  347. top: '80px'
  348. },
  349. xAxis: {
  350. type: 'category',
  351. data: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
  352. axisTick: {
  353. alignWithLabel: true
  354. },
  355. axisLabel: {
  356. style: {
  357. fill: '#fff'
  358. }
  359. },
  360. axisLine: {
  361. lineStyle: {
  362. color: '#fff'
  363. }
  364. }
  365. },
  366. yAxis: {
  367. type: 'value',
  368. name: '',
  369. nameTextStyle: {
  370. color: '#fff',
  371. fontSize: 14
  372. },
  373. splitLine: {
  374. show: false
  375. },
  376. axisLabel: {
  377. style: {
  378. fill: '#fff'
  379. }
  380. },
  381. axisLine: {
  382. lineStyle: {
  383. color: '#fff'
  384. }
  385. }
  386. },
  387. series: [
  388. {
  389. type: 'bar',
  390. name: '委托',
  391. data: [],
  392. barMaxWidth: '35px',
  393. barStyle: {
  394. fill: 'rgba(0, 186, 255, 0.4)'
  395. },
  396. itemStyle: {
  397. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  398. { offset: 0, color: "#83bff6" },
  399. { offset: 0.5, color: "#188df0" },
  400. { offset: 1, color: "#188df0" },
  401. ])
  402. },
  403. emphasis: {
  404. itemStyle: {
  405. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  406. { offset: 0, color: "#2378f7" },
  407. { offset: 0.7, color: "#2378f7" },
  408. { offset: 1, color: "#83bff6" },
  409. ])
  410. }
  411. },
  412. label: {
  413. show: true,
  414. position: 'top',
  415. textStyle: {
  416. color: '#fff',
  417. fontSize: 14
  418. },
  419. formatter (params) {
  420. return params.value ? params.value : ''
  421. }
  422. }
  423. },
  424. {
  425. type: 'line',
  426. name: '受理',
  427. data: [],
  428. symbol: 'circle',
  429. symbolSize: 10,
  430. lineArea: {
  431. show: true,
  432. gradient: ['rgba(245, 217, 79, 0.8)', 'rgba(245, 217, 79, 0.2)']
  433. },
  434. itemStyle: {
  435. color: '#f5d94e'
  436. },
  437. label: {
  438. show: true,
  439. position: 'right',
  440. textStyle: {
  441. color: '#f5d94e',
  442. fontSize: 14
  443. },
  444. formatter (params) {
  445. return params.value ? params.value : ''
  446. }
  447. }
  448. }
  449. ],
  450. tooltip: {
  451. show: true,
  452. trigger: 'axis'
  453. }
  454. }
  455. export const sampleOption = {
  456. title: {
  457. show: true,
  458. text: '样品受理情况',
  459. textStyle: {
  460. color: '#fff',
  461. fontSize: 20,
  462. fontWeight: '600'
  463. },
  464. textAlign: 'center',
  465. left: '50%',
  466. top: '20px'
  467. },
  468. grid: {
  469. top: '80px'
  470. },
  471. xAxis: {
  472. type: 'category',
  473. data: ['已委托未收样', '已收样', '已收不合格', '留样'],
  474. axisTick: {
  475. alignWithLabel: true
  476. },
  477. axisLabel: {
  478. style: {
  479. fill: '#fff'
  480. },
  481. formatter (params) {
  482. return rowLimit(params, 3)
  483. }
  484. },
  485. axisLine: {
  486. lineStyle: {
  487. color: '#fff'
  488. }
  489. }
  490. },
  491. yAxis: {
  492. type: 'value',
  493. name: '',
  494. nameTextStyle: {
  495. color: '#fff',
  496. fontSize: 14
  497. },
  498. splitLine: {
  499. show: false
  500. },
  501. axisLine: {
  502. lineStyle: {
  503. color: '#fff'
  504. }
  505. }
  506. },
  507. series: [{
  508. type: 'bar',
  509. name: '',
  510. data: [],
  511. barMaxWidth: '35px',
  512. itemStyle: {
  513. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  514. { offset: 0, color: "#83bff6" },
  515. { offset: 0.5, color: "#188df0" },
  516. { offset: 1, color: "#188df0" },
  517. ])
  518. },
  519. emphasis: {
  520. itemStyle: {
  521. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  522. { offset: 0, color: "#2378f7" },
  523. { offset: 0.7, color: "#2378f7" },
  524. { offset: 1, color: "#83bff6" },
  525. ])
  526. }
  527. }
  528. }],
  529. tooltip: {
  530. show: true,
  531. trigger: 'axis'
  532. }
  533. }
  534. export const monthOption = {
  535. legend: {
  536. data: [
  537. {
  538. name: '任务总数',
  539. itemStyle: {
  540. color: '#00baff'
  541. }
  542. },
  543. {
  544. name: '已完成',
  545. itemStyle: {
  546. color: '#f5d94e'
  547. }
  548. }
  549. ],
  550. textStyle: {
  551. color: '#fff',
  552. },
  553. bottom: 10
  554. },
  555. title: {
  556. show: true,
  557. text: '检测任务月度完成量',
  558. textStyle: {
  559. color: '#fff',
  560. fontSize: 20,
  561. fontWeight: '600'
  562. },
  563. textAlign: 'center',
  564. left: '50%',
  565. top: '20px'
  566. },
  567. grid: {
  568. top: '80px'
  569. },
  570. xAxis: {
  571. type: 'category',
  572. data: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
  573. axisTick: {
  574. alignWithLabel: true
  575. },
  576. axisLabel: {
  577. style: {
  578. fill: '#fff'
  579. }
  580. },
  581. axisLine: {
  582. lineStyle: {
  583. color: '#fff'
  584. }
  585. }
  586. },
  587. yAxis: {
  588. type: 'value',
  589. name: '',
  590. nameTextStyle: {
  591. color: '#fff',
  592. fontSize: 14
  593. },
  594. splitLine: {
  595. show: false
  596. },
  597. axisLabel: {
  598. style: {
  599. fill: '#fff'
  600. }
  601. },
  602. axisLine: {
  603. lineStyle: {
  604. color: '#fff'
  605. }
  606. }
  607. },
  608. series: [
  609. {
  610. type: 'bar',
  611. name: '任务总数',
  612. data: [],
  613. barMaxWidth: '35px',
  614. barStyle: {
  615. fill: 'rgba(0, 186, 255, 0.4)'
  616. },
  617. itemStyle: {
  618. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  619. { offset: 0, color: "#83bff6" },
  620. { offset: 0.5, color: "#188df0" },
  621. { offset: 1, color: "#188df0" },
  622. ])
  623. },
  624. emphasis: {
  625. itemStyle: {
  626. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  627. { offset: 0, color: "#2378f7" },
  628. { offset: 0.7, color: "#2378f7" },
  629. { offset: 1, color: "#83bff6" },
  630. ])
  631. }
  632. },
  633. label: {
  634. show: true,
  635. position: 'top',
  636. textStyle: {
  637. color: '#fff',
  638. fontSize: 14
  639. },
  640. formatter (params) {
  641. return params.value ? params.value : ''
  642. }
  643. }
  644. },
  645. {
  646. type: 'line',
  647. name: '已完成',
  648. data: [],
  649. symbol: 'circle',
  650. symbolSize: 10,
  651. lineArea: {
  652. show: true,
  653. gradient: ['rgba(245, 217, 79, 0.8)', 'rgba(245, 217, 79, 0.2)']
  654. },
  655. itemStyle: {
  656. color: '#f5d94e'
  657. },
  658. label: {
  659. show: true,
  660. position: 'right',
  661. textStyle: {
  662. color: '#f5d94e',
  663. fontSize: 14
  664. },
  665. formatter (params) {
  666. return params.value ? params.value : ''
  667. }
  668. }
  669. }
  670. ],
  671. tooltip: {
  672. show: true,
  673. trigger: 'axis'
  674. }
  675. }
  676. export const yearOption = {
  677. title: {
  678. show: true,
  679. text: '检测任务年度完成量',
  680. textStyle: {
  681. color: '#fff',
  682. fontSize: 20,
  683. fontWeight: '600'
  684. },
  685. textAlign: 'center',
  686. left: '50%',
  687. top: '20px'
  688. },
  689. legend: {
  690. orient: 'horizontal',
  691. show: true,
  692. left: 'center',
  693. bottom: 10,
  694. z: 3,
  695. itemWidth: 25,
  696. itemHeight: 14,
  697. itemGap: 10,
  698. data: [
  699. {
  700. name: '未完成',
  701. textStyle: {
  702. color: '#ff6347'
  703. }
  704. },
  705. {
  706. name: '已完成',
  707. textStyle: {
  708. color: '#3f3'
  709. }
  710. }
  711. ]
  712. },
  713. series: [
  714. {
  715. name: '任务完成情况',
  716. type: 'pie',
  717. radius: '55%',
  718. center: ['50%', '50%'],
  719. data: [],
  720. itemStyle: {
  721. emphasis: {
  722. shadowBlur: 10,
  723. shadowOffsetX: 0,
  724. shadowColor: 'rgba(0, 0, 0, 0.5)'
  725. },
  726. normal: {
  727. label: {
  728. show: true,
  729. position: 'outer',
  730. // formatter: `占比:{d}%\t{b}:{c}`,
  731. formatter: `{b}:{c}\t占比:{d}%`,
  732. fontSize: 14
  733. },
  734. labelLine: {
  735. show: true
  736. }
  737. }
  738. }
  739. }
  740. ],
  741. color: ['#ff6347', '#3f3'],
  742. tooltip: {
  743. show: true,
  744. trigger: 'item',
  745. formatter: '任务情况<br/>{b}:{c}<br/>占比:{d}%'
  746. }
  747. }