data.js 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772
  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. xAxis: {
  40. type: 'category',
  41. data: ['理化', '微生物', '细胞活率', '残留检测', '细胞鉴别'],
  42. axisTick: {
  43. alignWithLabel: true
  44. },
  45. axisLabel: {
  46. style: {
  47. fill: '#fff'
  48. },
  49. formatter (params) {
  50. return rowLimit(params, 2)
  51. }
  52. },
  53. axisLine: {
  54. lineStyle: {
  55. color: '#fff'
  56. }
  57. }
  58. // axisLabel: {
  59. // inside: true,
  60. // color: "#000",
  61. // },
  62. // axisTick: {
  63. // show: true,
  64. // },
  65. // axisLine: {
  66. // show: true,
  67. // },
  68. // z: 10
  69. },
  70. yAxis: {
  71. type: 'value',
  72. name: '',
  73. nameTextStyle: {
  74. color: '#fff',
  75. fontSize: 14
  76. },
  77. splitLine: {
  78. show: false
  79. },
  80. axisLine: {
  81. lineStyle: {
  82. color: '#fff'
  83. }
  84. }
  85. },
  86. series: [{
  87. type: 'bar',
  88. name: '',
  89. data: [],
  90. barMaxWidth: '35px',
  91. itemStyle: {
  92. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  93. { offset: 0, color: "#83bff6" },
  94. { offset: 0.5, color: "#188df0" },
  95. { offset: 1, color: "#188df0" },
  96. ]),
  97. label: {
  98. show: true,
  99. position: 'top',
  100. textStyle: {
  101. color: '#fff',
  102. fontSize: 14
  103. },
  104. formatter (params) {
  105. return params.value ? params.value : ''
  106. }
  107. }
  108. },
  109. emphasis: {
  110. itemStyle: {
  111. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  112. { offset: 0, color: "#2378f7" },
  113. { offset: 0.7, color: "#2378f7" },
  114. { offset: 1, color: "#83bff6" },
  115. ])
  116. }
  117. }
  118. }],
  119. tooltip: {
  120. show: true,
  121. trigger: 'axis'
  122. }
  123. }
  124. export const acceptList = [
  125. '无菌检查',
  126. '支原体检查',
  127. '内毒素',
  128. '细胞计数与活率',
  129. '免疫评估',
  130. '细胞标志蛋白检测',
  131. '干细胞三项诱导分化',
  132. '细胞外源病毒因子检测',
  133. '干细胞生物学效力检测',
  134. 'CAR-T',
  135. '残留物检测',
  136. '干细胞成瘤性检测',
  137. '干细胞的免疫学反应检测',
  138. '核型分析',
  139. '细胞形态',
  140. '感染八项',
  141. '衣原体检查',
  142. '结核杆菌',
  143. '新项目与方法',
  144. '基础科研'
  145. ]
  146. const colors = [
  147. '#d20962',
  148. '#f47721',
  149. '#7ac143',
  150. '#00a78e',
  151. '#00bce4',
  152. '#7d3f98',
  153. '#037ef3',
  154. '#f85a40',
  155. '#00c16e',
  156. '#ffd900',
  157. '#0cb9c1',
  158. '#7552cc'
  159. ]
  160. let colorList = []
  161. const getOptions = () => {
  162. let res = []
  163. colorList = []
  164. acceptList.forEach(item => {
  165. let random = parseInt(Math.random() * 12)
  166. let obj = {
  167. name: item,
  168. textStyle: {
  169. color: colors[random]
  170. }
  171. }
  172. res.push(obj)
  173. colorList.push(colors[random])
  174. })
  175. return res
  176. }
  177. export const acceptOption = {
  178. title: {
  179. show: true,
  180. text: '检测类型',
  181. textStyle: {
  182. color: '#fff',
  183. fontSize: 20,
  184. fontWeight: '600'
  185. },
  186. textAlign: 'center',
  187. left: '50%',
  188. top: '20px'
  189. },
  190. legend: {
  191. type: 'scroll',
  192. orient: 'vertical',
  193. show: true,
  194. // left: 'center',
  195. // bottom: 10,
  196. right: 10,
  197. top: 50,
  198. z: 3,
  199. itemWidth: 25,
  200. itemHeight: 14,
  201. itemGap: 10,
  202. data: getOptions()
  203. },
  204. series: [
  205. {
  206. name: '任务完成情况',
  207. type: 'pie',
  208. radius: '55%',
  209. center: ['35%', '50%'],
  210. data: [],
  211. itemStyle: {
  212. emphasis: {
  213. shadowBlur: 10,
  214. shadowOffsetX: 0,
  215. shadowColor: 'rgba(0, 0, 0, 0.5)'
  216. },
  217. normal: {
  218. label: {
  219. show: true,
  220. position: 'outer',
  221. // formatter: `占比:{d}%\n\n\r{b}:{c}`,
  222. formatter: `{b}:{c}`,
  223. fontSize: 14
  224. },
  225. labelLine: {
  226. show: true
  227. }
  228. }
  229. }
  230. }
  231. ],
  232. color: colorList,
  233. tooltip: {
  234. show: true,
  235. trigger: 'item',
  236. formatter: '任务情况<br/>{b}:{c}<br/>占比:{d}%'
  237. }
  238. }
  239. export const taskOption = {
  240. // 图表标题
  241. title: {
  242. show: true,
  243. text: '检测任务情况',
  244. textStyle: {
  245. color: '#fff',
  246. fontSize: 20,
  247. fontWeight: '600'
  248. },
  249. textAlign: 'center',
  250. left: '50%',
  251. top: '20px'
  252. },
  253. grid: {
  254. top: '80px',
  255. bottom: '30px'
  256. },
  257. xAxis: {
  258. type: 'category',
  259. data: ['委托', '任务分配', '检测', '报告'],
  260. axisTick: {
  261. alignWithLabel: true
  262. },
  263. axisLabel: {
  264. style: {
  265. fill: '#fff'
  266. },
  267. formatter (params) {
  268. return rowLimit(params, 2)
  269. }
  270. },
  271. axisLine: {
  272. lineStyle: {
  273. color: '#fff'
  274. }
  275. }
  276. },
  277. yAxis: {
  278. type: 'value',
  279. name: '',
  280. nameTextStyle: {
  281. color: '#fff',
  282. fontSize: 14
  283. },
  284. splitLine: {
  285. show: false
  286. },
  287. axisLine: {
  288. lineStyle: {
  289. color: '#fff'
  290. }
  291. }
  292. },
  293. series: [{
  294. type: 'bar',
  295. name: '',
  296. data: [],
  297. barWidth: '24px',
  298. barGap: '20%',
  299. barMaxWidth: '35px',
  300. itemStyle: {
  301. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  302. { offset: 0, color: "#83bff6" },
  303. { offset: 0.5, color: "#188df0" },
  304. { offset: 1, color: "#188df0" },
  305. ])
  306. },
  307. emphasis: {
  308. itemStyle: {
  309. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  310. { offset: 0, color: "#2378f7" },
  311. { offset: 0.7, color: "#2378f7" },
  312. { offset: 1, color: "#83bff6" },
  313. ])
  314. }
  315. },
  316. label: {
  317. show: true,
  318. position: 'top',
  319. textStyle: {
  320. color: '#fff',
  321. fontSize: 14
  322. },
  323. formatter (params) {
  324. return params.value ? params.value : ''
  325. }
  326. }
  327. }],
  328. tooltip: {
  329. show: true,
  330. trigger: 'axis'
  331. }
  332. }
  333. export const trustOption = {
  334. legend: {
  335. data: [
  336. {
  337. name: '委托',
  338. itemStyle: {
  339. color: '#00baff'
  340. }
  341. },
  342. {
  343. name: '受理',
  344. itemStyle: {
  345. color: '#f5d94e'
  346. }
  347. }
  348. ],
  349. textStyle: {
  350. color: '#fff',
  351. },
  352. bottom: 10
  353. },
  354. title: {
  355. show: true,
  356. text: '检测委托受理量',
  357. textStyle: {
  358. color: '#fff',
  359. fontSize: 20,
  360. fontWeight: '600'
  361. },
  362. textAlign: 'center',
  363. left: '50%',
  364. top: '20px'
  365. },
  366. xAxis: {
  367. type: 'category',
  368. data: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
  369. axisTick: {
  370. alignWithLabel: true
  371. },
  372. axisLabel: {
  373. style: {
  374. fill: '#fff'
  375. }
  376. },
  377. axisLine: {
  378. lineStyle: {
  379. color: '#fff'
  380. }
  381. }
  382. },
  383. yAxis: {
  384. type: 'value',
  385. name: '',
  386. nameTextStyle: {
  387. color: '#fff',
  388. fontSize: 14
  389. },
  390. splitLine: {
  391. show: false
  392. },
  393. axisLabel: {
  394. style: {
  395. fill: '#fff'
  396. }
  397. },
  398. axisLine: {
  399. lineStyle: {
  400. color: '#fff'
  401. }
  402. }
  403. },
  404. series: [
  405. {
  406. type: 'bar',
  407. name: '委托',
  408. data: [],
  409. barMaxWidth: '35px',
  410. barStyle: {
  411. fill: 'rgba(0, 186, 255, 0.4)'
  412. },
  413. itemStyle: {
  414. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  415. { offset: 0, color: "#83bff6" },
  416. { offset: 0.5, color: "#188df0" },
  417. { offset: 1, color: "#188df0" },
  418. ])
  419. },
  420. emphasis: {
  421. itemStyle: {
  422. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  423. { offset: 0, color: "#2378f7" },
  424. { offset: 0.7, color: "#2378f7" },
  425. { offset: 1, color: "#83bff6" },
  426. ])
  427. }
  428. },
  429. label: {
  430. show: true,
  431. position: 'top',
  432. textStyle: {
  433. color: '#fff',
  434. fontSize: 14
  435. },
  436. formatter (params) {
  437. return params.value ? params.value : ''
  438. }
  439. }
  440. },
  441. {
  442. type: 'line',
  443. name: '受理',
  444. data: [],
  445. symbol: 'circle',
  446. symbolSize: 10,
  447. lineArea: {
  448. show: true,
  449. gradient: ['rgba(245, 217, 79, 0.8)', 'rgba(245, 217, 79, 0.2)']
  450. },
  451. itemStyle: {
  452. color: '#f5d94e'
  453. },
  454. label: {
  455. show: true,
  456. position: 'right',
  457. textStyle: {
  458. color: '#f5d94e',
  459. fontSize: 14
  460. },
  461. formatter (params) {
  462. return params.value ? params.value : ''
  463. }
  464. }
  465. }
  466. ],
  467. tooltip: {
  468. show: true,
  469. trigger: 'axis'
  470. }
  471. }
  472. export const sampleOption = {
  473. title: {
  474. show: true,
  475. text: '样品受理情况',
  476. textStyle: {
  477. color: '#fff',
  478. fontSize: 20,
  479. fontWeight: '600'
  480. },
  481. textAlign: 'center',
  482. left: '50%',
  483. top: '20px'
  484. },
  485. xAxis: {
  486. type: 'category',
  487. data: ['已委托未收样', '已收样', '已收不合格', '留样'],
  488. axisTick: {
  489. alignWithLabel: true
  490. },
  491. axisLabel: {
  492. style: {
  493. fill: '#fff'
  494. },
  495. formatter (params) {
  496. return rowLimit(params, 3)
  497. }
  498. },
  499. axisLine: {
  500. lineStyle: {
  501. color: '#fff'
  502. }
  503. }
  504. },
  505. yAxis: {
  506. type: 'value',
  507. name: '',
  508. nameTextStyle: {
  509. color: '#fff',
  510. fontSize: 14
  511. },
  512. splitLine: {
  513. show: false
  514. },
  515. axisLine: {
  516. lineStyle: {
  517. color: '#fff'
  518. }
  519. }
  520. },
  521. series: [{
  522. type: 'bar',
  523. name: '',
  524. data: [],
  525. barMaxWidth: '35px',
  526. itemStyle: {
  527. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  528. { offset: 0, color: "#83bff6" },
  529. { offset: 0.5, color: "#188df0" },
  530. { offset: 1, color: "#188df0" },
  531. ])
  532. },
  533. emphasis: {
  534. itemStyle: {
  535. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  536. { offset: 0, color: "#2378f7" },
  537. { offset: 0.7, color: "#2378f7" },
  538. { offset: 1, color: "#83bff6" },
  539. ])
  540. }
  541. }
  542. }],
  543. tooltip: {
  544. show: true,
  545. trigger: 'axis'
  546. }
  547. }
  548. export const monthOption = {
  549. legend: {
  550. data: [
  551. {
  552. name: '任务总数',
  553. itemStyle: {
  554. color: '#00baff'
  555. }
  556. },
  557. {
  558. name: '已完成',
  559. itemStyle: {
  560. color: '#f5d94e'
  561. }
  562. }
  563. ],
  564. textStyle: {
  565. color: '#fff',
  566. },
  567. bottom: 10
  568. },
  569. title: {
  570. show: true,
  571. text: '检测任务月度完成量',
  572. textStyle: {
  573. color: '#fff',
  574. fontSize: 20,
  575. fontWeight: '600'
  576. },
  577. textAlign: 'center',
  578. left: '50%',
  579. top: '20px'
  580. },
  581. xAxis: {
  582. type: 'category',
  583. data: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
  584. axisTick: {
  585. alignWithLabel: true
  586. },
  587. axisLabel: {
  588. style: {
  589. fill: '#fff'
  590. }
  591. },
  592. axisLine: {
  593. lineStyle: {
  594. color: '#fff'
  595. }
  596. }
  597. },
  598. yAxis: {
  599. type: 'value',
  600. name: '',
  601. nameTextStyle: {
  602. color: '#fff',
  603. fontSize: 14
  604. },
  605. splitLine: {
  606. show: false
  607. },
  608. axisLabel: {
  609. style: {
  610. fill: '#fff'
  611. }
  612. },
  613. axisLine: {
  614. lineStyle: {
  615. color: '#fff'
  616. }
  617. }
  618. },
  619. series: [
  620. {
  621. type: 'bar',
  622. name: '任务总数',
  623. data: [],
  624. barMaxWidth: '35px',
  625. barStyle: {
  626. fill: 'rgba(0, 186, 255, 0.4)'
  627. },
  628. itemStyle: {
  629. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  630. { offset: 0, color: "#83bff6" },
  631. { offset: 0.5, color: "#188df0" },
  632. { offset: 1, color: "#188df0" },
  633. ])
  634. },
  635. emphasis: {
  636. itemStyle: {
  637. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  638. { offset: 0, color: "#2378f7" },
  639. { offset: 0.7, color: "#2378f7" },
  640. { offset: 1, color: "#83bff6" },
  641. ])
  642. }
  643. },
  644. label: {
  645. show: true,
  646. position: 'top',
  647. textStyle: {
  648. color: '#fff',
  649. fontSize: 14
  650. },
  651. formatter (params) {
  652. return params.value ? params.value : ''
  653. }
  654. }
  655. },
  656. {
  657. type: 'line',
  658. name: '已完成',
  659. data: [],
  660. symbol: 'circle',
  661. symbolSize: 10,
  662. lineArea: {
  663. show: true,
  664. gradient: ['rgba(245, 217, 79, 0.8)', 'rgba(245, 217, 79, 0.2)']
  665. },
  666. itemStyle: {
  667. color: '#f5d94e'
  668. },
  669. label: {
  670. show: true,
  671. position: 'right',
  672. textStyle: {
  673. color: '#f5d94e',
  674. fontSize: 14
  675. },
  676. formatter (params) {
  677. return params.value ? params.value : ''
  678. }
  679. }
  680. }
  681. ],
  682. tooltip: {
  683. show: true,
  684. trigger: 'axis'
  685. }
  686. }
  687. export const yearOption = {
  688. title: {
  689. show: true,
  690. text: '检测任务年度完成量',
  691. textStyle: {
  692. color: '#fff',
  693. fontSize: 20,
  694. fontWeight: '600'
  695. },
  696. textAlign: 'center',
  697. left: '50%',
  698. top: '20px'
  699. },
  700. legend: {
  701. orient: 'horizontal',
  702. show: true,
  703. left: 'center',
  704. bottom: 10,
  705. z: 3,
  706. itemWidth: 25,
  707. itemHeight: 14,
  708. itemGap: 10,
  709. data: [
  710. {
  711. name: '未完成',
  712. textStyle: {
  713. color: '#ff6347'
  714. }
  715. },
  716. {
  717. name: '已完成',
  718. textStyle: {
  719. color: '#3f3'
  720. }
  721. }
  722. ]
  723. },
  724. series: [
  725. {
  726. name: '任务完成情况',
  727. type: 'pie',
  728. radius: '55%',
  729. center: ['50%', '50%'],
  730. data: [],
  731. itemStyle: {
  732. emphasis: {
  733. shadowBlur: 10,
  734. shadowOffsetX: 0,
  735. shadowColor: 'rgba(0, 0, 0, 0.5)'
  736. },
  737. normal: {
  738. label: {
  739. show: true,
  740. position: 'outer',
  741. formatter: `占比:{d}%\n\n\r{b}:{c}`,
  742. // formatter: `{b}:{c}\n\n\r占比:{d}%`,
  743. fontSize: 14
  744. },
  745. labelLine: {
  746. show: true
  747. }
  748. }
  749. }
  750. }
  751. ],
  752. color: ['#ff6347', '#3f3'],
  753. tooltip: {
  754. show: true,
  755. trigger: 'item',
  756. formatter: '任务情况<br/>{b}:{c}<br/>占比:{d}%'
  757. }
  758. }