index.vue 6.7 KB

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