index.vue 5.3 KB

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