From 4cb06437d5d5f36bb178635b0d2a7f25e816e003 Mon Sep 17 00:00:00 2001 From: qianlishi <1432731663@qq.com> Date: Fri, 17 Jun 2022 09:13:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E5=A4=A7=E5=B1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- report-ui/config/dev.env.js | 4 +- .../src/assets/styles/screenDesigner.scss | 133 +--- report-ui/src/views/bigScreenReport/index.vue | 3 +- .../screenDesigner/components/contentMenu.vue | 39 +- report-ui/src/views/screenDesigner/index.vue | 613 ++------------- .../src/views/screenDesigner/index备份.vue | 725 ++++++++++++++++++ .../views/screenDesigner/layout/leftMenu.vue | 144 ++++ .../screenDesigner/layout/middleScreen.vue | 260 +++++++ .../screenDesigner/layout/rightConfig.vue | 70 ++ .../views/screenDesigner/layout/topBar.vue | 229 ++++++ report-ui/src/views/screenDesigner/node.md | 4 + .../src/views/screenDesigner/util/revoke.js | 92 +++ .../src/views/screenDesigner/util/screen.js | 1 + 13 files changed, 1640 insertions(+), 677 deletions(-) create mode 100644 report-ui/src/views/screenDesigner/index备份.vue create mode 100644 report-ui/src/views/screenDesigner/layout/leftMenu.vue create mode 100644 report-ui/src/views/screenDesigner/layout/middleScreen.vue create mode 100644 report-ui/src/views/screenDesigner/layout/rightConfig.vue create mode 100644 report-ui/src/views/screenDesigner/layout/topBar.vue create mode 100644 report-ui/src/views/screenDesigner/util/revoke.js diff --git a/report-ui/config/dev.env.js b/report-ui/config/dev.env.js index ee3d90dc..f50fc84e 100644 --- a/report-ui/config/dev.env.js +++ b/report-ui/config/dev.env.js @@ -4,6 +4,6 @@ const prodEnv = require('./prod.env') module.exports = merge(prodEnv, { NODE_ENV: '"development"', - BASE_API: '"http://127.0.0.1:9095"' - // BASE_API: '"http://10.108.26.197:9095"' + // BASE_API: '"http://127.0.0.1:9095"' + BASE_API: '"http://10.108.26.197:9095"' }) diff --git a/report-ui/src/assets/styles/screenDesigner.scss b/report-ui/src/assets/styles/screenDesigner.scss index c7ca98cd..75dbd578 100644 --- a/report-ui/src/assets/styles/screenDesigner.scss +++ b/report-ui/src/assets/styles/screenDesigner.scss @@ -3,27 +3,7 @@ height: 100%; background: #242a30; color: #fff; - .layout-bar { - height: 40px; - line-height: 40px; - font-size: 12px; - padding: 0 10px; - display: flex; - flex-direction: row; - overflow: hidden; - .bar-item { - margin-right: 20px; - cursor: pointer; - .iconfont { - font-size: 12px; - margin-right: 4px; - } - .el-dropdown-link { - color: #fff; - cursor: pointer; - } - } - } + .layout-container { width: 100%; height: calc(100vh - 40px); @@ -31,70 +11,6 @@ flex-direction: row; justify-content: space-between; overflow: hidden; - .layout-left { - width: 200px; - background: #242a30; - overflow-x: hidden; - overflow-y: auto; - .chart-type { - display: flex; - flex-direction: row; - overflow: hidden; - .type-left { - width: 100%; - height: calc(100vh - 80px); - text-align: center; - /deep/.el-tabs__header { - width: 30%; - margin-right: 0; - .el-tabs__nav-wrap { - &::after { - background: transparent; - } - .el-tabs__item { - text-align: center; - width: 100%; - color: #fff; - padding: 0; - } - } - } - /deep/.el-tabs__content { - width: 70%; - } - } - } - //工具栏一个元素 - .tools-item { - display: flex; - position: relative; - width: 100%; - height: 48px; - align-items: center; - -webkit-box-align: center; - padding: 0 6px; - cursor: pointer; - font-size: 12px; - margin-bottom: 1px; - - .tools-item-icon { - color: #409eff; - margin-right: 10px; - width: 53px; - height: 30px; - line-height: 30px; - text-align: center; - display: block; - border: 1px solid #3a4659; - background: #282a30; - } - .tools-item-text { - } - } - /deep/.el-tabs__content { - padding: 0; - } - } .layout-middle { // display: flex; position: relative; @@ -107,50 +23,7 @@ align-items: center; vertical-align: middle; text-align: center; - .workbench-container { - position: relative; - -webkit-transform-origin: 0 0; - transform-origin: 0 0; - -webkit-box-sizing: border-box; - box-sizing: border-box; - margin: 0; - padding: 0; - - .vueRuler { - width: 100%; - padding: 18px 0px 0px 18px; - } - - .workbench { - background-color: #1e1e1e; - position: relative; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - -webkit-transform-origin: 0 0; - transform-origin: 0 0; - margin: 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; - } - } } - .layout-right { width: 300px; } @@ -232,6 +105,4 @@ } } } -/deep/.el-dropdown-menu__item { - max-width: none; -} + diff --git a/report-ui/src/views/bigScreenReport/index.vue b/report-ui/src/views/bigScreenReport/index.vue index e1db14e6..c5d47ed2 100644 --- a/report-ui/src/views/bigScreenReport/index.vue +++ b/report-ui/src/views/bigScreenReport/index.vue @@ -180,7 +180,8 @@ export default { }, openDesign(val) { let routeUrl = this.$router.resolve({ - path: "/bigscreen/designer", + path: "/screenDesigner", + // path: "/bigscreen/designer", query: { reportCode: val.reportCode } diff --git a/report-ui/src/views/screenDesigner/components/contentMenu.vue b/report-ui/src/views/screenDesigner/components/contentMenu.vue index 15562b1c..67a9a8ad 100644 --- a/report-ui/src/views/screenDesigner/components/contentMenu.vue +++ b/report-ui/src/views/screenDesigner/components/contentMenu.vue @@ -24,7 +24,9 @@ export default { props: { styleObj: Object, - visible: Boolean + visible: Boolean, + widgets: Array, + rightClickIndex: Number }, data() { return {}; @@ -49,7 +51,8 @@ export default { type: "warning" }) .then(() => { - this.$emit("deletelayer"); + console.log(this.rightClickIndex); + this.widgets.splice(this.rightClickIndex, 1); this.$message({ type: "success", message: "删除成功!" @@ -63,19 +66,41 @@ export default { }); }, copyLayer() { - this.$emit("copylayer"); + const obj = this.deepClone(this.widgets[this.rightClickIndex]); + this.widgets.splice(this.widgets.length, 0, obj); }, istopLayer() { - this.$emit("istopLayer"); + if (this.rightClickIndex + 1 < this.widgets.length) { + const temp = this.widgets.splice(this.rightClickIndex, 1)[0]; + this.widgets.push(temp); + } }, setlowLayer() { - this.$emit("setlowLayer"); + if (this.rightClickIndex != 0) { + this.widgets.unshift(this.widgets.splice(this.rightClickIndex, 1)[0]); + } }, moveupLayer() { - this.$emit("moveupLayer"); + if (this.rightClickIndex != 0) { + this.widgets[this.rightClickIndex] = this.widgets.splice( + this.rightClickIndex - 1, + 1, + this.widgets[this.rightClickIndex] + )[0]; + } else { + this.widgets.push(this.widgets.shift()); + } }, movedownLayer() { - this.$emit("movedownLayer"); + if (this.rightClickIndex != this.widgets.length - 1) { + this.widgets[this.rightClickIndex] = this.widgets.splice( + this.rightClickIndex + 1, + 1, + this.widgets[this.rightClickIndex] + )[0]; + } else { + this.widgets.unshift(this.widgets.splice(this.rightClickIndex, 1)[0]); + } } } }; diff --git a/report-ui/src/views/screenDesigner/index.vue b/report-ui/src/views/screenDesigner/index.vue index f4e4747d..ba283f0d 100644 --- a/report-ui/src/views/screenDesigner/index.vue +++ b/report-ui/src/views/screenDesigner/index.vue @@ -1,218 +1,48 @@ + diff --git a/report-ui/src/views/screenDesigner/layout/leftMenu.vue b/report-ui/src/views/screenDesigner/layout/leftMenu.vue new file mode 100644 index 00000000..0f2ecef5 --- /dev/null +++ b/report-ui/src/views/screenDesigner/layout/leftMenu.vue @@ -0,0 +1,144 @@ + + + + diff --git a/report-ui/src/views/screenDesigner/layout/middleScreen.vue b/report-ui/src/views/screenDesigner/layout/middleScreen.vue new file mode 100644 index 00000000..6ee0430a --- /dev/null +++ b/report-ui/src/views/screenDesigner/layout/middleScreen.vue @@ -0,0 +1,260 @@ + + + + diff --git a/report-ui/src/views/screenDesigner/layout/rightConfig.vue b/report-ui/src/views/screenDesigner/layout/rightConfig.vue new file mode 100644 index 00000000..29d2622b --- /dev/null +++ b/report-ui/src/views/screenDesigner/layout/rightConfig.vue @@ -0,0 +1,70 @@ + + + diff --git a/report-ui/src/views/screenDesigner/layout/topBar.vue b/report-ui/src/views/screenDesigner/layout/topBar.vue new file mode 100644 index 00000000..a9ebbd58 --- /dev/null +++ b/report-ui/src/views/screenDesigner/layout/topBar.vue @@ -0,0 +1,229 @@ + + + + diff --git a/report-ui/src/views/screenDesigner/node.md b/report-ui/src/views/screenDesigner/node.md index 2e20709c..141ddb24 100644 --- a/report-ui/src/views/screenDesigner/node.md +++ b/report-ui/src/views/screenDesigner/node.md @@ -13,6 +13,10 @@ │ │ ├── pieCharts(文件夹) (饼图) │ │ ├── texts(文件夹) (文本、滚动文本、超链接、当前时间、图片、视频、表格、内联框架) │ │ ├── wordcloudCharts(文件夹) (词云图) +│ ├── layout(文件夹) +│ │ ├── left.vue 大屏左侧工具栏 +│ │ ├── middle.vue 大屏中间配置 +│ │ ├── right.vue 大屏右侧配置 │ ├── util(文件夹) 公共 js │ ├── widget(文件夹) 图表组件 │ │ ├── barCharts(文件夹) (柱状图) diff --git a/report-ui/src/views/screenDesigner/util/revoke.js b/report-ui/src/views/screenDesigner/util/revoke.js new file mode 100644 index 00000000..8cb590c1 --- /dev/null +++ b/report-ui/src/views/screenDesigner/util/revoke.js @@ -0,0 +1,92 @@ +export class Revoke { + // 历史记录 + recordList = []; + + // 撤销记录,用于重做 + redoList = []; + + // 当前记录用currentRecord变量暂时存储,当用户修改时,再存放到recordList + currentRecord = null; + + // 上次插入数据时间 + time = 0; + + /** + * @description: 插入历史记录 + * @param {object}record + * @return {boolean} + */ + push(record) { + const nowTime = Date.now(); + // 防止添加重复的时间,当添加间隔小于100ms时,则替换当前记录并取消执行添加 + if (this.time + 100 > nowTime) { + this.currentRecord = JSON.stringify(record); + return false; + } + + this.time = nowTime; + // 判断之前是否已经存在currentRecord记录,有则存储到recordList + if (this.currentRecord) { + this.recordList.push(this.currentRecord); + //(清空记录)增加记录后则应该清空重做记录 + //splice() 方法向/从数组添加/删除项目,并返回删除的项目。 + this.redoList.splice(0, this.redoList.length); + } + // 将json转成字符串存储 + this.currentRecord = JSON.stringify(record); + + // 最多存储2000条记录,超过2000条记录则删除之前的记录 + if (this.length > 2000) { + //unshift() 方法将新项添加到数组的开头,并返回新的长度。 + this.recordList.unshift(); + } + + return true; + } + + /** + * @description: 撤销操作 + * @param {*} + * @return {object} + */ + undo() { + // 没有记录时,返回false + // 新建的recordList里面,不知为什么会存在一条记录,未找到原因,所以就判断长度为1时就不能撤销了。 + if (this.recordList.length === 1 ) { + return false; + } + //pop(): 方法用于删除并返回数组的最后一个元素。 + const record = this.recordList.pop(); + + // 将当前记录添加到重做记录里面 + if (this.currentRecord) { + this.redoList.push(this.currentRecord); + } + // 丢弃当前记录,防止重复添加 + this.currentRecord = null; + //返回撤销的记录 + return JSON.parse(record); + } + + /** + * @description: 重做操作 + * @param {*} + * @return {*} + */ + redo() { + // 没有重做记录时,返回false + if (this.redoList.length === 0) { + return false; + } + //pop(): 方法用于删除并返回数组的最后一个元素。 + const record = this.redoList.pop(); + // 添加到重做记录里面 + if (this.currentRecord) { + this.recordList.push(this.currentRecord); + } + // 丢弃当前记录,防止重复添加 + this.currentRecord = null; + + return JSON.parse(record); + } +} diff --git a/report-ui/src/views/screenDesigner/util/screen.js b/report-ui/src/views/screenDesigner/util/screen.js index 6a7622cc..01196cb1 100644 --- a/report-ui/src/views/screenDesigner/util/screen.js +++ b/report-ui/src/views/screenDesigner/util/screen.js @@ -15,6 +15,7 @@ export const handlerLayerWidget = (val, getToolByCode) => { } export const handleBigScreen = (data, getToolByCode, callBcak) => { + console.log('aa', getToolByCode("screen")) const optionScreen = getToolByCode("screen").options; const setup = optionScreen.setup; for (const key in data) {