report.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  1. <!-- -->
  2. <template>
  3. <div class="static_info">
  4. <div ref="orgchart"></div>
  5. <div class="chart-template static_info">
  6. <!-- <div class="line"></div> -->
  7. <div>
  8. <p>
  9. <span> 其它(本月) </span>
  10. </p>
  11. <div ref="otherchart"></div>
  12. </div>
  13. </div>
  14. </div>
  15. </template>
  16. <script>
  17. import "./../../board.scss";
  18. import {
  19. orgInfo,
  20. currentMonthVisitInfo,
  21. orgSecurityInfo,
  22. } from "@/api/board/cockpit.js";
  23. export default {
  24. props: {
  25. orgId: {
  26. type: String,
  27. isRequired: true,
  28. },
  29. },
  30. data() {
  31. return {
  32. data: {
  33. org: [],
  34. visit: [],
  35. orgSecurity: [],
  36. },
  37. };
  38. },
  39. components: {},
  40. computed: {},
  41. watch: {
  42. orgId: {
  43. deep: true,
  44. handler(val) {
  45. this.getOrgData();
  46. this.getOtherData();
  47. },
  48. },
  49. },
  50. created() {
  51. // this.types = types;
  52. // this.maxDisplay = 16;
  53. // this.refreshTime = 1 * 10 * 1000;
  54. // this.isMouseOver = false;
  55. },
  56. async mounted() {
  57. window.addEventListener("resize", this.windowResize);
  58. },
  59. beforeDestroy() {
  60. // this.timer && clearInterval(this.timer);
  61. // this.timer = null;
  62. window.removeEventListener("resize", this.windowResize);
  63. },
  64. methods: {
  65. // handleClick() {
  66. // this.getData();
  67. // },
  68. handleMouseEnter() {
  69. this.isMouseOver = true;
  70. },
  71. handleMouseLeave() {
  72. this.isMouseOver = false;
  73. },
  74. async getOrgData() {
  75. let columnCount = 4;
  76. let r = (await orgInfo(this.orgId)).data;
  77. let data = [];
  78. for (let i in r) {
  79. let columnIndex = i % columnCount;
  80. if (!data[columnIndex]) {
  81. data[columnIndex] = [];
  82. }
  83. let orgName = r[i].orgName;
  84. r[i].orgName = parseInt(i) + 1 + "." + orgName;
  85. r[i].reachRate = (r[i].reachRate * 100).toFixed(2) + "%";
  86. data[columnIndex].push(r[i]);
  87. }
  88. this.data = data;
  89. this.initOrgMap();
  90. },
  91. async getOtherData() {
  92. this.visit= (await currentMonthVisitInfo(this.orgId)).data
  93. this.orgSecurity=(await orgSecurityInfo(this.orgId)).data;
  94. this.initOtherMap();
  95. },
  96. initOtherMap() {
  97. this.myChart && this.myChart.dispose();
  98. let c = this.$refs["otherchart"];
  99. // 基于准备好的dom,初始化echarts实例
  100. this.myChart = echarts.init(
  101. c
  102. // document.getElementById("commAlarmEvent_Chart")
  103. );
  104. let t = this;
  105. // 指定图表的配置项和数据
  106. var option = {
  107. // color: ["#82D5AE"],
  108. tooltip: {
  109. trigger: "axis",
  110. confine: true,
  111. axisPointer: {
  112. type: "shadow",
  113. },
  114. // formatter: "完成率:{c}%",
  115. },
  116. legend: {
  117. show: true,
  118. textStyle: {
  119. color: "rgb(245, 245, 245)",
  120. },
  121. },
  122. grid: {
  123. left: "3%",
  124. right: "4%",
  125. bottom: "2%",
  126. top: "20px",
  127. containLabel: true,
  128. },
  129. series: [
  130. {
  131. name: "来访",
  132. type: "pie",
  133. center: ["33%", "50%"],
  134. data: [
  135. {
  136. name: "纸质",
  137. value: this.visit.paperCount,
  138. },
  139. {
  140. name: "紧急来访",
  141. value: this.visit.urgencyCount,
  142. },
  143. {
  144. name: "电子",
  145. value: this.visit.electronicCount,
  146. },
  147. ],
  148. },
  149. {
  150. name: "安保",
  151. type: "pie",
  152. center: ["66%", "50%"],
  153. data: [
  154. {
  155. name: "未配置保安",
  156. value: this.orgSecurity.unequippedCount,
  157. },
  158. {
  159. name: "配置保安",
  160. value: this.orgSecurity.equippedCount,
  161. }
  162. ],
  163. },
  164. ],
  165. };
  166. if (option && typeof option === "object") {
  167. this.myChart.setOption(option);
  168. }
  169. },
  170. initOrgMap() {
  171. this.myChart && this.myChart.dispose();
  172. let c = this.$refs["orgchart"];
  173. // 基于准备好的dom,初始化echarts实例
  174. this.myChart = echarts.init(
  175. c
  176. // document.getElementById("commAlarmEvent_Chart")
  177. );
  178. let t = this;
  179. // 指定图表的配置项和数据
  180. var option = {
  181. // color: ["#82D5AE"],
  182. tooltip: {
  183. trigger: "axis",
  184. confine: true,
  185. axisPointer: {
  186. type: "shadow",
  187. },
  188. // formatter: "完成率:{c}%",
  189. },
  190. legend: {
  191. show: false,
  192. textStyle: {
  193. color: "rgb(245, 245, 245)",
  194. },
  195. },
  196. grid: {
  197. left: "3%",
  198. right: "4%",
  199. bottom: "2%",
  200. top: "20px",
  201. containLabel: true,
  202. },
  203. series: [
  204. {
  205. name: "行社",
  206. type: "pie",
  207. radius: ["70%", "110%"],
  208. center: ["33%", "33%"],
  209. data: [
  210. {
  211. name: "行社",
  212. value: this.org.hangsheCount,
  213. },
  214. ],
  215. },
  216. {
  217. name: "营业网点",
  218. type: "pie",
  219. radius: ["70%", "110%"],
  220. center: ["66%", "33%"],
  221. data: [
  222. {
  223. name: "营业网点",
  224. value: this.org.bankingCount,
  225. },
  226. ],
  227. },
  228. {
  229. name: "网点业务库",
  230. type: "pie",
  231. radius: ["70%", "110%"],
  232. center: ["66%", "33%"],
  233. data: [
  234. {
  235. name: "网点业务库",
  236. value: this.org.offlineCount,
  237. },
  238. ],
  239. },
  240. {
  241. name: "离行式自助银行",
  242. type: "pie",
  243. radius: ["70%", "110%"],
  244. center: ["66%", "66%"],
  245. data: [
  246. {
  247. name: "离行式自助银行",
  248. value: this.org.bankingStoreCount,
  249. },
  250. ],
  251. },
  252. ],
  253. };
  254. if (option && typeof option === "object") {
  255. this.myChart.setOption(option);
  256. }
  257. },
  258. windowResize() {
  259. this.myChart && this.myChart.resize();
  260. },
  261. },
  262. };
  263. </script>
  264. <style lang="scss" scoped>
  265. .report {
  266. background-image: linear-gradient(
  267. to right,
  268. rgba(27, 33, 57, 0.8) 0%,
  269. rgba(32, 49, 99, 0.6) 50%,
  270. rgba(27, 33, 57, 0.8) 100%
  271. );
  272. margin-top: 15px;
  273. width: calc(100% - 0px);
  274. margin-left: 1px;
  275. border-top: 3px solid;
  276. border-image: linear-gradient(
  277. to right,
  278. rgba(27, 33, 57, 0.8) 20%,
  279. rgba(101, 219, 229, 1) 50%,
  280. rgba(27, 33, 57, 0.8) 80%
  281. )
  282. 3;
  283. }
  284. .static_info {
  285. height: calc(100%);
  286. width: 100%;
  287. display: flex;
  288. flex-direction: column;
  289. margin: 5px;
  290. & > div:first {
  291. width: 40%;
  292. }
  293. & > div:first {
  294. width: 60%;
  295. }
  296. }
  297. </style>