index.vue 7.5 KB

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