index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403
  1. <template>
  2. <div class="dashboard-editor-container">
  3. <div class="mtitle">
  4. 早上好,管理员!
  5. <iframe
  6. allowtransparency="true"
  7. frameborder="0"
  8. width="180"
  9. height="36"
  10. scrolling="no"
  11. style="padding-top: 10px"
  12. src="//tianqi.2345.com/plugin/widget/index.htm?s=3&z=2&t=0&v=0&d=2&bd=0&k=&f=#545555&ltf=#545555&htf=ffffff&q=1&e=1&a=1&c=72036&w=180&h=36&align=center"
  13. ></iframe>
  14. </div>
  15. <!-- <div class="cbox">-->
  16. <!-- <div class="ctitle">各保税区综合评分概况</div>-->
  17. <!-- <div class="rows">-->
  18. <!-- <div class="row">-->
  19. <!-- <div class="out">-->
  20. <!-- <div class="int">-->
  21. <!-- <span class="icon" style="background-color: rgba(37, 97, 239, 1)">&#xe6e0;</span>-->
  22. <!-- <div class="num">80</div>-->
  23. <!-- <div class="desc">南宁综合保税区</div>-->
  24. <!-- </div>-->
  25. <!-- </div>-->
  26. <!-- </div>-->
  27. <!-- <div class="row">-->
  28. <!-- <div class="out">-->
  29. <!-- <div class="int">-->
  30. <!-- <span class="icon" style="background-color: rgba(102, 110, 232, 1)">&#xe6e0;</span>-->
  31. <!-- <div class="num">80</div>-->
  32. <!-- <div class="desc">钦州综合保税区</div>-->
  33. <!-- </div>-->
  34. <!-- </div>-->
  35. <!-- </div>-->
  36. <!-- <div class="row">-->
  37. <!-- <div class="out">-->
  38. <!-- <div class="int">-->
  39. <!-- <span class="icon" style="background-color: rgba(61, 212, 167, 1)">&#xe6e0;</span>-->
  40. <!-- <div class="num">80</div>-->
  41. <!-- <div class="desc">北海综合保税区</div>-->
  42. <!-- </div>-->
  43. <!-- </div>-->
  44. <!-- </div>-->
  45. <!-- <div class="row">-->
  46. <!-- <div class="out">-->
  47. <!-- <div class="int">-->
  48. <!-- <span class="icon" style="background-color: rgba(250, 116, 107, 1)">&#xe6e0;</span>-->
  49. <!-- <div class="num">80</div>-->
  50. <!-- <div class="desc">凭祥综合保税区</div>-->
  51. <!-- </div>-->
  52. <!-- </div>-->
  53. <!-- </div>-->
  54. <!-- <div class="row">-->
  55. <!-- <div class="out">-->
  56. <!-- <div class="int">-->
  57. <!-- <span class="icon" style="background-color: rgba(253, 219, 120, 1)">&#xe6e0;</span>-->
  58. <!-- <div class="num">80</div>-->
  59. <!-- <div class="desc">梧州综合保税区</div>-->
  60. <!-- </div>-->
  61. <!-- </div>-->
  62. <!-- </div>-->
  63. <!-- </div>-->
  64. <!-- </div>-->
  65. <div class="row" style="width: 40%; float: left; margin-top: 15px">
  66. <div class="cbox">
  67. <div class="lable">快捷入口</div>
  68. <div class="menu" v-for="(item, index) in topMenus" @click="handleSelect(item)">
  69. <div class="out">
  70. <div class="int">
  71. <div class="icon"><svg-icon :icon-class="item.meta.icon" /></div>
  72. <div class="desc omit">{{ item.meta.title }}</div>
  73. </div>
  74. </div>
  75. </div>
  76. </div>
  77. </div>
  78. <div class="row" style="width: 60%; float: left; margin-top: 15px; padding-left: 20px">
  79. <div class="cbox">
  80. <div class="lable">{{ year }}广西综合保税区进出口总值(亿元)</div>
  81. <BarChart :chartData="chartData.bar" tag="(亿元)" style="width: 100%"></BarChart>
  82. </div>
  83. </div>
  84. <div class="row" style="width: 25%; float: left; margin-top: 15px">
  85. <div class="cbox">
  86. <div class="lable omit">{{ year }}各综合保税区进出口总值占比(%)</div>
  87. <PieChart
  88. :chartData="chartData.bar"
  89. ></PieChart>
  90. </div>
  91. </div>
  92. <div class="row" style="width: 25%; float: left; padding-left: 15px; margin-top: 15px">
  93. <div class="cbox">
  94. <div class="lable omit">{{ year }}各综合保税区加工贸易进出口值占比(%)</div>
  95. <PieChart
  96. :chartData="chartData.pie1"
  97. tag="亿"
  98. ></PieChart>
  99. </div>
  100. </div>
  101. <div class="row" style="width: 25%; float: left; padding-left: 15px; margin-top: 15px">
  102. <div class="cbox">
  103. <div class="lable omit">{{ year }}各综合保税区物流货物进出口值占比(%)</div>
  104. <PieChart
  105. :chartData="chartData.pie2"
  106. ></PieChart>
  107. </div>
  108. </div>
  109. <div class="row" style="width: 25%; float: left; padding-left: 15px; margin-top: 15px">
  110. <div class="cbox">
  111. <div class="lable omit">{{ year }}各综合保税区一般贸易进出口值占比(%)</div>
  112. <PieChart
  113. :chartData="chartData.pie3"
  114. ></PieChart>
  115. </div>
  116. </div>
  117. </div>
  118. </template>
  119. <script>
  120. import PanelGroup from './dashboard/PanelGroup';
  121. import LineChart from './dashboard/LineChart';
  122. import RaddarChart from './dashboard/RaddarChart';
  123. import PieChart from './dashboard/PieChart';
  124. import BarChart from './dashboard/BarChart';
  125. import { constantRoutes } from '@/router';
  126. import axios from 'axios'
  127. export default {
  128. name: 'Index',
  129. components: {
  130. PanelGroup,
  131. LineChart,
  132. RaddarChart,
  133. PieChart,
  134. BarChart
  135. },
  136. data() {
  137. return {
  138. year: new Date().getFullYear(),
  139. nameList: ['南宁', '梧州', '北海', '钦州', '凭祥'],
  140. dataNameList: ['加工贸易进出口值', '物流货物进出口值', '一般贸易进出口值'],
  141. chartData: {
  142. bar: [
  143. // { name: '凭祥', value: 716.33 },
  144. // { name: '钦州', value: 265.73 },
  145. // { name: '南宁', value: 215.48 },
  146. // { name: '北海', value: 34.49 },
  147. // { name: '梧州', value: 0 }
  148. ],
  149. pie1: [
  150. // { name: '南宁保税区', value: '1' },
  151. // { name: '北海保税区', value: '2' },
  152. // { name: '梧州保税区', value: '2' },
  153. // { name: '钦州保税区', value: '2' },
  154. // { name: '凭祥保税区', value: '2' }
  155. ],
  156. pie2: [],
  157. pie3: []
  158. }
  159. };
  160. },
  161. mounted() {
  162. axios({
  163. // url: process.env.VUE_APP_BASE_API + '/gather/statistics/wb/comprehensive/GxzhbsqsdzzjckzbVo',
  164. url: process.env.VUE_APP_BASE_API + '/gather/statistics/wb/comprehensive/total/value/deptId/list',
  165. method: 'POST',
  166. data: {
  167. year: new Date().getFullYear()
  168. },
  169. header: {
  170. "Content-Type": "application/json;charset=UTF-8"
  171. }
  172. }).then((res) => {
  173. if(res.data.code >= 200 && res.data.code <= 300) {
  174. this.year = (res?.data?.data?.year || this.year) + (res?.data?.data?.month ? '年' + res?.data?.data?.month.replace(/^0+/, '') + '月' : '年 ')
  175. let dataObj = res.data.data.date
  176. // 获取各地区总值
  177. this.chartData.bar = Object.values(dataObj)?.map((item, index) => {
  178. return {
  179. name: this.nameList[index],
  180. value: Object.values(item)[0] ? Object.values(item)[0].map(pitem => {
  181. if(pitem?.feeName == '进出口总值') {
  182. return pitem.collValue
  183. }
  184. }).find(value => !!value) : 0.00
  185. }
  186. })
  187. // 将数据按dataNameList顺序组成数组
  188. let valueList = [[], [], []]
  189. this.dataNameList.map((name, index) => {
  190. Object.values(dataObj).map(obj => {
  191. (obj[Object.keys(obj)[0]] || [{feeName: this.dataNameList[0]},{feeName: this.dataNameList[1]}, {feeName: this.dataNameList[2]}]).map((item) => {
  192. if(item.feeName == name) {
  193. valueList[index] = [...valueList[index], item.collValue || 0]
  194. }
  195. })
  196. })
  197. })
  198. valueList.map((item, pindex) => {
  199. this.chartData[`pie${pindex+1}`] = this.nameList.map((name,index) => {
  200. return {
  201. name,
  202. value:item[index]
  203. }
  204. })
  205. })
  206. }
  207. })
  208. },
  209. computed: {
  210. theme() {
  211. return this.$store.state.settings.theme;
  212. },
  213. // 顶部显示菜单
  214. topMenus() {
  215. let topMenus = [];
  216. this.routers.map(menu => {
  217. if (menu.hidden !== true) {
  218. // 兼容顶部栏一级菜单内部跳转
  219. if (menu.path === '/') {
  220. topMenus.push(menu.children[0]);
  221. } else {
  222. topMenus.push(menu);
  223. }
  224. }
  225. });
  226. return topMenus.slice(0, 9);
  227. },
  228. // 所有的路由信息
  229. routers() {
  230. return this.$store.state.permission.topbarRouters;
  231. },
  232. // 设置子路由
  233. childrenMenus() {
  234. var childrenMenus = [];
  235. this.routers.map(router => {
  236. for (var item in router.children) {
  237. if (router.children[item].parentPath === undefined) {
  238. if (router.path === '/') {
  239. router.children[item].path = '/' + router.children[item].path;
  240. } else {
  241. if (!this.ishttp(router.children[item].path)) {
  242. router.children[item].path = router.path + '/' + router.children[item].path;
  243. }
  244. }
  245. router.children[item].parentPath = router.path;
  246. }
  247. childrenMenus.push(router.children[item]);
  248. }
  249. });
  250. return constantRoutes.concat(childrenMenus);
  251. },
  252. // 默认激活的菜单
  253. activeMenu() {
  254. const path = this.$route.path;
  255. let activePath = path;
  256. if (path !== undefined && path.lastIndexOf('/') > 0 && hideList.indexOf(path) === -1) {
  257. const tmpPath = path.substring(1, path.length);
  258. activePath = '/' + tmpPath.substring(0, tmpPath.indexOf('/'));
  259. this.$store.dispatch('app/toggleSideBarHide', false);
  260. } else if (!this.$route.children) {
  261. activePath = path;
  262. this.$store.dispatch('app/toggleSideBarHide', true);
  263. }
  264. this.activeRoutes(activePath);
  265. return activePath;
  266. }
  267. },
  268. methods: {
  269. // 菜单选择事件
  270. handleSelect(item) {
  271. this.isShowMenu = false;
  272. this.currentIndex = item.path;
  273. let key = item.path;
  274. const route = this.routers.find(item => item.path === key);
  275. if (this.ishttp(key)) {
  276. // http(s):// 路径新窗口打开
  277. window.open(key, '_blank');
  278. } else if (!route || !route.children) {
  279. // 没有子路由路径内部打开
  280. this.$router.push({ path: key });
  281. this.$store.dispatch('app/toggleSideBarHide', true);
  282. } else {
  283. // 显示左侧联动菜单
  284. this.activeRoutes(key);
  285. this.$store.dispatch('app/toggleSideBarHide', false);
  286. }
  287. this.$emit('showHamBurger');
  288. this.$emit('closeMenuHandler');
  289. },
  290. // 当前激活的路由
  291. activeRoutes(key) {
  292. var routes = [];
  293. if (this.childrenMenus && this.childrenMenus.length > 0) {
  294. this.childrenMenus.map(item => {
  295. if (key == item.parentPath || (key == 'index' && '' == item.path)) {
  296. routes.push(item);
  297. }
  298. });
  299. }
  300. if (routes.length > 0) {
  301. this.$store.commit('SET_SIDEBAR_ROUTERS', routes);
  302. }
  303. },
  304. ishttp(url) {
  305. return url.indexOf('http://') !== -1 || url.indexOf('https://') !== -1;
  306. }
  307. }
  308. };
  309. </script>
  310. <style lang="scss" scoped>
  311. .dashboard-editor-container {
  312. padding: 32px;
  313. background-color: rgb(240, 242, 245);
  314. position: relative;
  315. overflow: hidden;
  316. .mtitle {
  317. margin-bottom: 20px;
  318. font-size: 19px;
  319. margin-top: -15px;
  320. }
  321. .cbox {
  322. background-color: white;
  323. border-radius: 8px;
  324. box-shadow: 0px 10px 30px rgba(228, 228, 228, 0.49);
  325. overflow: hidden;
  326. padding: 20px;
  327. .ctitle {
  328. font-weight: 500;
  329. font-size: 21px;
  330. color: #333333;
  331. margin-bottom: 40px;
  332. }
  333. .rows {
  334. .row {
  335. float: left;
  336. width: 20%;
  337. .out {
  338. padding: 10px;
  339. .int {
  340. border: 1px solid #e6e6e6;
  341. text-align: center;
  342. border-radius: 8px;
  343. padding: 30px;
  344. color: #545555;
  345. .icon {
  346. display: block;
  347. width: 45px;
  348. height: 45px;
  349. margin: 0 auto;
  350. border-radius: 12px;
  351. color: white;
  352. margin-top: -56px;
  353. font-size: 20px;
  354. line-height: 42px;
  355. }
  356. .num {
  357. font-size: 30px;
  358. font-weight: bold;
  359. margin-top: 10px;
  360. margin-bottom: 10px;
  361. }
  362. .desc {
  363. font-size: 15px;
  364. }
  365. }
  366. }
  367. }
  368. }
  369. .menu {
  370. float: left;
  371. width: 33.33%;
  372. .out {
  373. padding: 10px;
  374. .int {
  375. padding: 10px 10px 0px 10px;
  376. text-align: center;
  377. cursor: pointer;
  378. .icon {
  379. width: 45px;
  380. height: 45px;
  381. color: white;
  382. border-radius: 12px;
  383. margin: 0 auto;
  384. font-size: 23px;
  385. line-height: 45px;
  386. background-color: rgb(37, 97, 239);
  387. color: white;
  388. }
  389. .desc {
  390. color: #545555;
  391. margin-top: 9px;
  392. font-size: 14px;
  393. }
  394. }
  395. }
  396. }
  397. }
  398. }
  399. </style>