考勤汇总快照
This commit is contained in:
@@ -28,14 +28,14 @@
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="汇总主表ID" align="center" prop="summaryId" v-if="false"/>
|
||||
<el-table-column label="汇总名称" align="center" prop="summaryName" />
|
||||
<el-table-column label="汇总开始日期" align="center" prop="startDate" width="180">
|
||||
<template #default="scope">
|
||||
<span>{{ parseTime(scope.row.startDate, '{y}-{m}-{d}') }}</span>
|
||||
<el-table-column label="汇总开始日期" align="center" width="180">
|
||||
<template #default="{ row }">
|
||||
{{ formatDate(row.startDate) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="汇总结束日期" align="center" prop="endDate" width="180">
|
||||
<template #default="scope">
|
||||
<span>{{ parseTime(scope.row.endDate, '{y}-{m}-{d}') }}</span>
|
||||
<el-table-column label="汇总结束日期" align="center" width="180">
|
||||
<template #default="{ row }">
|
||||
{{ formatDate(row.endDate) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
@@ -92,24 +92,44 @@
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog :title="title" v-model="detailOpen" width="500px" append-to-body>
|
||||
<snapshot-detail :summary-id="form.summaryId" />
|
||||
<el-dialog
|
||||
:title="title"
|
||||
v-model="detailOpen"
|
||||
width="500px"
|
||||
append-to-body
|
||||
:close-on-click-modal="false"
|
||||
@closed="handleDetailDialogClosed"
|
||||
>
|
||||
<snapshot-detail v-if="detailOpen && currentSummaryId" :summary-id="currentSummaryId" />
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="AttendanceSummary">
|
||||
import { listAttendanceSummary, getAttendanceSummary, delAttendanceSummary, addAttendanceSummary, updateAttendanceSummary } from "@/api/oa/attendanceSummary";
|
||||
import { listAttendanceSummary, getAttendanceSummary, delAttendanceSummary, addWithDetails, updateAttendanceSummary } from "@/api/oa/attendanceSummary";
|
||||
|
||||
import UserSelect from '@/components/UserSelect/index.vue';
|
||||
import { listUser } from "@/api/system/user";
|
||||
import snapshotDetail from "./components/snapshotDetail.vue";
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
|
||||
// 日期格式化方法
|
||||
const formatDate = (date) => {
|
||||
if (!date) return '';
|
||||
return proxy.parseTime(date, '{y}-{m}-{d}');
|
||||
};
|
||||
|
||||
const attendanceSummaryList = ref([]);
|
||||
const userOptions = ref([]); // 用户选项列表
|
||||
const open = ref(false);
|
||||
const detailOpen = ref(false);
|
||||
const currentSummaryId = ref(null);
|
||||
const buttonLoading = ref(false);
|
||||
|
||||
// 处理详情对话框关闭
|
||||
const handleDetailDialogClosed = () => {
|
||||
currentSummaryId.value = null;
|
||||
};
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const ids = ref([]);
|
||||
@@ -173,12 +193,6 @@ function handleQuery() {
|
||||
getList();
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm("queryRef");
|
||||
handleQuery();
|
||||
}
|
||||
|
||||
// 多选框选中数据
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map(item => item.summaryId);
|
||||
@@ -189,10 +203,6 @@ function handleSelectionChange(selection) {
|
||||
/** 新增按钮操作 */
|
||||
function handleAdd() {
|
||||
reset();
|
||||
// 获取用户列表
|
||||
listUser().then(response => {
|
||||
userOptions.value = response.rows;
|
||||
});
|
||||
open.value = true;
|
||||
title.value = "添加考勤汇总";
|
||||
}
|
||||
@@ -211,14 +221,13 @@ function handleUpdate(row) {
|
||||
}
|
||||
|
||||
function handleDetail(row) {
|
||||
loading.value = true;
|
||||
const _summaryId = row.summaryId || ids.value;
|
||||
getAttendanceSummary(_summaryId).then(response => {
|
||||
loading.value = false;
|
||||
form.value = response.data;
|
||||
detailOpen.value = true;
|
||||
title.value = "考勤汇总详情";
|
||||
});
|
||||
if (!row || !row.summaryId) {
|
||||
proxy.$modal.msgError("无效的记录");
|
||||
return;
|
||||
}
|
||||
currentSummaryId.value = row.summaryId;
|
||||
title.value = "考勤汇总详情";
|
||||
detailOpen.value = true;
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
@@ -235,7 +244,11 @@ function submitForm() {
|
||||
buttonLoading.value = false;
|
||||
});
|
||||
} else {
|
||||
addAttendanceSummary(form.value).then(response => {
|
||||
addWithDetails({
|
||||
...form.value,
|
||||
startDate: form.value.startDate + ' 00:00:00',
|
||||
endDate: form.value.endDate + ' 23:59:59'
|
||||
}).then(response => {
|
||||
proxy.$modal.msgSuccess("新增成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
|
||||
Reference in New Issue
Block a user