|
@@ -88,6 +88,29 @@
|
|
|
<i class="iconfont iconyulan" @click="viewScreen"></i>
|
|
|
</el-tooltip>
|
|
|
</span>
|
|
|
+
|
|
|
+ <span class="btn">
|
|
|
+ <el-tooltip
|
|
|
+ class="item"
|
|
|
+ effect="dark"
|
|
|
+ content="撤销"
|
|
|
+ placement="bottom"
|
|
|
+ >
|
|
|
+ <i class="iconfont" @click="handleUndo">撤销</i>
|
|
|
+ </el-tooltip>
|
|
|
+ </span>
|
|
|
+
|
|
|
+ <span class="btn">
|
|
|
+ <el-tooltip
|
|
|
+ class="item"
|
|
|
+ effect="dark"
|
|
|
+ content="恢复"
|
|
|
+ placement="bottom"
|
|
|
+ >
|
|
|
+ <i class="iconfont" @click="handleRedo">恢复</i>
|
|
|
+ </el-tooltip>
|
|
|
+ </span>
|
|
|
+
|
|
|
<span class="btn" v-permission="'bigScreenManage:export'">
|
|
|
<el-tooltip
|
|
|
class="item"
|
|
@@ -263,6 +286,7 @@ import draggable from "vuedraggable";
|
|
|
import VueRulerTool from "vue-ruler-tool"; // 大屏设计页面的标尺插件
|
|
|
import contentMenu from "./components/contentMenu";
|
|
|
import { getToken } from "@/utils/auth";
|
|
|
+import { Revoke } from '@/utils/revoke' //处理历史记录 2022-02-22
|
|
|
|
|
|
export default {
|
|
|
name: "Login",
|
|
@@ -290,6 +314,7 @@ export default {
|
|
|
|
|
|
bigscreenWidth: 1920, // 大屏设计的大小
|
|
|
bigscreenHeight: 1080,
|
|
|
+ revoke: null, //处理历史记录 2022-02-22
|
|
|
|
|
|
// 工作台大屏画布,保存到表gaea_report_dashboard中
|
|
|
dashboard: {
|
|
@@ -395,10 +420,18 @@ export default {
|
|
|
widgets: {
|
|
|
handler(val) {
|
|
|
this.handlerLayerWidget(val);
|
|
|
+ //以下部分是记录历史
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.revoke.push(this.widgets)
|
|
|
+ })
|
|
|
},
|
|
|
deep: true
|
|
|
}
|
|
|
},
|
|
|
+ created() {
|
|
|
+ /* 以下是记录历史的 */
|
|
|
+ this.revoke = new Revoke()
|
|
|
+ },
|
|
|
mounted() {
|
|
|
// 如果是新的设计工作台
|
|
|
this.initEchartData();
|
|
@@ -408,6 +441,30 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
methods: {
|
|
|
+ /**
|
|
|
+ * @description: 恢复
|
|
|
+ * @param {*}
|
|
|
+ * @return {*}
|
|
|
+ */
|
|
|
+ handleUndo() {
|
|
|
+ const record = this.revoke.undo()
|
|
|
+ if (!record) {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ this.widgets = record
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @description: 重做
|
|
|
+ * @param {*}
|
|
|
+ * @return {*}
|
|
|
+ */
|
|
|
+ handleRedo() {
|
|
|
+ const record = this.revoke.redo()
|
|
|
+ if (!record) {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ this.widgets = record
|
|
|
+ },
|
|
|
handlerLayerWidget(val) {
|
|
|
const layerWidgetArr = [];
|
|
|
for (let i = 0; i < val.length; i++) {
|
|
@@ -639,6 +696,13 @@ export default {
|
|
|
};
|
|
|
// 处理默认值
|
|
|
const widgetJsonValue = this.handleDefaultValue(widgetJson);
|
|
|
+
|
|
|
+ //2022年02月22日 修复:可以拖拽放到鼠标的位置
|
|
|
+ widgetJsonValue.value.position.left =
|
|
|
+ x - widgetJsonValue.value.position.width / 2
|
|
|
+ widgetJsonValue.value.position.top =
|
|
|
+ y - widgetJsonValue.value.position.height / 2
|
|
|
+
|
|
|
// 将选中的复制组件,放到工作区中去
|
|
|
this.widgets.push(this.deepClone(widgetJsonValue));
|
|
|
// 激活新组件的配置属性
|