list.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. <template>
  2. <view class="mainBox">
  3. <uni-nav-bar fixed="true" statusBar="true" left-icon="back"
  4. :title="pageName=='myList'?'我的质检工单':pageName=='myInspectionProjectTask'?'我的质检任务单':pageName=='myInspectionProjectEntrusted'?'我的质检受托单':'质检工单'"
  5. @clickLeft="back">
  6. </uni-nav-bar>
  7. <view class="top-wrapper">
  8. <uni-section>
  9. <uni-easyinput prefixIcon="search" style="width: 460rpx" v-model="keyWord" placeholder="名称、批次号">
  10. </uni-easyinput>
  11. </uni-section>
  12. <button class="search_btn" @click="doSearch">搜索</button>
  13. </view>
  14. <div style="height:100rpx;width: 475rpx;"></div>
  15. <view class="wrapper">
  16. <u-list @scrolltolower="scrolltolower" class="listContent">
  17. <view v-for="(item, index) in tableList" :key="index+item.id" style="position: relative;">
  18. <view class="item">
  19. <view class="herder_item">
  20. <view class="herder_text"></view>
  21. <view class="herder_view">
  22. {{ getDictValue('质检计划类型', item.qualityType+'')}}/{{item.code}}/{{item.productCode}}/{{item.productName}}
  23. </view>
  24. </view>
  25. <view class="text">检验项目:</view>
  26. <view class="item_value">
  27. <view @click="goTo(item.id,row.id,item.sampleMeasureUnit)"
  28. v-for="(row,_index) in item.templateList" :key="item.inspectionName+index+'_'+_index"
  29. :style="{background:row.status==1?'#19be6b':row.status==2?'#ff9900':row.status==3?'#ff9900':'#909399'}">
  30. {{row.inspectionName}}
  31. </view>
  32. </view>
  33. </view>
  34. </view>
  35. <view style="width:100%;height:40rpx"></view>
  36. <view style='margin-top: 20vh;' v-if="tableList.length==0">
  37. <u-empty iconSize='150' textSize='32' text='暂无数据'>
  38. </u-empty>
  39. </view>
  40. </u-list>
  41. </view>
  42. <u-toast ref="uToast"></u-toast>
  43. </view>
  44. </template>
  45. <script>
  46. import dictMixns from '@/mixins/dictMixins'
  47. import {
  48. getList,
  49. getRequestentrustList,
  50. getTaskmonadList
  51. } from '@/api/inspectionWork/index.js'
  52. export default {
  53. components: {},
  54. mixins: [dictMixns],
  55. props: {
  56. pageName: {
  57. default: ""
  58. }
  59. },
  60. data() {
  61. return {
  62. tableList: [],
  63. page: 1,
  64. size: 10,
  65. isEnd: false,
  66. keyWord: '',
  67. userInfo: {}
  68. }
  69. },
  70. computed: {
  71. },
  72. created() {
  73. this.requestDict('质检计划类型')
  74. },
  75. methods: {
  76. successInit() {
  77. uni.showLoading({
  78. title: '加载中'
  79. })
  80. let data = {
  81. pageNum: 1,
  82. size: this.tableList.length,
  83. keyWord: this.keyWord,
  84. recordingMethod: 1,
  85. }
  86. if (this.pageName) {
  87. data.currentLoginUserId = this.userInfo.userId
  88. }
  89. if (this.pageName == 'myInspectionProjectEntrusted') {
  90. data.approvalStatus = 2
  91. }
  92. let api = this.pageName == 'myInspectionProjectTask' ? getTaskmonadList : this.pageName ==
  93. 'myInspectionProjectEntrusted' ? getRequestentrustList : getList
  94. api(data).then(res => {
  95. this.tableList = res.list
  96. }).then(() => {
  97. uni.hideLoading()
  98. })
  99. },
  100. doSearch() {
  101. this.isEnd = false
  102. this.page = 1
  103. this.getList()
  104. },
  105. //获取列表信息
  106. getList() {
  107. this.userInfo = uni.getStorageSync('userInfo')
  108. if (this.isEnd || !this.userInfo.userId) {
  109. return
  110. }
  111. uni.showLoading({
  112. title: '加载中'
  113. })
  114. let data = {
  115. pageNum: this.page,
  116. size: this.size,
  117. keyWord: this.keyWord,
  118. recordingMethod: 1,
  119. }
  120. if (this.pageName) {
  121. data.currentLoginUserId = this.userInfo.userId
  122. }
  123. if (this.pageName == 'myInspectionProjectEntrusted') {
  124. data.approvalStatus = 2
  125. }
  126. let api = this.pageName == 'myInspectionProjectTask' ? getTaskmonadList : this.pageName ==
  127. 'myInspectionProjectEntrusted' ? getRequestentrustList : getList
  128. api(data).then(res => {
  129. if (this.page === 1) {
  130. this.tableList = res.list
  131. } else {
  132. this.tableList.push(...res.list)
  133. }
  134. this.page += 1
  135. this.isEnd = this.tableList.length >= res.count
  136. }).then(() => {
  137. uni.hideLoading()
  138. })
  139. },
  140. goTo(workId, projectId, sampleMeasureUnit) {
  141. uni.navigateTo({
  142. url: '/pages/qms/inspectionWork/inspectionProjectReport?workId=' + workId + '&projectId=' +
  143. projectId + '&pageName=' + this.pageName + '&sampleMeasureUnit=' + sampleMeasureUnit
  144. })
  145. },
  146. scrolltolower() {
  147. if (this.isEnd) {
  148. return
  149. }
  150. this.getList();
  151. },
  152. }
  153. }
  154. </script>
  155. <style lang="scss" scoped>
  156. .mainBox {
  157. background-color: #f3f8fb
  158. }
  159. // .wrapper{
  160. // }
  161. .top-wrapper {
  162. background-color: #fff;
  163. display: flex;
  164. width: 750rpx;
  165. height: 88rpx;
  166. padding: 16rpx 32rpx;
  167. align-items: center;
  168. // gap: 16rpx;
  169. position: absolute;
  170. z-index: 999;
  171. // top: 44px;
  172. // // #ifdef APP-PLUS
  173. // top: 140rpx;
  174. // // #endif
  175. /deep/.uni-section {
  176. margin-top: 0px;
  177. }
  178. /deep/.uni-section-header {
  179. padding: 0px;
  180. }
  181. .search_btn {
  182. width: 120rpx;
  183. height: 70rpx;
  184. line-height: 70rpx;
  185. padding: 0 24rpx;
  186. background: $theme-color;
  187. font-size: 32rpx;
  188. color: #fff;
  189. margin: 0;
  190. margin-left: 26rpx;
  191. }
  192. .menu_icon {
  193. width: 44rpx;
  194. height: 44rpx;
  195. margin-left: 14rpx;
  196. }
  197. }
  198. .item {
  199. width: 720rpx;
  200. // height:400rpx;
  201. margin: 20rpx auto 0;
  202. padding: 26rpx;
  203. border-radius: 30rpx;
  204. .text {
  205. margin-top: 20rpx;
  206. }
  207. background: #fff;
  208. }
  209. .item_value {
  210. width: 100%;
  211. display: flex;
  212. flex-wrap: wrap;
  213. margin-left: -10rpx;
  214. >view {
  215. font-size: 24rpx;
  216. color: #fff;
  217. padding: 12rpx;
  218. border-radius: 10rpx;
  219. background: #979797;
  220. margin-left: 10rpx;
  221. margin-top: 20rpx;
  222. }
  223. }
  224. .herder_item {
  225. display: flex;
  226. // align-items: center;
  227. font-size: 28rpx;
  228. font-weight: bold;
  229. .herder_view {
  230. width: calc(100% - 20rpx);
  231. word-break: break-all;
  232. }
  233. .herder_text {
  234. min-width: 10rpx;
  235. height: 32rpx;
  236. border-radius: 10rpx;
  237. background: #00c0a1;
  238. margin-right: 12rpx;
  239. margin-top: 5rpx;
  240. }
  241. }
  242. </style>