App.vue
1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<template>
<div id="app">
<setting
:layout="layout"
:isDraggable="isDraggable"
:isResizable="isResizable"
@isLock="isLock"
/>
<layout :layout="layout" :isDraggable="isDraggable" :isResizable="isResizable"/>
</div>
</template>
<script>
import setting from "./components/setting";
import layout from "./components/layout";
export default {
name: "app",
components: {
setting,
layout
},
mounted() {
this.$inventory
.list({
fragmentType: "dashboard!name!home"
})
.then(list => {
if (list.managedObjects.length === 0) {
return this.$inventory
.create({
"dashboard!name!home": {}
})
.then(detail => {
this.id = detail.id;
});
} else {
this.id = list.managedObjects[0].id;
}
});
},
data() {
return {
layout: [],
isDraggable: true,
isResizable: true,
id: null
};
},
methods: {
isLock: function(val) {
this.isDraggable = val.isDraggable;
this.isResizable = val.isResizable;
this.$message.success(
val.isResizable && val.isDraggable ? "编辑已解锁" : "编辑已锁定"
);
}
}
};
</script>
<style>
html,
body {
margin: 0;
padding: 0;
}
#app {
font-family: "Avenir", Helvetica, Arial, sans-serif;
}
</style>