2022-06-08 14:51:11 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<div class="fullHeight pages">
|
2023-03-14 18:26:52 +08:00
|
|
|
|
<!-- :showR="true" -->
|
2022-06-08 14:51:11 +08:00
|
|
|
|
<vhead :titleName="'消息中心'"></vhead>
|
|
|
|
|
|
<div class="pageContainer">
|
|
|
|
|
|
<div class="pageDataContainer">
|
|
|
|
|
|
<div class="searchBox whiteBlock">
|
|
|
|
|
|
<el-form
|
|
|
|
|
|
:inline="true"
|
|
|
|
|
|
size="medium"
|
|
|
|
|
|
:model="searchForm"
|
|
|
|
|
|
ref="searchForm"
|
|
|
|
|
|
>
|
2023-03-14 18:26:52 +08:00
|
|
|
|
<el-form-item :label="'标题'" prop="title" class="last">
|
2022-06-08 14:51:11 +08:00
|
|
|
|
<el-input
|
|
|
|
|
|
v-model="searchForm.title"
|
|
|
|
|
|
:placeholder="
|
|
|
|
|
|
$t('message.docManage.dialog_file_renaming.placeholder')
|
|
|
|
|
|
"
|
|
|
|
|
|
clearable
|
|
|
|
|
|
></el-input>
|
|
|
|
|
|
</el-form-item>
|
2023-03-14 18:26:52 +08:00
|
|
|
|
<el-form-item :label="'消息类型'" prop="title" class="last">
|
2022-06-08 14:51:11 +08:00
|
|
|
|
<el-select v-model="searchForm.type" placeholder="请选择">
|
2023-03-14 18:26:52 +08:00
|
|
|
|
<el-option label="全部" value=""> </el-option>
|
2022-06-08 14:51:11 +08:00
|
|
|
|
<el-option
|
|
|
|
|
|
v-for="item in options"
|
|
|
|
|
|
:key="item.value"
|
|
|
|
|
|
:label="item.label"
|
2023-03-14 18:26:52 +08:00
|
|
|
|
:value="item.value"
|
|
|
|
|
|
>
|
2022-06-08 14:51:11 +08:00
|
|
|
|
</el-option>
|
|
|
|
|
|
</el-select>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item>
|
|
|
|
|
|
<el-date-picker
|
2023-03-14 18:26:52 +08:00
|
|
|
|
v-model="timeData"
|
|
|
|
|
|
type="daterange"
|
|
|
|
|
|
value-format="yyyy-MM-dd"
|
|
|
|
|
|
range-separator="至"
|
|
|
|
|
|
start-placeholder="开始日期"
|
|
|
|
|
|
end-placeholder="结束日期"
|
|
|
|
|
|
>
|
2022-06-08 14:51:11 +08:00
|
|
|
|
</el-date-picker>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item>
|
|
|
|
|
|
<el-button type="primary" plain @click="getListData">{{
|
2023-03-14 18:26:52 +08:00
|
|
|
|
$t('message.docManage.query')
|
2022-06-08 14:51:11 +08:00
|
|
|
|
}}</el-button>
|
|
|
|
|
|
<el-button type="warning" plain @click="resetForm">{{
|
2023-03-14 18:26:52 +08:00
|
|
|
|
$t('message.docManage.refresh')
|
2022-06-08 14:51:11 +08:00
|
|
|
|
}}</el-button>
|
2023-03-14 18:26:52 +08:00
|
|
|
|
<el-button type="danger" plain @click="clearAllFn"
|
|
|
|
|
|
>一键清空消息</el-button
|
|
|
|
|
|
>
|
2022-06-08 14:51:11 +08:00
|
|
|
|
</el-form-item>
|
|
|
|
|
|
</el-form>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<el-row :gutter="25">
|
|
|
|
|
|
<el-col :span="6" v-for="(item, index) in tableData" :key="index">
|
|
|
|
|
|
<div class="whiteBlock fileContent">
|
2023-03-14 18:26:52 +08:00
|
|
|
|
<img
|
|
|
|
|
|
class="imgs"
|
|
|
|
|
|
v-if="item.imageUrl"
|
|
|
|
|
|
:src="item.imageUrl"
|
|
|
|
|
|
:preview="item.imageUrl"
|
|
|
|
|
|
/>
|
2022-06-08 14:51:11 +08:00
|
|
|
|
<div class="msgBox">
|
2023-03-14 18:26:52 +08:00
|
|
|
|
<p class="title">标题:{{ item.title }}</p>
|
2022-06-08 14:51:11 +08:00
|
|
|
|
<p class="content">内容:{{ item.msg }}</p>
|
2023-03-14 18:26:52 +08:00
|
|
|
|
<p class="time">发送时间:{{ item.sendTime }}</p>
|
2022-06-08 14:51:11 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<!-- <div class="right">
|
|
|
|
|
|
<img src="@/assets/images/eye.png" @click="viewFn(item)" />
|
|
|
|
|
|
<img src="@/assets/images/download.png" @click="downFn(item)" />
|
|
|
|
|
|
</div> -->
|
|
|
|
|
|
<i class="el-icon-close" @click="deleteNotice(item)"></i>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
</el-row>
|
2023-03-14 18:26:52 +08:00
|
|
|
|
<div class="placeholderBox" v-show="tableData.length == 0">
|
|
|
|
|
|
<img src="@/assets/images/noData.png" />
|
|
|
|
|
|
<p>暂无消息</p>
|
2022-06-08 14:51:11 +08:00
|
|
|
|
</div>
|
2023-03-14 18:26:52 +08:00
|
|
|
|
<el-pagination
|
|
|
|
|
|
v-show="tableData.length > 0"
|
2022-06-08 14:51:11 +08:00
|
|
|
|
class="pagerBox"
|
|
|
|
|
|
@size-change="handleSizeChange"
|
|
|
|
|
|
@current-change="handleCurrentChange"
|
|
|
|
|
|
:current-page="pageNo"
|
|
|
|
|
|
:page-sizes="[20, 30, 50]"
|
|
|
|
|
|
:page-size="pageSize"
|
|
|
|
|
|
layout="total, sizes, prev, pager, next"
|
2023-03-14 18:26:52 +08:00
|
|
|
|
:total="Number(total)"
|
2022-06-08 14:51:11 +08:00
|
|
|
|
background
|
|
|
|
|
|
></el-pagination>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<script>
|
2023-03-14 18:26:52 +08:00
|
|
|
|
import {
|
|
|
|
|
|
getNoticeListApi,
|
|
|
|
|
|
cleanAllNoticeApi,
|
|
|
|
|
|
deleteNoticeApi
|
|
|
|
|
|
} from '@/assets/js/api/company/project'
|
|
|
|
|
|
import vhead from '@/components/header'
|
2022-06-08 14:51:11 +08:00
|
|
|
|
export default {
|
|
|
|
|
|
components: { vhead },
|
|
|
|
|
|
data() {
|
|
|
|
|
|
return {
|
|
|
|
|
|
searchForm: {
|
2023-03-14 18:26:52 +08:00
|
|
|
|
title: '',
|
|
|
|
|
|
type: ''
|
2022-06-08 14:51:11 +08:00
|
|
|
|
},
|
2023-03-14 18:26:52 +08:00
|
|
|
|
timeData: '',
|
2022-06-08 14:51:11 +08:00
|
|
|
|
total: 0,
|
|
|
|
|
|
pageNo: 1,
|
|
|
|
|
|
pageSize: 20,
|
|
|
|
|
|
tableData: [],
|
2023-03-14 18:26:52 +08:00
|
|
|
|
options: [
|
|
|
|
|
|
{
|
|
|
|
|
|
label: '高空火警',
|
|
|
|
|
|
value: '8'
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
label: '考勤提醒',
|
|
|
|
|
|
value: '1'
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
label: '防疫人员通知',
|
|
|
|
|
|
value: '2'
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
label: '防疫车辆通知',
|
|
|
|
|
|
value: '3'
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
label: '访客通知',
|
|
|
|
|
|
value: '16'
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
label: '混凝土监测',
|
|
|
|
|
|
value: '4'
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
label: '卸料平台',
|
|
|
|
|
|
value: '5'
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
label: '配电箱',
|
|
|
|
|
|
value: '6'
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
label: '扬尘',
|
|
|
|
|
|
value: '7'
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
label: '标养室',
|
|
|
|
|
|
value: '9'
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
label: '安全检查',
|
|
|
|
|
|
value: '10'
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
label: '质量检查',
|
|
|
|
|
|
value: '11'
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
label: '塔吊',
|
|
|
|
|
|
value: '12'
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
label: '升降机',
|
|
|
|
|
|
value: '13'
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
label: '电表',
|
|
|
|
|
|
value: '14'
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
label: '水表',
|
|
|
|
|
|
value: '15'
|
|
|
|
|
|
}
|
|
|
|
|
|
]
|
|
|
|
|
|
}
|
2022-06-08 14:51:11 +08:00
|
|
|
|
},
|
|
|
|
|
|
created() {
|
2023-03-14 18:26:52 +08:00
|
|
|
|
document.title = '消息中心'
|
2022-06-08 14:51:11 +08:00
|
|
|
|
this.selectNowDate()
|
2023-03-14 18:26:52 +08:00
|
|
|
|
this.getListData()
|
2022-06-08 14:51:11 +08:00
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
// 获取当前时间 返回YYYY-MM-DD HH:mm:ss
|
2023-03-14 18:26:52 +08:00
|
|
|
|
selectNowDate() {
|
|
|
|
|
|
var date = new Date(),
|
|
|
|
|
|
year = date.getFullYear(),
|
|
|
|
|
|
month = date.getMonth() + 1,
|
|
|
|
|
|
day = date.getDate(),
|
|
|
|
|
|
hours = date.getHours(), //获取当前小时数(0-23)
|
|
|
|
|
|
minutes = date.getMinutes(), //获取当前分钟数(0-59)
|
|
|
|
|
|
seconds = date.getSeconds()
|
|
|
|
|
|
month >= 1 && month <= 9 ? (month = '0' + month) : ''
|
|
|
|
|
|
day >= 0 && day <= 9 ? (day = '0' + day) : ''
|
|
|
|
|
|
hours >= 0 && hours <= 9 ? (hours = '0' + hours) : ''
|
|
|
|
|
|
minutes >= 0 && minutes <= 9 ? (minutes = '0' + minutes) : ''
|
|
|
|
|
|
seconds >= 0 && seconds <= 9 ? (seconds = '0' + seconds) : ''
|
|
|
|
|
|
// var timer = year + '-' + month + '-' + day + ' ' + hours + ':' + minutes+ ':' + seconds;
|
|
|
|
|
|
var timer = year + '-' + month + '-' + day
|
|
|
|
|
|
this.timeData = [timer, timer]
|
|
|
|
|
|
console.log(timer)
|
|
|
|
|
|
// return timer;
|
|
|
|
|
|
},
|
|
|
|
|
|
deleteNotice(val) {
|
2022-06-08 14:51:11 +08:00
|
|
|
|
console.log(val)
|
|
|
|
|
|
this.$confirm('此操作将永久删除该消息, 是否继续?', '提示', {
|
2023-03-14 18:26:52 +08:00
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
|
|
cancelButtonText: '取消',
|
|
|
|
|
|
type: 'warning'
|
|
|
|
|
|
})
|
|
|
|
|
|
.then(() => {
|
|
|
|
|
|
deleteNoticeApi({ id: val.id }).then((res) => {
|
|
|
|
|
|
if (res.code == 200) {
|
|
|
|
|
|
this.$message({
|
|
|
|
|
|
type: 'success',
|
|
|
|
|
|
message: '删除成功!'
|
|
|
|
|
|
})
|
|
|
|
|
|
this.getListData()
|
|
|
|
|
|
}
|
2022-06-08 14:51:11 +08:00
|
|
|
|
})
|
2023-03-14 18:26:52 +08:00
|
|
|
|
})
|
|
|
|
|
|
.catch(() => {
|
2022-06-08 14:51:11 +08:00
|
|
|
|
this.$message({
|
|
|
|
|
|
type: 'info',
|
|
|
|
|
|
message: '已取消删除'
|
2023-03-14 18:26:52 +08:00
|
|
|
|
})
|
|
|
|
|
|
})
|
2022-06-08 14:51:11 +08:00
|
|
|
|
},
|
2023-03-14 18:26:52 +08:00
|
|
|
|
clearAllFn() {
|
|
|
|
|
|
cleanAllNoticeApi({ userId: this.$store.state.userInfo.userId }).then(
|
|
|
|
|
|
(res) => {
|
|
|
|
|
|
this.$message.success(res.message)
|
|
|
|
|
|
this.getListData()
|
|
|
|
|
|
}
|
|
|
|
|
|
)
|
2022-06-08 14:51:11 +08:00
|
|
|
|
},
|
|
|
|
|
|
//获取列表数据
|
|
|
|
|
|
getListData() {
|
2023-03-14 18:26:52 +08:00
|
|
|
|
let data = this.searchForm
|
|
|
|
|
|
if (this.timeData) {
|
2022-06-08 14:51:11 +08:00
|
|
|
|
data.startTime = this.timeData[0]
|
|
|
|
|
|
data.endTime = this.timeData[1]
|
2023-03-14 18:26:52 +08:00
|
|
|
|
} else {
|
2022-06-08 14:51:11 +08:00
|
|
|
|
data.startTime = ''
|
|
|
|
|
|
data.endTime = ''
|
|
|
|
|
|
}
|
2023-03-14 18:26:52 +08:00
|
|
|
|
data.pageNo = this.pageNo
|
|
|
|
|
|
data.pageSize = this.pageSize
|
|
|
|
|
|
data.accountId = this.$store.state.userInfo.userId
|
2022-06-08 14:51:11 +08:00
|
|
|
|
getNoticeListApi(data).then((res) => {
|
2023-03-14 18:26:52 +08:00
|
|
|
|
console.log(res)
|
|
|
|
|
|
this.tableData = res.result.records
|
|
|
|
|
|
this.total = res.result.total
|
|
|
|
|
|
})
|
2022-06-08 14:51:11 +08:00
|
|
|
|
},
|
2023-03-14 18:26:52 +08:00
|
|
|
|
viewFn(item) {},
|
2022-06-08 14:51:11 +08:00
|
|
|
|
resetForm() {
|
2023-03-14 18:26:52 +08:00
|
|
|
|
this.$refs['searchForm'].resetFields()
|
|
|
|
|
|
this.getListData()
|
2022-06-08 14:51:11 +08:00
|
|
|
|
},
|
|
|
|
|
|
//查看条数
|
|
|
|
|
|
handleSizeChange(val) {
|
2023-03-14 18:26:52 +08:00
|
|
|
|
this.pageSize = val
|
|
|
|
|
|
this.getListData()
|
2022-06-08 14:51:11 +08:00
|
|
|
|
},
|
|
|
|
|
|
//查看页
|
|
|
|
|
|
handleCurrentChange(val) {
|
2023-03-14 18:26:52 +08:00
|
|
|
|
this.pageNo = val
|
|
|
|
|
|
this.getListData()
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2022-06-08 14:51:11 +08:00
|
|
|
|
</script>
|
|
|
|
|
|
<style lang="less" scoped>
|
|
|
|
|
|
.fileContent {
|
|
|
|
|
|
border-radius: 3px;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
height: 100px;
|
|
|
|
|
|
padding: 0 20px;
|
|
|
|
|
|
margin-bottom: 20px;
|
|
|
|
|
|
position: relative;
|
2023-03-14 18:26:52 +08:00
|
|
|
|
.el-icon-close {
|
2022-06-08 14:51:11 +08:00
|
|
|
|
position: absolute;
|
|
|
|
|
|
right: 10px;
|
|
|
|
|
|
top: 6px;
|
2023-03-14 18:26:52 +08:00
|
|
|
|
color: #f56c6c;
|
2022-06-08 14:51:11 +08:00
|
|
|
|
font-size: 18px;
|
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
}
|
2023-03-14 18:26:52 +08:00
|
|
|
|
// justify-content: space-between;
|
|
|
|
|
|
// .right {
|
|
|
|
|
|
// display: flex;
|
|
|
|
|
|
// align-items: center;
|
|
|
|
|
|
// img {
|
|
|
|
|
|
// margin-left: 18px;
|
|
|
|
|
|
// cursor: pointer;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
.imgs {
|
2022-06-08 14:51:11 +08:00
|
|
|
|
width: 60px;
|
|
|
|
|
|
height: 60px;
|
|
|
|
|
|
margin-right: 10px;
|
2023-03-14 18:26:52 +08:00
|
|
|
|
}
|
|
|
|
|
|
.msgBox {
|
|
|
|
|
|
.title {
|
|
|
|
|
|
font-size: 15px;
|
|
|
|
|
|
}
|
|
|
|
|
|
.content {
|
|
|
|
|
|
font-size: 13px;
|
|
|
|
|
|
opacity: 0.8;
|
|
|
|
|
|
margin-top: 3px;
|
2022-06-08 14:51:11 +08:00
|
|
|
|
}
|
2023-03-14 18:26:52 +08:00
|
|
|
|
.time {
|
|
|
|
|
|
font-size: 13px;
|
|
|
|
|
|
opacity: 0.6;
|
|
|
|
|
|
margin-top: 3px;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2022-06-08 14:51:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.pageContainer {
|
|
|
|
|
|
height: calc(100% - 61px);
|
|
|
|
|
|
}
|
|
|
|
|
|
</style>
|