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,123 @@
|
|
1
|
+
<template>
|
2
|
+
<div>
|
3
|
+
<div style="margin-bottom: 10px;">
|
4
|
+
搜索参数:
|
5
|
+
<div>{{ JSON.stringify(search) }}</div>
|
6
|
+
</div>
|
7
|
+
<sc-crud
|
8
|
+
:loading.sync="loading"
|
9
|
+
:search.sync="search"
|
10
|
+
:options="options"
|
11
|
+
:data="data"
|
12
|
+
:total="total"
|
13
|
+
@getList="getList"
|
14
|
+
>
|
15
|
+
</sc-crud>
|
16
|
+
</div>
|
17
|
+
</template>
|
18
|
+
|
19
|
+
<script>
|
20
|
+
import { mockApi } from "../../mock";
|
21
|
+
export default {
|
22
|
+
data() {
|
23
|
+
return {
|
24
|
+
loading: false,
|
25
|
+
search: {
|
26
|
+
pageNum: 1,
|
27
|
+
pageSize: 10,
|
28
|
+
},
|
29
|
+
options: {
|
30
|
+
border: true,
|
31
|
+
init: true,
|
32
|
+
expandSearch: true, // 初始展开搜索框
|
33
|
+
renderColumns: [
|
34
|
+
{
|
35
|
+
prop: "name",
|
36
|
+
label: "姓名",
|
37
|
+
search: true, // 启用搜索
|
38
|
+
},
|
39
|
+
{
|
40
|
+
prop: "gender",
|
41
|
+
label: "性别",
|
42
|
+
search: {
|
43
|
+
comp: {
|
44
|
+
name: "el-select", // 使用下拉选择
|
45
|
+
options: [
|
46
|
+
{ label: "男", value: "男" },
|
47
|
+
{ label: "女", value: "女" },
|
48
|
+
],
|
49
|
+
},
|
50
|
+
reset: () => {
|
51
|
+
console.log("重置事件");
|
52
|
+
},
|
53
|
+
},
|
54
|
+
},
|
55
|
+
{
|
56
|
+
prop: "age",
|
57
|
+
label: "年龄",
|
58
|
+
},
|
59
|
+
{
|
60
|
+
prop: "is30",
|
61
|
+
label: "大于30",
|
62
|
+
search: {
|
63
|
+
comp: {
|
64
|
+
name: "el-select",
|
65
|
+
options: [
|
66
|
+
{ label: "是", value: "是" },
|
67
|
+
{ label: "否", value: "否" },
|
68
|
+
],
|
69
|
+
},
|
70
|
+
},
|
71
|
+
},
|
72
|
+
{
|
73
|
+
prop: "city",
|
74
|
+
label: "城市",
|
75
|
+
search: {
|
76
|
+
comp: {
|
77
|
+
name: "el-select",
|
78
|
+
options: [
|
79
|
+
{ label: "北京", value: "北京" },
|
80
|
+
{ label: "上海", value: "上海" },
|
81
|
+
{ label: "广州", value: "广州" },
|
82
|
+
],
|
83
|
+
},
|
84
|
+
},
|
85
|
+
},
|
86
|
+
{
|
87
|
+
prop: "date",
|
88
|
+
label: "日期",
|
89
|
+
search: {
|
90
|
+
comp: {
|
91
|
+
name: "el-date-picker",
|
92
|
+
type: "daterange",
|
93
|
+
startPlaceholder: "开始日期",
|
94
|
+
endPlaceholder: "结束日期",
|
95
|
+
valueFormat: "yyyy-MM-dd",
|
96
|
+
},
|
97
|
+
},
|
98
|
+
},
|
99
|
+
],
|
100
|
+
searchForm: {
|
101
|
+
columnWidth: "220px",
|
102
|
+
labelWidth: "80px",
|
103
|
+
},
|
104
|
+
},
|
105
|
+
data: [],
|
106
|
+
total: 0,
|
107
|
+
};
|
108
|
+
},
|
109
|
+
|
110
|
+
methods: {
|
111
|
+
async getList() {
|
112
|
+
this.loading = true;
|
113
|
+
try {
|
114
|
+
const { data, total } = await mockApi.getList(this.search);
|
115
|
+
this.data = data;
|
116
|
+
this.total = total;
|
117
|
+
} finally {
|
118
|
+
this.loading = false;
|
119
|
+
}
|
120
|
+
},
|
121
|
+
},
|
122
|
+
};
|
123
|
+
</script>
|
@@ -0,0 +1,124 @@
|
|
1
|
+
<template>
|
2
|
+
<div>
|
3
|
+
<div style="margin-bottom: 10px;">
|
4
|
+
搜索参数:
|
5
|
+
<div>{{ JSON.stringify(search) }}</div>
|
6
|
+
</div>
|
7
|
+
<sc-crud
|
8
|
+
:loading.sync="loading"
|
9
|
+
:search.sync="search"
|
10
|
+
:options="options"
|
11
|
+
:data="data"
|
12
|
+
:total="total"
|
13
|
+
@getList="getList"
|
14
|
+
>
|
15
|
+
</sc-crud>
|
16
|
+
</div>
|
17
|
+
</template>
|
18
|
+
|
19
|
+
<script>
|
20
|
+
import { mockApi } from "../../mock";
|
21
|
+
export default {
|
22
|
+
data() {
|
23
|
+
return {
|
24
|
+
loading: false,
|
25
|
+
search: {
|
26
|
+
pageNum: 1,
|
27
|
+
pageSize: 10,
|
28
|
+
},
|
29
|
+
options: {
|
30
|
+
border: true,
|
31
|
+
init: true,
|
32
|
+
expandSearch: true, // 初始展开搜索框
|
33
|
+
localSearch: true, // 启用本地搜索
|
34
|
+
renderColumns: [
|
35
|
+
{
|
36
|
+
prop: "name",
|
37
|
+
label: "姓名",
|
38
|
+
search: true, // 启用搜索
|
39
|
+
},
|
40
|
+
{
|
41
|
+
prop: "gender",
|
42
|
+
label: "性别",
|
43
|
+
search: {
|
44
|
+
comp: {
|
45
|
+
name: "el-select", // 使用下拉选择
|
46
|
+
options: [
|
47
|
+
{ label: "男", value: "男" },
|
48
|
+
{ label: "女", value: "女" },
|
49
|
+
],
|
50
|
+
},
|
51
|
+
},
|
52
|
+
},
|
53
|
+
{
|
54
|
+
prop: "age",
|
55
|
+
label: "年龄",
|
56
|
+
search: {
|
57
|
+
filter: (cellValue, searchValue, row) => {
|
58
|
+
console.log(cellValue, searchValue, row);
|
59
|
+
// 返回 true 表示匹配,false 表示不匹配
|
60
|
+
return cellValue > 30;
|
61
|
+
},
|
62
|
+
},
|
63
|
+
},
|
64
|
+
{
|
65
|
+
prop: "is30",
|
66
|
+
label: "大于30",
|
67
|
+
search: {
|
68
|
+
comp: {
|
69
|
+
name: "el-select",
|
70
|
+
options: [
|
71
|
+
{ label: "是", value: "是" },
|
72
|
+
{ label: "否", value: "否" },
|
73
|
+
],
|
74
|
+
},
|
75
|
+
},
|
76
|
+
},
|
77
|
+
{
|
78
|
+
prop: "city",
|
79
|
+
label: "城市",
|
80
|
+
search: {
|
81
|
+
comp: {
|
82
|
+
name: "el-select",
|
83
|
+
options: [
|
84
|
+
{ label: "北京", value: "北京" },
|
85
|
+
{ label: "上海", value: "上海" },
|
86
|
+
{ label: "广州", value: "广州" },
|
87
|
+
],
|
88
|
+
},
|
89
|
+
},
|
90
|
+
},
|
91
|
+
{
|
92
|
+
prop: "date",
|
93
|
+
label: "日期",
|
94
|
+
search: {
|
95
|
+
comp: {
|
96
|
+
name: "el-date-picker",
|
97
|
+
type: "daterange",
|
98
|
+
startPlaceholder: "开始日期",
|
99
|
+
endPlaceholder: "结束日期",
|
100
|
+
valueFormat: "yyyy-MM-dd",
|
101
|
+
},
|
102
|
+
},
|
103
|
+
},
|
104
|
+
],
|
105
|
+
},
|
106
|
+
data: [],
|
107
|
+
total: 0,
|
108
|
+
};
|
109
|
+
},
|
110
|
+
|
111
|
+
methods: {
|
112
|
+
async getList() {
|
113
|
+
this.loading = true;
|
114
|
+
try {
|
115
|
+
const { data, total } = await mockApi.getList(this.search);
|
116
|
+
this.data = data;
|
117
|
+
this.total = total;
|
118
|
+
} finally {
|
119
|
+
this.loading = false;
|
120
|
+
}
|
121
|
+
},
|
122
|
+
},
|
123
|
+
};
|
124
|
+
</script>
|
@@ -0,0 +1,148 @@
|
|
1
|
+
<template>
|
2
|
+
<div>
|
3
|
+
<div style="margin-bottom: 15px;">搜索参数:{{ search }}</div>
|
4
|
+
<sc-crud
|
5
|
+
:loading.sync="loading"
|
6
|
+
:search.sync="search"
|
7
|
+
:options="options"
|
8
|
+
:data="data"
|
9
|
+
:total="total"
|
10
|
+
@getList="getList"
|
11
|
+
>
|
12
|
+
<!-- 自定义城市搜索组件 -->
|
13
|
+
<template #city-search>
|
14
|
+
<el-cascader
|
15
|
+
v-model="search.city"
|
16
|
+
:options="cityTreeData"
|
17
|
+
:props="{ checkStrictly: true }"
|
18
|
+
clearable
|
19
|
+
></el-cascader>
|
20
|
+
</template>
|
21
|
+
|
22
|
+
<!-- 自定义年龄搜索标题 -->
|
23
|
+
<template #age-search-label>
|
24
|
+
<span>自定义年龄搜索标题 <i class="el-icon-warning"></i></span>
|
25
|
+
</template>
|
26
|
+
|
27
|
+
<!-- 自定义搜索头 -->
|
28
|
+
<template #date-searchHeader>
|
29
|
+
<div>
|
30
|
+
自定义搜索头
|
31
|
+
</div>
|
32
|
+
</template>
|
33
|
+
</sc-crud>
|
34
|
+
</div>
|
35
|
+
</template>
|
36
|
+
|
37
|
+
<script>
|
38
|
+
import { mockApi, cityTreeData } from "../../mock";
|
39
|
+
|
40
|
+
export default {
|
41
|
+
data() {
|
42
|
+
return {
|
43
|
+
loading: false,
|
44
|
+
cityTreeData,
|
45
|
+
search: {
|
46
|
+
pageNum: 1,
|
47
|
+
pageSize: 10,
|
48
|
+
city: [],
|
49
|
+
status: "",
|
50
|
+
},
|
51
|
+
options: {
|
52
|
+
border: true,
|
53
|
+
init: true,
|
54
|
+
expandSearch: true,
|
55
|
+
// 搜索表单配置
|
56
|
+
searchForm: {
|
57
|
+
columnWidth: "300px",
|
58
|
+
labelWidth: "100px",
|
59
|
+
// 自定义操作按钮
|
60
|
+
action: {
|
61
|
+
search: {
|
62
|
+
label: "查询",
|
63
|
+
icon: "el-icon-search",
|
64
|
+
},
|
65
|
+
reset: {
|
66
|
+
label: "清空",
|
67
|
+
icon: "el-icon-delete",
|
68
|
+
},
|
69
|
+
handles: [
|
70
|
+
{
|
71
|
+
label: "导出搜索结果",
|
72
|
+
icon: "el-icon-download",
|
73
|
+
type: "success",
|
74
|
+
onClick: (search) => {
|
75
|
+
console.log("导出搜索条件:", search);
|
76
|
+
},
|
77
|
+
},
|
78
|
+
],
|
79
|
+
},
|
80
|
+
},
|
81
|
+
// 表头搜索配置
|
82
|
+
searchHeader: {
|
83
|
+
trigger: "click",
|
84
|
+
placement: "bottom",
|
85
|
+
},
|
86
|
+
renderColumns: [
|
87
|
+
{
|
88
|
+
prop: "name",
|
89
|
+
label: "姓名",
|
90
|
+
search: {
|
91
|
+
// 自定义渲染函数
|
92
|
+
labelRender: () => (
|
93
|
+
<span>
|
94
|
+
自定义姓名标题 <i class="el-icon-warning"></i>
|
95
|
+
</span>
|
96
|
+
),
|
97
|
+
},
|
98
|
+
},
|
99
|
+
{
|
100
|
+
prop: "age",
|
101
|
+
label: "年龄",
|
102
|
+
search: true,
|
103
|
+
},
|
104
|
+
{
|
105
|
+
prop: "city",
|
106
|
+
label: "城市",
|
107
|
+
search: true, // 使用插槽自定义
|
108
|
+
},
|
109
|
+
{
|
110
|
+
prop: "status",
|
111
|
+
label: "状态",
|
112
|
+
search: {
|
113
|
+
comp: {
|
114
|
+
name: "el-radio-group",
|
115
|
+
options: [
|
116
|
+
{ label: "全部", value: "" },
|
117
|
+
{ label: "启用", value: 1 },
|
118
|
+
{ label: "禁用", value: 0 },
|
119
|
+
],
|
120
|
+
},
|
121
|
+
},
|
122
|
+
},
|
123
|
+
{
|
124
|
+
prop: "date",
|
125
|
+
label: "测试",
|
126
|
+
search: true,
|
127
|
+
},
|
128
|
+
],
|
129
|
+
},
|
130
|
+
data: [],
|
131
|
+
total: 0,
|
132
|
+
};
|
133
|
+
},
|
134
|
+
|
135
|
+
methods: {
|
136
|
+
async getList() {
|
137
|
+
this.loading = true;
|
138
|
+
try {
|
139
|
+
const { data, total } = await mockApi.getList(this.search);
|
140
|
+
this.data = data;
|
141
|
+
this.total = total;
|
142
|
+
} finally {
|
143
|
+
this.loading = false;
|
144
|
+
}
|
145
|
+
},
|
146
|
+
},
|
147
|
+
};
|
148
|
+
</script>
|
@@ -0,0 +1,47 @@
|
|
1
|
+
<template>
|
2
|
+
<div>
|
3
|
+
<sc-crud
|
4
|
+
:selected="selectedRows"
|
5
|
+
:options="options"
|
6
|
+
:data="data"
|
7
|
+
@selection-change="handleSelectionChange"
|
8
|
+
@select="handleSelect"
|
9
|
+
@select-all="handleSelectAll"
|
10
|
+
>
|
11
|
+
</sc-crud>
|
12
|
+
</div>
|
13
|
+
</template>
|
14
|
+
|
15
|
+
<script>
|
16
|
+
export default {
|
17
|
+
data() {
|
18
|
+
return {
|
19
|
+
selectedRows: [],
|
20
|
+
options: {
|
21
|
+
selection: true,
|
22
|
+
renderColumns: [
|
23
|
+
{ prop: "name", label: "姓名" },
|
24
|
+
{ prop: "gender", label: "性别" },
|
25
|
+
],
|
26
|
+
},
|
27
|
+
data: [
|
28
|
+
{ id: 1, name: "张三", gender: "男" },
|
29
|
+
{ id: 2, name: "李四", gender: "女" },
|
30
|
+
],
|
31
|
+
};
|
32
|
+
},
|
33
|
+
methods: {
|
34
|
+
handleSelectionChange(selection) {
|
35
|
+
this.$message.success(`选中 ${selection.length} 条数据`);
|
36
|
+
},
|
37
|
+
handleSelect(selection, row) {
|
38
|
+
this.$message.info(
|
39
|
+
`${row.name} ${selection.includes(row) ? "被选中" : "取消选中"}`
|
40
|
+
);
|
41
|
+
},
|
42
|
+
handleSelectAll(selection) {
|
43
|
+
this.$message.info(`${selection.length ? "全选" : "取消全选"}`);
|
44
|
+
},
|
45
|
+
},
|
46
|
+
};
|
47
|
+
</script>
|
@@ -0,0 +1,94 @@
|
|
1
|
+
<template>
|
2
|
+
<div>
|
3
|
+
<el-button @click="handleClick">手动更新选中数据</el-button>
|
4
|
+
<sc-crud
|
5
|
+
:loading.sync="loading"
|
6
|
+
:search.sync="search"
|
7
|
+
:selected.sync="selectedRows"
|
8
|
+
:options="options"
|
9
|
+
:data="data"
|
10
|
+
:total="total"
|
11
|
+
@getList="getList"
|
12
|
+
>
|
13
|
+
</sc-crud>
|
14
|
+
</div>
|
15
|
+
</template>
|
16
|
+
|
17
|
+
<script>
|
18
|
+
import { mockApi } from "../../mock";
|
19
|
+
export default {
|
20
|
+
data() {
|
21
|
+
return {
|
22
|
+
loading: false,
|
23
|
+
selectedRows: [
|
24
|
+
{
|
25
|
+
id: 1,
|
26
|
+
},
|
27
|
+
{
|
28
|
+
id: 2,
|
29
|
+
},
|
30
|
+
{
|
31
|
+
id: 3,
|
32
|
+
},
|
33
|
+
{
|
34
|
+
id: 8,
|
35
|
+
},
|
36
|
+
{
|
37
|
+
id: 7,
|
38
|
+
},
|
39
|
+
],
|
40
|
+
search: {
|
41
|
+
pageNum: 1,
|
42
|
+
pageSize: 10,
|
43
|
+
},
|
44
|
+
options: {
|
45
|
+
selection: {
|
46
|
+
reserveSelection: true, // 是否保留选中状态
|
47
|
+
ctrlSelect: true, // 是否启用 Ctrl 键点击选中
|
48
|
+
shiftSelect: true, // 是否启用 Shift 键批量选中
|
49
|
+
banner: true, // 是否显示横幅
|
50
|
+
maxDisplay: 3, // 直接显示的最大数量
|
51
|
+
labelKey: "name", // 显示的字段名
|
52
|
+
clear: true, // 是否显示清除按钮
|
53
|
+
selectable: (row, index) => {
|
54
|
+
return index !== 0 && index !== 7;
|
55
|
+
},
|
56
|
+
},
|
57
|
+
init: true,
|
58
|
+
renderColumns: [
|
59
|
+
{ prop: "name", label: "姓名" },
|
60
|
+
{ prop: "gender", label: "性别" },
|
61
|
+
{ prop: "age", label: "年龄" },
|
62
|
+
{ prop: "city", label: "城市" },
|
63
|
+
],
|
64
|
+
},
|
65
|
+
data: [],
|
66
|
+
total: 0,
|
67
|
+
};
|
68
|
+
},
|
69
|
+
computed: {
|
70
|
+
selectedNames() {
|
71
|
+
return this.selectedRows.map((row) => row.name).join("、");
|
72
|
+
},
|
73
|
+
},
|
74
|
+
methods: {
|
75
|
+
async getList() {
|
76
|
+
this.loading = true;
|
77
|
+
const { data, total } = await mockApi.getList(this.search);
|
78
|
+
this.data = data;
|
79
|
+
this.total = total;
|
80
|
+
this.loading = false;
|
81
|
+
},
|
82
|
+
handleClick() {
|
83
|
+
this.selectedRows = [
|
84
|
+
{
|
85
|
+
id: 1,
|
86
|
+
},
|
87
|
+
{
|
88
|
+
id: 3,
|
89
|
+
},
|
90
|
+
];
|
91
|
+
},
|
92
|
+
},
|
93
|
+
};
|
94
|
+
</script>
|
@@ -0,0 +1,64 @@
|
|
1
|
+
<template>
|
2
|
+
<div>
|
3
|
+
<sc-crud
|
4
|
+
:loading.sync="loading"
|
5
|
+
:search.sync="search"
|
6
|
+
:selected.sync="selectedRows"
|
7
|
+
:options="options"
|
8
|
+
:data="data"
|
9
|
+
:total="total"
|
10
|
+
@getList="getList"
|
11
|
+
>
|
12
|
+
</sc-crud>
|
13
|
+
</div>
|
14
|
+
</template>
|
15
|
+
|
16
|
+
<script>
|
17
|
+
import { mockApi } from "../../mock";
|
18
|
+
export default {
|
19
|
+
data() {
|
20
|
+
return {
|
21
|
+
loading: false,
|
22
|
+
selectedRows: {
|
23
|
+
id: 2,
|
24
|
+
},
|
25
|
+
search: {
|
26
|
+
pageNum: 1,
|
27
|
+
pageSize: 10,
|
28
|
+
},
|
29
|
+
options: {
|
30
|
+
singleSelection: {
|
31
|
+
banner: true,
|
32
|
+
ctrlSelect: true,
|
33
|
+
selectable: (row, index) => {
|
34
|
+
return index !== 0;
|
35
|
+
},
|
36
|
+
},
|
37
|
+
init: true,
|
38
|
+
renderColumns: [
|
39
|
+
{ prop: "name", label: "姓名" },
|
40
|
+
{ prop: "gender", label: "性别" },
|
41
|
+
{ prop: "age", label: "年龄" },
|
42
|
+
{ prop: "city", label: "城市" },
|
43
|
+
],
|
44
|
+
},
|
45
|
+
data: [],
|
46
|
+
total: 0,
|
47
|
+
};
|
48
|
+
},
|
49
|
+
computed: {
|
50
|
+
selectedNames() {
|
51
|
+
return this.selectedRows.map((row) => row.name).join("、");
|
52
|
+
},
|
53
|
+
},
|
54
|
+
methods: {
|
55
|
+
async getList() {
|
56
|
+
this.loading = true;
|
57
|
+
const { data, total } = await mockApi.getList(this.search);
|
58
|
+
this.data = data;
|
59
|
+
this.total = total;
|
60
|
+
this.loading = false;
|
61
|
+
},
|
62
|
+
},
|
63
|
+
};
|
64
|
+
</script>
|
@@ -0,0 +1,69 @@
|
|
1
|
+
<template>
|
2
|
+
<sc-crud
|
3
|
+
:loading.sync="loading"
|
4
|
+
:search.sync="search"
|
5
|
+
:options="options"
|
6
|
+
:data="data"
|
7
|
+
:total="total"
|
8
|
+
@getList="getList"
|
9
|
+
>
|
10
|
+
</sc-crud>
|
11
|
+
</template>
|
12
|
+
|
13
|
+
<script>
|
14
|
+
import { mockApi } from "../../mock";
|
15
|
+
export default {
|
16
|
+
data() {
|
17
|
+
return {
|
18
|
+
loading: false,
|
19
|
+
search: {
|
20
|
+
pageNum: 1,
|
21
|
+
pageSize: 10,
|
22
|
+
},
|
23
|
+
options: {
|
24
|
+
border: true,
|
25
|
+
init: true,
|
26
|
+
renderColumns: [
|
27
|
+
{
|
28
|
+
prop: "city",
|
29
|
+
label: "城市",
|
30
|
+
spanProp: "city", // 开启该列合并
|
31
|
+
},
|
32
|
+
{
|
33
|
+
prop: "gender",
|
34
|
+
label: "性别",
|
35
|
+
spanProp: "gender", // 开启该列合并
|
36
|
+
},
|
37
|
+
{
|
38
|
+
prop: "age",
|
39
|
+
label: "年龄",
|
40
|
+
},
|
41
|
+
{
|
42
|
+
prop: "is30",
|
43
|
+
label: "大于30",
|
44
|
+
spanProp: "is30",
|
45
|
+
},
|
46
|
+
{ prop: "name", label: "姓名" },
|
47
|
+
],
|
48
|
+
showSummary: true, // 启用合计行
|
49
|
+
},
|
50
|
+
data: [],
|
51
|
+
total: 0,
|
52
|
+
};
|
53
|
+
},
|
54
|
+
|
55
|
+
methods: {
|
56
|
+
async getList() {
|
57
|
+
this.loading = true;
|
58
|
+
try {
|
59
|
+
const { data, total } = await mockApi.getList(this.search);
|
60
|
+
// 根据当前排序字段对数据进行排序
|
61
|
+
this.data = [...data];
|
62
|
+
this.total = total;
|
63
|
+
} finally {
|
64
|
+
this.loading = false;
|
65
|
+
}
|
66
|
+
},
|
67
|
+
},
|
68
|
+
};
|
69
|
+
</script>
|