index.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  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. getPlanDetailsList({
  89. deptId: Number(store.curDeptDetails.deptId),
  90. keywords: keywords.value
  91. }).then(res => {
  92. if (res.code == 200) {
  93. listData.value = res.data;
  94. uni.stopPullDownRefresh();
  95. }
  96. uni.stopPullDownRefresh();
  97. })
  98. })
  99. function reflush() {
  100. init();
  101. }
  102. function init(data) {
  103. uni.showLoading({
  104. title: '加载中'
  105. });
  106. getPlanDetailsList({
  107. deptId: Number(store.curDeptDetails.deptId),
  108. keywords: keywords.value
  109. }).then(res => {
  110. if (res.code == 200) {
  111. listData.value = res.data;
  112. uni.hideLoading();
  113. }
  114. uni.hideLoading();
  115. })
  116. }
  117. function handleToBatchReporting(item) {
  118. store.planDetails = item
  119. uni.navigateTo({
  120. url: '/pages/batchReporting/index'
  121. })
  122. }
  123. function handleSearch() {
  124. let reqParam = {
  125. keywords: keywords.value
  126. }
  127. reqParam.tenantId = !store.tenantId ? store.userInfo.tenantId : store.tenantId;
  128. init(reqParam)
  129. }
  130. </script>
  131. <style lang="scss">
  132. $nav-height: 60rpx;
  133. .box-bg {
  134. width: 100%;
  135. background-color: #F5F5F5;
  136. padding: 5rpx 0;
  137. justify-content: space-around;
  138. align-items: center;
  139. .input-view {
  140. width: 100%;
  141. flex: 4;
  142. background-color: #f8f8f8;
  143. height: $nav-height;
  144. border: 1rpx solid #999;
  145. border-radius: 15rpx;
  146. padding: 0 15rpx;
  147. flex-wrap: nowrap;
  148. margin: 0 10rpx 20rpx;
  149. line-height: $nav-height;
  150. .input-uni-icon {
  151. line-height: $nav-height;
  152. }
  153. .nav-bar-input {
  154. width: 80%;
  155. height: $nav-height;
  156. line-height: $nav-height;
  157. padding: 0 5rpx;
  158. background-color: #f8f8f8;
  159. }
  160. }
  161. .search {
  162. width: 20%;
  163. text-align: center;
  164. color: #808080;
  165. margin-top: -20rpx;
  166. }
  167. }
  168. .uni-column {
  169. background-color: rgba(245, 245, 245, 1);
  170. height: calc(100% - 40rpx);
  171. }
  172. .list-item {
  173. background-color: #fff;
  174. position: relative;
  175. padding: 16rpx;
  176. padding-bottom: 24rpx;
  177. border-radius: 24rpx;
  178. margin-bottom: 24rpx;
  179. .title-container {
  180. justify-content: space-between;
  181. margin-top: 8rpx;
  182. margin-bottom: 16rpx;
  183. .title {
  184. height: 48rpx;
  185. align-items: center;
  186. .label {
  187. font-size: 32rpx;
  188. font-weight: bold;
  189. &.code {
  190. margin-left: 8rpx;
  191. }
  192. }
  193. }
  194. .tag {
  195. border: 1px solid #1ce5b0;
  196. background-color: #f6fffd;
  197. padding: 8rpx;
  198. border-radius: 8rpx;
  199. .label {
  200. color: #1ce5b0;
  201. font-size: 24rpx;
  202. }
  203. &.not-start {
  204. border: 1px solid #bbbbbb;
  205. background-color: #f5f5f5;
  206. .label {
  207. color: #bbbbbb;
  208. }
  209. }
  210. }
  211. }
  212. .item-info {
  213. margin-bottom: 8rpx;
  214. .label {
  215. font-size: 28rpx;
  216. width: 220rpx;
  217. color: #808080;
  218. &.right {
  219. flex: 1;
  220. color: #000000;
  221. }
  222. }
  223. }
  224. }
  225. </style>