11
This commit is contained in:
@@ -851,7 +851,8 @@ export const onboardingTaskApi = {
|
||||
uploadEmployeeAttachment(params: FormData) {
|
||||
return moduleRequest("/biz/onboarding/employee/").post<number>(
|
||||
"attachment/upload",
|
||||
params
|
||||
params,
|
||||
{ cancel: false, loading: false }
|
||||
);
|
||||
},
|
||||
|
||||
|
||||
@@ -20,6 +20,16 @@
|
||||
办理转正
|
||||
</el-button>
|
||||
</template>
|
||||
<template #companyName="scope">
|
||||
<div class="org-position-cell">
|
||||
<div class="company-title">{{ scope.row.companyName || '-' }}</div>
|
||||
<div class="dept-pos-desc">
|
||||
<span class="dept-text">{{ scope.row.departmentName || '-' }}</span>
|
||||
<span class="divider">/</span>
|
||||
<span class="pos-text">{{ scope.row.positionName || '-' }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template #employmentType="scope">
|
||||
<el-tag :type="scope.row.employmentType === 'part_time' ? 'warning' : 'primary'" effect="plain">
|
||||
{{ employmentTypeText(scope.row.employmentType) }}
|
||||
@@ -61,6 +71,7 @@
|
||||
<span>所属部门:{{ detail.employee.departmentName || "-" }}</span>
|
||||
<span>所属岗位:{{ detail.employee.positionName || "-" }}</span>
|
||||
<span>入职日期:{{ formatDate(detail.employee.entryDate) }}</span>
|
||||
<span>员工司龄:{{ formatSeniority(detail.employee.entryDate) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -120,6 +131,7 @@
|
||||
}}</el-descriptions-item>
|
||||
<el-descriptions-item label="员工编号">{{ detail.employee.employeeNo || employeeInfo.employeeNo || "-" }}</el-descriptions-item>
|
||||
<el-descriptions-item label="入职日期">{{ formatDate(detail.employee.entryDate) }}</el-descriptions-item>
|
||||
<el-descriptions-item label="员工司龄">{{ formatSeniority(detail.employee.entryDate) }}</el-descriptions-item>
|
||||
<el-descriptions-item label="用工类型">{{ employmentTypeText(detail.employee.employmentType) }}</el-descriptions-item>
|
||||
<el-descriptions-item label="转正状态">{{ regularizationText(detail.employee.regularizationStatus) }}</el-descriptions-item>
|
||||
<el-descriptions-item label="转正日期">{{ formatDate(detail.employee.regularizationDate) }}</el-descriptions-item>
|
||||
@@ -809,18 +821,8 @@ const columns: ColumnProps<OnboardingEmployee>[] = [
|
||||
},
|
||||
{
|
||||
prop: "companyName",
|
||||
label: "所属公司",
|
||||
minWidth: 180
|
||||
},
|
||||
{
|
||||
prop: "departmentName",
|
||||
label: "所属部门",
|
||||
minWidth: 140
|
||||
},
|
||||
{
|
||||
prop: "positionName",
|
||||
label: "所属岗位",
|
||||
minWidth: 140
|
||||
label: "所属公司 / 部门 / 岗位",
|
||||
minWidth: 220
|
||||
},
|
||||
{
|
||||
prop: "phone",
|
||||
@@ -831,9 +833,15 @@ const columns: ColumnProps<OnboardingEmployee>[] = [
|
||||
{
|
||||
prop: "entryDate",
|
||||
label: "入职日期",
|
||||
minWidth: 140,
|
||||
minWidth: 130,
|
||||
render: scope => formatDate(scope.row.entryDate)
|
||||
},
|
||||
{
|
||||
prop: "seniority",
|
||||
label: "员工司龄",
|
||||
minWidth: 160,
|
||||
render: scope => formatSeniority(scope.row.entryDate)
|
||||
},
|
||||
{
|
||||
prop: "regularizationStatus",
|
||||
label: "转正状态",
|
||||
@@ -937,6 +945,60 @@ const formatDate = (timeStr?: string) => {
|
||||
return timeStr.replace("T", " ").substring(0, 10);
|
||||
};
|
||||
|
||||
const formatSeniority = (timeStr?: string) => {
|
||||
if (!timeStr) return "-";
|
||||
const match = String(timeStr).match(/^(\d{4})[-/](\d{1,2})[-/](\d{1,2})/);
|
||||
if (!match) return "-";
|
||||
|
||||
const startYear = Number(match[1]);
|
||||
const startMonth = Number(match[2]);
|
||||
const startDay = Number(match[3]);
|
||||
|
||||
const now = new Date();
|
||||
const currentYear = now.getFullYear();
|
||||
const currentMonth = now.getMonth() + 1;
|
||||
const currentDay = now.getDate();
|
||||
|
||||
const startDate = new Date(startYear, startMonth - 1, startDay);
|
||||
const currentDate = new Date(currentYear, currentMonth - 1, currentDay);
|
||||
|
||||
const diffMs = currentDate.getTime() - startDate.getTime();
|
||||
if (diffMs < 0) return "未到入职日";
|
||||
|
||||
const totalDays = Math.round(diffMs / (1000 * 60 * 60 * 24));
|
||||
|
||||
let years = currentYear - startYear;
|
||||
let months = currentMonth - startMonth;
|
||||
let days = currentDay - startDay;
|
||||
|
||||
if (days < 0) {
|
||||
months -= 1;
|
||||
const prevMonthDays = new Date(currentYear, currentMonth - 1, 0).getDate();
|
||||
days += prevMonthDays;
|
||||
}
|
||||
|
||||
if (months < 0) {
|
||||
years -= 1;
|
||||
months += 12;
|
||||
}
|
||||
|
||||
// 区间1:不满一个月
|
||||
if (years === 0 && months === 0) {
|
||||
return `${totalDays}天`;
|
||||
}
|
||||
|
||||
// 区间2:满一个月,不满一年
|
||||
if (years === 0) {
|
||||
const text = days > 0 ? `${months}个月${days}天` : `${months}个月`;
|
||||
return `${text}(${totalDays}天)`;
|
||||
}
|
||||
|
||||
// 区间3:满一年及以上
|
||||
// 零头天数不展示,仅展示年和月(若月为0则只展示年),最后附带总天数
|
||||
const text = months > 0 ? `${years}年${months}个月` : `${years}年`;
|
||||
return `${text}(${totalDays}天)`;
|
||||
};
|
||||
|
||||
async function showDetail(row: OnboardingEmployee) {
|
||||
const { data } = await onboardingTaskApi.employeeDetail({
|
||||
id: row.id
|
||||
@@ -1063,10 +1125,10 @@ async function uploadRegularizationFile(options: UploadRequestOptions) {
|
||||
const formData = new FormData();
|
||||
formData.append("file", options.file);
|
||||
const { data } = await onboardingTaskApi.uploadEmployeeAttachment(formData);
|
||||
options.onSuccess({ fileId: data });
|
||||
return { fileId: data };
|
||||
} catch (error: any) {
|
||||
options.onError(error as any);
|
||||
ElMessage.error(error?.msg || error?.message || "材料上传失败");
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1553,4 +1615,38 @@ onBeforeUnmount(clearMaterialPreviews);
|
||||
color: #dc2626;
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
.org-position-cell {
|
||||
line-height: 1.45;
|
||||
padding: 2px 0;
|
||||
}
|
||||
|
||||
.org-position-cell .company-title {
|
||||
font-weight: 600;
|
||||
color: var(--el-text-color-primary);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.org-position-cell .dept-pos-desc {
|
||||
font-size: 12px;
|
||||
margin-top: 2px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.org-position-cell .dept-text {
|
||||
color: var(--el-text-color-secondary);
|
||||
}
|
||||
|
||||
.org-position-cell .divider {
|
||||
color: var(--el-border-color-darker);
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.org-position-cell .pos-text {
|
||||
color: var(--el-color-primary);
|
||||
font-weight: 500;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user