|
@@ -25,13 +25,13 @@
|
|
</el-card>
|
|
</el-card>
|
|
<el-card style="height: 300px;width: 1200px; margin-left: 30px;">
|
|
<el-card style="height: 300px;width: 1200px; margin-left: 30px;">
|
|
<el-table :data="tableData" border height="250" style="width: 100%">
|
|
<el-table :data="tableData" border height="250" style="width: 100%">
|
|
- <el-table-column fixed prop="messageID" label="ID" align="center" width="250">
|
|
|
|
|
|
+ <el-table-column fixed prop="id" label="ID" align="center" width="250">
|
|
</el-table-column>
|
|
</el-table-column>
|
|
- <el-table-column prop="messageTitle" label="消息标题" align="center" width="220">
|
|
|
|
|
|
+ <el-table-column prop="title" label="消息标题" align="center" width="220">
|
|
</el-table-column>
|
|
</el-table-column>
|
|
<el-table-column prop="messageTel" label="手机号" align="center" width="220">
|
|
<el-table-column prop="messageTel" label="手机号" align="center" width="220">
|
|
</el-table-column>
|
|
</el-table-column>
|
|
- <el-table-column prop="messageData" label="发布时间" align="center" width="220">
|
|
|
|
|
|
+ <el-table-column prop="sendTime" label="发布时间" align="center" width="220">
|
|
</el-table-column>
|
|
</el-table-column>
|
|
<el-table-column fixed="right" label="操作" align="center" width="200">
|
|
<el-table-column fixed="right" label="操作" align="center" width="200">
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
@@ -44,13 +44,13 @@
|
|
:current-page="currentPage" :page-sizes="[5, 10, 20, 50]" :page-size="pagesize"
|
|
:current-page="currentPage" :page-sizes="[5, 10, 20, 50]" :page-size="pagesize"
|
|
layout="total, sizes, prev, pager, next, jumper" prev-text="上一页" next-text="下一页" :total="this.tableData.length">
|
|
layout="total, sizes, prev, pager, next, jumper" prev-text="上一页" next-text="下一页" :total="this.tableData.length">
|
|
</el-pagination>
|
|
</el-pagination>
|
|
-
|
|
|
|
</el-card>
|
|
</el-card>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
-import axios from "axios"
|
|
|
|
|
|
+import { getMessageList } from "../../../api/message";
|
|
|
|
+
|
|
export default {
|
|
export default {
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
@@ -67,43 +67,32 @@ export default {
|
|
styleArrow: true,
|
|
styleArrow: true,
|
|
setContent: '',
|
|
setContent: '',
|
|
setTitle: ''
|
|
setTitle: ''
|
|
-
|
|
|
|
}
|
|
}
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
//搜索功能
|
|
//搜索功能
|
|
onSubmit() {
|
|
onSubmit() {
|
|
// 若未输入值,则展示所有数据
|
|
// 若未输入值,则展示所有数据
|
|
- if(null === this.formInline.messageTitle || undefined === this.formInline.messageTitle){
|
|
|
|
|
|
+ if (null === this.formInline.messageTitle || undefined === this.formInline.messageTitle) {
|
|
this.tableDataRst = this.tableData;
|
|
this.tableDataRst = this.tableData;
|
|
} else {
|
|
} else {
|
|
this.tableDataRst = []; // 结果列表置空
|
|
this.tableDataRst = []; // 结果列表置空
|
|
- let regStr = '';
|
|
|
|
|
|
+ let regStr = '';
|
|
// 初始化正则表达式
|
|
// 初始化正则表达式
|
|
- for(let i=0; i<this.formInline.messageTitle.length; i++){
|
|
|
|
|
|
+ for (let i = 0; i < this.formInline.messageTitle.length; i++) {
|
|
regStr = regStr + '(' + this.formInline.messageTitle[i] + ')([\\s]*)'; //跨字匹配
|
|
regStr = regStr + '(' + this.formInline.messageTitle[i] + ')([\\s]*)'; //跨字匹配
|
|
}
|
|
}
|
|
let reg = new RegExp(regStr);
|
|
let reg = new RegExp(regStr);
|
|
console.log(reg);
|
|
console.log(reg);
|
|
- for(let i=0; i<this.tableData.length; i++){
|
|
|
|
|
|
+ for (let i = 0; i < this.tableData.length; i++) {
|
|
let name = this.tableData[i].name; //按照名字匹配
|
|
let name = this.tableData[i].name; //按照名字匹配
|
|
let regMatch = name.match(reg);
|
|
let regMatch = name.match(reg);
|
|
- if(null !== regMatch) {//将匹配的数据放入结果列表中
|
|
|
|
- this.tableDataRst.push(this.tableData[i]);
|
|
|
|
|
|
+ if (null !== regMatch) {//将匹配的数据放入结果列表中
|
|
|
|
+ this.tableDataRst.push(this.tableData[i]);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- //重置功能
|
|
|
|
- resetForm() {
|
|
|
|
- this.$options.data();
|
|
|
|
- // // 重置数据
|
|
|
|
- // this.$data = this.$options.data();
|
|
|
|
- // 有报错Avoid replacing instance root $data. Use nested data properties instead.
|
|
|
|
- // Object.assign(this.$data, this.$options.data())
|
|
|
|
- this.formInline.messageTitle = "";
|
|
|
|
- this.value = ""
|
|
|
|
- },
|
|
|
|
//消息删除
|
|
//消息删除
|
|
messageDel(row, column) {
|
|
messageDel(row, column) {
|
|
console.log(column);
|
|
console.log(column);
|
|
@@ -122,21 +111,31 @@ export default {
|
|
handleAdd() {
|
|
handleAdd() {
|
|
this.$router.push({
|
|
this.$router.push({
|
|
path: 'messageCreate'
|
|
path: 'messageCreate'
|
|
- })
|
|
|
|
- // 路由跳转
|
|
|
|
|
|
+ }) // 路由跳转
|
|
|
|
+ },
|
|
|
|
+ //重置功能
|
|
|
|
+ resetForm() {
|
|
|
|
+ this.$options.data();
|
|
|
|
+ // // 重置数据
|
|
|
|
+ // this.$data = this.$options.data();
|
|
|
|
+ // 有报错Avoid replacing instance root $data. Use nested data properties instead.
|
|
|
|
+ // Object.assign(this.$data, this.$options.data())
|
|
|
|
+ this.formInline.messageTitle = "";
|
|
|
|
+ this.value = ""
|
|
},
|
|
},
|
|
//获取消息列表
|
|
//获取消息列表
|
|
- getMessageList() {
|
|
|
|
- axios.post("http://localhost:8080/goods/goodAll").then((res) => {
|
|
|
|
- this.tableData = res.data.data
|
|
|
|
- }).catch(error => {
|
|
|
|
-
|
|
|
|
|
|
+ getMessage() {
|
|
|
|
+ getMessageList().then((res) => {
|
|
|
|
+ console.log(res);
|
|
|
|
+ console.log(res.rows);
|
|
|
|
+ this.tableData = res.rows
|
|
|
|
+ console.log(this.tableData);
|
|
})
|
|
})
|
|
},
|
|
},
|
|
},
|
|
},
|
|
|
|
|
|
mounted() {
|
|
mounted() {
|
|
- this.getMessageList();
|
|
|
|
|
|
+ this.getMessage();
|
|
},
|
|
},
|
|
}
|
|
}
|
|
|
|
|