mirror of
https://github.com/FatttSnake/Pinnacle-OA.git
synced 2026-04-05 23:11:24 +08:00
Add employee personal information
This commit is contained in:
@@ -1,15 +1,22 @@
|
|||||||
package com.cfive.pinnacle.controller;
|
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.UserWork;
|
||||||
import com.cfive.pinnacle.entity.Work;
|
import com.cfive.pinnacle.entity.Work;
|
||||||
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.IUserWorkService;
|
||||||
import com.cfive.pinnacle.service.IWorkService;
|
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 com.cfive.pinnacle.utils.WebUtil;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -27,87 +34,72 @@ import java.util.List;
|
|||||||
public class WorkController {
|
public class WorkController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private IWorkService workService;
|
private IWorkService workService;
|
||||||
|
|
||||||
@GetMapping
|
@GetMapping
|
||||||
@PreAuthorize("hasAuthority('work:manage:get')")
|
|
||||||
public ResponseResult<List<Work>> getAll(String content) {
|
public ResponseResult<List<Work>> getAll(String content) {
|
||||||
if (content != null) {
|
if (content != null) {
|
||||||
List<Work> workList = workService.getWorkByContent(content);
|
List<Work> workList = workService.getWorkByContent(content);
|
||||||
return ResponseResult.databaseSelectSuccess(workList);
|
return ResponseResult.build(ResponseCode.DATABASE_SELECT_OK, "success",workList);
|
||||||
} else {
|
} else {
|
||||||
return ResponseResult.databaseSelectSuccess(workService.getAll());
|
return ResponseResult.build(ResponseCode.DATABASE_SELECT_OK, "success", workService.getAll());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/todo")
|
@GetMapping("/todo")
|
||||||
@PreAuthorize("hasAuthority('work:self:get')")
|
|
||||||
public ResponseResult<List<Work>> getTodo() {
|
public ResponseResult<List<Work>> getTodo() {
|
||||||
Long userId = WebUtil.getLoginUser().getUser().getId();
|
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")
|
@GetMapping("/card")
|
||||||
public ResponseResult<List<Work>> getCard() {
|
public ResponseResult<List<Work>> getCard() {
|
||||||
if (WebUtil.hasAuthority("work:self:home")) {
|
|
||||||
Long userId = WebUtil.getLoginUser().getUser().getId();
|
Long userId = WebUtil.getLoginUser().getUser().getId();
|
||||||
return ResponseResult.databaseSelectSuccess(workService.getCard(userId));
|
// long userId = 1;
|
||||||
}
|
return ResponseResult.build(ResponseCode.DATABASE_SELECT_OK, "success", workService.getCard(userId));
|
||||||
return ResponseResult.databaseSelectSuccess(List.of());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/complete")
|
@GetMapping("/complete")
|
||||||
@PreAuthorize("hasAuthority('work:self:get')")
|
|
||||||
public ResponseResult<List<Work>> getComplete() {
|
public ResponseResult<List<Work>> getComplete() {
|
||||||
Long userId = WebUtil.getLoginUser().getUser().getId();
|
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}")
|
@GetMapping("/{workId}")
|
||||||
@PreAuthorize("hasAuthority('work:self:detail') and hasAuthority('work:self:get')")
|
|
||||||
public ResponseResult<Work> getOne(@PathVariable Long workId) {
|
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
|
@PostMapping
|
||||||
@PreAuthorize("hasAuthority('work:manage:add')")
|
public ResponseResult<?> addWork(@RequestBody Work work) {
|
||||||
public ResponseResult<Work> addWork(@RequestBody Work work) {
|
|
||||||
work.setPublisherId(WebUtil.getLoginUser().getUser().getId());
|
work.setPublisherId(WebUtil.getLoginUser().getUser().getId());
|
||||||
if(workService.addWork(work)){
|
if(workService.addWork(work)){
|
||||||
return ResponseResult.databaseSaveSuccess(work);
|
return ResponseResult.build(ResponseCode.DATABASE_SAVE_OK, "success", null);
|
||||||
} else {
|
}else
|
||||||
return ResponseResult.build(ResponseCode.DATABASE_SAVE_ERROR, "Add failed", null);
|
return ResponseResult.build(ResponseCode.DATABASE_SAVE_ERROR, "error", null);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@DeleteMapping("/{id}")
|
@DeleteMapping("/{id}")
|
||||||
@PreAuthorize("hasAuthority('work:manage:delete')")
|
|
||||||
public ResponseResult<?> deleteById(@PathVariable Long id) {
|
public ResponseResult<?> deleteById(@PathVariable Long id) {
|
||||||
if(workService.deleteByWorkId(id)){
|
if(workService.deleteByWorkId(id)){
|
||||||
return ResponseResult.databaseDeleteSuccess();
|
return ResponseResult.build(ResponseCode.DATABASE_DELETE_OK, "success", null);
|
||||||
} else {
|
}else
|
||||||
return ResponseResult.build(ResponseCode.DATABASE_DELETE_ERROR, "Delete failed", null);
|
return ResponseResult.build(ResponseCode.DATABASE_DELETE_ERROR, "error", null);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping("/setStatus")
|
@PutMapping("/set_status")
|
||||||
@PreAuthorize("hasAuthority('work:self:status') and hasAuthority('work:self:get')")
|
public ResponseResult<?> updateStatus(@RequestBody UserWork userWork) {
|
||||||
public ResponseResult<UserWork> updateStatus(@RequestBody UserWork userWork) {
|
|
||||||
userWork.setUserId(WebUtil.getLoginUser().getUser().getId());
|
userWork.setUserId(WebUtil.getLoginUser().getUser().getId());
|
||||||
if(workService.updateStatus(userWork)){
|
if(workService.updateStatus(userWork)){
|
||||||
return ResponseResult.databaseUpdateSuccess(userWork);
|
return ResponseResult.build(ResponseCode.DATABASE_UPDATE_OK, "success", null);
|
||||||
} else {
|
}else
|
||||||
return ResponseResult.build(ResponseCode.DATABASE_UPDATE_ERROR, "Update failed", null);
|
return ResponseResult.build(ResponseCode.DATABASE_UPDATE_ERROR, "error", null);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping
|
@PutMapping
|
||||||
@PreAuthorize("hasAuthority('work:manage:modify')")
|
public ResponseResult<?> updateWork(@RequestBody Work work) {
|
||||||
public ResponseResult<Work> updateWork(@RequestBody Work work) {
|
|
||||||
work.setPublisherId(WebUtil.getLoginUser().getUser().getId());
|
work.setPublisherId(WebUtil.getLoginUser().getUser().getId());
|
||||||
if(workService.updateWork(work)){
|
if(workService.updateWork(work)){
|
||||||
return ResponseResult.databaseUpdateSuccess(work);
|
return ResponseResult.build(ResponseCode.DATABASE_UPDATE_OK, "success", null);
|
||||||
} else {
|
}else
|
||||||
return ResponseResult.build(ResponseCode.DATABASE_UPDATE_ERROR, "Update failed", null);
|
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;
|
private UserMapper userMapper;
|
||||||
@Override
|
@Override
|
||||||
public List<Work> getAll() {
|
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();
|
return workMapper.getAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Work> getTodo(Long userId) {
|
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);
|
return workMapper.getTodo(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Work> getCard(Long userId) {
|
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);
|
return workMapper.getCard(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Work> getComplete(Long userId) {
|
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);
|
return workMapper.getComplete(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,12 +64,6 @@ public class WorkServiceImpl extends ServiceImpl<WorkMapper, Work> implements IW
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Work> getWorkByContent(String content) {
|
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);
|
return workMapper.getWorkByContent(content);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,9 @@
|
|||||||
:data="taskData"
|
:data="taskData"
|
||||||
border
|
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="创建者">{{ taskData.publisherName }}</el-descriptions-item>
|
||||||
<el-descriptions-item label="创建时间">{{
|
<el-descriptions-item label="创建时间">{{
|
||||||
formatDate(taskData.createTime)
|
formatDate(taskData.createTime)
|
||||||
@@ -14,7 +17,7 @@
|
|||||||
<el-descriptions-item label="结束时间">{{
|
<el-descriptions-item label="结束时间">{{
|
||||||
formatDate(taskData.deadline)
|
formatDate(taskData.deadline)
|
||||||
}}</el-descriptions-item>
|
}}</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-progress :text-inside="true" :stroke-width="16" :percentage="taskData.progress" />
|
||||||
</el-descriptions-item>
|
</el-descriptions-item>
|
||||||
<el-descriptions-item label="负责员工">
|
<el-descriptions-item label="负责员工">
|
||||||
@@ -22,11 +25,10 @@
|
|||||||
item.username
|
item.username
|
||||||
}}</el-tag>
|
}}</el-tag>
|
||||||
</el-descriptions-item>
|
</el-descriptions-item>
|
||||||
<el-descriptions-item label="工作信息">{{ taskData.content }}</el-descriptions-item>
|
|
||||||
</el-descriptions>
|
</el-descriptions>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang='ts'>
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
taskData: {
|
taskData: {
|
||||||
|
|||||||
@@ -138,7 +138,9 @@
|
|||||||
<template #default>
|
<template #default>
|
||||||
<div style="display: flex; gap: 10px; flex-direction: column">
|
<div style="display: flex; gap: 10px; flex-direction: column">
|
||||||
<div>
|
<div>
|
||||||
<el-button style="width: 100%">个人档案</el-button>
|
<el-button @click="profile" style="width: 100%"
|
||||||
|
>个人档案</el-button
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<el-button @click="logout" style="width: 100%">退出</el-button>
|
<el-button @click="logout" style="width: 100%">退出</el-button>
|
||||||
@@ -221,6 +223,9 @@ export default {
|
|||||||
changeCollapsed() {
|
changeCollapsed() {
|
||||||
this.isCollapsed = !this.isCollapsed
|
this.isCollapsed = !this.isCollapsed
|
||||||
setLocalStorage('menuCollapsed', this.isCollapsed.toString())
|
setLocalStorage('menuCollapsed', this.isCollapsed.toString())
|
||||||
|
},
|
||||||
|
profile() {
|
||||||
|
this.$router.push('/profile')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async mounted() {
|
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>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang='ts'>
|
||||||
import request from '@/services'
|
import request from '@/services'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@@ -126,7 +126,7 @@ export default {
|
|||||||
setTaskStatus(userWork) {
|
setTaskStatus(userWork) {
|
||||||
console.log(userWork)
|
console.log(userWork)
|
||||||
request
|
request
|
||||||
.put('/work/setStatus', userWork)
|
.put('/work/set_status', userWork)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
console.log(response.data.data)
|
console.log(response.data.data)
|
||||||
this.getTableData()
|
this.getTableData()
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<router-view></router-view>
|
<router-view></router-view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang='ts'>
|
||||||
export default {
|
export default {
|
||||||
name: 'TaskPage',
|
name: 'TaskPage',
|
||||||
data() {
|
data() {
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang='ts'>
|
||||||
import request from '@/services'
|
import request from '@/services'
|
||||||
export default {
|
export default {
|
||||||
name: 'TodoPage',
|
name: 'TodoPage',
|
||||||
@@ -116,7 +116,7 @@ export default {
|
|||||||
userWork.completeTime = new Date()
|
userWork.completeTime = new Date()
|
||||||
console.log(userWork)
|
console.log(userWork)
|
||||||
request
|
request
|
||||||
.put('/work/setStatus', userWork)
|
.put('/work/set_status', userWork)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
console.log(response.data.data)
|
console.log(response.data.data)
|
||||||
this.getTableData()
|
this.getTableData()
|
||||||
|
|||||||
@@ -33,6 +33,11 @@ const router = createRouter({
|
|||||||
requiresAuth: false
|
requiresAuth: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: '/profile',
|
||||||
|
component: async () => await import('@/pages/profile/PersonalProfile.vue'),
|
||||||
|
name: 'profile'
|
||||||
|
},
|
||||||
workRouter,
|
workRouter,
|
||||||
noticeRouter,
|
noticeRouter,
|
||||||
attendanceRouter,
|
attendanceRouter,
|
||||||
|
|||||||
Reference in New Issue
Block a user