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,347 @@
|
|
1
|
+
import dayjs from "dayjs";
|
2
|
+
|
3
|
+
// provinceData.js - 省份数据
|
4
|
+
export const provinceData = [
|
5
|
+
{ value: "11", label: "北京市" },
|
6
|
+
{ value: "12", label: "天津市" },
|
7
|
+
{ value: "13", label: "河北省" },
|
8
|
+
{ value: "31", label: "上海市" },
|
9
|
+
{ value: "32", label: "江苏省" },
|
10
|
+
{ value: "33", label: "浙江省" },
|
11
|
+
];
|
12
|
+
|
13
|
+
// cityData.js - 城市数据(按省份代码分组)
|
14
|
+
export const cityData = {
|
15
|
+
"11": [
|
16
|
+
// 北京市
|
17
|
+
{ value: "1101", label: "北京市" },
|
18
|
+
],
|
19
|
+
"12": [
|
20
|
+
// 天津市
|
21
|
+
{ value: "1201", label: "天津市" },
|
22
|
+
],
|
23
|
+
"13": [
|
24
|
+
// 河北省
|
25
|
+
{ value: "1301", label: "石家庄市" },
|
26
|
+
{ value: "1302", label: "唐山市" },
|
27
|
+
{ value: "1303", label: "秦皇岛市" },
|
28
|
+
{ value: "1304", label: "邯郸市" },
|
29
|
+
{ value: "1305", label: "邢台市" },
|
30
|
+
{ value: "1306", label: "保定市" },
|
31
|
+
{ value: "1307", label: "张家口市" },
|
32
|
+
{ value: "1308", label: "承德市" },
|
33
|
+
{ value: "1309", label: "沧州市" },
|
34
|
+
{ value: "1310", label: "廊坊市" },
|
35
|
+
{ value: "1311", label: "衡水市" },
|
36
|
+
],
|
37
|
+
"31": [
|
38
|
+
// 上海市
|
39
|
+
{ value: "3101", label: "上海市" },
|
40
|
+
],
|
41
|
+
"32": [
|
42
|
+
// 江苏省
|
43
|
+
{ value: "3201", label: "南京市" },
|
44
|
+
{ value: "3202", label: "无锡市" },
|
45
|
+
{ value: "3203", label: "徐州市" },
|
46
|
+
{ value: "3204", label: "常州市" },
|
47
|
+
{ value: "3205", label: "苏州市" },
|
48
|
+
{ value: "3206", label: "南通市" },
|
49
|
+
{ value: "3207", label: "连云港市" },
|
50
|
+
{ value: "3208", label: "淮安市" },
|
51
|
+
{ value: "3209", label: "盐城市" },
|
52
|
+
{ value: "3210", label: "扬州市" },
|
53
|
+
{ value: "3211", label: "镇江市" },
|
54
|
+
{ value: "3212", label: "泰州市" },
|
55
|
+
{ value: "3213", label: "宿迁市" },
|
56
|
+
],
|
57
|
+
"33": [
|
58
|
+
// 浙江省
|
59
|
+
{ value: "3301", label: "杭州市" },
|
60
|
+
{ value: "3302", label: "宁波市" },
|
61
|
+
{ value: "3303", label: "温州市" },
|
62
|
+
{ value: "3304", label: "嘉兴市" },
|
63
|
+
{ value: "3305", label: "湖州市" },
|
64
|
+
{ value: "3306", label: "绍兴市" },
|
65
|
+
{ value: "3307", label: "金华市" },
|
66
|
+
{ value: "3308", label: "衢州市" },
|
67
|
+
{ value: "3309", label: "舟山市" },
|
68
|
+
{ value: "3310", label: "台州市" },
|
69
|
+
{ value: "3311", label: "丽水市" },
|
70
|
+
],
|
71
|
+
"44": [
|
72
|
+
// 广东省
|
73
|
+
{ value: "4401", label: "广州市" },
|
74
|
+
{ value: "4402", label: "韶关市" },
|
75
|
+
{ value: "4403", label: "深圳市" },
|
76
|
+
{ value: "4404", label: "珠海市" },
|
77
|
+
{ value: "4405", label: "汕头市" },
|
78
|
+
{ value: "4406", label: "佛山市" },
|
79
|
+
{ value: "4407", label: "江门市" },
|
80
|
+
{ value: "4408", label: "湛江市" },
|
81
|
+
{ value: "4409", label: "茂名市" },
|
82
|
+
{ value: "4412", label: "肇庆市" },
|
83
|
+
{ value: "4413", label: "惠州市" },
|
84
|
+
{ value: "4414", label: "梅州市" },
|
85
|
+
{ value: "4415", label: "汕尾市" },
|
86
|
+
{ value: "4416", label: "河源市" },
|
87
|
+
{ value: "4417", label: "阳江市" },
|
88
|
+
{ value: "4418", label: "清远市" },
|
89
|
+
{ value: "4419", label: "东莞市" },
|
90
|
+
{ value: "4420", label: "中山市" },
|
91
|
+
{ value: "4451", label: "潮州市" },
|
92
|
+
{ value: "4452", label: "揭阳市" },
|
93
|
+
{ value: "4453", label: "云浮市" },
|
94
|
+
],
|
95
|
+
"50": [
|
96
|
+
// 重庆市
|
97
|
+
{ value: "5001", label: "重庆市" },
|
98
|
+
],
|
99
|
+
"51": [
|
100
|
+
// 四川省
|
101
|
+
{ value: "5101", label: "成都市" },
|
102
|
+
{ value: "5103", label: "自贡市" },
|
103
|
+
{ value: "5104", label: "攀枝花市" },
|
104
|
+
{ value: "5105", label: "泸州市" },
|
105
|
+
{ value: "5106", label: "德阳市" },
|
106
|
+
{ value: "5107", label: "绵阳市" },
|
107
|
+
{ value: "5108", label: "广元市" },
|
108
|
+
{ value: "5109", label: "遂宁市" },
|
109
|
+
{ value: "5110", label: "内江市" },
|
110
|
+
{ value: "5111", label: "乐山市" },
|
111
|
+
{ value: "5113", label: "南充市" },
|
112
|
+
{ value: "5114", label: "眉山市" },
|
113
|
+
{ value: "5115", label: "宜宾市" },
|
114
|
+
{ value: "5116", label: "广安市" },
|
115
|
+
{ value: "5117", label: "达州市" },
|
116
|
+
{ value: "5118", label: "雅安市" },
|
117
|
+
{ value: "5119", label: "巴中市" },
|
118
|
+
{ value: "5120", label: "资阳市" },
|
119
|
+
],
|
120
|
+
};
|
121
|
+
|
122
|
+
export const cityTreeData = [
|
123
|
+
{
|
124
|
+
value: "浙江",
|
125
|
+
label: "浙江",
|
126
|
+
children: [
|
127
|
+
{
|
128
|
+
value: "杭州",
|
129
|
+
label: "杭州",
|
130
|
+
children: [
|
131
|
+
{
|
132
|
+
value: "西湖区",
|
133
|
+
label: "西湖区",
|
134
|
+
},
|
135
|
+
{
|
136
|
+
value: "滨江区",
|
137
|
+
label: "滨江区",
|
138
|
+
},
|
139
|
+
],
|
140
|
+
},
|
141
|
+
{
|
142
|
+
value: "宁波",
|
143
|
+
label: "宁波",
|
144
|
+
children: [
|
145
|
+
{
|
146
|
+
value: "海曙区",
|
147
|
+
label: "海曙区",
|
148
|
+
},
|
149
|
+
{
|
150
|
+
value: "江北区",
|
151
|
+
label: "江北区",
|
152
|
+
},
|
153
|
+
],
|
154
|
+
},
|
155
|
+
],
|
156
|
+
},
|
157
|
+
{
|
158
|
+
value: "江苏",
|
159
|
+
label: "江苏",
|
160
|
+
children: [
|
161
|
+
{
|
162
|
+
value: "南京",
|
163
|
+
label: "南京",
|
164
|
+
children: [
|
165
|
+
{
|
166
|
+
value: "玄武区",
|
167
|
+
label: "玄武区",
|
168
|
+
},
|
169
|
+
{
|
170
|
+
value: "秦淮区",
|
171
|
+
label: "秦淮区",
|
172
|
+
},
|
173
|
+
],
|
174
|
+
},
|
175
|
+
{
|
176
|
+
value: "苏州",
|
177
|
+
label: "苏州",
|
178
|
+
},
|
179
|
+
],
|
180
|
+
},
|
181
|
+
];
|
182
|
+
|
183
|
+
// 模拟API请求函数
|
184
|
+
export const mockApi = {
|
185
|
+
// 获取所有省份
|
186
|
+
getProvinces() {
|
187
|
+
return new Promise((resolve) => {
|
188
|
+
setTimeout(() => {
|
189
|
+
console.log("getProvinces---", provinceData);
|
190
|
+
resolve({
|
191
|
+
code: 200,
|
192
|
+
data: provinceData,
|
193
|
+
message: "success",
|
194
|
+
});
|
195
|
+
}, 100);
|
196
|
+
});
|
197
|
+
},
|
198
|
+
|
199
|
+
// 根据省份代码获取城市
|
200
|
+
getCities(provinceCode) {
|
201
|
+
return new Promise((resolve, reject) => {
|
202
|
+
setTimeout(() => {
|
203
|
+
const cities = cityData[provinceCode];
|
204
|
+
console.log("cities---", cities, "code---", provinceCode);
|
205
|
+
|
206
|
+
if (cities) {
|
207
|
+
resolve({
|
208
|
+
code: 200,
|
209
|
+
data: cities,
|
210
|
+
message: "success",
|
211
|
+
});
|
212
|
+
} else {
|
213
|
+
resolve({
|
214
|
+
code: 200,
|
215
|
+
data: [],
|
216
|
+
message: "no data",
|
217
|
+
});
|
218
|
+
}
|
219
|
+
}, 100);
|
220
|
+
});
|
221
|
+
},
|
222
|
+
|
223
|
+
getList: (() => {
|
224
|
+
let cachedData = null;
|
225
|
+
const total = 33;
|
226
|
+
|
227
|
+
const generateAllData = () => {
|
228
|
+
const mockData = [];
|
229
|
+
const cities = ["北京", "上海", "广州"];
|
230
|
+
|
231
|
+
for (let i = 0; i < total; i++) {
|
232
|
+
const age = Math.floor(Math.random() * 20) + 20;
|
233
|
+
mockData.push({
|
234
|
+
id: i + 1, // 使用固定的自增ID
|
235
|
+
name: `用户${i + 1}`,
|
236
|
+
gender: i % 2 === 0 ? "男" : "女", // 使用固定规则
|
237
|
+
age: age,
|
238
|
+
is30: age > 30 ? "是" : "否",
|
239
|
+
city: cities[i % cities.length], // 循环使用城市
|
240
|
+
date: dayjs()
|
241
|
+
.subtract(i, "day") // 按顺序递减日期
|
242
|
+
.format("YYYY-MM-DD"),
|
243
|
+
status: i % 2, // 使用固定规则
|
244
|
+
});
|
245
|
+
}
|
246
|
+
return mockData;
|
247
|
+
};
|
248
|
+
|
249
|
+
return ({ pageNum, pageSize }) => {
|
250
|
+
return new Promise((resolve) => {
|
251
|
+
if (!cachedData) {
|
252
|
+
cachedData = generateAllData();
|
253
|
+
}
|
254
|
+
|
255
|
+
const start = (pageNum - 1) * pageSize;
|
256
|
+
const end = Math.min(start + pageSize, total);
|
257
|
+
|
258
|
+
setTimeout(() => {
|
259
|
+
resolve({
|
260
|
+
data: cachedData.slice(start, end),
|
261
|
+
total,
|
262
|
+
});
|
263
|
+
}, 300);
|
264
|
+
});
|
265
|
+
};
|
266
|
+
})(),
|
267
|
+
// 生成更多测试数据
|
268
|
+
|
269
|
+
// 模拟API请求函数
|
270
|
+
getDynamicData({ pageNum = 1, pageSize = 10 }) {
|
271
|
+
const generateMockData = (count) => {
|
272
|
+
const result = [];
|
273
|
+
for (let i = 0; i < count; i++) {
|
274
|
+
result.push({
|
275
|
+
materialCode: `M${String(i + 1).padStart(3, "0")}`,
|
276
|
+
materialName: `产品${i + 1}`,
|
277
|
+
materialSpec: `规格${i + 1}`,
|
278
|
+
quantityGradeName: String.fromCharCode(65 + (i % 26)), // A-Z循环
|
279
|
+
firstChildren: [
|
280
|
+
{
|
281
|
+
id: "S001",
|
282
|
+
name: "供应商1",
|
283
|
+
price: 100 + i * 10,
|
284
|
+
secondChildren: [
|
285
|
+
{
|
286
|
+
sort: 1,
|
287
|
+
productUnitPrice: 100 + i * 10,
|
288
|
+
priceFollow: i % 2 === 0 ? "Y" : "N",
|
289
|
+
priceDifference: i % 2 === 0 ? -10 : 10,
|
290
|
+
pricePercentageChange: i % 2 === 0 ? 0.1 : -0.1,
|
291
|
+
},
|
292
|
+
{
|
293
|
+
sort: 2,
|
294
|
+
productUnitPrice: 90 + i * 10,
|
295
|
+
priceFollow: i % 2 === 0 ? "N" : "Y",
|
296
|
+
priceDifference: i % 2 === 0 ? 5 : -5,
|
297
|
+
pricePercentageChange: 0.05,
|
298
|
+
},
|
299
|
+
],
|
300
|
+
},
|
301
|
+
{
|
302
|
+
id: "S002",
|
303
|
+
name: "供应商2",
|
304
|
+
price: 90 + i * 10,
|
305
|
+
secondChildren: [
|
306
|
+
{
|
307
|
+
sort: 1,
|
308
|
+
productUnitPrice: 95 + i * 10,
|
309
|
+
priceFollow: "Y",
|
310
|
+
priceDifference: -5,
|
311
|
+
pricePercentageChange: 0.05,
|
312
|
+
},
|
313
|
+
{
|
314
|
+
sort: 2,
|
315
|
+
productUnitPrice: 92 + i * 10,
|
316
|
+
priceFollow: "Y",
|
317
|
+
priceDifference: -3,
|
318
|
+
pricePercentageChange: 0.03,
|
319
|
+
},
|
320
|
+
],
|
321
|
+
},
|
322
|
+
{
|
323
|
+
id: "S003",
|
324
|
+
name: "供应商3",
|
325
|
+
price: 80 + i * 10,
|
326
|
+
},
|
327
|
+
],
|
328
|
+
});
|
329
|
+
}
|
330
|
+
return result;
|
331
|
+
};
|
332
|
+
|
333
|
+
// 扩展数据集
|
334
|
+
const allData = generateMockData(50);
|
335
|
+
return new Promise((resolve) => {
|
336
|
+
setTimeout(() => {
|
337
|
+
const start = (pageNum - 1) * pageSize;
|
338
|
+
const end = start + pageSize;
|
339
|
+
|
340
|
+
resolve({
|
341
|
+
total: allData.length,
|
342
|
+
data: allData.slice(start, end),
|
343
|
+
});
|
344
|
+
}, 300);
|
345
|
+
});
|
346
|
+
},
|
347
|
+
};
|
@@ -0,0 +1,69 @@
|
|
1
|
+
<template>
|
2
|
+
<div>
|
3
|
+
<div>
|
4
|
+
{{ JSON.stringify(form) }}
|
5
|
+
</div>
|
6
|
+
<sc-form v-model="form" :options="options"> </sc-form>
|
7
|
+
</div>
|
8
|
+
</template>
|
9
|
+
|
10
|
+
<script>
|
11
|
+
export default {
|
12
|
+
data() {
|
13
|
+
return {
|
14
|
+
form: {},
|
15
|
+
};
|
16
|
+
},
|
17
|
+
computed: {
|
18
|
+
options() {
|
19
|
+
return {
|
20
|
+
renderColumns: [
|
21
|
+
{
|
22
|
+
prop: "input",
|
23
|
+
label: "整数生成",
|
24
|
+
comp: {
|
25
|
+
name: "el-input",
|
26
|
+
},
|
27
|
+
mock: ({ Random, Mock, Preset }, scope) => {
|
28
|
+
return Random.integer(1, 100);
|
29
|
+
},
|
30
|
+
},
|
31
|
+
{
|
32
|
+
prop: "image",
|
33
|
+
label: "图片生成",
|
34
|
+
comp: {
|
35
|
+
name: "el-image",
|
36
|
+
bind: ({ row }) => {
|
37
|
+
return {
|
38
|
+
src: row.image,
|
39
|
+
};
|
40
|
+
},
|
41
|
+
},
|
42
|
+
mock: ({ Random, Mock, Preset }, scope) => {
|
43
|
+
return Preset.imageUrl();
|
44
|
+
},
|
45
|
+
},
|
46
|
+
{
|
47
|
+
prop: "array",
|
48
|
+
label: "数组生成",
|
49
|
+
formatter: (row) => {
|
50
|
+
return (row.array || [])
|
51
|
+
.map((item) => {
|
52
|
+
return item?.name;
|
53
|
+
})
|
54
|
+
.join(",");
|
55
|
+
},
|
56
|
+
mock: ({ Random, Mock, Preset }, scope) => {
|
57
|
+
return Preset.array(() => {
|
58
|
+
return {
|
59
|
+
name: Random.cword(5, 10),
|
60
|
+
};
|
61
|
+
}, 10);
|
62
|
+
},
|
63
|
+
},
|
64
|
+
],
|
65
|
+
};
|
66
|
+
},
|
67
|
+
},
|
68
|
+
};
|
69
|
+
</script>
|
@@ -0,0 +1,290 @@
|
|
1
|
+
<template>
|
2
|
+
<div>
|
3
|
+
<h3>表单</h3>
|
4
|
+
<sc-form v-model="form" :options="options"> </sc-form>
|
5
|
+
<h3 style="margin-top: 20px;">表格</h3>
|
6
|
+
<sc-crud :data="data" :options="crudOptions"> </sc-crud>
|
7
|
+
</div>
|
8
|
+
</template>
|
9
|
+
|
10
|
+
<script>
|
11
|
+
export default {
|
12
|
+
data() {
|
13
|
+
return {
|
14
|
+
form: {
|
15
|
+
multiSelect: [],
|
16
|
+
daterange: [],
|
17
|
+
checkbox: [],
|
18
|
+
cascader: [],
|
19
|
+
transfer: [],
|
20
|
+
},
|
21
|
+
data: [
|
22
|
+
{
|
23
|
+
id: 1,
|
24
|
+
input: "",
|
25
|
+
select: "",
|
26
|
+
},
|
27
|
+
{
|
28
|
+
id: 2,
|
29
|
+
input: "",
|
30
|
+
select: "",
|
31
|
+
},
|
32
|
+
{
|
33
|
+
id: 3,
|
34
|
+
input: "",
|
35
|
+
select: "",
|
36
|
+
},
|
37
|
+
{
|
38
|
+
id: 4,
|
39
|
+
input: "",
|
40
|
+
select: "",
|
41
|
+
},
|
42
|
+
],
|
43
|
+
};
|
44
|
+
},
|
45
|
+
computed: {
|
46
|
+
options() {
|
47
|
+
return {
|
48
|
+
renderColumns: [
|
49
|
+
// 1. 输入框类
|
50
|
+
{
|
51
|
+
prop: "input",
|
52
|
+
label: "普通输入框",
|
53
|
+
comp: {
|
54
|
+
name: "el-input",
|
55
|
+
maxlength: 20,
|
56
|
+
"show-word-limit": true,
|
57
|
+
},
|
58
|
+
},
|
59
|
+
{
|
60
|
+
prop: "input2",
|
61
|
+
label: "校验规则生成",
|
62
|
+
rules: ["email"],
|
63
|
+
},
|
64
|
+
{
|
65
|
+
prop: "textarea",
|
66
|
+
label: "文本域",
|
67
|
+
comp: {
|
68
|
+
name: "el-input",
|
69
|
+
type: "textarea",
|
70
|
+
rows: 3,
|
71
|
+
placeholder: "请输入多行文本",
|
72
|
+
},
|
73
|
+
},
|
74
|
+
{
|
75
|
+
prop: "number",
|
76
|
+
label: "数字输入框",
|
77
|
+
comp: {
|
78
|
+
name: "el-input-number",
|
79
|
+
min: 0,
|
80
|
+
max: 100,
|
81
|
+
step: 1,
|
82
|
+
},
|
83
|
+
},
|
84
|
+
|
85
|
+
// 2. 选择器类
|
86
|
+
{
|
87
|
+
prop: "select",
|
88
|
+
label: "下拉选择",
|
89
|
+
comp: {
|
90
|
+
name: "el-select",
|
91
|
+
options: [
|
92
|
+
{ label: "选项1", value: "1" },
|
93
|
+
{ label: "选项2", value: "2" },
|
94
|
+
{ label: "选项3", value: "3" },
|
95
|
+
{ label: "选项4", value: "4" },
|
96
|
+
],
|
97
|
+
},
|
98
|
+
},
|
99
|
+
{
|
100
|
+
prop: "multiSelect",
|
101
|
+
label: "多选选择器",
|
102
|
+
comp: {
|
103
|
+
name: "el-select",
|
104
|
+
multiple: true,
|
105
|
+
options: [
|
106
|
+
{ label: "选项A", value: "A" },
|
107
|
+
{ label: "选项B", value: "B" },
|
108
|
+
{ label: "选项C", value: "C" },
|
109
|
+
{ label: "选项D", value: "D" },
|
110
|
+
],
|
111
|
+
},
|
112
|
+
},
|
113
|
+
|
114
|
+
// 3. 日期时间类
|
115
|
+
{
|
116
|
+
prop: "date",
|
117
|
+
label: "日期选择",
|
118
|
+
comp: {
|
119
|
+
name: "el-date-picker",
|
120
|
+
type: "date",
|
121
|
+
valueFormat: "yyyy-MM-dd",
|
122
|
+
},
|
123
|
+
},
|
124
|
+
{
|
125
|
+
prop: "daterange",
|
126
|
+
label: "日期范围",
|
127
|
+
comp: {
|
128
|
+
name: "el-date-picker",
|
129
|
+
type: "daterange",
|
130
|
+
startPlaceholder: "开始日期",
|
131
|
+
endPlaceholder: "结束日期",
|
132
|
+
valueFormat: "yyyy-MM-dd",
|
133
|
+
},
|
134
|
+
},
|
135
|
+
{
|
136
|
+
prop: "time",
|
137
|
+
label: "时间选择",
|
138
|
+
comp: {
|
139
|
+
name: "el-time-picker",
|
140
|
+
valueFormat: "HH:mm:ss",
|
141
|
+
},
|
142
|
+
},
|
143
|
+
|
144
|
+
// 4. 单选复选类
|
145
|
+
{
|
146
|
+
prop: "radio",
|
147
|
+
label: "单选组",
|
148
|
+
comp: {
|
149
|
+
name: "el-radio-group",
|
150
|
+
options: [
|
151
|
+
{ label: "选项1", value: "1" },
|
152
|
+
{ label: "选项2", value: "2" },
|
153
|
+
{ label: "选项3", value: "3" },
|
154
|
+
{ label: "选项4", value: "4" },
|
155
|
+
],
|
156
|
+
},
|
157
|
+
},
|
158
|
+
{
|
159
|
+
prop: "checkbox",
|
160
|
+
label: "复选框组",
|
161
|
+
comp: {
|
162
|
+
name: "el-checkbox-group",
|
163
|
+
options: [
|
164
|
+
{ label: "选项A", value: "A" },
|
165
|
+
{ label: "选项B", value: "B" },
|
166
|
+
{ label: "选项C", value: "C" },
|
167
|
+
{ label: "选项D", value: "D" },
|
168
|
+
],
|
169
|
+
},
|
170
|
+
},
|
171
|
+
|
172
|
+
// 5. 级联选择器
|
173
|
+
{
|
174
|
+
prop: "cascader",
|
175
|
+
label: "级联选择",
|
176
|
+
comp: {
|
177
|
+
name: "el-cascader",
|
178
|
+
options: [
|
179
|
+
{
|
180
|
+
value: "1",
|
181
|
+
label: "一级1",
|
182
|
+
children: [
|
183
|
+
{ value: "1-1", label: "二级1-1" },
|
184
|
+
{ value: "1-2", label: "二级1-2" },
|
185
|
+
],
|
186
|
+
},
|
187
|
+
{
|
188
|
+
value: "2",
|
189
|
+
label: "一级2",
|
190
|
+
children: [
|
191
|
+
{ value: "2-1", label: "二级2-1" },
|
192
|
+
{ value: "2-2", label: "二级2-2" },
|
193
|
+
],
|
194
|
+
},
|
195
|
+
],
|
196
|
+
},
|
197
|
+
},
|
198
|
+
|
199
|
+
// 6. 开关、滑块、评分类
|
200
|
+
{
|
201
|
+
prop: "switch",
|
202
|
+
label: "开关",
|
203
|
+
comp: {
|
204
|
+
name: "el-switch",
|
205
|
+
"active-text": "开启",
|
206
|
+
"inactive-text": "关闭",
|
207
|
+
},
|
208
|
+
},
|
209
|
+
{
|
210
|
+
prop: "slider",
|
211
|
+
label: "滑块",
|
212
|
+
comp: {
|
213
|
+
name: "el-slider",
|
214
|
+
min: 0,
|
215
|
+
max: 100,
|
216
|
+
step: 10,
|
217
|
+
"show-stops": true,
|
218
|
+
},
|
219
|
+
},
|
220
|
+
{
|
221
|
+
prop: "rate",
|
222
|
+
label: "评分",
|
223
|
+
comp: {
|
224
|
+
name: "el-rate",
|
225
|
+
max: 5,
|
226
|
+
"allow-half": true,
|
227
|
+
"show-text": true,
|
228
|
+
},
|
229
|
+
},
|
230
|
+
|
231
|
+
// 7. 穿梭框
|
232
|
+
{
|
233
|
+
prop: "transfer",
|
234
|
+
label: "穿梭框",
|
235
|
+
comp: {
|
236
|
+
name: "el-transfer",
|
237
|
+
data: [
|
238
|
+
{ key: 1, label: "选项1" },
|
239
|
+
{ key: 2, label: "选项2" },
|
240
|
+
{ key: 3, label: "选项3" },
|
241
|
+
],
|
242
|
+
titles: ["待选列表", "已选列表"],
|
243
|
+
},
|
244
|
+
},
|
245
|
+
],
|
246
|
+
};
|
247
|
+
},
|
248
|
+
crudOptions() {
|
249
|
+
return {
|
250
|
+
toolbar: false,
|
251
|
+
renderColumns: [
|
252
|
+
{
|
253
|
+
prop: "id",
|
254
|
+
label: "ID",
|
255
|
+
isEdit: false,
|
256
|
+
},
|
257
|
+
{
|
258
|
+
prop: "input",
|
259
|
+
label: "普通输入框",
|
260
|
+
isEdit: true,
|
261
|
+
form: {
|
262
|
+
comp: {
|
263
|
+
name: "el-input",
|
264
|
+
maxlength: 20,
|
265
|
+
"show-word-limit": true,
|
266
|
+
},
|
267
|
+
},
|
268
|
+
},
|
269
|
+
{
|
270
|
+
prop: "select",
|
271
|
+
label: "下拉选择",
|
272
|
+
isEdit: true,
|
273
|
+
form: {
|
274
|
+
comp: {
|
275
|
+
name: "el-select",
|
276
|
+
options: [
|
277
|
+
{ label: "选项1", value: "1" },
|
278
|
+
{ label: "选项2", value: "2" },
|
279
|
+
{ label: "选项3", value: "3" },
|
280
|
+
{ label: "选项4", value: "4" },
|
281
|
+
],
|
282
|
+
},
|
283
|
+
},
|
284
|
+
},
|
285
|
+
],
|
286
|
+
};
|
287
|
+
},
|
288
|
+
},
|
289
|
+
};
|
290
|
+
</script>
|