dataView.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356
  1. <template>
  2. <div class="full" style="position: relative;" :style="tagIndex==0?'':'background-color: rgba(20, 41, 87,.5);'">
  3. <div style="width: 100%;z-index: 99;height: 10%;" :class="tagIndex==0?'tagIndex0':''">
  4. <top-menu style="z-index: 99;" :gridList="gridList"></top-menu>
  5. </div>
  6. <dv-border-box-8 :color="['#1a3776', '#3f6a9a']" backgroundColor="rgba(20, 41, 87,.5)" :style="tagIndex==0?'':'height: 90%'">
  7. <div class="full center" style="flex-direction: column">
  8. <keep-alive>
  9. <router-view v-if="$route.meta.keepAlive" />
  10. </keep-alive>
  11. <router-view v-if="!$route.meta.keepAlive" />
  12. </div>
  13. </dv-border-box-8>
  14. </div>
  15. </template>
  16. <script>
  17. import {getDetail, getList} from "../../api/grid/grid";
  18. import {mapGetters} from "vuex";
  19. import charts from "../../components/charts/charts";
  20. import {fullscreenToggel, listenfullscreen} from "@/util/util";
  21. import Charts from "@jiaminghi/charts";
  22. import { changeDefaultConfig } from '@jiaminghi/charts'
  23. import {calcDate, dateFormat} from "../../util/date";
  24. import {resetRouter} from "../../router/router";
  25. import topMenu from "../../components/top-menu";
  26. import {getStore} from "../../util/store";
  27. import {validatenull} from "../../util/validate";
  28. export default {
  29. components: {topMenu},
  30. mounted() {
  31. this.onLoad();
  32. },
  33. created() {
  34. //实时检测刷新token
  35. this.refreshToken();
  36. },
  37. name: "dataView",
  38. computed: {
  39. ...mapGetters(["userInfo","currentGrid","tagIndex","loading",'menu']),
  40. week(){
  41. return this.weekStr[this.dateTime.week]
  42. },
  43. },
  44. watch:{
  45. $route(){
  46. }
  47. },
  48. methods: {
  49. currentTime() {
  50. setInterval(this.getTime, 500);
  51. },
  52. getTime() {
  53. let date = new Date();
  54. let str = dateFormat(date);
  55. let week = date.getDay();
  56. str = str.split(" ");
  57. this.dateTime = {
  58. week: week,
  59. date: str[0],
  60. time: str[1]
  61. }
  62. },
  63. logout() {
  64. this.$confirm('退出系统, 是否继续?', {
  65. confirmButtonText: '确定',
  66. cancelButtonText: '取消',
  67. }).then(() => {
  68. this.$store.dispatch("LogOut").then(() => {
  69. resetRouter();
  70. this.$router.push({path: "/login"});
  71. });
  72. });
  73. },
  74. handleScreen() {
  75. fullscreenToggel();
  76. },
  77. async onLoad(id){
  78. this.currentTime();
  79. let grids = (await getList(1,100,{userCode: this.userInfo['user_id']})).data.data.records;
  80. this.gridList = grids;
  81. this.$store.commit('SET_USER_INFO', this.userInfo);
  82. const grid = typeof id == 'undefined' ? this.userInfo.grid[this.currentGridIndex] : (await getDetail({"id": id})).data.data;
  83. this.grid = grid;
  84. await this.$store.dispatch("FlowRoutes")
  85. },
  86. // 定时检测token
  87. refreshToken() {
  88. this.refreshTime = setInterval(() => {
  89. const token = getStore({
  90. name: "token",
  91. debug: true
  92. }) || {};
  93. const date = calcDate(token.datetime, new Date().getTime());
  94. if (validatenull(date)) return;
  95. if (date.seconds >= this.website.tokenTime && !this.refreshLock) {
  96. this.refreshLock = true;
  97. this.$store
  98. .dispatch("refreshToken")
  99. .then(() => {
  100. this.refreshLock = false;
  101. })
  102. .catch(() => {
  103. this.refreshLock = false;
  104. });
  105. }
  106. }, 10000);
  107. }
  108. },
  109. provide() {
  110. return {
  111. index: this
  112. };
  113. },
  114. data() {
  115. return {
  116. //刷新token锁
  117. refreshLock: false,
  118. //刷新token的时间
  119. refreshTime: "",
  120. gridList: [],
  121. key: 1,
  122. menuActive: 0,
  123. visible: false,
  124. tagList: [
  125. {name: '网格看板',path: '/grid/viewpanel'},
  126. {name: '网格划分',path: '/grid/divide'},
  127. {name: '数据大屏',path: '/grid/dataPage'},
  128. // {name: '人员管理',path: '/grid/myLayout/memberList'},
  129. // {name: '设备管理',path: '/grid/myLayout/deviceList'},
  130. {name: '网格管理',path: '/community/agency'},
  131. {name: '全屏',path: ''},
  132. {name: '退出',path: ''},
  133. ],
  134. tendencyOption:{
  135. title: {
  136. text: '社区人口数量',
  137. style: {
  138. fill: '#083a29',
  139. fontSize: 17,
  140. fontWeight: 'bold',
  141. textAlign: 'center',
  142. textBaseline: 'bottom'
  143. }
  144. },
  145. xAxis: {
  146. name: '社区名称',
  147. data: ['幸福里', '阅海万家','幸福里', '阅海万家','幸福里', '阅海万家' ] ,
  148. nameTextStyle: {
  149. fill: '#b9b9ba',
  150. fontSize: 10
  151. },
  152. axisLabel:{
  153. style: {
  154. fill: '#33b0dd',
  155. fontSize: 15
  156. }
  157. }
  158. },
  159. yAxis: {
  160. name: '人口数',
  161. data: 'value',
  162. nameTextStyle: {
  163. fill: '#b9b9ba',
  164. fontSize: 10
  165. },
  166. axisLabel:{
  167. style: {
  168. fill: '#33b0dd',
  169. fontSize: 12
  170. }}
  171. },
  172. legend: {
  173. show:true
  174. },
  175. series: [
  176. {
  177. data: [1200, 2230, 1900, 2100, 3500, 4200, 3985],
  178. type: 'bar'
  179. }
  180. ]
  181. },
  182. currentGridIndex: 0,
  183. fullscreen: false,
  184. weekStr: ['星期天','星期一','星期二','星期三','星期四','星期五','星期六',],
  185. AMap: {},
  186. map: {},
  187. grid: {},
  188. dateTime: {}
  189. }
  190. },
  191. }
  192. </script>
  193. <style scoped>
  194. .container{
  195. width: 100%;
  196. height: 100%;
  197. background: url('/data/data-bg.png') no-repeat center/cover;
  198. }
  199. .tagIndex0{
  200. top: 0;
  201. position: absolute;
  202. }
  203. .device-title{
  204. font-style: italic;font-size: 10px;text-align: center;line-height: 100px;letter-spacing: 20px;
  205. animation: suofang 2s linear infinite reverse;
  206. }
  207. .center{display: flex;justify-content: center;align-items: center;}
  208. .logo-info{width: 60%;height: 100%;background: url('/data/bg-top.png') no-repeat center/100% 90%;}
  209. .time-info{width: 40%;height: 100%;background: url('/data/bg-time.png') no-repeat center/100% 90%;}
  210. .ele1{
  211. width: 40px;
  212. height: 40px;
  213. background: url('/data/ele1.png') no-repeat center/contain ;
  214. animation: round 2s infinite linear;
  215. }
  216. .white{
  217. color: #dddddd;
  218. }
  219. .data2{
  220. background: url('/data/data-bg-3.png') no-repeat center/80% ;
  221. }
  222. .row{
  223. display: flex;
  224. flex-direction: row;
  225. }
  226. .green{
  227. color: rgba(0, 186, 189, 1);
  228. }
  229. .font-20{
  230. font-size: 20px;
  231. }
  232. .full{
  233. width: 100%;
  234. height: 100%;
  235. }
  236. .main-container{
  237. width: 100%;
  238. height: calc(100%);
  239. }
  240. .big:hover{
  241. font-size: 20px;
  242. }
  243. .tag-bar{
  244. margin: 5px;
  245. width: calc(100% - 10px);
  246. height: 40px;
  247. background: white;
  248. }
  249. .tendency{
  250. background: url('/data/bg-grid.png') no-repeat center/cover ;
  251. }
  252. .left{
  253. width: 30%;height: 100%;background: url('/data/left.png') no-repeat center;
  254. background-size: 20%;
  255. }
  256. .right{
  257. width: 30%;height: 100%;background: url('/data/right.png') no-repeat center;
  258. background-size: 20%;
  259. }
  260. .left:hover{
  261. cursor: pointer;
  262. background-size: 25%;
  263. }
  264. .right:hover{
  265. cursor: pointer;
  266. background-size: 25%;
  267. }
  268. .data1{
  269. width: 300px;height: 100px;
  270. background: url('/data/data-bg-1.png') no-repeat center/contain ;
  271. }
  272. @keyframes round {
  273. from { transform: rotate(0deg) }
  274. to {
  275. transform: rotate(360deg)
  276. }
  277. }
  278. .message{
  279. animation: translation 10s infinite linear
  280. }
  281. @keyframes translation {
  282. from { transform: translateX(-200%) }
  283. to {
  284. transform: translateX(200%)
  285. }
  286. }
  287. @keyframes suofang {
  288. from { transform: rotateY(0deg)}
  289. to {
  290. transform: rotateY(360deg)
  291. }
  292. }
  293. .tag-button{
  294. width: 100px;
  295. height: 30px;
  296. cursor: pointer;
  297. margin-left: 20px;
  298. background: url('/data/bg-grid.png') no-repeat center/cover;
  299. }
  300. .down {
  301. margin-left: 8px;
  302. width: 12px;
  303. height: 12px;
  304. background: url('/data/down.png') no-repeat center/contain;
  305. display: inline-block;
  306. }
  307. .actvieBorder{
  308. border: solid 2px #22ddda;
  309. }
  310. @keyframes offset {
  311. from { transform: translate(0,0)}
  312. to { transform: translate(2%,2%)}
  313. }
  314. .grid-button:active{
  315. animation: offset 1s linear;
  316. }
  317. /deep/ .el-select .el-input .el-select__caret {
  318. color: rgba(0, 186, 189, 1);
  319. font-size: 14px;
  320. -webkit-transition: -webkit-transform .3s;
  321. transition: -webkit-transform .3s;
  322. transition: transform .3s;
  323. transition: transform .3s,-webkit-transform .3s;
  324. -webkit-transform: rotateZ(
  325. 180deg
  326. );
  327. transform: rotateZ(
  328. 180deg
  329. );
  330. cursor: pointer;
  331. }
  332. /deep/ .gridName .el-select .el-input__inner {
  333. color: rgba(0, 186, 189, 1);
  334. background: transparent;
  335. border: transparent;
  336. }
  337. .title{
  338. color: white;
  339. font-size: 40px;
  340. }
  341. </style>