考勤管理查询处理
parent
c2e101fa10
commit
2f324e0865
|
|
@ -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="isDel != null "> and pma.is_del = #{isDel}</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="userPhone!=null and userPhone!=''"> and psu.user_phone like concat('%', #{userPhone}, '%')</if>
|
||||
<if test="startDate!=null"> and date(pma.att_date) >= date(#{startDate})</if>
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,12 @@
|
|||
<el-option v-for="(it) in data.subdepts" :key="it.id" :label="it.subDeptName" :value="it.id" />
|
||||
</el-select>
|
||||
</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-input v-model="queryParams.userName" placeholder="请输入姓名" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item><el-form-item label="日期" prop="inTime">
|
||||
|
|
@ -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();
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.attendance-ubi-data{
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ import {
|
|||
} from '@/api/manage/attendanceubidevice'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
import { findMyProjectList } from '@/api/publics'
|
||||
import { workAreaTree } from '@/api/system/workAarea'
|
||||
import { workAreaTree, transformTreeData } from '@/api/system/workAarea'
|
||||
const { proxy } = getCurrentInstance()
|
||||
const userStore = useUserStore()
|
||||
const { ubi_device_source } = proxy.useDict('ubi_device_source')
|
||||
|
|
@ -387,28 +387,7 @@ function getWorkAreaTree() {
|
|||
data.workAreaOptions = transformTreeData(response.data);
|
||||
});
|
||||
}
|
||||
/** 转换树形数据格式 */
|
||||
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;
|
||||
});
|
||||
}
|
||||
|
||||
getList()
|
||||
getProjectList()
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px"
|
||||
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"
|
||||
:props="{ value: 'id', label: 'title', children: 'children' }" value-key="id" placeholder="请选择工区"
|
||||
clearable style="width: 240px" check-strictly />
|
||||
|
|
@ -116,7 +116,7 @@
|
|||
|
||||
<script setup name="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 videoMonitorDrawer from './videoMonitorDrawer.vue'
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
|
@ -166,28 +166,7 @@ function getWorkAreaTree() {
|
|||
});
|
||||
}
|
||||
|
||||
/** 转换树形数据格式 */
|
||||
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;
|
||||
});
|
||||
}
|
||||
|
||||
/** 查找树节点 */
|
||||
function findTreeNode(nodes, id) {
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@
|
|||
<script setup>
|
||||
import { listVideoMonitor, getVideoMonitor, delVideoMonitor, addVideoMonitor, updateVideoMonitor } from '@/api/manage/videoMonitor'
|
||||
import { findMyProjectList } from '@/api/publics'
|
||||
import { workAreaTree } from '@/api/system/workAarea'
|
||||
import { workAreaTree, transformTreeData } from '@/api/system/workAarea'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
const $emit = defineEmits('success')
|
||||
const userStore = useUserStore()
|
||||
|
|
@ -111,28 +111,7 @@ function getSelectProject() {
|
|||
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.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;
|
||||
});
|
||||
}
|
||||
|
||||
/** 查询工区树结构 */
|
||||
function getWorkAreaTree() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue