index.vue 5.0 KB

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