1.完成生产管理-电量分析静态界面
2.完成综合管理-人员排班管理交互 3.修改部分逻辑和样式
This commit is contained in:
@ -26,6 +26,15 @@
|
||||
<div class="week-day">{{ dateInfo.weekDay }}</div>
|
||||
</div>
|
||||
</template>
|
||||
<template #default="scope">
|
||||
<div
|
||||
class="schedule-cell"
|
||||
:style="{ color: getShiftColor(scope.row[`day${index + 1}`]) }"
|
||||
@click="handleCellClick(scope.row, {...dateInfo, index}, scope)"
|
||||
>
|
||||
{{ scope.row[`day${index + 1}`] }}
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
@ -34,6 +43,10 @@
|
||||
<script lang="ts" setup>
|
||||
import { ref, computed, onMounted } from 'vue';
|
||||
|
||||
const emit = defineEmits<{
|
||||
'edit-schedule': [rowData: any, columnData: any, cellEvent: any]
|
||||
}>();
|
||||
|
||||
// 员工列表
|
||||
const employees = [
|
||||
{ name: '张三', position: '水泥工', weeklyHours: 142 },
|
||||
@ -51,6 +64,19 @@ const employees = [
|
||||
// 排班类型
|
||||
const shifts = ['早班', '中班', '晚班', '休息'];
|
||||
|
||||
// 排班类型与颜色的映射关系
|
||||
const shiftColorMap = {
|
||||
'早班': '#67c23a', // 绿色
|
||||
'中班': '#e6a23c', // 橙色
|
||||
'晚班': '#409eff', // 蓝色
|
||||
'休息': '#909399' // 灰色
|
||||
};
|
||||
|
||||
// 根据排班类型获取对应的颜色
|
||||
const getShiftColor = (shiftType: string) => {
|
||||
return shiftColorMap[shiftType as keyof typeof shiftColorMap] || '#333';
|
||||
};
|
||||
|
||||
// 获取当前月的日期信息
|
||||
const currentMonthDates = ref<any[]>([]);
|
||||
|
||||
@ -112,6 +138,11 @@ const scheduleData = computed(() => {
|
||||
onMounted(() => {
|
||||
currentMonthDates.value = getCurrentMonthDates();
|
||||
});
|
||||
|
||||
// 处理单元格点击事件
|
||||
const handleCellClick = (rowData: any, columnData: any, cellEvent: any) => {
|
||||
emit('edit-schedule', rowData, columnData, cellEvent);
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
@ -165,6 +196,18 @@ onMounted(() => {
|
||||
padding: 8px 0;
|
||||
}
|
||||
|
||||
/* 排班单元格样式 */
|
||||
.schedule-cell {
|
||||
padding: 8px 0;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
.schedule-cell:hover {
|
||||
background-color: #f5f7fa;
|
||||
transform: scale(1.05);
|
||||
}
|
||||
|
||||
.date-number {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
|
||||
Reference in New Issue
Block a user