Bladeren bron

修复潜在的错误

mxd 3 jaren geleden
bovenliggende
commit
65a9fb6c95

+ 1 - 1
magic-editor/src/console/src/components/layout/magic-group.vue

@@ -128,7 +128,7 @@ export default {
   mounted() {
     let map = {}
     request.send('/options').success(data => {
-      this.defaultOptions = data.map(e => {
+      this.defaultOptions = data&&data.map(e => {
         let item = {text: e[0], value: e[0], description: e[1], defaultValue: e[2]}
         this.optionsMap[item.value] = item;
         return item;

+ 1 - 1
magic-editor/src/console/src/components/layout/magic-option.vue

@@ -55,7 +55,7 @@ export default {
   mounted() {
     let map = {}
       request.send('/options').success(data => {
-        this.defaultOptions = data.map(e => {
+        this.defaultOptions = data&&data.map(e => {
           let item = {text: e[0], value: e[0], description: e[1], defaultValue: e[2]}
           this.optionsMap[item.value] = item;
           return item;

+ 1 - 1
magic-editor/src/console/src/components/layout/magic-todo.vue

@@ -56,7 +56,7 @@ export default {
       request.send('todo').success(data => {
         this.todoList = data
         const $parent = this.$parent.$parent.$parent.$refs
-        this.todoList.forEach(item => {
+        this.todoList&&this.todoList.forEach(item => {
           let cache
           if (item.type === 1) {
             cache = $parent.apiList.getItemById(item.id)

+ 2 - 2
magic-editor/src/console/src/components/resources/magic-api-list.vue

@@ -167,10 +167,10 @@ export default {
       this.tree = []
       return new Promise((resolve) => {
         request.send('group/list?type=1').success(data => {
-          this.listGroupData = data
+          this.listGroupData = data || []
           bus.$emit('status', '接口分组加载完毕')
           request.send('list').success(data => {
-            this.listChildrenData = data
+            this.listChildrenData = data || []
             this.initTreeData()
             this.openItemById()
             this.showLoading = false

+ 1 - 1
magic-editor/src/console/src/components/resources/magic-datasource-list.vue

@@ -168,7 +168,7 @@ export default {
       bus.$emit('status', '正在初始化数据源列表')
       return new Promise((resolve) => {
         request.send('datasource/list').success(data => {
-          this.datasources = data;
+          this.datasources = data || [];
           JavaClass.setExtensionAttribute('org.ssssssss.magicapi.modules.SQLModule', this.datasources.filter(it => it.key).map(it => {
             return {
               name: it.key,

+ 2 - 2
magic-editor/src/console/src/components/resources/magic-function-list.vue

@@ -170,10 +170,10 @@ export default {
       bus.$emit('status', '正在初始化函数列表')
       return new Promise((resolve) => {
         request.send('group/list?type=2').success(data => {
-          this.listGroupData = data;
+          this.listGroupData = data || [];
           bus.$emit('status', '函数分组加载完毕')
           request.send('function/list').success(data => {
-            this.listChildrenData = data
+            this.listChildrenData = data || []
             this.initTreeData()
             this.openItemById()
             this.showLoading = false

+ 5 - 0
magic-editor/src/console/src/components/resources/magic-resource-choose.vue

@@ -85,6 +85,7 @@ export default {
           { id: 'datasource',_type: 'root', name: '3.数据源', parentId: 'root', path:'', selected: false, checkedHalf: false}
       ]
       request.send('group/list?type=1').success(data => {
+        data = data || []
         this.listGroupData.push(...data.map(it => {
           it.parentId = it.parentId == '0' ? 'api' : it.parentId;
           it.selected = false;
@@ -93,6 +94,7 @@ export default {
           return it;
         }))
         request.send('list').success(data => {
+          data = data || []
           this.listChildrenData.push(...data.map(it => {
             it._type = 'api';
             it.selected = false;
@@ -103,6 +105,7 @@ export default {
         })
       })
       request.send('group/list?type=2').success(data => {
+        data = data || []
         this.listGroupData.push(...data.map(it => {
           it.parentId = it.parentId == '0' ? 'function' : it.parentId;
           it.selected = false;
@@ -111,6 +114,7 @@ export default {
           return it;
         }))
         request.send('function/list').success(data => {
+          data = data || []
           this.listChildrenData.push(...data.map(it => {
             it._type = 'function';
             it.selected = false;
@@ -121,6 +125,7 @@ export default {
         })
       })
       request.send('datasource/list').success(data => {
+        data = data || []
         this.listChildrenData.push(...data.filter(it => it.id).map(it => {
           it._type = 'datasource';
           it.selected = false;