Fault.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393
  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-align="right" name="equipment">
  6. <uni-easyinput type="text" v-model="queryParams.equipment" placeholder="请输入" />
  7. </uni-forms-item>
  8. <uni-forms-item label="告警信息:" 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-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-align="right" class="select_box">
  15. <uni-data-select v-model="queryParams.type" :localdata="range" style="width: 102px;"
  16. @change="changeId"></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" :battery="0"
  31. :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="false" title="告警处理" @closeDrawer="closeDrawer" @alarmDispose="alarmDispose">
  43. <view class="drawer_main">
  44. <view>
  45. <FaultDrawer :alarmFrom="alarmFrom" :range="range"></FaultDrawer>
  46. </view>
  47. </view>
  48. </PublicDrawer>
  49. </scroll-view>
  50. </uni-drawer>
  51. <!-- 右侧抽屉结束 -->
  52. </view>
  53. </template>
  54. <script>
  55. import FaultDrawer from "./FaultDrawer.vue"
  56. export default {
  57. components: {
  58. FaultDrawer
  59. },
  60. props: ['isSlecte', 'title'],
  61. name: 'Fault',
  62. mounted() {
  63. this.alarmList()
  64. },
  65. data() {
  66. return {
  67. popupMessage: '成功消息',
  68. popupType: 'success',
  69. alarmFrom: {
  70. id: 0,
  71. remark: null,
  72. type: undefined,
  73. equipment: undefined,
  74. info: undefined,
  75. beginTime: undefined,
  76. },
  77. range: [{
  78. value: 1,
  79. text: "充电机告警"
  80. },
  81. {
  82. value: 2,
  83. text: "BMS告警"
  84. },
  85. {
  86. value: 3,
  87. text: "机器人告警"
  88. },{
  89. value: 4,
  90. text: "消防告警"
  91. },
  92. ],
  93. datalist: [],
  94. dateArr: [],
  95. queryParams: {
  96. page: 1, //当前页
  97. pageSize: 10, //每页条数
  98. equipment: undefined, //充电机ID
  99. info: undefined, //告警信息
  100. beginTime: undefined,
  101. endTime: undefined,
  102. type: undefined, //告警状态
  103. orderByField: 'id', //排序字段
  104. orderByWays: 'desc' //排序方式
  105. },
  106. total: 0, //总条数,
  107. loading: false,
  108. headers: [{
  109. label: '告警设备',
  110. key: 'equipment',
  111. widtd: 100
  112. }, {
  113. label: '告警标识',
  114. key: 'code',
  115. widtd:88
  116. }, {
  117. label: '告警信息',
  118. key: 'info',
  119. widtd: 228
  120. }, {
  121. label: '告警开始时间',
  122. key: 'beginTime',
  123. widtd: 186,
  124. }, {
  125. label: '告警结束时间',
  126. key: 'endTime',
  127. widtd: 186,
  128. },{
  129. label: '告警状态',
  130. key: 'finished',
  131. widtd: 112,
  132. },{
  133. label: '告警类型',
  134. key: 'type',
  135. widtd: 112,
  136. }],
  137. showLoadMore: false,
  138. loadMore: 'more',
  139. }
  140. },
  141. methods: {
  142. //顶部公共消息提示
  143. ExchangeMessage(type, message) {
  144. this.popupType = type
  145. this.popupMessage = message ? message : '后端接口404错误!'
  146. this.$refs.Exchangepopup.open()
  147. },
  148. //告警处理抽屉
  149. faultDrawer(row) {
  150. this.alarmFrom = row
  151. this.$refs.AlarmDrawer.open();
  152. },
  153. //告警处理修改
  154. alarmDispose() {
  155. console.log(this.alarmFrom)
  156. const params = {
  157. id: this.alarmFrom.id,
  158. type: this.alarmFrom.type,
  159. remark: this.alarmFrom.remark
  160. }
  161. this.$http.alarmDispose(params)
  162. .then(res => {
  163. this.$refs.AlarmDrawer.close();
  164. this.ExchangeMessage(res.code === 0 ? 'success' : 'error', res.msg)
  165. }).catch(err => {
  166. console.error(err)
  167. })
  168. },
  169. //关闭抽屉
  170. closeDrawer() {
  171. this.$refs.AlarmDrawer.close();
  172. },
  173. //触底加载数据
  174. pullup() {
  175. this.showLoadMore = true
  176. if (this.total == this.datalist.length) {
  177. this.loadMore = 'no-more'
  178. return
  179. } else {
  180. this.queryParams.page++
  181. this.alarmList()
  182. this.loadMore = 'loading'
  183. }
  184. },
  185. //告警记录列表,
  186. alarmList() {
  187. this.$http.alarmList(this.queryParams).then(res => {
  188. // console.log(res.data.records)
  189. this.showLoadMore = false
  190. if (res.code === 0) {
  191. res.data.records.forEach(item=>{
  192. if(item.type == 1){
  193. item.type = '充电机告警'
  194. }else if(item.type == 2){
  195. item.type = 'BMS告警'
  196. }else if(item.type == 3){
  197. item.type = '机器人告警'
  198. }else if(item.type == 4){
  199. item.type = '消防告警'
  200. }
  201. })
  202. this.datalist.push(...res.data.records)
  203. this.total = res.data.total
  204. }
  205. });
  206. },
  207. //充电机下拉选择事件
  208. changeId(e) {
  209. // console.log(e, 'e')
  210. },
  211. //重置
  212. resetForm() {
  213. this.dateArr = []
  214. this.queryParams = {
  215. page: 1,
  216. pageSize: 10,
  217. equipment: undefined,
  218. info: undefined,
  219. beginTime: undefined,
  220. endTime: undefined,
  221. type: undefined
  222. }
  223. this.alarmList()
  224. },
  225. //查询
  226. handleQuery() {
  227. if (this.dateArr.length > 0) {
  228. this.queryParams.beginTime = this.dateArr[0]+' ' +'00:00:00'
  229. this.queryParams.endTime = this.dateArr[1]+' ' +'23:59:59'
  230. }else{
  231. this.queryParams.beginTime = undefined
  232. this.queryParams.endTime = undefined
  233. }
  234. this.queryParams.page = 1
  235. this.datalist = []
  236. this.showLoadMore = false
  237. this.alarmList()
  238. }
  239. }
  240. }
  241. </script>
  242. <style lang="scss" scoped>
  243. .drawer_main {
  244. // border: 1px solid red;
  245. // padding-top: 20px;
  246. }
  247. ::v-deep .uni-popup-message__box{
  248. height: 20px;
  249. line-height: 11px;
  250. }
  251. .main_table {
  252. width: 1040px;
  253. height: 580px;
  254. background: #111827;
  255. box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.1);
  256. border-radius: 2px;
  257. border: 1px solid #192337;
  258. margin-top: 16px;
  259. box-sizing: border-box;
  260. padding: 16px 20px;
  261. display: flex;
  262. flex-direction: column;
  263. overflow: hidden;
  264. }
  265. .box {
  266. width: 1040px;
  267. height: 66px;
  268. background: #111827;
  269. box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.1);
  270. border-radius: 2px 2px 2px 2px;
  271. border: 1px solid #192337;
  272. // margin-top: 20px;
  273. }
  274. ::v-deep .search_box_from {
  275. padding-top: 15px;
  276. span {
  277. display: flex;
  278. }
  279. }
  280. .search_box {
  281. display: flex;
  282. justify-content: space-between;
  283. .box_btn {
  284. display: flex;
  285. margin-top: 16px;
  286. padding-right: 10px;
  287. .cx_btn {
  288. width: 60px;
  289. height: 34px;
  290. text-align: center;
  291. line-height: 34px;
  292. background: #91FDB9;
  293. border-radius: 2px 2px 2px 2px;
  294. color: black;
  295. font-size: 14px;
  296. margin-right: 10px;
  297. }
  298. .cz_btn {
  299. width: 60px;
  300. height: 34px;
  301. text-align: center;
  302. line-height: 34px;
  303. border-radius: 2px 2px 2px 2px;
  304. border: 1px solid #263042;
  305. color: #fff;
  306. font-size: 14px;
  307. }
  308. }
  309. }
  310. ::v-deep .uni-forms-item__content {
  311. background: rgba(255, 255, 255, 0);
  312. border-radius: 2px 2px 2px 2px;
  313. border: 1px solid #263042;
  314. .uni-easyinput__content {
  315. background: none !important;
  316. border: none !important;
  317. color: #fff;
  318. }
  319. .uni-select__selector-item {
  320. font-size: 14px;
  321. font-weight: 400;
  322. color: #A8ADC8;
  323. }
  324. }
  325. ::v-deep .uni-forms-item__label {
  326. font-size: 14px;
  327. color: white;
  328. padding: 0 2px 0 0;
  329. }
  330. ::v-deep .uni-select__selector {
  331. background: #111827;
  332. border: 1px solid #263042;
  333. color: #606266;
  334. z-index: 9999999;
  335. }
  336. ::v-deep .uni-date-x {
  337. background: none;
  338. }
  339. ::v-deep .uni-date-x--border {
  340. border: none;
  341. }
  342. ::v-deep .uni-select {
  343. border: none;
  344. }
  345. ::v-deep .uni-forms-item {
  346. width: 200px;
  347. }
  348. ::v-deep .uni-popper__arrow::after {
  349. display: none;
  350. }
  351. ::v-deep .uni-popper__arrow {
  352. display: none;
  353. }
  354. ::v-deep .uni-select__input-text {
  355. color: #fff;
  356. }
  357. ::v-deep .uni-date-x {
  358. color: #fff;
  359. }
  360. .last_box {
  361. width: 320px;
  362. }
  363. .select_box {
  364. width: 160px;
  365. }
  366. </style>