remindList.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379
  1. <template>
  2. <view>
  3. <u-navbar title="租户断电提醒" title-color="#101010"></u-navbar>
  4. <u-tabs :list="list" :is-scroll="false"
  5. :current="current" @change="change"></u-tabs>
  6. <view class="records">
  7. <view class="records-item" v-for="(item, index) in abnormalRecordsList" :key="index"
  8. >
  9. <!-- <view class="icon icon2">
  10. <image class="img" src="@/assets/img/riFill-cloud-off-fill.svg" mode=""></image>
  11. </view>
  12. <view class="icon icon3">
  13. <image class="img" src="@/assets/img/outputVoltage.svg" mode=""></image>
  14. </view> -->
  15. <view class="title">
  16. <view class="name">
  17. <span v-if="item.level==1" class="level level1 ">一级</span>
  18. <span v-if="item.level==2" class="level level2">二级</span>
  19. {{item.content}}
  20. </view>
  21. <view class="date" style="display: flex; justify-content: space-between;">
  22. <view>{{item.title}}</view>
  23. <view>{{item.createTime}}</view>
  24. </view>
  25. </view>
  26. </view>
  27. </view>
  28. <u-divider :isnone="abnormalRecordsList.length==0" nonetext="暂无异常报警记录" border-color="#CFD2D5">
  29. 已经到底了</u-divider>
  30. </view>
  31. </template>
  32. <script>
  33. import {
  34. parseUnixTime,
  35. beforeTimeStamp,
  36. getWeek
  37. } from '@/apis/utils'
  38. import * as API from '@/apis/pagejs/energyManage.js'
  39. export default {
  40. data() {
  41. return {
  42. abnormalRecordsList: [], // 异常告警记录
  43. queryDate: '',
  44. configId: '',
  45. pageIndex: 1,
  46. recordsTotal: 0,
  47. companyId: '',
  48. show1: false, // 时间选择
  49. defaultTime: '',
  50. params: {
  51. year: true,
  52. month: true,
  53. day: false,
  54. hour: false,
  55. minute: false,
  56. second: false,
  57. timestamp: false
  58. },
  59. time: '全部时间',
  60. show2: false, // 状态选择
  61. state: '全部状态',
  62. stateList: [],
  63. show3: false, // 设备选择
  64. device: '全部设备',
  65. deviceList: [],
  66. value1: 1,
  67. value2: 1,
  68. value3: 1,
  69. list: [{
  70. name: '一级预警',
  71. level:'1'
  72. }, {
  73. name: '二级预警',
  74. level:'2'
  75. }],
  76. current: 0,
  77. options1: [{
  78. label: '2024年2月',
  79. value: 1,
  80. },
  81. {
  82. label: '2024年3月',
  83. value: 2,
  84. },
  85. {
  86. label: '2024年4月',
  87. value: 3,
  88. }
  89. ],
  90. options2: [{
  91. label: '设备离线',
  92. value: 1,
  93. },
  94. {
  95. label: '温度异常',
  96. value: 2,
  97. },
  98. {
  99. label: '电压异常',
  100. value: 3,
  101. },
  102. {
  103. label: '功率因数异常',
  104. value: 4,
  105. },
  106. ],
  107. options3: [{
  108. label: '荆鹏集团',
  109. value: 1,
  110. },
  111. {
  112. label: '青少年宫',
  113. value: 2,
  114. },
  115. {
  116. label: '荆州院子',
  117. value: 3,
  118. },
  119. ],
  120. }
  121. },
  122. onLoad(op) {
  123. if(op.id) {
  124. this.companyId = op.id;
  125. }
  126. var date = new Date();
  127. var year = date.getFullYear();
  128. var month = date.getMonth()+1 >= 10 ? date.getMonth()+1 : '0'+(date.getMonth()+1);
  129. this.defaultTime = year + '-' + month;
  130. this.queryDate = year + '-' + month;
  131. this.time = year + '年' + parseInt(month) + '月';
  132. //this.getAlarmConfiguration();
  133. this.getAbnormalAlarmRecord();
  134. },
  135. onReady() {
  136. },
  137. onReachBottom() {
  138. if (this.abnormalRecordsList.length < this.recordsTotal) {
  139. this.myLoadmore();
  140. }
  141. },
  142. methods: {
  143. // 异常告警记录
  144. getAbnormalAlarmRecord(bl) {
  145. uni.showLoading({
  146. title: "加载中",
  147. mask: true,
  148. })
  149. if (bl) {
  150. this.abnormalRecordsList = [];
  151. this.pageIndex = 1;
  152. }
  153. API.remindList({
  154. queryDate: this.queryDate,
  155. configId: this.configId,
  156. pageIndex: this.pageIndex,
  157. pageSize: 20,
  158. companyId: this.companyId,
  159. queryParent:this.companyId?1:0,
  160. level:this.list[this.current].level
  161. }).then((res) => {
  162. uni.hideLoading();
  163. this.abnormalRecordsList = [
  164. ...this.abnormalRecordsList,
  165. ...res.data.data
  166. ];
  167. this.recordsTotal = res.data.recordsTotal;
  168. }).catch(error => {
  169. uni.showToast({
  170. title: error,
  171. icon: "none"
  172. })
  173. })
  174. },
  175. myLoadmore() {
  176. this.pageIndex += 1;
  177. this.getAbnormalAlarmRecord();
  178. },
  179. // 异常查询条件
  180. getAlarmConfiguration() {
  181. uni.showLoading({
  182. title: "加载中",
  183. mask: true,
  184. })
  185. API.alarmConfiguration().then((response) => {
  186. uni.hideLoading();
  187. var list1 = [];
  188. var list2 = [];
  189. if(response.data.alarmConfigList && response.data.alarmConfigList.length != 0) {
  190. list1 = response.data.alarmConfigList.map(item => {
  191. return {
  192. label: item.name,
  193. value: item.id
  194. }
  195. });
  196. }
  197. list1.unshift({
  198. value: '',
  199. label: '全部状态'
  200. });
  201. if(response.data.companyInfoList && response.data.companyInfoList.length != 0) {
  202. list2 = response.data.companyInfoList.map(item => {
  203. if(item.id == this.companyId) {
  204. this.device = item.name;
  205. }
  206. return {
  207. label: item.name,
  208. value: item.id
  209. }
  210. });
  211. }
  212. list2.unshift({
  213. value: '',
  214. label: '全部设备'
  215. });
  216. this.stateList = list1;
  217. this.deviceList = list2;
  218. }).catch(error => {
  219. uni.showToast({
  220. title: error,
  221. icon: "none"
  222. })
  223. })
  224. },
  225. change(index){
  226. this.current = index;
  227. this.getAbnormalAlarmRecord(true);
  228. },
  229. // 时间查询
  230. timeChange(params) {
  231. console.log(params)
  232. this.time = params.year + '年' + parseInt(params.month) + '月';
  233. this.queryDate = params.year + '-' + params.month;
  234. this.getAbnormalAlarmRecord(true);
  235. },
  236. // 状态查询
  237. stateChange(e) {
  238. console.log(e);
  239. this.configId = e[0].value;
  240. this.state = e[0].label;
  241. this.getAbnormalAlarmRecord(true);
  242. },
  243. // 设备查询
  244. deviceChange(e) {
  245. console.log(e);
  246. this.companyId = e[0].value;
  247. this.device = e[0].label;
  248. this.getAbnormalAlarmRecord(true);
  249. }
  250. }
  251. }
  252. </script>
  253. <style lang="scss" scoped>
  254. .dropdown {
  255. background-color: #fff;
  256. position: sticky;
  257. top: 88rpx;
  258. z-index: 999;
  259. padding: 18rpx 46rpx;
  260. display: flex;
  261. justify-content: space-around;
  262. border-bottom: 1px solid rgba(245, 245, 245, 1);
  263. .dropdown-item{
  264. //width: 47.33%;
  265. text-align: center;
  266. height: 60rpx;
  267. line-height: 60rpx;
  268. }
  269. }
  270. // 记录
  271. .records {
  272. background-color: #fff;
  273. // margin-top: 80rpx;
  274. .records-item {
  275. display: flex;
  276. align-items: center;
  277. padding: 24rpx 40rpx;
  278. border-top: 1px solid rgba(245, 245, 245, 1);
  279. .level{
  280. color:#fff;
  281. border-radius: 8rpx;
  282. font-weight: 400;
  283. padding: 4rpx 8rpx;
  284. font-size: 22rpx;
  285. margin-right: 2px;
  286. }
  287. .level1{
  288. background: red;
  289. }
  290. .level2{
  291. background-color: rgba(255,123,0,1);
  292. }
  293. .icon {
  294. width: 72rpx;
  295. height: 72rpx;
  296. border-radius: 4px;
  297. display: flex;
  298. align-items: center;
  299. justify-content: center;
  300. .img {
  301. width: 48rpx;
  302. height: 48rpx;
  303. }
  304. }
  305. .icon1 {
  306. background-color: rgba(255, 227, 218, 1);
  307. }
  308. .icon2 {
  309. background-color: rgba(230, 230, 230, 1);
  310. }
  311. .icon3 {
  312. background-color: rgba(212, 251, 220, 1);
  313. }
  314. .title {
  315. margin-left: 16rpx;
  316. .name {
  317. color: rgba(51, 51, 51, 1);
  318. font-weight: bold;
  319. }
  320. .date {
  321. color: rgba(119, 119, 119, 1);
  322. font-size: 24rpx;
  323. margin-top: 4rpx;
  324. }
  325. }
  326. .equipment {
  327. margin-left: auto;
  328. margin-right: 24rpx;
  329. .equipment1 {
  330. color: rgba(51, 51, 51, 1);
  331. font-weight: bold;
  332. }
  333. .equipment2 {
  334. color: rgba(119, 119, 119, 1);
  335. font-size: 24rpx;
  336. text-align: right;
  337. margin-top: 4rpx;
  338. }
  339. }
  340. }
  341. }
  342. </style>