xttzview.vue
3.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<template>
<div class="from-clues">
<!-- 表单部分 -->
<div class="from-clues-header">
<el-form :model="ruleForm" @submit.native.prevent label-width="80px">
<el-row>
<el-col :span="5">
<el-form-item label="通知标题">
<el-input v-model="ruleForm.noticeTitle" @clear="queryClick()" clearable placeholder="通知标题"></el-input>
</el-form-item>
</el-col>
<el-col :span="19" class="btnColRight">
<el-form-item>
<el-button type="primary" @click="handleSearch">查询</el-button>
<el-button type="primary" native-type="submit" @click="toReadAll()">一键已读</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
<!-- 表格 -->
<div class="from-clues-content">
<lb-table :page-size="pageData.size" border :current-page.sync="pageData.current" :total="tableData.total"
@size-change="handleSizeChange" @p-current-change="handleCurrentChange" :column="tableData.columns"
:data="tableData.data">
</lb-table>
</div>
<addDialog ref="addDialog" v-model="isDialog" :isButtonFlag="isButtonFlag" :title="dialogTitle" />
</div>
</template>
<script>
import table from "@/utils/mixin/table";
import { datas, sendThis } from "./xttzviewdata";
import { getSysNoticeList, setReadStatus, setAllRead } from "@/api/sysNotice.js"
import addDialog from "./components/addDialog.vue";
export default {
name: "xttzview",
components: { addDialog },
mixins: [table],
mounted () {
sendThis(this);
this.queryClick()
},
data () {
return {
isDialog: false,
isButtonFlag: true,
dialogTitle: '',
ruleForm: {
noticeTitle: '',
noticeStatus: '2'
},
tableData: {
total: 0,
columns: datas.columns(),
data: [],
},
isDiglog: false
}
},
methods: {
// 列表渲染接口
queryClick () {
this.$startLoading()
getSysNoticeList({ ...this.ruleForm, ...this.pageData }, { 'target': '#xttzLoading' }).then(res => {
if (res.code === 200) {
this.$endLoading()
let { total, records } = res.result
this.tableData.total = total;
this.tableData.data = records
}
})
},
//打开新增弹窗
openDialog (item) {
this.$nextTick(() => {
this.isButtonFlag = false;
this.$refs.addDialog.getDetailInfo(item);
this.dialogTitle = '系统通知详情'
this.isDialog = true;
})
let that = this;
if (item.isRead == 1) {
setReadStatus({ bsmNotice: item.bsmNotice }).then(res => {
if (res.code == 200) {
that.$nextTick(() => {
item.isRead = 2
})
}
})
}
},
//一键已读
toReadAll () {
setAllRead().then(res => {
if (res.code == 200) {
this.$message.success('设置成功')
this.queryClick();
} else {
this.$message.error("设置失败")
}
})
},
downloadFile (item) {
const href = item.noticeFileUrl
window.open(href, '_blank');
}
},
};
</script>
<style scoped lang="scss">
@import "~@/styles/public.scss";
</style>