index.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. <template>
  2. <view class="uni-column container" >
  3. <scroll-view class="scroll-container" scroll-y>
  4. <view v-for="(item, index) in listData" :key="index"
  5. class="list-item">
  6. <view class="title-container uni-row">
  7. <view class="title uni-row">
  8. <text class="label">批次号:</text>
  9. <text class="label code">{{ item['lotCode'] }}</text>
  10. </view>
  11. <view class="right-info uni-row">
  12. <view class="right-info uni-row"> <text class="label ">工时</text>
  13. <text class="label time">{{ item['taskTime'] }}h</text>
  14. </view>
  15. <view class="right-info uni-row" style="margin-left:32px;"> <text class="label">合格数</text>
  16. <text class="label number ">{{ item['qualifiedQuantity'] }}</text>
  17. </view>
  18. </view>
  19. </view>
  20. <view class="item-info uni-row">
  21. <text class="label">操作者</text>
  22. <text class="label right">{{ item['nickName'] }}</text>
  23. </view>
  24. <view class="item-info uni-row">
  25. <text class="label">开始时间</text>
  26. <text class="label right">{{ item['startTime']}}</text>
  27. </view>
  28. <view class="item-info uni-row">
  29. <text class="label">结束时间</text>
  30. <text class="label right">{{ (item['endTime'] !="")?item['endTime']:'-'}}</text>
  31. </view>
  32. <view class="item-info uni-row">
  33. <text class="label">废品数</text>
  34. <text class="label right">{{ item['rejectNum']}}</text>
  35. </view>
  36. <view class="item-info uni-row">
  37. <text class="label">废品原因</text>
  38. <text class="label right">{{ (item['remark'] != "")?item['remark']:'-'}}</text>
  39. </view>
  40. <view v-if="item['status'] == 0" class="status-btn uni-row ">
  41. <button class="finished-turnover-tag" size="mini"
  42. @click.stop="handleShowEndWorkDialog(item)">结束报工</button>
  43. </view>
  44. </view>
  45. </scroll-view>
  46. <view class="bottom uni-row">
  47. <button class="bottom-btn left-btn" @click="HandleChangevehicle"><text class="label">更换载具</text></button>
  48. <button class="bottom-btn right-btn" @click="handleStartProcessing"><text class="label">开始加工</text></button>
  49. </view>
  50. <dialog-end-work ref="endWorkDialog" @sendEquipment='getEquipment' @reset="reset"/>
  51. <dialog-selectEquipment ref='selectEquipment'></dialog-selectEquipment>
  52. </view>
  53. </template>
  54. <script setup>
  55. import {
  56. ref
  57. } from 'vue'
  58. import {
  59. onLoad,
  60. onReady
  61. } from '@dcloudio/uni-app'
  62. import { getDayWorkItemList,saveDayWorkItem } from "@/api/business/dayWorkItem.js"
  63. const listData = ref([])
  64. const curSubDetails = ref({})
  65. const endWorkDialog = ref(null)
  66. const selectEquipment = ref(null)
  67. const equipmentList = ref([])
  68. onLoad((options) => {
  69. curSubDetails.value = options.currentSubPlan;
  70. console.log(JSON.parse(curSubDetails.value))
  71. init();
  72. })
  73. function init(){
  74. getDayWorkItemList().then(res => {
  75. listData.value = res.rows;
  76. console.log(listData)
  77. })
  78. }
  79. function reset(){
  80. init();
  81. }
  82. function handleShowEndWorkDialog(data){
  83. // 调用子组件中的方法
  84. endWorkDialog.value.open(data)
  85. }
  86. function HandleChangevehicle(){
  87. uni.navigateTo({
  88. url:"/pages/changeBox/index"
  89. })
  90. }
  91. function getEquipment(data){
  92. console.log(data);
  93. equipmentList.value = data;
  94. }
  95. function handleStartProcessing(){
  96. selectEquipment.value.open();
  97. let date = new Date()
  98. saveDayWorkItem({
  99. dayworkId: '1',
  100. startTime: date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate()
  101. }).then(res => {
  102. if(res.code === 200){
  103. uni.showToast({
  104. icon: 'success',
  105. title: '操作成功',
  106. duration: 2000
  107. });
  108. init();
  109. }else{
  110. uni.showToast({
  111. icon: 'error',
  112. title: '操作失败',
  113. duration: 2000
  114. });
  115. }
  116. })
  117. }
  118. </script>
  119. <style lang="scss">
  120. .container {
  121. height: 2000rpx;
  122. background-color: #f5f5f5;
  123. overflow: auto;
  124. }
  125. .scroll-container {
  126. position: absolute;
  127. top: 24rpx;
  128. right: 0;
  129. bottom: 144rpx;
  130. left: 0;
  131. }
  132. .selected {
  133. border: 1px solid #1684fc;
  134. }
  135. .list-item {
  136. background-color: #fff;
  137. position: relative;
  138. padding: 16rpx;
  139. padding-bottom: 24rpx;
  140. margin: 0 24rpx;
  141. margin-bottom: 24rpx;
  142. border-radius: 8rpx;
  143. .title-container {
  144. justify-content: space-between;
  145. margin-top: 8rpx;
  146. margin-bottom: 16rpx;
  147. .title {
  148. height: 48rpx;
  149. align-items: center;
  150. .label {
  151. font-size: 32rpx;
  152. font-weight: bold;
  153. &.code {
  154. margin-left: 8rpx;
  155. }
  156. }
  157. }
  158. }
  159. .item-info {
  160. margin-bottom: 8rpx;
  161. .label {
  162. font-size: 28rpx;
  163. width: 152rpx;
  164. color: #808080;
  165. &.right {
  166. flex: 1;
  167. color: #000000;
  168. }
  169. }
  170. }
  171. .right-info {
  172. justify-content: flex-end;
  173. margin-top: 5rpx;
  174. .label {
  175. font-size: 28rpx;
  176. color: #000000;
  177. &.time {
  178. margin-left: 8rpx;
  179. color: #1684fc;
  180. }
  181. &.number {
  182. margin-left: 8rpx;
  183. color: rgba(0, 226, 166, 1);
  184. }
  185. }
  186. }
  187. }
  188. .bottom {
  189. position: fixed;
  190. right: 0;
  191. bottom: 0;
  192. left: 0;
  193. height: 100rpx;
  194. padding: 16rpx 24rpx;
  195. align-items: center;
  196. background-color: #FFFFFF;
  197. justify-content: space-between;
  198. .bottom-btn {
  199. flex: 1;
  200. font-size: 28rpx;
  201. color: #FFFFFF;
  202. &.left-btn {
  203. background-color: #1684fc;
  204. }
  205. &.right-btn {
  206. background-color: rgb(255, 121, 1);
  207. margin-left: 24rpx;
  208. }
  209. }
  210. }
  211. .status-btn {
  212. width: 100%;
  213. justify-content: flex-end;
  214. .finished-turnover-tag {
  215. margin: unset;
  216. border-radius: 8rpx;
  217. background-color: rgb(255, 85, 85);
  218. font-size: 28rpx;
  219. color: #FFFFFF;
  220. }
  221. }
  222. </style>