jiangping
2023-10-24 349bcef9a96391d22522a3409adf5a89e7e70a95
minipro_standard/pages_adjust/pages/workOrderReporting/workOrderReporting.vue
@@ -1,5 +1,6 @@
<template>
   <view>
<template>
   <page-meta :page-style="(badShow||statistics) ?'overflow: hidden;': ''"/>
   <view class="content">
      <view class="tips-label">当前任务需要质检;产出后,请耐心等待质检员检验,并根据检验结果调整产出数据后再报工。</view>
      <workOrderInfo :orederMessage="info" />
      <!-- <u-tabs :list="tab" lineColor="#305ED5" :activeStyle="{color:'#305ED5'}" lineWidth="50%" :itemStyle="{width: '50%', boxSizing: 'border-box', height: '88rpx'}" @click="click"></u-tabs> -->
@@ -21,7 +22,7 @@
                  <!-- <img src="@/assets/icon/gongdan_ic_shoudong@2x.png" alt="" /> -->
                  <!-- <img src="@/static/gongdan_ic_shoudong@2x.ong" alt="" /> -->
                  <image src="../../static/gongdan_ic_shoudong@2x.png" class="img28" mode=""></image>
                  <span class="cm">手动录入</span>
                  <span class="cm">手动投料</span>
               </div>
            </div>
@@ -37,11 +38,11 @@
                                 <span> {{ item.materialName || '墙体砖' }}{{ item.procedureName ? `&nbsp;|&nbsp;${item.procedureName}` : ''
                                 }}</span>
                                 <div class="bg_list_item_num_item_wl_lx">
                                    <span class="green" v-if="item.qualityType == 0">合格&nbsp;/&nbsp;</span>
                                    <span class="orange" v-if="item.qualityType == 1">不良&nbsp;/&nbsp;</span>
                                    <span class="red" v-if="item.qualityType == 2">报废&nbsp;/&nbsp;</span>
                                    <span class="green" v-if="item.qualityType == 0">合格<text class="c6" decode>{{split}}</text></span>
                                    <span class="orange" v-if="item.qualityType == 1">不良<text class="c6" decode>{{split}}</text></span>
                                    <span class="red" v-if="item.qualityType == 2">报废<text class="c6" decode>{{split}}</text></span>
                                    <span>{{ item.locationName }}</span>
                                    <span>{{ item.batch ? `&nbsp;/&nbsp;${item.batch}` : '' }}</span>
                                    <span v-if="item.batch"><text class="c6" decode>{{split}}</text>{{ item.batch }}</span>
                                 </div>
                              </div>
                              <div class="bg_list_item_num_item_sr">
@@ -124,8 +125,9 @@
                  :style="{ color: form.durationName ? '#333' : '' }">{{ form.durationName ? form.durationName : '请选择' }}</span>
               <image src="../../../static/ic_ar@2x.png" class="img_ar" mode=""></image>
            </div>
         </div>
         <div class="bg_list_item" v-if="form.duration && arrType && arrType.length > 0">
         </div>
         <!-- form.duration &&  -->
         <div class="bg_list_item" v-if="arrType && arrType.length > 0">
            <div class="bg_list_item_top">
               <div class="bg_list_item_top_left">
                  <div class="bg_list_item_top_left_x bg_m"></div>
@@ -175,31 +177,38 @@
      </div>
      <div class="details_dj" v-if="typeView === 1">
         <div class="details_dj_list">
            <scroll-view scroll-y="true" refresher-enabled="true" @scrolltolower="getLists">
               <u-swipe-action v-for="(item, index) in djData" :key="index">
                  <u-swipe-action-item :options="options" @click="dele(item.id)">
                     <div class="details_dj_list_item">
                        <span>{{ item.attrName }}:{{ item.val }}</span>
                        <span>{{ item.userName }} {{ item.createTime }}</span>
                     </div>
                  </u-swipe-action-item>
               </u-swipe-action>
            </scroll-view>
         <div class="details_dj_list">
            <u-swipe-action v-for="(item, index) in djData" :key="index">
               <u-swipe-action-item :options="options" @click="dele(item.id)">
                  <div class="details_dj_list_item">
                     <span>{{ item.attrName }}:{{ item.val }}</span>
                     <span>{{ item.userName }} {{ item.createTime }}</span>
                  </div>
               </u-swipe-action-item>
            </u-swipe-action>
         </div>
      </div>
      <!-- v-if="info.status === 2 || info.procedureNeedcheck === 1" -->
      <template v-if="info.status === 2 || info.procedureNeedcheck === 1">
      <!-- v-if="info.status === 2 || info.procedureNeedcheck === 1" -->
      <!-- status 0已创建、1已备料、2已完工、3已检验、4已报工、5已入库、6已取消、7生产中 -->
      <!-- procedureNeedcheck 工序是否需要检验才能报工 0是 1否 -->
      <template v-if="typeView == 0 &&( 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>
            <!-- proxy.$auth('h5:workorder:processRecord') &&  -->
         </div>
      </template>
      <template v-if="typeView == 1 && info.status !== 4 && info.procedureNeedcheck !== 5 && info.procedureNeedcheck !== 6">
         <div class="bh_zw"></div>
         <div class="bg_footer bg_f7">
            <div class="bg_footer_submit1" @click="jumpdj" v-if="typeView == 1">
               <image src="../../../static/gongdan_ic_shoudong@2x.png" class="fornt-img" mode=""></image>
               <span>新增点检</span>
            </div>
         </div>
      </template>
      </template>
      <u-safe-bottom></u-safe-bottom>
      <u-datetime-picker :show="TimeShow" @cancel="TimeShow=false" @confirm="timeConfirm" v-model="form.time"
         mode="time"></u-datetime-picker>
      <u-popup :show="badShow" @close="badShow=false" :round="8" closeable zIndex="20000">
@@ -252,7 +261,7 @@
            <div class="tg_footer">
               <!-- proxy.$auth('h5:workorderoutput:confirm') &&  -->
               <button class="tg_footer_qr" @click="submitBG" v-if="isSubmit">确认报工</button>
               <div class="tg_footer_fh" @click="gofh" v-else-if="!isSubmit">返回修改</div>
               <div class="tg_footer_fh" @click="statistics = false" v-else-if="!isSubmit">返回修改</div>
            </div>
         </div>
      </u-popup>
@@ -296,7 +305,8 @@
               {
                  name: '点检'
               }
            ],
            ],
            split: '&nbsp;/&nbsp;',
            form: {
               time: '',
               defective: [],
@@ -344,7 +354,8 @@
         this.workorderId = obj.id
         this.queryByIds()
         this.getOrocessRecords()
         this.getData()
         this.getData()
         this.pageDJs()
         uni.$on('spotAdd', () => {
            if (this.typeView == 1) {
               this.pages.page = 1
@@ -356,41 +367,45 @@
         })
      },
      computed: {
         expectedSalary() {
            if (this.arrType.length === 0) return 0;
         expectedSalary() {
            let { qualified, undesirable } = this.produceFrom
            if (this.arrType.length === 0) return 0;
            let temp = this.arrType[this.form.index]
            // 按件计算
            if (this.arrType[this.form.index].type == 0) {
               if (!this.produceFrom.qualified) return 0
               if (this.arrType[this.form.index].unqualified == 1) { // 是否计入不良品
                  let total = Number(this.produceFrom.qualified) + Number(this.produceFrom.undesirable)
                  return (total * (this.arrType[this.form.index].salary / 100)).toFixed(2) || 0
            if (temp.type == 0) {
               if (!qualified) return 0
               if (temp.unqualified == 1) { // 是否计入不良品
                  let total = Number(qualified) + Number(undesirable)
                  return (total * (temp.salary / 100)).toFixed(2) || 0
               } else {
                  return (Number(this.produceFrom.qualified) * (this.arrType[this.form.index].salary / 100)).toFixed(
                  return (Number(qualified) * (temp.salary / 100)).toFixed(
                     2) || 0
               }
            } else {
               if (!this.form.duration) return 0;
               let h = (this.form.duration / 60 / 60).toFixed(2)
               return (Number(h) * (this.arrType[this.form.index].salary / 10 / 10)).toFixed(2) || 0
               return (Number(h) * (temp.salary / 10 / 10)).toFixed(2) || 0
            }
         },
         complianceRate() {
            if (this.arrType.length === 0) return 0;
            if (!this.produceFrom.qualified && !this.produceFrom.undesirable) return 0;
            if (!this.form.duration) return 0;
            if (!this.arrType[this.form.index].num) return 0;
         complianceRate() {
            let { index, duration } = this.form
            let { qualified, undesirable } = this.produceFrom
            if (this.arrType.length === 0) return 0;
            let temp = this.arrType[index]
            if (!qualified && !undesirable) return 0;
            if (!duration) return 0;
            if (!temp.num || !temp.times) return 0;
            // 按件计算
            // if (infoBox.value.type == 0) {
            if (this.arrType[this.form.index].unqualified == 1) { // 是否计入不良品
               let a = ((Number(this.produceFrom.qualified) + Number(this.produceFrom.undesirable)) / (this.form
                  .duration / 3600)).toFixed(2)
               let b = (this.arrType[this.form.index].num / (this.arrType[form.index].times / 3600)).toFixed(2)
            if (temp.unqualified == 1) { // 是否计入不良品
               let a = ((Number(qualified) + Number(undesirable)) / (Number(duration) / 3600)).toFixed(2)
               let b = (temp.num / (temp.times / 3600)).toFixed(2)
               return ((Number(a) / Number(b)) * 100).toFixed(2)
               // let total = (Number(from.qualified) + Number(from.undesirable)) / ((from.duration * 60 * 60) * infoBox.value.num / )
               // return total * infoBox.value.salary;
            } else {
               let a = (this.produceFrom.qualified / (this.form.duration / 3600)).toFixed(2)
               let b = (this.arrType[this.form.index].num / (this.arrType[this.form.index].times / 3600)).toFixed(2)
               let a = (Number(qualified) / (Number(duration) / 3600)).toFixed(2)
               let b = (temp.num / (temp.times / 3600)).toFixed(2)
               return ((Number(a) / Number(b)) * 100).toFixed(2)
               // return Number(from.qualified) * infoBox.value.salary;
            }
@@ -414,7 +429,8 @@
                              item.id = item.type
                              item.active = index == 0
                           })
                           this.arrType = result.data
                           this.arrType = result.data
                        } else {
                           this.arrType = []
                        }
@@ -459,7 +475,6 @@
         timeConfirm({
            value
         }) {
            console.log(value)
            let h = Number(value.substring(0, 2))
            let m = Number(value.substring(3, 5))
            let s = 0
@@ -641,8 +656,9 @@
                     num: this.produceFrom.undesirable
                  })
                  this.isSubmit = Number(this.produceFrom.qualified) + Number(this.produceFrom.undesirable) <= this
                     .info.planNum;
               }
                     .info.planNum;
               }
            } else {
               console.log('推式')
               if (this.feedingData.length === 0) {
@@ -652,7 +668,6 @@
               }
               if (this.produceFrom.qualified <= 0 && this.produceFrom.undesirable <= 0) {
                  uni.$u.toast('产出明细不能为空')
                  return
               }
               this.statisticsData = []
@@ -766,36 +781,6 @@
               }
            })
         },
         // => {
         //   // if (!from.duration || from.duration <= 0) {
         //   //     return Toast('报工时长不能为空')
         //   // }
         //   let createUnqualifiedDTOList = from.defective.map(item => {
         //     return {
         //       categoryId: item.id,
         //       unQualifiedNum: item.num
         //     }
         //   })
         //   let createWorkorderRecordDTO = {
         //     workorderId: route.query.id,
         //     duration: from.duration ? from.duration : 0,
         //     qualifiedNum: produceFrom.qualified ? produceFrom.qualified : 0,
         //     unQualifiedNum: produceFrom.undesirable ? produceFrom.undesirable : 0
         //   }
         //   // id: route.query.id
         //   comfirmDoneStandard({
         //     createUnqualifiedDTOList,
         //     createWorkorderRecordDTO
         //   }).then(res => {
         //     if (res.code === 200) {
         //       Toast.success({ message: '报工成功', forbidClick: true, duration: 2000 })
         //       setTimeout(() => {
         //         router.go(-2)
         //       }, 2000)
         //     }
         //   })
         // }
         jumpdj() {
            uni.navigateTo({
               url: `/pages_adjust/pages/spotCheck/spotCheck?id=${this.workorderId}`
@@ -872,11 +857,11 @@
                     })
                     return
                  }
                  total = total += item.num
                  total += Number(item.num)
                  arr.push(item)
                  name += item.name + item.num + ';'
               }
            })
            })
            if (total != Number(this.produceFrom.undesirable)) {
               uni.showToast({
                  title: '不良数必须等于产出不良数',
@@ -953,14 +938,14 @@
      width: 100%;
      display: flex;
      flex-direction: column;
      margin-top: 30rpx;
      // margin-top: 30rpx;
      .bg_list_item {
         display: flex;
         flex-direction: column;
         // margin-bottom: 40rpx;
         border-bottom: 40rpx #f7f7f7 solid;
         // border-bottom: 40rpx #f7f7f7 solid;
         //
         .kong {
            text-align: center;
            padding: 30rpx 0;
@@ -975,10 +960,10 @@
         .bg_list_item_top {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding-left: 30rpx;
            padding-right: 30rpx;
            margin-bottom: 30rpx;
            justify-content: space-between;
            background-color: #f7f7f7;
            padding: 30rpx;
            // padding-right: 30rpx;
            .bg_list_item_top_left {
               display: flex;
@@ -1044,27 +1029,25 @@
            padding: 0 30rpx;
            box-sizing: border-box;
            background: white;
            &:last-child {
               .bg_list_item_num{
                  border: none !important;
               }
            }
            .bg_list_item_num {
               width: 100%;
               min-height: 98rpx;
               background: white;
               display: flex;
               justify-content: center;
               align-items: center;
               align-items: center;
               border-bottom: 1rpx solid #E5E5E5;
               &:last-child {
                  border: none !important;
               }
               .kong {
                  text-align: center;
                  font-size: 25rpx;
                  padding: 30rpx 0;
                  background: #ffffff;
               }
               .bg_list_item_num_item {
                  width: 100%;
                  height: 100%;
@@ -1074,11 +1057,7 @@
                  padding: 15rpx 0;
                  box-sizing: border-box;
                  justify-content: space-between;
                  border-bottom: 1rpx solid #E5E5E5;
                  &:last-child {
                     border: none;
                  }
                  .bg_list_item_num_item_list {
                     display: flex;
@@ -1138,9 +1117,9 @@
                  span {
                     flex-shrink: 0;
                     overflow: hidden;
                     text-overflow: ellipsis;
                     white-space: nowrap;
                     // overflow: hidden;
                     // text-overflow: ellipsis;
                     // white-space: nowrap;
                     b {
                        font-size: 30rpx;
@@ -1205,9 +1184,9 @@
                     .wulll {
                        width: 400rpx;
                        text-align: right;
                        overflow: hidden;
                        white-space: nowrap;
                        text-overflow: ellipsis;
                        // overflow: hidden;
                        // white-space: nowrap;
                        // text-overflow: ellipsis;
                     }
                     span {
@@ -1223,12 +1202,13 @@
   }
   .bg_plan {
      width: 100%;
      width: 100%;
      border-top: 20rpx #f7f7f7 solid;
      // height: 98px;
      padding: 30rpx;
      box-sizing: border-box;
      background: #FFFFFF;
      margin-bottom: 40rpx;
      // margin-bottom: 40rpx;
      display: flex;
      align-items: center;
      justify-content: space-between;
@@ -1409,7 +1389,7 @@
   .bottom-view {
      left: 40rpx;
      right: 40rpx;
      bottom: 0
      bottom: 20rpx
   }
   .bl_list {
@@ -1591,5 +1571,9 @@
         font-weight: 500;
         color: #FFFFFF;
      }
   }
   .content {
      height: 100vh;
      background-color: #f7f7f7;
   }
</style>