powerCut.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  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" :data-status="index+1">
  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" v-model="site_name"></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 planListData" :key="index"
  33. @tap="goDetail(item.id)">
  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.site_name}}</view>
  39. </view>
  40. <view class="pro-date ">{{item.start_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="planListData.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 planListData" :key="index"
  61. @tap="goDetail(item.id)">
  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.site_name}}</view>
  67. </view>
  68. <view class="pro-date ">{{item.start_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="planListData.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 planListData" :key="index" @tap="goDetail(item.id)">
  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.site_name}}</view>
  92. </view>
  93. <view class="pro-date ">{{item.start_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="planListData.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. planListData:[],
  125. site_name:'',
  126. status_value:1
  127. };
  128. },
  129. onLoad: function(option) {
  130. this.getDataList({"status_value":1})
  131. },
  132. methods: {
  133. //筛选
  134. searchSiteList() {
  135. this.getDataList({
  136. "site_name": this.site_name,
  137. "status_value":this.status_value
  138. })
  139. },
  140. //数据请求
  141. async getDataList(params = {}) {
  142. const res = await this.$myRequest({
  143. url: 'BlackoutPlan/getBlackoutPlanList',
  144. showLoading: true,
  145. data: params
  146. })
  147. console.log('res.data.data')
  148. console.log(res.data.data)
  149. this.planListData = res.data.data
  150. },
  151. tabSelect(e) {
  152. console.log(e.currentTarget);
  153. this.TabCur = e.currentTarget.dataset.id;
  154. // this.scrollLeft = (e.currentTarget.dataset.id - 1) * 60;
  155. this.status_value=e.currentTarget.dataset.status;
  156. this.modalName=null;
  157. this.getDataList({"status_value":e.currentTarget.dataset.status})
  158. },
  159. goAddPage(id) {
  160. uni.navigateTo({
  161. url: '/pages/eleControl/powerCut/powerCutAdd/powerCutAdd',
  162. });
  163. },
  164. goDetail(id) {
  165. uni.navigateTo({
  166. url: '/pages/eleControl/powerCut/powerCutDetail/powerCutDetail?id='+id+'&&status_value='+this.status_value,
  167. });
  168. },
  169. // ListTouch触摸开始
  170. ListTouchStart(e) {
  171. this.listTouchStart = e.touches[0].pageX;
  172. },
  173. // ListTouch计算方向
  174. ListTouchMove(e) {
  175. this.listTouchDirection = e.touches[0].pageX - this.listTouchStart < -80 ? 'left' : 'right'
  176. },
  177. // ListTouch计算滚动
  178. ListTouchEnd(e) {
  179. if (this.listTouchDirection == 'left') {
  180. this.modalName = e.currentTarget.dataset.target
  181. } else {
  182. this.modalName = null
  183. }
  184. this.listTouchDirection = null
  185. }
  186. }
  187. }
  188. </script>
  189. <style lang="scss">
  190. //已处理未处理消息个数样式
  191. .cu-list.menu-avatar .cu-item {
  192. height: 89px;
  193. }
  194. .nav .cu-item.cur {
  195. position: relative;
  196. border-bottom: 8rpx solid;
  197. }
  198. .cu-tag.badge {
  199. top: 14rpx;
  200. right: 42rpx;
  201. }
  202. .nav .cu-item {
  203. width: 33.333%;
  204. margin: 0;
  205. .text-blue,
  206. .line-blue,
  207. .lines-blue {
  208. color: #4274E7
  209. }
  210. }
  211. </style>