mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-07 18:06:46 +08:00
feat: 添加功能
日期框取消后,后续主动定位到相应的选项中
This commit is contained in:
@@ -775,7 +775,7 @@
|
|||||||
<!-- 不限制时间 -->
|
<!-- 不限制时间 -->
|
||||||
<a-checkbox :checked="signDateTimeType === signTimeSection.NoLimit"
|
<a-checkbox :checked="signDateTimeType === signTimeSection.NoLimit"
|
||||||
@change="handleSelectSignDateTime(signTimeSection.NoLimit)">
|
@change="handleSelectSignDateTime(signTimeSection.NoLimit)">
|
||||||
<span class="grey-color">不限制时间</span>
|
<span class="grey-color">不限制</span>
|
||||||
|
|
||||||
<span v-if="signDateTimeType === signTimeSection.NoLimit" class="grey-color ml-10">
|
<span v-if="signDateTimeType === signTimeSection.NoLimit" class="grey-color ml-10">
|
||||||
{{ signDateTimeRange }}
|
{{ signDateTimeRange }}
|
||||||
@@ -797,9 +797,9 @@
|
|||||||
<a-checkbox :checked="signDateTimeType === signTimeSection.Custom"
|
<a-checkbox :checked="signDateTimeType === signTimeSection.Custom"
|
||||||
@change="handleSelectSignDateTime(signTimeSection.Custom)">
|
@change="handleSelectSignDateTime(signTimeSection.Custom)">
|
||||||
<div class="flex-center">
|
<div class="flex-center">
|
||||||
<span class="grey-color">自定义时间</span>
|
<span class="grey-color">自定义</span>
|
||||||
<span v-if="signDateTimeType === signTimeSection.Custom" class="flex-center">
|
<span v-if="signDateTimeType === signTimeSection.Custom" class="flex-center">
|
||||||
<div class="flex-center">
|
<div class="flex-center ml-10">
|
||||||
<span style="color: #6d7584;margin-right:8px;">开始前</span>
|
<span style="color: #6d7584;margin-right:8px;">开始前</span>
|
||||||
<a-input-number :min="0" :max="999999" :precision="0" style="
|
<a-input-number :min="0" :max="999999" :precision="0" style="
|
||||||
width: 100px;
|
width: 100px;
|
||||||
@@ -3121,6 +3121,7 @@ export default defineComponent({
|
|||||||
state.assessmentName = ""; // 新增
|
state.assessmentName = ""; // 新增
|
||||||
};
|
};
|
||||||
const removePG = () => {
|
const removePG = () => {
|
||||||
|
resetSignDateTime()
|
||||||
console.log("11111");
|
console.log("11111");
|
||||||
state.changeName = false;
|
state.changeName = false;
|
||||||
state.assessmentId = null;
|
state.assessmentId = null;
|
||||||
@@ -3631,7 +3632,6 @@ export default defineComponent({
|
|||||||
removePG();
|
removePG();
|
||||||
};
|
};
|
||||||
//保存开课
|
//保存开课
|
||||||
|
|
||||||
const handleSureStu = async () => {
|
const handleSureStu = async () => {
|
||||||
if (editBeginClass.value) {
|
if (editBeginClass.value) {
|
||||||
message.info("讲师费已进入审批阶段,无法编辑");
|
message.info("讲师费已进入审批阶段,无法编辑");
|
||||||
@@ -3856,6 +3856,8 @@ export default defineComponent({
|
|||||||
state.offteachers = [...item.offteachers];
|
state.offteachers = [...item.offteachers];
|
||||||
state.cstm_hs = true;
|
state.cstm_hs = true;
|
||||||
state.kk_eidt = true;
|
state.kk_eidt = true;
|
||||||
|
|
||||||
|
switchSignDateTimeType(item.beforeStart, item.afterStart)
|
||||||
};
|
};
|
||||||
const columnFun = (itm) => {
|
const columnFun = (itm) => {
|
||||||
console.log("itm", itm);
|
console.log("itm", itm);
|
||||||
@@ -5056,62 +5058,115 @@ export default defineComponent({
|
|||||||
*/
|
*/
|
||||||
const signDateTimeRange = ref("默认");
|
const signDateTimeRange = ref("默认");
|
||||||
|
|
||||||
|
function resetSignDateTime() {
|
||||||
|
signDateTimeType.value = 0;
|
||||||
|
resetBeforeAndAfter()
|
||||||
|
}
|
||||||
|
function resetBeforeAndAfter() {
|
||||||
|
state.beforeValue = null
|
||||||
|
state.afterStartValue = null
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 签到时间类型
|
* 签到时间类型
|
||||||
*/
|
*/
|
||||||
const signDateTimeType = ref();
|
const signDateTimeType = ref();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理签到时间类型切换
|
* 处理签到时间类型切换
|
||||||
* @param type {typeof signTimeSection}
|
* @param type {typeof signTimeSection}
|
||||||
*/
|
*/
|
||||||
function handleSelectSignDateTime(type) {
|
function handleSelectSignDateTime(type) {
|
||||||
|
resetBeforeAndAfter()
|
||||||
// 重复点击取消按钮选中
|
// 重复点击取消按钮选中
|
||||||
if (type === signDateTimeType.value) {
|
if (type === signDateTimeType.value) {
|
||||||
signDateTimeType.value = 0;
|
resetSignDateTime()
|
||||||
state.beforeValue = null
|
|
||||||
state.afterStartValue = null
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
console.log("state.projectTime", state.xjkkinputV3)
|
|
||||||
if (!state.xjkkinputV3[1] || !state.xjkkinputV3[0]) {
|
if (!state.xjkkinputV3[1] || !state.xjkkinputV3[0]) {
|
||||||
message.error("请设置好面授时间")
|
message.error("请设置好面授时间")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 面授开课时间
|
||||||
|
const classStartTime = dayjs(state.xjkkinputV3[0])
|
||||||
|
// 面授结束时间
|
||||||
|
const classEndTime = dayjs(state.xjkkinputV3[1])
|
||||||
|
console.log("classStartTime", classStartTime, "classEndTime", classEndTime)
|
||||||
const { endSignTime, startSignTime } = getDayOfStartAndEnd()
|
const { endSignTime, startSignTime } = getDayOfStartAndEnd()
|
||||||
|
|
||||||
signDateTimeType.value = type;
|
signDateTimeType.value = type;
|
||||||
if (type === signTimeSection.NoLimit) {
|
if (type === signTimeSection.NoLimit) {
|
||||||
// 如果不限制,那么就是从当前时间开始,到课程结束时间结束
|
// 如果不限制,那么就是从当前时间开始,到课程结束时间结束
|
||||||
signDateTimeRange.value = `( 当前时间 至 ${endSignTime} )`;
|
signDateTimeRange.value = `( 当前时间 至 ${endSignTime} )`;
|
||||||
const classEndTime = state.xjkkinputV3[1]
|
|
||||||
const diffEndTime = classEndTime.diff(dayjs(), "minute")
|
|
||||||
state.beforeValue = diffEndTime
|
|
||||||
|
|
||||||
// console.log("before value", state.beforeValue)
|
const diffStartTime = (dayjs(classStartTime).diff(dayjs(), "minute"))
|
||||||
|
state.beforeValue = diffStartTime <= 0 ? 0 : diffStartTime
|
||||||
|
state.afterValue = (dayjs(endSignTime).diff(classEndTime, "minute"))
|
||||||
|
console.log("before value, after value", state.beforeValue, state.afterValue)
|
||||||
} else if (type === signTimeSection.OpenDay) {
|
} else if (type === signTimeSection.OpenDay) {
|
||||||
// 如果限制在开课时间,选项签到规则是课程创建的“面授时间”的起始时间至开课当日23时59分。
|
// 如果限制在开课时间,选项签到规则是课程创建的“面授时间”的起始时间至开课当日23时59分。
|
||||||
signDateTimeRange.value = `( ${startSignTime} 至 ${endSignTime} )`;
|
signDateTimeRange.value = `( ${startSignTime} 至 ${endSignTime} )`;
|
||||||
const classEndTime = state.xjkkinputV3[1]
|
state.afterStartValue = (dayjs(endSignTime).diff(classEndTime, "minute"))
|
||||||
const classStartTime = state.xjkkinputV3[0]
|
state.beforeValue = (dayjs(classStartTime).diff(startSignTime, "minute"))
|
||||||
|
console.log("before value, after value", state.beforeValue, state.afterStartValue)
|
||||||
const diffEnd = dayjs(endSignTime).diff(classEndTime, "minute")
|
|
||||||
const diffStart = dayjs(classStartTime).diff(startSignTime, "minute")
|
|
||||||
state.afterStartValue = diffEnd
|
|
||||||
state.beforeValue = diffStart
|
|
||||||
// console.log("after value", state.afterStartValue, "before value", state.beforeValue)
|
|
||||||
} else if (type === signTimeSection.Custom) {
|
} else if (type === signTimeSection.Custom) {
|
||||||
signDateTimeRange.value = "";
|
signDateTimeRange.value = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取开课和结束那天的终点时间
|
||||||
|
*/
|
||||||
|
function getDayOfStartAndEnd() {
|
||||||
|
const endSignTime = dayjs(dayjs(classEndTime).add(1, "day").format("YYYY-MM-DD")).subtract(1, "second").format("YYYY-MM-DD HH:mm:ss")
|
||||||
|
const startSignTime = dayjs(dayjs(classStartTime).format("YYYY-MM-DD")).format("YYYY-MM-DD HH:mm:ss")
|
||||||
|
return { startSignTime, endSignTime }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDayOfStartAndEnd() {
|
/**
|
||||||
const endSignTime = dayjs(state.xjkkinputV3[1].add(1, "day").format("YYYY-MM-DD"))
|
* 根据考勤开始前和考勤开始后的时间,切换签到时间类型
|
||||||
.subtract(1, "second")
|
* @param before
|
||||||
.format("YYYY-MM-DD HH:mm:ss")
|
* @param after
|
||||||
const startSignTime = dayjs(state.xjkkinputV3[0].format("YYYY-MM-DD")).format("YYYY-MM-DD HH:mm:ss")
|
*/
|
||||||
return { startSignTime, endSignTime }
|
function switchSignDateTimeType(before, after) {
|
||||||
|
signDateTimeType.value = 0
|
||||||
|
if (!before && !after) return;
|
||||||
|
const start = state.xjkkinputV3[0]
|
||||||
|
const end = state.xjkkinputV3[1]
|
||||||
|
|
||||||
|
//如果 end + after 的日期时间为 23:59:59,就排除自定义
|
||||||
|
// 如果 start - before 的日期时间为 00:00:00,就为开课当日
|
||||||
|
//反之则为不限制时间
|
||||||
|
const isLastSecond = dayjs(end).add(after, "minute").format("HH:mm:ss") === "23:59:00"
|
||||||
|
const isFirstSecond = dayjs(start).subtract(before, "minute").format("HH:mm:ss") === "00:00:00"
|
||||||
|
console.log("isLastSecond", isLastSecond, "isFirstSecond", isFirstSecond);
|
||||||
|
console.log(dayjs(end).add(after, "minute").format("HH:mm:ss"));
|
||||||
|
console.log(dayjs(start).subtract(before, "minute").format("HH:mm:ss"));
|
||||||
|
|
||||||
|
// 面授开课时间
|
||||||
|
const classStartTime = dayjs(state.xjkkinputV3[0])
|
||||||
|
// 面授结束时间
|
||||||
|
const classEndTime = dayjs(state.xjkkinputV3[1])
|
||||||
|
const endSignTime = dayjs(dayjs(classEndTime).add(1, "day").format("YYYY-MM-DD")).subtract(1, "second").format("YYYY-MM-DD HH:mm:ss")
|
||||||
|
const startSignTime = dayjs(dayjs(classStartTime).format("YYYY-MM-DD")).format("YYYY-MM-DD HH:mm:ss")
|
||||||
|
|
||||||
|
if (isLastSecond) {
|
||||||
|
if (isFirstSecond) {
|
||||||
|
signDateTimeType.value = signTimeSection.OpenDay
|
||||||
|
signDateTimeRange.value = `( ${startSignTime} 至 ${endSignTime} )`;
|
||||||
|
} else {
|
||||||
|
signDateTimeType.value = signTimeSection.NoLimit
|
||||||
|
signDateTimeRange.value = `( 当前时间 至 ${endSignTime} )`;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
signDateTimeType.value = signTimeSection.Custom
|
||||||
|
// state.beforeValue = before
|
||||||
|
// state.afterValue = after
|
||||||
|
}
|
||||||
}
|
}
|
||||||
window.dayjs = dayjs;
|
// window.dayjs = dayjs;
|
||||||
return {
|
return {
|
||||||
signDateTimeRange,
|
signDateTimeRange,
|
||||||
signTimeSection,
|
signTimeSection,
|
||||||
|
|||||||
Reference in New Issue
Block a user