index.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378
  1. <template>
  2. <view style="background:#f1f1f1;" class="padding-sm">
  3. <view class="searchSelect shadow" v-if="flag">
  4. <view class="cu-bar search bg-white">
  5. <view class="search-form round">
  6. <input @focus="InputFocus" @blur="InputBlur" @input="handleInput()" v-model="searchInput"
  7. :adjust-position="false" type="text" placeholder="" confirm-type="search"></input>
  8. <text class="cuIcon-search "></text>
  9. </view>
  10. </view>
  11. <view class="select-items">
  12. <view class="select-item" v-for="(item,index) in searchList" @click="clickSelectItem(item,index)"
  13. :key="index">{{item}}</view>
  14. </view>
  15. </view>
  16. <view class="section1 section bg-white padding-xs">
  17. <view class=" static-tabs grid margin-bottom text-center col-3 margin-top-sm margin-bottom-sm">
  18. <view :class="['padding-sm ',Inv==0?'active':'']" @click="Inv=0">报警信息统计</view>
  19. <view :class="['padding-sm ',Inv==1?'active':'']" @click="Inv=1">数据等级统计</view>
  20. <view :class="['padding-sm ',Inv==2?'active':'']" @click="Inv=2">设备运行状态</view>
  21. </view>
  22. <view class="time text-center">统计时段:{{staticData.statisticalPeriod}}
  23. </view>
  24. <view style="height:570rpx">
  25. <view v-if="Inv == 0">
  26. <chart :bindData="staticData" v-if="hackReset"></chart>
  27. </view>
  28. <view v-if="Inv == 1">
  29. <chart2 :bindData="staticData"></chart2>
  30. </view>
  31. <view v-if="Inv == 2" class="chart3-box">
  32. <ul class="chart3-icon">
  33. <li>
  34. <image src="../../static/chart3-1.png" style="width:64rpx;height:64rpx"></image>
  35. </li>
  36. <li>
  37. <image src="../../static/chart3-2.png" style="width:64rpx;height:64rpx"></image>
  38. </li>
  39. <li>
  40. <image src="../../static/chart3-3.png" style="width:64rpx;height:64rpx"></image>
  41. </li>
  42. <li>
  43. <image src="../../static/chart3-4.png" style="width:64rpx;height:64rpx"></image>
  44. </li>
  45. <li>
  46. <image src="../../static/chart3-5.png" style="width:64rpx;height:64rpx"></image>
  47. </li>
  48. </ul>
  49. <chart3 :bindData="staticData">
  50. </chart3>
  51. </view>
  52. </view>
  53. </view>
  54. <!-- 宫格列表 -->
  55. <!-- <square :cuIconList="cuIconList"></square> -->
  56. <view class="section2 section bg-white margin-top-sm margin-bottom-sm">
  57. <view class="cu-list grid col-3 no-border">
  58. <view class="cu-item justify-center align-center" @tap=navItemClick(index)
  59. v-for="(item,index) in cuIconList" :key="index">
  60. <image :src="item.imgUrl" style="width:100rpx;height:100rpx"></image>
  61. <view class="cu-tag badge" v-if="item.badge!=0">
  62. <block v-if="item.badge!=0">{{item.badge>99?'99+':item.badge}}</block>
  63. </view>
  64. <text>{{item.name}}</text>
  65. </view>
  66. </view>
  67. </view>
  68. </view>
  69. </template>
  70. <script>
  71. import chart from './components/chart/chart.vue';
  72. import chart2 from './components/chart2/chart2.vue';
  73. import chart3 from './components/chart3/chart3.vue';
  74. import chart4 from './components/chart4/chart4.vue';
  75. import json from '../../data/json.js';
  76. export default {
  77. components: {
  78. chart,
  79. chart2,
  80. chart3,
  81. chart4
  82. },
  83. data() {
  84. return {
  85. componentKey: 0,
  86. arr: [],
  87. searchInput: '',
  88. alarmCount: '',
  89. flag: false,
  90. // 宫格列表数据
  91. cuIconList: [{
  92. imgUrl: '../../static/square1.png',
  93. badge: 0,
  94. name: '综合报警',
  95. redirectUrl: '/pages/siteList/siteList?type=1'
  96. }, {
  97. imgUrl: '../../static/square2.png',
  98. badge: 0,
  99. name: '运行监测',
  100. redirectUrl: '/pages/siteList/siteList?type=2'
  101. }, {
  102. imgUrl: '../../static/square-wb.png',
  103. badge: 0,
  104. name: '维保',
  105. redirectUrl: ''
  106. }, {
  107. imgUrl: '../../static/square-bx.png',
  108. badge: 0,
  109. name: '报修',
  110. redirectUrl: ''
  111. }, {
  112. imgUrl: '../../static/square-rl.png',
  113. badge: 0,
  114. name: '人脸识别',
  115. redirectUrl: ''
  116. }, {
  117. imgUrl: '../../static/square-xj.png',
  118. badge: 0,
  119. badge: 0,
  120. name: '巡检',
  121. redirectUrl: ''
  122. }, {
  123. imgUrl: '../../static/square-bz.png',
  124. badge: 0,
  125. badge: 0,
  126. name: '风险保障',
  127. redirectUrl: ''
  128. }, {
  129. imgUrl: '../../static/square-dljc.png',
  130. badge: 0,
  131. badge: 0,
  132. name: '电力监察',
  133. redirectUrl: ''
  134. }],
  135. Inv: 0,
  136. searchList: [],
  137. searchList2: [],
  138. staticData: {}
  139. };
  140. },
  141. onNavigationBarButtonTap(e) {
  142. if (e.float == 'right') {
  143. console.log("你点击了扫一扫")
  144. uni.scanCode({
  145. // success: function(res) {
  146. // console.log('条码类型:' + res.scanType);
  147. // console.log('条码内容:' + res.result);
  148. // }
  149. success: function(res) {
  150. let result = res.result;
  151. if (result.indexOf('http://') == 0 || result.indexOf('https://') == 0) {
  152. //是网址,直接跳转
  153. plus.runtime.openURL(result); //调用手机浏览器
  154. //怎么在APP内跳转网址?
  155. } else {
  156. //不是网址,打印出结果
  157. uni.showToast({
  158. title: res.result
  159. })
  160. }
  161. },
  162. fail: function(err) {
  163. console.log('扫码失败', err)
  164. }
  165. });
  166. } else {
  167. this.showTag()
  168. }
  169. },
  170. created: function() {
  171. },
  172. mounted() {
  173. document.querySelector('.uni-page-head-hd').style.display = 'none'
  174. },
  175. beforeCreate: function() {
  176. },
  177. onLoad: function(option) {
  178. if (option.op) {
  179. this.getData();
  180. } else {
  181. this.init()
  182. }
  183. // this.getData();
  184. this.hackReset = false;
  185. this.$nextTick(() => {
  186. this.hackReset = true;
  187. })
  188. },
  189. methods: {
  190. async init() {
  191. window.location.href = this.$BASE_URL+"Com/getPageAuthorization1"
  192. },
  193. // end
  194. async getData() {
  195. const res = await this.$myRequest({
  196. url: 'Index/getDataStatistics',
  197. showLoading: true
  198. })
  199. this.staticData = res.data.data[0]
  200. this.alarmCount = this.staticData.alarmCount
  201. this.cuIconList[0].badge = this.staticData.unprocessedCount
  202. },
  203. handleInput() {
  204. var newlist = this.searchList2.filter(item => item.indexOf(this.searchInput) > -1)
  205. this.searchList = newlist
  206. },
  207. navItemClick(index) {
  208. let url = "";
  209. switch (index) {
  210. case 0:
  211. url = "/pages/siteListAlarming/siteListAlarming"
  212. break;
  213. case 1:
  214. url = "/pages/siteList/siteList"
  215. break;
  216. case 7:
  217. url = "/pages/eleControl/eleControl"
  218. break;
  219. default:
  220. break;
  221. }
  222. if (url) {
  223. uni.navigateTo({
  224. url: url
  225. })
  226. } else {
  227. uni.showModal({
  228. title: 'Tips',
  229. content: '此模块开发中~',
  230. showCancel: false,
  231. success: function(res) {
  232. if (res.confirm) {} else if (res.cancel) {}
  233. }
  234. });
  235. }
  236. },
  237. showTag() {
  238. this.flag = !this.flag;
  239. },
  240. InputFocus(e) {
  241. this.InputBottom = e.detail.height
  242. },
  243. InputBlur(e) {
  244. this.InputBottom = 0
  245. },
  246. changeTab(Inv) {
  247. that.navIdx = Inv;
  248. },
  249. }
  250. }
  251. //解决IOS返回页面不刷新的问题
  252. history.pushState(null, null, document.URL); //禁止网页返回上一页
  253. window.addEventListener('popstate', function() {
  254. // alert('点击返回按钮了!')
  255. });
  256. </script>
  257. <style lang="scss">
  258. body {
  259. background: #f1f1f1 !important;
  260. }
  261. .select-items {
  262. overflow: auto;
  263. height: 80vh
  264. }
  265. .static-tabs {
  266. border-radius: 50rpx;
  267. border: 1rpx solid #4074E7;
  268. }
  269. .static-tabs>view {
  270. color: #4074E7;
  271. font-size: 30rpx;
  272. }
  273. .static-tabs>view.active {
  274. color: #fff;
  275. background: #4074E7
  276. }
  277. .static-tabs>view:first-child {
  278. border-top-left-radius: 50rpx;
  279. border-bottom-left-radius: 50rpx;
  280. }
  281. .static-tabs>view:nth-child(2) {
  282. border-left: 1px solid #4074E7;
  283. border-right: 1px solid #4074E7
  284. }
  285. .static-tabs>view:last-child {
  286. border-top-right-radius: 50rpx;
  287. border-bottom-right-radius: 50rpx;
  288. }
  289. /* 检测时间 */
  290. .time {
  291. border-radius: 50rpx;
  292. background: #FAFCFF;
  293. border: 1px solid #E8F1FF;
  294. padding: 20rpx;
  295. color: #666666;
  296. font-size: 28rpx;
  297. }
  298. .chart3-box {
  299. position: relative
  300. }
  301. .chart3-icon {
  302. position: absolute;
  303. top: 60rpx;
  304. left: 30rpx
  305. }
  306. .chart3-icon li {
  307. padding-top: 25rpx
  308. }
  309. ul,
  310. li {
  311. padding: 0;
  312. margin: 0;
  313. list-style: none
  314. }
  315. </style>
  316. <style>
  317. .shadow {
  318. box-shadow: 1px 1px 4px rgb(26 26 26 / 10%);
  319. }
  320. </style>