powerCut.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. <template>
  2. <view class="processWrapper ">
  3. <view style="height:196rpx"></view>
  4. <view class="ding">
  5. <scroll-view scroll-x class="bg-white nav text-center">
  6. <view class="cu-item" :class="index==TabCur?'text-blue cur':''" v-for="(item,index) in tabNav"
  7. :key="index" @tap="tabSelect" :data-id="index">
  8. <view v-if="TabCur==index" class="cu-tag badge">
  9. <block class="cu-tag badge">{{TabCur? unporcessList.length:porcessedList.length}} </block>
  10. </view>
  11. {{item}}
  12. </view>
  13. </scroll-view>
  14. <!-- 筛选框start -->
  15. <view class="cu-bar search bg-gray filter-section">
  16. <view class="search-form round bg-white">
  17. <text class="cuIcon-search"></text>
  18. <input class="" type="text" placeholder="请输入站点名称" confirm-type="search"></input>
  19. </view>
  20. <view class="action">
  21. <button class="cu-btn bg-blue round" @click="searchSiteList">查询</button>
  22. </view>
  23. </view>
  24. <!-- 筛选框end -->
  25. </view>
  26. <!-- 未执行 -->
  27. <block v-if="TabCur==0">
  28. <view>
  29. <view class="cu-list menu-avatar">
  30. <view class="cu-item" :class="modalName=='move-box-'+ index?'move-cur':''"
  31. @touchstart="ListTouchStart" @touchmove="ListTouchMove" @touchend="ListTouchEnd"
  32. :data-target="'move-box-' + index" v-for="(item,index) in unporcessList" :key="index"
  33. @tap="goDetail()">
  34. <view class="cu-avatar lg" style="background-image:url(../../../static/unprocessIcon.png);">
  35. </view>
  36. <view class="content">
  37. <view class="pro-title">
  38. <view class="cut">{{item.title}}</view>
  39. </view>
  40. <view class="pro-date ">{{item.time}}</view>
  41. </view>
  42. <view class="action" style="z-index:99">
  43. <view class="unProcess" @tap="goUnprocessDetail(item.id)">未执行</view>
  44. </view>
  45. <view class="move">
  46. <view class="bg-grey" @click.stop="editItem(item)">编辑</view>
  47. <view class="bg-red" @click.stop="deleteItem(item)">删除</view>
  48. </view>
  49. </view>
  50. <view class=" text-center margin-top" v-if="unporcessList.length === 0">暂无数据...</view>
  51. </view>
  52. </view>
  53. </block>
  54. <!-- 执行中 -->
  55. <block v-if="TabCur==1">
  56. <view style=" height: calc(100vh - 400rpx);overflow: scroll;">
  57. <view class="cu-list menu-avatar ">
  58. <view class="cu-item" :class="modalName=='move-box-'+ index?'move-cur':''"
  59. @touchstart="ListTouchStart" @touchmove="ListTouchMove" @touchend="ListTouchEnd"
  60. :data-target="'move-box-' + index" v-for="(item,index) in porcessedList" :key="index"
  61. @tap="goDetail()">
  62. <view class="cu-avatar lg" style="background-image:url(../../../static/processingIcon.png);">
  63. </view>
  64. <view class="content">
  65. <view class="pro-title">
  66. <view class="cut">{{item.title}}</view>
  67. </view>
  68. <view class="pro-date ">{{item.time}}</view>
  69. </view>
  70. <view class="action" style="z-index:99">
  71. <view class="processing" @tap="goProcessedDetail(item.id)">执行中</view>
  72. </view>
  73. <view class="move">
  74. <view class="bg-grey" @click.stop="editItem(item)">编辑</view>
  75. <view class="bg-red" @click.stop="deleteItem(item)">删除</view>
  76. </view>
  77. </view>
  78. <view class="text-center margin-top" v-if="porcessedList.length === 0">暂无数据...</view>
  79. </view>
  80. </view>
  81. </block>
  82. <!-- 已执行 -->
  83. <block v-if="TabCur==2">
  84. <view style=" height: calc(100vh - 400rpx);overflow: scroll;">
  85. <view class="cu-list menu-avatar ">
  86. <view class="cu-item" v-for="(item,index) in porcessedList" :key="index" @tap="goDetail()">
  87. <view class="cu-avatar lg" style="background-image:url(../../../static/processedIcon.png);">
  88. </view>
  89. <view class="content">
  90. <view class="pro-title">
  91. <view class="cut">{{item.title}}</view>
  92. </view>
  93. <view class="pro-date ">{{item.time}}</view>
  94. </view>
  95. <view class="action" style="z-index:99">
  96. <view class="processed" @tap="goProcessedDetail(item.id)">已执行</view>
  97. </view>
  98. </view>
  99. <view class="text-center margin-top" v-if="porcessedList.length === 0">暂无数据...</view>
  100. </view>
  101. </view>
  102. </block>
  103. <!-- 新增按钮start -->
  104. <view class="plus">
  105. <image src="../../../static/plus.png" style="width:125rpx;height:125rpx" @tap="goAddPage()"></image>
  106. </view>
  107. <!-- 新增按钮end -->
  108. </view>
  109. </template>
  110. <script>
  111. import json from '../../../data/json.js';
  112. export default {
  113. data() {
  114. return {
  115. modalName: null,
  116. listTouchStart: 0,
  117. listTouchDirection: null,
  118. unporcessList: json.inspectUnprocessList,
  119. porcessedList: json.inspectProcessedList,
  120. type: '0',
  121. CustomBar: this.CustomBar,
  122. TabCur: 0,
  123. tabNav: ['未执行', '执行中', '已执行', ],
  124. };
  125. },
  126. onLoad: function(option) {},
  127. onNavigationBarButtonTap(e) {
  128. console.log(e)
  129. uni.navigateTo({
  130. url: '/pages/export/export',
  131. success: res => {},
  132. fail: () => {},
  133. complete: () => {}
  134. });
  135. },
  136. methods: {
  137. tabSelect(e) {
  138. console.log(e.currentTarget);
  139. this.TabCur = e.currentTarget.dataset.id;
  140. this.scrollLeft = (e.currentTarget.dataset.id - 1) * 60;
  141. this.modalName=null
  142. },
  143. goAddPage(id) {
  144. uni.navigateTo({
  145. url: '/pages/eleControl/powerCut/powerCutAdd/powerCutAdd',
  146. });
  147. },
  148. goDetail() {
  149. uni.navigateTo({
  150. url: '/pages/eleControl/powerCut/powerCutDetail/powerCutDetail',
  151. });
  152. },
  153. // ListTouch触摸开始
  154. ListTouchStart(e) {
  155. this.listTouchStart = e.touches[0].pageX;
  156. },
  157. // ListTouch计算方向
  158. ListTouchMove(e) {
  159. this.listTouchDirection = e.touches[0].pageX - this.listTouchStart < -80 ? 'left' : 'right'
  160. },
  161. // ListTouch计算滚动
  162. ListTouchEnd(e) {
  163. if (this.listTouchDirection == 'left') {
  164. this.modalName = e.currentTarget.dataset.target
  165. } else {
  166. this.modalName = null
  167. }
  168. this.listTouchDirection = null
  169. }
  170. }
  171. }
  172. </script>
  173. <style lang="scss">
  174. //已处理未处理消息个数样式
  175. .cu-list.menu-avatar .cu-item {
  176. height: 89px;
  177. }
  178. .nav .cu-item.cur {
  179. position: relative;
  180. border-bottom: 8rpx solid;
  181. }
  182. .cu-tag.badge {
  183. top: 14rpx;
  184. right: 42rpx;
  185. }
  186. .nav .cu-item {
  187. width: 33.333%;
  188. margin: 0;
  189. .text-blue,
  190. .line-blue,
  191. .lines-blue {
  192. color: #4274E7
  193. }
  194. }
  195. </style>