444 lines
12 KiB
Vue
Raw Normal View History

2024-03-21 19:30:54 +08:00
<template>
<div>
2024-04-03 18:19:28 +08:00
<div class="fullHeight" v-if="!infoDetailShow">
<div class="searchBtn">
<div
class="search-btn-item"
:class="checkIndex == index ? 'item-active' : ''"
v-for="(item, index) in searchBtnList"
:key="index"
@click="searchSelect(item, index)"
>
{{ item.name }}
</div>
</div>
<div class="searchBox whiteBlock">
<el-form
:inline="true"
ref="searchForm"
:model="searchForm"
size="medium"
style="width: 100%;display: flex;align-items: center;"
>
<el-form-item label="标题内容" prop="title">
<el-input
placeholder="请输入"
clearable
v-model="searchForm.title"
/>
</el-form-item>
<el-form-item label="应用" prop="app">
<!-- suffix-icon="el-icon-search" -->
<el-input
placeholder="请输入"
clearable
v-model="searchForm.app"
/>
</el-form-item>
<el-form-item label="标签" prop="tag">
<el-input
placeholder="请输入"
clearable
v-model="searchForm.tag"
/>
</el-form-item>
<!-- 时间 -->
<el-form-item label="接收时间" style="margin-right: auto;">
<el-date-picker
size="medium"
v-model="timeRange"
type="daterange"
range-separator="至"
value-format="yyyy-MM-dd"
:start-placeholder="'开始日期'"
:end-placeholder="'结束日期'"
>
</el-date-picker>
</el-form-item>
<!-- 条件查询按钮 -->
<el-form-item style="margin-right: 0px;">
<el-button type="primary" plain @click="searchList">查询</el-button>
</el-form-item>
</el-form>
</div>
<div class="info-operate">
<span>消息列表</span>
<el-button type="primary" size="medium" @click="markReadFn">标为已读</el-button>
<el-button type="danger" plain size="medium" @click="deleteInfoFn">删除</el-button>
</div>
<div class="table_wrap whiteBlock">
<el-table class="tables" v-loading="loading" :data="tableData" @selection-change="handleSelectionChange">
<el-table-column type="selection" align="center" width="60" />
<el-table-column label="标题内容" align="center" prop="title">
<template slot-scope="scope">
2024-04-07 17:17:33 +08:00
<span :style="{color: scope.row.isRead == 1?'#BFBFBF':'#5181F7'}" style="cursor: pointer;" @click="infoDetailOpen">{{
2024-04-03 18:19:28 +08:00
scope.row.title
}}</span>
</template>
</el-table-column>
<el-table-column label="类别" align="center" prop="type">
<template slot-scope="scope">
<span>{{ scope.row.type | typeText(searchBtnList) }}</span>
</template>
</el-table-column>
<el-table-column
label="应用"
align="center"
prop="app"
/>
<el-table-column label="标签" align="center" prop="tag" />
<el-table-column label="操作时间" align="center" prop="operateTime" />
</el-table>
<el-pagination
class="pagerBox"
@size-change="SizeChange"
@current-change="CurrentChange"
:current-page="pageInfo.pageNo"
:page-sizes="$store.state.PAGESIZRS"
:page-size="pageInfo.pageSize"
layout="total, sizes, prev, pager, next"
:total="Number(pageInfo.total)"
background
></el-pagination>
2024-03-21 19:30:54 +08:00
</div>
</div>
2024-04-03 18:19:28 +08:00
<div class="info-content" v-else>
<div class="back-operate" @click="infoDetailShow = false">
<i class="el-icon-arrow-left"></i>
<span>返回</span>
</div>
<div class="info-content-detail">
2024-04-07 17:17:33 +08:00
<div class="detail-title">{{rowObj.title}}</div>
2024-04-03 18:19:28 +08:00
<div class="detail-sub-title">
2024-04-07 17:17:33 +08:00
<span>应用{{rowObj.app}}</span>
<span>标签{{rowObj.tag}}</span>
<span>接收时间{{rowObj.operateTime}}</span>
2024-04-03 18:19:28 +08:00
</div>
2024-04-07 17:17:33 +08:00
<div class="detail-content">{{rowObj.content}}</div>
2024-03-21 19:30:54 +08:00
</div>
</div>
</div>
</template>
<script>
2024-04-07 17:17:33 +08:00
import { getInfoListApi, markInfoReadApi, batchDeleteInfoApi } from "@/assets/js/api/loginSign.js";
2024-05-06 15:42:53 +08:00
import { getNoticeListApi } from "@/assets/js/api/company/project";
2024-03-21 19:30:54 +08:00
export default {
data() {
return {
infoDetailShow: false,
checkIndex: 0,
2024-05-06 15:42:53 +08:00
// searchBtnList: [
// { name: "全部类别", value: "" },
// { name: "通知公告", value: 1 },
// { name: "审批流程", value: 3 },
// { name: "风险预警", value: 2 },
// { name: "任务待办", value: 4 },
// { name: "其他", value: 5 },
// ],
2024-03-21 19:30:54 +08:00
searchBtnList: [
{ name: "全部类别", value: "" },
2024-05-06 15:42:53 +08:00
{ name: "质量", value: 11 },
{ name: "安全", value: 10 },
{ name: "AI", value: 8 }
2024-03-21 19:30:54 +08:00
],
devSn: "",
// 遮罩层
loading: false,
daterange: [],
pageInfo: {
pageNo: 1, //页数
pageSize: 10, //条数
total: 1, //总条数
},
searchForm: {
2024-04-03 18:19:28 +08:00
title: "",
app: "",
tag: "",
2024-03-21 19:30:54 +08:00
},
2024-04-03 18:19:28 +08:00
timeRange: [],
tableData: [],
2024-04-07 17:17:33 +08:00
multipleSelection: [],
rowObj: {}
2024-03-21 19:30:54 +08:00
};
},
2024-04-03 18:19:28 +08:00
filters: {
typeText(val, list) {
let findItem = list.find((item) => val === item.value);
return findItem ? findItem.name : "";
},
},
mounted() {},
created() {
this.getList();
},
2024-03-21 19:30:54 +08:00
methods: {
2024-04-03 18:19:28 +08:00
// 删除
deleteInfoFn(){
let selectedIds = [];
if(this.multipleSelection.length == 0){
this.$message({
type: "error",
message: "请勾选表格项",
});
return;
} else {
this.multipleSelection.map(item => {
selectedIds.push(item.id)
})
}
this.$confirm("此操作将删除信息, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
2024-04-07 17:17:33 +08:00
batchDeleteInfoApi({ accountId: this.$store.state.userInfo.userId, ids: selectedIds.join(',') }).then((res) => {
2024-04-03 18:19:28 +08:00
if (res.success) {
this.getList()
this.$message({
type: "success",
message: "操作成功!",
});
} else {
this.$message({
type: "error",
message: res.message,
});
}
});
})
.catch(() => {
this.$message({
type: "info",
message: "已取消操作",
});
});
},
// 标为已读
markReadFn(){
let selectedIds = [];
if(this.multipleSelection.length == 0){
this.$message({
type: "error",
message: "请勾选表格项",
});
return;
} else {
this.multipleSelection.map(item => {
selectedIds.push(item.id)
})
}
this.$confirm("此操作将标记已读, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
markInfoReadApi({ accountId: this.$store.state.userInfo.userId, ids: selectedIds.join(',') }).then((res) => {
if (res.success) {
this.getList()
this.$message({
type: "success",
message: "操作成功!",
});
} else {
this.$message({
type: "error",
message: res.message,
});
}
});
})
.catch(() => {
this.$message({
type: "info",
message: "已取消操作",
});
});
},
handleSelectionChange(val) {
this.multipleSelection = val;
console.log(val,'测试测试')
},
2024-04-07 17:17:33 +08:00
infoDetailOpen(item) {
this.rowObj = item;
2024-03-21 19:30:54 +08:00
this.infoDetailShow = true;
},
searchSelect(obj, index) {
this.checkIndex = index;
2024-04-03 18:19:28 +08:00
this.pageInfo.pageNo = 1;
this.getList();
2024-03-21 19:30:54 +08:00
},
//查询列表
getList() {
2024-04-03 18:19:28 +08:00
let requestData = {
2024-04-07 17:17:33 +08:00
accountId: this.$store.state.userInfo.userId,
2024-03-21 19:30:54 +08:00
pageNo: this.pageInfo.pageNo,
pageSize: this.pageInfo.pageSize,
2024-04-03 18:19:28 +08:00
type: this.searchBtnList[this.checkIndex].value,
2024-04-07 17:17:33 +08:00
isRead: 0,
2024-05-06 15:42:53 +08:00
...this.searchForm,
};
if (this.timeRange && this.timeRange.length > 0) {
requestData.operateTime_begin = this.timeRange[0];
requestData.operateTime_end = this.timeRange[1];
2024-04-03 18:19:28 +08:00
}
2024-05-06 15:42:53 +08:00
getNoticeListApi(requestData).then((res) => {
if (res.success) {
this.tableData = res.result.records;
this.pageInfo.total = res.result.total;
2024-03-21 19:30:54 +08:00
}
});
},
2024-05-06 15:42:53 +08:00
//查询列表
// getList() {
// let requestData = {
// accountId: this.$store.state.userInfo.userId,
// pageNo: this.pageInfo.pageNo,
// pageSize: this.pageInfo.pageSize,
// type: this.searchBtnList[this.checkIndex].value,
// isRead: 0,
// ...this.searchForm
// }
// if(this.timeRange && this.timeRange.length > 0){
// requestData.operateTime_begin = this.timeRange[0]
// requestData.operateTime_end = this.timeRange[1]
// }
// getInfoListApi(requestData).then((result) => {
// if (result.success) {
// this.tableData = result.result.records;
// this.pageInfo.total = result.result.total;
// }
// });
// },
2024-03-21 19:30:54 +08:00
SizeChange(val) {
this.pageInfo.pageSize = val;
this.getList();
},
CurrentChange(val) {
this.pageInfo.pageNo = val;
this.getList();
},
searchList() {
this.pageInfo.pageNo = 1; //页数
this.getList();
},
refresh() {
2024-04-03 18:19:28 +08:00
this.searchForm = {
title: "",
app: "",
tag: "",
};
2024-03-21 19:30:54 +08:00
this.pageInfo.pageNo = 1; //页数
this.pageInfo.pageSize = 10; //条数
this.getList();
},
//选择条数
handleSizeChange(val) {
this.pageSize2 = val;
this.getPageList();
},
//选择分页
handleCurrentChange(val) {
this.pageNo2 = val;
this.getPageList();
2024-04-03 18:19:28 +08:00
}
2024-03-21 19:30:54 +08:00
},
};
</script>
<style lang="less" scoped>
.tables {
min-height: 0;
}
.searchBox {
height: 50px;
margin-bottom: 0px;
margin-top: 10px;
}
.searchBtn {
display: flex;
align-items: center;
margin-top: 15px;
margin-left: 25px;
.search-btn-item {
width: 65px;
padding: 5px 1px;
text-align: center;
border: 1px solid #638ef7;
border-radius: 3px;
font-size: 14px;
color: #638ef7;
cursor: pointer;
}
.item-active {
background-color: #5181f6;
color: white;
}
.search-btn-item:not(:last-child) {
margin-right: 10px;
}
}
.info-operate {
display: flex;
align-items: center;
margin: 0px 25px 10px 25px;
> span:nth-child(1) {
margin-right: auto;
font-family: PingFang SC, PingFang SC;
font-weight: 500;
color: #000000;
}
}
2024-04-03 18:19:28 +08:00
.info-content {
.back-operate {
2024-03-21 19:30:54 +08:00
display: flex;
align-items: center;
2024-04-03 18:19:28 +08:00
color: #5282f6;
2024-03-21 19:30:54 +08:00
height: 40px;
2024-04-03 18:19:28 +08:00
border-bottom: 2px solid #c8c8c8;
2024-03-21 19:30:54 +08:00
padding-bottom: 5px;
cursor: pointer;
2024-04-03 18:19:28 +08:00
.el-icon-arrow-left {
color: #5282f6;
2024-03-21 19:30:54 +08:00
margin-left: 15px;
}
2024-04-03 18:19:28 +08:00
> span {
2024-03-21 19:30:54 +08:00
margin-left: 5px;
}
}
2024-04-03 18:19:28 +08:00
.info-content-detail {
2024-03-21 19:30:54 +08:00
margin-top: 80px;
2024-04-03 18:19:28 +08:00
.detail-title {
2024-03-21 19:30:54 +08:00
font-family: PingFang SC, PingFang SC;
color: #000000;
font-size: 18px;
text-align: center;
}
2024-04-03 18:19:28 +08:00
.detail-sub-title {
2024-03-21 19:30:54 +08:00
display: flex;
align-items: center;
justify-content: center;
font-family: PingFang SC, PingFang SC;
color: #000000;
font-size: 16px;
margin-top: 30px;
margin-bottom: 30px;
2024-04-03 18:19:28 +08:00
span:not(:last-child) {
2024-03-21 19:30:54 +08:00
margin-right: 25px;
}
}
2024-04-03 18:19:28 +08:00
.detail-content {
2024-03-21 19:30:54 +08:00
font-family: PingFang SC, PingFang SC;
color: #000000;
font-size: 14px;
2024-04-07 17:17:33 +08:00
margin: 0 25px 15px 25px;
2024-03-21 19:30:54 +08:00
}
}
}
2024-04-07 17:17:33 +08:00
.table_wrap{
.pagerBox{
margin-top: 30px;
}
}
2024-03-21 19:30:54 +08:00
</style>