-
@@ -68,18 +58,27 @@
},
data() {
return {
- pageSize: 20,
jsonBody: [],
checkboxList: [],
tableAll: false,
indeterminate: false,
+ columns: [],
+ selectedRowKeys: [],
+ dataSource: [],
+ pageNo: 1,
+ pageSize: 10,
+ total: 0,
+ searchParmes: {},
+ loading:false,
}
},
mounted() {
eventBUs.$on('searchQuery', search => {
+ this.searchParmes = search
this.getTableList(search)
})
eventBUs.$on('searchReset', target => {
+ this.searchParmes = {}
this.getTableList()
})
this.getData()
@@ -93,42 +92,46 @@
getAction(this.url.tableHeader, params).then((res) => {
if (res.success) {
var jsonHead = res.result
- for (var i = 0; i < jsonHead.length; i++) {
- $('#table_thead_tr').append('
' + jsonHead[i].db_field_en_name + '' + jsonHead[i].db_field_txt + ' | ')
- }
- if (this.isOperation) {
- let th = '
' + 'Operation ' + '' + '操作' + ' | '
- $('#table_thead_tr').append(th)
- }
- }
- })
- },
- checkboxChange(checkedList) {
- this.indeterminate = !!checkedList.length && checkedList.length < this.jsonBody.length
- this.tableAll = checkedList.length === this.jsonBody.length
- },
- checkboxAll(event) {
- this.tableAll = event.target.checked
- this.checkboxList = []
- if (this.tableAll) {
- if (this.jsonBody.length > 0){
- this.jsonBody.forEach(res => {
- this.checkboxList.push(res.id)
+ jsonHead.forEach(res => {
+ this.columns.push({
+ title: res.db_field_txt,
+ dataIndex: res.db_field_name,
+ align: 'center'
+ })
+ })
+ this.columns.push({
+ title: '操作',
+ align: 'center',
+ fixed: 'right',
+ scopedSlots: { customRender: 'operation' }
})
}
- }
+ })
},
- getTableList(search) {
+ getTableList() {
let params = {
- ...search,
+ ...this.searchParmes,
+ pageNo: this.pageNo,
+ pageSize: this.pageSize
}
+ this.loading = true
getAction(this.url.tableList, params).then((res) => {
if (res.success) {
- this.jsonBody = res.result.records
+ this.dataSource = res.result.records
+ this.total = res.result.total
+ this.loading = false
}
})
},
- onChange() {
+ onChange(page, pageSize) {
+ this.pageNo = page
+ this.getTableList()
+ },
+ SizeChange(page, pageSize) {
+ this.pageSize = pageSize
+ this.getTableList()
+ },
+ onSelectChange() {
},
OperationClick(ol, item) {
@@ -137,7 +140,11 @@
}
}
-
+