manualTable.vue
1.88 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
<!-- 不传入接口名称,手动调用接口,并更新表格数据 -->
<template>
<div>
<el-form
:inline="true"
:model="searchForm"
>
<el-form-item label="name:">
<el-input v-model="searchForm.name"></el-input>
</el-form-item>
<el-form-item>
<el-button
size="small"
type="primary"
@click="handleSearch"
>查询</el-button>
</el-form-item>
</el-form>
<glsx-table
ref="tableRef2"
:tableData="tableData"
:tableTotal="tableTotal"
:tableParams="tableParams"
@refreshTable="handleSearch"
>
<span
slot="auth-button"
slot-scope="scope"
:data="scope.scope"
>
<el-button
type="text"
@click="handleAdd(scope.scope)"
>新增</el-button>
</span>
</glsx-table>
</div>
</template>
<script>
import { getListApi2 } from '../api/test'
export default {
name: 'manualTable',
data() {
return {
searchForm: {
name: ''
},
// 表格参数
tableData: [],
tableTotal: 0,
tableParams: {
listName: 'list',
tableOption: true,
tableColumns: [{
label: 'id',
prop: 'id',
width: '80px'
}, {
label: '姓名',
prop: 'name'
}]
}
}
},
mounted() {
this.handleSearch()
},
methods: {
handleAdd(row) {
this.$notify({
title: '提示',
message: row
})
},
handleSearch() {
var params = {
...JSON.parse(JSON.stringify(this.searchForm)),
pageSize: this.$refs.tableRef2.page.pageSize,
pageNum: this.$refs.tableRef2.page.pageNum
}
getListApi2(params).then(res => {
this.tableData = res.list
this.tableTotal= res.total
})
}
}
}
</script>
<style scoped>
</style>