@juge0218/elpis 1.0.1 → 1.0.3
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.
Potentially problematic release.
This version of @juge0218/elpis might be problematic. Click here for more details.
- package/app/middleware.js +2 -1
- package/app/pages/dashboard/complex-view/header-view/complex-view/sub-menu/sub-menu.vue +14 -4
- package/app/pages/dashboard/complex-view/header-view/header-view.vue +61 -39
- package/app/pages/dashboard/complex-view/iframe-view/iframe-view.vue +15 -12
- package/app/pages/dashboard/complex-view/schema-view/complex-view/search-panel/search-panel.vue +15 -13
- package/app/pages/dashboard/complex-view/schema-view/complex-view/table-panel/table-panel.vue +56 -38
- package/app/pages/dashboard/complex-view/schema-view/components/create-form/create-form.vue +35 -24
- package/app/pages/dashboard/complex-view/schema-view/components/detail-panel/detail-panel.vue +32 -18
- package/app/pages/dashboard/complex-view/schema-view/components/edit-form/edit-form.vue +43 -27
- package/app/pages/dashboard/complex-view/sider-view/complex-view/sub-menu/sub-menu.vue +14 -4
- package/app/pages/widgets/header-container/header-container.vue +14 -12
- package/app/pages/widgets/schema-form/complex-view/input/input.vue +35 -21
- package/app/pages/widgets/schema-form/complex-view/input-number/input-number.vue +35 -21
- package/app/pages/widgets/schema-form/complex-view/select/select.vue +36 -22
- package/app/pages/widgets/schema-form/schema-form.vue +23 -16
- package/app/pages/widgets/schema-search-bar/complex-view/date-range/date-range.vue +24 -17
- package/app/pages/widgets/schema-search-bar/complex-view/dynamic-select/dynamic-select.vue +21 -14
- package/app/pages/widgets/schema-search-bar/complex-view/input/input.vue +14 -13
- package/app/pages/widgets/schema-search-bar/complex-view/select/select.vue +19 -13
- package/app/pages/widgets/schema-search-bar/schema-search-bar.vue +33 -20
- package/app/pages/widgets/schema-table/schema-table.vue +60 -31
- package/elpis-core/index.js +1 -1
- package/package.json +1 -1
package/app/middleware.js
CHANGED
|
@@ -2,7 +2,8 @@ const path = require('path')
|
|
|
2
2
|
module.exports = (app) => {
|
|
3
3
|
// 配置静态根目录
|
|
4
4
|
const koaStatic = require('koa-static')
|
|
5
|
-
app.use(koaStatic(path.resolve(
|
|
5
|
+
app.use(koaStatic(path.resolve(__dirname, './public')));
|
|
6
|
+
app.use(koaStatic(path.resolve(process.cwd(), './app/public')));
|
|
6
7
|
|
|
7
8
|
// 模板渲染引擎
|
|
8
9
|
const koaNunjucks = require('koa-nunjucks-2')
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
const { menuItem } = defineProps(
|
|
2
|
+
const { menuItem } = defineProps({
|
|
3
|
+
menuItem: {
|
|
4
|
+
type: Object,
|
|
5
|
+
required: true,
|
|
6
|
+
},
|
|
7
|
+
})
|
|
3
8
|
</script>
|
|
4
9
|
|
|
5
10
|
<template>
|
|
@@ -8,10 +13,15 @@ const { menuItem } = defineProps(['menuItem']);
|
|
|
8
13
|
{{ menuItem.name }}
|
|
9
14
|
</template>
|
|
10
15
|
<div v-for="item in menuItem.subMenu" :key="item.key">
|
|
11
|
-
<sub-menu
|
|
12
|
-
|
|
16
|
+
<sub-menu
|
|
17
|
+
v-if="item.subMenu && item.subMenu.length > 0"
|
|
18
|
+
:menu-item="item"
|
|
19
|
+
></sub-menu>
|
|
20
|
+
<el-menu-item v-else :index="item.key">
|
|
21
|
+
{{ item.name }}
|
|
22
|
+
</el-menu-item>
|
|
13
23
|
</div>
|
|
14
24
|
</el-sub-menu>
|
|
15
25
|
</template>
|
|
16
26
|
|
|
17
|
-
<style lang="less" scoped></style>
|
|
27
|
+
<style lang="less" scoped></style>
|
|
@@ -1,72 +1,86 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import HeaderContainer from
|
|
3
|
-
import SubMenu from
|
|
4
|
-
import { useMenuStore } from
|
|
5
|
-
import { useProjectStore } from
|
|
6
|
-
import { ref, watch, onMounted } from
|
|
7
|
-
import { ArrowDown } from
|
|
8
|
-
import { useRoute } from
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const projectStore = useProjectStore();
|
|
12
|
-
const menuStore = useMenuStore();
|
|
2
|
+
import HeaderContainer from "$elpisWidgets/header-container/header-container.vue"
|
|
3
|
+
import SubMenu from "./complex-view/sub-menu/sub-menu.vue"
|
|
4
|
+
import { useMenuStore } from "$elpisStore/menu"
|
|
5
|
+
import { useProjectStore } from "$elpisStore/project"
|
|
6
|
+
import { ref, watch, onMounted } from "vue"
|
|
7
|
+
import { ArrowDown } from "@element-plus/icons-vue"
|
|
8
|
+
import { useRoute } from "vue-router"
|
|
13
9
|
|
|
10
|
+
const projectStore = useProjectStore()
|
|
11
|
+
const menuStore = useMenuStore()
|
|
14
12
|
|
|
15
13
|
defineProps({
|
|
16
14
|
projName: {
|
|
17
15
|
type: String,
|
|
18
|
-
default:
|
|
19
|
-
}
|
|
16
|
+
default: "",
|
|
17
|
+
},
|
|
20
18
|
})
|
|
21
19
|
|
|
22
20
|
const route = useRoute()
|
|
23
21
|
|
|
24
|
-
const activeKey = ref(
|
|
22
|
+
const activeKey = ref("")
|
|
25
23
|
const setActiveKey = () => {
|
|
26
24
|
const menuItem = menuStore.findMenuItem({
|
|
27
|
-
key:
|
|
28
|
-
value: route.query.key
|
|
25
|
+
key: "key",
|
|
26
|
+
value: route.query.key,
|
|
29
27
|
})
|
|
30
|
-
activeKey.value = menuItem?.key
|
|
28
|
+
activeKey.value = menuItem?.key
|
|
31
29
|
}
|
|
32
30
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
},
|
|
31
|
+
watch(
|
|
32
|
+
[() => route.query.key, () => menuStore.menuList],
|
|
33
|
+
() => {
|
|
34
|
+
setActiveKey()
|
|
35
|
+
},
|
|
36
|
+
{ deep: true },
|
|
37
|
+
)
|
|
38
38
|
|
|
39
39
|
onMounted(() => {
|
|
40
|
-
setActiveKey()
|
|
40
|
+
setActiveKey()
|
|
41
41
|
})
|
|
42
42
|
|
|
43
|
-
const emit = defineEmits([
|
|
43
|
+
const emit = defineEmits(["menu-select"])
|
|
44
44
|
const onMenuSelect = (menuKey) => {
|
|
45
45
|
const menuItem = menuStore.findMenuItem({
|
|
46
|
-
key:
|
|
47
|
-
value: menuKey
|
|
46
|
+
key: "key",
|
|
47
|
+
value: menuKey,
|
|
48
48
|
})
|
|
49
|
-
emit(
|
|
49
|
+
emit("menu-select", menuItem)
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
const handleCommand = (event) => {
|
|
53
|
-
const projectItem = projectStore.projectList.find(
|
|
53
|
+
const projectItem = projectStore.projectList.find(
|
|
54
|
+
(item) => item.key === event,
|
|
55
|
+
)
|
|
54
56
|
if (!projectItem || !projectItem.homePage) return
|
|
55
57
|
const { host } = window.location
|
|
56
|
-
window.location.replace(
|
|
58
|
+
window.location.replace(
|
|
59
|
+
`http://${host}/view/dashboard${projectItem.homePage}`,
|
|
60
|
+
)
|
|
57
61
|
}
|
|
58
|
-
|
|
59
62
|
</script>
|
|
60
63
|
|
|
61
64
|
<template>
|
|
62
65
|
<header-container :title="projName">
|
|
63
66
|
<template #menu-content>
|
|
64
67
|
<!-- 根据 menuStore.menuList 渲染 -->
|
|
65
|
-
<el-menu
|
|
68
|
+
<el-menu
|
|
69
|
+
:default-active="activeKey"
|
|
70
|
+
mode="horizontal"
|
|
71
|
+
:ellipsis="false"
|
|
72
|
+
@select="onMenuSelect"
|
|
73
|
+
>
|
|
66
74
|
<template v-for="item in menuStore.menuList">
|
|
67
|
-
<sub-menu
|
|
75
|
+
<sub-menu
|
|
76
|
+
v-if="item.subMenu && item.subMenu.length > 0"
|
|
77
|
+
:key="item.key"
|
|
78
|
+
:menu-item="item"
|
|
79
|
+
>
|
|
68
80
|
</sub-menu>
|
|
69
|
-
<el-menu-item v-else :index="item.key">
|
|
81
|
+
<el-menu-item v-else :index="item.key">
|
|
82
|
+
{{ item.name }}
|
|
83
|
+
</el-menu-item>
|
|
70
84
|
</template>
|
|
71
85
|
</el-menu>
|
|
72
86
|
</template>
|
|
@@ -75,13 +89,21 @@ const handleCommand = (event) => {
|
|
|
75
89
|
<el-dropdown @command="handleCommand">
|
|
76
90
|
<span class="project-list">
|
|
77
91
|
{{ projName }}
|
|
78
|
-
<el-icon
|
|
92
|
+
<el-icon
|
|
93
|
+
v-if="projectStore.projectList.length > 1"
|
|
94
|
+
class="el-icon--right"
|
|
95
|
+
>
|
|
79
96
|
<arrow-down />
|
|
80
|
-
</el-icon
|
|
81
|
-
|
|
97
|
+
</el-icon>
|
|
98
|
+
</span>
|
|
99
|
+
<template v-if="projectStore.projectList.length > 1" #dropdown>
|
|
82
100
|
<el-dropdown-menu>
|
|
83
|
-
<el-dropdown-item
|
|
84
|
-
|
|
101
|
+
<el-dropdown-item
|
|
102
|
+
v-for="item in projectStore.projectList"
|
|
103
|
+
:key="item.key"
|
|
104
|
+
:command="item.key"
|
|
105
|
+
:disabled="item.name === projName"
|
|
106
|
+
>
|
|
85
107
|
{{ item.name }}
|
|
86
108
|
</el-dropdown-item>
|
|
87
109
|
</el-dropdown-menu>
|
|
@@ -108,4 +130,4 @@ const handleCommand = (event) => {
|
|
|
108
130
|
:deep(.el-menu--horizontal.el-menu) {
|
|
109
131
|
border-bottom: 1px solid #e8e8e8;
|
|
110
132
|
}
|
|
111
|
-
</style>
|
|
133
|
+
</style>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { ref, watch, onMounted } from
|
|
3
|
-
import { useRoute } from
|
|
4
|
-
import { useMenuStore } from
|
|
2
|
+
import { ref, watch, onMounted } from "vue"
|
|
3
|
+
import { useRoute } from "vue-router"
|
|
4
|
+
import { useMenuStore } from "$elpisStore/menu"
|
|
5
5
|
|
|
6
|
-
const path = ref(
|
|
6
|
+
const path = ref("")
|
|
7
7
|
|
|
8
8
|
const route = useRoute()
|
|
9
9
|
|
|
@@ -12,21 +12,24 @@ const setPath = () => {
|
|
|
12
12
|
const { key, sider_key } = route.query
|
|
13
13
|
|
|
14
14
|
const menuItem = menuStore.findMenuItem({
|
|
15
|
-
key:
|
|
16
|
-
value: sider_key ?? key
|
|
15
|
+
key: "key",
|
|
16
|
+
value: sider_key ?? key,
|
|
17
17
|
})
|
|
18
18
|
|
|
19
|
-
path.value = menuItem?.iframeConfig?.path ??
|
|
19
|
+
path.value = menuItem?.iframeConfig?.path ?? ""
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
watch(
|
|
23
23
|
[
|
|
24
24
|
() => route.query.key,
|
|
25
25
|
() => route.query.sider_key,
|
|
26
|
-
() => menuStore.menuList
|
|
27
|
-
],
|
|
26
|
+
() => menuStore.menuList,
|
|
27
|
+
],
|
|
28
|
+
() => {
|
|
28
29
|
setPath()
|
|
29
|
-
},
|
|
30
|
+
},
|
|
31
|
+
{ deep: true },
|
|
32
|
+
)
|
|
30
33
|
|
|
31
34
|
onMounted(() => {
|
|
32
35
|
setPath()
|
|
@@ -34,7 +37,7 @@ onMounted(() => {
|
|
|
34
37
|
</script>
|
|
35
38
|
|
|
36
39
|
<template>
|
|
37
|
-
<iframe :src="path" class="iframe"
|
|
40
|
+
<iframe :src="path" class="iframe" />
|
|
38
41
|
</template>
|
|
39
42
|
|
|
40
43
|
<style lang="less" scoped>
|
|
@@ -44,4 +47,4 @@ onMounted(() => {
|
|
|
44
47
|
border: none;
|
|
45
48
|
overflow: auto;
|
|
46
49
|
}
|
|
47
|
-
</style>
|
|
50
|
+
</style>
|
package/app/pages/dashboard/complex-view/schema-view/complex-view/search-panel/search-panel.vue
CHANGED
|
@@ -1,29 +1,31 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { inject } from
|
|
3
|
-
import SchemaSearchBar from
|
|
2
|
+
import { inject } from "vue"
|
|
3
|
+
import SchemaSearchBar from "$elpisWidgets/schema-search-bar/schema-search-bar.vue"
|
|
4
4
|
|
|
5
|
-
const { searchSchema } = inject(
|
|
5
|
+
const { searchSchema } = inject("schemaViewData")
|
|
6
6
|
|
|
7
|
-
const emit = defineEmits([
|
|
7
|
+
const emit = defineEmits(["search"])
|
|
8
8
|
|
|
9
9
|
const onLoad = (searValObj) => {
|
|
10
|
-
emit(
|
|
10
|
+
emit("search", searValObj)
|
|
11
11
|
}
|
|
12
12
|
const onSearch = (searValObj) => {
|
|
13
|
-
emit(
|
|
13
|
+
emit("search", searValObj)
|
|
14
14
|
}
|
|
15
15
|
const onReset = () => {
|
|
16
|
-
emit(
|
|
16
|
+
emit("search", {})
|
|
17
17
|
}
|
|
18
|
-
defineExpose({
|
|
19
|
-
|
|
20
|
-
})
|
|
21
|
-
|
|
18
|
+
defineExpose({})
|
|
22
19
|
</script>
|
|
23
20
|
|
|
24
21
|
<template>
|
|
25
22
|
<el-card class="search-panel">
|
|
26
|
-
<schema-search-bar
|
|
23
|
+
<schema-search-bar
|
|
24
|
+
:schema="searchSchema"
|
|
25
|
+
@load="onLoad"
|
|
26
|
+
@search="onSearch"
|
|
27
|
+
@reset="onReset"
|
|
28
|
+
></schema-search-bar>
|
|
27
29
|
</el-card>
|
|
28
30
|
</template>
|
|
29
31
|
|
|
@@ -35,4 +37,4 @@ defineExpose({
|
|
|
35
37
|
:deep(.el-card__body) {
|
|
36
38
|
padding-bottom: 2px;
|
|
37
39
|
}
|
|
38
|
-
</style>
|
|
40
|
+
</style>
|
package/app/pages/dashboard/complex-view/schema-view/complex-view/table-panel/table-panel.vue
CHANGED
|
@@ -1,89 +1,107 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { ref, inject } from
|
|
3
|
-
import SchemaTable from
|
|
4
|
-
import $curl from
|
|
5
|
-
import { ElMessageBox, ElNotification } from
|
|
2
|
+
import { ref, inject } from "vue"
|
|
3
|
+
import SchemaTable from "$elpisWidgets/schema-table/schema-table.vue"
|
|
4
|
+
import $curl from "$elpisCommon/curl"
|
|
5
|
+
import { ElMessageBox, ElNotification } from "element-plus"
|
|
6
6
|
|
|
7
|
-
const { api, apiParams, tableSchema, tableConfig } = inject(
|
|
7
|
+
const { api, apiParams, tableSchema, tableConfig } = inject("schemaViewData")
|
|
8
8
|
|
|
9
|
-
const schemaTableRef = ref(null)
|
|
9
|
+
const schemaTableRef = ref(null)
|
|
10
10
|
|
|
11
11
|
const EventHandlerMap = {
|
|
12
|
-
remove: removeData
|
|
12
|
+
remove: removeData,
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
function removeData
|
|
15
|
+
function removeData({ btnConfig, rowData }) {
|
|
16
16
|
const { eventOption } = btnConfig
|
|
17
17
|
if (!eventOption?.params) return
|
|
18
18
|
|
|
19
|
-
const { params } = eventOption
|
|
20
|
-
const removeKey = Object.keys(params)[0]
|
|
19
|
+
const { params } = eventOption
|
|
20
|
+
const removeKey = Object.keys(params)[0]
|
|
21
21
|
|
|
22
22
|
let removeValue
|
|
23
|
-
const removeValueList = params[removeKey]?.split(
|
|
24
|
-
if (removeValueList[0] ===
|
|
23
|
+
const removeValueList = params[removeKey]?.split("::") ?? ""
|
|
24
|
+
if (removeValueList[0] === "schema" && removeValueList[1]) {
|
|
25
25
|
removeValue = rowData[removeValueList[1]]
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
ElMessageBox.confirm(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
ElMessageBox.confirm(
|
|
29
|
+
`确认删除${removeKey}为:${removeValue}数据吗?`,
|
|
30
|
+
"提示",
|
|
31
|
+
{
|
|
32
|
+
confirmButtonText: "确定",
|
|
33
|
+
cancelButtonText: "取消",
|
|
34
|
+
type: "warning",
|
|
35
|
+
},
|
|
36
|
+
).then(async () => {
|
|
33
37
|
schemaTableRef.value.showLoading()
|
|
34
38
|
const res = await $curl({
|
|
35
39
|
url: api.value,
|
|
36
|
-
method:
|
|
40
|
+
method: "delete",
|
|
37
41
|
data: {
|
|
38
|
-
[removeKey]: removeValue
|
|
42
|
+
[removeKey]: removeValue,
|
|
39
43
|
},
|
|
40
|
-
errorMessage:
|
|
44
|
+
errorMessage: "删除失败",
|
|
41
45
|
})
|
|
42
46
|
schemaTableRef.value.hideLoading()
|
|
43
47
|
if (!res || !res.success || !res.data) return
|
|
44
48
|
|
|
45
49
|
ElNotification.success({
|
|
46
|
-
title:
|
|
47
|
-
message:
|
|
50
|
+
title: "提示",
|
|
51
|
+
message: "删除成功",
|
|
48
52
|
})
|
|
49
53
|
|
|
50
54
|
loadTableData()
|
|
51
55
|
})
|
|
52
|
-
}
|
|
56
|
+
}
|
|
53
57
|
|
|
54
|
-
const emit = defineEmits([
|
|
58
|
+
const emit = defineEmits(["operate"])
|
|
55
59
|
const operationHandler = async ({ btnConfig, rowData }) => {
|
|
56
|
-
const { eventKey } = btnConfig
|
|
60
|
+
const { eventKey } = btnConfig
|
|
57
61
|
if (EventHandlerMap[eventKey]) {
|
|
58
|
-
EventHandlerMap[eventKey]({ btnConfig, rowData })
|
|
62
|
+
EventHandlerMap[eventKey]({ btnConfig, rowData })
|
|
59
63
|
} else {
|
|
60
|
-
emit(
|
|
64
|
+
emit("operate", { btnConfig, rowData })
|
|
61
65
|
}
|
|
62
|
-
}
|
|
63
|
-
function loadTableData
|
|
66
|
+
}
|
|
67
|
+
function loadTableData() {
|
|
64
68
|
schemaTableRef.value.loadTableData()
|
|
65
69
|
}
|
|
66
|
-
function initData
|
|
70
|
+
function initData() {
|
|
67
71
|
schemaTableRef.value.initData()
|
|
68
72
|
}
|
|
69
73
|
defineExpose({
|
|
70
74
|
loadTableData,
|
|
71
|
-
initData
|
|
72
|
-
})
|
|
75
|
+
initData,
|
|
76
|
+
})
|
|
73
77
|
</script>
|
|
74
78
|
|
|
75
79
|
<template>
|
|
76
80
|
<el-card class="table-panel">
|
|
77
81
|
<!-- operation-panel -->
|
|
78
|
-
<el-row
|
|
79
|
-
|
|
80
|
-
|
|
82
|
+
<el-row
|
|
83
|
+
v-if="tableConfig?.headerButtons?.length > 0"
|
|
84
|
+
class="operation-panel"
|
|
85
|
+
justify="end"
|
|
86
|
+
>
|
|
87
|
+
<el-button
|
|
88
|
+
v-for="(item, index) in tableConfig.headerButtons"
|
|
89
|
+
v-bind="item"
|
|
90
|
+
:key="index"
|
|
91
|
+
@click="operationHandler({ btnConfig: item })"
|
|
92
|
+
>
|
|
81
93
|
{{ item.label }}
|
|
82
94
|
</el-button>
|
|
83
95
|
</el-row>
|
|
84
96
|
<!-- schema-tabel (组件 widgets) -->
|
|
85
|
-
<schema-table
|
|
86
|
-
|
|
97
|
+
<schema-table
|
|
98
|
+
ref="schemaTableRef"
|
|
99
|
+
:api-params="apiParams"
|
|
100
|
+
:schema="tableSchema"
|
|
101
|
+
:api="api"
|
|
102
|
+
:buttons="tableConfig?.rowButtons ?? []"
|
|
103
|
+
@operate="operationHandler"
|
|
104
|
+
></schema-table>
|
|
87
105
|
</el-card>
|
|
88
106
|
</template>
|
|
89
107
|
|
|
@@ -102,4 +120,4 @@ defineExpose({
|
|
|
102
120
|
display: flex;
|
|
103
121
|
flex-direction: column;
|
|
104
122
|
}
|
|
105
|
-
</style>
|
|
123
|
+
</style>
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { inject, ref } from
|
|
3
|
-
import SchemaForm from
|
|
4
|
-
import $curl from
|
|
5
|
-
import { ElNotification } from
|
|
2
|
+
import { inject, ref } from "vue"
|
|
3
|
+
import SchemaForm from "$elpisWidgets/schema-form/schema-form.vue"
|
|
4
|
+
import $curl from "$elpisCommon/curl"
|
|
5
|
+
import { ElNotification } from "element-plus"
|
|
6
6
|
|
|
7
|
-
const { api, components } = inject(
|
|
7
|
+
const { api, components } = inject("schemaViewData")
|
|
8
8
|
|
|
9
|
-
const name = ref(
|
|
10
|
-
const title = ref(
|
|
11
|
-
const saveBtnText = ref(
|
|
9
|
+
const name = ref("createForm")
|
|
10
|
+
const title = ref("")
|
|
11
|
+
const saveBtnText = ref("")
|
|
12
12
|
const loading = ref(false)
|
|
13
13
|
|
|
14
14
|
const isShow = ref(false)
|
|
@@ -20,14 +20,15 @@ const show = () => {
|
|
|
20
20
|
|
|
21
21
|
isShow.value = true
|
|
22
22
|
}
|
|
23
|
-
const close = () => {
|
|
23
|
+
const close = () => {
|
|
24
|
+
isShow.value = false
|
|
25
|
+
}
|
|
24
26
|
|
|
25
27
|
const schemaFormRef = ref(null)
|
|
26
28
|
|
|
27
|
-
const emit = defineEmits([
|
|
29
|
+
const emit = defineEmits(["command"])
|
|
28
30
|
|
|
29
31
|
const save = async () => {
|
|
30
|
-
|
|
31
32
|
if (loading.value) return
|
|
32
33
|
// 校验表单
|
|
33
34
|
if (!schemaFormRef.value.validate()) return
|
|
@@ -35,8 +36,8 @@ const save = async () => {
|
|
|
35
36
|
|
|
36
37
|
const res = await $curl({
|
|
37
38
|
url: api.value,
|
|
38
|
-
method:
|
|
39
|
-
data: { ...schemaFormRef.value.getValue() }
|
|
39
|
+
method: "post",
|
|
40
|
+
data: { ...schemaFormRef.value.getValue() },
|
|
40
41
|
})
|
|
41
42
|
|
|
42
43
|
loading.value = false
|
|
@@ -44,36 +45,46 @@ const save = async () => {
|
|
|
44
45
|
if (!res || !res.success) return
|
|
45
46
|
|
|
46
47
|
ElNotification({
|
|
47
|
-
title:
|
|
48
|
-
message:
|
|
49
|
-
type:
|
|
48
|
+
title: "创建成功",
|
|
49
|
+
message: "创建成功",
|
|
50
|
+
type: "success",
|
|
50
51
|
})
|
|
51
52
|
|
|
52
53
|
close()
|
|
53
54
|
|
|
54
|
-
emit(
|
|
55
|
+
emit("command", { event: "loadTableData" })
|
|
55
56
|
}
|
|
56
57
|
|
|
57
58
|
defineExpose({
|
|
58
59
|
name,
|
|
59
|
-
show
|
|
60
|
+
show,
|
|
60
61
|
})
|
|
61
|
-
|
|
62
62
|
</script>
|
|
63
63
|
|
|
64
64
|
<template>
|
|
65
|
-
<el-drawer
|
|
65
|
+
<el-drawer
|
|
66
|
+
v-model="isShow"
|
|
67
|
+
direction="rtl"
|
|
68
|
+
:destroy-on-close="true"
|
|
69
|
+
:size="550"
|
|
70
|
+
>
|
|
66
71
|
<template #header>
|
|
67
72
|
<h3>{{ title }}</h3>
|
|
68
73
|
</template>
|
|
69
74
|
<template #default>
|
|
70
|
-
<schema-form
|
|
75
|
+
<schema-form
|
|
76
|
+
ref="schemaFormRef"
|
|
77
|
+
v-loading="loading"
|
|
78
|
+
:schema="components[name]?.schema"
|
|
79
|
+
></schema-form>
|
|
71
80
|
</template>
|
|
72
81
|
<template #footer>
|
|
73
|
-
<el-button @click="close"
|
|
74
|
-
<el-button type="primary" @click="save">
|
|
82
|
+
<el-button @click="close"> 取消 </el-button>
|
|
83
|
+
<el-button type="primary" @click="save">
|
|
84
|
+
{{ saveBtnText }}
|
|
85
|
+
</el-button>
|
|
75
86
|
</template>
|
|
76
87
|
</el-drawer>
|
|
77
88
|
</template>
|
|
78
89
|
|
|
79
|
-
<style lang="less" scoped></style>
|
|
90
|
+
<style lang="less" scoped></style>
|
package/app/pages/dashboard/complex-view/schema-view/components/detail-panel/detail-panel.vue
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { inject, ref } from
|
|
3
|
-
import $curl from
|
|
2
|
+
import { inject, ref } from "vue"
|
|
3
|
+
import $curl from "$elpisCommon/curl"
|
|
4
4
|
|
|
5
|
-
const { api, components } = inject(
|
|
5
|
+
const { api, components } = inject("schemaViewData")
|
|
6
6
|
|
|
7
|
-
const name = ref(
|
|
7
|
+
const name = ref("detailPanel")
|
|
8
8
|
const isShow = ref(false)
|
|
9
|
-
const title = ref(
|
|
10
|
-
const mainKey = ref(
|
|
11
|
-
const mainValue = ref(
|
|
9
|
+
const title = ref("")
|
|
10
|
+
const mainKey = ref("")
|
|
11
|
+
const mainValue = ref("")
|
|
12
12
|
const dtoModel = ref({})
|
|
13
13
|
const loading = ref(false)
|
|
14
14
|
|
|
@@ -19,8 +19,8 @@ const fetchFormData = async () => {
|
|
|
19
19
|
|
|
20
20
|
const res = await $curl({
|
|
21
21
|
url: api.value,
|
|
22
|
-
method:
|
|
23
|
-
query: { [mainKey.value]: mainValue.value }
|
|
22
|
+
method: "get",
|
|
23
|
+
query: { [mainKey.value]: mainValue.value },
|
|
24
24
|
})
|
|
25
25
|
|
|
26
26
|
loading.value = false
|
|
@@ -34,7 +34,7 @@ const show = (rowData) => {
|
|
|
34
34
|
const { config } = components.value[name.value]
|
|
35
35
|
|
|
36
36
|
title.value = config.title
|
|
37
|
-
mainKey.value = config.mainKey//表单主键
|
|
37
|
+
mainKey.value = config.mainKey //表单主键
|
|
38
38
|
mainValue.value = rowData[mainKey.value]
|
|
39
39
|
dtoModel.value = {}
|
|
40
40
|
|
|
@@ -43,25 +43,39 @@ const show = (rowData) => {
|
|
|
43
43
|
fetchFormData()
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
const close = () => {
|
|
46
|
+
const close = () => {
|
|
47
|
+
isShow.value = false
|
|
48
|
+
}
|
|
47
49
|
|
|
48
50
|
defineExpose({
|
|
49
51
|
name,
|
|
50
|
-
show
|
|
52
|
+
show,
|
|
51
53
|
})
|
|
52
54
|
</script>
|
|
53
55
|
|
|
54
56
|
<template>
|
|
55
|
-
<el-drawer
|
|
57
|
+
<el-drawer
|
|
58
|
+
v-model="isShow"
|
|
59
|
+
direction="rtl"
|
|
60
|
+
:destroy-on-close="true"
|
|
61
|
+
:size="550"
|
|
62
|
+
>
|
|
56
63
|
<template #header>
|
|
57
64
|
<h3>{{ title }}</h3>
|
|
58
65
|
</template>
|
|
59
66
|
<template #default>
|
|
60
67
|
<el-card v-loading="loading" shadow="always" class="detail-panel">
|
|
61
|
-
<el-row
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
68
|
+
<el-row
|
|
69
|
+
v-for="(item, key) in components[name]?.schema?.properties"
|
|
70
|
+
:key="key"
|
|
71
|
+
type="flex"
|
|
72
|
+
align="middle"
|
|
73
|
+
class="row-item"
|
|
74
|
+
>
|
|
75
|
+
<el-row class="item-label"> {{ item.label }}: </el-row>
|
|
76
|
+
<el-row class="item-value">
|
|
77
|
+
{{ dtoModel[key] }}
|
|
78
|
+
</el-row>
|
|
65
79
|
</el-row>
|
|
66
80
|
</el-card>
|
|
67
81
|
</template>
|
|
@@ -92,4 +106,4 @@ defineExpose({
|
|
|
92
106
|
}
|
|
93
107
|
}
|
|
94
108
|
}
|
|
95
|
-
</style>
|
|
109
|
+
</style>
|