inspection.vue 6.4 KB

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