index.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  1. <template>
  2. <view style="background:#f1f1f1;" class="padding-sm">
  3. <!-- 下拉选择 -->
  4. <view class="searchSelect shadow" v-if="flag">
  5. <view class="cu-bar search bg-white">
  6. <view class="search-form round" style="margin-top:0">
  7. <input @focus="InputFocus" @blur="InputBlur" @input="handleInput()" v-model="searchInput"
  8. :adjust-position="false" type="text" placeholder="" confirm-type="search"
  9. style="border:none"></input>
  10. <text class="cuIcon-search "></text>
  11. </view>
  12. </view>
  13. <view class="select-items">
  14. <view class="select-item" v-for="(item,index) in searchList" @click="clickSelectItem(item,index)"
  15. :key="index">{{item}}</view>
  16. </view>
  17. </view>
  18. <!-- 下拉选择 end -->
  19. <!-- <search-Select :flag="flag"></search-Select> -->
  20. <!-- 图表 -->
  21. <view class="section1 section bg-white padding-xs">
  22. <view class=" static-tabs grid margin-bottom text-center col-3 margin-top-sm margin-bottom-sm">
  23. <view :class="['padding-sm ',Inv==0?'active':'']" @click="Inv=0">报警信息统计</view>
  24. <view :class="['padding-sm ',Inv==1?'active':'']" @click="Inv=1">数据等级统计</view>
  25. <view :class="['padding-sm ',Inv==2?'active':'']" @click="Inv=2">设备运行状态</view>
  26. </view>
  27. <view class="time text-center">统计时段:{{staticData.statisticalPeriod}}
  28. </view>
  29. <view style="height:570rpx">
  30. <view v-if="Inv == 0">
  31. <chart :bindData="staticData" v-if="hackReset"></chart>
  32. </view>
  33. <view v-if="Inv == 1">
  34. <chart2 :bindData="staticData"></chart2>
  35. </view>
  36. <view v-if="Inv == 2" class="chart3-box" @tap="goOfflineList()">
  37. <ul class="chart3-icon">
  38. <li>
  39. <image src="../../static/chart3-1.png" style="width:64rpx;height:64rpx"></image>
  40. </li>
  41. <li>
  42. <image src="../../static/chart3-2.png" style="width:64rpx;height:64rpx"></image>
  43. </li>
  44. <li>
  45. <image src="../../static/chart3-3.png" style="width:64rpx;height:64rpx"></image>
  46. </li>
  47. <li>
  48. <image src="../../static/chart3-4.png" style="width:64rpx;height:64rpx"></image>
  49. </li>
  50. <li>
  51. <image src="../../static/chart3-5.png" style="width:64rpx;height:64rpx"></image>
  52. </li>
  53. </ul>
  54. <chart3 :bindData="staticData" :searchList="searchList" :searchList2="searchList2">
  55. </chart3>
  56. </view>
  57. </view>
  58. </view>
  59. <!-- 图表 end-->
  60. <!-- 宫格列表 -->
  61. <view class="section2 section bg-white margin-top-sm margin-bottom-sm">
  62. <view class="cu-list grid col-3 no-border">
  63. <view class="cu-item justify-center align-center" @tap=navItemClick(index)
  64. v-for="(item,index) in cuIconList" :key="index">
  65. <image :src="item.imgUrl" style="width:100rpx;height:100rpx"></image>
  66. <view class="cu-tag badge" v-if="item.badge!=0">
  67. <block v-if="item.badge!=1">{{item.badge>99?'99+':item.badge}}</block>
  68. </view>
  69. <text>{{item.name}}</text>
  70. </view>
  71. </view>
  72. </view>
  73. <!-- 宫格列表 end -->
  74. </view>
  75. </template>
  76. <script>
  77. import chart from './components/chart/chart.vue';
  78. import chart2 from './components/chart2/chart2.vue';
  79. import chart3 from './components/chart3/chart3.vue';
  80. import searchSelect from './components/searchSelect/searchSelect.vue';
  81. import json from '../../data/json.js';
  82. export default {
  83. components: {
  84. chart,
  85. chart2,
  86. chart3,
  87. searchSelect
  88. },
  89. data() {
  90. return {
  91. staticData: json.staticData.data[0],
  92. alarmCount: json.staticData.data[0].alarmCount,
  93. cuIconList: json.cuIconList,
  94. Inv: 0,
  95. flag: false,
  96. searchList: [],
  97. searchList2: [],
  98. searchInput: '',
  99. };
  100. },
  101. // 自定义导航事件
  102. onNavigationBarButtonTap(e) {
  103. if (e.float == 'right') {
  104. console.log("你点击了扫一扫")
  105. } else {
  106. this.showTag()
  107. }
  108. },
  109. onLoad(option) {
  110. // 图表切换渲染
  111. this.hackReset = true;
  112. // 数据渲染
  113. this.getSearchList();
  114. },
  115. methods: {
  116. // 九宫格页面跳转
  117. navItemClick(index) {
  118. let url = "";
  119. switch (index) {
  120. case 0:
  121. url = "/pages/alarmingList/alarmingList"
  122. break;
  123. case 1:
  124. url = "/pages/deviceType/deviceType"
  125. break;
  126. case 2:
  127. url = "/pages/inspectList/inspectList"
  128. break;
  129. case 3:
  130. url = "/pages/xunJian/xunJian"
  131. break;
  132. case 4:
  133. url = "/pages/repair/repair"
  134. break;
  135. case 5:
  136. url = "/pages/weiBao/weiBao"
  137. break;
  138. case 6:
  139. url = "/pages/videoList/videoList"
  140. break;
  141. case 7:
  142. url = "/pages/safeGuard/safeGuard"
  143. break;
  144. case 9:
  145. url = "/pages/deviceManage/deviceManage"
  146. break;
  147. case 10:
  148. url = "/pages/accountManage/accountManage"
  149. break;
  150. default:
  151. break;
  152. }
  153. if (url) {
  154. uni.navigateTo({
  155. url: url
  156. })
  157. } else {
  158. uni.showModal({
  159. title: 'Tips',
  160. content: '此模块开发中~',
  161. showCancel: false,
  162. success: function(res) {
  163. if (res.confirm) {} else if (res.cancel) {}
  164. }
  165. });
  166. }
  167. },
  168. // 页面跳转
  169. goOfflineList() {
  170. uni.navigateTo({
  171. url: '/pages/deviceOffLine/deviceOffLine',
  172. success: res => {},
  173. fail: () => {},
  174. complete: () => {}
  175. });
  176. },
  177. //请求
  178. async getSearchList(ming = {}) {
  179. const res = await this.$myRequest({
  180. url: 'Index/getSiteDropDownBox',
  181. data: ming
  182. })
  183. res.data.data.forEach(item => {
  184. this.searchList.push(item.siteName)
  185. this.searchList2.push(item.siteName)
  186. });
  187. },
  188. showTag() {
  189. this.flag = !this.flag;
  190. },
  191. // 下拉选择
  192. clickSelectItem(item, index) {
  193. this.getSearchList({
  194. "siteName": item
  195. });
  196. this.flag = false
  197. },
  198. handleInput() {
  199. var newlist = this.searchList2.filter(item => item.indexOf(this.searchInput) > -1)
  200. this.searchList = newlist
  201. },
  202. InputFocus(e) {
  203. this.InputBottom = e.detail.height
  204. },
  205. InputBlur(e) {
  206. this.InputBottom = 0
  207. },
  208. changeTab(Inv) {
  209. that.navIdx = Inv;
  210. },
  211. }
  212. }
  213. </script>
  214. <style lang="scss">
  215. body {
  216. background: #f1f1f1 !important;
  217. }
  218. .select-items {
  219. overflow: auto;
  220. height: 80vh
  221. }
  222. .static-tabs {
  223. border-radius: 50rpx;
  224. border: 1rpx solid #4074E7;
  225. }
  226. .static-tabs>view {
  227. color: #4074E7;
  228. font-size: 30rpx;
  229. }
  230. .static-tabs>view.active {
  231. color: #fff;
  232. background: #4074E7
  233. }
  234. .static-tabs>view:first-child {
  235. border-top-left-radius: 50rpx;
  236. border-bottom-left-radius: 50rpx;
  237. }
  238. .static-tabs>view:nth-child(2) {
  239. border-left: 1px solid #4074E7;
  240. border-right: 1px solid #4074E7
  241. }
  242. .static-tabs>view:last-child {
  243. border-top-right-radius: 50rpx;
  244. border-bottom-right-radius: 50rpx;
  245. }
  246. /* 检测时间 */
  247. .time {
  248. border-radius: 50rpx;
  249. background: #FAFCFF;
  250. border: 1px solid #E8F1FF;
  251. padding: 20rpx;
  252. color: #666666;
  253. font-size: 30rpx;
  254. }
  255. .chart3-box {
  256. position: relative
  257. }
  258. .chart3-icon {
  259. position: absolute;
  260. top: 60rpx;
  261. left: 30rpx
  262. }
  263. .chart3-icon li {
  264. padding-top: 25rpx
  265. }
  266. ul,
  267. li {
  268. padding: 0;
  269. margin: 0;
  270. list-style: none
  271. }
  272. </style>
  273. <style>
  274. .shadow {
  275. box-shadow: 1px 1px 4px rgb(26 26 26 / 10%);
  276. }
  277. </style>