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,219 +0,0 @@
|
|
1
|
-
<template>
|
2
|
-
<div>
|
3
|
-
<div class="demo-section">
|
4
|
-
<h3>控制行编辑状态:</h3>
|
5
|
-
<el-button @click="handleRowChange(0)">禁用第一行</el-button>
|
6
|
-
<el-button @click="handleRowChange(1)">禁用第二行</el-button>
|
7
|
-
<el-button @click="handleRowChange(2)">禁用第三行</el-button>
|
8
|
-
<el-button @click="handleRowChange(null)">取消禁用</el-button>
|
9
|
-
</div>
|
10
|
-
|
11
|
-
<div style="margin-bottom: 20px;">
|
12
|
-
<h3>控制列编辑状态:</h3>
|
13
|
-
<el-button @click="handleColumnChange('name')">禁用姓名列</el-button>
|
14
|
-
<el-button @click="handleColumnChange('gender')">禁用性别列</el-button>
|
15
|
-
<el-button @click="handleColumnChange('age')">禁用年龄列</el-button>
|
16
|
-
<el-button @click="handleColumnChange(null)">取消禁用</el-button>
|
17
|
-
</div>
|
18
|
-
|
19
|
-
<div style="margin-bottom: 20px;">
|
20
|
-
<h3>控制单元格编辑状态:</h3>
|
21
|
-
<el-button @click="handleCellChange('name')"
|
22
|
-
>禁用姓名第一个单元格</el-button
|
23
|
-
>
|
24
|
-
<el-button @click="handleCellChange('gender')"
|
25
|
-
>禁用性别第一个单元格</el-button
|
26
|
-
>
|
27
|
-
<el-button @click="handleCellChange('age')"
|
28
|
-
>禁用年龄第一个单元格</el-button
|
29
|
-
>
|
30
|
-
<el-button @click="handleCellChange(null)">取消禁用</el-button>
|
31
|
-
</div>
|
32
|
-
|
33
|
-
<sc-crud
|
34
|
-
:search.sync="searchForm"
|
35
|
-
ref="crud"
|
36
|
-
:options="options"
|
37
|
-
:data="data"
|
38
|
-
>
|
39
|
-
</sc-crud>
|
40
|
-
</div>
|
41
|
-
</template>
|
42
|
-
|
43
|
-
<script>
|
44
|
-
export default {
|
45
|
-
data() {
|
46
|
-
return {
|
47
|
-
searchForm: {},
|
48
|
-
data: [
|
49
|
-
{
|
50
|
-
id: 1,
|
51
|
-
name: "张三",
|
52
|
-
gender: "男",
|
53
|
-
age: 20,
|
54
|
-
city: "北京",
|
55
|
-
date: "2021-01-01",
|
56
|
-
},
|
57
|
-
{
|
58
|
-
id: 2,
|
59
|
-
name: "李四",
|
60
|
-
gender: "女",
|
61
|
-
age: 21,
|
62
|
-
city: "上海",
|
63
|
-
date: "2021-01-02",
|
64
|
-
},
|
65
|
-
{
|
66
|
-
id: 3,
|
67
|
-
name: "王五",
|
68
|
-
gender: "男",
|
69
|
-
age: 22,
|
70
|
-
city: "广州",
|
71
|
-
date: "2021-01-03",
|
72
|
-
},
|
73
|
-
{
|
74
|
-
id: 4,
|
75
|
-
name: "赵六",
|
76
|
-
gender: "女",
|
77
|
-
age: 23,
|
78
|
-
city: "深圳",
|
79
|
-
date: "2021-01-04",
|
80
|
-
},
|
81
|
-
],
|
82
|
-
disabledRowIndex: null,
|
83
|
-
disabledCellProp: null,
|
84
|
-
disabledCell: { row: null, prop: null },
|
85
|
-
};
|
86
|
-
},
|
87
|
-
computed: {
|
88
|
-
options() {
|
89
|
-
return {
|
90
|
-
editConfig: {
|
91
|
-
mode: "row",
|
92
|
-
batch: true,
|
93
|
-
edit: true,
|
94
|
-
isRowEdit: ({ row, $index }) => {
|
95
|
-
// 如果设置了禁用行索引,则该行不可编辑
|
96
|
-
if (this.disabledRowIndex !== null) {
|
97
|
-
return $index !== this.disabledRowIndex;
|
98
|
-
}
|
99
|
-
return true;
|
100
|
-
},
|
101
|
-
},
|
102
|
-
renderColumns: [
|
103
|
-
{
|
104
|
-
prop: "name",
|
105
|
-
label: "姓名",
|
106
|
-
isEdit: ({ row, $index }) => {
|
107
|
-
if (
|
108
|
-
this.disabledCell.row === 0 &&
|
109
|
-
this.disabledCell.prop === "name"
|
110
|
-
) {
|
111
|
-
return $index !== 0;
|
112
|
-
}
|
113
|
-
return this.disabledCellProp !== "name";
|
114
|
-
},
|
115
|
-
},
|
116
|
-
{
|
117
|
-
prop: "gender",
|
118
|
-
label: "性别",
|
119
|
-
isEdit: ({ row, $index }) => {
|
120
|
-
if (
|
121
|
-
this.disabledCell.row === 0 &&
|
122
|
-
this.disabledCell.prop === "gender"
|
123
|
-
) {
|
124
|
-
return $index !== 0;
|
125
|
-
}
|
126
|
-
return this.disabledCellProp !== "gender";
|
127
|
-
},
|
128
|
-
form: {
|
129
|
-
comp: {
|
130
|
-
name: "el-select",
|
131
|
-
options: [
|
132
|
-
{ value: "男", label: "男" },
|
133
|
-
{ value: "女", label: "女" },
|
134
|
-
],
|
135
|
-
},
|
136
|
-
},
|
137
|
-
},
|
138
|
-
{
|
139
|
-
prop: "age",
|
140
|
-
label: "年龄",
|
141
|
-
isEdit: ({ row, $index }) => {
|
142
|
-
if (
|
143
|
-
this.disabledCell.row === 0 &&
|
144
|
-
this.disabledCell.prop === "age"
|
145
|
-
) {
|
146
|
-
return $index !== 0;
|
147
|
-
}
|
148
|
-
return this.disabledCellProp !== "age";
|
149
|
-
},
|
150
|
-
form: {
|
151
|
-
comp: {
|
152
|
-
name: "el-select",
|
153
|
-
options: [
|
154
|
-
{ value: 20, label: "20" },
|
155
|
-
{ value: 21, label: "21" },
|
156
|
-
{ value: 22, label: "22" },
|
157
|
-
{ value: 23, label: "23" },
|
158
|
-
],
|
159
|
-
},
|
160
|
-
},
|
161
|
-
},
|
162
|
-
{
|
163
|
-
prop: "city",
|
164
|
-
label: "城市",
|
165
|
-
form: {
|
166
|
-
comp: {
|
167
|
-
name: "el-select",
|
168
|
-
options: [
|
169
|
-
{ value: "北京", label: "北京" },
|
170
|
-
{ value: "上海", label: "上海" },
|
171
|
-
{ value: "广州", label: "广州" },
|
172
|
-
{ value: "深圳", label: "深圳" },
|
173
|
-
],
|
174
|
-
},
|
175
|
-
},
|
176
|
-
},
|
177
|
-
{
|
178
|
-
prop: "date",
|
179
|
-
label: "日期",
|
180
|
-
form: {
|
181
|
-
comp: {
|
182
|
-
name: "el-date-picker",
|
183
|
-
props: {
|
184
|
-
type: "date",
|
185
|
-
placeholder: "选择日期",
|
186
|
-
format: "yyyy-MM-dd",
|
187
|
-
valueFormat: "yyyy-MM-dd",
|
188
|
-
},
|
189
|
-
},
|
190
|
-
},
|
191
|
-
},
|
192
|
-
],
|
193
|
-
};
|
194
|
-
},
|
195
|
-
},
|
196
|
-
methods: {
|
197
|
-
// 控制行编辑状态
|
198
|
-
handleRowChange(index) {
|
199
|
-
this.disabledRowIndex = index;
|
200
|
-
this.$refs.crud.clearAllEdit();
|
201
|
-
},
|
202
|
-
|
203
|
-
// 控制单元格编辑状态
|
204
|
-
handleColumnChange(prop) {
|
205
|
-
this.disabledCellProp = prop;
|
206
|
-
this.$refs.crud.clearAllEdit();
|
207
|
-
},
|
208
|
-
handleCellChange(prop) {
|
209
|
-
if (prop === null) {
|
210
|
-
this.disabledCell = { row: null, prop: null };
|
211
|
-
} else {
|
212
|
-
// 设置第一行的指定列单元格为禁用状态
|
213
|
-
this.disabledCell = { row: 0, prop };
|
214
|
-
}
|
215
|
-
this.$refs.crud.clearAllEdit();
|
216
|
-
},
|
217
|
-
},
|
218
|
-
};
|
219
|
-
</script>
|
@@ -1,172 +0,0 @@
|
|
1
|
-
<template>
|
2
|
-
<div>
|
3
|
-
<sc-crud
|
4
|
-
:search.sync="searchForm"
|
5
|
-
:options="options"
|
6
|
-
:data="data"
|
7
|
-
@add="add"
|
8
|
-
@edit="edit"
|
9
|
-
@view="view"
|
10
|
-
@save="save"
|
11
|
-
>
|
12
|
-
</sc-crud>
|
13
|
-
</div>
|
14
|
-
</template>
|
15
|
-
|
16
|
-
<script>
|
17
|
-
export default {
|
18
|
-
data() {
|
19
|
-
return {
|
20
|
-
searchForm: {},
|
21
|
-
options: {
|
22
|
-
editConfig: {
|
23
|
-
mode: "dialog",
|
24
|
-
edit: {},
|
25
|
-
add: {
|
26
|
-
addType: "first",
|
27
|
-
},
|
28
|
-
view: {},
|
29
|
-
delete: true,
|
30
|
-
lastAdd: {},
|
31
|
-
},
|
32
|
-
dialog: {}, // 自定义弹窗配置
|
33
|
-
formOptions: {}, // 自定义表单配置
|
34
|
-
renderColumns: [
|
35
|
-
{
|
36
|
-
prop: "name",
|
37
|
-
label: "姓名",
|
38
|
-
form: {},
|
39
|
-
},
|
40
|
-
{
|
41
|
-
prop: "gender",
|
42
|
-
label: "性别",
|
43
|
-
form: {
|
44
|
-
comp: {
|
45
|
-
name: "el-select",
|
46
|
-
options: [
|
47
|
-
{ value: "男", label: "男" },
|
48
|
-
{ value: "女", label: "女" },
|
49
|
-
],
|
50
|
-
},
|
51
|
-
},
|
52
|
-
},
|
53
|
-
{
|
54
|
-
prop: "age",
|
55
|
-
label: "年龄",
|
56
|
-
form: {
|
57
|
-
comp: {
|
58
|
-
name: "el-select",
|
59
|
-
options: [
|
60
|
-
{ value: 20, label: "20" },
|
61
|
-
{ value: 21, label: "21" },
|
62
|
-
{ value: 22, label: "22" },
|
63
|
-
{ value: 23, label: "23" },
|
64
|
-
],
|
65
|
-
},
|
66
|
-
},
|
67
|
-
},
|
68
|
-
{
|
69
|
-
prop: "city",
|
70
|
-
label: "城市",
|
71
|
-
form: {
|
72
|
-
comp: {
|
73
|
-
name: "el-select",
|
74
|
-
options: [
|
75
|
-
{ value: "北京", label: "北京" },
|
76
|
-
{ value: "上海", label: "上海" },
|
77
|
-
{ value: "广州", label: "广州" },
|
78
|
-
{ value: "深圳", label: "深圳" },
|
79
|
-
],
|
80
|
-
},
|
81
|
-
},
|
82
|
-
},
|
83
|
-
{
|
84
|
-
prop: "date",
|
85
|
-
label: "日期",
|
86
|
-
form: {
|
87
|
-
comp: {
|
88
|
-
name: "el-date-picker",
|
89
|
-
props: {
|
90
|
-
type: "date",
|
91
|
-
placeholder: "选择日期",
|
92
|
-
valueFormat: "yyyy-MM-dd",
|
93
|
-
},
|
94
|
-
},
|
95
|
-
},
|
96
|
-
},
|
97
|
-
],
|
98
|
-
},
|
99
|
-
data: [
|
100
|
-
{
|
101
|
-
id: 1,
|
102
|
-
name: "张三",
|
103
|
-
gender: "男",
|
104
|
-
age: 20,
|
105
|
-
city: "北京",
|
106
|
-
date: "2021-01-01",
|
107
|
-
},
|
108
|
-
{
|
109
|
-
id: 2,
|
110
|
-
name: "李四",
|
111
|
-
gender: "女",
|
112
|
-
age: 21,
|
113
|
-
city: "上海",
|
114
|
-
date: "2021-01-02",
|
115
|
-
},
|
116
|
-
{
|
117
|
-
id: 3,
|
118
|
-
name: "王五",
|
119
|
-
gender: "男",
|
120
|
-
age: 22,
|
121
|
-
city: "广州",
|
122
|
-
date: "2021-01-03",
|
123
|
-
},
|
124
|
-
{
|
125
|
-
id: 4,
|
126
|
-
name: "赵六",
|
127
|
-
gender: "女",
|
128
|
-
age: 23,
|
129
|
-
city: "深圳",
|
130
|
-
date: "2021-01-04",
|
131
|
-
},
|
132
|
-
{
|
133
|
-
id: 5,
|
134
|
-
name: "孙七",
|
135
|
-
gender: "男",
|
136
|
-
age: 24,
|
137
|
-
city: "成都",
|
138
|
-
date: "2021-01-05",
|
139
|
-
},
|
140
|
-
{
|
141
|
-
id: 6,
|
142
|
-
name: "周八",
|
143
|
-
gender: "女",
|
144
|
-
age: 25,
|
145
|
-
city: "重庆",
|
146
|
-
date: "2021-01-06",
|
147
|
-
},
|
148
|
-
],
|
149
|
-
};
|
150
|
-
},
|
151
|
-
methods: {
|
152
|
-
add(done, scope) {
|
153
|
-
this.$message("点击新增");
|
154
|
-
done();
|
155
|
-
},
|
156
|
-
edit(done, scope) {
|
157
|
-
this.$message("点击编辑");
|
158
|
-
done();
|
159
|
-
},
|
160
|
-
view(done, scope) {
|
161
|
-
this.$message("点击查看");
|
162
|
-
done();
|
163
|
-
},
|
164
|
-
save(done, scope) {
|
165
|
-
setTimeout(() => {
|
166
|
-
done();
|
167
|
-
this.$message("点击保存");
|
168
|
-
}, 500);
|
169
|
-
},
|
170
|
-
},
|
171
|
-
};
|
172
|
-
</script>
|
@@ -1,88 +0,0 @@
|
|
1
|
-
<template>
|
2
|
-
<div>
|
3
|
-
<sc-crud :search.sync="searchForm" :options="options" :data="data">
|
4
|
-
</sc-crud>
|
5
|
-
</div>
|
6
|
-
</template>
|
7
|
-
|
8
|
-
<script>
|
9
|
-
export default {
|
10
|
-
data() {
|
11
|
-
return {
|
12
|
-
searchForm: {},
|
13
|
-
data: [
|
14
|
-
{
|
15
|
-
id: 1,
|
16
|
-
name: "张三",
|
17
|
-
gender: "男",
|
18
|
-
age: 20,
|
19
|
-
city: "北京",
|
20
|
-
date: "2021-01-01",
|
21
|
-
},
|
22
|
-
{
|
23
|
-
id: 2,
|
24
|
-
name: "李四",
|
25
|
-
gender: "女",
|
26
|
-
age: 21,
|
27
|
-
city: "上海",
|
28
|
-
date: "2021-01-02",
|
29
|
-
},
|
30
|
-
{
|
31
|
-
id: 3,
|
32
|
-
name: "王五",
|
33
|
-
gender: "男",
|
34
|
-
age: 22,
|
35
|
-
city: "广州",
|
36
|
-
date: "2021-01-03",
|
37
|
-
},
|
38
|
-
{
|
39
|
-
id: 4,
|
40
|
-
name: "赵六",
|
41
|
-
gender: "女",
|
42
|
-
age: 23,
|
43
|
-
city: "深圳",
|
44
|
-
date: "2021-01-04",
|
45
|
-
},
|
46
|
-
],
|
47
|
-
isEdit: true,
|
48
|
-
};
|
49
|
-
},
|
50
|
-
computed: {
|
51
|
-
options() {
|
52
|
-
return {
|
53
|
-
editConfig: {
|
54
|
-
mode: "free",
|
55
|
-
},
|
56
|
-
renderColumns: [
|
57
|
-
{ prop: "name", label: "姓名" },
|
58
|
-
{
|
59
|
-
prop: "gender",
|
60
|
-
label: "性别",
|
61
|
-
},
|
62
|
-
{
|
63
|
-
prop: "age",
|
64
|
-
label: "年龄",
|
65
|
-
form: {
|
66
|
-
comp: {
|
67
|
-
name: "el-select",
|
68
|
-
options: [
|
69
|
-
{ value: "1", label: "选项1" },
|
70
|
-
{ value: "2", label: "选项2" },
|
71
|
-
],
|
72
|
-
},
|
73
|
-
},
|
74
|
-
},
|
75
|
-
{
|
76
|
-
prop: "city",
|
77
|
-
label: "城市",
|
78
|
-
},
|
79
|
-
{
|
80
|
-
prop: "date",
|
81
|
-
label: "日期",
|
82
|
-
},
|
83
|
-
],
|
84
|
-
};
|
85
|
-
},
|
86
|
-
},
|
87
|
-
};
|
88
|
-
</script>
|
@@ -1,82 +0,0 @@
|
|
1
|
-
<template>
|
2
|
-
<div>
|
3
|
-
<el-button type="primary" @click="isEdit = !isEdit"
|
4
|
-
>切换第三列编辑状态</el-button
|
5
|
-
>
|
6
|
-
<sc-crud :search.sync="searchForm" :options="options" :data="data">
|
7
|
-
</sc-crud>
|
8
|
-
</div>
|
9
|
-
</template>
|
10
|
-
|
11
|
-
<script>
|
12
|
-
export default {
|
13
|
-
data() {
|
14
|
-
return {
|
15
|
-
searchForm: {},
|
16
|
-
data: [
|
17
|
-
{
|
18
|
-
id: 1,
|
19
|
-
name: "张三",
|
20
|
-
gender: "男",
|
21
|
-
age: 20,
|
22
|
-
city: "北京",
|
23
|
-
date: "2021-01-01",
|
24
|
-
},
|
25
|
-
{
|
26
|
-
id: 2,
|
27
|
-
name: "李四",
|
28
|
-
gender: "女",
|
29
|
-
age: 21,
|
30
|
-
city: "上海",
|
31
|
-
date: "2021-01-02",
|
32
|
-
},
|
33
|
-
{
|
34
|
-
id: 3,
|
35
|
-
name: "王五",
|
36
|
-
gender: "男",
|
37
|
-
age: 22,
|
38
|
-
city: "广州",
|
39
|
-
date: "2021-01-03",
|
40
|
-
},
|
41
|
-
{
|
42
|
-
id: 4,
|
43
|
-
name: "赵六",
|
44
|
-
gender: "女",
|
45
|
-
age: 23,
|
46
|
-
city: "深圳",
|
47
|
-
date: "2021-01-04",
|
48
|
-
},
|
49
|
-
],
|
50
|
-
isEdit: true,
|
51
|
-
};
|
52
|
-
},
|
53
|
-
computed: {
|
54
|
-
options() {
|
55
|
-
return {
|
56
|
-
renderColumns: [
|
57
|
-
{ prop: "name", label: "姓名" },
|
58
|
-
{
|
59
|
-
prop: "gender",
|
60
|
-
label: "性别",
|
61
|
-
isEdit: true,
|
62
|
-
},
|
63
|
-
{
|
64
|
-
prop: "age",
|
65
|
-
label: "年龄",
|
66
|
-
isEdit: this.isEdit,
|
67
|
-
},
|
68
|
-
{
|
69
|
-
prop: "city",
|
70
|
-
label: "城市",
|
71
|
-
},
|
72
|
-
{
|
73
|
-
prop: "date",
|
74
|
-
label: "日期",
|
75
|
-
isEdit: true,
|
76
|
-
},
|
77
|
-
],
|
78
|
-
};
|
79
|
-
},
|
80
|
-
},
|
81
|
-
};
|
82
|
-
</script>
|
@@ -1,154 +0,0 @@
|
|
1
|
-
<template>
|
2
|
-
<div>
|
3
|
-
<div class="demo-section">
|
4
|
-
<h3>方法调用示例:</h3>
|
5
|
-
<el-button @click="setFirstRowEdit">设置第一行编辑</el-button>
|
6
|
-
<el-button @click="setMultiRowEdit">设置多行编辑</el-button>
|
7
|
-
<el-button @click="cancelRowEdit">取消编辑</el-button>
|
8
|
-
<el-button @click="saveRowEdit">保存编辑</el-button>
|
9
|
-
</div>
|
10
|
-
|
11
|
-
<div style="margin-bottom: 20px;">
|
12
|
-
<h3>其他操作:</h3>
|
13
|
-
<el-button @click="addNewRow">新增行</el-button>
|
14
|
-
<el-button @click="addNewRowToFirst">新增至首行</el-button>
|
15
|
-
<el-button @click="clearAllEditStatus">清除所有编辑</el-button>
|
16
|
-
<el-button @click="showEditingStatus">显示编辑状态</el-button>
|
17
|
-
</div>
|
18
|
-
|
19
|
-
<sc-crud
|
20
|
-
:search.sync="searchForm"
|
21
|
-
ref="crud"
|
22
|
-
:options="options"
|
23
|
-
:data="data"
|
24
|
-
>
|
25
|
-
</sc-crud>
|
26
|
-
</div>
|
27
|
-
</template>
|
28
|
-
|
29
|
-
<script>
|
30
|
-
export default {
|
31
|
-
data() {
|
32
|
-
return {
|
33
|
-
searchForm: {},
|
34
|
-
data: [
|
35
|
-
{
|
36
|
-
id: 1,
|
37
|
-
name: "张三",
|
38
|
-
gender: "男",
|
39
|
-
age: 20,
|
40
|
-
city: "北京",
|
41
|
-
date: "2021-01-01",
|
42
|
-
},
|
43
|
-
{
|
44
|
-
id: 2,
|
45
|
-
name: "李四",
|
46
|
-
gender: "女",
|
47
|
-
age: 21,
|
48
|
-
city: "上海",
|
49
|
-
date: "2021-01-02",
|
50
|
-
},
|
51
|
-
{
|
52
|
-
id: 3,
|
53
|
-
name: "王五",
|
54
|
-
gender: "男",
|
55
|
-
age: 22,
|
56
|
-
city: "广州",
|
57
|
-
date: "2021-01-03",
|
58
|
-
},
|
59
|
-
],
|
60
|
-
};
|
61
|
-
},
|
62
|
-
computed: {
|
63
|
-
options() {
|
64
|
-
return {
|
65
|
-
editConfig: {
|
66
|
-
mode: "row",
|
67
|
-
trigger: "manual",
|
68
|
-
edit: true,
|
69
|
-
},
|
70
|
-
renderColumns: [
|
71
|
-
{ prop: "name", label: "姓名" },
|
72
|
-
{
|
73
|
-
prop: "gender",
|
74
|
-
label: "性别",
|
75
|
-
form: {
|
76
|
-
comp: {
|
77
|
-
name: "el-select",
|
78
|
-
options: [
|
79
|
-
{ value: "男", label: "男" },
|
80
|
-
{ value: "女", label: "女" },
|
81
|
-
],
|
82
|
-
},
|
83
|
-
},
|
84
|
-
},
|
85
|
-
{ prop: "age", label: "年龄" },
|
86
|
-
{ prop: "city", label: "城市" },
|
87
|
-
{ prop: "date", label: "日期" },
|
88
|
-
],
|
89
|
-
};
|
90
|
-
},
|
91
|
-
},
|
92
|
-
methods: {
|
93
|
-
// 设置第一行进入编辑状态
|
94
|
-
setFirstRowEdit() {
|
95
|
-
const firstRow = this.data[0];
|
96
|
-
this.$refs.crud.setRowEdit(firstRow, {
|
97
|
-
type: "edit",
|
98
|
-
prop: "name", // 聚焦到name列
|
99
|
-
});
|
100
|
-
},
|
101
|
-
|
102
|
-
// 设置多行进入编辑状态
|
103
|
-
setMultiRowEdit() {
|
104
|
-
const rows = this.data.slice(0, 2); // 获取前两行
|
105
|
-
this.$refs.crud.setRowEdit(rows, { type: "edit" });
|
106
|
-
},
|
107
|
-
|
108
|
-
// 取消编辑状态
|
109
|
-
cancelRowEdit() {
|
110
|
-
const editingRows = this.$refs.crud.getEditingRows();
|
111
|
-
this.$refs.crud.setRowEdit(editingRows, { type: "cancel" });
|
112
|
-
},
|
113
|
-
|
114
|
-
// 保存编辑状态
|
115
|
-
saveRowEdit() {
|
116
|
-
const editingRows = this.$refs.crud.getEditingRows();
|
117
|
-
this.$refs.crud.setRowEdit(editingRows, { type: "save" });
|
118
|
-
},
|
119
|
-
|
120
|
-
// 新增行
|
121
|
-
addNewRow() {
|
122
|
-
this.$refs.crud.addRow({
|
123
|
-
name: "新用户",
|
124
|
-
gender: "男",
|
125
|
-
age: 25,
|
126
|
-
});
|
127
|
-
},
|
128
|
-
|
129
|
-
// 在首行新增
|
130
|
-
addNewRowToFirst() {
|
131
|
-
this.$refs.crud.addRow(
|
132
|
-
{
|
133
|
-
name: "新用户",
|
134
|
-
gender: "男",
|
135
|
-
age: 25,
|
136
|
-
},
|
137
|
-
"first"
|
138
|
-
);
|
139
|
-
},
|
140
|
-
|
141
|
-
// 清除所有编辑状态
|
142
|
-
clearAllEditStatus() {
|
143
|
-
this.$refs.crud.clearAllEdit();
|
144
|
-
},
|
145
|
-
|
146
|
-
// 显示编辑状态信息
|
147
|
-
showEditingStatus() {
|
148
|
-
// 获取所有编辑状态的行
|
149
|
-
const editingRows = this.$refs.crud.getEditingRows();
|
150
|
-
console.log("正在编辑的行:", editingRows);
|
151
|
-
},
|
152
|
-
},
|
153
|
-
};
|
154
|
-
</script>
|