ysy hai 1 ano
pai
achega
5260ba19a1

+ 239 - 113
src/views/produce/components/jobBooking/components/oneJobQualityBomPL.vue

@@ -1,7 +1,7 @@
 <template>
   <div>
     <div class="title_box rx-bc mt6">
-      <div class="name">报工信息({{ list.length || 0 }})个 </div>
+      <div class="name">取样信息({{ list.length || 0 }})个 </div>
 
       <div class="rx-bc"> </div>
     </div>
@@ -15,153 +15,134 @@
       style="width: 100%"
       stripe
       border
+      :default-expand-all="true"
     >
-      <el-table-column label="序号" type="index" width="55">
+      <el-table-column type="expand" label="批量" width="80">
         <template slot-scope="{ row, $index }">
-          {{ $index + 1 }}
-        </template>
-      </el-table-column>
+          <div class="material" :key="$index">
+            <div class="btn_end">
+              <div class="content_table2">
+                <div class="head row rx-sc">
+                  <div class="item ww25">合格品数量</div>
+                  <div class="item ww25"
+                    >报工总重量 /{{ row.extInfo.weightUnit }}
+                  </div>
+                  <div class="item ww25">处置</div>
+                  <div class="item ww25">取样</div>
+                </div>
 
-      <el-table-column label="编码" type="code" minWidth="110">
-        <template slot-scope="{ row, $index }">
-          {{ row.code }}
-        </template>
-      </el-table-column>
+                <div class="table">
+                  <div
+                    class="tr row rx-sc"
+                    v-for="(it, yyIdx) in row.extInfo.batchReportInfo"
+                    :key="$index + yyIdx"
+                  >
+                    <div class="item ww25">
+                      <div>{{ it.allFeedQuantity }}</div>
+                    </div>
 
-      <el-table-column label="名称" type="name" minWidth="110">
-        <template slot-scope="{ row, $index }">
-          {{ row.name }}
-        </template>
-      </el-table-column>
+                    <div class="item ww25">
+                      <div>{{ it.allReportWeight }}</div>
+                    </div>
 
-      <el-table-column label="型号" type="modelType">
-        <template slot-scope="{ row, $index }">
-          {{ row.modelType }}
-        </template>
-      </el-table-column>
+                    <div class="item ww25">
+                      <el-select
+                        size="mini"
+                        class="content_num"
+                        filterable
+                        v-model="it.taskId"
+                        placeholder="请选择"
+                        disabled
+                      >
+                        <el-option
+                          v-for="item in stepsList"
+                          :label="item.taskTypeName"
+                          :value="item.taskId"
+                          :key="item.taskId"
+                        >
+                        </el-option>
+                      </el-select>
+                    </div>
 
-      <el-table-column label="规格" type="specification">
-        <template slot-scope="{ row, $index }">
-          {{ row.specification }}
+                    <div class="item ww25">
+                      <div v-if="isDetails">{{ it.sample }}</div>
+                      <el-input
+                        v-else
+                        class="content_num"
+                        size="mini"
+                        v-model="it.sample"
+                        type="number"
+                        @input="blurNum(it, $index, yyIdx)"
+                      ></el-input>
+                    </div>
+                  </div>
+                </div>
+              </div>
+            </div>
+          </div>
         </template>
       </el-table-column>
 
-      <el-table-column label="牌号" type="brandNum">
+      <el-table-column label="序号" width="85">
         <template slot-scope="{ row, $index }">
-          {{ row.brandNum }}
+          {{ $index + 1 }}
+          <div class="tag_box" v-if="row.isCache">缓</div>
         </template>
       </el-table-column>
 
-      <el-table-column label="包装库存" type="brandNum">
+      <el-table-column label="编码" prop="code" minWidth="110">
         <template slot-scope="{ row, $index }">
-          {{ row.packingCountBase }}/ {{ row.minUnit }}
+          {{ row.code }}
         </template>
       </el-table-column>
 
-      <el-table-column
-        v-if="singleReport == 1"
-        :label="currentTaskDiagram.isFirstTask == 1 ? '物料重量' : '上道重量'"
-        type="weightUnit"
-      >
+      <el-table-column label="名称" prop="name" minWidth="140">
         <template slot-scope="{ row, $index }">
-          <div v-if="currentTaskDiagram.isFirstTask == 1">
-            {{ row.extInfo.weight || 0 }} {{ row.extInfo.weightUnit }}</div
-          >
-          <div v-if="currentTaskDiagram.isFirstTask == 0">
-            {{ row.extInfo.newWeight || 0 }}
-            {{ row.extInfo.weightUnit }}</div
-          >
+          {{ row.name }}
         </template>
       </el-table-column>
 
-      <el-table-column v-if="singleReport == 1" label="刻码" type="engrave">
+      <el-table-column label="型号" type="modelType">
         <template slot-scope="{ row, $index }">
-          {{ row.extInfo.engrave }}
+          {{ row.modelType }}
         </template>
       </el-table-column>
 
-      <el-table-column
-        v-if="singleReport == 1"
-        label="物料代号"
-        type="materielCode"
-      >
+      <el-table-column label="规格" prop="specification">
         <template slot-scope="{ row, $index }">
-          {{ row.extInfo.materielCode }}
+          {{ row.specification }}
         </template>
       </el-table-column>
 
-      <el-table-column
-        v-if="singleReport == 1 && deviceList.length > 0"
-        width="140"
-        label="设备"
-        type="deviceId"
-      >
+      <el-table-column label="牌号" prop="brandNum">
         <template slot-scope="{ row, $index }">
-          <el-select
-            class="content_num"
-            v-model="row.deviceId"
-            filterable
-            placeholder="请选择"
-            @change="(e) => selectVal(e, row, $index)"
-            size="mini"
-          >
-            <el-option
-              v-for="item in deviceList"
-              :label="item.name + '-' + item.codeNumber"
-              :value="item.id"
-              :key="item.id"
-            >
-            </el-option>
-          </el-select>
+          {{ row.brandNum }}
         </template>
       </el-table-column>
 
-      <el-table-column
-        v-if="singleReport == 1 && deviceList.length > 0"
-        label="炉次号"
-        width="90"
-        type="heatNumber"
-      >
+      <el-table-column width="140" label="设备" prop="deviceId">
         <template slot-scope="{ row, $index }">
-          <el-input
-            size="mini"
-            class="content_num"
-            v-model="row.extInfo.heatNumber"
-            placeholder="请输入炉次号"
-          />
+          {{ row.deviceName || row.extInfo.deviceName }}
         </template>
       </el-table-column>
 
-      <el-table-column
-        v-if="singleReport == 1"
-        label="数量"
-        width="90"
-        type="feedQuantity"
-      >
+      <el-table-column label="炉次号" width="90" prop="heatNumber">
         <template slot-scope="{ row, $index }">
-          <el-input
-            size="mini"
-            class="content_num"
-            v-model="row.feedQuantity"
-            placeholder="数量"
-          />
+          {{ row.extInfo.heatNumber }}
         </template>
       </el-table-column>
 
-      <el-table-column
-        v-if="singleReport == 1"
-        label="位置"
-        width="110"
-        type="feedQuantity"
-      >
+      <el-table-column label="投料数量" width="90" prop="feedQuantity">
         <template slot-scope="{ row, $index }">
-          {{ row.extInfo.position }}
+          {{ row.feedQuantity }}
         </template>
       </el-table-column>
 
-      <el-table-column label="操作" fixed="right" width="60px" v-if="!isDetails">
+      <el-table-column label="操作" width="60px">
         <template slot-scope="{ $index, row }">
-          <el-link type="danger" @click="getDelete($index)">删除</el-link>
+          <el-link v-if="!isDetails" type="danger" @click="getDelete($index)"
+            >删除</el-link
+          >
         </template>
       </el-table-column>
     </el-table>
@@ -169,6 +150,8 @@
 </template>
 
 <script>
+  import { getTaskInstanceList } from '@/api/produce/job';
+
   export default {
     name: 'semiProductJobBom',
 
@@ -177,12 +160,8 @@
         type: Array,
         default: () => []
       },
-      equipmentList: {
-        type: Array,
-        default: () => []
-      },
 
-      currentTaskDiagram: {
+      item: {
         type: Object,
         default: () => {}
       },
@@ -196,19 +175,166 @@
     },
 
     data() {
-      return {};
+      return {
+        stepsList: []
+      };
     },
 
     methods: {
-      getDelete(index) {
-        this.list.splice(index, 1);
-      } 
+      getTaskFn() {
+        getTaskInstanceList(this.item.workOrderId).then((res) => {
+          this.stepsList = res;
+        });
+      },
+
+      getDelete(idx) {
+        this.list.splice(idx, 1);
+      },
+
+      blurNum(it, idx, yyIdx) {
+        let value = it.sample;
+        value = value.replace(/\./g, '');
+
+        if (
+          Number(value) >
+          Number(this.list[idx].extInfo.batchReportInfo[yyIdx].allFeedQuantity)
+        ) {
+          this.$set(this.list[idx].extInfo.batchReportInfo[yyIdx], 'sample', 0);
+          this.$forceUpdate();
+        }
+      }
+    },
+
+    created() {
+      this.getTaskFn();
     }
   };
 </script>
 
 <style lang="scss" scoped>
-  .materialBor {
-    border: 1px solid #157a2c;
+  .tag_box {
+    display: inline-block;
+    padding: 1px 6px;
+    margin-right: 6px;
+    background: #e6a23c;
+    font-size: 11px;
+    color: #fff;
+    border-radius: 2px;
+  }
+
+  .content_num {
+    --input-background-color: #f0f8f2;
+  }
+
+  .numerate {
+    font-size: 22rpx;
+    color: #157a2c;
+    cursor: pointer;
+  }
+
+  .material {
+    width: 90%;
+    margin: auto;
+  }
+
+  .btn_end {
+    text-align: right;
+    margin-bottom: 10px;
+  }
+
+  .content_table2 {
+    width: 100%;
+
+    .row {
+      width: 100%;
+
+      .item {
+        color: #404446;
+        font-size: 14px;
+        padding-left: 6px;
+        text-align: center;
+      }
+
+      .color157 {
+        color: #157a2c;
+      }
+
+      .ww20 {
+        width: 20%;
+      }
+
+      .ww30 {
+        width: 30%;
+      }
+
+      .ww25 {
+        width: 25%;
+      }
+
+      .ww35 {
+        width: 35%;
+      }
+
+      .ww10 {
+        width: 10%;
+      }
+    }
+
+    .head {
+      height: 32px;
+      background: #f7f9fa;
+      border-top: 1px solid #e3e5e5;
+      border-left: 1px solid #e3e5e5;
+
+      .item {
+        height: 32px;
+        line-height: 32px;
+        border-right: 1px solid #e3e5e5;
+        box-sizing: border-box;
+      }
+    }
+
+    .tr {
+      border-top: 1px solid #e3e5e5;
+      border-left: 1px solid #e3e5e5;
+
+      .item {
+        font-size: 12px;
+        min-height: 32px;
+        display: flex;
+        align-items: center;
+        border-right: 1px solid #e3e5e5;
+        box-sizing: border-box;
+        white-space: normal;
+        word-break: break-all;
+      }
+
+      &:last-child {
+        border-bottom: 1px solid #e3e5e5;
+      }
+    }
+  }
+
+  .formula_box {
+    font-size: 12px;
+    font-style: normal;
+    font-weight: 400;
+    margin-top: 15px;
+    color: #157a2c;
+  }
+
+  .reportWeight {
+    font-size: 12px;
+    font-style: normal;
+    font-weight: 400;
+    margin-top: 15px;
+    color: #157a2c;
+  }
+
+  .content_num {
+    display: flex;
+    align-items: center;
+    padding: 2px;
+    --input-background-color: #f0f8f2;
   }
 </style>