index.vue 8.2 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. // alert('op')
  180. // alert(option.op)
  181. // 首页数据渲染
  182. this.getData();
  183. } else {
  184. this.init()
  185. }
  186. this.hackReset = false;
  187. this.$nextTick(() => {
  188. this.hackReset = true;
  189. })
  190. },
  191. methods: {
  192. async init() {
  193. window.location.href = "https://wx.ewoogi.com/USKYOF/USKYOF.php/Home/Com/getPageAuthorization1"
  194. },
  195. // end
  196. async getData() {
  197. const res = await this.$myRequest({
  198. url: 'Index/getDataStatistics',
  199. showLoading: true
  200. })
  201. this.staticData = res.data.data[0]
  202. this.alarmCount = this.staticData.alarmCount
  203. this.cuIconList[0].badge = this.staticData.unprocessedCount
  204. },
  205. handleInput() {
  206. var newlist = this.searchList2.filter(item => item.indexOf(this.searchInput) > -1)
  207. this.searchList = newlist
  208. },
  209. navItemClick(index) {
  210. let url = "";
  211. switch (index) {
  212. case 0:
  213. url = "/pages/siteListAlarming/siteListAlarming"
  214. break;
  215. case 1:
  216. url = "/pages/siteList/siteList"
  217. break;
  218. case 7:
  219. url = "/pages/eleControl/eleControl"
  220. break;
  221. default:
  222. break;
  223. }
  224. if (url) {
  225. uni.navigateTo({
  226. url: url
  227. })
  228. } else {
  229. uni.showModal({
  230. title: 'Tips',
  231. content: '此模块开发中~',
  232. showCancel: false,
  233. success: function(res) {
  234. if (res.confirm) {} else if (res.cancel) {}
  235. }
  236. });
  237. }
  238. },
  239. showTag() {
  240. this.flag = !this.flag;
  241. },
  242. InputFocus(e) {
  243. this.InputBottom = e.detail.height
  244. },
  245. InputBlur(e) {
  246. this.InputBottom = 0
  247. },
  248. changeTab(Inv) {
  249. that.navIdx = Inv;
  250. },
  251. }
  252. }
  253. //解决IOS返回页面不刷新的问题
  254. history.pushState(null, null, document.URL); //禁止网页返回上一页
  255. window.addEventListener('popstate', function() {
  256. // alert('点击返回按钮了!')
  257. });
  258. </script>
  259. <style lang="scss">
  260. body {
  261. background: #f1f1f1 !important;
  262. }
  263. .select-items {
  264. overflow: auto;
  265. height: 80vh
  266. }
  267. .static-tabs {
  268. border-radius: 50rpx;
  269. border: 1rpx solid #4074E7;
  270. }
  271. .static-tabs>view {
  272. color: #4074E7;
  273. font-size: 30rpx;
  274. }
  275. .static-tabs>view.active {
  276. color: #fff;
  277. background: #4074E7
  278. }
  279. .static-tabs>view:first-child {
  280. border-top-left-radius: 50rpx;
  281. border-bottom-left-radius: 50rpx;
  282. }
  283. .static-tabs>view:nth-child(2) {
  284. border-left: 1px solid #4074E7;
  285. border-right: 1px solid #4074E7
  286. }
  287. .static-tabs>view:last-child {
  288. border-top-right-radius: 50rpx;
  289. border-bottom-right-radius: 50rpx;
  290. }
  291. /* 检测时间 */
  292. .time {
  293. border-radius: 50rpx;
  294. background: #FAFCFF;
  295. border: 1px solid #E8F1FF;
  296. padding: 20rpx;
  297. color: #666666;
  298. font-size: 28rpx;
  299. }
  300. .chart3-box {
  301. position: relative
  302. }
  303. .chart3-icon {
  304. position: absolute;
  305. top: 60rpx;
  306. left: 30rpx
  307. }
  308. .chart3-icon li {
  309. padding-top: 25rpx
  310. }
  311. ul,
  312. li {
  313. padding: 0;
  314. margin: 0;
  315. list-style: none
  316. }
  317. </style>
  318. <style>
  319. .shadow {
  320. box-shadow: 1px 1px 4px rgb(26 26 26 / 10%);
  321. }
  322. </style>