后台增加配置选择

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

@ -1,32 +1,39 @@
<template>
<div class="app-container attendance-ubi-data">
<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="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" />
</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" />
</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>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery"></el-button>
<el-button icon="Refresh" @click="resetQuery"></el-button>
@ -53,25 +60,28 @@
<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">
<template #default="scope">
<span>{{ parseTime(scope.row.inTime)}}</span>
<span>{{ parseTime(scope.row.inTime) }}</span>
</template>
</el-table-column>
<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">
@ -82,12 +92,12 @@
<el-table-column label="班组" align="center" prop="subDeptGroupName" />
<el-table-column label="工种类型" align="center" prop="craftType">
<template #default="scope">
<dict-tag :options="pro_craft_type" :value="scope.row.craftType" class="dict-tag"/>
<dict-tag :options="pro_craft_type" :value="scope.row.craftType" class="dict-tag" />
</template>
</el-table-column>
</el-table-column>
<el-table-column label="工种岗位" align="center" prop="craftPost">
<template #default="scope">
<dict-tag :options="pro_craft_post" :value="scope.row.craftPost" class="dict-tag"/>
<dict-tag :options="pro_craft_post" :value="scope.row.craftPost" class="dict-tag" />
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" v-if="false">
@ -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>
@ -122,7 +132,7 @@
<el-input v-model="form.subDeptGroup" placeholder="请输入班组编号(外键)" />
</el-form-item>
<el-form-item label="班组名称" prop="subDeptGroupName">
<el-input v-model="form.subDeptGroupName" placeholder="请输入班组名称" />
<el-input v-model="form.subDeptGroupName" placeholder="请输入班组名称" />
</el-form-item>
<el-form-item label="工种岗位" prop="craftPost">
<el-input v-model="form.craftPost" placeholder="请输入工种岗位" />
@ -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'
@ -166,7 +177,7 @@ 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');
const { pro_craft_type, pro_craft_post } = proxy.useDict('pro_craft_type', 'pro_craft_post');
const userStore = useUserStore()
@ -200,26 +211,28 @@ const data = reactive({
deviceNo: null,
isDel: null,
state: null,
cfgId: null,
},
rules: {
},
projects:[],
subdepts:[],
projects: [],
subdepts: [],
currentPrjId: '',
//
workAreaOptions: [],
workAreaOptions: [],
cfgOptions: []
});
const { queryParams, form, rules } = toRefs(data);
/*所属单位改变事件 */
function subDeptChange(){
function subDeptChange() {
}
/*项目改变事件 */
function projectChange(){
function projectChange() {
listProProjectInfoSubdepts({ projectId: queryParams.value.projectId, pageNum: 1, pageSize: 100 }).then(d => {
data.subdepts = d.rows || [];
data.subdepts = d.rows || [];
});
}
/** 查询项目列表 */
@ -281,10 +294,10 @@ function reset() {
/** 查询工区树结构 */
function getWorkAreaTree() {
workAreaTree(userStore.currentPrjId).then(response => {
// el-tree-select
data.workAreaOptions = transformTreeData(response.data);
});
workAreaTree(userStore.currentPrjId).then(response => {
// el-tree-select
data.workAreaOptions = transformTreeData(response.data);
});
}
/** 搜索按钮操作 */
@ -363,27 +376,37 @@ function handleExport() {
}, `attendanceUbiData_${new Date().getTime()}.xlsx`)
}
queryParams.value.inTime= proxy.$dt(new Date()).format("YYYY-MM-DD");
getList();
queryParams.value.inTime = proxy.$dt(new Date()).format("YYYY-MM-DD");
/** 查询配置项列表 */
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();
</script>
<style lang="scss">
.attendance-ubi-data{
.data-list{
.dict-tag{
*{
font-family: none !important;
color:#222;
font-size: 14px;
}
.el-tag{
background: none;
border: none;
.attendance-ubi-data {
.data-list {
.dict-tag {
* {
font-family: none !important;
color: #222;
font-size: 14px;
}
.el-tag {
background: none;
border: none;
}
}
}
}
}
</style>

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");
/** 查询配置项列表 */
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();
handleQuery();
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>