mirror of
https://github.com/FatttSnake/Pinnacle-OA.git
synced 2026-04-05 15:01:23 +08:00
Add employee personal information
This commit is contained in:
@@ -1,15 +1,22 @@
|
||||
package com.cfive.pinnacle.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.cfive.pinnacle.entity.User;
|
||||
import com.cfive.pinnacle.entity.UserWork;
|
||||
import com.cfive.pinnacle.entity.Work;
|
||||
import com.cfive.pinnacle.entity.common.ResponseCode;
|
||||
import com.cfive.pinnacle.entity.common.ResponseResult;
|
||||
import com.cfive.pinnacle.service.IUserWorkService;
|
||||
import com.cfive.pinnacle.service.IWorkService;
|
||||
import com.cfive.pinnacle.service.impl.UserWorkServiceImpl;
|
||||
import com.cfive.pinnacle.service.impl.WorkServiceImpl;
|
||||
import com.cfive.pinnacle.utils.WebUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -27,87 +34,72 @@ import java.util.List;
|
||||
public class WorkController {
|
||||
@Autowired
|
||||
private IWorkService workService;
|
||||
|
||||
@GetMapping
|
||||
@PreAuthorize("hasAuthority('work:manage:get')")
|
||||
public ResponseResult<List<Work>> getAll(String content) {
|
||||
if (content != null) {
|
||||
List<Work> workList = workService.getWorkByContent(content);
|
||||
return ResponseResult.databaseSelectSuccess(workList);
|
||||
return ResponseResult.build(ResponseCode.DATABASE_SELECT_OK, "success",workList);
|
||||
} else {
|
||||
return ResponseResult.databaseSelectSuccess(workService.getAll());
|
||||
return ResponseResult.build(ResponseCode.DATABASE_SELECT_OK, "success", workService.getAll());
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/todo")
|
||||
@PreAuthorize("hasAuthority('work:self:get')")
|
||||
public ResponseResult<List<Work>> getTodo() {
|
||||
Long userId = WebUtil.getLoginUser().getUser().getId();
|
||||
return ResponseResult.databaseSelectSuccess(workService.getTodo(userId));
|
||||
return ResponseResult.build(ResponseCode.DATABASE_SELECT_OK, "success", workService.getTodo(userId));
|
||||
}
|
||||
|
||||
@GetMapping("/card")
|
||||
public ResponseResult<List<Work>> getCard() {
|
||||
if (WebUtil.hasAuthority("work:self:home")) {
|
||||
Long userId = WebUtil.getLoginUser().getUser().getId();
|
||||
return ResponseResult.databaseSelectSuccess(workService.getCard(userId));
|
||||
}
|
||||
return ResponseResult.databaseSelectSuccess(List.of());
|
||||
Long userId = WebUtil.getLoginUser().getUser().getId();
|
||||
// long userId = 1;
|
||||
return ResponseResult.build(ResponseCode.DATABASE_SELECT_OK, "success", workService.getCard(userId));
|
||||
}
|
||||
|
||||
@GetMapping("/complete")
|
||||
@PreAuthorize("hasAuthority('work:self:get')")
|
||||
public ResponseResult<List<Work>> getComplete() {
|
||||
Long userId = WebUtil.getLoginUser().getUser().getId();
|
||||
return ResponseResult.databaseSelectSuccess(workService.getComplete(userId));
|
||||
return ResponseResult.build(ResponseCode.DATABASE_SELECT_OK, "success", workService.getComplete(userId));
|
||||
}
|
||||
|
||||
@GetMapping("/{workId}")
|
||||
@PreAuthorize("hasAuthority('work:self:detail') and hasAuthority('work:self:get')")
|
||||
public ResponseResult<Work> getOne(@PathVariable Long workId) {
|
||||
return ResponseResult.databaseSelectSuccess(workService.getOne(workId));
|
||||
return ResponseResult.build(ResponseCode.DATABASE_SELECT_OK, "success",workService.getOne(workId));
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@PreAuthorize("hasAuthority('work:manage:add')")
|
||||
public ResponseResult<Work> addWork(@RequestBody Work work) {
|
||||
public ResponseResult<?> addWork(@RequestBody Work work) {
|
||||
work.setPublisherId(WebUtil.getLoginUser().getUser().getId());
|
||||
if (workService.addWork(work)) {
|
||||
return ResponseResult.databaseSaveSuccess(work);
|
||||
} else {
|
||||
return ResponseResult.build(ResponseCode.DATABASE_SAVE_ERROR, "Add failed", null);
|
||||
}
|
||||
if(workService.addWork(work)){
|
||||
return ResponseResult.build(ResponseCode.DATABASE_SAVE_OK, "success", null);
|
||||
}else
|
||||
return ResponseResult.build(ResponseCode.DATABASE_SAVE_ERROR, "error", null);
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
@PreAuthorize("hasAuthority('work:manage:delete')")
|
||||
public ResponseResult<?> deleteById(@PathVariable Long id) {
|
||||
if (workService.deleteByWorkId(id)) {
|
||||
return ResponseResult.databaseDeleteSuccess();
|
||||
} else {
|
||||
return ResponseResult.build(ResponseCode.DATABASE_DELETE_ERROR, "Delete failed", null);
|
||||
}
|
||||
if(workService.deleteByWorkId(id)){
|
||||
return ResponseResult.build(ResponseCode.DATABASE_DELETE_OK, "success", null);
|
||||
}else
|
||||
return ResponseResult.build(ResponseCode.DATABASE_DELETE_ERROR, "error", null);
|
||||
}
|
||||
|
||||
@PutMapping("/setStatus")
|
||||
@PreAuthorize("hasAuthority('work:self:status') and hasAuthority('work:self:get')")
|
||||
public ResponseResult<UserWork> updateStatus(@RequestBody UserWork userWork) {
|
||||
@PutMapping("/set_status")
|
||||
public ResponseResult<?> updateStatus(@RequestBody UserWork userWork) {
|
||||
userWork.setUserId(WebUtil.getLoginUser().getUser().getId());
|
||||
if (workService.updateStatus(userWork)) {
|
||||
return ResponseResult.databaseUpdateSuccess(userWork);
|
||||
} else {
|
||||
return ResponseResult.build(ResponseCode.DATABASE_UPDATE_ERROR, "Update failed", null);
|
||||
}
|
||||
if(workService.updateStatus(userWork)){
|
||||
return ResponseResult.build(ResponseCode.DATABASE_UPDATE_OK, "success", null);
|
||||
}else
|
||||
return ResponseResult.build(ResponseCode.DATABASE_UPDATE_ERROR, "error", null);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@PreAuthorize("hasAuthority('work:manage:modify')")
|
||||
public ResponseResult<Work> updateWork(@RequestBody Work work) {
|
||||
public ResponseResult<?> updateWork(@RequestBody Work work) {
|
||||
work.setPublisherId(WebUtil.getLoginUser().getUser().getId());
|
||||
if (workService.updateWork(work)) {
|
||||
return ResponseResult.databaseUpdateSuccess(work);
|
||||
} else {
|
||||
return ResponseResult.build(ResponseCode.DATABASE_UPDATE_ERROR, "Update failed", null);
|
||||
}
|
||||
if(workService.updateWork(work)){
|
||||
return ResponseResult.build(ResponseCode.DATABASE_UPDATE_OK, "success", null);
|
||||
}else
|
||||
return ResponseResult.build(ResponseCode.DATABASE_UPDATE_ERROR, "error", null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,42 +36,21 @@ public class WorkServiceImpl extends ServiceImpl<WorkMapper, Work> implements IW
|
||||
private UserMapper userMapper;
|
||||
@Override
|
||||
public List<Work> getAll() {
|
||||
// List<Work> workList = workMapper.getAll();
|
||||
// for (Work work:
|
||||
// workList) {
|
||||
// work.setProgress(getProgress(work.getId()));
|
||||
// work.setPublisherName(getUserName(work.getPublisherId()));
|
||||
// }
|
||||
return workMapper.getAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Work> getTodo(Long userId) {
|
||||
// List<Work> workList = workMapper.getTodo(userId);
|
||||
// for (Work work:
|
||||
// workList) {
|
||||
// work.setPublisherName(getUserName(work.getPublisherId()));
|
||||
// }
|
||||
return workMapper.getTodo(userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Work> getCard(Long userId) {
|
||||
// List<Work> workList = workMapper.getCard(userId);
|
||||
// for (Work work:
|
||||
// workList) {
|
||||
// work.setPublisherName(getUserName(work.getPublisherId()));
|
||||
// }
|
||||
return workMapper.getCard(userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Work> getComplete(Long userId) {
|
||||
// List<Work> workList = workMapper.getComplete(userId);
|
||||
// for (Work work:
|
||||
// workList) {
|
||||
// work.setPublisherName(getUserName(work.getPublisherId()));
|
||||
// }
|
||||
return workMapper.getComplete(userId);
|
||||
}
|
||||
|
||||
@@ -85,12 +64,6 @@ public class WorkServiceImpl extends ServiceImpl<WorkMapper, Work> implements IW
|
||||
|
||||
@Override
|
||||
public List<Work> getWorkByContent(String content) {
|
||||
// List<Work> workList = workMapper.getWorkByContent(content);
|
||||
// for (Work work:
|
||||
// workList) {
|
||||
// work.setProgress(getProgress(work.getId()));
|
||||
// work.setPublisherName(getUserName(work.getPublisherId()));
|
||||
// }
|
||||
return workMapper.getWorkByContent(content);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,9 @@
|
||||
:data="taskData"
|
||||
border
|
||||
>
|
||||
<el-descriptions-item span="3" label="工作信息">{{
|
||||
taskData.content
|
||||
}}</el-descriptions-item>
|
||||
<el-descriptions-item label="创建者">{{ taskData.publisherName }}</el-descriptions-item>
|
||||
<el-descriptions-item label="创建时间">{{
|
||||
formatDate(taskData.createTime)
|
||||
@@ -14,7 +17,7 @@
|
||||
<el-descriptions-item label="结束时间">{{
|
||||
formatDate(taskData.deadline)
|
||||
}}</el-descriptions-item>
|
||||
<el-descriptions-item label="状态">
|
||||
<el-descriptions-item span="2" label="状态">
|
||||
<el-progress :text-inside="true" :stroke-width="16" :percentage="taskData.progress" />
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="负责员工">
|
||||
@@ -22,11 +25,10 @@
|
||||
item.username
|
||||
}}</el-tag>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="工作信息">{{ taskData.content }}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
<script lang='ts'>
|
||||
export default {
|
||||
props: {
|
||||
taskData: {
|
||||
|
||||
@@ -138,7 +138,9 @@
|
||||
<template #default>
|
||||
<div style="display: flex; gap: 10px; flex-direction: column">
|
||||
<div>
|
||||
<el-button style="width: 100%">个人档案</el-button>
|
||||
<el-button @click="profile" style="width: 100%"
|
||||
>个人档案</el-button
|
||||
>
|
||||
</div>
|
||||
<div>
|
||||
<el-button @click="logout" style="width: 100%">退出</el-button>
|
||||
@@ -221,6 +223,9 @@ export default {
|
||||
changeCollapsed() {
|
||||
this.isCollapsed = !this.isCollapsed
|
||||
setLocalStorage('menuCollapsed', this.isCollapsed.toString())
|
||||
},
|
||||
profile() {
|
||||
this.$router.push('/profile')
|
||||
}
|
||||
},
|
||||
async mounted() {
|
||||
|
||||
72
ui/src/pages/profile/PersonalProfile.vue
Normal file
72
ui/src/pages/profile/PersonalProfile.vue
Normal file
@@ -0,0 +1,72 @@
|
||||
<template>
|
||||
<div class="profile">
|
||||
<el-form :model="form" label-width="72px" label-position="top">
|
||||
<el-row :gutter="40">
|
||||
<el-col :span="12" style="text-align: center">
|
||||
<el-avatar :size="128" style="margin-bottom: 20px" />
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="名字">
|
||||
<el-input v-model="form.firstName" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="姓氏">
|
||||
<el-input v-model="form.lastName" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-form-item label="用户ID">
|
||||
<el-input v-model="form.userId" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="性别">
|
||||
<el-select placeholder="Select" size="large">
|
||||
<el-option />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="生日">
|
||||
<el-date-picker />
|
||||
</el-form-item>
|
||||
<el-form-item label="邮箱">
|
||||
<el-input />
|
||||
</el-form-item>
|
||||
<el-form-item label="手机号码">
|
||||
<el-input />
|
||||
</el-form-item>
|
||||
<el-form-item label="联系地址">
|
||||
<el-input />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
form: {
|
||||
userId: '',
|
||||
firstName: '',
|
||||
lastName: '',
|
||||
gender: '',
|
||||
birth: '',
|
||||
email: '',
|
||||
tel: '',
|
||||
address: ''
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
.profile {
|
||||
padding: 20px;
|
||||
}
|
||||
.profile .el-input {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
@@ -54,7 +54,7 @@
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
<script lang='ts'>
|
||||
import request from '@/services'
|
||||
|
||||
export default {
|
||||
@@ -126,7 +126,7 @@ export default {
|
||||
setTaskStatus(userWork) {
|
||||
console.log(userWork)
|
||||
request
|
||||
.put('/work/setStatus', userWork)
|
||||
.put('/work/set_status', userWork)
|
||||
.then((response) => {
|
||||
console.log(response.data.data)
|
||||
this.getTableData()
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<router-view></router-view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
<script lang='ts'>
|
||||
export default {
|
||||
name: 'TaskPage',
|
||||
data() {
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
<script lang='ts'>
|
||||
import request from '@/services'
|
||||
export default {
|
||||
name: 'TodoPage',
|
||||
@@ -116,7 +116,7 @@ export default {
|
||||
userWork.completeTime = new Date()
|
||||
console.log(userWork)
|
||||
request
|
||||
.put('/work/setStatus', userWork)
|
||||
.put('/work/set_status', userWork)
|
||||
.then((response) => {
|
||||
console.log(response.data.data)
|
||||
this.getTableData()
|
||||
|
||||
@@ -33,6 +33,11 @@ const router = createRouter({
|
||||
requiresAuth: false
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/profile',
|
||||
component: async () => await import('@/pages/profile/PersonalProfile.vue'),
|
||||
name: 'profile'
|
||||
},
|
||||
workRouter,
|
||||
noticeRouter,
|
||||
attendanceRouter,
|
||||
|
||||
Reference in New Issue
Block a user