|
@@ -7,8 +7,8 @@
|
|
<i id="search-text" class="el-icon-search"> 筛选搜索</i>
|
|
<i id="search-text" class="el-icon-search"> 筛选搜索</i>
|
|
</div>
|
|
</div>
|
|
<div class="search-btn">
|
|
<div class="search-btn">
|
|
- <el-button plain>重置</el-button>
|
|
|
|
- <el-button type="primary">查询搜索</el-button>
|
|
|
|
|
|
+ <el-button plain @click="reset">重置</el-button>
|
|
|
|
+ <el-button type="primary" @click="searchNotice">查询搜索</el-button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- 筛选公告标题 -->
|
|
<!-- 筛选公告标题 -->
|
|
@@ -43,21 +43,25 @@
|
|
<!-- 数据栏 -->
|
|
<!-- 数据栏 -->
|
|
<div class="data-list">
|
|
<div class="data-list">
|
|
<el-table :data="tableData" border style="width: 100%" class="data-table">
|
|
<el-table :data="tableData" border style="width: 100%" class="data-table">
|
|
- <el-table-column prop="id" label="ID"> </el-table-column>
|
|
|
|
- <el-table-column prop="title" label="公告标题"> </el-table-column>
|
|
|
|
- <el-table-column prop="publishTime" label="发布时间"> </el-table-column>
|
|
|
|
|
|
+ <el-table-column prop="noticeId" label="ID"> </el-table-column>
|
|
|
|
+ <el-table-column prop="noticeTitle" label="公告标题"> </el-table-column>
|
|
|
|
+ <el-table-column prop="createTime" label="发布时间"> </el-table-column>
|
|
<el-table-column prop="operation" label="操作">
|
|
<el-table-column prop="operation" label="操作">
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
- <el-button size="mini" type="text" @click="viewDetails(scope.$index)"
|
|
|
|
- >查看详情</el-button
|
|
|
|
- >
|
|
|
|
<el-button
|
|
<el-button
|
|
- id="deleteBtn"
|
|
|
|
size="mini"
|
|
size="mini"
|
|
type="text"
|
|
type="text"
|
|
- @click="deleteBtn(scope.$index)"
|
|
|
|
- >删除</el-button
|
|
|
|
|
|
+ @click="viewDetails(scope)"
|
|
|
|
+ >查看详情</el-button
|
|
>
|
|
>
|
|
|
|
+ <el-popconfirm
|
|
|
|
+ title="你确定删除本条消息吗?"
|
|
|
|
+ @confirm="deleteNotice(scope)"
|
|
|
|
+ >
|
|
|
|
+ <el-button id="deleteBtn" size="mini" type="text" slot="reference"
|
|
|
|
+ >删除</el-button
|
|
|
|
+ >
|
|
|
|
+ </el-popconfirm>
|
|
</template>
|
|
</template>
|
|
<!-- <el-button size="mini" type="text" icon="el-icon-delete"
|
|
<!-- <el-button size="mini" type="text" icon="el-icon-delete"
|
|
>删除</el-button
|
|
>删除</el-button
|
|
@@ -174,6 +178,8 @@
|
|
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
|
+import { getNotice, deleteNotice,searchJNotice } from "../../api/notice/notice";
|
|
|
|
+
|
|
export default {
|
|
export default {
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
@@ -184,43 +190,41 @@ export default {
|
|
total: 0,
|
|
total: 0,
|
|
pageSize: 5,
|
|
pageSize: 5,
|
|
totalNum: "",
|
|
totalNum: "",
|
|
|
|
+ row_ : "1",
|
|
|
|
+ noticeTime_: "1"
|
|
};
|
|
};
|
|
},
|
|
},
|
|
mounted() {
|
|
mounted() {
|
|
//获取总条目的id
|
|
//获取总条目的id
|
|
this.totalNum = document.querySelector("#dataNum");
|
|
this.totalNum = document.querySelector("#dataNum");
|
|
this.getMockNoticeList();
|
|
this.getMockNoticeList();
|
|
- this.getTableList();
|
|
|
|
|
|
+ // this.getTableList();
|
|
},
|
|
},
|
|
|
|
|
|
methods: {
|
|
methods: {
|
|
getMockNoticeList() {
|
|
getMockNoticeList() {
|
|
- var Mock = require("mockjs");
|
|
|
|
- var data = Mock.mock({
|
|
|
|
- "list|1-20": [
|
|
|
|
- {
|
|
|
|
- "id|+1": 1,
|
|
|
|
- title: "@cword(3, 5)",
|
|
|
|
- publishTime: "@datetime()",
|
|
|
|
- // 'operation|1-10': "★",
|
|
|
|
- },
|
|
|
|
- ],
|
|
|
|
- });
|
|
|
|
- this.mockNoticeList = data;
|
|
|
|
- },
|
|
|
|
- //获取数据按钮
|
|
|
|
- getTableList() {
|
|
|
|
- this.tableData = this.mockNoticeList.list;
|
|
|
|
- // console.log(this.tableData)
|
|
|
|
|
|
+ getNotice().then((res) => {
|
|
|
|
+ //获取数据
|
|
|
|
+ this.tableData = res.rows;
|
|
|
|
+ console.log(res);
|
|
|
|
|
|
- //获取数据总数
|
|
|
|
- this.totalNum.innerHTML = `共:${this.tableData.length}条`;
|
|
|
|
- this.total = this.tableData.length;
|
|
|
|
- // console.log(this.total)
|
|
|
|
|
|
+ //获取数据总数
|
|
|
|
+ this.totalNum.innerHTML = `共:${res.rows.length}条`;
|
|
|
|
+ this.total = res.rows.length;
|
|
|
|
+ });
|
|
},
|
|
},
|
|
// 删除按钮
|
|
// 删除按钮
|
|
- deleteBtn(row) {
|
|
|
|
- this.tableData.splice(this.tableData[row], 1);
|
|
|
|
|
|
+ deleteNotice(row) {
|
|
|
|
+ console.log(row);
|
|
|
|
+ row = row.row.noticeId;
|
|
|
|
+ deleteNotice(row).then((res) => {
|
|
|
|
+ console.log(res);
|
|
|
|
+ this.$message({
|
|
|
|
+ message: "恭喜你,删除成功!",
|
|
|
|
+ type: "success",
|
|
|
|
+ });
|
|
|
|
+ this.$router.go(0);
|
|
|
|
+ });
|
|
// console.log(this.tableData[row].title)
|
|
// console.log(this.tableData[row].title)
|
|
// console.log(this.tableData[row].publishTime)
|
|
// console.log(this.tableData[row].publishTime)
|
|
},
|
|
},
|
|
@@ -230,14 +234,30 @@ export default {
|
|
},
|
|
},
|
|
//查看详情按钮 点击按钮跳转到公告详情页面
|
|
//查看详情按钮 点击按钮跳转到公告详情页面
|
|
viewDetails(row) {
|
|
viewDetails(row) {
|
|
|
|
+ row = row.row.noticeId
|
|
|
|
+ this.row_ = row
|
|
|
|
+ console.log(this.row_)
|
|
|
|
+ // console.log(this.noticeTime_)
|
|
this.$router.push({
|
|
this.$router.push({
|
|
name: "noticeDetails",
|
|
name: "noticeDetails",
|
|
- query:{
|
|
|
|
- publishTime:'时间',
|
|
|
|
- title:'标题'
|
|
|
|
- }
|
|
|
|
|
|
+ query: {
|
|
|
|
+ id: this.row_,
|
|
|
|
+ },
|
|
});
|
|
});
|
|
},
|
|
},
|
|
|
|
+ //搜索
|
|
|
|
+ searchNotice() {
|
|
|
|
+ searchJNotice(this.input).then((res) =>{
|
|
|
|
+ console.log(res);
|
|
|
|
+ this.tableData = res.rows
|
|
|
|
+ })
|
|
|
|
+ this.reset();
|
|
|
|
+ },
|
|
|
|
+ //重置
|
|
|
|
+ reset() {
|
|
|
|
+ this.input = "";
|
|
|
|
+ this.value1 = "";
|
|
|
|
+ },
|
|
},
|
|
},
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|