change - add车间查看历史通知

master
yinq 4 months ago
parent 001b6e7e33
commit 3dc2c71515

@ -98,10 +98,11 @@ public class SysNoticeController extends BaseController
* @return * @return
*/ */
@GetMapping("/workshopNoticeList") @GetMapping("/workshopNoticeList")
public AjaxResult workshopNoticeList(SysNotice notice) public TableDataInfo workshopNoticeList(SysNotice notice)
{ {
startPage();
List<SysNotice> list = noticeService.workshopNoticeList(notice); 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"> <if test="userId != null">
AND b.user_id = #{userId} AND b.user_id = #{userId}
</if> </if>
<if test="userId != null"> <if test="checkStatus != null and checkStatus != ''">
AND b.check_status = #{checkStatus} AND b.check_status = #{checkStatus}
</if> </if>
</where> </where>

@ -1,42 +1,99 @@
<template> <template>
<el-dialog :visible.sync="visible" title="通知" width="50%"> <div class="navbar">
<el-form ref="form" :model="noticeListData" label-width="100px"> <div class="right-menu">
<el-row> <el-tooltip content="历史通知" class="right-menu-item hover-effect">
<el-col :span="12"> <span
<el-form-item label="公告标题:" prop="noticeTitle"> class="exceptionHandling"
<span>{{ noticeListData.noticeTitle }}</span> @click="getNoticeData(true)"
</el-form-item> ><i class="el-icon-message"></i>
</el-col> </span>
<el-col :span="12"> </el-tooltip>
<el-form-item label="公告类型" prop="noticeType"> </div>
<el-select v-model="noticeListData.noticeType" placeholder="请选择公告类型" disabled> <el-dialog :visible.sync="visible" title="通知" width="50%">
<el-option <el-form ref="form" :model="noticeListData" label-width="100px">
v-for="dict in dict.type.sys_notice_type" <el-row>
:key="dict.value" <el-col :span="12">
:label="dict.label" <el-form-item label="公告标题:" prop="noticeTitle">
:value="dict.value" <span>{{ noticeListData.noticeTitle }}</span>
></el-option> </el-form-item>
</el-select> </el-col>
</el-form-item> <el-col :span="12">
</el-col> <el-form-item label="公告类型" prop="noticeType">
<el-col :span="24"> <el-select v-model="noticeListData.noticeType" placeholder="请选择公告类型" disabled>
<el-form-item label="内容"> <el-option
<ReadOnlyEditor v-model="noticeListData.noticeContent" :min-height="192"/> v-for="dict in dict.type.sys_notice_type"
<DownloadFile v-model="noticeListData.attachPath" @file-clicked="handleFileClick"/> :key="dict.value"
</el-form-item> :label="dict.label"
</el-col> :value="dict.value"
</el-row> ></el-option>
</el-form> </el-select>
<span slot="footer" class="dialog-footer"> </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> <el-button @click="visible = false">关闭</el-button>
</span> </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> </template>
<script> <script>
import ReadOnlyEditor from "@/components/ReadOnlyEditor/index.vue"; import ReadOnlyEditor from "@/components/ReadOnlyEditor/index.vue";
import DownloadFile from "@/components/DownloadFile/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"; import {parseTime} from "@/utils/ruoyi";
export default { export default {
@ -55,6 +112,26 @@ export default {
default: () => [], default: () => [],
}, },
}, },
data() {
return {
noticeOpen: false,
noticeLoading: false,
historyNoticeList: [],
noticeTotal: 0,
//
routerIds: [],
//
single: true,
//
multiple: true,
//
queryParams: {
pageNum: 1,
pageSize: 10,
noticeType: '1'
},
};
},
methods: { methods: {
handleFileClick(fileUrl) { handleFileClick(fileUrl) {
console.log('已下载文件:', fileUrl); console.log('已下载文件:', fileUrl);
@ -64,7 +141,89 @@ export default {
userNotice.checkTime = null; userNotice.checkTime = null;
updateUserNotice(userNotice).then(res => { 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> </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() { mounted() {
setInterval(() => { setInterval(() => this.workshopNoticeTasks(), 5000 * 1000)
},
methods: {
workshopNoticeTasks() {
if (this.notificationInstance) {
this.notificationInstance.close(); // 手动关闭通知
}
workshopNoticeList({noticeType: '1', checkStatus: '0'}).then(res => { workshopNoticeList({noticeType: '1', checkStatus: '0'}).then(res => {
this.noticeList = res.data; this.noticeList = res.rows;
if (this.noticeList.length > 0) { if (this.noticeList.length > 0) {
this.notificationInstance = this.$notify.info({ this.notificationInstance = this.$notify.info({
title: '通知', title: '通知',
@ -35,9 +41,9 @@ export const noticeData = {
}); });
} }
}); });
}, 60 * 1000) },
},
methods: { //点击查看弹窗逻辑
handleNotificationClick() { handleNotificationClick() {
this.noticeListData = this.noticeList[0]; this.noticeListData = this.noticeList[0];
let userNotice = this.noticeListData.sysUserNoticeList[0]; let userNotice = this.noticeListData.sysUserNoticeList[0];
@ -51,7 +57,7 @@ export const noticeData = {
this.notificationInstance.close(); // 手动关闭通知 this.notificationInstance.close(); // 手动关闭通知
} }
}, },
} },
}; };

Loading…
Cancel
Save