|
|
@@ -45,17 +45,17 @@
|
|
|
<div class="steps-head-right">
|
|
|
<el-button v-if="$hasPermission('hr:payrollBatches:calculate')" type="primary" icon="el-icon-video-play"
|
|
|
size="small" :loading="calcActionRunning === 'calculate'"
|
|
|
- :disabled="!canCalculate || !!calcActionRunning" @click="runCalc('calculate')">
|
|
|
+ :disabled="!canCalculate || !!calcActionRunning || calcPrompting" @click="runCalc('calculate')">
|
|
|
执行核算
|
|
|
</el-button>
|
|
|
<el-button v-if="$hasPermission('hr:payrollBatches:recalculate')" type="warning"
|
|
|
icon="el-icon-refresh-right" size="small" plain :loading="calcActionRunning === 'recalculate'"
|
|
|
- :disabled="!canRecalculate || !!calcActionRunning" @click="runCalc('recalculate')">
|
|
|
+ :disabled="!canRecalculate || !!calcActionRunning || calcPrompting" @click="runCalc('recalculate')">
|
|
|
重算
|
|
|
</el-button>
|
|
|
<el-button v-if="canCancel && $hasPermission('hr:hrPayroll:cancel')" type="danger"
|
|
|
icon="el-icon-circle-close" size="small" plain :loading="cancelLoading"
|
|
|
- :disabled="!!calcActionRunning" @click="openCancel">
|
|
|
+ :disabled="!!calcActionRunning || calcPrompting" @click="openCancel">
|
|
|
取消批次
|
|
|
</el-button>
|
|
|
</div>
|
|
|
@@ -545,6 +545,8 @@ export default {
|
|
|
/* 异常明细接口失败时的错误文案(不能把接口故障读成「本批次无异常」) */
|
|
|
exceptionsError: '',
|
|
|
calcActionRunning: '',
|
|
|
+ /* 核算原因弹窗打开中:与 calcActionRunning 一起构成前端防重复点击闸门 */
|
|
|
+ calcPrompting: false,
|
|
|
overviewLoading: false,
|
|
|
/* ★ 2026-10-09:取消批次 */
|
|
|
cancelVisible: false,
|
|
|
@@ -767,7 +769,8 @@ export default {
|
|
|
return '已审批(历史批次):如需修正金额请走更正草稿 / 人工调整';
|
|
|
}
|
|
|
if (this.batchStatus === 'CONFIRMING') return '确认中:等待员工确认后再送审批';
|
|
|
- if (this.batchStatus === 'FETCHING') return '取数中,请稍候刷新';
|
|
|
+ /* FETCHING = 建批次后尚未取数,取数由「执行核算」触发,必须给出可操作的引导 */
|
|
|
+ if (this.batchStatus === 'FETCHING') return '批次待取数:点「执行核算」开始取数与试算';
|
|
|
if (this.batchStatus === 'PAID') return '该批次工资已发放,不再支持核算类操作';
|
|
|
if (this.batchStatus === 'CLOSED') return '批次已关闭,不再参与核算与统计';
|
|
|
if (this.batchStatus === 'VOID') return '批次已作废,不再参与核算与统计';
|
|
|
@@ -1132,12 +1135,19 @@ export default {
|
|
|
},
|
|
|
/* ---------- Y1:执行核算 / 重算 ---------- */
|
|
|
async runCalc(action) {
|
|
|
+ /*
|
|
|
+ * 防重复点击:弹窗已打开或已有核算请求在跑时直接忽略。
|
|
|
+ * 按钮 disabled 只能挡住「已渲染」的点击,连点两下时第二次事件仍可能在
|
|
|
+ * loading 生效前进入方法,这里做同步闸门;后端另有行锁兜底并发。
|
|
|
+ */
|
|
|
+ if (this.calcActionRunning || this.calcPrompting) return;
|
|
|
if (!this.currentBatchId) {
|
|
|
this.$message.warning('请先选择薪资批次');
|
|
|
return;
|
|
|
}
|
|
|
const isCalc = action === 'calculate';
|
|
|
let reason = '';
|
|
|
+ this.calcPrompting = true;
|
|
|
try {
|
|
|
const result = await this.$prompt(
|
|
|
'请输入本次操作原因(必填,写入受控操作审计)',
|
|
|
@@ -1152,6 +1162,8 @@ export default {
|
|
|
reason = String(result.value || '').trim();
|
|
|
} catch (error) {
|
|
|
return;
|
|
|
+ } finally {
|
|
|
+ this.calcPrompting = false;
|
|
|
}
|
|
|
this.calcActionRunning = action;
|
|
|
try {
|