change - add车间查看历史通知

master
yinq 4 months ago
parent 001b6e7e33
commit 3dc2c71515

@ -98,10 +98,11 @@ public class SysNoticeController extends BaseController
* @return
*/
@GetMapping("/workshopNoticeList")
public AjaxResult workshopNoticeList(SysNotice notice)
public TableDataInfo workshopNoticeList(SysNotice notice)
{
startPage();
List<SysNotice> list = noticeService.workshopNoticeList(notice);
return success(list);
return getDataTable(list);
}
/**

@ -76,7 +76,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="userId != null">
AND b.user_id = #{userId}
</if>
<if test="userId != null">
<if test="checkStatus != null and checkStatus != ''">
AND b.check_status = #{checkStatus}
</if>
</where>

@ -1,42 +1,99 @@
<template>
<el-dialog :visible.sync="visible" title="通知" width="50%">
<el-form ref="form" :model="noticeListData" label-width="100px">
<el-row>
<el-col :span="12">
<el-form-item label="公告标题:" prop="noticeTitle">
<span>{{ noticeListData.noticeTitle }}</span>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="公告类型" prop="noticeType">
<el-select v-model="noticeListData.noticeType" placeholder="请选择公告类型" disabled>
<el-option
v-for="dict in dict.type.sys_notice_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="内容">
<ReadOnlyEditor v-model="noticeListData.noticeContent" :min-height="192"/>
<DownloadFile v-model="noticeListData.attachPath" @file-clicked="handleFileClick"/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<span slot="footer" class="dialog-footer">
<div class="navbar">
<div class="right-menu">
<el-tooltip content="历史通知" class="right-menu-item hover-effect">
<span
class="exceptionHandling"
@click="getNoticeData(true)"
><i class="el-icon-message"></i>
</span>
</el-tooltip>
</div>
<el-dialog :visible.sync="visible" title="通知" width="50%">
<el-form ref="form" :model="noticeListData" label-width="100px">
<el-row>
<el-col :span="12">
<el-form-item label="公告标题:" prop="noticeTitle">
<span>{{ noticeListData.noticeTitle }}</span>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="公告类型" prop="noticeType">
<el-select v-model="noticeListData.noticeType" placeholder="请选择公告类型" disabled>
<el-option
v-for="dict in dict.type.sys_notice_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="内容">
<ReadOnlyEditor v-model="noticeListData.noticeContent" :min-height="192"/>
<DownloadFile v-model="noticeListData.attachPath" @file-clicked="handleFileClick"/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">关闭</el-button>
</span>
</el-dialog>
</el-dialog>
<el-dialog :visible.sync="noticeOpen" title="历史通知记录" width="50" append-to-body>
<el-table v-loading="noticeLoading" :data="historyNoticeList" >
<el-table-column label="序号" align="center" prop="noticeId" width="100" />
<el-table-column
label="公告标题"
align="center"
prop="noticeTitle"
:show-overflow-tooltip="true"
/>
<el-table-column label="公告类型" align="center" prop="noticeType" width="100">
<template slot-scope="scope">
<dict-tag :options="dict.type.sys_notice_type" :value="scope.row.noticeType"/>
</template>
</el-table-column>
<el-table-column label="状态" align="center" prop="status" width="100">
<template slot-scope="scope">
<dict-tag :options="dict.type.sys_notice_status" :value="scope.row.status"/>
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
@click="viewContent(scope.row)"
>查看内容</el-button>
</template>
</el-table-column>
</el-table>
<span slot="footer" class="dialog-footer">
<el-button @click="noticeOpen = false">关闭</el-button>
</span>
<pagination
v-show="noticeTotal>0"
:total="noticeTotal"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getHistoryNoticeList"
/>
</el-dialog>
</div>
</template>
<script>
import ReadOnlyEditor from "@/components/ReadOnlyEditor/index.vue";
import DownloadFile from "@/components/DownloadFile/index.vue";
import {updateUserNotice} from "@/api/system/notice";
import {updateUserNotice, workshopNoticeList} from "@/api/system/notice";
import {parseTime} from "@/utils/ruoyi";
export default {
@ -55,6 +112,26 @@ export default {
default: () => [],
},
},
data() {
return {
noticeOpen: false,
noticeLoading: false,
historyNoticeList: [],
noticeTotal: 0,
//
routerIds: [],
//
single: true,
//
multiple: true,
//
queryParams: {
pageNum: 1,
pageSize: 10,
noticeType: '1'
},
};
},
methods: {
handleFileClick(fileUrl) {
console.log('已下载文件:', fileUrl);
@ -64,7 +141,89 @@ export default {
userNotice.checkTime = null;
updateUserNotice(userNotice).then(res => {
})
},
/** 报警列表 */
getNoticeData(open) {
this.noticeOpen = open;
this.noticeLoading = true;
this.getHistoryNoticeList();
},
getHistoryNoticeList() {
workshopNoticeList(this.queryParams).then((response) => {
this.historyNoticeList = response.rows;
this.noticeTotal = response.total;
this.noticeLoading = false;
});
},
viewContent(row){
this.noticeListData = row;
this.visible = true;
}
}
};
</script>
<style lang="scss" scoped>
.right-menu {
float: right;
height: 100%;
line-height: 50px;
&:focus {
outline: none;
}
.right-menu-item {
.right-menu {
float: right;
height: 100%;
line-height: 50px;
&:focus {
outline: none;
}
.right-menu-item {
display: inline-block;
padding: 0 8px;
height: 100%;
font-size: 18px;
color: #5a5e66;
vertical-align: text-bottom;
&.hover-effect {
cursor: pointer;
transition: background .3s;
&:hover {
background: rgba(0, 0, 0, .025)
}
}
}
.avatar-container {
margin-right: 30px;
.avatar-wrapper {
margin-top: 5px;
position: relative;
.user-avatar {
cursor: pointer;
width: 40px;
height: 40px;
border-radius: 10px;
}
.el-icon-caret-bottom {
cursor: pointer;
position: absolute;
right: -20px;
top: 25px;
font-size: 12px;
}
}
}
}
}
}
</style>

@ -13,9 +13,15 @@ export const noticeData = {
};
},
mounted() {
setInterval(() => {
setInterval(() => this.workshopNoticeTasks(), 5000 * 1000)
},
methods: {
workshopNoticeTasks() {
if (this.notificationInstance) {
this.notificationInstance.close(); // 手动关闭通知
}
workshopNoticeList({noticeType: '1', checkStatus: '0'}).then(res => {
this.noticeList = res.data;
this.noticeList = res.rows;
if (this.noticeList.length > 0) {
this.notificationInstance = this.$notify.info({
title: '通知',
@ -35,9 +41,9 @@ export const noticeData = {
});
}
});
}, 60 * 1000)
},
methods: {
},
//点击查看弹窗逻辑
handleNotificationClick() {
this.noticeListData = this.noticeList[0];
let userNotice = this.noticeListData.sysUserNoticeList[0];
@ -51,7 +57,7 @@ export const noticeData = {
this.notificationInstance.close(); // 手动关闭通知
}
},
}
},
};

Loading…
Cancel
Save