-
Notifications
You must be signed in to change notification settings - Fork 92
/
index.vue
76 lines (75 loc) · 2.02 KB
/
index.vue
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
<template>
<d2-container>
<template slot="header">自定义字段类型
<example-helper title="帮助说明" >
<h4>crud配置</h4>
<d2-highlight :code="helper.code"/>
</example-helper>
</template>
<crud-search ref="search" :options="crud.searchOptions" @submit="handleSearch" class="d2-mb-10" >
</crud-search>
<d2-crud
ref="d2Crud"
:columns="crud.columns"
:data="crud.list"
:rowHandle="crud.rowHandle"
edit-title="修改"
:add-template="crud.addTemplate"
:add-rules="crud.addRules"
:edit-template="crud.editTemplate"
:edit-rules="crud.editRules"
:form-options="crud.formOptions"
:options="crud.options"
:loading="crud.loading"
@dialog-open="handleDialogOpen"
@row-edit="handleRowEdit"
@row-add="handleRowAdd"
@row-remove="handleRowRemove"
@dialog-cancel="handleDialogCancel"
@form-data-change="handleFormDataChange"
>
<el-button slot="header" style="margin-bottom: 5px" size="small" type="primary" @click="addRow">新增</el-button>
</d2-crud>
<crud-footer ref="footer" :current="crud.page.current"
:size="crud.page.size"
:total="crud.page.total"
@change="handlePaginationChange"
>
</crud-footer>
</d2-container>
</template>
<script>
import { AddObj, GetList, UpdateObj, DelObj } from './api'
import { crudOptions } from './crud'
import { d2CrudPlus } from 'd2-crud-plus'
import helper from './helper'
export default {
name: 'customTypePage',
components: {},
mixins: [d2CrudPlus.crud],
data () {
return {
helper: helper
}
},
computed: {
},
methods: {
getCrudOptions () {
return crudOptions
},
pageRequest (query) {
return GetList(query)
},
addRequest (row) {
return AddObj(row)
},
updateRequest (row) {
return UpdateObj(row)
},
delRequest (row) {
return DelObj(row.id)
}
}
}
</script>