fireRun.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. <template>
  2. <view class="uni-container uni-container-bg">
  3. <view class="top">
  4. <view>
  5. <view class="search-time">
  6. <text class="time-item">事件时间:</text>
  7. <uni-datetime-picker class="time-item-check" type="date" v-model="startSingle"
  8. @maskClick="startMaskClick" />
  9. </view>
  10. <view class="search-time">
  11. <text class="time-item">结束时间:</text>
  12. <uni-datetime-picker class="time-item-check" type="date" v-model="endSingle"
  13. @maskClick="endMaskClick" />
  14. </view>
  15. </view>
  16. <view class="search-icon">
  17. <u-icon name="search" color="#4CB2B6" size="40" @click="handleQuery"></u-icon>
  18. </view>
  19. </view>
  20. <view class="main">
  21. <view v-for="(item, index) in list" :key="index">
  22. <uni-card v-if="list.length>0">
  23. <view class="main-item">
  24. <rich-text :nodes="`事件内容: ${item.eventContent}`" class="font-16 uni-ellipsis-set"></rich-text>
  25. </view>
  26. <view class="main-item">
  27. <text style="width: 140rpx;">事件日期:</text>
  28. <text class="conts">{{ item.eventTime}}</text>
  29. </view>
  30. <view class="">
  31. <view class="an-niu" @click.native="delClick(item.id)" link style="margin-left:3px">
  32. <text class="deletes">删除事件</text>
  33. </view>
  34. <view class="an-niu" @click.native="detailClick(item.id)" link style="margin-left:3px;">
  35. <text class="bianji details">查看详情</text>
  36. </view>
  37. <view class="an-niu" @click.native="editClick(item.id)" link style="margin-left:3px;">
  38. <text class="bianji">编辑事件</text>
  39. </view>
  40. </view>
  41. </uni-card>
  42. <view v-else style="text-align:center">
  43. 暂无数据
  44. </view>
  45. </view>
  46. </view>
  47. <view>
  48. <image :src="Group" @click="addClick" class="tiantupian"></image>
  49. </view>
  50. </view>
  51. </template>
  52. <script>
  53. import config from '@/config'
  54. import {
  55. getStationEvent,
  56. delMicrostation
  57. } from '@/api/fire_station/index';
  58. const baseUrlImg = config.baseUrlImg
  59. export default {
  60. data() {
  61. return {
  62. Group: `${baseUrlImg}/checkActive/Group.png`,
  63. endSingle: '', //结束时间
  64. startSingle: '', //开始时间
  65. list: [],
  66. queryParams: {
  67. pageNo: 1,
  68. pageSize: 5,
  69. eventTime: [],
  70. eventContent: null,
  71. microstationid:''
  72. },
  73. eventTimeString: '',
  74. // 总条数
  75. total: 0,
  76. runId:""
  77. }
  78. },
  79. onShow() {
  80. this.list = []
  81. this.getData()
  82. },
  83. onLoad: function(option) {
  84. this.runId=option.runId
  85. this.queryParams.microstationid=option.runId
  86. },
  87. methods: {
  88. getData() {
  89. if (this.queryParams.pageNo != 1) {
  90. this.queryParams.eventTime.push(this.startSingle, this.endSingle)
  91. }
  92. getStationEvent(this.queryParams).then(response => {
  93. this.list = [...this.list, ...response.data.list]
  94. this.total = response.data.total;
  95. this.queryParams.eventTime = []
  96. })
  97. },
  98. delClick(val) {
  99. let that = this
  100. uni.showModal({
  101. title: '确认删除',
  102. content: `是否确认删除?`,
  103. success: function(res) {
  104. if (res.confirm) {
  105. delMicrostation({
  106. id: val
  107. }).then(delres => {
  108. that.$modal.msg('删除成功')
  109. that.queryParams.pageNo = 1;
  110. that.list=[]
  111. that.getData()
  112. that.$forceUpdate()
  113. })
  114. // delRole(ids);
  115. } else if (res.cancel) {
  116. }
  117. }
  118. });
  119. },
  120. /** 搜索按钮操作 */
  121. handleQuery() {
  122. const end = new Date(this.endSingle).getTime()
  123. const start = new Date(this.startSingle).getTime()
  124. if (!this.endSingle && !this.startSingle) {
  125. this.queryParams.pageNo = 1;
  126. this.list = []
  127. this.getData();
  128. } else if (this.endSingle && this.startSingle && start <= end) {
  129. // } else{
  130. this.queryParams.pageNo = 1;
  131. this.queryParams.eventTime.push(this.startSingle, this.endSingle)
  132. this.list = []
  133. this.getData();
  134. } else if (start > end) {
  135. this.$modal.msgError('结束时间不能小于事件时间')
  136. } else {
  137. this.$modal.msgError('请选择事件时间和结束时间')
  138. }
  139. },
  140. startMaskClick(e) {
  141. },
  142. endMaskClick(e) {
  143. },
  144. addClick() {
  145. uni.navigateTo({
  146. url: `/pagesA/fire/add_fireRun/add_fireEvent/add_fireEvent?runId=${this.runId}`
  147. });
  148. },
  149. detailClick(val){
  150. uni.navigateTo({
  151. url: `/pagesA/fire/add_fireRun/add_fireEvent/add_fireEvent?id=${val}&runId=${this.runId}&isview=isview`
  152. });
  153. },
  154. editClick(val) {
  155. uni.navigateTo({
  156. url: `/pagesA/fire/add_fireRun/add_fireEvent/add_fireEvent?id=${val}&runId=${this.runId}`
  157. });
  158. }
  159. },
  160. // 触底的事件
  161. onReachBottom() {
  162. // 判断是否还有下一页数据
  163. if (this.queryParams.pageNo * this.queryParams.pageSize >= this.total)
  164. return uni.showToast({
  165. title: `数据加载完毕`
  166. });
  167. // 判断是否正在请求其它数据,如果是,则不发起额外的请求
  168. if (this.loading) return;
  169. this.queryParams.pageNo += 1;
  170. this.getData();
  171. },
  172. }
  173. </script>
  174. <style lang="scss" scoped>
  175. body {
  176. background-color: #f5f7f9;
  177. }
  178. page {
  179. background-color: #f5f7f9 !important;
  180. }
  181. .uni-container {
  182. height: 100vh;
  183. }
  184. .top {
  185. display: flex;
  186. align-items: center;
  187. width: 90%;
  188. margin-left: 5%;
  189. justify-content: space-between;
  190. .search-time {
  191. display: flex;
  192. align-items: center;
  193. margin-top: 40rpx;
  194. margin-bottom: 20rpx;
  195. .time-item {
  196. margin-right: 20rpx;
  197. }
  198. .time-item-check {}
  199. }
  200. .search-icon {}
  201. }
  202. .tiantupian {
  203. width: 110rpx;
  204. height: 110rpx;
  205. position: fixed;
  206. right: 15px;
  207. bottom: 40rpx;
  208. }
  209. /deep/.uni-card {
  210. box-shadow: 0px 0px 3px 0px rgba(86, 165, 168, 0.63) !important;
  211. border-radius: 30rpx;
  212. }
  213. .main {
  214. margin-left: 5%;
  215. margin-top: 30rpx;
  216. width: 90%;
  217. .main-item {
  218. display: flex;
  219. // justify-content: start;
  220. // justify-content: space-between;
  221. margin-bottom: 15rpx;
  222. color: #728f90;
  223. }
  224. }
  225. .an-niu {
  226. float: right;
  227. font-size: 10px;
  228. text-align: center;
  229. display: flex;
  230. color: #fff;
  231. .deletes,
  232. .bianji {
  233. width: 72px;
  234. height: 60rpx;
  235. border-radius: 30px;
  236. background-color: red;
  237. margin-right: 20rpx;
  238. margin-bottom: 20rpx;
  239. text-align: center;
  240. line-height: 60rpx;
  241. }
  242. .bianji {
  243. background-color: #4CB2B6
  244. }
  245. .details{
  246. background-color: #F7C41E
  247. }
  248. }
  249. /deep/.u-button--primary {
  250. border: 1px solid #fff;
  251. background-color: #fff !important;
  252. }
  253. </style>