Browse Source

fix: 打卡时间选择

uni
xuesinan 3 years ago
parent
commit
3af67bab24
  1. 1
      CHANGELOG.md
  2. 81
      plugins/p-check-work/detail.vue

1
CHANGELOG.md

@ -63,6 +63,7 @@
- | 时间轴优化 | [1fe5eb6](https://101.201.226.163:50022/ccsens_tall/TALL-MUI-4/commits/1fe5eb6)
- | 时间轴优化 | [77a137e](https://101.201.226.163:50022/ccsens_tall/TALL-MUI-4/commits/77a137e)
- | 时间轴展示 | [8b1b380](https://101.201.226.163:50022/ccsens_tall/TALL-MUI-4/commits/8b1b380)
- | 使用uniapp完成打卡插件(包括详情页) | [7f14dab](https://101.201.226.163:50022/ccsens_tall/TALL-MUI-4/commits/7f14dab)
- | 使用uview完成api请求 | [1b3efd8](https://101.201.226.163:50022/ccsens_tall/TALL-MUI-4/commits/1b3efd8)
- | 手机号登录 | [a198527](https://101.201.226.163:50022/ccsens_tall/TALL-MUI-4/commits/a198527)
- | 手机号登录 | [8f455da](https://101.201.226.163:50022/ccsens_tall/TALL-MUI-4/commits/8f455da)

81
plugins/p-check-work/detail.vue

@ -31,7 +31,7 @@
<u-td>
<template v-if="!item.morningStatus">
<view v-if="item.isMine === 1">
<u-button class="m-0" size="mini" type="primary" @click="showTimeSelect(0, item)">早打卡</u-button>
<u-button class="m-0" size="mini" type="primary" @click="showTimeSelect(0, item, list.dateTime)">早打卡</u-button>
</view>
<template v-else>
@ -73,7 +73,7 @@
<u-td>
<template v-if="!item.nightStatus">
<view v-if="item.isMine === 1">
<u-button class="m-0" size="mini" type="primary" @click="showTimeSelect(1, item)">晚打卡</u-button>
<u-button class="m-0" size="mini" type="primary" @click="showTimeSelect(1, item, list.dateTime)">晚打卡</u-button>
</view>
<template v-else>
@ -128,7 +128,23 @@
</view>
<!-- 审核人列表 -->
<u-select v-model="show" :list="list" @confirm="confirm"></u-select>
<u-select v-model="show" :list="list" @confirm="confirm"></u-select>
<!-- 打卡弹框 -->
<u-modal v-model="punchModal" title="打卡" :showCancelButton="true" @confirm="confirmPunch">
<view class="px-4 text-sm">
<!-- 文字内容 -->
<view class="flex justify-between items-center">
<view>打卡原因</view>
<input class="text-sm text-right" v-model="remark" placeholder="请输入打卡原因" />
</view>
<!-- 时间选择 -->
<view class="my-4 flex justify-between items-center">
<view>打卡时间</view>
<view @click="showChangeTime">{{ dayjs(+selectedTime).format("HH:mm") }}</view>
</view>
</view>
</u-modal>
<!-- 审核操作按钮列表 -->
<u-action-sheet :list="actions" v-model="actionShow" @click="clickAction"></u-action-sheet>
@ -165,21 +181,25 @@
let list = ref([]); //
let actionShow = ref(false); //
const actions = ref([{ text: '修改' }, { text: '驳回' }, { text: '确认' }]); //
let examineParams = ref({}); //
let examineParams = ref({}); //
let punchModal = ref(false); //
let remark = ref(null); //
let showModal = ref(false); //
const params = ref({year: false, month: false, day: false, hour: true, minute: true, timestamp: true})
let checkerId = ref(null);
let checkerName = ref(null);
let isShow = ref(false);
let isShow = ref(false); //
let timeType = ref(null); // 0 1
let actionType = ref(0); // 0 1
let currRecord = ref({}); //
let selectedDate = ref(null); //
let selectedTime = ref(null); //
let startTime = dayjs().startOf('day').valueOf();
let endTime = dayjs().endOf('day').valueOf();
let memberIdList = ref([]);
onMounted(() => {
onMounted(() => {
selectedTime.value = dayjs().valueOf();
list.value = [];
let checker_arr = JSON.parse(checkers);
@ -249,11 +269,17 @@
}
//
function showTimeSelect(clockType, record) {
function showTimeSelect(clockType, record, time) {
punchModal.value = true; //
selectedDate.value = time; //
actionType.value = 0; // 0 1
timeType.value = clockType; // 0 1
currRecord.value = record; //
}
//
function showChangeTime() {
showModal.value = true;
actionType.value = 0;
timeType.value = clockType;
currRecord.value = record;
}
//
@ -263,11 +289,11 @@
try {
const params = {
checkerId: checkerId.value,
id: !currRecord.value.id ? '' : currRecord.value.id,
id: !currRecord.value.id ? null : currRecord.value.id,
memberId: currRecord.value.memberId,
dateTime: selectedTime.value,
clockType: timeType.value,
remark: ''
remark: remark.value
}
const data = await uni.$u.api.clockPunch(params, url);
@ -287,20 +313,7 @@
}
// 0 1 2
function clickAction(index) {
// if (timeType.value === 'morning') {
// if (index === 0 || index === 2) {
// examineParams.value.morningStatus = 3;
// } else if (index === 1) {
// examineParams.value.morningStatus = 2;
// }
// } else {
// if (index === 0 || index === 2) {
// examineParams.value.nightStatus = 3;
// } else if (index === 1) {
// examineParams.value.nightStatus = 2;
// }
// }
function clickAction(index) {
if (index === 1) { //
examineParams.value.type = 1;
} else if (index === 2) { //
@ -318,15 +331,19 @@
//
function changeTime(e) {
selectedTime.value = e.timestamp * 1000;
examineParams.value[timeType.value] = e.timestamp * 1000;
const date = selectedDate.value + " " + e.hour + ":" + e.minute;
selectedTime.value = dayjs(date).valueOf();
examineParams.value[timeType.value] = dayjs(date).valueOf();
if (actionType.value === 0) {
punch();
} else {
if (actionType.value === 1) {
handleClockAudit();
}
}
}
//
function confirmPunch() {
punch();
}
//
async function handleClockAudit() {

Loading…
Cancel
Save