diff --git a/frontend/src/components/DeViewSelect/dom.js b/frontend/src/components/DeViewSelect/dom.js new file mode 100644 index 0000000000..0077c09474 --- /dev/null +++ b/frontend/src/components/DeViewSelect/dom.js @@ -0,0 +1,32 @@ + +export const on = (function() { + if (document.addEventListener) { + return function(element, event, handler) { + if (element && event && handler) { + element.addEventListener(event, handler, false) + } + } + } else { + return function(element, event, handler) { + if (element && event && handler) { + element.attachEvent('on' + event, handler) + } + } + } +})() +export const off = (function() { + if (document.removeEventListener) { + return function(element, event, handler) { + if (element && event) { + element.removeEventListener(event, handler, false) + } + } + } else { + return function(element, event, handler) { + if (element && event) { + element.detachEvent('on' + event, handler) + } + } + } +})() + diff --git a/frontend/src/components/DeViewSelect/index.vue b/frontend/src/components/DeViewSelect/index.vue new file mode 100644 index 0000000000..73c5f34a96 --- /dev/null +++ b/frontend/src/components/DeViewSelect/index.vue @@ -0,0 +1,226 @@ + + + + + diff --git a/frontend/src/components/canvas/components/Editor/ComponentWrapper.vue b/frontend/src/components/canvas/components/Editor/ComponentWrapper.vue index 057699fe77..9c5869e8d5 100644 --- a/frontend/src/components/canvas/components/Editor/ComponentWrapper.vue +++ b/frontend/src/components/canvas/components/Editor/ComponentWrapper.vue @@ -149,7 +149,7 @@ export default { return style }, componentActiveFlag() { - return (this.curComponent && this.config === this.curComponent) && !this.previewVisible && !this.showPosition.includes('multiplexing') + return (this.curComponent && this.config === this.curComponent) && !this.previewVisible && !this.showPosition.includes('multiplexing') && !this.showPosition.includes('email-task') }, curGap() { return (this.canvasStyleData.panel.gap === 'yes' && this.config.auxiliaryMatrix) ? this.componentGap : 0 diff --git a/frontend/src/components/canvas/components/Editor/EditBarView.vue b/frontend/src/components/canvas/components/Editor/EditBarView.vue index 3a7aab4566..9422f4832f 100644 --- a/frontend/src/components/canvas/components/Editor/EditBarView.vue +++ b/frontend/src/components/canvas/components/Editor/EditBarView.vue @@ -1,6 +1,6 @@ @@ -40,6 +43,14 @@ export default { type: String, required: false, default: 'NotProvided' + }, + panelId: { + type: String, + default: null + }, + chartTitle: { + type: String, + default: null } }, data() { @@ -51,7 +62,8 @@ export default { 'view', 'custom' ], - timer: null + timer: null, + isTaskChecked: false } }, computed: { @@ -67,14 +79,29 @@ export default { 'linkageSettingStatus', 'componentData', 'canvasStyleData', - 'componentGap' - ]) + 'componentGap', + 'panelViews' + ]), + + taskChecked() { + const panelId = this.panelId + return !!this.panelViews && !!this.panelViews[panelId] && !!this.panelViews[panelId].some(view => view.viewId === this.viewId) + } + }, + watch: { + taskChecked(val) { + this.isTaskChecked = val + } }, mounted() { if (this.showPosition === 'multiplexing-view') { this.multiplexingCheckModel = true this.multiplexingCheck(this.multiplexingCheckModel) } + if (this.showPosition === 'email-task') { + this.isTaskChecked = !!this.taskChecked + // this.emailTaskCheck(this.isTaskChecked) + } }, beforeDestroy() { }, @@ -104,6 +131,13 @@ export default { // remove this.$store.commit('removeCurMultiplexingComponentWithId', this.viewId) } + }, + emailTaskCheck(val) { + if (val) { + this.$store.dispatch('task/addView', { 'panelId': this.panelId, 'viewId': this.viewId, 'title': this.chartTitle }) + } else { + this.$store.dispatch('task/delView', { 'panelId': this.panelId, 'viewId': this.viewId }) + } } } diff --git a/frontend/src/components/canvas/custom-component/UserView.vue b/frontend/src/components/canvas/custom-component/UserView.vue index 524ac8c8f4..c1afd1191f 100644 --- a/frontend/src/components/canvas/custom-component/UserView.vue +++ b/frontend/src/components/canvas/custom-component/UserView.vue @@ -12,6 +12,8 @@ v-if="editBarViewShowFlag" :element="element" :show-position="showPosition" + :panel-id="panelInfo.id" + :chart-title="chart.title || chart.name" :is-edit="isEdit" :view-id="element.propValue.viewId" @showViewDetails="openChartDetailsDialog" @@ -234,7 +236,7 @@ export default { } }, editBarViewShowFlag() { - return (this.active && this.inTab && !this.mobileLayoutStatus) || this.showPosition.includes('multiplexing') + return (this.active && this.inTab && !this.mobileLayoutStatus) || this.showPosition.includes('multiplexing') || this.showPosition.includes('email-task') }, charViewShowFlag() { return this.httpRequest.status && this.chart.type && !this.chart.type.includes('table') && !this.chart.type.includes('text') && this.chart.type !== 'label' && this.renderComponent() === 'echarts' diff --git a/frontend/src/store/getters.js b/frontend/src/store/getters.js index f336da0de7..d686989826 100644 --- a/frontend/src/store/getters.js +++ b/frontend/src/store/getters.js @@ -30,6 +30,7 @@ const getters = { uiInfo: state => state.user.uiInfo, conditions: state => state.conditions.conditions, msgTypes: state => state.msg.msgTypes, - geoMap: state => state.map.geoMap + geoMap: state => state.map.geoMap, + panelViews: state => state.task.panelViews } export default getters diff --git a/frontend/src/store/index.js b/frontend/src/store/index.js index fad58ca06b..2f1c155c04 100644 --- a/frontend/src/store/index.js +++ b/frontend/src/store/index.js @@ -21,6 +21,7 @@ import event from '@/components/canvas/store/event' import layer from '@/components/canvas/store/layer' import snapshot from '@/components/canvas/store/snapshot' import lock from '@/components/canvas/store/lock' +import task from './modules/task' import { valueValid, formatCondition } from '@/utils/conditionUtil' import { Condition } from '@/components/widget/bean/Condition' @@ -44,6 +45,7 @@ const data = { ...layer.state, ...snapshot.state, ...lock.state, + ...task.state, // 编辑器模式 edit preview editMode: 'edit', // 当前页面全局数据 包括扩展公共样式 公共的仪表板样式,用来实时响应样式的变化 @@ -696,7 +698,8 @@ const data = { application, lic, msg, - map + map, + task }, getters } diff --git a/frontend/src/store/modules/task.js b/frontend/src/store/modules/task.js new file mode 100644 index 0000000000..ec22d7276c --- /dev/null +++ b/frontend/src/store/modules/task.js @@ -0,0 +1,49 @@ +import Vue from 'vue' +const state = { + panelViews: {} +} + +const mutations = { + + ADD_VIEW: (state, { panelId, viewId, title }) => { + if (!state.panelViews[panelId]) { + Vue.set(state.panelViews, panelId, []) + } + const views = state.panelViews[panelId] + if (views.some(item => item.viewId === viewId)) { + return + } + views.push({ viewId, title }) + state.panelViews[panelId] = views + }, + + DEL_VIEW: (state, { panelId, viewId }) => { + const views = state.panelViews[panelId] + if (!views || !views.length) return + let len = views.length + while (len--) { + const item = views[len] + if (viewId === item.viewId) { + views.splice(len, 1) + } + } + state.panelViews[panelId] = views + } +} + +const actions = { + addView({ commit }, data) { + commit('ADD_VIEW', data) + }, + delView({ commit }, data) { + commit('DEL_VIEW', data) + } +} + +export default { + namespaced: true, + state, + mutations, + actions +} + diff --git a/frontend/src/styles/index.scss b/frontend/src/styles/index.scss index 6faf1b578d..45f0623dee 100644 --- a/frontend/src/styles/index.scss +++ b/frontend/src/styles/index.scss @@ -833,3 +833,6 @@ div:focus { .fu-operator-component__label { width: 100px !important; } +.view-select-option { + display: none !important; +}