1
0
mirror of https://github.com/FatttSnake/Pinnacle-OA.git synced 2026-04-06 07:21:24 +08:00

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
This commit is contained in:
assina045
2023-05-18 19:05:36 +08:00
parent 18469aca5f
commit 44499c154c
4 changed files with 89 additions and 19 deletions

View File

@@ -2,13 +2,18 @@ package com.cfive.pinnacle.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.cfive.pinnacle.entity.Affair; 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.ResponseCode;
import com.cfive.pinnacle.entity.common.ResponseResult; import com.cfive.pinnacle.entity.common.ResponseResult;
import com.cfive.pinnacle.service.IAffairService; import com.cfive.pinnacle.service.IAffairService;
import com.cfive.pinnacle.service.IUserService;
import com.cfive.pinnacle.utils.WebUtil; import com.cfive.pinnacle.utils.WebUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List;
/** /**
* <p> * <p>
* 事务 前端控制器 * 事务 前端控制器
@@ -23,6 +28,10 @@ import org.springframework.web.bind.annotation.*;
public class AffairController { public class AffairController {
@Autowired @Autowired
IAffairService affairService; IAffairService affairService;
// IUserService userService;
// 不用userService的方法了userController中已经写好了直接拿来用
@Autowired
UserController userController;
@PostMapping("/add") @PostMapping("/add")
@@ -30,6 +39,10 @@ public class AffairController {
return ResponseResult.build(ResponseCode.DATABASE_SAVE_OK, "success", affairService.save(affair)); return ResponseResult.build(ResponseCode.DATABASE_SAVE_OK, "success", affairService.save(affair));
} }
@GetMapping("/NotApproved") @GetMapping("/NotApproved")
public ResponseResult select_NotApproved() { public ResponseResult select_NotApproved() {
LambdaQueryWrapper<Affair> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<Affair> wrapper = new LambdaQueryWrapper<>();

View File

@@ -40,7 +40,9 @@ public interface AffairMapper extends BaseMapper<Affair> {
@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) @ResultType(Affair.class)
List<Affair> selectAffairs_NotApproved(); List<Affair> selectAffairs_NotApproved();

View File

@@ -8,18 +8,30 @@
<el-form-item label="申请者:"> <el-form-item label="申请者:">
<el-col :span="3"> <el-col :span="3">
<el-input v-model="form.applicantId" class="shortInput" /> <el-input
v-model="form.applicantId"
class="shortInput"
disabled
:placeholder="currentUser.username"
/>
</el-col> </el-col>
</el-form-item> </el-form-item>
<el-form-item label="审批者:"> <el-form-item label="审批者:">
<el-col :span="4"> <el-col :span="4">
<el-select v-model="form.inspectorId" placeholder="请选择审批者"> <el-select
<el-option value="1" label="ggb" /> v-model="form.inspectorId"
<el-option value="1652714496280469506" label="cyb" /> placeholder="请选择审批者"
<el-option value="1654151146072145921" label="syf" /> filterable
<el-option value="1654151877520973826" label="gzw" /> ref="fieldSelect"
<el-option value="1654151930402746370" label="yrm" /> popper-class="roleSelect"
>
<el-option
v-for="user in users"
:label="user.username"
:value="user.id"
:key="user.id"
/>
</el-select> </el-select>
</el-col> </el-col>
</el-form-item> </el-form-item>
@@ -82,7 +94,19 @@ export default {
old: '', old: '',
deleted: '', deleted: '',
version: '' version: ''
},
users: [
{
id: '',
username: ''
} }
],
currentUser: [
{
id: '',
username: ''
}
]
} }
}, },
// created: { // created: {
@@ -103,6 +127,7 @@ export default {
// }, // },
methods: { methods: {
onSubmit: function (form) { onSubmit: function (form) {
this.form.applicantId = this.currentUser.id
console.log(form) console.log(form)
if ( if (
!_.isEmpty(form.title) && !_.isEmpty(form.title) &&
@@ -153,27 +178,54 @@ export default {
type: 'error' type: 'error'
}) })
} }
if (_.isEmpty(form.createTime)) { // if (_.isEmpty(form.createTime)) {
ElMessage({ // ElMessage({
message: '错误!发送时间不能为空!', // message: '错误!发送时间不能为空!',
type: 'error' // type: 'error'
}) // })
// }
} }
} }, // 表单提交及验证
},
resetForm() { resetForm() {
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.ruleForm.resetFields() this.$refs.ruleForm.resetFields()
}) })
}, }, // 重置页面
alarm() { alarm() {
setInterval(() => { setInterval(() => {
this.form.createTime = new Date() this.form.createTime = new Date()
}, 500) }, 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() { created() {
this.alarm() this.alarm()
this.getUser()
this.getCurrentUser()
},
mounted() {
this.$nextTick(function () {
this.$refs.fieldSelect.$refs.scrollbar.$el.classList.add('scroll-opacity')
})
} }
} }
</script> </script>
@@ -191,4 +243,7 @@ export default {
height: 70%; height: 70%;
width: 70%; width: 70%;
} }
.roleSelect {
height: 100px;
}
</style> </style>

View File

@@ -85,7 +85,7 @@
<el-row> <el-row>
<el-col :span="3"></el-col> <el-col :span="3"></el-col>
<el-col :span="4">事务标题:</el-col> <el-col :span="4">事务标题:</el-col>
<el-col :span="1">{{ dialogData.title }}</el-col> <el-col :span="17">{{ dialogData.title }}</el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="3"></el-col> <el-col :span="3"></el-col>
@@ -93,7 +93,7 @@
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="7"></el-col> <el-col :span="7"></el-col>
<el-col :span="1">{{ dialogData.content }}</el-col> <el-col :span="17">{{ dialogData.content }}</el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="11"></el-col> <el-col :span="11"></el-col>