From 3f77b0a759e9825e633d0d50000afbc8a2e3e1a8 Mon Sep 17 00:00:00 2001
From: zss <zss@example.com>
Date: 星期二, 10 二月 2026 14:44:34 +0800
Subject: [PATCH] 生产报工记录加上工序名称字段
---
src/views/personnelManagement/attendanceCheckin/index.vue | 132 ++++++++++++++++++++++++++++---------------
1 files changed, 85 insertions(+), 47 deletions(-)
diff --git a/src/views/personnelManagement/attendanceCheckin/index.vue b/src/views/personnelManagement/attendanceCheckin/index.vue
index 0448cf7..98a94b8 100644
--- a/src/views/personnelManagement/attendanceCheckin/index.vue
+++ b/src/views/personnelManagement/attendanceCheckin/index.vue
@@ -42,52 +42,55 @@
{{ todayRecord?.workHours ?? '-' }}
</el-descriptions-item>
<el-descriptions-item label="寮傚父鏍囪">
- <span v-if="todayRecord?.status === 'normal'">-</span>
+ <span v-if="!todayRecord.id || todayRecord?.status === 0">-</span>
<el-tag v-else type="danger" size="small">
- {{ todayRecord?.statusText }}
+ {{ todayRecord?.status === 1 ? '杩熷埌' : '鏃╅��' }}
</el-tag>
</el-descriptions-item>
</el-descriptions>
</el-card>
- <!-- 鏌ヨ鏉′欢锛堢鐞嗗憳鑰冨嫟鏃ユ姤锛� -->
- <div class="search_form">
- <div>
- <span class="search_title">閮ㄩ棬锛�</span>
- <el-select
- v-model="searchForm.deptId"
- placeholder="璇烽�夋嫨閮ㄩ棬"
- style="width: 180px"
- clearable
- >
- <el-option
- v-for="item in deptOptions"
- :key="item.value"
- :label="item.label"
- :value="item.value"
+ <div class="attendance-operation">
+ <!-- 鏌ヨ鏉′欢锛堢鐞嗗憳鑰冨嫟鏃ユ姤锛� -->
+ <el-form :model="searchForm" :inline="true" class="search-form">
+ <el-form-item label="閮ㄩ棬锛�" prop="deptId">
+ <el-tree-select
+ v-model="searchForm.deptId"
+ :data="deptOptions"
+ :props="{ value: 'id', label: 'label', children: 'children' }"
+ value-key="id"
+ placeholder="璇烽�夋嫨閮ㄩ棬"
+ check-strictly
+ style="width: 200px"
/>
- </el-select>
+ </el-form-item>
- <span class="search_title ml10">鏃ユ湡锛�</span>
- <el-date-picker
- v-model="searchForm.date"
- type="date"
- value-format="YYYY-MM-DD"
- format="YYYY-MM-DD"
- placeholder="璇烽�夋嫨鏃ユ湡"
- clearable
- />
+ <el-form-item label="鏃ユ湡锛�" prop="date">
+ <el-date-picker
+ v-model="searchForm.date"
+ type="date"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
+ placeholder="璇烽�夋嫨鏃ユ湡"
+ clearable
+ />
+ </el-form-item>
- <el-button type="primary" @click="fetchData" style="margin-left: 10px">
- 鎼滅储
- </el-button>
- <el-button @click="resetSearch">閲嶇疆</el-button>
- </div>
- <div>
- <el-button icon="Download" @click="handleExport">
- 瀵煎嚭鑰冨嫟鏃ユ姤
- </el-button>
- </div>
+ <el-form-item>
+ <el-button type="primary" @click="fetchData">
+ <el-icon><Search /></el-icon>
+ 鎼滅储
+ </el-button>
+ <el-button @click="resetSearch">
+ <el-icon><Refresh /></el-icon>
+ 閲嶇疆
+ </el-button>
+ </el-form-item>
+ </el-form>
+
+ <el-button icon="Download" @click="handleExport">
+ 瀵煎嚭鑰冨嫟鏃ユ姤
+ </el-button>
</div>
<!-- 鑰冨嫟鏃ユ姤琛ㄦ牸 -->
@@ -174,13 +177,16 @@
<script setup>
import { ref, reactive, computed, onMounted, onBeforeUnmount } from "vue";
-import { ElMessage } from "element-plus";
+import {ElMessage, ElMessageBox} from "element-plus";
import {
createPersonalAttendanceRecord,
findPersonalAttendanceRecords, findTodayPersonalAttendanceRecord
} from "@/api/personnelManagement/personalAttendanceRecords.js";
import Pagination from "@/components/Pagination/index.vue";
+import {deptTreeSelect} from "@/api/system/user.js";
+import {Refresh, Search} from "@element-plus/icons-vue";
+const { proxy } = getCurrentInstance()
const tableLoading = ref(false)
// 鍒嗛〉鍙傛暟
const page = reactive({
@@ -192,12 +198,7 @@
const todayRecord = ref({})
// 閮ㄩ棬閫夐」
-const deptOptions = [
- { label: "鐢熶骇涓�閮�", value: "鐢熶骇涓�閮�" },
- { label: "鐢熶骇浜岄儴", value: "鐢熶骇浜岄儴" },
- { label: "璁惧缁存姢閮�", value: "璁惧缁存姢閮�" },
- { label: "璐ㄦ閮�", value: "璐ㄦ閮�" },
-];
+const deptOptions = ref([])
// 鏌ヨ琛ㄥ崟
const searchForm = reactive({
@@ -261,10 +262,31 @@
return "";
};
+// 鏌ヨ閮ㄩ棬鍒楄〃
+const fetchDeptOptions = () => {
+ deptTreeSelect().then(response => {
+ deptOptions.value = filterDisabledDept(JSON.parse(JSON.stringify(response.data)))
+ })
+}
+
+/** 杩囨护绂佺敤鐨勯儴闂� */
+function filterDisabledDept(deptList) {
+ return deptList.filter(dept => {
+ if (dept.disabled) {
+ return false
+ }
+ if (dept.children && dept.children.length) {
+ dept.children = filterDisabledDept(dept.children)
+ }
+ return true
+ })
+}
+
+
// 鏌ヨ
const fetchData = () => {
tableLoading.value = true
- findPersonalAttendanceRecords({...page, searchForm}).then((res) => {
+ findPersonalAttendanceRecords({...page, ...searchForm}).then((res) => {
tableData.value = res.data.records;
page.value.total = res.data.total;
}).finally(() => {
@@ -291,15 +313,25 @@
fetchData();
};
-// 瀵煎嚭锛堟紨绀猴級
const handleExport = () => {
- ElMessage.success("褰撳墠涓烘紨绀洪〉闈紝瀵煎嚭鍔熻兘鏈鎺ュ疄闄呮帴鍙�");
+ ElMessageBox.confirm("鏄惁纭瀵煎嚭锛�", "瀵煎嚭", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ })
+ .then(() => {
+ proxy.download("/personalAttendanceRecords/export", {}, "鑰冨嫟璁板綍.xlsx");
+ })
+ .catch(() => {
+ proxy.$modal.msg("宸插彇娑�");
+ });
};
// 鎵撳崱
const handleCheckInOut = () => {
createPersonalAttendanceRecord({}).then((res) => {
fetchData()
+ fetchTodayData()
ElMessage.success("鎵撳崱鎴愬姛锛�");
})
};
@@ -315,6 +347,7 @@
searchForm.date = `${Y}-${M}-${D}`;
fetchData();
fetchTodayData()
+ fetchDeptOptions();
});
onBeforeUnmount(() => {
@@ -370,5 +403,10 @@
::v-deep(.row-abnormal) {
background-color: #fff5f5;
}
+
+.attendance-operation {
+ display: flex;
+ justify-content: space-between;
+}
</style>
--
Gitblit v1.9.3