add底层网格图

qianlishi 3 years ago
parent 07332967e5
commit 434002b0ec

@ -153,6 +153,7 @@
}" }"
@click.self="setOptionsOnClickScreen" @click.self="setOptionsOnClickScreen"
> >
<div v-if="grade" class="bg-grid"></div>
<widget <widget
ref="widgets" ref="widgets"
v-for="(widget, index) in widgets" v-for="(widget, index) in widgets"
@ -164,6 +165,7 @@
@onActivated="setOptionsOnClickWidget" @onActivated="setOptionsOnClickWidget"
@contextmenu.prevent.native="rightClick($event, index)" @contextmenu.prevent.native="rightClick($event, index)"
@mousedown.prevent.native="widgetsClick(index)" @mousedown.prevent.native="widgetsClick(index)"
@mouseup.prevent.native="widgetsMouseup"
/> />
</div> </div>
</vue-ruler-tool> </vue-ruler-tool>
@ -242,6 +244,7 @@ export default {
}, },
data() { data() {
return { return {
grade: false,
layerWidget: [], layerWidget: [],
widgetTools: widgetTools, // js widgetTools: widgetTools, // js
widthLeftForTools: 200, // widthLeftForTools: 200, //
@ -355,6 +358,10 @@ export default {
// //
this.initEchartData(); this.initEchartData();
this.widgets = []; this.widgets = [];
window.addEventListener("mouseup", () => {
this.grade = false;
});
}, },
methods: { methods: {
handlerLayerWidget(val) { handlerLayerWidget(val) {
@ -378,8 +385,6 @@ export default {
if (code != 200) return; if (code != 200) return;
const processData = this.handleInitEchartsData(data); const processData = this.handleInitEchartsData(data);
const screenData = this.handleBigScreen(data.dashboard); const screenData = this.handleBigScreen(data.dashboard);
console.log(screenData);
console.log(processData);
this.widgets = processData; this.widgets = processData;
this.dashboard = screenData; this.dashboard = screenData;
}, },
@ -618,6 +623,10 @@ export default {
} }
} }
this.setOptionsOnClickWidget(index); this.setOptionsOnClickWidget(index);
this.grade = true;
},
widgetsMouseup(e) {
this.grade = false;
}, },
handleMouseDown() { handleMouseDown() {
const draggableArr = this.$refs.widgets; const draggableArr = this.$refs.widgets;
@ -888,6 +897,20 @@ export default {
margin: 0; margin: 0;
padding: 0; padding: 0;
} }
.bg-grid {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-size: 30px 30px, 30px 30px;
background-image: linear-gradient(
hsla(0, 0%, 100%, 0.1) 1px,
transparent 0
),
linear-gradient(90deg, hsla(0, 0%, 100%, 0.1) 1px, transparent 0);
// z-index: 2;
}
} }
} }

@ -12,6 +12,7 @@
:top="widgetsTop" :top="widgetsTop"
ref="draggable" ref="draggable"
:index="index" :index="index"
:z-index="-1"
@focus="handleFocus" @focus="handleFocus"
@blur="handleBlur" @blur="handleBlur"
> >

@ -57,7 +57,6 @@ export default {
watch: { watch: {
value: { value: {
handler(val) { handler(val) {
console.log(val);
this.options = val; this.options = val;
}, },
deep: true deep: true

Loading…
Cancel
Save