index.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  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'/>
  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 handleShowEndWorkDialog(data){
  80. // 调用子组件中的方法
  81. endWorkDialog.value.open(data)
  82. }
  83. function HandleChangevehicle(){
  84. uni.navigateTo({
  85. url:"/pages/changeBox/index"
  86. })
  87. }
  88. function getEquipment(data){
  89. console.log(data);
  90. equipmentList.value = data;
  91. }
  92. function handleStartProcessing(){
  93. selectEquipment.value.open();
  94. let date = new Date()
  95. saveDayWorkItem({
  96. dayworkId: '1',
  97. startTime: date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate()
  98. }).then(res => {
  99. if(res.code === 200){
  100. uni.showToast({
  101. icon: 'success',
  102. title: '操作成功',
  103. duration: 2000
  104. });
  105. }else{
  106. uni.showToast({
  107. icon: 'error',
  108. title: '操作失败',
  109. duration: 2000
  110. });
  111. }
  112. })
  113. }
  114. </script>
  115. <style lang="scss">
  116. .container {
  117. height: 2000rpx;
  118. background-color: #f5f5f5;
  119. overflow: auto;
  120. }
  121. .scroll-container {
  122. position: absolute;
  123. top: 24rpx;
  124. right: 0;
  125. bottom: 144rpx;
  126. left: 0;
  127. }
  128. .list-item {
  129. background-color: #fff;
  130. position: relative;
  131. padding: 16rpx;
  132. padding-bottom: 24rpx;
  133. margin: 0 24rpx;
  134. margin-bottom: 24rpx;
  135. border-radius: 8rpx;
  136. .title-container {
  137. justify-content: space-between;
  138. margin-top: 8rpx;
  139. margin-bottom: 16rpx;
  140. .title {
  141. height: 48rpx;
  142. align-items: center;
  143. .label {
  144. font-size: 32rpx;
  145. font-weight: bold;
  146. &.code {
  147. margin-left: 8rpx;
  148. }
  149. }
  150. }
  151. }
  152. .item-info {
  153. margin-bottom: 8rpx;
  154. .label {
  155. font-size: 28rpx;
  156. width: 152rpx;
  157. color: #808080;
  158. &.right {
  159. flex: 1;
  160. color: #000000;
  161. }
  162. }
  163. }
  164. .right-info {
  165. justify-content: flex-end;
  166. margin-top: 5rpx;
  167. .label {
  168. font-size: 28rpx;
  169. color: #000000;
  170. &.time {
  171. margin-left: 8rpx;
  172. color: #1684fc;
  173. }
  174. &.number {
  175. margin-left: 8rpx;
  176. color: rgba(0, 226, 166, 1);
  177. }
  178. }
  179. }
  180. }
  181. .bottom {
  182. position: fixed;
  183. right: 0;
  184. bottom: 0;
  185. left: 0;
  186. height: 100rpx;
  187. padding: 16rpx 24rpx;
  188. align-items: center;
  189. background-color: #FFFFFF;
  190. justify-content: space-between;
  191. .bottom-btn {
  192. flex: 1;
  193. font-size: 28rpx;
  194. color: #FFFFFF;
  195. &.left-btn {
  196. background-color: #1684fc;
  197. }
  198. &.right-btn {
  199. background-color: rgb(255, 121, 1);
  200. margin-left: 24rpx;
  201. }
  202. }
  203. }
  204. .status-btn {
  205. width: 100%;
  206. justify-content: flex-end;
  207. .finished-turnover-tag {
  208. margin: unset;
  209. border-radius: 8rpx;
  210. background-color: rgb(255, 85, 85);
  211. font-size: 28rpx;
  212. color: #FFFFFF;
  213. }
  214. }
  215. </style>