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
// TODO: 组件表单所需的所有参数(未完善类型检测)
export function BaseTableArgumentsTest(listName, loading, List, queryParams, columObj) {
this.listName = listName
this.loading = loading
this.List = List
this.queryParams = queryParams
this.columObj = columObj
}
// TODO: 以下导出皆暂时不可用,都未完善
// 查询条件 (检查查询条件的类型)
export function queryParamsType(pageNum, pageSize, pageTotal) {
if (typeof pageNum !== 'number' && typeof pageSize !== 'number' && typeof pageTotal !== 'number') {
console.warn('queryParams查询参数的type类型错误!请检查后重新赋值')
return null
} else {
this.pageNum = pageNum
this.pageSize = pageSize
this.pageTotal = pageTotal
}
}
// 操作选项的类型判断
export function operationType(type, label, icon, color, buttonClick, isShow) {
this.type = type
this.label = label
this.icon = icon
this.color = color
this.buttonClick = buttonClick | function() {}
this.isShow = isShow | function(row, $index) {
return true
}
}
// 列的类型以及参数判断
export function columnDataType(text, status, ownDefined, isSwitch, image, isOperation, prop, label, width, align, operation) {
this.text = text
this.status = status
this.ownDefined = ownDefined
this.isSwitch = isSwitch
this.image = image
this.isOperation = isOperation
this.prop = prop
this.label = label
this.width = width
this.align = align
if (operation instanceof operationType) {
this.operations = operationType
} else {
console.warn('operation参数的type类型错误!请检查后重新赋值')
}
}
// 组件表单所需的所有参数
export function BaseTableArguments(selection, loading, processList, queryParams, columnData) {
// TODO: 选择框是否需要存在 (selection判断表单选择框是否需要存在)
if (typeof selection !== 'boolean') {
console.warn('selection下拉框参数的type类型错误!请检查后重新赋值')
} else {
this.selection = selection
// TODO: 选择框 (根据条件是否可选)
this.selectable = (row, index) => {
if (row.isSwitch) {
return true
}
}
}
// 加载进度 (判断是否显示加载进度)
if (typeof loading !== 'boolean') {
console.warn('loading进度条参数的type类型错误!请检查后重新赋值')
} else {
this.loading = loading
}
// 查询参数 (判断查询条件是否符合类型)
if (queryParams instanceof queryParamsType) {
this.queryParams = queryParamsType
}
// 每一列的参数
if (columnData instanceof columnDataType) {
this.columnData = columnData
}
this.processList = processList
}