|
@@ -25,6 +25,7 @@ |
|
@@ -25,6 +25,7 @@ |
25
|
import { Button } from 'ant-design-vue';
|
25
|
import { Button } from 'ant-design-vue';
|
26
|
import { getModelTsl } from '/@/api/device/modelOfMatter';
|
26
|
import { getModelTsl } from '/@/api/device/modelOfMatter';
|
27
|
import { FunctionType } from './cpns/config';
|
27
|
import { FunctionType } from './cpns/config';
|
|
|
28
|
+ import { isObject } from '/@/utils/is';
|
28
|
|
29
|
|
29
|
defineEmits(['register']);
|
30
|
defineEmits(['register']);
|
30
|
|
31
|
|
|
@@ -78,11 +79,17 @@ |
|
@@ -78,11 +79,17 @@ |
78
|
]);
|
79
|
]);
|
79
|
};
|
80
|
};
|
80
|
|
81
|
|
|
|
82
|
+ const isEmptyObject = (value: any) => isObject(value) && !Object.keys(value).length;
|
|
|
83
|
+
|
81
|
const handleExportAll = async () => {
|
84
|
const handleExportAll = async () => {
|
82
|
loading.value = true;
|
85
|
loading.value = true;
|
83
|
try {
|
86
|
try {
|
84
|
const [events, properties, services] = await getAllModel();
|
87
|
const [events, properties, services] = await getAllModel();
|
85
|
- const value = { properties, services, events };
|
88
|
+ const value = {
|
|
|
89
|
+ properties: isEmptyObject(properties) ? [] : properties,
|
|
|
90
|
+ services: isEmptyObject(services) ? [] : services,
|
|
|
91
|
+ events: isEmptyObject(events) ? [] : events,
|
|
|
92
|
+ };
|
86
|
exportJSONFile(value);
|
93
|
exportJSONFile(value);
|
87
|
} catch (error) {
|
94
|
} catch (error) {
|
88
|
throw error;
|
95
|
throw error;
|