index.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  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" :adjust-position="false"
  8. type="text" placeholder="" confirm-type="search" style="border:none"></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. case 4:
  132. url = "/pages/repair/repair"
  133. break;
  134. case 5:
  135. url = "/pages/weiBao/weiBao"
  136. break;
  137. default:
  138. break;
  139. }
  140. if (url) {
  141. uni.navigateTo({
  142. url: url
  143. })
  144. } else {
  145. uni.showModal({
  146. title: 'Tips',
  147. content: '此模块开发中~',
  148. showCancel: false,
  149. success: function(res) {
  150. if (res.confirm) {
  151. } else if (res.cancel) {
  152. }
  153. }
  154. });
  155. }
  156. },
  157. //请求
  158. async getSearchList(ming = {}) {
  159. const res = await this.$myRequest({
  160. url: 'Index/getSiteDropDownBox',
  161. data: ming
  162. })
  163. res.data.data.forEach(item => {
  164. this.searchList.push(item.siteName)
  165. this.searchList2.push(item.siteName)
  166. });
  167. },
  168. // 下拉选择
  169. clickSelectItem(item, index) {
  170. this.getSearchList({
  171. "siteName": item
  172. });
  173. this.flag = false
  174. },
  175. handleInput() {
  176. var newlist = this.searchList2.filter(item => item.indexOf(this.searchInput) > -1)
  177. this.searchList = newlist
  178. },
  179. showTag() {
  180. this.flag = !this.flag;
  181. },
  182. InputFocus(e) {
  183. this.InputBottom = e.detail.height
  184. },
  185. InputBlur(e) {
  186. this.InputBottom = 0
  187. },
  188. changeTab(Inv) {
  189. that.navIdx = Inv;
  190. },
  191. // 页面跳转
  192. goOfflineList() {
  193. uni.navigateTo({
  194. url: '/pages/deviceOffLine/deviceOffLine',
  195. success: res => {},
  196. fail: () => {},
  197. complete: () => {}
  198. });
  199. },
  200. }
  201. }
  202. </script>
  203. <style lang="scss">
  204. body {
  205. background: #f1f1f1 !important;
  206. }
  207. .select-items {
  208. overflow: auto;
  209. height: 80vh
  210. }
  211. .static-tabs {
  212. border-radius: 50rpx;
  213. border: 1rpx solid #4074E7;
  214. }
  215. .static-tabs>view {
  216. color: #4074E7;
  217. font-size: 30rpx;
  218. }
  219. .static-tabs>view.active {
  220. color: #fff;
  221. background: #4074E7
  222. }
  223. .static-tabs>view:first-child {
  224. border-top-left-radius: 50rpx;
  225. border-bottom-left-radius: 50rpx;
  226. }
  227. .static-tabs>view:nth-child(2) {
  228. border-left: 1px solid #4074E7;
  229. border-right: 1px solid #4074E7
  230. }
  231. .static-tabs>view:last-child {
  232. border-top-right-radius: 50rpx;
  233. border-bottom-right-radius: 50rpx;
  234. }
  235. /* 检测时间 */
  236. .time {
  237. border-radius: 50rpx;
  238. background: #FAFCFF;
  239. border: 1px solid #E8F1FF;
  240. padding: 20rpx;
  241. color: #666666;
  242. font-size: 30rpx;
  243. }
  244. .chart3-box {
  245. position: relative
  246. }
  247. .chart3-icon {
  248. position: absolute;
  249. top: 60rpx;
  250. left: 30rpx
  251. }
  252. .chart3-icon li {
  253. padding-top: 25rpx
  254. }
  255. ul,
  256. li {
  257. padding: 0;
  258. margin: 0;
  259. list-style: none
  260. }
  261. </style>
  262. <style>
  263. .shadow {
  264. box-shadow: 1px 1px 4px rgb(26 26 26 / 10%);
  265. }
  266. </style>