|
|
@@ -8,19 +8,6 @@
|
|
|
custom-class="salary-profile-modal"
|
|
|
@update:visible="updateVisible"
|
|
|
>
|
|
|
- <el-alert
|
|
|
- class="dialog-tip"
|
|
|
- type="info"
|
|
|
- :closable="false"
|
|
|
- show-icon
|
|
|
- title="调薪 / 调岗 / 跨法人均新增版本,历史版本不会被覆盖"
|
|
|
- >
|
|
|
- <template slot="default">
|
|
|
- 同一员工、同一法人、同一任职周期的生效区间不能重叠;已被核算引用的版本不能原地修改,
|
|
|
- 本次保存会生成新版本(版本号自动递增)。
|
|
|
- </template>
|
|
|
- </el-alert>
|
|
|
-
|
|
|
<div v-if="employee" class="employee-brief">
|
|
|
<span class="brief-name">{{ employee.name }}</span>
|
|
|
<span class="brief-meta">工号 {{ employee.employeeNo || '—' }}</span>
|
|
|
@@ -102,16 +89,13 @@
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
- <p class="field-hint">
|
|
|
- 该员工按所选模板版本核算;下拉列出该法人<b>已启用模板的当前版本</b>,默认带出当前档案引用的版本。
|
|
|
- </p>
|
|
|
</div>
|
|
|
|
|
|
<div class="form-section">
|
|
|
<div class="section-title">缴费基数(核算用)</div>
|
|
|
<el-row :gutter="20">
|
|
|
<el-col :span="12">
|
|
|
- <el-form-item label="社保基数">
|
|
|
+ <el-form-item label="社保基数" prop="socialBase">
|
|
|
<el-input-number
|
|
|
v-model="form.socialBase"
|
|
|
:min="0"
|
|
|
@@ -122,7 +106,7 @@
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
|
- <el-form-item label="公积金基数">
|
|
|
+ <el-form-item label="公积金基数" prop="fundBase">
|
|
|
<el-input-number
|
|
|
v-model="form.fundBase"
|
|
|
:min="0"
|
|
|
@@ -133,13 +117,6 @@
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
- <p class="field-hint">
|
|
|
- 社保 / 公积金基数在档案里是<b>核算快照</b>;权威来源是下方的「员工参保关系」,
|
|
|
- 两者不一致时以参保关系为准。
|
|
|
- <template v-if="currentOverview">
|
|
|
- 已按该员工<b>当前有效档案 V{{ currentOverview.versionNo }}</b>预填,可直接调整。
|
|
|
- </template>
|
|
|
- </p>
|
|
|
</div>
|
|
|
|
|
|
<!--
|
|
|
@@ -150,15 +127,12 @@
|
|
|
<div class="form-section">
|
|
|
<div class="section-title">
|
|
|
员工参保关系
|
|
|
+ <span v-if="needMaintainSocial" class="required-mark">*</span>
|
|
|
<el-checkbox v-model="maintainSocial" class="section-toggle" @change="onMaintainSocialChange">
|
|
|
本次一并维护
|
|
|
</el-checkbox>
|
|
|
</div>
|
|
|
<template v-if="maintainSocial">
|
|
|
- <p class="field-hint">
|
|
|
- 方案必须属于同一法人且已启用;同一员工启用关系的有效期不得重叠。
|
|
|
- 未勾选时不动这条关系。
|
|
|
- </p>
|
|
|
<el-row :gutter="20">
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="五险一金方案" prop="social.socialPlanId">
|
|
|
@@ -172,7 +146,7 @@
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
|
- <el-form-item label="参保城市">
|
|
|
+ <el-form-item label="参保城市" prop="social.cityCode">
|
|
|
<!-- 选择省 / 市后按行政区划码写入 cityCode(接口要 6 位编码,如 430100) -->
|
|
|
<el-cascader v-model="cityPath" :options="cityAreaOptions" :props="{ expandTrigger: 'hover' }"
|
|
|
filterable clearable placeholder="请选择省 / 市" style="width: 100%" />
|
|
|
@@ -200,7 +174,7 @@
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
|
- <el-form-item label="参保生效日期">
|
|
|
+ <el-form-item label="参保生效日期" prop="social.effectiveDate">
|
|
|
<el-date-picker v-model="form.social.effectiveDate" type="date" value-format="yyyy-MM-dd"
|
|
|
placeholder="选择日期" class="full-width" />
|
|
|
</el-form-item>
|
|
|
@@ -224,32 +198,22 @@
|
|
|
</template>
|
|
|
</el-tag>
|
|
|
</template>
|
|
|
- <span v-else>暂无(核算时该员工不会扣社保,请在需要时勾选上方「本次一并维护」)</span>
|
|
|
+ <span v-else-if="needMaintainSocial">
|
|
|
+ 暂无参保关系,首次维护薪资档案须勾选上方「本次一并维护」
|
|
|
+ </span>
|
|
|
+ <span v-else>暂无</span>
|
|
|
</p>
|
|
|
</div>
|
|
|
|
|
|
<div class="form-section">
|
|
|
<div class="section-title">
|
|
|
员工年度税务档案
|
|
|
+ <span v-if="needMaintainTax" class="required-mark">*</span>
|
|
|
<el-checkbox v-model="maintainTax" class="section-toggle" @change="onMaintainTaxChange">
|
|
|
本次一并维护
|
|
|
</el-checkbox>
|
|
|
</div>
|
|
|
<template v-if="maintainTax">
|
|
|
- <p class="field-hint">
|
|
|
- 同一法人 + 员工 + 自然年度<b>仅允许一份启用档案</b>;税务身份与专项附加扣除已支持查看,
|
|
|
- 下方已存在档案会一并展示,便于比对后再保存。
|
|
|
- </p>
|
|
|
- <!-- 该年度已有启用档案:后端没有更新接口,只能复用,字段置为只读并明确说明 -->
|
|
|
- <p v-if="taxExistingProfile" class="field-hint field-hint--warn">
|
|
|
- 该员工 <b>{{ taxExistingProfile.taxYear }} 年度</b>已有启用档案(编号
|
|
|
- <span class="link-id">{{ taxExistingProfile.id }}</span>,
|
|
|
- {{ taxExistingProfile.taxIdentity || '税务身份未填' }}<template
|
|
|
- v-if="taxExistingProfile.additionalDeduction != null"> · 专项扣除
|
|
|
- {{ taxExistingProfile.additionalDeduction }} 元/月</template>):
|
|
|
- <b>本次保存将直接关联该档案,不会重复创建</b>。已存在的年度档案暂不支持在界面修改
|
|
|
- (接口未提供更新能力),如需变更请联系系统管理员处理。
|
|
|
- </p>
|
|
|
<el-row :gutter="20">
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="税务年度" prop="tax.taxYear">
|
|
|
@@ -258,7 +222,7 @@
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
|
- <el-form-item label="税务身份">
|
|
|
+ <el-form-item label="税务身份" prop="tax.taxIdentity" :rules="taxIdentityRules">
|
|
|
<el-input v-model.trim="form.tax.taxIdentity" placeholder="如 居民个人 / 外籍个人" maxlength="50"
|
|
|
:disabled="!!taxExistingProfile" />
|
|
|
</el-form-item>
|
|
|
@@ -270,7 +234,7 @@
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
|
- <el-form-item label="档案生效日期">
|
|
|
+ <el-form-item label="档案生效日期" prop="tax.effectiveDate" :rules="taxEffectiveDateRules">
|
|
|
<el-date-picker v-model="form.tax.effectiveDate" type="date" value-format="yyyy-MM-dd"
|
|
|
placeholder="选择日期" class="full-width" :disabled="!!taxExistingProfile" />
|
|
|
</el-form-item>
|
|
|
@@ -287,7 +251,10 @@
|
|
|
{{ item.statusLabel }}
|
|
|
</el-tag>
|
|
|
</template>
|
|
|
- <span v-else>暂无(未维护时个税按法定规则与公司默认设置核算)</span>
|
|
|
+ <span v-else-if="needMaintainTax">
|
|
|
+ 暂无年度税务档案,首次维护薪资档案须勾选上方「本次一并维护」
|
|
|
+ </span>
|
|
|
+ <span v-else>暂无</span>
|
|
|
</p>
|
|
|
</div>
|
|
|
|
|
|
@@ -531,6 +498,10 @@
|
|
|
industryRiskLevels: INDUSTRY_RISK_LEVEL_OPTIONS,
|
|
|
existingSocialList: [],
|
|
|
existingTaxList: [],
|
|
|
+ /* 员工级事实是否已查询完成 / 查询是否失败:只有「确定查不到」才要求首次维护必勾 */
|
|
|
+ factsLoaded: false,
|
|
|
+ socialFactsFailed: false,
|
|
|
+ taxFactsFailed: false,
|
|
|
/* 该员工在所选年度已有的启用税务档案(有则保存时直接关联,不再新建) */
|
|
|
taxExistingProfile: null,
|
|
|
/* 适用模板版本下拉(P0-2)与其既有版本区间(P1-11 重叠校验) */
|
|
|
@@ -543,6 +514,12 @@
|
|
|
employmentType: [{ required: true, message: '请选择用工性质', trigger: 'change' }],
|
|
|
changeSource: [{ required: true, message: '请选择变更来源', trigger: 'change' }],
|
|
|
baseSalary: [{ required: true, message: '请输入定岗薪资', trigger: 'blur' }],
|
|
|
+ socialBase: [
|
|
|
+ { required: true, message: '请输入社保基数', trigger: ['blur', 'change'] }
|
|
|
+ ],
|
|
|
+ fundBase: [
|
|
|
+ { required: true, message: '请输入公积金基数', trigger: ['blur', 'change'] }
|
|
|
+ ],
|
|
|
effectiveDate: [{ required: true, message: '请选择生效日期', trigger: 'change' }],
|
|
|
templateVersionId: [
|
|
|
{ required: true, message: '请选择适用模板版本', trigger: 'change' }
|
|
|
@@ -550,6 +527,10 @@
|
|
|
'social.socialPlanId': [
|
|
|
{ required: true, message: '请选择五险一金方案', trigger: 'change' }
|
|
|
],
|
|
|
+ 'social.cityCode': [{ required: true, message: '请选择参保城市', trigger: 'change' }],
|
|
|
+ 'social.effectiveDate': [
|
|
|
+ { required: true, message: '请选择参保生效日期', trigger: 'change' }
|
|
|
+ ],
|
|
|
'tax.taxYear': [{ required: true, message: '请选择税务年度', trigger: 'change' }]
|
|
|
}
|
|
|
};
|
|
|
@@ -584,6 +565,35 @@
|
|
|
(item) => String(item.itemType || '').toUpperCase() === 'WORK_INJURY'
|
|
|
);
|
|
|
},
|
|
|
+ /**
|
|
|
+ * 该员工是否已有在期参保关系 / 年度税务档案。
|
|
|
+ * 查询未完成或查询失败时按「已有」处理 —— 不能因为接口暂时不可用就把保存卡死。
|
|
|
+ */
|
|
|
+ hasExistingSocial() {
|
|
|
+ if (!this.factsLoaded || this.socialFactsFailed) return true;
|
|
|
+ return (this.existingSocialList || []).length > 0;
|
|
|
+ },
|
|
|
+ hasExistingTax() {
|
|
|
+ if (!this.factsLoaded || this.taxFactsFailed) return true;
|
|
|
+ return (this.existingTaxList || []).length > 0;
|
|
|
+ },
|
|
|
+ /** 首次维护薪资档案:员工还没有参保关系 / 税务档案,本次必须一并维护 */
|
|
|
+ needMaintainSocial() {
|
|
|
+ return !this.hasExistingSocial;
|
|
|
+ },
|
|
|
+ needMaintainTax() {
|
|
|
+ return !this.hasExistingTax;
|
|
|
+ },
|
|
|
+ /** 税务身份:已有启用档案时字段只读复用原值,不再要求必填 */
|
|
|
+ taxIdentityRules() {
|
|
|
+ if (this.taxExistingProfile) return [];
|
|
|
+ return [{ required: true, message: '请填写税务身份', trigger: 'blur' }];
|
|
|
+ },
|
|
|
+ /** 档案生效日期:同上,已有档案直接复用其生效日期 */
|
|
|
+ taxEffectiveDateRules() {
|
|
|
+ if (this.taxExistingProfile) return [];
|
|
|
+ return [{ required: true, message: '请选择档案生效日期', trigger: 'change' }];
|
|
|
+ },
|
|
|
/** 方案下拉异常时的提示(空串 = 无需提示) */
|
|
|
socialPlanTip() {
|
|
|
if (!this.maintainSocial) return '';
|
|
|
@@ -748,6 +758,9 @@
|
|
|
this.maintainTax = false;
|
|
|
this.existingSocialList = [];
|
|
|
this.existingTaxList = [];
|
|
|
+ this.factsLoaded = false;
|
|
|
+ this.socialFactsFailed = false;
|
|
|
+ this.taxFactsFailed = false;
|
|
|
this.taxExistingProfile = null;
|
|
|
this.versionOptions = [];
|
|
|
this.existingVersions = [];
|
|
|
@@ -756,7 +769,9 @@
|
|
|
/* 参保生效日期默认跟档案生效日期走,HR 可改 */
|
|
|
this.form.social.effectiveDate = '';
|
|
|
this.loadSocialPlans();
|
|
|
- this.loadExistingFacts();
|
|
|
+ /* 必须等「已有参保关系 / 税务档案」查完:首次维护的必勾校验依赖这个结果,
|
|
|
+ 否则用户可以在查询返回前点保存绕过校验 */
|
|
|
+ await this.loadExistingFacts();
|
|
|
/* 用工性质与员工档案同源(字典 position_nature),选项 / 措辞保持一致 */
|
|
|
this.loadEmploymentTypeDict();
|
|
|
/* 先备好模板版本选项(P0-2),再预填「当前有效档案」的关联主键 */
|
|
|
@@ -970,13 +985,33 @@
|
|
|
getEmployeeSocialPage({ companyId, userId, effectiveDate: this.baseDate, pageNum: 1, size: 20 }),
|
|
|
getEmployeeTaxProfilePage({ companyId, userId, effectiveDate: this.baseDate, pageNum: 1, size: 20 })
|
|
|
]);
|
|
|
- this.existingSocialList =
|
|
|
- socialRes.status === 'fulfilled' ? socialRes.value.list || [] : [];
|
|
|
- this.existingTaxList = taxRes.status === 'fulfilled' ? taxRes.value.list || [] : [];
|
|
|
+ /* 查询失败不能当作「没有」:否则接口一抖就会把「首次维护必须勾选」误判出来 */
|
|
|
+ this.socialFactsFailed = socialRes.status !== 'fulfilled';
|
|
|
+ this.taxFactsFailed = taxRes.status !== 'fulfilled';
|
|
|
+ this.existingSocialList = this.socialFactsFailed ? [] : socialRes.value.list || [];
|
|
|
+ this.existingTaxList = this.taxFactsFailed ? [] : taxRes.value.list || [];
|
|
|
+ this.factsLoaded = true;
|
|
|
/* 列表回来后再同步一次:勾选早于加载完成时也能识别「该年度已有启用档案」 */
|
|
|
if (this.maintainTax) this.syncTaxExisting();
|
|
|
},
|
|
|
async handleSave() {
|
|
|
+ /*
|
|
|
+ * 首次维护薪资档案:员工还没有参保关系 / 年度税务档案时,两条员工级事实必须一并建立,
|
|
|
+ * 否则核算时既不扣社保也没有个税档案。已存在的员工不校验,勾不勾都行。
|
|
|
+ * 先于表单校验提示,避免用户先把其余字段填完才被拦下。
|
|
|
+ */
|
|
|
+ if (this.needMaintainSocial && !this.maintainSocial) {
|
|
|
+ this.$message.error(
|
|
|
+ '该员工还没有参保关系,首次维护薪资档案需一并维护:请勾选「员工参保关系 · 本次一并维护」,并填写五险一金方案、参保城市和参保生效日期'
|
|
|
+ );
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (this.needMaintainTax && !this.maintainTax) {
|
|
|
+ this.$message.error(
|
|
|
+ '该员工还没有年度税务档案,首次维护薪资档案需一并维护:请勾选「员工年度税务档案 · 本次一并维护」,并填写税务年度、税务身份和档案生效日期'
|
|
|
+ );
|
|
|
+ return;
|
|
|
+ }
|
|
|
try {
|
|
|
await this.$refs.form.validate();
|
|
|
} catch (error) {
|
|
|
@@ -1079,10 +1114,6 @@
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
- .dialog-tip {
|
|
|
- margin-bottom: 14px;
|
|
|
- }
|
|
|
-
|
|
|
.employee-brief {
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
@@ -1125,6 +1156,14 @@
|
|
|
font-weight: 400;
|
|
|
}
|
|
|
|
|
|
+ /* 员工还没有参保关系 / 税务档案时,该区块必须一并维护,用红星提示 */
|
|
|
+ .required-mark {
|
|
|
+ margin-left: -6px;
|
|
|
+ color: #f56c6c;
|
|
|
+ font-size: 14px;
|
|
|
+ line-height: 1;
|
|
|
+ }
|
|
|
+
|
|
|
/* 「系统关联信息」只读展示(原为可编辑输入框,见模板内注释) */
|
|
|
.link-value {
|
|
|
min-height: 32px;
|