yiqing-hesuanjiance.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  1. <template>
  2. <div>
  3. <div v-if="shows">
  4. <van-nav-bar
  5. title="核酸检测统计"
  6. left-arrow
  7. left-text="返回"
  8. @click-left="onClickLeft"
  9. />
  10. </div>
  11. <div
  12. id="main"
  13. style="width: 350px; height: 320px; margin: 0 auto; border-radius: 10px"
  14. ></div>
  15. <div
  16. id="main2"
  17. style="width: 350px; height: 540px; margin: 20px auto"
  18. v-show="shows1 != infos1"
  19. ></div>
  20. </div>
  21. </template>
  22. <script>
  23. import { getAllUrlParams } from "../../../plugins/url-encapsulation.js";
  24. import * as echarts from "echarts";
  25. export default {
  26. data() {
  27. return {
  28. shows: true,
  29. infos: [],
  30. infos1: [],
  31. shows1:""
  32. };
  33. },
  34. methods: {
  35. getanalysis() {
  36. let myChart = echarts.init(document.getElementById("main"));
  37. this.$http
  38. .post(
  39. "http://zaoquan.nxjiewei.com:8011/api/workbench/epidemic_situation/nucleic_acid_test_statistics"
  40. )
  41. .then((res) => {
  42. // 指定图表的配置项和数据
  43. // console.log(res);
  44. this.infos = res.data.data;
  45. // console.log(this.infos);
  46. var option = {
  47. backgroundColor: "#fff",
  48. borderRadius: "20px",
  49. title: {
  50. text: "核酸检测统计",
  51. x: "25px",
  52. y: "15px",
  53. },
  54. tooltip: {
  55. show: true,
  56. trigger: "item",
  57. // formatter: "{a} <br/>{b} : {c}",
  58. },
  59. legend: {
  60. //设置小块标记
  61. y: "bottom",
  62. x: "center",
  63. },
  64. calculable: true,
  65. series: [
  66. {
  67. name: "",
  68. type: "pie",
  69. radius: ["40%", "70%"], //饼图的半径大小
  70. // center: ["60%", "60%"], //饼图的位置
  71. label: {
  72. //饼图图形上的文本颜色设置
  73. normal: {
  74. show: true,
  75. position: "inner", //标签的位置
  76. textStyle: {
  77. fontWeight: 300,
  78. fontSize: 16, //文字的字体大小
  79. },
  80. formatter: "{d}%", //设置百分比
  81. },
  82. },
  83. data: [
  84. {
  85. value: this.infos.nucleic_acid_test,
  86. name: "已检测",
  87. // 配置映射图显示颜色
  88. itemStyle: {
  89. // 设置扇形的颜色
  90. color: "#39f",
  91. shadowBlur: 200,
  92. shadowColor: "rgba(0, 0, 0, 0)",
  93. },
  94. }, //饼图图形颜色
  95. {
  96. value: this.infos.not_nucleic_acid_test,
  97. name: "未检测",
  98. itemStyle: {
  99. // 设置扇形的颜色
  100. color: "red",
  101. shadowBlur: 200,
  102. shadowColor: "rgba(0, 0, 0, 0)",
  103. },
  104. },
  105. ],
  106. },
  107. ],
  108. };
  109. myChart.setOption(option);
  110. });
  111. },
  112. // getanalysis1() {
  113. // let myChart1 = echarts.init(document.getElementById("main2"));
  114. // this.$http
  115. // .post(
  116. // "http://zaoquan.nxjiewei.com:8011/api/workbench/epidemic_situation/nucleic_acid_test_statistics"
  117. // )
  118. // .then((res) => {
  119. // // console.log(res);
  120. // // 指定图表的配置项和数据
  121. // this.infos1 = res.data.data.not_nat_section_list;
  122. // console.log(this.infos1);
  123. // let numArr = [];
  124. // let section_fullnameArr = [];
  125. // for (let i in this.infos1) {
  126. // // console.log(this.not_nat_section_list[i].section_fullname);
  127. // numArr.push(this.infos1[i].num);
  128. // section_fullnameArr.push(this.infos1[i].section_fullname);
  129. // }
  130. // let array = [];
  131. // for (let i = 0; i < numArr.length; i++) {
  132. // let obj = {};
  133. // for (let j = 0; j < section_fullnameArr.length; j++) {
  134. // if (i == j) {
  135. // obj.name = section_fullnameArr[j];
  136. // obj.value = numArr[i];
  137. // array.push(obj);
  138. // }
  139. // }
  140. // }
  141. // var option1 = {
  142. // backgroundColor: "#fff",
  143. // borderRadius: 9,
  144. // title: {
  145. // text: "核酸未检测人员部门分布",
  146. // // left: "left",
  147. // x: "25px",
  148. // y: "15px",
  149. // },
  150. // tooltip: {
  151. // trigger: "item",
  152. // formatter: "{a} <br/>{b} : {c}",
  153. // },
  154. // textStyle: {
  155. // fontSize: 10,
  156. // color: "#fff",
  157. // },
  158. // legend: {
  159. // //设置小块标记
  160. // y: "bottom",
  161. // x: "center",
  162. // },
  163. // calculable: true,
  164. // series: [
  165. // {
  166. // name: "",
  167. // type: "pie",
  168. // radius: ["50%", "80%"], //饼图的半径大小
  169. // // center: ["60%", "60%"], //饼图的位置
  170. // label: {
  171. // //饼图图形上的文本颜色设置
  172. // normal: {
  173. // show: true,
  174. // position: "inner", //标签的位置
  175. // textStyle: {
  176. // fontWeight: 300,
  177. // fontSize: 16, //文字的字体大小
  178. // },
  179. // formatter: "{d}%", //设置百分比
  180. // },
  181. // },
  182. // data: array,
  183. // },
  184. // ],
  185. // };
  186. // myChart1.setOption(option1);
  187. // });
  188. // },
  189. getanalysis1() {
  190. let myChart1 = echarts.init(document.getElementById("main2"));
  191. this.$http
  192. .post(
  193. "http://zaoquan.nxjiewei.com:8011/api/workbench/epidemic_situation/nucleic_acid_test_statistics"
  194. )
  195. .then((res) => {
  196. console.log(res.data.data.not_nat_section_list);
  197. // 指定图表的配置项和数据
  198. this.infos1 = res.data.data.not_nat_section_list;
  199. // console.log(this.infos1);
  200. let numArr = [];
  201. let section_fullnameArr = [];
  202. let section_idArr = [];
  203. for (let i in this.infos1) {
  204. // console.log(this.not_nat_section_list[i].section_fullname);
  205. numArr.push(this.infos1[i].num);
  206. section_fullnameArr.push(this.infos1[i].section_fullname);
  207. section_idArr.push(this.infos1[i].section_id);
  208. }
  209. let array = [];
  210. for (let i = 0; i < numArr.length; i++) {
  211. for (let j = 0; j < section_fullnameArr.length; j++) {
  212. let obj = {};
  213. for (let k = 0; k < section_idArr.length; k++) {
  214. if (i == j && i == k && j == k) {
  215. obj.name = section_fullnameArr[j];
  216. obj.value = numArr[i];
  217. obj.Id = section_idArr[k];
  218. array.push(obj);
  219. }
  220. }
  221. }
  222. }
  223. // console.log(array);
  224. // for (let i = 0; i < numArr.length; i++) {
  225. // let obj = {};
  226. // for (let j = 0; j < section_fullnameArr.length; j++) {
  227. // for (let k = 0; k < section_id.length; k++) {
  228. // if (i== j == k) {
  229. // obj.name = section_fullnameArr[j];
  230. // obj.value = numArr[i];
  231. // obj.id = section_id[k];
  232. // array.push(obj);
  233. // }
  234. // }
  235. // }
  236. // }
  237. var option1 = {
  238. backgroundColor: "#fff",
  239. borderRadius: 9,
  240. title: {
  241. text: "未接种疫苗部门分布",
  242. // left: "left",
  243. x: "25px",
  244. y: "15px",
  245. },
  246. tooltip: {
  247. show: true,
  248. trigger: "item",
  249. // formatter: "{a} <br/>{b} : {c}",
  250. },
  251. textStyle: {
  252. fontSize: 10,
  253. color: "#fff",
  254. },
  255. legend: {
  256. //设置小块标记
  257. y: "70%",
  258. x: "center",
  259. },
  260. calculable: true,
  261. series: [
  262. {
  263. name: "",
  264. type: "pie",
  265. radius: ["50%", "80%"], //饼图的半径大小
  266. center: ["50%", "200px"], //饼图的位置
  267. label: {
  268. //饼图图形上的文本颜色设置
  269. normal: {
  270. show: true,
  271. position: "inner", //标签的位置
  272. textStyle: {
  273. fontWeight: 100,
  274. fontSize: 14, //文字的字体大小
  275. color: "#fff",
  276. },
  277. formatter: "{d}%", //设置百分比
  278. },
  279. },
  280. data: array,
  281. },
  282. ],
  283. };
  284. myChart1.setOption(option1);
  285. // myChart1.on("click", function (param) {
  286. // // console.log("111");
  287. // // console.log(param.data.Id);
  288. // let its = param.data.Id;
  289. // // console.log(its);
  290. // window.location.href = `#/zaoquan/yiqing/yiqing-weijiezhong?its=${its}`;
  291. // });
  292. });
  293. },
  294. onClickLeft() {
  295. window.history.back();
  296. },
  297. },
  298. mounted() {
  299. document.body.style.backgroundColor = "#39f"; //背景色
  300. this.token = getAllUrlParams(window.location.href).token;
  301. // console.log(this.token);
  302. this.getanalysis();
  303. this.getanalysis1();
  304. },
  305. };
  306. </script>
  307. <style scoped>
  308. >>> .van-nav-bar {
  309. background: #39f;
  310. }
  311. >>> .van-nav-bar__title {
  312. color: #fff;
  313. }
  314. >>> .van-nav-bar .van-icon {
  315. color: #fff;
  316. }
  317. >>> .van-nav-bar__text {
  318. color: #fff;
  319. }
  320. [class*="van-hairline"]:after {
  321. border: none;
  322. }
  323. >>>canvas{
  324. border-radius: 20px!important;
  325. }
  326. </style>