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