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 712ade4..7b43468 100644 --- a/Pinnacle/src/main/java/com/cfive/pinnacle/controller/AffairController.java +++ b/Pinnacle/src/main/java/com/cfive/pinnacle/controller/AffairController.java @@ -39,6 +39,16 @@ public class AffairController { return ResponseResult.build(ResponseCode.DATABASE_SAVE_OK, "success", affairService.save(affair)); } + @GetMapping("/add/getUser") + public ResponseResult getUser() { + List userList = (List)userController.getAllUser().getData(); + return ResponseResult.build(ResponseCode.DATABASE_SELECT_OK,"success",userList); + }//获取数据库中所有用户 + + @GetMapping("/add/getCurrentUser") + public ResponseResult getCurrentUser() { + return ResponseResult.build(ResponseCode.DATABASE_SELECT_OK,"success",WebUtil.getLoginUser().getUser()); + }//获取当前用户 diff --git a/ui/src/components/ApplicantsAddAffairs.vue b/ui/src/components/ApplicantsAddAffairs.vue index 07d75f2..2f95e2c 100644 --- a/ui/src/components/ApplicantsAddAffairs.vue +++ b/ui/src/components/ApplicantsAddAffairs.vue @@ -6,16 +6,16 @@ - - - - - - - - - - + + + + + @@ -109,22 +109,6 @@ export default { ] } }, - // created: { - // // request(form) { - // // post("localhost:8686/addAffairs", - // // { - // // affairsName: form.affairsName, - // // Applicants: form.Applicants, - // // Approver: form.Approver, - // // affairsType: form.affairsType, - // // Date: form.Date, - // // Time: form.Time, - // // affairsContent: form.affairsContent - // // }, - // // ) - // // get("localhost:8686/addAffairs") - // // } - // }, methods: { onSubmit: function (form) { this.form.applicantId = this.currentUser.id @@ -205,23 +189,22 @@ export default { .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) + }) } - // , - // 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() + this.getCurrentUser() }, mounted() { this.$nextTick(function () {