oa-ui/src/views/Home/Index.vue

556 lines
18 KiB
Vue
Raw Normal View History

2024-07-21 05:54:36 +00:00
<template>
2024-10-24 02:44:59 +00:00
<el-row class="mt-8px" :gutter="8" justify="space-between" >
<el-col :xl="7" :lg="7" :md="24" :sm="24" :xs="24">
<el-card shadow="hover">
<template #header >
<div class="SystemThem" style="height: 2px;"></div>
<div class="h-3 flex justify-between" style="height: 15px;margin: 0;padding: 0;">
2024-10-24 08:06:03 +00:00
<span style="display: inline-block;">新闻速递</span>
2024-10-24 02:44:59 +00:00
<el-link
type="primary"
:underline="false"
2024-10-30 07:11:54 +00:00
@click.prevent="more"
2024-10-24 02:44:59 +00:00
target="_blank"
style="margin-top: 10px"
>
更多>>
</el-link>
</div>
</template>
2024-07-23 08:09:18 +00:00
<el-skeleton :loading="loading" animated>
2024-10-24 03:17:32 +00:00
<el-card shadow="never" style="margin-bottom: 5px;height: 330px">
2024-10-24 03:00:10 +00:00
<el-carousel :interval="4000" height="300px" motion-blur @change="handleCarouselChange">
2024-10-24 11:29:58 +00:00
<el-carousel-item v-for="item in filteredList" :key="item.Id">
<el-image style="width: 100%; height: 100%" :src="imgUrl+item.newsImg" alt="无图片" :title="item.newsName"/>
2024-10-24 02:44:59 +00:00
</el-carousel-item>
</el-carousel>
</el-card>
<el-row>
<el-col :span="24">
2024-10-24 11:29:58 +00:00
<span class="ellipsis" v-if="filteredList[pageNo - 1]">{{filteredList[pageNo-1].newsName}}</span>
2024-07-23 08:09:18 +00:00
</el-col>
</el-row>
</el-skeleton>
2024-07-23 01:18:33 +00:00
</el-card>
2024-10-24 02:44:59 +00:00
<el-card shadow="hover" class="mt-8px">
<template #header >
<div class="SystemThem" style="height: 2px;"></div>
<div class="h-3 flex justify-between" style="height: 15px;margin: 0;padding: 0;">
2024-10-24 08:06:03 +00:00
<span style="display: inline-block;">内部刊物</span>
2024-10-24 02:44:59 +00:00
<el-link
type="primary"
:underline="false"
target="_blank"
style="margin-top: 10px"
>
更多>>
</el-link>
2024-07-21 05:54:36 +00:00
</div>
</template>
2024-10-24 02:44:59 +00:00
<el-skeleton :loading="loading" animated>
2024-07-21 05:54:36 +00:00
<el-row>
<el-col
2024-10-24 02:44:59 +00:00
v-for="(item,index) in todo"
2024-07-21 05:54:36 +00:00
:key="`card-${index}`"
>
2024-10-24 02:44:59 +00:00
<span style="display: inline-block; margin-bottom: 10px;font-size: 15px;" >* {{item.title}}</span>
2024-07-21 05:54:36 +00:00
</el-col>
</el-row>
</el-skeleton>
</el-card>
2024-10-24 02:44:59 +00:00
<el-card shadow="hover" class="mt-8px">
<template #header >
<div class="SystemThem" style="height: 2px;"></div>
<div class="h-3 flex justify-between" style="height: 15px;margin: 0;padding: 0;">
<span style="display: inline-block;">系统聚焦</span>
<el-link
type="primary"
:underline="false"
target="_blank"
style="margin-top: 10px"
>
更多>>
</el-link>
</div>
</template>
2024-07-21 05:54:36 +00:00
<el-skeleton :loading="loading" animated>
2024-10-24 02:44:59 +00:00
<el-row>
<el-col
v-for="(item,index) in todo"
:key="`card-${index}`"
>
<span style="display: inline-block; margin-bottom: 10px;font-size: 15px;" >* {{item.title}}</span>
2024-09-18 06:09:34 +00:00
</el-col>
2024-10-24 02:44:59 +00:00
</el-row>
</el-skeleton>
</el-card>
</el-col>
<el-col :xl="11" :lg="11" :md="24" :sm="24" :xs="24" class="mb-8px">
<el-card shadow="hover">
<template #header >
<div class="SystemThem" style="height: 2px;"></div>
<div class="h-3 flex justify-between" style="height: 15px;margin: 0;padding: 0;">
<span style="display: inline-block;">事务</span>
<el-link
type="primary"
:underline="false"
target="_blank"
style="margin-top: 10px"
>
更多>>
</el-link>
</div>
</template>
<el-skeleton :loading="loading" animated>
<el-tabs type="border-card" class="demo-tabs">
<el-tab-pane label="待办">
<el-row>
<el-col
v-for="(item,index) in todo"
:key="`card-${index}`"
>
<span style="display: inline-block; margin-bottom: 10px;font-size: 15px;" >* {{item.title}}</span>
</el-col>
</el-row>
</el-tab-pane>
<el-tab-pane label="待阅">
<el-row>
<el-col
v-for="(item,index) in todo"
:key="`card-${index}`"
>
<span style="display: inline-block; margin-bottom: 10px;font-size: 15px;" >* {{item.title}}</span>
</el-col>
</el-row>
</el-tab-pane>
<el-tab-pane label="已办">
<el-row>
<el-col
v-for="(item,index) in todo"
:key="`card-${index}`"
>
<span style="display: inline-block; margin-bottom: 10px;font-size: 15px;" >* {{item.title}}</span>
</el-col>
</el-row>
</el-tab-pane>
<el-tab-pane label="已阅">
<el-row>
<el-col
v-for="(item,index) in todo"
:key="`card-${index}`"
>
<span style="display: inline-block; margin-bottom: 10px;font-size: 15px;" >* {{item.title}}</span>
</el-col>
</el-row>
</el-tab-pane>
</el-tabs>
</el-skeleton>
</el-card>
<el-card shadow="hover" class="mt-8px">
<template #header >
<div class="SystemThem" style="height: 2px;"></div>
<div class="h-3 flex justify-between" style="height: 15px;margin: 0;padding: 0;">
<span style="display: inline-block;">报销单</span>
<el-link
type="primary"
:underline="false"
target="_blank"
style="margin-top: 10px"
>
更多>>
</el-link>
</div>
</template>
<el-skeleton :loading="loading" animated>
<el-row>
<el-col
v-for="(item,index) in todo"
:key="`card-${index}`"
>
<span style="display: inline-block; margin-bottom: 10px;font-size: 15px;" >* {{item.title}}</span>
2024-07-21 05:54:36 +00:00
</el-col>
2024-09-18 06:09:34 +00:00
</el-row>
</el-skeleton>
</el-card>
2024-10-24 02:44:59 +00:00
<el-card shadow="hover" class="mt-8px">
<template #header >
<div class="SystemThem" style="height: 2px;"></div>
<div class="h-3 flex justify-between" style="height: 15px;margin: 0;padding: 0;">
<span style="display: inline-block;">会议室管理</span>
<el-link
type="primary"
:underline="false"
target="_blank"
style="margin-top: 10px"
>
更多>>
</el-link>
2024-07-23 08:13:48 +00:00
</div>
</template>
<el-skeleton :loading="loading" animated>
<el-row>
2024-10-24 02:44:59 +00:00
<el-col
v-for="(item,index) in todo"
:key="`card-${index}`"
>
<span style="display: inline-block; margin-bottom: 10px;font-size: 15px;" >* {{item.title}}</span>
2024-07-23 08:13:48 +00:00
</el-col>
</el-row>
</el-skeleton>
</el-card>
2024-09-19 05:34:43 +00:00
</el-col>
2024-10-24 02:44:59 +00:00
<el-col :xl="6" :lg="6" :md="24" :sm="24" :xs="24" class="mb-8px">
<el-card shadow="hover">
<template #header >
<div class="SystemThem" style="height: 2px;"></div>
<div class="h-3 flex justify-between" style="height: 15px;margin: 0;padding: 0;">
<span style="display: inline-block;">新闻</span>
<el-link
type="primary"
:underline="false"
target="_blank"
2024-10-30 07:11:54 +00:00
@click.prevent="more"
2024-10-24 02:44:59 +00:00
style="margin-top: 10px"
>
更多>>
</el-link>
2024-09-19 05:34:43 +00:00
</div>
</template>
<el-skeleton :loading="loading" animated>
<div v-for="(item, index) in filteredList2" :key="`dynamics-${index}`">
<div class="flex items-center">
<div>
2024-10-24 11:29:58 +00:00
<div class="text-14px" @click="openDialog(item.contentType,item.id)">
2024-10-24 02:44:59 +00:00
<dict-tag :type="DICT_TYPE.HOME_CONTENT_STATUS" :value="item.contentType" /> :
2024-10-24 11:29:58 +00:00
{{ item.newsName }}
2024-09-19 05:34:43 +00:00
</div>
2024-10-24 02:44:59 +00:00
<div class="text-12px text-gray-400">
2024-10-24 11:29:58 +00:00
{{ formatTime(item.newsCreatetime, 'yyyy-MM-dd') }}
2024-09-19 05:34:43 +00:00
</div>
</div>
</div>
<el-divider />
</div>
</el-skeleton>
</el-card>
2024-10-24 02:44:59 +00:00
<el-card shadow="hover" class="mt-8px">
<template #header >
<div class="SystemThem" style="height: 2px;"></div>
<div class="h-3 flex justify-between" style="height: 15px;margin: 0;padding: 0;">
<span style="display: inline-block;">邮件</span>
<el-link
type="primary"
:underline="false"
target="_blank"
style="margin-top: 10px"
>
更多>>
</el-link>
2024-07-23 01:18:33 +00:00
</div>
</template>
<el-skeleton :loading="loading" animated>
<el-row>
2024-10-24 02:44:59 +00:00
<el-table stripe :data="tableData" border style="width: 100%" max-height="300">
<el-table-column :formatter="dateFormatter2" prop="Date" label="时间" width="100" />
<el-table-column prop="Name" label="发件人" width="70" />
<el-table-column
prop="Address"
label="标题"
show-overflow-tooltip
/>
</el-table>
2024-07-23 01:18:33 +00:00
</el-row>
</el-skeleton>
</el-card>
2024-10-24 02:44:59 +00:00
<el-card shadow="hover" class="mt-8px">
<template #header >
<div class="SystemThem" style="height: 2px;"></div>
<div class="h-3 flex justify-between" style="height: 15px;margin: 0;padding: 0;">
<span style="display: inline-block;">日历</span>
<el-link
type="primary"
:underline="false"
target="_blank"
style="margin-top: 10px"
>
更多>>
</el-link>
</div>
</template>
<el-skeleton :loading="loading" animated>
<el-calendar ref="calendar" class="custom-calendar">
<template #header = "{date}">
<el-row>
<el-col :span="6">
<span style="display: inline-block;font-size: 10px">{{ date }}</span>
</el-col>
<el-col :span="18">
<el-button-group style="display: flex; justify-content: space-between;">
<el-button size="small" @click="selectDate('prev-year')">上年</el-button>
<el-button size="small" @click="selectDate('prev-month')">上月</el-button>
<el-button size="small" @click="selectDate('today')">今天</el-button>
<el-button size="small" @click="selectDate('next-year')">下年</el-button>
<el-button size="small" @click="selectDate('next-month')">下月</el-button>
</el-button-group>
</el-col>
</el-row>
</template>
</el-calendar>
</el-skeleton>
</el-card>
2024-07-21 05:54:36 +00:00
</el-col>
</el-row>
2024-09-19 05:34:43 +00:00
<Dialog :title="dialogTitle" v-model="dialogVisible" style="width: 85%">
<el-form >
<el-form-item >
2024-10-24 11:29:58 +00:00
<span style="font-size: 20px; font-weight: bold;">{{formData.newsName}}</span>
2024-09-19 05:34:43 +00:00
<el-divider style="border-top: none; margin: 0;"/>
2024-10-24 11:29:58 +00:00
<span style="font-size: 12px">发布时间: {{formatTime(formData.newsCreatetime,'yyyy-MM-dd')}}</span>
2024-09-19 05:34:43 +00:00
<el-divider style="margin-top: 10px"/>
2024-10-24 11:29:58 +00:00
<span style="line-height: 1.2" v-html="formData.newsContent"></span>
2024-09-19 05:34:43 +00:00
</el-form-item>
</el-form>
<template #footer>
<el-button @click="dialogVisible = false"> </el-button>
</template>
</Dialog>
2024-07-21 05:54:36 +00:00
</template>
<script lang="ts" setup>
import { formatTime } from '@/utils'
2024-10-24 02:44:59 +00:00
import type {Todo, Email} from './types'
2024-10-24 01:29:50 +00:00
import {dateFormatter2} from "@/utils/formatTime";
import {DICT_TYPE} from "@/utils/dict";
2024-09-19 05:34:43 +00:00
import {imgApi, imgVO} from "@/api/home/homeimg";
2024-10-24 02:44:59 +00:00
import {CalendarDateType, CalendarInstance} from "element-plus";
2024-10-30 07:11:54 +00:00
const { push } = useRouter()
2024-07-21 05:54:36 +00:00
defineOptions({ name: 'Home' })
2024-09-18 06:09:34 +00:00
const loading = ref(false)
2024-10-24 02:44:59 +00:00
const imgList = ref<imgVO[]>([]) // 列表的数据
2024-09-14 02:04:37 +00:00
const total = ref(0) // 列表的总页数
2024-10-24 02:44:59 +00:00
const pageNo = ref<number>(1)
const calendar = ref<CalendarInstance>()
const selectDate = (val: CalendarDateType) => {
if (!calendar.value) return
calendar.value.selectDate(val)
}
2024-10-24 03:00:10 +00:00
const handleCarouselChange = async (currentIndex:number) => {
pageNo.value=currentIndex+1
}
2024-10-30 07:11:54 +00:00
//利用路由实现跳转
const more = async () => {
await push({name: 'Homeimg'})
}
2024-10-24 02:44:59 +00:00
let tableData = reactive<Email[]>([])
const getTableData = async () => {
const data = [
{
Date:new Date(),
Name:'张三',
Address:'关于会议的审批关于会议的审批关于会议的',
},
{
Date:new Date(),
Name:'李四',
Address:'关于会议的审批关于会议的审批关于会议的',
},
{
Date:new Date(),
Name:'王二',
Address:'关于会议的审批关于会议的审批关于会议的',
},
{
Date:new Date(),
Name:'麻子',
Address:'关于会议的审批关于会议的审批关于会议的',
},
{
Date:new Date(),
Name:'张三',
Address:'关于会议的审批关于会议的审批关于会议的',
},
]
tableData = Object.assign(tableData, data)
}
//获取待办已办信息
let todo = reactive<Todo[]>([])
const getTodo = async () => {
const data = [
{
title: '集团政研会六届五次会员大会在贵州遵义召开',
type: '请假',
content: '',
date: new Date()
},
{
title: '总裁在“国际海运(中国)年会2010”发表主旨演讲',
type: '任务',
content: '',
date: new Date()
},
{
title: '(集团)总公司荣获《企业社会责任蓝皮书(2010)》卓越者企业',
type: '出差',
content: '',
date: new Date()
},
{
title: '总裁在“国际海运(中国)年会2010”发表主旨演讲',
type: '会议',
content: '需要你在某日某月开会',
date: new Date()
},
{
title: '集团政研会六届五次会员大会在贵州遵义召开',
type: '会议',
content: '需要你在某日某月开会',
date: new Date()
},
{
title: '(集团)总公司荣获《企业社会责任蓝皮书(2010)》卓越者企业',
type: '会议',
content: '需要你在某日某月开会',
date: new Date()
}
]
todo = Object.assign(todo, data)
}
2024-09-19 05:34:43 +00:00
const formData = ref({
2024-10-24 11:29:58 +00:00
id: undefined,
newsName: undefined,
newsCreatetime: undefined,
newsImg: [],
newsContent: undefined,
2024-09-19 05:34:43 +00:00
contentType: undefined,
2024-10-24 11:29:58 +00:00
newsStatus: undefined,
status: undefined,
deptId: undefined,
userId: undefined,
2024-09-19 05:34:43 +00:00
})
const dialogVisible = ref(false) // 弹窗的是否展示
const dialogTitle = ref('') // 弹窗的标题
const openDialog = async (type:number,id?:number) => {
dialogVisible.value = true
dialogTitle.value = type===1?'公告':'通知'
resetForm()
if (id) {
formData.value = await imgApi.getimg(id)
}
}
/** 重置表单 */
const resetForm = () => {
2024-10-24 11:29:58 +00:00
formData.value = {
Id: undefined,
newsName: undefined,
newsCreatetime: undefined,
newsImg: undefined,
newsContent: undefined,
contentType: undefined,
newsStatus: undefined,
status: undefined,
deptId: undefined,
userId: undefined,
}
2024-09-19 05:34:43 +00:00
}
const filteredList = computed(() => {
2024-10-24 11:29:58 +00:00
return imgList.value.filter(item => item.newsStatus !== 0 && item.status!==0);
2024-09-19 05:34:43 +00:00
});
2024-10-24 08:06:03 +00:00
// const filteredList2 = computed(() => {
// return imgList.value.filter(item => item.contentStatus !== 0 );
// });
2024-09-19 05:34:43 +00:00
const filteredList2 = computed(() => {
2024-10-24 08:06:03 +00:00
return imgList.value
2024-10-24 11:29:58 +00:00
.filter(item => item.status !== 0)
2024-10-24 08:06:03 +00:00
.slice(0, 3); // 限制只显示前3条
2024-09-19 05:34:43 +00:00
});
2024-10-24 02:44:59 +00:00
const queryParamsImg = reactive({
2024-09-19 05:34:43 +00:00
pageNo: 1,
2024-10-24 11:29:58 +00:00
pageSize: 10,
id: undefined,
newsName: undefined,
newsCreatetime: [],
newsImg: undefined,
newsContent: undefined,
2024-09-19 05:34:43 +00:00
contentType: undefined,
2024-10-24 11:29:58 +00:00
newsStatus: undefined,
status: undefined,
deptId: undefined,
userId: undefined,
2024-09-19 05:34:43 +00:00
createTime: [],
})
const imgUrl = "//images.weserv.nl/?url="
2024-10-24 02:44:59 +00:00
2024-09-14 02:04:37 +00:00
/** 查询列表 */
const getList = async () => {
loading.value = true
try {
2024-10-24 02:44:59 +00:00
const imgData = await imgApi.getimgPage(queryParamsImg)
imgList.value = imgData.list
total.value = imgData.total
2024-09-18 06:09:34 +00:00
2024-09-14 02:04:37 +00:00
} finally {
loading.value = false
}
}
2024-07-21 05:54:36 +00:00
const getAllApi = async () => {
await Promise.all([
2024-10-24 02:44:59 +00:00
getTableData(),
getTodo(),
2024-07-21 05:54:36 +00:00
])
loading.value = false
}
getAllApi()
2024-09-14 02:04:37 +00:00
/** 初始化 **/
onMounted(() => {
getList()
})
2024-07-21 05:54:36 +00:00
</script>
2024-07-22 07:51:58 +00:00
<style scoped>
.el-carousel__item h3 {
opacity: 0.75;
line-height: 200px;
margin: 0;
text-align: center;
}
</style>
2024-09-18 06:09:34 +00:00
<style lang="scss">
.el-table .warning-row {
display: none;
}
</style>
2024-10-24 02:44:59 +00:00
<style>
.SystemThem {
background-color: var(--el-color-primary);
}
.custom-calendar {
height: 310px; /* 根据需要调整高度 */
}
.custom-calendar .el-calendar-table__row {
height: 40px; /* 设置行高度,根据需要调整 */
}
.custom-calendar .el-calendar-day {
height: 100%; /* 设置每个日历单元格的高度为100% */
display: flex; /* 使用 flexbox */
align-items: center; /* 垂直居中 */
justify-content: center; /* 水平居中 */
}
2024-10-24 03:00:10 +00:00
.ellipsis {
display: inline-block; /* 需要是块状元素span默认是行内元素所以使用inline-block */
max-width: 400px; /* 设置最大宽度,超出部分将显示省略号 */
white-space: nowrap; /* 禁止换行 */
overflow: hidden; /* 超出容器的内容隐藏 */
text-overflow: ellipsis; /* 超出的内容以省略号显示 */
}
2024-10-24 02:44:59 +00:00
</style>