@isxiaoyuan/elpis 1.0.0

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.
Files changed (85) hide show
  1. package/.eslintignore +3 -0
  2. package/.eslintrc +52 -0
  3. package/.vscode/settings.json +8 -0
  4. package/REMADE.md +228 -0
  5. package/app/controller/base.js +43 -0
  6. package/app/controller/project.js +106 -0
  7. package/app/controller/view.js +21 -0
  8. package/app/extend/logger.js +36 -0
  9. package/app/middleware/api-params-verify.js +73 -0
  10. package/app/middleware/api-sign-verify.js +43 -0
  11. package/app/middleware/error-handler.js +33 -0
  12. package/app/middleware/project-handle.js +26 -0
  13. package/app/middleware.js +41 -0
  14. package/app/pages/asserts/custom.css +11 -0
  15. package/app/pages/boot.js +43 -0
  16. package/app/pages/common/curl.js +88 -0
  17. package/app/pages/common/utils.js +2 -0
  18. package/app/pages/dashboard/complex-view/header-view/complex-view/sub-menu/sub-menu.vue +19 -0
  19. package/app/pages/dashboard/complex-view/header-view/header-view.vue +138 -0
  20. package/app/pages/dashboard/complex-view/iframe-view/iframe-view.vue +51 -0
  21. package/app/pages/dashboard/complex-view/schema-view/complex-view/search-panel/search-panel.vue +41 -0
  22. package/app/pages/dashboard/complex-view/schema-view/complex-view/table-panel/table-panel.vue +128 -0
  23. package/app/pages/dashboard/complex-view/schema-view/components/component-config.js +20 -0
  24. package/app/pages/dashboard/complex-view/schema-view/components/create-form/create-form.vue +95 -0
  25. package/app/pages/dashboard/complex-view/schema-view/components/detail-panel/detail-panel.vue +98 -0
  26. package/app/pages/dashboard/complex-view/schema-view/components/edit-form/edit-form.vue +123 -0
  27. package/app/pages/dashboard/complex-view/schema-view/hook/schema.js +129 -0
  28. package/app/pages/dashboard/complex-view/schema-view/schema-view.vue +98 -0
  29. package/app/pages/dashboard/complex-view/silder-view/silder-view.vue +127 -0
  30. package/app/pages/dashboard/dashboard.vue +96 -0
  31. package/app/pages/dashboard/entry.dashboard.js +48 -0
  32. package/app/pages/store/index.js +5 -0
  33. package/app/pages/store/menu.js +70 -0
  34. package/app/pages/store/project.js +17 -0
  35. package/app/pages/widgets/header-container/asserts/avatar.png +0 -0
  36. package/app/pages/widgets/header-container/asserts/logo.png +0 -0
  37. package/app/pages/widgets/header-container/header-container.vue +102 -0
  38. package/app/pages/widgets/schema-form/complex-view/input/input.vue +137 -0
  39. package/app/pages/widgets/schema-form/complex-view/input-number/input-number.vue +136 -0
  40. package/app/pages/widgets/schema-form/complex-view/select/select.vue +122 -0
  41. package/app/pages/widgets/schema-form/form-item-config.js +20 -0
  42. package/app/pages/widgets/schema-form/schema-form.vue +136 -0
  43. package/app/pages/widgets/schema-search-bar/complex-view/date-range/date-range.vue +55 -0
  44. package/app/pages/widgets/schema-search-bar/complex-view/dynamic-select/dynamic-select.vue +69 -0
  45. package/app/pages/widgets/schema-search-bar/complex-view/input/input.vue +45 -0
  46. package/app/pages/widgets/schema-search-bar/complex-view/select/select.vue +53 -0
  47. package/app/pages/widgets/schema-search-bar/schema-item-config.js +24 -0
  48. package/app/pages/widgets/schema-search-bar/schema-search-bar.vue +115 -0
  49. package/app/pages/widgets/schema-table/schema-table.vue +255 -0
  50. package/app/pages/widgets/sider-container/complex-view/sub-menu/sub-menu.vue +18 -0
  51. package/app/pages/widgets/sider-container/sider-container.vue +29 -0
  52. package/app/public/dist/entry.dashboard.tpl +27 -0
  53. package/app/public/dist/entry.page1.tpl +25 -0
  54. package/app/public/dist/entry.page2.tpl +25 -0
  55. package/app/public/dist/entry.project-list.tpl +27 -0
  56. package/app/public/static/logo.png +0 -0
  57. package/app/public/static/normalize.css +239 -0
  58. package/app/router/project.js +12 -0
  59. package/app/router/view.js +7 -0
  60. package/app/router-schema/project.js +30 -0
  61. package/app/service/base.js +13 -0
  62. package/app/service/project.js +58 -0
  63. package/app/view/entry.tpl +27 -0
  64. package/app/webpack/config/webpack.base.js +305 -0
  65. package/app/webpack/config/webpack.dev.js +62 -0
  66. package/app/webpack/config/webpack.prod.js +120 -0
  67. package/app/webpack/dev.js +62 -0
  68. package/app/webpack/libs/blank.js +1 -0
  69. package/app/webpack/prod.js +22 -0
  70. package/config/config.beta.js +3 -0
  71. package/config/config.default.js +3 -0
  72. package/config/config.prod.js +3 -0
  73. package/elpis-core/env.js +20 -0
  74. package/elpis-core/index.js +97 -0
  75. package/elpis-core/loader/config.js +66 -0
  76. package/elpis-core/loader/controller.js +86 -0
  77. package/elpis-core/loader/extend.js +66 -0
  78. package/elpis-core/loader/middleware.js +74 -0
  79. package/elpis-core/loader/router-schema.js +56 -0
  80. package/elpis-core/loader/router.js +49 -0
  81. package/elpis-core/loader/service.js +82 -0
  82. package/index.js +42 -0
  83. package/model/index.js +109 -0
  84. package/package.json +92 -0
  85. package/test/controller/project.test.js +188 -0
@@ -0,0 +1,48 @@
1
+ import boot from "$elpisPages/boot.js";
2
+
3
+ import dashboard from "./dashboard.vue";
4
+ import businessDashboardRouterConfig from "$businessDashboardRouterConfig";
5
+
6
+ const routes = [];
7
+
8
+ // 头部菜单路由
9
+ routes.push({
10
+ path: "/view/dashboard/iframe",
11
+ // name: "iframe-view",
12
+ component: () => import("./complex-view/iframe-view/iframe-view.vue"),
13
+ });
14
+ routes.push({
15
+ path: "/view/dashboard/schema",
16
+ component: () => import("./complex-view/schema-view/schema-view.vue"),
17
+ });
18
+
19
+ const siderRoutes = [
20
+ {
21
+ path: "schema",
22
+ component: () => import("./complex-view/schema-view/schema-view.vue"),
23
+ },
24
+ {
25
+ path: "iframe",
26
+ component: () => import("./complex-view/iframe-view/iframe-view.vue"),
27
+ },
28
+ ];
29
+
30
+ // 侧边栏路由
31
+ routes.push({
32
+ path: "/view/dashboard/sider",
33
+ component: () => import("./complex-view/silder-view/silder-view.vue"),
34
+ children: siderRoutes,
35
+ });
36
+
37
+ // 业务扩展路由
38
+ if (typeof businessDashboardRouterConfig === "function") {
39
+ businessDashboardRouterConfig({ routes, siderRoutes });
40
+ }
41
+
42
+ // 侧边栏兜底策略
43
+ routes.push({
44
+ path: "/view/dashboard/sider/:chapters+",
45
+ component: () => import("./complex-view/silder-view/silder-view.vue"),
46
+ });
47
+
48
+ boot(dashboard, { routes });
@@ -0,0 +1,5 @@
1
+ import { createPinia } from "pinia";
2
+
3
+ const pinia = createPinia();
4
+
5
+ export default pinia;
@@ -0,0 +1,70 @@
1
+ import { defineStore } from "pinia";
2
+ import { ref } from "vue";
3
+
4
+ export const useMenuStore = defineStore("menu", () => {
5
+ // 菜单列表
6
+ const menuList = ref([]);
7
+
8
+ // 设置菜单列表
9
+ const setMenuList = (list) => {
10
+ menuList.value = list;
11
+ };
12
+
13
+ /**
14
+ * 找出菜单目录
15
+ * @param key 搜索字段
16
+ * @param value 搜索值
17
+ * @param mList 要搜索的菜单列表
18
+ */
19
+ const findMenuItem = ({ key, value }, mList = menuList.value) => {
20
+ for (let i = 0; i < mList.length; ++i) {
21
+ const menuItem = mList[i];
22
+ if (!menuItem) {
23
+ continue;
24
+ }
25
+ const { menuType, moduleType } = menuItem;
26
+ if (menuItem[key] === value) {
27
+ return menuItem;
28
+ }
29
+ if (menuType === "group" && menuItem.subMenu) {
30
+ const mItem = findMenuItem({ key, value }, menuItem.subMenu);
31
+ if (mItem) {
32
+ return mItem;
33
+ }
34
+ }
35
+ if (
36
+ moduleType === "sider" &&
37
+ menuItem.siderConfig &&
38
+ menuItem.siderConfig.menu
39
+ ) {
40
+ const mItem = findMenuItem({ key, value }, menuItem.siderConfig.menu);
41
+ if (mItem) {
42
+ return mItem;
43
+ }
44
+ }
45
+ }
46
+ };
47
+
48
+ /**
49
+ * 找出菜单目录中的第一个菜单项
50
+ * @param mList 要搜索的菜单列表
51
+ */
52
+
53
+ const findFirstMemuItem = (mList = menuList.value) => {
54
+ if (!mList || !mList[0]) {
55
+ return;
56
+ }
57
+ let firstMenuItem = mList[0];
58
+ if (firstMenuItem.subMenu) {
59
+ firstMenuItem = findFirstMemuItem(firstMenuItem.subMenu);
60
+ }
61
+ return firstMenuItem;
62
+ };
63
+
64
+ return {
65
+ menuList,
66
+ setMenuList,
67
+ findMenuItem,
68
+ findFirstMemuItem,
69
+ };
70
+ });
@@ -0,0 +1,17 @@
1
+ import { defineStore } from "pinia";
2
+ import { ref } from "vue";
3
+
4
+ export const useProjectStore = defineStore("project", () => {
5
+ // 项目列表
6
+ const projectList = ref([]);
7
+
8
+ // 设置项目列表
9
+ const setProjectList = (list) => {
10
+ projectList.value = list;
11
+ };
12
+
13
+ return {
14
+ projectList,
15
+ setProjectList,
16
+ };
17
+ });
@@ -0,0 +1,102 @@
1
+ <template>
2
+ <div class="header-container">
3
+ <el-header class="header">
4
+ <el-row type="flex" align="middle" class="header-row">
5
+ <el-row type="flex" align="middle" class="title-panel">
6
+ <img src="./asserts/logo.png" alt="" class="logo" />
7
+ <el-row class="title">{{ title }}</el-row>
8
+ </el-row>
9
+ <!-- 菜单区域 -->
10
+ <slot name="menu-content"></slot>
11
+ <!-- 设置区域 -->
12
+ <el-row type="flex" align="middle" justify="end" class="setting-panel">
13
+ <slot name="setting-content"></slot>
14
+ <img src="./asserts/avatar.png" alt="" class="avatar" />
15
+ <div>{{ username }}</div>
16
+ <!-- <el-dropdown @command="handleUserCommand">
17
+ <template #reference>
18
+ <el-button type="primary" size="small"> 更多操作 </el-button>
19
+ </template>
20
+ <template #dropdown>
21
+ <el-dropdown-menu>
22
+ <el-dropdown-item type="danger">退出登录</el-dropdown-item>
23
+ </el-dropdown-menu>
24
+ </template>
25
+ </el-dropdown> -->
26
+ </el-row>
27
+ </el-row>
28
+ </el-header>
29
+ <el-main class="main-container">
30
+ <slot name="main-content"></slot>
31
+ </el-main>
32
+ </div>
33
+ </template>
34
+
35
+ <script setup>
36
+ import { ref } from "vue";
37
+
38
+ defineProps({
39
+ title: {
40
+ type: String,
41
+ default: "Elpis",
42
+ },
43
+ });
44
+
45
+ const username = ref("isYuan");
46
+ </script>
47
+
48
+ <style scoped lang="less">
49
+ .header-container {
50
+ height: 100%;
51
+ min-width: 1000px;
52
+ overflow: hidden;
53
+ .header {
54
+ max-height: 120px;
55
+ border-bottom: 1px solid #e8e8e8;
56
+
57
+ .header-row {
58
+ height: 60px;
59
+ padding: 0 20px;
60
+ .title-panel {
61
+ width: 180px;
62
+ min-width: 180px;
63
+ .logo {
64
+ width: 25px;
65
+ height: 25px;
66
+ margin-right: 10px;
67
+ border-radius: 50%;
68
+ }
69
+ .title {
70
+ font-size: 15px;
71
+ font-weight: 500;
72
+ }
73
+ }
74
+ .setting-panel {
75
+ margin-left: auto;
76
+ min-width: 180px;
77
+ .user-name {
78
+ font-size: 16px;
79
+ font-weight: 500;
80
+ cursor: pointer;
81
+ height: auto;
82
+ line-height: 60px;
83
+ outline: none;
84
+ }
85
+ .avatar {
86
+ width: 30px;
87
+ height: 30px;
88
+ margin-right: 12px;
89
+ border-radius: 50%;
90
+ }
91
+ }
92
+ }
93
+ }
94
+ .main-container {
95
+ // height: calc(100vh - 60px);
96
+ }
97
+
98
+ :deep(.el-header) {
99
+ padding: 0;
100
+ }
101
+ }
102
+ </style>
@@ -0,0 +1,137 @@
1
+ <template>
2
+ <el-row type="flex" align="middle" class="form-item">
3
+ <!-- label -->
4
+ <el-row class="item-label" justify="end">
5
+ <el-row v-if="schema.option?.required" type="flex" class="required"
6
+ >*</el-row
7
+ >
8
+ {{ schema.label }}
9
+ </el-row>
10
+
11
+ <!-- value -->
12
+ <el-row class="item-value">
13
+ <el-input
14
+ v-model="dtoValue"
15
+ v-bind="schema.option"
16
+ class="component"
17
+ :placeholder="placeholder"
18
+ :class="validTips ? 'valid-border' : ''"
19
+ @focus="onFocus"
20
+ @blur="onBlur"
21
+ />
22
+ </el-row>
23
+ <!-- 错误信息 -->
24
+ <el-row v-if="validTips" class="valid-tips">
25
+ {{ validTips }}
26
+ </el-row>
27
+ </el-row>
28
+ </template>
29
+
30
+ <script setup>
31
+ import { ref, toRefs, watch, inject, onMounted } from "vue";
32
+ const ajv = inject("ajv");
33
+
34
+ const props = defineProps({
35
+ schemaKey: String,
36
+ schema: Object,
37
+ model: [Object, Number, String],
38
+ });
39
+
40
+ const { schemaKey, schema } = props;
41
+ const { model } = toRefs(props);
42
+
43
+ const name = ref("input");
44
+
45
+ const dtoValue = ref();
46
+ const validTips = ref(null);
47
+ const placeholder = ref("");
48
+
49
+ const initData = () => {
50
+ dtoValue.value = model.value ?? schema.option?.default;
51
+ validTips.value = null;
52
+
53
+ const { minLength, maxLength, pattern } = schema;
54
+
55
+ const ruleList = [];
56
+ if (schema.option?.placeholder) {
57
+ ruleList.push(schema.option.placeholder);
58
+ }
59
+ if (minLength) {
60
+ ruleList.push(`长度不能小于${minLength}`);
61
+ }
62
+ if (maxLength) {
63
+ ruleList.push(`长度不能超过${maxLength}`);
64
+ }
65
+ if (pattern) {
66
+ ruleList.push(`格式必须符合${pattern}`);
67
+ }
68
+
69
+ placeholder.value = ruleList.join("|");
70
+ };
71
+
72
+ const validate = () => {
73
+ validTips.value = null;
74
+ const { type } = schema;
75
+
76
+ // 校验是否必填
77
+ if (schema.option?.required && !dtoValue.value) {
78
+ validTips.value = "不能为空";
79
+ return false;
80
+ }
81
+
82
+ // 校验 schema
83
+ if (dtoValue.value) {
84
+ const validate = ajv.compile(schema);
85
+ const valid = validate(dtoValue.value);
86
+ if (!valid && validate.errors && validate.errors[0]) {
87
+ const { keyword, params } = validate.errors[0];
88
+ if (keyword === "type") {
89
+ validTips.value = `类型必须为${type}`;
90
+ } else if (keyword === "maxLength") {
91
+ validTips.value = `值长度不能超过${params.limit}`;
92
+ } else if (keyword === "minLength") {
93
+ validTips.value = `值长度不能小于${params.limit}`;
94
+ } else if (keyword === "pattern") {
95
+ validTips.value = "格式不正确";
96
+ } else {
97
+ console.log(validate.errors[0]);
98
+ validTips.value = "不符合要求";
99
+ }
100
+ return false;
101
+ }
102
+ }
103
+ return true;
104
+ };
105
+
106
+ const getValue = () => {
107
+ return dtoValue.value !== undefined ? { [schemaKey]: dtoValue.value } : {};
108
+ };
109
+
110
+ const onFocus = () => {
111
+ validTips.value = null;
112
+ };
113
+
114
+ const onBlur = () => {
115
+ validate();
116
+ };
117
+
118
+ onMounted(() => {
119
+ initData();
120
+ });
121
+
122
+ watch(
123
+ [model, schema],
124
+ () => {
125
+ initData();
126
+ },
127
+ { deep: true },
128
+ );
129
+
130
+ defineExpose({
131
+ name,
132
+ validate,
133
+ getValue,
134
+ });
135
+ </script>
136
+
137
+ <style scoped lang="less"></style>
@@ -0,0 +1,136 @@
1
+ <template>
2
+ <el-row type="flex" align="middle" class="form-item">
3
+ <!-- label -->
4
+ <el-row class="item-label" justify="end">
5
+ <el-row v-if="schema.option?.required" type="flex" class="required"
6
+ >*</el-row
7
+ >
8
+ {{ schema.label }}
9
+ </el-row>
10
+
11
+ <!-- value -->
12
+ <el-row class="item-value">
13
+ <el-input-number
14
+ v-model="dtoValue"
15
+ v-bind="schema.option"
16
+ :controls="false"
17
+ :placeholder="placeholder"
18
+ class="component"
19
+ :class="validTips ? 'valid-border' : ''"
20
+ @focus="onFocus"
21
+ @blur="onBlur"
22
+ />
23
+ </el-row>
24
+ <!-- 错误信息 -->
25
+ <el-row v-if="validTips" class="valid-tips">
26
+ {{ validTips }}
27
+ </el-row>
28
+ </el-row>
29
+ </template>
30
+
31
+ <script setup>
32
+ import { ref, toRefs, watch, inject, onMounted } from "vue";
33
+ const ajv = inject("ajv");
34
+
35
+ const props = defineProps({
36
+ schemaKey: String,
37
+ schema: Object,
38
+ model: [Object, Number, String],
39
+ });
40
+
41
+ const { schemaKey, schema } = props;
42
+ const { model } = toRefs(props);
43
+
44
+ const name = ref("input-number");
45
+
46
+ const dtoValue = ref();
47
+ const validTips = ref(null);
48
+ const placeholder = ref("");
49
+
50
+ const initData = () => {
51
+ dtoValue.value = model.value ?? schema.option?.default;
52
+ validTips.value = null;
53
+
54
+ const { minium, maximum } = schema;
55
+
56
+ const ruleList = [];
57
+ if (schema.option?.placeholder) {
58
+ ruleList.push(schema.option.placeholder);
59
+ }
60
+ if (minium) {
61
+ ruleList.push(`值不能小于${minium}`);
62
+ }
63
+ if (maximum) {
64
+ ruleList.push(`值不能超过${maximum}`);
65
+ }
66
+ placeholder.value = ruleList.join("|");
67
+ };
68
+
69
+ const validate = () => {
70
+ validTips.value = null;
71
+ const { type } = schema;
72
+
73
+ // 校验是否必填
74
+ if (schema.option?.required && !dtoValue.value) {
75
+ validTips.value = "不能为空";
76
+ return false;
77
+ }
78
+
79
+ // 校验 schema
80
+ if (dtoValue.value) {
81
+ const validate = ajv.compile(schema);
82
+ const valid = validate(dtoValue.value);
83
+ if (!valid && validate.errors && validate.errors[0]) {
84
+ const { keyword, params } = validate.errors[0];
85
+ if (keyword === "type") {
86
+ validTips.value = `类型必须为${type}`;
87
+ } else if (keyword === "maximum") {
88
+ validTips.value = `值不能超过${params.limit}`;
89
+ } else if (keyword === "minimum") {
90
+ validTips.value = `值不能小于${params.limit}`;
91
+ } else {
92
+ console.log(validate.errors[0]);
93
+ validTips.value = "不符合要求";
94
+ }
95
+ return false;
96
+ }
97
+ }
98
+ return true;
99
+ };
100
+
101
+ const getValue = () => {
102
+ return dtoValue.value !== undefined ? { [schemaKey]: dtoValue.value } : {};
103
+ };
104
+
105
+ const onFocus = () => {
106
+ validTips.value = null;
107
+ };
108
+
109
+ const onBlur = () => {
110
+ validate();
111
+ };
112
+
113
+ onMounted(() => {
114
+ initData();
115
+ });
116
+
117
+ watch(
118
+ [model, schema],
119
+ () => {
120
+ initData();
121
+ },
122
+ { deep: true },
123
+ );
124
+
125
+ defineExpose({
126
+ name,
127
+ validate,
128
+ getValue,
129
+ });
130
+ </script>
131
+
132
+ <style scoped lang="less">
133
+ :deep(.el-input-number .el-input__inner) {
134
+ text-align: left;
135
+ }
136
+ </style>
@@ -0,0 +1,122 @@
1
+ <template>
2
+ <el-row type="flex" align="middle" class="form-item">
3
+ <!-- label -->
4
+ <el-row class="item-label" justify="end">
5
+ <el-row v-if="schema.option?.required" type="flex" class="required"
6
+ >*</el-row
7
+ >
8
+ {{ schema.label }}
9
+ </el-row>
10
+
11
+ <!-- value -->
12
+ <el-row class="item-value">
13
+ <el-select
14
+ v-model="dtoValue"
15
+ v-bind="schema.option"
16
+ class="component"
17
+ :class="validTips ? 'valid-border' : ''"
18
+ @change="onChange"
19
+ >
20
+ <el-option
21
+ v-for="item in schema.option?.enumList"
22
+ :key="item.value"
23
+ :label="item.label"
24
+ :value="item.value"
25
+ />
26
+ </el-select>
27
+ </el-row>
28
+ <!-- 错误信息 -->
29
+ <el-row v-if="validTips" class="valid-tips">
30
+ {{ validTips }}
31
+ </el-row>
32
+ </el-row>
33
+ </template>
34
+
35
+ <script setup>
36
+ import { ref, toRefs, watch, inject, onMounted } from "vue";
37
+ const ajv = inject("ajv");
38
+
39
+ const props = defineProps({
40
+ schemaKey: String,
41
+ schema: Object,
42
+ model: [Object, Number, String],
43
+ });
44
+
45
+ const { schemaKey, schema } = props;
46
+ const { model } = toRefs(props);
47
+
48
+ const name = ref("select");
49
+
50
+ const dtoValue = ref();
51
+ const validTips = ref(null);
52
+
53
+ const initData = () => {
54
+ dtoValue.value = model.value ?? schema.option?.default;
55
+ validTips.value = null;
56
+ };
57
+
58
+ const validate = () => {
59
+ validTips.value = null;
60
+ // const { type } = schema;
61
+
62
+ // 校验是否必填
63
+ if (schema.option?.required && !dtoValue.value) {
64
+ validTips.value = "不能为空";
65
+ return false;
66
+ }
67
+
68
+ // 校验 schema
69
+ if (dtoValue.value) {
70
+ let dtoEnum = [];
71
+ if (schema.option?.enumList) {
72
+ // 校验 enumList 中的 value 是否与 dtoValue 匹配
73
+ dtoEnum = schema.option?.enumList.map((item) => item.value);
74
+ }
75
+ const validate = ajv.compile({
76
+ schema,
77
+ ...{ enum: dtoEnum },
78
+ });
79
+
80
+ const valid = validate(dtoValue.value);
81
+ if (!valid && validate.errors && validate.errors[0]) {
82
+ const { keyword } = validate.errors[0];
83
+ if (keyword === "enum") {
84
+ validTips.value = `取值超出枚举范围`;
85
+ } else {
86
+ console.log(validate.errors[0]);
87
+ validTips.value = "不符合要求";
88
+ }
89
+ return false;
90
+ }
91
+ }
92
+ return true;
93
+ };
94
+
95
+ const getValue = () => {
96
+ return dtoValue.value !== undefined ? { [schemaKey]: dtoValue.value } : {};
97
+ };
98
+
99
+ const onChange = () => {
100
+ validate();
101
+ };
102
+
103
+ onMounted(() => {
104
+ initData();
105
+ });
106
+
107
+ watch(
108
+ [model, schema],
109
+ () => {
110
+ initData();
111
+ },
112
+ { deep: true },
113
+ );
114
+
115
+ defineExpose({
116
+ name,
117
+ validate,
118
+ getValue,
119
+ });
120
+ </script>
121
+
122
+ <style scoped lang="less"></style>
@@ -0,0 +1,20 @@
1
+ import input from "./complex-view/input/input.vue";
2
+ import inputNumber from "./complex-view/input-number/input-number.vue";
3
+ import select from "./complex-view/select/select.vue";
4
+
5
+ // 业务拓展 component 配置
6
+ import BusinessFormItemConfig from "$businessFormItemConfig";
7
+
8
+ const FormItemConfig = {
9
+ input: {
10
+ component: input,
11
+ },
12
+ inputNumber: {
13
+ component: inputNumber,
14
+ },
15
+ select: {
16
+ component: select,
17
+ },
18
+ };
19
+
20
+ export default { ...FormItemConfig, ...BusinessFormItemConfig };