Mr.Zhang
2023-09-14 8a8564207b3777893a2797aa6bd7ca9b6d000f3d
minipro_standard/pages_adjust/pages/OrderDetail/OrderDetail.vue
@@ -1,10 +1,6 @@
<template>
   <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">
@@ -113,6 +109,49 @@
               </div>
            </template>
         </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>
               </div>
            </div>
            <div class="bg_list_item_h">
               <div class="bg_list_item_num">
                  <div class="bg_list_item_num_item">
                     <span>计件方式</span>
                     <div class="bg_list_item_num_item_list">
                        {{ performance.salaryType == 0 ? '计件' : '计时' }}
                     </div>
                  </div>
               </div>
               <div class="bg_list_item_num">
                  <div class="bg_list_item_num_item">
                     <span>工资单价</span>
                     <div class="bg_list_item_num_item_sr">
                        <span class="color1">{{ (performance.salaryPrice / 10 / 10).toFixed(2) }}元/{{ performance.salaryType ==
                         0 ? '件' : '时' }}</span>
                     </div>
                  </div>
               </div>
               <div class="bg_list_item_num">
                  <div class="bg_list_item_num_item">
                     <span>预计工资</span>
                     <div class="bg_list_item_num_item_sr">
                        <span class="color1">{{ (performance.salary / 10 / 10).toFixed(2) }}元</span>
                     </div>
                  </div>
               </div>
               <div class="bg_list_item_num">
                  <div class="bg_list_item_num_item">
                     <span>达标率</span>
                     <div class="bg_list_item_num_item_sr">
                        <span class="color1">{{ complianceRate }}%</span>
                     </div>
                  </div>
               </div>
            </div>
         </div>
      </div>
      
   </view>
@@ -152,13 +191,6 @@
      data() {
         return {
            workorderId: '',
            cate: [{
                  name: '生产'
               },
               {
                  name: '点检'
               }
            ],
            form: {
               time: '',
               efective: [],
@@ -186,17 +218,24 @@
               qualified: '', // 合格
               undesirableId: '',
               undesirable: 5 // 不良
            },
            pages: {
               capacity: 10,
               page: 1,
               total: 0
            },
            djData: [],
            cateList: [],
            finished: true,
            finished: true,
            performance: {}
         };
      },
      onLoad(obj) {
         this.workorderId = obj.id
         this.queryByIds()
         this.getOrocessRecords()
         this.getData()
         this.getData()
         this.pageDJs()
         this.getOrocessRecordCC()
         uni.$on('spotAdd', () => {
            if (this.typeView == 1) {
@@ -206,43 +245,23 @@
         })
      },
      computed: {
         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
            if (!this.performance) return 0;
            if (!this.performance.duration) return 0;
            if (!this.performance.qualifiedNum && !this.performance.unqualifiedNum) return 0;
            if (this.performance.salaryUnqualified == 1) { // 是否计入不良品
               let a = ((Number(this.performance.qualifiedNum) + Number(this.performance.unqualifiedNum)) / (this.performance
                  .duration / 3600)).toFixed(2)
               let b = (this.arrType[this.form.index].num / (this.arrType[form.index].times / 3600)).toFixed(2)
               let b = (this.performance.salaryNum / (this.performance.salaryTimes / 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)
            } else {
               let a = (this.performance.qualifiedNum / (this.performance.duration / 3600)).toFixed(2)
               // let b = (this.arrType[this.form.index].num / (this.arrType[this.form.index].times / 3600)).toFixed(2)
               let b = (this.performance.salaryNum / (this.performance.salaryTimes / 3600)).toFixed(2)
               return ((Number(a) / Number(b)) * 100).toFixed(2)
               // return Number(from.qualified) * infoBox.value.salary;
            }
         }
      },
@@ -268,7 +287,7 @@
               this.pageDJs()
            }
         },
         getLists() {
         getLists() {
            if (!this.finished) {
               return
            }
@@ -343,7 +362,7 @@
               url: `/pages_inspect/pages/InspectionRecords/InspectionRecords?id=${this.workorderId}`
            })
         },
         pageDJs() {
         pageDJs() {
            pageDJ({
                  capacity: this.pages.capacity,
                  page: this.pages.page,
@@ -427,7 +446,7 @@
         },
         queryByIds() {
            queryById(this.workorderId)
               .then(res => {
               .then(res => {
                  this.info = res.data
                  queryList({
                     deleted: 0,
@@ -464,10 +483,13 @@
         getOrocessRecordCC() {
            getWorkorderRecordListStandard({
               workorderId: this.workorderId
            }).then(res => {
            }).then(res => {
               console.log(res.data[0]);
               debugger
               if (res.data.length > 0) {
                  this.produceFrom.qualified = res.data[0].qualifiedNum
                  this.produceFrom.undesirable = res.data[0].unqualifiedNum
                  this.performance = res.data[0]
               }
            })
         },
@@ -512,13 +534,13 @@
      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;
@@ -535,9 +557,8 @@
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding-left: 30rpx;
            padding-right: 30rpx;
            margin-bottom: 30rpx;
            padding: 30rpx;
            background-color: #f7f7f7;
            .bg_list_item_top_left {
               display: flex;