jiangping
2023-10-26 ea87c908fb6cdfc3e227a584a53e6730efb8262a
minipro_standard/pages_adjust/pages/OrderDetail/OrderDetail.vue
@@ -1,11 +1,11 @@
<template>
   <view class="content">
      <workOrderInfo :orederMessage="info" />
      <view class="bg_cate">
         <view @click="clickIten(index)" :class="typeView == index ? 'bg_cate_item active' : 'bg_cate_item'"
            v-for="(item, index) in cate" :key="index">{{ item.name }}</view>
      </view>
      <div v-if="typeView==0" class="bg_list">
   <view>
      <workOrderInfo :orederMessage="info" />
      <!-- <view class="bg_cate">
         <view @click="clickIten(index)" :class="typeView == index ? 'bg_cate_item active' : 'bg_cate_item'"
            v-for="(item, index) in cate" :key="index">{{ item.name }}</view>
      </view> -->
      <div class="bg_list">
         <div class="bg_list_item">
            <div class="bg_list_item_top">
               <div class="bg_list_item_top_left">
@@ -15,26 +15,26 @@
            </div>
            <template v-if="feedingData && feedingData.length > 0">
               <view class="plr30 bg_w">
                  <view >
                     <div v-for="(item, index) in feedingData" :key="index" class="bg_list_item_h">
               <view>
                  <view v-for="(item, index) in feedingData" :key="index">
                     <div class="bg_list_item_h">
                        <div class="bg_list_item_num">
                           <div class="bg_list_item_num_item">
                              <div class="bg_list_item_num_item_wl">
                                 <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">合格<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 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>{{ item.locationName }}</span>
                                    <span v-if="item.batch"><text class="c6" decode>{{ split }}</text>{{ item.batch }}</span>
                                    <span>{{ item.batch ? `&nbsp;/&nbsp;${item.batch}` : '' }}</span>
                                 </div>
                              </div>
                              <div class="bg_list_item_num_item_sr">
                                 <view class="cY">
                                    <view class="mr10">{{ item.num }}</view>
                                    <span>{{ item.unitName }}</span>
                                    <span v-if="info.umodel">{{ info.umodel.name }}</span>
                                 </view>
                              </div>
@@ -63,7 +63,7 @@
               </div>
            </div>
            <div class="bg_list_item_h">
               <div class="bg_list_item_num plr30">
               <div class="bg_list_item_num">
                  <div class="bg_list_item_num_item">
                     <span>良品数{{ info.umodel ? `(${info.umodel.name})` : '' }}</span>
                     <div class="bg_list_item_num_item_sr">
@@ -74,7 +74,7 @@
               </div>
            </div>
            <div class="bg_list_item_h">
               <div class="bg_list_item_num plr30">
               <div class="bg_list_item_num">
                  <div class="bg_list_item_num_item">
                     <span>不良数{{ info.umodel ? `(${info.umodel.name})` : '' }}</span>
                     <div class="bg_list_item_num_item_sr">
@@ -83,55 +83,27 @@
                     </div>
                  </div>
               </div>
            </div>
            <!-- <div class="bg_list_item_h">
               <div class="bg_list_item_num plr30">
                  <div class="bg_list_item_num_item">
                     <span>不良数{{ info.umodel ? `(${info.umodel.name})` : '' }}</span>
                     <div class="bg_list_item_num_item_sr">
                        <view class="mr10">{{ produceFrom.undesirable }}</view>
                        <span v-if="info.umodel">{{ info.umodel.name }}</span>
                     </div>
                  </div>
               </div>
            </div> -->
            </div>
         </div>
         <div class="bg_list_item">
            <div class="bg_list_item_top">
               <div class="bg_list_item_top_left">
                  <div class="bg_list_item_top_left_x bg_m"></div>
                  <span>工资绩效</span>
                  <span>生产点检</span>
               </div>
            </div>
            <div class="bg_list_item_h mb40 ">
               <div class="bg_list_item_num plr30" style="display: block;">
                  <div class="bX ptb15">
                     <div class="f30 c2">预计工资</div>
                     <div class="f28" style="color:#4275FC">{{ (performance.salary / 10 / 10).toFixed(2) }}元</div>
                  </div>
                  <div class="f24 c6">
                     {{ performance.salaryType == 0 ? '计件' : '计时' }} |
                     {{ (performance.salaryPrice / 10 / 10).toFixed(2) }}元/{{ performance.salaryType ==
                           0 ? '件' : '时' }} |
                     达标率:{{ complianceRate }}%
                  </div>
               </div>
            </div>
         </div>
      </div>
      <div v-else class="bg_list">
            <template v-if="djData && djData.length > 0">
               <div class="details_dj">
                  <div class="details_dj_list">
                     <view v-for="(item, index) in djData" :key="index">
                        <div class="details_dj_list_item">
                           <span>{{ item.attrName }}:{{ item.val }}</span>
                           <span>{{ item.userName }} {{ item.createTime }}</span>
                        </div>
                     </view>
                     <!-- <scroll-view scroll-y="true" refresher-enabled="true" @scrolltolower="getLists">
                     </scroll-view> -->
                     <scroll-view scroll-y="true" refresher-enabled="true" @scrolltolower="getLists">
                        <view v-for="(item, index) in djData" :key="index">
                           <div class="details_dj_list_item">
                              <span>{{ item.attrName }}:{{ item.val }}</span>
                              <span>{{ item.userName }} {{ item.createTime }}</span>
                           </div>
                        </view>
                     </scroll-view>
                  </div>
               </div>
            </template>
@@ -141,7 +113,7 @@
               </div>
            </template>
         </div>
      </div>
      </div>
      
   </view>
</template>
@@ -178,16 +150,15 @@
         workOrderInfo
      },
      data() {
         return {
            cate: [{
                  name: '生产'
               },
               {
                  name: '点检'
               }
            ],
            split: '&nbsp;/&nbsp;',
         return {
            workorderId: '',
            cate: [{
                  name: '生产'
               },
               {
                  name: '点检'
               }
            ],
            form: {
               time: '',
               efective: [],
@@ -215,24 +186,17 @@
               qualified: '', // 合格
               undesirableId: '',
               undesirable: 5 // 不良
            },
            pages: {
               capacity: 10,
               page: 1,
               total: 0
            },
            djData: [],
            cateList: [],
            finished: true,
            performance: {}
            finished: true,
         };
      },
      onLoad(obj) {
         this.workorderId = obj.id
         this.queryByIds()
         this.getOrocessRecords()
         this.getData()
         this.pageDJs()
         this.getData()
         this.getOrocessRecordCC()
         uni.$on('spotAdd', () => {
            if (this.typeView == 1) {
@@ -242,25 +206,43 @@
         })
      },
      computed: {
         complianceRate() {
            if (!this.performance) return 0;
            let {duration, salaryNum, salaryTimes, qualifiedNum, unqualifiedNum, salaryUnqualified} = this.performance
            // 报工时长
            if (!duration) return 0;
            debugger
            // 报工数量
            if (!qualifiedNum && !unqualifiedNum) return 0;
            // 标准数量、时长
            if (!salaryNum || !salaryTimes) return 0
            if (salaryUnqualified == 1) { // 是否计入不良品
               let a = ((Number(qualifiedNum) + Number(unqualifiedNum)) / (duration / 3600)).toFixed(2)
               let b = (salaryNum / (salaryTimes / 3600)).toFixed(2)
         expectedSalary() {
            if (this.arrType.length === 0) return 0;
            // 按件计算
            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
               } else {
                  return (Number(this.produceFrom.qualified) * (this.arrType[this.form.index].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
            }
         },
         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;
            // 按件计算
            // 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)
               return ((Number(a) / Number(b)) * 100).toFixed(2)
            } else {
               let a = (qualifiedNum / (duration / 3600)).toFixed(2)
               let b = (salaryNum / (salaryTimes / 3600)).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)
               return ((Number(a) / Number(b)) * 100).toFixed(2)
               // return Number(from.qualified) * infoBox.value.salary;
            }
         }
      },
@@ -286,7 +268,7 @@
               this.pageDJs()
            }
         },
         getLists() {
         getLists() {
            if (!this.finished) {
               return
            }
@@ -361,7 +343,7 @@
               url: `/pages_inspect/pages/InspectionRecords/InspectionRecords?id=${this.workorderId}`
            })
         },
         pageDJs() {
         pageDJs() {
            pageDJ({
                  capacity: this.pages.capacity,
                  page: this.pages.page,
@@ -445,7 +427,7 @@
         },
         queryByIds() {
            queryById(this.workorderId)
               .then(res => {
               .then(res => {
                  this.info = res.data
                  queryList({
                     deleted: 0,
@@ -482,12 +464,10 @@
         getOrocessRecordCC() {
            getWorkorderRecordListStandard({
               workorderId: this.workorderId
            }).then(res => {
               // console.log(res.data[0]);
            }).then(res => {
               if (res.data.length > 0) {
                  this.produceFrom.qualified = res.data[0].qualifiedNum
                  this.produceFrom.undesirable = res.data[0].unqualifiedNum
                  this.performance = res.data[0]
               }
            })
         },
@@ -501,18 +481,14 @@
   }
</script>
<style lang="scss" scoped>
   .content {
      height: 100vh;
      background-color: #f7f7f7;
   }
<style lang="scss" scoped>
   .bg_cate {
      width: 100%;
      height: 88rpx;
      background: #FFFFFF;
      display: flex;
      align-items: center;
      // border-top: 20rpx solid #f7f7f7;
      .active {
         box-sizing: border-box;
         color: #305ED5 !important;
@@ -536,22 +512,32 @@
      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;
            background: #ffffff;
            font-size: 25rpx;
            span {
               color: #474747;
            }
         }
         .bg_list_item_top {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 30rpx;
            background-color: #f7f7f7;
            padding-left: 30rpx;
            padding-right: 30rpx;
            margin-bottom: 30rpx;
            .bg_list_item_top_left {
               display: flex;
@@ -614,21 +600,23 @@
         .bg_list_item_h {
            width: 100%;
            padding: 0 30rpx;
            box-sizing: border-box;
            background: white;
            border-bottom: 1rpx solid #E5E5E5;
            padding: 15rpx 0;
            &:last-child {
               border: none !important;
            }
            .bg_list_item_num {
               width: 100%;
               min-height: 98rpx;
               background: white;
               box-sizing: border-box;
               background: white;
               display: flex;
               justify-content: center;
               align-items: center;
               border-bottom: 1rpx solid #E5E5E5;
               &:last-child {
                  border: none !important;
               }
               .kong {
                  text-align: center;
                  font-size: 25rpx;
@@ -642,10 +630,10 @@
                  display: flex;
                  align-items: center;
                  // height: 118rpx;
                  // padding: 15rpx 0;
                  padding: 15rpx 0;
                  box-sizing: border-box;
                  justify-content: space-between;
                  // border-bottom: 3rpx solid #111;
                  border-bottom: 1rpx solid #E5E5E5;
                  &:last-child {
                     border: none;
@@ -1045,15 +1033,5 @@
            }
         }
      }
   }
   .kong {
      text-align: center;
      padding: 30rpx 0;
      // background: #ffffff;
      font-size: 25rpx;
      span {
         color: #474747;
      }
   }
</style>