|
@@ -52,6 +52,7 @@ import widgetWordCloud from "./wordcloud/widgetWordCloud";
|
|
import widgetHeatmap from "./heatmap/widgetHeatmap";
|
|
import widgetHeatmap from "./heatmap/widgetHeatmap";
|
|
import widgetRadar from "./radar/widgetRadar";
|
|
import widgetRadar from "./radar/widgetRadar";
|
|
import widgetBarLineStackChart from "./barline/widgetBarLineStackChart";
|
|
import widgetBarLineStackChart from "./barline/widgetBarLineStackChart";
|
|
|
|
+import widgetSelect from "./form/widgetSelect";
|
|
|
|
|
|
export default {
|
|
export default {
|
|
name: "Widget",
|
|
name: "Widget",
|
|
@@ -85,11 +86,12 @@ export default {
|
|
widgetWordCloud,
|
|
widgetWordCloud,
|
|
widgetHeatmap,
|
|
widgetHeatmap,
|
|
widgetRadar,
|
|
widgetRadar,
|
|
- widgetBarLineStackChart
|
|
|
|
|
|
+ widgetBarLineStackChart,
|
|
|
|
+ widgetSelect,
|
|
},
|
|
},
|
|
model: {
|
|
model: {
|
|
prop: "value",
|
|
prop: "value",
|
|
- event: "input"
|
|
|
|
|
|
+ event: "input",
|
|
},
|
|
},
|
|
props: {
|
|
props: {
|
|
/*
|
|
/*
|
|
@@ -101,9 +103,9 @@ export default {
|
|
bigscreen: Object,
|
|
bigscreen: Object,
|
|
value: {
|
|
value: {
|
|
type: [Object],
|
|
type: [Object],
|
|
- default: () => {}
|
|
|
|
|
|
+ default: () => {},
|
|
},
|
|
},
|
|
- step: Number
|
|
|
|
|
|
+ step: Number,
|
|
},
|
|
},
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
@@ -111,9 +113,9 @@ export default {
|
|
setup: {},
|
|
setup: {},
|
|
data: {},
|
|
data: {},
|
|
position: {},
|
|
position: {},
|
|
-/* leftMargin: null,
|
|
|
|
|
|
+ /* leftMargin: null,
|
|
topMargin: null*/
|
|
topMargin: null*/
|
|
- }
|
|
|
|
|
|
+ },
|
|
};
|
|
};
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
@@ -124,14 +126,14 @@ export default {
|
|
return this.value.position.height;
|
|
return this.value.position.height;
|
|
},
|
|
},
|
|
widgetsLeft() {
|
|
widgetsLeft() {
|
|
- return this.value.position.left// >= this.leftMargin ? this.leftMargin : this.value.position.left;
|
|
|
|
|
|
+ return this.value.position.left; // >= this.leftMargin ? this.leftMargin : this.value.position.left;
|
|
},
|
|
},
|
|
widgetsTop() {
|
|
widgetsTop() {
|
|
- return this.value.position.top// >= this.topMargin ? this.topMargin : this.value.position.top;
|
|
|
|
|
|
+ return this.value.position.top; // >= this.topMargin ? this.topMargin : this.value.position.top;
|
|
},
|
|
},
|
|
widgetsZIndex() {
|
|
widgetsZIndex() {
|
|
return this.value.position.zIndex || 1;
|
|
return this.value.position.zIndex || 1;
|
|
- }
|
|
|
|
|
|
+ },
|
|
},
|
|
},
|
|
mounted() {},
|
|
mounted() {},
|
|
methods: {
|
|
methods: {
|
|
@@ -146,23 +148,42 @@ export default {
|
|
// 计算workbench的X轴边界值
|
|
// 计算workbench的X轴边界值
|
|
// 组件距离左侧宽度 + 组件宽度 > 大屏总宽度时,右侧边界值 = (大屏宽度 - 组件宽度);左侧边界值 = 0
|
|
// 组件距离左侧宽度 + 组件宽度 > 大屏总宽度时,右侧边界值 = (大屏宽度 - 组件宽度);左侧边界值 = 0
|
|
const { bigscreenWidth, bigscreenHeight } = this.bigscreen;
|
|
const { bigscreenWidth, bigscreenHeight } = this.bigscreen;
|
|
- const xBoundaryValue = (left + width) > bigscreenWidth ? bigscreenWidth - width : left < 0 ? 0 : left;
|
|
|
|
|
|
+ const xBoundaryValue =
|
|
|
|
+ left + width > bigscreenWidth
|
|
|
|
+ ? bigscreenWidth - width
|
|
|
|
+ : left < 0
|
|
|
|
+ ? 0
|
|
|
|
+ : left;
|
|
// 初始化X轴边界值
|
|
// 初始化X轴边界值
|
|
this.leftMargin = left;
|
|
this.leftMargin = left;
|
|
// 计算Y轴边界值
|
|
// 计算Y轴边界值
|
|
- const yBoundaryValue = (top + height) > bigscreenHeight ? bigscreenHeight - height : top < 0 ? 0 : top;
|
|
|
|
|
|
+ const yBoundaryValue =
|
|
|
|
+ top + height > bigscreenHeight
|
|
|
|
+ ? bigscreenHeight - height
|
|
|
|
+ : top < 0
|
|
|
|
+ ? 0
|
|
|
|
+ : top;
|
|
// 初始化Y轴边界值
|
|
// 初始化Y轴边界值
|
|
this.topMargin = top;
|
|
this.topMargin = top;
|
|
// 若位置超出边界值则重新设置位置
|
|
// 若位置超出边界值则重新设置位置
|
|
- if (this.leftMargin != xBoundaryValue || this.topMargin != yBoundaryValue) {
|
|
|
|
|
|
+ if (
|
|
|
|
+ this.leftMargin != xBoundaryValue ||
|
|
|
|
+ this.topMargin != yBoundaryValue
|
|
|
|
+ ) {
|
|
this.$nextTick(() => {
|
|
this.$nextTick(() => {
|
|
this.leftMargin = xBoundaryValue;
|
|
this.leftMargin = xBoundaryValue;
|
|
this.topMargin = yBoundaryValue;
|
|
this.topMargin = yBoundaryValue;
|
|
- this.$emit("onActivated", { index, left: xBoundaryValue, top: yBoundaryValue, width, height });
|
|
|
|
- })
|
|
|
|
|
|
+ this.$emit("onActivated", {
|
|
|
|
+ index,
|
|
|
|
+ left: xBoundaryValue,
|
|
|
|
+ top: yBoundaryValue,
|
|
|
|
+ width,
|
|
|
|
+ height,
|
|
|
|
+ });
|
|
|
|
+ });
|
|
}
|
|
}
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ },
|
|
|
|
+ },
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|
|
|
|
|