index.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. <template>
  2. <view class="wrap">
  3. <view class="header-wrap">
  4. <view class="header f-padding">
  5. <view class="header-item header-title">
  6. 欢迎登录
  7. <view class="message" @click="openPage('pages/center/news/news')">
  8. <u-icon name="bell"></u-icon>
  9. <u-badge type="error" class="badge" :count="newsTotal" :offset='[-10,-10]'></u-badge>
  10. </view>
  11. </view>
  12. <view class="header-item header-con">{{vuex_user.officerName}}</view>
  13. </view>
  14. </view>
  15. <view class="statistics">
  16. <!-- 设备状态 1-已离线 2-运行中 4-保养中 -->
  17. <u-row justify="center">
  18. <u-col span="4" text-align="center" @click="openPage('pages/equipmentList/equipmentList','')">
  19. <view class="count" style="color: #0074DD;">{{deviceStatisData.totalNum||'0'}}</view>
  20. <view class="name">总设备数</view>
  21. </u-col>
  22. <u-col span="4" text-align="center" @click="openPage('pages/equipmentList/equipmentList','1')">
  23. <view class="count" style="color: #f00;">{{deviceStatisData.onlineNum||'0'}}</view>
  24. <view class="name">设备离线</view>
  25. </u-col>
  26. <u-col span="4" text-align="center" @click="openPage('pages/equipmentList/equipmentList','4')">
  27. <view class="count" style="color: #07A68D;">{{deviceStatisData.exceptionNum||'0'}}</view>
  28. <view class="name">未检测</view>
  29. </u-col>
  30. </u-row>
  31. </view>
  32. <view class="list-block equipment">
  33. <view class="list-block-til u-font-18">设备信息</view>
  34. <view class="list-block-con u-flex u-flex-wrap u-row-left" v-if="deviceTypeListData.length>0">
  35. <view class="list-block-item"
  36. @click="openPage('pages/deviceList/deviceList',item.id)"
  37. v-for="item in deviceTypeListData" :key="item.id">
  38. <image class="img" :src="item.deviceTypeImgUrl||''" mode="widthFix"></image>
  39. <view class="txt">{{item.deviceTypeName}}</view>
  40. </view>
  41. </view>
  42. <u-empty text="暂无内容" mode="list" v-else></u-empty>
  43. </view>
  44. <view class="list-block">
  45. <view class="list-block-til u-font-18">考勤管理</view>
  46. <view class="list-block-con u-flex u-flex-wrap u-row-left">
  47. <view class="list-block-item"
  48. @click="openPage('pages/clockIn/clockIn')">
  49. <image class="img" src="../../static/img/daka.png" mode="widthFix"></image>
  50. <view class="txt">打卡</view>
  51. </view>
  52. </view>
  53. </view>
  54. <view class="list-block">
  55. <view class="list-block-til u-font-18">问题上报</view>
  56. <view class="list-block-con u-flex u-flex-wrap u-row-left">
  57. <view class="list-block-item"
  58. @click="openPage('pages/report/report')">
  59. <image class="img" src="../../static/img/report.png" mode="widthFix"></image>
  60. <view class="txt">问题上报</view>
  61. </view>
  62. </view>
  63. </view>
  64. </view>
  65. </template>
  66. <script>
  67. export default {
  68. data() {
  69. return {
  70. newsTotal:'',
  71. noticeList:[],
  72. devicemsg:[],
  73. deviceStatisData:[],
  74. deviceTypeListData:[],
  75. }
  76. },
  77. onLoad() {
  78. },
  79. onShow() {
  80. // this.deviceTypeList();
  81. this.deviceStatis();
  82. // this.getUnreadTotal();
  83. },
  84. methods: {
  85. openPage(path,param) {
  86. this.$u.route({
  87. url: path,
  88. params:{
  89. param:param
  90. }
  91. })
  92. },
  93. deviceStatis(){
  94. this.$u.api.getDeviceStatis().then(res=>{
  95. if(res.code==200){
  96. this.deviceStatisData = res.data;
  97. // console.log('getDeviceStatis',res);
  98. }else{
  99. uni.showToast({
  100. icon:'none',
  101. title:res.msg
  102. })
  103. }
  104. console.log('res',res);
  105. }).catch(err=>{
  106. console.log('err',err);
  107. })
  108. },
  109. deviceTypeList(){
  110. this.$u.api.getDeviceTypeList().then(res=>{
  111. if(res.code==200){
  112. this.deviceTypeListData = res.data;
  113. // console.log('getDeviceStatis',res);
  114. }else{
  115. uni.showToast({
  116. icon:'none',
  117. title:res.msg
  118. })
  119. }
  120. console.log('res',res);
  121. }).catch(err=>{
  122. console.log('err',err);
  123. })
  124. },
  125. getUnreadTotal(){
  126. let that = this;
  127. this.$u.api.unreadTotal().then(res=>{
  128. if(res.code==200){
  129. this.newsTotal = res.data.noReadCount;
  130. }else{
  131. uni.showToast({
  132. icon:'none',
  133. title:res.msg
  134. })
  135. }
  136. console.log('res',res);
  137. }).catch(err=>{
  138. console.log('err',err);
  139. })
  140. },
  141. noticeClick(e){
  142. console.log('e',e);
  143. // console.log('this.devicemsg[e]',this.devicemsg[e]);
  144. // 消息类型 1-维保通知 2-预警通知 3-确认通知
  145. // console.log('this.devicemsg',this.devicemsg);
  146. // console.log('this.devicemsg[e]',this.devicemsg[e]);
  147. // console.log('this.devicemsg[e].msgType',this.devicemsg[e].msgType);
  148. if(this.devicemsg[e].msgType=='1'){
  149. uni.switchTab({
  150. url: '/pages/maintenanceCenter/maintenanceCenter',
  151. fail(e) {
  152. console.log('',e);
  153. }
  154. })
  155. }else if(this.devicemsg[e].msgType=='2'){
  156. uni.switchTab({
  157. url: '/pages/warningCenter/warningCenter'
  158. })
  159. }else if(this.devicemsg[e].msgType=='3'){
  160. uni.navigateTo({
  161. url: '/pages/center/mywork/mywork'
  162. })
  163. }
  164. },
  165. }
  166. }
  167. </script>
  168. <style lang="scss" scoped>
  169. page{background-color: #F6F6F6;}
  170. .header-wrap{
  171. overflow: hidden;
  172. .header{
  173. position: relative;
  174. box-sizing: border-box;
  175. height: 260rpx;
  176. padding: 48rpx 24rpx 98rpx;
  177. color: #fff;
  178. border-radius: 0 0 50% 50%;
  179. &::before{
  180. width: 140%; height: 100%; position: absolute; left: -20%; top: 0; content: ''; border-radius: 0 0 50% 50%;
  181. background: linear-gradient(180deg, #4466D8 0%, #8274F8 100%);
  182. background: url(../../static/img/index-header-bg.png) no-repeat;
  183. }
  184. .header-title{
  185. font-size: 50rpx;
  186. font-weight: 400;
  187. color: #FFFFFF;
  188. line-height: 70rpx;
  189. letter-spacing: 2rpx;
  190. margin-bottom: 3rpx;
  191. .message{
  192. position: relative;
  193. float: right;
  194. cursor: pointer;
  195. .badge{
  196. }
  197. }
  198. }
  199. .header-con{
  200. font-size: 28rpx;
  201. font-weight: 400;
  202. color: #FFFFFF;
  203. line-height: 40rpx;
  204. letter-spacing: 1rpx;
  205. }
  206. .header-item{
  207. position: relative;
  208. }
  209. }
  210. }
  211. .statistics{
  212. position: relative;
  213. margin: -80rpx 24rpx 24rpx;
  214. padding: 43rpx 30rpx 43rpx;
  215. border-radius: 10rpx;
  216. background-color: #fff;
  217. .count{
  218. font-size: 86rpx;
  219. font-weight: 400;
  220. color: #3171CF;
  221. line-height: 100rpx;
  222. letter-spacing: 3rpx;
  223. }
  224. .name{
  225. font-size: 26rpx;
  226. font-weight: 400;
  227. color: #7D7D7D;
  228. line-height: 37rpx;
  229. letter-spacing: 1px;
  230. }
  231. }
  232. .notice{
  233. margin: 20rpx 0;
  234. padding: 0 30rpx;
  235. background-color: #fff;
  236. }
  237. </style>