|
|
|
@ -4,8 +4,14 @@ |
|
|
|
<div class="mb-8 flex justify-between items-center"> |
|
|
|
<div class="text-2xl font-semibold">流水账</div> |
|
|
|
<div class="flex items-center"> |
|
|
|
<a-button type="primary" :disabled="morningStatus">{{ morningStatus ? '已打卡' : '早打卡' }}</a-button> |
|
|
|
<a-button class="mx-5" type="primary" :disabled="nightStatus">{{ nightStatus ? '已打卡' : '晚打卡' }}</a-button> |
|
|
|
<a-button type="primary" v-if="!morning" @click="punch(0)"> 早打卡 </a-button> |
|
|
|
<a-button type="primary" v-else> |
|
|
|
{{ dayjs(+morning).format('HH:mm') }} |
|
|
|
</a-button> |
|
|
|
<a-button class="mx-5" type="primary" v-if="!night" @click="punch(1)"> 晚打卡 </a-button> |
|
|
|
<a-button class="mx-5" type="primary" v-else> |
|
|
|
{{ dayjs(+night).format('HH:mm') }} |
|
|
|
</a-button> |
|
|
|
<FullscreenExitOutlined v-if="isFullScreen" class="text-lg" style="color: #777" @click="changeIsFullScreen(false)" /> |
|
|
|
<FullscreenOutlined v-else class="text-lg" style="color: #777" @click="changeIsFullScreen(true)" /> |
|
|
|
</div> |
|
|
|
@ -39,7 +45,7 @@ |
|
|
|
|
|
|
|
<div class="block w-full"> |
|
|
|
<a-button type="primary" html-type="submit" @click="handleSubmit">筛选</a-button> |
|
|
|
<a-button class="mx-3" type="primary">导出</a-button> |
|
|
|
<a-button class="mx-3" type="primary" @click="handleExport">导出</a-button> |
|
|
|
<a-button @click="resetData">重置</a-button> |
|
|
|
</div> |
|
|
|
</a-form> |
|
|
|
@ -210,7 +216,7 @@ import { useStore } from 'vuex'; |
|
|
|
import { reactive, ref, onMounted, computed, watch } from 'vue'; |
|
|
|
import dayjs from 'dayjs'; |
|
|
|
import { FullscreenExitOutlined, FullscreenOutlined, DeleteOutlined, PushpinOutlined } from '@ant-design/icons-vue'; |
|
|
|
import { getBasicInfo, queryTasks, submitTask, clockQuery, clockPunch } from 'apis'; |
|
|
|
import { getBasicInfo, queryTasks, submitTask, clockQuery, clockPunch, exportQuery } from 'apis'; |
|
|
|
import { message } from 'ant-design-vue'; |
|
|
|
|
|
|
|
const store = useStore(); |
|
|
|
@ -222,8 +228,8 @@ const userId = computed(() => store.getters['user/userId']); // 用户id |
|
|
|
const isFullScreen = computed(() => store.state.layout.isFullScreen); // 是否全屏 |
|
|
|
const visible = ref(false); // 是否显示弹框表单 |
|
|
|
const isDisabled = ref(false); // 是否允许编辑 |
|
|
|
const morningStatus = ref(false); // 早打卡 |
|
|
|
const nightStatus = ref(false); // 晚打卡 |
|
|
|
const morning = ref(false); // 早打卡 |
|
|
|
const night = ref(false); // 晚打卡 |
|
|
|
const checkerId = ref(null); // 打卡审核人id |
|
|
|
const recordId = ref(null); // 记录id |
|
|
|
const memberId = ref(null); // 成员id |
|
|
|
@ -391,6 +397,30 @@ function resetData() { |
|
|
|
proDatas.value = []; |
|
|
|
} |
|
|
|
|
|
|
|
// 导出 |
|
|
|
async function handleExport() { |
|
|
|
try { |
|
|
|
const start = formState.timeRange[0].startOf('day').valueOf(); |
|
|
|
const end = formState.timeRange[1].startOf('day').valueOf(); |
|
|
|
const params = { |
|
|
|
param: { |
|
|
|
projectId: projectId.value || sessionProjectId, |
|
|
|
roleId: roleId.value, |
|
|
|
memberIdList: [], |
|
|
|
startTime: start, |
|
|
|
endTime: end, |
|
|
|
}, |
|
|
|
}; |
|
|
|
|
|
|
|
const { url } = store.state.projects.project; |
|
|
|
const data = await exportQuery(params, url); |
|
|
|
window.open(data, '_blank'); |
|
|
|
} catch (error) { |
|
|
|
message.info(error); |
|
|
|
throw new Error(error); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 分页改变 |
|
|
|
function handlePage(e) { |
|
|
|
const start = dayjs(+formState.timeRange[0].startOf('day')).add(e - 1, 'day'); |
|
|
|
@ -534,7 +564,7 @@ async function submitForm() { |
|
|
|
const { url } = store.state.projects.project; |
|
|
|
const data = await submitTask(params, url); |
|
|
|
visible.value = false; |
|
|
|
punch(); |
|
|
|
// punch(); |
|
|
|
getQueryTasks(); |
|
|
|
} catch (error) { |
|
|
|
message.info(error); |
|
|
|
@ -544,9 +574,11 @@ async function submitForm() { |
|
|
|
|
|
|
|
// 获取当前打卡信息 |
|
|
|
async function getClockQuery() { |
|
|
|
const start = dayjs(+new Date().getTime()).valueOf(); |
|
|
|
const start = dayjs(+new Date().getTime()) |
|
|
|
.startOf('day') |
|
|
|
.valueOf(); |
|
|
|
const end = dayjs(+new Date().getTime()) |
|
|
|
.add(1, 'day') |
|
|
|
.endOf('day') |
|
|
|
.valueOf(); |
|
|
|
|
|
|
|
const params = { |
|
|
|
@ -579,16 +611,17 @@ async function getClockQuery() { |
|
|
|
|
|
|
|
recordId.value = data[0].recordList[0].id; |
|
|
|
|
|
|
|
morningStatus.value = data[0].recordList[0].morningStatus > 0; // 早打卡状态 |
|
|
|
nightStatus.value = data[0].recordList[0].nightStatus > 0; // 晚打卡状态 |
|
|
|
morning.value = data[0].recordList[0].morning; // 早打卡状态 |
|
|
|
night.value = data[0].recordList[0].night; // 晚打卡状态 |
|
|
|
} catch (error) { |
|
|
|
message.info(error); |
|
|
|
throw new Error(error); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
async function punch() { |
|
|
|
const clockType = isSubmitDeliver.value ? 1 : 0; // 打卡类型:1 晚打卡 0 早打卡 |
|
|
|
async function punch(clockType) { |
|
|
|
if ((clockType === 0 && morning.value) || (clockType === 1 && night.value)) return; |
|
|
|
|
|
|
|
const dateTime = dayjs(+new Date().getTime()).valueOf(); // 打卡时间 |
|
|
|
|
|
|
|
const params = { param: { checkerId: checkerId.value, memberId: memberId.value, id: recordId.value, clockType, dateTime } }; |
|
|
|
@ -596,8 +629,7 @@ async function punch() { |
|
|
|
const { url } = store.state.projects.project; |
|
|
|
const data = await clockPunch(params, url); |
|
|
|
|
|
|
|
morningStatus.value = data[0].recordList[0].morningStatus > 0; // 早打卡状态 |
|
|
|
nightStatus.value = data[0].recordList[0].nightStatus > 0; // 晚打卡状态 |
|
|
|
getClockQuery(); |
|
|
|
} catch (error) { |
|
|
|
message.info(`打卡失败,${error}`); |
|
|
|
throw new Error(error); |
|
|
|
|