FireAlarm.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461
  1. <template>
  2. <view class="recharge_box">
  3. <view class="search_box box">
  4. <uni-forms :modelValue="queryParams" class="search_box_from">
  5. <uni-forms-item label="告警设备:" label-width="80px" label-align="right" name="equipment">
  6. <uni-easyinput type="text" v-model="queryParams.equipment" placeholder="请输入" />
  7. </uni-forms-item>
  8. <uni-forms-item label="告警信息:" label-width="80px" label-align="right" name="info">
  9. <uni-easyinput type="text" v-model="queryParams.info" placeholder="请输入" />
  10. </uni-forms-item>
  11. <!-- <uni-forms-item label="告警时间:" name="dateArr" label-width="80px" label-align="right" class="last_box">
  12. <uni-datetime-picker v-model="dateArr" type="daterange" rangeSeparator="至" />
  13. </uni-forms-item> -->
  14. <uni-forms-item label="告警类型:" name="type" label-width="80px" label-align="right" class="select_box">
  15. <uni-data-select v-model="queryParams.type" :localdata="range"
  16. style="width: 104px;"></uni-data-select>
  17. </uni-forms-item>
  18. </uni-forms>
  19. <view class="box_btn">
  20. <view class="cx_btn" @click="handleQuery">
  21. 查询
  22. </view>
  23. <view class="cz_btn" @click="resetForm">
  24. 重置
  25. </view>
  26. </view>
  27. </view>
  28. <view class="main_table">
  29. <!-- <FaultTable :loading="loading" :datalist="datalist"></FaultTable> -->
  30. <lyy-table @faultDrawer="faultDrawer" :headerFixed="true" :showLoadMore="showLoadMore" :loadMore="loadMore"
  31. :battery="0" :columnFixed=1 :contents="datalist" :headers="headers" @onPullup="pullup">
  32. </lyy-table>
  33. </view>
  34. <!-- 顶部公共提示信息 -->
  35. <uni-popup ref="Exchangepopup" type="message">
  36. <uni-popup-message :type="popupType" :message="popupMessage" :duration="2000"></uni-popup-message>
  37. </uni-popup>
  38. <!-- 顶部提示信息结束-->
  39. <!--右侧抽屉 -->
  40. <uni-drawer ref="AlarmDrawer" mode="right" :width="400" :mask-click="true">
  41. <scroll-view style="height: 100%;" scroll-y="true">
  42. <PublicDrawer :flag="true" title="消防告警处理" @closeDrawer="closeDrawer">
  43. <view class="drawer_main">
  44. <view class="drawer_main_title">
  45. 系统检测到【电池/架载机】发生了消防问题,确认需要抓取电池吗?
  46. </view>
  47. <view class="drawer_main_tip">
  48. <text>确认消防换仓:</text>机器人执行消防换仓动作。
  49. </view>
  50. <view class="drawer_main_tip">
  51. <text>忽略:</text>放弃消防换仓。
  52. </view>
  53. <view class="btn_box">
  54. <view class="btn_box_ok" @click="alarmDispose">
  55. 确认消防换仓
  56. </view>
  57. <view class="btn_box_off" @click="closeDrawer">
  58. 忽略
  59. </view>
  60. </view>
  61. </view>
  62. </PublicDrawer>
  63. </scroll-view>
  64. </uni-drawer>
  65. <!-- 右侧抽屉结束 -->
  66. </view>
  67. </template>
  68. <script>
  69. import FaultDrawer from "./FaultDrawer.vue"
  70. export default {
  71. components: {
  72. FaultDrawer
  73. },
  74. props: ['isSlecte', 'title'],
  75. name: 'Fault',
  76. mounted() {
  77. uni.showLoading({
  78. title:'数据加载中...'
  79. })
  80. this.curAlarmlist=setInterval(()=>{
  81. this.alarmList()
  82. },1000)
  83. },
  84. destroyed() {
  85. this.$storage.remove('gotoname'); //清除本地存储
  86. clearInterval(this.curAlarmlist)
  87. },
  88. data() {
  89. return {
  90. popupMessage: '成功消息',
  91. popupType: 'success',
  92. alarmFrom: {
  93. },
  94. range: [{
  95. value: 1,
  96. text: "充电机告警"
  97. },
  98. {
  99. value: 2,
  100. text: "BMS告警"
  101. },
  102. {
  103. value: 3,
  104. text: "机器人告警"
  105. }, {
  106. value: 4,
  107. text: "消防告警"
  108. },
  109. ],
  110. datalist: [],
  111. dateArr: [],
  112. queryParams: {
  113. page: 1, //当前页
  114. pageSize: 10, //每页条数
  115. equipment: undefined, //告警设备
  116. beginTime: undefined,
  117. endTime: undefined,
  118. info: undefined,
  119. type: undefined, //告警类型
  120. orderByWays: 'desc' //排序方式
  121. },
  122. total: 0, //总条数,
  123. loading: false,
  124. headers: [{
  125. label: '告警设备',
  126. key: 'equipment',
  127. widtd: 150
  128. }, {
  129. label: '告警类型',
  130. key: 'type',
  131. widtd: 200,
  132. }, {
  133. label: '告警标识',
  134. key: 'code',
  135. widtd: 150,
  136. }, {
  137. label: '告警信息',
  138. key: 'info',
  139. widtd: 330
  140. }, {
  141. label: '操作',
  142. key: 'id',
  143. widtd: 120,
  144. },
  145. // {
  146. // label: '告警开始时间',
  147. // key: 'beginTime',
  148. // widtd: 196,
  149. // },
  150. ],
  151. showLoadMore: false,
  152. loadMore: 'more',
  153. curAlarmlist:null,
  154. }
  155. },
  156. methods: {
  157. //顶部公共消息提示
  158. ExchangeMessage(type, message) {
  159. this.popupType = type
  160. this.popupMessage = message ? message : '后端接口404错误!'
  161. this.$refs.Exchangepopup.open()
  162. },
  163. //告警处理抽屉
  164. faultDrawer(row) {
  165. console.log(row, 'row')
  166. this.alarmFrom = row
  167. this.$refs.AlarmDrawer.open();
  168. },
  169. //告警处理修改
  170. alarmDispose() {
  171. console.log(this.alarmFrom)
  172. //这里数据都拿到了 接口也写好了 就看后端需要传什么参数了 参数写好放开下面的注释就行
  173. const params = {
  174. targetCode: this.alarmFrom.chargerCode,
  175. // type: this.alarmFrom.type,
  176. // remark: this.alarmFrom.remark
  177. }
  178. // this.$http.FireChangestorage(params)
  179. // .then(res => {
  180. // this.$refs.AlarmDrawer.close();
  181. // this.ExchangeMessage(res.code === 0 ? 'success' : 'error', res.msg)
  182. // }).catch(err => {
  183. // console.error(err)
  184. // })
  185. },
  186. //关闭抽屉
  187. closeDrawer() {
  188. this.$refs.AlarmDrawer.close();
  189. },
  190. //触底加载数据
  191. pullup() {
  192. this.showLoadMore = true
  193. if (this.total == this.datalist.length) {
  194. this.loadMore = 'no-more'
  195. return
  196. } else {
  197. this.queryParams.page++
  198. this.alarmList()
  199. this.loadMore = 'loading'
  200. }
  201. },
  202. //消防告警记录列表,
  203. alarmList() { //getwarnList
  204. if(this.queryParams.type){
  205. this.queryParams.type=this.queryParams.type*1
  206. }
  207. this.$http.getwarnList(this.queryParams).then(res => {
  208. // console.log(res.data.records)
  209. this.showLoadMore = false
  210. if (res.code === 0) {
  211. res.data.list.forEach(item => {
  212. if (item.type == 1) {
  213. item.type = '充电机告警'
  214. } else if (item.type == 2) {
  215. item.type = 'BMS告警'
  216. } else if (item.type == 3) {
  217. item.type = '机器人告警'
  218. } else if (item.type == 4) {
  219. item.type = '消防告警'
  220. }
  221. if(item.equipment.includes('电池') || item.equipment.includes('充电机') || item.equipment.includes('架载机')){
  222. item.alarmValue=999
  223. }
  224. })
  225. if(res.data.list.length>this.datalist.length){
  226. this.datalist.push(...res.data.list)
  227. }
  228. this.total = res.data.total
  229. uni.hideLoading()
  230. }
  231. }).catch(err => {uni.hideLoading()});
  232. },
  233. //重置
  234. resetForm() {
  235. this.dateArr = []
  236. this.datalist = []
  237. this.queryParams = {
  238. page: 1,
  239. pageSize: 10,
  240. equipment: undefined,
  241. info: undefined,
  242. beginTime: undefined,
  243. endTime: undefined,
  244. type: undefined,
  245. orderByWays: "desc"
  246. }
  247. this.alarmList()
  248. },
  249. //查询
  250. handleQuery() {
  251. if (this.dateArr.length > 0) {
  252. this.queryParams.beginTime = this.dateArr[0] + ' ' + '00:00:00'
  253. this.queryParams.endTime = this.dateArr[1] + ' ' + '23:59:59'
  254. } else {
  255. this.queryParams.beginTime = undefined
  256. this.queryParams.endTime = undefined
  257. }
  258. this.queryParams.page = 1
  259. this.datalist = []
  260. this.showLoadMore = false
  261. this.alarmList()
  262. }
  263. }
  264. }
  265. </script>
  266. <style lang="scss" scoped>
  267. .drawer_main {
  268. // padding-top: 20px;
  269. .drawer_main_title {
  270. font-size: 16px;
  271. }
  272. .drawer_main_tip {
  273. font-size: 14px;
  274. margin-top: 10px;
  275. text {
  276. font-size: 16px;
  277. }
  278. }
  279. .btn_box {
  280. display: flex;
  281. font-size: 14px;
  282. margin-top: 20px;
  283. justify-content: flex-end;
  284. .btn_box_ok {
  285. width: 100px;
  286. height: 32px;
  287. background: #91FDB9;
  288. border-radius: 2px 2px 2px 2px;
  289. text-align: center;
  290. line-height: 32px;
  291. color: black;
  292. margin-right: 20px;
  293. }
  294. .btn_box_off {
  295. width: 60px;
  296. height: 32px;
  297. border-radius: 2px 2px 2px 2px;
  298. color: #fff;
  299. border: 1px solid #263042;
  300. text-align: center;
  301. line-height: 32px;
  302. }
  303. }
  304. }
  305. ::v-deep .uni-popup-message__box {
  306. height: 20px;
  307. line-height: 11px;
  308. }
  309. .main_table {
  310. width: 1040px;
  311. height: 580px;
  312. background: #111827;
  313. box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.1);
  314. border-radius: 2px;
  315. border: 1px solid #192337;
  316. margin-top: 16px;
  317. box-sizing: border-box;
  318. padding: 16px 20px;
  319. display: flex;
  320. flex-direction: column;
  321. overflow: hidden;
  322. }
  323. .box {
  324. width: 1040px;
  325. height: 66px;
  326. background: #111827;
  327. box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.1);
  328. border-radius: 2px 2px 2px 2px;
  329. border: 1px solid #192337;
  330. // margin-top: 20px;
  331. }
  332. ::v-deep .search_box_from {
  333. padding-top: 15px;
  334. span {
  335. display: flex;
  336. }
  337. }
  338. .search_box {
  339. display: flex;
  340. justify-content: space-between;
  341. .box_btn {
  342. display: flex;
  343. margin-top: 16px;
  344. padding-right: 16px;
  345. .cx_btn {
  346. width: 60px;
  347. height: 34px;
  348. text-align: center;
  349. line-height: 34px;
  350. background: #91FDB9;
  351. border-radius: 2px 2px 2px 2px;
  352. color: black;
  353. font-size: 14px;
  354. margin-right: 10px;
  355. }
  356. .cz_btn {
  357. width: 60px;
  358. height: 34px;
  359. text-align: center;
  360. line-height: 34px;
  361. border-radius: 2px 2px 2px 2px;
  362. border: 1px solid #263042;
  363. color: #fff;
  364. font-size: 14px;
  365. }
  366. }
  367. }
  368. ::v-deep .uni-forms-item__content {
  369. background: rgba(255, 255, 255, 0);
  370. border-radius: 2px 2px 2px 2px;
  371. border: 1px solid #263042;
  372. .uni-easyinput__content {
  373. background: none !important;
  374. border: none !important;
  375. color: #fff;
  376. }
  377. .uni-select__selector-item {
  378. font-size: 14px;
  379. font-weight: 400;
  380. color: #A8ADC8;
  381. }
  382. }
  383. ::v-deep .uni-forms-item__label {
  384. font-size: 14px;
  385. color: white;
  386. }
  387. ::v-deep .uni-select__selector {
  388. background: #111827;
  389. border: 1px solid #263042;
  390. color: #606266;
  391. z-index: 9999999;
  392. }
  393. ::v-deep .uni-date-x {
  394. background: none;
  395. }
  396. ::v-deep .uni-date-x--border {
  397. border: none;
  398. }
  399. ::v-deep .uni-select {
  400. border: none;
  401. }
  402. ::v-deep .uni-forms-item {
  403. width: 200px;
  404. }
  405. ::v-deep .uni-popper__arrow::after {
  406. display: none;
  407. }
  408. ::v-deep .uni-popper__arrow {
  409. display: none;
  410. }
  411. ::v-deep .uni-select__input-text {
  412. color: #fff;
  413. }
  414. ::v-deep .uni-date-x {
  415. color: #fff;
  416. }
  417. .last_box {
  418. width: 320px;
  419. }
  420. .select_box {
  421. width: 160px;
  422. }
  423. </style>