From 44499c154c93b5d2d720bf8c524db9a5d7535ea9 Mon Sep 17 00:00:00 2001 From: assina045 Date: Thu, 18 May 2023 19:05:36 +0800 Subject: [PATCH] 1. Optimized the problem of vertical display of data in the content button of the transaction management page and the approved transaction page. Now the transaction title and transaction content can be displayed normally 2. The approver drop-down box in the transaction add page can dynamically obtain the user id and username from the database and provide the username to the user for selection 3. The approver drop-down box has added a search function, a scroll bar, and a limit on the height of the drop-down box 4. You can obtain the id and username of the current user from the applicant input box, and display the username of the current user in the input box. The user has no grant to modify the contents of the input box --- .../pinnacle/controller/AffairController.java | 13 +++ .../cfive/pinnacle/mapper/AffairMapper.java | 4 +- ui/src/components/ApplicantsAddAffairs.vue | 87 +++++++++++++++---- ui/src/components/ApproverNotApproved.vue | 4 +- 4 files changed, 89 insertions(+), 19 deletions(-) diff --git a/Pinnacle/src/main/java/com/cfive/pinnacle/controller/AffairController.java b/Pinnacle/src/main/java/com/cfive/pinnacle/controller/AffairController.java index 4da6806..712ade4 100644 --- a/Pinnacle/src/main/java/com/cfive/pinnacle/controller/AffairController.java +++ b/Pinnacle/src/main/java/com/cfive/pinnacle/controller/AffairController.java @@ -2,13 +2,18 @@ package com.cfive.pinnacle.controller; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.cfive.pinnacle.entity.Affair; +import com.cfive.pinnacle.entity.Attendance; +import com.cfive.pinnacle.entity.User; import com.cfive.pinnacle.entity.common.ResponseCode; import com.cfive.pinnacle.entity.common.ResponseResult; import com.cfive.pinnacle.service.IAffairService; +import com.cfive.pinnacle.service.IUserService; import com.cfive.pinnacle.utils.WebUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import java.util.List; + /** *

* 事务 前端控制器 @@ -23,6 +28,10 @@ import org.springframework.web.bind.annotation.*; public class AffairController { @Autowired IAffairService affairService; +// IUserService userService; +// 不用userService的方法了,userController中已经写好了直接拿来用 + @Autowired + UserController userController; @PostMapping("/add") @@ -30,6 +39,10 @@ public class AffairController { return ResponseResult.build(ResponseCode.DATABASE_SAVE_OK, "success", affairService.save(affair)); } + + + + @GetMapping("/NotApproved") public ResponseResult select_NotApproved() { LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); diff --git a/Pinnacle/src/main/java/com/cfive/pinnacle/mapper/AffairMapper.java b/Pinnacle/src/main/java/com/cfive/pinnacle/mapper/AffairMapper.java index 245bee2..06b01b4 100644 --- a/Pinnacle/src/main/java/com/cfive/pinnacle/mapper/AffairMapper.java +++ b/Pinnacle/src/main/java/com/cfive/pinnacle/mapper/AffairMapper.java @@ -40,7 +40,9 @@ public interface AffairMapper extends BaseMapper { - @Select("SELECT * from t_affair where status=0 ") + + + @Select("SELECT t_affair.applicant_id,t_affair.inspector_id,t_user.id,t_user.username from t_affair,t_user ") @ResultType(Affair.class) List selectAffairs_NotApproved(); diff --git a/ui/src/components/ApplicantsAddAffairs.vue b/ui/src/components/ApplicantsAddAffairs.vue index 04a83b5..966f491 100644 --- a/ui/src/components/ApplicantsAddAffairs.vue +++ b/ui/src/components/ApplicantsAddAffairs.vue @@ -8,18 +8,30 @@ - + - - - - - - + + @@ -82,7 +94,19 @@ export default { old: '', deleted: '', version: '' - } + }, + users: [ + { + id: '', + username: '' + } + ], + currentUser: [ + { + id: '', + username: '' + } + ] } }, // created: { @@ -103,6 +127,7 @@ export default { // }, methods: { onSubmit: function (form) { + this.form.applicantId = this.currentUser.id console.log(form) if ( !_.isEmpty(form.title) && @@ -153,27 +178,54 @@ export default { type: 'error' }) } - if (_.isEmpty(form.createTime)) { - ElMessage({ - message: '错误!发送时间不能为空!', - type: 'error' - }) - } + // if (_.isEmpty(form.createTime)) { + // ElMessage({ + // message: '错误!发送时间不能为空!', + // type: 'error' + // }) + // } } - }, + }, // 表单提交及验证 resetForm() { this.$nextTick(() => { this.$refs.ruleForm.resetFields() }) - }, + }, // 重置页面 alarm() { setInterval(() => { this.form.createTime = new Date() }, 500) + }, // 动态时钟 + getUser() { + request + .get('http://localhost:8621/affair/add/getUser') + .then((response) => { + this.users = response.data.data + }) + .catch((reportError) => { + console.log(reportError) + }) // 数据库中获取用户 + }, + getCurrentUser() { + request + .get('http://localhost:8621/affair/add/getCurrentUser') + .then((response) => { + this.currentUser = response.data.data + }) + .catch((reportError) => { + console.log(reportError) + }) } }, created() { this.alarm() + this.getUser() + this.getCurrentUser() + }, + mounted() { + this.$nextTick(function () { + this.$refs.fieldSelect.$refs.scrollbar.$el.classList.add('scroll-opacity') + }) } } @@ -191,4 +243,7 @@ export default { height: 70%; width: 70%; } +.roleSelect { + height: 100px; +} diff --git a/ui/src/components/ApproverNotApproved.vue b/ui/src/components/ApproverNotApproved.vue index 8e0a8db..576d7d5 100644 --- a/ui/src/components/ApproverNotApproved.vue +++ b/ui/src/components/ApproverNotApproved.vue @@ -85,7 +85,7 @@ 事务标题: - {{ dialogData.title }} + {{ dialogData.title }} @@ -93,7 +93,7 @@ - {{ dialogData.content }} + {{ dialogData.content }}