running.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. <template>
  2. <view>
  3. <my-add-button
  4. @handleClick="addChange"
  5. :is-batch="true"
  6. :button-list="addButtonList"
  7. />
  8. <my-page
  9. :loadData="loadData"
  10. :swipe-action="true"
  11. @rowClick="handleDetail"
  12. :row-show-params="{ sbUseTypeMap }"
  13. :page-size="10"
  14. ref="myPage"
  15. >
  16. <template #pageRow="{ recordModel, rowShowParams }">
  17. <view
  18. class="mx3 my2 p3 bg-color-white box p-relative"
  19. @longpress="showMask(recordModel.id,$event)">
  20. <common-mask
  21. :item="recordModel"
  22. :is-edit="true"
  23. :maskId="maskId"
  24. @hide="maskId = 0"
  25. @edit="handleEdit(recordModel)"
  26. @del="handleDel(recordModel)" />
  27. <view class="d-flex j-between border-bottom pb-2 a-center">
  28. <view class="text-color-b f-size-26">{{
  29. rowShowParams.sbUseTypeMap[recordModel.sbModelUseType]
  30. }}</view>
  31. <view class="f-size-24 state-orange">{{
  32. recordModel.updateTime
  33. }}</view>
  34. </view>
  35. <view class="mt-2 d-flex j-between">
  36. <view class="text-color-3 f-size-32 f-weight-bold">{{
  37. recordModel.sbName || ''
  38. }}</view>
  39. <view class="text-color-3 f-size-32 f-weight-bold">{{
  40. recordModel.zbh || ''
  41. }}</view>
  42. </view>
  43. <view class="mt-2 d-flex j-between">
  44. <view class="f-size-26 text-color-6 f-weight-4 mt-2">
  45. {{ recordModel.sbNo||'' }}
  46. </view>
  47. <view class="f-size-26 text-color-6 f-weight-4 mt-2 pr-3">
  48. {{ recordModel.fillDate || '' }}
  49. </view>
  50. </view>
  51. </view>
  52. </template>
  53. </my-page>
  54. </view>
  55. </template>
  56. <script>
  57. export default {
  58. data() {
  59. return {
  60. sbUseTypeMap: {},
  61. maskId: 0,
  62. addButtonList: [
  63. {
  64. text: '扫码',
  65. index: 0
  66. },
  67. {
  68. text: '新增',
  69. index: 1
  70. },
  71. {
  72. text: '批量复制',
  73. index: 2
  74. },
  75. {
  76. text: '批量修改',
  77. index: 3
  78. }
  79. ]
  80. };
  81. },
  82. onPullDownRefresh() {
  83. this.$refs.myPage.pagePullDownRefresh();
  84. },
  85. onReachBottom() {
  86. this.$refs.myPage.pageReachBottom();
  87. },
  88. onLoad() {
  89. this.sbUseTypeMap = this.$DictCache.getLabelByValueMapByType(
  90. this.$DictCache.TYPE.SB_USE_TYPE
  91. );
  92. this.$nextTick(() => {
  93. this.$refs.myPage.initPage();
  94. });
  95. },
  96. onHide() {
  97. this.maskId = 0
  98. },
  99. methods: {
  100. addChange(select) {
  101. const index = select.index
  102. if (index === 0) {
  103. uni.scanCode({
  104. success(e) {
  105. console.log(e.result);
  106. if (e.result) {
  107. uni.navigateTo({
  108. url: '/pages/running/running-edit?sbId=' + e.result
  109. });
  110. }
  111. }
  112. });
  113. } else if (index === 1) {
  114. uni.navigateTo({
  115. url: '/pages/running/running-edit'
  116. });
  117. } else if (index === 2) {
  118. this.$Http
  119. .copySbRunFill({})
  120. .then((res) => {
  121. this.$refs.myPage.pagePullDownRefresh();
  122. });
  123. } else {
  124. uni.navigateTo({
  125. url: '/pages/running/running-batch-select'
  126. });
  127. }
  128. },
  129. showMask(id, e) {
  130. this.maskId = id
  131. // #ifdef H5
  132. e.preventDefault()
  133. // #endif
  134. },
  135. loadData(parameter) {
  136. return this.$Http
  137. .getSbRunFillPage({
  138. ...parameter,
  139. filter: 1
  140. })
  141. .then((res) => {
  142. return res.data;
  143. });
  144. },
  145. handleEdit(item) {
  146. uni.navigateTo({
  147. url: '/pages/running/running-edit?id=' + item.id
  148. });
  149. },
  150. // 删除
  151. handleDel(item) {
  152. const that = this;
  153. const params = [];
  154. params.push(item.id);
  155. uni.showModal({
  156. title: '提示',
  157. content: '您确认删除吗?',
  158. success: (res) => {
  159. if (res.confirm) {
  160. this.$Http.deleteSbRunFills(params).then((res) => {
  161. uni.showToast({ title: '删除成功' });
  162. that.$refs.myPage.listData = [];
  163. that.$refs.myPage.loadMore = true;
  164. that.$refs.myPage.pageNum = 1;
  165. that.$refs.myPage.initData();
  166. });
  167. } else if (res.cancel) {
  168. }
  169. }
  170. });
  171. },
  172. // 跳转详情
  173. handleDetail(item) {
  174. if (this.maskId !== 0) {
  175. this.maskId = 0
  176. return
  177. }
  178. uni.navigateTo({
  179. url: '/pages/running/running-detail?id=' + item.id
  180. });
  181. }
  182. }
  183. };
  184. </script>
  185. <style lang="less">
  186. page {
  187. background-color: #f4f4f4;
  188. }
  189. .box {
  190. padding-right: 0;
  191. border-radius: 20rpx;
  192. }
  193. .p-top8 {
  194. padding-top: 0rpx;
  195. }
  196. </style>