mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-06 17:36:44 +08:00
feat: 函数抽离,优化界面显示
抽离出提示语内容 现在提示语可随着选择的时间自由变动
This commit is contained in:
@@ -803,7 +803,7 @@
|
||||
<p>面授开始前x分钟至面授时间开始后x分钟,允许进行签到。</p>
|
||||
</template>
|
||||
|
||||
<QuestionCircleOutlined style="height: 20px;width: 20px; margin-top: 8px;" class="grey-color"/>
|
||||
<QuestionCircleOutlined style="height: 20px;width: 20px; margin-top: 8px;" class="grey-color" />
|
||||
</a-popover>
|
||||
<span v-if="signDateTimeType === signTimeSection.Custom" class="flex-center">
|
||||
<div class="flex-center ml-10">
|
||||
@@ -1419,7 +1419,7 @@ import DropDown from "@/components/common/DropDown";
|
||||
import { checkPer, checkOwner } from "@/utils/utils";
|
||||
import dayjs from "dayjs";
|
||||
import { duration } from "moment";
|
||||
import { DeleteOutlined, DownOutlined ,QuestionCircleOutlined } from "@ant-design/icons-vue";
|
||||
import { DeleteOutlined, DownOutlined, QuestionCircleOutlined } from "@ant-design/icons-vue";
|
||||
|
||||
//列表表格
|
||||
const moreLine = (item) => {
|
||||
@@ -5062,9 +5062,23 @@ export default defineComponent({
|
||||
};
|
||||
|
||||
/**
|
||||
* 提示签到时间的范围
|
||||
* 提示签到时间的范围提示语
|
||||
*/
|
||||
const signDateTimeRange = ref("默认");
|
||||
const signDateTimeRange = computed(() => {
|
||||
const classStartTime = dayjs(state.xjkkinputV3[0])
|
||||
const classEndTime = dayjs(state.xjkkinputV3[1])
|
||||
const endSignTime = dayjs(classEndTime.add(1, "day").format("YYYY-MM-DD")).subtract(1, "second").format("YYYY-MM-DD HH:mm:ss")
|
||||
const startSignTime = dayjs(classStartTime.format("YYYY-MM-DD")).format("YYYY-MM-DD HH:mm:ss")
|
||||
|
||||
if (signDateTimeType.value === signTimeSection.NoLimit) {
|
||||
return `( 当前时间 至 ${endSignTime} )`
|
||||
} else if (signDateTimeType.value === signTimeSection.OpenDay) {
|
||||
return `( ${startSignTime} 至 ${endSignTime} )`
|
||||
} else if (signDateTimeType.value === signTimeSection.Custom) {
|
||||
return ""
|
||||
}
|
||||
return ""
|
||||
})
|
||||
|
||||
function resetSignDateTime() {
|
||||
signDateTimeType.value = 0;
|
||||
@@ -5107,20 +5121,15 @@ export default defineComponent({
|
||||
signDateTimeType.value = type;
|
||||
if (type === signTimeSection.NoLimit) {
|
||||
// 如果不限制,那么就是从当前时间开始,到课程结束时间结束
|
||||
signDateTimeRange.value = `( 当前时间 至 ${endSignTime} )`;
|
||||
|
||||
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) {
|
||||
// 如果限制在开课时间,选项签到规则是课程创建的“面授时间”的起始时间至开课当日23时59分。
|
||||
signDateTimeRange.value = `( ${startSignTime} 至 ${endSignTime} )`;
|
||||
state.afterStartValue = (dayjs(endSignTime).diff(classEndTime, "minute"))
|
||||
state.beforeValue = (dayjs(classStartTime).diff(startSignTime, "minute"))
|
||||
console.log("before value, after value", state.beforeValue, state.afterStartValue)
|
||||
} else if (type === signTimeSection.Custom) {
|
||||
signDateTimeRange.value = "";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -5135,8 +5144,8 @@ export default defineComponent({
|
||||
|
||||
/**
|
||||
* 根据考勤开始前和考勤开始后的时间,切换签到时间类型
|
||||
* @param before
|
||||
* @param after
|
||||
* @param before {number}
|
||||
* @param after {number}
|
||||
*/
|
||||
function switchSignDateTimeType(before, after) {
|
||||
signDateTimeType.value = 0
|
||||
@@ -5150,28 +5159,15 @@ export default defineComponent({
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user