xttz.vue
5.59 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
<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="5">
<el-form-item label="通知状态">
<el-select v-model="ruleForm.noticeStatus" class="width100" filterable clearable placeholder="请选择通知状态">
<el-option v-for="item in noticeStatusList" :key="item.value" :label="item.label" :value="item.value">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="14" class="btnColRight">
<el-form-item>
<el-button type="primary" native-type="submit" @click="queryClick()">查询</el-button>
<el-button type="primary" @click="openDialog()">新增</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 "./xttzdata";
import { getSysNoticeList, deleteSysNotice, publishNotice, unPublishNotice } from "@/api/system.js"
import addDialog from "./components/addDialog.vue";
export default {
name: "xttz",
components: { addDialog },
mixins: [table],
mounted () {
sendThis(this);
this.queryClick()
},
data () {
return {
isDialog: false,
isButtonFlag: true,
dialogTitle: '',
ruleForm: {
noticeTitle: '',
noticeStatus: ''
},
noticeStatusList: [
{ "label": '未发布', 'value': '1' },
{ 'label': '已发布', 'value': '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) {
if (item) {
this.$nextTick(() => {
this.isButtonFlag = false;
this.$refs.addDialog.getDetailInfo(item);
this.dialogTitle = '系统通知详情'
})
} else {
this.isButtonFlag = true;
this.dialogTitle = '新增系统通知'
}
this.isDialog = true;
},
//删除
delNotice (item) {
this.$confirm('是否确定删除', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteSysNotice({ "bsmNotice": item.bsmNotice }).then(res => {
if (res.code == 200) {
this.$message.success('删除成功')
this.queryClick();
} else {
this.$message.error(res.message)
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
});
});
},
//发布
toPublish (item) {
this.$confirm('是否确定发布', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
publishNotice({ "bsmNotice": item.bsmNotice }).then(res => {
if (res.code == 200) {
this.$message.success('发布成功')
this.postMessage()
this.queryClick();
} else {
this.$message.error(res.message)
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '操作取消'
});
});
},
postMessage () {
window.parent.postMessage({ update: true }, '*')
},
//取消发布
toUnPublish (item) {
this.$confirm('是否确定取消发布', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
unPublishNotice({ "bsmNotice": item.bsmNotice }).then(res => {
if (res.code == 200) {
this.$message.success('删除成功')
this.queryClick();
} else {
this.$message.error(res.message)
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '操作取消'
});
});
},
//编辑通知
editNotice (item) {
this.$nextTick(() => {
this.isButtonFlag = true;
this.$refs.addDialog.getDetailInfo(item);
this.dialogTitle = '编辑系统通知'
this.isDialog = true;
})
},
downloadFile (item) {
const href = item.noticeFileUrl
window.open(href, '_blank');
}
},
};
</script>
<style scoped lang="scss">
@import "~@/styles/public.scss";
</style>