index.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. <template>
  2. <view class="uni-column" style="padding: 24rpx">
  3. <view class="box-bg uni-row">
  4. <view class="input-view uni-row">
  5. <uni-icons class="input-uni-icon" type="search" size="18" color="#999" />
  6. <input class="nav-bar-input" type="text" v-model="keywords" placeholder="输入搜索关键词" />
  7. </view>
  8. <view class="search" @click="handleSearch">搜索</view>
  9. </view>
  10. <view v-if="listData.length == 0" style="color: #999;margin: 50% auto;">
  11. <text>暂无生产计划</text>
  12. </view>
  13. <view v-else style="height: calc(100% - 100rpx); overflow: auto;">
  14. <view v-for="(item, index) in listData" :key="index" @click="handleToBatchReporting(item)"
  15. class="list-item">
  16. <view class="title-container uni-row">
  17. <view class="title uni-row">
  18. <text class="label">生产计划单号</text>
  19. <text class="label code">{{ item['productionPlanNo'] }}</text>
  20. </view>
  21. <view v-if="item['dayWorkList'].length > 0" class="tag"><text class="label">进行中</text></view>
  22. <view v-else type="default" class="tag not-start"><text class="label">未开始</text></view>
  23. </view>
  24. <view class="item-info uni-row">
  25. <text class="label">产品描述</text>
  26. <text class="label right">{{ item['productDescription'] }}</text>
  27. </view>
  28. <view class="item-info uni-row">
  29. <text class="label">总批数</text>
  30. <text class="label right">{{ item['totalLotNumber'] }}</text>
  31. </view>
  32. <!-- <view class="item-info uni-row">
  33. <text class="label">完成批数</text>
  34. <text class="label right">{{ item['equiment'] }}</text>
  35. </view> -->
  36. <view class="item-info uni-row">
  37. <text class="label">投产数</text>
  38. <text class="label right">{{ item['productionQuantity'] }}</text>
  39. </view>
  40. <view class="item-info uni-row">
  41. <text class="label">单批量</text>
  42. <text class="label right">{{ item['oneLotQuantity'] }}</text>
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. </template>
  48. <script setup>
  49. import {
  50. getPlanDetailsList
  51. } from '@/api/business/planDetails.js'
  52. import {
  53. ref
  54. } from 'vue'
  55. import {
  56. onReady,
  57. onLoad,
  58. onUnload,
  59. onPullDownRefresh,
  60. onShow
  61. } from '@dcloudio/uni-app'
  62. import {
  63. getToken
  64. } from '@/utils/auth'
  65. import {
  66. store
  67. } from '@/store/index.js'
  68. import {
  69. getUserProcess
  70. } from '@/api/process/process.js'
  71. const listData = ref([])
  72. const keywords = ref('')
  73. onLoad(() => {
  74. // dayworkItem数据更改后刷新数据
  75. // uni.$on('dayworkItemUpdate', reflush);
  76. })
  77. onShow(() => {
  78. reflush();
  79. })
  80. onUnload(() => {
  81. console.log(store.curDeptDetails)
  82. // uni.$off('dayworkItemUpdate', reflush)
  83. })
  84. /**
  85. * 监听下拉刷新
  86. */
  87. onPullDownRefresh(() => {
  88. uni.stopPullDownRefresh();
  89. reflush();
  90. // getPlanDetailsList({
  91. // deptId: Number(store.curDeptDetails.deptId),
  92. // keywords: keywords.value
  93. // }).then(res => {
  94. // if (res.code == 200) {
  95. // listData.value = res.data;
  96. // uni.stopPullDownRefresh();
  97. // }
  98. // uni.stopPullDownRefresh();
  99. // })
  100. })
  101. function reflush() {
  102. init();
  103. }
  104. function init(data) {
  105. uni.showLoading({
  106. title: '加载中'
  107. });
  108. getPlanDetailsList({
  109. deptId: Number(store.curDeptDetails.deptId),
  110. keywords: keywords.value
  111. }).then(res => {
  112. if (res.code == 200) {
  113. listData.value = res.data;
  114. uni.hideLoading();
  115. }
  116. uni.hideLoading();
  117. })
  118. }
  119. function handleToBatchReporting(item) {
  120. store.planDetails = item
  121. uni.navigateTo({
  122. url: '/pages/sortBatchReporting/index'
  123. })
  124. }
  125. function handleSearch() {
  126. let reqParam = {
  127. keywords: keywords.value
  128. }
  129. reqParam.tenantId = !store.tenantId ? store.userInfo.tenantId : store.tenantId;
  130. init(reqParam)
  131. }
  132. </script>
  133. <style lang="scss">
  134. $nav-height: 60rpx;
  135. .box-bg {
  136. width: 100%;
  137. background-color: #F5F5F5;
  138. padding: 5rpx 0;
  139. justify-content: space-around;
  140. align-items: center;
  141. .input-view {
  142. width: 100%;
  143. flex: 4;
  144. background-color: #f8f8f8;
  145. height: $nav-height;
  146. border: 1rpx solid #999;
  147. border-radius: 15rpx;
  148. padding: 0 15rpx;
  149. flex-wrap: nowrap;
  150. margin: 0 10rpx 20rpx;
  151. line-height: $nav-height;
  152. .input-uni-icon {
  153. line-height: $nav-height;
  154. }
  155. .nav-bar-input {
  156. width: 80%;
  157. height: $nav-height;
  158. line-height: $nav-height;
  159. padding: 0 5rpx;
  160. background-color: #f8f8f8;
  161. }
  162. }
  163. .search {
  164. width: 20%;
  165. text-align: center;
  166. color: #808080;
  167. margin-top: -20rpx;
  168. }
  169. }
  170. .uni-column {
  171. background-color: rgba(245, 245, 245, 1);
  172. height: calc(100% - 40rpx);
  173. }
  174. .list-item {
  175. background-color: #fff;
  176. position: relative;
  177. padding: 16rpx;
  178. padding-bottom: 24rpx;
  179. border-radius: 24rpx;
  180. margin-bottom: 24rpx;
  181. .title-container {
  182. justify-content: space-between;
  183. margin-top: 8rpx;
  184. margin-bottom: 16rpx;
  185. .title {
  186. height: 48rpx;
  187. align-items: center;
  188. .label {
  189. font-size: 32rpx;
  190. font-weight: bold;
  191. &.code {
  192. margin-left: 8rpx;
  193. }
  194. }
  195. }
  196. .tag {
  197. border: 1px solid #1ce5b0;
  198. background-color: #f6fffd;
  199. padding: 8rpx;
  200. border-radius: 8rpx;
  201. .label {
  202. color: #1ce5b0;
  203. font-size: 24rpx;
  204. }
  205. &.not-start {
  206. border: 1px solid #bbbbbb;
  207. background-color: #f5f5f5;
  208. .label {
  209. color: #bbbbbb;
  210. }
  211. }
  212. }
  213. }
  214. .item-info {
  215. margin-bottom: 8rpx;
  216. .label {
  217. font-size: 28rpx;
  218. width: 220rpx;
  219. color: #808080;
  220. &.right {
  221. flex: 1;
  222. color: #000000;
  223. }
  224. }
  225. }
  226. }
  227. </style>