index.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. <template>
  2. <view class="uni-column" style="height: 100%; background-color: #f5f5f5;">
  3. <scroll-view class="scroll-container" scroll-y>
  4. <view v-for="(item, index) in listData" :key="index" class="list-item" @click="handleToreportingForWork">
  5. <view class="title-container uni-row" style="justify-content: flex-start;">
  6. <view class="title uni-row">
  7. <text class="label">批次号:</text>
  8. <text class="label code">{{ curSubPlan['productionPlanNo'] }}</text>
  9. </view>
  10. <view class=" uni-row" style="margin-left: 16rpx;">
  11. <view v-if="item['status'] == 1" class="tag"><text class="label">进行中</text></view>
  12. <view v-else-if="item['status'] == 2" class="tag turnover "><text class="label">周转中</text>
  13. </view>
  14. <view v-else-if="item['status'] == 0" class="tag turnover "><text class="label">未开始</text>
  15. </view>
  16. <view v-else type="default" class="tag finished"><text class="label">已完成</text></view>
  17. </view>
  18. </view>
  19. <view class="item-info uni-row">
  20. <text class="label">箱号</text>
  21. <text class="label right">{{ item['caseNumber'] }}</text>
  22. </view>
  23. <view class="item-info uni-row">
  24. <text class="label">总工时</text>
  25. <text class="label right">{{ item['totalWorkingHours']}}h</text>
  26. </view>
  27. <view class="item-info uni-row">
  28. <text class="label">合格数/投入数</text>
  29. <text class="label right">{{ item['qualifiedQuantity'] }}/{{item['invest']}}</text>
  30. </view>
  31. <view class="item-info uni-row">
  32. <text class="label">上道工序</text>
  33. <text class="label right">{{ item['previousProcess'] }}</text>
  34. </view>
  35. <view class="item-info uni-row">
  36. <text class="label">当前工序</text>
  37. <text class="label right">{{ item['currentProcess']}}</text>
  38. </view>
  39. <view class="item-info uni-row">
  40. <text class="label">下道工序</text>
  41. <text class="label right">{{ item['NextProcess'] }}</text>
  42. </view>
  43. <view class="status-btn uni-row">
  44. <view v-if="item['status'] == 1" class=" uni-row">
  45. <button class="turnover-tag" size="mini" @click.stop="handleShowTurnoverApplication(null)">周转申请</button>
  46. <!-- <button class="reporting-tag" size="mini" @click="handleToreportingForWork">去报工</button> -->
  47. </view>
  48. <view v-else-if="item['status'] == 2" class=" uni-row">
  49. <button class="turnover-tag" size="mini">取消周转</button>
  50. </view>
  51. </view>
  52. </view>
  53. </scroll-view>
  54. <view class="bottom uni-row">
  55. <button class="start-batch-btn" type="primary" @click="handleShowLotDialog(listData)">开始新批次</button>
  56. </view>
  57. <dialog-lot ref="lotDialog" />
  58. <dialog-turnoverApplication ref="turnoverApplicationDialog" />
  59. </view>
  60. </template>
  61. <script setup>
  62. import {
  63. reactive,
  64. ref
  65. } from 'vue'
  66. import {
  67. onLoad,
  68. onReady
  69. } from '@dcloudio/uni-app'
  70. import {
  71. getDayWorkList
  72. } from '@/api/business/dayWork.js'
  73. const turnoverApplicationDialog = ref(null)
  74. const lotDialog = ref(null)
  75. const listData = ref([])
  76. const bizDayworkObj = ref({})
  77. const curSubPlan = ref({})
  78. onLoad((options) => {
  79. curSubPlan.value = JSON.parse(options?.currentSubPlan || {});
  80. console.log(curSubPlan.value)
  81. init(curSubPlan.value.id);
  82. uni.$on('batchReportingaddBatch',() =>{
  83. console.log("111111111111111111")
  84. init(curSubPlan.value.id);
  85. })
  86. })
  87. const handleShowTurnoverApplication = (data) => {
  88. let _data = data ?? {}
  89. // 调用子组件中的方法
  90. turnoverApplicationDialog.value.open(_data)
  91. }
  92. const handleShowLotDialog = (data) => {
  93. if (data.length > 0) {
  94. lotDialog.value.open(data)
  95. } else {
  96. uni.navigateTo({
  97. url: "/pages/addNewBatch/index?currentSubPlan=" + JSON.stringify(curSubPlan.value)
  98. })
  99. }
  100. }
  101. function init(id) {
  102. uni.showLoading({
  103. title: '加载中'
  104. });
  105. let reqData = {};
  106. reqData.productionPlanDetailSubDetailId = id;
  107. // console.log(reqData)
  108. getDayWorkList(reqData).then(res => {
  109. console.log(reqData)
  110. console.log(res)
  111. listData.value = res.rows;
  112. uni.hideLoading();
  113. })
  114. }
  115. function handleToreportingForWork() {
  116. console.log(curSubPlan.value)
  117. uni.navigateTo({
  118. url: "/pages/reportingForWork/index?currentSubPlan=" + JSON.stringify(curSubPlan.value)
  119. })
  120. }
  121. </script>
  122. <style lang="scss">
  123. .scroll-container {
  124. width: 92%;
  125. margin: 24rpx auto 0 auto;
  126. height: 90%;
  127. }
  128. .list-item {
  129. background-color: #fff;
  130. position: relative;
  131. padding: 16rpx;
  132. padding-bottom: 24rpx;
  133. margin-bottom: 24rpx;
  134. border-radius: 10rpx;
  135. .title-container {
  136. margin-top: 8rpx;
  137. margin-bottom: 16rpx;
  138. .title {
  139. height: 48rpx;
  140. align-items: center;
  141. .label {
  142. font-size: 32rpx;
  143. font-weight: bold;
  144. &.code {
  145. margin-left: 8rpx;
  146. }
  147. }
  148. }
  149. .tag {
  150. border: 1px solid #1CE5B0;
  151. background-color: #F6FFFD;
  152. padding: 8rpx;
  153. border-radius: 8rpx;
  154. .label {
  155. color: #1CE5B0;
  156. font-size: 24rpx;
  157. }
  158. &.finished {
  159. border: 1px solid #BBBBBB;
  160. background-color: #F5F5F5;
  161. .label {
  162. color: #BBBBBB;
  163. }
  164. }
  165. &.turnover {
  166. border: 1px solid #FF7901;
  167. background-color: #F6FFFD;
  168. .label {
  169. color: #FF7901;
  170. }
  171. }
  172. }
  173. }
  174. .item-info {
  175. margin-bottom: 8rpx;
  176. .label {
  177. font-size: 28rpx;
  178. width: 220rpx;
  179. color: #808080;
  180. &.right {
  181. flex: 1;
  182. color: #000000;
  183. }
  184. }
  185. }
  186. .status-btn {
  187. justify-content: flex-end;
  188. align-items: center;
  189. .turnover-tag {
  190. padding-right: 12rpx;
  191. padding-left: 12rpx;
  192. border-radius: 8rpx;
  193. border: 1rpx solid #FF7901;
  194. background-color: #FF7901;
  195. font-size: 28rpx;
  196. color: #FFFFFF;
  197. }
  198. .reporting-tag {
  199. padding-right: 12rpx;
  200. padding-left: 12rpx;
  201. border-radius: 8rpx;
  202. margin-left: 16rpx;
  203. border: 1rpx solid #1684fc;
  204. background-color: #1684fc;
  205. font-size: 28rpx;
  206. color: #FFFFFF;
  207. }
  208. }
  209. }
  210. .bottom {
  211. height: 10%;
  212. position: fixed;
  213. right: 0;
  214. bottom: 0;
  215. left: 0;
  216. height: 100rpx;
  217. border-top: 1px solid #999999;
  218. padding: 16rpx 32rpx;
  219. align-items: center;
  220. background-color: #fff;
  221. .start-batch-btn {
  222. flex: 1;
  223. height: 80rpx;
  224. padding-top: 10 rpx;
  225. border-radius: 8rpx;
  226. color: #FFFFFF;
  227. font-size: 28rpx;
  228. }
  229. }
  230. </style>