-
Notifications
You must be signed in to change notification settings - Fork 6
/
ui.go
32 lines (29 loc) · 1022 Bytes
/
ui.go
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
package subscan_plugin
type UiConfig struct {
Type string `json:"type"`
Body struct {
Type string `json:"type"`
Api struct {
Method string `json:"method"`
Url string `json:"url"`
RequestAdaptor string `json:"requestAdaptor"`
Adaptor string `json:"adaptor"`
} `json:"api"`
SyncLocation bool `json:"syncLocation"`
HeaderToolbar []string `json:"headerToolbar"`
Columns []UiColumns `json:"columns"`
} `json:"body"`
}
type UiColumns struct {
Name string `json:"name"`
Label string `json:"label"`
}
// https://baidu.gitee.io/amis/docs/concepts/schema
func (u *UiConfig) Init() {
u.Type = "page"
u.Body.Type = "crud"
u.Body.SyncLocation = false
u.Body.HeaderToolbar = []string{}
u.Body.Api.RequestAdaptor = "return {...api, data: {...api.data, page: api.data.page - 1, row: api.data.perPage,} }"
u.Body.Api.Adaptor = "return {...payload, status: payload.code, data: {items: payload.data.%s, count: payload.data.count}, msg: payload.message };"
}