ysy 1 anno fa
parent
commit
ce36afa2c6

+ 254 - 146
src/views/produce/components/jobBooking/components/semiProductJobBom.vue

@@ -6,8 +6,16 @@
       <div class="rx-bc"> </div>
     </div>
 
-    <el-table ref="oneJobQualityBom" class="table_content" :max-height="600" :data="list" tooltip-effect="dark"
-      style="width: 100%" stripe border>
+    <el-table
+      ref="oneJobQualityBom"
+      class="table_content"
+      :max-height="600"
+      :data="list"
+      tooltip-effect="dark"
+      style="width: 100%"
+      stripe
+      border
+    >
       <el-table-column label="序号" type="index" width="55">
         <template slot-scope="{ row, $index }">
           {{ $index + 1 }}
@@ -16,17 +24,20 @@
 
       <el-table-column label="次数" type="index" width="80">
         <template slot-scope="{ row, $index }">
-          <div class="tag_box" v-if="
-            Object.prototype.hasOwnProperty.call(row, 'extInfo') &&
-            Object.prototype.hasOwnProperty.call(
-              row.extInfo,
-              'productionTimes'
-            ) &&
-            Object.prototype.hasOwnProperty.call(
-              row.extInfo.productionTimes,
-              item.currentTaskDiagram.taskId
-            )
-          ">
+          <div
+            class="tag_box"
+            v-if="
+              Object.prototype.hasOwnProperty.call(row, 'extInfo') &&
+              Object.prototype.hasOwnProperty.call(
+                row.extInfo,
+                'productionTimes'
+              ) &&
+              Object.prototype.hasOwnProperty.call(
+                row.extInfo.productionTimes,
+                item.currentTaskDiagram.taskId
+              )
+            "
+          >
             {{ row.extInfo.productionTimes[item.currentTaskDiagram.taskId] }}
           </div>
 
@@ -48,12 +59,12 @@
             row.rootCategoryLevelId == 2
               ? '在制品'
               : row.rootCategoryLevelId == 23
-                ? '半成品'
-                : row.rootCategoryLevelId == 9
-                  ? '产品'
-                  : row.rootCategoryLevelId == 28
-                    ? '废品'
-                    : ''
+              ? '半成品'
+              : row.rootCategoryLevelId == 9
+              ? '产品'
+              : row.rootCategoryLevelId == 28
+              ? '废品'
+              : ''
           }})
         </template>
       </el-table-column>
@@ -82,101 +93,194 @@
         </template>
       </el-table-column>
 
-      <el-table-column v-if="singleReport == 1" :label="item.currentTaskDiagram.isFirstTask == 1 ? '物料重量' : '上道重量'
-        " type="weightUnit">
+      <el-table-column
+        v-if="singleReport == 1"
+        :label="
+          item.currentTaskDiagram.isFirstTask == 1 ? '物料重量' : '上道重量'
+        "
+        type="weightUnit"
+      >
         <template slot-scope="{ row, $index }">
           <div v-if="item.currentTaskDiagram.isFirstTask == 1">
-            {{ row.extInfo.weight || 0 }} {{ row.extInfo.weightUnit }}</div>
+            {{ row.extInfo.weight || 0 }} {{ row.extInfo.weightUnit }}</div
+          >
           <div v-if="item.currentTaskDiagram.isFirstTask == 0">
             {{ row.extInfo.newWeight || 0 }}
-            {{ row.extInfo.weightUnit }}</div>
+            {{ row.extInfo.weightUnit }}</div
+          >
         </template>
       </el-table-column>
 
       <el-table-column v-if="singleReport == 1" label="刻码" type="engrave">
         <template slot-scope="{ row, $index }">
-          <span v-if='isDetails'>{{ row.extInfo.engrave }}</span>
-          <el-input v-else size="mini" class="content_num" v-model="row.extInfo.engrave" placeholder="刻码" />
+          <span v-if="isDetails">{{ row.extInfo.engrave }}</span>
+          <el-input
+            v-else
+            size="mini"
+            class="content_num"
+            v-model="row.extInfo.engrave"
+            placeholder="刻码"
+          />
         </template>
       </el-table-column>
 
-      <el-table-column v-if="singleReport == 1" label="物料代号" type="materielCode">
+      <el-table-column
+        v-if="singleReport == 1"
+        label="物料代号"
+        type="materielCode"
+      >
         <template slot-scope="{ row, $index }">
-          <span v-if='isDetails'>{{ row.extInfo.materielCode }}</span>
-          <el-input v-else size="mini" class="content_num" v-model="row.extInfo.materielCode" placeholder="数量" />
-
+          <span v-if="isDetails">{{ row.extInfo.materielCode }}</span>
+          <el-input
+            v-else
+            size="mini"
+            class="content_num"
+            v-model="row.extInfo.materielCode"
+            placeholder="数量"
+          />
         </template>
       </el-table-column>
 
-      <el-table-column v-if="singleReport == 1 && deviceList.length > 0" width="140" label="设备" type="deviceId">
+      <el-table-column
+        v-if="singleReport == 1 && deviceList.length > 0"
+        width="140"
+        label="设备"
+        type="deviceId"
+      >
         <template slot-scope="{ row, $index }">
-          <el-select class="content_num" v-model="row.deviceId" 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-select
+            class="content_num"
+            v-model="row.deviceId"
+            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>
         </template>
       </el-table-column>
 
-      <el-table-column v-if="singleReport == 1 && deviceList.length > 0" label="炉次号" width="90" type="heatNumber">
+      <el-table-column
+        v-if="singleReport == 1 && deviceList.length > 0"
+        label="炉次号"
+        width="90"
+        type="heatNumber"
+      >
         <template slot-scope="{ row, $index }">
-          <el-input size="mini" class="content_num" v-model="row.extInfo.heatNumber" placeholder="请输入炉次号" />
+          <el-input
+            size="mini"
+            class="content_num"
+            v-model="row.extInfo.heatNumber"
+            placeholder="请输入炉次号"
+          />
         </template>
       </el-table-column>
 
-      <el-table-column v-if="singleReport == 1" label="数量" width="90" type="feedQuantity">
+      <el-table-column
+        v-if="singleReport == 1"
+        label="数量"
+        width="90"
+        type="feedQuantity"
+      >
         <template slot-scope="{ row, $index }">
-          <el-input size="mini" class="content_num" v-model="row.feedQuantity" placeholder="数量" />
+          <el-input
+            size="mini"
+            class="content_num"
+            v-model="row.feedQuantity"
+            placeholder="数量"
+          />
         </template>
       </el-table-column>
 
-      <el-table-column v-if="singleReport == 1" label="位置" width="110" type="position">
+      <el-table-column
+        v-if="singleReport == 1"
+        label="位置"
+        width="110"
+        type="position"
+      >
         <template slot-scope="{ row, $index }">
-          <span v-if='isDetails'>{{ row.extInfo.position }}</span>
-          <el-input v-else size="mini" class="content_num" v-model="row.extInfo.position" placeholder="位置" />
+          <span v-if="isDetails">{{ row.extInfo.position }}</span>
+          <el-input
+            v-else
+            size="mini"
+            class="content_num"
+            v-model="row.extInfo.position"
+            placeholder="位置"
+          />
         </template>
       </el-table-column>
 
-
-      <el-table-column v-if="singleReport == 1" label="物料重量" width="110" type="weight">
+      <el-table-column
+        v-if="singleReport == 1"
+        label="物料重量"
+        width="110"
+        type="weight"
+      >
         <template slot-scope="{ row, $index }">
           <div class="tag_box">{{ row.extInfo.newWeight ? '上' : '原' }}</div>
-          <span>{{ row.extInfo.newWeight ? row.extInfo.newWeight : row.extInfo.weight }}</span>
+          <span>{{
+            row.extInfo.newWeight ? row.extInfo.newWeight : row.extInfo.weight
+          }}</span>
         </template>
       </el-table-column>
 
-
-      <el-table-column v-if="singleReport == 1" label="报工重量" width="110" type="feedQuantity">
+      <el-table-column
+        v-if="singleReport == 1"
+        label="报工重量"
+        width="110"
+        type="feedQuantity"
+      >
         <template slot-scope="{ row, $index }">
-          <span v-if='isDetails'>{{ row.extInfo.reportWeight }}</span>
-          <el-input v-else size="mini" class="content_num" v-model="row.extInfo.reportWeight" placeholder="报工重量"
-            type='digit' />
-
+          <span v-if="isDetails">{{ row.extInfo.reportWeight }}</span>
+          <el-input
+            v-else
+            size="mini"
+            class="content_num"
+            v-model="row.extInfo.reportWeight"
+            placeholder="报工重量"
+            type="digit"
+          />
         </template>
       </el-table-column>
 
-
       <!-- v-if="item.currentTaskDiagram.isFirstTask == 1 " -->
-      <el-table-column label="质检结果" width="110" type="">
+      <el-table-column label="质检结果" width="80" type="">
         <template slot-scope="{ row, $index }">
-          <div  @click="openNumerate(row, $index)">
-							<div class="numerate">点击计算</div>
-						</div>
-
+          <div @click="openNumerate(row, $index)">
+            <div class="numerate">点击计算</div>
+          </div>
         </template>
       </el-table-column>
 
-      <el-table-column label="处置" width="110" type="taskName">
+      <el-table-column label="处置" width="130" type="taskName">
         <template slot-scope="{ row, $index }">
-          <span v-if='isDetails'>{{ row.extInfo.taskName }}</span>
-        
 
+          <span v-if="isDetails">{{ row.extInfo.taskName }}</span>
+          <el-select
+            v-else
+            size="mini"
+            class="content_num"
+            v-model="row.extInfo.taskId"
+            placeholder="请选择"
+            @change="(e) => selectName(e, $index)"
+          >
+            <el-option
+              v-for="item in stepsList"
+              :label="item.taskTypeName"
+              :value="item.taskId"
+              :key="item.taskId"
+            >
+            </el-option>
+          </el-select>
         </template>
       </el-table-column>
 
-
-
       <el-table-column label="操作" fixed="right" width="60px">
         <template slot-scope="{ $index, row }">
           <el-link type="danger" @click="getDelete($index)">删除</el-link>
@@ -189,106 +293,110 @@
 <script>
   import { getTaskInstanceList } from '@/api/produce/job';
 
-export default {
-  name: 'semiProductJobBom',
+  export default {
+    name: 'semiProductJobBom',
 
-  props: {
-    list: {
-      type: Array,
-      default: () => []
-    },
-    equipmentList: {
-      type: Array,
-      default: () => []
-    },
+    props: {
+      list: {
+        type: Array,
+        default: () => []
+      },
+      equipmentList: {
+        type: Array,
+        default: () => []
+      },
 
-    item: {
-      type: Object,
-      default: () => { }
-    },
-    isDetails: {
-      type: Boolean,
-      default: false
-    },
-    singleReport: {
-      default: null
-    }
-  },
-
-  watch: {
-    equipmentList: {
-      immediate: true,
-      deep: true,
-      handler(newVal) {
-        this.deviceList = newVal;
-        this.changeHeatNumber();
+      item: {
+        type: Object,
+        default: () => {}
+      },
+      isDetails: {
+        type: Boolean,
+        default: false
+      },
+      singleReport: {
+        default: null
       }
-    }
-  },
+    },
 
-  data() {
-    return {
-      deviceList: [],
+    watch: {
+      equipmentList: {
+        immediate: true,
+        deep: true,
+        handler(newVal) {
+          this.deviceList = newVal;
+          this.changeHeatNumber();
+        }
+      }
+    },
 
-      stepsList: []
-    };
-  },
+    data() {
+      return {
+        deviceList: [],
 
-  methods: {
+        stepsList: []
+      };
+    },
 
-    getTaskFn() {
-      console.log(this.item, 'this.item')
-        getTaskInstanceList(this.item.id).then((res) => {
+    methods: {
+      getTaskFn() {
+        getTaskInstanceList(this.item.workOrderId).then((res) => {
           this.stepsList = res;
-
-
         });
       },
 
-    changeHeatNumber() {
-      this.deviceList.forEach((f) => {
-        this.list.forEach((o) => {
-          if (
-            o.deviceId &&
-            f.instanceId == o.deviceId &&
-            this.deviceList.length > 1
-          ) {
-            o.extInfo.heatNumber = f.extInfo.heatNumber;
-            this.$forceUpdate();
-          } else if (this.deviceList.length == 1) {
-            o.extInfo.heatNumber = this.deviceList[0].extInfo.heatNumber;
-            this.$forceUpdate();
-          }
+      changeHeatNumber() {
+        this.deviceList.forEach((f) => {
+          this.list.forEach((o) => {
+            if (
+              o.deviceId &&
+              f.instanceId == o.deviceId &&
+              this.deviceList.length > 1
+            ) {
+              o.extInfo.heatNumber = f.extInfo.heatNumber;
+              this.$forceUpdate();
+            } else if (this.deviceList.length == 1) {
+              o.extInfo.heatNumber = this.deviceList[0].extInfo.heatNumber;
+              this.$forceUpdate();
+            }
+          });
         });
-      });
-    }
-  },
+      },
 
-  created() {
-    this.getTaskFn()
-  }
-  
+      
+    selectName(value, idx) {
+      const taskObj = this.stepsList.find(item => item.taskId === value);
+      this.$set(this.list[idx].extInfo, 'taskName', taskObj.taskTypeName)
+      this.$forceUpdate()
+
+    },
+    },
+
+
+    created() {
+      this.getTaskFn();
+    }
   };
 </script>
 
 <style lang="scss" scoped>
-.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;
-			}
+  .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;
+  }
 </style>

+ 1 - 0
src/views/produce/components/routings.vue

@@ -58,6 +58,7 @@
       },
 
       handleClose() {
+        this.activeIndex = 0;
         this.$emit('closeRoute');
       }
     },