powerCut.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  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 style=" height: calc(100vh - 400rpx);overflow: scroll;">
  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:100rpx;height:100rpx" @tap="goAddPage()"></image>
  106. </view>
  107. <!-- 新增按钮end -->
  108. </view>
  109. </template>
  110. <script>
  111. export default {
  112. data() {
  113. return {
  114. modalName: null,
  115. listTouchStart: 0,
  116. listTouchDirection: null,
  117. type: '0',
  118. CustomBar: this.CustomBar,
  119. TabCur: 0,
  120. tabNav: ['未执行', '执行中', '已执行', ],
  121. planListData:[],
  122. site_name:'',
  123. status_value:1
  124. };
  125. },
  126. onLoad: function(option) {
  127. this.getDataList({"status_value":1})
  128. },
  129. methods: {
  130. //编辑
  131. editItem(item) {
  132. uni.navigateTo({
  133. url: '/pages/eleControl/powerCut/powerCutAdd/powerCutAdd?id=' + item.id + '&status_value=' + this.status_value + '',
  134. });
  135. },
  136. //筛选
  137. searchSiteList() {
  138. this.getDataList({
  139. "site_name": this.site_name,
  140. "status_value":this.status_value
  141. })
  142. },
  143. //删除
  144. deleteItem(item) {
  145. uni.showModal({
  146. title: '确认删除吗?',
  147. content: '',
  148. success: function(result) {
  149. if (result.confirm) {
  150. this.setDelSite({
  151. "id": item.id
  152. })
  153. } else if (result.cancel) {
  154. // console.log('用户点击取消');
  155. }
  156. }.bind(this)
  157. });
  158. },
  159. async setDelSite(ming = {}) {
  160. const res = await this.$myRequest({
  161. url: 'BlackoutPlan/delBlackoutPlan',
  162. data: ming
  163. })
  164. if (!res.data.flag) {
  165. uni.showToast({
  166. title: "删除失败",
  167. icon: "none"
  168. });
  169. }else{
  170. uni.showToast({
  171. title: "删除成功",
  172. });
  173. setTimeout(() => {
  174. this.getDataList({
  175. "site_name": this.site_name,
  176. "status_value":this.status_value
  177. })
  178. }, 1000);
  179. }
  180. },
  181. //数据请求
  182. async getDataList(params = {}) {
  183. const res = await this.$myRequest({
  184. url: 'BlackoutPlan/getBlackoutPlanList',
  185. showLoading: true,
  186. data: params
  187. })
  188. console.log('res.data.data')
  189. console.log(res.data.data)
  190. this.planListData = res.data.data
  191. },
  192. tabSelect(e) {
  193. console.log(e.currentTarget);
  194. this.TabCur = e.currentTarget.dataset.id;
  195. // this.scrollLeft = (e.currentTarget.dataset.id - 1) * 60;
  196. this.status_value=e.currentTarget.dataset.status;
  197. this.modalName=null;
  198. this.getDataList({"status_value":e.currentTarget.dataset.status})
  199. },
  200. goAddPage(id) {
  201. uni.navigateTo({
  202. url: '/pages/eleControl/powerCut/powerCutAdd/powerCutAdd',
  203. });
  204. },
  205. goDetail(id) {
  206. uni.navigateTo({
  207. url: '/pages/eleControl/powerCut/powerCutDetail/powerCutDetail?id='+id+'&&status_value='+this.status_value,
  208. });
  209. },
  210. // ListTouch触摸开始
  211. ListTouchStart(e) {
  212. this.listTouchStart = e.touches[0].pageX;
  213. },
  214. // ListTouch计算方向
  215. ListTouchMove(e) {
  216. this.listTouchDirection = e.touches[0].pageX - this.listTouchStart < -80 ? 'left' : 'right'
  217. },
  218. // ListTouch计算滚动
  219. ListTouchEnd(e) {
  220. if (this.listTouchDirection == 'left') {
  221. this.modalName = e.currentTarget.dataset.target
  222. } else {
  223. this.modalName = null
  224. }
  225. this.listTouchDirection = null
  226. }
  227. }
  228. }
  229. </script>
  230. <style lang="scss">
  231. //已处理未处理消息个数样式
  232. .cu-list.menu-avatar .cu-item {
  233. height: 89px;
  234. }
  235. .nav .cu-item.cur {
  236. position: relative;
  237. border-bottom: 8rpx solid;
  238. }
  239. .cu-tag.badge {
  240. top: 14rpx;
  241. right: 42rpx;
  242. }
  243. .nav .cu-item {
  244. width: 33.333%;
  245. margin: 0;
  246. .text-blue,
  247. .line-blue,
  248. .lines-blue {
  249. color: #4274E7
  250. }
  251. }
  252. </style>