Răsfoiți Sursa

feat(薪资审批): 新增薪资核算批次与工资条异议审批详情页

接入 hr_payroll_batch_approval / hr_payroll_payslip_appeal_approval 流程组件映射;新增 payrollBatch / payrollAppeal 接口封装与详情、审批提交组件;批次审批展示汇总与异常不含个人薪资明细,异议审批只展示申诉内容与来源;同时切换开发代理地址
lihaiting 3 zile în urmă
părinte
comite
05a6166816

+ 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;
+}

+ 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>

+ 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'
     }
   };
 

+ 2 - 2
vue.config.js

@@ -38,13 +38,13 @@ module.exports = {
         // target: 'http://124.71.68.31:50001', // 测试环境
         // target: 'http://124.71.68.31:50001',
         // target: 'http://192.168.1.105:18086',
-        target: 'http://localhost:18086',
+        // target: 'http://localhost:18086',
         // target: 'http://192.168.1.116:18086',
         // target: 'http://192.168.1.3:18086',
         // target: 'http://192.168.1.251:18186',
         // target: 'http://192.168.1.251:18086',
         // target: 'http://192.168.1.3:18086',
-        // target: 'https://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.9:18086', // 陈兵
         // target: 'http://192.168.1.116:18086', // 赵沙金