Selaa lähdekoodia

考勤明细出勤情况配色调整

lihaiting 1 viikko sitten
vanhempi
commit
c11736bb51
1 muutettua tiedostoa jossa 21 lisäystä ja 5 poistoa
  1. 21 5
      src/views/attendance/daily/index.vue

+ 21 - 5
src/views/attendance/daily/index.vue

@@ -51,7 +51,8 @@
         <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(row.statusList[index])" class="punch-tag">
+            <el-tag size="mini" :type="attendanceStatusTagType(row.statusList[index])"
+              :style="attendanceStatusTagStyle(row.statusList[index])" class="punch-tag">
               {{ name }}
             </el-tag>
           </div>
@@ -216,6 +217,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: {
@@ -357,14 +367,20 @@ export default {
         MISSING_IN: 'warning',
         MISSING_OUT: 'warning',
         ABSENT: 'danger',
+        /* 请假回内置 info 灰;出差/外出/加班走 EXTRA_STATUS_TAG_STYLE 自定义色,
+           不套内置 type(否则底色被覆盖成灰) */
         LEAVE: 'info',
-        BUSINESS_TRIP: 'info',
-        OUTING: 'info',
-        OVERTIME: 'info',
+        BUSINESS_TRIP: '',
+        OUTING: '',
+        OVERTIME: '',
       };
       const value = String(code || '');
       if (!value) return 'info';
-      return types[value] || 'info';
+      return Object.prototype.hasOwnProperty.call(types, value) ? types[value] : '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);