workorder.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <template>
  2. <view class="workorder-page">
  3. <navigation title="工单执行"></navigation>
  4. <view class="list-box" v-if="dataList.length>0">
  5. <view class="list-item" v-for="(item, index) in dataList" :key="index">
  6. <view class="item-text">订单号:{{ item.orderNum || '-' }}</view>
  7. <view class="item-text">设备名称:{{ item.equipmentName || '-' }}</view>
  8. <view class="item-text">产品名称:{{ item.productionName || '-' }}</view>
  9. <view class="item-text">客户名称:{{ item.customerName || '-' }}</view>
  10. <view class="item-text">工序名称:{{ item.processName || '-' }}</view>
  11. <view class="btn-box">
  12. <view class="btn-item" @click="workreport(item.id)">
  13. <view>报工</view>
  14. </view>
  15. </view>
  16. </view>
  17. </view>
  18. <empty v-else text="暂无数据"></empty>
  19. <!-- 确认框 -->
  20. <u-modal :show="show" :title="title" :showCancelButton="true" @cancel="modalCancel" @confirm="modalConfirm">
  21. <view class="slot-content">
  22. <u--form labelPosition="left" labelWidth="160rpx" :model="info" :rules="rules" ref="form">
  23. <view class="form">
  24. <u-form-item label="报工数量" prop="reportNum" borderBottom>
  25. <u--input v-model="info.reportNum" placeholder="请填写报工数量" border="none"></u--input>
  26. </u-form-item>
  27. <u-form-item label="废品数量" prop="wasteNum">
  28. <u--input v-model="info.wasteNum" placeholder="请填写废品数量" border="none"></u--input>
  29. </u-form-item>
  30. </view>
  31. </u--form>
  32. </view>
  33. </u-modal>
  34. </view>
  35. </template>
  36. <script>
  37. export default {
  38. data() {
  39. return {
  40. dataList: [],
  41. show: false,
  42. title: '报工',
  43. info: {
  44. id: '',
  45. reportNum: '',
  46. wasteNum: ''
  47. },
  48. rules: {
  49. reportNum: {
  50. type: 'string',
  51. required: true,
  52. message: '请填写报工数量',
  53. trigger: ['blur', 'change']
  54. },
  55. wasteNum: {
  56. type: 'string',
  57. required: true,
  58. message: '请填写废品数量',
  59. trigger: ['blur', 'change']
  60. },
  61. },
  62. }
  63. },
  64. onShow() {
  65. this.getList()
  66. },
  67. methods: {
  68. getList() {
  69. uni.showLoading({
  70. title: '正在加载...'
  71. })
  72. this.$api.listCurrentOrder().then(res => {
  73. this.dataList = res.data
  74. uni.hideLoading()
  75. }).catch(err => {})
  76. },
  77. // 报工
  78. workreport(id) {
  79. uni.navigateTo({
  80. url: '/subPackages/work/workreport?id=' + id
  81. });
  82. // this.info.id = id
  83. // this.info.reportNum = ''
  84. // this.info.wasteNum = ''
  85. // this.show = true
  86. },
  87. modalConfirm() {
  88. let that = this
  89. this.$refs.form.validate().then(res => {
  90. this.$api.productCompleteOrder(this.info).then(res => {
  91. this.show = false
  92. uni.showToast({
  93. title: '操作成功!',
  94. duration: 2000
  95. });
  96. setTimeout(function() {
  97. that.getList()
  98. }, 2000);
  99. }).catch(err => {})
  100. }).catch(err => {
  101. console.log('表单错误信息:', err);
  102. })
  103. },
  104. modalCancel() {
  105. this.show = false
  106. },
  107. }
  108. }
  109. </script>
  110. <style lang="scss" scoped>
  111. .workorder-page {
  112. .list-box {
  113. padding: 0 20rpx;
  114. color: $uni-text-color-list;
  115. .list-item {
  116. background-color: $uni-bg-color;
  117. padding: 20rpx;
  118. border-radius: 20rpx;
  119. margin-top: 28rpx;
  120. .item-text {
  121. margin-top: 10rpx;
  122. }
  123. }
  124. .btn-box {
  125. display: flex;
  126. justify-content: flex-end;
  127. margin-top: 10rpx;
  128. .btn-item {
  129. width: 175rpx;
  130. height: 50rpx;
  131. line-height: 50rpx;
  132. text-align: center;
  133. border-radius: 24rpx;
  134. margin-left: 20rpx;
  135. border: 1px solid #43adfd;
  136. color: #43adfd;
  137. }
  138. }
  139. }
  140. }
  141. </style>