Showing
10 changed files
with
128 additions
and
113 deletions
| ... | @@ -5187,14 +5187,12 @@ | ... | @@ -5187,14 +5187,12 @@ |
| 5187 | "balanced-match": { | 5187 | "balanced-match": { |
| 5188 | "version": "1.0.0", | 5188 | "version": "1.0.0", |
| 5189 | "bundled": true, | 5189 | "bundled": true, |
| 5190 | - "dev": true, | 5190 | + "dev": true |
| 5191 | - "optional": true | ||
| 5192 | }, | 5191 | }, |
| 5193 | "brace-expansion": { | 5192 | "brace-expansion": { |
| 5194 | "version": "1.1.11", | 5193 | "version": "1.1.11", |
| 5195 | "bundled": true, | 5194 | "bundled": true, |
| 5196 | "dev": true, | 5195 | "dev": true, |
| 5197 | - "optional": true, | ||
| 5198 | "requires": { | 5196 | "requires": { |
| 5199 | "balanced-match": "^1.0.0", | 5197 | "balanced-match": "^1.0.0", |
| 5200 | "concat-map": "0.0.1" | 5198 | "concat-map": "0.0.1" |
| ... | @@ -5209,20 +5207,17 @@ | ... | @@ -5209,20 +5207,17 @@ |
| 5209 | "code-point-at": { | 5207 | "code-point-at": { |
| 5210 | "version": "1.1.0", | 5208 | "version": "1.1.0", |
| 5211 | "bundled": true, | 5209 | "bundled": true, |
| 5212 | - "dev": true, | 5210 | + "dev": true |
| 5213 | - "optional": true | ||
| 5214 | }, | 5211 | }, |
| 5215 | "concat-map": { | 5212 | "concat-map": { |
| 5216 | "version": "0.0.1", | 5213 | "version": "0.0.1", |
| 5217 | "bundled": true, | 5214 | "bundled": true, |
| 5218 | - "dev": true, | 5215 | + "dev": true |
| 5219 | - "optional": true | ||
| 5220 | }, | 5216 | }, |
| 5221 | "console-control-strings": { | 5217 | "console-control-strings": { |
| 5222 | "version": "1.1.0", | 5218 | "version": "1.1.0", |
| 5223 | "bundled": true, | 5219 | "bundled": true, |
| 5224 | - "dev": true, | 5220 | + "dev": true |
| 5225 | - "optional": true | ||
| 5226 | }, | 5221 | }, |
| 5227 | "core-util-is": { | 5222 | "core-util-is": { |
| 5228 | "version": "1.0.2", | 5223 | "version": "1.0.2", |
| ... | @@ -5339,8 +5334,7 @@ | ... | @@ -5339,8 +5334,7 @@ |
| 5339 | "inherits": { | 5334 | "inherits": { |
| 5340 | "version": "2.0.3", | 5335 | "version": "2.0.3", |
| 5341 | "bundled": true, | 5336 | "bundled": true, |
| 5342 | - "dev": true, | 5337 | + "dev": true |
| 5343 | - "optional": true | ||
| 5344 | }, | 5338 | }, |
| 5345 | "ini": { | 5339 | "ini": { |
| 5346 | "version": "1.3.5", | 5340 | "version": "1.3.5", |
| ... | @@ -5352,7 +5346,6 @@ | ... | @@ -5352,7 +5346,6 @@ |
| 5352 | "version": "1.0.0", | 5346 | "version": "1.0.0", |
| 5353 | "bundled": true, | 5347 | "bundled": true, |
| 5354 | "dev": true, | 5348 | "dev": true, |
| 5355 | - "optional": true, | ||
| 5356 | "requires": { | 5349 | "requires": { |
| 5357 | "number-is-nan": "^1.0.0" | 5350 | "number-is-nan": "^1.0.0" |
| 5358 | } | 5351 | } |
| ... | @@ -5367,7 +5360,6 @@ | ... | @@ -5367,7 +5360,6 @@ |
| 5367 | "version": "3.0.4", | 5360 | "version": "3.0.4", |
| 5368 | "bundled": true, | 5361 | "bundled": true, |
| 5369 | "dev": true, | 5362 | "dev": true, |
| 5370 | - "optional": true, | ||
| 5371 | "requires": { | 5363 | "requires": { |
| 5372 | "brace-expansion": "^1.1.7" | 5364 | "brace-expansion": "^1.1.7" |
| 5373 | } | 5365 | } |
| ... | @@ -5375,14 +5367,12 @@ | ... | @@ -5375,14 +5367,12 @@ |
| 5375 | "minimist": { | 5367 | "minimist": { |
| 5376 | "version": "0.0.8", | 5368 | "version": "0.0.8", |
| 5377 | "bundled": true, | 5369 | "bundled": true, |
| 5378 | - "dev": true, | 5370 | + "dev": true |
| 5379 | - "optional": true | ||
| 5380 | }, | 5371 | }, |
| 5381 | "minipass": { | 5372 | "minipass": { |
| 5382 | "version": "2.3.5", | 5373 | "version": "2.3.5", |
| 5383 | "bundled": true, | 5374 | "bundled": true, |
| 5384 | "dev": true, | 5375 | "dev": true, |
| 5385 | - "optional": true, | ||
| 5386 | "requires": { | 5376 | "requires": { |
| 5387 | "safe-buffer": "^5.1.2", | 5377 | "safe-buffer": "^5.1.2", |
| 5388 | "yallist": "^3.0.0" | 5378 | "yallist": "^3.0.0" |
| ... | @@ -5401,7 +5391,6 @@ | ... | @@ -5401,7 +5391,6 @@ |
| 5401 | "version": "0.5.1", | 5391 | "version": "0.5.1", |
| 5402 | "bundled": true, | 5392 | "bundled": true, |
| 5403 | "dev": true, | 5393 | "dev": true, |
| 5404 | - "optional": true, | ||
| 5405 | "requires": { | 5394 | "requires": { |
| 5406 | "minimist": "0.0.8" | 5395 | "minimist": "0.0.8" |
| 5407 | } | 5396 | } |
| ... | @@ -5482,8 +5471,7 @@ | ... | @@ -5482,8 +5471,7 @@ |
| 5482 | "number-is-nan": { | 5471 | "number-is-nan": { |
| 5483 | "version": "1.0.1", | 5472 | "version": "1.0.1", |
| 5484 | "bundled": true, | 5473 | "bundled": true, |
| 5485 | - "dev": true, | 5474 | + "dev": true |
| 5486 | - "optional": true | ||
| 5487 | }, | 5475 | }, |
| 5488 | "object-assign": { | 5476 | "object-assign": { |
| 5489 | "version": "4.1.1", | 5477 | "version": "4.1.1", |
| ... | @@ -5495,7 +5483,6 @@ | ... | @@ -5495,7 +5483,6 @@ |
| 5495 | "version": "1.4.0", | 5483 | "version": "1.4.0", |
| 5496 | "bundled": true, | 5484 | "bundled": true, |
| 5497 | "dev": true, | 5485 | "dev": true, |
| 5498 | - "optional": true, | ||
| 5499 | "requires": { | 5486 | "requires": { |
| 5500 | "wrappy": "1" | 5487 | "wrappy": "1" |
| 5501 | } | 5488 | } |
| ... | @@ -5617,7 +5604,6 @@ | ... | @@ -5617,7 +5604,6 @@ |
| 5617 | "version": "1.0.2", | 5604 | "version": "1.0.2", |
| 5618 | "bundled": true, | 5605 | "bundled": true, |
| 5619 | "dev": true, | 5606 | "dev": true, |
| 5620 | - "optional": true, | ||
| 5621 | "requires": { | 5607 | "requires": { |
| 5622 | "code-point-at": "^1.0.0", | 5608 | "code-point-at": "^1.0.0", |
| 5623 | "is-fullwidth-code-point": "^1.0.0", | 5609 | "is-fullwidth-code-point": "^1.0.0", |
| ... | @@ -10994,6 +10980,11 @@ | ... | @@ -10994,6 +10980,11 @@ |
| 10994 | "integrity": "sha1-HuO8mhbsv1EYvjNLsV+cRvgvWCU=", | 10980 | "integrity": "sha1-HuO8mhbsv1EYvjNLsV+cRvgvWCU=", |
| 10995 | "dev": true | 10981 | "dev": true |
| 10996 | }, | 10982 | }, |
| 10983 | + "vuex": { | ||
| 10984 | + "version": "3.1.0", | ||
| 10985 | + "resolved": "https://registry.npmjs.org/vuex/-/vuex-3.1.0.tgz", | ||
| 10986 | + "integrity": "sha512-mdHeHT/7u4BncpUZMlxNaIdcN/HIt1GsGG5LKByArvYG/v6DvHcOxvDCts+7SRdCoIRGllK8IMZvQtQXLppDYg==" | ||
| 10987 | + }, | ||
| 10997 | "warning": { | 10988 | "warning": { |
| 10998 | "version": "3.0.0", | 10989 | "version": "3.0.0", |
| 10999 | "resolved": "https://registry.npmjs.org/warning/-/warning-3.0.0.tgz", | 10990 | "resolved": "https://registry.npmjs.org/warning/-/warning-3.0.0.tgz", | ... | ... |
| ... | @@ -15,7 +15,8 @@ | ... | @@ -15,7 +15,8 @@ |
| 15 | "less-loader": "^4.1.0", | 15 | "less-loader": "^4.1.0", |
| 16 | "lodash": "^4.17.11", | 16 | "lodash": "^4.17.11", |
| 17 | "vue": "^2.6.6", | 17 | "vue": "^2.6.6", |
| 18 | - "vue-grid-layout": "^2.3.4" | 18 | + "vue-grid-layout": "^2.3.4", |
| 19 | + "vuex": "^3.1.0" | ||
| 19 | }, | 20 | }, |
| 20 | "devDependencies": { | 21 | "devDependencies": { |
| 21 | "@vue/cli-plugin-babel": "^3.5.0", | 22 | "@vue/cli-plugin-babel": "^3.5.0", | ... | ... |
| 1 | <template> | 1 | <template> |
| 2 | <div id="app"> | 2 | <div id="app"> |
| 3 | - <setting | 3 | + <setting/> |
| 4 | - :layout="layout" | 4 | + <!-- <layout/> --> |
| 5 | - :isDraggable="isDraggable" | ||
| 6 | - :isResizable="isResizable" | ||
| 7 | - @isLock="isLock" | ||
| 8 | - /> | ||
| 9 | - <layout :layout="layout" :isDraggable="isDraggable" :isResizable="isResizable"/> | ||
| 10 | </div> | 5 | </div> |
| 11 | </template> | 6 | </template> |
| 12 | 7 | ||
| 13 | <script> | 8 | <script> |
| 14 | import setting from "./components/setting"; | 9 | import setting from "./components/setting"; |
| 15 | -import layout from "./components/layout"; | 10 | +// import layout from "./components/layout"; |
| 16 | 11 | ||
| 17 | export default { | 12 | export default { |
| 18 | name: "app", | 13 | name: "app", |
| 19 | components: { | 14 | components: { |
| 20 | setting, | 15 | setting, |
| 21 | - layout | 16 | + // layout |
| 22 | }, | 17 | }, |
| 23 | mounted() { | 18 | mounted() { |
| 24 | this.$inventory | 19 | this.$inventory |
| ... | @@ -32,29 +27,25 @@ export default { | ... | @@ -32,29 +27,25 @@ export default { |
| 32 | "dashboard!name!home": {} | 27 | "dashboard!name!home": {} |
| 33 | }) | 28 | }) |
| 34 | .then(detail => { | 29 | .then(detail => { |
| 35 | - this.id = detail.id; | 30 | + this.$store.commit("setDashboardId", detail.id); |
| 36 | }); | 31 | }); |
| 37 | } else { | 32 | } else { |
| 38 | - this.id = list.managedObjects[0].id; | 33 | + this.$store.commit( |
| 34 | + "layout/setDashboardId", | ||
| 35 | + list.managedObjects[0].id | ||
| 36 | + ); | ||
| 39 | } | 37 | } |
| 40 | }); | 38 | }); |
| 41 | }, | 39 | }, |
| 42 | - data() { | ||
| 43 | - return { | ||
| 44 | - layout: [], | ||
| 45 | - isDraggable: true, | ||
| 46 | - isResizable: true, | ||
| 47 | - id: null | ||
| 48 | - }; | ||
| 49 | - }, | ||
| 50 | methods: { | 40 | methods: { |
| 51 | - isLock: function(val) { | 41 | + // isLock: function(val) { |
| 52 | - this.isDraggable = val.isDraggable; | 42 | + // this.$store.commit("setLock", detail.id); |
| 53 | - this.isResizable = val.isResizable; | 43 | + // this.isDraggable = val.isDraggable; |
| 54 | - this.$message.success( | 44 | + // this.isResizable = val.isResizable; |
| 55 | - val.isResizable && val.isDraggable ? "编辑已解锁" : "编辑已锁定" | 45 | + // this.$message.success( |
| 56 | - ); | 46 | + // val.isResizable && val.isDraggable ? "编辑已解锁" : "编辑已锁定" |
| 57 | - } | 47 | + // ); |
| 48 | + // } | ||
| 58 | } | 49 | } |
| 59 | }; | 50 | }; |
| 60 | </script> | 51 | </script> | ... | ... |
src/autoImport.js
0 → 100644
| 1 | +import Vue from 'vue'; | ||
| 2 | +import { camelCase } from 'lodash'; | ||
| 3 | + | ||
| 4 | +const requireComponent = require.context('./views', true, /.(vue|js)$/); | ||
| 5 | + | ||
| 6 | +const componentList = []; | ||
| 7 | +const componentAll = []; | ||
| 8 | + | ||
| 9 | +requireComponent.keys().forEach((fileName) => { | ||
| 10 | + const componentConfig = requireComponent(fileName); | ||
| 11 | + const componentName = camelCase(fileName.split('/')[1]); | ||
| 12 | + if (componentList.indexOf(componentName) === -1) { | ||
| 13 | + componentList.push(componentName); | ||
| 14 | + } | ||
| 15 | + componentAll.push(componentConfig.default.name); | ||
| 16 | + Vue.component( | ||
| 17 | + componentConfig.default.name, | ||
| 18 | + componentConfig.default || componentConfig | ||
| 19 | + ); | ||
| 20 | +}); | ||
| 21 | + | ||
| 22 | +window.componentList = componentList; | ||
| 23 | +window.componentAll = componentAll; |
| ... | @@ -6,13 +6,13 @@ | ... | @@ -6,13 +6,13 @@ |
| 6 | shape="circle" | 6 | shape="circle" |
| 7 | icon="close" | 7 | icon="close" |
| 8 | @click="close" | 8 | @click="close" |
| 9 | - v-show="isDraggable&&isResizable" | 9 | + v-show="this.$store.state.layout.isDraggable&&this.$store.state.layout.isResizable" |
| 10 | ></a-button> | 10 | ></a-button> |
| 11 | <a-button | 11 | <a-button |
| 12 | size="small" | 12 | size="small" |
| 13 | shape="circle" | 13 | shape="circle" |
| 14 | icon="setting" | 14 | icon="setting" |
| 15 | - v-show="isDraggable&&isResizable" | 15 | + v-show="this.$store.state.layout.isDraggable&&this.$store.state.layout.isResizable" |
| 16 | ></a-button> | 16 | ></a-button> |
| 17 | </div> | 17 | </div> |
| 18 | <component :is="layout.name" :isConfig="isConfig"></component> | 18 | <component :is="layout.name" :isConfig="isConfig"></component> |
| ... | @@ -34,8 +34,8 @@ export default { | ... | @@ -34,8 +34,8 @@ export default { |
| 34 | props: { | 34 | props: { |
| 35 | layout: Object, | 35 | layout: Object, |
| 36 | index: Number, | 36 | index: Number, |
| 37 | - isDraggable: Boolean, | 37 | + // isDraggable: Boolean, |
| 38 | - isResizable: Boolean | 38 | + // isResizable: Boolean |
| 39 | }, | 39 | }, |
| 40 | data() { | 40 | data() { |
| 41 | return { | 41 | return { | ... | ... |
| 1 | <template> | 1 | <template> |
| 2 | <grid-layout | 2 | <grid-layout |
| 3 | - :layout.sync="layout" | 3 | + :layout.sync="this.$store.state.layout.layout" |
| 4 | :col-num="100" | 4 | :col-num="100" |
| 5 | :row-height="30" | 5 | :row-height="30" |
| 6 | - :is-draggable="isDraggable" | 6 | + :is-draggable="this.$store.state.layout.isDraggable" |
| 7 | - :is-resizable="isResizable" | 7 | + :is-resizable="this.$store.state.layout.isResizable" |
| 8 | :is-mirrored="false" | 8 | :is-mirrored="false" |
| 9 | :vertical-compact="true" | 9 | :vertical-compact="true" |
| 10 | :margin="[0, 0]" | 10 | :margin="[0, 0]" |
| 11 | :use-css-transforms="true" | 11 | :use-css-transforms="true" |
| 12 | > | 12 | > |
| 13 | <grid-item | 13 | <grid-item |
| 14 | - v-for="(item,index) in layout" | 14 | + v-for="(item,index) in this.$store.state.layout.layout" |
| 15 | :x="item.x" | 15 | :x="item.x" |
| 16 | :y="item.y" | 16 | :y="item.y" |
| 17 | :w="item.w" | 17 | :w="item.w" |
| ... | @@ -23,7 +23,7 @@ | ... | @@ -23,7 +23,7 @@ |
| 23 | :maxH="item.maxH" | 23 | :maxH="item.maxH" |
| 24 | :key="item.i" | 24 | :key="item.i" |
| 25 | > | 25 | > |
| 26 | - <gridComponent :isDraggable="isDraggable" :isResizable="isResizable" :layout="item" :index="index" @close="close"/> | 26 | + <gridComponent :layout="item" :index="index" @close="close"/> |
| 27 | </grid-item> | 27 | </grid-item> |
| 28 | </grid-layout> | 28 | </grid-layout> |
| 29 | </template> | 29 | </template> |
| ... | @@ -32,11 +32,6 @@ | ... | @@ -32,11 +32,6 @@ |
| 32 | import VueGridLayout from "vue-grid-layout"; | 32 | import VueGridLayout from "vue-grid-layout"; |
| 33 | import gridComponent from "./gridComponent"; | 33 | import gridComponent from "./gridComponent"; |
| 34 | export default { | 34 | export default { |
| 35 | - props: { | ||
| 36 | - layout: Array, | ||
| 37 | - isDraggable: Boolean, | ||
| 38 | - isResizable: Boolean | ||
| 39 | - }, | ||
| 40 | components: { | 35 | components: { |
| 41 | GridLayout: VueGridLayout.GridLayout, | 36 | GridLayout: VueGridLayout.GridLayout, |
| 42 | GridItem: VueGridLayout.GridItem, | 37 | GridItem: VueGridLayout.GridItem, |
| ... | @@ -44,7 +39,7 @@ export default { | ... | @@ -44,7 +39,7 @@ export default { |
| 44 | }, | 39 | }, |
| 45 | methods:{ | 40 | methods:{ |
| 46 | close:function(val){ | 41 | close:function(val){ |
| 47 | - this.layout.splice(val,1) | 42 | + // this.layout.splice(val,1) |
| 48 | } | 43 | } |
| 49 | } | 44 | } |
| 50 | }; | 45 | }; | ... | ... |
| ... | @@ -5,9 +5,14 @@ | ... | @@ -5,9 +5,14 @@ |
| 5 | shape="circle" | 5 | shape="circle" |
| 6 | icon="plus" | 6 | icon="plus" |
| 7 | @click="() => visible = true" | 7 | @click="() => visible = true" |
| 8 | - v-show="isDraggable&&isResizable" | 8 | + v-show="this.$store.state.layout.isDraggable&&this.$store.state.layout.isResizable" |
| 9 | + ></a-button> | ||
| 10 | + <a-button | ||
| 11 | + size="small" | ||
| 12 | + shape="circle" | ||
| 13 | + icon="lock" | ||
| 14 | + @click="isLock(!this.$store.state.layout.isDraggable)" | ||
| 9 | ></a-button> | 15 | ></a-button> |
| 10 | - <a-button size="small" shape="circle" icon="lock" @click="isLock"></a-button> | ||
| 11 | <a-modal | 16 | <a-modal |
| 12 | title="添加小部件" | 17 | title="添加小部件" |
| 13 | centered | 18 | centered |
| ... | @@ -43,16 +48,10 @@ | ... | @@ -43,16 +48,10 @@ |
| 43 | 48 | ||
| 44 | 49 | ||
| 45 | <script> | 50 | <script> |
| 51 | +import { mapMutations } from "vuex"; | ||
| 46 | export default { | 52 | export default { |
| 47 | - props: { | ||
| 48 | - layout: Array, | ||
| 49 | - isDraggable: Boolean, | ||
| 50 | - isResizable: Boolean | ||
| 51 | - }, | ||
| 52 | data() { | 53 | data() { |
| 53 | return { | 54 | return { |
| 54 | - isDraggable1: this.isDraggable, | ||
| 55 | - isResizable1: this.isResizable, | ||
| 56 | visible: false, | 55 | visible: false, |
| 57 | list: window.componentList, | 56 | list: window.componentList, |
| 58 | selectItem: null, | 57 | selectItem: null, |
| ... | @@ -60,12 +59,9 @@ export default { | ... | @@ -60,12 +59,9 @@ export default { |
| 60 | }; | 59 | }; |
| 61 | }, | 60 | }, |
| 62 | methods: { | 61 | methods: { |
| 63 | - isLock: function() { | 62 | + ...mapMutations({ |
| 64 | - this.$emit("isLock", { | 63 | + isLock: "setLock" |
| 65 | - isDraggable: !this.isDraggable, | 64 | + }), |
| 66 | - isResizable: !this.isResizable | ||
| 67 | - }); | ||
| 68 | - }, | ||
| 69 | filterOption(input, option) { | 65 | filterOption(input, option) { |
| 70 | return ( | 66 | return ( |
| 71 | option.componentOptions.children[0].text | 67 | option.componentOptions.children[0].text |
| ... | @@ -82,14 +78,7 @@ export default { | ... | @@ -82,14 +78,7 @@ export default { |
| 82 | } | 78 | } |
| 83 | }, | 79 | }, |
| 84 | add: function() { | 80 | add: function() { |
| 85 | - this.layout.push({ | 81 | + this.$store.commit("setLatout", this.selectItem); |
| 86 | - x: 0, | ||
| 87 | - y: 0, | ||
| 88 | - w: 10, | ||
| 89 | - h: 2, | ||
| 90 | - i: this.layout.length + 1, | ||
| 91 | - name: this.selectItem | ||
| 92 | - }); | ||
| 93 | this.visible = false; | 82 | this.visible = false; |
| 94 | } | 83 | } |
| 95 | } | 84 | } | ... | ... |
| 1 | -import Vue from "vue"; | 1 | +import Vue from 'vue'; |
| 2 | -import App from "./App.vue"; | 2 | +import App from './App.vue'; |
| 3 | -import { camelCase } from "lodash"; | 3 | +import store from './store'; |
| 4 | -import { Modal, Button, Select, message } from "ant-design-vue"; | 4 | +import './autoImport'; |
| 5 | -import { inventory } from "./api/inventory"; | 5 | +import { Modal, Button, Select, message } from 'ant-design-vue'; |
| 6 | +import { inventory } from './api/inventory'; | ||
| 6 | 7 | ||
| 7 | Vue.config.productionTip = false; | 8 | Vue.config.productionTip = false; |
| 8 | Vue.use(Modal); | 9 | Vue.use(Modal); |
| ... | @@ -12,27 +13,8 @@ Vue.use(Select); | ... | @@ -12,27 +13,8 @@ Vue.use(Select); |
| 12 | Vue.prototype.$message = message; | 13 | Vue.prototype.$message = message; |
| 13 | Vue.prototype.$inventory = inventory; | 14 | Vue.prototype.$inventory = inventory; |
| 14 | 15 | ||
| 15 | -const requireComponent = require.context("./views", true, /.(vue|js)$/); | ||
| 16 | - | ||
| 17 | -const componentList = []; | ||
| 18 | -const componentAll = []; | ||
| 19 | - | ||
| 20 | -requireComponent.keys().forEach(fileName => { | ||
| 21 | - const componentConfig = requireComponent(fileName); | ||
| 22 | - const componentName = camelCase(fileName.split("/")[1]); | ||
| 23 | - if (componentList.indexOf(componentName) === -1) { | ||
| 24 | - componentList.push(componentName); | ||
| 25 | - } | ||
| 26 | - componentAll.push(componentConfig.default.name); | ||
| 27 | - Vue.component( | ||
| 28 | - componentConfig.default.name, | ||
| 29 | - componentConfig.default || componentConfig | ||
| 30 | - ); | ||
| 31 | -}); | ||
| 32 | -window.componentList = componentList; | ||
| 33 | -window.componentAll = componentAll; | ||
| 34 | - | ||
| 35 | new Vue({ | 16 | new Vue({ |
| 36 | - el: "#app", | 17 | + el: '#app', |
| 37 | - render: h => h(App) | 18 | + store, |
| 19 | + render: (h) => h(App), | ||
| 38 | }); | 20 | }); | ... | ... |
src/store/components/layout.js
0 → 100644
| 1 | +const state = { | ||
| 2 | + layout: [], | ||
| 3 | + isDraggable: true, | ||
| 4 | + isResizable: true, | ||
| 5 | + dashboardId: null, | ||
| 6 | +}; | ||
| 7 | + | ||
| 8 | +const mutations = { | ||
| 9 | + setDashboardId(state, id) { | ||
| 10 | + state.dashboardId = id; | ||
| 11 | + }, | ||
| 12 | + setLock(state, value) { | ||
| 13 | + state.isDraggable = value; | ||
| 14 | + state.isResizable = value; | ||
| 15 | + }, | ||
| 16 | + setLatout(state, name) { | ||
| 17 | + state.layout.push({ | ||
| 18 | + x: 0, | ||
| 19 | + y: 0, | ||
| 20 | + w: 10, | ||
| 21 | + h: 2, | ||
| 22 | + i: state.layout.length + 1, | ||
| 23 | + name | ||
| 24 | + }); | ||
| 25 | + }, | ||
| 26 | +}; | ||
| 27 | + | ||
| 28 | +export default { | ||
| 29 | + namespaced: true, | ||
| 30 | + state, | ||
| 31 | + mutations, | ||
| 32 | +}; |
-
Please register or sign in to post a comment