diff --git a/magic-editor/src/console/src/assets/index.css b/magic-editor/src/console/src/assets/index.css
index 90c320d8..fa56147d 100644
--- a/magic-editor/src/console/src/assets/index.css
+++ b/magic-editor/src/console/src/assets/index.css
@@ -295,4 +295,14 @@
.ma-table-request-row {
display: flex;
+}
+
+/** 旋转特效 **/
+@keyframes rotate {
+ from {
+ transform: rotate(0deg);
+ }
+ to {
+ transform: rotate(360deg);
+ }
}
\ No newline at end of file
diff --git a/magic-editor/src/console/src/components/common/magic-tree.vue b/magic-editor/src/console/src/components/common/magic-tree.vue
index 7556cd0b..15d984a8 100644
--- a/magic-editor/src/console/src/components/common/magic-tree.vue
+++ b/magic-editor/src/console/src/components/common/magic-tree.vue
@@ -2,13 +2,22 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
无数据
@@ -20,11 +29,70 @@ export default {
props: {
data: Array,
// 解决子组件不强制刷新
- forceUpdate: Boolean
+ forceUpdate: Boolean,
+ loading: {
+ type: Boolean,
+ default: false
+ },
+ loadingTime: {
+ type: Number,
+ default: 500
+ }
},
components: {
MagicTreeItem
+ },
+ data() {
+ return {
+ showLoading: false
+ }
+ },
+ watch: {
+ loading(newVal) {
+ if (newVal) {
+ this.showLoading = newVal
+ } else {
+ setTimeout(() => {
+ this.showLoading = newVal
+ }, this.loadingTime)
+ }
+ }
+ },
+ mounted() {
+ this.showLoading = this.loading
}
}
-
+
diff --git a/magic-editor/src/console/src/components/resources/magic-api-list.vue b/magic-editor/src/console/src/components/resources/magic-api-list.vue
index 60203a62..4dcb3215 100644
--- a/magic-editor/src/console/src/components/resources/magic-api-list.vue
+++ b/magic-editor/src/console/src/components/resources/magic-api-list.vue
@@ -22,7 +22,7 @@
-
+
{
this.listGroupData = data
request.send('list').success(data => {
this.listChildrenData = data
this.initTreeData()
+ this.showLoading = false
})
})
},
diff --git a/magic-editor/src/console/src/components/resources/magic-datasource-list.vue b/magic-editor/src/console/src/components/resources/magic-datasource-list.vue
index 834cb213..06f61370 100644
--- a/magic-editor/src/console/src/components/resources/magic-datasource-list.vue
+++ b/magic-editor/src/console/src/components/resources/magic-datasource-list.vue
@@ -15,7 +15,7 @@
-
+
- datasourceContextMenu(e, item)">
@@ -24,6 +24,13 @@
+
+ 无数据
@@ -74,7 +81,9 @@ export default {
password: "",
maxRows: "-1"
},
- editor: null
+ editor: null,
+ // 是否展示loading
+ showLoading: true
}
},
methods: {
@@ -107,6 +116,8 @@ export default {
},
// 初始化数据
initData() {
+ this.showLoading = true
+ this.datasources = []
request.send('datasource/list').success(data => {
this.datasources = data;
JavaClass.setExtensionAttribute('org.ssssssss.magicapi.modules.SQLModule',this.datasources.filter(it => it.key).map(it => {
@@ -116,6 +127,9 @@ export default {
comment: it.name
}
}))
+ setTimeout(() => {
+ this.showLoading = false
+ }, 500)
})
},
showDetail(id){
@@ -313,4 +327,28 @@ ul li:hover{
width: 100%;
height: 100%;
}
+.ma-tree-wrapper .loading i {
+ color: var(--color);
+ font-size: 20px;
+}
+.ma-tree-wrapper .loading .icon {
+ width: 20px;
+ margin: 0 auto;
+ animation: rotate 1s linear infinite;
+}
+.ma-tree-wrapper .loading {
+ color: var(--color);
+ position: absolute;
+ text-align: center;
+ width: 100%;
+ top: 50%;
+ margin-top: -20px;
+}
+.ma-tree-wrapper .no-data {
+ color: var(--color);
+ position: absolute;
+ top: 50%;
+ left: 50%;
+ margin-left: -20px;
+}
diff --git a/magic-editor/src/console/src/components/resources/magic-function-list.vue b/magic-editor/src/console/src/components/resources/magic-function-list.vue
index 87372419..e2ebeafa 100644
--- a/magic-editor/src/console/src/components/resources/magic-function-list.vue
+++ b/magic-editor/src/console/src/components/resources/magic-function-list.vue
@@ -22,7 +22,7 @@
-
+
{
this.listGroupData = data;
request.send('function/list').success(data => {
this.listChildrenData = data
this.initTreeData()
+ this.showLoading = false
})
})
},
diff --git a/magic-editor/src/console/src/components/resources/magic-resource-choose.vue b/magic-editor/src/console/src/components/resources/magic-resource-choose.vue
index 2199dd5f..e57527f1 100644
--- a/magic-editor/src/console/src/components/resources/magic-resource-choose.vue
+++ b/magic-editor/src/console/src/components/resources/magic-resource-choose.vue
@@ -1,5 +1,5 @@
-
+
{
@@ -113,6 +117,7 @@ export default {
return it;
}))
this.initTreeData()
+ this.showLoading--
})
})
request.send('datasource/list').success(data => {
@@ -124,6 +129,7 @@ export default {
return it;
}))
this.initTreeData()
+ this.showLoading--
})
},
// 初始化tree结构数据