26 changed files with 2038 additions and 35 deletions
@ -0,0 +1,46 @@ |
|||||
|
export default { |
||||
|
week:[ |
||||
|
{ |
||||
|
id: 1, |
||||
|
name: "周一", |
||||
|
value: "", |
||||
|
days:"周一" |
||||
|
}, |
||||
|
{ |
||||
|
id: 2, |
||||
|
name: "周二", |
||||
|
value: "", |
||||
|
days:"周二" |
||||
|
}, |
||||
|
{ |
||||
|
id: 3, |
||||
|
name: "周三", |
||||
|
value: "", |
||||
|
days:"周三" |
||||
|
}, |
||||
|
{ |
||||
|
id: 4, |
||||
|
name: "周四", |
||||
|
value: "", |
||||
|
days:"周四" |
||||
|
}, |
||||
|
{ |
||||
|
id: 5, |
||||
|
name: "周五", |
||||
|
value: "", |
||||
|
days:"周五" |
||||
|
}, |
||||
|
{ |
||||
|
id: 6, |
||||
|
name: "周六", |
||||
|
value: "", |
||||
|
days:"周六" |
||||
|
}, |
||||
|
{ |
||||
|
id: 7, |
||||
|
name: "周七", |
||||
|
value: "", |
||||
|
days:"周七" |
||||
|
} |
||||
|
] |
||||
|
} |
||||
@ -0,0 +1,223 @@ |
|||||
|
<!-- |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2025-01-21 15:20:48 |
||||
|
@ 备注: 添加倒班制度 |
||||
|
--> |
||||
|
<script lang="ts" setup> |
||||
|
import { workTimeInfo, ruleInfo, TimesClassInfo } from "@/api/hr/people/type"; |
||||
|
import { teamcontlist } from "@/api/hr/org/index"; |
||||
|
import { addTeamTime } from "@/api/hr/people/index"; |
||||
|
const props = defineProps({ |
||||
|
open: { |
||||
|
type: Boolean, |
||||
|
default: false, |
||||
|
}, |
||||
|
teamInfo: { |
||||
|
type: Object, |
||||
|
default() { |
||||
|
return {}; |
||||
|
}, |
||||
|
}, |
||||
|
}); |
||||
|
const emits = defineEmits(["update:open", "restdata"]); |
||||
|
const sunmitBut = ref(false); |
||||
|
const formInfo = reactive({ |
||||
|
name: "", |
||||
|
}); |
||||
|
const worktimeList = ref<workTimeInfo[]>([ |
||||
|
{ |
||||
|
title: "", |
||||
|
startTime: "", |
||||
|
endTime: "", |
||||
|
}, |
||||
|
]); |
||||
|
/** |
||||
|
* 弹窗显示控制 |
||||
|
*/ |
||||
|
const isShow = computed({ |
||||
|
get: () => { |
||||
|
if (props.open) { |
||||
|
} |
||||
|
return props.open; |
||||
|
}, |
||||
|
set: (val) => { |
||||
|
emits("update:open", val); |
||||
|
}, |
||||
|
}); |
||||
|
/** |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2025-01-14 13:57:36 |
||||
|
@ 功能: 关闭弹窗 |
||||
|
*/ |
||||
|
const closeDialog = () => { |
||||
|
emits("update:open", false); |
||||
|
worktimeList.value = [ |
||||
|
{ |
||||
|
title: "", |
||||
|
startTime: "", |
||||
|
endTime: "", |
||||
|
}, |
||||
|
]; |
||||
|
formInfo.name = ""; |
||||
|
sunmitBut.value = false; |
||||
|
emits("restdata"); |
||||
|
}; |
||||
|
/** |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2025-01-14 15:16:33 |
||||
|
@ 功能: 添加工作时间段安排 |
||||
|
*/ |
||||
|
const addTimeSet = () => { |
||||
|
worktimeList.value.push({ |
||||
|
title: "", |
||||
|
startTime: "", |
||||
|
endTime: "", |
||||
|
}); |
||||
|
}; |
||||
|
/** |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2025-01-14 15:34:42 |
||||
|
@ 功能: 删除时间片段 |
||||
|
*/ |
||||
|
const delTimeSet = (val: any) => { |
||||
|
console.log("删除时间片段", val.$index, worktimeList.value.length); |
||||
|
if (worktimeList.value.length > 1) { |
||||
|
worktimeList.value.splice(val.$index, 1); |
||||
|
console.log("删除时间片段", val.$index); |
||||
|
} else { |
||||
|
val.title = ""; |
||||
|
val.startTime = ""; |
||||
|
val.title = ""; |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
/** |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2025-01-21 15:33:34 |
||||
|
@ 功能: 提交日程安排 |
||||
|
*/ |
||||
|
const addContsubmit = () => { |
||||
|
sunmitBut.value = true; |
||||
|
if (!formInfo.name) { |
||||
|
ElMessage.error("请输入名称"); |
||||
|
sunmitBut.value = false; |
||||
|
return false; |
||||
|
} else { |
||||
|
if (formInfo.name == "" || formInfo.name == null) { |
||||
|
ElMessage.error("请输入名称"); |
||||
|
sunmitBut.value = false; |
||||
|
return false; |
||||
|
} |
||||
|
} |
||||
|
let workList = new Array(); |
||||
|
if (worktimeList.value.length < 1) { |
||||
|
ElMessage.error("请输入工作时间安排!"); |
||||
|
sunmitBut.value = false; |
||||
|
return false; |
||||
|
} else { |
||||
|
let isTrue = false; |
||||
|
worktimeList.value.forEach((item: any) => { |
||||
|
if (!item.title) { |
||||
|
isTrue = true; |
||||
|
} else { |
||||
|
if (item.title == "" || item.title == null) { |
||||
|
isTrue = true; |
||||
|
} |
||||
|
} |
||||
|
if (!item.startTime) { |
||||
|
isTrue = true; |
||||
|
} else { |
||||
|
if (item.startTime == "" || item.startTime == null) { |
||||
|
isTrue = true; |
||||
|
} |
||||
|
} |
||||
|
if (!item.endTime) { |
||||
|
isTrue = true; |
||||
|
} else { |
||||
|
if (item.endTime == "" || item.endTime == null) { |
||||
|
isTrue = true; |
||||
|
} |
||||
|
} |
||||
|
workList.push(item); |
||||
|
}); |
||||
|
if (isTrue) { |
||||
|
ElMessage.error("请输入工作时间安排!"); |
||||
|
sunmitBut.value = false; |
||||
|
return false; |
||||
|
} |
||||
|
} |
||||
|
}; |
||||
|
</script> |
||||
|
<template> |
||||
|
<el-dialog |
||||
|
v-model="isShow" |
||||
|
width="60%" |
||||
|
title="添加班组轮询规则" |
||||
|
append-to-body |
||||
|
:before-close="closeDialog" |
||||
|
> |
||||
|
<el-form ref="addForm" :model="formInfo" label-width="120px" class="demo-ruleForm"> |
||||
|
<el-form-item label="名称" prop="name"> |
||||
|
<el-input v-model="formInfo.name" placeholder="请输入名称"></el-input> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="工作时间段安排" prop="rule"> |
||||
|
<el-table :data="worktimeList" border style="width: 100%"> |
||||
|
<el-table-column align="center" prop="title" label="时段名称" width="180"> |
||||
|
<template #default="scope"> |
||||
|
<el-input v-model="scope.row.title" placeholder="请输入时段名称"></el-input> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
<el-table-column align="center" label="开始与结束时间"> |
||||
|
<template #default="scope"> |
||||
|
<el-time-select |
||||
|
style="width: 120px" |
||||
|
placeholder="起始时间" |
||||
|
v-model="scope.row.startTime" |
||||
|
start="00:00" |
||||
|
step="00:01" |
||||
|
end="23:59" |
||||
|
> |
||||
|
</el-time-select> |
||||
|
至 |
||||
|
<el-time-select |
||||
|
style="width: 120px" |
||||
|
placeholder="结束时间" |
||||
|
v-model="scope.row.endTime" |
||||
|
:min-time="scope.row.startTime" |
||||
|
start="00:00" |
||||
|
step="00:01" |
||||
|
end="23:59" |
||||
|
> |
||||
|
</el-time-select> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
<el-table-column align="center" width="100"> |
||||
|
<template #header> |
||||
|
<el-button type="primary" size="small" @click="addTimeSet()" |
||||
|
><i class="fa fa-plus iconLeft"></i> 新增</el-button |
||||
|
> |
||||
|
</template> |
||||
|
<template #default="scope"> |
||||
|
<el-button |
||||
|
v-if="worktimeList.length > 1" |
||||
|
type="danger" |
||||
|
size="small" |
||||
|
@click="delTimeSet(scope)" |
||||
|
><i class="fa fa-trash-o iconLeft"></i>删除</el-button |
||||
|
> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
</el-table> |
||||
|
</el-form-item> |
||||
|
</el-form> |
||||
|
<template #footer class="el_dialog__footer"> |
||||
|
<div class="dialog-footer"> |
||||
|
<el-button size="small" type="primary" @click="addContsubmit" :loading="sunmitBut" |
||||
|
>确 定</el-button |
||||
|
> |
||||
|
<el-button size="small" @click="closeDialog">取 消</el-button> |
||||
|
</div> |
||||
|
</template> |
||||
|
</el-dialog> |
||||
|
</template> |
||||
|
<style lang="scss" scoped></style> |
||||
@ -0,0 +1,234 @@ |
|||||
|
<!-- |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2025-01-21 15:51:07 |
||||
|
@ 备注: 编辑工作时间段 |
||||
|
--> |
||||
|
<script lang="ts" setup> |
||||
|
import { teamcontlist } from "@/api/hr/org/index"; |
||||
|
import { editWorkTimeCont } from "@/api/hr/people/index"; |
||||
|
const props = defineProps({ |
||||
|
open: { |
||||
|
type: Boolean, |
||||
|
default: false, |
||||
|
}, |
||||
|
teamInfo: { |
||||
|
type: Object, |
||||
|
default() { |
||||
|
return {}; |
||||
|
}, |
||||
|
}, |
||||
|
}); |
||||
|
const emits = defineEmits(["update:open", "restdata"]); |
||||
|
const editBut = ref(false); |
||||
|
const editFormInfo = reactive({ |
||||
|
id: props.teamInfo.id, |
||||
|
name: props.teamInfo.name, |
||||
|
}); |
||||
|
const editWorktimeList = ref<workTimeInfo[]>([]); |
||||
|
/** |
||||
|
* 弹窗显示控制 |
||||
|
*/ |
||||
|
const isOpen = computed({ |
||||
|
get: () => { |
||||
|
if (props.open) { |
||||
|
editFormInfo.id = props.teamInfo.id.toString(); |
||||
|
editFormInfo.name = props.teamInfo.name; |
||||
|
editWorktimeList.value = props.teamInfo.list; |
||||
|
} |
||||
|
return props.open; |
||||
|
}, |
||||
|
set: (val) => { |
||||
|
emits("update:open", val); |
||||
|
}, |
||||
|
}); |
||||
|
/** |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2025-01-15 13:01:03 |
||||
|
@ 功能: 关闭修改轮询 |
||||
|
*/ |
||||
|
const closeEditDialog = () => { |
||||
|
editFormInfo.id = ""; |
||||
|
editFormInfo.name = ""; |
||||
|
editWorktimeList.value = []; |
||||
|
emits("update:open", false); |
||||
|
}; |
||||
|
/** |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2025-01-14 15:16:33 |
||||
|
@ 功能: 添加工作时间段安排 |
||||
|
*/ |
||||
|
const addTimeSet = () => { |
||||
|
editWorktimeList.value.push({ |
||||
|
title: "", |
||||
|
startTime: "", |
||||
|
endTime: "", |
||||
|
}); |
||||
|
}; |
||||
|
/** |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2025-01-14 15:34:42 |
||||
|
@ 功能: 删除时间片段 |
||||
|
*/ |
||||
|
const delTimeSet = (val: any) => { |
||||
|
console.log("删除时间片段", val.$index, editWorktimeList.value.length); |
||||
|
if (editWorktimeList.value.length > 1) { |
||||
|
editWorktimeList.value.splice(val.$index, 1); |
||||
|
console.log("删除时间片段", val.$index); |
||||
|
} else { |
||||
|
val.title = ""; |
||||
|
val.startTime = ""; |
||||
|
val.title = ""; |
||||
|
} |
||||
|
}; |
||||
|
/** |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2025-01-15 13:13:43 |
||||
|
@ 功能: 提交编辑轮询规则 |
||||
|
*/ |
||||
|
const editContsubmit = () => { |
||||
|
editBut.value = true; |
||||
|
if (!editFormInfo.name) { |
||||
|
ElMessage.error("请输入名称"); |
||||
|
editBut.value = false; |
||||
|
return false; |
||||
|
} else { |
||||
|
if (editFormInfo.name == "" || editFormInfo.name == null) { |
||||
|
ElMessage.error("请输入名称"); |
||||
|
editBut.value = false; |
||||
|
return false; |
||||
|
} |
||||
|
} |
||||
|
let workList = new Array(); |
||||
|
if (editWorktimeList.value.length < 1) { |
||||
|
ElMessage.error("请输入工作时间安排!"); |
||||
|
editBut.value = false; |
||||
|
return false; |
||||
|
} else { |
||||
|
let isTrue = false; |
||||
|
editWorktimeList.value.forEach((item: any) => { |
||||
|
if (!item.title) { |
||||
|
isTrue = true; |
||||
|
} else { |
||||
|
if (item.title == "" || item.title == null) { |
||||
|
isTrue = true; |
||||
|
} |
||||
|
} |
||||
|
if (!item.startTime) { |
||||
|
isTrue = true; |
||||
|
} else { |
||||
|
if (item.startTime == "" || item.startTime == null) { |
||||
|
isTrue = true; |
||||
|
} |
||||
|
} |
||||
|
if (!item.endTime) { |
||||
|
isTrue = true; |
||||
|
} else { |
||||
|
if (item.endTime == "" || item.endTime == null) { |
||||
|
isTrue = true; |
||||
|
} |
||||
|
} |
||||
|
workList.push(item); |
||||
|
}); |
||||
|
if (isTrue) { |
||||
|
ElMessage.error("请输入工作时间安排!"); |
||||
|
editBut.value = false; |
||||
|
return false; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
var sendData = { |
||||
|
id: editFormInfo.id, |
||||
|
name: editFormInfo.name, |
||||
|
list: workList, |
||||
|
}; |
||||
|
console.log("上传规则", sendData); |
||||
|
editBut.value = false; |
||||
|
|
||||
|
editWorkTimeCont(sendData) |
||||
|
.then((data) => { |
||||
|
ElMessage.success(data.msg); |
||||
|
closeEditDialog(); |
||||
|
}) |
||||
|
.finally(() => { |
||||
|
editBut.value = false; |
||||
|
}); |
||||
|
}; |
||||
|
</script> |
||||
|
<template> |
||||
|
<el-dialog |
||||
|
v-model="isOpen" |
||||
|
width="60%" |
||||
|
title="编辑班组设定" |
||||
|
append-to-body |
||||
|
:before-close="closeEditDialog" |
||||
|
> |
||||
|
<el-form |
||||
|
ref="addForm" |
||||
|
:model="editFormInfo" |
||||
|
label-width="120px" |
||||
|
class="demo-ruleForm" |
||||
|
> |
||||
|
<el-form-item label="名称" prop="name"> |
||||
|
<el-input v-model="editFormInfo.name" placeholder="请输入名称"></el-input> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="工作时间段安排" prop="rule"> |
||||
|
<el-table :data="editWorktimeList" border style="width: 100%"> |
||||
|
<el-table-column align="center" prop="title" label="时段名称" width="180"> |
||||
|
<template #default="scope"> |
||||
|
<el-input v-model="scope.row.title" placeholder="请输入时段名称"></el-input> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
<el-table-column align="center" label="开始与结束时间"> |
||||
|
<template #default="scope"> |
||||
|
<el-time-select |
||||
|
style="width: 120px" |
||||
|
placeholder="起始时间" |
||||
|
v-model="scope.row.startTime" |
||||
|
start="00:00" |
||||
|
step="00:01" |
||||
|
end="23:59" |
||||
|
> |
||||
|
</el-time-select> |
||||
|
至 |
||||
|
<el-time-select |
||||
|
style="width: 120px" |
||||
|
placeholder="结束时间" |
||||
|
v-model="scope.row.endTime" |
||||
|
:min-time="scope.row.startTime" |
||||
|
start="00:00" |
||||
|
step="00:01" |
||||
|
end="23:59" |
||||
|
> |
||||
|
</el-time-select> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
<el-table-column align="center" width="100"> |
||||
|
<template #header> |
||||
|
<el-button type="primary" size="small" @click="addTimeSet()" |
||||
|
><i class="fa fa-plus iconLeft"></i> 新增</el-button |
||||
|
> |
||||
|
</template> |
||||
|
<template #default="scope"> |
||||
|
<el-button |
||||
|
v-if="editWorktimeList.length > 1" |
||||
|
type="danger" |
||||
|
size="small" |
||||
|
@click="delTimeSet(scope)" |
||||
|
><i class="fa fa-trash-o iconLeft"></i>删除</el-button |
||||
|
> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
</el-table> |
||||
|
</el-form-item> |
||||
|
</el-form> |
||||
|
<template #footer class="el_dialog__footer"> |
||||
|
<div class="dialog-footer"> |
||||
|
<el-button size="small" type="primary" @click="editContsubmit" :loading="editBut" |
||||
|
>确 定</el-button |
||||
|
> |
||||
|
<el-button size="small" @click="closeEditDialog">取 消</el-button> |
||||
|
</div> |
||||
|
</template> |
||||
|
</el-dialog> |
||||
|
</template> |
||||
|
<style lang="scss" scoped></style> |
||||
@ -0,0 +1,234 @@ |
|||||
|
<!-- |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2025-01-21 16:19:52 |
||||
|
@ 备注: 设置轮询规则 |
||||
|
--> |
||||
|
<script lang="ts" setup> |
||||
|
import { teamcontlist, gainCycleRule, saveCycleRules } from "@/api/hr/org/index"; |
||||
|
|
||||
|
import DayPage from "@/views/hr/teams/classTime/setupTimePage/dayPage.vue"; |
||||
|
import WeekPage from "@/views/hr/teams/classTime/setupTimePage/weekPage.vue"; |
||||
|
import MonthPage from "@/views/hr/teams/classTime/setupTimePage/monthPage.vue"; |
||||
|
import QuarterPage from "@/views/hr/teams/classTime/setupTimePage/quarterPage.vue"; |
||||
|
import YearsPage from "@/views/hr/teams/classTime/setupTimePage/yearsPage.vue"; |
||||
|
|
||||
|
import WorkTimePage from "@/views/hr/teams/classTime/setupTimePage/workTimePage.vue"; |
||||
|
|
||||
|
const props = defineProps({ |
||||
|
open: { |
||||
|
type: Boolean, |
||||
|
default: false, |
||||
|
}, |
||||
|
teamInfo: { |
||||
|
type: Object, |
||||
|
default() { |
||||
|
return {}; |
||||
|
}, |
||||
|
}, |
||||
|
}); |
||||
|
const pickCycle = ref(""); //切换页选择 |
||||
|
const emits = defineEmits(["update:open", "restdata"]); |
||||
|
/** |
||||
|
* 弹窗显示控制 |
||||
|
*/ |
||||
|
const isOpen = computed({ |
||||
|
get: () => { |
||||
|
if (props.open) { |
||||
|
if (props.teamInfo.list && props.teamInfo.list.length > 0) { |
||||
|
pickCycle.value = props.teamInfo.list[0].id; |
||||
|
} |
||||
|
setupFormInfo.id = props.teamInfo.id; |
||||
|
setupFormInfo.name = props.teamInfo.name; |
||||
|
gainTimeList(); |
||||
|
gainTeamRules(); |
||||
|
} |
||||
|
return props.open; |
||||
|
}, |
||||
|
set: (val) => { |
||||
|
emits("update:open", val); |
||||
|
}, |
||||
|
}); |
||||
|
//数据格式 |
||||
|
const setupFormInfo = reactive({ |
||||
|
id: props.teamInfo.id, |
||||
|
cycle: 1, |
||||
|
name: props.teamInfo.name, |
||||
|
list: [], |
||||
|
}); |
||||
|
const workPageDay = ref(null); |
||||
|
/** |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2025-01-15 13:01:03 |
||||
|
@ 功能: 关闭修改轮询 |
||||
|
*/ |
||||
|
const closeSetupDialog = () => { |
||||
|
setupFormInfo.id = ""; |
||||
|
setupFormInfo.name = ""; |
||||
|
workPageDay.value.initWorkTime(); |
||||
|
// editWorktimeList.value = []; |
||||
|
emits("update:open", false); |
||||
|
}; |
||||
|
|
||||
|
/** |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2025-01-23 13:07:41 |
||||
|
@ 功能: 获取班组规则 |
||||
|
*/ |
||||
|
const gainTeamRules = () => { |
||||
|
gainCycleRule({ id: props.teamInfo.id }).then((data: any) => { |
||||
|
console.log("获取班组规则", data); |
||||
|
if (data.code == 0) { |
||||
|
setupFormInfo.id = data.data.id.toString(); |
||||
|
setupFormInfo.name = data.data.name; |
||||
|
setupFormInfo.cycle = data.data.cycle; |
||||
|
setupFormInfo.list = data.data.list; |
||||
|
|
||||
|
workPageDay.value.callBackData(data.data.list); |
||||
|
} |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
const tiemList = ref([]); |
||||
|
/** |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2025-01-14 10:27:12 |
||||
|
@ 功能: 获取班组列表 |
||||
|
*/ |
||||
|
const gainTimeList = () => { |
||||
|
let searchMap = { |
||||
|
page: 1, |
||||
|
pagesize: 2000, |
||||
|
name: "", |
||||
|
}; |
||||
|
teamcontlist(searchMap).then((data) => { |
||||
|
tiemList.value = data.data.list; |
||||
|
|
||||
|
// tiemList.value.push({ |
||||
|
// id: 10110, |
||||
|
// name: "空班", |
||||
|
// time: 1656752010, |
||||
|
// state: 1, |
||||
|
// status: true, |
||||
|
// }); |
||||
|
// tiemList.value.push({ |
||||
|
// id: 10111, |
||||
|
// name: "休班", |
||||
|
// time: 1656752010, |
||||
|
// state: 1, |
||||
|
// status: true, |
||||
|
// }); |
||||
|
// tiemList.value.push({ |
||||
|
// id: 10112, |
||||
|
// name: "值班", |
||||
|
// time: 1656752010, |
||||
|
// state: 1, |
||||
|
// status: true, |
||||
|
// }); |
||||
|
}); |
||||
|
}; |
||||
|
/** |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2025-01-22 14:35:46 |
||||
|
@ 功能: 更新数据 |
||||
|
*/ |
||||
|
const restdata = (val: any) => { |
||||
|
// console.log("更新数据", val); |
||||
|
setupFormInfo.list = val; |
||||
|
}; |
||||
|
/** |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2025-01-23 08:32:01 |
||||
|
@ 功能: 提交数据 |
||||
|
*/ |
||||
|
const setupContsubmit = () => { |
||||
|
console.log("更新数据", setupFormInfo); |
||||
|
saveCycleRules(setupFormInfo).then((data: any) => { |
||||
|
ElMessage({ |
||||
|
message: data.msg, |
||||
|
type: "success", |
||||
|
}); |
||||
|
closeSetupDialog(); |
||||
|
}); |
||||
|
}; |
||||
|
</script> |
||||
|
<template> |
||||
|
<el-dialog |
||||
|
v-model="isOpen" |
||||
|
width="60%" |
||||
|
title="编辑班组轮询规则" |
||||
|
append-to-body |
||||
|
:before-close="closeSetupDialog" |
||||
|
> |
||||
|
<el-form |
||||
|
ref="addForm" |
||||
|
:model="setupFormInfo" |
||||
|
label-width="120px" |
||||
|
class="demo-ruleForm" |
||||
|
> |
||||
|
<el-form-item label="制度名称" prop="name"> |
||||
|
<el-input v-model="setupFormInfo.name" placeholder="请输入名称"></el-input> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="周期" prop="cycle"> |
||||
|
<el-radio-group v-model="setupFormInfo.cycle"> |
||||
|
<el-radio :value="1">日</el-radio> |
||||
|
<el-radio :value="2">周</el-radio> |
||||
|
<el-radio :value="3">月</el-radio> |
||||
|
<el-radio :value="4">季</el-radio> |
||||
|
<el-radio :value="5">年</el-radio> |
||||
|
</el-radio-group> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="轮询规则设定" prop="cycle"> |
||||
|
<WorkTimePage |
||||
|
ref="workPageDay" |
||||
|
v-model:pick-cycle="setupFormInfo.cycle" |
||||
|
:team-info="props.teamInfo" |
||||
|
:tiem-list="tiemList" |
||||
|
:ruler-info="setupFormInfo" |
||||
|
@restdata="restdata" |
||||
|
/> |
||||
|
<!-- <el-tabs v-model="pickCycle" class="demo-tabs" style="width: 100%"> |
||||
|
<el-tab-pane |
||||
|
v-for="item in props.teamInfo.list" |
||||
|
:label="item.title + ' (' + item.startTime + '-' + item.endTime + ')'" |
||||
|
:name="item.id" |
||||
|
> |
||||
|
<DayPage |
||||
|
v-if="setupFormInfo.cycle == 1" |
||||
|
:team-info="props.teamInfo" |
||||
|
:tiem-list="tiemList" |
||||
|
/> |
||||
|
<WeekPage |
||||
|
v-if="setupFormInfo.cycle == 2" |
||||
|
:team-info="props.teamInfo" |
||||
|
:tiem-list="tiemList" |
||||
|
/> |
||||
|
<MonthPage |
||||
|
v-if="setupFormInfo.cycle == 3" |
||||
|
:team-info="props.teamInfo" |
||||
|
:tiem-list="tiemList" |
||||
|
/> |
||||
|
<QuarterPage |
||||
|
v-if="setupFormInfo.cycle == 4" |
||||
|
:team-info="props.teamInfo" |
||||
|
:tiem-list="tiemList" |
||||
|
/> |
||||
|
<YearsPage |
||||
|
v-if="setupFormInfo.cycle == 5" |
||||
|
:team-info="props.teamInfo" |
||||
|
:tiem-list="tiemList" |
||||
|
/> |
||||
|
</el-tab-pane> |
||||
|
</el-tabs> --> |
||||
|
</el-form-item> |
||||
|
</el-form> |
||||
|
<template #footer class="el_dialog__footer"> |
||||
|
<div class="dialog-footer"> |
||||
|
<el-button size="small" type="primary" @click="setupContsubmit" :loading="editBut" |
||||
|
>确 定</el-button |
||||
|
> |
||||
|
<el-button size="small" @click="closeSetupDialog">取 消</el-button> |
||||
|
</div> |
||||
|
</template> |
||||
|
</el-dialog> |
||||
|
</template> |
||||
|
<style lang="scss" scoped></style> |
||||
@ -0,0 +1,90 @@ |
|||||
|
<!-- |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2025-01-21 16:53:22 |
||||
|
@ 备注: 按日设置规则 |
||||
|
--> |
||||
|
<script lang="ts" setup> |
||||
|
import { workTeams } from "@/api/hr/people/type"; |
||||
|
const props = defineProps({ |
||||
|
teamInfo: { |
||||
|
type: Object, |
||||
|
default() { |
||||
|
return {}; |
||||
|
}, |
||||
|
}, |
||||
|
tiemList: { |
||||
|
type: Object, |
||||
|
default() { |
||||
|
return {}; |
||||
|
}, |
||||
|
}, |
||||
|
}); |
||||
|
const dayList = reactive<workTeams>([]); |
||||
|
onMounted(() => { |
||||
|
dayList.push({ |
||||
|
id: "1", |
||||
|
name: "1", |
||||
|
value: "", |
||||
|
}); |
||||
|
}); |
||||
|
</script> |
||||
|
<template> |
||||
|
<el-scrollbar> |
||||
|
<div class="scrollbar-flex-content"> |
||||
|
<div v-for="item in dayList" :key="item.id" class="infobox"> |
||||
|
<div class="titleBox">{{ item.name }}</div> |
||||
|
<el-select v-model="item.value" placeholder=""> |
||||
|
<el-option |
||||
|
v-for="item in props.tiemList" |
||||
|
:key="item.id" |
||||
|
:label="item.name" |
||||
|
:value="item.id" |
||||
|
> |
||||
|
</el-option> |
||||
|
</el-select> |
||||
|
</div> |
||||
|
<div class="infoAddbox"> |
||||
|
<i class="fa fa-plus"></i> |
||||
|
</div> |
||||
|
</div> |
||||
|
</el-scrollbar> |
||||
|
</template> |
||||
|
<style lang="scss" scoped> |
||||
|
.scrollbar-flex-content { |
||||
|
display: flex; |
||||
|
border-left: 1px solid rgb(177.3, 179.4, 183.6); |
||||
|
} |
||||
|
.scrollbar-demo-item { |
||||
|
flex-shrink: 0; |
||||
|
display: flex; |
||||
|
align-items: center; |
||||
|
justify-content: center; |
||||
|
width: 100px; |
||||
|
height: 50px; |
||||
|
margin: 10px; |
||||
|
text-align: center; |
||||
|
border-radius: 4px; |
||||
|
background: var(--el-color-danger-light-9); |
||||
|
color: var(--el-color-danger); |
||||
|
} |
||||
|
.infobox { |
||||
|
width: 100px; |
||||
|
text-align: center; |
||||
|
border: 1px solid rgb(177.3, 179.4, 183.6); |
||||
|
margin-left: -1px; |
||||
|
.titleBox { |
||||
|
background-color: rgb(177.3, 179.4, 183.6); |
||||
|
} |
||||
|
} |
||||
|
.infoAddbox { |
||||
|
width: 50px; |
||||
|
border: 1px solid rgb(177.3, 179.4, 183.6); |
||||
|
margin-left: -1px; |
||||
|
display: flex; |
||||
|
align-items: center; /* 垂直居中 */ |
||||
|
justify-content: center; /* 水平居中 */ |
||||
|
font-size: 30px; |
||||
|
color: rgb(51.2, 126.4, 204); |
||||
|
cursor: pointer; |
||||
|
} |
||||
|
</style> |
||||
@ -0,0 +1,10 @@ |
|||||
|
<!-- |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2025-01-21 16:53:22 |
||||
|
@ 备注: 按月设置规则 |
||||
|
--> |
||||
|
<script lang="ts" setup></script> |
||||
|
<template> |
||||
|
<div></div> |
||||
|
</template> |
||||
|
<style lang="scss" scoped></style> |
||||
@ -0,0 +1,10 @@ |
|||||
|
<!-- |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2025-01-21 16:53:22 |
||||
|
@ 备注: 按季度设置规则 |
||||
|
--> |
||||
|
<script lang="ts" setup></script> |
||||
|
<template> |
||||
|
<div></div> |
||||
|
</template> |
||||
|
<style lang="scss" scoped></style> |
||||
@ -0,0 +1,11 @@ |
|||||
|
<!-- |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2025-01-21 16:53:22 |
||||
|
@ 备注: 按周设置规则 |
||||
|
--> |
||||
|
<script lang="ts" setup></script> |
||||
|
<template> |
||||
|
<div></div> |
||||
|
</template> |
||||
|
<style lang="scss" scoped></style> |
||||
|
|
||||
@ -0,0 +1,713 @@ |
|||||
|
<!-- |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2025-01-22 10:01:49 |
||||
|
@ 备注: 以班组为基准 |
||||
|
--> |
||||
|
<script lang="ts" setup> |
||||
|
import constTimeVal from "@/api/calendar/dayWeekMonthYears"; |
||||
|
import { guiZeInfo, teamsPickTry, workTeams } from "@/api/hr/people/type"; |
||||
|
const props = defineProps({ |
||||
|
pickCycle: { |
||||
|
type: String, |
||||
|
default: "1", |
||||
|
}, |
||||
|
teamInfo: { |
||||
|
type: Object, |
||||
|
default() { |
||||
|
return {}; |
||||
|
}, |
||||
|
}, |
||||
|
tiemList: { |
||||
|
type: Object, |
||||
|
default() { |
||||
|
return {}; |
||||
|
}, |
||||
|
}, |
||||
|
rulerInfo: { |
||||
|
type: Object, |
||||
|
default() { |
||||
|
return {}; |
||||
|
}, |
||||
|
}, |
||||
|
}); |
||||
|
/** |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2025-01-22 15:20:14 |
||||
|
@ 功能: 当月最后一天 |
||||
|
*/ |
||||
|
const getCurrentMonthDays = () => { |
||||
|
const now = new Date(); |
||||
|
const year = now.getFullYear(); |
||||
|
const month = now.getMonth() + 1; // 注意月份从 0 开始,所以要加 1 |
||||
|
|
||||
|
// 获取当月的最后一天 |
||||
|
const lastDay = new Date(year, month, 0); |
||||
|
return lastDay.getDate(); |
||||
|
}; |
||||
|
|
||||
|
const emits = defineEmits(["update:pickCycle", "restdata"]); |
||||
|
const dayList = reactive<workTeams>([]); |
||||
|
const lunXunRule = ref<guiZeInfo[]>([]); |
||||
|
const teamPick = ref([]); |
||||
|
let jiShuQi = 1; |
||||
|
onMounted(() => { |
||||
|
let listAry = []; |
||||
|
switch (props.pickCycle) { |
||||
|
case 2: //周 |
||||
|
listAry = constTimeVal.week; |
||||
|
break; |
||||
|
case 3: //月 |
||||
|
let lastDay = getCurrentMonthDays(); |
||||
|
console.log("最后一天", lastDay); |
||||
|
for (let i = 1; i <= lastDay; i++) { |
||||
|
listAry.push({ |
||||
|
id: i, |
||||
|
name: i.toString(), |
||||
|
value: "", |
||||
|
days: i.toString(), |
||||
|
}); |
||||
|
} |
||||
|
break; |
||||
|
case 4: //季度 |
||||
|
for (let i = 1; i <= 90; i++) { |
||||
|
listAry.push({ |
||||
|
id: i, |
||||
|
name: i.toString(), |
||||
|
value: "", |
||||
|
days: i.toString(), |
||||
|
}); |
||||
|
} |
||||
|
break; |
||||
|
case 5: //年 |
||||
|
for (let i = 1; i <= 365; i++) { |
||||
|
listAry.push({ |
||||
|
id: i, |
||||
|
name: i.toString(), |
||||
|
value: "", |
||||
|
days: i.toString(), |
||||
|
}); |
||||
|
} |
||||
|
break; |
||||
|
default: |
||||
|
for (let i = 1; i <= jiShuQi; i++) { |
||||
|
listAry.push({ |
||||
|
id: i, |
||||
|
name: i.toString(), |
||||
|
value: "", |
||||
|
days: i.toString(), |
||||
|
}); |
||||
|
} |
||||
|
break; |
||||
|
} |
||||
|
lunXunRule.value.push({ |
||||
|
id: "", |
||||
|
name: "", |
||||
|
list: listAry, |
||||
|
}); |
||||
|
}); |
||||
|
watch( |
||||
|
() => props.pickCycle, |
||||
|
(val: any) => { |
||||
|
let listAry = []; |
||||
|
switch (props.pickCycle) { |
||||
|
case 2: //周 |
||||
|
listAry = []; |
||||
|
listAry = constTimeVal.week; |
||||
|
|
||||
|
lunXunRule.value.forEach((item: guiZeInfo) => { |
||||
|
item.list = listAry; |
||||
|
}); |
||||
|
break; |
||||
|
case 3: //月 |
||||
|
listAry = []; |
||||
|
let lastDay = getCurrentMonthDays(); |
||||
|
console.log("最后一天", lastDay); |
||||
|
for (let i = 1; i <= lastDay; i++) { |
||||
|
listAry.push({ |
||||
|
id: i, |
||||
|
name: i.toString(), |
||||
|
value: "", |
||||
|
days: i.toString(), |
||||
|
}); |
||||
|
} |
||||
|
lunXunRule.value.forEach((item: guiZeInfo) => { |
||||
|
item.list = listAry; |
||||
|
}); |
||||
|
break; |
||||
|
case 4: //季度 |
||||
|
listAry = []; |
||||
|
for (let i = 1; i <= 90; i++) { |
||||
|
listAry.push({ |
||||
|
id: i, |
||||
|
name: i.toString(), |
||||
|
value: "", |
||||
|
days: i.toString(), |
||||
|
}); |
||||
|
} |
||||
|
lunXunRule.value.forEach((item: guiZeInfo) => { |
||||
|
item.list = listAry; |
||||
|
}); |
||||
|
break; |
||||
|
case 5: //年 |
||||
|
listAry = []; |
||||
|
for (let i = 1; i <= 365; i++) { |
||||
|
listAry.push({ |
||||
|
id: i, |
||||
|
name: i.toString(), |
||||
|
value: "", |
||||
|
days: i.toString(), |
||||
|
}); |
||||
|
} |
||||
|
lunXunRule.value.forEach((item: guiZeInfo) => { |
||||
|
item.list = listAry; |
||||
|
}); |
||||
|
break; |
||||
|
default: |
||||
|
listAry = []; |
||||
|
jiShuQi = 1; |
||||
|
// for (let i = 1; i <= jiShuQi; i++) { |
||||
|
// listAry.push({ |
||||
|
// id: i, |
||||
|
// name: i.toString(), |
||||
|
// value: "", |
||||
|
// }); |
||||
|
// } |
||||
|
lunXunRule.value.splice(0); |
||||
|
lunXunRule.value.push({ |
||||
|
id: "", |
||||
|
name: "", |
||||
|
list: [ |
||||
|
{ |
||||
|
id: jiShuQi, |
||||
|
name: jiShuQi.toString(), |
||||
|
value: "", |
||||
|
days: jiShuQi.toString(), |
||||
|
}, |
||||
|
], |
||||
|
}); |
||||
|
break; |
||||
|
} |
||||
|
|
||||
|
console.log("计步器", jiShuQi); |
||||
|
}, |
||||
|
{ |
||||
|
deep: true, |
||||
|
} |
||||
|
); |
||||
|
//周期变化 |
||||
|
// const pickCycleVal = computed({ |
||||
|
// get: () => { |
||||
|
// let listAry = []; |
||||
|
// switch (props.pickCycle) { |
||||
|
// case 2: //周 |
||||
|
// listAry = constTimeVal.week; |
||||
|
// break; |
||||
|
// case 3: //月 |
||||
|
// let lastDay = getCurrentMonthDays(); |
||||
|
// console.log("最后一天", lastDay); |
||||
|
// for (let i = 1; i <= lastDay; i++) { |
||||
|
// listAry.push({ |
||||
|
// id: i, |
||||
|
// name: i.toString(), |
||||
|
// value: "", |
||||
|
// }); |
||||
|
// } |
||||
|
// break; |
||||
|
// case 4: //季度 |
||||
|
// for (let i = 1; i <= 90; i++) { |
||||
|
// listAry.push({ |
||||
|
// id: i, |
||||
|
// name: i.toString(), |
||||
|
// value: "", |
||||
|
// }); |
||||
|
// } |
||||
|
// break; |
||||
|
// case 5: //年 |
||||
|
// for (let i = 1; i <= 365; i++) { |
||||
|
// listAry.push({ |
||||
|
// id: i, |
||||
|
// name: i.toString(), |
||||
|
// value: "", |
||||
|
// }); |
||||
|
// } |
||||
|
// break; |
||||
|
// default: |
||||
|
// jiShuQi = 1; |
||||
|
// listAry = [ |
||||
|
// { |
||||
|
// id: jiShuQi, |
||||
|
// name: jiShuQi.toString(), |
||||
|
// value: "", |
||||
|
// }, |
||||
|
// ]; |
||||
|
// break; |
||||
|
// } |
||||
|
// lunXunRule.forEach((item: guiZeInfo) => { |
||||
|
// item.list = listAry; |
||||
|
// }); |
||||
|
// console.log("转黄", lunXunRule); |
||||
|
// return props.pickCycle; |
||||
|
// }, |
||||
|
// set: (val) => { |
||||
|
// emits("update:pickCycle", val); |
||||
|
// }, |
||||
|
// }); |
||||
|
/** |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2025-01-22 11:41:18 |
||||
|
@ 功能: 添加周期 |
||||
|
*/ |
||||
|
const addCycle = (val: any) => { |
||||
|
console.log("addCycle", val); |
||||
|
let valNum = val.length + 1; |
||||
|
let zhijie = { |
||||
|
id: valNum, |
||||
|
name: valNum.toString(), |
||||
|
value: "", |
||||
|
days: valNum.toString(), |
||||
|
}; |
||||
|
val.push(zhijie); |
||||
|
// if (lunXunRule && lunXunRule.length > 0) { |
||||
|
// console.log("添加周期1", lunXunRule); |
||||
|
// jiShuQi++; |
||||
|
// let zhijie = { |
||||
|
// id: jiShuQi, |
||||
|
// name: jiShuQi.toString(), |
||||
|
// value: "", |
||||
|
// days: jiShuQi.toString(), |
||||
|
// }; |
||||
|
// lunXunRule.forEach((item: guiZeInfo) => { |
||||
|
// console.log("添加周期1------->", item.list, zhijie, item.list.length); |
||||
|
// // item.list[item.list.length] = zhijie; |
||||
|
// item.list.push(zhijie); |
||||
|
// }); |
||||
|
// } else { |
||||
|
// console.log("添加周期2", lunXunRule.list); |
||||
|
// jiShuQi = 1; |
||||
|
// lunXunRule.push({ |
||||
|
// id: "", |
||||
|
// name: "", |
||||
|
// list: [ |
||||
|
// { |
||||
|
// id: jiShuQi, |
||||
|
// name: jiShuQi, |
||||
|
// value: "", |
||||
|
// days: jiShuQi.toString(), |
||||
|
// }, |
||||
|
// ], |
||||
|
// }); |
||||
|
// } |
||||
|
|
||||
|
// console.log("添加周期", lunXunRule); |
||||
|
}; |
||||
|
/** |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2025-01-22 13:59:16 |
||||
|
@ 功能: 添加班次 |
||||
|
*/ |
||||
|
const addTeamsInfo = () => { |
||||
|
console.log("添加班次", jiShuQi); |
||||
|
|
||||
|
let listAry = []; |
||||
|
switch (props.pickCycle) { |
||||
|
case 2: //周 |
||||
|
listAry = constTimeVal.week; |
||||
|
break; |
||||
|
case 3: //月 |
||||
|
let lastDay = getCurrentMonthDays(); |
||||
|
console.log("最后一天", lastDay); |
||||
|
for (let i = 1; i <= lastDay; i++) { |
||||
|
listAry.push({ |
||||
|
id: i, |
||||
|
name: i.toString(), |
||||
|
value: "", |
||||
|
days: i.toString(), |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
break; |
||||
|
case 4: //季度 |
||||
|
console.log("最后si天", props.pickCycle); |
||||
|
for (let i = 1; i <= 90; i++) { |
||||
|
listAry.push({ |
||||
|
id: i, |
||||
|
name: i.toString(), |
||||
|
value: "", |
||||
|
days: i.toString(), |
||||
|
}); |
||||
|
} |
||||
|
break; |
||||
|
case 5: //年 |
||||
|
console.log("最后nian天", vprops.pickCycle); |
||||
|
for (let i = 1; i <= 365; i++) { |
||||
|
listAry.push({ |
||||
|
id: i, |
||||
|
name: i.toString(), |
||||
|
value: "", |
||||
|
days: i.toString(), |
||||
|
}); |
||||
|
} |
||||
|
break; |
||||
|
default: |
||||
|
for (let j = 1; j <= jiShuQi; j++) { |
||||
|
listAry.push({ |
||||
|
id: j, |
||||
|
name: j.toString(), |
||||
|
value: "", |
||||
|
days: j.toString(), |
||||
|
}); |
||||
|
} |
||||
|
// console.log("最天", props.pickCycle); |
||||
|
// console.log("最天", listAry); |
||||
|
// console.log("最天", jiShuQi); |
||||
|
break; |
||||
|
} |
||||
|
// lunXunRule.forEach((item: guiZeInfo) => { |
||||
|
// item.list = listAry; |
||||
|
// }); |
||||
|
|
||||
|
// let zhouqi = []; |
||||
|
// for (let j = 1; j <= jiShuQi; j++) { |
||||
|
// zhouqi.push({ |
||||
|
// id: j, |
||||
|
// name: j.toString(), |
||||
|
// value: "", |
||||
|
// }); |
||||
|
// } |
||||
|
console.log("最天------------->", lunXunRule, listAry); |
||||
|
lunXunRule.value.push({ |
||||
|
id: "", |
||||
|
name: "", |
||||
|
list: listAry, |
||||
|
}); |
||||
|
console.log("最天------2324------->", lunXunRule); |
||||
|
}; |
||||
|
/** |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2025-01-22 14:25:44 |
||||
|
@ 功能: 删除轮询周期 |
||||
|
*/ |
||||
|
const delCycle = (val: any) => { |
||||
|
if (val && val.length > 0) { |
||||
|
val.pop(); |
||||
|
} |
||||
|
// if (lunXunRule && lunXunRule.length > 1) { |
||||
|
// console.log("删除轮询周期", lunXunRule); |
||||
|
// lunXunRule.forEach((item: guiZeInfo) => { |
||||
|
// item.list.pop(); |
||||
|
// jiShuQi = item.list.length; |
||||
|
// }); |
||||
|
// } |
||||
|
}; |
||||
|
/** |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2025-01-22 14:40:09 |
||||
|
@ 功能: 删除班次 |
||||
|
*/ |
||||
|
const delCycleTeam = (val: number) => { |
||||
|
if (lunXunRule.value && lunXunRule.value.length > 1) { |
||||
|
console.log("删除班次", val); |
||||
|
lunXunRule.value.splice(val, 1); |
||||
|
} |
||||
|
}; |
||||
|
//监听轮询变换 |
||||
|
watch( |
||||
|
() => lunXunRule.value, |
||||
|
(val: guiZeInfo[]) => { |
||||
|
emits("restdata", val); |
||||
|
if (val && val.length > 0) { |
||||
|
teamPick.value = []; |
||||
|
val.forEach((item: guiZeInfo) => { |
||||
|
teamPick.value.push(item.id); |
||||
|
|
||||
|
if (props.tiemList && props.tiemList.length > 0) { |
||||
|
props.tiemList.forEach((tlItem: any) => { |
||||
|
if (item.id == tlItem.id) { |
||||
|
item.name = tlItem.name; |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
if (props.teamInfo.list && props.teamInfo.list.length > 0) { |
||||
|
props.teamInfo.list.forEach((itemTeam: any) => { |
||||
|
// console.log("班组", itemTeam); |
||||
|
// console.log("班组--1--》", item.list); |
||||
|
if (item.list && item.list.length > 0) { |
||||
|
item.list.forEach((itVal: any) => { |
||||
|
// console.log("班组----》", itVal); |
||||
|
if (itVal.value == itemTeam.id) { |
||||
|
itVal.days = itemTeam.title; |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
deep: true, |
||||
|
} |
||||
|
); |
||||
|
/** |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2025-01-22 14:51:14 |
||||
|
@ 功能: 判断是否已经选择 |
||||
|
*/ |
||||
|
const isPickVal = (id: string) => { |
||||
|
if (teamPick.value && teamPick.value.length > 0) { |
||||
|
// console.log("判断是否已经选择", teamPick.value.includes(id)); |
||||
|
return teamPick.value.includes(id); |
||||
|
} |
||||
|
return false; |
||||
|
}; |
||||
|
/** |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2025-01-23 08:22:04 |
||||
|
@ 功能: 初始化数据 |
||||
|
*/ |
||||
|
const initWorkTime = () => { |
||||
|
// let listAry = []; |
||||
|
// switch (props.pickCycle) { |
||||
|
// case 2: //周 |
||||
|
// listAry = []; |
||||
|
// listAry = constTimeVal.week; |
||||
|
|
||||
|
// lunXunRule.forEach((item: guiZeInfo) => { |
||||
|
// item.list = listAry; |
||||
|
// }); |
||||
|
// break; |
||||
|
// case 3: //月 |
||||
|
// listAry = []; |
||||
|
// let lastDay = getCurrentMonthDays(); |
||||
|
// console.log("最后一天", lastDay); |
||||
|
// for (let i = 1; i <= lastDay; i++) { |
||||
|
// listAry.push({ |
||||
|
// id: i, |
||||
|
// name: i.toString(), |
||||
|
// value: "", |
||||
|
// days: i.toString(), |
||||
|
// }); |
||||
|
// } |
||||
|
// lunXunRule.forEach((item: guiZeInfo) => { |
||||
|
// item.list = listAry; |
||||
|
// }); |
||||
|
// break; |
||||
|
// case 4: //季度 |
||||
|
// listAry = []; |
||||
|
// for (let i = 1; i <= 90; i++) { |
||||
|
// listAry.push({ |
||||
|
// id: i, |
||||
|
// name: i.toString(), |
||||
|
// value: "", |
||||
|
// days: i.toString(), |
||||
|
// }); |
||||
|
// } |
||||
|
// lunXunRule.forEach((item: guiZeInfo) => { |
||||
|
// item.list = listAry; |
||||
|
// }); |
||||
|
// break; |
||||
|
// case 5: //年 |
||||
|
// listAry = []; |
||||
|
// for (let i = 1; i <= 365; i++) { |
||||
|
// listAry.push({ |
||||
|
// id: i, |
||||
|
// name: i.toString(), |
||||
|
// value: "", |
||||
|
// days: i.toString(), |
||||
|
// }); |
||||
|
// } |
||||
|
// lunXunRule.forEach((item: guiZeInfo) => { |
||||
|
// item.list = listAry; |
||||
|
// }); |
||||
|
// break; |
||||
|
// default: |
||||
|
// listAry = []; |
||||
|
// jiShuQi = 1; |
||||
|
// lunXunRule.splice(0); |
||||
|
// lunXunRule.push({ |
||||
|
// id: "", |
||||
|
// name: "", |
||||
|
// list: [ |
||||
|
// { |
||||
|
// id: jiShuQi, |
||||
|
// name: jiShuQi.toString(), |
||||
|
// value: "", |
||||
|
// days: jiShuQi.toString(), |
||||
|
// }, |
||||
|
// ], |
||||
|
// }); |
||||
|
// break; |
||||
|
// } |
||||
|
// listAry = []; |
||||
|
jiShuQi = 1; |
||||
|
lunXunRule.value.splice(0); |
||||
|
lunXunRule.value.push({ |
||||
|
id: "", |
||||
|
name: "", |
||||
|
list: [ |
||||
|
{ |
||||
|
id: jiShuQi, |
||||
|
name: jiShuQi.toString(), |
||||
|
value: "", |
||||
|
days: jiShuQi.toString(), |
||||
|
}, |
||||
|
], |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
/** |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2025-01-23 13:19:32 |
||||
|
@ 功能: 回填规则 |
||||
|
*/ |
||||
|
const callBackData = (val: any) => { |
||||
|
lunXunRule.value.splice(0); |
||||
|
if (val && val.length > 0) { |
||||
|
} |
||||
|
lunXunRule.value = val; |
||||
|
// val.forEach((item: any) => { |
||||
|
// console.log("回填规则-2-->", item); |
||||
|
// lunXunRule.value.push(item); |
||||
|
// }); |
||||
|
console.log("回填规则--->", val); |
||||
|
console.log("回填规则", lunXunRule.value); |
||||
|
}; |
||||
|
|
||||
|
defineExpose({ |
||||
|
initWorkTime, |
||||
|
callBackData, |
||||
|
}); |
||||
|
</script> |
||||
|
<template> |
||||
|
<table cellspacing="1" class="table_body" style="width: 100%"> |
||||
|
<tr> |
||||
|
<td width="150">参与班次</td> |
||||
|
<td>周期</td> |
||||
|
<td v-if="props.pickCycle == 1" width="120">操作</td> |
||||
|
</tr> |
||||
|
<tr v-for="(item, index) in lunXunRule" :key="item.id"> |
||||
|
<td> |
||||
|
<el-select v-model="item.id" placeholder="请选择班组" clearable> |
||||
|
<el-option |
||||
|
v-for="items in props.tiemList" |
||||
|
:key="items.id.toString()" |
||||
|
:label="items.name" |
||||
|
:value="items.id.toString()" |
||||
|
:disabled="isPickVal(items.id.toString())" |
||||
|
> |
||||
|
</el-option> |
||||
|
</el-select> |
||||
|
<el-button |
||||
|
v-if="lunXunRule && lunXunRule.length > 1" |
||||
|
type="danger" |
||||
|
size="small" |
||||
|
@click="delCycleTeam(index)" |
||||
|
>删除班次</el-button |
||||
|
> |
||||
|
</td> |
||||
|
<td align="left" style="display: grid"> |
||||
|
<div class="jksfd"> |
||||
|
<div |
||||
|
v-for="(itemDay, indexDay) in item.list" |
||||
|
:key="index + '_' + itemDay.id + '_' + indexDay" |
||||
|
class="infobox" |
||||
|
> |
||||
|
<div class="titleBox"> |
||||
|
<el-text>{{ itemDay.name }}</el-text> |
||||
|
</div> |
||||
|
<div class="selectBox"> |
||||
|
<el-select |
||||
|
v-model="itemDay.value" |
||||
|
placeholder="请选择工作时间段" |
||||
|
clearable |
||||
|
:key="index + '_' + itemDay.id + '_' + indexDay" |
||||
|
> |
||||
|
<el-option |
||||
|
v-for="itemGroup in props.teamInfo.list" |
||||
|
:key="index + '_' + itemDay.id + '_' + indexDay" |
||||
|
:label=" |
||||
|
itemGroup.title + |
||||
|
'(' + |
||||
|
itemGroup.startTime + |
||||
|
'-' + |
||||
|
itemGroup.endTime + |
||||
|
')' |
||||
|
" |
||||
|
:value="itemGroup.id.toString()" |
||||
|
> |
||||
|
</el-option> |
||||
|
</el-select> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</td> |
||||
|
<td> |
||||
|
<el-button type="primary" @click.top="addCycle(item.list)" |
||||
|
><i class="fa fa-plus"></i |
||||
|
></el-button> |
||||
|
<el-button |
||||
|
v-if="item.list && item.list.length > 1" |
||||
|
type="danger" |
||||
|
@click.top="delCycle(item.list)" |
||||
|
><i class="fa fa-minus"></i |
||||
|
></el-button> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td :colspan="props.pickCycle == 1 ? 3 : 2"> |
||||
|
<el-button @click="addTeamsInfo" type="success" style="margin-bottom: 5px" |
||||
|
>添加参数班次</el-button |
||||
|
> |
||||
|
</td> |
||||
|
</tr> |
||||
|
</table> |
||||
|
</template> |
||||
|
<style lang="scss" scoped> |
||||
|
.table_body { |
||||
|
background-color: #ffffff; |
||||
|
|
||||
|
border-collapse: collapse; |
||||
|
/* |
||||
|
* 设置边框 |
||||
|
*/ |
||||
|
td, |
||||
|
th { |
||||
|
border: 1px solid #f0f0f0; |
||||
|
padding: 5px 5px 0 5px; |
||||
|
text-align: center; |
||||
|
} |
||||
|
} |
||||
|
.tdWidth { |
||||
|
width: 200px; |
||||
|
} |
||||
|
.jksfd { |
||||
|
display: flex; |
||||
|
width: 100%; |
||||
|
overflow: hidden; |
||||
|
overflow-x: auto; |
||||
|
.infobox { |
||||
|
width: 200px; |
||||
|
text-align: center; |
||||
|
border: 1px solid rgb(177.3, 179.4, 183.6); |
||||
|
// margin-left: -1px; |
||||
|
margin-bottom: 5px; |
||||
|
.selectBox { |
||||
|
padding: 5px; |
||||
|
} |
||||
|
.titleBox { |
||||
|
display: flex; |
||||
|
width: 200px; |
||||
|
background-color: rgb(177.3, 179.4, 183.6); |
||||
|
span { |
||||
|
width: 90%; |
||||
|
} |
||||
|
i { |
||||
|
margin-right: 5px; |
||||
|
margin-top: 8px; |
||||
|
cursor: pointer; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</style> |
||||
@ -0,0 +1,10 @@ |
|||||
|
<!-- |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2025-01-21 16:53:22 |
||||
|
@ 备注: 按年设置规则 |
||||
|
--> |
||||
|
<script lang="ts" setup></script> |
||||
|
<template> |
||||
|
<div></div> |
||||
|
</template> |
||||
|
<style lang="scss" scoped></style> |
||||
@ -0,0 +1,187 @@ |
|||||
|
<!-- |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2025-01-14 11:17:13 |
||||
|
@ 备注: 班次管理 |
||||
|
--> |
||||
|
<script lang="ts" setup> |
||||
|
import { TimesClassInfo } from "@/api/hr/people/type"; |
||||
|
import { teamTimeList, editWorkTimeState } from "@/api/hr/people/index"; |
||||
|
|
||||
|
import AddClass from "@/views/hr/teams/classTime/addClass.vue"; |
||||
|
import EditClass from "@/views/hr/teams/classTime/editClass.vue"; |
||||
|
|
||||
|
const searchData = reactive({ |
||||
|
name: "", |
||||
|
}); |
||||
|
const searchFormRef = ref(ElForm); |
||||
|
const timeClassList = ref<TimesClassInfo[]>([]); |
||||
|
const teamLookInfo = ref<TimesClassInfo>(); |
||||
|
const addIsShow = ref(false); |
||||
|
const editIsShow = ref(false); |
||||
|
const setupIsShow = ref(false); |
||||
|
/** |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2025-01-14 11:34:57 |
||||
|
@ 功能: 获取班次列表 |
||||
|
*/ |
||||
|
const getTimeClassList = () => { |
||||
|
teamTimeList(searchData).then((data: any) => { |
||||
|
timeClassList.value = data.data; |
||||
|
}); |
||||
|
}; |
||||
|
/** |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2025-01-14 11:39:01 |
||||
|
@ 功能: 查询班次 |
||||
|
*/ |
||||
|
const searchSubmit = () => { |
||||
|
getTimeClassList(); |
||||
|
}; |
||||
|
/** |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2025-01-14 13:14:17 |
||||
|
@ 功能: 改变班次轮询规则状态 |
||||
|
*/ |
||||
|
const switchChange = (val: any) => { |
||||
|
// console.log("改变班次轮询规则状态", val); |
||||
|
let setState = 2; |
||||
|
if (val.states) setState = 1; |
||||
|
let sendData = { |
||||
|
id: val.id.toString(), |
||||
|
state: setState, |
||||
|
constrain: 2, |
||||
|
}; |
||||
|
editWorkTimeState(sendData).then((data: any) => { |
||||
|
getTimeClassList(); |
||||
|
}); |
||||
|
}; |
||||
|
/** |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2025-01-14 13:31:30 |
||||
|
@ 功能: 新增班次轮询规则 |
||||
|
*/ |
||||
|
const addNewCont = () => { |
||||
|
// console.log("新增班次轮询规则"); |
||||
|
addIsShow.value = true; |
||||
|
// console.log("新增班次轮询规则", addIsShow.value); |
||||
|
}; |
||||
|
/** |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2025-01-15 09:16:08 |
||||
|
@ 功能: 编辑班次轮询 |
||||
|
*/ |
||||
|
const showEdit = (val: any) => { |
||||
|
teamLookInfo.value = val; |
||||
|
editIsShow.value = true; |
||||
|
}; |
||||
|
/** |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2025-01-15 09:12:06 |
||||
|
@ 功能: 删除班次轮询 |
||||
|
*/ |
||||
|
const deleteOperate = (val: any) => { |
||||
|
ElMessageBox.confirm("您确定要删除此内容?一经删除!内容将不可恢复!", "Warning", { |
||||
|
confirmButtonText: "确定", |
||||
|
cancelButtonText: "取消", |
||||
|
type: "warning", |
||||
|
}) |
||||
|
.then(() => { |
||||
|
let sendData = { |
||||
|
id: val.id.toString(), |
||||
|
state: 3, |
||||
|
constrain: 2, |
||||
|
}; |
||||
|
editWorkTimeState(sendData).then((data: any) => { |
||||
|
getTimeClassList(); |
||||
|
}); |
||||
|
}) |
||||
|
.catch(() => {}); |
||||
|
}; |
||||
|
//数据加载 |
||||
|
onMounted(() => { |
||||
|
getTimeClassList(); |
||||
|
}); |
||||
|
</script> |
||||
|
<template> |
||||
|
<div class="app-container"> |
||||
|
<AddClass v-model:open="addIsShow" @restdata="getTimeClassList" /> |
||||
|
<EditClass |
||||
|
v-model:open="editIsShow" |
||||
|
:team-info="teamLookInfo" |
||||
|
@restdata="getTimeClassList" |
||||
|
/> |
||||
|
<el-card shadow="never"> |
||||
|
<template #header> |
||||
|
<el-form ref="searchFormRef" :model="searchData" :inline="true"> |
||||
|
<el-form-item label="班次名称"> |
||||
|
<el-input v-model="searchData.name" clearable></el-input> |
||||
|
</el-form-item> |
||||
|
<el-form-item> |
||||
|
<el-button type="primary" @click="searchSubmit" |
||||
|
><i class="fa fa-search"></i>查询</el-button |
||||
|
> |
||||
|
</el-form-item> |
||||
|
<el-form-item> |
||||
|
<el-button type="warning" @click="addNewCont" |
||||
|
><i class="fa fa-plus"></i>新增</el-button |
||||
|
> |
||||
|
</el-form-item> |
||||
|
</el-form> |
||||
|
</template> |
||||
|
<el-table :data="timeClassList" style="width: 100%"> |
||||
|
<el-table-column prop="name" label="名称" width="200"> </el-table-column> |
||||
|
<el-table-column prop="rulename" label="轮询规则"> </el-table-column> |
||||
|
<el-table-column label="工作时段安排"> |
||||
|
<template #default="scope"> |
||||
|
<el-row v-for="item in scope.row.list" :key="item.title"> |
||||
|
<el-col :span="24" |
||||
|
>{{ item.title }} 工作时间:{{ item.startTime }} - |
||||
|
{{ item.endTime }}</el-col |
||||
|
> |
||||
|
</el-row> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
|
||||
|
<el-table-column label="状态" width="100"> |
||||
|
<template #default="scope"> |
||||
|
<el-switch |
||||
|
@change="switchChange(scope.row)" |
||||
|
style="display: block" |
||||
|
v-model="scope.row.states" |
||||
|
active-color="#13ce66" |
||||
|
inactive-color="#ff4949" |
||||
|
active-text="启用" |
||||
|
inactive-text="禁用" |
||||
|
inline-prompt |
||||
|
> |
||||
|
</el-switch> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
|
||||
|
<el-table-column |
||||
|
align="center" |
||||
|
fixed="right" |
||||
|
label="操作" |
||||
|
width="160" |
||||
|
header-align="center" |
||||
|
> |
||||
|
<template #default="scope"> |
||||
|
<el-button v-if="false" size="small" @click="setOrigin(scope.row)" |
||||
|
>设置源点</el-button |
||||
|
> |
||||
|
|
||||
|
<el-button size="small" @click="showEdit(scope.row)">编辑</el-button> |
||||
|
<el-button size="small" @click="deleteOperate(scope.row)">删除</el-button> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
</el-table> |
||||
|
</el-card> |
||||
|
</div> |
||||
|
</template> |
||||
|
<style lang="scss" scoped> |
||||
|
.app-container { |
||||
|
:deep .el-card__header { |
||||
|
padding-bottom: 0px; |
||||
|
} |
||||
|
} |
||||
|
</style> |
||||
Loading…
Reference in new issue