This commit is contained in:
2025-09-05 21:36:48 +08:00
parent b910c6fee2
commit c9496f4400
10 changed files with 472 additions and 18 deletions

View File

@ -5,6 +5,11 @@
<div v-show="showSearch" class="mb-[10px]">
<el-card shadow="hover">
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
<el-form-item label="项目名称" prop="projectId">
<el-select v-model="queryParams.projectId" clearable placeholder="全部">
<el-option v-for="item in projectList" :key="item.value" :label="item.projectName" :value="item.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>
@ -156,6 +161,7 @@
</el-button>
<!-- <el-button link type="primary" icon="Switch" @click="handleToggle(scope.row)"> 切换人脸 </el-button> -->
<el-button link type="primary" icon="Switch" @click="handleChange(scope.row)"> 人员迁移 </el-button>
<el-button link type="primary" icon="Switch" @click="handleAssign(scope.row)"> 分配班组 </el-button>
<el-button link type="primary" icon="ChatLineSquare" @click="handleExit(scope.row)"> 入退场记录 </el-button>
<el-button link type="danger" icon="Delete" @click="handleDelete(scope.row)"
v-hasPermi="['contractor:constructionUser:remove']">
@ -443,6 +449,30 @@
</template>
</el-calendar>
</el-dialog>
<el-dialog draggable :title="skipName + '-人员分配'" v-model="personnelAllocation" width="500px">
<el-form-item label="所属项目" label-width="130px">
<el-select v-model="personnelAllocationObject.projectId" @change="selectProject1" placeholder="请选择所属项目" style="width: 240px">
<el-option v-for="item in projectList" :key="item.id" :label="item.projectName" :value="item.id" />
</el-select>
</el-form-item>
<el-form-item label="岗位" label-width="130px">
<el-select v-model="personnelAllocationObject.postId" placeholder="请选择岗位" style="width: 240px">
<el-option v-for="item in user_post_type" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item label="班组" label-width="130px">
<el-select v-model="personnelAllocationObject.teamId" :disabled="!personnelAllocationObject.projectId" placeholder="请选择分包单位"
style="width: 240px">
<el-option v-for="item in teamList" :key="item.id" :label="item.teamName" :value="item.id" />
</el-select>
</el-form-item>
<template #footer>
<div class="dialog-footer">
<el-button type="primary" @click="handlePersonnelAllocation">确认</el-button>
<el-button @click="personnelAllocation = false"> 取消 </el-button>
</div>
</template>
</el-dialog>
</div>
</template>
@ -462,7 +492,10 @@ import {
getConstructionUserExit,
dowloadConstructionUserTemplate,
importConstructionUserInfo,
listConstructionMonth
listConstructionMonth,
ProjectList,
TeamList,
TeamDistribution
} from '@/api/project/constructionUser';
import {
ConstructionUserForm,
@ -494,8 +527,8 @@ import { parseTime } from '@/utils/ruoyi';
const calendar = ref<CalendarInstance>();
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { type_of_work, user_sex_type, user_clock_type, user_file_type, user_status_type, wage_measure_unit_type } = toRefs<any>(
proxy?.useDict('type_of_work', 'user_sex_type', 'user_clock_type', 'user_file_type', 'user_status_type', 'wage_measure_unit_type')
const { type_of_work, user_sex_type, user_clock_type, user_file_type, user_status_type, wage_measure_unit_type,user_post_type } = toRefs<any>(
proxy?.useDict('type_of_work', 'user_sex_type', 'user_clock_type', 'user_file_type', 'user_status_type', 'wage_measure_unit_type','user_post_type')
);
// 获取用户 store
const userStore = useUserStoreHook();
@ -511,6 +544,7 @@ const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const skip = ref(false);
const personnelAllocation = ref(false);
const fileStatus = ref(false);
const showFaceDrawer = ref(false);
const statusDialog = ref(false);
@ -531,6 +565,10 @@ const queryFormRef = ref<ElFormInstance>();
const constructionUserFormRef = ref<ElFormInstance>();
const skipName = ref('');
const calendarList = ref<Array<AttendanceMonthVO>>([]);
// 项目列表
const projectList = ref([]);
// 班组列表
const teamList = ref([]);
const dialog = reactive<DialogOption>({
visible: false,
title: '',
@ -543,6 +581,14 @@ const skipObject: skipType = reactive({
projectId: '',
contractorId: ''
});
// 人员分配
const personnelAllocationObject = reactive({
memberId: null,
projectId: '',
teamId: '',
postId: '',
});
const contractorList = ref<Array<skipTeamType>>([]);
//项目列表
const skipOptions = ref<Array<skipOptionType>>([]);
@ -661,6 +707,13 @@ const uploadPath = computed(() => {
return list;
});
// 获取项目列表
const getProjectList = async () => {
const res = await ProjectList({});
projectList.value = res.rows;
projectList.value.unshift({ id: '', projectName: '全部' });
};
/** 返回文件上传状态 */
const uploadStatusColor = computed(() => (str: string) => {
switch (str) {
@ -825,7 +878,7 @@ const reset = () => {
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.value.pageNum = 1;
if (contractorOpt.value.length == 1) queryParams.value.contractorId = contractorOpt.value[0].value;
// if (contractorOpt.value.length == 1) queryParams.value.contractorId = contractorOpt.value[0].value;
getList();
};
@ -1053,6 +1106,36 @@ const listeningProject = watch(
getContractorList();
}
);
// 分配班组
const handleAssign = async (row: ConstructionUserVO) => {
const _id = row?.id || ids.value[0];
currentUserId.value = _id;
personnelAllocationObject.memberId = row?.sysUserId;
personnelAllocation.value = true;
};
// 选择项目1
const selectProject1 = (e: any) => {
// 请求班组
getTeamList(personnelAllocationObject.projectId);
};
const getTeamList = async (projectId) => {
const res = await TeamList({
projectId,
pageNum: 1,
pageSize: 100
});
teamList.value = res.rows;
};
// 人员分配
const handlePersonnelAllocation = async () => {
let res = await TeamDistribution(personnelAllocationObject);
if (res.code == 200) {
ElMessage.success(res.msg);
personnelAllocation.value = false;
getList();
}
};
onUnmounted(() => {
listeningProject();
@ -1060,6 +1143,7 @@ onUnmounted(() => {
onMounted(() => {
getContractorList();
getProjectList();
});
</script>
<style scoped lang="scss">