tableMixin.js
2.46 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
import { mapGetters } from 'vuex'
// 引入详情弹框
import dataDetails from "@/components/EditDialog";
let mixin = {
data () {
return {
title: '',
formData: {
pageSize: 10
}
}
},
components: {
dataDetails,
},
computed: {
...mapGetters(['dicData'])
},
mounted () {
this.handleSearch()
},
methods: {
// 表格索引得问题
/**
* @description: 表格索引得问题
* @param {*} index
* @author: renchao
*/
indexMethod (index) {
return index + 1 + (this.form.currentPage - 1) * this.formData.pageSize;
},
/**
* @description: handleSizeChange
* @param {*} val
* @author: renchao
*/
handleSizeChange (val) {
this.formData.pageSize = val
this.featchData()
},
/**
* @description: handleSearch
* @author: renchao
*/
handleSearch () {
this.form.currentPage = 1
this.tableData.data = []
if (this.featchData) {
this.featchData()
}
if (this.queryClick) {
this.queryClick()
}
},
/**
* @description: handleCurrentChange
* @param {*} val
* @author: renchao
*/
handleCurrentChange (val) {
this.form.currentPage = val
this.featchData()
},
/**
* @description: handleSubmit
* @author: renchao
*/
handleSubmit () {
this.tableData.data = []
this.featchData()
},
// 详情
/**
* @description: 详情
* @param {*} row
* @author: renchao
*/
handleEdit (row) {
this.$refs.editLog.isShow(row);
if (row.rectypeName) {
this.title = row.rectypeName
} else {
let Title = ''
this.dicData['A21'].map(item => {
if (item.DCODE == row.DJLX || item.DCODE == row.djlx) {
Title = item.DNAME
return
}
})
this.dicData['A8'].map(item => {
if (item.DCODE == row.QLLX || item.DCODE == row.qllx) {
Title += '-' + item.DNAME
return
}
})
this.title = Title
}
},
// 重置表单
/**
* @description: 重置表单
* @author: renchao
*/
resetForm () {
if (!this.form) return
Object.keys(this.form).forEach((key) => {
if (key !== 'currentPage') this.form[key] = '';
})
this.form.currentPage = 1
this.tableData.data = []
this.featchData()
}
}
}
export default mixin