Răsfoiți Sursa

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

tanzx 3 zile în urmă
părinte
comite
a9f1042919
23 a modificat fișierele cu 2897 adăugiri și 225 ștergeri
  1. BIN
      public/importTemplate/BOM导入模板.xls
  2. 42 6
      src/BIZComponents/inventoryTable.vue
  3. 38 1
      src/BIZComponents/inventoryTableDetails.vue
  4. 12 0
      src/api/bpm/components/qualityReportApproval/qualityReportApproval.js
  5. 145 0
      src/api/hr/payrollAppeal.js
  6. 181 0
      src/api/hr/payrollBatch.js
  7. 86 0
      src/styles/index.scss
  8. 12 3
      src/views/bpm/documents/documentTemplate/components/mainBodyTemplate.vue
  9. 5 1
      src/views/bpm/documents/noticeIssuance/components/addOrEdit.vue
  10. 238 0
      src/views/bpm/handleTask/components/payrollAppealApproval/detail.vue
  11. 130 0
      src/views/bpm/handleTask/components/payrollAppealApproval/submit.vue
  12. 472 0
      src/views/bpm/handleTask/components/payrollBatchApproval/detail.vue
  13. 114 0
      src/views/bpm/handleTask/components/payrollBatchApproval/submit.vue
  14. 215 43
      src/views/bpm/handleTask/components/qualityReportApproval/detailDialog.vue
  15. 119 26
      src/views/bpm/handleTask/components/qualityReportApproval/unqualifiedProduct.vue
  16. 109 6
      src/views/bpm/handleTask/components/quotation/addDialog.vue
  17. 362 0
      src/views/bpm/handleTask/components/quotation/bom.js
  18. 143 0
      src/views/bpm/handleTask/components/quotation/bomDetailDialog.vue
  19. 336 0
      src/views/bpm/handleTask/components/quotation/bomImportDialog.vue
  20. 54 2
      src/views/bpm/handleTask/components/quotation/detailDialog.vue
  21. 71 134
      src/views/bpm/handleTask/components/quotation/submit.vue
  22. 10 0
      src/views/bpm/handleTask/index.vue
  23. 3 3
      vue.config.js

BIN
public/importTemplate/BOM导入模板.xls


+ 42 - 6
src/BIZComponents/inventoryTable.vue

@@ -590,6 +590,8 @@
 
       <!-- 操作列 -->
       <template v-slot:action="scope">
+        <!-- 行内自定义操作:父组件传了 rowActions 插槽才渲染(报价单审批用 BOM导入/BOM详情) -->
+        <slot name="rowActions" :row="scope.row" :index="scope.$index"></slot>
         <el-popconfirm
           class="ele-action"
           title="确定要删除吗?"
@@ -649,6 +651,11 @@
       ProductionVersion
     },
     props: {
+      // 操作列宽度:传了 rowActions 插槽(如报价单审批的 BOM导入/BOM详情)时可放宽,不传沿用 120
+      rowActionWidth: {
+        type: Number,
+        default: 120
+      },
       pageName: {
         default: '',
         type: String
@@ -760,6 +767,8 @@
           datasource: []
         },
         pricingWayList,
+        // 标记:用户是否手动改过表格数据(单价/数量),审批前据此判断是否需要落库
+        singlePriceChanged: false,
         rules: {},
         dictList: {}
       };
@@ -1073,7 +1082,8 @@
               },
 
           {
-            width: 200,
+            // 有效期 = 数字输入框 + 单位下拉,两个控件拼一起
+            width: 150,
             prop: 'guaranteePeriod',
             label: '有效期',
             slot: 'guaranteePeriod',
@@ -1152,7 +1162,7 @@
           {
             columnKey: 'action',
             label: '操作',
-            width: 120,
+            width: this.rowActionWidth,
             align: 'center',
             resizable: false,
             slot: 'action',
@@ -1281,6 +1291,10 @@
       getPrice() {
         return [this.allPrice, this.form.discountTotalPrice];
       },
+      // 供父组件查询:用户在表格里是否手动调整过数据
+      isSinglePriceChanged() {
+        return this.singlePriceChanged;
+      },
       orderNoChange(row, item) {
         row['orderId'] = item.orderId;
       },
@@ -1288,16 +1302,20 @@
       changeCount(row, index) {
         if (!row) {
           this.form.datasource.forEach((item, index) => {
+            // 必须替换数组里的行对象:写成 this.$set(this.form, 'datasource[i]')
+            // 只会在 form 上挂一个字符串键,数组元素不会更新,合计/总计永远是旧值
             this.$set(
-              this.form,
-              'datasource[' + index + ']',
+              this.form.datasource,
+              index,
               changeCount(item, this.countObj)
             );
           });
         } else {
+          // 用户在界面上改动了某行的单价/数量,置位"已改动"标记
+          this.singlePriceChanged = true;
           this.$set(
-            this.form,
-            'datasource[' + index + ']',
+            this.form.datasource,
+            index,
             changeCount(row, this.countObj)
           );
         }
@@ -1426,12 +1444,26 @@
       },
       //选择产品回调
       changeParent(obj, idx) {
+        let bomCleared = false;
         obj.forEach((item, index) => {
           let i = idx == -1 ? index : idx;
           let row = JSON.parse(JSON.stringify(this.defaultForm));
           row.key = this.form.datasource.length + 1;
           let parasm = idx == -1 ? row : this.form.datasource[i];
 
+          // 切换产品:原 BOM 属于已换掉的产品,必须清空;
+          // 单价若是由 BOM导入回填的(该行有 bomList),一并归零,避免新产品沿用旧成本价
+          const hadBom =
+            Array.isArray(parasm.bomList) && parasm.bomList.length > 0;
+          if (hadBom) {
+            bomCleared = true;
+            this.$set(parasm, 'singlePrice', 0);
+            this.$set(parasm, 'notaxSinglePrice', 0);
+            this.$set(parasm, 'totalPrice', 0);
+          }
+          this.$set(parasm, 'bomList', []);
+          this.$set(parasm, 'rowKey', '');
+
           this.$set(parasm, 'productId', item.id);
           this.$set(parasm, 'categoryName', item.name);
           this.$set(parasm, 'productCategoryId', item.categoryLevelId);
@@ -1486,6 +1518,10 @@
             this.form.datasource.push(row);
           }
         });
+        // 清过 BOM 的行单价被归零,总计要跟着重算
+        if (bomCleared) {
+          this.changeAll();
+        }
       },
       remove(index) {
         this.form.datasource.splice(index, 1);

+ 38 - 1
src/BIZComponents/inventoryTableDetails.vue

@@ -90,6 +90,16 @@
           {{ scope.row[countObj.unitKey] }}
         </el-form-item>
       </template> -->
+      <template v-slot:bomAction="scope">
+        <el-link
+          type="primary"
+          :underline="false"
+          icon="el-icon-document"
+          @click.native="openBomDetail(scope.row)"
+        >
+          BOM详情<span v-if="rowBomCount(scope.row)">({{ rowBomCount(scope.row) }})</span>
+        </el-link>
+      </template>
       <!-- 表头工具栏 -->
       <template v-slot:toolbar>
         <div class="headbox">
@@ -139,6 +149,11 @@
       timeDialog
     },
     props: {
+      // 是否显示「操作」列(BOM详情):只有报价单审批详情传 true,其它单据不受影响
+      showBomDetail: {
+        default: false,
+        type: Boolean
+      },
       isDiscountTotalPrice: {
         default: false,
         type: Boolean
@@ -885,11 +900,22 @@
           }
         ];
         // 合并所有列
-        return [
+        const mergedColumns = [
           ...baseColumns,
           ...additionalColumns,
           ...remainingColumns
         ].filter((item) => !item.isNone);
+        if (this.showBomDetail) {
+          mergedColumns.push({
+            width: 130,
+            columnKey: 'bomAction',
+            label: '操作',
+            slot: 'bomAction',
+            fixed: 'right',
+            align: 'center'
+          });
+        }
+        return mergedColumns;
       }
     },
 
@@ -995,6 +1021,10 @@
         });
         return comitDatasource;
       },
+      // 返回 [总计, 优惠后总金额],与可编辑表格的接口保持一致
+      getPrice() {
+        return [this.allPrice, this.form.discountTotalPrice];
+      },
       setDeliveryDays() {
         console.log(this.form.datasource, 'this.form.datasource');
         this.form.datasource.forEach((item, i) => {
@@ -1054,6 +1084,13 @@
         return isNaN(num) ? 0 : formatPrice(num);
       },
       //修改回显
+      rowBomCount(row) {
+        return row && Array.isArray(row.bomList) ? row.bomList.length : 0;
+      },
+      // 交给父组件(报价单审批详情)打开 BOM 详情弹窗
+      openBomDetail(row) {
+        this.$emit('showBomDetail', row);
+      },
       async putTableValue(data) {
         let productList =
           (data &&

+ 12 - 0
src/api/bpm/components/qualityReportApproval/qualityReportApproval.js

@@ -75,6 +75,18 @@ export async function getById(id) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+
+/**
+ * 获取回流工序(处置方式选「返工 / 返修」时选择工序)
+ * 与不合格品台账列表页同一接口:入参工单编码
+ */
+export async function refluxTask(data) {
+  const res = await request.post('/mes/workorder/refluxTask', data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
 /**
  * 不合格品台账列表
  */

+ 145 - 0
src/api/hr/payrollAppeal.js

@@ -0,0 +1,145 @@
+import request from '@/utils/request';
+import { getProcessInstance } from '@/api/bpm/processInstance';
+import { listOrganizations } from '@/api/organization';
+
+/**
+ * 工资条异议审批(流程标识 hr_payroll_payslip_appeal_approval)审批页取数。
+ *
+ * 取数顺序与薪资批次审批一致:
+ * 1. 待办传入的 businessId 是申诉单 id,优先按 id 取申诉详情;
+ * 2. 详情接口取不到(后端尚未提供该端点)时,回退流程实例 formVariables,
+ *    发起审批时已把申诉摘要写进变量,保证审批页不会空白;
+ * 3. 拿到 companyId 后再翻译法人名称,翻译失败不影响页面渲染。
+ *
+ * 审批页不取工资金额:异议成立的金额调整由「工资条更正审批」单独走一遍。
+ */
+
+function unwrap(response) {
+  const result = (response && response.data) || {};
+  if (Number(result.code) === 0) return result.data;
+  const error = new Error(result.message || '服务调用失败');
+  if (response && response.__toastShown) error.__toastShown = true;
+  return Promise.reject(error);
+}
+
+function hasId(value) {
+  return value !== undefined && value !== null && String(value).trim() !== '';
+}
+
+/** 申诉类型:与 HR 端 APPEAL_TYPE_OPTIONS 保持一致 */
+export const APPEAL_TYPE_LABELS = {
+  AMOUNT: '金额有误',
+  ITEM_MISSING: '项目缺失',
+  ATTENDANCE: '考勤/扣款异常',
+  OTHER: '其他'
+};
+
+/** 申诉受理状态:HR 在申诉页受理后的结果 */
+export const APPEAL_STATUS_LABELS = {
+  PROCESSING: '待受理',
+  REJECTED: '已驳回',
+  CORRECTED: '已创建更正',
+  CLOSED: '已关闭'
+};
+
+/**
+ * 申诉详情:GET /hr/payroll/payslips/appeals/{appealId}
+ *
+ * 后端目前只有分页接口,这里按 REST 同族路径先行对接;
+ * 端点不存在时返回 null,由 loadPayslipAppealApprovalDetail 走变量回退。
+ */
+export async function getPayslipAppealDetail(appealId) {
+  if (!hasId(appealId)) return null;
+  const response = await request({
+    url: `/hr/payroll/payslips/appeals/${encodeURIComponent(String(appealId))}`,
+    method: 'get'
+  });
+  return unwrap(response);
+}
+
+function flattenOrganizations(list) {
+  const result = [];
+  const walk = (items) => {
+    (Array.isArray(items) ? items : []).forEach((item) => {
+      if (!item) return;
+      result.push(item);
+      if (Array.isArray(item.children) && item.children.length) {
+        walk(item.children);
+      }
+    });
+  };
+  walk(list);
+  return result;
+}
+
+async function resolveCompanyName(companyId) {
+  if (!hasId(companyId)) return '';
+  try {
+    const list = await listOrganizations();
+    const hit = flattenOrganizations(list).find(
+      (item) => String(item.id) === String(companyId)
+    );
+    return hit ? hit.name || hit.orgName || hit.groupName || '' : '';
+  } catch (error) {
+    return '';
+  }
+}
+
+/**
+ * 审批页取数入口。
+ *
+ * @param {string|number} businessId 申诉单 id(发起审批时的 businessId)
+ * @param {string|number} processInstanceId 流程实例 id,详情取不到时用于回退变量
+ * @returns {Promise<{appeal: Object, formVariables: Object, companyName: string, errorMessage: string}>}
+ */
+export async function loadPayslipAppealApprovalDetail(
+  businessId,
+  processInstanceId = ''
+) {
+  const result = {
+    appeal: {},
+    formVariables: {},
+    companyName: '',
+    errorMessage: ''
+  };
+
+  let appealId = hasId(businessId) ? businessId : '';
+
+  if (hasId(appealId)) {
+    try {
+      const detail = await getPayslipAppealDetail(appealId);
+      result.appeal = detail || {};
+    } catch (error) {
+      /* 详情端点未上线属于预期情况,不提示错误,交给变量回退 */
+      result.errorMessage = '';
+    }
+  }
+
+  const needFallback =
+    !result.appeal || !Object.keys(result.appeal).length;
+
+  if (needFallback && hasId(processInstanceId)) {
+    try {
+      const instance = await getProcessInstance(processInstanceId);
+      result.formVariables = (instance && instance.formVariables) || {};
+      const fallbackId = result.formVariables.appealId;
+      if (!hasId(appealId) && hasId(fallbackId)) {
+        appealId = fallbackId;
+        try {
+          const detail = await getPayslipAppealDetail(appealId);
+          if (detail && Object.keys(detail).length) result.appeal = detail;
+        } catch (error) {
+          /* 仍然取不到就只用变量 */
+        }
+      }
+    } catch (error) {
+      /* 流程实例也取不到时保持空白状态 */
+    }
+  }
+
+  const companyId =
+    result.appeal.companyId || result.formVariables.companyId || '';
+  result.companyName = await resolveCompanyName(companyId);
+
+  return result;
+}

+ 181 - 0
src/api/hr/payrollBatch.js

@@ -0,0 +1,181 @@
+import request from '@/utils/request';
+import { getProcessInstance } from '@/api/bpm/processInstance';
+
+function unwrap(response) {
+  const result = (response && response.data) || {};
+  if (Number(result.code) === 0) return result.data;
+  const error = new Error(result.message || '服务调用失败');
+  if (response && response.__toastShown) error.__toastShown = true;
+  return Promise.reject(error);
+}
+
+function hasId(value) {
+  return value !== undefined && value !== null && String(value).trim() !== '';
+}
+
+/**
+ * 薪资核算工作台汇总:批次状态、同步状态、人数、完成率、异常计数、可用动作。
+ * GET /hr/payroll/batches/{batchId}/dashboard
+ * 不含工资金额与来源快照正文。
+ */
+export async function getPayrollBatchDashboard(batchId) {
+  if (!hasId(batchId)) return null;
+  const response = await request({
+    url: `/hr/payroll/batches/${encodeURIComponent(String(batchId))}/dashboard`,
+    method: 'get'
+  });
+  return unwrap(response);
+}
+
+/**
+ * 批次未关闭异常:GET /hr/payroll/batches/{batchId}/exceptions
+ */
+export async function listPayrollBatchExceptions(batchId) {
+  if (!hasId(batchId)) return [];
+  const response = await request({
+    url: `/hr/payroll/batches/${encodeURIComponent(String(batchId))}/exceptions`,
+    method: 'get'
+  });
+  return unwrap(response) || [];
+}
+
+/**
+ * 法人内批次摘要:GET /hr/payroll/batches?companyId=xxx
+ * 含审批单据编码、模板版本、发起人、创建时间,不含金额。
+ */
+export async function listPayrollBatches(companyId) {
+  if (!hasId(companyId)) return [];
+  const response = await request({
+    url: '/hr/payroll/batches',
+    method: 'get',
+    params: { companyId }
+  });
+  return unwrap(response) || [];
+}
+
+/**
+ * 法人可用薪资模板摘要:GET /hr/payroll/templates?companyId=xxx
+ * 批次摘要只返回模板主键和版本号,名称需另取。
+ */
+export async function listPayrollTemplates(companyId) {
+  if (!hasId(companyId)) return [];
+  const response = await request({
+    url: '/hr/payroll/templates',
+    method: 'get',
+    params: { companyId }
+  });
+  return unwrap(response) || [];
+}
+
+/**
+ * 按模板主键查模板名称,取不到时返回空字符串(不阻断审批页渲染)。
+ */
+export async function resolvePayrollTemplateName(companyId, templateId) {
+  if (!hasId(companyId) || !hasId(templateId)) return '';
+  try {
+    const list = await listPayrollTemplates(companyId);
+    const records = Array.isArray(list) ? list : [];
+    const matched = records.find((item) => String(item.id) === String(templateId));
+    return (matched && matched.templateName) || '';
+  } catch (error) {
+    return '';
+  }
+}
+
+/**
+ * 在法人批次摘要列表中查找当前批次。
+ */
+export async function getPayrollBatchSummary(companyId, batchId) {
+  if (!hasId(companyId) || !hasId(batchId)) return {};
+  const list = await listPayrollBatches(companyId);
+  const records = Array.isArray(list) ? list : [];
+  return (
+    records.find((item) => String(item.id) === String(batchId)) || {}
+  );
+}
+
+/**
+ * 审批详情取数(审批页用)
+ *
+ * 1. 待办传入的 businessId 即薪资批次主键,直接取工作台汇总;
+ * 2. 汇总取不到时回退流程实例 formVariables(发起审批时透传的批次字段);
+ * 3. 汇总可用时再并行取未关闭异常与批次摘要(单据编码/模板版本)。
+ *
+ * 不经过薪资明细接口,审批页不取个人薪资数据。
+ */
+export async function loadPayrollBatchApprovalDetail(
+  businessId,
+  processInstanceId = ''
+) {
+  const result = {
+    dashboard: {},
+    summary: {},
+    exceptions: [],
+    formVariables: {},
+    errorMessage: ''
+  };
+
+  let batchId = hasId(businessId) ? businessId : '';
+  let dashboardError = '';
+
+  if (hasId(batchId)) {
+    try {
+      result.dashboard = (await getPayrollBatchDashboard(batchId)) || {};
+    } catch (error) {
+      dashboardError = error.message || '';
+    }
+  }
+
+  if (
+    (!result.dashboard || !Object.keys(result.dashboard).length) &&
+    hasId(processInstanceId)
+  ) {
+    try {
+      const instance = await getProcessInstance(processInstanceId);
+      result.formVariables = (instance && instance.formVariables) || {};
+      const fallbackId = result.formVariables.businessId;
+      if (hasId(fallbackId) && String(fallbackId) !== String(batchId)) {
+        batchId = fallbackId;
+        try {
+          result.dashboard = (await getPayrollBatchDashboard(batchId)) || {};
+        } catch (error) {
+          dashboardError = error.message || dashboardError;
+        }
+      }
+    } catch (error) {
+      /* 流程实例也取不到时保留流程表单摘要 */
+    }
+  }
+
+  if (result.dashboard && Object.keys(result.dashboard).length > 0) {
+    const companyId = result.dashboard.companyId;
+    await Promise.all([
+      listPayrollBatchExceptions(batchId)
+        .then((list) => {
+          result.exceptions = Array.isArray(list) ? list : [];
+        })
+        .catch(() => {
+          result.exceptions = [];
+        }),
+      getPayrollBatchSummary(companyId, batchId)
+        .then(async (summary) => {
+          result.summary = summary || {};
+          if (hasId(result.summary.templateId)) {
+            const templateName = await resolvePayrollTemplateName(
+              companyId,
+              result.summary.templateId
+            );
+            if (templateName) result.summary.templateName = templateName;
+          }
+        })
+        .catch(() => {
+          result.summary = {};
+        })
+    ]);
+  }
+
+  if (dashboardError) {
+    result.errorMessage = dashboardError;
+  }
+  return result;
+}

+ 86 - 0
src/styles/index.scss

@@ -203,3 +203,89 @@ table th .is-required::before {
 .repair_infoLogs .el-steps:last-child .el-step__line {
   display: none !important;
 }
+
+/* 下拉触发器(如审批按钮区的“更多”):可点击文字统一显示手型光标 */
+.el-dropdown-link {
+  cursor: pointer;
+}
+
+/*
+ * 物品清单「有效期」列:数字输入框 + 有效期单位下拉 拼成一个输入组
+ * 问题:左侧输入框包在 el-form-item 里,内容区默认 40px 行高,输入框按基线排版
+ * 会被往下压 2px,导致和右侧下拉框上下错位;同时两个框各自带边框,拼接处成了双线。
+ * 全项目有 6 份 inventoryTable 副本(报价单/商机/合同/采购/销售/退货),统一在这里修。
+ */
+.period {
+  display: flex;
+  align-items: center;
+  width: 100%;
+
+  .borderleftnone {
+    flex: 1 1 0;
+    min-width: 0;
+
+    .el-form-item {
+      margin-bottom: 0;
+    }
+
+    /* 去掉行高/基线影响,让输入框与右侧下拉框顶边对齐 */
+    .el-form-item__content {
+      display: flex;
+      line-height: normal;
+    }
+
+    .el-input__inner {
+      border-top-right-radius: 0;
+      border-bottom-right-radius: 0;
+    }
+  }
+
+  .borderrightnone {
+    /* 和左侧输入框等分整列宽度 */
+    flex: 1 1 0;
+    min-width: 0;
+
+    /* 拼接处只留左侧输入框的右边框,避免两条边框叠成双线 */
+    .el-input__inner {
+      border-top-left-radius: 0;
+      border-bottom-left-radius: 0;
+      border-left: 0;
+    }
+  }
+
+  /* 单元格很窄,默认 15px 内边距会把"请输入/请选择"截断 */
+  .el-input__inner {
+    padding-left: 6px;
+    padding-right: 6px;
+  }
+}
+
+/*
+ * 表格内的多选(如报价单物品清单的「产地」):
+ * el-tag 是 flex 子项,单元格一窄就被压扁,文字被裁掉、关闭按钮溢出到 tag 外面。
+ * 这里让 tag 不被压缩,并把 tag / 关闭图标收小一号,保证 2~3 个字的选项能完整显示。
+ */
+.time-form .el-select .el-tag {
+  flex: 0 0 auto;
+  max-width: 100%;
+  height: 22px;
+  line-height: 20px;
+  padding: 0 4px;
+  font-size: 12px;
+}
+
+.time-form .el-select .el-tag .el-icon-close {
+  flex: none;
+  position: static;
+  width: 14px;
+  height: 14px;
+  line-height: 14px;
+  font-size: 10px;
+  margin-left: 3px;
+}
+
+.time-form .el-select__tags-text {
+  max-width: 100%;
+  overflow: hidden;
+  text-overflow: ellipsis;
+}

+ 12 - 3
src/views/bpm/documents/documentTemplate/components/mainBodyTemplate.vue

@@ -122,7 +122,7 @@
           <td class="label">发文单位意见</td>
           <td colspan="4">
             <el-form-item prop="unitOpinion">
-              <el-input v-model="form.unitOpinion" :disabled="disabled" placeholder="请输入" />
+              <el-input v-model="form.unitOpinion" :disabled="isFieldDisabled('unitOpinion')" placeholder="请输入" />
             </el-form-item>
           </td>
         </tr>
@@ -132,7 +132,7 @@
           <td class="label">会办单位意见</td>
           <td colspan="2">
             <el-form-item prop="coUnitOpinion">
-              <el-input v-model="form.coUnitOpinion" :disabled="disabled" placeholder="请输入" />
+              <el-input v-model="form.coUnitOpinion" :disabled="isFieldDisabled('coUnitOpinion')" placeholder="请输入" />
             </el-form-item>
           </td>
           <td class="label">核稿</td>
@@ -158,7 +158,7 @@
           <td class="label">领导批示</td>
           <td colspan="4">
             <el-form-item prop="leaderInstruction">
-              <el-input v-model="form.leaderInstruction" :disabled="disabled" placeholder="请输入" />
+              <el-input v-model="form.leaderInstruction" :disabled="isFieldDisabled('leaderInstruction')" placeholder="请输入" />
             </el-form-item>
           </td>
         </tr>
@@ -298,6 +298,11 @@ export default {
       type: String,
       default: 'template'
     },
+    // 只读模式下仍需放开的字段编码(审核场景),其余字段继续跟随 type=detail 只读
+    editableKeys: {
+      type: Array,
+      default: () => []
+    },
   },
   data() {
     return {
@@ -402,6 +407,10 @@ export default {
     
   },
   methods: {
+    // 审核模式下只放开 editableKeys 指定的字段
+    isFieldDisabled(fieldKey) {
+      return this.disabled && !this.editableKeys.includes(fieldKey);
+    },
     setFiles(files) {
       console.log('setFiles~~~', files);
       this.form.attachments = files.map((i) => i.id);

+ 5 - 1
src/views/bpm/documents/noticeIssuance/components/addOrEdit.vue

@@ -3,7 +3,7 @@
         <el-card shadow="never">
             <el-tabs v-model="tabValue" type="card" @tab-click="handleTabClick">
                 <el-tab-pane v-if="query.type != 'view'" label="稿纸信息" name="1">
-                    <MainBodyTemplate ref="mainBodyTemplate" :type="routerQuery.type" menu="notice" :disabled="disabled" @sendFiles="getFiles"></MainBodyTemplate>
+                    <MainBodyTemplate ref="mainBodyTemplate" :type="routerQuery.type" menu="notice" :disabled="disabled" :editable-keys="editableOpinionKeys" @sendFiles="getFiles"></MainBodyTemplate>
                 </el-tab-pane>
                 <el-tab-pane label="正文" name="2">
                     <div class="editor-wrapper">
@@ -284,6 +284,10 @@ export default {
     disabled() {
       return this.routerQuery.type == 'detail' || this.routerQuery.type == 'view';
     },
+    // 审核(待办处理)时,稿纸里的三段意见允许审核人修改
+    editableOpinionKeys() {
+      return this.isApprove ? ['unitOpinion', 'coUnitOpinion', 'leaderInstruction'] : [];
+    },
   },
   methods: {
     // openDrawer(query) {

+ 238 - 0
src/views/bpm/handleTask/components/payrollAppealApproval/detail.vue

@@ -0,0 +1,238 @@
+<!-- 工资条异议审批详情:只看异议内容与来源,不展示工资明细金额 -->
+<template>
+  <main class="cm-detail-host" v-loading="loading">
+    <div v-if="hasData" class="cm-create-page cm-detail-page">
+      <div class="cm-create-employee-card cm-detail-employee">
+        <span class="cm-employee-avatar">{{ avatarText }}</span>
+        <div class="cm-employee-info">
+          <b>
+            {{ employeeName }}
+            <span class="cm-employee-no">工号:{{ jobNumberLabel }}</span>
+            <span class="cm-employee-no">所属组织:{{ organizationName }}</span>
+          </b>
+        </div>
+        <div class="cm-detail-status">
+          <small>受理状态</small>
+          <span :class="['cm-status', statusTone]">{{ statusLabel }}</span>
+        </div>
+      </div>
+
+      <div class="cm-create-section">
+        <div class="cm-create-section-title">异议信息</div>
+        <div class="cm-create-grid">
+          <div class="cm-compare-item">
+            <span class="cm-compare-label">申诉单号:</span>
+            <span class="cm-compare-value is-highlight">{{ appealCode }}</span>
+          </div>
+          <div class="cm-compare-item">
+            <span class="cm-compare-label">工资条编号:</span>
+            <span class="cm-compare-value">{{ payslipCode }}</span>
+          </div>
+          <div class="cm-compare-item">
+            <span class="cm-compare-label">申诉类型:</span>
+            <span class="cm-compare-value">{{ appealTypeLabel }}</span>
+          </div>
+          <div class="cm-compare-item">
+            <span class="cm-compare-label">提交时间:</span>
+            <span class="cm-compare-value">{{ formatDateTime(createTime) }}</span>
+          </div>
+        </div>
+      </div>
+
+      <div class="cm-create-section">
+        <div class="cm-create-section-title">异议原因</div>
+        <div class="appeal-reason">{{ appealReason }}</div>
+      </div>
+
+      <div class="cm-create-section">
+        <div class="cm-create-section-title">审批说明</div>
+        <ul class="approval-tips">
+          <li>通过:表示异议成立,HR 需在「薪资核算 → 工资条申诉」执行受理;涉及金额调整的,另走「工资条更正审批」。</li>
+          <li>驳回:异议不成立,HR 受理时选择「驳回 / 解释关闭」,工资条退回员工可确认状态。</li>
+          <li>审批不直接改动工资条状态,也不修改任何金额,避免审批与核算结果互相覆盖。</li>
+        </ul>
+      </div>
+    </div>
+    <el-empty v-else-if="!loading" description="暂无工资条异议信息" />
+  </main>
+</template>
+
+<script>
+import { loadPayslipAppealApprovalDetail, APPEAL_TYPE_LABELS, APPEAL_STATUS_LABELS } from '@/api/hr/payrollAppeal';
+
+const STATUS_TONE = {
+  PROCESSING: 'pending',
+  REJECTED: 'terminated',
+  CORRECTED: 'active',
+  CLOSED: 'expired'
+};
+
+export default {
+  name: 'PayrollAppealApprovalDetail',
+  props: {
+    // 待办传入的申诉单主键
+    businessId: {
+      default: ''
+    },
+    // 流程实例主键,申诉单主键缺失时用于回退流程表单变量
+    id: {
+      default: ''
+    },
+    taskId: {
+      default: ''
+    },
+    taskDefinitionKey: {
+      default: ''
+    },
+    fromUser: {
+      default: ''
+    },
+    deptName: {
+      default: ''
+    },
+    createTime: {
+      default: ''
+    }
+  },
+  data() {
+    return {
+      loading: false,
+      loadedKey: '',
+      appeal: {},
+      formVariables: {},
+      companyName: ''
+    };
+  },
+  computed: {
+    hasData() {
+      return (
+        Object.keys(this.appeal).length > 0 ||
+        Object.keys(this.formVariables).length > 0
+      );
+    },
+    /** 逐字段「详情接口优先、流程变量兜底」 */
+    employeeName() {
+      return (
+        this.appeal.employeeName ||
+        this.formVariables.employeeName ||
+        this.fromUser ||
+        '-'
+      );
+    },
+    jobNumberLabel() {
+      return this.appeal.jobNumber || this.formVariables.jobNumber || '-';
+    },
+    organizationName() {
+      return (
+        this.companyName ||
+        this.appeal.deptName ||
+        this.formVariables.deptName ||
+        this.deptName ||
+        '-'
+      );
+    },
+    appealCode() {
+      const id = this.appeal.id || this.formVariables.appealId || this.businessId;
+      return id ? `APPEAL-${id}` : '-';
+    },
+    payslipCode() {
+      const id = this.appeal.payslipId || this.formVariables.payslipId;
+      return id != null && id !== '' ? String(id) : '-';
+    },
+    appealTypeLabel() {
+      const code = this.appeal.appealType || this.formVariables.appealType || '';
+      return (
+        this.appeal.appealTypeLabel ||
+        this.formVariables.appealTypeLabel ||
+        APPEAL_TYPE_LABELS[code] ||
+        code ||
+        '-'
+      );
+    },
+    status() {
+      return this.appeal.status || this.formVariables.status || '';
+    },
+    statusLabel() {
+      return APPEAL_STATUS_LABELS[this.status] || this.status || '-';
+    },
+    statusTone() {
+      return STATUS_TONE[this.status] || 'draft';
+    },
+    appealReason() {
+      return (
+        this.appeal.appealReason ||
+        this.formVariables.appealReason ||
+        '员工未填写异议说明'
+      );
+    },
+    avatarText() {
+      return this.employeeName && this.employeeName !== '-'
+        ? this.employeeName.slice(0, 1)
+        : '薪';
+    }
+  },
+  watch: {
+    businessId: {
+      immediate: true,
+      handler() {
+        this.load();
+      }
+    },
+    id() {
+      if (!this.businessId) this.load();
+    }
+  },
+  methods: {
+    formatDateTime(value) {
+      const text = String(value || this.formVariables.createTime || '');
+      if (!text) return '-';
+      return text.replace('T', ' ').slice(0, 19);
+    },
+    async load() {
+      if (!this.businessId && !this.id) return;
+      const key = `${this.businessId}|${this.id}`;
+      if (this.loading || key === this.loadedKey) return;
+      this.loadedKey = key;
+      this.loading = true;
+      try {
+        const detail = await loadPayslipAppealApprovalDetail(
+          this.businessId,
+          this.id
+        );
+        this.appeal = detail.appeal || {};
+        this.formVariables = detail.formVariables || {};
+        this.companyName = detail.companyName || '';
+      } catch (error) {
+        this.appeal = {};
+        this.formVariables = {};
+        this.$message.error(error.message || '工资条异议信息加载失败');
+      } finally {
+        this.loading = false;
+      }
+    }
+  }
+};
+</script>
+
+<style lang="scss" scoped src="@/styles/views/hrContractManagement/index.scss"></style>
+
+<style lang="scss" scoped>
+.appeal-reason {
+  padding: 12px 14px;
+  color: #243955;
+  font-size: 14px;
+  line-height: 1.8;
+  white-space: pre-wrap;
+  word-break: break-all;
+  background: #f6f8fb;
+  border-radius: 4px;
+}
+
+.approval-tips {
+  margin: 0;
+  padding-left: 18px;
+  color: #7b899b;
+  font-size: 13px;
+  line-height: 1.9;
+}
+</style>

+ 130 - 0
src/views/bpm/handleTask/components/payrollAppealApproval/submit.vue

@@ -0,0 +1,130 @@
+<!-- 工资条异议审批操作区:通过 / 驳回 -->
+<template>
+  <el-col :span="16" :offset="6">
+    <el-alert
+      type="warning"
+      :closable="false"
+      show-icon
+      class="appeal-approval-alert"
+    >
+      <template slot="title">
+        审批只判定异议是否成立,不会自动改动工资条。通过后请到「薪资核算 → 工资条申诉」受理,
+        涉及金额调整的再发起「工资条更正审批」。
+      </template>
+    </el-alert>
+    <el-form label-width="100px" :model="form">
+      <el-form-item label="审批意见">
+        <ApprovalOpinion ref="approvalOpinion" v-model="form.reason" />
+      </el-form-item>
+    </el-form>
+    <div class="audit-buttons">
+      <el-button
+        icon="el-icon-edit-outline"
+        type="success"
+        size="mini"
+        :loading="isLoading"
+        v-click-once
+        @click="$refs.approvalOpinion.validate(1) && handleApprove()"
+        >通过</el-button
+      >
+      <el-button
+        icon="el-icon-circle-close"
+        type="danger"
+        size="mini"
+        :loading="isLoading"
+        v-click-once
+        @click="$refs.approvalOpinion.validate(0) && handleReject()"
+        >驳回</el-button
+      >
+    </div>
+  </el-col>
+</template>
+
+<script>
+import { approveTaskWithVariables, rejectTask } from '@/api/bpm/task';
+
+export default {
+  name: 'PayrollAppealApprovalSubmit',
+  props: {
+    businessId: {
+      default: ''
+    },
+    id: {
+      default: ''
+    },
+    taskId: {
+      default: ''
+    },
+    taskDefinitionKey: {
+      default: ''
+    },
+    businessCode: {
+      default: ''
+    }
+  },
+  data() {
+    return {
+      form: {
+        reason: '同意'
+      },
+      isLoading: false
+    };
+  },
+  methods: {
+    handleApprove() {
+      this.submit(true);
+    },
+    handleReject() {
+      this.submit(false);
+    },
+    async submit(pass) {
+      if (!this.taskId) {
+        this.$message.warning('未获取到审批任务,请刷新待办后重试');
+        return;
+      }
+      if (!this.form.reason || !this.form.reason.trim()) {
+        this.$message.warning('请填写审批意见');
+        return;
+      }
+      this.isLoading = true;
+      try {
+        const payload = { id: this.taskId, reason: this.form.reason.trim() };
+        const res = pass
+          ? await approveTaskWithVariables({
+              ...payload,
+              // 回写给业务侧判断分支:pass=true 表示异议成立
+              variables: { pass: true, appealApproved: true }
+            })
+          : await rejectTask(payload);
+        // 失败提示由 request 拦截器统一弹出,这里不再重复弹窗
+        if (!res || !res.data || Number(res.data.code) !== 0) {
+          return;
+        }
+        // 成功提示由父级 handleAudit 统一弹出,避免重复提示
+        this.$emit('handleAudit', {
+          status: pass ? 1 : 0,
+          title: pass ? '通过' : '驳回'
+        });
+      } catch (error) {
+        // 网络异常由拦截器提示;这里仅兜底非响应体异常
+        if (!error || !error.message) {
+          this.$message.error(pass ? '审批失败' : '驳回失败');
+        }
+      } finally {
+        this.isLoading = false;
+      }
+    }
+  }
+};
+</script>
+
+<style lang="scss" scoped>
+.appeal-approval-alert {
+  margin-bottom: 16px;
+}
+
+.audit-buttons {
+  padding-left: 100px;
+  margin-bottom: 12px;
+}
+</style>

+ 472 - 0
src/views/bpm/handleTask/components/payrollBatchApproval/detail.vue

@@ -0,0 +1,472 @@
+<!-- 薪资核算审批详情:只展示批次汇总与异常信息,不展示个人薪资明细 -->
+<template>
+  <main class="cm-detail-host" v-loading="loading">
+    <div v-if="hasData" class="cm-create-page cm-detail-page">
+      <div class="cm-create-employee-card cm-detail-employee">
+        <span class="cm-employee-avatar">{{ avatarText }}</span>
+        <div class="cm-employee-info">
+          <b>
+            申请人:{{ applicantName }}
+            <span class="cm-employee-no">所属组织:{{ organizationName }}</span>
+            <span v-if="documentCode" class="cm-employee-no"
+              >审批单号:{{ documentCode }}</span
+            >
+          </b>
+        </div>
+        <div class="cm-detail-status">
+          <small>批次状态</small>
+          <span :class="['cm-status', statusTone]">{{ batchStatusLabel }}</span>
+        </div>
+      </div>
+
+      <div class="cm-create-section">
+        <div class="cm-create-section-title">薪资核算批次</div>
+        <div class="cm-create-grid">
+          <div class="cm-compare-item">
+            <span class="cm-compare-label">核算月份:</span>
+            <span class="cm-compare-value is-highlight">{{ payrollMonth }}</span>
+          </div>
+          <div class="cm-compare-item">
+            <span class="cm-compare-label">所属法人:</span>
+            <span class="cm-compare-value">{{ organizationName }}</span>
+          </div>
+          <div class="cm-compare-item">
+            <span class="cm-compare-label">薪资模板:</span>
+            <span class="cm-compare-value">{{ templateLabel }}</span>
+          </div>
+          <div class="cm-compare-item">
+            <span class="cm-compare-label">数据同步:</span>
+            <span class="cm-compare-value">{{ dataSyncStatusLabel }}</span>
+          </div>
+          <div class="cm-compare-item">
+            <span class="cm-compare-label">输入快照数:</span>
+            <span class="cm-compare-value">{{ snapshotCountLabel }}</span>
+          </div>
+          <div class="cm-compare-item">
+            <span class="cm-compare-label">核算完成率:</span>
+            <span class="cm-compare-value">{{ completionRateLabel }}</span>
+          </div>
+          <div class="cm-compare-item">
+            <span class="cm-compare-label">期望核算人数:</span>
+            <span class="cm-compare-value">{{ employeeCountLabel }}</span>
+          </div>
+          <div class="cm-compare-item">
+            <span class="cm-compare-label">已核算人数:</span>
+            <span class="cm-compare-value">{{ calculatedEmployeeCountLabel }}</span>
+          </div>
+          <div class="cm-compare-item">
+            <span class="cm-compare-label">发起时间:</span>
+            <span class="cm-compare-value">{{
+              formatDateTime(createTime || summary.createTime)
+            }}</span>
+          </div>
+        </div>
+      </div>
+
+      <div v-if="exceptionRows.length" class="cm-create-section">
+        <div class="cm-create-section-title">
+          核算异常(未关闭 {{ exceptionRows.length }} 条)
+        </div>
+        <div class="exception-summary">
+          <span class="exception-summary-item">
+            未关闭总数:<b>{{ openExceptionCountLabel }}</b>
+          </span>
+          <span class="exception-summary-item">
+            BLOCK 阻断:<b class="is-danger">{{ blockExceptionCount }}</b>
+          </span>
+          <span class="exception-summary-item">
+            WARN/HIGH 预警:<b class="is-warning">{{ warningExceptionCount }}</b>
+          </span>
+          <span class="exception-summary-item">
+            预警级别:<b>{{ alertLevelLabel }}</b>
+          </span>
+        </div>
+        <el-table
+          v-if="exceptionRows.length"
+          :data="exceptionRows"
+          size="mini"
+          border
+          class="exception-table"
+        >
+          <el-table-column label="风险级别" width="100">
+            <template slot-scope="{ row }">
+              <el-tag
+                size="mini"
+                :type="riskTagType(row.riskLevel)"
+                effect="plain"
+                >{{ riskLevelLabel(row.riskLevel) }}</el-tag
+              >
+            </template>
+          </el-table-column>
+          <el-table-column label="异常编码" prop="exceptionCode" width="160" />
+          <el-table-column
+            label="异常说明"
+            prop="message"
+            min-width="240"
+            show-overflow-tooltip
+          />
+          <el-table-column label="处理状态" width="110">
+            <template slot-scope="{ row }">
+              {{ exceptionStatusLabel(row.status) }}
+            </template>
+          </el-table-column>
+          <el-table-column
+            label="处理结论"
+            prop="handleResult"
+            min-width="160"
+            show-overflow-tooltip
+          />
+          <el-table-column label="处理时间" width="170">
+            <template slot-scope="{ row }">
+              {{ formatDateTime(row.handleTime) }}
+            </template>
+          </el-table-column>
+        </el-table>
+      </div>
+    </div>
+    <el-empty v-else-if="!loading" description="暂无薪资核算批次信息" />
+  </main>
+</template>
+
+<script>
+import { listOrganizations } from '@/api/organization';
+import { loadPayrollBatchApprovalDetail } from '@/api/hr/payrollBatch';
+
+const BATCH_STATUS_LABELS = {
+  FETCHING: '取数中',
+  FETCHED: '已取数',
+  CALCULATING: '核算中',
+  CALCULATED: '已核算',
+  CONFIRMING: '待确认',
+  APPROVING: '审批中',
+  APPROVED_LOCKED: '审批通过(已锁定)',
+  APPROVED: '审批通过',
+  PAYING: '发放中',
+  PAID: '已发放',
+  CLOSED: '已关闭',
+  VOID: '已作废',
+  CANCELLED: '已取消'
+};
+
+const SYNC_STATUS_LABELS = {
+  NOT_SYNCED: '未形成快照',
+  SYNCING: '取数中',
+  SYNCED: '已冻结',
+  BLOCKED: '存在阻断异常'
+};
+
+const ALERT_LEVEL_LABELS = {
+  NONE: '无',
+  WARN: '预警',
+  BLOCK: '阻断'
+};
+
+const RISK_LEVEL_LABELS = {
+  WARN: '预警',
+  HIGH: '高危',
+  BLOCK: '阻断'
+};
+
+const RISK_TAG_TYPES = {
+  WARN: 'warning',
+  HIGH: 'danger',
+  BLOCK: 'danger'
+};
+
+const EXCEPTION_STATUS_LABELS = {
+  OPEN: '待处理',
+  ACCEPTED: '已受理',
+  RESOLVED: '已处理',
+  IGNORED: '已忽略'
+};
+
+function flattenOrganizations(list) {
+  const result = [];
+  const walk = (items) => {
+    (Array.isArray(items) ? items : []).forEach((item) => {
+      if (!item) return;
+      result.push(item);
+      if (Array.isArray(item.children) && item.children.length) {
+        walk(item.children);
+      }
+    });
+  };
+  walk(list);
+  return result;
+}
+
+export default {
+  name: 'PayrollBatchApprovalDetail',
+  props: {
+    // 待办传入的薪资批次主键
+    businessId: {
+      default: ''
+    },
+    // 流程实例主键,批次主键缺失时用于回退流程表单变量
+    id: {
+      default: ''
+    },
+    taskId: {
+      default: ''
+    },
+    taskDefinitionKey: {
+      default: ''
+    },
+    // 流程发起人与发起人组织,由审批弹窗透传
+    fromUser: {
+      default: ''
+    },
+    deptName: {
+      default: ''
+    },
+    createTime: {
+      default: ''
+    }
+  },
+  data() {
+    return {
+      loading: false,
+      loadedKey: '',
+      dashboard: {},
+      summary: {},
+      exceptions: [],
+      formVariables: {},
+      companyName: '',
+      errorMessage: ''
+    };
+  },
+  computed: {
+    hasData() {
+      return (
+        Object.keys(this.dashboard).length > 0 ||
+        Object.keys(this.formVariables).length > 0
+      );
+    },
+    batchStatus() {
+      return (
+        this.dashboard.batchStatus ||
+        this.summary.batchStatus ||
+        this.formVariables.batchStatus ||
+        ''
+      );
+    },
+    batchStatusLabel() {
+      return BATCH_STATUS_LABELS[this.batchStatus] || this.batchStatus || '-';
+    },
+    statusTone() {
+      if (Number(this.blockExceptionCount) > 0) return 'expired';
+      switch (this.batchStatus) {
+        case 'APPROVING':
+          return 'pending';
+        case 'APPROVED_LOCKED':
+        case 'APPROVED':
+        case 'PAID':
+        case 'CLOSED':
+          return 'active';
+        case 'CALCULATED':
+        case 'CONFIRMING':
+          return 'trial';
+        case 'FETCHING':
+        case 'FETCHED':
+        case 'CALCULATING':
+          return 'signing';
+        case 'CANCELLED':
+        case 'VOID':
+          return 'terminated';
+        default:
+          return 'draft';
+      }
+    },
+    payrollMonth() {
+      return (
+        this.dashboard.payrollMonth ||
+        this.summary.payrollMonth ||
+        this.formVariables.payrollMonth ||
+        '-'
+      );
+    },
+    documentCode() {
+      return this.summary.documentCode || this.formVariables.documentCode || '';
+    },
+    templateLabel() {
+      const name = this.summary.templateName;
+      const version = this.summary.templateVersion;
+      const versionText = version != null ? `V${version}` : '';
+      if (name) return [name, versionText].filter(Boolean).join(' ');
+      return versionText || '-';
+    },
+    dataSyncStatusLabel() {
+      const status = this.dashboard.dataSyncStatus || '';
+      return SYNC_STATUS_LABELS[status] || status || '-';
+    },
+    alertLevelLabel() {
+      const level = this.dashboard.alertLevel || '';
+      return ALERT_LEVEL_LABELS[level] || level || '-';
+    },
+    employeeCountLabel() {
+      const count = this.dashboard.employeeCount;
+      return count == null ? '-' : `${count} 人`;
+    },
+    calculatedEmployeeCountLabel() {
+      const count = this.dashboard.calculatedEmployeeCount;
+      return count == null ? '-' : `${count} 人`;
+    },
+    snapshotCountLabel() {
+      const count = this.dashboard.snapshotCount;
+      return count == null ? '-' : `${count} 条`;
+    },
+    completionRateLabel() {
+      const rate = this.dashboard.calculationCompletionRate;
+      if (rate == null || rate === '') return '-';
+      return `${rate}%`;
+    },
+    openExceptionCount() {
+      const count = this.dashboard.openExceptionCount;
+      if (count != null) return count;
+      return this.exceptionRows.length;
+    },
+    openExceptionCountLabel() {
+      return `${this.openExceptionCount} 条`;
+    },
+    blockExceptionCount() {
+      return this.dashboard.blockExceptionCount == null
+        ? 0
+        : this.dashboard.blockExceptionCount;
+    },
+    warningExceptionCount() {
+      return this.dashboard.warningExceptionCount == null
+        ? 0
+        : this.dashboard.warningExceptionCount;
+    },
+    applicantName() {
+      return (
+        this.fromUser ||
+        this.summary.createUserName ||
+        this.formVariables.createUserName ||
+        '-'
+      );
+    },
+    organizationName() {
+      return this.companyName || this.deptName || '-';
+    },
+    avatarText() {
+      return this.applicantName && this.applicantName !== '-'
+        ? this.applicantName.slice(0, 1)
+        : '薪';
+    },
+    exceptionRows() {
+      return Array.isArray(this.exceptions) ? this.exceptions : [];
+    }
+  },
+  watch: {
+    businessId: {
+      immediate: true,
+      handler() {
+        this.load();
+      }
+    },
+    id() {
+      if (!this.businessId) this.load();
+    }
+  },
+  methods: {
+    riskLevelLabel(level) {
+      return RISK_LEVEL_LABELS[level] || level || '-';
+    },
+    riskTagType(level) {
+      return RISK_TAG_TYPES[level] || 'info';
+    },
+    exceptionStatusLabel(status) {
+      return EXCEPTION_STATUS_LABELS[status] || status || '-';
+    },
+    formatDateTime(value) {
+      const text = String(value || '');
+      if (!text) return '-';
+      return text.replace('T', ' ').slice(0, 19);
+    },
+    async load() {
+      if (!this.businessId && !this.id) return;
+      const key = `${this.businessId}|${this.id}`;
+      if (this.loading || key === this.loadedKey) return;
+      this.loadedKey = key;
+      this.loading = true;
+      try {
+        const detail = await loadPayrollBatchApprovalDetail(
+          this.businessId,
+          this.id
+        );
+        this.dashboard = detail.dashboard || {};
+        this.summary = detail.summary || {};
+        this.exceptions = Array.isArray(detail.exceptions)
+          ? detail.exceptions
+          : [];
+        this.formVariables = detail.formVariables || {};
+        this.errorMessage = detail.errorMessage || '';
+        await this.loadCompanyName();
+        if (!this.hasData && this.errorMessage) {
+          this.$message.warning(this.errorMessage);
+        }
+      } catch (error) {
+        this.dashboard = {};
+        this.summary = {};
+        this.exceptions = [];
+        this.formVariables = {};
+        this.$message.error(error.message || '薪资核算批次信息加载失败');
+      } finally {
+        this.loading = false;
+      }
+    },
+    async loadCompanyName() {
+      const companyId = this.dashboard.companyId || this.formVariables.companyId;
+      if (companyId == null || companyId === '') return;
+      try {
+        const list = await listOrganizations();
+        const records = flattenOrganizations(list);
+        const hit = records.find(
+          (item) => String(item.id) === String(companyId)
+        );
+        this.companyName = hit
+          ? hit.name || hit.orgName || hit.groupName || ''
+          : '';
+      } catch (error) {
+        this.companyName = '';
+      }
+    }
+  }
+};
+</script>
+
+<style
+  lang="scss"
+  scoped
+  src="@/styles/views/hrContractManagement/index.scss"
+></style>
+
+<style lang="scss" scoped>
+.exception-summary {
+  display: flex;
+  flex-wrap: wrap;
+  gap: 24px;
+  margin-bottom: 12px;
+  color: #7b899b;
+  font-size: 13px;
+}
+
+.exception-summary .exception-summary-item b {
+  margin-left: 4px;
+  color: #243955;
+  font-size: 14px;
+}
+
+.exception-summary .exception-summary-item b.is-danger {
+  color: #d55752;
+}
+
+.exception-summary .exception-summary-item b.is-warning {
+  color: #db7a25;
+}
+
+.exception-table {
+  margin-bottom: 8px;
+}
+</style>

+ 114 - 0
src/views/bpm/handleTask/components/payrollBatchApproval/submit.vue

@@ -0,0 +1,114 @@
+<!-- 薪资核算审批操作区:通过 / 驳回 -->
+<template>
+  <el-col :span="16" :offset="6">
+    <el-form label-width="100px" :model="form">
+      <el-form-item label="审批意见">
+        <ApprovalOpinion ref="approvalOpinion" v-model="form.reason" />
+      </el-form-item>
+    </el-form>
+    <div class="audit-buttons">
+      <el-button
+        icon="el-icon-edit-outline"
+        type="success"
+        size="mini"
+        :loading="isLoading"
+        v-click-once
+        @click="$refs.approvalOpinion.validate(1) && handleApprove()"
+        >通过</el-button
+      >
+      <el-button
+        icon="el-icon-circle-close"
+        type="danger"
+        size="mini"
+        :loading="isLoading"
+        v-click-once
+        @click="$refs.approvalOpinion.validate(0) && handleReject()"
+        >驳回</el-button
+      >
+    </div>
+  </el-col>
+</template>
+
+<script>
+import { approveTaskWithVariables, rejectTask } from '@/api/bpm/task';
+
+export default {
+  name: 'PayrollBatchApprovalSubmit',
+  props: {
+    businessId: {
+      default: ''
+    },
+    id: {
+      default: ''
+    },
+    taskId: {
+      default: ''
+    },
+    taskDefinitionKey: {
+      default: ''
+    },
+    businessCode: {
+      default: ''
+    }
+  },
+  data() {
+    return {
+      form: {
+        reason: '同意'
+      },
+      isLoading: false
+    };
+  },
+  methods: {
+    handleApprove() {
+      this.submit(true);
+    },
+    handleReject() {
+      this.submit(false);
+    },
+    async submit(pass) {
+      if (!this.taskId) {
+        this.$message.warning('未获取到审批任务,请刷新待办后重试');
+        return;
+      }
+      if (!this.form.reason || !this.form.reason.trim()) {
+        this.$message.warning('请填写审批意见');
+        return;
+      }
+      this.isLoading = true;
+      try {
+        const payload = { id: this.taskId, reason: this.form.reason.trim() };
+        const res = pass
+          ? await approveTaskWithVariables({
+              ...payload,
+              variables: { pass: true }
+            })
+          : await rejectTask(payload);
+        // 失败提示由 request 拦截器统一弹出,这里不再重复弹窗
+        if (!res || !res.data || Number(res.data.code) !== 0) {
+          return;
+        }
+        // 成功提示由父级 handleAudit 统一弹出,避免重复提示
+        this.$emit('handleAudit', {
+          status: pass ? 1 : 0,
+          title: pass ? '通过' : '驳回'
+        });
+      } catch (error) {
+        // 网络异常由拦截器提示;这里仅兜底非响应体异常
+        if (!error || !error.message) {
+          this.$message.error(pass ? '审批失败' : '驳回失败');
+        }
+      } finally {
+        this.isLoading = false;
+      }
+    }
+  }
+};
+</script>
+
+<style lang="scss" scoped>
+.audit-buttons {
+  padding-left: 100px;
+  margin-bottom: 12px;
+}
+</style>

+ 215 - 43
src/views/bpm/handleTask/components/qualityReportApproval/detailDialog.vue

@@ -40,7 +40,7 @@
         ref="unqualifiedProductRef"
         v-show="activeComp == 'unqualifiedList'"
         @setQualifiedNumber="setQualifiedNumber"
-        :total="basicInfoData.total || form.total"
+        :total="ledgerQuantity || basicInfoData.total || form.total || 0"
         @setLossNumber="setLossNumber"
         :businessType="businessType"
       ></unqualifiedProduct>
@@ -226,7 +226,14 @@
         activeComp: 'main',
         // 质检报告数据
         template: '',
-        fileUrl: ''
+        fileUrl: '',
+        // 不良品处置台账未关联质检工单(手工新增等):此时不加载检测报告,只渲染不合格品处置单
+        isUnqualifiedDisposalNoOrder: false,
+        // 不良品处置台账已关联质检工单:结论/合格数/不合格数全部以工单详情接口为准,
+        // 明细的处置/删除/加行不得再用 poList 反推覆盖(前端不做兜底、不自己算数)
+        disposalHasWorkOrder: false,
+        // 不良品台账的送检总数:明细合格/不合格计算以它为准,不能用质检工单的 total
+        ledgerQuantity: 0
       };
     },
     mounted() {
@@ -234,6 +241,16 @@
     },
     methods: {
       async open() {
+        // 已办详情复用同一组件实例(不像待办每次新建),open 前重置 tab,
+        // 避免上一条记录的「不合格品处置单」tab 残留或多次 unshift 重复
+        this.tabOptions = [
+          { key: 'main', name: '报告' },
+          { key: 'unqualifiedList', name: '不良品台账' }
+        ];
+        this.activeComp = 'main';
+        this.ledgerQuantity = 0;
+        this.disposalHasWorkOrder = false;
+        this.isUnqualifiedDisposalNoOrder = false;
         let api = getDetailById;
 
         let detail = null;
@@ -250,17 +267,51 @@
           api = getCertifiById;
         }
         if (this.businessType?.includes('不良品处置')) {
-          const data = await getById(this.businessId);
-          const enterprisePageData = await enterprisePage({
-            pageNum: 1,
-            size: 200
-          });
-          detail = await api(data.qualityWorkOrderId);
-          detail.data.templateList.forEach((item) => {
-            if (item.inspectImage) {
-              inspectImage.push(...item.inspectImage);
-            }
-          });
+          let data = null;
+          try {
+            data = await getById(this.businessId);
+          } catch (error) {
+            // 台账详情拿不到时明确提示,不留一个全空白页面
+            console.error('不良品台账详情获取失败', this.businessId, error);
+            this.$message.error(
+              `不良品处置单数据获取失败:${error?.message || error}`
+            );
+            return;
+          }
+          let enterprisePageData = null;
+          try {
+            enterprisePageData = await enterprisePage({
+              pageNum: 1,
+              size: 200
+            });
+          } catch (error) {
+            // 只影响单位名称回填,不中断处置单/台账明细渲染
+            console.warn('企业信息获取失败,单位名称留空', error);
+          }
+          // 台账数量 = 本次送检总数,处置明细的合格/不合格计算以它为准
+          this.ledgerQuantity = data.quantity || 0;
+          if (data.qualityWorkOrderId) {
+            // 已关联质检工单:这几个数字的唯一来源就是工单详情接口
+            this.disposalHasWorkOrder = true;
+            detail = await api(data.qualityWorkOrderId);
+            detail.data.templateList?.forEach((item) => {
+              if (item.inspectImage) {
+                inspectImage.push(...item.inspectImage);
+              }
+            });
+          } else {
+            // 台账未关联质检工单(如手工新增):空工单ID不能拼进URL,否则后端 Long 参数会抛
+            // NumberFormatException: For input string: "null";这里用台账数据兜底,
+            // 只渲染不合格品处置单,不加载质检报告
+            this.isUnqualifiedDisposalNoOrder = true;
+            detail = {
+              data: {
+                ...data,
+                id: '',
+                code: data.sourceCode || ''
+              }
+            };
+          }
 
           //  feedbackDepartment: '',
           //         feedbackPerson: '',
@@ -282,13 +333,37 @@
           });
 
           this.activeComp = 'unqualifiedHtml';
-          const depData = await getGroupById(this.deptId);
-          console.log(depData, 'depData');
+          // 部门ID来源:待办/审批页由流程上下文传入(this.deptId);
+          // 已办查看页父级只传 businessId,此时只能用台账接口返回的 deptId。
+          // 两者都没有时不要发请求——/main/group/getGroupById/undefined 会 404 抛错,
+          // 一旦抛出整个 open() 中断,处置单与台账明细都渲染不出来(表现为整页空白)
+          const deptId = this.deptId || data.deptId || '';
+          let deptHeadPerson = '';
+          if (deptId) {
+            try {
+              const depData = await getGroupById(deptId);
+              deptHeadPerson = depData?.data?.managerFirst?.[0]?.name || '';
+            } catch (error) {
+              // 部门信息取不到不影响处置单回填:部门负责人字段留空并提示
+              console.warn('部门信息获取失败,部门负责人留空', deptId, error);
+            }
+          }
           this.$nextTick(() => {
-            if (data.contentText) {
-              data.contentText = JSON.parse(data.contentText);
+            // contentText 是 JSON 字符串,空值/脏数据直接 JSON.parse 会抛错导致整页不回填
+            if (typeof data.contentText === 'string' && data.contentText) {
+              try {
+                data.contentText = JSON.parse(data.contentText);
+              } catch (error) {
+                console.error('台账 contentText 解析失败,处置单改用台账字段回填', error);
+                data.contentText = null;
+              }
+            }
+            const htmlRef = this.$refs.unqualifiedHtmlRef;
+            if (!htmlRef) {
+              console.error('不合格品处置单组件未渲染,数据无法回填');
+              return;
             }
-            this.$refs.unqualifiedHtmlRef.init(
+            htmlRef.init(
               data.contentText?.basicInfoData
                 ? data.contentText.basicInfoData
                 : {
@@ -304,7 +379,7 @@
                     feedbackPerson: this.fromUser,
                     feedbackDate: this.createTime,
                     deptHeadDate: this.createTime,
-                    deptHeadPerson: depData?.data?.managerFirst[0]?.name,
+                    deptHeadPerson,
                     sampleMeasureUnit: data.measureUnit,
                     vehiclePhotoUrl: vehiclePhotoUrl?.map(
                       (item) => item.storagePath[0]?.storePath
@@ -328,9 +403,13 @@
 
         if (detail.data.reportTemplateJson?.template) {
           this.template = detail.data.reportTemplateJson.template;
-          console.log(detail.data, 'detail.data');
-          this.inspectionItems = detail.data.reportTemplateJson.inspectionItems;
-          this.basicInfoData = detail.data.reportTemplateJson?.basicInfoData;
+          this.inspectionItems =
+            detail.data.reportTemplateJson.inspectionItems || [];
+          // 报告模板里的 basicInfoData 会整体替换页面绑定的对象,
+          // 因此结论/合格数在下面(模板赋值之后)再统一回填
+          if (detail.data.reportTemplateJson.basicInfoData) {
+            this.basicInfoData = detail.data.reportTemplateJson.basicInfoData;
+          }
           this.$nextTick(() => {
             this.$refs.templateRef.init(
               this.basicInfoData,
@@ -345,8 +424,54 @@
           // this.loadReportData();
           // this.loadListDetail();
 
-          let url = await getJmPrintViewUrl('qmsqualityinspectionprint');
-          this.fileUrl = `${url}?token=${getToken()}&id=${this.businessId}`;
+          // 台账未关联质检工单时没有检测报告可打印,跳过,避免用台账ID请求报告页
+          if (!this.isUnqualifiedDisposalNoOrder) {
+            try {
+              const url = await getJmPrintViewUrl('qmsqualityinspectionprint');
+              this.fileUrl = `${url}?token=${getToken()}&id=${this.businessId}`;
+            } catch (error) {
+              // 只影响报告页预览,不影响处置单与台账明细
+              console.error('检测报告打印地址获取失败,报告预览留空', error);
+            }
+          }
+        }
+
+        // 不良品处置:结论 / 合格数 / 不合格数唯一来源是「质检工单详情」,
+        // 台账 getById 从不返回这几个字段。必须放在报告模板覆盖 basicInfoData 之后,
+        // 否则会被模板里的 undefined 冲掉(表现就是全部显示 0)。
+        // 台账没有关联质检工单(手工新增)时没有数据来源,保持空即可,不拿明细反推。
+        if (this.businessType?.includes('不良品处置')) {
+          const src = detail.data || {};
+          const hasQualified =
+            src.qualifiedNumber !== undefined && src.qualifiedNumber !== null;
+          const hasNoQualified =
+            src.noQualifiedNumber !== undefined &&
+            src.noQualifiedNumber !== null;
+          this.$set(
+            this.basicInfoData,
+            'qualityResults',
+            src.qualityResults ?? ''
+          );
+          this.$set(
+            this.basicInfoData,
+            'qualifiedNumber',
+            hasQualified ? src.qualifiedNumber : ''
+          );
+          this.$set(
+            this.basicInfoData,
+            'noQualifiedNumber',
+            hasNoQualified ? src.noQualifiedNumber : ''
+          );
+          if (!hasQualified && !hasNoQualified) {
+            // 只在控制台留痕,页面不打扰用户
+            console.warn(
+              '[不良品处置] 合格数/不合格数无数据来源:台账未关联质检工单,或工单未返回 qualifiedNumber / noQualifiedNumber',
+              {
+                businessId: this.businessId,
+                qualityWorkOrderId: src.qualityWorkOrderId
+              }
+            );
+          }
         }
       },
       setLossNumber({
@@ -373,22 +498,32 @@
         );
       },
       async initUnqualifiedProduct() {
-        const data = await getList({
-          sourceCode: this.form.code
-        });
-        if (data.list[0]) {
-          this.unqualifiedProducts = data.list[0];
+        let unqualified = null;
+        if (this.businessType?.includes('不良品处置')) {
+          // 处置审批的台账主键就是审批业务ID,直接用它加载明细;
+          // 不走 sourceCode 查询,避免台账未关联质检工单(sourceCode 为空)时查不到台账、明细丢失
+          unqualified = { id: this.businessId };
+        } else {
+          const data = await getList({
+            sourceCode: this.form.code
+          });
+          unqualified = data.list?.[0];
+        }
+        if (unqualified) {
+          this.unqualifiedProducts = unqualified;
         }
 
         this.$nextTick(() => {
           this.$refs.unqualifiedProductRef.init({
-            id: this.unqualifiedProducts?.id,
+            id: unqualified?.id,
             qualityType:
               this.basicInfoData.qualityType || this.form.qualityType,
             workOrderCode: this.basicInfoData.code || this.form.code,
-            qualityWorkerId: this.basicInfoData.qualityWorkerId || this.form.id,
+            // 兜底场景 form.id 已被置空,避免把台账ID误当作质检工单ID写入明细
+            qualityWorkerId:
+              this.basicInfoData.qualityWorkerId || this.form.id || null,
             workOrderId:
-              this.basicInfoData.workOrderId || this.form.workOrderId,
+              this.basicInfoData.workOrderId || this.form.workOrderId || null,
             qualityResults:
               this.basicInfoData.qualityResults || this.form.qualityResults
           });
@@ -396,20 +531,57 @@
       },
 
       setQualifiedNumber(data) {
-        this.basicInfoData.qualifiedNumber = data.qualifiedNumber;
-        this.basicInfoData.noQualifiedNumber = data.noQualifiedNumber;
-        if (!data.noQualifiedNumber) {
-          if (data.isQualifiedNumber) {
-            this.basicInfoData.qualityResults = 1;
-          } else {
-            this.basicInfoData.qualityResults = 4;
-          }
+        // 不良品处置且台账已关联质检工单:结论 / 合格数 / 不合格数 唯一来源是工单详情接口,
+        // 明细的处置 / 删除 / 加行只影响明细本身,绝不能拿 poList 反推去覆盖工单返回值。
+        // 例:台账只有 1 件待处置、工单却是 90 件检验,按台账总数反推会把 89 冲成 0。
+        if (this.businessType?.includes('不良品处置') && this.disposalHasWorkOrder) {
+          return;
         }
-        if (!data.qualifiedNumber) {
-          this.basicInfoData.qualityResults = 2;
+        // 合格数 / 不合格数一律以台账接口的 qualifiedNumber / noQualifiedNumber 为准;
+        // 只有这两类数在页面上被用户改动(处置/删除/切换结论)时才会重新计算后回传
+        if (data.qualifiedNumber !== undefined && data.qualifiedNumber !== null) {
+          this.$set(
+            this.basicInfoData,
+            'qualifiedNumber',
+            data.qualifiedNumber
+          );
+        }
+        if (
+          data.noQualifiedNumber !== undefined &&
+          data.noQualifiedNumber !== null
+        ) {
+          this.$set(
+            this.basicInfoData,
+            'noQualifiedNumber',
+            data.noQualifiedNumber
+          );
         }
-        if (data.qualifiedNumber && data.noQualifiedNumber) {
+        // 初次加载只回显数量,不自动改写台账已保存的「结论」
+        if (data.fromApi) {
+          return;
+        }
+        // 用户手动选结论:结论以用户选择为准,只回填数量
+        if (data.fromSelect) {
+          return;
+        }
+        // 数量还没算出来(台账总数为 0 等)时不要改写结论,否则会把用户的选择冲掉
+        const qualified = Number(data.qualifiedNumber);
+        const noQualified = Number(data.noQualifiedNumber);
+        if (
+          !Number.isFinite(qualified) ||
+          !Number.isFinite(noQualified) ||
+          qualified + noQualified <= 0
+        ) {
+          return;
+        }
+        if (qualified > 0 && noQualified > 0) {
           this.basicInfoData.qualityResults = 3;
+        } else if (qualified > 0) {
+          // 明细全部按「让步接收」处置时结论应为整单让步接收
+          this.basicInfoData.qualityResults =
+            data.isQualifiedNumber === false ? 4 : 1;
+        } else {
+          this.basicInfoData.qualityResults = 2;
         }
       },
       async getTableValue() {

+ 119 - 26
src/views/bpm/handleTask/components/qualityReportApproval/unqualifiedProduct.vue

@@ -395,6 +395,7 @@
     queryQualitySamplContent,
     queryQualityInventory,
     getById,
+    refluxTask,
     getBadnameList,
     getBadtypeList,
     getReasontypeList
@@ -449,6 +450,9 @@
           ]
         },
         disposeType: '',
+        // 批量处置标识:一次处置弹窗「确定」对应一个标识,同批明细共享,
+        // 审批通过时按「处置类型 + 该标识」合并生成一张处置入库单
+        disposeBatchNo: '',
         disposeForm: {
           disposeType: '',
           sampleCondition: '',
@@ -459,7 +463,8 @@
           depotId: '',
           depotName: '',
           taskId: '',
-          keepSampleQuantity: ''
+          keepSampleQuantity: '',
+          disposeBatchNo: ''
         },
         loading: false,
         selection: [],
@@ -580,7 +585,9 @@
             type: 'selection',
             columnKey: 'selection',
             reserveSelection: true,
-            align: 'center'
+            align: 'center',
+            // 已处置的行只做展示,不允许再被勾选去「批量处置 / 批量删除」
+            selectable: (row) => row.disposalStatus != 2
           },
           {
             columnKey: 'index',
@@ -727,7 +734,8 @@
             showOverflowTooltip: true,
             filters: [
               { value: 0, text: '待处置' },
-              { value: 1, text: '处置中' }
+              { value: 1, text: '处置中' },
+              { value: 2, text: '处置完成' }
             ],
             filterMethod: this.disposalStatusFilter,
             formatter: (row, column, cellValue) => {
@@ -765,16 +773,16 @@
         return { 0: '待处置', 1: '处置中', 2: '处置完成' };
       },
       // 兜底去重,防止 uniqueKey 极端情况下仍重复
+      // 注意:不再过滤掉「已处置」的行(disposalStatus == 2),
+      // 台账明细要展示全部样品(含已处置),否则审批人看到的条数和实际不合格数对不上
       displayPoList() {
         const seen = new Set();
-        return this.poList
-          .filter((item) => item.disposalStatus != 2)
-          .filter((item) => {
-            const key = item.uniqueKey || item.id;
-            if (!key || seen.has(key)) return false;
-            seen.add(key);
-            return true;
-          });
+        return this.poList.filter((item) => {
+          const key = item.uniqueKey || item.id;
+          if (!key || seen.has(key)) return false;
+          seen.add(key);
+          return true;
+        });
       }
     },
     created() {
@@ -836,7 +844,9 @@
           await this.datasource();
         }
       },
-      setQualifiedNumber() {
+      // fromSelect:结论是用户手动选的,父组件只回填数量、不得按数量反推结论,
+      // 否则「整单合格 / 整单让步接收 / 部分合格」会被下面的推导逻辑立刻改回「整单不合格」
+      setQualifiedNumber(fromSelect = false) {
         let isQualifiedNumber = true;
         let noQualifiedNumber = this.poList
           .filter((item) => ![5, 6, 7].includes(item.disposeType))
@@ -853,9 +863,19 @@
         this.$emit('setQualifiedNumber', {
           noQualifiedNumber,
           qualifiedNumber: this.availableTotal - noQualifiedNumber,
-          isQualifiedNumber
+          isQualifiedNumber,
+          fromSelect
         });
       },
+      // 切换结论时重建明细的来源:质检工单场景用「待处置库存」;
+      // 手工新增台账没有工单库存(qualityWorkerId 为空),用台账自身未处置的行,
+      // 否则选「整单不合格 / 整单让步接收」会把明细清空
+      baseDisposeList() {
+        if (this.qualityWorkerId) {
+          return this.inventoryList;
+        }
+        return this.oldList.filter((item) => item.disposalStatus != 2);
+      },
       selectResult(qualityResults) {
         if (qualityResults == 1) {
           this.poList = JSON.parse(JSON.stringify(this.oldList));
@@ -870,7 +890,7 @@
         }
         if (qualityResults == 4) {
           this.poList = [
-            ...JSON.parse(JSON.stringify(this.inventoryList)),
+            ...JSON.parse(JSON.stringify(this.baseDisposeList())),
             ...JSON.parse(
               JSON.stringify(
                 this.oldList.filter((item) => item.disposalStatus == 2)
@@ -888,7 +908,7 @@
         }
         if (qualityResults == 2) {
           this.poList = [
-            ...JSON.parse(JSON.stringify(this.inventoryList)),
+            ...JSON.parse(JSON.stringify(this.baseDisposeList())),
             ...JSON.parse(
               JSON.stringify(
                 this.oldList.filter((item) => item.disposalStatus == 2)
@@ -907,7 +927,8 @@
           });
         }
         this.qualityResults = qualityResults;
-        this.setQualifiedNumber();
+        // 用户手动选结论:只让父组件刷新数量,结论保持用户选的值
+        this.setQualifiedNumber(true);
       },
       disposeTypeChange() {
         if (this.disposeForm.disposeType == 6) {
@@ -976,21 +997,68 @@
       // /* 表格数据源 */
       async datasource() {
         const arr = await getById(this.id);
-        this.oldList = JSON.parse(JSON.stringify(arr.poList));
-        this.poList = arr.poList.map((item) => {
+        this.oldList = JSON.parse(JSON.stringify(arr.poList || []));
+        this.poList = (arr.poList || []).map((item) => {
           this.ensureUniqueKey(item);
           return item;
         });
-        this.setQualifiedNumber();
+
+        // 回流工序:处置方式选「返工 / 返修」时要选工序,和台账列表页取的是同一份数据。
+        // 台账记录里的工单编码就是 sourceCode,拿它调 /mes/workorder/refluxTask。
+        if (arr.sourceCode) {
+          this.workOrderCode = arr.sourceCode;
+          await this.getRefluxTask();
+        } else {
+          console.warn(
+            '[不良品台账] 台账记录未返回工单编码(sourceCode),处置方式选「返工 / 返修」时无法选择回流工序',
+            arr
+          );
+        }
+        // 合格数 / 不合格数的数据源是「质检工单详情」接口(父组件 detailDialog 用 getDetailById 回填);
+        // 台账 getById 从不返回这两个字段(内外网实测一致),
+        // 用 poList 反推会把「让步接收(5)/留样(6)/消耗(7)」这些处置行排除掉,数也对不上。
+        // 其他业务类型(检测报告单等)保持原有计算逻辑不变。
+        const hasApiNumber =
+          arr.qualifiedNumber !== undefined &&
+          arr.qualifiedNumber !== null &&
+          arr.noQualifiedNumber !== undefined &&
+          arr.noQualifiedNumber !== null;
+        if (this.businessType?.includes('不良品处置')) {
+          if (hasApiNumber) {
+            this.$emit('setQualifiedNumber', {
+              qualifiedNumber: arr.qualifiedNumber,
+              noQualifiedNumber: arr.noQualifiedNumber,
+              // 标记来自接口:父组件只更新数量,不改写台账已保存的「结论」
+              fromApi: true
+            });
+          } else {
+            // 不做兜底:台账接口没给就保持父组件用工单数据回填的值,别拿 poList 反推
+            console.warn(
+              '[不良品台账] 台账 getById 未返回 qualifiedNumber / noQualifiedNumber,合格数/不合格数以质检工单详情回填为准',
+              arr.unqualifiedProductsCode
+            );
+          }
+        } else {
+          this.setQualifiedNumber();
+        }
       },
 
-      //   async getRefluxTask() {
-      //     await refluxTask({
-      //       workOrderCode: this.workOrderCode
-      //     }).then((res) => {
-      //       this.refluxTaskList = res;
-      //     });
-      //   },
+      /**
+       * 回流工序:处置方式选「返工 / 返修」时,工序下拉的数据源
+       * 与不合格品台账列表页一致,用工单编码查询
+       */
+      async getRefluxTask() {
+        if (!this.workOrderCode) return;
+        try {
+          const res = await refluxTask({
+            workOrderCode: this.workOrderCode
+          });
+          this.refluxTaskList = res || [];
+        } catch (error) {
+          this.refluxTaskList = [];
+          this.$message.error(error.message || '回流工序加载失败');
+        }
+      },
 
       remove() {
         let ids = this.selection.map((item) => item.id);
@@ -1003,6 +1071,27 @@
         this.disposeType = '';
         this.all = false;
         this.formData.disposalStatus = '';
+        this.disposeBatchNo = '';
+        this.disposeForm.disposeBatchNo = '';
+      },
+      /**
+       * 生成处置批次标识
+       * 规则:DB + yyyyMMddHHmmss + 4 位随机数,例如 DB202611101530251234
+       * 一次处置弹窗「确定」生成一个,批量处置写入全部选中行,单条处置只写当前行;
+       * 同一条明细被重新处置时标识覆盖为最新一次,保证以最终处置结果为准。
+       */
+      buildDisposeBatchNo() {
+        const d = new Date();
+        const pad = (n) => String(n).padStart(2, '0');
+        const ts =
+          d.getFullYear() +
+          pad(d.getMonth() + 1) +
+          pad(d.getDate()) +
+          pad(d.getHours()) +
+          pad(d.getMinutes()) +
+          pad(d.getSeconds());
+        const rand = String(Math.floor(Math.random() * 10000)).padStart(4, '0');
+        return `DB${ts}${rand}`;
       },
       // // 处置
       disposeFn(type, row) {
@@ -1013,6 +1102,10 @@
           this.current = row;
         }
         this.formData = { ...row };
+        // 每次打开处置弹窗都生成新的批次标识:批量处置时全部选中行共享同一个标识,
+        // 单条处置时该行使用自己的标识,审批通过后按标识把同批明细合并成一张处置入库单
+        this.disposeBatchNo = this.buildDisposeBatchNo();
+        this.disposeForm.disposeBatchNo = this.disposeBatchNo;
         this.dialogVisible = true;
       },
 

+ 109 - 6
src/views/bpm/handleTask/components/quotation/addDialog.vue

@@ -259,7 +259,31 @@
         :isDeliveryDeadline="false"
         :isGuaranteePeriod="false"
         :isDiscount="false"
-      ></inventoryTable>
+        :is-produce-delivery-deadline="isProduceDeliveryDeadlineRequired"
+        :rowActionWidth="270"
+      >
+        <!-- 行内操作:BOM导入 / BOM详情(仅报价单审批传,其它单据不受影响) -->
+        <template v-slot:rowActions="{ row, index }">
+          <el-link
+            type="primary"
+            :underline="false"
+            icon="el-icon-upload2"
+            @click.native="openBomImport(row, index)"
+          >
+            BOM导入
+          </el-link>
+          <el-link
+            type="primary"
+            :underline="false"
+            icon="el-icon-document"
+            @click.native="openBomDetail(row)"
+          >
+            BOM详情<span v-if="bomCount(row)">({{ bomCount(row) }})</span>
+          </el-link>
+        </template>
+      </inventoryTable>
+      <bomImportDialog ref="bomImportDialogRef" @success="handleBomImported"></bomImportDialog>
+      <bomDetailDialog ref="bomDetailDialogRef"></bomDetailDialog>
       <!-- <el-row style="margin-top: 20px">
         <el-col :span="6">
           <el-form-item prop="taxRate" label="税率">
@@ -338,11 +362,15 @@
     getcontactlink,
     getDetail
   } from '@/api/bpm/components/saleManage/quotation';
+  import { contactDetail } from '@/api/bpm/components/saleManage/contact';
   import {
     getDetail as getOpportunityDetail
   } from '@/api/bpm/components/saleManage/businessOpportunity';
   import { copyObj } from '@/utils/util';
   import { getFile } from '@/api/system/file';
+  import bomImportDialog from './bomImportDialog.vue';
+  import bomDetailDialog from './bomDetailDialog.vue';
+  import { buildRowKey } from './bom';
   // import fileMain from "@/components/addDoc/index.vue";
 
   export default {
@@ -352,11 +380,32 @@
       fileUpload,
       inventoryTable,
       parentList,
-      headList
+      headList,
+      bomImportDialog,
+      bomDetailDialog
     },
     props: {
       businessId: {
         default: ''
+      },
+      // 当前审批节点(发起时为空),保留透传,便于后续按节点控制字段
+      taskDefinitionKey: {
+        default: ''
+      }
+    },
+    computed: {
+      /**
+       * 「生产交付交期」是否必填:
+       * - 发起报价单(没有审批节点,taskDefinitionKey 为空)→ 不必填
+       * - 生产主管指派节点只是选人往下传,不排产,不校验
+       * - 其余审批节点(技术员、销售员补充等真正排产/确认交期的节点)→ 必填
+       * 驳回/转办不走回写,不会触发这条校验
+       */
+      isProduceDeliveryDeadlineRequired() {
+        return (
+          !!this.taskDefinitionKey &&
+          this.taskDefinitionKey !== 'productionSupervisorApprove1'
+        );
       }
     },
     data() {
@@ -477,6 +526,54 @@
       this.getDetailData(this.businessId);
     },
     methods: {
+      /* ===== BOM导入 / BOM详情(销售员补充、技术员等可编辑节点) ===== */
+      bomCount(row) {
+        return row && Array.isArray(row.bomList) ? row.bomList.length : 0;
+      },
+      // 物品清单行稳定键:已落库行用明细行id,新增行生成临时键(后端按 row_key 记录,仅排查用)
+      bomRowKey(row, index) {
+        if (!row.rowKey) {
+          this.$set(row, 'rowKey', buildRowKey(row, index));
+        }
+        return row.rowKey;
+      },
+      openBomImport(row, index) {
+        this.$refs.bomImportDialogRef.open({
+          row: row,
+          index: index,
+          quoteId: this.form.id,
+          rowKey: this.bomRowKey(row, index)
+        });
+      },
+      openBomDetail(row) {
+        this.$refs.bomDetailDialogRef.open({ row: row });
+      },
+      // 导入成功:BOM 挂到清单行随报价单一起提交,累计价格回填到该行单价并重算总计
+      handleBomImported(payload) {
+        const row = (payload && payload.row) || {};
+        const price = (payload && payload.price) || {};
+        const bomList = (payload && payload.bomList) || [];
+        this.$set(row, 'bomList', bomList);
+        this.$set(row, 'singlePrice', price.singlePrice);
+        this.$set(row, 'notaxSinglePrice', price.notaxSinglePrice);
+        if (price.taxRate !== null && price.taxRate !== undefined) {
+          this.$set(row, 'taxRate', price.taxRate);
+        }
+        const count = Number(row.totalCount) || 0;
+        const weight = Number(row.singleWeight) || 0;
+        // 与清单表口径一致:按数量计价 单价×数量;按重量计价 单价×数量×单重
+        const rowAmount =
+          Number(row.pricingWay) === 2
+            ? price.singlePrice * count * weight
+            : price.singlePrice * count;
+        this.$set(row, 'totalPrice', Number(rowAmount.toFixed(4)));
+        this.$nextTick(() => {
+          const table = this.$refs.inventoryTable;
+          if (table && typeof table.changeAll === 'function') {
+            table.changeAll();
+          }
+        });
+      },
       opportunityTypeChange() {
         if (this.form.opportunityType === 0) {
           this.form.opportunityId = '';
@@ -587,21 +684,27 @@
           contactLinkId: '',
           contactLinkName: '',
           contactEmail: '',
-          contactTel: '',
-          customerMark: base.serialNo
-
+          contactTel: ''
         });
         this.getLinkInfo(obj.id);
         this.getBusinessList(obj.name);
+        this.getCustomerMark(obj.id);
         this.$nextTick(() => {
           if(this.form.opportunityType==1){
             this.$refs.inventoryTable.putTableValue([])
             this.form.opportunityId=''
           }
-          this.$refs.inventoryTable.setCustomerMark(base.serialNo);
         });
       },
 
+      // 选完客户后取客户代号(base.serialNo),填充到明细行的 customerMark
+      async getCustomerMark(contactId) {
+        const { base } = await contactDetail(contactId);
+        this.$set(this.form, 'customerMark', base.serialNo);
+        this.$refs.inventoryTable &&
+          this.$refs.inventoryTable.setCustomerMark(base.serialNo);
+      },
+
       handParent() {
         let item = {
           id: this.form.contactId

+ 362 - 0
src/views/bpm/handleTask/components/quotation/bom.js

@@ -0,0 +1,362 @@
+/**
+ * 报价单「BOM导入」纯逻辑:模板列定义、模版解析、取价规则、价格计算。
+ * 不依赖组件上下文(无 $/axios/window),便于单测与复用。
+ *
+ * 取价规则(需求原文):
+ *  1. 按物料编码(物品编码)调用 eom/goods/page 查出该物品的价格;
+ *  2. 价格查不到按 0;
+ *  3. 多个价格取接口返回的第一条;没有上架(t_eom_goods.goods_status != 1)
+ *     或该商品没有设置任何价格,一律按 0。
+ */
+
+/* 模版文件(放在 public/importTemplate 下,与项目其它导入模版同目录) */
+export const BOM_TEMPLATE_NAME = 'BOM导入模板';
+export const BOM_TEMPLATE_URL =
+  (process.env.BASE_URL || '/') + 'importTemplate/BOM导入模板.xls';
+
+/* 价格与金额统一保留 4 位小数,与后端 decimal(15,4)/decimal(18,4) 对齐 */
+export const BOM_PRICE_SCALE = 4;
+
+/*
+ * 与「BOM导入模板.xls」第 2 行表头一一对应;第 1 行是说明行,解析时自动跳过。
+ * 文字列用 minWidth(宽度不足时由表格均分剩余空间,避免右侧留白),
+ * 数字/标签列用固定 width;全部对齐方式与系统其它表格一致(居中 + 超出省略提示)。
+ */
+const textColumn = (prop, label, minWidth) => ({
+  prop: prop,
+  label: label,
+  minWidth: minWidth,
+  align: 'center',
+  showOverflowTooltip: true
+});
+
+const numberColumn = (prop, label, width) => ({
+  prop: prop,
+  label: label,
+  width: width,
+  align: 'center',
+  showOverflowTooltip: true
+});
+
+export const BOM_TEMPLATE_COLUMNS = [
+  textColumn('bomCategory', '物料分类', 180),
+  numberColumn('bomLevel', '级次', 70),
+  textColumn('parentMaterialCode', '父级物料编码', 140),
+  textColumn('materialCode', '物料编码', 150),
+  numberColumn('dosage', '用量', 80),
+  textColumn('name', '名称', 160),
+  textColumn('specification', '规格', 160),
+  textColumn('supplierInfo', '供应商信息', 130)
+];
+
+/* 详情弹窗展示列 = 模版列 + 价格列 */
+export const BOM_DETAIL_COLUMNS = BOM_TEMPLATE_COLUMNS.concat([
+  numberColumn('quantity', '数量', 90),
+  textColumn('taxPrice', '含税单价', 110),
+  numberColumn('taxRate', '税率(%)', 90),
+  textColumn('notaxPrice', '不含税单价', 120),
+  textColumn('totalPrice', '总价', 110)
+]);
+
+/* 模版必填列(带 * 的列),供应商信息非必填 */
+const REQUIRED_PROPS = [
+  'bomCategory',
+  'bomLevel',
+  'parentMaterialCode',
+  'materialCode',
+  'dosage',
+  'name',
+  'specification'
+];
+
+/*
+ * 模版自带的示例 BOM(示例树:产品-工程机械行业-顺新产品 / 物料-顺新物料)。
+ * 只是填写示例,不属于真实业务数据,导入时必须过滤掉。
+ * 判定要求「分类与编码同时命中」,避免误伤真实数据里同编码的物料。
+ */
+export const BOM_TEMPLATE_DEMO_CATEGORIES = ['产品-工程机械行业-顺新产品', '物料-顺新物料'];
+export const BOM_TEMPLATE_DEMO_CODES = [
+  'TQWV5-00-00',
+  'PZM-1500-00',
+  'PZM-1500-01',
+  'PZM-1500-01-03',
+  'PZM-1500-01-01',
+  'PZM-1500-01-04',
+  'PZM-1500-01-05'
+];
+
+/** 是否为模版自带的示例行 */
+export function isTemplateDemoLine(line) {
+  if (!line) return false;
+  const category = normalizeCell(line.bomCategory);
+  const code = normalizeCell(line.materialCode);
+  if (BOM_TEMPLATE_DEMO_CODES.indexOf(code) < 0) return false;
+  return BOM_TEMPLATE_DEMO_CATEGORIES.some(
+    (demoCategory) => category === demoCategory || category.indexOf(demoCategory + '-') === 0
+  );
+}
+
+/* 空价格:查不到商品 / 商品未上架 / 商品无价格,一律按 0 参与计算 */
+export const EMPTY_PRICE = {
+  goodsId: null,
+  goodsPriceId: null,
+  priceType: '',
+  taxPrice: 0,
+  taxRate: null,
+  notaxPrice: 0,
+  shelfStatus: 0
+};
+
+export function toNumber(value, fallback) {
+  if (value === null || value === undefined || value === '') {
+    return fallback === undefined ? 0 : fallback;
+  }
+  const num = Number(value);
+  return Number.isFinite(num) ? num : fallback === undefined ? 0 : fallback;
+}
+
+export function round(value, digits) {
+  const scale = digits === undefined ? BOM_PRICE_SCALE : digits;
+  const num = toNumber(value, 0);
+  const factor = Math.pow(10, scale);
+  return Math.round((num + Number.EPSILON) * factor) / factor;
+}
+
+function normalizeCell(cell) {
+  return String(cell === null || cell === undefined ? '' : cell).trim();
+}
+
+/**
+ * 解析模版二维数组。
+ * @param {Array<Array>} matrix xlsx 读出的二维数组(header:1)
+ * @returns {{lines: Array, errors: Array<string>}}
+ */
+export function parseBomRows(matrix) {
+  const rows = Array.isArray(matrix) ? matrix : [];
+  const headerIndex = rows.findIndex((row) =>
+    (Array.isArray(row) ? row : []).some((cell) => normalizeCell(cell).indexOf('物料编码') > -1)
+  );
+  if (headerIndex < 0) {
+    return { lines: [], errors: ['未识别到表头行,请使用标准「BOM导入模板」'] };
+  }
+  const header = (Array.isArray(rows[headerIndex]) ? rows[headerIndex] : []).map((cell) =>
+    normalizeCell(cell).replace(/^\*+/, '')
+  );
+  const columns = BOM_TEMPLATE_COLUMNS.map((column) => ({
+    prop: column.prop,
+    label: column.label,
+    index: header.indexOf(column.label)
+  }));
+  const missing = columns
+    .filter((column) => REQUIRED_PROPS.indexOf(column.prop) > -1 && column.index < 0)
+    .map((column) => column.label);
+  if (missing.length) {
+    return { lines: [], errors: ['模版缺少必要列:' + missing.join('、')] };
+  }
+
+  const lines = [];
+  const errors = [];
+  const skipped = [];
+  for (let i = headerIndex + 1; i < rows.length; i++) {
+    const row = Array.isArray(rows[i]) ? rows[i] : [];
+    const rowNo = i + 1;
+    if (row.every((cell) => !normalizeCell(cell))) {
+      continue;
+    }
+    const cellOf = (prop) => {
+      const column = columns.find((item) => item.prop === prop);
+      return column && column.index > -1 ? row[column.index] : '';
+    };
+    const materialCode = normalizeCell(cellOf('materialCode'));
+    if (!materialCode) {
+      // 有内容却缺物料编码:属填写问题,明确指出是哪一行
+      errors.push('第' + rowNo + '行:物料编码不能为空');
+      continue;
+    }
+    const line = {
+      sort: lines.length + 1,
+      bomCategory: normalizeCell(cellOf('bomCategory')),
+      bomLevel: toNumber(cellOf('bomLevel'), 1),
+      parentMaterialCode: normalizeCell(cellOf('parentMaterialCode')),
+      materialCode: materialCode,
+      dosage: toNumber(cellOf('dosage'), 0),
+      name: normalizeCell(cellOf('name')),
+      specification: normalizeCell(cellOf('specification')),
+      supplierInfo: normalizeCell(cellOf('supplierInfo'))
+    };
+    if (isTemplateDemoLine(line)) {
+      // 模版自带的填写示例(如 产品-工程机械行业-顺新产品 / TQWV5-00-00 多功能提取罐)
+      // 静默丢弃,不打扰用户
+      skipped.push({ rowNo: rowNo, reason: '模版示例行' });
+      continue;
+    }
+    if (!line.name) {
+      errors.push('第' + rowNo + '行:名称不能为空');
+      continue;
+    }
+    lines.push(line);
+  }
+  if (!lines.length && !errors.length) {
+    errors.push('模版中没有可导入的数据行');
+  }
+  return { lines: lines, errors: errors, skipped: skipped };
+}
+
+/* 物料编码与商品编码 / 物品编码(categoryInfo.code)任一相等即命中 */
+function goodsMatchesCode(goods, code) {
+  if (!goods) return false;
+  if (normalizeCell(goods.goodsCode) === code) return true;
+  const categoryInfo = goods.categoryInfo;
+  return !!categoryInfo && normalizeCell(categoryInfo.code) === code;
+}
+
+/**
+ * 用一个物品编码取出单价。
+ * 候选 = 命中该编码且已上架(goodsStatus === 1)的商品下的全部价格;
+ * 多个价格按接口返回顺序取第一条(需求:有多个价格就取第一条)。
+ * 未命中 / 未上架 / 未设置价格 -> EMPTY_PRICE(各项 0),流程不报错。
+ */
+export function pickGoodsPrice(goodsList, materialCode) {
+  const code = normalizeCell(materialCode);
+  if (!code || !Array.isArray(goodsList) || !goodsList.length) {
+    return Object.assign({}, EMPTY_PRICE);
+  }
+  const matched = goodsList.filter((goods) => goodsMatchesCode(goods, code));
+  if (!matched.length) return Object.assign({}, EMPTY_PRICE);
+  const onShelf = matched.filter((goods) => Number(goods.goodsStatus) === 1);
+  if (!onShelf.length) return Object.assign({}, EMPTY_PRICE);
+
+  const candidates = [];
+  onShelf.forEach((goods) => {
+    (goods.goodsPriceList || []).forEach((price) => {
+      candidates.push({ goods: goods, price: price });
+    });
+  });
+  if (!candidates.length) return Object.assign({}, EMPTY_PRICE);
+
+  const picked = candidates[0];
+  const taxPrice = round(toNumber(picked.price.unitPrice, 0));
+  const taxRate =
+    picked.price.taxRate === null || picked.price.taxRate === undefined
+      ? null
+      : round(picked.price.taxRate, 2);
+  const notaxFromPrice =
+    picked.price.excludeTaxPrice === null || picked.price.excludeTaxPrice === undefined
+      ? null
+      : toNumber(picked.price.excludeTaxPrice, 0);
+  return {
+    goodsId: picked.goods.id === undefined ? null : picked.goods.id,
+    goodsPriceId: picked.price.id === undefined ? null : picked.price.id,
+    priceType: picked.price.priceType || '',
+    taxPrice: taxPrice,
+    taxRate: taxRate,
+    notaxPrice: round(
+      notaxFromPrice === null ? taxPrice / (1 + toNumber(taxRate, 0) / 100) : notaxFromPrice
+    ),
+    shelfStatus: 1
+  };
+}
+
+/**
+ * 用量 -> 数量:数量 = 用量 × 物品清单行数量(明细数量为空或 0 时按 1 计)。
+ */
+export function calcBomQuantity(dosage, lineCount) {
+  const count = toNumber(lineCount, 0);
+  const base = count > 0 ? count : 1;
+  return round(toNumber(dosage, 0) * base);
+}
+
+/**
+ * 生成入库用的 BOM 明细行(模版字段 + 价格字段 + 关联字段)。
+ * @param {Array} templateLines parseBomRows().lines
+ * @param {{quantity: number, priceMap: Object, quoteId: (string|number), quoteProductId: (string|number), rowKey: string}} ctx
+ */
+export function buildBomLines(templateLines, ctx) {
+  const options = ctx || {};
+  const priceMap = options.priceMap || {};
+  return (templateLines || []).map((line) => {
+    const price = priceMap[line.materialCode] || EMPTY_PRICE;
+    const quantity = calcBomQuantity(line.dosage, options.quantity);
+    const taxPrice = round(toNumber(price.taxPrice, 0));
+    return Object.assign({}, line, {
+      quoteId: options.quoteId || 0,
+      quoteProductId: options.quoteProductId || 0,
+      rowKey: options.rowKey || '',
+      quantity: quantity,
+      taxPrice: taxPrice,
+      taxRate: price.taxRate === undefined ? null : price.taxRate,
+      notaxPrice: round(toNumber(price.notaxPrice, 0)),
+      totalPrice: round(taxPrice * quantity),
+      goodsId: price.goodsId === undefined ? null : price.goodsId,
+      goodsPriceId: price.goodsPriceId === undefined ? null : price.goodsPriceId,
+      shelfStatus: toNumber(price.shelfStatus, 0)
+    });
+  });
+}
+
+/* BOM 合计总价 = Σ(含税单价 × 数量) */
+export function sumBomTotalPrice(bomList) {
+  return round(
+    (bomList || []).reduce((total, item) => total + toNumber(item.totalPrice, 0), 0)
+  );
+}
+
+/**
+ * 回填到物品清单行的单价:单位成本 = Σ(含税单价 × 用量)。
+ * 与 BOM 行 quantity/totalPrice 同源,保证「单价 × 明细数量」等于「Σ BOM 总价」。
+ */
+export function sumBomUnitPrice(bomList) {
+  return round(
+    (bomList || []).reduce(
+      (total, item) => total + toNumber(item.taxPrice, 0) * toNumber(item.dosage, 0),
+      0
+    )
+  );
+}
+
+/* 从 BOM 行中取一个税率回填明细行(多个时取第一个非空) */
+export function pickBomTaxRate(bomList) {
+  const found = (bomList || []).find(
+    (item) => item.taxRate !== null && item.taxRate !== undefined
+  );
+  return found ? found.taxRate : null;
+}
+
+/**
+ * 物品清单行的回填价格:含税单价、不含税单价、税率。
+ */
+export function buildRowPrice(bomList) {
+  const singlePrice = sumBomUnitPrice(bomList);
+  const taxRate = pickBomTaxRate(bomList);
+  const notaxSinglePrice =
+    taxRate === null ? singlePrice : round(singlePrice / (1 + toNumber(taxRate, 0) / 100), 2);
+  return {
+    singlePrice: singlePrice,
+    notaxSinglePrice: notaxSinglePrice,
+    taxRate: taxRate
+  };
+}
+
+/**
+ * 物品清单行的稳定键:已落库行用明细行 id,新增行用前端生成的 uuid。
+ * 服务端以 row_key 做「同一明细数据」的判重与覆盖依据。
+ */
+export function buildRowKey(row, index) {
+  if (row && row.id !== undefined && row.id !== null && row.id !== '') {
+    return String(row.id);
+  }
+  const seed = [Date.now(), index, Math.random()].join('-');
+  return 'tmp-' + seed.replace(/[^0-9a-zA-Z-]/g, '').slice(0, 48);
+}
+
+/**
+ * 分片:按物料编码查价时控制并发,避免一次性打爆 eom/goods/page。
+ */
+export function chunkList(list, size) {
+  const step = size > 0 ? size : 1;
+  const chunks = [];
+  for (let i = 0; i < (list || []).length; i += step) {
+    chunks.push(list.slice(i, i + step));
+  }
+  return chunks;
+}

+ 143 - 0
src/views/bpm/handleTask/components/quotation/bomDetailDialog.vue

@@ -0,0 +1,143 @@
+<template>
+  <el-dialog
+    :title="dialogTitle"
+    :visible.sync="dialogVisible"
+    :close-on-click-modal="false"
+    append-to-body
+    width="80%"
+    top="5vh"
+    custom-class="ele-dialog-form"
+    @close="close"
+  >
+    <el-card shadow="never">
+      <el-alert
+        v-if="!bomList.length"
+        type="info"
+        :closable="false"
+        show-icon
+        title="该明细行暂无 BOM 数据"
+      />
+
+      <ele-pro-table
+        v-else
+        ref="table"
+        :need-page="false"
+        :columns="columns"
+        :datasource="bomList"
+        row-key="materialCode"
+        max-height="420px"
+      >
+        <template v-slot:shelf="{ row: item }">
+          <el-tag v-if="Number(item.shelfStatus) === 1" type="success" size="small">
+            已上架
+          </el-tag>
+          <el-tag v-else type="info" size="small">按0</el-tag>
+        </template>
+      </ele-pro-table>
+
+      <div class="bom-summary" v-if="bomList.length">
+        <span class="amount">数量:{{ toNumber(row.totalCount, 0) }}</span>
+        <span class="amount">单价:{{ formatAmount(row.singlePrice) }}元</span>
+        <span class="amount">BOM条数:{{ bomList.length }}</span>
+        <span class="amount">总计:{{ formatAmount(sumTotal) }}元</span>
+      </div>
+    </el-card>
+
+    <div slot="footer" class="dialog-footer">
+      <el-button size="small" @click="close">关 闭</el-button>
+    </div>
+  </el-dialog>
+</template>
+
+<script>
+  /* 报价单审批页:查看某条物品清单行已导入的 BOM 详情(只读,与 eom 报价单 BOM详情 同版式) */
+  const textColumn = (prop, label, minWidth) => ({
+    prop: prop,
+    label: label,
+    minWidth: minWidth,
+    align: 'center',
+    showOverflowTooltip: true
+  });
+
+  const numberColumn = (prop, label, width) => ({
+    prop: prop,
+    label: label,
+    width: width,
+    align: 'center',
+    showOverflowTooltip: true
+  });
+
+  export default {
+    name: 'QuoteBomDetailDialog',
+    data() {
+      return {
+        dialogVisible: false,
+        row: {},
+        bomList: [],
+        columns: [
+          textColumn('bomCategory', '物料分类', 180),
+          numberColumn('bomLevel', '级次', 70),
+          textColumn('parentMaterialCode', '父级物料编码', 140),
+          textColumn('materialCode', '物料编码', 150),
+          numberColumn('dosage', '用量', 80),
+          textColumn('name', '名称', 160),
+          textColumn('specification', '规格', 160),
+          textColumn('supplierInfo', '供应商信息', 130),
+          numberColumn('quantity', '数量', 90),
+          textColumn('taxPrice', '含税单价', 110),
+          numberColumn('taxRate', '税率(%)', 90),
+          textColumn('notaxPrice', '不含税单价', 120),
+          textColumn('totalPrice', '总价', 110),
+          { columnKey: 'shelf', label: '状态', width: 90, align: 'center', slot: 'shelf' }
+        ]
+      };
+    },
+    computed: {
+      dialogTitle() {
+        const name = this.row && this.row.productName ? this.row.productName : '';
+        return name ? 'BOM详情 - ' + name : 'BOM详情';
+      },
+      sumTotal() {
+        return this.bomList.reduce(
+          (total, item) => total + this.toNumber(item.totalPrice, 0),
+          0
+        );
+      }
+    },
+    methods: {
+      toNumber(value, fallback) {
+        const num = Number(value);
+        if (value === null || value === undefined || value === '' || !isFinite(num)) {
+          return fallback === undefined ? 0 : fallback;
+        }
+        return num;
+      },
+      formatAmount(value) {
+        return this.toNumber(value, 0).toFixed(4);
+      },
+      // BOM 数据随报价单详情返回在 quoteProductList[].bomList 上,这里只做展示
+      open(payload) {
+        const params = payload || {};
+        this.row = params.row || {};
+        this.bomList = Array.isArray(this.row.bomList) ? this.row.bomList : [];
+        this.dialogVisible = true;
+      },
+      close() {
+        this.dialogVisible = false;
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  .bom-summary {
+    margin-top: 8px;
+    text-align: right;
+
+    .amount {
+      margin-left: 20px;
+      font-size: 13px;
+      color: #606266;
+    }
+  }
+</style>

+ 336 - 0
src/views/bpm/handleTask/components/quotation/bomImportDialog.vue

@@ -0,0 +1,336 @@
+<template>
+  <el-dialog
+    :title="dialogTitle"
+    :visible.sync="dialogVisible"
+    :close-on-click-modal="false"
+    :close-on-press-escape="false"
+    append-to-body
+    width="80%"
+    top="5vh"
+    custom-class="ele-dialog-form"
+    @close="close"
+  >
+    <el-card shadow="never">
+      <el-form size="small" label-width="80px" class="zw-criterion" @submit.native.prevent>
+        <el-form-item label="选择文件">
+          <div class="bom-upload">
+            <el-upload
+              action="#"
+              :show-file-list="false"
+              :http-request="handleUpload"
+              accept=".xls,.xlsx"
+              :disabled="loading"
+            >
+              <el-button size="small" type="primary" icon="el-icon-upload2" :loading="loading">
+                文件上传
+              </el-button>
+            </el-upload>
+            <span class="bom-upload-tip">
+              只能上传 excel 文件(.xls/.xlsx),点击
+              <el-link type="primary" :underline="false" @click="downloadTemplate">
+                下载《BOM导入模板》
+              </el-link>
+            </span>
+            <span class="bom-upload-file" v-if="fileName">{{ fileName }}</span>
+          </div>
+        </el-form-item>
+      </el-form>
+
+      <el-alert
+        v-for="(item, index) in errors"
+        :key="index"
+        type="error"
+        :closable="false"
+        show-icon
+        :title="item"
+        class="bom-alert"
+      />
+
+      <ele-pro-table
+        ref="table"
+        :need-page="false"
+        :columns="columns"
+        :datasource="bomList"
+        row-key="materialCode"
+        v-loading="loading"
+        max-height="320px"
+        class="dict-table"
+      >
+        <template v-slot:shelf="{ row: item }">
+          <el-tag v-if="toNumber(item.shelfStatus, 0) === 1" type="success" size="small">
+            已上架
+          </el-tag>
+          <el-tag v-else type="info" size="small">按0</el-tag>
+        </template>
+      </ele-pro-table>
+
+      <div class="bom-summary" v-if="bomList.length">
+        <span class="amount">BOM条数:{{ bomList.length }}</span>
+        <span class="amount">总计:{{ formatAmount(sumTotal) }}元</span>
+        <span class="amount">回填单价:{{ formatAmount(rowPrice.singlePrice) }}元</span>
+      </div>
+    </el-card>
+
+    <div slot="footer" class="dialog-footer">
+      <el-button size="small" @click="close">关 闭</el-button>
+      <el-button
+        size="small"
+        type="primary"
+        :disabled="loading || !bomList.length"
+        v-click-once
+        @click="confirm"
+      >
+        确定导入
+      </el-button>
+    </div>
+  </el-dialog>
+</template>
+
+<script>
+  import * as XLSX from 'xlsx';
+  import { download1 } from '@/utils/file';
+  import { getList as getGoodsList } from '@/api/bpm/components/goodsManage';
+  import {
+    BOM_DETAIL_COLUMNS,
+    BOM_TEMPLATE_NAME,
+    BOM_TEMPLATE_URL,
+    chunkList,
+    parseBomRows,
+    pickGoodsPrice,
+    buildBomLines,
+    buildRowPrice,
+    sumBomTotalPrice,
+    toNumber
+  } from './bom';
+
+  const PRICE_QUERY_CHUNK = 5;
+
+  export default {
+    name: 'BomImportDialog',
+    data() {
+      return {
+        dialogVisible: false,
+        loading: false,
+        fileName: '',
+        row: {},
+        rowIndex: -1,
+        quoteId: '',
+        rowKey: '',
+        bomList: [],
+        errors: [],
+        rowPrice: { singlePrice: 0, notaxSinglePrice: 0, taxRate: null },
+        columns: BOM_DETAIL_COLUMNS.concat([
+          { columnKey: 'shelf', label: '状态', width: 90, align: 'center', slot: 'shelf' }
+        ])
+      };
+    },
+    computed: {
+      dialogTitle() {
+        const name = this.row && this.row.productName ? this.row.productName : '';
+        return name ? 'BOM导入 - ' + name : 'BOM导入';
+      },
+      sumTotal() {
+        return sumBomTotalPrice(this.bomList);
+      }
+    },
+    methods: {
+      toNumber(value, fallback) {
+        return toNumber(value, fallback);
+      },
+      formatAmount(value) {
+        return toNumber(value, 0).toFixed(4);
+      },
+      /* 父组件调用:row 为物品清单行对象,index 为行下标 */
+      open(payload) {
+        const params = payload || {};
+        this.dialogVisible = true;
+        this.row = params.row || {};
+        this.rowIndex = params.index === undefined ? -1 : params.index;
+        this.quoteId = params.quoteId || '';
+        this.rowKey = params.rowKey || '';
+        this.fileName = '';
+        this.errors = [];
+        this.bomList = [];
+        this.rowPrice = { singlePrice: 0, notaxSinglePrice: 0, taxRate: null };
+      },
+      close() {
+        this.dialogVisible = false;
+        this.loading = false;
+      },
+      downloadTemplate() {
+        download1(window.location.origin + BOM_TEMPLATE_URL, BOM_TEMPLATE_NAME);
+      },
+      /* 读文件 -> 解析模版 -> 按物料编码取价 -> 计算数量与价格 */
+      async handleUpload(param) {
+        const file = param && param.file;
+        if (!file) return;
+        this.loading = true;
+        this.fileName = file.name;
+        this.errors = [];
+        try {
+          const matrix = await this.readSheet(file);
+          const parsed = parseBomRows(matrix);
+          if (parsed.errors.length) {
+            // 只回报有问题的行(第N行 + 原因),示例行/空行静默丢弃;其余行照常导入
+            this.errors = parsed.errors;
+          }
+          if (!parsed.lines.length) {
+            this.bomList = [];
+            this.rowPrice = { singlePrice: 0, notaxSinglePrice: 0, taxRate: null };
+            return;
+          }
+          const priceMap = await this.loadPriceMap(parsed.lines);
+          const bomList = buildBomLines(parsed.lines, {
+            quantity: this.row.totalCount,
+            priceMap: priceMap,
+            quoteId: this.quoteId,
+            quoteProductId: this.row.id,
+            rowKey: this.rowKey
+          });
+          this.bomList = bomList;
+          this.rowPrice = buildRowPrice(bomList);
+          const missCodes = bomList
+            .filter((item) => toNumber(item.shelfStatus, 0) !== 1)
+            .map((item) => item.materialCode);
+          if (missCodes.length) {
+            this.errors = this.errors.concat([
+              '以下物料编码未取到上架价格,已按 0 计算:' + missCodes.join('、')
+            ]);
+          }
+        } catch (error) {
+          this.errors = ['文件解析失败:' + (error && error.message ? error.message : error)];
+          this.bomList = [];
+        } finally {
+          this.loading = false;
+        }
+      },
+      readSheet(file) {
+        return new Promise((resolve, reject) => {
+          const reader = new FileReader();
+          reader.onload = (event) => {
+            try {
+              const workbook = XLSX.read(new Uint8Array(event.target.result), {
+                type: 'array'
+              });
+              const firstSheet = workbook.Sheets[workbook.SheetNames[0]];
+              resolve(
+                XLSX.utils.sheet_to_json(firstSheet, { header: 1, raw: false, defval: '' })
+              );
+            } catch (error) {
+              reject(error);
+            }
+          };
+          reader.onerror = reject;
+          reader.readAsArrayBuffer(file);
+        });
+      },
+      /* 按物料编码调 eom/goods/page,命中后按「优先上架、多价格取第一条」取价;查不到就是 0 */
+      async loadPriceMap(lines) {
+        const codes = [];
+        (lines || []).forEach((line) => {
+          if (line.materialCode && codes.indexOf(line.materialCode) < 0) {
+            codes.push(line.materialCode);
+          }
+        });
+        const priceMap = {};
+        const groups = chunkList(codes, PRICE_QUERY_CHUNK);
+        for (let i = 0; i < groups.length; i++) {
+          const results = await Promise.all(
+            groups[i].map((code) => this.queryGoodsByCode(code))
+          );
+          groups[i].forEach((code, index) => {
+            priceMap[code] = pickGoodsPrice(results[index], code);
+          });
+        }
+        return priceMap;
+      },
+      async queryGoodsByCode(code) {
+        try {
+          // pageNum/size 是后端 PaginationPO 的分页字段(不是 pageSize)
+          const res = await getGoodsList({
+            searchName: code,
+            pageNum: 1,
+            size: 50
+          });
+          if (Array.isArray(res)) return res;
+          if (res && Array.isArray(res.list)) return res.list;
+          if (res && Array.isArray(res.records)) return res.records;
+          return [];
+        } catch (error) {
+          // 单个编码查询失败不影响整单导入,按 0 处理
+          return [];
+        }
+      },
+      confirm() {
+        if (!this.bomList.length) {
+          this.$message.warning('请先选择并解析模版文件');
+          return;
+        }
+        const existed = (this.row.bomList || []).length;
+        const tip = existed
+          ? '该物品清单行已有 ' +
+            existed +
+            ' 条 BOM 数据,确定覆盖导入 ' +
+            this.bomList.length +
+            ' 条吗?'
+          : '确定导入 ' + this.bomList.length + ' 条 BOM 数据吗?';
+        this.$confirm(tip, '提示', {
+          type: 'warning',
+          confirmButtonText: '确定',
+          cancelButtonText: '取消'
+        })
+          .then(() => this.doImport())
+          .catch(() => {});
+      },
+      doImport() {
+        // BOM 挂在物品清单行上,随报价单 save/update 一起提交,
+        // 由后端 QuoteProductServiceImpl#saveBomBatch 按产品整行覆盖落库(新增与修改同一套逻辑)。
+        this.$emit('success', {
+          bomList: this.bomList,
+          price: this.rowPrice,
+          row: this.row,
+          index: this.rowIndex,
+          rowKey: this.rowKey
+        });
+        this.$message.success('成功导入 ' + this.bomList.length + ' 条 BOM 数据');
+        this.close();
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  .bom-upload {
+    display: flex;
+    align-items: center;
+    flex-wrap: wrap;
+  }
+
+  .bom-upload-tip {
+    margin-left: 12px;
+    font-size: 12px;
+    color: #909399;
+  }
+
+  .bom-upload-file {
+    margin-left: 12px;
+    font-size: 12px;
+    color: #606266;
+  }
+
+  .bom-alert {
+    margin-bottom: 8px;
+  }
+
+
+  .bom-summary {
+    margin-top: 8px;
+    text-align: right;
+  }
+
+  .bom-summary .amount {
+    margin-left: 20px;
+    font-size: 13px;
+    color: #606266;
+  }
+</style>

+ 54 - 2
src/views/bpm/handleTask/components/quotation/detailDialog.vue

@@ -83,6 +83,7 @@
       :isDeliveryDeadline="false"
       :isGuaranteePeriod="false"
       :isDiscount="false"
+      :isProduceDeliveryDeadline="true"
       v-if="taskDefinitionKey === 'technicianApprove'"
     ></inventoryTable>
     <inventoryTabledetail
@@ -90,7 +91,11 @@
       v-if="taskDefinitionKey != 'technicianApprove'"
       :isDiscount="false"
       ref="inventoryTabledetailRef"
+      showBomDetail
+      @showBomDetail="openBomDetail"
     ></inventoryTabledetail>
+
+    <bomDetailDialog ref="bomDetailDialogRef"></bomDetailDialog>
   </div>
   <!-- </ele-modal> -->
 </template>
@@ -104,6 +109,7 @@
   import inventoryTable from '@/BIZComponents/inventoryTable.vue';
 
   import { getDetail } from '@/api/bpm/components/saleManage/quotation';
+  import bomDetailDialog from './bomDetailDialog.vue';
   // import fileMain from "@/components/addDoc/index.vue";
   export default {
     mixins: [dictMixins],
@@ -118,7 +124,8 @@
     components: {
       // fileMain,
       inventoryTable,
-      inventoryTabledetail
+      inventoryTabledetail,
+      bomDetailDialog
     },
     data() {
       return {
@@ -296,8 +303,53 @@
           this.form = data;
         }
       },
+      // 查看该物品清单行已导入的 BOM(数据来自 eom/quote/getById 的 quoteProductList[].bomList)
+      openBomDetail(row) {
+        this.$refs.bomDetailDialogRef &&
+          this.$refs.bomDetailDialogRef.open({ row: row });
+      },
+      /**
+       * 取当前明细数据,供审批组件在「技术主管审批 / 销售员补充 / 发起人」节点回写报价单。
+       * 1. 技术员节点渲染可编辑的 inventoryTable,其余节点渲染只读的 inventoryTabledetail,
+       *    必须按当前真正挂载的表格取,否则另一个 ref 是 undefined,会报 "reading 'getTableValue'"。
+       * 2. /eom/quote/update 接收的是报价单对象(含 quoteProductList),不是裸数组,
+       *    所以这里返回整单数据,明细和总价都用当前表格的最新值覆盖。
+       */
       getTableValue() {
-        return this.$refs.inventoryTable.getTableValue();
+        const table =
+          this.taskDefinitionKey === 'technicianApprove'
+            ? this.$refs.inventoryTable
+            : this.$refs.inventoryTabledetailRef;
+        if (!table) {
+          throw new Error(
+            `报价单明细表格未渲染(taskDefinitionKey=${this.taskDefinitionKey}),无法取明细数据`
+          );
+        }
+        // 审批提交前不跑表格的 el-form 校验,必填项在这里兜住:
+        // 可编辑表格(isProduceDeliveryDeadline 开启)里生产交付交期必填
+        if (table === this.$refs.inventoryTable) {
+          const rows = table.getTableValue() || [];
+          const missing = rows.some((row) => !row.produceDeliveryDeadline);
+          if (missing) {
+            throw new Error('请选择生产交付交期');
+          }
+        }
+        const payload = Object.assign({}, this.form, {
+          quoteProductList: table.getTableValue()
+        });
+        // 明细被改过之后 form 里的旧总额已失效,总价以表格当前计算结果为准
+        if (typeof table.getPrice === 'function') {
+          payload.totalPrice = table.getPrice()[0];
+        }
+        return payload;
+      },
+      // 转发:用户在明细表里是否手动改过单价/数量,审批前据此判断是否需要落库
+      isSinglePriceChanged() {
+        const table =
+          this.taskDefinitionKey === 'technicianApprove'
+            ? this.$refs.inventoryTable
+            : this.$refs.inventoryTabledetailRef;
+        return (table && table.isSinglePriceChanged && table.isSinglePriceChanged()) || false;
       }
     }
   };

+ 71 - 134
src/views/bpm/handleTask/components/quotation/submit.vue

@@ -1,31 +1,6 @@
 <template>
   <el-col :span="16" :offset="6">
     <el-form label-width="100px" ref="formRef" :model="form">
-      <!-- <el-form-item
-        label="技术员"
-        prop="technicianId"
-        style="margin-bottom: 20px"
-        :rules="{
-          required: true,
-          message: '请选择',
-          trigger: 'change'
-        }"
-        v-if="taskDefinitionKey == 'productionSupervisorApprove1'"
-      >
-        <el-select
-          v-model="form.technicianId"
-          clearable
-          style="width: 100%"
-          :filterable="true"
-        >
-          <el-option
-            v-for="item in userOptions"
-            :key="item.id"
-            :label="item.name"
-            :value="item.id"
-          />
-        </el-select>
-      </el-form-item> -->
       <el-form-item
         label="审批意见"
 
@@ -40,33 +15,32 @@
       </el-form-item>
     </el-form>
     <div style="margin-left: 10%; margin-bottom: 20px; font-size: 14px">
+      <!-- 生产主管指派节点:通过没有任何意义,必须指派技术员才能流转到下一节点 -->
       <el-button
-        icon="el-icon-edit-outline"
+        v-if="taskDefinitionKey === 'productionSupervisorApprove1'"
+        icon="el-icon-user"
         type="success"
         size="mini"
         v-click-once
-        @click="$refs.approvalOpinion.validate(1) && handleAudit(1)"
-        >通过
+        @click="$refs.approvalOpinion.validate(1) && openAssign()"
+        >指派技术员
       </el-button>
-      <!-- <el-button
+      <el-button
+        v-else
         icon="el-icon-edit-outline"
         type="success"
         size="mini"
-        v-if="taskDefinitionKey === 'productionSupervisorApprove1'"
-        @click="head"
-        >指派技术员
-      </el-button> -->
+        v-click-once
+        @click="$refs.approvalOpinion.validate(1) && handleAudit(1)"
+        >通过
+      </el-button>
       <el-button
         icon="el-icon-circle-close"
         type="danger"
         size="mini"
         v-click-once
         @click="$refs.approvalOpinion.validate(0) && handleAudit(0)"
-        v-if="
-          !['starter'].includes(
-            taskDefinitionKey
-          )
-        "
+        v-if="!['starter'].includes(taskDefinitionKey)"
         >驳回
       </el-button>
 
@@ -76,43 +50,14 @@
           <el-dropdown-item command="cancel">作废</el-dropdown-item>
         </el-dropdown-menu>
       </el-dropdown>
-
-      <!-- <el-button
-        icon="el-icon-circle-close"
-        type="danger"
-        size="mini"
-        @click="handleBackList"
-        >退回
-      </el-button> -->
-      <!-- <el-button
-        icon="el-icon-circle-close"
-        type="danger"
-        size="mini"
-        @click="handleAudit(0)"
-        v-if="taskDefinitionKey != 'productionSupervisorApprove1'"
-        >不通过
-      </el-button>
-      <el-button
-        icon="el-icon-edit-outline"
-        type="primary"
-        size="mini"
-        v-if="taskDefinitionKey != 'productionSupervisorApprove1'"
-        @click="handleUpdateAssignee"
-        >转办
-      </el-button> -->
     </div>
     <head-list ref="headRef" @changeParent="changePersonel"></head-list>
   </el-col>
 </template>
 
 <script>
-  import {
-    updateTech,
-    UpdateInformation,
-    cancel
-  } from '@/api/bpm/components/saleManage/quotation';
+  import { UpdateInformation } from '@/api/bpm/components/saleManage/quotation';
   import {approveTaskWithVariables, rejectTask,cancelTask} from '@/api/bpm/task';
-  import { listAllUserBind } from '@/api/system/organization';
   import headList from '@/components/headList';
   // 流程实例的详情页,可用于审批
   export default {
@@ -137,99 +82,91 @@
     data() {
       return {
         form: {
-          technicianId: '',
           reason: '同意'
         },
-        userOptions: []
+        // 指派技术员时,人员选择弹窗里选中的人
+        pickedUserId: ''
       };
     },
-    created() {
-      this.userOptions = [];
-      listAllUserBind().then((data) => {
-        this.userOptions.push(...data);
-      });
-    },
     methods: {
-      /** 处理转办审批人 */
-      handleUpdateAssignee() {
-        this.$emit('handleUpdateAssignee');
-      },
-      /** 退回 */
-      handleBackList() {
-        this.$emit('handleBackList');
-      },
-      head() {
-        this.$refs.headRef.open();
+      /** 指派技术员:选人后提交(流转变量 userId) */
+      openAssign() {
+        this.pickedUserId = '';
+        this.$refs.headRef.open(null, 0, '指派技术员');
       },
+      /** 人员选择回调 */
       changePersonel(data) {
-        this.form.technicianId = data.id;
-        this.handleAudit(1, 'zp');
+        if (!data || !data.id) return;
+        this.pickedUserId = data.id;
+        this.handleAudit(1, 'assign');
       },
       async handleAudit(status, type) {
-        //生产主管审批选择技术员
-        // if (this.taskDefinitionKey === 'productionSupervisorApprove1') {
-        //   if (!this.form.technicianId && type == 'zp') {
-        //     this.$message.warning(`请选择技术人员!`);
-        //     return;
-        //   }
-        // }
-        //技术员修改
-        // if (this.taskDefinitionKey === 'technicianApprove' && status === 1) {
-        //   let data = await this.getTableValue();
-        //   if (!arr) {
-        //     return;
-        //   }
-        //   let arr = data.map((item) => {
-        //     return {
-        //       id: item.id,
-        //       technicalAnswerId: item.technicalAnswerId,
-        //       technicalAnswerName: item.technicalAnswerName,
-        //       technicalDrawings: item.technicalDrawings,
-        //       technicalParams: item.technicalParams
-        //     };
-        //   });
-        //   try {
-        //     await updateTech(arr);
-        //   } catch (error) {}
-        // }
-        //销售员补充
-        if ((this.taskDefinitionKey === 'salesmanApprove'||this.taskDefinitionKey === 'starter')&&status === 1) {
-          let arr = await this.getTableValue();
-          if (!arr) {
-            return;
-          }
-          let data = await UpdateInformation(arr);
-          if (data.code != '0') {
+        // 指派技术员必须选人:后端靠 variables.userId 决定任务交给谁
+        if (type === 'assign' && !this.pickedUserId) {
+          this.$message.warning('请选择技术人员!');
+          return;
+        }
+        // 通过时必须回写报价单:明细表里的单价/备注/附件/工艺路线等修改都要落库,
+        // 不能靠“是否改过单价”来判断,否则改了备注、附件这些字段就会漏调 UpdateInformation
+        if (status === 1) {
+          try {
+            const payload = await this.getTableValue();
+            // 详情组件在必填校验不通过时会返回空值(如生产交付交期没选),
+            // 此时表格已经弹过具体是哪个必填项,这里直接拦下不再提交审批
+            if (!payload) {
+              console.warn('报价单取值为空(校验未通过),已阻止提交审批');
+              return;
+            }
+            const data = await UpdateInformation(payload);
+            if (data.code != '0') {
+              // 回写失败不能静默跳过,否则点通过后流程动了、修改却没保存
+              this.$message.error(data.message || '报价单回写失败,未提交审批');
+              return;
+            }
+          } catch (error) {
+            this.$message.error(error.message || '报价单回写失败,未提交审批');
             return;
           }
         }
-        this._approveTaskWithVariables(status, this.form.technicianId, type);
+        this._approveTaskWithVariables(status, type);
       },
-      async _approveTaskWithVariables(status, technicianId, type) {
+      async _approveTaskWithVariables(status, type) {
         let variables = {
           pass: !!status
         };
-        if (technicianId && type == 'zp') {
-          variables['technicianId'] = technicianId;
+        // 后端流程变量名是 userId(不是 technicianId):指派技术员时把选中的人带上
+        if (status && type === 'assign' && this.pickedUserId) {
+          variables['userId'] = this.pickedUserId;
         }
 
+        const failText = status === 0 ? '驳回失败' : '审批失败';
+
         let API = !!status ? approveTaskWithVariables : rejectTask;
         API({
           id: this.taskId,
           reason: this.form.reason,
           variables
-        }).then((res) => {
-          if (res.data.code != '-1') {
-            this.$emit('handleAudit', {
-              status,
-              title: status === 0 ? '驳回' : ''
-            });
-          }
-        });
+        })
+          .then((res) => {
+            // 后端成功码是 0(其余一律视为失败),不能再只判断 -1,
+            // 否则遇到 -2 / 500 之类的错误码会误报成功并关掉弹窗
+            if (res?.data?.code == 0) {
+              this.$emit('handleAudit', {
+                status,
+                title: status === 0 ? '驳回' : ''
+              });
+            } else {
+              this.$message.error(res?.data?.message || failText);
+            }
+          })
+          .catch(() => {
+            this.$message.error(failText);
+          });
       },
 
       getTableValue() {
         return new Promise((resolve, reject) => {
+          // 父组件回调:data 为报价单整单数据(含 quoteProductList)
           this.$emit('getTableValue', async (data) => {
             resolve(await data);
           });

+ 10 - 0
src/views/bpm/handleTask/index.vue

@@ -398,6 +398,16 @@
     hr_attendance_trip_apply: {
       pcView: '/bpm/handleTask/components/hrTripManagement/hrTripDetail.vue',
       pcHandle: '/bpm/handleTask/components/hrTripManagement/submit.vue'
+    },
+    // 薪资核算批次审批:批次汇总 + 异常,不含个人薪资明细
+    hr_payroll_batch_approval: {
+      pcView: '/bpm/handleTask/components/payrollBatchApproval/detail.vue',
+      pcHandle: '/bpm/handleTask/components/payrollBatchApproval/submit.vue'
+    },
+    // 工资条异议审批:只看申诉内容与来源,金额调整另走更正审批
+    hr_payroll_payslip_appeal_approval: {
+      pcView: '/bpm/handleTask/components/payrollAppealApproval/detail.vue',
+      pcHandle: '/bpm/handleTask/components/payrollAppealApproval/submit.vue'
     }
   };
 

+ 3 - 3
vue.config.js

@@ -44,11 +44,11 @@ module.exports = {
         // target: 'http://192.168.1.251:18186',
         // target: 'http://192.168.1.251:18086',
         // target: 'http://192.168.1.3:18086',
-        // target: 'http://aiot.zoomwin.com.cn:51001/api',
+        target: 'https://aiot.zoomwin.com.cn:51001/api',
         // target: 'http://192.168.1.3:18086',
-        // target: 'http://192.168.1.147:18086', // 陈兵
+        // target: 'http://192.168.1.9:18086', // 陈兵
         // target: 'http://192.168.1.116:18086', // 赵沙金
-        target: 'http://192.168.1.113:18086', // 郭丹
+        // target: 'http://192.168.1.113:18086', // 郭丹
         // target: 'http://192.168.1.102:18086', // 吴志豪
 
         changeOrigin: true, // 只有这个值为true的情况下 s才表示开启跨域