diff --git a/src/views/process/evection/index.vue b/src/views/process/evection/index.vue index 6e7a9a6..b308ce1 100644 --- a/src/views/process/evection/index.vue +++ b/src/views/process/evection/index.vue @@ -56,7 +56,7 @@ - + @@ -260,6 +268,115 @@ 取 消 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{item.name}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -306,6 +423,8 @@ export default { title: "", // 是否显示弹出层 open: false, + openDetails: false, + isEdit: false, timeStatusList: [{id: '1', name: "上午"}, {id: '2', name: "下午"}], // 日期范围 @@ -438,6 +557,7 @@ export default { // 取消按钮 cancel() { this.open = false; + this.openDetails = false; this.reset(); }, // 表单重置 @@ -474,6 +594,10 @@ export default { handleAdd() { this.reset(); const Id = this.$store.state.user.id; + + let idNums = [Id+""]; + this.$set(this.form,"orgHeadUserIdList",idNums) + getPostName(Id).then(response => { this.form.postName = response.data.postName; this.open = true; @@ -504,6 +628,33 @@ export default { this.title = "编辑"; }); }, + + + /** 详情按钮操作 */ + handleDetails(row) { + this.reset(); + const Id = row.uuid; + getEvection(Id).then(response => { + this.form = response.data; + let num = []; + let numArr = this.form.hostUserId.split(",") + numArr.forEach(function (item){ + num.push(parseInt(item)); + }) + this.$set(this.form,"hostUserId",num) + if(this.form.travelers!=null){ + let arr = this.form.travelers.split(',') + let nums = []; + arr.forEach(function (item){ + nums.push(item.trim() + ""); + }) + this.$set(this.form,"orgHeadUserIdList",nums) + } + this.openDetails = true; + this.title = "详情"; + }); + }, + //选择部门 changDept(e) { console.log(e) @@ -523,8 +674,8 @@ export default { }) }, - getSelectedUserNames() { - const selectedUserIds = this.form.orgHeadUserIdList; + getSelectedUserNames(filteredIds) { + const selectedUserIds = filteredIds; const selectedUsers = this.personOptions.filter(option => selectedUserIds.includes(option.userIds)); const selectedUserNames = selectedUsers.map(user => user.userName); return selectedUserNames.join(', '); @@ -547,8 +698,26 @@ export default { console.log(this.form) this.$refs["form"].validate(valid => { if (valid) { - var list = this.form.hostUserId.join(","); + var lists = this.form.orgHeadUserIdList.join(","); + var idsArray = lists.split(",") + const Ids = this.$store.state.user.id+""; + const containsIds = idsArray.includes(Ids); + var filteredIds; + if(containsIds){ + //去掉它 + filteredIds = idsArray.filter(id => id !== Ids); + }else{ + this.$modal.msgError("出行人需要添加申请人"); + return ; + } + console.log(filteredIds) + this.form.travelers = filteredIds.join(","); + console.log(this.form.travelers) + var nameList = this.getSelectedUserNames(filteredIds); + this.form.travelersName = nameList; + + var list = this.form.hostUserId.join(","); // 将字符串分割成数组 const userIdArray = list.split(','); // 检查数组中是否同时存在0和其他非0的值 @@ -558,18 +727,11 @@ export default { this.$modal.msgError("选择’/‘后不能在选择其他人员"); return ; } - this.form.hostUserId = list; var hostNameList = this.getSelectedUserNameEvecTion(); this.form.hostUserName = hostNameList; - - var lists = this.form.orgHeadUserIdList.join(","); - this.form.travelers = lists; - - var nameList = this.getSelectedUserNames(); - this.form.travelersName = nameList; if (this.form.id != undefined) { this.form.examineStatus = 0 updateEvection(this.form).then(response => { diff --git a/src/views/process/requestReport/index.vue b/src/views/process/requestReport/index.vue index 6946a3c..6540506 100644 --- a/src/views/process/requestReport/index.vue +++ b/src/views/process/requestReport/index.vue @@ -161,7 +161,7 @@ - + - + + - + @@ -318,7 +318,7 @@ - + - + + - + @@ -459,17 +459,7 @@ export default { total: 0, // 表格数据 tableList: [ - { - userName:"张三", - orgName:"公司机关/分公司机关/×××项目部", - createTime:"2024-08-28 17:28", - leaveStartDate:"2024-08-29", - leaveStartInterval:"1", - leaveEndDate:"2024-08-29", - leaveEndInterval:"2", - leaveDuration:"1", - examineStatus:"0", - } + ], // 弹出层标题 title: "", @@ -516,9 +506,9 @@ export default { leaveStartDate: [ { required: true, message: "外出开始时间不能为空", trigger: "blur" } ], - leaveStartInterval: [ - { required: true, message: "不能为空", trigger: "change" } - ], + // leaveStartInterval: [ + // { required: true, message: "不能为空", trigger: "change" } + // ], leaveEndDate: [ { required: true, message: "外出结束时间不能为空", trigger: "blur" } ], @@ -580,6 +570,8 @@ export default { this.dateRange[1] = formattedDate; }, handleDateChange(){ + this.form.leaveStartInterval = 1; + this.form.leaveEndInterval = 2; if(this.form.leaveStartDate&&this.form.leaveEndDate){ let daysNumber = this.daysBetween(this.form.leaveStartDate,this.form.leaveEndDate) // console.log(daysNumber) @@ -810,20 +802,63 @@ export default { this.$refs["form"].validate(valid => { if (valid) { console.log(this.form) - var list = this.form.hostUserId.join(","); - this.form.hostUserId = list; - var lists = this.form.orgHeadUserIdList.join(","); - this.form.travelers = lists; - this.form.examineStatus = 0 - updateEvection(this.form).then(response => { - this.$modal.msgSuccess("修改成功"); - this.open = false; - this.getList(); - }); + var idsArray = lists.split(",") + const Ids = this.$store.state.user.id+""; + const containsIds = idsArray.includes(Ids); + var filteredIds; + if(containsIds){ + //去掉它 + filteredIds = idsArray.filter(id => id !== Ids); + }else{ + this.$modal.msgError("出行人需要添加申请人"); + return ; + } + this.form.travelers = filteredIds.join(","); + var nameList = this.getSelectedUserNames(filteredIds); + this.form.travelersName = nameList; + + 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 hostNameList = this.getSelectedUserNameEvecTion(); + this.form.hostUserName = hostNameList; + + + this.form.examineStatus = 0 + updateEvection(this.form).then(response => { + this.$modal.msgSuccess("修改成功"); + this.open = false; + this.getList(); + }); } }); }, + + getSelectedUserNames(filteredIds) { + const selectedUserIds = filteredIds; + const selectedUsers = this.personOptions.filter(option => selectedUserIds.includes(option.userIds)); + const selectedUserNames = selectedUsers.map(user => user.userName); + return selectedUserNames.join(', '); + }, + + getSelectedUserNameEvecTion() { + const selectedUserIdsStr = this.form.hostUserId; + // 将字符串分割成字符串数组,并将每个元素转换为整数 + const selectedUserIds = selectedUserIdsStr.split(',').map(id => parseInt(id.trim(), 10)); + const selectedUsers = this.userList.filter(option => selectedUserIds.includes(option.userId)); + const selectedUserNames = selectedUsers.map(user => user.userName); + return selectedUserNames.join(', '); + }, + handleBack(row) { this.$modal.confirm('是否确认撤回该申请?').then(function() { let param = { diff --git a/src/views/process/wechatEvection/index.vue b/src/views/process/wechatEvection/index.vue index a3e7e76..7410dee 100644 --- a/src/views/process/wechatEvection/index.vue +++ b/src/views/process/wechatEvection/index.vue @@ -42,7 +42,7 @@ - +