后台增加配置选择

dev_xd
lj7788 2026-03-31 17:35:22 +08:00
parent 4c0425a73c
commit 26442645eb
5 changed files with 119 additions and 57 deletions

View File

@ -54,6 +54,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<where>
<if test="comId != null "> and comId = #{comId}</if>
<if test="projectId != null "> and projectId = #{projectId}</if>
<if test="cfgId != null "> and cfg_id = #{cfgId}</if>
<if test="subDeptId != null "> and sub_dept_id = #{subDeptId}</if>
<if test="userId != null "> and userId = #{userId}</if>
<if test="userName != null and userName != ''"> and userName like concat('%', #{userName}, '%')</if>
@ -95,6 +96,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from attendance_ubi_data ad
<where>
<if test="projectId != null "> and ad.projectId = #{projectId}</if>
<if test="cfgId != null "> and ad.cfg_id = #{cfgId}</if>
<if test="subDeptId != null "> and ad.sub_dept_id = #{subDeptId}</if>
and date(ifNull(ad.`inTime`,ad.`outTime`)) <![CDATA[ >= ]]> date(#{inTime}) and date(ifNull(ad.`outTime`,ad.`inTime`)) <![CDATA[ < ]]> date(#{outTime})
</where>

View File

@ -3,28 +3,35 @@
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="项目" prop="projectId">
<el-select :disabled="data.currentPrjId != ''" style="width:192px;" v-model="queryParams.projectId" placeholder="请选择项目" clearable
@change="()=>{handleQuery();projectChange();}">
<el-select :disabled="data.currentPrjId != ''" style="width:192px;" v-model="queryParams.projectId"
placeholder="请选择项目" clearable @change="() => { handleQuery(); projectChange(); }">
<el-option v-for="prj in data.projects" :key="prj.id" :label="prj.projectName" :value="prj.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="所属单位" prop="subDeptId">
<el-select v-model="queryParams.subDeptId" style="width:192px;" placeholder="请选择所属单位" clearable @change="()=>{handleQuery();subDeptChange();}">
<el-select v-model="queryParams.subDeptId" style="width:192px;" placeholder="请选择所属单位" clearable
@change="() => { handleQuery(); subDeptChange(); }">
<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="cfgId" v-if="data.cfgOptions.length > 0">
<el-select v-model="queryParams.cfgId" placeholder="请选择考勤配置" style="width: 200px;"
@change="handleQuery">
<el-option v-for="cfg in data.cfgOptions" :key="cfg.id" :label="cfg.cfgName" :value="cfg.id" />
</el-select>
</el-form-item>
<el-form-item label="所属工区" prop="workAreaAncestors" v-if="data.workAreaOptions && data.workAreaOptions.length > 0">
<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" />
: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">
<el-date-picker clearable v-model="queryParams.inTime" type="date" value-format="YYYY-MM-DD" @change="handleQuery"
placeholder="请选择日期">
<el-date-picker clearable v-model="queryParams.inTime" type="date" value-format="YYYY-MM-DD"
@change="handleQuery" placeholder="请选择日期">
</el-date-picker>
</el-form-item>
<el-form-item>
@ -53,14 +60,16 @@
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="attendanceUbiDataList" @selection-change="handleSelectionChange" class="data-list">
<el-table v-loading="loading" :data="attendanceUbiDataList" @selection-change="handleSelectionChange"
class="data-list">
<el-table-column label="姓名" align="center" prop="userName" />
<el-table-column label="项目" align="center" prop="projectName" />
<el-table-column label="单位" align="center" prop="subDeptName" />
<el-table-column label="进场照片" align="center" prop="inPhoto">
<template #default="scope">
<el-image v-if="scope.row.inPhoto" :src="scope.row.inPhoto" style="height:80px;" :preview-teleported="true" :preview-src-list="[scope.row.inPhoto]"></el-image>
<el-image v-if="scope.row.inPhoto" :src="scope.row.inPhoto" style="height:80px;" :preview-teleported="true"
:preview-src-list="[scope.row.inPhoto]"></el-image>
</template>
</el-table-column>
<el-table-column label="进场时间" align="center" prop="inTime" width="180">
@ -71,7 +80,8 @@
<el-table-column label="离场照片" align="center" prop="outPhoto">
<template #default="scope">
<el-image v-if="scope.row.outPhoto" :src="scope.row.outPhoto" style="height:80px;" :preview-teleported="true" :preview-src-list="[scope.row.outPhoto]"></el-image>
<el-image v-if="scope.row.outPhoto" :src="scope.row.outPhoto" style="height:80px;" :preview-teleported="true"
:preview-src-list="[scope.row.outPhoto]"></el-image>
</template>
</el-table-column>
<el-table-column label="离场时间" align="center" prop="outTime" width="180">
@ -100,8 +110,8 @@
</el-table-column>
</el-table>
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize"
@pagination="getList" />
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize" @pagination="getList" />
<!-- 添加或修改考勤管理对话框 -->
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
@ -159,6 +169,7 @@
</template>
<script setup name="AttendanceUbiData">
import { listAttendance_cfg } from '@/api/manage/attendancecfg'
import { listAttendanceUbiData, getAttendanceUbiData, delAttendanceUbiData, addAttendanceUbiData, updateAttendanceUbiData } from "@/api/manage/attendanceUbiData";
import { findMyProjectList } from "@/api/publics";
import useUserStore from '@/store/modules/user'
@ -200,6 +211,7 @@ const data = reactive({
deviceNo: null,
isDel: null,
state: null,
cfgId: null,
},
rules: {
},
@ -208,6 +220,7 @@ const data = reactive({
currentPrjId: '',
//
workAreaOptions: [],
cfgOptions: []
});
const { queryParams, form, rules } = toRefs(data);
@ -364,7 +377,16 @@ function handleExport() {
}
queryParams.value.inTime = proxy.$dt(new Date()).format("YYYY-MM-DD");
getList();
/** 查询配置项列表 */
function getCfgList() {
listAttendance_cfg({ projectId: userStore.currentPrjId, pageNum: 1, pageSize: 100 }).then(response => {
data.cfgOptions = response.rows || []
queryParams.value.cfgId = data.cfgOptions[0]?.id || null
getList()
});
}
getCfgList()
getProjectList();
//
getWorkAreaTree();
@ -379,6 +401,7 @@ getWorkAreaTree();
color: #222;
font-size: 14px;
}
.el-tag {
background: none;
border: none;

View File

@ -13,6 +13,12 @@
@change="() => { handleQuery(); }">
<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="cfgId" v-if="data.cfgOptions.length > 0">
<el-select v-model="queryParams.cfgId" placeholder="请选择考勤配置" style="width: 200px;" @change="handleQuery">
<el-option v-for="cfg in data.cfgOptions" :key="cfg.id" :label="cfg.cfgName"
:value="cfg.id" />
</el-select>
</el-form-item>
<el-form-item label="显示方式" prop="showType">
<el-select v-model="queryParams.showType" style="width:192px;" placeholder="请选择显示方式">
@ -69,7 +75,7 @@ import {statisticsAttendanceUbiData,statisticsExportAttendanceUbiData} from '@/a
import useUserStore from '@/store/modules/user'
import attItem from './item.vue'
const { proxy } = getCurrentInstance();
import { listAttendance_cfg } from '@/api/manage/attendancecfg'
const { pro_craft_type, pro_craft_post } = proxy.useDict( 'pro_craft_type', 'pro_craft_post');
const userStore = useUserStore()
@ -81,7 +87,8 @@ const data = reactive({
inTime: '',
projectId: '',
subDeptId: '',
showType: '0'
showType: '0',
cfgId: '',
},
rules: {
@ -94,6 +101,7 @@ const data = reactive({
total: 0,
tdDays:[],
elkey:0,
cfgOptions: [],
});
const { queryParams, form, rules } = toRefs(data);
@ -136,7 +144,8 @@ function getList() {
pageNum:queryParams.value.pageNum,
pageSize:queryParams.value.pageSize,
projectId:queryParams.value.projectId,
subDeptId:queryParams.value.subDeptId
subDeptId:queryParams.value.subDeptId,
cfgId:queryParams.value.cfgId,
}
let dt1=proxy.$dt(queryParams.value.inTime);
let dt2=dt1.month(dt1.month()+1);
@ -197,8 +206,19 @@ function resetQuery() {
handleQuery();
}
queryParams.value.inTime = proxy.$dt(new Date()).format("YYYY-MM-DD");
getProjectList();
/** 查询配置项列表 */
function getCfgList() {
listAttendance_cfg({ projectId: userStore.currentPrjId, pageNum: 1, pageSize: 100 }).then(response => {
data.cfgOptions = response.rows || []
queryParams.value.cfgId = data.cfgOptions[0]?.id || null
handleQuery();
});
}
getProjectList();
getCfgList()
</script>
<style lang="scss"></style>

View File

@ -9,7 +9,7 @@
</el-select>
</el-form-item>
<el-form-item label="考勤配置" prop="cfgId" v-if="data.cfgOptions.length > 0">
<el-select v-model="queryParams.cfgId" placeholder="请选择考勤配置" clearable style="width: 300px;">
<el-select v-model="queryParams.cfgId" placeholder="请选择考勤配置" style="width: 200px;" @change="handleQuery">
<el-option v-for="cfg in data.cfgOptions" :key="cfg.id" :label="cfg.cfgName"
:value="cfg.id" />
</el-select>
@ -333,7 +333,6 @@ function handleAdd() {
form.value.projectId = userStore.currentPrjId
form.value.projectName = userStore.currentProName
form.value.source = ubi_device_source.value[0].value
getCfgList()
open.value = true
title.value = '添加宇泛的设备信息'
}

View File

@ -1,6 +1,13 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="考勤配置" prop="cfgId" v-if="data.cfgOptions.length > 0">
<el-select v-model="queryParams.cfgId" placeholder="请选择考勤配置" style="width: 200px;" @change="handleQuery">
<el-option v-for="cfg in data.cfgOptions" :key="cfg.id" :label="cfg.cfgName"
:value="cfg.id" />
</el-select>
</el-form-item>
<el-form-item label="用户名" prop="userName">
<el-input v-model="queryParams.userName" placeholder="请输入用户名" clearable @keyup.enter="handleQuery" />
</el-form-item>
@ -122,6 +129,7 @@
<script setup name="MobileAttendanceData">
import { listMobileAttendanceData, getMobileAttendanceData, delMobileAttendanceData, addMobileAttendanceData, updateMobileAttendanceData } from "@/api/manage/mobileAttendanceData";
import useUserStore from "@/store/modules/user";
import { listAttendance_cfg } from '@/api/manage/attendancecfg'
const { proxy } = getCurrentInstance();
const userStore = useUserStore();
const mobileAttendanceDataList = ref([]);
@ -149,9 +157,11 @@ const data = reactive({
attImg: null,
isDel: null,
state: null,
cfgId: null,
},
rules: {
}
},
cfgOptions: [],
});
const { queryParams, form, rules } = toRefs(data);
@ -279,5 +289,13 @@ function handleExport() {
}, `mobileAttendanceData_${new Date().getTime()}.xlsx`)
}
getList();
/** 查询配置项列表 */
function getCfgList() {
listAttendance_cfg({ projectId: userStore.currentPrjId, pageNum: 1, pageSize: 100 }).then(response => {
data.cfgOptions = response.rows || []
queryParams.value.cfgId = data.cfgOptions[0]?.id || null
getList()
});
}
getCfgList()
</script>