| | |
| | | @keyup.enter="refreshTable()" /> |
| | | </div> |
| | | <div class="search-item"> |
| | | <el-tree-select v-model="query.deptId" |
| | | <el-tree-select v-model="query.sysDeptId" |
| | | :data="deptOptions" |
| | | :props="{ value: 'id', label: 'label', children: 'children' }" |
| | | value-key="id" |
| | |
| | | <div class="search-actions"> |
| | | <el-button size="small" |
| | | type="primary" |
| | | @click="refreshTable()" |
| | | :icon="Search"> |
| | | @click="refreshTable()"> |
| | | 查询 |
| | | </el-button> |
| | | <el-button size="small" |
| | | @click="refresh()" |
| | | :icon="Refresh" |
| | | style="margin-left: 8px"> |
| | | 重置 |
| | | </el-button> |
| | |
| | | <div class="search-buttons"> |
| | | <el-button size="small" |
| | | type="primary" |
| | | @click="configTime" |
| | | :icon="Setting"> |
| | | @click="configTime"> |
| | | 班次配置 |
| | | </el-button> |
| | | <el-button size="small" |
| | | type="success" |
| | | @click="handleDown" |
| | | :loading="downLoading" |
| | | :icon="Download" |
| | | style="margin-left: 8px"> |
| | | 导出 |
| | | </el-button> |
| | | <el-button size="small" |
| | | type="warning" |
| | | @click="schedulingVisible = true" |
| | | :icon="Calendar" |
| | | style="margin-left: 8px"> |
| | | 排班 |
| | | </el-button> |
| | |
| | | :key="'d' + i"> |
| | | <el-dropdown trigger="click" |
| | | placement="bottom" |
| | | @command="(e) => handleCommand(e, m)" |
| | | :disabled="isCellBlockedByLeaveDate(item, m)" |
| | | @command="(e) => handleCommand(e, item, m)" |
| | | class="shift-dropdown"> |
| | | <div class="shift-box" |
| | | :class="{ |
| | | 'shift-box-early': m.shift === '0', |
| | | 'shift-box-mid': m.shift === '1', |
| | | 'shift-box-night': m.shift === '2', |
| | | 'shift-box-rest': m.shift === '3', |
| | | 'shift-box-leave': m.shift === '4', |
| | | 'shift-box-other': m.shift === '5', |
| | | 'shift-box-business': m.shift === '6', |
| | | 'shift-box-early': m.shift === '早班', |
| | | 'shift-box-mid': m.shift === '中班', |
| | | 'shift-box-night': m.shift === '夜班', |
| | | 'shift-box-rest': !m.shift || m.shift === '休息', |
| | | 'shift-box-leave': m.shift === '请假', |
| | | 'shift-box-other': m.shift === '夜11', |
| | | 'shift-box-business': m.shift === '夜12', |
| | | }"> |
| | | <span class="shift-text">{{ getShiftByDic(m.shift) || '—' }}</span> |
| | | <span class="shift-text">{{ getShiftNameByValue(m.shift) || '休息' }}</span> |
| | | </div> |
| | | <template #dropdown> |
| | | <el-dropdown-menu> |
| | | <el-dropdown-item v-for="(n, j) in classType" |
| | | :key="'h' + j" |
| | | :command="n.id">{{ n.locationName |
| | | :command="n.id">{{ n.shift || '—' |
| | | }}</el-dropdown-item> |
| | | </el-dropdown-menu> |
| | | </template> |
| | |
| | | </div> --> |
| | | <div class="user-total"> |
| | | <span class="total-label">合计出勤:</span> |
| | | <span class="total-value">{{ item.work_time }}天</span> |
| | | <span class="total-value">{{ item.year.totalYearAttendance }}天</span> |
| | | </div> |
| | | </div> |
| | | </div> |
| | |
| | | <div class="search_thing"> |
| | | <div class="search_label" |
| | | style="width: 90px"> |
| | | <span style="color: red; margin-right: 4px">*</span>部门: |
| | | </div> |
| | | <div class="search_input"> |
| | | <el-tree-select v-model="schedulingQuery.deptId" |
| | | :data="deptOptions" |
| | | :props="{ value: 'id', label: 'label', children: 'children' }" |
| | | value-key="id" |
| | | placeholder="请选择部门" |
| | | check-strictly |
| | | clearable |
| | | @change="onSchedulingDeptChange" |
| | | style="width: 100%" /> |
| | | </div> |
| | | </div> |
| | | <div class="search_thing"> |
| | | <div class="search_label" |
| | | style="width: 90px"> |
| | | <span style="color: red; margin-right: 4px">*</span>人员名称: |
| | | </div> |
| | | <div class="search_input"> |
| | |
| | | style="width: 100%" |
| | | multiple |
| | | clearable |
| | | collapse-tags> |
| | | collapse-tags |
| | | :disabled="!schedulingQuery.deptId"> |
| | | <el-option v-for="item in personList" |
| | | :key="item.userId" |
| | | :label="item.nickName" |
| | | :value="item.userId"> |
| | | :key="item.id" |
| | | :label="item.staffName" |
| | | :value="item.id"> |
| | | </el-option> |
| | | </el-select> |
| | | </div> |
| | |
| | | <div class="search_input"> |
| | | <el-select v-model="schedulingQuery.shift" |
| | | placeholder="请选择" |
| | | style="width: 100%"> |
| | | <el-option v-for="item in classType" |
| | | style="width: 100%" |
| | | :disabled="!schedulingQuery.deptId"> |
| | | <el-option v-for="item in schedulingClassType" |
| | | :key="item.id" |
| | | :label="item.locationName" |
| | | :label="getShiftNameByValue(item.shift)" |
| | | :value="item.id"> |
| | | </el-option> |
| | | </el-select> |
| | |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, reactive, onMounted, getCurrentInstance } from "vue"; |
| | | import { |
| | | ref, |
| | | reactive, |
| | | computed, |
| | | watch, |
| | | onMounted, |
| | | getCurrentInstance, |
| | | } from "vue"; |
| | | import { useRouter } from "vue-router"; |
| | | import { |
| | | page, |
| | |
| | | add, |
| | | exportFile, |
| | | update, |
| | | selectUserCondition, |
| | | staffOnJobListPage, |
| | | } from "@/api/personnelManagement/class"; |
| | | import { findStaffLeaveListPage } from "@/api/personnelManagement/staffLeave.js"; |
| | | import { deptTreeSelect } from "@/api/system/user.js"; |
| | | import { getAttendanceRules } from "@/api/personnelManagement/attendanceRules.js"; |
| | | import { useDict } from "@/utils/dict"; |
| | | const { proxy } = getCurrentInstance(); |
| | | const router = useRouter(); |
| | | |
| | | // 查询条件 |
| | | const query = reactive({ |
| | | userName: "", |
| | | deptId: "", |
| | | sysDeptId: "", |
| | | year: new Date(), |
| | | month: new Date().getMonth() + 1, |
| | | }); |
| | | |
| | | // 获取班次字典值 |
| | | const { shifts_list } = useDict("shifts_list"); |
| | | // 月份选项 |
| | | const monthOptions = [ |
| | | { value: 1, label: "1月" }, |
| | |
| | | const deptOptions = ref([]); |
| | | |
| | | // 周列表 |
| | | const weeks = ref([ |
| | | { weekNum: 1, week: "周一", day: "01" }, |
| | | { weekNum: 1, week: "周二", day: "02" }, |
| | | { weekNum: 1, week: "周三", day: "03" }, |
| | | { weekNum: 1, week: "周四", day: "04" }, |
| | | { weekNum: 1, week: "周五", day: "05" }, |
| | | { weekNum: 1, week: "周六", day: "06" }, |
| | | { weekNum: 2, week: "周日", day: "07" }, |
| | | { weekNum: 2, week: "周一", day: "08" }, |
| | | { weekNum: 2, week: "周二", day: "09" }, |
| | | { weekNum: 2, week: "周三", day: "10" }, |
| | | { weekNum: 2, week: "周四", day: "11" }, |
| | | { weekNum: 2, week: "周五", day: "12" }, |
| | | { weekNum: 2, week: "周六", day: "13" }, |
| | | { weekNum: 3, week: "周日", day: "14" }, |
| | | { weekNum: 3, week: "周一", day: "15" }, |
| | | { weekNum: 3, week: "周二", day: "16" }, |
| | | { weekNum: 3, week: "周三", day: "17" }, |
| | | { weekNum: 3, week: "周四", day: "18" }, |
| | | { weekNum: 3, week: "周五", day: "19" }, |
| | | { weekNum: 3, week: "周六", day: "20" }, |
| | | { weekNum: 4, week: "周日", day: "21" }, |
| | | { weekNum: 4, week: "周一", day: "22" }, |
| | | { weekNum: 4, week: "周二", day: "23" }, |
| | | { weekNum: 4, week: "周三", day: "24" }, |
| | | { weekNum: 4, week: "周四", day: "25" }, |
| | | { weekNum: 4, week: "周五", day: "26" }, |
| | | { weekNum: 4, week: "周六", day: "27" }, |
| | | { weekNum: 5, week: "周日", day: "28" }, |
| | | { weekNum: 5, week: "周一", day: "29" }, |
| | | { weekNum: 5, week: "周二", day: "30" }, |
| | | ]); |
| | | const weeks = ref([]); |
| | | |
| | | // 班次类型 |
| | | const classType = ref([]); |
| | |
| | | |
| | | // 人员列表 |
| | | const personList = ref([]); |
| | | const personListAll = ref([]); |
| | | const leaveDateMap = ref({}); |
| | | |
| | | // 加载状态 |
| | | const loading = ref(false); |
| | |
| | | // 排班查询条件 |
| | | const schedulingQuery = reactive({ |
| | | week: "", |
| | | deptId: "", |
| | | userId: null, |
| | | shift: "", |
| | | }); |
| | | |
| | | const schedulingClassType = computed(() => { |
| | | if (!schedulingQuery.deptId) return classType.value || []; |
| | | return (classType.value || []).filter(item => { |
| | | if (["998", "999"].includes(String(item?.id))) return true; |
| | | const itemDeptId = item.deptId ?? item.sysDeptId ?? item.dept_id; |
| | | return String(itemDeptId) === String(schedulingQuery.deptId); |
| | | }); |
| | | }); |
| | | |
| | | // 列表数据 |
| | | const listForm = ref([ |
| | | { |
| | | id: 1, |
| | | name: "张三", |
| | | monthlyAttendance: { |
| | | totalAttendance: 22, |
| | | 早班: 10, |
| | | 中班: 8, |
| | | 夜班: 4, |
| | | 休息: 6, |
| | | 请假: 0, |
| | | 出差: 0, |
| | | }, |
| | | day0: 10, |
| | | day1: 8, |
| | | day2: 4, |
| | | day3: 6, |
| | | day4: 0, |
| | | day6: 0, |
| | | list: [ |
| | | { id: 1, shift: "0" }, |
| | | { id: 2, shift: "0" }, |
| | | { id: 3, shift: "1" }, |
| | | { id: 4, shift: "1" }, |
| | | { id: 5, shift: "2" }, |
| | | { id: 6, shift: "2" }, |
| | | { id: 7, shift: "3" }, |
| | | { id: 8, shift: "0" }, |
| | | { id: 9, shift: "0" }, |
| | | { id: 10, shift: "1" }, |
| | | { id: 11, shift: "1" }, |
| | | { id: 12, shift: "2" }, |
| | | { id: 13, shift: "2" }, |
| | | { id: 14, shift: "3" }, |
| | | { id: 15, shift: "0" }, |
| | | { id: 16, shift: "0" }, |
| | | { id: 17, shift: "1" }, |
| | | { id: 18, shift: "1" }, |
| | | { id: 19, shift: "2" }, |
| | | { id: 20, shift: "2" }, |
| | | { id: 21, shift: "3" }, |
| | | { id: 22, shift: "0" }, |
| | | { id: 23, shift: "0" }, |
| | | { id: 24, shift: "1" }, |
| | | { id: 25, shift: "1" }, |
| | | { id: 26, shift: "2" }, |
| | | { id: 27, shift: "2" }, |
| | | { id: 28, shift: "3" }, |
| | | { id: 29, shift: "0" }, |
| | | { id: 30, shift: "0" }, |
| | | ], |
| | | }, |
| | | { |
| | | id: 2, |
| | | name: "李四", |
| | | monthlyAttendance: { |
| | | totalAttendance: 20, |
| | | 早班: 8, |
| | | 中班: 6, |
| | | 夜班: 6, |
| | | 休息: 8, |
| | | 请假: 2, |
| | | 出差: 0, |
| | | }, |
| | | day0: 8, |
| | | day1: 6, |
| | | day2: 6, |
| | | day3: 8, |
| | | day4: 2, |
| | | day6: 0, |
| | | list: [ |
| | | { id: 31, shift: "1" }, |
| | | { id: 32, shift: "1" }, |
| | | { id: 33, shift: "2" }, |
| | | { id: 34, shift: "2" }, |
| | | { id: 35, shift: "3" }, |
| | | { id: 36, shift: "0" }, |
| | | { id: 37, shift: "0" }, |
| | | { id: 38, shift: "1" }, |
| | | { id: 39, shift: "1" }, |
| | | { id: 40, shift: "2" }, |
| | | { id: 41, shift: "2" }, |
| | | { id: 42, shift: "3" }, |
| | | { id: 43, shift: "0" }, |
| | | { id: 44, shift: "0" }, |
| | | { id: 45, shift: "1" }, |
| | | { id: 46, shift: "1" }, |
| | | { id: 47, shift: "2" }, |
| | | { id: 48, shift: "2" }, |
| | | { id: 49, shift: "3" }, |
| | | { id: 50, shift: "0" }, |
| | | { id: 51, shift: "0" }, |
| | | { id: 52, shift: "4" }, |
| | | { id: 53, shift: "4" }, |
| | | { id: 54, shift: "1" }, |
| | | { id: 55, shift: "1" }, |
| | | { id: 56, shift: "2" }, |
| | | { id: 57, shift: "2" }, |
| | | { id: 58, shift: "3" }, |
| | | { id: 59, shift: "0" }, |
| | | { id: 60, shift: "0" }, |
| | | ], |
| | | }, |
| | | { |
| | | id: 3, |
| | | name: "王五", |
| | | monthlyAttendance: { |
| | | totalAttendance: 23, |
| | | 早班: 9, |
| | | 中班: 9, |
| | | 夜班: 5, |
| | | 休息: 5, |
| | | 请假: 0, |
| | | 出差: 2, |
| | | }, |
| | | day0: 9, |
| | | day1: 9, |
| | | day2: 5, |
| | | day3: 5, |
| | | day4: 0, |
| | | day6: 2, |
| | | list: [ |
| | | { id: 61, shift: "2" }, |
| | | { id: 62, shift: "2" }, |
| | | { id: 63, shift: "3" }, |
| | | { id: 64, shift: "0" }, |
| | | { id: 65, shift: "0" }, |
| | | { id: 66, shift: "1" }, |
| | | { id: 67, shift: "1" }, |
| | | { id: 68, shift: "2" }, |
| | | { id: 69, shift: "2" }, |
| | | { id: 70, shift: "3" }, |
| | | { id: 71, shift: "0" }, |
| | | { id: 72, shift: "0" }, |
| | | { id: 73, shift: "1" }, |
| | | { id: 74, shift: "1" }, |
| | | { id: 75, shift: "2" }, |
| | | { id: 76, shift: "2" }, |
| | | { id: 77, shift: "3" }, |
| | | { id: 78, shift: "0" }, |
| | | { id: 79, shift: "0" }, |
| | | { id: 80, shift: "1" }, |
| | | { id: 81, shift: "1" }, |
| | | { id: 82, shift: "6" }, |
| | | { id: 83, shift: "6" }, |
| | | { id: 84, shift: "2" }, |
| | | { id: 85, shift: "2" }, |
| | | { id: 86, shift: "3" }, |
| | | { id: 87, shift: "0" }, |
| | | { id: 88, shift: "0" }, |
| | | { id: 89, shift: "1" }, |
| | | { id: 90, shift: "1" }, |
| | | ], |
| | | }, |
| | | { |
| | | id: 4, |
| | | name: "张三", |
| | | monthlyAttendance: { |
| | | totalAttendance: 22, |
| | | 早班: 10, |
| | | 中班: 8, |
| | | 夜班: 4, |
| | | 休息: 6, |
| | | 请假: 0, |
| | | 出差: 0, |
| | | }, |
| | | day0: 10, |
| | | day1: 8, |
| | | day2: 4, |
| | | day3: 6, |
| | | day4: 0, |
| | | day6: 0, |
| | | list: [ |
| | | { id: 1, shift: "0" }, |
| | | { id: 2, shift: "0" }, |
| | | { id: 3, shift: "1" }, |
| | | { id: 4, shift: "1" }, |
| | | { id: 5, shift: "2" }, |
| | | { id: 6, shift: "2" }, |
| | | { id: 7, shift: "3" }, |
| | | { id: 8, shift: "0" }, |
| | | { id: 9, shift: "0" }, |
| | | { id: 10, shift: "1" }, |
| | | { id: 11, shift: "1" }, |
| | | { id: 12, shift: "2" }, |
| | | { id: 13, shift: "2" }, |
| | | { id: 14, shift: "3" }, |
| | | { id: 15, shift: "0" }, |
| | | { id: 16, shift: "0" }, |
| | | { id: 17, shift: "1" }, |
| | | { id: 18, shift: "1" }, |
| | | { id: 19, shift: "2" }, |
| | | { id: 20, shift: "2" }, |
| | | { id: 21, shift: "3" }, |
| | | { id: 22, shift: "0" }, |
| | | { id: 23, shift: "0" }, |
| | | { id: 24, shift: "1" }, |
| | | { id: 25, shift: "1" }, |
| | | { id: 26, shift: "2" }, |
| | | { id: 27, shift: "2" }, |
| | | { id: 28, shift: "3" }, |
| | | { id: 29, shift: "0" }, |
| | | { id: 30, shift: "0" }, |
| | | ], |
| | | }, |
| | | { |
| | | id: 5, |
| | | name: "张三", |
| | | monthlyAttendance: { |
| | | totalAttendance: 22, |
| | | 早班: 10, |
| | | 中班: 8, |
| | | 夜班: 4, |
| | | 休息: 6, |
| | | 请假: 0, |
| | | 出差: 0, |
| | | }, |
| | | day0: 10, |
| | | day1: 8, |
| | | day2: 4, |
| | | day3: 6, |
| | | day4: 0, |
| | | day6: 0, |
| | | list: [ |
| | | { id: 1, shift: "0" }, |
| | | { id: 2, shift: "0" }, |
| | | { id: 3, shift: "1" }, |
| | | { id: 4, shift: "1" }, |
| | | { id: 5, shift: "2" }, |
| | | { id: 6, shift: "2" }, |
| | | { id: 7, shift: "3" }, |
| | | { id: 8, shift: "0" }, |
| | | { id: 9, shift: "0" }, |
| | | { id: 10, shift: "1" }, |
| | | { id: 11, shift: "1" }, |
| | | { id: 12, shift: "2" }, |
| | | { id: 13, shift: "2" }, |
| | | { id: 14, shift: "3" }, |
| | | { id: 15, shift: "0" }, |
| | | { id: 16, shift: "0" }, |
| | | { id: 17, shift: "1" }, |
| | | { id: 18, shift: "1" }, |
| | | { id: 19, shift: "2" }, |
| | | { id: 20, shift: "2" }, |
| | | { id: 21, shift: "3" }, |
| | | { id: 22, shift: "0" }, |
| | | { id: 23, shift: "0" }, |
| | | { id: 24, shift: "1" }, |
| | | { id: 25, shift: "1" }, |
| | | { id: 26, shift: "2" }, |
| | | { id: 27, shift: "2" }, |
| | | { id: 28, shift: "3" }, |
| | | { id: 29, shift: "0" }, |
| | | { id: 30, shift: "0" }, |
| | | ], |
| | | }, |
| | | { |
| | | id: 6, |
| | | name: "张三", |
| | | monthlyAttendance: { |
| | | totalAttendance: 22, |
| | | 早班: 10, |
| | | 中班: 8, |
| | | 夜班: 4, |
| | | 休息: 6, |
| | | 请假: 0, |
| | | 出差: 0, |
| | | }, |
| | | day0: 10, |
| | | day1: 8, |
| | | day2: 4, |
| | | day3: 6, |
| | | day4: 0, |
| | | day6: 0, |
| | | list: [ |
| | | { id: 1, shift: "0" }, |
| | | { id: 2, shift: "0" }, |
| | | { id: 3, shift: "1" }, |
| | | { id: 4, shift: "1" }, |
| | | { id: 5, shift: "2" }, |
| | | { id: 6, shift: "2" }, |
| | | { id: 7, shift: "3" }, |
| | | { id: 8, shift: "0" }, |
| | | { id: 9, shift: "0" }, |
| | | { id: 10, shift: "1" }, |
| | | { id: 11, shift: "1" }, |
| | | { id: 12, shift: "2" }, |
| | | { id: 13, shift: "2" }, |
| | | { id: 14, shift: "3" }, |
| | | { id: 15, shift: "0" }, |
| | | { id: 16, shift: "0" }, |
| | | { id: 17, shift: "1" }, |
| | | { id: 18, shift: "1" }, |
| | | { id: 19, shift: "2" }, |
| | | { id: 20, shift: "2" }, |
| | | { id: 21, shift: "3" }, |
| | | { id: 22, shift: "0" }, |
| | | { id: 23, shift: "0" }, |
| | | { id: 24, shift: "1" }, |
| | | { id: 25, shift: "1" }, |
| | | { id: 26, shift: "2" }, |
| | | { id: 27, shift: "2" }, |
| | | { id: 28, shift: "3" }, |
| | | { id: 29, shift: "0" }, |
| | | { id: 30, shift: "0" }, |
| | | ], |
| | | }, |
| | | ]); |
| | | const listForm = ref([]); |
| | | |
| | | // 当前页 |
| | | const currentPage = ref(1); |
| | |
| | | const monthList = ref([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]); |
| | | |
| | | // 年度列表 |
| | | const yearList = ref([ |
| | | { |
| | | id: 1, |
| | | name: "张三", |
| | | work_time: 260, |
| | | day0: 98, |
| | | day1: 78, |
| | | day2: 46, |
| | | day3: 74, |
| | | day4: 14, |
| | | day6: 10, |
| | | monthList: [ |
| | | { |
| | | totalMonthAttendance: 22, |
| | | day0: 10, |
| | | day1: 8, |
| | | day2: 4, |
| | | day3: 6, |
| | | day4: 0, |
| | | day6: 0, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 19, |
| | | day0: 7, |
| | | day1: 6, |
| | | day2: 6, |
| | | day3: 9, |
| | | day4: 3, |
| | | day6: 0, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 23, |
| | | day0: 9, |
| | | day1: 9, |
| | | day2: 5, |
| | | day3: 5, |
| | | day4: 0, |
| | | day6: 2, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 21, |
| | | day0: 8, |
| | | day1: 7, |
| | | day2: 6, |
| | | day3: 7, |
| | | day4: 0, |
| | | day6: 1, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 22, |
| | | day0: 9, |
| | | day1: 8, |
| | | day2: 5, |
| | | day3: 6, |
| | | day4: 1, |
| | | day6: 1, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 18, |
| | | day0: 6, |
| | | day1: 6, |
| | | day2: 6, |
| | | day3: 8, |
| | | day4: 4, |
| | | day6: 0, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 23, |
| | | day0: 10, |
| | | day1: 9, |
| | | day2: 4, |
| | | day3: 5, |
| | | day4: 0, |
| | | day6: 0, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 22, |
| | | day0: 9, |
| | | day1: 8, |
| | | day2: 5, |
| | | day3: 6, |
| | | day4: 0, |
| | | day6: 0, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 21, |
| | | day0: 8, |
| | | day1: 7, |
| | | day2: 6, |
| | | day3: 7, |
| | | day4: 0, |
| | | day6: 1, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 22, |
| | | day0: 9, |
| | | day1: 8, |
| | | day2: 5, |
| | | day3: 6, |
| | | day4: 1, |
| | | day6: 1, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 19, |
| | | day0: 7, |
| | | day1: 7, |
| | | day2: 5, |
| | | day3: 8, |
| | | day4: 2, |
| | | day6: 0, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 23, |
| | | day0: 10, |
| | | day1: 9, |
| | | day2: 4, |
| | | day3: 5, |
| | | day4: 0, |
| | | day6: 0, |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | id: 2, |
| | | name: "李四", |
| | | work_time: 252, |
| | | day0: 90, |
| | | day1: 72, |
| | | day2: 50, |
| | | day3: 76, |
| | | day4: 18, |
| | | day6: 8, |
| | | monthList: [ |
| | | { |
| | | totalMonthAttendance: 21, |
| | | day0: 9, |
| | | day1: 7, |
| | | day2: 5, |
| | | day3: 7, |
| | | day4: 2, |
| | | day6: 0, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 18, |
| | | day0: 6, |
| | | day1: 6, |
| | | day2: 6, |
| | | day3: 10, |
| | | day4: 4, |
| | | day6: 0, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 22, |
| | | day0: 8, |
| | | day1: 8, |
| | | day2: 6, |
| | | day3: 6, |
| | | day4: 0, |
| | | day6: 2, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 20, |
| | | day0: 7, |
| | | day1: 6, |
| | | day2: 7, |
| | | day3: 8, |
| | | day4: 0, |
| | | day6: 2, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 21, |
| | | day0: 8, |
| | | day1: 7, |
| | | day2: 6, |
| | | day3: 7, |
| | | day4: 1, |
| | | day6: 1, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 17, |
| | | day0: 5, |
| | | day1: 5, |
| | | day2: 7, |
| | | day3: 9, |
| | | day4: 5, |
| | | day6: 0, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 22, |
| | | day0: 9, |
| | | day1: 8, |
| | | day2: 5, |
| | | day3: 6, |
| | | day4: 0, |
| | | day6: 0, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 21, |
| | | day0: 8, |
| | | day1: 7, |
| | | day2: 6, |
| | | day3: 7, |
| | | day4: 1, |
| | | day6: 0, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 20, |
| | | day0: 7, |
| | | day1: 6, |
| | | day2: 7, |
| | | day3: 8, |
| | | day4: 0, |
| | | day6: 2, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 21, |
| | | day0: 8, |
| | | day1: 7, |
| | | day2: 6, |
| | | day3: 7, |
| | | day4: 1, |
| | | day6: 1, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 18, |
| | | day0: 6, |
| | | day1: 6, |
| | | day2: 6, |
| | | day3: 9, |
| | | day4: 3, |
| | | day6: 0, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 22, |
| | | day0: 9, |
| | | day1: 8, |
| | | day2: 5, |
| | | day3: 6, |
| | | day4: 0, |
| | | day6: 0, |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | id: 3, |
| | | name: "王五", |
| | | work_time: 268, |
| | | day0: 102, |
| | | day1: 82, |
| | | day2: 48, |
| | | day3: 70, |
| | | day4: 10, |
| | | day6: 14, |
| | | monthList: [ |
| | | { |
| | | totalMonthAttendance: 23, |
| | | day0: 10, |
| | | day1: 9, |
| | | day2: 4, |
| | | day3: 5, |
| | | day4: 0, |
| | | day6: 0, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 21, |
| | | day0: 8, |
| | | day1: 8, |
| | | day2: 5, |
| | | day3: 6, |
| | | day4: 0, |
| | | day6: 2, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 24, |
| | | day0: 10, |
| | | day1: 9, |
| | | day2: 5, |
| | | day3: 4, |
| | | day4: 0, |
| | | day6: 3, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 22, |
| | | day0: 9, |
| | | day1: 8, |
| | | day2: 5, |
| | | day3: 6, |
| | | day4: 0, |
| | | day6: 2, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 23, |
| | | day0: 10, |
| | | day1: 8, |
| | | day2: 5, |
| | | day3: 5, |
| | | day4: 1, |
| | | day6: 1, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 21, |
| | | day0: 8, |
| | | day1: 7, |
| | | day2: 6, |
| | | day3: 7, |
| | | day4: 1, |
| | | day6: 1, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 23, |
| | | day0: 10, |
| | | day1: 9, |
| | | day2: 4, |
| | | day3: 5, |
| | | day4: 0, |
| | | day6: 0, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 22, |
| | | day0: 9, |
| | | day1: 8, |
| | | day2: 5, |
| | | day3: 6, |
| | | day4: 0, |
| | | day6: 0, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 23, |
| | | day0: 10, |
| | | day1: 9, |
| | | day2: 4, |
| | | day3: 5, |
| | | day4: 0, |
| | | day6: 2, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 22, |
| | | day0: 9, |
| | | day1: 8, |
| | | day2: 5, |
| | | day3: 6, |
| | | day4: 1, |
| | | day6: 1, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 21, |
| | | day0: 8, |
| | | day1: 7, |
| | | day2: 6, |
| | | day3: 7, |
| | | day4: 0, |
| | | day6: 2, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 24, |
| | | day0: 10, |
| | | day1: 9, |
| | | day2: 5, |
| | | day3: 4, |
| | | day4: 0, |
| | | day6: 3, |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | id: 4, |
| | | name: "赵六", |
| | | work_time: 248, |
| | | day0: 88, |
| | | day1: 70, |
| | | day2: 50, |
| | | day3: 78, |
| | | day4: 20, |
| | | day6: 6, |
| | | monthList: [ |
| | | { |
| | | totalMonthAttendance: 20, |
| | | day0: 8, |
| | | day1: 6, |
| | | day2: 6, |
| | | day3: 8, |
| | | day4: 3, |
| | | day6: 0, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 17, |
| | | day0: 5, |
| | | day1: 5, |
| | | day2: 7, |
| | | day3: 10, |
| | | day4: 5, |
| | | day6: 0, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 21, |
| | | day0: 7, |
| | | day1: 7, |
| | | day2: 7, |
| | | day3: 7, |
| | | day4: 1, |
| | | day6: 1, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 19, |
| | | day0: 6, |
| | | day1: 6, |
| | | day2: 7, |
| | | day3: 9, |
| | | day4: 2, |
| | | day6: 1, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 20, |
| | | day0: 7, |
| | | day1: 7, |
| | | day2: 6, |
| | | day3: 8, |
| | | day4: 2, |
| | | day6: 0, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 16, |
| | | day0: 4, |
| | | day1: 4, |
| | | day2: 8, |
| | | day3: 10, |
| | | day4: 6, |
| | | day6: 0, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 21, |
| | | day0: 8, |
| | | day1: 7, |
| | | day2: 6, |
| | | day3: 7, |
| | | day4: 1, |
| | | day6: 1, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 20, |
| | | day0: 7, |
| | | day1: 7, |
| | | day2: 6, |
| | | day3: 8, |
| | | day4: 2, |
| | | day6: 0, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 19, |
| | | day0: 6, |
| | | day1: 6, |
| | | day2: 7, |
| | | day3: 9, |
| | | day4: 2, |
| | | day6: 1, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 20, |
| | | day0: 7, |
| | | day1: 7, |
| | | day2: 6, |
| | | day3: 8, |
| | | day4: 2, |
| | | day6: 0, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 18, |
| | | day0: 6, |
| | | day1: 6, |
| | | day2: 6, |
| | | day3: 9, |
| | | day4: 4, |
| | | day6: 0, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 21, |
| | | day0: 8, |
| | | day1: 7, |
| | | day2: 6, |
| | | day3: 7, |
| | | day4: 1, |
| | | day6: 1, |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | id: 5, |
| | | name: "钱七", |
| | | work_time: 266, |
| | | day0: 100, |
| | | day1: 84, |
| | | day2: 46, |
| | | day3: 72, |
| | | day4: 12, |
| | | day6: 12, |
| | | monthList: [ |
| | | { |
| | | totalMonthAttendance: 23, |
| | | day0: 10, |
| | | day1: 9, |
| | | day2: 4, |
| | | day3: 5, |
| | | day4: 0, |
| | | day6: 0, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 21, |
| | | day0: 8, |
| | | day1: 8, |
| | | day2: 5, |
| | | day3: 6, |
| | | day4: 1, |
| | | day6: 1, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 23, |
| | | day0: 9, |
| | | day1: 9, |
| | | day2: 5, |
| | | day3: 5, |
| | | day4: 0, |
| | | day6: 2, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 22, |
| | | day0: 9, |
| | | day1: 8, |
| | | day2: 5, |
| | | day3: 6, |
| | | day4: 0, |
| | | day6: 2, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 22, |
| | | day0: 9, |
| | | day1: 8, |
| | | day2: 5, |
| | | day3: 6, |
| | | day4: 1, |
| | | day6: 1, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 20, |
| | | day0: 7, |
| | | day1: 7, |
| | | day2: 6, |
| | | day3: 8, |
| | | day4: 2, |
| | | day6: 0, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 23, |
| | | day0: 10, |
| | | day1: 9, |
| | | day2: 4, |
| | | day3: 5, |
| | | day4: 0, |
| | | day6: 0, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 22, |
| | | day0: 9, |
| | | day1: 8, |
| | | day2: 5, |
| | | day3: 6, |
| | | day4: 0, |
| | | day6: 0, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 23, |
| | | day0: 9, |
| | | day1: 9, |
| | | day2: 5, |
| | | day3: 5, |
| | | day4: 0, |
| | | day6: 2, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 22, |
| | | day0: 9, |
| | | day1: 8, |
| | | day2: 5, |
| | | day3: 6, |
| | | day4: 1, |
| | | day6: 1, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 20, |
| | | day0: 7, |
| | | day1: 7, |
| | | day2: 6, |
| | | day3: 8, |
| | | day4: 2, |
| | | day6: 0, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 23, |
| | | day0: 10, |
| | | day1: 9, |
| | | day2: 4, |
| | | day3: 5, |
| | | day4: 0, |
| | | day6: 0, |
| | | }, |
| | | ], |
| | | }, |
| | | ]); |
| | | const yearList = ref([]); |
| | | |
| | | // 导出加载状态 |
| | | const downLoading = ref(false); |
| | |
| | | JSON.parse(JSON.stringify(response.data)) |
| | | ); |
| | | }); |
| | | }; |
| | | |
| | | // 根据班次值获取班次名称 |
| | | const getShiftNameByValue = value => { |
| | | if (!value) return ""; |
| | | const shift = shifts_list.value.find(item => item.value === value); |
| | | return shift ? shift.label : value; |
| | | }; |
| | | |
| | | // 过滤禁用的部门 |
| | |
| | | yearList.value = []; |
| | | currentPage.value = 1; |
| | | query.userName = ""; |
| | | query.deptId = ""; |
| | | query.sysDeptId = ""; |
| | | query.year = new Date(); |
| | | query.month = new Date().getMonth() + 1; |
| | | if (query.month) { |
| | |
| | | current: currentPage.value, |
| | | time: year + "-" + month + "-01 00:00:00", |
| | | userName: query.userName, |
| | | deptId: query.deptId, |
| | | sysDeptId: query.sysDeptId, |
| | | }) |
| | | .then(res => { |
| | | pageLoading.value = false; |
| | |
| | | current: currentPage.value, |
| | | time: year + "-01-01 00:00:00", |
| | | userName: query.userName, |
| | | deptId: query.deptId, |
| | | sysDeptId: query.sysDeptId, |
| | | }).then(res => { |
| | | pageLoading.value = false; |
| | | total.value = res.data.total; |
| | |
| | | proxy.$modal.msgError("请选择周次"); |
| | | return; |
| | | } |
| | | if (!schedulingQuery.deptId) { |
| | | proxy.$modal.msgError("请选择部门"); |
| | | return; |
| | | } |
| | | let time = schedulingQuery.week.getTime(); |
| | | |
| | | // 格式化日期为 YYYY-MM-DD 格式 |
| | |
| | | proxy.$modal.msgError("请选择班次"); |
| | | return; |
| | | } |
| | | const blockedEmployees = (personList.value || []).filter(item => { |
| | | const leaveDate = getEmployeeLeaveDate(item?.id); |
| | | const weekEndDate = getSchedulingWeekEndDate(); |
| | | return leaveDate && weekEndDate && weekEndDate.getTime() > leaveDate.getTime(); |
| | | }); |
| | | if (blockedEmployees.length) { |
| | | proxy.$modal.msgError("存在已超过离职日期的人员,不能继续排班"); |
| | | return; |
| | | } |
| | | loading.value = true; |
| | | add({ |
| | | startWeek, |
| | | endWeek, |
| | | userId: schedulingQuery.userId.join(","), |
| | | shift: schedulingQuery.shift, |
| | | staffOnJobId: schedulingQuery.userId.join(","), |
| | | personalAttendanceLocationConfigId: schedulingQuery.shift, |
| | | }) |
| | | .then(res => { |
| | | loading.value = false; |
| | | proxy.$modal.msgSuccess("操作成功"); |
| | | schedulingVisible.value = false; |
| | | schedulingQuery.week = ""; |
| | | schedulingQuery.deptId = ""; |
| | | schedulingQuery.userId = null; |
| | | schedulingQuery.shift = ""; |
| | | personList.value = []; |
| | | refresh(); |
| | | }) |
| | | .catch(err => { |
| | |
| | | exportFile({ |
| | | time, |
| | | userName: query.userName, |
| | | deptId: query.deptId, |
| | | sysDeptId: query.sysDeptId, |
| | | isMonth: query.month ? true : false, |
| | | }) |
| | | .then(res => { |
| | | proxy.$modal.msgSuccess("下载成功"); |
| | | downLoading.value = false; |
| | | const blob = new Blob([res], { |
| | | type: "application/force-download", |
| | | }); |
| | | const blob = |
| | | res instanceof Blob |
| | | ? res |
| | | : new Blob([res], { |
| | | type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", |
| | | }); |
| | | let fileName = ""; |
| | | if (query.month) { |
| | | fileName = year + "-" + query.month + " 班次信息"; |
| | |
| | | } |
| | | proxy.$download.saveAs(blob, fileName + ".xlsx"); |
| | | }) |
| | | .catch(err => { |
| | | .catch(err => {}) |
| | | .finally(() => { |
| | | downLoading.value = false; |
| | | }); |
| | | }; |
| | | // 处理命令 |
| | | const handleCommand = (e, m) => { |
| | | if (e != m.shift) { |
| | | update({ |
| | | id: m.id, |
| | | shift: e, |
| | | }).then(res => { |
| | | proxy.$modal.msgSuccess("操作成功"); |
| | | m.shift = e; |
| | | }); |
| | | const handleCommand = (e, row, cell) => { |
| | | if (isCellBlockedByLeaveDate(row, cell)) { |
| | | proxy.$modal.msgError("该员工已超出离职日期,不能继续排班"); |
| | | return; |
| | | } |
| | | // if (e != m.shift) { |
| | | update({ |
| | | id: cell.id, |
| | | personalAttendanceLocationConfigId: e, |
| | | }).then(res => { |
| | | proxy.$modal.msgSuccess("操作成功"); |
| | | // m.shift = e; |
| | | if (query.month) { |
| | | init(); |
| | | } else { |
| | | initYear(); |
| | | } |
| | | }); |
| | | // } |
| | | }; |
| | | // 查询规则列表 |
| | | const fetchData = () => { |
| | | getAttendanceRules({ current: -1, size: -1 }).then(res => { |
| | | classType.value = res.data.records; |
| | | const records = Array.isArray(res?.data?.records) ? res.data.records : []; |
| | | const appendList = [ |
| | | { id: 998, shift: "休息" }, |
| | | { id: 999, shift: "请假" }, |
| | | ]; |
| | | const exists = new Set(records.map(r => String(r?.id))); |
| | | appendList.forEach(item => { |
| | | if (!exists.has(String(item.id))) { |
| | | records.push(item); |
| | | } |
| | | }); |
| | | classType.value = records; |
| | | }); |
| | | }; |
| | | // 获取用户 |
| | |
| | | // let arr = res.data; |
| | | // personList.value = arr; |
| | | // }); |
| | | selectUserCondition().then(res => { |
| | | let arr = res.data; |
| | | personList.value = arr; |
| | | staffOnJobListPage({ |
| | | current: -1, |
| | | size: -1, |
| | | staffState: 1, |
| | | }).then(res => { |
| | | let arr = res.data.records; |
| | | personListAll.value = arr; |
| | | updatePersonListByDept(); |
| | | }); |
| | | }; |
| | | |
| | | const getLeaveDates = () => { |
| | | findStaffLeaveListPage({ |
| | | current: -1, |
| | | size: -1, |
| | | }).then(res => { |
| | | const records = Array.isArray(res?.data?.records) ? res.data.records : []; |
| | | const map = {}; |
| | | records.forEach(item => { |
| | | const staffId = item?.staffOnJobId ?? item?.staff_on_job_id; |
| | | const leaveDate = item?.leaveDate ?? item?.leave_date; |
| | | if (!staffId || !leaveDate) return; |
| | | const key = String(staffId); |
| | | const prev = map[key]; |
| | | if (!prev || String(leaveDate) > String(prev)) { |
| | | map[key] = leaveDate; |
| | | } |
| | | }); |
| | | leaveDateMap.value = map; |
| | | updatePersonListByDept(); |
| | | syncPersonListSelection(); |
| | | }); |
| | | }; |
| | | |
| | | const findDeptNodeById = (deptId, deptList = deptOptions.value) => { |
| | | const list = Array.isArray(deptList) ? deptList : []; |
| | | for (const node of list) { |
| | | if (String(node.id) === String(deptId)) return node; |
| | | if (node.children && node.children.length) { |
| | | const found = findDeptNodeById(deptId, node.children); |
| | | if (found) return found; |
| | | } |
| | | } |
| | | return null; |
| | | }; |
| | | |
| | | const collectDeptIds = node => { |
| | | const ids = []; |
| | | if (!node) return ids; |
| | | ids.push(String(node.id)); |
| | | if (node.children && node.children.length) { |
| | | node.children.forEach(child => { |
| | | ids.push(...collectDeptIds(child)); |
| | | }); |
| | | } |
| | | return ids; |
| | | }; |
| | | |
| | | const updatePersonListByDept = () => { |
| | | if (!schedulingQuery.deptId) { |
| | | personList.value = []; |
| | | return; |
| | | } |
| | | const node = findDeptNodeById(schedulingQuery.deptId); |
| | | const deptIds = new Set(collectDeptIds(node)); |
| | | personList.value = (personListAll.value || []).filter(item => { |
| | | const itemDeptId = item.deptId ?? item.sysDeptId ?? item.dept_id; |
| | | return deptIds.has(String(itemDeptId)) && !isEmployeeBlockedByLeaveDate(item); |
| | | }); |
| | | }; |
| | | |
| | | const parseDateOnly = value => { |
| | | if (!value) return null; |
| | | if (value instanceof Date) { |
| | | const d = new Date(value); |
| | | d.setHours(0, 0, 0, 0); |
| | | return d; |
| | | } |
| | | const normalized = String(value).trim().slice(0, 10); |
| | | if (!normalized) return null; |
| | | const d = new Date(normalized.replace(/-/g, "/")); |
| | | if (Number.isNaN(d.getTime())) return null; |
| | | d.setHours(0, 0, 0, 0); |
| | | return d; |
| | | }; |
| | | |
| | | const getSchedulingWeekEndDate = () => { |
| | | if (!schedulingQuery.week) return null; |
| | | const start = new Date(schedulingQuery.week); |
| | | start.setHours(0, 0, 0, 0); |
| | | return new Date(start.getTime() + 24 * 60 * 60 * 1000 * 5); |
| | | }; |
| | | |
| | | const getCellDate = cell => parseDateOnly(cell?.time); |
| | | |
| | | const getEmployeeLeaveDate = staffId => { |
| | | const leaveDate = leaveDateMap.value[String(staffId)]; |
| | | return parseDateOnly(leaveDate); |
| | | }; |
| | | |
| | | const isEmployeeBlockedByLeaveDate = item => { |
| | | const leaveDate = getEmployeeLeaveDate(item?.id); |
| | | if (!leaveDate) return false; |
| | | const weekEndDate = getSchedulingWeekEndDate(); |
| | | if (!weekEndDate) return false; |
| | | return weekEndDate.getTime() > leaveDate.getTime(); |
| | | }; |
| | | |
| | | const isCellBlockedByLeaveDate = (row, cell) => { |
| | | const staffId = row?.userId ?? row?.user_id ?? row?.id; |
| | | const leaveDate = getEmployeeLeaveDate(staffId); |
| | | const cellDate = getCellDate(cell); |
| | | if (!leaveDate || !cellDate) return false; |
| | | return cellDate.getTime() > leaveDate.getTime(); |
| | | }; |
| | | |
| | | const syncPersonListSelection = () => { |
| | | if (!Array.isArray(schedulingQuery.userId) || !schedulingQuery.userId.length) return; |
| | | const validIds = new Set((personList.value || []).map(item => String(item.id))); |
| | | const nextIds = schedulingQuery.userId.filter(id => validIds.has(String(id))); |
| | | if (nextIds.length !== schedulingQuery.userId.length) { |
| | | schedulingQuery.userId = nextIds; |
| | | proxy.$modal.msgWarning("已自动剔除超出离职日期的人员"); |
| | | } |
| | | }; |
| | | |
| | | const setDefaultShiftByDept = () => { |
| | | if (!schedulingQuery.deptId) { |
| | | schedulingQuery.shift = ""; |
| | | return; |
| | | } |
| | | const first = schedulingClassType.value?.[0]; |
| | | schedulingQuery.shift = first ? first.id : ""; |
| | | }; |
| | | |
| | | const onSchedulingDeptChange = () => { |
| | | schedulingQuery.userId = null; |
| | | updatePersonListByDept(); |
| | | setDefaultShiftByDept(); |
| | | }; |
| | | |
| | | // 根据字典获取日期 |
| | | const getDayByDic = e => { |
| | | let obj = classType.value.find(m => m.locationName == e); |
| | | let obj = classType.value.find(m => m.shift == e); |
| | | if (obj) { |
| | | return obj.id; |
| | | } |
| | |
| | | |
| | | // 根据字典获取班次 |
| | | const getShiftByDic = e => { |
| | | let obj = classType.value.find(m => m.id == e); |
| | | let obj = classType.value.find(m => m.shift == e); |
| | | if (obj) { |
| | | return obj.locationName; |
| | | return obj.shift; |
| | | } |
| | | return "无"; |
| | | }; |
| | |
| | | onMounted(() => { |
| | | fetchData(); |
| | | getUsers(); |
| | | getLeaveDates(); |
| | | fetchDeptOptions(); |
| | | if (query.month) { |
| | | init(); |
| | |
| | | } |
| | | monthList.value.reverse(); |
| | | }); |
| | | |
| | | watch( |
| | | () => classType.value, |
| | | () => { |
| | | if (schedulingVisible.value && schedulingQuery.deptId) { |
| | | setDefaultShiftByDept(); |
| | | } |
| | | } |
| | | ); |
| | | |
| | | watch( |
| | | () => schedulingQuery.week, |
| | | () => { |
| | | if (!schedulingVisible.value) return; |
| | | updatePersonListByDept(); |
| | | syncPersonListSelection(); |
| | | } |
| | | ); |
| | | |
| | | watch( |
| | | () => schedulingQuery.deptId, |
| | | () => { |
| | | if (!schedulingVisible.value) return; |
| | | updatePersonListByDept(); |
| | | syncPersonListSelection(); |
| | | } |
| | | ); |
| | | |
| | | watch( |
| | | () => schedulingVisible.value, |
| | | val => { |
| | | if (!val) return; |
| | | schedulingQuery.week = ""; |
| | | schedulingQuery.deptId = ""; |
| | | schedulingQuery.userId = null; |
| | | schedulingQuery.shift = ""; |
| | | personList.value = []; |
| | | } |
| | | ); |
| | | </script> |
| | | |
| | | <style scoped> |
| | |
| | | .user-stats { |
| | | /* display: flex; */ |
| | | /* flex-wrap: wrap; |
| | | gap: 10px; */ |
| | | gap: 10px; */ |
| | | margin-bottom: 4px; |
| | | } |
| | | |
| | |
| | | display: flex; |
| | | flex-direction: column; |
| | | align-items: center; |
| | | height: 65px; |
| | | } |
| | | |
| | | /* 月度出勤 */ |