index.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. <template>
  2. <view class="content-box">
  3. <uni-nav-bar
  4. fixed="true"
  5. statusBar="true"
  6. left-icon="back"
  7. title="委外单"
  8. background-color="#157A2C"
  9. color="#fff"
  10. @clickLeft="back"
  11. ></uni-nav-bar>
  12. <view class="top-wrapper">
  13. <uni-easyinput
  14. prefixIcon="search"
  15. style="flex: 1"
  16. v-model="searchFrom.keyWord"
  17. placeholder="请输入型号、规格、批次号"
  18. ></uni-easyinput>
  19. <button class="search_btn" @click="doSearch">搜索</button>
  20. <button class="search_btn" @click="filterShow = true">筛选</button>
  21. </view>
  22. <view class="list_box">
  23. <u-list
  24. @scrolltolower="scrolltolower"
  25. key="list"
  26. :preLoadScreen="page * 10"
  27. >
  28. <u-list-item v-for="(item, index) in dataList" :key="index">
  29. <workCard
  30. :item="item"
  31. :index="index"
  32. @handleDetail="handleDetail"
  33. ></workCard>
  34. </u-list-item>
  35. <u-list-item v-if="dataList.length === 0">
  36. <view style="margin-top: 20vh">
  37. <u-empty iconSize="150" textSize="32" text="暂无工单"> </u-empty>
  38. </view>
  39. </u-list-item>
  40. </u-list>
  41. </view>
  42. <searchPopup
  43. :show="filterShow"
  44. @close="filterShow = false"
  45. @search="onFilterSearch"
  46. ></searchPopup>
  47. </view>
  48. </template>
  49. <script>
  50. import workCard from "../components/workCard.vue";
  51. import searchPopup from "../components/searchPopup.vue";
  52. import { workorderPage } from "@/api/pda/workOrder.js";
  53. import { getOutsourceList } from "@/api/pda/outsourcing.js";
  54. let [isEnd] = [false];
  55. export default {
  56. components: {
  57. workCard,
  58. searchPopup,
  59. },
  60. data() {
  61. return {
  62. page: 1,
  63. size: 10,
  64. dataList: [],
  65. filterShow: false,
  66. searchFrom: {
  67. keyWord: "",
  68. workOrderCode: "",
  69. name: "",
  70. code: "",
  71. },
  72. };
  73. },
  74. onShow() {
  75. this.getList();
  76. },
  77. methods: {
  78. async getList() {
  79. const params = {
  80. pageNum: this.page,
  81. size: this.size,
  82. ...this.searchFrom,
  83. };
  84. Object.keys(params).forEach((k) => {
  85. if (params[k] === "" || params[k] === null || params[k] === undefined) {
  86. delete params[k];
  87. }
  88. });
  89. isEnd = false;
  90. const res = await getOutsourceList(params);
  91. if (params.pageNum === 1) {
  92. this.dataList = [];
  93. }
  94. this.dataList.push(...res.list);
  95. isEnd = this.dataList.length >= res.count;
  96. },
  97. doSearch() {
  98. this.page = 1;
  99. this.getList();
  100. },
  101. onFilterSearch(e) {
  102. this.searchFrom = { ...this.searchFrom, ...e };
  103. this.doSearch();
  104. },
  105. scrolltolower() {
  106. if (isEnd) return;
  107. this.page++;
  108. this.getList();
  109. },
  110. handleDetail(item) {
  111. let url = "/pages/pda/outsourcing/components/outsourcingDetail";
  112. url += `?item=${JSON.stringify(item)}`;
  113. uni.navigateTo({
  114. url,
  115. });
  116. },
  117. back() {
  118. uni.navigateBack();
  119. },
  120. },
  121. };
  122. </script>
  123. <style lang="scss" scoped>
  124. .content-box {
  125. height: 100vh;
  126. overflow: hidden;
  127. display: flex;
  128. flex-direction: column;
  129. background-color: $page-bg;
  130. }
  131. .top-wrapper {
  132. background-color: #fff;
  133. display: flex;
  134. align-items: center;
  135. padding: 20rpx 26rpx;
  136. gap: 20rpx;
  137. box-sizing: border-box;
  138. .search_btn {
  139. padding: 0 26rpx;
  140. height: 64rpx;
  141. line-height: 64rpx;
  142. background: $theme-color;
  143. color: #fff;
  144. border-radius: 8rpx;
  145. font-size: 26rpx;
  146. white-space: nowrap;
  147. margin: 0;
  148. }
  149. }
  150. .list_box {
  151. overflow: hidden;
  152. padding: 16rpx 0;
  153. .u-list {
  154. height: 100% !important;
  155. }
  156. }
  157. </style>