Просмотр исходного кода

Merge branch 'dev' of http://110.41.163.243:9980/kd-aiot/kd-aiot-frontend-mes into dengfei

695593266@qq.com 10 месяцев назад
Родитель
Сommit
c71df156d3

+ 34 - 6
src/views/batchRecord/components/editModal.vue

@@ -1179,7 +1179,7 @@
     },
     methods: {
       // 外部调用,打开弹窗
-      open(type, data) {
+      open(type, data, activeComp = 'main') {
         console.log('data', type, data);
         this.type = type;
         this.form.reportWorkType = this.reportWorkType;
@@ -1203,6 +1203,9 @@
           this.title = `${this.reportWorkTypeName}事项`;
           this.form.workOrderId = data.workOrderId;
           this.form.id = data.id;
+          if (data.processInstanceId) {
+            this.activeComp = activeComp;
+          }
           if (this.form.workOrderId) {
             this.getProductTaskList(this.form.workOrderId);
             // 根据工单id 获取详情
@@ -1245,6 +1248,10 @@
           );
           this.teamUserList = this.teamAllList[index];
         }
+        // 加载班组列表
+        if(this.teamList.length == 0 && this.form.teamId){
+          this.getTeamList(this.form.teamId);
+        }
         console.log('this.form', this.form);
         this.loading = false;
         this.getListByWorkOrderId();
@@ -1307,6 +1314,7 @@
         this.details = null;
         this.workOrderInfo = null;
         this.rulesDetail = null;
+        this.activeComp = 'main';
         this.$nextTick(() => {
           this.$refs.formRef.clearValidate();
           this.visible = false;
@@ -1548,6 +1556,25 @@
           body.duration = body.duration * 60 * 60 * 1000;
         }
 
+        // 设置物料和产出明细中的  ruleId 、produceTaskId、produceTaskInstanceId
+        body.outputDetails = body.outputDetails.map((i) => {
+          return {
+            ...i,
+            ruleId: body.ruleId,
+            produceTaskId: body.produceTaskId,
+            produceTaskInstanceId: body.produceTaskInstanceId
+          };
+        });
+
+        body.pickDetails = body.pickDetails.map((i) => {
+          return {
+            ...i,
+            ruleId: body.ruleId,
+            produceTaskId: body.produceTaskId,
+            produceTaskInstanceId: body.produceTaskInstanceId
+          };
+        });
+
         this.butLoading = true;
         console.log('body', body);
         try {
@@ -1669,9 +1696,11 @@
         console.log('materialObject 物料信息', materialObject);
         this.form.outputDetails = materialObject.outputDetails.map((i) => {
           i.reportQuantityCopy = i.reportQuantity;
+          i.qualifiedQuantityCopy = i.qualifiedQuantity;
+          i.noQualifiedQuantityCopy = i.noQualifiedQuantity;
 
           const sumItem = materialObject.sumOutputDetails.find(
-            (i) => i.categoryCode === i.categoryCode
+            (item) => item.categoryCode === i.categoryCode
           );
 
           if (sumItem) {
@@ -1744,14 +1773,12 @@
           return i;
         });
 
-        this.preOutputDetails = preOutputDetails.filter(
-          (i) => i.outputType != 1
-        );
+        this.preOutputDetails = preOutputDetails;
 
         this.sumOutputDetails = materialObject.sumOutputDetails;
 
         this.form.pickDetails = [
-          ...preOutputDetails.filter((i) => i.outputType == 1),
+          ...preOutputDetails.map((i) => i),
           ...pickDetails
         ];
 
@@ -1826,6 +1853,7 @@
         console.log('this.teamUserList', this.teamUserList);
       },
       async getTeamList(id) {
+        if(!id) return;
         const ids = id.split(',');
         this.teamList = [];
         this.teamUserList = [];

+ 36 - 0
src/views/batchRecord/components/list.vue

@@ -40,6 +40,16 @@
         >
           {{ row.code }}
         </el-link>
+
+        <!-- <template v-slot:approvalStatus="{ row }">
+          <el-link
+            type="primary"
+            :underline="false"
+            @click="openEdit('detail', row, 'bpm')"
+          >
+            {{ approvalStatusText(row) }}
+          </el-link>
+        </template> -->
       </template>
 
       <template v-slot:action="{ row }">
@@ -328,6 +338,12 @@
             type: 'input',
             placeholder: '请输入'
           },
+          {
+            label: '生产工单号:',
+            value: 'workOrderCode',
+            type: 'input',
+            placeholder: '请输入'
+          },
           {
             label: '类型:',
             value: 'itemType',
@@ -488,6 +504,26 @@
         this.$message.success('报工成功!');
         this.butLoading = false;
         this.reload();
+      },
+      approvalStatusText(row) {
+        switch (row.approvalStatus) {
+          case 0:
+            return '未提交';
+          case 1:
+            return '审核中';
+          case 2:
+            return '审核通过';
+          case 3:
+            return '审核不通过';
+          case 4:
+            return '终止审核中';
+          case 5:
+            return '终止审核通过';
+          case 7:
+            return '流程废止';
+          default:
+            return '';
+        }
       }
     }
   };

+ 26 - 3
src/views/checklistManagement/checklist.vue

@@ -19,7 +19,10 @@
           >
         </template>
         <template v-slot:action="{ row }">
-          <el-link type="text" @click="checkAddConfirm('edit', row)"
+          <el-link
+            type="text"
+            v-if="row.approvalStatus == 0"
+            @click="checkAddConfirm('edit', row)"
             >编辑</el-link
           >
           <el-link
@@ -29,6 +32,7 @@
             >提交</el-link
           >
           <el-popconfirm
+            v-if="row.approvalStatus != 1"
             title="您确定要删除这条数据吗?"
             @confirm="deleteRow(row)"
           >
@@ -49,6 +53,7 @@
       ref="checkAddRef"
       @confirm="checkAddConfirm('add', $event)"
     ></checkAdd>
+
     <checkDetails ref="checkDetailsRef" @reload="reload"></checkDetails>
 
     <process-submit-dialog
@@ -101,6 +106,16 @@
             minWidth: 110,
             showOverflowTooltip: true
           },
+          {
+            prop: 'checklistType',
+            label: '放行类型',
+            align: 'center',
+            minWidth: 110,
+            showOverflowTooltip: true,
+            formatter: (row) => {
+              return this.getDictValue('放行类型', row.checklistType + '');
+            }
+          },
           {
             prop: 'productCode',
             label: '产品编码',
@@ -132,7 +147,7 @@
             }
           },
           {
-            prop: 'code',
+            prop: 'workOrderCode',
             label: '生产工单号',
             align: 'center',
             minWidth: 110,
@@ -304,6 +319,12 @@
       // 提交审批
       openApproval(row) {
         console.log('row', row);
+
+        let businessType = this.getDictValue(
+          '放行类型',
+          row.checklistType + ''
+        );
+        console.log('businessType', businessType);
         this.processSubmitDialogFlag = true;
         this.$nextTick(async () => {
           let params = {
@@ -311,7 +332,9 @@
             businessKey: 'work_order_checklist_approval',
             formCreateUserId: row.createUserId,
             variables: {
-              businessCode: row.code
+              businessCode: row.code,
+              businessName: '放行单',
+              businessType: businessType
             }
           };
 

+ 111 - 19
src/views/checklistManagement/components/checkDetails.vue

@@ -40,6 +40,7 @@
       :model="form"
       :rules="rules"
       label-width="100px"
+      :disabled="type == 'detail'"
     >
       <header-title title="基本信息"></header-title>
 
@@ -73,7 +74,11 @@
         :datasource="form.orders"
       >
         <template v-slot:action="{ row }">
-          <el-link icon="el-icon-edit" type="primary" :underline="false"
+          <el-link
+            icon="el-icon-edit"
+            type="primary"
+            :underline="false"
+            @click="openWorkOrderDetail(row)"
             >详情</el-link
           >
           <el-link
@@ -223,12 +228,6 @@
         </tr>
       </table>
 
-      <bpmTask
-        v-if="form.processInstanceId"
-        :id="form.processInstanceId"
-        :businessId="form.id"
-      ></bpmTask>
-
       <!-- 选择生产工单 -->
       <selectWorkOrder
         ref="selectWorkOrderRef"
@@ -247,14 +246,14 @@
 
     <template v-slot:footer>
       <el-button
-        v-if="type != 'detail'"
+        v-if="type != 'detail' && !form.approvalStatus"
         type="primary"
-        @click="submit"
+        @click="submit('submit')"
         :loading="butLoading"
-        >提 交</el-button
+        >保存并提交</el-button
       >
       <el-button
-        v-if="type != 'detail'"
+        v-if="type != 'detail' && !form.approvalStatus"
         type="primary"
         @click="submit('save')"
         :loading="butLoading"
@@ -262,6 +261,15 @@
       >
       <el-button @click="handleClose">取 消</el-button>
     </template>
+
+    <detailsPop ref="detailsRef"> </detailsPop>
+
+    <process-submit-dialog
+      :processSubmitDialogFlag.sync="processSubmitDialogFlag"
+      v-if="processSubmitDialogFlag"
+      ref="processSubmitDialogRef"
+      :isNotNeedProcess="false"
+    ></process-submit-dialog>
   </ele-modal>
 </template>
 
@@ -278,10 +286,27 @@
   } from '@/api/checklistrecord/index';
   import bpmTask from '@/components/bpmTask/bpmTask.vue';
   import bpmDetail from '@/views/bpm/processInstance/detail.vue';
+  import detailsPop from '@/views/produceOrder/components/details/index.vue';
+  import { getById as getworkOrderById } from '@/api/produceOrder/index';
+  import processSubmitDialog from '@/components/processSubmitDialog/processSubmitDialog.vue';
 
   export default {
     mixins: [dictMixins],
-    components: { selectWorkOrder, SelectUser, bpmTask, bpmDetail },
+    components: {
+      selectWorkOrder,
+      SelectUser,
+      bpmTask,
+      bpmDetail,
+      detailsPop,
+      processSubmitDialog
+    },
+    props: {
+      // 保存是否关闭弹窗
+      saveClose: {
+        type: Boolean,
+        default: false
+      }
+    },
     data() {
       const formBaseData = {
         id: null,
@@ -333,7 +358,8 @@
         activeComp: 'main',
         showSelectUser: false,
         // 0 生产验收人 1 质检验收人
-        selectUserType: 0
+        selectUserType: 0,
+        processSubmitDialogFlag: false
       };
     },
     watch: {
@@ -365,6 +391,17 @@
           }
         },
         deep: true
+      },
+      processSubmitDialogFlag(val) {
+        if (!val) {
+          // 关闭后 刷新详情
+          if (this.form.id) {
+            this.$emit('reload');
+            this.$nextTick(() => {
+              this.handleClose();
+            });
+          }
+        }
       }
     },
     computed: {
@@ -500,6 +537,7 @@
 
           this.form.templateId = data.templateId;
           this.form.templateName = data.templateName;
+          this.form.checklistType = data.checklistType;
 
           // 处理携带的生产工单
           if (data.workOrderList && data.workOrderList.length) {
@@ -545,24 +583,32 @@
                 // 存在id 则更新
                 if (this.form.id) {
                   await checklistrecordUpdate(this.form);
+                  this.$message.success('操作成功,已保存到放行单列表');
                 } else {
                   this.form.createUserName = this.$store.state.user.info.name;
                   const data = await checklistrecordSave(this.form);
+                  this.$message.success('操作成功,已保存到放行单列表');
                   this.form.id = data;
-                  this.getCheckDetails(data);
+                  this.getCheckDetails(this.form.id);
                 }
               } else {
+                // submit 保存并提交审核
+                // 存在id 则更新
+                if (this.form.id) {
+                  await checklistrecordUpdate(this.form);
+                } else {
+                  this.form.createUserName = this.$store.state.user.info.name;
+                  const data = await checklistrecordSave(this.form);
+                  this.form.id = data;
+                  await this.getCheckDetails(this.form.id);
+                }
+                this.openApproval();
               }
-              this.$message.success('操作成功');
               this.butLoading = false;
               this.$emit('reload');
             } catch (error) {
               this.butLoading = false;
             }
-
-            if (type != 'save') {
-              this.handleClose();
-            }
           } else {
             // 转换为数组
             const firstErrorField = Object.values(invalidFields);
@@ -758,6 +804,52 @@
           this.form.qualityCheckUserId = userInfo.id;
           this.form.qualityCheckUserName = userInfo.name;
         }
+      },
+      async openWorkOrderDetail(row) {
+        console.log('row', row);
+        const info = await getworkOrderById(row.workOrderId);
+        this.$refs.detailsRef.open(info);
+      },
+      // 提交审批
+      openApproval() {
+        const row = this.form;
+        console.log('row', row);
+
+        let businessType = this.getDictValue(
+          '放行类型',
+          row.checklistType + ''
+        );
+        console.log('businessType', businessType);
+        this.processSubmitDialogFlag = true;
+        this.$nextTick(async () => {
+          let params = {
+            businessId: row.id,
+            businessKey: 'work_order_checklist_approval',
+            formCreateUserId: row.createUserId,
+            variables: {
+              businessCode: row.code,
+              businessName: '放行单',
+              businessType: businessType
+            }
+          };
+
+          if (this.clientEnvironmentId == 5) {
+            // 嘉实环境
+            const data = await getCategoryByCode(row.orders[0]?.productCode);
+
+            // 判断品类
+            if (data && data.categoryLevelCodePath?.includes('W3-209')) {
+              // 药品
+              params.businessKey = 'work_order_checklist_approval1';
+            } else {
+              // 器械
+              params.businessKey = 'work_order_checklist_approval';
+            }
+          }
+
+          console.log('params', params);
+          this.$refs.processSubmitDialogRef.init(params);
+        });
       }
     }
   };

+ 8 - 6
src/views/produce/components/feeding/index.vue

@@ -607,6 +607,7 @@
       },
 
       async getTeamList(id) {
+        if(!id) return;
         const ids = id.split(',');
         this.teamList = [];
         this.teamUserList = [];
@@ -855,12 +856,6 @@
           }
         });
 
-        // 延迟刷新
-        setTimeout(() => {
-          // 点击了缓存或者投料
-          this.$emit('reload');
-        }, 800);
-
         // for (let item of this.List) {
         //   await checkRepeatFeed({
         //     currentTaskDiagram: item.currentTaskDiagram,
@@ -924,6 +919,13 @@
             this.executorIdList = [];
             this.checked = false;
             this.teamId = '';
+
+            // 延迟刷新
+            setTimeout(() => {
+              // 点击了缓存或者投料
+              this.$emit('reload');
+            }, 500);
+
             this.$emit('feedSuccess', 'success');
           })
           .catch((e) => {

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

@@ -772,6 +772,7 @@
       },
 
       async getTeamList(id) {
+        if(!id) return;
         const ids = id.split(',');
         this.teamList = [];
         this.teamUserList = [];

+ 295 - 62
src/views/produce/components/prenatalExamination/material.vue

@@ -6,7 +6,7 @@
       ref="table"
       row-key="id"
       :columns="materialColumns"
-      :datasource="materialList"
+      :datasource="localPickDetails"
       cache-key="prenatal-examination-material-list-table-2511031522"
       autoAmendPage
       :needPage="false"
@@ -18,12 +18,52 @@
         >
       </template>
 
+      <template v-if="outputType == 1" v-slot:selectColumnHeader>
+        <el-checkbox
+          v-model="selectedAll"
+          @change="selectedAllChange"
+          :indeterminate="isIndeterminate"
+        ></el-checkbox>
+      </template>
+
       <template v-slot:selectColumn="{ row }">
         <el-checkbox
           v-model="row.selected"
           @change="selectedChange(row)"
         ></el-checkbox>
       </template>
+
+      <template v-slot:feedQuantityHeader>
+        <el-tooltip
+          effect="dark"
+          content="数量是指存在多次投料时,本道工序在本次记录表报工时的累计当时投料数量;"
+          placement="top"
+        >
+          <div>
+            <span>数量</span>
+            <i
+              class="el-icon-info"
+              style="margin-left: 4px; color: #909399"
+            ></i>
+          </div>
+        </el-tooltip>
+      </template>
+
+      <template v-slot:sumConsumeQuantityHeader>
+        <el-tooltip
+          effect="dark"
+          content="累计消耗数量是指存在多次记录表报工时,本次记录表报工时的累计实时消耗数量;"
+          placement="top"
+        >
+          <div>
+            <span>累计消耗数量</span>
+            <i
+              class="el-icon-info"
+              style="margin-left: 4px; color: #909399"
+            ></i>
+          </div>
+        </el-tooltip>
+      </template>
     </ele-pro-table>
 
     <header-title title="产出清单" style="margin-top: 20px"></header-title>
@@ -80,6 +120,54 @@
           @change="$emit('update:outputDetails', localOutputDetails)"
         ></el-input>
       </template>
+
+      <template v-slot:sumReportQuantityHeader>
+        <el-tooltip
+          effect="dark"
+          content="已报工数量是指存在多次记录表报工时,多次报工数量的累计实时已报工数量;"
+          placement="top"
+        >
+          <div>
+            <span>已报工数量</span>
+            <i
+              class="el-icon-info"
+              style="margin-left: 4px; color: #909399"
+            ></i>
+          </div>
+        </el-tooltip>
+      </template>
+
+      <template v-slot:sumQualifiedQuantityHeader>
+        <el-tooltip
+          effect="dark"
+          content="合格品数量是指存在多次记录表报工时,多次报工数量的累计实时合格品数量;"
+          placement="top"
+        >
+          <div>
+            <span>合格总数</span>
+            <i
+              class="el-icon-info"
+              style="margin-left: 4px; color: #909399"
+            ></i>
+          </div>
+        </el-tooltip>
+      </template>
+
+      <template v-slot:sumNoQualifiedQuantityHeader>
+        <el-tooltip
+          effect="dark"
+          content="不合格品数量是指存在多次记录表报工时,多次报工数量的累计实时不合格品数量;"
+          placement="top"
+        >
+          <div>
+            <span>不合格总数</span>
+            <i
+              class="el-icon-info"
+              style="margin-left: 4px; color: #909399"
+            ></i>
+          </div>
+        </el-tooltip>
+      </template>
     </ele-pro-table>
 
     <materialModal ref="materialModalRef" @confirm="materialConfirm" />
@@ -244,13 +332,23 @@
           this.getCategoryAndLevelByCategoryId();
         },
         immediate: true
+      },
+      localPickDetails: {
+        handler(newVal) {
+          // 如果全选则更新 selectdAll
+          if (
+            newVal.length > 0 &&
+            newVal.every((item) => item.selected === true)
+          ) {
+            this.selectedAll = true;
+          } else {
+            this.selectedAll = false;
+          }
+        },
+        deep: true
       }
     },
     computed: {
-      // 物料清单(包含上到工序产出明细)
-      materialList() {
-        return [...this.preOutputDetails, ...this.localPickDetails];
-      },
       // 物料清单表头
       materialColumns() {
         const list = [
@@ -304,7 +402,8 @@
             minWidth: 120,
             formatter: (row) => {
               return (row.quantity || 0) + (row.unit || '');
-            }
+            },
+            headerSlot: 'feedQuantityHeader'
           },
           {
             label: '当次消耗数量',
@@ -317,10 +416,12 @@
                 const outputItem = this.localOutputDetails.find(
                   (item) => item.categoryCode === row.categoryCode
                 );
-                return (
-                  (outputItem ? outputItem.reportQuantity : 0) +
-                  (row.unit || '')
-                );
+
+                if (outputItem) {
+                  return outputItem.reportQuantity + (row.unit || '');
+                }
+
+                return 0 + (row.unit || '');
               } else {
                 // 产出为在制品 或 BOM标准产出
                 // 查询基数
@@ -352,7 +453,9 @@
                   return '0' + (row.unit || '');
                 }
                 // 当次消耗
-                let needQuantity = outputItem.reportQuantity * count;
+                let needQuantity = this.formatNumber(
+                  outputItem.reportQuantity * count
+                );
                 return needQuantity + (row.unit || '');
               }
             }
@@ -389,7 +492,9 @@
                           this.materialQuotaInfo.standardOutput.categoryCode
                       );
                       if (preItem) {
-                        preCount += preItem.sumReportQuantity * proportion;
+                        preCount += this.formatNumber(
+                          preItem.sumReportQuantity * proportion
+                        );
                       }
                     }
 
@@ -400,7 +505,9 @@
                           item.categoryCode === this.categoryInfo.categoryCode
                       );
                       if (preItem) {
-                        preCount += preItem.sumReportQuantity * proportion;
+                        preCount += this.formatNumber(
+                          preItem.sumReportQuantity * proportion
+                        );
                       }
                     }
                   }
@@ -479,7 +586,9 @@
                       this.materialQuotaInfo.standardOutput.categoryCode
                   );
                   if (preItem) {
-                    preCount += preItem.sumReportQuantity * proportion;
+                    preCount += this.formatNumber(
+                      preItem.sumReportQuantity * proportion
+                    );
                   }
                 }
                 // 在制品
@@ -492,7 +601,9 @@
                         item.categoryCode === this.categoryInfo.categoryCode
                     );
                     if (preItem) {
-                      preCount += preItem.sumReportQuantity * proportion;
+                      preCount += this.formatNumber(
+                        preItem.sumReportQuantity * proportion
+                      );
                     }
                   }
                 }
@@ -508,17 +619,19 @@
                   cumulativeOutputQuantity =
                     outputItem.sumReportQuantity + outputItem.reportQuantity;
                 }
-                const needQuantity = cumulativeOutputQuantity * proportion;
+                const needQuantity = this.formatNumber(
+                  cumulativeOutputQuantity * proportion
+                );
 
                 // 已消耗数量转换
-                // const sumReportQuantity = row.sumReportQuantity * proportion;
                 const sumReportQuantity = row.sumReportQuantity;
 
                 return (
                   needQuantity + preCount + sumReportQuantity + (row.unit || '')
                 );
               }
-            }
+            },
+            headerSlot: 'sumConsumeQuantityHeader'
           }
         ];
         if (this.outputType == 1) {
@@ -527,23 +640,15 @@
             label: '选择',
             slot: 'selectColumn',
             align: 'center',
-            fixed: 'right'
+            fixed: 'right',
+            headerSlot: 'selectColumnHeader'
           });
         }
         return list;
-      }
-    },
-
-    data() {
-      return {
-        localPickDetails: [],
-        localOutputDetails: [],
-        // bom配置的 标准产出信息
-        materialQuotaInfo: null,
-        // 在制品信息
-        categoryInfo: null,
-        // 产出清单表头
-        outputDetailsColumns: [
+      },
+      // 产出清单表头
+      outputDetailsColumns() {
+        return [
           {
             width: 45,
             type: 'index',
@@ -616,27 +721,105 @@
             label: '已报工数量',
             prop: 'sumReportQuantity',
             minWidth: 120,
-            formatter(row) {
-              return (row.sumReportQuantity || 0) + row.unit;
-            }
+            formatter: (row) => {
+              let count = row.sumReportQuantity || 0;
+
+              if (this.executeStatus === 2) {
+                // 已执行,处理重新一键报工时,sumReportQuantity包含了当前报工数量
+                count += row.reportQuantity - row.reportQuantityCopy;
+              } else {
+                count += row.reportQuantity;
+              }
+
+              return count + (row.unit || '');
+            },
+            headerSlot: 'sumReportQuantityHeader'
           },
           {
             label: '合格总数',
             prop: 'sumQualifiedQuantity',
             minWidth: 120,
-            formatter(row) {
-              return (row.sumQualifiedQuantity || 0) + (row.unit || '');
-            }
+            formatter: (row) => {
+              // 已报工数量
+              let sumReportQuantity = row.sumReportQuantity || 0;
+
+              if (this.executeStatus === 2) {
+                // 已执行,处理重新一键报工时,sumReportQuantity包含了当前报工数量
+                sumReportQuantity +=
+                  row.reportQuantity - row.reportQuantityCopy;
+              } else {
+                sumReportQuantity += row.reportQuantity;
+              }
+
+              let count = row.sumQualifiedQuantity || 0;
+
+              if (this.executeStatus === 2) {
+                // 已执行,处理重新一键报工时,sumQualifiedQuantity包含了当前报工数量
+                count += row.qualifiedQuantity - row.qualifiedQuantityCopy;
+              } else {
+                count += row.qualifiedQuantity;
+              }
+              // 处理缓存后,物料被其他工单报工超出已报工数量问题
+              if (count > sumReportQuantity) {
+                count = sumReportQuantity;
+              }
+
+              return count + (row.unit || '');
+            },
+            headerSlot: 'sumQualifiedQuantityHeader'
           },
           {
             label: '不合格总数',
             prop: 'sumNoQualifiedQuantity',
             minWidth: 120,
-            formatter(row) {
-              return (row.sumNoQualifiedQuantity || 0) + (row.unit || '');
-            }
+            formatter: (row) => {
+              // 已报工数量
+              let sumReportQuantity = row.sumReportQuantity || 0;
+
+              if (this.executeStatus === 2) {
+                // 已执行,处理重新一键报工时,sumReportQuantity包含了当前报工数量
+                sumReportQuantity +=
+                  row.reportQuantity - row.reportQuantityCopy;
+              } else {
+                sumReportQuantity += row.reportQuantity;
+              }
+
+              let count = row.sumNoQualifiedQuantity || 0;
+
+              if (this.executeStatus === 2) {
+                // 已执行,处理重新一键报工时,sumNoQualifiedQuantity包含了当前报工数量
+                count += row.noQualifiedQuantity - row.noQualifiedQuantityCopy;
+              } else {
+                count += row.noQualifiedQuantity;
+              }
+              // 处理缓存后,物料被其他工单报工超出已报工数量问题
+              if (count > sumReportQuantity) {
+                count = sumReportQuantity;
+              }
+
+              return count + (row.unit || '');
+            },
+            headerSlot: 'sumNoQualifiedQuantityHeader'
           }
-        ]
+        ];
+      },
+      isIndeterminate() {
+        return (
+          this.localPickDetails.some((item) => item.selected) &&
+          !this.selectedAll
+        );
+      }
+    },
+
+    data() {
+      return {
+        localPickDetails: [],
+        localOutputDetails: [],
+        // bom配置的 标准产出信息
+        materialQuotaInfo: null,
+        // 在制品信息
+        categoryInfo: null,
+        selectedAll: false
       };
     },
     methods: {
@@ -648,7 +831,6 @@
             ruleId: this.ruleId,
             produceTaskId: this.produceTaskId
           },
-          // ...this.localPickDetails, ...this.preOutputDetails
           []
         );
       },
@@ -681,6 +863,8 @@
             // 不存在则添加
             this.localPickDetails.push({
               ...newItem,
+              // 物料的类型
+              outputType: 1,
               reportQuantity: 0,
               ruleId: this.ruleId,
               bomCategoryId: this.bomCategoryId,
@@ -690,7 +874,8 @@
               workOrderId: this.workOrderId,
               sumQualifiedQuantity,
               sumNoQualifiedQuantity,
-              sumReportQuantity
+              sumReportQuantity,
+              selected: false
             });
           }
         });
@@ -775,6 +960,7 @@
       noQualifiedQuantityMax(row) {
         return row.reportQuantity;
       },
+      // 单选
       selectedChange(row) {
         console.log('row', row);
         if (this.outputType != 1) return;
@@ -829,9 +1015,25 @@
             (item) => !(item.categoryId === row.categoryId)
           );
         }
+
         console.log('this.localOutputDetails', this.localOutputDetails);
+
         this.$emit('update:outputDetails', this.localOutputDetails);
       },
+      // 全选
+      selectedAllChange() {
+        this.localPickDetails = this.localPickDetails.map((item) => {
+          if (item.selected == this.selectedAll) {
+            return item;
+          }
+
+          item.selected = this.selectedAll;
+
+          this.selectedChange(item);
+
+          return item;
+        });
+      },
       // getCategoryAndLevelByCategoryId 获取产品 在制品信息
       async getCategoryAndLevelByCategoryId() {
         const data = await getCategoryAndLevelByCategoryId(this.categoryId);
@@ -885,10 +1087,20 @@
       reportQuantitymax(row) {
         if (this.outputType == 1) {
           // 查询物料本身
-          const pickItem = this.localPickDetails.find(
+          let pickItem = this.localPickDetails.find(
             (item) => item.categoryCode === row.categoryCode
           );
 
+          if (!pickItem) {
+            // 查询上到工序产出明细
+            pickItem = this.preOutputDetails.find(
+              (item) => item.categoryCode === row.categoryCode
+            );
+          }
+
+          // 未找到物料,则不限制
+          if (!pickItem) return Infinity;
+
           // 查询其他工单sumOutputDetails中已产生的bom标准产出和在制品的累计消耗数量
           let preCount = 0;
           if (this.materialQuotaInfo) {
@@ -909,7 +1121,9 @@
                     this.materialQuotaInfo.standardOutput.categoryCode
                 );
                 if (preItem) {
-                  preCount += preItem.sumReportQuantity * proportion;
+                  preCount += this.formatNumber(
+                    preItem.sumReportQuantity * proportion
+                  );
                 }
               }
 
@@ -919,15 +1133,14 @@
                   (item) => item.categoryCode === this.categoryInfo.categoryCode
                 );
                 if (preItem) {
-                  preCount += preItem.sumReportQuantity * proportion;
+                  preCount += this.formatNumber(
+                    preItem.sumReportQuantity * proportion
+                  );
                 }
               }
             }
           }
 
-          // 未找到物料,则返回剩余数量
-          if (!pickItem) return pickItem.quantity - preCount;
-
           // 已执行,处理重新一键报工时,sumReportQuantity包含了当前报工数量
           if (this.executeStatus == 2) {
             const count =
@@ -951,6 +1164,7 @@
             (item) => item.categoryCode === row.categoryCode
           );
 
+          // debugger;
           // 存在则当前row为在制品或BOM标准产出
           if (preOutputItem) {
             // 区分已执行状态
@@ -975,9 +1189,17 @@
 
           // 计算每个物料的最大可报工数量
           const maxQuantities = quota.map((item) => {
-            const pickItem = this.localPickDetails.find(
+            let pickItem = this.localPickDetails.find(
               (p) => p.categoryCode === item.categoryCode
             );
+
+            // 从上一道工序产出物中找
+            if (!pickItem) {
+              pickItem = this.preOutputDetails.find(
+                (p) => p.categoryCode === item.categoryCode
+              );
+            }
+
             if (!pickItem) {
               return Infinity;
             }
@@ -1001,8 +1223,9 @@
                   this.materialQuotaInfo.standardOutput.categoryCode
               );
               if (preStd) {
-                preOutputConsumedProportion +=
-                  preStd.sumReportQuantity * proportion;
+                preOutputConsumedProportion += this.formatNumber(
+                  preStd.sumReportQuantity * proportion
+                );
               }
             }
 
@@ -1015,8 +1238,9 @@
                 (s) => s.categoryCode === this.categoryInfo.categoryCode
               );
               if (preWip) {
-                preOutputConsumedProportion +=
-                  preWip.sumReportQuantity * proportion;
+                preOutputConsumedProportion += this.formatNumber(
+                  preWip.sumReportQuantity * proportion
+                );
               }
             }
 
@@ -1026,7 +1250,9 @@
               : row.sumReportQuantity;
 
             // 已执行的比例换算,换算为需要多少物料数量
-            const consumedProportion = consumedQuantity * proportion;
+            const consumedProportion = this.formatNumber(
+              consumedQuantity * proportion
+            );
 
             // 最大可报工数量
             let maxQuantity =
@@ -1070,15 +1296,17 @@
           }
 
           for (const item of this.localOutputDetails) {
-            const pickitem = this.localPickDetails.find(
-              (pick) => pick.categoryCode == item.categoryCode
-            );
-
-            const prePickitem = this.preOutputDetails.find(
+            let pickitem = this.localPickDetails.find(
               (pick) => pick.categoryCode == item.categoryCode
             );
+            // 从上一道工序产出物中找
+            if (!pickitem) {
+              pickitem = this.preOutputDetails.find(
+                (pick) => pick.categoryCode == item.categoryCode
+              );
+            }
 
-            if (pickitem == null && prePickitem == null) {
+            if (!pickitem) {
               this.$message.warning(
                 `所需物料【${item.categoryName}】未在物料清单中找到`
               );
@@ -1122,6 +1350,11 @@
         } else {
           this.setMaterialQuotaInfo();
         }
+      },
+      // 处理数字精度问题,不使用toFixed,避免4舍5入
+      formatNumber(value, decimalPlaces = 4) {
+        const factor = Math.pow(10, decimalPlaces);
+        return Math.floor(value * factor) / factor;
       }
     }
   };

+ 2 - 4
src/views/produce/components/prenatalExamination/programRulesDialog.vue

@@ -465,11 +465,9 @@
         this.visible = false;
       },
       // 初始化 事项、工单、工序信息
-      async init(row, workOrderInfo, produceTaskInfo) {
+      async init(row, workOrderInfo) {
         console.log('productionInfo', workOrderInfo);
         console.log('workOrderInfo', row, workOrderInfo);
-        console.log('produceTaskInfo', produceTaskInfo);
-        this.produceTaskInfo = produceTaskInfo;
         this.productionInfo = row;
         this.workOrderInfo = workOrderInfo;
         this.visible = true;
@@ -662,7 +660,7 @@
               produceRoutingName: this.workOrderInfo.produceRoutingName,
               produceTaskConfigId: this.productionInfo.produceTaskConfigId,
               produceTaskId: this.productionInfo.produceTaskId,
-              produceTaskName: this.produceTaskInfo.name,
+              produceTaskName: this.productionInfo.produceTaskName,
               reportWorkType: this.productionInfo.reportWorkType,
               ruleId: this.ruleInfo.id,
               ruleName: this.ruleInfo.name,

+ 169 - 155
src/views/produce/components/prenatalExamination/releaseRulesDialog.vue

@@ -16,6 +16,7 @@
       ref="ruleFormRef"
       label-width="150px"
       v-loading="loading"
+      :disabled="type === 'detail'"
     >
       <el-row>
         <el-col :span="8">
@@ -234,153 +235,152 @@
           </el-form-item>
         </el-col>
       </el-row>
-    </el-form>
 
-    <material
-      v-if="
-        addForm.produceTaskId &&
-        addForm.reportWorkType == 2 &&
-        workOrderInfo &&
-        productionInfo
-      "
-      ref="materialRef"
-      :pickDetails.sync="addForm.pickDetails"
-      :outputDetails.sync="addForm.outputDetails"
-      :preOutputDetails="preOutputDetails"
-      :sumOutputDetails="sumOutputDetails"
-      :workOrderId="addForm.workOrderId"
-      :ruleId="addForm.ruleId"
-      :produceTaskId="addForm.produceTaskId"
-      :produceTaskName="addForm.produceTaskName"
-      :produceTaskInstanceId="productionInfo.produceTaskInstanceId"
-      :bomCategoryId="workOrderInfo.bomCategoryId"
-      :outputType="addForm.outputType"
-      :categoryId="workOrderInfo.categoryId"
-      :executeStatus="productionInfo.executeStatus"
-      @refresh="getListByWorkOrderId"
-    ></material>
-
-    <header-title title="检查项目" :style="`margin-top: 20px`"></header-title>
-
-    <template v-if="addForm.recordRulesClassify == 10">
-      <el-tabs v-model="statisticsType" type="card">
-        <el-tab-pane
-          v-for="i in statisticsTypeList"
-          :label="i.label"
-          :name="i.value"
-          :key="i.value"
-        >
-        </el-tab-pane>
-      </el-tabs>
-      <statistics
-        ref="statisticsRef"
-        :details.sync="addForm.details"
-        :statisticsType="statisticsType"
-        :produceTaskId="addForm.produceTaskId"
+      <material
+        v-if="
+          addForm.produceTaskId &&
+          addForm.reportWorkType == 2 &&
+          workOrderInfo &&
+          productionInfo
+        "
+        ref="materialRef"
+        :pickDetails.sync="addForm.pickDetails"
+        :outputDetails.sync="addForm.outputDetails"
+        :preOutputDetails="preOutputDetails"
+        :sumOutputDetails="sumOutputDetails"
         :workOrderId="addForm.workOrderId"
-        :routingId="addForm.produceRoutingId"
         :ruleId="addForm.ruleId"
-      ></statistics>
-    </template>
-
-    <ele-pro-table
-      v-if="addForm.recordRulesClassify && addForm.recordRulesClassify != 10"
-      v-loading="loading"
-      ref="table"
-      row-key="id"
-      :columns="detailsColumns"
-      :datasource="addForm.details"
-      cacheKey="mes-releaseRulesDialong-2510281408"
-      :needPage="false"
-    >
-      <template v-slot:toolkit>
-        <el-button
-          v-if="addForm.recordRulesClassify != 4"
-          type="primary"
-          @click="batchCheck"
-          >批量检查</el-button
-        >
-        <el-button
-          v-if="addForm.recordRulesClassify != 4"
-          type="primary"
-          @click="batchQualified"
-          >批量合格</el-button
-        >
-      </template>
-      <template v-slot:paramValue="{ row }">
-        <div v-if="addForm.recordRulesClassify == 4">
-          {{ row.productName || row.name }}
-        </div>
-        <div v-else>
-          {{ row.paramValue }}
-        </div>
+        :produceTaskId="addForm.produceTaskId"
+        :produceTaskName="addForm.produceTaskName"
+        :produceTaskInstanceId="productionInfo.produceTaskInstanceId"
+        :bomCategoryId="workOrderInfo.bomCategoryId"
+        :outputType="addForm.outputType"
+        :categoryId="workOrderInfo.categoryId"
+        :executeStatus="productionInfo.executeStatus"
+        @refresh="getListByWorkOrderId"
+      ></material>
+
+      <header-title title="检查项目" :style="`margin-top: 20px`"></header-title>
+
+      <template v-if="addForm.recordRulesClassify == 10">
+        <el-tabs v-model="statisticsType" type="card">
+          <el-tab-pane
+            v-for="i in statisticsTypeList"
+            :label="i.label"
+            :name="i.value"
+            :key="i.value"
+          >
+          </el-tab-pane>
+        </el-tabs>
+        <statistics
+          ref="statisticsRef"
+          :details.sync="addForm.details"
+          :statisticsType="statisticsType"
+          :produceTaskId="addForm.produceTaskId"
+          :workOrderId="addForm.workOrderId"
+          :routingId="addForm.produceRoutingId"
+          :ruleId="addForm.ruleId"
+        ></statistics>
       </template>
-      <template v-slot:toolNames="{ row }">
-        <el-link :underline="false" style="cursor: pointer">
-          <div class="ele-cell">
-            <div @click="handleAdd(row)">
-              {{ row.toolNames ? row.toolNames : '请选择' }}
+
+      <ele-pro-table
+        v-if="addForm.recordRulesClassify && addForm.recordRulesClassify != 10"
+        v-loading="loading"
+        ref="table"
+        row-key="id"
+        :columns="detailsColumns"
+        :datasource="addForm.details"
+        cacheKey="mes-releaseRulesDialong-2510281408"
+        :needPage="false"
+      >
+        <template v-slot:toolkit>
+          <el-button
+            v-if="addForm.recordRulesClassify != 4"
+            type="primary"
+            @click="batchCheck"
+            >批量检查</el-button
+          >
+          <el-button
+            v-if="addForm.recordRulesClassify != 4"
+            type="primary"
+            @click="batchQualified"
+            >批量合格</el-button
+          >
+        </template>
+        <template v-slot:paramValue="{ row }">
+          <div v-if="addForm.recordRulesClassify == 4">
+            {{ row.productName || row.name }}
+          </div>
+          <div v-else>
+            {{ row.paramValue }}
+          </div>
+        </template>
+        <template v-slot:toolNames="{ row }">
+          <el-link :underline="false" style="cursor: pointer">
+            <div class="ele-cell">
+              <div @click="handleAdd(row)">
+                {{ row.toolNames ? row.toolNames : '请选择' }}
+              </div>
+              <i
+                v-if="!row.toolNames"
+                class="el-icon-arrow-down"
+                @click="handleAdd(row)"
+              ></i>
+              <i v-else class="el-icon-close" @click="clearTool(row)"></i>
             </div>
-            <i
-              v-if="!row.toolNames"
-              class="el-icon-arrow-down"
-              @click="handleAdd(row)"
-            ></i>
-            <i v-else class="el-icon-close" @click="clearTool(row)"></i>
+          </el-link>
+        </template>
+        <template v-slot:checkUsersIds="{ row }">
+          <div>
+            <el-select
+              v-model="row.checkUsersIds"
+              placeholder="请选择检查人"
+              filterable
+              multiple
+              @change="checkUsersIdsChange(row)"
+            >
+              <el-option
+                v-for="item in activeTeamUserList"
+                :label="item.name"
+                :value="item.id"
+                :key="item.id"
+              >
+              </el-option>
+            </el-select>
           </div>
-        </el-link>
-      </template>
-      <template v-slot:checkUsersIds="{ row }">
-        <div>
-          <el-select
-            v-model="row.checkUsersIds"
-            placeholder="请选择检查人"
-            filterable
-            multiple
-            @change="checkUsersIdsChange(row)"
-          >
-            <el-option
-              v-for="item in activeTeamUserList"
-              :label="item.name"
-              :value="item.id"
-              :key="item.id"
+        </template>
+        <template v-slot:checkStatus="{ row }">
+          <div>
+            <el-radio-group v-model="row.checkStatus">
+              <el-radio :label="1">已检查</el-radio>
+              <el-radio :label="0">未检查</el-radio>
+            </el-radio-group>
+          </div>
+        </template>
+        <template v-slot:errorMsg="{ row }">
+          <div>
+            <el-input
+              type="text"
+              :rows="1"
+              placeholder="请输入"
+              v-model="row.errorMsg"
             >
-            </el-option>
-          </el-select>
-        </div>
-      </template>
-      <template v-slot:checkStatus="{ row }">
-        <div>
-          <el-radio-group v-model="row.checkStatus">
-            <el-radio :label="1">已检查</el-radio>
-            <el-radio :label="0">未检查</el-radio>
-          </el-radio-group>
-        </div>
-      </template>
-      <template v-slot:errorMsg="{ row }">
-        <div>
-          <el-input
-            type="text"
-            :rows="1"
-            placeholder="请输入"
-            v-model="row.errorMsg"
-          >
-            <template v-if="row.unitName" slot="append">
-              <div>{{ row.unitName }}</div>
-            </template>
-          </el-input>
-        </div></template
-      >
-      <template v-slot:checkResult="{ row }">
-        <div>
-          <el-radio-group v-model="row.checkResult">
-            <el-radio :label="1">合格</el-radio>
-            <el-radio :label="0">不合格</el-radio>
-          </el-radio-group>
-        </div>
-      </template>
-    </ele-pro-table>
-
+              <template v-if="row.unitName" slot="append">
+                <div>{{ row.unitName }}</div>
+              </template>
+            </el-input>
+          </div></template
+        >
+        <template v-slot:checkResult="{ row }">
+          <div>
+            <el-radio-group v-model="row.checkResult">
+              <el-radio :label="1">合格</el-radio>
+              <el-radio :label="0">不合格</el-radio>
+            </el-radio-group>
+          </div>
+        </template>
+      </ele-pro-table>
+    </el-form>
     <!-- 底部按钮 -->
     <template #footer>
       <div class="modal-footer">
@@ -388,7 +388,8 @@
           v-if="
             $hasPermission('mes:producetaskrecordrulesrecord:res') &&
             productionInfo &&
-            productionInfo.executeStatus == 2
+            productionInfo.executeStatus == 2 &&
+            type !== 'detail'
           "
           :loading="butLoading"
           type="primary"
@@ -398,7 +399,10 @@
         </el-button>
 
         <el-button
-          v-if="$hasPermission('mes:producetaskrecordrulesrecord:sus')"
+          v-if="
+            $hasPermission('mes:producetaskrecordrulesrecord:sus') &&
+            type !== 'detail'
+          "
           :loading="butLoading"
           type="primary"
           @click="submit('submit')"
@@ -414,7 +418,8 @@
             v-if="
               productionInfo &&
               productionInfo.recordId != null &&
-              productionInfo.executeStatus == 1
+              productionInfo.executeStatus == 1 &&
+              type !== 'detail'
             "
             title="您确定要清空缓存吗?"
             @confirm="clearCache"
@@ -426,7 +431,10 @@
         </template>
 
         <el-button
-          v-if="$hasPermission('mes:producetaskrecordrulesrecord:saveorupdate')"
+          v-if="
+            $hasPermission('mes:producetaskrecordrulesrecord:saveorupdate') &&
+            type !== 'detail'
+          "
           :loading="butLoading"
           type="primary"
           @click="submit('cache')"
@@ -435,10 +443,7 @@
           缓存
         </el-button>
 
-        <el-button
-          v-if="productionInfo && productionInfo.executeStatus == 2"
-          @click="handleBeforeClose"
-        >
+        <el-button v-if="productionInfo" @click="handleBeforeClose">
           关闭
         </el-button>
       </div>
@@ -664,7 +669,9 @@
           { label: '成品统计', value: '1' },
           { label: '物料统计', value: '2' },
           { label: '工序统计', value: '3' }
-        ]
+        ],
+        // 查看 编辑 edit 、detail
+        type: 'edit'
       };
     },
     computed: {
@@ -755,6 +762,11 @@
       this.getWorkshopArea();
     },
     methods: {
+      // 仅仅查看
+      openView(productionInfo, workOrderInfo) {
+        this.type = 'detail';
+        this.open(productionInfo, workOrderInfo);
+      },
       open(productionInfo, workOrderInfo) {
         console.log(
           'productionInfo, workOrderInfo',
@@ -890,9 +902,11 @@
 
         this.addForm.outputDetails = materialObject.outputDetails.map((i) => {
           i.reportQuantityCopy = i.reportQuantity;
+          i.qualifiedQuantityCopy = i.qualifiedQuantity;
+          i.noQualifiedQuantityCopy = i.noQualifiedQuantity;
 
           const sumItem = materialObject.sumOutputDetails.find(
-            (item) => i.categoryCode === item.categoryCode
+            (item) => item.categoryCode === i.categoryCode
           );
 
           if (sumItem) {
@@ -966,14 +980,12 @@
           return i;
         });
 
-        this.preOutputDetails = preOutputDetails.filter(
-          (i) => i.outputType != 1
-        );
+        this.preOutputDetails = preOutputDetails;
 
         this.sumOutputDetails = materialObject.sumOutputDetails;
 
         this.addForm.pickDetails = [
-          ...preOutputDetails.filter((i) => i.outputType == 1),
+          ...preOutputDetails.map((i) => i),
           ...pickDetails
         ];
 
@@ -1031,7 +1043,8 @@
         this.workOrderInfo = null;
         this.productionInfo = null;
         this.statisticsType = '1';
-        console.log('this.$refs.ruleFormRef', this.addForm);
+        // 重置
+        this.type = 'edit';
         this.$nextTick(() => {
           this.$refs.ruleFormRef.clearValidate();
           this.visible = false;
@@ -1198,6 +1211,7 @@
       },
 
       async getTeamList(id) {
+        if(!id) return;
         const ids = id.split(',');
         this.teamList = [];
         this.teamUserList = [];

+ 10 - 5
src/views/produce/components/prenatalExamination/taskDialog.vue

@@ -58,6 +58,7 @@
     <template #footer>
       <div class="modal-footer">
         <el-button
+          v-if="type != 'detail'"
           :loading="butLoading"
           type="primary"
           @click="submit('submit')"
@@ -66,10 +67,7 @@
           一键报工
         </el-button>
 
-        <el-button
-          v-if="productionInfo && productionInfo.executeStatus == 2"
-          @click="handleBeforeClose"
-        >
+        <el-button v-if="productionInfo" @click="handleBeforeClose">
           关闭
         </el-button>
       </div>
@@ -167,11 +165,17 @@
         workOrderInfo: null,
         // 加载中 loading
         loading: false,
-        title: '任务确认'
+        title: '任务确认',
+        // 编辑 或者是  详情 edit detila
+        type: 'edit'
       };
     },
     computed: {},
     methods: {
+      openView(productionInfo, workOrderInfo) {
+        this.type = 'detail';
+        this.open(productionInfo, workOrderInfo);
+      },
       open(productionInfo, workOrderInfo) {
         console.log(
           'productionInfo, workOrderInfo',
@@ -206,6 +210,7 @@
         console.log('this.addForm', this.addForm);
       },
       handleBeforeClose() {
+        this.type = 'edit';
         this.addForm = JSON.parse(JSON.stringify(this.formDate));
         console.log('this.$refs.ruleFormRef', this.addForm);
         this.$refs.ruleFormRef?.clearValidate();

+ 14 - 2
src/views/produce/components/routings.vue

@@ -54,6 +54,13 @@
           <el-tab-pane label="生产明细">
             <productionDetails :workOrderInfo="routeObj"></productionDetails>
           </el-tab-pane>
+
+          <el-tab-pane label="记录详情" v-if="sourceTaskId && routeObj && sourceTaskId != '-1'">
+            <recordRules
+              :produceTaskId="sourceTaskId"
+              :workOrderInfo="routeObj"
+            ></recordRules>
+          </el-tab-pane>
         </el-tabs>
       </div>
     </ele-modal>
@@ -65,12 +72,15 @@
   import jobDetails from '../components/jobBooking/details.vue';
   import pickDetails from '../components/picking/details.vue';
   import productionDetails from '@/views//workOrderList/components/productionDetails.vue';
+  import recordRules from '@/views/produceOrder/components/recordRules/recordRules.vue';
+
   export default {
     components: {
       feedDetails,
       jobDetails,
       pickDetails,
-      productionDetails
+      productionDetails,
+      recordRules
     },
     props: {
       routeObj: {
@@ -87,7 +97,8 @@
         activeIndex: 0,
         desIndex: 0,
         newId: '',
-        curTaskObj: null
+        curTaskObj: null,
+        sourceTaskId: ''
       };
     },
     methods: {
@@ -104,6 +115,7 @@
 
           console.log('res', res, index);
           this.newId = res[index].taskId;
+          this.sourceTaskId = this.routeList[this.desIndex]?.sourceTaskId || '';
 
           console.log(this.routeObj, 666666);
 

+ 5 - 0
src/views/produce/components/warehousing/index.vue

@@ -813,6 +813,7 @@
       },
 
       async getTeamList(id) {
+        if(!id) return;
         const ids = id.split(',');
         this.teamList = [];
         this.teamUserList = [];
@@ -828,6 +829,10 @@
 
           this.teamAllList.push(item.userVOList);
         });
+
+        if(this.form.teamId && this.teamUserList.length == 0){
+          this.checkTeamList(this.form.teamId);
+        }
       },
 
       changeId() {

+ 8 - 2
src/views/produceOrder/components/details/index.vue

@@ -6,6 +6,7 @@
       :custom-class="isFullscreen ? 'not-fullscreen' : 'is-fullscreen'"
       :before-close="handleClose"
       :with-header="false"
+      append-to-body
     >
       <!-- 自定义头部 -->
       <div class="custom-drawer-header">
@@ -80,11 +81,16 @@
 
           <el-tab-pane
             label="记录详情"
-            v-if="sourceTaskId && workOrderInfo.bomCategoryId"
+            v-if="
+              sourceTaskId &&
+              workOrderInfo &&
+              sourceTaskId != '-1' &&
+              sourceTaskId != '-2'
+            "
           >
             <recordRules
               :produceTaskId="sourceTaskId"
-              :bomCategoryId="workOrderInfo.bomCategoryId"
+              :workOrderInfo="workOrderInfo"
             ></recordRules>
           </el-tab-pane>
         </el-tabs>

+ 123 - 39
src/views/produceOrder/components/recordRules/recordRules.vue

@@ -1,37 +1,76 @@
 <template>
-  <ele-pro-table
-    :columns="columns"
-    :datasource="datasource"
-    cacheKey="mes-recordRules-25113-031018"
-    ref="tableRef"
-  >
-    <template v-slot:toolbar>
-      <el-select v-model="reportWorkType" placeholder="请选择" @change="reload">
-        <el-option
-          v-for="item in reportWorkTypeOptions"
-          :key="item.value"
-          :label="item.label"
-          :value="item.value"
-        ></el-option>
-      </el-select>
-    </template>
-  </ele-pro-table>
+  <div>
+    <ele-pro-table
+      :columns="columns"
+      :datasource="datasource"
+      cacheKey="mes-recordRules-25113-031018"
+      ref="tableRef"
+      :need-page="false"
+    >
+      <template v-slot:toolbar>
+        <el-select
+          v-model="reportWorkType"
+          placeholder="请选择"
+          @change="reload"
+        >
+          <el-option
+            v-for="item in reportWorkTypeOptions"
+            :key="item.value"
+            :label="item.label"
+            :value="item.value"
+          ></el-option>
+        </el-select>
+      </template>
+      <template v-slot:action="{ row }">
+        <el-link
+          type="primary"
+          :underline="false"
+          icon="el-icon-view"
+          @click="openDetils(row)"
+        >
+          详情
+        </el-link>
+      </template>
+    </ele-pro-table>
+
+    <programRulesDialog
+      ref="programRulesDialogRef"
+      :dialogTitle="dialogTitle"
+      @reload="reload"
+    />
+
+    <releaseRulesDialog ref="releaseRulesDialogRef" @reload="reload" />
+
+    <taskDialog ref="taskDialogRef" @reload="reload" />
+  </div>
 </template>
 
 <script>
   import tableColumnsMixin from '@/mixins/tableColumnsMixin';
   import dictMixins from '@/mixins/dictMixins';
-  import { produceTaskRecordRules } from '@/api/producetaskrulerecord/index';
+  import {
+    getLastRuleRecords,
+    getProduceTaskInstanceId
+  } from '@/api/producetaskrulerecord/index.js';
+  import taskDialog from '@/views/produce/components/prenatalExamination/taskDialog.vue';
+  import releaseRulesDialog from '@/views/produce/components/prenatalExamination/releaseRulesDialog.vue';
+  import programRulesDialog from '@/views/produce/components/prenatalExamination/programRulesDialog.vue';
 
   export default {
     name: 'recordRules',
+    components: {
+      programRulesDialog,
+      releaseRulesDialog,
+      taskDialog
+    },
     props: {
       produceTaskId: {
         type: String,
         required: true
       },
-      bomCategoryId: {
-        type: String,
+      // 工单信息
+      workOrderInfo: {
+        type: Object,
         required: true
       }
     },
@@ -67,12 +106,37 @@
             }
           },
           {
-            prop: 'rulesName',
+            prop: 'ruleName',
             label: '名称',
             align: 'center',
             formatter: (row) => {
-              return row.rulesName || row.itemTaskName;
+              return row.ruleName || row.itemTaskName;
             }
+          },
+          {
+            prop: 'executeStatus',
+            label: '执行状态',
+            align: 'center',
+            formatter: (row) => {
+              switch (row.executeStatus) {
+                case 0:
+                  return '未报工';
+                case 1:
+                  return '执行中';
+                default:
+                  return '已报工';
+              }
+            }
+          },
+          {
+            columnKey: 'action',
+            label: '操作',
+            width: 150,
+            align: 'center',
+            resizable: false,
+            slot: 'action',
+            showOverflowTooltip: true,
+            fixed: 'right'
           }
         ],
         reportWorkType: 1,
@@ -80,7 +144,8 @@
           { label: '产前准备', value: 1 },
           { label: '过程监测', value: 2 },
           { label: '产后检查', value: 3 }
-        ]
+        ],
+        dialogTitle: ''
       };
     },
     watch: {
@@ -90,26 +155,45 @@
     },
     methods: {
       datasource({ page, limit, where }) {
-        let body = {
-          ...where,
-          produceTaskId: this.produceTaskId,
-          bomCategoryId: this.bomCategoryId,
-          reportWorkType: this.reportWorkType,
-          pageNum: page,
-          size: limit,
-          bomCategoryId: null
-        };
-
-        if (this.reportWorkType == 2) {
-          body.bomCategoryId = this.bomCategoryId;
-        } else {
-          body.bomCategoryId = null;
-        }
+        return this.getList();
+      },
+      async getList() {
+        const [list, produceTaskInstanceInfo] = await Promise.all([
+          getLastRuleRecords({
+            workOrderId: this.workOrderInfo.id,
+            produceTaskId: this.produceTaskId,
+            reportWorkType: this.reportWorkType,
+            isTempRecord: 0
+          }),
+          getProduceTaskInstanceId(this.workOrderInfo.id, this.produceTaskId)
+        ]);
 
-        return produceTaskRecordRules(body);
+        list.map((i) => {
+          // 工序名称
+          i.produceTaskName = produceTaskInstanceInfo.name;
+          i.produceTaskInstanceId = produceTaskInstanceInfo.id;
+          return i;
+        });
+        console.log('list', list);
+        return list;
       },
       reload() {
         this.$refs.tableRef.reload();
+      },
+      openDetils(item) {
+        console.log('this.workOrderInfo', this.workOrderInfo);
+        console.log('item', item);
+
+        if (item.executeMethod == 1) {
+          // 设备保养计划相关逻辑
+          this.dialogTitle = '新增设备保养计划';
+          this.$refs.programRulesDialogRef.init(item, this.workOrderInfo);
+        } else if (item.executeMethod == 2) {
+          this.$refs.releaseRulesDialogRef.openView(item, this.workOrderInfo);
+        } else {
+          // 任务确认
+          this.$refs.taskDialogRef.openView(item, this.workOrderInfo);
+        }
       }
     }
   };

+ 9 - 1
src/views/unacceptedProduct/detail.vue

@@ -397,8 +397,16 @@
         if (this.$route.query.qualityType == 1) {
           return this.allList.filter((item) => [5, 10].includes(item.value));
         }
+
+        if (
+          this.$route.query.qualityType == 2
+        ) {
+          return this.allList.filter(
+            (item) => item.value !== 8
+          );
+        }
+
         if (
-          this.$route.query.qualityType == 2 ||
           this.$route.query.qualityType == 3
         ) {
           return this.allList.filter(

+ 2 - 2
vue.config.js

@@ -36,7 +36,7 @@ module.exports = {
         // target: 'http://192.168.1.125:18086',
         // target: 'http://192.168.1.251:18086',
         // target: 'http://192.168.1.251:18086',
-        target: 'http://192.168.1.125:18086',
+        // target: 'http://192.168.1.125:18086',
         // target: 'http://192.168.1.116:18086', // 赵沙金
         // target: 'http://192.168.1.251:18086', // 开发环境
         // target: 'http://192.168.1.103:18086',192.168.1.116
@@ -44,7 +44,7 @@ module.exports = {
         // target: 'http://192.168.1.30:18086',
         // target: 'http://192.168.1.211:18086',
         // target: 'http://192.168.1.33:18086',
-        // target: 'http://192.168.1.251:18186', // 测试环境
+        target: 'http://192.168.1.251:18186', // 测试环境
         // target: 'http://192.168.1.251:18087',
         // target: 'http://116.163.22.90:86/api', // 嘉实生产
         changeOrigin: true, // 只有这个值为true的情况下 才表示开启跨域