diff --git a/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/manage/ProMobileAttendanceDataMapper.xml b/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/manage/ProMobileAttendanceDataMapper.xml index bbe02927..55abb26b 100644 --- a/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/manage/ProMobileAttendanceDataMapper.xml +++ b/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/manage/ProMobileAttendanceDataMapper.xml @@ -63,6 +63,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and pma.att_img = #{attImg} and pma.is_del = #{isDel} and pma.state = #{state} + and wa.work_area_id = #{workAreaId} and psu.user_name like concat('%', #{userName}, '%') and psu.user_phone like concat('%', #{userPhone}, '%') and date(pma.att_date) >= date(#{startDate}) diff --git a/yanzhu-ui-vue3/src/api/system/workAarea.js b/yanzhu-ui-vue3/src/api/system/workAarea.js index 4409d29b..9ec2f8b5 100644 --- a/yanzhu-ui-vue3/src/api/system/workAarea.js +++ b/yanzhu-ui-vue3/src/api/system/workAarea.js @@ -49,3 +49,26 @@ export function workAreaTree(projectId) { method: 'get' }) } + +/** 转换树形数据格式 */ +export function transformTreeData(apiData) { + if (!apiData || !Array.isArray(apiData)) { + return []; + } + + return apiData.map(item => { + // 先展开item.data,再设置children,避免被覆盖 + const transformedItem = { + id: item.id, + title: item.label, // 使用label作为显示文本 + ancestors: item.data?.ancestors, // 从data字段中获取ancestors + // 保留原始数据以备后用 + ...item.data + }; + + // 确保children使用正确转换后的数据 + transformedItem.children = item.children ? transformTreeData(item.children) : []; + + return transformedItem; + }); +} diff --git a/yanzhu-ui-vue3/src/views/manage/attendanceUbiData/index.vue b/yanzhu-ui-vue3/src/views/manage/attendanceUbiData/index.vue index 8fa40ccf..3b4b1e8f 100644 --- a/yanzhu-ui-vue3/src/views/manage/attendanceUbiData/index.vue +++ b/yanzhu-ui-vue3/src/views/manage/attendanceUbiData/index.vue @@ -14,6 +14,12 @@ + + + + @@ -157,7 +163,7 @@ import { listAttendanceUbiData, getAttendanceUbiData, delAttendanceUbiData, addA import { findMyProjectList } from "@/api/publics"; import useUserStore from '@/store/modules/user' import { listProProjectInfoSubdepts } from "@/api/manage/proProjectInfoSubdepts"; - +import { workAreaTree, transformTreeData } from '@/api/system/workAarea' const { proxy } = getCurrentInstance(); const { pro_craft_type, pro_craft_post } = proxy.useDict( 'pro_craft_type', 'pro_craft_post'); @@ -200,6 +206,8 @@ const data = reactive({ projects:[], subdepts:[], currentPrjId: '', + // 工区树选项 + workAreaOptions: [], }); const { queryParams, form, rules } = toRefs(data); @@ -271,6 +279,14 @@ function reset() { proxy.resetForm("attendanceUbiDataRef"); } +/** 查询工区树结构 */ +function getWorkAreaTree() { + workAreaTree(userStore.currentPrjId).then(response => { + // 转换数据格式以适配el-tree-select组件 + data.workAreaOptions = transformTreeData(response.data); + }); +} + /** 搜索按钮操作 */ function handleQuery() { queryParams.value.pageNum = 1; @@ -350,7 +366,8 @@ function handleExport() { queryParams.value.inTime= proxy.$dt(new Date()).format("YYYY-MM-DD"); getList(); getProjectList(); - +// 获取工区树数据 +getWorkAreaTree();