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,160 @@
|
|
1
|
+
<template>
|
2
|
+
<sc-form v-model="form" :options="options"> </sc-form>
|
3
|
+
</template>
|
4
|
+
|
5
|
+
<script>
|
6
|
+
export default {
|
7
|
+
data() {
|
8
|
+
// 非全局组件示例
|
9
|
+
this.CustomComponent = {
|
10
|
+
render: (h) => {
|
11
|
+
return h("div", "自定义组件");
|
12
|
+
},
|
13
|
+
};
|
14
|
+
|
15
|
+
return {
|
16
|
+
options: {
|
17
|
+
renderColumns: [
|
18
|
+
// 1. Select选择器示例
|
19
|
+
{
|
20
|
+
prop: "type",
|
21
|
+
label: "下拉选择",
|
22
|
+
comp: {
|
23
|
+
name: "el-select",
|
24
|
+
multiple: true,
|
25
|
+
// 动态属性配置
|
26
|
+
bind: (scope) => ({
|
27
|
+
disabled: scope.row.status === "disabled",
|
28
|
+
}),
|
29
|
+
// 子组件配置
|
30
|
+
children: [
|
31
|
+
{ name: "el-option", label: "类型1", value: "1" },
|
32
|
+
{ name: "el-option", label: "类型2", value: "2" },
|
33
|
+
],
|
34
|
+
// 事件处理
|
35
|
+
on: {
|
36
|
+
change: (val, scope) => {
|
37
|
+
console.log("选择值:", val);
|
38
|
+
console.log("当前行:", scope.row);
|
39
|
+
},
|
40
|
+
},
|
41
|
+
},
|
42
|
+
},
|
43
|
+
|
44
|
+
// 2. Input输入框示例
|
45
|
+
{
|
46
|
+
prop: "name",
|
47
|
+
label: "输入框",
|
48
|
+
comp: {
|
49
|
+
name: "el-input",
|
50
|
+
// 直接属性配置
|
51
|
+
clearable: true,
|
52
|
+
maxlength: 20,
|
53
|
+
"show-word-limit": true,
|
54
|
+
// 插槽配置
|
55
|
+
slots: {
|
56
|
+
prefix: () => <i class="el-icon-search" />,
|
57
|
+
suffix: () => <i class="el-icon-date" />,
|
58
|
+
},
|
59
|
+
// 事件监听
|
60
|
+
on: {
|
61
|
+
input: (val, scope) => {
|
62
|
+
console.log("输入值:", val);
|
63
|
+
},
|
64
|
+
focus: (event, scope) => {
|
65
|
+
console.log("获得焦点");
|
66
|
+
},
|
67
|
+
},
|
68
|
+
},
|
69
|
+
},
|
70
|
+
|
71
|
+
// 3. Radio单选组示例
|
72
|
+
{
|
73
|
+
prop: "gender",
|
74
|
+
label: "单选组",
|
75
|
+
comp: {
|
76
|
+
name: "el-radio-group",
|
77
|
+
// 动态生成选项
|
78
|
+
children: (scope) => {
|
79
|
+
const options = [
|
80
|
+
{ label: "男", value: "male" },
|
81
|
+
{ label: "女", value: "female" },
|
82
|
+
];
|
83
|
+
return options.map((item) => ({
|
84
|
+
name: "el-radio",
|
85
|
+
label: item.value,
|
86
|
+
children: item.label,
|
87
|
+
}));
|
88
|
+
},
|
89
|
+
// 组件挂载后的回调
|
90
|
+
mounted: (scope, ref) => {
|
91
|
+
console.log("单选组已挂载:", ref);
|
92
|
+
},
|
93
|
+
},
|
94
|
+
},
|
95
|
+
|
96
|
+
// 4. 自定义组件示例
|
97
|
+
{
|
98
|
+
prop: "custom",
|
99
|
+
label: "自定义组件",
|
100
|
+
comp: {
|
101
|
+
name: this.CustomComponent,
|
102
|
+
// 自定义属性
|
103
|
+
customProp: "自定义值",
|
104
|
+
// 原生事件
|
105
|
+
nativeOn: {
|
106
|
+
click: () => {
|
107
|
+
console.log("点击自定义组件");
|
108
|
+
},
|
109
|
+
},
|
110
|
+
},
|
111
|
+
},
|
112
|
+
|
113
|
+
// 5. 级联选择器示例
|
114
|
+
{
|
115
|
+
prop: "region",
|
116
|
+
label: "地区选择",
|
117
|
+
comp: {
|
118
|
+
name: "el-cascader",
|
119
|
+
// 属性配置
|
120
|
+
options: [
|
121
|
+
{
|
122
|
+
value: "zhejiang",
|
123
|
+
label: "浙江",
|
124
|
+
children: [
|
125
|
+
{
|
126
|
+
value: "hangzhou",
|
127
|
+
label: "杭州",
|
128
|
+
},
|
129
|
+
],
|
130
|
+
},
|
131
|
+
],
|
132
|
+
// 条件属性
|
133
|
+
bind: (scope) => ({
|
134
|
+
disabled: !scope.row.type,
|
135
|
+
placeholder: `请选择${scope.item.label}`,
|
136
|
+
}),
|
137
|
+
// 值变化事件
|
138
|
+
on: {
|
139
|
+
change: (value, scope) => {
|
140
|
+
console.log("选择的地区:", value);
|
141
|
+
},
|
142
|
+
},
|
143
|
+
},
|
144
|
+
},
|
145
|
+
],
|
146
|
+
},
|
147
|
+
// 表格数据
|
148
|
+
form: {
|
149
|
+
id: 1,
|
150
|
+
type: ["1"],
|
151
|
+
name: "测试数据",
|
152
|
+
gender: "male",
|
153
|
+
custom: "",
|
154
|
+
region: ["zhejiang", "hangzhou"],
|
155
|
+
status: "normal",
|
156
|
+
},
|
157
|
+
};
|
158
|
+
},
|
159
|
+
};
|
160
|
+
</script>
|
@@ -0,0 +1,49 @@
|
|
1
|
+
<template>
|
2
|
+
<sc-crud :options="options" :data="data"> </sc-crud>
|
3
|
+
</template>
|
4
|
+
|
5
|
+
<script>
|
6
|
+
export default {
|
7
|
+
data() {
|
8
|
+
return {
|
9
|
+
options: {
|
10
|
+
renderColumns: [
|
11
|
+
{ prop: "name", label: "昵称" },
|
12
|
+
{
|
13
|
+
prop: "username",
|
14
|
+
label: "姓名",
|
15
|
+
formatter: (row) => row.username + " formatter",
|
16
|
+
},
|
17
|
+
{
|
18
|
+
prop: "gender",
|
19
|
+
label: "性别",
|
20
|
+
html: true,
|
21
|
+
formatter: (row) => {
|
22
|
+
return `<span style="color:red">${row.gender}</span>`;
|
23
|
+
},
|
24
|
+
},
|
25
|
+
],
|
26
|
+
},
|
27
|
+
data: [
|
28
|
+
{
|
29
|
+
createTime: "2018-06-02 12:28:47",
|
30
|
+
createUser: 94,
|
31
|
+
id: 56,
|
32
|
+
idNumber: "8",
|
33
|
+
name: "识间华中张认",
|
34
|
+
password: "sed laboris",
|
35
|
+
phone: "18157668675",
|
36
|
+
gender: "男",
|
37
|
+
age: 20,
|
38
|
+
status: 35,
|
39
|
+
updateTime: "2018-09-08 16:33:19",
|
40
|
+
updateUser: 58,
|
41
|
+
username: "石洋",
|
42
|
+
},
|
43
|
+
],
|
44
|
+
};
|
45
|
+
},
|
46
|
+
};
|
47
|
+
</script>
|
48
|
+
|
49
|
+
<style lang="scss" scoped></style>
|
@@ -0,0 +1,91 @@
|
|
1
|
+
<template>
|
2
|
+
<sc-crud :options="options" :data="data"> </sc-crud>
|
3
|
+
</template>
|
4
|
+
|
5
|
+
<script>
|
6
|
+
export default {
|
7
|
+
data() {
|
8
|
+
return {
|
9
|
+
options: {
|
10
|
+
pagination: true,
|
11
|
+
action: [
|
12
|
+
{
|
13
|
+
label: "操作",
|
14
|
+
icon: "el-icon-edit",
|
15
|
+
onClick: () => {},
|
16
|
+
},
|
17
|
+
],
|
18
|
+
renderColumns: [
|
19
|
+
{
|
20
|
+
prop: "name",
|
21
|
+
label: "昵称",
|
22
|
+
render: (h, scope) => {
|
23
|
+
// 安装了jsx相关转换插件可以使用vue-jsx语法
|
24
|
+
return <div>{scope.row.name + "render"}</div>;
|
25
|
+
},
|
26
|
+
},
|
27
|
+
{
|
28
|
+
prop: "username",
|
29
|
+
label: "名称",
|
30
|
+
render: (h, scope) => {
|
31
|
+
// 否则使用h函数渲染
|
32
|
+
return h("div", {}, scope.row.username + "h");
|
33
|
+
},
|
34
|
+
},
|
35
|
+
{
|
36
|
+
prop: "gender",
|
37
|
+
label: "性别",
|
38
|
+
render: (h, scope) => {
|
39
|
+
return (
|
40
|
+
<el-select
|
41
|
+
v-model={scope.row.gender} // 与v-model相同
|
42
|
+
onChange={() => {
|
43
|
+
console.log("change");
|
44
|
+
}} // 事件加on前缀
|
45
|
+
clearable // 组件的属性
|
46
|
+
props={{
|
47
|
+
// 约等于模板语法的v-bind
|
48
|
+
multiple: true,
|
49
|
+
}}
|
50
|
+
on={{
|
51
|
+
// 约等于模板语法的v-on
|
52
|
+
"visible-change": () => {
|
53
|
+
console.log("visible-change");
|
54
|
+
},
|
55
|
+
}}
|
56
|
+
scopedSlots={{
|
57
|
+
// 作用域插槽
|
58
|
+
prefix: () => "prefix",
|
59
|
+
}}
|
60
|
+
>
|
61
|
+
<i slot="prefix">具名插槽</i>
|
62
|
+
<el-option value="111" label="111"></el-option>
|
63
|
+
</el-select>
|
64
|
+
);
|
65
|
+
},
|
66
|
+
},
|
67
|
+
],
|
68
|
+
},
|
69
|
+
data: [
|
70
|
+
{
|
71
|
+
createTime: "2018-06-02 12:28:47",
|
72
|
+
createUser: 94,
|
73
|
+
id: 56,
|
74
|
+
idNumber: "8",
|
75
|
+
name: "识间华中张认",
|
76
|
+
password: "sed laboris",
|
77
|
+
phone: "18157668675",
|
78
|
+
gender: "男",
|
79
|
+
age: 20,
|
80
|
+
status: 35,
|
81
|
+
updateTime: "2018-09-08 16:33:19",
|
82
|
+
updateUser: 58,
|
83
|
+
username: "石洋",
|
84
|
+
},
|
85
|
+
],
|
86
|
+
};
|
87
|
+
},
|
88
|
+
};
|
89
|
+
</script>
|
90
|
+
|
91
|
+
<style lang="scss" scoped></style>
|
@@ -0,0 +1,63 @@
|
|
1
|
+
<template>
|
2
|
+
<sc-crud :options="options" :data="data">
|
3
|
+
<!-- 根据prop渲染插槽 -->
|
4
|
+
<template #name="{row}">
|
5
|
+
{{ row.name + "slot" }}
|
6
|
+
</template>
|
7
|
+
<template #username="{row}">
|
8
|
+
{{ row.username + "slot" }}
|
9
|
+
</template>
|
10
|
+
</sc-crud>
|
11
|
+
</template>
|
12
|
+
|
13
|
+
<script>
|
14
|
+
export default {
|
15
|
+
data() {
|
16
|
+
return {
|
17
|
+
options: {
|
18
|
+
pagination: true,
|
19
|
+
action: [
|
20
|
+
{
|
21
|
+
label: "操作",
|
22
|
+
icon: "el-icon-edit",
|
23
|
+
onClick: () => {},
|
24
|
+
},
|
25
|
+
],
|
26
|
+
renderColumns: [
|
27
|
+
{
|
28
|
+
prop: "name",
|
29
|
+
label: "昵称",
|
30
|
+
},
|
31
|
+
{
|
32
|
+
prop: "username",
|
33
|
+
label: "名称",
|
34
|
+
},
|
35
|
+
{
|
36
|
+
prop: "gender",
|
37
|
+
label: "性别",
|
38
|
+
},
|
39
|
+
],
|
40
|
+
},
|
41
|
+
data: [
|
42
|
+
{
|
43
|
+
createTime: "2018-06-02 12:28:47",
|
44
|
+
createUser: 94,
|
45
|
+
id: 56,
|
46
|
+
idNumber: "8",
|
47
|
+
name: "识间华中张认",
|
48
|
+
password: "sed laboris",
|
49
|
+
phone: "18157668675",
|
50
|
+
gender: "男",
|
51
|
+
age: 20,
|
52
|
+
status: 35,
|
53
|
+
updateTime: "2018-09-08 16:33:19",
|
54
|
+
updateUser: 58,
|
55
|
+
username: "石洋",
|
56
|
+
},
|
57
|
+
],
|
58
|
+
};
|
59
|
+
},
|
60
|
+
};
|
61
|
+
</script>
|
62
|
+
|
63
|
+
<style lang="scss" scoped></style>
|
@@ -0,0 +1,98 @@
|
|
1
|
+
<template>
|
2
|
+
<div>
|
3
|
+
<sc-crud
|
4
|
+
:loading="loading"
|
5
|
+
:search.sync="searchForm"
|
6
|
+
:options="options"
|
7
|
+
:data="data"
|
8
|
+
:total="total"
|
9
|
+
@getList="getList"
|
10
|
+
>
|
11
|
+
</sc-crud>
|
12
|
+
</div>
|
13
|
+
</template>
|
14
|
+
|
15
|
+
<script>
|
16
|
+
export default {
|
17
|
+
data() {
|
18
|
+
return {
|
19
|
+
loading: false,
|
20
|
+
searchForm: {},
|
21
|
+
options: {
|
22
|
+
init: true,
|
23
|
+
renderColumns: [
|
24
|
+
{
|
25
|
+
prop: "name",
|
26
|
+
label: "昵称",
|
27
|
+
search: true,
|
28
|
+
},
|
29
|
+
{
|
30
|
+
prop: "username",
|
31
|
+
label: "姓名",
|
32
|
+
search: true,
|
33
|
+
},
|
34
|
+
{
|
35
|
+
prop: "gender",
|
36
|
+
label: "性别",
|
37
|
+
search: true,
|
38
|
+
},
|
39
|
+
],
|
40
|
+
},
|
41
|
+
data: [],
|
42
|
+
total: 0,
|
43
|
+
};
|
44
|
+
},
|
45
|
+
methods: {
|
46
|
+
async getList() {
|
47
|
+
this.loading = true;
|
48
|
+
const { data, total } = await this.listApi(this.searchForm);
|
49
|
+
this.loading = false;
|
50
|
+
this.data = data;
|
51
|
+
this.total = total;
|
52
|
+
},
|
53
|
+
listApi() {
|
54
|
+
// 模拟请求api
|
55
|
+
return new Promise((resolve, reject) => {
|
56
|
+
setTimeout(() => {
|
57
|
+
resolve({
|
58
|
+
code: 200,
|
59
|
+
data: [
|
60
|
+
{
|
61
|
+
createTime: "2018-06-02 12:28:47",
|
62
|
+
createUser: 94,
|
63
|
+
id: 56,
|
64
|
+
idNumber: "8",
|
65
|
+
name: "识间华中张认",
|
66
|
+
password: "sed laboris",
|
67
|
+
phone: "18157668675",
|
68
|
+
gender: "男",
|
69
|
+
age: 20,
|
70
|
+
status: 35,
|
71
|
+
updateTime: "2018-09-08 16:33:19",
|
72
|
+
updateUser: 58,
|
73
|
+
username: "石洋",
|
74
|
+
},
|
75
|
+
{
|
76
|
+
createTime: "2018-06-02 12:28:47",
|
77
|
+
createUser: 94,
|
78
|
+
id: 57,
|
79
|
+
idNumber: "8",
|
80
|
+
name: "识间华中张认1",
|
81
|
+
password: "sed laboris",
|
82
|
+
phone: "18157668675",
|
83
|
+
gender: "男",
|
84
|
+
age: 20,
|
85
|
+
status: 35,
|
86
|
+
updateTime: "2018-09-08 16:33:19",
|
87
|
+
updateUser: 58,
|
88
|
+
username: "石洋11",
|
89
|
+
},
|
90
|
+
],
|
91
|
+
total: 2,
|
92
|
+
});
|
93
|
+
}, 1000);
|
94
|
+
});
|
95
|
+
},
|
96
|
+
},
|
97
|
+
};
|
98
|
+
</script>
|
@@ -0,0 +1,72 @@
|
|
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
|
+
options: {
|
14
|
+
handleRow: [
|
15
|
+
{
|
16
|
+
label: "操作列隐藏",
|
17
|
+
type: "primary",
|
18
|
+
onClick: () => {
|
19
|
+
this.options.action = false;
|
20
|
+
},
|
21
|
+
},
|
22
|
+
],
|
23
|
+
action: {
|
24
|
+
width: "auto", // auto: 自动计算宽度
|
25
|
+
calcWidth: 20, // 增加的宽度,默认20
|
26
|
+
handles: [
|
27
|
+
{
|
28
|
+
icon: "el-icon-search",
|
29
|
+
type: "primary",
|
30
|
+
onClick: () => {
|
31
|
+
console.log("search");
|
32
|
+
},
|
33
|
+
},
|
34
|
+
],
|
35
|
+
},
|
36
|
+
renderColumns: [
|
37
|
+
{ prop: "name", label: "昵称", search: true },
|
38
|
+
{
|
39
|
+
prop: "username",
|
40
|
+
label: "姓名",
|
41
|
+
search: {
|
42
|
+
name: "el-date-picker",
|
43
|
+
},
|
44
|
+
},
|
45
|
+
{
|
46
|
+
prop: "gender",
|
47
|
+
label: "性别",
|
48
|
+
},
|
49
|
+
],
|
50
|
+
},
|
51
|
+
data: [
|
52
|
+
{
|
53
|
+
createTime: "2018-06-02 12:28:47",
|
54
|
+
createUser: 94,
|
55
|
+
id: 56,
|
56
|
+
idNumber: "8",
|
57
|
+
name: "识间华中张认",
|
58
|
+
password: "sed laboris",
|
59
|
+
phone: "18157668675",
|
60
|
+
gender: "男",
|
61
|
+
age: 20,
|
62
|
+
status: 35,
|
63
|
+
updateTime: "2018-09-08 16:33:19",
|
64
|
+
updateUser: 58,
|
65
|
+
username: "石洋",
|
66
|
+
},
|
67
|
+
],
|
68
|
+
};
|
69
|
+
},
|
70
|
+
methods: {},
|
71
|
+
};
|
72
|
+
</script>
|
@@ -0,0 +1,107 @@
|
|
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
|
+
options: {
|
14
|
+
// 列宽度自动计算规则
|
15
|
+
calcColumnWidth: {
|
16
|
+
widthType: "first", // first为默认值,仅计算第一个有内容的宽度
|
17
|
+
widthFont: "12px Ubuntu", //自定义计算的字体大小和类型(有助于更精确的计算)
|
18
|
+
calcWidth: 20, // 增加的宽度,默认单元格内边距20px
|
19
|
+
},
|
20
|
+
renderColumns: [
|
21
|
+
{
|
22
|
+
prop: "name",
|
23
|
+
width: "auto", // 列自动计算宽度
|
24
|
+
label: "昵称1",
|
25
|
+
search: true,
|
26
|
+
},
|
27
|
+
{
|
28
|
+
prop: "name",
|
29
|
+
width: "auto",
|
30
|
+
calcWidth: 200, // 增加的宽度
|
31
|
+
label: "昵称2",
|
32
|
+
search: true,
|
33
|
+
},
|
34
|
+
{
|
35
|
+
prop: "name",
|
36
|
+
minWidth: "auto", // 列自动计算最小宽度
|
37
|
+
label: "昵称3",
|
38
|
+
search: true,
|
39
|
+
},
|
40
|
+
{
|
41
|
+
prop: "username",
|
42
|
+
label: "姓名",
|
43
|
+
width: "auto",
|
44
|
+
widthType: "max", // 计算所有内容的最大宽度(数据量大存在性能问题),独立设置,覆盖calcColumnWidth
|
45
|
+
widthFont: "12px Ubuntu",
|
46
|
+
search: {
|
47
|
+
name: "el-date-picker",
|
48
|
+
},
|
49
|
+
},
|
50
|
+
{
|
51
|
+
prop: "gender",
|
52
|
+
label: "性别",
|
53
|
+
},
|
54
|
+
],
|
55
|
+
},
|
56
|
+
data: [
|
57
|
+
{
|
58
|
+
createTime: "2018-06-02 12:28:47",
|
59
|
+
createUser: 94,
|
60
|
+
id: 56,
|
61
|
+
idNumber: "8",
|
62
|
+
name: "识间华中张认",
|
63
|
+
password: "sed laboris",
|
64
|
+
phone: "18157668675",
|
65
|
+
gender: "男",
|
66
|
+
age: 20,
|
67
|
+
status: 35,
|
68
|
+
updateTime: "2018-09-08 16:33:19",
|
69
|
+
updateUser: 58,
|
70
|
+
username: "石洋ooooooo",
|
71
|
+
},
|
72
|
+
{
|
73
|
+
createTime: "2018-06-02 12:28:47",
|
74
|
+
createUser: 94,
|
75
|
+
id: 56,
|
76
|
+
idNumber: "8",
|
77
|
+
name: "识间华中张认ooooooooooooooo",
|
78
|
+
password: "sed laboris",
|
79
|
+
phone: "18157668675",
|
80
|
+
gender: "男",
|
81
|
+
age: 20,
|
82
|
+
status: 35,
|
83
|
+
updateTime: "2018-09-08 16:33:19",
|
84
|
+
updateUser: 58,
|
85
|
+
username: "石洋oooooooooooooooo",
|
86
|
+
},
|
87
|
+
{
|
88
|
+
createTime: "2018-06-02 12:28:47",
|
89
|
+
createUser: 94,
|
90
|
+
id: 56,
|
91
|
+
idNumber: "8",
|
92
|
+
name: "识间华中张认oooooooooooooooooooooooooooooooooo",
|
93
|
+
password: "sed laboris",
|
94
|
+
phone: "18157668675",
|
95
|
+
gender: "男",
|
96
|
+
age: 20,
|
97
|
+
status: 35,
|
98
|
+
updateTime: "2018-09-08 16:33:19",
|
99
|
+
updateUser: 58,
|
100
|
+
username: "石洋312312312______-----ooooooooooooooooooo",
|
101
|
+
},
|
102
|
+
],
|
103
|
+
};
|
104
|
+
},
|
105
|
+
methods: {},
|
106
|
+
};
|
107
|
+
</script>
|
@@ -0,0 +1,65 @@
|
|
1
|
+
<template>
|
2
|
+
<div>
|
3
|
+
<sc-crud :search.sync="searchForm" :options="options" :data="data">
|
4
|
+
<template #handleRow-left="{size}">
|
5
|
+
<el-button :size="size">handleRow插槽</el-button>
|
6
|
+
</template>
|
7
|
+
</sc-crud>
|
8
|
+
</div>
|
9
|
+
</template>
|
10
|
+
|
11
|
+
<script>
|
12
|
+
export default {
|
13
|
+
data() {
|
14
|
+
return {
|
15
|
+
searchForm: {},
|
16
|
+
options: {
|
17
|
+
rowEdit: true,
|
18
|
+
handleRow: {
|
19
|
+
add: {
|
20
|
+
label: "自定义弹窗新增",
|
21
|
+
}, // 自定义弹窗新增按钮
|
22
|
+
batchDelete: {
|
23
|
+
label: "自定义批量删除",
|
24
|
+
}, // 自定义批量删除按钮
|
25
|
+
rowAdd: {
|
26
|
+
label: "定义行新增",
|
27
|
+
}, // 自定义行新增按钮
|
28
|
+
},
|
29
|
+
renderColumns: [
|
30
|
+
{ prop: "name", label: "昵称", search: true },
|
31
|
+
{
|
32
|
+
prop: "username",
|
33
|
+
label: "姓名",
|
34
|
+
search: {
|
35
|
+
name: "el-date-picker",
|
36
|
+
},
|
37
|
+
},
|
38
|
+
{
|
39
|
+
prop: "gender",
|
40
|
+
label: "性别",
|
41
|
+
},
|
42
|
+
],
|
43
|
+
},
|
44
|
+
data: [
|
45
|
+
{
|
46
|
+
createTime: "2018-06-02 12:28:47",
|
47
|
+
createUser: 94,
|
48
|
+
id: 56,
|
49
|
+
idNumber: "8",
|
50
|
+
name: "识间华中张认",
|
51
|
+
password: "sed laboris",
|
52
|
+
phone: "18157668675",
|
53
|
+
gender: "男",
|
54
|
+
age: 20,
|
55
|
+
status: 35,
|
56
|
+
updateTime: "2018-09-08 16:33:19",
|
57
|
+
updateUser: 58,
|
58
|
+
username: "石洋",
|
59
|
+
},
|
60
|
+
],
|
61
|
+
};
|
62
|
+
},
|
63
|
+
methods: {},
|
64
|
+
};
|
65
|
+
</script>
|