dialog-end-work.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <template>
  2. <dialog-base ref="baseDialog" title="结束报工">
  3. <view class="list-container">
  4. <view class="list-title"><text class="label">合格量</text></view>
  5. <view class="table-item">
  6. <input class="input" v-model="workInfo.qualified" placeholder="请输入合格量" />
  7. </view>
  8. <view class="list-title">
  9. <text class="label">废品量</text>
  10. </view>
  11. <view class="table-item"><input class="input" v-model="workInfo.rejectNum" placeholder="请输入废品量" /></view>
  12. <view class="list-title">
  13. <text class="label">废品原因</text>
  14. </view>
  15. <view class="table-item"><input class="input" v-model="workInfo.remark" placeholder="请输入废品原因" /></view>
  16. <view class="list-title uni-row">
  17. <text class="label">当前序是否完成</text>
  18. <switch class="switch" @change="switchChange" color="rgba(255,85,85,1)" style="transform:scale(0.7)" />
  19. </view>
  20. <view class="list-title"><text class="label">请选择设备:</text></view>
  21. <!-- <scroll-view class="scroll-container" scroll-y> -->
  22. <checkbox-group class="equipment-container uni-row" @change="checkboxChange">
  23. <checkbox v-for="(item,index) in equiments" class="checkbox" style="transform:scale(0.8)" :key="index"
  24. :value="item" :checked="item.checked">
  25. {{item}}
  26. </checkbox>
  27. </checkbox-group>
  28. </view>
  29. <view class="add-btn-container uni-row">
  30. <button type="default" class="btn" @click="handleFinishReporting">结束报工</button>
  31. </view>
  32. </dialog-base>
  33. </template>
  34. <script setup>
  35. import {
  36. ref,
  37. getCurrentInstance
  38. } from 'vue'
  39. import {
  40. updateDayWorkItem,
  41. saveDayWorkItem
  42. } from "@/api/business/dayWorkItem.js"
  43. const baseDialog = ref(null)
  44. const equiments = ref(['009-21', '009-22', '009-23', '009-24', '009-25', '009-26', '009-27', '009-28', '009-29',
  45. '009-26', '009-27'
  46. ])
  47. const workInfo = ref({})
  48. const open = (data) => {
  49. // console.log(dialog.value)
  50. workInfo.value.dayworkId = data.dayworkId;
  51. workInfo.value.id = data.id;
  52. baseDialog.value.open()
  53. }
  54. function switchChange(event) {
  55. if (event.detail.value) {
  56. workInfo.value.status = "2"
  57. }
  58. }
  59. function checkboxChange(event) {
  60. console.log(event.detail.value)
  61. workInfo.value.equiments = event.detail.value
  62. }
  63. function handleFinishReporting() {
  64. console.log(workInfo.value)
  65. if(workInfo.value.status != 2) {
  66. workInfo.value.status = '1';
  67. }
  68. saveDayWorkItem(workInfo.value).then(res => {
  69. if(res.code === 200){
  70. uni.showToast({
  71. icon: 'success',
  72. title: '操作成功',
  73. duration: 2000
  74. });
  75. baseDialog.value.close();
  76. }else{
  77. uni.showToast({
  78. icon: 'error',
  79. title: '操作失败',
  80. duration: 2000
  81. });
  82. }
  83. })
  84. }
  85. defineExpose({
  86. open
  87. })
  88. </script>
  89. <style lang="scss">
  90. .dialog-body {
  91. .list-container {
  92. width: 100%;
  93. display: flex;
  94. align-items: flex-start;
  95. padding: 0 4rpx;
  96. .list-title {
  97. margin-top: 24rpx;
  98. .label {
  99. font-size: 32rpx;
  100. }
  101. }
  102. .switch {
  103. margin-top: -8rpx;
  104. align-items: center;
  105. }
  106. .equipment-container {
  107. width: 100%;
  108. height: 120rpx;
  109. flex-wrap: wrap;
  110. justify-content: flex-start;
  111. overflow: auto;
  112. .checkbox {
  113. padding: 12rpx 0;
  114. justify-content: center;
  115. align-items: center;
  116. }
  117. }
  118. .table-item {
  119. margin-top: 24rpx;
  120. .input {
  121. height: 60rpx;
  122. border: 1px solid #808080;
  123. }
  124. }
  125. }
  126. .add-btn-container {
  127. margin-top: 32rpx;
  128. .btn {
  129. flex: 1;
  130. background-color: rgba(255, 85, 85, 1);
  131. color: #FFFFFF;
  132. }
  133. }
  134. }
  135. </style>