index.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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-section>
  14. <uni-easyinput
  15. prefixIcon="search"
  16. style="width: 520rpx"
  17. v-model="searchFrom.keyWord"
  18. placeholder="请输入"
  19. >
  20. </uni-easyinput>
  21. </uni-section>
  22. <button class="search_btn" @click="doSearch">搜索</button>
  23. <!-- <image class="menu_icon" src="~@/static/pda/menu.svg"></image> -->
  24. </view>
  25. <view class="list_box">
  26. <u-list
  27. @scrolltolower="scrolltolower"
  28. key="list"
  29. :preLoadScreen="page * 10"
  30. >
  31. <u-list-item v-for="(item, index) in dataList" :key="index">
  32. <workCard
  33. :item="item"
  34. :index="index"
  35. @handleDetail="handleDetail"
  36. ></workCard>
  37. </u-list-item>
  38. <u-list-item v-if="dataList.length === 0">
  39. <view style="margin-top: 20vh">
  40. <u-empty iconSize="150" textSize="32" text="暂无工单"> </u-empty>
  41. </view>
  42. </u-list-item>
  43. </u-list>
  44. </view>
  45. </view>
  46. </template>
  47. <script>
  48. import workCard from "../components/workCard.vue";
  49. import { workorderPage } from "@/api/pda/workOrder.js";
  50. import { getOutsourceList } from "@/api/pda/outsourcing.js";
  51. let [isEnd] = [false];
  52. export default {
  53. components: {
  54. workCard,
  55. },
  56. data() {
  57. return {
  58. page: 1,
  59. size: 10,
  60. dataList: [],
  61. searchFrom: {
  62. keyWord: null,
  63. },
  64. };
  65. },
  66. onShow() {
  67. this.getList();
  68. },
  69. methods: {
  70. async getList() {
  71. let params = {
  72. pageNum: this.page,
  73. size: this.size,
  74. ...this.searchFrom,
  75. };
  76. isEnd = false;
  77. const res = await getOutsourceList(params);
  78. if (params.pageNum === 1) {
  79. this.dataList = [];
  80. }
  81. this.dataList.push(...res.list);
  82. isEnd = this.dataList.length >= res.count;
  83. },
  84. doSearch() {
  85. this.getList();
  86. },
  87. scrolltolower() {
  88. if (isEnd) return;
  89. this.page++;
  90. this.getList();
  91. },
  92. handleDetail(item) {
  93. let url = "/pages/pda/outsourcing/components/outsourcingDetail";
  94. url += `?item=${JSON.stringify(item)}`;
  95. uni.navigateTo({
  96. url,
  97. });
  98. },
  99. },
  100. };
  101. </script>
  102. <style lang="scss" scoped>
  103. .content-box {
  104. height: 100vh;
  105. overflow: hidden;
  106. display: flex;
  107. flex-direction: column;
  108. background-color: $page-bg;
  109. }
  110. .top-wrapper {
  111. background-color: #fff;
  112. display: flex;
  113. width: 750rpx;
  114. height: 88rpx;
  115. padding: 16rpx 32rpx;
  116. align-items: center;
  117. gap: 16rpx;
  118. /deep/.uni-section {
  119. margin-top: 0px;
  120. }
  121. /deep/.uni-section-header {
  122. padding: 0px;
  123. }
  124. .search_btn {
  125. width: 120rpx;
  126. height: 70rpx;
  127. line-height: 70rpx;
  128. padding: 0 24rpx;
  129. background: $theme-color;
  130. font-size: 32rpx;
  131. color: #fff;
  132. margin: 0;
  133. margin-left: 26rpx;
  134. }
  135. .menu_icon {
  136. width: 44rpx;
  137. height: 44rpx;
  138. margin-left: 14rpx;
  139. }
  140. }
  141. .list_box {
  142. flex: 1;
  143. overflow: hidden;
  144. padding: 16rpx 0;
  145. .u-list {
  146. height: 100% !important;
  147. }
  148. }
  149. </style>