Fault.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398
  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. uni.showLoading({
  188. title:'数据加载中...'
  189. })
  190. this.$http.alarmList(this.queryParams).then(res => {
  191. // console.log(res.data.records)
  192. this.showLoadMore = false
  193. if (res.code === 0) {
  194. res.data.records.forEach(item=>{
  195. if(item.type == 1){
  196. item.type = '充电机告警'
  197. }else if(item.type == 2){
  198. item.type = 'BMS告警'
  199. }else if(item.type == 3){
  200. item.type = '机器人告警'
  201. }else if(item.type == 4){
  202. item.type = '消防告警'
  203. }
  204. })
  205. this.datalist.push(...res.data.records)
  206. this.total = res.data.total
  207. uni.hideLoading()
  208. }
  209. }).catch(err => {uni.hideLoading()});
  210. },
  211. //充电机下拉选择事件
  212. changeId(e) {
  213. // console.log(e, 'e')
  214. },
  215. //重置
  216. resetForm() {
  217. this.dateArr = []
  218. this.datalist=[]
  219. this.queryParams = {
  220. page: 1,
  221. pageSize: 10,
  222. equipment: undefined,
  223. info: undefined,
  224. beginTime: undefined,
  225. endTime: undefined,
  226. type: undefined
  227. }
  228. this.alarmList()
  229. },
  230. //查询
  231. handleQuery() {
  232. if (this.dateArr.length > 0) {
  233. this.queryParams.beginTime = this.dateArr[0]+' ' +'00:00:00'
  234. this.queryParams.endTime = this.dateArr[1]+' ' +'23:59:59'
  235. }else{
  236. this.queryParams.beginTime = undefined
  237. this.queryParams.endTime = undefined
  238. }
  239. this.queryParams.page = 1
  240. this.datalist = []
  241. this.showLoadMore = false
  242. this.alarmList()
  243. }
  244. }
  245. }
  246. </script>
  247. <style lang="scss" scoped>
  248. .drawer_main {
  249. // border: 1px solid red;
  250. // padding-top: 20px;
  251. }
  252. ::v-deep .uni-popup-message__box{
  253. height: 20px;
  254. line-height: 11px;
  255. }
  256. .main_table {
  257. width: 1040px;
  258. height: 580px;
  259. background: #111827;
  260. box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.1);
  261. border-radius: 2px;
  262. border: 1px solid #192337;
  263. margin-top: 16px;
  264. box-sizing: border-box;
  265. padding: 16px 20px;
  266. display: flex;
  267. flex-direction: column;
  268. overflow: hidden;
  269. }
  270. .box {
  271. width: 1040px;
  272. height: 66px;
  273. background: #111827;
  274. box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.1);
  275. border-radius: 2px 2px 2px 2px;
  276. border: 1px solid #192337;
  277. // margin-top: 20px;
  278. }
  279. ::v-deep .search_box_from {
  280. padding-top: 15px;
  281. span {
  282. display: flex;
  283. }
  284. }
  285. .search_box {
  286. display: flex;
  287. justify-content: space-between;
  288. .box_btn {
  289. display: flex;
  290. margin-top: 16px;
  291. padding-right: 10px;
  292. .cx_btn {
  293. width: 60px;
  294. height: 34px;
  295. text-align: center;
  296. line-height: 34px;
  297. background: #91FDB9;
  298. border-radius: 2px 2px 2px 2px;
  299. color: black;
  300. font-size: 14px;
  301. margin-right: 10px;
  302. }
  303. .cz_btn {
  304. width: 60px;
  305. height: 34px;
  306. text-align: center;
  307. line-height: 34px;
  308. border-radius: 2px 2px 2px 2px;
  309. border: 1px solid #263042;
  310. color: #fff;
  311. font-size: 14px;
  312. }
  313. }
  314. }
  315. ::v-deep .uni-forms-item__content {
  316. background: rgba(255, 255, 255, 0);
  317. border-radius: 2px 2px 2px 2px;
  318. border: 1px solid #263042;
  319. .uni-easyinput__content {
  320. background: none !important;
  321. border: none !important;
  322. color: #fff;
  323. }
  324. .uni-select__selector-item {
  325. font-size: 14px;
  326. font-weight: 400;
  327. color: #A8ADC8;
  328. }
  329. }
  330. ::v-deep .uni-forms-item__label {
  331. font-size: 14px;
  332. color: white;
  333. padding: 0 2px 0 0;
  334. }
  335. ::v-deep .uni-select__selector {
  336. background: #111827;
  337. border: 1px solid #263042;
  338. color: #606266;
  339. z-index: 9999999;
  340. }
  341. ::v-deep .uni-date-x {
  342. background: none;
  343. }
  344. ::v-deep .uni-date-x--border {
  345. border: none;
  346. }
  347. ::v-deep .uni-select {
  348. border: none;
  349. }
  350. ::v-deep .uni-forms-item {
  351. width: 200px;
  352. }
  353. ::v-deep .uni-popper__arrow::after {
  354. display: none;
  355. }
  356. ::v-deep .uni-popper__arrow {
  357. display: none;
  358. }
  359. ::v-deep .uni-select__input-text {
  360. color: #fff;
  361. }
  362. ::v-deep .uni-date-x {
  363. color: #fff;
  364. }
  365. .last_box {
  366. width: 320px;
  367. }
  368. .select_box {
  369. width: 160px;
  370. }
  371. </style>