|
|
@@ -38,8 +38,11 @@
|
|
|
<ele-pro-table ref="table" row-key="id" :columns="columns" :datasource="fetchPage" :need-page="true"
|
|
|
:page-size="20" :page-sizes="[10, 20, 50]" :cache-key="$tableCacheKey('hr-attendance-daily-v9')">
|
|
|
<template v-slot:toolbar>
|
|
|
- <el-button icon="el-icon-upload2" @click="onImport">导入excel</el-button>
|
|
|
- <el-button type="primary" icon="el-icon-download" @click="onExport">excel导出</el-button>
|
|
|
+ <!-- 导入/导出按钮权限:统一用 hr:hrAttendanceRuleDaily:importExcel(2026-11-12 用户指定) -->
|
|
|
+ <el-button v-if="$hasPermission('hr:hrAttendanceRuleDaily:importExcel')" icon="el-icon-upload2"
|
|
|
+ @click="onImport">导入excel</el-button>
|
|
|
+ <el-button v-if="$hasPermission('hr:hrAttendanceRuleDaily:importExcel')" type="primary" icon="el-icon-download"
|
|
|
+ @click="onExport">excel导出</el-button>
|
|
|
</template>
|
|
|
|
|
|
<template slot="name" slot-scope="{ row }">
|
|
|
@@ -49,8 +52,10 @@
|
|
|
</template>
|
|
|
|
|
|
<template slot="statusNameList" slot-scope="{ row }">
|
|
|
+ <!-- 文案直取后端中文 statusNameList;颜色按同序英文码 statusList 判断(2026-11-11 用户口径) -->
|
|
|
<div v-for="(name, index) in row.statusNameList" :key="index" class="status-tag-line">
|
|
|
- <el-tag size="mini" :type="attendanceStatusTagType(name)" class="punch-tag">
|
|
|
+ <el-tag size="mini" :type="attendanceStatusTagType(row.statusList[index])"
|
|
|
+ :style="attendanceStatusTagStyle(row.statusList[index])" class="punch-tag">
|
|
|
{{ name }}
|
|
|
</el-tag>
|
|
|
</div>
|
|
|
@@ -215,6 +220,15 @@ const STATUS_OPTIONS = [
|
|
|
{ value: 'OVERTIME', label: '加班' },
|
|
|
];
|
|
|
|
|
|
+/* 出差蓝色、外出青色、加班用另一种绿(不与「正常」的 success 绿撞色);请假回内置 info 灰。
|
|
|
+ (2026-11-11 用户指定)内置 el-tag 四色不够区分,自定义色的用浅底 + 同色系文字/边框。
|
|
|
+ 纯展示配色,不参与数据判断;色值可直接在此调整。 */
|
|
|
+const EXTRA_STATUS_TAG_STYLE = {
|
|
|
+ BUSINESS_TRIP: { backgroundColor: '#ecf5ff', borderColor: '#b3d8ff', color: '#409EFF' }, // 蓝
|
|
|
+ OUTING: { backgroundColor: '#e6fffb', borderColor: '#87e8de', color: '#08979C' }, // 青(待用户看图确认)
|
|
|
+ OVERTIME: { backgroundColor: '#e8f7ef', borderColor: '#a8e0c2', color: '#0F9D58' }, // 翡翠绿,区别于正常 success 绿
|
|
|
+};
|
|
|
+
|
|
|
export default {
|
|
|
name: 'AttendanceDaily',
|
|
|
components: {
|
|
|
@@ -335,20 +349,41 @@ export default {
|
|
|
return { list: this.currentRows, count: data.count };
|
|
|
},
|
|
|
punchStatusTagType(item) {
|
|
|
- /* 文案与色值均按后端中文字段判断:statusName=有效/已作废/地点异常,sourceType=移动端/考勤设备/补卡 */
|
|
|
- if (item.sourceType === '补卡' || item.statusText === '已作废') return 'danger';
|
|
|
- if (item.statusText === '有效') return 'success';
|
|
|
- if (item.statusText === '待审批') return 'warning';
|
|
|
- return 'info';
|
|
|
+ /* 打卡状态 tag 颜色按 punchRecords[].status 原始码判断(2026-11-11 用户口径):
|
|
|
+ VALID = 正常 → 绿色 success;其它码 = 异常 → 红色 danger。
|
|
|
+ status 未返回时没有判定依据 → 灰色 info,绝不把「字段缺失」当成异常;
|
|
|
+ 文案仍是后端中文 statusName 直取,未返回就留空,前端不兜底。 */
|
|
|
+ const code = String(item.status || '');
|
|
|
+ if (!code) return 'info';
|
|
|
+ return code === 'VALID' ? 'success' : 'danger';
|
|
|
+ },
|
|
|
+ /* 出勤情况 tag 颜色:按行级 statusList 英文码判断(2026-11-11 用户口径:英文值判色、
|
|
|
+ 中文 statusNameList 显示)。两者同序,按 index 配对。
|
|
|
+ 码表 = 用户提供的 AttendanceConstants.DAILY_*(前 6 项,实际字符串按本页 STATUS_OPTIONS
|
|
|
+ 一直在用的 NORMAL/LATE/EARLY_LEAVE/MISSING_IN/MISSING_OUT/ABSENT)+ LEAVE/BUSINESS_TRIP/OUTING/OVERTIME。
|
|
|
+ 码未返回、两数组不同序或出现码表外的值 → 灰(没有配色依据),不把缺失/未知当成异常。 */
|
|
|
+ attendanceStatusTagType(code) {
|
|
|
+ const types = {
|
|
|
+ NORMAL: 'success',
|
|
|
+ LATE: 'warning',
|
|
|
+ EARLY_LEAVE: 'warning',
|
|
|
+ MISSING_IN: 'warning',
|
|
|
+ MISSING_OUT: 'warning',
|
|
|
+ ABSENT: 'danger',
|
|
|
+ /* 请假回内置 info 灰;出差/外出/加班走 EXTRA_STATUS_TAG_STYLE 自定义色,
|
|
|
+ 不套内置 type(否则底色被覆盖成灰) */
|
|
|
+ LEAVE: 'info',
|
|
|
+ BUSINESS_TRIP: '',
|
|
|
+ OUTING: '',
|
|
|
+ OVERTIME: '',
|
|
|
+ };
|
|
|
+ const value = String(code || '');
|
|
|
+ if (!value) return 'info';
|
|
|
+ return Object.prototype.hasOwnProperty.call(types, value) ? types[value] : 'info';
|
|
|
},
|
|
|
- /* 出勤情况 tag 颜色:按后端状态中文字段判断(正常=绿,迟到/早退/缺卡=橙,旷工=红,其他=灰) */
|
|
|
- attendanceStatusTagType(name) {
|
|
|
- const text = String(name || '');
|
|
|
- if (!text) return 'info';
|
|
|
- if (text.includes('正常')) return 'success';
|
|
|
- if (text.includes('旷工')) return 'danger';
|
|
|
- if (text.includes('迟到') || text.includes('早退') || text.includes('缺')) return 'warning';
|
|
|
- return 'info';
|
|
|
+ /* 四个自定义色:返回 el-tag 的 inline style;其余码返回 null,Vue 不追加样式 */
|
|
|
+ attendanceStatusTagStyle(code) {
|
|
|
+ return EXTRA_STATUS_TAG_STYLE[String(code || '')] || null;
|
|
|
},
|
|
|
minuteText(value) {
|
|
|
return value === null || value === undefined ? '' : String(value);
|