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

View File

@@ -253,12 +253,13 @@ create table `t_work`
create table `t_user_work` create table `t_user_work`
( (
`id` bigint not null primary key, `id` bigint not null primary key,
`user_id` bigint not null comment '用户', `user_id` bigint not null comment '用户',
`work_id` bigint not null comment '工作事项', `work_id` bigint not null comment '工作事项',
`status` int not null default 0 comment '工作状态', `status` int not null default 0 comment '工作状态',
`deleted` bigint not null default 0, `complete_time` datetime null comment '完成时间',
`version` int not null default 0, `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), constraint t_user_work_user_id_fk foreign key (user_id) references t_user (id),
constraint t_user_work_work_id_fk foreign key (work_id) references t_work (id) constraint t_user_work_work_id_fk foreign key (work_id) references t_work (id)
) comment '中间表-用户-工作事项'; ) comment '中间表-用户-工作事项';

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> <template>
<el-card shadow="hover" class="workCard"> <el-card shadow="hover" class="homeCard">
<template #header> <template #header>
<div class="card-header" style="height: 20px"> <div class="card-header" style="height: 20px">
<h2>待办工作</h2> <h2>待办工作</h2>
<el-button class="button" text @click="pushTodo">查看更多</el-button> <el-button class="button" text @click="pushTodo">查看更多</el-button>
</div> </div>
</template> </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-row :gutter="10">
<el-col :xs="0" :sm="4" :md="4" :lg="3" :xl="2" style="justify-content: center"> <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-avatar style="background-color: #409eff" :size="32">
<el-icon <el-icon color="white" :size="22" style="vertical-align: center">
color="white"
:size="SIZE_ICON_MD()"
style="vertical-align: center"
>
<icon-pinnacle-workpage /> <icon-pinnacle-workpage />
</el-icon> </el-icon>
</el-avatar> </el-avatar>
</el-col> </el-col>
<el-col :xs="5" :sm="5" :md="5" :lg="8" :xl="10" <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 item.content
}}</el-text> }}</el-text>
</el-col> </el-col>
<el-col :xs="15" :sm="11" :md="12" :lg="10" :xl="10" style="text-align: right" <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) formatDate(item.deadline)
}}</el-text></el-col }}</el-text></el-col
> >
<el-col :xs="4" :sm="4" :md="3" :lg="3" :xl="2" style="text-align: right" <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> </el-row>
</div> </div>
@@ -38,8 +34,6 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { SIZE_ICON_LG, SIZE_ICON_MD } from '@/constants/Common.constants'
export default { export default {
props: { props: {
tableData: { tableData: {
@@ -47,12 +41,6 @@ export default {
} }
}, },
methods: { methods: {
SIZE_ICON_LG() {
return SIZE_ICON_LG
},
SIZE_ICON_MD() {
return SIZE_ICON_MD
},
formatDate(time) { formatDate(time) {
return new Date(time).toLocaleString() return new Date(time).toLocaleString()
}, },
@@ -70,16 +58,16 @@ export default {
align-items: center; align-items: center;
} }
.text { .card-text {
font-size: 14px; font-size: 14px;
} }
.item { .card-item {
margin-bottom: 5px; margin-bottom: 5px;
height: calc(((100vh - 56px - 40px - 20px) / 2 - 56px - 40px) / 5); 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); height: calc((100vh - 56px - 40px - 20px) / 2);
min-height: calc((500px - 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)"> <div style="height: calc(100vh - 56px - 40px); min-height: calc(500px - 56px - 40px)">
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="12"> <el-col :span="12">
<work-card :tableData="tableData" /> <work-card :tableData="works" />
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<work-card :tableData="tableData" /> <notice-card :tableData="notices" />
</el-col> </el-col>
</el-row> </el-row>
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="12"> <el-col :span="12">
<work-card :tableData="tableData" /> <work-card :tableData="works" />
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<work-card :tableData="tableData" /> <work-card :tableData="works" />
</el-col> </el-col>
</el-row> </el-row>
</div> </div>
@@ -26,7 +26,8 @@ export default {
name: 'HomePage', name: 'HomePage',
data() { data() {
return { return {
tableData: [] works: [],
notices: []
} }
}, },
methods: { methods: {
@@ -34,7 +35,15 @@ export default {
request request
.get('/work/card') .get('/work/card')
.then((response) => { .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) => { .catch((reportError) => {
console.log(reportError) console.log(reportError)

View File

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