commit
5b294b781b
|
@ -15,15 +15,15 @@
|
||||||
class="handle-del mr10"
|
class="handle-del mr10"
|
||||||
@click="delAllSelection"
|
@click="delAllSelection"
|
||||||
>批量删除</el-button>
|
>批量删除</el-button>
|
||||||
<el-select v-model="selectCate" placeholder="筛选省份" class="handle-select mr10">
|
<el-select v-model="query.address" placeholder="地址" class="handle-select mr10">
|
||||||
<el-option key="1" label="广东省" value="广东省"></el-option>
|
<el-option key="1" label="广东省" value="广东省"></el-option>
|
||||||
<el-option key="2" label="湖南省" value="湖南省"></el-option>
|
<el-option key="2" label="湖南省" value="湖南省"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
<el-input v-model="selectWord" placeholder="筛选关键词" class="handle-input mr10"></el-input>
|
<el-input v-model="query.name" placeholder="用户名" class="handle-input mr10"></el-input>
|
||||||
<el-button type="primary" icon="el-icon-search" @click="handleSearch">搜索</el-button>
|
<el-button type="primary" icon="el-icon-search" @click="handleSearch">搜索</el-button>
|
||||||
</div>
|
</div>
|
||||||
<el-table
|
<el-table
|
||||||
:data="data"
|
:data="tableData"
|
||||||
border
|
border
|
||||||
class="table"
|
class="table"
|
||||||
ref="multipleTable"
|
ref="multipleTable"
|
||||||
|
@ -75,9 +75,9 @@
|
||||||
<el-pagination
|
<el-pagination
|
||||||
background
|
background
|
||||||
layout="total, prev, pager, next"
|
layout="total, prev, pager, next"
|
||||||
:current-page="page.index"
|
:current-page="query.pageIndex"
|
||||||
:page-size="page.size"
|
:page-size="query.pageSize"
|
||||||
:total="page.total"
|
:total="pageTotal"
|
||||||
@current-change="handlePageChange"
|
@current-change="handlePageChange"
|
||||||
></el-pagination>
|
></el-pagination>
|
||||||
</div>
|
</div>
|
||||||
|
@ -107,17 +107,17 @@ export default {
|
||||||
name: 'basetable',
|
name: 'basetable',
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
query: {
|
||||||
|
address: '',
|
||||||
|
name: '',
|
||||||
|
pageIndex: 1,
|
||||||
|
pageSize: 10
|
||||||
|
},
|
||||||
tableData: [],
|
tableData: [],
|
||||||
multipleSelection: [],
|
multipleSelection: [],
|
||||||
delList: [],
|
delList: [],
|
||||||
selectCate: '',
|
|
||||||
selectWord: '',
|
|
||||||
editVisible: false,
|
editVisible: false,
|
||||||
page: {
|
pageTotal: 0,
|
||||||
index: 1,
|
|
||||||
size: 10,
|
|
||||||
total: 50
|
|
||||||
},
|
|
||||||
form: {},
|
form: {},
|
||||||
idx: -1,
|
idx: -1,
|
||||||
id: -1
|
id: -1
|
||||||
|
@ -126,38 +126,19 @@ export default {
|
||||||
created() {
|
created() {
|
||||||
this.getData();
|
this.getData();
|
||||||
},
|
},
|
||||||
computed: {
|
|
||||||
data() {
|
|
||||||
return this.tableData.filter(d => {
|
|
||||||
let is_del = false;
|
|
||||||
for (let i = 0; i < this.delList.length; i++) {
|
|
||||||
if (d.name === this.delList[i].name) {
|
|
||||||
is_del = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!is_del) {
|
|
||||||
if (
|
|
||||||
d.address.indexOf(this.selectCate) > -1 &&
|
|
||||||
(d.name.indexOf(this.selectWord) > -1 || d.address.indexOf(this.selectWord) > -1)
|
|
||||||
) {
|
|
||||||
return d;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
// 获取 easy-mock 的模拟数据
|
// 获取 easy-mock 的模拟数据
|
||||||
getData() {
|
getData() {
|
||||||
fetchData({
|
fetchData(this.query).then(res => {
|
||||||
page: this.page.index
|
|
||||||
}).then(res => {
|
|
||||||
this.tableData = res.list;
|
this.tableData = res.list;
|
||||||
|
this.pageTotal = res.pageTotal || 50;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// 触发搜索按钮
|
// 触发搜索按钮
|
||||||
handleSearch() {},
|
handleSearch() {
|
||||||
|
this.$set(this.query, 'pageIndex', 1);
|
||||||
|
this.getData();
|
||||||
|
},
|
||||||
// 删除操作
|
// 删除操作
|
||||||
handleDelete(index, row) {
|
handleDelete(index, row) {
|
||||||
// 二次确认删除
|
// 二次确认删除
|
||||||
|
@ -187,7 +168,6 @@ export default {
|
||||||
// 编辑操作
|
// 编辑操作
|
||||||
handleEdit(index, row) {
|
handleEdit(index, row) {
|
||||||
this.idx = index;
|
this.idx = index;
|
||||||
this.id = row.id;
|
|
||||||
this.form = row;
|
this.form = row;
|
||||||
this.editVisible = true;
|
this.editVisible = true;
|
||||||
},
|
},
|
||||||
|
@ -199,7 +179,7 @@ export default {
|
||||||
},
|
},
|
||||||
// 分页导航
|
// 分页导航
|
||||||
handlePageChange(val) {
|
handlePageChange(val) {
|
||||||
this.page.index = val;
|
this.$set(this.query, 'pageIndex', val);
|
||||||
this.getData();
|
this.getData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue