考勤管理查询处理

dev_xd
lj7788 2025-12-29 18:03:22 +08:00
parent c2e101fa10
commit 2f324e0865
6 changed files with 47 additions and 69 deletions

View File

@ -63,6 +63,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="attImg != null and attImg != ''"> and pma.att_img = #{attImg}</if> <if test="attImg != null and attImg != ''"> and pma.att_img = #{attImg}</if>
<if test="isDel != null "> and pma.is_del = #{isDel}</if> <if test="isDel != null "> and pma.is_del = #{isDel}</if>
<if test="state != null "> and pma.state = #{state}</if> <if test="state != null "> and pma.state = #{state}</if>
<if test="workAreaId != null "> and wa.work_area_id = #{workAreaId}</if>
<if test="userName!=null and userName!=''"> and psu.user_name like concat('%', #{userName}, '%')</if> <if test="userName!=null and userName!=''"> and psu.user_name like concat('%', #{userName}, '%')</if>
<if test="userPhone!=null and userPhone!=''"> and psu.user_phone like concat('%', #{userPhone}, '%')</if> <if test="userPhone!=null and userPhone!=''"> and psu.user_phone like concat('%', #{userPhone}, '%')</if>
<if test="startDate!=null"> and date(pma.att_date) &gt;= date(#{startDate})</if> <if test="startDate!=null"> and date(pma.att_date) &gt;= date(#{startDate})</if>

View File

@ -49,3 +49,26 @@ export function workAreaTree(projectId) {
method: 'get' 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;
});
}

View File

@ -14,6 +14,12 @@
<el-option v-for="(it) in data.subdepts" :key="it.id" :label="it.subDeptName" :value="it.id" /> <el-option v-for="(it) in data.subdepts" :key="it.id" :label="it.subDeptName" :value="it.id" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="所属工区" prop="workAreaAncestors">
<el-tree-select v-model="queryParams.workAreaId" :data="data.workAreaOptions"
:props="{ value: 'id', label: 'title', children: 'children' }" value-key="id" placeholder="请选择工区"
clearable style="width: 240px" />
</el-form-item>
<el-form-item label="姓名" prop="userName"> <el-form-item label="姓名" prop="userName">
<el-input v-model="queryParams.userName" placeholder="请输入姓名" clearable @keyup.enter="handleQuery" /> <el-input v-model="queryParams.userName" placeholder="请输入姓名" clearable @keyup.enter="handleQuery" />
</el-form-item><el-form-item label="" prop="inTime"> </el-form-item><el-form-item label="" prop="inTime">
@ -157,7 +163,7 @@ import { listAttendanceUbiData, getAttendanceUbiData, delAttendanceUbiData, addA
import { findMyProjectList } from "@/api/publics"; import { findMyProjectList } from "@/api/publics";
import useUserStore from '@/store/modules/user' import useUserStore from '@/store/modules/user'
import { listProProjectInfoSubdepts } from "@/api/manage/proProjectInfoSubdepts"; import { listProProjectInfoSubdepts } from "@/api/manage/proProjectInfoSubdepts";
import { workAreaTree, transformTreeData } from '@/api/system/workAarea'
const { proxy } = getCurrentInstance(); const { proxy } = getCurrentInstance();
const { pro_craft_type, pro_craft_post } = proxy.useDict( 'pro_craft_type', 'pro_craft_post'); const { pro_craft_type, pro_craft_post } = proxy.useDict( 'pro_craft_type', 'pro_craft_post');
@ -200,6 +206,8 @@ const data = reactive({
projects:[], projects:[],
subdepts:[], subdepts:[],
currentPrjId: '', currentPrjId: '',
//
workAreaOptions: [],
}); });
const { queryParams, form, rules } = toRefs(data); const { queryParams, form, rules } = toRefs(data);
@ -271,6 +279,14 @@ function reset() {
proxy.resetForm("attendanceUbiDataRef"); proxy.resetForm("attendanceUbiDataRef");
} }
/** 查询工区树结构 */
function getWorkAreaTree() {
workAreaTree(userStore.currentPrjId).then(response => {
// el-tree-select
data.workAreaOptions = transformTreeData(response.data);
});
}
/** 搜索按钮操作 */ /** 搜索按钮操作 */
function handleQuery() { function handleQuery() {
queryParams.value.pageNum = 1; queryParams.value.pageNum = 1;
@ -350,7 +366,8 @@ function handleExport() {
queryParams.value.inTime= proxy.$dt(new Date()).format("YYYY-MM-DD"); queryParams.value.inTime= proxy.$dt(new Date()).format("YYYY-MM-DD");
getList(); getList();
getProjectList(); getProjectList();
//
getWorkAreaTree();
</script> </script>
<style lang="scss"> <style lang="scss">
.attendance-ubi-data{ .attendance-ubi-data{

View File

@ -150,7 +150,7 @@ import {
} from '@/api/manage/attendanceubidevice' } from '@/api/manage/attendanceubidevice'
import useUserStore from '@/store/modules/user' import useUserStore from '@/store/modules/user'
import { findMyProjectList } from '@/api/publics' import { findMyProjectList } from '@/api/publics'
import { workAreaTree } from '@/api/system/workAarea' import { workAreaTree, transformTreeData } from '@/api/system/workAarea'
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
const userStore = useUserStore() const userStore = useUserStore()
const { ubi_device_source } = proxy.useDict('ubi_device_source') const { ubi_device_source } = proxy.useDict('ubi_device_source')
@ -387,28 +387,7 @@ function getWorkAreaTree() {
data.workAreaOptions = transformTreeData(response.data); data.workAreaOptions = transformTreeData(response.data);
}); });
} }
/** 转换树形数据格式 */
function transformTreeData(apiData) {
if (!apiData || !Array.isArray(apiData)) {
return [];
}
return apiData.map(item => {
// item.datachildren
const transformedItem = {
id: item.id,
title: item.label, // 使label
ancestors: item.data?.ancestors, // dataancestors
//
...item.data
};
// children使
transformedItem.children = item.children ? transformTreeData(item.children) : [];
return transformedItem;
});
}
getList() getList()
getProjectList() getProjectList()

View File

@ -2,7 +2,7 @@
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px" <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px"
v-if="data.workAreaOptions && data.workAreaOptions.length > 0"> v-if="data.workAreaOptions && data.workAreaOptions.length > 0">
<el-form-item label="工区" prop="workAreaAncestors"> <el-form-item label="所属工区" prop="workAreaAncestors">
<el-tree-select v-model="queryParams.workAreaAncestors" :data="data.workAreaOptions" <el-tree-select v-model="queryParams.workAreaAncestors" :data="data.workAreaOptions"
:props="{ value: 'id', label: 'title', children: 'children' }" value-key="id" placeholder="请选择工区" :props="{ value: 'id', label: 'title', children: 'children' }" value-key="id" placeholder="请选择工区"
clearable style="width: 240px" check-strictly /> clearable style="width: 240px" check-strictly />
@ -116,7 +116,7 @@
<script setup name="VideoMonitor"> <script setup name="VideoMonitor">
import { listVideoMonitor, getVideoMonitor, delVideoMonitor, addVideoMonitor, updateVideoMonitor } from '@/api/manage/videoMonitor' import { listVideoMonitor, getVideoMonitor, delVideoMonitor, addVideoMonitor, updateVideoMonitor } from '@/api/manage/videoMonitor'
import { workAreaTree } from '@/api/system/workAarea' import { workAreaTree, transformTreeData } from '@/api/system/workAarea'
import useUserStore from '@/store/modules/user' import useUserStore from '@/store/modules/user'
import videoMonitorDrawer from './videoMonitorDrawer.vue' import videoMonitorDrawer from './videoMonitorDrawer.vue'
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
@ -166,28 +166,7 @@ function getWorkAreaTree() {
}); });
} }
/** 转换树形数据格式 */
function transformTreeData(apiData) {
if (!apiData || !Array.isArray(apiData)) {
return [];
}
return apiData.map(item => {
// item.datachildren
const transformedItem = {
id: item.id,
title: item.label, // 使label
ancestors: item.data?.ancestors, // dataancestors
//
...item.data
};
// children使
transformedItem.children = item.children ? transformTreeData(item.children) : [];
return transformedItem;
});
}
/** 查找树节点 */ /** 查找树节点 */
function findTreeNode(nodes, id) { function findTreeNode(nodes, id) {

View File

@ -51,7 +51,7 @@
<script setup> <script setup>
import { listVideoMonitor, getVideoMonitor, delVideoMonitor, addVideoMonitor, updateVideoMonitor } from '@/api/manage/videoMonitor' import { listVideoMonitor, getVideoMonitor, delVideoMonitor, addVideoMonitor, updateVideoMonitor } from '@/api/manage/videoMonitor'
import { findMyProjectList } from '@/api/publics' import { findMyProjectList } from '@/api/publics'
import { workAreaTree } from '@/api/system/workAarea' import { workAreaTree, transformTreeData } from '@/api/system/workAarea'
import useUserStore from '@/store/modules/user' import useUserStore from '@/store/modules/user'
const $emit = defineEmits('success') const $emit = defineEmits('success')
const userStore = useUserStore() const userStore = useUserStore()
@ -111,28 +111,7 @@ function getSelectProject() {
return objs.length > 0 ? objs[0] : { id: data.currentPrjId, comId: userStore.currentComId } return objs.length > 0 ? objs[0] : { id: data.currentPrjId, comId: userStore.currentComId }
} }
/** 转换树形数据格式 */
function transformTreeData(apiData) {
if (!apiData || !Array.isArray(apiData)) {
return [];
}
return apiData.map(item => {
// item.datachildren
const transformedItem = {
id: item.id,
title: item.label, // 使label
ancestors: item.data?.ancestors, // dataancestors
//
...item.data
};
// children使
transformedItem.children = item.children ? transformTreeData(item.children) : [];
return transformedItem;
});
}
/** 查询工区树结构 */ /** 查询工区树结构 */
function getWorkAreaTree() { function getWorkAreaTree() {