# eboss js 代码块
eboss 系统常见代码块
# 命令列表
命令 | 描述 | 类型/语言 | 提示 | 备注 |
---|---|---|---|---|
ecache | eboss getCache | function / javascript | - | - |
etabledata | etable data数据 | function / javascript | - | - |
eget | 发送通用get请求 | function / javascript | - | - |
epost | 发送通用post请求 | function / javascript | - | - |
eloaddata | etable表格 loadData 方法 | function / javascript | - | - |
# ecache
命令描述:eboss getCache
快捷命令:ecache
// 页面缓存
this.$$store.dispatch("getCache").then(res => {
if (res.success) {
Object.assign(this.$$data, res.model)
if (res.refresh) {
this.init()
}
} else {
this.init()
}
})
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
# etabledata
命令描述:etable data数据
快捷命令:etabledata
// 表格表头数据列表,
columns: [
{
"label":"测试数据",
"prop":"text"
},
{
"label":"操作",
"prop":"options"
}
],
// 表格显示的数据列表,
dataList: [],
// 总条目数,
totalCount: 0,
// 每页显示条目个数,
pageSize: 10,
// 当前页数,
pageIndex: 1,
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# eget
命令描述:发送通用get请求
快捷命令:eget
const url = '$1'
const params = {}
this.axiosGet(url, params).then(res => {
if (res.success) {
console.log(res.model)
} else {
this.$$alert(res.errorMessage, '提示')
}
}).catch(err => {
console.log(err)
}).finally(() => {})
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
# epost
命令描述:发送通用post请求
快捷命令:epost
const url = '$1'
const params = {}
this.axiosPost(url, params).then(res => {
if (res.success) {
console.log(res.model)
} else {
this.$$alert(res.errorMessage, '提示')
}
}).catch(err => {
console.log(err)
}).finally(() => {})
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
# eloaddata
命令描述:etable表格 loadData 方法
快捷命令:eloaddata
// 查询加载数据方法
loadData () {
this.pageIndex = 1;
this.searchList()
},
// pageSize 改变时会触发
handleSizeChange (size) {
this.pageSize = size;
this.searchList()
},
// currentPage 改变时会触发
handleCurrentChange (current) {
this.pageIndex = current;
this.searchList()
},
// 真正的搜索方法 - 搜索查询列表页面模板
searchList () {
let params = {
pageIndex: this.pageIndex,
pageSize: this.pageSize,
model: {}
}
// 搜索状态
this.searchLoading = true
this.axiosPost('请求url', params)
.then(res => {
if (res.success) {
this.dataList = res.model
this.totalCount = res.totalCount
} else {
this.$$alert(res.errorMessage, '提示', {showClose: false})
}
}).finally(() => {
this.searchLoading = false
})
},
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
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