新增信息维护年收入字段全链路支持
This commit is contained in:
@@ -115,6 +115,7 @@
|
||||
<el-table-column label="身份证号" align="center" prop="idCard" :show-overflow-tooltip="true"/>
|
||||
<el-table-column label="所属部门" align="center" prop="deptName" :show-overflow-tooltip="true"/>
|
||||
<el-table-column label="电话" align="center" prop="phone" width="120"/>
|
||||
<el-table-column label="年收入" align="center" prop="annualIncome" width="140"/>
|
||||
<el-table-column label="状态" align="center" prop="status" width="100">
|
||||
<template slot-scope="scope">
|
||||
<el-tag v-if="scope.row.status === '0'" type="success">在职</el-tag>
|
||||
@@ -204,11 +205,19 @@
|
||||
<el-input v-model="form.phone" placeholder="请输入电话" maxlength="11" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="年收入" prop="annualIncome">
|
||||
<el-input v-model="form.annualIncome" placeholder="请输入年收入(元/年)" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="入职时间" prop="hireDate">
|
||||
<el-date-picker v-model="form.hireDate" type="date" placeholder="选择入职时间" value-format="yyyy-MM-dd" style="width: 100%" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" />
|
||||
</el-row>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-radio-group v-model="form.status">
|
||||
@@ -318,6 +327,9 @@
|
||||
<el-descriptions-item label="所属部门">{{ employeeDetail.deptName || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="身份证号">{{ employeeDetail.idCard || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="电话">{{ employeeDetail.phone || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="年收入">
|
||||
{{ employeeDetail.annualIncome !== null && employeeDetail.annualIncome !== undefined && employeeDetail.annualIncome !== '' ? employeeDetail.annualIncome : '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="入职时间">
|
||||
{{ employeeDetail.hireDate ? parseTime(employeeDetail.hireDate, '{y}-{m}-{d}') : '-' }}
|
||||
</el-descriptions-item>
|
||||
@@ -453,6 +465,7 @@
|
||||
<el-table-column label="柜员号" prop="staffId" align="center" />
|
||||
<el-table-column label="身份证号" prop="idCard" align="center" />
|
||||
<el-table-column label="电话" prop="phone" align="center" />
|
||||
<el-table-column label="年收入" prop="annualIncome" align="center" width="140" />
|
||||
<el-table-column label="失败原因" prop="errorMessage" align="center" min-width="200" :show-overflow-tooltip="true" />
|
||||
</el-table>
|
||||
|
||||
@@ -606,6 +619,9 @@ export default {
|
||||
{ required: true, message: "电话不能为空", trigger: "blur" },
|
||||
{ pattern: phonePattern, message: "请输入正确的11位手机号", trigger: "blur" }
|
||||
],
|
||||
annualIncome: [
|
||||
{ validator: (rule, value, callback) => this.validateAnnualIncomeRule(value, callback, "年收入"), trigger: "blur" }
|
||||
],
|
||||
status: [
|
||||
{ required: true, message: "请选择状态", trigger: "change" }
|
||||
]
|
||||
@@ -938,6 +954,7 @@ export default {
|
||||
deptId: null,
|
||||
idCard: null,
|
||||
phone: null,
|
||||
annualIncome: null,
|
||||
hireDate: null,
|
||||
status: "0",
|
||||
relatives: [],
|
||||
@@ -945,6 +962,36 @@ export default {
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
normalizeAnnualIncome(value) {
|
||||
if (value === null || value === undefined) {
|
||||
return null;
|
||||
}
|
||||
const normalized = String(value).trim();
|
||||
return normalized === "" ? null : normalized;
|
||||
},
|
||||
validateAnnualIncome(value, fieldLabel = "年收入") {
|
||||
const normalized = this.normalizeAnnualIncome(value);
|
||||
if (normalized === null) {
|
||||
return true;
|
||||
}
|
||||
if (!/^\d+(\.\d{1,2})?$/.test(normalized)) {
|
||||
this.$modal.msgError(`${fieldLabel}格式不正确,需为非负金额且最多保留2位小数`);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
validateAnnualIncomeRule(value, callback, fieldLabel = "年收入") {
|
||||
const normalized = this.normalizeAnnualIncome(value);
|
||||
if (normalized === null) {
|
||||
callback();
|
||||
return;
|
||||
}
|
||||
if (!/^\d+(\.\d{1,2})?$/.test(normalized)) {
|
||||
callback(new Error(`${fieldLabel}格式不正确,需为非负金额且最多保留2位小数`));
|
||||
return;
|
||||
}
|
||||
callback();
|
||||
},
|
||||
normalizeAssetInfoList() {
|
||||
const assetInfoList = Array.isArray(this.form.assetInfoList)
|
||||
? this.form.assetInfoList
|
||||
@@ -1114,6 +1161,7 @@ export default {
|
||||
...response.data,
|
||||
assetInfoList: response.data.assetInfoList || []
|
||||
};
|
||||
this.form.annualIncome = response.data.annualIncome;
|
||||
this.open = true;
|
||||
this.title = "编辑员工";
|
||||
});
|
||||
@@ -1123,18 +1171,27 @@ export default {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
this.form.assetInfoList = this.normalizeAssetInfoList();
|
||||
if (!this.validateAssetInfoList(this.form.assetInfoList)) {
|
||||
const payload = {
|
||||
...this.form,
|
||||
assetInfoList: this.form.assetInfoList
|
||||
};
|
||||
payload.annualIncome = this.normalizeAnnualIncome(payload.annualIncome);
|
||||
this.form.assetInfoList = payload.assetInfoList;
|
||||
if (!this.validateAnnualIncome(payload.annualIncome, "年收入")) {
|
||||
return;
|
||||
}
|
||||
if (!this.validateAssetInfoList(payload.assetInfoList)) {
|
||||
return;
|
||||
}
|
||||
if (this.isAdd) {
|
||||
addBaseStaff(this.form).then(response => {
|
||||
addBaseStaff(payload).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.isAdd = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
updateBaseStaff(this.form).then(response => {
|
||||
updateBaseStaff(payload).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
|
||||
Reference in New Issue
Block a user