jiangping
2023-09-11 4fa0cbae96cde47e4878e16c87da294903a457ae
minipro_standard/pages_adjust/pages/workOrderReporting/workOrderReporting.vue
@@ -189,7 +189,7 @@
         </div>
      </div>
      <!-- v-if="info.status === 2 || info.procedureNeedcheck === 1" -->
      <template>
      <template v-if="info.status === 2 || info.procedureNeedcheck === 1">
         <div class="bh_zw"></div>
         <div class="bg_footer bg_f7">
            <div class="bg_footer_submit bg_m" v-if="typeView == 0" @click="submit">确认报工</div>
@@ -247,8 +247,10 @@
      categoryExtList,
      queryOne,
      queryList
   } from '@/util/api/PlanningAPI'
   import { REGULAR } from '@/util/utils'
   } from '@/util/api/PlanningAPI'
   import {
      REGULAR
   } from '@/util/utils'
   export default {
      components: {
         workOrderInfo
@@ -291,7 +293,7 @@
               undesirableId: '',
               undesirable: '' // 不良
            },
            triggered: false,
            triggered: false,
            finished: true,
            djData: [],
            cateList: [],
@@ -306,12 +308,15 @@
         this.workorderId = obj.id
         this.queryByIds()
         this.getOrocessRecords()
         this.getData()
         uni.$on('spotAdd', () => {
            if (this.typeView == 1) {
               this.pages.page = 1
               this.pageDJs()
            }
         this.getData()
         uni.$on('spotAdd', () => {
            if (this.typeView == 1) {
               this.pages.page = 1
               this.pageDJs()
            }
         })
         uni.$on('addMaterial', () => {
            this.getOrocessRecords()
         })
      },
      computed: {
@@ -410,7 +415,7 @@
         },
         clickIten(index) {
            this.typeView = index
            if (this.typeView == 1) {
            if (this.typeView == 1) {
               this.pages.page = 1
               this.pageDJs()
            }
@@ -514,67 +519,71 @@
            this.form.index = index
            this.form.type = item.type
         },
         submit() {
            let createUnqualifiedDTOList = this.form.defective.map((item) => {
                return {
                  categoryId: item.id,
                  unQualifiedNum: item.num
                }
              })
              let createWorkorderRecordDTO = {
                workorderId: this.workorderId,
                duration: this.form.duration ? this.form.duration : 0,
                qualifiedNum: this.produceFrom.qualified ? this.produceFrom.qualified : 0,
                unQualifiedNum: this.produceFrom.undesirable ? this.produceFrom.undesirable : 0
              }
              // id: route.query.id
              comfirmDoneStandard({
                createUnqualifiedDTOList,
                createWorkorderRecordDTO
              }).then(res => {
                if (res.code === 200) {
                     uni.$u.toast('报工成功')
                  setTimeout(() => {
                    uni.navigateBack({ data: 2})
                  }, 2000)
                }
              })
         submit() {
            let createUnqualifiedDTOList = this.form.defective.map((item) => {
               return {
                  categoryId: item.id,
                  unQualifiedNum: item.num
               }
            })
            let createWorkorderRecordDTO = {
               workorderId: this.workorderId,
               duration: this.form.duration ? this.form.duration : 0,
               qualifiedNum: this.produceFrom.qualified ? this.produceFrom.qualified : 0,
               unQualifiedNum: this.produceFrom.undesirable ? this.produceFrom.undesirable : 0
            }
            // id: route.query.id
            comfirmDoneStandard({
               createUnqualifiedDTOList,
               createWorkorderRecordDTO
            }).then(res => {
               if (res.code === 200) {
                  uni.$u.toast('报工成功')
                  setTimeout(() => {
                     uni.navigateBack({
                        data: 2
                     })
                  }, 2000)
               }
            })
         },
         jumpdj() {
            uni.navigateTo({
               url: `/pages_adjust/pages/spotCheck/spotCheck?id=${this.workorderId}`
            })
         },
         getLists() {
            if (!this.finished) {
               return
            }
            this.finished = false
            this.pages.page += 1
            this.pageDJs()
         },
         pageDJs() {
         getLists() {
            if (!this.finished) {
               return
            }
            this.finished = false
            this.pages.page += 1
            this.pageDJs()
         },
         pageDJs() {
            pageDJ({
               capacity: this.pages.capacity,
               page: this.pages.page,
               model: {
                  workorderId: this.workorderId
               }
            }).then(res => {
               let {data} = res
               if (data.page == 1) {
                  this.djData = []
               }
               this.djData.push(...data.records)
               // loading.value = false
            }).catch(err => {
               // loading.value = false
               // finished.value = true
            })
            .finally(() => {
               this.finished = true
            })
                  capacity: this.pages.capacity,
                  page: this.pages.page,
                  model: {
                     workorderId: this.workorderId
                  }
               }).then(res => {
                  let {
                     data
                  } = res
                  if (data.page == 1) {
                     this.djData = []
                  }
                  this.djData.push(...data.records)
                  // loading.value = false
               }).catch(err => {
                  // loading.value = false
                  // finished.value = true
               })
               .finally(() => {
                  this.finished = true
               })
         },
         dele(id) {
            deletedj(id)
@@ -639,6 +648,27 @@
               // url: ''
               url: `/pages_adjust/pages/manualFeed/manualFeed?id=${this.workorderId}`
            })
         },
         deleItem(id, type) {
            uni.showModal({
               title: '提示',
               content: '确定删除此条记录吗?',
               success: (res) => {
                  if (res.confirm) {
                     console.log('用户点击确定');
                     deleteCT(id)
                        .then(res => {
                           this.getOrocessRecords()
                           // if (type === 'C') {
                           //    this.getOrocessRecordCC()
                           // } else if (type === 'T') {
                           //    this.getOrocessRecords()
                           // }
                        })
                        .catch(err => {})
                  }
               }
            })
         }
      }
   }