index.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. <template>
  2. <view class="danger-wrap" >
  3. <view class="search-wrap">
  4. <uni-easyinput v-model="queryConditions.keywords"
  5. suffixIcon="search"
  6. @confirm="search"
  7. @iconClick="search"
  8. placeholder="请输入隐患名称/关键字" trim />
  9. </view>
  10. <view class="tab-wrap">
  11. <view class="tab-item" @click="changeStatus('1')"
  12. :class="tabIndex==='1'?'active':''">
  13. <text>我发起的</text>
  14. </view>
  15. <view class="tab-item" @click="changeStatus('2')"
  16. :class="tabIndex==='2'?'active':''">
  17. <text>待处理</text>
  18. </view>
  19. <view class="tab-item" @click="changeStatus('3')"
  20. :class="tabIndex==='3'?'active':''">
  21. <text>已处理</text>
  22. </view>
  23. <view class="tab-item" @click="changeStatus('4')"
  24. :class="tabIndex==='4'?'active':''">
  25. <text>已撤销</text>
  26. </view>
  27. </view>
  28. <view class="search-cont">
  29. <roll-load :total="queryConditions.total"
  30. :size="queryConditions.limit"
  31. :topBt="{show:false}"
  32. @lower="lower"
  33. ref="roll-load" styles="height:calc(100vh - 99rpx )">
  34. <template v-slot:cont>
  35. <block></block>
  36. <uni-list>
  37. <uni-list-item v-for="(item,index) in dataList"
  38. :key='item.dangerId'
  39. :title="item.dangerTitle"
  40. :thumb="item.scenePhoto?item.scenePhoto:'userThumb'"
  41. :note="getDesc(item)" thumb-size="lg"
  42. :rightText="item.taskInsTitle"
  43. :clickable=true @click="showDetailInfo(item)" showArrow>
  44. </uni-list-item>
  45. </uni-list>
  46. </template>
  47. </roll-load>
  48. </view>
  49. </view>
  50. </template>
  51. <script>
  52. import RollLoad from '@/components/RollLoad/index.vue';
  53. import userThumb from '@/static/tabBar/mine.png';
  54. import { getMyHandlingDangerInsByPage } from '@/api/danger.js';
  55. export default {
  56. components: {
  57. RollLoad
  58. },
  59. data() {
  60. return {
  61. userThumb,
  62. scrollTop: 0,
  63. tabIndex:"1",
  64. old: {
  65. scrollTop: 0
  66. },
  67. pageNumber: 1,
  68. items: [],
  69. dataList: [],
  70. queryConditions: {
  71. page: 1,
  72. limit: 10,
  73. total: 0,
  74. keywords: ''
  75. }
  76. }
  77. },
  78. onShow() {
  79. this.getList();
  80. },
  81. onPullDownRefresh() {
  82. console.log('refresh');
  83. setTimeout(function() {
  84. uni.stopPullDownRefresh();
  85. }, 1000);
  86. },
  87. methods: {
  88. //跳转隐患详情页面
  89. showDetailInfo(item) {
  90. uni.navigateTo({
  91. url: `/views/danger/detail?id=${item.dangerId}&type=${item.formCode}`
  92. });
  93. },
  94. lower: function(e) {
  95. if (e.status) {
  96. this.queryConditions.page = e.pageNumber
  97. this.getList();
  98. }
  99. },
  100. scroll: function(e) {
  101. console.log(e.detail.scrollTop)
  102. this.old.scrollTop = e.detail.scrollTop
  103. },
  104. //数据请求分页列表
  105. getList() {
  106. //
  107. let accountInfo=uni.getStorageSync('accountInfo');
  108. let queryConditions=Object.assign(this.queryConditions);
  109. delete queryConditions.total;
  110. /*
  111. status--[1]待处理
  112. status--[-1]已撤销
  113. 不传--已处理
  114. */
  115. let tabIndex=this.tabIndex;
  116. if(accountInfo){//登录状态可以换取到用户id
  117. accountInfo=JSON.parse(accountInfo);
  118. let userId=accountInfo.userId;
  119. if(tabIndex==='1'){
  120. //我发起的
  121. userId={
  122. submitAccountId:userId
  123. }
  124. }else if(tabIndex==='2'||tabIndex==='3'||tabIndex==='4'){
  125. //我参与的
  126. if(tabIndex==='2'){
  127. userId={
  128. taskInsAccountId:userId,
  129. status:'1'
  130. }
  131. }else if(tabIndex==='3'){
  132. userId={
  133. handleAccountId:userId
  134. }
  135. }else{
  136. userId={
  137. submitAccountId:userId,
  138. status:'-1'
  139. }
  140. }
  141. }
  142. queryConditions={...queryConditions,...userId}
  143. }
  144. getMyHandlingDangerInsByPage(queryConditions).then((res) => {
  145. this.totalPage = Math.ceil(res.count / res.limit);
  146. this.dataList = res.data
  147. })
  148. },
  149. search(){
  150. this.getList();
  151. },
  152. changeStatus(status){
  153. this.tabIndex=status;
  154. this.queryConditions.keywords="";
  155. this.getList();
  156. },
  157. getDesc(item) {
  158. let lecel = item.dangerLevel == 1 ? "一般" : "重大";
  159. let dangerCatTitle=item.dangerCatTitle;
  160. let desc=`类别: ${dangerCatTitle};等级:${lecel};描述${item.dangerDesc}`
  161. return desc;
  162. }
  163. }
  164. }
  165. </script>
  166. <style lang="scss" scoped>
  167. .danger-wrap{
  168. background-color: #fff;
  169. position: relative;
  170. .tab-wrap{
  171. display: flex;
  172. justify-content: space-around;
  173. align-items: center;
  174. .tab-item{
  175. width: 25%;
  176. height: 70upx;
  177. text-align: center;
  178. line-height: 70upx;
  179. cursor: pointer;
  180. &.active{
  181. background-color: #0081FF;
  182. color: #fff;
  183. transition: 0.3s;
  184. }
  185. }
  186. }
  187. .list {
  188. padding: 10upx 10upx;
  189. .item {
  190. border: 1px solid #ccc;
  191. margin-bottom: 10upx;
  192. padding: 5upx 5upx;
  193. border: 2px solid #dedede;
  194. border-radius: 15upx;
  195. box-shadow: 2px 2px 2px #aaaaaa;
  196. position: relative;
  197. .title {
  198. display: flex;
  199. justify-content: flex-start;
  200. padding-bottom: 10upx;
  201. .name {
  202. font-size: 30upx;
  203. padding-left: 10upx;
  204. }
  205. }
  206. .cont {
  207. color: #999999;
  208. }
  209. .more {
  210. height: 40upx;
  211. position: absolute;
  212. right: 10upx;
  213. top: 50%;
  214. transform: translateY(-50%);
  215. display: flex;
  216. justify-content: center;
  217. align-items: center;
  218. .icon {
  219. width: 20upx;
  220. height: 20upx;
  221. background-color: red;
  222. padding-right: 10aaupx;
  223. }
  224. }
  225. }
  226. }
  227. }
  228. </style>