|
|
@ -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() { |
|
|
|