vue-super-crud 1.7.1 → 1.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +42 -10
- package/lib/index.css +1 -1
- package/lib/super-crud.min.js +2 -2
- package/package.json +21 -16
- package/.browserslistrc +0 -3
- package/.versionrc.json +0 -36
- package/CHANGELOG.md +0 -232
- package/babel.config.js +0 -12
- package/build/alias.js +0 -10
- package/build/build.js +0 -52
- package/build/config.js +0 -70
- package/deploy.bat +0 -14
- package/docs/.vuepress/components/button/base.vue +0 -88
- package/docs/.vuepress/components/common/code-format.vue +0 -331
- package/docs/.vuepress/components/commonConfig/presetCodeTemplate/base.vue +0 -68
- package/docs/.vuepress/components/commonConfig/presetCodeTemplate/customParams.vue +0 -73
- package/docs/.vuepress/components/commonConfig/renderType/component.vue +0 -160
- package/docs/.vuepress/components/commonConfig/renderType/formatter.vue +0 -49
- package/docs/.vuepress/components/commonConfig/renderType/render.vue +0 -91
- package/docs/.vuepress/components/commonConfig/renderType/slot.vue +0 -63
- package/docs/.vuepress/components/crud/baseUse/baseUse.vue +0 -98
- package/docs/.vuepress/components/crud/baseUse/columnAction.vue +0 -72
- package/docs/.vuepress/components/crud/baseUse/columnWidth.vue +0 -107
- package/docs/.vuepress/components/crud/baseUse/handleRow.vue +0 -65
- package/docs/.vuepress/components/crud/baseUse/height.vue +0 -82
- package/docs/.vuepress/components/crud/baseUse/index.vue +0 -54
- package/docs/.vuepress/components/crud/baseUse/loading.vue +0 -70
- package/docs/.vuepress/components/crud/baseUse/pagination.vue +0 -108
- package/docs/.vuepress/components/crud/baseUse/selection.vue +0 -114
- package/docs/.vuepress/components/crud/baseUse/summaryMethod.vue +0 -118
- package/docs/.vuepress/components/crud/baseUse/title.vue +0 -54
- package/docs/.vuepress/components/crud/baseUse/toolbar.vue +0 -69
- package/docs/.vuepress/components/crud/buttons/common.vue +0 -115
- package/docs/.vuepress/components/crud/buttons/fast.vue +0 -82
- package/docs/.vuepress/components/crud/contextMenu/base.vue +0 -72
- package/docs/.vuepress/components/crud/copy.vue +0 -52
- package/docs/.vuepress/components/crud/crudEvents/api.vue +0 -157
- package/docs/.vuepress/components/crud/crudEvents/deleteTip.vue +0 -93
- package/docs/.vuepress/components/crud/crudEvents/events.vue +0 -188
- package/docs/.vuepress/components/crud/dataSort/base.vue +0 -142
- package/docs/.vuepress/components/crud/genDynamicColumns/base.vue +0 -53
- package/docs/.vuepress/components/crud/genDynamicColumns/dynamicAndFixed.vue +0 -111
- package/docs/.vuepress/components/crud/genDynamicColumns/treeDynamic.vue +0 -68
- package/docs/.vuepress/components/crud/handleBar/handleRow.vue +0 -65
- package/docs/.vuepress/components/crud/handleBar/toolbar.vue +0 -69
- package/docs/.vuepress/components/crud/renderType/1.vue +0 -57
- package/docs/.vuepress/components/crud/renderType/2.vue +0 -63
- package/docs/.vuepress/components/crud/renderType/3.vue +0 -105
- package/docs/.vuepress/components/crud/renderType/5.vue +0 -91
- package/docs/.vuepress/components/crud/search/1.vue +0 -90
- package/docs/.vuepress/components/crud/search/2.vue +0 -78
- package/docs/.vuepress/components/crud/search/3.vue +0 -107
- package/docs/.vuepress/components/crud/search/base.vue +0 -123
- package/docs/.vuepress/components/crud/search/localSearch.vue +0 -124
- package/docs/.vuepress/components/crud/search/special.vue +0 -148
- package/docs/.vuepress/components/crud/selection/events.vue +0 -47
- package/docs/.vuepress/components/crud/selection/pagination.vue +0 -94
- package/docs/.vuepress/components/crud/selection/singleSelection.vue +0 -64
- package/docs/.vuepress/components/crud/span/base.vue +0 -69
- package/docs/.vuepress/components/crud/span/special.vue +0 -75
- package/docs/.vuepress/components/crud/summary/base.vue +0 -99
- package/docs/.vuepress/components/crud/tableEdit/addDeleteBtn.vue +0 -174
- package/docs/.vuepress/components/crud/tableEdit/cellEdit.vue +0 -194
- package/docs/.vuepress/components/crud/tableEdit/controlEdit.vue +0 -219
- package/docs/.vuepress/components/crud/tableEdit/dialog.vue +0 -172
- package/docs/.vuepress/components/crud/tableEdit/free.vue +0 -88
- package/docs/.vuepress/components/crud/tableEdit/freeColumn.vue +0 -82
- package/docs/.vuepress/components/crud/tableEdit/methods.vue +0 -154
- package/docs/.vuepress/components/crud/tableEdit/rowAction.vue +0 -107
- package/docs/.vuepress/components/crud/tableEdit/rowBatch.vue +0 -116
- package/docs/.vuepress/components/crud/tableEdit/rowClick.vue +0 -98
- package/docs/.vuepress/components/crud/validate/base.vue +0 -122
- package/docs/.vuepress/components/crud/validate/custom.vue +0 -82
- package/docs/.vuepress/components/crud/validate/regulars.vue +0 -88
- package/docs/.vuepress/components/crud/validate/relation.vue +0 -91
- package/docs/.vuepress/components/crud/validate/tree.vue +0 -82
- package/docs/.vuepress/components/dialog/baseUse/base.vue +0 -92
- package/docs/.vuepress/components/dialog/baseUse/beforeConfirm.vue +0 -78
- package/docs/.vuepress/components/dialog/baseUse/control.vue +0 -79
- package/docs/.vuepress/components/dialog/baseUse/drawer.vue +0 -59
- package/docs/.vuepress/components/dialog/baseUse/footer.vue +0 -87
- package/docs/.vuepress/components/dialog/baseUse/insertSlot.vue +0 -79
- package/docs/.vuepress/components/dict/DictLinkage.vue +0 -91
- package/docs/.vuepress/components/dict/baseUse.vue +0 -72
- package/docs/.vuepress/components/dict/component.vue +0 -82
- package/docs/.vuepress/components/dict/localDict.vue +0 -68
- package/docs/.vuepress/components/form/baseUse/base.vue +0 -48
- package/docs/.vuepress/components/form/baseUse/dataFormat.vue +0 -92
- package/docs/.vuepress/components/form/baseUse/deep.vue +0 -57
- package/docs/.vuepress/components/form/baseUse/gridLayout.vue +0 -47
- package/docs/.vuepress/components/form/baseUse/group.vue +0 -66
- package/docs/.vuepress/components/form/baseUse/hidden.vue +0 -40
- package/docs/.vuepress/components/form/baseUse/inlineLayout.vue +0 -48
- package/docs/.vuepress/components/form/baseUse/label.vue +0 -51
- package/docs/.vuepress/components/form/baseUse/tooltip.vue +0 -40
- package/docs/.vuepress/components/form/baseUse/validate.vue +0 -52
- package/docs/.vuepress/components/form/detail/base.vue +0 -78
- package/docs/.vuepress/components/form/detail/border.vue +0 -90
- package/docs/.vuepress/components/form/detail/singleDetail.vue +0 -72
- package/docs/.vuepress/components/formatData/baseUse.vue +0 -131
- package/docs/.vuepress/components/mock/index.js +0 -347
- package/docs/.vuepress/components/mockData/custom.vue +0 -69
- package/docs/.vuepress/components/mockData/example.vue +0 -290
- package/docs/.vuepress/components/positionSlot/base.vue +0 -24
- package/docs/.vuepress/components/positionSlot/form.vue +0 -71
- package/docs/.vuepress/components/positionSlot/table.vue +0 -85
- package/docs/.vuepress/components/tabs/base.vue +0 -57
- package/docs/.vuepress/components/temp.js +0 -195
- package/docs/.vuepress/config.js +0 -146
- package/docs/.vuepress/enhanceApp.js +0 -142
- package/docs/.vuepress/public/favicon.ico +0 -0
- package/docs/.vuepress/public/super.png +0 -0
- package/docs/.vuepress/styles/index.styl +0 -25
- package/docs/.vuepress/styles/palette.styl +0 -6
- package/docs/README.md +0 -14
- package/docs/guide/button/base.md +0 -31
- package/docs/guide/commonConfig/jsx.md +0 -166
- package/docs/guide/commonConfig/presetCodeTemplate.md +0 -68
- package/docs/guide/commonConfig/renderType.md +0 -181
- package/docs/guide/crud/baseUse.md +0 -120
- package/docs/guide/crud/buttons.md +0 -18
- package/docs/guide/crud/config.md +0 -217
- package/docs/guide/crud/contextMenu.md +0 -18
- package/docs/guide/crud/dataSort.md +0 -66
- package/docs/guide/crud/genDynamicColumns.md +0 -145
- package/docs/guide/crud/handleBar.md +0 -26
- package/docs/guide/crud/renderType.md +0 -4
- package/docs/guide/crud/search.md +0 -150
- package/docs/guide/crud/selection.md +0 -73
- package/docs/guide/crud/span.md +0 -98
- package/docs/guide/crud/summary.md +0 -167
- package/docs/guide/crud/tableEdit.md +0 -377
- package/docs/guide/crud/validate.md +0 -158
- package/docs/guide/dialog/baseUse.md +0 -81
- package/docs/guide/dict/baseUse.md +0 -174
- package/docs/guide/dict/component.md +0 -88
- package/docs/guide/dict/config.md +0 -44
- package/docs/guide/form/baseUse.md +0 -142
- package/docs/guide/form/detail.md +0 -38
- package/docs/guide/formatData/baseUse.md +0 -98
- package/docs/guide/formatData/config.md +0 -142
- package/docs/guide/mockData/base.md +0 -26
- package/docs/guide/positionSlot/base.md +0 -41
- package/docs/guide/question/base.md +0 -44
- package/docs/guide/start/base.md +0 -30
- package/docs/guide/tabs/base.md +0 -63
- package/examples/App.vue +0 -52
- package/examples/Layout/components/AppMain.vue +0 -40
- package/examples/Layout/components/Item.vue +0 -29
- package/examples/Layout/components/Link.vue +0 -44
- package/examples/Layout/components/SidebarItem.vue +0 -93
- package/examples/Layout/index.vue +0 -69
- package/examples/assets/logo.png +0 -0
- package/examples/favicon.ico +0 -0
- package/examples/index.html +0 -18
- package/examples/main.js +0 -54
- package/examples/router/index.js +0 -140
- package/examples/store/index.js +0 -0
- package/examples/styles/index.scss +0 -63
- package/examples/styles/sidebar.scss +0 -226
- package/examples/styles/transition.scss +0 -48
- package/examples/styles/variables.scss +0 -25
- package/examples/views/crud/base.vue +0 -68
- package/examples/views/crud/handleRow.vue +0 -84
- package/examples/views/crud/search.vue +0 -116
- package/examples/views/dashboard/index.vue +0 -244
- package/examples/views/dashboard/index1.vue +0 -234
- package/examples/views/dashboard/test.vue +0 -9
- package/examples/views/formTest/index.vue +0 -168
- package/examples/views/nested/menu1/index.vue +0 -7
- package/examples/views/nested/menu1/menu1-1/index.vue +0 -7
- package/examples/views/nested/menu1/menu1-2/index.vue +0 -7
- package/examples/views/nested/menu1/menu1-2/menu1-2-1/index.vue +0 -5
- package/examples/views/nested/menu1/menu1-2/menu1-2-2/index.vue +0 -5
- package/examples/views/nested/menu1/menu1-3/index.vue +0 -5
- package/examples/views/nested/menu2/index.vue +0 -5
- package/gulpfile.js +0 -84
- package/packages/button/index.vue +0 -189
- package/packages/core/components/comp.vue +0 -223
- package/packages/core/components/position.vue +0 -135
- package/packages/core/components/render.vue +0 -460
- package/packages/core/configManager.js +0 -302
- package/packages/core/create.js +0 -8
- package/packages/core/defaultRender.js +0 -64
- package/packages/core/dict/global.js +0 -10
- package/packages/core/dict/index.js +0 -432
- package/packages/core/dict/mixin.js +0 -94
- package/packages/core/event.js +0 -60
- package/packages/core/index.js +0 -6
- package/packages/core/init.js +0 -122
- package/packages/core/mock/genConfig.js +0 -228
- package/packages/core/mock/genData.js +0 -422
- package/packages/core/mock/index.js +0 -4
- package/packages/core/rules.js +0 -111
- package/packages/crud/column.vue +0 -205
- package/packages/crud/columnAction.vue +0 -207
- package/packages/crud/columnCell.vue +0 -146
- package/packages/crud/defaultColumn.vue +0 -130
- package/packages/crud/drawerColumn.vue +0 -225
- package/packages/crud/form.vue +0 -69
- package/packages/crud/index.vue +0 -564
- package/packages/crud/menuBar.vue +0 -298
- package/packages/crud/mixins/cacheHandler.js +0 -36
- package/packages/crud/mixins/calcColumnWidth.js +0 -79
- package/packages/crud/mixins/calcHeight.js +0 -105
- package/packages/crud/mixins/columnHandler.js +0 -128
- package/packages/crud/mixins/contextMenu.js +0 -98
- package/packages/crud/mixins/dataProcessor.js +0 -202
- package/packages/crud/mixins/dialog.js +0 -109
- package/packages/crud/mixins/excelHandler.js +0 -150
- package/packages/crud/mixins/exposeMethods.js +0 -107
- package/packages/crud/mixins/generateDynamicColumns.js +0 -250
- package/packages/crud/mixins/props.js +0 -38
- package/packages/crud/mixins/searchHandler.js +0 -151
- package/packages/crud/mixins/select.js +0 -359
- package/packages/crud/mixins/spanMethod.js +0 -288
- package/packages/crud/mixins/summary.js +0 -177
- package/packages/crud/mixins/tableEdit.js +0 -547
- package/packages/crud/mixins/validate.js +0 -219
- package/packages/crud/pagination.vue +0 -110
- package/packages/crud/search.vue +0 -119
- package/packages/crud/searchHeader.vue +0 -231
- package/packages/crud/selectBanner.vue +0 -138
- package/packages/crud/utils/EditState.js +0 -319
- package/packages/crud/utils/excelExport.js +0 -112
- package/packages/crud/utils/excelImport.js +0 -112
- package/packages/crud/utils/index.js +0 -98
- package/packages/dialog/dialog.js +0 -233
- package/packages/dialog/dialog.vue +0 -15
- package/packages/dialog/index.js +0 -22
- package/packages/dict/cascadeFormat.vue +0 -179
- package/packages/dict/dateFormat.vue +0 -40
- package/packages/dict/form/cascade.vue +0 -61
- package/packages/dict/form/checkbox.vue +0 -90
- package/packages/dict/form/extendMethod.js +0 -22
- package/packages/dict/form/input-base.js +0 -31
- package/packages/dict/form/input.js +0 -20
- package/packages/dict/form/radio.vue +0 -69
- package/packages/dict/form/select.vue +0 -118
- package/packages/dict/form/switch.vue +0 -75
- package/packages/dict/valueFormat.vue +0 -188
- package/packages/directive/dialog/drag.js +0 -86
- package/packages/directive/dialog/dragSize.js +0 -42
- package/packages/directive/index.js +0 -9
- package/packages/directive/insertSlot.js +0 -10
- package/packages/form/contextMenu.js +0 -192
- package/packages/form/draftDrawer.vue +0 -391
- package/packages/form/formAction.vue +0 -97
- package/packages/form/formItem.vue +0 -259
- package/packages/form/index.vue +0 -451
- package/packages/form/props.js +0 -15
- package/packages/grid/cell.vue +0 -65
- package/packages/grid/index.vue +0 -130
- package/packages/group/index.vue +0 -96
- package/packages/tabs/index.vue +0 -290
- package/packages/tooltip/index.js +0 -9
- package/packages/tooltip/tooltip.vue +0 -32
- package/packages/tooltip/tooltipComponent.js +0 -38
- package/packages/verifyInput/index.vue +0 -131
- package/styles/button.scss +0 -3
- package/styles/crud.scss +0 -425
- package/styles/dialog.scss +0 -95
- package/styles/form.scss +0 -532
- package/styles/group.scss +0 -78
- package/styles/index.scss +0 -94
- package/styles/tabs.scss +0 -139
- package/styles/verifyInput.scss +0 -56
- package/vue-jsx-sync.js +0 -90
- package/vue.config.js +0 -54
@@ -1,47 +0,0 @@
|
|
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>
|
@@ -1,94 +0,0 @@
|
|
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>
|
@@ -1,64 +0,0 @@
|
|
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>
|
@@ -1,69 +0,0 @@
|
|
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>
|
@@ -1,75 +0,0 @@
|
|
1
|
-
<template>
|
2
|
-
<div>
|
3
|
-
<h3>选中数据:{{ JSON.stringify(selected) }}</h3>
|
4
|
-
<sc-crud
|
5
|
-
:loading.sync="loading"
|
6
|
-
:search.sync="search"
|
7
|
-
:selected.sync="selected"
|
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
|
-
search: {
|
24
|
-
pageNum: 1,
|
25
|
-
pageSize: 15,
|
26
|
-
},
|
27
|
-
selected: [],
|
28
|
-
options: {
|
29
|
-
border: true,
|
30
|
-
init: true,
|
31
|
-
selection: {
|
32
|
-
banner: true,
|
33
|
-
reserveSelection: true,
|
34
|
-
spanProp: "city", // 开启该列合并
|
35
|
-
},
|
36
|
-
index: {
|
37
|
-
label: "序号",
|
38
|
-
spanProp: "gender",
|
39
|
-
},
|
40
|
-
renderColumns: [
|
41
|
-
{
|
42
|
-
prop: "city",
|
43
|
-
label: "城市",
|
44
|
-
spanProp: "city", // 开启该列合并
|
45
|
-
},
|
46
|
-
{
|
47
|
-
prop: "gender",
|
48
|
-
label: "性别",
|
49
|
-
spanProp: "gender", // 开启该列合并
|
50
|
-
},
|
51
|
-
{
|
52
|
-
prop: "age",
|
53
|
-
label: "年龄",
|
54
|
-
},
|
55
|
-
],
|
56
|
-
showSummary: true, // 启用合计行
|
57
|
-
},
|
58
|
-
data: [],
|
59
|
-
total: 0,
|
60
|
-
};
|
61
|
-
},
|
62
|
-
|
63
|
-
methods: {
|
64
|
-
async getList() {
|
65
|
-
this.loading = true;
|
66
|
-
try {
|
67
|
-
const { data } = await mockApi.getList(this.search);
|
68
|
-
this.data = data;
|
69
|
-
} finally {
|
70
|
-
this.loading = false;
|
71
|
-
}
|
72
|
-
},
|
73
|
-
},
|
74
|
-
};
|
75
|
-
</script>
|
@@ -1,99 +0,0 @@
|
|
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
|
-
|
16
|
-
export default {
|
17
|
-
data() {
|
18
|
-
return {
|
19
|
-
loading: false,
|
20
|
-
search: {
|
21
|
-
pageNum: 1,
|
22
|
-
pageSize: 10,
|
23
|
-
},
|
24
|
-
options: {
|
25
|
-
border: true,
|
26
|
-
init: true,
|
27
|
-
showSummary: true, // 启用统计行
|
28
|
-
renderColumns: [
|
29
|
-
{
|
30
|
-
prop: "amount",
|
31
|
-
label: "金额",
|
32
|
-
summary: {
|
33
|
-
type: "sum",
|
34
|
-
prefix: "¥",
|
35
|
-
suffix: "元",
|
36
|
-
decimals: 2,
|
37
|
-
ignoreZero: true, // 忽略0值
|
38
|
-
},
|
39
|
-
},
|
40
|
-
{
|
41
|
-
prop: "score",
|
42
|
-
label: "得分",
|
43
|
-
summary: {
|
44
|
-
type: "avg",
|
45
|
-
decimals: 1,
|
46
|
-
suffix: "分",
|
47
|
-
},
|
48
|
-
},
|
49
|
-
{
|
50
|
-
prop: "status",
|
51
|
-
label: "状态统计",
|
52
|
-
summary: {
|
53
|
-
type: "count",
|
54
|
-
predicate: (value) => value === "active",
|
55
|
-
suffix: "个活跃",
|
56
|
-
},
|
57
|
-
},
|
58
|
-
{
|
59
|
-
prop: "nested.sales",
|
60
|
-
label: "销售额",
|
61
|
-
summary: {
|
62
|
-
type: "custom",
|
63
|
-
path: "nested.sales",
|
64
|
-
method: (values, data) => {
|
65
|
-
// 自定义统计逻辑
|
66
|
-
const total = values.reduce((sum, val) => sum + val, 0);
|
67
|
-
return total;
|
68
|
-
},
|
69
|
-
},
|
70
|
-
},
|
71
|
-
],
|
72
|
-
},
|
73
|
-
data: [],
|
74
|
-
total: 0,
|
75
|
-
};
|
76
|
-
},
|
77
|
-
|
78
|
-
methods: {
|
79
|
-
async getList() {
|
80
|
-
this.loading = true;
|
81
|
-
try {
|
82
|
-
const { data, total } = await mockApi.getList(this.search);
|
83
|
-
this.data = data.map((item) => ({
|
84
|
-
...item,
|
85
|
-
amount: Math.floor(Math.random() * 100),
|
86
|
-
score: Math.floor(Math.random() * 100),
|
87
|
-
status: Math.random() > 0.5 ? "active" : "inactive",
|
88
|
-
nested: {
|
89
|
-
sales: Math.floor(Math.random() * 100),
|
90
|
-
},
|
91
|
-
}));
|
92
|
-
this.total = total;
|
93
|
-
} finally {
|
94
|
-
this.loading = false;
|
95
|
-
}
|
96
|
-
},
|
97
|
-
},
|
98
|
-
};
|
99
|
-
</script>
|
@@ -1,174 +0,0 @@
|
|
1
|
-
<template>
|
2
|
-
<div>
|
3
|
-
<sc-crud
|
4
|
-
:search.sync="searchForm"
|
5
|
-
:options="options"
|
6
|
-
:data="data"
|
7
|
-
@add="add"
|
8
|
-
@delete="handleDelete"
|
9
|
-
@batchDelete="handleBatchDelete"
|
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
|
-
id: 5,
|
55
|
-
name: "孙七",
|
56
|
-
gender: "男",
|
57
|
-
age: 24,
|
58
|
-
city: "成都",
|
59
|
-
date: "2021-01-05",
|
60
|
-
},
|
61
|
-
{
|
62
|
-
id: 6,
|
63
|
-
name: "周八",
|
64
|
-
gender: "女",
|
65
|
-
age: 25,
|
66
|
-
city: "重庆",
|
67
|
-
date: "2021-01-06",
|
68
|
-
},
|
69
|
-
],
|
70
|
-
};
|
71
|
-
},
|
72
|
-
computed: {
|
73
|
-
options() {
|
74
|
-
return {
|
75
|
-
selection: true,
|
76
|
-
editConfig: {
|
77
|
-
mode: "row",
|
78
|
-
edit: {},
|
79
|
-
add: {
|
80
|
-
addType: "last",
|
81
|
-
},
|
82
|
-
lastAdd: {},
|
83
|
-
delete: {
|
84
|
-
confirm: (scope) => `是否删除序号为${scope.$index + 1}的数据?`, // 删除提示
|
85
|
-
},
|
86
|
-
batchDelete: {
|
87
|
-
confirm: (rows) =>
|
88
|
-
`是否删除序号为${rows
|
89
|
-
.map((row) => row.$index + 1)
|
90
|
-
.join(",")}的数据?`, // 删除提示
|
91
|
-
},
|
92
|
-
},
|
93
|
-
renderColumns: [
|
94
|
-
{
|
95
|
-
prop: "name",
|
96
|
-
label: "姓名",
|
97
|
-
},
|
98
|
-
{
|
99
|
-
prop: "gender",
|
100
|
-
label: "性别",
|
101
|
-
form: {
|
102
|
-
comp: {
|
103
|
-
name: "el-select",
|
104
|
-
options: [
|
105
|
-
{ value: "男", label: "男" },
|
106
|
-
{ value: "女", label: "女" },
|
107
|
-
],
|
108
|
-
},
|
109
|
-
},
|
110
|
-
},
|
111
|
-
{
|
112
|
-
prop: "age",
|
113
|
-
label: "年龄",
|
114
|
-
form: {
|
115
|
-
comp: {
|
116
|
-
name: "el-select",
|
117
|
-
options: [
|
118
|
-
{ value: 20, label: "20" },
|
119
|
-
{ value: 21, label: "21" },
|
120
|
-
{ value: 22, label: "22" },
|
121
|
-
{ value: 23, label: "23" },
|
122
|
-
],
|
123
|
-
},
|
124
|
-
},
|
125
|
-
},
|
126
|
-
{
|
127
|
-
prop: "city",
|
128
|
-
label: "城市",
|
129
|
-
form: {
|
130
|
-
comp: {
|
131
|
-
name: "el-select",
|
132
|
-
options: [
|
133
|
-
{ value: "北京", label: "北京" },
|
134
|
-
{ value: "上海", label: "上海" },
|
135
|
-
{ value: "广州", label: "广州" },
|
136
|
-
{ value: "深圳", label: "深圳" },
|
137
|
-
],
|
138
|
-
},
|
139
|
-
},
|
140
|
-
},
|
141
|
-
{
|
142
|
-
prop: "date",
|
143
|
-
label: "日期",
|
144
|
-
form: {
|
145
|
-
comp: {
|
146
|
-
name: "el-date-picker",
|
147
|
-
props: {
|
148
|
-
type: "date",
|
149
|
-
placeholder: "选择日期",
|
150
|
-
valueFormat: "yyyy-MM-dd",
|
151
|
-
},
|
152
|
-
},
|
153
|
-
},
|
154
|
-
},
|
155
|
-
],
|
156
|
-
};
|
157
|
-
},
|
158
|
-
},
|
159
|
-
methods: {
|
160
|
-
add(done, scope) {
|
161
|
-
console.log("add", scope);
|
162
|
-
done();
|
163
|
-
},
|
164
|
-
handleDelete(done, scope) {
|
165
|
-
console.log("handleDelete", scope);
|
166
|
-
done();
|
167
|
-
},
|
168
|
-
handleBatchDelete(done, rows) {
|
169
|
-
console.log("handleBatchDelete", rows);
|
170
|
-
done();
|
171
|
-
},
|
172
|
-
},
|
173
|
-
};
|
174
|
-
</script>
|