1
0
mirror of https://github.com/FatttSnake/Pinnacle-OA.git synced 2026-04-05 23:11:24 +08:00

Add affair management

This commit is contained in:
assina045
2023-05-06 03:54:36 +08:00
parent 5a1d44bf66
commit c944c20f2d
12 changed files with 678 additions and 3 deletions

View File

@@ -1,7 +1,12 @@
package com.cfive.pinnacle.controller; package com.cfive.pinnacle.controller;
import org.springframework.web.bind.annotation.RequestMapping; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.springframework.web.bind.annotation.RestController; import com.cfive.pinnacle.entity.Affair;
import com.cfive.pinnacle.entity.common.ResponseCode;
import com.cfive.pinnacle.entity.common.ResponseResult;
import com.cfive.pinnacle.service.IAffairService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/** /**
* <p> * <p>
@@ -11,8 +16,57 @@ import org.springframework.web.bind.annotation.RestController;
* @author FatttSnake * @author FatttSnake
* @since 2023-04-30 * @since 2023-04-30
*/ */
@CrossOrigin
@RestController @RestController
@RequestMapping("/affair") @RequestMapping("/affair")
public class AffairController { public class AffairController {
@Autowired
IAffairService affairService;
@PostMapping("/add")
public ResponseResult addAffair(@RequestBody Affair affair){
return ResponseResult.build(ResponseCode.DATABASE_SAVE_OK,"success",affairService.save(affair));
}
@GetMapping("/NotApproved")
public ResponseResult select_NotApproved(){
LambdaQueryWrapper<Affair> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(Affair::getStatus, 0);
return ResponseResult.build(ResponseCode.DATABASE_SELECT_OK, "success", affairService.list(wrapper));
}
@GetMapping("/Approved")
public ResponseResult select_Approved(){
LambdaQueryWrapper<Affair> wrapper2 =new LambdaQueryWrapper<>();
wrapper2.ne(Affair::getStatus,0);
return ResponseResult.build(ResponseCode.DATABASE_SELECT_OK,"success",affairService.list(wrapper2)) ;
}
@PutMapping("/yes")
public ResponseResult updateAffair_yes(@RequestBody Affair affair){
System.out.println(affair);
return ResponseResult.build(ResponseCode.DATABASE_UPDATE_OK,"success",affairService.updateAffair_Yes(affair));
//审批同意
}
@PutMapping("/no")
public ResponseResult updateAffair_No(@RequestBody Affair affair){
return ResponseResult.build(ResponseCode.DATABASE_UPDATE_OK,"success",affairService.updateAffair_No(affair));
//审批驳回
}
@DeleteMapping("/{id}")
public ResponseResult deleteAffair_Apprioved(@PathVariable Long id){
System.out.println("affair");
return ResponseResult.build(ResponseCode.DATABASE_DELETE_OK,"success",affairService.removeById(id));
//删除已审批事务
}
} }

View File

@@ -10,6 +10,7 @@ import java.io.Serial;
import java.io.Serializable; import java.io.Serializable;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
@@ -72,6 +73,7 @@ public class Affair implements Serializable {
* 创建时间 * 创建时间
*/ */
@TableField("create_time") @TableField("create_time")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'",timezone = "UTC")
private LocalDateTime createTime; private LocalDateTime createTime;
/** /**

View File

@@ -2,7 +2,9 @@ package com.cfive.pinnacle.mapper;
import com.cfive.pinnacle.entity.Affair; import com.cfive.pinnacle.entity.Affair;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.*;
import java.util.List;
/** /**
* <p> * <p>
@@ -15,4 +17,31 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper @Mapper
public interface AffairMapper extends BaseMapper<Affair> { public interface AffairMapper extends BaseMapper<Affair> {
@Insert("insert into t_affair(title,type_id,content,applicant_id,inspector_id,create_time) values(#{title},#{typeId},#{content},#{applicantId},#{inspectorId},#{createTime})")
int insertAffair(Affair affair);
//添加事务
//不添加事务的状态(affairsStatus),当事务进行添加时,添加的状态默认为'未审批'
@Delete("delete from t_affair where id=#{id}")
int deleteAffairs(Affair affair);
//根据id撤回新建的事务在新建事务时会再进行一次确定
// (是否撤回,当用户撤回新建的事务时根据新建的事务的id删除该条事务在数据库中的信息)
@Update("update t_affair set status=1 where id=#{id}")
int updateAffairs_Yes(Affair affair);
//管理员权限--->修改事务的状态(AffairsStatus)--->达到审批的效果
//同意
@Update("update t_affair set Status=2 where id=#{id}" )
int updateAffairs_NO(Affair affair);
//不同意
@Select("SELECT * from t_affair where status=0 ")
@ResultType(Affair.class)
List<Affair> selectAffairs_NotApproved();
} }

View File

@@ -13,4 +13,10 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/ */
public interface IAffairService extends IService<Affair> { public interface IAffairService extends IService<Affair> {
int insertAffair(Affair affair);
int updateAffair_Yes(Affair affair);
int updateAffair_No(Affair affair);
int deleteAffair_ApprovedByID(Affair affair);
} }

View File

@@ -4,6 +4,7 @@ import com.cfive.pinnacle.entity.Affair;
import com.cfive.pinnacle.mapper.AffairMapper; import com.cfive.pinnacle.mapper.AffairMapper;
import com.cfive.pinnacle.service.IAffairService; import com.cfive.pinnacle.service.IAffairService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
/** /**
@@ -17,4 +18,26 @@ import org.springframework.stereotype.Service;
@Service @Service
public class AffairServiceImpl extends ServiceImpl<AffairMapper, Affair> implements IAffairService { public class AffairServiceImpl extends ServiceImpl<AffairMapper, Affair> implements IAffairService {
@Autowired
private AffairMapper affairMapper;
@Override
public int insertAffair(Affair affair) {
return affairMapper.insertAffair(affair);
}
public int updateAffair_Yes(Affair affair) {
return affairMapper.updateAffairs_Yes(affair);
}
public int updateAffair_No(Affair affair) {
return affairMapper.updateAffairs_NO(affair);
}
@Override
public int deleteAffair_ApprovedByID(Affair affair) {
return affairMapper.deleteAffairs(affair);
}
} }

View File

@@ -0,0 +1,144 @@
<template>
<el-form :model="form" label-width="120px">
<el-form-item label="事务名称:">
<el-col :span="4">
<el-input v-model="form.title" placeholder="请输入事务名称" class="longInput" />
</el-col>
</el-form-item>
<el-form-item label="申请者:">
<el-col :span="3">
<el-input v-model="form.applicantId" class="shortInput" />
</el-col>
</el-form-item>
<el-form-item label="审批者:">
<el-col :span="4">
<el-select v-model="form.inspectorId" placeholder="请选择审批者">
<el-option value="1" label="ggb" />
<el-option value="1652714496280469506" label="cyb" />
</el-select>
</el-col>
</el-form-item>
<el-form-item label="事务类型:">
<el-col :span="8">
<el-radio-group v-model="form.typeId">
<el-radio :label="1" name="type">事假</el-radio>
<el-radio :label="2" name="type">病假</el-radio>
<el-radio :label="3" name="type">财务报销</el-radio>
<el-radio :label="4" name="type">调休</el-radio>
</el-radio-group>
</el-col>
</el-form-item>
<el-form-item label="发送日期:">
<el-col :span="1"><i class="el-icon-date"></i></el-col>
<el-col :span="5">
<el-date-picker
v-model="form.createTime"
type="date"
placeholder="请选择要发送日期"
style="width: 100%"
/>
</el-col>
</el-form-item>
<el-form-item label="具体内容:">
<el-row :span="20">
<el-col :span="40">
<el-input
v-model="form.content"
type="textarea"
class="textarea"
rows="15"
cols="20"
/>
</el-col>
</el-row>
</el-form-item>
<el-form-item>
<el-col :span="6">
<el-button type="primary" @click="onSubmit(form)">提交</el-button>
<el-button type="danger" @click="getApproed()">重置</el-button>
</el-col>
</el-form-item>
</el-form>
</template>
<script>
import 'element-plus/theme-chalk/index.css'
import request from '@/services'
export default {
data() {
return {
form: {
id: '',
title: '',
content: '',
typeId: '',
status: '',
applicantId: '',
inspectorId: '',
createTime: '',
inspectTime: '',
priority: '',
modifyTime: '',
originId: '',
old: '',
deleted: '',
version: ''
}
}
},
// 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(form) {
console.log(form)
request
.post('http://localhost:8621/affair/add', form)
.then((response) => {
console.log(response.data)
this.getApproed()
})
.catch((reportError) => {
console.log(reportError)
})
},
getApproed() {
history.go(0)
}
}
}
</script>
<style>
.longInput {
width: 99%;
}
.shortInput {
width: 150px;
}
.textarea {
height: 70%;
width: 70%;
}
</style>

View File

@@ -0,0 +1,179 @@
<template>
<el-row :span="24">
<el-col :span="18">
<div class="mt-4">
<el-input v-model="input3" placeholder="查询事务" class="input-with-select">
<template #prepend>
<el-select v-model="select" placeholder="查询方式">
<el-option label="事务编号" value="1" />
<el-option label="事务名称" value="2" />
<el-option label="日期" value="3" />
</el-select>
</template>
<template #append>
<el-button>查询</el-button>
</template>
</el-input>
</div>
</el-col>
<el-col :span="4">
<el-button type="warning" round>待审批</el-button>
<el-button type="success" round>已审批</el-button>
</el-col>
</el-row>
<el-table :data="tableData" style="width: 100%">
<el-table-column label="事务编号" prop="id" />
<el-table-column label="事务名称" prop="title" />
<el-table-column label="事务类型" prop="typeId" />
<el-table-column label="申请者" prop="applicantId" />
<el-table-column label="提交日期" prop="createTime">
<template #default="scope">
{{ format(scope.row.createTime) }}
</template>
</el-table-column>
<el-table-column label="审批日期" prop="inspectTime">
<template #default="scope">
{{ format(scope.row.inspectTime) }}
</template>
</el-table-column>
<el-table-column label="操作" key="slot" width="180">
<template #default="scope">
<el-button size="small" type="danger" @click="handleDelete(scope.row)">
删除
</el-button>
<el-button size="small" type="text" @click="handleEdit(scope.$index, scope.row)"
>具体内容
</el-button>
</template>
</el-table-column>
<el-table-column label="审批者" width="90" prop="inspectorId" />
</el-table>
<el-divider :data="labelData">
<div class="block">
<el-pagination
style="color: #888888"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
v-model:current-page="currentPage3"
:page-size="100"
layout="prev, pager, next, jumper"
:total="1000"
>
</el-pagination>
</div>
</el-divider>
</template>
<script>
import request from '@/services'
import 'element-plus/theme-chalk/index.css'
export default {
data() {
return {
tableData: [
{
id: '',
title: '',
content: '',
type_id: '',
status: '',
applicant_id: '',
inspector_id: '',
create_time: '',
inspect_time: '',
priority: '',
modify_time: '',
origin_id: '',
old: '',
deleted: '',
version: ''
}
],
// }],
labelData: [
{
currentPage1: 5,
currentPage2: 5,
currentPage3: 5,
currentPage4: 4
}
]
}
},
methods: {
handleYes(row) {
console.log(row)
request
.put('http://localhost:8621/affair/yes', row)
.then((response) => {
console.log(response.data)
this.getApproed()
})
.catch((reportError) => {
console.log(reportError)
})
},
handleNo(row) {
console.log(row)
request
.put('http://localhost:8621/affair/no', row)
.then((response) => {
console.log(response.data)
this.getApproed()
})
.catch((reportError) => {
console.log(reportError)
})
},
handleDelete(row) {
console.log(row.id)
request
.delete('http://localhost:8621/affair/' + row.id)
.then((response) => {
console.log(response.data)
this.getApproed()
})
.catch((reportError) => {
console.log(reportError)
})
},
handleSizeChange(val) {
console.log(`每页 ${val}`)
},
handleCurrentChange(val) {
console.log(`当前页: ${val}`)
},
getApproed() {
request
.get('http://localhost:8621/affair/Approved')
.then((response) => {
this.tableData = response.data.data
console.log(this.tableData)
})
.catch((reportError) => {
console.log(reportError)
})
},
format(time) {
return new Date(time).toLocaleString()
}
},
created() {
this.getApproed()
console.log(this.tableData)
}
}
</script>
<style></style>

View File

@@ -0,0 +1,165 @@
<template>
<el-row :span="24">
<el-col :span="18">
<div class="mt-4">
<el-input v-model="input3" placeholder="查询事务" class="input-with-select">
<template #prepend>
<el-select v-model="select" placeholder="查询方式">
<el-option label="事务编号" value="1" />
<el-option label="事务名称" value="2" />
<el-option label="日期" value="3" />
</el-select>
</template>
<template #append>
<el-button>查询</el-button>
</template>
</el-input>
</div>
</el-col>
<el-col :span="4">
<el-button type="warning" round>待审批</el-button>
<el-button type="success" round>已审批</el-button>
</el-col>
</el-row>
<el-table :data="tableData" style="width: 100%">
<el-table-column label="事务编号" prop="id" />
<el-table-column label="事务名称" prop="title" />
<el-table-column label="事务类型" prop="typeId" />
<el-table-column label="申请者" prop="applicantId" />
<el-table-column label="日期" prop="createTime">
<template #default="scope">
{{ format(scope.row.createTime) }}
</template>
</el-table-column>
<el-table-column label="操作" key="slot" width="240">
<template #default="scope">
<el-button size="small" type="text" @click="handleYes(scope.row)"
>具体内容
</el-button>
<el-button size="small" type="success" @click="handleYes(scope.row)"
>同意
</el-button>
<el-button size="small" type="danger" @click="handleNo(scope.row)">
驳回
</el-button>
</template>
</el-table-column>
</el-table>
<el-divider :data="labelData">
<div class="block">
<el-pagination
style="color: #888888"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
v-model:current-page="currentPage3"
:page-size="100"
layout="prev, pager, next, jumper"
:total="1000"
>
</el-pagination>
</div>
</el-divider>
</template>
<script>
import request from '@/services'
import 'element-plus/theme-chalk/index.css'
export default {
data() {
return {
tableData: [
{
id: '',
title: '',
content: '',
type_id: '',
status: '',
applicant_id: '',
inspector_id: '',
create_time: '',
inspect_time: '',
priority: '',
modify_time: '',
origin_id: '',
old: '',
deleted: '',
version: ''
}
],
// }],
labelData: [
{
currentPage1: 5,
currentPage2: 5,
currentPage3: 5,
currentPage4: 4
}
]
}
},
methods: {
handleYes(row) {
console.log(row)
request
.put('http://localhost:8621/affair/yes', row)
.then((response) => {
console.log(response.data)
this.getApproed()
})
.catch((reportError) => {
console.log(reportError)
})
},
handleNo(row) {
console.log(row)
request
.put('http://localhost:8621/affair/no', row)
.then((response) => {
console.log(response.data)
this.getApproed()
})
.catch((reportError) => {
console.log(reportError)
})
},
handleSizeChange(val) {
console.log(`每页 ${val}`)
},
handleCurrentChange(val) {
console.log(`当前页: ${val}`)
},
getApproed() {
request
.get('http://localhost:8621/affair/NotApproved')
.then((response) => {
this.tableData = response.data.data
console.log(this.tableData)
})
.catch((reportError) => {
console.log(reportError)
})
},
format(time) {
return new Date(time).toLocaleString()
}
},
created() {
this.getApproed()
console.log(this.tableData)
}
}
</script>
<style></style>

View File

@@ -0,0 +1,9 @@
<template><approver-not-approved></approver-not-approved></template>
<script>
export default {
name: 'AffairPage'
}
</script>
<style scoped></style>

View File

@@ -0,0 +1,11 @@
<template>
<applicants-add-affairs></applicants-add-affairs>
</template>
<script>
export default {
name: 'AffairAdd'
}
</script>
<style scoped></style>

View File

@@ -0,0 +1,9 @@
<template><approver-approved></approver-approved></template>
<script>
export default {
name: 'AffairApproved'
}
</script>
<style scoped></style>

View File

@@ -103,6 +103,50 @@ const router = createRouter({
requiresScrollbar: false, requiresScrollbar: false,
requiresPadding: true requiresPadding: true
} }
},
{
path: '/affair',
name: 'affair',
redirect: 'manage',
children: [
{
path: 'manage',
name: 'affairManage',
component: async () => await import('@/pages/affair/Affair.vue'),
meta: {
title: '事务管理',
requiresScrollbar: true,
requiresPadding: true
}
},
{
path: 'add',
component: async () => await import('@/pages/affair/AffairAdd.vue'),
name: 'affairAdd',
meta: {
title: '事务添加',
requiresScrollbar: true,
requiresPadding: true
}
},
{
path: 'approved',
component: async () =>
await import('@/pages/affair/AffairApproved.vue'),
name: 'affairApproved',
meta: {
title: '已审批事务',
requiresScrollbar: true,
requiresPadding: true
}
}
],
meta: {
title: '事务',
icon: IconPinnacleHome,
requiresScrollbar: false,
requiresPadding: true
}
} }
] ]
}, },