vue-super-crud 1.7.1 → 1.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +42 -10
- package/lib/index.css +1 -1
- package/lib/super-crud.min.js +2 -2
- package/package.json +21 -16
- package/src/config/common.js +2 -1
- package/src/config/crud.js +3 -3
- package/src/index.js +4 -0
- package/src/template/formatData.js +75 -87
- package/.browserslistrc +0 -3
- package/.versionrc.json +0 -36
- package/CHANGELOG.md +0 -232
- package/babel.config.js +0 -12
- package/build/alias.js +0 -10
- package/build/build.js +0 -52
- package/build/config.js +0 -70
- package/deploy.bat +0 -14
- package/docs/.vuepress/components/button/base.vue +0 -88
- package/docs/.vuepress/components/common/code-format.vue +0 -331
- package/docs/.vuepress/components/commonConfig/presetCodeTemplate/base.vue +0 -68
- package/docs/.vuepress/components/commonConfig/presetCodeTemplate/customParams.vue +0 -73
- package/docs/.vuepress/components/commonConfig/renderType/component.vue +0 -160
- package/docs/.vuepress/components/commonConfig/renderType/formatter.vue +0 -49
- package/docs/.vuepress/components/commonConfig/renderType/render.vue +0 -91
- package/docs/.vuepress/components/commonConfig/renderType/slot.vue +0 -63
- package/docs/.vuepress/components/crud/baseUse/baseUse.vue +0 -98
- package/docs/.vuepress/components/crud/baseUse/columnAction.vue +0 -72
- package/docs/.vuepress/components/crud/baseUse/columnWidth.vue +0 -107
- package/docs/.vuepress/components/crud/baseUse/handleRow.vue +0 -65
- package/docs/.vuepress/components/crud/baseUse/height.vue +0 -82
- package/docs/.vuepress/components/crud/baseUse/index.vue +0 -54
- package/docs/.vuepress/components/crud/baseUse/loading.vue +0 -70
- package/docs/.vuepress/components/crud/baseUse/pagination.vue +0 -108
- package/docs/.vuepress/components/crud/baseUse/selection.vue +0 -114
- package/docs/.vuepress/components/crud/baseUse/summaryMethod.vue +0 -118
- package/docs/.vuepress/components/crud/baseUse/title.vue +0 -54
- package/docs/.vuepress/components/crud/baseUse/toolbar.vue +0 -69
- package/docs/.vuepress/components/crud/buttons/common.vue +0 -115
- package/docs/.vuepress/components/crud/buttons/fast.vue +0 -82
- package/docs/.vuepress/components/crud/contextMenu/base.vue +0 -72
- package/docs/.vuepress/components/crud/copy.vue +0 -52
- package/docs/.vuepress/components/crud/crudEvents/api.vue +0 -157
- package/docs/.vuepress/components/crud/crudEvents/deleteTip.vue +0 -93
- package/docs/.vuepress/components/crud/crudEvents/events.vue +0 -188
- package/docs/.vuepress/components/crud/dataSort/base.vue +0 -142
- package/docs/.vuepress/components/crud/genDynamicColumns/base.vue +0 -53
- package/docs/.vuepress/components/crud/genDynamicColumns/dynamicAndFixed.vue +0 -111
- package/docs/.vuepress/components/crud/genDynamicColumns/treeDynamic.vue +0 -68
- package/docs/.vuepress/components/crud/handleBar/handleRow.vue +0 -65
- package/docs/.vuepress/components/crud/handleBar/toolbar.vue +0 -69
- package/docs/.vuepress/components/crud/renderType/1.vue +0 -57
- package/docs/.vuepress/components/crud/renderType/2.vue +0 -63
- package/docs/.vuepress/components/crud/renderType/3.vue +0 -105
- package/docs/.vuepress/components/crud/renderType/5.vue +0 -91
- package/docs/.vuepress/components/crud/search/1.vue +0 -90
- package/docs/.vuepress/components/crud/search/2.vue +0 -78
- package/docs/.vuepress/components/crud/search/3.vue +0 -107
- package/docs/.vuepress/components/crud/search/base.vue +0 -123
- package/docs/.vuepress/components/crud/search/localSearch.vue +0 -124
- package/docs/.vuepress/components/crud/search/special.vue +0 -148
- package/docs/.vuepress/components/crud/selection/events.vue +0 -47
- package/docs/.vuepress/components/crud/selection/pagination.vue +0 -94
- package/docs/.vuepress/components/crud/selection/singleSelection.vue +0 -64
- package/docs/.vuepress/components/crud/span/base.vue +0 -69
- package/docs/.vuepress/components/crud/span/special.vue +0 -75
- package/docs/.vuepress/components/crud/summary/base.vue +0 -99
- package/docs/.vuepress/components/crud/tableEdit/addDeleteBtn.vue +0 -174
- package/docs/.vuepress/components/crud/tableEdit/cellEdit.vue +0 -194
- package/docs/.vuepress/components/crud/tableEdit/controlEdit.vue +0 -219
- package/docs/.vuepress/components/crud/tableEdit/dialog.vue +0 -172
- package/docs/.vuepress/components/crud/tableEdit/free.vue +0 -88
- package/docs/.vuepress/components/crud/tableEdit/freeColumn.vue +0 -82
- package/docs/.vuepress/components/crud/tableEdit/methods.vue +0 -154
- package/docs/.vuepress/components/crud/tableEdit/rowAction.vue +0 -107
- package/docs/.vuepress/components/crud/tableEdit/rowBatch.vue +0 -116
- package/docs/.vuepress/components/crud/tableEdit/rowClick.vue +0 -98
- package/docs/.vuepress/components/crud/validate/base.vue +0 -122
- package/docs/.vuepress/components/crud/validate/custom.vue +0 -82
- package/docs/.vuepress/components/crud/validate/regulars.vue +0 -88
- package/docs/.vuepress/components/crud/validate/relation.vue +0 -91
- package/docs/.vuepress/components/crud/validate/tree.vue +0 -82
- package/docs/.vuepress/components/dialog/baseUse/base.vue +0 -92
- package/docs/.vuepress/components/dialog/baseUse/beforeConfirm.vue +0 -78
- package/docs/.vuepress/components/dialog/baseUse/control.vue +0 -79
- package/docs/.vuepress/components/dialog/baseUse/drawer.vue +0 -59
- package/docs/.vuepress/components/dialog/baseUse/footer.vue +0 -87
- package/docs/.vuepress/components/dialog/baseUse/insertSlot.vue +0 -79
- package/docs/.vuepress/components/dict/DictLinkage.vue +0 -91
- package/docs/.vuepress/components/dict/baseUse.vue +0 -72
- package/docs/.vuepress/components/dict/component.vue +0 -82
- package/docs/.vuepress/components/dict/localDict.vue +0 -68
- package/docs/.vuepress/components/form/baseUse/base.vue +0 -48
- package/docs/.vuepress/components/form/baseUse/dataFormat.vue +0 -92
- package/docs/.vuepress/components/form/baseUse/deep.vue +0 -57
- package/docs/.vuepress/components/form/baseUse/gridLayout.vue +0 -47
- package/docs/.vuepress/components/form/baseUse/group.vue +0 -66
- package/docs/.vuepress/components/form/baseUse/hidden.vue +0 -40
- package/docs/.vuepress/components/form/baseUse/inlineLayout.vue +0 -48
- package/docs/.vuepress/components/form/baseUse/label.vue +0 -51
- package/docs/.vuepress/components/form/baseUse/tooltip.vue +0 -40
- package/docs/.vuepress/components/form/baseUse/validate.vue +0 -52
- package/docs/.vuepress/components/form/detail/base.vue +0 -78
- package/docs/.vuepress/components/form/detail/border.vue +0 -90
- package/docs/.vuepress/components/form/detail/singleDetail.vue +0 -72
- package/docs/.vuepress/components/formatData/baseUse.vue +0 -131
- package/docs/.vuepress/components/mock/index.js +0 -347
- package/docs/.vuepress/components/mockData/custom.vue +0 -69
- package/docs/.vuepress/components/mockData/example.vue +0 -290
- package/docs/.vuepress/components/positionSlot/base.vue +0 -24
- package/docs/.vuepress/components/positionSlot/form.vue +0 -71
- package/docs/.vuepress/components/positionSlot/table.vue +0 -85
- package/docs/.vuepress/components/tabs/base.vue +0 -57
- package/docs/.vuepress/components/temp.js +0 -195
- package/docs/.vuepress/config.js +0 -146
- package/docs/.vuepress/enhanceApp.js +0 -142
- package/docs/.vuepress/public/favicon.ico +0 -0
- package/docs/.vuepress/public/super.png +0 -0
- package/docs/.vuepress/styles/index.styl +0 -25
- package/docs/.vuepress/styles/palette.styl +0 -6
- package/docs/README.md +0 -14
- package/docs/guide/button/base.md +0 -31
- package/docs/guide/commonConfig/jsx.md +0 -166
- package/docs/guide/commonConfig/presetCodeTemplate.md +0 -68
- package/docs/guide/commonConfig/renderType.md +0 -181
- package/docs/guide/crud/baseUse.md +0 -120
- package/docs/guide/crud/buttons.md +0 -18
- package/docs/guide/crud/config.md +0 -217
- package/docs/guide/crud/contextMenu.md +0 -18
- package/docs/guide/crud/dataSort.md +0 -66
- package/docs/guide/crud/genDynamicColumns.md +0 -145
- package/docs/guide/crud/handleBar.md +0 -26
- package/docs/guide/crud/renderType.md +0 -4
- package/docs/guide/crud/search.md +0 -150
- package/docs/guide/crud/selection.md +0 -73
- package/docs/guide/crud/span.md +0 -98
- package/docs/guide/crud/summary.md +0 -167
- package/docs/guide/crud/tableEdit.md +0 -377
- package/docs/guide/crud/validate.md +0 -158
- package/docs/guide/dialog/baseUse.md +0 -81
- package/docs/guide/dict/baseUse.md +0 -174
- package/docs/guide/dict/component.md +0 -88
- package/docs/guide/dict/config.md +0 -44
- package/docs/guide/form/baseUse.md +0 -142
- package/docs/guide/form/detail.md +0 -38
- package/docs/guide/formatData/baseUse.md +0 -98
- package/docs/guide/formatData/config.md +0 -142
- package/docs/guide/mockData/base.md +0 -26
- package/docs/guide/positionSlot/base.md +0 -41
- package/docs/guide/question/base.md +0 -44
- package/docs/guide/start/base.md +0 -30
- package/docs/guide/tabs/base.md +0 -63
- package/examples/App.vue +0 -52
- package/examples/Layout/components/AppMain.vue +0 -40
- package/examples/Layout/components/Item.vue +0 -29
- package/examples/Layout/components/Link.vue +0 -44
- package/examples/Layout/components/SidebarItem.vue +0 -93
- package/examples/Layout/index.vue +0 -69
- package/examples/assets/logo.png +0 -0
- package/examples/favicon.ico +0 -0
- package/examples/index.html +0 -18
- package/examples/main.js +0 -54
- package/examples/router/index.js +0 -140
- package/examples/store/index.js +0 -0
- package/examples/styles/index.scss +0 -63
- package/examples/styles/sidebar.scss +0 -226
- package/examples/styles/transition.scss +0 -48
- package/examples/styles/variables.scss +0 -25
- package/examples/views/crud/base.vue +0 -68
- package/examples/views/crud/handleRow.vue +0 -84
- package/examples/views/crud/search.vue +0 -116
- package/examples/views/dashboard/index.vue +0 -244
- package/examples/views/dashboard/index1.vue +0 -234
- package/examples/views/dashboard/test.vue +0 -9
- package/examples/views/formTest/index.vue +0 -168
- package/examples/views/nested/menu1/index.vue +0 -7
- package/examples/views/nested/menu1/menu1-1/index.vue +0 -7
- package/examples/views/nested/menu1/menu1-2/index.vue +0 -7
- package/examples/views/nested/menu1/menu1-2/menu1-2-1/index.vue +0 -5
- package/examples/views/nested/menu1/menu1-2/menu1-2-2/index.vue +0 -5
- package/examples/views/nested/menu1/menu1-3/index.vue +0 -5
- package/examples/views/nested/menu2/index.vue +0 -5
- package/gulpfile.js +0 -84
- package/packages/button/index.vue +0 -189
- package/packages/core/components/comp.vue +0 -223
- package/packages/core/components/position.vue +0 -135
- package/packages/core/components/render.vue +0 -460
- package/packages/core/configManager.js +0 -302
- package/packages/core/create.js +0 -8
- package/packages/core/defaultRender.js +0 -64
- package/packages/core/dict/global.js +0 -10
- package/packages/core/dict/index.js +0 -432
- package/packages/core/dict/mixin.js +0 -94
- package/packages/core/event.js +0 -60
- package/packages/core/index.js +0 -6
- package/packages/core/init.js +0 -122
- package/packages/core/mock/genConfig.js +0 -228
- package/packages/core/mock/genData.js +0 -422
- package/packages/core/mock/index.js +0 -4
- package/packages/core/rules.js +0 -111
- package/packages/crud/column.vue +0 -205
- package/packages/crud/columnAction.vue +0 -207
- package/packages/crud/columnCell.vue +0 -146
- package/packages/crud/defaultColumn.vue +0 -130
- package/packages/crud/drawerColumn.vue +0 -225
- package/packages/crud/form.vue +0 -69
- package/packages/crud/index.vue +0 -564
- package/packages/crud/menuBar.vue +0 -298
- package/packages/crud/mixins/cacheHandler.js +0 -36
- package/packages/crud/mixins/calcColumnWidth.js +0 -79
- package/packages/crud/mixins/calcHeight.js +0 -105
- package/packages/crud/mixins/columnHandler.js +0 -128
- package/packages/crud/mixins/contextMenu.js +0 -98
- package/packages/crud/mixins/dataProcessor.js +0 -202
- package/packages/crud/mixins/dialog.js +0 -109
- package/packages/crud/mixins/excelHandler.js +0 -150
- package/packages/crud/mixins/exposeMethods.js +0 -107
- package/packages/crud/mixins/generateDynamicColumns.js +0 -250
- package/packages/crud/mixins/props.js +0 -38
- package/packages/crud/mixins/searchHandler.js +0 -151
- package/packages/crud/mixins/select.js +0 -359
- package/packages/crud/mixins/spanMethod.js +0 -288
- package/packages/crud/mixins/summary.js +0 -177
- package/packages/crud/mixins/tableEdit.js +0 -547
- package/packages/crud/mixins/validate.js +0 -219
- package/packages/crud/pagination.vue +0 -110
- package/packages/crud/search.vue +0 -119
- package/packages/crud/searchHeader.vue +0 -231
- package/packages/crud/selectBanner.vue +0 -138
- package/packages/crud/utils/EditState.js +0 -319
- package/packages/crud/utils/excelExport.js +0 -112
- package/packages/crud/utils/excelImport.js +0 -112
- package/packages/crud/utils/index.js +0 -98
- package/packages/dialog/dialog.js +0 -233
- package/packages/dialog/dialog.vue +0 -15
- package/packages/dialog/index.js +0 -22
- package/packages/dict/cascadeFormat.vue +0 -179
- package/packages/dict/dateFormat.vue +0 -40
- package/packages/dict/form/cascade.vue +0 -61
- package/packages/dict/form/checkbox.vue +0 -90
- package/packages/dict/form/extendMethod.js +0 -22
- package/packages/dict/form/input-base.js +0 -31
- package/packages/dict/form/input.js +0 -20
- package/packages/dict/form/radio.vue +0 -69
- package/packages/dict/form/select.vue +0 -118
- package/packages/dict/form/switch.vue +0 -75
- package/packages/dict/valueFormat.vue +0 -188
- package/packages/directive/dialog/drag.js +0 -86
- package/packages/directive/dialog/dragSize.js +0 -42
- package/packages/directive/index.js +0 -9
- package/packages/directive/insertSlot.js +0 -10
- package/packages/form/contextMenu.js +0 -192
- package/packages/form/draftDrawer.vue +0 -391
- package/packages/form/formAction.vue +0 -97
- package/packages/form/formItem.vue +0 -259
- package/packages/form/index.vue +0 -451
- package/packages/form/props.js +0 -15
- package/packages/grid/cell.vue +0 -65
- package/packages/grid/index.vue +0 -130
- package/packages/group/index.vue +0 -96
- package/packages/tabs/index.vue +0 -290
- package/packages/tooltip/index.js +0 -9
- package/packages/tooltip/tooltip.vue +0 -32
- package/packages/tooltip/tooltipComponent.js +0 -38
- package/packages/verifyInput/index.vue +0 -131
- package/styles/button.scss +0 -3
- package/styles/crud.scss +0 -425
- package/styles/dialog.scss +0 -95
- package/styles/form.scss +0 -532
- package/styles/group.scss +0 -78
- package/styles/index.scss +0 -94
- package/styles/tabs.scss +0 -139
- package/styles/verifyInput.scss +0 -56
- package/vue-jsx-sync.js +0 -90
- package/vue.config.js +0 -54
@@ -1,377 +0,0 @@
|
|
1
|
-
# 表格编辑
|
2
|
-
|
3
|
-
表格编辑功能允许用户直接在表格中编辑数据,支持行编辑、单元格编辑和自由编辑等多种模式,以及多种触发方式。
|
4
|
-
|
5
|
-
## 基础配置
|
6
|
-
通过 editConfig 配置表格的编辑模式和触发方式。 </br>
|
7
|
-
编辑模式下,默认渲染`input`组件,需要通过包裹一层 `form` 对象才能自定义配置编辑组件。
|
8
|
-
|
9
|
-
```js
|
10
|
-
options: {
|
11
|
-
editConfig: {
|
12
|
-
// 编辑模式:row(行编辑)、cell(单元格编辑)、free(自由编辑)、dialog(弹窗编辑)
|
13
|
-
mode: 'row',
|
14
|
-
// 触发方式:manual(手动)、click(单击)、dblclick(双击)
|
15
|
-
trigger: 'manual',
|
16
|
-
// 编辑按钮触发
|
17
|
-
edit: true,
|
18
|
-
},
|
19
|
-
renderColumns: [
|
20
|
-
{
|
21
|
-
prop: 'name',
|
22
|
-
label: '姓名',
|
23
|
-
form: { // 自定义编辑组件配置
|
24
|
-
comp: {
|
25
|
-
name: 'el-select',
|
26
|
-
options: [
|
27
|
-
{
|
28
|
-
label: '选项1',
|
29
|
-
value: '选项1',
|
30
|
-
}
|
31
|
-
]
|
32
|
-
},
|
33
|
-
}
|
34
|
-
}
|
35
|
-
]
|
36
|
-
}
|
37
|
-
```
|
38
|
-
|
39
|
-
|
40
|
-
## 自由编辑
|
41
|
-
|
42
|
-
### 全局自由编辑
|
43
|
-
|
44
|
-
`mode: free` 自由编辑 </br>
|
45
|
-
自由编辑模式下,所有可编辑的单元格始终处于编辑状态。
|
46
|
-
|
47
|
-
<ClientOnly>
|
48
|
-
<common-code-format>
|
49
|
-
<crud-tableEdit-free slot="source"></crud-tableEdit-free>
|
50
|
-
|
51
|
-
<<< @/docs/.vuepress/components/crud/tableEdit/free.vue
|
52
|
-
</common-code-format>
|
53
|
-
</ClientOnly>
|
54
|
-
|
55
|
-
### 单列自由编辑
|
56
|
-
|
57
|
-
`isEdit` 设置单列自由编辑 </br>
|
58
|
-
|
59
|
-
<ClientOnly>
|
60
|
-
<common-code-format>
|
61
|
-
<crud-tableEdit-freeColumn slot="source"></crud-tableEdit-freeColumn>
|
62
|
-
|
63
|
-
<<< @/docs/.vuepress/components/crud/tableEdit/freeColumn.vue
|
64
|
-
</common-code-format>
|
65
|
-
</ClientOnly>
|
66
|
-
|
67
|
-
|
68
|
-
## 行编辑
|
69
|
-
|
70
|
-
### 手动触发 - 操作列
|
71
|
-
|
72
|
-
通过操作列编辑按钮 `edit`触发编辑状态。
|
73
|
-
|
74
|
-
```js
|
75
|
-
editConfig: {
|
76
|
-
mode: "row",
|
77
|
-
trigger: "manual",
|
78
|
-
edit: {} // 操作列按钮配置
|
79
|
-
}
|
80
|
-
```
|
81
|
-
|
82
|
-
#### 事件处理
|
83
|
-
|
84
|
-
`@edit(done, scope)` 点击编辑触发,参数`done(params)`,可设置编辑后的行数据 </br>
|
85
|
-
`@save(done, scope, unLoading)` 点击保存触发,参数`done(params)`,可设置保存后的行数据 </br>
|
86
|
-
`@cancel(done, scope)` 点击取消触发 </br>
|
87
|
-
|
88
|
-
<ClientOnly>
|
89
|
-
<common-code-format>
|
90
|
-
<crud-tableEdit-rowAction slot="source"></crud-tableEdit-rowAction>
|
91
|
-
|
92
|
-
<<< @/docs/.vuepress/components/crud/tableEdit/rowAction.vue
|
93
|
-
</common-code-format>
|
94
|
-
</ClientOnly>
|
95
|
-
|
96
|
-
### 手动触发 - 批量编辑
|
97
|
-
|
98
|
-
通过批量编辑按钮 `batch` 触发编辑状态。
|
99
|
-
|
100
|
-
```js
|
101
|
-
editConfig: {
|
102
|
-
mode: "row",
|
103
|
-
trigger: "manual",
|
104
|
-
batch: {
|
105
|
-
isSelect: true, // 是否批量编辑选中项,搭配selection使用
|
106
|
-
} // 批量操作按钮配置
|
107
|
-
}
|
108
|
-
```
|
109
|
-
|
110
|
-
#### 事件处理
|
111
|
-
|
112
|
-
`@batchEdit(done, rows)` 点击批量编辑触发,参数`done(rows)`,可传递需要编辑的行,默认编辑所有行 </br>
|
113
|
-
`@batchSave(done, rows)` 点击批量保存触发,参数`done(rows)`,可传递需要保存的行,默认保存所有编辑行 </br>
|
114
|
-
`@batchCancel(done, rows)` 点击批量取消触发,参数`done(rows)`,可传递需要取消的行,默认取消所有编辑行 </br>
|
115
|
-
|
116
|
-
<ClientOnly>
|
117
|
-
<common-code-format>
|
118
|
-
<crud-tableEdit-rowBatch slot="source"></crud-tableEdit-rowBatch>
|
119
|
-
|
120
|
-
<<< @/docs/.vuepress/components/crud/tableEdit/rowBatch.vue
|
121
|
-
</common-code-format>
|
122
|
-
</ClientOnly>
|
123
|
-
|
124
|
-
### 手动触发 - 调用方法
|
125
|
-
|
126
|
-
<ClientOnly>
|
127
|
-
<common-code-format>
|
128
|
-
<crud-tableEdit-methods slot="source"></crud-tableEdit-methods>
|
129
|
-
|
130
|
-
<<< @/docs/.vuepress/components/crud/tableEdit/methods.vue
|
131
|
-
</common-code-format>
|
132
|
-
</ClientOnly>
|
133
|
-
|
134
|
-
|
135
|
-
### 单击触发
|
136
|
-
|
137
|
-
点击行时触发编辑状态。
|
138
|
-
|
139
|
-
```js
|
140
|
-
editConfig: {
|
141
|
-
mode: "row",
|
142
|
-
trigger: "click",
|
143
|
-
}
|
144
|
-
```
|
145
|
-
|
146
|
-
#### 事件处理
|
147
|
-
|
148
|
-
`@edit(done, scope)` 点击编辑触发,参数`done(params)`,可设置编辑后的行数据 </br>
|
149
|
-
`@save(done, scope, unLoading)` 点击保存触发,参数`done(params)`,可设置保存后的行数据 </br>
|
150
|
-
|
151
|
-
<ClientOnly>
|
152
|
-
<common-code-format>
|
153
|
-
<crud-tableEdit-rowClick slot="source"></crud-tableEdit-rowClick>
|
154
|
-
|
155
|
-
<<< @/docs/.vuepress/components/crud/tableEdit/rowClick.vue
|
156
|
-
</common-code-format>
|
157
|
-
</ClientOnly>
|
158
|
-
|
159
|
-
|
160
|
-
## 单元格编辑
|
161
|
-
|
162
|
-
单元格编辑模式下,点击或双击单元格时,只有该单元格进入编辑状态
|
163
|
-
|
164
|
-
```js
|
165
|
-
editConfig: {
|
166
|
-
mode: "cell",
|
167
|
-
}
|
168
|
-
```
|
169
|
-
|
170
|
-
#### 事件处理
|
171
|
-
|
172
|
-
`@edit(done, scope, column)` 点击编辑触发,参数`done(params)`,可设置编辑后的数据 </br>
|
173
|
-
`@save(done, value, scope, column, unLoading)` 点击保存触发,参数`done(params)`,可设置保存后的数据 </br>
|
174
|
-
|
175
|
-
<ClientOnly>
|
176
|
-
<common-code-format>
|
177
|
-
<crud-tableEdit-cellEdit slot="source"></crud-tableEdit-cellEdit>
|
178
|
-
|
179
|
-
<<< @/docs/.vuepress/components/crud/tableEdit/cellEdit.vue
|
180
|
-
</common-code-format>
|
181
|
-
</ClientOnly>
|
182
|
-
|
183
|
-
## 控制编辑状态
|
184
|
-
|
185
|
-
`isRowEdit` 控制行编辑状态 </br>
|
186
|
-
`isEdit` 控制列与单元格编辑状态
|
187
|
-
|
188
|
-
```js
|
189
|
-
options: {
|
190
|
-
editConfig: {
|
191
|
-
isRowEdit: (row) => { //控制行编辑状态
|
192
|
-
return row.id % 2 === 0;
|
193
|
-
}
|
194
|
-
}
|
195
|
-
renderColumns: [
|
196
|
-
{
|
197
|
-
prop: 'name',
|
198
|
-
label: '姓名',
|
199
|
-
isEdit: (row) => { //控制单元格编辑状态
|
200
|
-
return row.id % 2 === 0;
|
201
|
-
}
|
202
|
-
}
|
203
|
-
]
|
204
|
-
}
|
205
|
-
```
|
206
|
-
<ClientOnly>
|
207
|
-
<common-code-format>
|
208
|
-
<crud-tableEdit-controlEdit slot="source"></crud-tableEdit-controlEdit>
|
209
|
-
|
210
|
-
<<< @/docs/.vuepress/components/crud/tableEdit/controlEdit.vue
|
211
|
-
</common-code-format>
|
212
|
-
</ClientOnly>
|
213
|
-
|
214
|
-
|
215
|
-
## 新增删除操作
|
216
|
-
|
217
|
-
### 基本配置
|
218
|
-
|
219
|
-
```js
|
220
|
-
editConfig: {
|
221
|
-
mode: 'row',
|
222
|
-
trigger: 'manual',
|
223
|
-
rowEdit: {
|
224
|
-
hasPermi: ['xx'] // 可以用于设置按钮权限等
|
225
|
-
},
|
226
|
-
// 底部新增行按钮配置
|
227
|
-
lastAdd: {
|
228
|
-
type: 'last', // first(第一行新增)、last(最后一行新增)
|
229
|
-
},
|
230
|
-
// 新增行按钮配置
|
231
|
-
rowAdd: {
|
232
|
-
type: 'first', // first(第一行新增)、last(最后一行新增)
|
233
|
-
},
|
234
|
-
// 批量删除按钮配置
|
235
|
-
batchDelete: {
|
236
|
-
confirm: (rows) => `是否删除序号为${rows.map(row => row.$index + 1).join(',')}的数据?`, // 删除提示
|
237
|
-
},
|
238
|
-
// 删除按钮配置
|
239
|
-
delete: {
|
240
|
-
confirm: (scope) => `是否删除序号为${scope.$index + 1}的数据?`, // 删除提示
|
241
|
-
},
|
242
|
-
},
|
243
|
-
```
|
244
|
-
|
245
|
-
### 事件处理
|
246
|
-
|
247
|
-
`@add` 点击新增触发,参数`done(params)`,可设置新增的行数据 </br>
|
248
|
-
`@delete` 点击删除触发 </br>
|
249
|
-
`@batchDelete` 点击批量删除触发 </br>
|
250
|
-
|
251
|
-
|
252
|
-
<ClientOnly>
|
253
|
-
<common-code-format>
|
254
|
-
<crud-tableEdit-addDeleteBtn slot="source"></crud-tableEdit-addDeleteBtn>
|
255
|
-
|
256
|
-
<<< @/docs/.vuepress/components/crud/tableEdit/addDeleteBtn.vue
|
257
|
-
</common-code-format>
|
258
|
-
</ClientOnly>
|
259
|
-
|
260
|
-
|
261
|
-
## 弹窗编辑
|
262
|
-
|
263
|
-
### 基本配置
|
264
|
-
|
265
|
-
```js
|
266
|
-
options: {
|
267
|
-
editConfig: {
|
268
|
-
mode: 'dialog',
|
269
|
-
// 编辑按钮配置
|
270
|
-
edit: {},
|
271
|
-
// 新增按钮配置
|
272
|
-
add: {
|
273
|
-
type: 'first', // first(第一行新增)、last(最后一行新增)
|
274
|
-
},
|
275
|
-
// 查看按钮配置
|
276
|
-
view: {},
|
277
|
-
},
|
278
|
-
dialog: {}, // 自定义弹窗配置
|
279
|
-
formOptions: {}, // 自定义表单配置
|
280
|
-
}
|
281
|
-
```
|
282
|
-
|
283
|
-
### 事件处理
|
284
|
-
|
285
|
-
`@add` 点击新增触发 </br>
|
286
|
-
`@edit` 点击编辑触发 </br>
|
287
|
-
`@save` 点击保存触发 </br>
|
288
|
-
`@view` 点击查看触发 </br>
|
289
|
-
|
290
|
-
<ClientOnly>
|
291
|
-
<common-code-format>
|
292
|
-
<crud-tableEdit-dialog slot="source"></crud-tableEdit-dialog>
|
293
|
-
|
294
|
-
<<< @/docs/.vuepress/components/crud/tableEdit/dialog.vue
|
295
|
-
</common-code-format>
|
296
|
-
</ClientOnly>
|
297
|
-
|
298
|
-
|
299
|
-
## API
|
300
|
-
|
301
|
-
### editConfig 配置
|
302
|
-
|
303
|
-
| 参数 | 说明 | 类型 | 可选值 |
|
304
|
-
| ----------- | -------------------------------- | ----------------------- | --------------------- |
|
305
|
-
| mode | 编辑模式 | string | free,cell,row,dialog |
|
306
|
-
| trigger | 触发方式 | string | manual,click,dblclick |
|
307
|
-
| edit | 编辑按钮配置 | object | - |
|
308
|
-
| batch | 批量操作按钮配置,仅限`row`模式 | object | - |
|
309
|
-
| add | 新增按钮配置 | object | - |
|
310
|
-
| lastAdd | 底部新增行按钮配置 | object | - |
|
311
|
-
| batchDelete | 批量删除按钮配置 | object | - |
|
312
|
-
| delete | 删除按钮配置 | object | - |
|
313
|
-
| view | 查看按钮配置,仅限`dialog`模式 | object | - |
|
314
|
-
| isRowEdit | 控制行是否可编辑 | function({row, $index}) | - |
|
315
|
-
| autofocus | 是否自动聚焦,支持字符串(prop) | boolean/string | true |
|
316
|
-
| exclusive | 行编辑是否互斥(同时只能编辑一行) | boolean | false |
|
317
|
-
|
318
|
-
### Column 配置
|
319
|
-
|
320
|
-
| 参数 | 说明 | 类型 | 默认值 |
|
321
|
-
| ----------------- | -------------------- | ------------------------------- | ----------------- |
|
322
|
-
| isEdit | 是否可编辑 | boolean/function({row, $index}) | false |
|
323
|
-
| add | 仅自定义新增组件 | boolean/Object | 默认继承form配置 |
|
324
|
-
| edit | 仅自定义编辑组件 | boolean/Object | 默认继承form配置 |
|
325
|
-
| form | 自定义编辑、新增组件 | boolean/Object | - |
|
326
|
-
| form.prop | 编辑字段 | boolean/Object | 默认继承列的prop |
|
327
|
-
| form.comp | 编辑组件 | object | el-input |
|
328
|
-
| form.render | 编辑组件渲染函数 | function | - |
|
329
|
-
| form.validateProp | 编辑组件验证字段 | string | 默认继承form.prop |
|
330
|
-
|
331
|
-
### slots
|
332
|
-
|
333
|
-
| 插槽名 | 说明 | 默认值 |
|
334
|
-
| ------------- | -------------------- | ------------ |
|
335
|
-
| `{prop}-form` | 自定义编辑、新增组件 | - |
|
336
|
-
| `{prop}-add` | 仅自定义新增组件 | 默认继承form |
|
337
|
-
| `{prop}-edit` | 仅自定义编辑组件 | 默认继承form |
|
338
|
-
|
339
|
-
|
340
|
-
### Events
|
341
|
-
|
342
|
-
|
343
|
-
| 事件名 | 说明 | 参数 |
|
344
|
-
| ----------------- | --------------------------------- | ------------------------------- |
|
345
|
-
| @add | 点击新增按钮时 | done(params), scope |
|
346
|
-
| @edit | 点击编辑按钮时 | done(params), scope |
|
347
|
-
| @save | 点击保存按钮时 | done(params), scope, unLoading |
|
348
|
-
| @cancel | 点击取消按钮时 | done(params), scope |
|
349
|
-
| @delete | 点击删除按钮时 | done, scope, unLoading |
|
350
|
-
| @view | 点击查看按钮时,仅限`dialog`模式 | done, scope |
|
351
|
-
| @batchEdit | 点击批量编辑按钮时,仅限`row`模式 | done(rows), rows |
|
352
|
-
| @batchSave | 点击批量保存按钮时,仅限`row`模式 | done(rows), rows, unLoading |
|
353
|
-
| @batchCancel | 点击批量取消按钮时,仅限`row`模式 | done(rows) |
|
354
|
-
| @batchDelete | 点击批量删除按钮时,仅限`row`模式 | done, rows, unLoading |
|
355
|
-
| @editStatusChange | 编辑状态变化时触发 | {mode, rowKey, row, prop, type} |
|
356
|
-
|
357
|
-
### Methods
|
358
|
-
|
359
|
-
| 方法名 | 说明 | 参数 | 返回值 |
|
360
|
-
| -------------- | ---------------------------------------- | ----------------------------------------------------------- | ------ |
|
361
|
-
| setRowEdit | 设置行编辑状态 | (rows: object/array, options: {type: string, prop: string}) | - |
|
362
|
-
| setBatchEdit | 批量设置行编辑状态,不传rows则设置所有行 | (type: string, rows: object/array) | - |
|
363
|
-
| setCellEdit | 设置单元格编辑状态 | (row: object, prop: string) | - |
|
364
|
-
| addRow | 新增表格行 | (params: object, type: first/last) | - |
|
365
|
-
| clearAllEdit | 清除所有编辑状态 | - | - |
|
366
|
-
| getEditingRows | 获取所有编辑状态的行 | - | array |
|
367
|
-
|
368
|
-
### options 快捷配置
|
369
|
-
|
370
|
-
| 参数 | 说明 | 类型 | 默认值 |
|
371
|
-
| ------------ | ----------------------- | ----------------------- | ------ |
|
372
|
-
| freeEdit | 启用自由编辑模式 | boolean | false |
|
373
|
-
| cellEdit | 启用单元格编辑模式 | boolean | false |
|
374
|
-
| rowEdit | 启用行编辑模式 | boolean | false |
|
375
|
-
| batchEdit | 启用批量编辑模式 | boolean | false |
|
376
|
-
| batchRowEdit | 启用行编辑+批量编辑模式 | boolean | false |
|
377
|
-
| isRowEdit | 控制行是否可编辑的函数 | function({row, $index}) | - |
|
@@ -1,158 +0,0 @@
|
|
1
|
-
# 表格校验
|
2
|
-
|
3
|
-
表格组件支持表单校验功能,包括必填校验、正则校验和自定义校验规则。同时提供了错误提示和错误状态管理。
|
4
|
-
|
5
|
-
## 基础用法
|
6
|
-
|
7
|
-
通过配置列的 `required` 属性来启用必填校验。支持布尔值和对象两种配置方式:
|
8
|
-
|
9
|
-
```js
|
10
|
-
renderColumns: [
|
11
|
-
{
|
12
|
-
prop: "name",
|
13
|
-
label: "姓名",
|
14
|
-
required: true // 简单配置
|
15
|
-
},
|
16
|
-
{
|
17
|
-
prop: "age",
|
18
|
-
label: "年龄",
|
19
|
-
required: { // 详细配置
|
20
|
-
message: "年龄不能为空",
|
21
|
-
trigger: "blur"
|
22
|
-
}
|
23
|
-
}
|
24
|
-
]
|
25
|
-
```
|
26
|
-
|
27
|
-
<ClientOnly>
|
28
|
-
<common-code-format>
|
29
|
-
<crud-validate-base slot="source"></crud-validate-base>
|
30
|
-
|
31
|
-
<<< @/docs/.vuepress/components/crud/validate/base.vue
|
32
|
-
</common-code-format>
|
33
|
-
</ClientOnly>
|
34
|
-
|
35
|
-
## 正则校验
|
36
|
-
|
37
|
-
通过配置列的 `rules` 属性来添加正则校验规则。支持内置正则模板和自定义正则对象:
|
38
|
-
|
39
|
-
```js
|
40
|
-
renderColumns: [
|
41
|
-
{
|
42
|
-
prop: "phone",
|
43
|
-
label: "手机号",
|
44
|
-
rules: ["integer"] // 使用内置正则或预设规则
|
45
|
-
},
|
46
|
-
{
|
47
|
-
prop: "email",
|
48
|
-
label: "邮箱",
|
49
|
-
rules: [{ // 自定义正则
|
50
|
-
regular: /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/,
|
51
|
-
message: "请输入正确的邮箱格式"
|
52
|
-
}]
|
53
|
-
}
|
54
|
-
]
|
55
|
-
```
|
56
|
-
|
57
|
-
<ClientOnly>
|
58
|
-
<common-code-format>
|
59
|
-
<crud-validate-regulars slot="source"></crud-validate-regulars>
|
60
|
-
|
61
|
-
<<< @/docs/.vuepress/components/crud/validate/regulars.vue
|
62
|
-
</common-code-format>
|
63
|
-
</ClientOnly>
|
64
|
-
|
65
|
-
## 自定义校验
|
66
|
-
|
67
|
-
通过配置 `rules` 的 validator 函数来自定义校验规则。支持获取 `scope` 参数:
|
68
|
-
|
69
|
-
```js
|
70
|
-
renderColumns: [
|
71
|
-
{
|
72
|
-
prop: "age",
|
73
|
-
label: "年龄",
|
74
|
-
rules: [{
|
75
|
-
validator: (rule, value, callback, scope) => {
|
76
|
-
if (value < 18) {
|
77
|
-
callback(new Error("年龄不能小于18岁"));
|
78
|
-
} else {
|
79
|
-
callback();
|
80
|
-
}
|
81
|
-
},
|
82
|
-
trigger: "change"
|
83
|
-
}]
|
84
|
-
},
|
85
|
-
{
|
86
|
-
prop: "age",
|
87
|
-
label: "年龄",
|
88
|
-
rules: (scope)=>[{
|
89
|
-
validator: (rule, value, callback) => {
|
90
|
-
if (value < 18) {
|
91
|
-
callback(new Error("年龄不能小于18岁"));
|
92
|
-
} else {
|
93
|
-
callback();
|
94
|
-
}
|
95
|
-
},
|
96
|
-
trigger: "change"
|
97
|
-
}]
|
98
|
-
}
|
99
|
-
]
|
100
|
-
```
|
101
|
-
|
102
|
-
<ClientOnly>
|
103
|
-
<common-code-format>
|
104
|
-
<crud-validate-custom slot="source"></crud-validate-custom>
|
105
|
-
|
106
|
-
<<< @/docs/.vuepress/components/crud/validate/custom.vue
|
107
|
-
</common-code-format>
|
108
|
-
</ClientOnly>
|
109
|
-
|
110
|
-
|
111
|
-
## 树级校验
|
112
|
-
|
113
|
-
<ClientOnly>
|
114
|
-
<common-code-format>
|
115
|
-
<crud-validate-tree slot="source"></crud-validate-tree>
|
116
|
-
|
117
|
-
<<< @/docs/.vuepress/components/crud/validate/tree.vue
|
118
|
-
</common-code-format>
|
119
|
-
</ClientOnly>
|
120
|
-
|
121
|
-
|
122
|
-
## 联动校验
|
123
|
-
|
124
|
-
通过方法 `validateField` 函数来精确控制每个校验单元格。
|
125
|
-
|
126
|
-
<ClientOnly>
|
127
|
-
<common-code-format>
|
128
|
-
<crud-validate-relation slot="source"></crud-validate-relation>
|
129
|
-
|
130
|
-
<<< @/docs/.vuepress/components/crud/validate/relation.vue
|
131
|
-
</common-code-format>
|
132
|
-
</ClientOnly>
|
133
|
-
|
134
|
-
## API
|
135
|
-
|
136
|
-
### Column 配置
|
137
|
-
|
138
|
-
| 参数 | 说明 | 类型 | 默认值 |
|
139
|
-
| -------- | -------- | ---------------------------- | ------ |
|
140
|
-
| required | 是否必填 | boolean/object | false |
|
141
|
-
| rules | 校验规则 | string/array/function(scope) | - |
|
142
|
-
|
143
|
-
### 实例方法
|
144
|
-
|
145
|
-
| 方法名 | 说明 | 参数 | 返回值 |
|
146
|
-
| ------------- | ------------ | ----------------------------- | ------- |
|
147
|
-
| validate | 校验整个表格 | callback(可选) | Promise |
|
148
|
-
| validateField | 校验指定行 | options: {index/id/row, prop} | Promise |
|
149
|
-
| clearValidate | 清除校验 | - | - |
|
150
|
-
|
151
|
-
### validateField Options
|
152
|
-
|
153
|
-
| 参数 | 说明 | 类型 |
|
154
|
-
| ----- | ------------ | ------------- |
|
155
|
-
| index | 行索引 | number |
|
156
|
-
| id | 行ID | string/number |
|
157
|
-
| row | 行数据对象 | object |
|
158
|
-
| prop | 校验的字段名 | string |
|
@@ -1,81 +0,0 @@
|
|
1
|
-
# 基本使用
|
2
|
-
|
3
|
-
## 基本使用
|
4
|
-
|
5
|
-
`title` 标题、`width` 宽度 。详情参考element-ui弹窗组件配置[element-ui](https://element.eleme.cn/#/zh-CN/component/dialog) </br>
|
6
|
-
`show()` 打开弹窗 </br>
|
7
|
-
弹窗渲染方式依旧为通用的 `render函数`,`component配置`</br>
|
8
|
-
|
9
|
-
<ClientOnly>
|
10
|
-
<common-code-format>
|
11
|
-
<dialog-baseUse-base slot="source"></dialog-baseUse-base>
|
12
|
-
|
13
|
-
<<< @/docs/.vuepress/components/dialog/baseUse/base.vue
|
14
|
-
</common-code-format>
|
15
|
-
</ClientOnly>
|
16
|
-
|
17
|
-
## 通过实例控制弹窗
|
18
|
-
|
19
|
-
`hide()` 手动关闭弹窗 </br>
|
20
|
-
`loading` 控制loading
|
21
|
-
|
22
|
-
<ClientOnly>
|
23
|
-
<common-code-format>
|
24
|
-
<dialog-baseUse-control slot="source"></dialog-baseUse-control>
|
25
|
-
|
26
|
-
<<< @/docs/.vuepress/components/dialog/baseUse/control.vue
|
27
|
-
</common-code-format>
|
28
|
-
</ClientOnly>
|
29
|
-
|
30
|
-
<!-- ## v-insertSlot插入插槽渲染弹窗
|
31
|
-
|
32
|
-
`v-insertSlot` 获取模板,插入弹窗实例</br>
|
33
|
-
|
34
|
-
<ClientOnly>
|
35
|
-
<common-code-format>
|
36
|
-
<dialog-baseUse-insertSlot slot="source"></dialog-baseUse-insertSlot>
|
37
|
-
|
38
|
-
<<< @/docs/.vuepress/components/dialog/baseUse/insertSlot.vue
|
39
|
-
</common-code-format>
|
40
|
-
</ClientOnly> -->
|
41
|
-
|
42
|
-
|
43
|
-
## 确认,取消关闭前方法
|
44
|
-
|
45
|
-
`confirm` 确认之前、`cancel` 取消之前</br>
|
46
|
-
|
47
|
-
<ClientOnly>
|
48
|
-
<common-code-format>
|
49
|
-
<dialog-baseUse-beforeConfirm slot="source"></dialog-baseUse-beforeConfirm>
|
50
|
-
|
51
|
-
<<< @/docs/.vuepress/components/dialog/baseUse/beforeConfirm.vue
|
52
|
-
</common-code-format>
|
53
|
-
</ClientOnly>
|
54
|
-
|
55
|
-
|
56
|
-
## 自定义底部按钮
|
57
|
-
|
58
|
-
`footer` 自定义底部按钮</br>
|
59
|
-
`footer.align` 底部对齐方式</br>
|
60
|
-
`footer` 为`false`时或 `footer.hidden` 为`true` 隐藏底部
|
61
|
-
|
62
|
-
<ClientOnly>
|
63
|
-
<common-code-format>
|
64
|
-
<dialog-baseUse-footer slot="source"></dialog-baseUse-footer>
|
65
|
-
|
66
|
-
<<< @/docs/.vuepress/components/dialog/baseUse/footer.vue
|
67
|
-
</common-code-format>
|
68
|
-
</ClientOnly>
|
69
|
-
|
70
|
-
|
71
|
-
## 抽屉式弹窗
|
72
|
-
|
73
|
-
`drawer` 抽屉式弹窗, 详情参考element-ui抽屉组件配置[element-ui](https://element.eleme.cn/#/zh-CN/component/drawer)
|
74
|
-
|
75
|
-
<ClientOnly>
|
76
|
-
<common-code-format>
|
77
|
-
<dialog-baseUse-drawer slot="source"></dialog-baseUse-drawer>
|
78
|
-
|
79
|
-
<<< @/docs/.vuepress/components/dialog/baseUse/drawer.vue
|
80
|
-
</common-code-format>
|
81
|
-
</ClientOnly>
|