index.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436
  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!important"></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.owner_name}}</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&& JSON.stringify(staticData) != '{}'"></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" >
  37. <ul class="chart3-icon">
  38. <li @tap="goOfflineList()">
  39. <image src="../../static/chart3-1.png" style="width:64rpx;height:64rpx"></image>
  40. </li>
  41. <li @tap="goFaultList()">
  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" >
  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: {},
  92. alarmCount: json.staticData.data[0].alarmCount,
  93. // cuIconList: json.cuIconList,
  94. Inv: 0,
  95. flag: false,
  96. searchList: [],
  97. searchList2: [],
  98. searchInput: '',
  99. selectedCode:10012,
  100. cuIconList : [{
  101. imgUrl: '../../static/square1.png',
  102. badge: 120,
  103. name: '综合报警',
  104. redirectUrl: '/pages/siteList/siteList?type=1'
  105. }, {
  106. imgUrl: '../../static/square2.png',
  107. badge: 0,
  108. name: '设备管理',
  109. redirectUrl: '/pages/siteList/siteList?type=2'
  110. },
  111. {
  112. imgUrl: '../../static/square-xf.png',
  113. badge: 0,
  114. name: '消防督查单',
  115. redirectUrl: ''
  116. },
  117. {
  118. imgUrl: '../../static/square-xj.png',
  119. badge: 0,
  120. badge: 0,
  121. name: '巡检',
  122. redirectUrl: ''
  123. },
  124. {
  125. imgUrl: '../../static/square-bx.png',
  126. badge: 0,
  127. name: '报修',
  128. redirectUrl: ''
  129. }, {
  130. imgUrl: '../../static/square-wb.png',
  131. badge: 0,
  132. name: '维保',
  133. redirectUrl: ''
  134. },
  135. {
  136. imgUrl: '../../static/square-sp.png',
  137. badge: 0,
  138. badge: 0,
  139. name: '视频监测',
  140. redirectUrl: ''
  141. },
  142. {
  143. imgUrl: '../../static/square-bz.png',
  144. badge: 0,
  145. badge: 0,
  146. name: '风险保障',
  147. redirectUrl: ''
  148. }, {
  149. imgUrl: '../../static/square-rl.png',
  150. badge: 0,
  151. name: '人脸识别',
  152. redirectUrl: ''
  153. },
  154. {
  155. imgUrl: '../../static/square-sb.png',
  156. badge: 0,
  157. name: '设备注册',
  158. redirectUrl: ''
  159. },
  160. {
  161. imgUrl: '../../static/square-yh.png',
  162. badge: 0,
  163. name: '用户管理',
  164. redirectUrl: ''
  165. }
  166. ]
  167. };
  168. },
  169. // 自定义导航事件
  170. onNavigationBarButtonTap(e) {
  171. if (e.float == 'right') {
  172. console.log("你点击了扫一扫")
  173. } else {
  174. this.showTag()
  175. }
  176. },
  177. onLoad(option) {
  178. // 数据渲染
  179. this.getHomeData();
  180. // 图表切换渲染
  181. this.hackReset = false;
  182. this.$nextTick(() => {
  183. this.hackReset = true;
  184. })
  185. this.getHandleData();
  186. this.getSearchList()
  187. },
  188. methods: {
  189. // 九宫格页面跳转
  190. navItemClick(index) {
  191. let url = "";
  192. switch (index) {
  193. case 0:
  194. url = "/pages/alarmingList/alarmingList?companyCode="+this.selectedCode
  195. break;
  196. case 1:
  197. url = "/pages/deviceType/deviceType?companyCode="+this.selectedCode
  198. break;
  199. case 2:
  200. url = "/pages/inspectList/inspectList"
  201. break;
  202. case 3:
  203. url = "/pages/xunJian/xunJian"
  204. break;
  205. case 4:
  206. url = "/pages/repair/repair"
  207. break;
  208. case 5:
  209. url = "/pages/weiBao/weiBao"
  210. break;
  211. case 6:
  212. url = "/pages/videoList/videoList"
  213. break;
  214. case 7:
  215. url = "/pages/safeGuard/safeGuard"
  216. break;
  217. // case 8:
  218. // url = "/pages/test/test"
  219. // break;
  220. case 9:
  221. url = "/pages/deviceManage/deviceManage"
  222. break;
  223. case 10:
  224. url = "/pages/accountManage/accountManage"
  225. break;
  226. default:
  227. break;
  228. }
  229. if (url) {
  230. uni.navigateTo({
  231. url: url
  232. })
  233. } else {
  234. uni.showModal({
  235. title: 'Tips',
  236. content: '此模块开发中~',
  237. showCancel: false,
  238. success: function(res) {
  239. if (res.confirm) {} else if (res.cancel) {}
  240. }
  241. });
  242. }
  243. },
  244. // 页面跳转
  245. goOfflineList() {
  246. uni.navigateTo({
  247. url: '/pages/deviceOffLine/deviceOffLine?type=离线',
  248. });
  249. },
  250. goFaultList() {
  251. uni.navigateTo({
  252. url: '/pages/deviceOffLine/deviceOffLine?type=故障',
  253. });
  254. },
  255. //站点下拉请求
  256. async getSearchList(param = {}) {
  257. const res = await this.$myRequest({
  258. url: 'Index/getCompanyList',
  259. data: param
  260. })
  261. res.data.data.forEach(item => {
  262. this.searchList.push(item)
  263. this.searchList2.push(item)
  264. });
  265. },
  266. showTag() {
  267. this.flag = !this.flag;
  268. },
  269. // 下拉选择
  270. clickSelectItem(item, index) {
  271. this.selectedCode=item.owner_code;
  272. this.getSearchList({
  273. "owner_code": item.owner_code
  274. });
  275. this.flag = false
  276. },
  277. handleInput() {
  278. var newlist = this.searchList2.filter(item => item.indexOf(this.searchInput) > -1)
  279. this.searchList = newlist
  280. },
  281. InputFocus(e) {
  282. this.InputBottom = e.detail.height
  283. },
  284. InputBlur(e) {
  285. this.InputBottom = 0
  286. },
  287. changeTab(Inv) {
  288. that.navIdx = Inv;
  289. },
  290. //echarts图表请求
  291. async getHomeData(param = {}) {
  292. const res = await this.$myRequest({
  293. url: 'Index/getHomePageData',
  294. data: param
  295. })
  296. console.log('首页请求staticData')
  297. console.log(res.data.data[0])
  298. this.staticData=res.data.data[0]
  299. },
  300. // 未处理告警请求
  301. async getHandleData() {
  302. const res = await this.$myRequest({
  303. url: 'Index/getFunctionalModuleStatistics',
  304. showLoading: true
  305. })
  306. this.cuIconList[0].badge = res.data.data[0].fire_brigade_inspector_count;
  307. this.cuIconList[2].badge = res.data.data[0].comprehensive_alarm_count
  308. },
  309. }
  310. }
  311. </script>
  312. <style lang="scss">
  313. body {
  314. background: #f1f1f1 !important;
  315. }
  316. .select-items {
  317. overflow: auto;
  318. height: 80vh
  319. }
  320. .static-tabs {
  321. border-radius: 50rpx;
  322. border: 1rpx solid #4074E7;
  323. }
  324. .static-tabs>view {
  325. color: #4074E7;
  326. font-size: 30rpx;
  327. }
  328. .static-tabs>view.active {
  329. color: #fff;
  330. background: #4074E7
  331. }
  332. .static-tabs>view:first-child {
  333. border-top-left-radius: 50rpx;
  334. border-bottom-left-radius: 50rpx;
  335. }
  336. .static-tabs>view:nth-child(2) {
  337. border-left: 1px solid #4074E7;
  338. border-right: 1px solid #4074E7
  339. }
  340. .static-tabs>view:last-child {
  341. border-top-right-radius: 50rpx;
  342. border-bottom-right-radius: 50rpx;
  343. }
  344. /* 检测时间 */
  345. .time {
  346. border-radius: 50rpx;
  347. background: #FAFCFF;
  348. border: 1px solid #E8F1FF;
  349. padding: 20rpx;
  350. color: #666666;
  351. font-size: 30rpx;
  352. }
  353. .chart3-box {
  354. position: relative
  355. }
  356. .chart3-icon {
  357. width:90%;
  358. position: absolute;
  359. top: 60rpx;
  360. left: 30rpx;
  361. z-index:1;
  362. }
  363. .chart3-icon li {
  364. padding-top: 25rpx
  365. }
  366. ul,
  367. li {
  368. padding: 0;
  369. margin: 0;
  370. list-style: none
  371. }
  372. </style>
  373. <style>
  374. .shadow {
  375. box-shadow: 1px 1px 4px rgb(26 26 26 / 10%);
  376. }
  377. </style>