From 71d3e0c8ae0609b0b71d888ec64fd66fcc46f9d3 Mon Sep 17 00:00:00 2001 From: hreenshan112 Date: Thu, 9 Jan 2025 08:32:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=80=A7=E6=A0=BC=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/hr/people/index.ts | 9 ++ src/views/hr/archives/index.vue | 185 +++++++++++++++++++++++++++++--- 2 files changed, 181 insertions(+), 13 deletions(-) diff --git a/src/api/hr/people/index.ts b/src/api/hr/people/index.ts index 93134cb..532987c 100644 --- a/src/api/hr/people/index.ts +++ b/src/api/hr/people/index.ts @@ -389,6 +389,15 @@ export function analysisRedisOrgExelect(data?: any): AxiosPromise { } +//解析人员绩效成绩 +export function anaRedisOrgStaffExc(data?: any): AxiosPromise { + return request({ + url: '/hrapi/staff/anaRedisOrgStaffExc', + method: 'post', + data: data + }); +} + /** * 根据行政组织ID获取当前行政组织人员及子行政组织 */ diff --git a/src/views/hr/archives/index.vue b/src/views/hr/archives/index.vue index 62e02af..6cdde79 100644 --- a/src/views/hr/archives/index.vue +++ b/src/views/hr/archives/index.vue @@ -21,6 +21,7 @@ import { analysisRedisExelect, analysisRedisOrgExelect, downLoadNineTestPage, + anaRedisOrgStaffExc, } from "@/api/hr/people/index"; import UserRole from "@/assets/icons/user.svg"; import { UploadFilled } from "@element-plus/icons-vue"; @@ -55,6 +56,8 @@ const direction = ref("rtl"); // const uploadFFurl = import.meta.env.VITE_APP_BASE_API + "/hrapi/staff/uploadUserFiles" const uploadFFurl = import.meta.env.VITE_APP_BASE_API + "/hrapi/staff/uploadUserFilesRedis"; +const uploadFFurlStaff = + import.meta.env.VITE_APP_BASE_API + "/hrapi/staff/upLoadPeopelMerits"; const searchOrgFormRef = ref(ElForm); const orgTreeRef = ref(ElTree); //行政组织树 @@ -149,12 +152,18 @@ const piLiangBox = ref(false); const orgListTemp = ref([]); //打开批量导入面板 const openPiliangBox = () => { + haveOrgList(); + piLiangBox.value = true; +}; + +//获取行政组织 +const haveOrgList = () => { gainTempleateOrgList().then((data: any) => { console.log("打开批量导入面板", data); orgListTemp.value = data.data; }); - piLiangBox.value = true; }; + let jiBuQiVal = 0; //关闭导入 const handleOpenClose = () => { @@ -195,6 +204,20 @@ function handleExcelChangeTemp(file: UploadFile) { } } +function handleExcelChangeTempStaff(file: UploadFile) { + excelLoading.value = true; + if (stafftempForm.orgId == 0 || stafftempForm.orgId == "") { + ElMessage.warning("对不起!你没有选定上传的是哪个行政组织得人员信息!"); + excelLoading.value = false; + return false; + } + if (!/\.(xlsx|xls|XLSX|XLS)$/.test(file.name)) { + ElMessage.warning("上传Excel只能为xlsx、xls格式"); + excelLoading.value = false; + return false; + } +} + let peopleListAry = new Array(); const peopleMsg = ref([]); const meritsYearIng = ref(); @@ -240,6 +263,7 @@ const uploadError = (response: any, uploadFile: UploadFile, uploadFiles: UploadF }; const excelUpload = ref(); +const excelUploadStaff = ref(); const insetPeopleCont = () => { // console.log("启动数据写入数据库",jiBuQiVal,totalNum.value) @@ -313,6 +337,9 @@ const ruleForm = reactive({ const tempForm = reactive({ orgId: 0, }); +const stafftempForm = reactive({ + orgId: 0, +}); /** @ 作者: 秦东 @ 时间: 2024-08-24 08:51:41 @@ -513,6 +540,7 @@ const openSetup = ref(false); */ const setupClick = () => { openSetup.value = true; + haveOrgList(); temList(); }; /** @@ -576,6 +604,73 @@ const downStatistics = (val: any) => { openTableType.value = true; downClassType.value = 2; }; + +//上传绩效成绩解析 +const staffChengji = reactive({ + orgId: "", + redisListKey: "", + total: "", + years: "", + levels: "", + number: 0, +}); + +/** +@ 作者: 秦东 +@ 时间: 2024-02-03 14:04:48 +@ 功能: 上传成功 +*/ +const uploadTrueStaff = ( + response: any, + uploadFile: UploadFile, + uploadFiles: UploadFiles +) => { + excelLoading.value = false; + // console.log("response",response); + // console.log("uploadFile",uploadFile); + // console.log("uploadFiles",uploadFiles); + peopleListAry.push("文件上传成功!开始解析数据并写入数据库!"); + peopleMsg.value.push("文件上传成功!开始解析数据并写入数据库!"); + // peopleListAry.value.push("文件上传成功!开始解析数据并写入数据库!") + console.log("上传成功", response.code); + if (response.code == 0) { + jiBuQiVal = 0; + progressSize.value = 0; + excelJiexi.value = true; + staffChengji.orgId = response.data.orgId; + staffChengji.redisListKey = response.data.redisListKey; + staffChengji.total = response.data.total; + staffChengji.years = response.data.years; + staffChengji.levels = response.data.levels; + console.log("上传成功===>", staffChengji); + insetPeopleContStall(); + } +}; +//解析数据上传 +const insetPeopleContStall = () => { + // console.log("启动数据写入数据库",jiBuQiVal,totalNum.value) + if (jiBuQiVal < staffChengji.total) { + staffChengji.number = jiBuQiVal; + // console.log("启动数据写入数据库",sendData) + anaRedisOrgStaffExc(staffChengji).then((data: any) => { + console.log("启动数据写入11111数据库", data, data.data); + peopleMsg.value.push(data.data.msgStr); + jiBuQiVal++; + // if (jibuq+ 1 >= totalNum.value){ + + // } + progressSize.value = Math.round((jiBuQiVal / staffChengji.total) * 10000) / 100; + insetPeopleContStall(); + nextTick(() => { + // handleClick(); + }); + }); + } else { + excelJiexi.value = false; + progressSize.value = 100; + excelUploadStaff.value.clearFiles(); + } +};