index.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. <template>
  2. <view class="content">
  3. <u-form :model="queryData" ref="uForm">
  4. <u-row>
  5. <u-col span="4">
  6. <u-form-item label="报警类型" label-width="80px">
  7. <u--input placeholder="请输入报警类型" border="surround" v-model="queryData.alarmType" />
  8. </u-form-item>
  9. </u-col>
  10. <u-col span="3">
  11. <u-form-item>
  12. <u-button type="primary" @click="queryPageDetails">查询</u-button>
  13. <u-button type="info" @click="reset">重置</u-button>
  14. </u-form-item>
  15. </u-col>
  16. </u-row>
  17. </u-form>
  18. <view class="tableBox">
  19. <uni-table border stripe emptyText="暂无更多数据" :loading="this.loading">
  20. <!-- 表头行 -->
  21. <uni-tr>
  22. <uni-th align="center" width="60">序号</uni-th>
  23. <uni-th align="center">报警单位</uni-th>
  24. <uni-th align="center">报警类型</uni-th>
  25. <uni-th align="center">报警时间</uni-th>
  26. <uni-th align="center">报警位置</uni-th>
  27. <uni-th align="center">报警等级</uni-th>
  28. <uni-th align="center">处置状态</uni-th>
  29. <uni-th align="center" width="170">操作</uni-th>
  30. </uni-tr>
  31. <uni-tr v-for="(item,index) in tableData" :key="item.id">
  32. <uni-td align="center" width="60">{{index + 1}}</uni-td>
  33. <uni-td align="center">{{item.alarmUnit}}</uni-td>
  34. <uni-td align="center">{{item.alarmType}}</uni-td>
  35. <uni-td align="center">{{item.alarmTime}}</uni-td>
  36. <uni-td align="center">{{item.alarmLocation}}</uni-td>
  37. <uni-td align="center">{{item.alarmLevel}}</uni-td>
  38. <uni-td align="center" class="processed"
  39. :class="{'untreated':item.status == 0}">{{item.status == 0?"未处理":"已处理"}}</uni-td>
  40. <uni-td align="center">
  41. <u-button size='mini' type='primary' @click="lookDetails('look',item.id)">查看</u-button>
  42. <u-button v-if="item.status == 0" size='mini' type='success'
  43. @click="lookDetails('manage',item.id)">处理</u-button>
  44. </uni-td>
  45. </uni-tr>
  46. </uni-table>
  47. <uni-pagination show-icon="true" :total="queryData.total" :current="queryData.current"
  48. @change="changePage" />
  49. </view>
  50. </view>
  51. </template>
  52. <script>
  53. import * as api from "@/api/fireFighting.js"
  54. export default {
  55. data() {
  56. return {
  57. queryData: {
  58. total: 0,
  59. size: 10,
  60. current: 1,
  61. },
  62. loading: false,
  63. tableData: []
  64. }
  65. },
  66. onLoad() {
  67. this.queryPageDetails()
  68. },
  69. methods: {
  70. queryPageDetails() {
  71. this.loading = true
  72. api.queryData(this.queryData).then(res => {
  73. this.tableData = res.data.records
  74. this.queryData.total = res.data.total
  75. this.loading = false
  76. })
  77. },
  78. changePage(page) {
  79. this.queryData.current = page.current
  80. this.queryPageDetails()
  81. },
  82. lookDetails(type, id) {
  83. if (type == 'look') {
  84. uni.navigateTo({
  85. url: `/pages/fireFighting/details?id=${id}`
  86. })
  87. } else {
  88. uni.showModal({
  89. title: '提示',
  90. type: 'success',
  91. content: '确认处理该条智慧消防报警?',
  92. success: (val) => {
  93. if (val.confirm) {
  94. api.manageMatter({
  95. id,
  96. status: 1
  97. }).then(res => {
  98. this.queryPageDetails()
  99. uni.showToast({
  100. title: '成功提示',
  101. //将值设置为 success 或者直接不用写icon这个参数
  102. icon: 'success',
  103. //显示持续时间为 2秒
  104. duration: 2000
  105. })
  106. })
  107. }
  108. }
  109. });
  110. }
  111. },
  112. reset() {
  113. this.queryData = {
  114. total: 0,
  115. size: 10,
  116. current: 1,
  117. }
  118. }
  119. }
  120. }
  121. </script>
  122. <style scoped lang="scss">
  123. .content {
  124. margin: 10px 20px;
  125. /deep/.u-form {
  126. margin-bottom: 20px;
  127. .u-form-item {
  128. .u-button {
  129. width: 80px;
  130. height: 35px;
  131. margin: 0 5px;
  132. }
  133. }
  134. }
  135. .tableBox {
  136. .uni-table {
  137. .uni-table-td {
  138. .u-button {
  139. width: 60px;
  140. float: left;
  141. margin: 0 5px;
  142. }
  143. }
  144. .processed {
  145. font-weight: bold;
  146. color: #67C23A;
  147. }
  148. .untreated {
  149. font-weight: bold;
  150. color: #F56C6C;
  151. }
  152. }
  153. .uni-pagination {
  154. float: right;
  155. margin: 10px 0;
  156. }
  157. }
  158. }
  159. </style>