ysy 1 жил өмнө
parent
commit
f9b0f415ed

+ 0 - 1
src/views/produce/components/feeding/index.vue

@@ -310,7 +310,6 @@ export default {
     checkCache(type, index) {
       return new Promise((resolve) => {
         if (type == 1) {
-          console.log([this.List[index]]);
           feedSaveCache(this.List).then((rr) => {
             this.$message.success('已经缓存');
           });

+ 7 - 1
src/views/produce/components/jobBooking/components/oneJobQualityBom.vue

@@ -196,12 +196,18 @@
 
     data() {
       return {};
+    },
+
+    methods: {
+      getDelete(index) {
+        this.list.splice(index, 1);
+      } 
     }
   };
 </script>
 
 <style lang="scss" scoped>
   .materialBor {
-    border: 1rpx solid #157a2c;
+    border: 1px solid #157a2c;
   }
 </style>

+ 295 - 8
src/views/produce/components/jobBooking/components/packingBom.vue

@@ -7,23 +7,310 @@
         <el-button size="mini" @click="handCancelPacking">重置打包</el-button>
       </div>
     </div>
-
-    
-
-
-
   </div>
 </template>
 
 <script>
   export default {
+    components: {},
+    props: {
+      objData: {
+        type: Object,
+        default: () => {}
+      },
+
+      taskId: {
+        type: String,
+        default: ''
+      },
+
+      workOrderId: {
+        type: String,
+        default: ''
+      }
+    },
+
     data() {
-      return {};
+      return {
+        formedNumLast: 0,
+
+        quantity: '',
+        unit: '',
+
+        unitList: [],
+
+        splitList: [],
+
+        packUnit: null,
+        temporaryNum: 0,
+        temporaryCount: 0,
+        temporaryList: [],
+        packTwoList: [],
+
+        show: false,
+        formData: {
+          wPackNum: null
+        }
+      };
+    },
+
+    computed: {
+      clientEnvironmentId() {
+        return this.$store.state.user.info.clientEnvironmentId;
+      }
     },
 
-    components: {},
     methods: {
-      handCancelPacking() {}
+      byCode() {
+        getByCode('packing_unit').then((res) => {
+          this.unitList = [];
+
+          res.forEach((obj, index) => {
+            for (let key in obj) {
+              if (obj.hasOwnProperty(key)) {
+                // 确保key是对象自身的属性
+
+                this.unitList.push({
+                  Key: `${key}`,
+                  Value: ` ${obj[key]}`
+                });
+              }
+            }
+          });
+        });
+      },
+
+      getPackingDetails() {
+        let param = {
+          workOrderId: this.workOrderId,
+          taskId: this.taskId,
+          tier: 1
+        };
+
+        getPackingReport(param).then((res) => {
+          this.splitList = res.detailList;
+          this.formedNumLast = res.totalQuantity;
+          this.quantity = res.quantity;
+          this.unit = res.unit;
+        });
+      },
+
+      handCancelPacking() {
+        uni.showModal({
+          title: `是否清空包装?`,
+          content: '',
+          confirmText: '确认',
+          success: () => {
+            let param = {
+              workOrderId: this.workOrderId,
+              taskId: this.taskId
+            };
+            cancelPacking(param).then((res) => {
+              this.getPackingDetails();
+              this.getPackingDetailsTwo();
+            });
+          }
+        });
+      },
+
+      handleSplit() {
+        if (this.splitList.length) {
+          uni.showToast({
+            title: '产品已分包',
+            icon: 'none'
+          });
+          return false;
+        }
+
+        if (!this.formedNumLast) {
+          uni.showToast({
+            title: '包装总数数量不能为空',
+            icon: 'none'
+          });
+          return false;
+        }
+
+        if (!this.quantity) {
+          uni.showToast({
+            title: '内包装单元数量不能为空',
+            icon: 'none'
+          });
+          return false;
+        }
+
+        if (!this.unit) {
+          uni.showToast({
+            title: '请选择包装单位',
+            icon: 'none'
+          });
+          return false;
+        }
+
+        let param = {
+          totalQuantity: this.formedNumLast,
+          quantity: this.quantity,
+          unit: this.unit,
+          workOrderId: this.workOrderId,
+          taskId: this.taskId,
+          tier: 1
+        };
+        packingReport(param).then((res) => {
+          this.splitList = res.map((m) => {
+            return {
+              check: false,
+              ...m
+            };
+          });
+
+          this.getPackingDetails();
+        });
+      },
+
+      handleCheck(idx, it) {
+        if (it.quantity <= 0) {
+          uni.showToast({
+            icon: 'none',
+            title: '数量为空不能勾选'
+          });
+
+          return false;
+        }
+
+        this.$set(this.splitList[idx], 'check', it.check ? 0 : 1);
+
+        this.temporaryList = [];
+
+        this.temporaryList = this.splitList.filter((e) => {
+          return e.check == 1;
+        });
+        this.temporaryNum = 0;
+        this.temporaryCount = 0;
+        if (this.temporaryList.length > 0) {
+          this.temporaryList.forEach((e) => {
+            this.temporaryNum = this.temporaryNum + 1;
+            this.temporaryCount = this.temporaryCount + Number(e.quantity);
+          });
+        }
+      },
+
+      handclose(it) {
+        this.splitList.forEach((f) => {
+          if (f.computeSize == it.computeSize) {
+            f.check = 0;
+          }
+        });
+
+        this.temporaryList = [];
+
+        this.temporaryList = this.splitList.filter((e) => {
+          return e.check == 1;
+        });
+      },
+
+      getPackingDetailsTwo() {
+        let param = {
+          totalQuantity: this.formedNumLast,
+          quantity: this.quantity,
+          unit: this.unit,
+          workOrderId: this.workOrderId,
+          taskId: this.taskId,
+          tier: 2
+        };
+        getPackingReportRepeat(param).then((res) => {
+          this.packTwoList = res.detailList;
+        });
+      },
+
+      handlePack() {
+        let _arr = [];
+        _arr = this.temporaryList.map((m) => {
+          return {
+            ...m,
+            isChecked: 1
+          };
+        });
+
+        let param = {
+          detailList: _arr,
+          quantity: this.temporaryCount,
+          totalQuantity: this.formedNumLast,
+          unit: this.packUnit,
+          taskId: this.taskId,
+          workOrderId: this.workOrderId,
+          tier: 2
+        };
+
+        packingReportRepeat(param).then((res) => {
+          this.temporaryList = [];
+          this.getPackingDetails();
+          this.getPackingDetailsTwo();
+        });
+      },
+
+      scrolltolower() {},
+
+      getData() {
+        let _packingReportMarginList = [];
+
+        _packingReportMarginList = this.splitList.filter((e) => {
+          return !e.parentId;
+        });
+
+        let packInfo = {
+          packingReportList: this.packTwoList,
+          packingReportMarginList: _packingReportMarginList,
+          formedNumLast: this.formedNumLast
+        };
+        return packInfo;
+      },
+
+      calculation() {
+        this.show = true;
+      },
+
+      calculationSave() {
+        let count = this.splitList.filter((item) => item.isChecked != 1).length;
+
+        if (this.formData.wPackNum <= count && count != 0) {
+          for (let i = 0; i < this.formData.wPackNum; i++) {
+            this.splitList[i].check = 1;
+          }
+          this.handleCheck(0, 0);
+          this.calculationClose();
+        } else {
+          if (count != 0) {
+            for (let i = 0; i < count; i++) {
+              this.splitList[i].check = 1;
+            }
+            this.handleCheck(0, 0);
+            this.calculationClose();
+          }
+          uni.showToast({
+            icon: 'none',
+            title: '外包装数超出内包装条数'
+          });
+        }
+      },
+
+      calculationClose() {
+        this.show = false;
+      },
+
+      calculationReset() {
+        this.formData.wPackNum = null;
+        this.splitList.forEach((f) => {
+          f.check = null;
+        });
+        this.temporaryList = [];
+        this.show = false;
+      }
+    },
+
+    created() {
+      this.formedNumLast = this.objData.formedNumLast;
+
+      this.byCode(), this.getPackingDetails();
+      this.getPackingDetailsTwo();
     }
   };
 </script>

+ 547 - 384
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,62 +93,135 @@
         </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="刻码" />
+          <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="数量" />
+          <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="位置" />
+          <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>{{
@@ -146,16 +230,31 @@
         </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" />
+          <el-input
+            v-else
+            size="mini"
+            class="content_num"
+            v-model="row.extInfo.reportWeight"
+            placeholder="报工重量"
+            type="digit"
+          />
         </template>
       </el-table-column>
 
-
-      <el-table-column label="质检结果" width="80" type=""  v-if="item.currentTaskDiagram.isFirstTask == 1 " >
+      <el-table-column
+        label="质检结果"
+        width="80"
+        type=""
+        v-if="item.currentTaskDiagram.isFirstTask == 1"
+      >
         <template slot-scope="{ row, $index }">
           <div @click="openNumerate(row, $index)">
             <div class="numerate">点击计算</div>
@@ -166,9 +265,20 @@
       <el-table-column label="处置" width="130" type="taskName">
         <template slot-scope="{ row, $index }">
           <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-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>
@@ -181,11 +291,20 @@
       </el-table-column>
     </el-table>
 
-    <el-dialog title="工序计算列表" :visible.sync="show" :before-close="cancel" :close-on-click-modal="false"
-      :close-on-press-escape="false" append-to-body width="800px">
+    <el-dialog
+      title="工序计算列表"
+      :visible.sync="show"
+      :before-close="cancel"
+      :close-on-click-modal="false"
+      :close-on-press-escape="false"
+      append-to-body
+      width="800px"
+    >
       <div class="material">
         <div class="btn_end">
-          <el-button type="primary" size="mini" @click="handAddParam">添加</el-button>
+          <el-button type="primary" size="mini" @click="handAddParam"
+            >添加</el-button
+          >
         </div>
         <div class="content_table2">
           <div class="head row rx-sc">
@@ -199,420 +318,464 @@
           <div class="table">
             <div class="tr row rx-sc" v-for="(it, idx) in paramList" :key="idx">
               <div class="item ww30">
-                <el-select size="mini" class="content_num" v-model="it.taskId" placeholder="请选择">
-                  <el-option v-for="item in stepsList" :label="item.taskTypeName" :value="item.taskId"
-                    :key="item.taskId">
+                <el-select
+                  size="mini"
+                  class="content_num"
+                  v-model="it.taskId"
+                  placeholder="请选择"
+                >
+                  <el-option
+                    v-for="item in stepsList"
+                    :label="item.taskTypeName"
+                    :value="item.taskId"
+                    :key="item.taskId"
+                  >
                   </el-option>
                 </el-select>
               </div>
 
               <div class="item ww20">
-                <el-input class="content_num" size="mini" v-model="it.billet" type="digit"
-                  @input="changeInp(it, idx)"></el-input>
+                <el-input
+                  class="content_num"
+                  size="mini"
+                  v-model="it.billet"
+                  type="digit"
+                  @input="changeInp(it, idx)"
+                ></el-input>
               </div>
 
               <div class="item ww20">
-                <el-input class="content_num" size="mini" v-model="it.density" type="digit"
-                  @input="changeInp(it, idx)"></el-input>
+                <el-input
+                  class="content_num"
+                  size="mini"
+                  v-model="it.density"
+                  type="digit"
+                  @input="changeInp(it, idx)"
+                ></el-input>
               </div>
 
-              <div class="item ww20" v-if="idx == 0 || idx != paramList.length - 1">
-                < {{ it.CVIWeight }} </div>
+              <div
+                class="item ww20"
+                v-if="idx == 0 || idx != paramList.length - 1"
+              >
+                < {{ it.CVIWeight }}
+              </div>
 
-                  <div class="item ww20" v-if="paramList.length > 1 && idx == paramList.length - 1">
-                    ≥ {{ it.CVIWeight }}
-                  </div>
+              <div
+                class="item ww20"
+                v-if="paramList.length > 1 && idx == paramList.length - 1"
+              >
+                ≥ {{ it.CVIWeight }}
+              </div>
 
-                  <div class="item ww20 rx-cc" @click="getDelete(idx)">
-                    <el-link type="danger">删除</el-link>
-                  </div>
+              <div class="item ww20 rx-cc" @click="getDelete2(idx)">
+                <el-link type="danger">删除</el-link>
               </div>
             </div>
           </div>
+        </div>
 
-          <div class="formula_box">计算公式: 物料重量/坯体密度*密度系数 </div>
+        <div class="formula_box">计算公式: 物料重量/坯体密度*密度系数 </div>
 
-          <div class="reportWeight rx-sc">
-            物料重量: {{ weight }} ; 报工重量: {{ reportWeight }}
-          </div>
+        <div class="reportWeight rx-sc">
+          物料重量: {{ weight }} ; 报工重量: {{ reportWeight }}
         </div>
-
-        <template slot="footer">
-          <el-button size="mini" type="primary" @click="paramSave">保存并计算</el-button>
-          <el-button size="mini" type="primary" @click="save">计算</el-button>
-          <el-button size="mini" @click="cancel">取消</el-button>
-        </template>
+      </div>
+
+      <template slot="footer">
+        <el-button size="mini" type="primary" @click="paramSave"
+          >保存并计算</el-button
+        >
+        <el-button size="mini" type="primary" @click="save">计算</el-button>
+        <el-button size="mini" @click="cancel">取消</el-button>
+      </template>
     </el-dialog>
   </div>
 </template>
 
 <script>
-import {
-  getTaskInstanceList,
-  getComputeParam,
-  saveParam
-} from '@/api/produce/job';
-
-export default {
-  name: 'semiProductJobBom',
-
-  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();
+  import {
+    getTaskInstanceList,
+    getComputeParam,
+    saveParam
+  } from '@/api/produce/job';
+
+  export default {
+    name: 'semiProductJobBom',
+
+    props: {
+      list: {
+        type: Array,
+        default: () => []
+      },
+      equipmentList: {
+        type: Array,
+        default: () => []
+      },
+
+      item: {
+        type: Object,
+        default: () => {}
+      },
+      isDetails: {
+        type: Boolean,
+        default: false
+      },
+      singleReport: {
+        default: null
       }
-    }
-  },
-
-  data() {
-    return {
-      deviceList: [],
-
-      stepsList: [],
-
-      weight: 0,
-      reportWeight: 0,
-
-      paramList: [],
-
-      resultObj: {},
-      resultIdx: 0,
-
-      show: false
-    };
-  },
-
-  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();
-          }
-        });
-      });
-    },
-
-    selectName(value, idx) {
-      const taskObj = this.stepsList.find((item) => item.taskId === value);
-      this.$set(this.list[idx].extInfo, 'taskName', taskObj.taskTypeName);
-      this.$forceUpdate();
+    watch: {
+      equipmentList: {
+        immediate: true,
+        deep: true,
+        handler(newVal) {
+          this.deviceList = newVal;
+          this.changeHeatNumber();
+        }
+      }
     },
 
-    openNumerate(row, idx) {
-      if (!row.extInfo.reportWeight) {
-        this.$message({ message: '请先输入报工重量', type: 'warning' });
-        return false;
-      }
-      this.weight = row.extInfo.weight;
-      this.reportWeight = row.extInfo.reportWeight;
-      this.resultIdx = idx;
+    data() {
+      return {
+        deviceList: [],
 
-      this.show = true;
-    },
+        stepsList: [],
 
-    getCompute() {
-      getComputeParam(
-        this.item.workOrderId,
-        this.item.currentTaskDiagram.taskId
-      ).then((res) => {
-        this.paramList = [];
-        this.paramList = (res && res.paramList) || [];
-        this.paramObj = res || {};
-      });
-    },
+        weight: 0,
+        reportWeight: 0,
 
-    handAddParam() {
-      this.paramList.push({
-        taskId: null,
-        taskName: null
-      });
-    },
-    getDelete(idx) {
-      this.paramList.splice(idx, 1);
-    },
+        paramList: [],
 
-    changeInp(item, index) {
-      if (Number(item.billet) && Number(item.density)) {
-        this.paramList[index].CVIWeight = (
-          (Number(this.weight) / item.billet) *
-          item.density
-        ).toFixed(2);
-      }
-    },
+        resultObj: {},
+        resultIdx: 0,
 
-    cancel() {
-      this.show = false;
-      this.reportWeight = 0;
-      this.weight = 0;
+        show: false
+      };
     },
 
-    paramSave() {
-      if (this.paramList.length > 0) {
-        let bol;
-        let _i;
-        bol = this.paramList.every((e, i) => {
-          _i = i + 1;
-          return e.taskId && e.billet && e.density;
+    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();
+            }
+          });
         });
+      },
 
-        if (!bol) {
-          this.$message({ message: `第${_i}行数据不全`, type: 'warning' });
+      selectName(value, idx) {
+        const taskObj = this.stepsList.find((item) => item.taskId === value);
+        this.$set(this.list[idx].extInfo, 'taskName', taskObj.taskTypeName);
+        this.$forceUpdate();
+      },
 
+      openNumerate(row, idx) {
+        if (!row.extInfo.reportWeight) {
+          this.$message({ message: '请先输入报工重量', type: 'warning' });
           return false;
         }
+        this.weight = row.extInfo.weight;
+        this.reportWeight = row.extInfo.reportWeight;
+        this.resultIdx = idx;
+
+        this.show = true;
+      },
+
+      getCompute() {
+        getComputeParam(
+          this.item.workOrderId,
+          this.item.currentTaskDiagram.taskId
+        ).then((res) => {
+          this.paramList = [];
+          this.paramList = (res && res.paramList) || [];
+          this.paramObj = res || {};
+        });
+      },
 
-        if (this.paramList.length < 1) {
-          this.$message({
-            message: '请输入二个以上计算数据',
-            type: 'warning'
-          });
-
-          return false;
+      handAddParam() {
+        this.paramList.push({
+          taskId: null,
+          taskName: null
+        });
+      },
+      getDelete(idx) {
+        this.list.splice(idx, 1);
+      },
+
+      getDelete2(idx) {
+        this.paramList.splice(idx, 1);
+      },
+
+      changeInp(item, index) {
+        if (Number(item.billet) && Number(item.density)) {
+          this.paramList[index].CVIWeight = (
+            (Number(this.weight) / item.billet) *
+            item.density
+          ).toFixed(2);
         }
-      }
-      let param = {};
-
-      if (!Object.prototype.hasOwnProperty.call(this.paramObj, 'id')) {
-        param = {
-          paramList: this.paramList,
-          workOrderId: this.item.workOrderId,
-          taskId: this.item.currentTaskDiagram.taskId
-        };
-      } else {
-        this.paramObj.paramList = this.paramList;
-        param = this.paramObj;
-      }
+      },
+
+      cancel() {
+        this.show = false;
+        this.reportWeight = 0;
+        this.weight = 0;
+      },
+
+      paramSave() {
+        if (this.paramList.length > 0) {
+          let bol;
+          let _i;
+          bol = this.paramList.every((e, i) => {
+            _i = i + 1;
+            return e.taskId && e.billet && e.density;
+          });
 
-      saveParam(param).then((res) => {
-        this.$message({ message: '保存成功', type: 'success' });
-        this.getCompute();
+          if (!bol) {
+            this.$message({ message: `第${_i}行数据不全`, type: 'warning' });
 
-        this.save()
-      });
-    },
+            return false;
+          }
 
-    save() {
-      if (this.item.currentTaskDiagram.isFirstTask == 1) {
-        this.resultObj = {};
+          if (this.paramList.length < 1) {
+            this.$message({
+              message: '请输入二个以上计算数据',
+              type: 'warning'
+            });
 
-        if (Number(this.reportWeight) < Number(this.paramList[0].CVIWeight)) {
-          this.resultObj = this.paramList[0];
-          this.setDataSave();
-          return false;
+            return false;
+          }
         }
-
-        if (
-          Number(this.reportWeight) >=
-          this.paramList[this.paramList.length - 1].CVIWeight
-        ) {
-          this.resultObj = this.paramList[this.paramList.length - 1];
-          this.setDataSave();
-          return false;
+        let param = {};
+
+        if (!Object.prototype.hasOwnProperty.call(this.paramObj, 'id')) {
+          param = {
+            paramList: this.paramList,
+            workOrderId: this.item.workOrderId,
+            taskId: this.item.currentTaskDiagram.taskId
+          };
+        } else {
+          this.paramObj.paramList = this.paramList;
+          param = this.paramObj;
         }
 
-        for (let i = 1; i < this.paramList.length; i++) {
+        saveParam(param).then((res) => {
+          this.$message({ message: '保存成功', type: 'success' });
+          this.getCompute();
+
+          this.save();
+        });
+      },
+
+      save() {
+        if (this.item.currentTaskDiagram.isFirstTask == 1) {
+          this.resultObj = {};
+
+          if (Number(this.reportWeight) < Number(this.paramList[0].CVIWeight)) {
+            this.resultObj = this.paramList[0];
+            this.setDataSave();
+            return false;
+          }
 
-          console.log(
-            11,
-            Number(this.paramList[i - 1].CVIWeight),
-            Number(this.reportWeight)
-          );
           if (
-            Number(this.paramList[i - 1].CVIWeight) <
-            Number(this.reportWeight) &&
-            Number(this.reportWeight) < Number(this.paramList[i].CVIWeight)
+            Number(this.reportWeight) >=
+            this.paramList[this.paramList.length - 1].CVIWeight
           ) {
-            this.resultObj = this.paramList[i];
-            break;
+            this.resultObj = this.paramList[this.paramList.length - 1];
+            this.setDataSave();
+            return false;
           }
+
+          for (let i = 1; i < this.paramList.length; i++) {
+            console.log(
+              11,
+              Number(this.paramList[i - 1].CVIWeight),
+              Number(this.reportWeight)
+            );
+            if (
+              Number(this.paramList[i - 1].CVIWeight) <
+                Number(this.reportWeight) &&
+              Number(this.reportWeight) < Number(this.paramList[i].CVIWeight)
+            ) {
+              this.resultObj = this.paramList[i];
+              break;
+            }
+          }
+          this.setDataSave();
         }
-        this.setDataSave();
+      },
+
+      setDataSave() {
+        this.$set(
+          this.list[this.resultIdx].extInfo,
+          'taskId',
+          this.resultObj.taskId
+        );
+        this.$set(
+          this.list[this.resultIdx].extInfo,
+          'density',
+          this.resultObj.density
+        );
+        this.$set(
+          this.list[this.resultIdx].extInfo,
+          'billet',
+          this.resultObj.billet
+        );
+        this.$set(
+          this.list[this.resultIdx].extInfo,
+          'taskName',
+          this.resultObj.taskName
+        );
+
+        this.cancel();
       }
     },
 
-    setDataSave() {
+    created() {
+      this.getTaskFn();
+      this.getCompute();
+    }
+  };
+</script>
 
-      this.$set(this.list[this.resultIdx].extInfo, 'taskId', this.resultObj.taskId)
-      this.$set(this.list[this.resultIdx].extInfo, 'density', this.resultObj.density)
-      this.$set(this.list[this.resultIdx].extInfo, 'billet', this.resultObj.billet)
-      this.$set(this.list[this.resultIdx].extInfo, 'taskName', this.resultObj.taskName)
+<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;
+  }
 
-      this.cancel()
-    },
+  .numerate {
+    font-size: 22rpx;
+    color: #157a2c;
+    cursor: pointer;
+  }
 
-  },
+  .material {
+    width: 100%;
+  }
 
-  created() {
-    this.getTaskFn();
-    this.getCompute();
+  .btn_end {
+    text-align: right;
+    margin-bottom: 10px;
   }
-};
-</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;
-}
-
-.material {
-  width: 100%;
-}
-
-.btn_end {
-  text-align: right;
-  margin-bottom: 10px;
-}
-
-.content_table2 {
-  width: 100%;
-
-  .row {
+  .content_table2 {
     width: 100%;
 
-    .item {
-      color: #404446;
-      font-size: 14px;
-      padding-left: 6px;
-    }
+    .row {
+      width: 100%;
 
-    .color157 {
-      color: #157a2c;
-    }
+      .item {
+        color: #404446;
+        font-size: 14px;
+        padding-left: 6px;
+      }
 
-    .ww20 {
-      width: 20%;
-    }
+      .color157 {
+        color: #157a2c;
+      }
 
-    .ww30 {
-      width: 30%;
-    }
+      .ww20 {
+        width: 20%;
+      }
 
-    .ww25 {
-      width: 25%;
-    }
+      .ww30 {
+        width: 30%;
+      }
+
+      .ww25 {
+        width: 25%;
+      }
+
+      .ww35 {
+        width: 35%;
+      }
 
-    .ww35 {
-      width: 35%;
+      .ww10 {
+        width: 10%;
+      }
     }
 
-    .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;
+      }
     }
-  }
 
-  .head {
-    height: 32px;
-    background: #f7f9fa;
-    border-top: 1px solid #e3e5e5;
-    border-left: 1px solid #e3e5e5;
+    .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;
+      }
 
-    .item {
-      height: 32px;
-      line-height: 32px;
-      border-right: 1px solid #e3e5e5;
-      box-sizing: border-box;
+      &:last-child {
+        border-bottom: 1px solid #e3e5e5;
+      }
     }
   }
 
-  .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;
-    }
+  .formula_box {
+    font-size: 12px;
+    font-style: normal;
+    font-weight: 400;
+    margin-top: 15px;
+    color: #157a2c;
+  }
 
-    &:last-child {
-      border-bottom: 1px solid #e3e5e5;
-    }
+  .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;
   }
-}
-
-.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>

+ 481 - 277
src/views/produce/components/jobBooking/index.vue

@@ -1,350 +1,554 @@
 <template>
   <div>
     <div class="top_fixed">
-      <el-button type="primary" size="mini" @click="save(2, 'all')">一键报工</el-button>
-      <el-button type="primary" size="mini" @click="removeCacheFn('all')">清空缓存</el-button>
-      <el-button type="primary" size="mini" @click="save(1, 'all')">缓存</el-button>
+      <el-button type="primary" size="mini" @click="save(2, 'all')"
+        >一键报工</el-button
+      >
+      <el-button type="primary" size="mini" @click="removeCacheFn('all')"
+        >清空缓存</el-button
+      >
+      <el-button type="primary" size="mini" @click="save(1, 'all')"
+        >缓存</el-button
+      >
     </div>
 
     <div class="job_box">
-      <div v-for="(item, index) in List" :key="index" class="card_box" v-if="isLoad">
+      <div
+        v-for="(item, index) in List"
+        :key="index"
+        class="card_box"
+        v-if="isLoad"
+      >
         <div class="title_box rx-bc">
           <div class="name">工单信息 </div>
 
           <div class="rx-bc">
-            <el-button type="text" size="mini" @click="openPicking(item.id, item)">添加物料</el-button>
-            <el-button type="text" size="mini" @click="removeCacheFn(item.id)">清空缓存</el-button>
-            <el-button type="text" size="mini" @click="save(1, index)">缓存</el-button>
+            <el-button
+              type="text"
+              size="mini"
+              @click="openPicking(item.id, item)"
+              >添加物料</el-button
+            >
+            <el-button type="text" size="mini" @click="removeCacheFn(item.id)"
+              >清空缓存</el-button
+            >
+            <el-button type="text" size="mini" @click="save(1, index)"
+              >缓存</el-button
+            >
           </div>
         </div>
 
         <workOrderBom :item="item"></workOrderBom>
-        <paramBom v-if="item.paramDetailList.length != 0" :list="item.paramDetailList"></paramBom>
-
-        <jobBom :item="item" :notFormed="item.notFormedList" :warehouseList="warehouseList"></jobBom>
-
-        <deviceBom v-if="item.equipmentList.length != 0" :list="item.equipmentList"></deviceBom>
-
-        <modelBom v-if="item.modelList.length != 0" :list="item.modelList" pattern="job" ref="modelRef"></modelBom>
-
-        <palletBom v-if="item.palletList.length != 0" :list="item.palletList"></palletBom>
-
-        <revolvingDiskBom v-if="item.revolvingDiskList.length > 0" pattern="job" :list="objData.revolvingDiskList">
+        <paramBom
+          v-if="item.paramDetailList.length != 0"
+          :list="item.paramDetailList"
+        ></paramBom>
+
+        <jobBom
+          :item="item"
+          :notFormed="item.notFormedList"
+          :warehouseList="warehouseList"
+        ></jobBom>
+
+        <deviceBom
+          v-if="item.equipmentList.length != 0"
+          :list="item.equipmentList"
+        ></deviceBom>
+
+        <modelBom
+          v-if="item.modelList.length != 0"
+          :list="item.modelList"
+          pattern="job"
+          ref="modelRef"
+        ></modelBom>
+
+        <palletBom
+          v-if="item.palletList.length != 0"
+          :list="item.palletList"
+        ></palletBom>
+
+        <revolvingDiskBom
+          v-if="item.revolvingDiskList.length > 0"
+          pattern="job"
+          :list="objData.revolvingDiskList"
+        >
         </revolvingDiskBom>
 
-        <semiProductJobBom :singleReport="item.singleReport" v-if="
-          item.semiProductList &&
-          item.semiProductList.length != 0 &&
-          taskObj.type != 4 &&
-          taskObj.type != 6
-        " :item="item" :list="item.semiProductList" :equipmentList="item.equipmentList"></semiProductJobBom>
-
-        <oneJobQualityBom :singleReport="item.singleReport" v-if="
-          item.semiProductList &&
-          item.semiProductList.length != 0 &&
-          taskObj.type == 6 &&
-          item.singleReport == 1
-        " :item="item" :list="item.semiProductList">
+        <semiProductJobBom
+          :singleReport="item.singleReport"
+          v-if="
+            item.semiProductList &&
+            item.semiProductList.length != 0 &&
+            taskObj.type != 4 &&
+            taskObj.type != 6
+          "
+          :item="item"
+          :list="item.semiProductList"
+          :equipmentList="item.equipmentList"
+        ></semiProductJobBom>
+
+        <oneJobQualityBom
+          :singleReport="item.singleReport"
+          v-if="
+            item.semiProductList &&
+            item.semiProductList.length != 0 &&
+            taskObj.type == 6 &&
+            item.singleReport == 1
+          "
+          :item="item"
+          :list="item.semiProductList"
+        >
         </oneJobQualityBom>
 
-        <byProductBom v-if="item.productRecycleList.length != 0" :list="item.productRecycleList">
+        <byProductBom
+          v-if="item.productRecycleList.length != 0"
+          :list="item.productRecycleList"
+        >
         </byProductBom>
 
-        <turnoverBom v-if="item.turnover.length != 0" :list="item.turnover" :wordItem="item" pattern="job">
+        <turnoverBom
+          v-if="item.turnover.length != 0"
+          :list="item.turnover"
+          :wordItem="item"
+          pattern="job"
+        >
         </turnoverBom>
 
-        <aridRegion v-if="item.aridRegionList.length != 0" :list="item.aridRegionList" :isType="true"></aridRegion>
-
-        <packingBom :workOrderId="item.id" :objData="item" ref="packRef"
-          v-if='taskObj.type == 4 && clientEnvironmentId != 3 && item'></packingBom>
-
-        <packingTgBom v-if="
-          item.pickOutInList &&
-          item.pickOutInList.length != 0 &&
-          taskObj.type == 4 &&
-          clientEnvironmentId == 3
-        " :list="item.pickOutInList" :item="item"></packingTgBom>
+        <aridRegion
+          v-if="item.aridRegionList.length != 0"
+          :list="item.aridRegionList"
+          :isType="true"
+        ></aridRegion>
+
+        <!-- <packingBom :taskId='taskObj.id' :workOrderId="item.id" :objData="item" ref="packRef"
+          v-if='taskObj.type == 4 && clientEnvironmentId != 3 && item'></packingBom> -->
+
+        <packingTgBom
+          v-if="
+            item.pickOutInList &&
+            item.pickOutInList.length != 0 &&
+            taskObj.type == 4 &&
+            clientEnvironmentId == 3
+          "
+          :list="item.pickOutInList"
+          :item="item"
+        ></packingTgBom>
       </div>
     </div>
 
-    <pickingList isType="job" ref="pickingListRef" @allSelection="allSelection"></pickingList>
+    <pickingList
+      isType="job"
+      ref="pickingListRef"
+      @allSelection="allSelection"
+    ></pickingList>
   </div>
 </template>
 
 <script>
-import { listByIdsReport } from '@/api/produce/job';
-import { getWarehouseList } from '@/api/produce/index';
-import pickingList from '../picking/pickingList.vue';
-
-import workOrderBom from '../feeding/components/workOrderBom.vue';
-import paramBom from '../feeding/components/paramBom.vue';
-import jobBom from './components/jobBom.vue';
-import deviceBom from '../feeding/components/deviceBom.vue';
-import modelBom from '../feeding/components/modelBom.vue';
-import palletBom from './components/palletBom.vue';
-import revolvingDiskBom from '../feeding/components/revolvingDiskBom.vue';
-import oneJobQualityBom from './components/oneJobQualityBom.vue';
-import semiProductJobBom from './components/semiProductJobBom.vue';
-
-import byProductBom from './components/byProductBom.vue';
-import turnoverBom from './components/turnoverBom.vue';
-import aridRegion from '../feeding/components/aridRegion.vue';
-import packingBom from './components/packingBom.vue';
-import packingTgBom from './components/packingTgBom';
-export default {
-  components: {
-    pickingList,
-
-    workOrderBom,
-    paramBom,
-    jobBom,
-    deviceBom,
-    modelBom,
-    palletBom,
-    revolvingDiskBom,
-    oneJobQualityBom,
-    semiProductJobBom,
-    byProductBom,
-    turnoverBom,
-    aridRegion,
-    packingBom,
-    packingTgBom
-  },
-  props: {
-    workListIds: {
-      type: Array,
-      default() {
-        return [];
+  import { listByIdsReport } from '@/api/produce/job';
+  import { getWarehouseList } from '@/api/produce/index';
+  import pickingList from '../picking/pickingList.vue';
+
+  import workOrderBom from '../feeding/components/workOrderBom.vue';
+  import paramBom from '../feeding/components/paramBom.vue';
+  import jobBom from './components/jobBom.vue';
+  import deviceBom from '../feeding/components/deviceBom.vue';
+  import modelBom from '../feeding/components/modelBom.vue';
+  import palletBom from './components/palletBom.vue';
+  import revolvingDiskBom from '../feeding/components/revolvingDiskBom.vue';
+  import oneJobQualityBom from './components/oneJobQualityBom.vue';
+  import semiProductJobBom from './components/semiProductJobBom.vue';
+
+  import byProductBom from './components/byProductBom.vue';
+  import turnoverBom from './components/turnoverBom.vue';
+  import aridRegion from '../feeding/components/aridRegion.vue';
+  import packingBom from './components/packingBom.vue';
+  import packingTgBom from './components/packingTgBom';
+  export default {
+    components: {
+      pickingList,
+
+      workOrderBom,
+      paramBom,
+      jobBom,
+      deviceBom,
+      modelBom,
+      palletBom,
+      revolvingDiskBom,
+      oneJobQualityBom,
+      semiProductJobBom,
+      byProductBom,
+      turnoverBom,
+      aridRegion,
+      packingBom,
+      packingTgBom
+    },
+    props: {
+      workListIds: {
+        type: Array,
+        default() {
+          return [];
+        }
       }
-    }
-  },
+    },
 
-  computed: {
-    taskObj() {
-      return this.$store.state.user.taskObj;
-    }
-  },
+    computed: {
+      taskObj() {
+        return this.$store.state.user.taskObj;
+      }
+    },
 
-  data() {
-    return {
-      List: [],
-      idsList: [],
-      isLoad: false,
+    data() {
+      return {
+        List: [],
+        idsList: [],
+        isLoad: false,
 
-      warehouseList: []
-    };
-  },
+        warehouseList: []
+      };
+    },
+
+    computed: {
+      taskObj() {
+        return this.$store.state.user.taskObj;
+      },
 
-  computed: {
-    taskObj() {
-      return this.$store.state.user.taskObj;
+      clientEnvironmentId() {
+        return this.$store.state.user.info.clientEnvironmentId;
+      }
     },
 
-    clientEnvironmentId() {
-      return this.$store.state.user.info.clientEnvironmentId;
-    }
-  },
+    watch: {
+      workListIds: {
+        handler(val) {
+          this.getList(val);
+        },
+        deep: true,
+        immediate: true
+      }
+    },
 
-  watch: {
-    workListIds: {
-      handler(val) {
-        this.getList(val);
-      },
-      deep: true,
-      immediate: true
-    }
-  },
-
-  created() {
-    this.getWarehouseListFn();
-  },
-
-  methods: {
-    getList(ids) {
-      this.idsList = ids || [];
-      let param = {
-        ids: ids,
-        taskId: this.taskObj.id,
-        type: 0
-      };
-      this.isLoad = false;
-      listByIdsReport(param)
-        .then((res) => {
-          this.List = res.map((obj) => {
-            if (!Object.prototype.hasOwnProperty.call(obj, 'turnover')) {
-              obj['turnover'] = [];
-            }
-            if (
-              !Object.prototype.hasOwnProperty.call(obj, 'aridRegionList')
-            ) {
-              obj['aridRegionList'] = [];
-            }
+    created() {
+      this.getWarehouseListFn();
+    },
 
-            if (!Object.prototype.hasOwnProperty.call(obj, 'instanceList')) {
-              obj['instanceList'] = [];
-            }
+    methods: {
+      getList(ids) {
+        this.idsList = ids || [];
+        let param = {
+          ids: ids,
+          taskId: this.taskObj.id,
+          type: 0
+        };
+        this.isLoad = false;
+        listByIdsReport(param)
+          .then((res) => {
+            this.List = res.map((obj) => {
+              if (!Object.prototype.hasOwnProperty.call(obj, 'turnover')) {
+                obj['turnover'] = [];
+              }
+              if (
+                !Object.prototype.hasOwnProperty.call(obj, 'aridRegionList')
+              ) {
+                obj['aridRegionList'] = [];
+              }
 
-            if (!Object.prototype.hasOwnProperty.call(obj, 'palletList')) {
-              obj['palletList'] = [];
-            }
+              if (!Object.prototype.hasOwnProperty.call(obj, 'instanceList')) {
+                obj['instanceList'] = [];
+              }
 
-            if (
-              !Object.prototype.hasOwnProperty.call(obj, 'revolvingDiskList')
-            ) {
-              obj['revolvingDiskList'] = [];
-            }
+              if (!Object.prototype.hasOwnProperty.call(obj, 'palletList')) {
+                obj['palletList'] = [];
+              }
+
+              if (
+                !Object.prototype.hasOwnProperty.call(obj, 'revolvingDiskList')
+              ) {
+                obj['revolvingDiskList'] = [];
+              }
+
+              if (obj.palletList.length > 0) {
+                obj.palletList = obj.palletList.map((m) => {
+                  return {
+                    hideKc: true, // 不显示库存
+                    quantity: m.feedQuantity,
+                    ...m
+                  };
+                });
+              }
+
+              if (this.taskObj.type == 6 && this.clientEnvironmentId == 3) {
+                obj.semiProductList = obj.pickOutInList;
+              }
 
-            if (obj.palletList.length > 0) {
-              obj.palletList = obj.palletList.map((m) => {
+              obj.workReportInfo = {
+                formingNum: null,
+                formingWeight: null,
+                formedNum: null,
+                formedWeight: null,
+                taskId: this.taskObj.id
+              };
+
+              obj.notFormedList = [
+                {
+                  notFormedNum: null,
+                  notFormedWeight: null,
+                  weightUnit: obj.weightUnit,
+                  unit: obj.unit,
+                  warehouseId: null // 处置 仓库id
+                }
+              ];
+
+              if (obj.semiProductList.length > 0) {
+                // 预制体报工
+                obj.workReportInfo.formedNum = obj.semiProductList.length;
+              }
+
+              obj.workReportInfo.formingNum = obj.formingNum;
+              obj.workReportInfo.formingWeight = obj.formingWeight;
+              obj.workReportInfo.unit = obj.unit;
+              obj.workReportInfo.weightUnit = obj.weightUnit;
+              obj.workReportInfo.workOrderId = obj.workOrderId;
+
+              obj.paramDetailList.map((m) => {
+                if (m.extInfo.textType == 5) {
+                  m.remainingTime = m.extInfo.remainingTime;
+                }
                 return {
-                  hideKc: true, // 不显示库存
-                  quantity: m.feedQuantity,
-                  ...m
+                  ...m.extInfo
                 };
               });
-            }
 
-            if (this.taskObj.type == 6 && this.clientEnvironmentId == 3) {
-              obj.semiProductList = obj.pickOutInList;
+              return {
+                ...obj
+              };
+            });
+          })
+          .finally(() => {
+            this.isLoad = true;
+
+            if (this.taskObj.type == 1) {
+              this.getCacheFn();
             }
+          });
+      },
 
-            obj.workReportInfo = {
-              formingNum: null,
-              formingWeight: null,
-              formedNum: null,
-              formedWeight: null,
-              taskId: this.taskObj.id
-            };
-
-            obj.notFormedList = [
-              {
-                notFormedNum: null,
-                notFormedWeight: null,
-                weightUnit: obj.weightUnit,
-                unit: obj.unit,
-                warehouseId: null // 处置 仓库id
+      openPicking(id, item) {
+        this.$refs.pickingListRef.open(id, item);
+      },
+
+      allSelection(id, selectList) {
+        this.List.forEach((m) => {
+          if (m.id == id) {
+            let turnover = [];
+            let equipmentList = []; // 生产设备
+
+            selectList.forEach((f) => {
+              if (f.rootCategoryLevelId == 4) {
+                equipmentList = equipmentList.concat(f);
               }
-            ];
+              if (f.rootCategoryLevelId == 7) {
+                turnover = turnover.concat(f);
+              }
+            });
 
-            if (obj.semiProductList.length > 0) {
-              // 预制体报工
-              obj.workReportInfo.formedNum = obj.semiProductList.length;
-            }
+            this.$set(m, 'equipmentList', equipmentList);
+            this.$set(m, 'turnover', turnover);
+
+            this.$forceUpdate();
+          }
+        });
+      },
+
+      async save(type) {
+        const loading = this.$loading({
+          lock: true,
+          text: '加载中',
+          background: 'rgba(0, 0, 0, 0.7)'
+        });
 
-            obj.workReportInfo.formingNum = obj.formingNum;
-            obj.workReportInfo.formingWeight = obj.formingWeight;
-            obj.workReportInfo.unit = obj.unit;
-            obj.workReportInfo.weightUnit = obj.weightUnit;
-            obj.workReportInfo.workOrderId = obj.workOrderId;
+        let bol2;
+        bol2 = this.List.every((e) => {
+          return (
+            e.workReportInfo['formedNum'] && e.workReportInfo['formedNum'] != 0
+          );
+        });
+
+        if (!bol2) {
+          this.$message.warning('请输入合格品数量');
+          loading.close();
+          return false;
+        }
 
-            obj.paramDetailList.map((m) => {
-              if (m.extInfo.textType == 5) {
-                m.remainingTime = m.extInfo.remainingTime;
+        // 预制体
+
+        let wId;
+        let bol = true;
+        let _i;
+        this.List.forEach((L) => {
+          if (L.semiProductList.length > 0 && this.taskObj.type != 4) {
+            bol = L.semiProductList.every((e, i) => {
+              _i = i + 1;
+              wId = L.code;
+
+              if (this.taskObj.type == 6) {
+                return (
+                  Object.prototype.hasOwnProperty.call(e.extInfo, 'taskId') &&
+                  e.extInfo.taskId
+                );
+              } else {
+                return (
+                  Object.prototype.hasOwnProperty.call(e.extInfo, 'taskId') &&
+                  e.extInfo.taskId &&
+                  e.extInfo.reportWeight
+                );
               }
-              return {
-                ...m.extInfo
-              };
             });
+          }
+        });
+
+        if (!bol) {
+          this.$message.warning(`请完善工单${wId}第${_i}处置方式`);
+          loading.close();
+
+          return false;
+        }
 
-            return {
-              ...obj
-            };
+        if (this.clientEnvironmentId != 2) {
+          let succ = this.List.some((L) => {
+            return L.productRecycleList.length > 0;
           });
-        })
-        .finally(() => {
-          this.isLoad = true;
 
-          if (this.taskObj.type == 1) {
-            this.getCacheFn();
+          if (succ) {
+            loading.close();
+            const isRecycle = await this.checkRecycle();
+            if (!isRecycle) {
+              return false;
+            }
           }
-        });
-    },
+        }
 
-    openPicking(id, item) {
-      this.$refs.pickingListRef.open(id, item);
-    },
+        // if (this.taskObj.type == 4 && this.clientEnvironmentId != 3) {
+        // 	const isPack = await this.checkPack()
 
-    allSelection(id, selectList) {
-      this.List.forEach((m) => {
-        if (m.id == id) {
-          let turnover = [];
-          let equipmentList = []; // 生产设备
+        // 	if (!isPack) {
+        // 		return false
+        // 	}
+        // }
 
-          selectList.forEach((f) => {
-            if (f.rootCategoryLevelId == 4) {
-              equipmentList = equipmentList.concat(f);
-            }
-            if (f.rootCategoryLevelId == 7) {
-              turnover = turnover.concat(f);
-            }
+        if (this.taskObj.type == 1) {
+          const isCache = await this.checkCache(type);
+
+          if (!isCache) {
+            return false;
+          }
+        }
+
+        jobSave(this.List)
+          .then((res) => {
+            loading.close();
+            this.$message.success('报工成功')
+            this.getList(this.idsList);;
+       
+          })
+          .finally(() => {
+            setTimeout(function () {
+              loading.close();
+            }, 3000);
           });
+      },
 
-          this.$set(m, 'equipmentList', equipmentList);
-          this.$set(m, 'turnover', turnover);
+      checkRecycle() {
+        return new Promise((resolve) => {
+          this.$confirm('是否跳过副产品回收处置!', '提示', {
+            confirmButtonText: '确定',
+            cancelButtonText: '取消',
+            type: 'warning'
+          })
+            .then(() => {
+              resolve(true);
+            })
+            .catch(() => {
+              resolve(false);
+            });
+        });
+      },
 
-          this.$forceUpdate();
-        }
-      });
-    },
-    async save(type, index) { },
 
-    getCacheFn() { },
+      checkCache(type) {
+
+				return new Promise((resolve) => {
+					if (type == 1) {
+
+						saveCache(this.List).then(rr => {
+				   this.$message.success('缓存成功')
+						})
+						resolve(false)
+					} else if (type == 2) {
+						resolve(true)
+					}
 
-    removeCacheFn(type) { },
+				})
+			},
 
-    getWarehouseListFn() {
-      getWarehouseList().then((res) => {
-        this.warehouseList = res.data;
-      });
+
+      getCacheFn() {},
+
+      removeCacheFn(type) {},
+
+      getWarehouseListFn() {
+        getWarehouseList().then((res) => {
+          this.warehouseList = res.data;
+        });
+      }
     }
-  }
-};
+  };
 </script>
 
 <style scoped lang="scss">
-.top_fixed {
-  width: 100%;
-  height: 40px;
-  background: #fff;
-  display: flex;
-  align-items: center;
-  justify-content: flex-end;
-}
-
-.title_box {
-  .name {
-    font-size: 14px;
-    font-style: normal;
-    font-weight: 400;
-    color: #157a2c;
-    padding-left: 5px;
-    position: relative;
-
-    &:before {
-      position: absolute;
-      content: '';
-      left: 0px;
-      top: 0px;
-      bottom: 0px;
-      width: 2px;
-      height: 14px;
-      background: #157a2c;
-      margin: auto;
+  .top_fixed {
+    width: 100%;
+    height: 40px;
+    background: #fff;
+    display: flex;
+    align-items: center;
+    justify-content: flex-end;
+  }
+
+  .title_box {
+    .name {
+      font-size: 14px;
+      font-style: normal;
+      font-weight: 400;
+      color: #157a2c;
+      padding-left: 5px;
+      position: relative;
+
+      &:before {
+        position: absolute;
+        content: '';
+        left: 0px;
+        top: 0px;
+        bottom: 0px;
+        width: 2px;
+        height: 14px;
+        background: #157a2c;
+        margin: auto;
+      }
     }
   }
-}
-
-.job_box {
-  margin-top: 6px;
-  width: 100%;
-  height: calc(100vh - 70px - 50px - 80px - 60px);
-  overflow-y: scroll;
-  overflow-x: hidden;
-}
-
-.card_box {
-  background: #fff;
-  padding: 8px;
-  border-radius: 2px;
-}
+
+  .job_box {
+    margin-top: 6px;
+    width: 100%;
+    height: calc(100vh - 70px - 50px - 80px - 60px);
+    overflow-y: scroll;
+    overflow-x: hidden;
+  }
+
+  .card_box {
+    background: #fff;
+    padding: 8px;
+    border-radius: 2px;
+  }
 </style>