siteArchive.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <template>
  2. <view class="site-wrapper">
  3. <!-- 筛选框start -->
  4. <view style="height:100rpx"></view>
  5. <view class="ding">
  6. <view class="cu-bar search bg-gray filter-section">
  7. <view class="search-form round bg-white">
  8. <text class="cuIcon-search"></text>
  9. <input class="" @focus="InputFocus" v-model="siteName" @blur="InputBlur" :adjust-position="false"
  10. type="text" placeholder="请输入站点" confirm-type="search"></input>
  11. </view>
  12. <view class="action">
  13. <button class="cu-btn bg-blue round" @click="searchData()">查询</button>
  14. </view>
  15. </view>
  16. </view>
  17. <!-- 筛选框end -->
  18. <view style="height: calc(100vh - 290rpx);overflow:scroll">
  19. <view class="cu-list menu-avatar">
  20. <view class="cu-item" :class="modalName=='move-box-'+ index?'move-cur':''"
  21. v-for="(item,index) in siteArchiveData" :key="index" :data-target="'move-box-' + index"
  22. @tap="goArchiveDetail(item.id)" @touchstart="ListTouchStart" @touchmove="ListTouchMove"
  23. @touchend="ListTouchEnd">
  24. <view class="cu-avatar round lg" style="background-image:url(../../../static/archiveIcon.png)">
  25. </view>
  26. <view class="content">
  27. <view class="pro-title">
  28. <view class="cut">{{item.site_name}} (现场档案)</view>
  29. </view>
  30. </view>
  31. <view class="nav-right num">
  32. <view class="text-grey">
  33. <text class="icon iconfont margin-right-sm margin-left-lg">&#xe629;</text>
  34. </view>
  35. </view>
  36. <view class="move" style="width: 66px;">
  37. <view class="bg-grey" @click.stop="editItem(item)">编辑</view>
  38. </view>
  39. </view>
  40. </view>
  41. </view>
  42. <!-- 新增按钮start -->
  43. <view class="plus">
  44. <image src="../../static/plus.png" style="width:100rpx;height:100rpx" @tap="goAddPage()"></image>
  45. </view>
  46. <!-- 新增按钮end -->
  47. </view>
  48. </template>
  49. <script>
  50. export default {
  51. data() {
  52. return {
  53. modalName: null,
  54. siteArchiveData: [],
  55. siteName: ''
  56. };
  57. },
  58. onLoad: function(option) {
  59. this.getDataList();
  60. },
  61. methods: {
  62. searchData() {
  63. this.getDataList({
  64. "site_name": this.siteName,
  65. })
  66. },
  67. InputFocus(e) {
  68. this.InputBottom = e.detail.height
  69. },
  70. InputBlur(e) {
  71. this.InputBottom = 0
  72. },
  73. //编辑
  74. editItem(item) {
  75. uni.navigateTo({
  76. url: '/pages/siteArchive/siteArchiveAdd/siteArchiveAdd?id=' + item.id + '',
  77. });
  78. },
  79. //数据请求
  80. async getDataList(params = {}) {
  81. const res = await this.$myRequest({
  82. url: 'Archives/getArchivesList',
  83. showLoading: true,
  84. data: params
  85. })
  86. console.log('res.data.data')
  87. console.log(res.data.data)
  88. this.siteArchiveData = res.data.data
  89. },
  90. // 页面跳转
  91. goArchiveDetail(id) {
  92. uni.navigateTo({
  93. url: '/pages/siteArchive/archiveDetail/archiveDetail?id=' + id,
  94. });
  95. },
  96. goAddPage(item) {
  97. uni.navigateTo({
  98. url: '/pages/siteArchive/siteArchiveAdd/siteArchiveAdd',
  99. });
  100. },
  101. // ListTouch触摸开始
  102. ListTouchStart(e) {
  103. this.listTouchStart = e.touches[0].pageX
  104. },
  105. // ListTouch计算方向
  106. ListTouchMove(e) {
  107. this.listTouchDirection = e.touches[0].pageX - this.listTouchStart < -80 ? 'left' : 'right'
  108. },
  109. // ListTouch计算滚动
  110. ListTouchEnd(e) {
  111. if (this.listTouchDirection == 'left') {
  112. this.modalName = e.currentTarget.dataset.target
  113. } else {
  114. this.modalName = null
  115. }
  116. this.listTouchDirection = null
  117. }
  118. }
  119. }
  120. </script>
  121. <style lang="scss">
  122. .cu-item {
  123. height: 160rpx !important
  124. }
  125. .cu-list.menu-avatar>.cu-item .content {
  126. left: 110rpx;
  127. }
  128. .cu-list>.cu-item.move-cur {
  129. -webkit-transform: translateX(-66px);
  130. }
  131. </style>