vue-super-crud 1.7.1
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/.browserslistrc +3 -0
- package/.versionrc.json +36 -0
- package/CHANGELOG.md +232 -0
- package/LICENSE +201 -0
- package/README.md +46 -0
- package/babel.config.js +12 -0
- package/build/alias.js +10 -0
- package/build/build.js +52 -0
- package/build/config.js +70 -0
- package/deploy.bat +14 -0
- package/docs/.vuepress/components/button/base.vue +88 -0
- package/docs/.vuepress/components/common/code-format.vue +331 -0
- package/docs/.vuepress/components/commonConfig/presetCodeTemplate/base.vue +68 -0
- package/docs/.vuepress/components/commonConfig/presetCodeTemplate/customParams.vue +73 -0
- package/docs/.vuepress/components/commonConfig/renderType/component.vue +160 -0
- package/docs/.vuepress/components/commonConfig/renderType/formatter.vue +49 -0
- package/docs/.vuepress/components/commonConfig/renderType/render.vue +91 -0
- package/docs/.vuepress/components/commonConfig/renderType/slot.vue +63 -0
- package/docs/.vuepress/components/crud/baseUse/baseUse.vue +98 -0
- package/docs/.vuepress/components/crud/baseUse/columnAction.vue +72 -0
- package/docs/.vuepress/components/crud/baseUse/columnWidth.vue +107 -0
- package/docs/.vuepress/components/crud/baseUse/handleRow.vue +65 -0
- package/docs/.vuepress/components/crud/baseUse/height.vue +82 -0
- package/docs/.vuepress/components/crud/baseUse/index.vue +54 -0
- package/docs/.vuepress/components/crud/baseUse/loading.vue +70 -0
- package/docs/.vuepress/components/crud/baseUse/pagination.vue +108 -0
- package/docs/.vuepress/components/crud/baseUse/selection.vue +114 -0
- package/docs/.vuepress/components/crud/baseUse/summaryMethod.vue +118 -0
- package/docs/.vuepress/components/crud/baseUse/title.vue +54 -0
- package/docs/.vuepress/components/crud/baseUse/toolbar.vue +69 -0
- package/docs/.vuepress/components/crud/buttons/common.vue +115 -0
- package/docs/.vuepress/components/crud/buttons/fast.vue +82 -0
- package/docs/.vuepress/components/crud/contextMenu/base.vue +72 -0
- package/docs/.vuepress/components/crud/copy.vue +52 -0
- package/docs/.vuepress/components/crud/crudEvents/api.vue +157 -0
- package/docs/.vuepress/components/crud/crudEvents/deleteTip.vue +93 -0
- package/docs/.vuepress/components/crud/crudEvents/events.vue +188 -0
- package/docs/.vuepress/components/crud/dataSort/base.vue +142 -0
- package/docs/.vuepress/components/crud/genDynamicColumns/base.vue +53 -0
- package/docs/.vuepress/components/crud/genDynamicColumns/dynamicAndFixed.vue +111 -0
- package/docs/.vuepress/components/crud/genDynamicColumns/treeDynamic.vue +68 -0
- package/docs/.vuepress/components/crud/handleBar/handleRow.vue +65 -0
- package/docs/.vuepress/components/crud/handleBar/toolbar.vue +69 -0
- package/docs/.vuepress/components/crud/renderType/1.vue +57 -0
- package/docs/.vuepress/components/crud/renderType/2.vue +63 -0
- package/docs/.vuepress/components/crud/renderType/3.vue +105 -0
- package/docs/.vuepress/components/crud/renderType/5.vue +91 -0
- package/docs/.vuepress/components/crud/search/1.vue +90 -0
- package/docs/.vuepress/components/crud/search/2.vue +78 -0
- package/docs/.vuepress/components/crud/search/3.vue +107 -0
- package/docs/.vuepress/components/crud/search/base.vue +123 -0
- package/docs/.vuepress/components/crud/search/localSearch.vue +124 -0
- package/docs/.vuepress/components/crud/search/special.vue +148 -0
- package/docs/.vuepress/components/crud/selection/events.vue +47 -0
- package/docs/.vuepress/components/crud/selection/pagination.vue +94 -0
- package/docs/.vuepress/components/crud/selection/singleSelection.vue +64 -0
- package/docs/.vuepress/components/crud/span/base.vue +69 -0
- package/docs/.vuepress/components/crud/span/special.vue +75 -0
- package/docs/.vuepress/components/crud/summary/base.vue +99 -0
- package/docs/.vuepress/components/crud/tableEdit/addDeleteBtn.vue +174 -0
- package/docs/.vuepress/components/crud/tableEdit/cellEdit.vue +194 -0
- package/docs/.vuepress/components/crud/tableEdit/controlEdit.vue +219 -0
- package/docs/.vuepress/components/crud/tableEdit/dialog.vue +172 -0
- package/docs/.vuepress/components/crud/tableEdit/free.vue +88 -0
- package/docs/.vuepress/components/crud/tableEdit/freeColumn.vue +82 -0
- package/docs/.vuepress/components/crud/tableEdit/methods.vue +154 -0
- package/docs/.vuepress/components/crud/tableEdit/rowAction.vue +107 -0
- package/docs/.vuepress/components/crud/tableEdit/rowBatch.vue +116 -0
- package/docs/.vuepress/components/crud/tableEdit/rowClick.vue +98 -0
- package/docs/.vuepress/components/crud/validate/base.vue +122 -0
- package/docs/.vuepress/components/crud/validate/custom.vue +82 -0
- package/docs/.vuepress/components/crud/validate/regulars.vue +88 -0
- package/docs/.vuepress/components/crud/validate/relation.vue +91 -0
- package/docs/.vuepress/components/crud/validate/tree.vue +82 -0
- package/docs/.vuepress/components/dialog/baseUse/base.vue +92 -0
- package/docs/.vuepress/components/dialog/baseUse/beforeConfirm.vue +78 -0
- package/docs/.vuepress/components/dialog/baseUse/control.vue +79 -0
- package/docs/.vuepress/components/dialog/baseUse/drawer.vue +59 -0
- package/docs/.vuepress/components/dialog/baseUse/footer.vue +87 -0
- package/docs/.vuepress/components/dialog/baseUse/insertSlot.vue +79 -0
- package/docs/.vuepress/components/dict/DictLinkage.vue +91 -0
- package/docs/.vuepress/components/dict/baseUse.vue +72 -0
- package/docs/.vuepress/components/dict/component.vue +82 -0
- package/docs/.vuepress/components/dict/localDict.vue +68 -0
- package/docs/.vuepress/components/form/baseUse/base.vue +48 -0
- package/docs/.vuepress/components/form/baseUse/dataFormat.vue +92 -0
- package/docs/.vuepress/components/form/baseUse/deep.vue +57 -0
- package/docs/.vuepress/components/form/baseUse/gridLayout.vue +47 -0
- package/docs/.vuepress/components/form/baseUse/group.vue +66 -0
- package/docs/.vuepress/components/form/baseUse/hidden.vue +40 -0
- package/docs/.vuepress/components/form/baseUse/inlineLayout.vue +48 -0
- package/docs/.vuepress/components/form/baseUse/label.vue +51 -0
- package/docs/.vuepress/components/form/baseUse/tooltip.vue +40 -0
- package/docs/.vuepress/components/form/baseUse/validate.vue +52 -0
- package/docs/.vuepress/components/form/detail/base.vue +78 -0
- package/docs/.vuepress/components/form/detail/border.vue +90 -0
- package/docs/.vuepress/components/form/detail/singleDetail.vue +72 -0
- package/docs/.vuepress/components/formatData/baseUse.vue +131 -0
- package/docs/.vuepress/components/mock/index.js +347 -0
- package/docs/.vuepress/components/mockData/custom.vue +69 -0
- package/docs/.vuepress/components/mockData/example.vue +290 -0
- package/docs/.vuepress/components/positionSlot/base.vue +24 -0
- package/docs/.vuepress/components/positionSlot/form.vue +71 -0
- package/docs/.vuepress/components/positionSlot/table.vue +85 -0
- package/docs/.vuepress/components/tabs/base.vue +57 -0
- package/docs/.vuepress/components/temp.js +195 -0
- package/docs/.vuepress/config.js +146 -0
- package/docs/.vuepress/enhanceApp.js +142 -0
- package/docs/.vuepress/public/favicon.ico +0 -0
- package/docs/.vuepress/public/super.png +0 -0
- package/docs/.vuepress/styles/index.styl +25 -0
- package/docs/.vuepress/styles/palette.styl +6 -0
- package/docs/README.md +14 -0
- package/docs/guide/button/base.md +31 -0
- package/docs/guide/commonConfig/jsx.md +166 -0
- package/docs/guide/commonConfig/presetCodeTemplate.md +68 -0
- package/docs/guide/commonConfig/renderType.md +181 -0
- package/docs/guide/crud/baseUse.md +120 -0
- package/docs/guide/crud/buttons.md +18 -0
- package/docs/guide/crud/config.md +217 -0
- package/docs/guide/crud/contextMenu.md +18 -0
- package/docs/guide/crud/dataSort.md +66 -0
- package/docs/guide/crud/genDynamicColumns.md +145 -0
- package/docs/guide/crud/handleBar.md +26 -0
- package/docs/guide/crud/renderType.md +4 -0
- package/docs/guide/crud/search.md +150 -0
- package/docs/guide/crud/selection.md +73 -0
- package/docs/guide/crud/span.md +98 -0
- package/docs/guide/crud/summary.md +167 -0
- package/docs/guide/crud/tableEdit.md +377 -0
- package/docs/guide/crud/validate.md +158 -0
- package/docs/guide/dialog/baseUse.md +81 -0
- package/docs/guide/dict/baseUse.md +174 -0
- package/docs/guide/dict/component.md +88 -0
- package/docs/guide/dict/config.md +44 -0
- package/docs/guide/form/baseUse.md +142 -0
- package/docs/guide/form/detail.md +38 -0
- package/docs/guide/formatData/baseUse.md +98 -0
- package/docs/guide/formatData/config.md +142 -0
- package/docs/guide/mockData/base.md +26 -0
- package/docs/guide/positionSlot/base.md +41 -0
- package/docs/guide/question/base.md +44 -0
- package/docs/guide/start/base.md +30 -0
- package/docs/guide/tabs/base.md +63 -0
- package/examples/App.vue +52 -0
- package/examples/Layout/components/AppMain.vue +40 -0
- package/examples/Layout/components/Item.vue +29 -0
- package/examples/Layout/components/Link.vue +44 -0
- package/examples/Layout/components/SidebarItem.vue +93 -0
- package/examples/Layout/index.vue +69 -0
- package/examples/assets/logo.png +0 -0
- package/examples/favicon.ico +0 -0
- package/examples/index.html +18 -0
- package/examples/main.js +54 -0
- package/examples/router/index.js +140 -0
- package/examples/store/index.js +0 -0
- package/examples/styles/index.scss +63 -0
- package/examples/styles/sidebar.scss +226 -0
- package/examples/styles/transition.scss +48 -0
- package/examples/styles/variables.scss +25 -0
- package/examples/views/crud/base.vue +68 -0
- package/examples/views/crud/handleRow.vue +84 -0
- package/examples/views/crud/search.vue +116 -0
- package/examples/views/dashboard/index.vue +244 -0
- package/examples/views/dashboard/index1.vue +234 -0
- package/examples/views/dashboard/test.vue +9 -0
- package/examples/views/formTest/index.vue +168 -0
- package/examples/views/nested/menu1/index.vue +7 -0
- package/examples/views/nested/menu1/menu1-1/index.vue +7 -0
- package/examples/views/nested/menu1/menu1-2/index.vue +7 -0
- package/examples/views/nested/menu1/menu1-2/menu1-2-1/index.vue +5 -0
- package/examples/views/nested/menu1/menu1-2/menu1-2-2/index.vue +5 -0
- package/examples/views/nested/menu1/menu1-3/index.vue +5 -0
- package/examples/views/nested/menu2/index.vue +5 -0
- package/gulpfile.js +84 -0
- package/lib/index.css +1 -0
- package/lib/super-crud.min.js +15 -0
- package/package.json +66 -0
- package/packages/button/index.vue +189 -0
- package/packages/core/components/comp.vue +223 -0
- package/packages/core/components/position.vue +135 -0
- package/packages/core/components/render.vue +460 -0
- package/packages/core/configManager.js +302 -0
- package/packages/core/create.js +8 -0
- package/packages/core/defaultRender.js +64 -0
- package/packages/core/dict/global.js +10 -0
- package/packages/core/dict/index.js +432 -0
- package/packages/core/dict/mixin.js +94 -0
- package/packages/core/event.js +60 -0
- package/packages/core/index.js +6 -0
- package/packages/core/init.js +122 -0
- package/packages/core/mock/genConfig.js +228 -0
- package/packages/core/mock/genData.js +422 -0
- package/packages/core/mock/index.js +4 -0
- package/packages/core/rules.js +111 -0
- package/packages/crud/column.vue +205 -0
- package/packages/crud/columnAction.vue +207 -0
- package/packages/crud/columnCell.vue +146 -0
- package/packages/crud/defaultColumn.vue +130 -0
- package/packages/crud/drawerColumn.vue +225 -0
- package/packages/crud/form.vue +69 -0
- package/packages/crud/index.vue +564 -0
- package/packages/crud/menuBar.vue +298 -0
- package/packages/crud/mixins/cacheHandler.js +36 -0
- package/packages/crud/mixins/calcColumnWidth.js +79 -0
- package/packages/crud/mixins/calcHeight.js +105 -0
- package/packages/crud/mixins/columnHandler.js +128 -0
- package/packages/crud/mixins/contextMenu.js +98 -0
- package/packages/crud/mixins/dataProcessor.js +202 -0
- package/packages/crud/mixins/dialog.js +109 -0
- package/packages/crud/mixins/excelHandler.js +150 -0
- package/packages/crud/mixins/exposeMethods.js +107 -0
- package/packages/crud/mixins/generateDynamicColumns.js +250 -0
- package/packages/crud/mixins/props.js +38 -0
- package/packages/crud/mixins/searchHandler.js +151 -0
- package/packages/crud/mixins/select.js +359 -0
- package/packages/crud/mixins/spanMethod.js +288 -0
- package/packages/crud/mixins/summary.js +177 -0
- package/packages/crud/mixins/tableEdit.js +547 -0
- package/packages/crud/mixins/validate.js +219 -0
- package/packages/crud/pagination.vue +110 -0
- package/packages/crud/search.vue +119 -0
- package/packages/crud/searchHeader.vue +231 -0
- package/packages/crud/selectBanner.vue +138 -0
- package/packages/crud/utils/EditState.js +319 -0
- package/packages/crud/utils/excelExport.js +112 -0
- package/packages/crud/utils/excelImport.js +112 -0
- package/packages/crud/utils/index.js +98 -0
- package/packages/dialog/dialog.js +233 -0
- package/packages/dialog/dialog.vue +15 -0
- package/packages/dialog/index.js +22 -0
- package/packages/dict/cascadeFormat.vue +179 -0
- package/packages/dict/dateFormat.vue +40 -0
- package/packages/dict/form/cascade.vue +61 -0
- package/packages/dict/form/checkbox.vue +90 -0
- package/packages/dict/form/extendMethod.js +22 -0
- package/packages/dict/form/input-base.js +31 -0
- package/packages/dict/form/input.js +20 -0
- package/packages/dict/form/radio.vue +69 -0
- package/packages/dict/form/select.vue +118 -0
- package/packages/dict/form/switch.vue +75 -0
- package/packages/dict/valueFormat.vue +188 -0
- package/packages/directive/dialog/drag.js +86 -0
- package/packages/directive/dialog/dragSize.js +42 -0
- package/packages/directive/index.js +9 -0
- package/packages/directive/insertSlot.js +10 -0
- package/packages/form/contextMenu.js +192 -0
- package/packages/form/draftDrawer.vue +391 -0
- package/packages/form/formAction.vue +97 -0
- package/packages/form/formItem.vue +259 -0
- package/packages/form/index.vue +451 -0
- package/packages/form/props.js +15 -0
- package/packages/grid/cell.vue +65 -0
- package/packages/grid/index.vue +130 -0
- package/packages/group/index.vue +96 -0
- package/packages/tabs/index.vue +290 -0
- package/packages/tooltip/index.js +9 -0
- package/packages/tooltip/tooltip.vue +32 -0
- package/packages/tooltip/tooltipComponent.js +38 -0
- package/packages/verifyInput/index.vue +131 -0
- package/src/config/common.js +88 -0
- package/src/config/crud.js +567 -0
- package/src/config/dialog.js +87 -0
- package/src/config/form.js +215 -0
- package/src/config/index.js +9 -0
- package/src/constants/index.js +72 -0
- package/src/index.js +67 -0
- package/src/template/btn/crud.js +6 -0
- package/src/template/btn/dialog.js +1 -0
- package/src/template/btn/form.js +3 -0
- package/src/template/btn/index.js +9 -0
- package/src/template/dicts.js +1 -0
- package/src/template/formatData.js +507 -0
- package/src/template/index.js +19 -0
- package/src/template/render.js +124 -0
- package/src/template/rules.js +53 -0
- package/src/utils/bem.js +49 -0
- package/src/utils/cache.js +77 -0
- package/src/utils/getType.js +34 -0
- package/src/utils/index.js +212 -0
- package/src/utils/mergeTemp.js +124 -0
- package/styles/button.scss +3 -0
- package/styles/crud.scss +425 -0
- package/styles/dialog.scss +95 -0
- package/styles/form.scss +532 -0
- package/styles/group.scss +78 -0
- package/styles/index.scss +94 -0
- package/styles/tabs.scss +139 -0
- package/styles/verifyInput.scss +56 -0
- package/vue-jsx-sync.js +90 -0
- package/vue.config.js +54 -0
@@ -0,0 +1,107 @@
|
|
1
|
+
<template>
|
2
|
+
<div>
|
3
|
+
<sc-crud
|
4
|
+
:search.sync="searchForm"
|
5
|
+
:options="options"
|
6
|
+
:data="data"
|
7
|
+
@edit="edit"
|
8
|
+
@save="save"
|
9
|
+
@cancel="cancel"
|
10
|
+
>
|
11
|
+
</sc-crud>
|
12
|
+
</div>
|
13
|
+
</template>
|
14
|
+
|
15
|
+
<script>
|
16
|
+
export default {
|
17
|
+
data() {
|
18
|
+
return {
|
19
|
+
searchForm: {},
|
20
|
+
data: [
|
21
|
+
{
|
22
|
+
id: 1,
|
23
|
+
name: "张三",
|
24
|
+
gender: "男",
|
25
|
+
age: 20,
|
26
|
+
city: "北京",
|
27
|
+
date: "2021-01-01",
|
28
|
+
},
|
29
|
+
{
|
30
|
+
id: 2,
|
31
|
+
name: "李四",
|
32
|
+
gender: "女",
|
33
|
+
age: 21,
|
34
|
+
city: "上海",
|
35
|
+
date: "2021-01-02",
|
36
|
+
},
|
37
|
+
{
|
38
|
+
id: 3,
|
39
|
+
name: "王五",
|
40
|
+
gender: "男",
|
41
|
+
age: 22,
|
42
|
+
city: "广州",
|
43
|
+
date: "2021-01-03",
|
44
|
+
},
|
45
|
+
{
|
46
|
+
id: 4,
|
47
|
+
name: "赵六",
|
48
|
+
gender: "女",
|
49
|
+
age: 23,
|
50
|
+
city: "深圳",
|
51
|
+
date: "2021-01-04",
|
52
|
+
},
|
53
|
+
],
|
54
|
+
isEdit: true,
|
55
|
+
};
|
56
|
+
},
|
57
|
+
computed: {
|
58
|
+
options() {
|
59
|
+
return {
|
60
|
+
editConfig: {
|
61
|
+
mode: "row",
|
62
|
+
trigger: "manual",
|
63
|
+
edit: {
|
64
|
+
hasPermi: ["xx:xx:xx"],
|
65
|
+
}, // 操作列按钮配置
|
66
|
+
},
|
67
|
+
renderColumns: [
|
68
|
+
{ prop: "name", label: "姓名" },
|
69
|
+
{
|
70
|
+
prop: "gender",
|
71
|
+
label: "性别",
|
72
|
+
},
|
73
|
+
{
|
74
|
+
prop: "age",
|
75
|
+
label: "年龄",
|
76
|
+
},
|
77
|
+
{
|
78
|
+
prop: "city",
|
79
|
+
label: "城市",
|
80
|
+
},
|
81
|
+
{
|
82
|
+
prop: "date",
|
83
|
+
label: "日期",
|
84
|
+
},
|
85
|
+
],
|
86
|
+
};
|
87
|
+
},
|
88
|
+
},
|
89
|
+
methods: {
|
90
|
+
edit(done, scope) {
|
91
|
+
console.log("edit", scope);
|
92
|
+
this.$message.info("点击编辑", scope);
|
93
|
+
done();
|
94
|
+
},
|
95
|
+
save(done, scope) {
|
96
|
+
console.log("save", scope);
|
97
|
+
this.$message.success("点击保存", scope);
|
98
|
+
done();
|
99
|
+
},
|
100
|
+
cancel(done, scope) {
|
101
|
+
console.log("cancel", scope);
|
102
|
+
this.$message.warning("点击取消", scope);
|
103
|
+
done();
|
104
|
+
},
|
105
|
+
},
|
106
|
+
};
|
107
|
+
</script>
|
@@ -0,0 +1,116 @@
|
|
1
|
+
<template>
|
2
|
+
<div>
|
3
|
+
<el-button @click="isSelection = !isSelection"
|
4
|
+
>切换为批量编辑选中项</el-button
|
5
|
+
>
|
6
|
+
<el-button @click="isAll = !isAll">切换为编辑所有项</el-button>
|
7
|
+
<sc-crud
|
8
|
+
ref="crud"
|
9
|
+
:search.sync="searchForm"
|
10
|
+
:options="options"
|
11
|
+
:data="data"
|
12
|
+
@batchEdit="batchEdit"
|
13
|
+
@batchSave="batchSave"
|
14
|
+
@batchCancel="batchCancel"
|
15
|
+
>
|
16
|
+
</sc-crud>
|
17
|
+
</div>
|
18
|
+
</template>
|
19
|
+
|
20
|
+
<script>
|
21
|
+
export default {
|
22
|
+
data() {
|
23
|
+
return {
|
24
|
+
searchForm: {},
|
25
|
+
data: [
|
26
|
+
{
|
27
|
+
id: 1,
|
28
|
+
name: "张三",
|
29
|
+
gender: "男",
|
30
|
+
age: 20,
|
31
|
+
city: "北京",
|
32
|
+
date: "2021-01-01",
|
33
|
+
},
|
34
|
+
{
|
35
|
+
id: 2,
|
36
|
+
name: "李四",
|
37
|
+
gender: "女",
|
38
|
+
age: 21,
|
39
|
+
city: "上海",
|
40
|
+
date: "2021-01-02",
|
41
|
+
},
|
42
|
+
{
|
43
|
+
id: 3,
|
44
|
+
name: "王五",
|
45
|
+
gender: "男",
|
46
|
+
age: 22,
|
47
|
+
city: "广州",
|
48
|
+
date: "2021-01-03",
|
49
|
+
},
|
50
|
+
{
|
51
|
+
id: 4,
|
52
|
+
name: "赵六",
|
53
|
+
gender: "女",
|
54
|
+
age: 23,
|
55
|
+
city: "深圳",
|
56
|
+
date: "2021-01-04",
|
57
|
+
},
|
58
|
+
],
|
59
|
+
isEdit: true,
|
60
|
+
isSelection: false,
|
61
|
+
isAll: false,
|
62
|
+
};
|
63
|
+
},
|
64
|
+
computed: {
|
65
|
+
options() {
|
66
|
+
return {
|
67
|
+
editConfig: {
|
68
|
+
mode: "row",
|
69
|
+
trigger: "manual",
|
70
|
+
batch: {
|
71
|
+
isSelect: this.isSelection,
|
72
|
+
hasPermi: ["xx:xx:xx"],
|
73
|
+
}, // 批量操作按钮配置
|
74
|
+
},
|
75
|
+
selection: this.isSelection,
|
76
|
+
renderColumns: [
|
77
|
+
{ prop: "name", label: "姓名" },
|
78
|
+
{
|
79
|
+
prop: "gender",
|
80
|
+
label: "性别",
|
81
|
+
},
|
82
|
+
{
|
83
|
+
prop: "age",
|
84
|
+
label: "年龄",
|
85
|
+
},
|
86
|
+
{
|
87
|
+
prop: "city",
|
88
|
+
label: "城市",
|
89
|
+
},
|
90
|
+
{
|
91
|
+
prop: "date",
|
92
|
+
label: "日期",
|
93
|
+
},
|
94
|
+
],
|
95
|
+
};
|
96
|
+
},
|
97
|
+
},
|
98
|
+
methods: {
|
99
|
+
batchEdit(done) {
|
100
|
+
console.log("batchEdit");
|
101
|
+
this.$message.info("点击批量编辑");
|
102
|
+
done(this.isAll ? this.data : this.data.slice(0, 2));
|
103
|
+
},
|
104
|
+
batchSave(done, rows) {
|
105
|
+
console.log("batchSave", rows);
|
106
|
+
this.$message.success("点击批量保存", rows);
|
107
|
+
done();
|
108
|
+
},
|
109
|
+
batchCancel(done, rows) {
|
110
|
+
console.log("batchCancel", rows);
|
111
|
+
this.$message.warning("点击批量取消", rows);
|
112
|
+
done();
|
113
|
+
},
|
114
|
+
},
|
115
|
+
};
|
116
|
+
</script>
|
@@ -0,0 +1,98 @@
|
|
1
|
+
<template>
|
2
|
+
<div>
|
3
|
+
<sc-crud
|
4
|
+
:search.sync="searchForm"
|
5
|
+
:options="options"
|
6
|
+
:data="data"
|
7
|
+
@edit="edit"
|
8
|
+
@save="save"
|
9
|
+
>
|
10
|
+
</sc-crud>
|
11
|
+
</div>
|
12
|
+
</template>
|
13
|
+
|
14
|
+
<script>
|
15
|
+
export default {
|
16
|
+
data() {
|
17
|
+
return {
|
18
|
+
searchForm: {},
|
19
|
+
data: [
|
20
|
+
{
|
21
|
+
id: 1,
|
22
|
+
name: "张三",
|
23
|
+
gender: "男",
|
24
|
+
age: 20,
|
25
|
+
city: "北京",
|
26
|
+
date: "2021-01-01",
|
27
|
+
},
|
28
|
+
{
|
29
|
+
id: 2,
|
30
|
+
name: "李四",
|
31
|
+
gender: "女",
|
32
|
+
age: 21,
|
33
|
+
city: "上海",
|
34
|
+
date: "2021-01-02",
|
35
|
+
},
|
36
|
+
{
|
37
|
+
id: 3,
|
38
|
+
name: "王五",
|
39
|
+
gender: "男",
|
40
|
+
age: 22,
|
41
|
+
city: "广州",
|
42
|
+
date: "2021-01-03",
|
43
|
+
},
|
44
|
+
{
|
45
|
+
id: 4,
|
46
|
+
name: "赵六",
|
47
|
+
gender: "女",
|
48
|
+
age: 23,
|
49
|
+
city: "深圳",
|
50
|
+
date: "2021-01-04",
|
51
|
+
},
|
52
|
+
],
|
53
|
+
isEdit: true,
|
54
|
+
};
|
55
|
+
},
|
56
|
+
computed: {
|
57
|
+
options() {
|
58
|
+
return {
|
59
|
+
editConfig: {
|
60
|
+
mode: "row",
|
61
|
+
trigger: "click",
|
62
|
+
},
|
63
|
+
renderColumns: [
|
64
|
+
{ prop: "name", label: "姓名" },
|
65
|
+
{
|
66
|
+
prop: "gender",
|
67
|
+
label: "性别",
|
68
|
+
},
|
69
|
+
{
|
70
|
+
prop: "age",
|
71
|
+
label: "年龄",
|
72
|
+
},
|
73
|
+
{
|
74
|
+
prop: "city",
|
75
|
+
label: "城市",
|
76
|
+
},
|
77
|
+
{
|
78
|
+
prop: "date",
|
79
|
+
label: "日期",
|
80
|
+
},
|
81
|
+
],
|
82
|
+
};
|
83
|
+
},
|
84
|
+
},
|
85
|
+
methods: {
|
86
|
+
edit(done, scope) {
|
87
|
+
this.$message.info("编辑");
|
88
|
+
console.log(scope, "edit");
|
89
|
+
done();
|
90
|
+
},
|
91
|
+
save(done, scope) {
|
92
|
+
this.$message.success("保存");
|
93
|
+
console.log(scope, "save");
|
94
|
+
done();
|
95
|
+
},
|
96
|
+
},
|
97
|
+
};
|
98
|
+
</script>
|
@@ -0,0 +1,122 @@
|
|
1
|
+
<template>
|
2
|
+
<div>
|
3
|
+
<sc-crud
|
4
|
+
ref="crud"
|
5
|
+
:search.sync="searchForm"
|
6
|
+
:options="options"
|
7
|
+
:data="data"
|
8
|
+
>
|
9
|
+
</sc-crud>
|
10
|
+
</div>
|
11
|
+
</template>
|
12
|
+
|
13
|
+
<script>
|
14
|
+
export default {
|
15
|
+
data() {
|
16
|
+
return {
|
17
|
+
searchForm: {},
|
18
|
+
data: [
|
19
|
+
{
|
20
|
+
createTime: "2018-06-02 12:28:47",
|
21
|
+
createUser: 94,
|
22
|
+
id: 56,
|
23
|
+
idNumber: "8",
|
24
|
+
name: "",
|
25
|
+
password: "sed laboris",
|
26
|
+
phone: "18157668675",
|
27
|
+
gender: "男",
|
28
|
+
age: 20,
|
29
|
+
status: 35,
|
30
|
+
updateTime: "2018-09-08 16:33:19",
|
31
|
+
updateUser: 58,
|
32
|
+
username: "石洋",
|
33
|
+
},
|
34
|
+
{
|
35
|
+
createTime: "2018-06-02 12:28:47",
|
36
|
+
createUser: 94,
|
37
|
+
id: 57,
|
38
|
+
idNumber: "8",
|
39
|
+
name: "",
|
40
|
+
password: "sed laboris",
|
41
|
+
phone: "18157668675",
|
42
|
+
gender: "男",
|
43
|
+
age: 20,
|
44
|
+
status: 35,
|
45
|
+
updateTime: "2018-09-08 16:33:19",
|
46
|
+
updateUser: 58,
|
47
|
+
username: "石洋",
|
48
|
+
},
|
49
|
+
],
|
50
|
+
};
|
51
|
+
},
|
52
|
+
computed: {
|
53
|
+
options() {
|
54
|
+
return {
|
55
|
+
handleRow: {
|
56
|
+
handles: [
|
57
|
+
{
|
58
|
+
label: "表格校验",
|
59
|
+
type: "primary",
|
60
|
+
onClick: (ctx) => {
|
61
|
+
this.$refs.crud.validate();
|
62
|
+
},
|
63
|
+
},
|
64
|
+
{
|
65
|
+
label: "清除校验",
|
66
|
+
type: "primary",
|
67
|
+
onClick: (ctx) => {
|
68
|
+
this.$refs.crud.clearValidate();
|
69
|
+
},
|
70
|
+
},
|
71
|
+
{
|
72
|
+
label: "表格第二行校验",
|
73
|
+
type: "primary",
|
74
|
+
onClick: (ctx) => {
|
75
|
+
this.$refs.crud.validateField(1);
|
76
|
+
},
|
77
|
+
},
|
78
|
+
],
|
79
|
+
},
|
80
|
+
renderColumns: [
|
81
|
+
{
|
82
|
+
prop: "name",
|
83
|
+
label: "昵称",
|
84
|
+
isEdit: true,
|
85
|
+
required: true,
|
86
|
+
},
|
87
|
+
{
|
88
|
+
prop: "username",
|
89
|
+
label: "姓名",
|
90
|
+
},
|
91
|
+
{
|
92
|
+
prop: "gender",
|
93
|
+
label: "性别",
|
94
|
+
required: true,
|
95
|
+
isEdit: true,
|
96
|
+
form: {
|
97
|
+
// 使用form字段自定义编辑模式的组件
|
98
|
+
comp: {
|
99
|
+
name: "el-select",
|
100
|
+
clearable: true,
|
101
|
+
children: [
|
102
|
+
{
|
103
|
+
name: "el-option",
|
104
|
+
label: "男",
|
105
|
+
value: "男",
|
106
|
+
},
|
107
|
+
{
|
108
|
+
name: "el-option",
|
109
|
+
label: "女",
|
110
|
+
value: "女",
|
111
|
+
},
|
112
|
+
],
|
113
|
+
},
|
114
|
+
},
|
115
|
+
},
|
116
|
+
],
|
117
|
+
};
|
118
|
+
},
|
119
|
+
},
|
120
|
+
methods: {},
|
121
|
+
};
|
122
|
+
</script>
|
@@ -0,0 +1,82 @@
|
|
1
|
+
<template>
|
2
|
+
<div>
|
3
|
+
<sc-crud
|
4
|
+
ref="crud"
|
5
|
+
:search.sync="searchForm"
|
6
|
+
:options="options"
|
7
|
+
:data="data"
|
8
|
+
>
|
9
|
+
</sc-crud>
|
10
|
+
</div>
|
11
|
+
</template>
|
12
|
+
|
13
|
+
<script>
|
14
|
+
export default {
|
15
|
+
data() {
|
16
|
+
return {
|
17
|
+
searchForm: {},
|
18
|
+
data: [
|
19
|
+
{
|
20
|
+
createTime: "2018-06-02 12:28:47",
|
21
|
+
createUser: 94,
|
22
|
+
id: 56,
|
23
|
+
idNumber: "8",
|
24
|
+
name: "",
|
25
|
+
password: "sed laboris",
|
26
|
+
phone: "18157668675",
|
27
|
+
gender: "男",
|
28
|
+
age: 20,
|
29
|
+
status: 35,
|
30
|
+
updateTime: "2018-09-08 16:33:19",
|
31
|
+
updateUser: 58,
|
32
|
+
username: "石洋",
|
33
|
+
},
|
34
|
+
],
|
35
|
+
};
|
36
|
+
},
|
37
|
+
computed: {
|
38
|
+
options() {
|
39
|
+
return {
|
40
|
+
handleRow: {
|
41
|
+
handles: [
|
42
|
+
{
|
43
|
+
label: "表格校验",
|
44
|
+
type: "primary",
|
45
|
+
onClick: () => {
|
46
|
+
this.$refs.crud.validate();
|
47
|
+
},
|
48
|
+
},
|
49
|
+
{
|
50
|
+
label: "清除校验",
|
51
|
+
type: "primary",
|
52
|
+
onClick: () => {
|
53
|
+
this.$refs.crud.clearValidate();
|
54
|
+
},
|
55
|
+
},
|
56
|
+
],
|
57
|
+
},
|
58
|
+
renderColumns: [
|
59
|
+
{
|
60
|
+
prop: "name",
|
61
|
+
label: "昵称",
|
62
|
+
isEdit: true,
|
63
|
+
rules: [
|
64
|
+
{
|
65
|
+
validator: (rule, value, callback) => {
|
66
|
+
if (value) {
|
67
|
+
callback();
|
68
|
+
} else {
|
69
|
+
callback(new Error("error1"));
|
70
|
+
}
|
71
|
+
},
|
72
|
+
trigger: "change",
|
73
|
+
},
|
74
|
+
],
|
75
|
+
},
|
76
|
+
],
|
77
|
+
};
|
78
|
+
},
|
79
|
+
},
|
80
|
+
methods: {},
|
81
|
+
};
|
82
|
+
</script>
|
@@ -0,0 +1,88 @@
|
|
1
|
+
<template>
|
2
|
+
<div>
|
3
|
+
<sc-crud
|
4
|
+
ref="crud"
|
5
|
+
:search.sync="searchForm"
|
6
|
+
:options="options"
|
7
|
+
:data="data"
|
8
|
+
>
|
9
|
+
</sc-crud>
|
10
|
+
</div>
|
11
|
+
</template>
|
12
|
+
|
13
|
+
<script>
|
14
|
+
export default {
|
15
|
+
data() {
|
16
|
+
return {
|
17
|
+
searchForm: {},
|
18
|
+
data: [
|
19
|
+
{
|
20
|
+
createTime: "2018-06-02 12:28:47",
|
21
|
+
createUser: 94,
|
22
|
+
id: 56,
|
23
|
+
idNumber: "8",
|
24
|
+
name: "识间华中张认",
|
25
|
+
password: "sed laboris",
|
26
|
+
phone: "18157668675",
|
27
|
+
gender: "男",
|
28
|
+
age: 20,
|
29
|
+
status: 35,
|
30
|
+
updateTime: "2018-09-08 16:33:19",
|
31
|
+
updateUser: 58,
|
32
|
+
username: "石洋",
|
33
|
+
},
|
34
|
+
],
|
35
|
+
isEdit: false,
|
36
|
+
};
|
37
|
+
},
|
38
|
+
computed: {
|
39
|
+
options() {
|
40
|
+
return {
|
41
|
+
handleRow: {
|
42
|
+
handles: [
|
43
|
+
{
|
44
|
+
label: "表格校验",
|
45
|
+
type: "primary",
|
46
|
+
onClick: (ctx) => {
|
47
|
+
this.$refs.crud.validate();
|
48
|
+
},
|
49
|
+
},
|
50
|
+
{
|
51
|
+
label: "清除校验",
|
52
|
+
type: "primary",
|
53
|
+
onClick: (ctx) => {
|
54
|
+
this.$refs.crud.clearValidate();
|
55
|
+
},
|
56
|
+
},
|
57
|
+
],
|
58
|
+
},
|
59
|
+
renderColumns: [
|
60
|
+
{
|
61
|
+
prop: "name",
|
62
|
+
label: "正整数校验",
|
63
|
+
isEdit: true,
|
64
|
+
rules: ["integer"],
|
65
|
+
},
|
66
|
+
{
|
67
|
+
prop: "username",
|
68
|
+
label: "自定义正则校验",
|
69
|
+
isEdit: true,
|
70
|
+
form: {
|
71
|
+
comp: {
|
72
|
+
placeholder: "请输入2到16个汉字",
|
73
|
+
},
|
74
|
+
},
|
75
|
+
rules: [
|
76
|
+
{
|
77
|
+
regular: /^(?:[\u4e00-\u9fa5·]{2,16})$/,
|
78
|
+
msg: "请输入2到16个汉字",
|
79
|
+
},
|
80
|
+
],
|
81
|
+
},
|
82
|
+
],
|
83
|
+
};
|
84
|
+
},
|
85
|
+
},
|
86
|
+
methods: {},
|
87
|
+
};
|
88
|
+
</script>
|
@@ -0,0 +1,91 @@
|
|
1
|
+
<template>
|
2
|
+
<sc-crud ref="crud" default-expand-all :options="options" :data="data">
|
3
|
+
</sc-crud>
|
4
|
+
</template>
|
5
|
+
|
6
|
+
<script>
|
7
|
+
export default {
|
8
|
+
data() {
|
9
|
+
return {
|
10
|
+
data: [
|
11
|
+
{
|
12
|
+
id: 1,
|
13
|
+
name: "总数量",
|
14
|
+
number: 100,
|
15
|
+
children: [
|
16
|
+
{
|
17
|
+
id: 11,
|
18
|
+
name: "子数量",
|
19
|
+
number: 50,
|
20
|
+
},
|
21
|
+
{
|
22
|
+
id: 12,
|
23
|
+
name: "子数量",
|
24
|
+
number: 30,
|
25
|
+
},
|
26
|
+
{
|
27
|
+
id: 13,
|
28
|
+
name: "子数量",
|
29
|
+
number: "",
|
30
|
+
},
|
31
|
+
],
|
32
|
+
},
|
33
|
+
],
|
34
|
+
};
|
35
|
+
},
|
36
|
+
computed: {
|
37
|
+
options() {
|
38
|
+
return {
|
39
|
+
renderColumns: [
|
40
|
+
{
|
41
|
+
prop: "name",
|
42
|
+
label: "名称",
|
43
|
+
},
|
44
|
+
{
|
45
|
+
prop: "number",
|
46
|
+
label: "数量",
|
47
|
+
isEdit: ({ row }) => row.name !== "总数量",
|
48
|
+
required: true,
|
49
|
+
form: {
|
50
|
+
comp: {
|
51
|
+
type: "number",
|
52
|
+
onBlur: (v, { row }) => {
|
53
|
+
const father = this.data[0];
|
54
|
+
father.children.forEach((i) => {
|
55
|
+
if (row === i) return;
|
56
|
+
this.$refs.crud.validateField({
|
57
|
+
row: i,
|
58
|
+
prop: "number",
|
59
|
+
});
|
60
|
+
});
|
61
|
+
},
|
62
|
+
},
|
63
|
+
},
|
64
|
+
rules: [
|
65
|
+
{
|
66
|
+
validator: (rule, value, callback) => {
|
67
|
+
const father = this.data[0];
|
68
|
+
if (father.children.some((i) => !i.number)) {
|
69
|
+
callback();
|
70
|
+
return;
|
71
|
+
}
|
72
|
+
let totalNumber = 0;
|
73
|
+
father.children.forEach((item) => {
|
74
|
+
totalNumber += Number(item.number);
|
75
|
+
});
|
76
|
+
if (totalNumber !== father.number) {
|
77
|
+
callback(new Error("【子数量】总和不等于【总数量】"));
|
78
|
+
} else {
|
79
|
+
callback();
|
80
|
+
}
|
81
|
+
},
|
82
|
+
},
|
83
|
+
],
|
84
|
+
},
|
85
|
+
],
|
86
|
+
};
|
87
|
+
},
|
88
|
+
},
|
89
|
+
methods: {},
|
90
|
+
};
|
91
|
+
</script>
|