list.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <template>
  2. <view>
  3. <scroll-view :scroll-y="true">
  4. <view class="cu-bar bg-white solid-bottom">
  5. <view class="action">
  6. <text class="cuIcon-title text-orange "></text> 建档列表
  7. </view>
  8. <view class="action">
  9. <button class="cu-btn bg-blue shadow" @click="addClick">新增</button>
  10. </view>
  11. </view>
  12. <scroll-view scroll-x class="bg-white nav">
  13. <view class="flex text-center">
  14. <view class="cu-item flex-sub" :class="index==TabCur?'text-orange cur':''" v-for="(item,index) in tabs"
  15. :key="index" @tap="tabSelect" :data-id="index">
  16. {{item.name}}
  17. </view>
  18. </view>
  19. </scroll-view>
  20. <view class="cu-list menu card-menu margin-top">
  21. <view class="cu-item" :class="modalName=='move-box-'+ index?'move-cur':''" @touchstart="ListTouchStart"
  22. @touchmove="ListTouchMove" @touchend="ListTouchEnd" :data-target="'move-box-' + index"
  23. style="margin-top: 10rpx;" v-for="(item,index) in filingList" :key="index">
  24. <view class="content" @click="editFiling(item)">
  25. <view class="cu-form-group">
  26. <view class="title" style="min-width: calc(6em + 15px);">制衣生产车间</view>
  27. <text class="text-grey" style="flex: 1;">{{item.workshop.zyProductWorkshop}}</text>
  28. </view>
  29. <view class="cu-form-group">
  30. <view class="title" style="min-width: calc(6em + 15px);">制衣班组</view>
  31. <text class="text-grey" style="flex: 1;">{{item.team.zyTeam}}</text>
  32. </view>
  33. <view class="cu-form-group">
  34. <view class="title" style="min-width: calc(6em + 15px);">订单号</view>
  35. <text class="text-grey" style="flex: 1;">{{item.orderNo}}</text>
  36. </view>
  37. <view class="cu-form-group">
  38. <view class="title" style="min-width: calc(6em + 15px);">交期</view>
  39. <text class="text-grey" style="flex: 1;">{{item.deliveryDate}}</text>
  40. </view>
  41. <view class="cu-form-group">
  42. <view class="title" style="min-width: calc(6em + 15px);">建档时间</view>
  43. <text class="text-grey" style="flex: 1;">{{item.filingDate}}</text>
  44. </view>
  45. </view>
  46. <view class="move">
  47. <view class="bg-grey" @click="editFiling(item)">修改</view>
  48. <view class="bg-red" @click="deleteFiling(item)">删除</view>
  49. </view>
  50. </view>
  51. </view>
  52. <u-toast ref="uToast" />
  53. </scroll-view>
  54. </view>
  55. </template>
  56. <script>
  57. import {
  58. list,
  59. deleteFiling
  60. } from '@/api/biz/filing.js'
  61. export default {
  62. data() {
  63. return {
  64. filingList: [],
  65. modalName: null,
  66. tabs: [{
  67. key: 0,
  68. name: '未封存'
  69. },
  70. {
  71. key: 1,
  72. name: '封存'
  73. }
  74. ],
  75. TabCur: 0,
  76. }
  77. },
  78. methods: {
  79. addClick() {
  80. uni.navigateTo({
  81. url: '/pages/filing/index'
  82. })
  83. },
  84. // loadData() {
  85. // list().then(res => {
  86. // if (res.success) {
  87. // this.filingList = res.data
  88. // } else {}
  89. // })
  90. // },
  91. loadData(tabIndex){
  92. list(tabIndex).then(res => {
  93. if (res.success) {
  94. this.filingList = res.data
  95. } else {}
  96. })
  97. // if (tabIndex == 0) {
  98. // getRcvReport().then(res => {
  99. // if (res.success) {
  100. // this.reportData = res.data
  101. // }
  102. // })
  103. // } else if (tabIndex == 1) {
  104. // getBackReport().then(res => {
  105. // this.reportData = res.data
  106. // })
  107. // } else {
  108. // }
  109. },
  110. editFiling(item) {
  111. uni.navigateTo({
  112. url: '/pages/filing/edit?orderInfo=' + encodeURIComponent(JSON.stringify(item))
  113. })
  114. },
  115. // ListTouch触摸开始
  116. ListTouchStart(e) {
  117. this.listTouchStart = e.touches[0].pageX
  118. },
  119. // ListTouch计算方向
  120. ListTouchMove(e) {
  121. this.listTouchDirection = e.touches[0].pageX - this.listTouchStart > 0 ? 'right' : 'left'
  122. },
  123. // ListTouch计算滚动
  124. ListTouchEnd(e) {
  125. if (this.listTouchDirection == 'left') {
  126. this.modalName = e.currentTarget.dataset.target
  127. } else {
  128. this.modalName = null
  129. }
  130. this.listTouchDirection = null
  131. },
  132. deleteFiling(item) {
  133. const arr = []
  134. arr.push(item)
  135. deleteFiling(arr).then(res => {
  136. if (res.success) {
  137. this.removeFilingInfo(item)
  138. }else{
  139. this.$refs.uToast.show({
  140. type: 'error',
  141. message: res.message,
  142. iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/success.png'
  143. })
  144. }
  145. })
  146. },
  147. removeFilingInfo(item) {
  148. const index = this.filingList.findIndex(ele => {
  149. return ele.id == item.id
  150. })
  151. this.filingList.splice(index, 1)
  152. },
  153. tabSelect(e) {
  154. this.TabCur = e.currentTarget.dataset.id;
  155. this.loadData(this.TabCur)
  156. },
  157. },
  158. onLoad() {
  159. this.loadData(0)
  160. uni.$on('loadData', (data) => {
  161. this.TabCur = data;
  162. console.log("xiugai"+data)
  163. this.loadData(data);
  164. })
  165. }
  166. }
  167. </script>
  168. <style>
  169. .cu-form-group {
  170. min-height: 0;
  171. border: none;
  172. }
  173. </style>