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

Add note cards and update work card layout

This commit is contained in:
GGB
2023-05-31 15:08:12 +08:00
parent b3ef7f855e
commit e0e09fcd25
6 changed files with 113 additions and 38 deletions

View File

@@ -41,14 +41,14 @@ public class UserController {
}
@GetMapping("/affair")
@PreAuthorize("hasAuthority('affair:self:add')")
@PreAuthorize("hasAnyAuthority('affair:self:add')")
@Operation(summary = "获取拥有审批权限的用户")
public ResponseResult<List<User>> getAffairUser() {
return ResponseResult.databaseSelectSuccess(userService.getAffairUser());
}
@GetMapping("/department")
@PreAuthorize("hasAuthority('attendance:manage:modify')")
@PreAuthorize("hasAnyAuthority('work:manage:add', 'work:admin:add', 'attendance:manage:modify')")
@Operation(summary = "获取同部门下所有用户")
public ResponseResult<List<User>> getDepartmentUser() {
return ResponseResult.databaseSaveSuccess(userService.getDepartmentUser());

View File

@@ -257,6 +257,7 @@ create table `t_user_work`
`user_id` bigint not null comment '用户',
`work_id` bigint not null comment '工作事项',
`status` int not null default 0 comment '工作状态',
`complete_time` datetime null comment '完成时间',
`deleted` bigint not null default 0,
`version` int not null default 0,
constraint t_user_work_user_id_fk foreign key (user_id) references t_user (id),

View File

@@ -0,0 +1,76 @@
<template>
<el-card shadow="hover" class="homeCard">
<template #header>
<div class="card-header" style="height: 20px">
<h2>公告</h2>
<el-button class="button" text @click="pushTodo">查看更多</el-button>
</div>
</template>
<div v-for="item in tableData" :key="item" class="card-text card-item">
<el-row :gutter="10">
<el-col :xs="0" :sm="4" :md="4" :lg="3" :xl="2" style="justify-content: center">
<el-avatar style="background-color: #f89898" :size="32">
<el-icon color="white" :size="22" style="vertical-align: center">
<icon-pinnacle-notice-item />
</el-icon>
</el-avatar>
</el-col>
<el-col :xs="5" :sm="5" :md="5" :lg="8" :xl="10"
><el-text size="large" style="color: black; line-height: 32px" truncated>{{
item.title
}}</el-text>
</el-col>
<el-col :xs="15" :sm="11" :md="12" :lg="10" :xl="10" style="text-align: right"
><el-text type="info" style="line-height: 32px">{{
formatDate(item.sendTime)
}}</el-text></el-col
>
<el-col :xs="4" :sm="4" :md="3" :lg="3" :xl="2" style="text-align: right"
><el-text type="info" style="line-height: 32px">{{
item.sender.username
}}</el-text></el-col
>
</el-row>
</div>
</el-card>
</template>
<script lang="ts">
export default {
props: {
tableData: {
type: Array
}
},
methods: {
formatDate(time) {
return new Date(time).toLocaleString()
},
pushTodo() {
this.$router.push('/notice/view/all')
}
}
}
</script>
<style>
.card-header {
display: flex;
justify-content: space-between;
align-items: center;
}
.card-text {
font-size: 14px;
}
.card-item {
margin-bottom: 5px;
height: calc(((100vh - 56px - 40px - 20px) / 2 - 56px - 40px) / 5);
min-height: 32px;
}
.homeCard {
height: calc((100vh - 56px - 40px - 20px) / 2);
min-height: calc((500px - 56px - 40px - 20px) / 2);
}
</style>

View File

@@ -1,36 +1,32 @@
<template>
<el-card shadow="hover" class="workCard">
<el-card shadow="hover" class="homeCard">
<template #header>
<div class="card-header" style="height: 20px">
<h2>待办工作</h2>
<el-button class="button" text @click="pushTodo">查看更多</el-button>
</div>
</template>
<div v-for="item in tableData" :key="item" class="text item">
<div v-for="item in tableData" :key="item" class="card-text card-item">
<el-row :gutter="10">
<el-col :xs="0" :sm="4" :md="4" :lg="3" :xl="2" style="justify-content: center">
<el-avatar style="background-color: #409eff" size="default">
<el-icon
color="white"
:size="SIZE_ICON_MD()"
style="vertical-align: center"
>
<el-avatar style="background-color: #409eff" :size="32">
<el-icon color="white" :size="22" style="vertical-align: center">
<icon-pinnacle-workpage />
</el-icon>
</el-avatar>
</el-col>
<el-col :xs="5" :sm="5" :md="5" :lg="8" :xl="10"
><el-text size="large" style="color: black; line-height: 42px" truncated>{{
><el-text size="large" style="color: black; line-height: 32px" truncated>{{
item.content
}}</el-text>
</el-col>
<el-col :xs="15" :sm="11" :md="12" :lg="10" :xl="10" style="text-align: right"
><el-text type="info" style="line-height: 42px">{{
><el-text type="info" style="line-height: 32px">{{
formatDate(item.deadline)
}}</el-text></el-col
>
<el-col :xs="4" :sm="4" :md="3" :lg="3" :xl="2" style="text-align: right"
><el-text type="info" style="line-height: 42px">截止</el-text></el-col
><el-text type="info" style="line-height: 32px">截止</el-text></el-col
>
</el-row>
</div>
@@ -38,8 +34,6 @@
</template>
<script lang="ts">
import { SIZE_ICON_LG, SIZE_ICON_MD } from '@/constants/Common.constants'
export default {
props: {
tableData: {
@@ -47,12 +41,6 @@ export default {
}
},
methods: {
SIZE_ICON_LG() {
return SIZE_ICON_LG
},
SIZE_ICON_MD() {
return SIZE_ICON_MD
},
formatDate(time) {
return new Date(time).toLocaleString()
},
@@ -70,16 +58,16 @@ export default {
align-items: center;
}
.text {
.card-text {
font-size: 14px;
}
.item {
.card-item {
margin-bottom: 5px;
height: calc(((100vh - 56px - 40px - 20px) / 2 - 56px - 40px) / 5);
min-height: 48px;
min-height: 32px;
}
.workCard {
.homeCard {
height: calc((100vh - 56px - 40px - 20px) / 2);
min-height: calc((500px - 56px - 40px - 20px) / 2);
}

View File

@@ -2,18 +2,18 @@
<div style="height: calc(100vh - 56px - 40px); min-height: calc(500px - 56px - 40px)">
<el-row :gutter="20">
<el-col :span="12">
<work-card :tableData="tableData" />
<work-card :tableData="works" />
</el-col>
<el-col :span="12">
<work-card :tableData="tableData" />
<notice-card :tableData="notices" />
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<work-card :tableData="tableData" />
<work-card :tableData="works" />
</el-col>
<el-col :span="12">
<work-card :tableData="tableData" />
<work-card :tableData="works" />
</el-col>
</el-row>
</div>
@@ -26,7 +26,8 @@ export default {
name: 'HomePage',
data() {
return {
tableData: []
works: [],
notices: []
}
},
methods: {
@@ -34,7 +35,15 @@ export default {
request
.get('/work/card')
.then((response) => {
this.tableData = response.data.data
this.works = response.data.data
})
.catch((reportError) => {
console.log(reportError)
})
request
.get('/notice/limit')
.then((response) => {
this.notices = response.data.data
})
.catch((reportError) => {
console.log(reportError)

View File

@@ -43,7 +43,8 @@ const workRouter = {
icon: shallowRef(IconPinnacleWork),
requiresMenu: true,
requiresScrollbar: false,
requiresPadding: true
requiresPadding: true,
requiresAuth: true
}
}