From b179c2d76ccec82c903bf8eba139d078e473750f Mon Sep 17 00:00:00 2001 From: lSun <15893999301@qq.com> Date: Thu, 14 Nov 2024 20:15:11 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=88=B7=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/process/evection/index.vue | 15 ++++++++-- src/views/process/leaveReporting/index.vue | 12 +++++++- src/views/process/outApply/index.vue | 34 +++++++++++++++++----- src/views/process/outExam/index.vue | 21 +++++++++++-- src/views/process/restApply/index.vue | 34 +++++++++++++++++----- src/views/process/restExam/index.vue | 21 +++++++++++-- 6 files changed, 116 insertions(+), 21 deletions(-) diff --git a/src/views/process/evection/index.vue b/src/views/process/evection/index.vue index 01f961f..ef4c686 100644 --- a/src/views/process/evection/index.vue +++ b/src/views/process/evection/index.vue @@ -137,7 +137,7 @@ - + - + { if (valid) { var list = this.form.hostUserId.join(","); + + // 将字符串分割成数组 + const userIdArray = list.split(','); + // 检查数组中是否同时存在0和其他非0的值 + const containsZero = userIdArray.includes('0'); + const containsOtherValues = userIdArray.some(id => id !== '0'); + if (containsZero && containsOtherValues) { + this.$modal.msgError("选择’/‘后不能在选择其他人员"); + return ; + } + this.form.hostUserId = list; var lists = this.form.orgHeadUserIdList.join(","); diff --git a/src/views/process/leaveReporting/index.vue b/src/views/process/leaveReporting/index.vue index a4a6c0d..5190e8b 100644 --- a/src/views/process/leaveReporting/index.vue +++ b/src/views/process/leaveReporting/index.vue @@ -226,7 +226,7 @@ - + id !== '0'); + if (containsZero && containsOtherValues) { + this.$modal.msgError("选择’/‘后不能在选择其他人员"); + return ; + } + this.form.hostUserId = list; if (this.form.id != undefined) { this.form.examineStatus = 0 diff --git a/src/views/process/outApply/index.vue b/src/views/process/outApply/index.vue index 7b37620..b64dcad 100644 --- a/src/views/process/outApply/index.vue +++ b/src/views/process/outApply/index.vue @@ -498,9 +498,13 @@ export default { console.log(this.form); // 转换 hostUserId 字段为整数数组 - let numArr = this.form.hostUserId.split(","); - let num = numArr.map(item => parseInt(item)); // 使用 map 简化代码 - this.$set(this.form, "hostUserId", num); + if(this.form.hostUserId ==null){ + this.$set(this.form, "hostUserId", 0); + }else{ + let numArr = this.form.hostUserId.split(","); + let num = numArr.map(item => parseInt(item)); // 使用 map 简化代码 + this.$set(this.form, "hostUserId", num); + } this.$set(this.form,"postName",postName) this.open = true; this.isView = false; @@ -521,9 +525,13 @@ export default { console.log(this.form); // 转换 hostUserId 字段为整数数组 - let numArr = this.form.hostUserId.split(","); - let num = numArr.map(item => parseInt(item)); // 使用 map 简化代码 - this.$set(this.form, "hostUserId", num); + if(this.form.hostUserId ==null){ + this.$set(this.form, "hostUserId", 0); + }else{ + let numArr = this.form.hostUserId.split(","); + let num = numArr.map(item => parseInt(item)); // 使用 map 简化代码 + this.$set(this.form, "hostUserId", num); + } this.$set(this.form,"postName",postName) this.open = true; this.isView = true; @@ -546,6 +554,17 @@ export default { if (valid) { console.log(this.form) var list = this.form.hostUserId.join(","); + + // 将字符串分割成数组 + const userIdArray = list.split(','); + // 检查数组中是否同时存在0和其他非0的值 + const containsZero = userIdArray.includes('0'); + const containsOtherValues = userIdArray.some(id => id !== '0'); + if (containsZero && containsOtherValues) { + this.$modal.msgError("选择’/‘后不能在选择其他人员"); + return ; + } + this.form.hostUserId = list; if (this.form.id != undefined) { this.form.examineStatus=0 @@ -565,13 +584,14 @@ export default { }); }, handleBack(row) { + var that = this; this.$modal.confirm('是否确认撤回该申请?').then(function() { let param = { id:row.id, examineStatus:'3', } changeHolidayStatus(param).then(response => { - this.getList(); + that.getList(); this.$modal.msgSuccess("撤回成功"); }); }) diff --git a/src/views/process/outExam/index.vue b/src/views/process/outExam/index.vue index 2983fa7..16e048e 100644 --- a/src/views/process/outExam/index.vue +++ b/src/views/process/outExam/index.vue @@ -406,12 +406,21 @@ export default { }, pass(){ this.$refs["form"].validate(valid => { + var name = ""; + const selectedOrg = this.orgList.find(org => org.id == this.form.orgId); + if (selectedOrg) { + name = selectedOrg.name; + } else { + name = ''; + } + if (valid) { let param = { id:this.form.id, examineStatus:'1', leaveType:"外出办事", - examineOpinion:this.form.examineOpinion + examineOpinion:this.form.examineOpinion, + orgName: name } this.changExamStatus(param) } @@ -419,12 +428,20 @@ export default { }, reject(){ this.$refs["form"].validate(valid => { + var name = ""; + const selectedOrg = this.orgList.find(org => org.id == this.form.orgId); + if (selectedOrg) { + name = selectedOrg.name; + } else { + name = ''; + } if (valid) { let param = { id:this.form.id, examineStatus:'2', leaveType:"外出办事", - examineOpinion:this.form.examineOpinion + examineOpinion:this.form.examineOpinion, + orgName:name } this.changExamStatus(param) } diff --git a/src/views/process/restApply/index.vue b/src/views/process/restApply/index.vue index 8c66354..0f92d46 100644 --- a/src/views/process/restApply/index.vue +++ b/src/views/process/restApply/index.vue @@ -483,9 +483,13 @@ console.log(this.form); // 转换 hostUserId 字段为整数数组 - let numArr = this.form.hostUserId.split(","); - let num = numArr.map(item => parseInt(item)); // 使用 map 简化代码 - this.$set(this.form, "hostUserId", num); + if(this.form.hostUserId ==null){ + this.$set(this.form, "hostUserId", 0); + }else{ + let numArr = this.form.hostUserId.split(","); + let num = numArr.map(item => parseInt(item)); // 使用 map 简化代码 + this.$set(this.form, "hostUserId", num); + } this.$set(this.form,"postName",postName) // 更新视图状态 this.open = true; @@ -507,9 +511,13 @@ console.log(this.form); // 转换 hostUserId 字段为整数数组 - let numArr = this.form.hostUserId.split(","); - let num = numArr.map(item => parseInt(item)); // 使用 map 简化代码 - this.$set(this.form, "hostUserId", num); + if(this.form.hostUserId ==null){ + this.$set(this.form, "hostUserId", 0); + }else{ + let numArr = this.form.hostUserId.split(","); + let num = numArr.map(item => parseInt(item)); // 使用 map 简化代码 + this.$set(this.form, "hostUserId", num); + } this.$set(this.form,"postName",postName) // 更新视图状态 this.open = true; @@ -533,6 +541,17 @@ if (valid) { console.log(this.form) var list = this.form.hostUserId.join(","); + + // 将字符串分割成数组 + const userIdArray = list.split(','); + // 检查数组中是否同时存在0和其他非0的值 + const containsZero = userIdArray.includes('0'); + const containsOtherValues = userIdArray.some(id => id !== '0'); + if (containsZero && containsOtherValues) { + this.$modal.msgError("选择’/‘后不能在选择其他人员"); + return ; + } + this.form.hostUserId = list; if (this.form.id != undefined) { this.form.examineStatus=0 @@ -552,13 +571,14 @@ }); }, handleBack(row) { + var that = this; this.$modal.confirm('是否确认撤回该申请?').then(function() { let param = { id:row.id, examineStatus:'3', } changeHolidayStatus(param).then(response => { - this.getList(); + that.getList(); this.$modal.msgSuccess("撤回成功"); }); }) diff --git a/src/views/process/restExam/index.vue b/src/views/process/restExam/index.vue index 7deda64..b2a87b1 100644 --- a/src/views/process/restExam/index.vue +++ b/src/views/process/restExam/index.vue @@ -406,12 +406,20 @@ export default { }, pass(){ this.$refs["form"].validate(valid => { + var name = ""; + const selectedOrg = this.orgList.find(org => org.id == this.form.orgId); + if (selectedOrg) { + name = selectedOrg.name; + } else { + name = ''; + } if (valid) { let param = { id:this.form.id, examineStatus:'1', leaveType:"轮休", - examineOpinion:this.form.examineOpinion + examineOpinion:this.form.examineOpinion, + orgName:name } this.changExamStatus(param) } @@ -419,12 +427,21 @@ export default { }, reject(){ this.$refs["form"].validate(valid => { + var name = ""; + const selectedOrg = this.orgList.find(org => org.id == this.form.orgId); + if (selectedOrg) { + name = selectedOrg.name; + } else { + name = ''; + } + if (valid) { let param = { id:this.form.id, examineStatus:'2', leaveType:"轮休", - examineOpinion:this.form.examineOpinion + examineOpinion:this.form.examineOpinion, + orgName:name } this.changExamStatus(param) }