diff --git a/report-ui/src/store/index.js b/report-ui/src/store/index.js
index f011f382..89cec40a 100644
--- a/report-ui/src/store/index.js
+++ b/report-ui/src/store/index.js
@@ -7,6 +7,7 @@ import app from './modules/app'
import user from './modules/user'
import cacheView from './modules/cachaView'
import help from './modules/help'
+import designer from './modules/designer'
Vue.use(Vuex)
@@ -18,7 +19,8 @@ const store = new Vuex.Store({
app,
user,
cacheView,
- help
+ help,
+ designer
},
state: { },
plugins: [initPlugin],
diff --git a/report-ui/src/store/modules/designer.js b/report-ui/src/store/modules/designer.js
new file mode 100644
index 00000000..ae275cac
--- /dev/null
+++ b/report-ui/src/store/modules/designer.js
@@ -0,0 +1,42 @@
+/*
+ * @Author: chengsl
+ * @Date: 2022-11-08 10:30:37
+ * @LastEditors: chengsl
+ * @LastEditTime: 2023-02-24 09:54:34
+ * @Description: 设计器公用变量
+ */
+
+const designer = {
+ state: {
+ allComponentLinkage: [], // 所有组件之间的联动配置
+ },
+
+ mutations: {
+ SET_ALL_COMPONENT_LINKAGE: (state, params) => {
+ var { index = -1, widgetId = '', linkageArr } = params
+ try {
+ console.log('params---', params)
+ linkageArr = linkageArr.map(item => {
+ const arr = item.widgetValue.split('-$-')
+ return {
+ originId: widgetId,
+ targetId: arr[0],
+ targetName: arr[1],
+ paramsConfig: item.paramsConfig
+ }
+ })
+ } catch (error) {
+ linkageArr = [] // 兼容异常错误导致页面加载不出来
+ }
+ state.allComponentLinkage[index] = {
+ index: +index,
+ widgetId,
+ linkageArr
+ }
+ }
+ },
+
+ actions: {}
+}
+
+export default designer
diff --git a/report-ui/src/views/bigscreenDesigner/designer/components/componentLinkage.vue b/report-ui/src/views/bigscreenDesigner/designer/components/componentLinkage.vue
new file mode 100644
index 00000000..44f25771
--- /dev/null
+++ b/report-ui/src/views/bigscreenDesigner/designer/components/componentLinkage.vue
@@ -0,0 +1,290 @@
+
+
+
+ 新增
+
+
+
+
+
+
+
+
+
+
+ 编辑
+
+
+ 删除
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{{ item.originKey }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/report-ui/src/views/bigscreenDesigner/designer/components/contentMenu.vue b/report-ui/src/views/bigscreenDesigner/designer/components/contentMenu.vue
index 15562b1c..849a9e3b 100644
--- a/report-ui/src/views/bigscreenDesigner/designer/components/contentMenu.vue
+++ b/report-ui/src/views/bigscreenDesigner/designer/components/contentMenu.vue
@@ -3,6 +3,12 @@
+
+
@@ -24,7 +30,7 @@
export default {
props: {
styleObj: Object,
- visible: Boolean
+ visible: Boolean,
},
data() {
return {};
@@ -36,7 +42,7 @@ export default {
} else {
document.body.removeEventListener("click", this.closeMenu);
}
- }
+ },
},
methods: {
closeMenu() {
@@ -46,22 +52,28 @@ export default {
this.$confirm("是否删除所选图层?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
- type: "warning"
+ type: "warning",
})
.then(() => {
this.$emit("deletelayer");
this.$message({
type: "success",
- message: "删除成功!"
+ message: "删除成功!",
});
})
.catch(() => {
this.$message({
type: "info",
- message: "已取消删除"
+ message: "已取消删除",
});
});
},
+ lockLayer() {
+ this.$emit("lockLayer");
+ },
+ noLockLayer() {
+ this.$emit("noLockLayer");
+ },
copyLayer() {
this.$emit("copylayer");
},
@@ -76,8 +88,8 @@ export default {
},
movedownLayer() {
this.$emit("movedownLayer");
- }
- }
+ },
+ },
};
diff --git a/report-ui/src/views/bigscreenDesigner/designer/linkageLogic.js b/report-ui/src/views/bigscreenDesigner/designer/linkageLogic.js
new file mode 100644
index 00000000..b00bf3f6
--- /dev/null
+++ b/report-ui/src/views/bigscreenDesigner/designer/linkageLogic.js
@@ -0,0 +1,128 @@
+/*
+ * @Author: chengsl
+ * @Date: 2023-02-24 09:40:13
+ * @LastEditors: chengsl
+ * @LastEditTime: 2023-02-24 13:12:24
+ * @Description: 各联动组件的参数配置 参数paramsKey的值具体封装时再改
+ */
+import { eventBus as bus } from "@/utils/eventBus";
+export const lickageParamsConfig = [
+ // {
+ // name: '按钮组',
+ // code: 'widgetButtonGroup',
+ // paramsKey: [] // 40@remarks 动态:[...row, index]
+ // },
+ {
+ name: '柱图',
+ code: 'widget-barchart',
+ paramsKey: ['name', 'value']
+ },
+ // ……
+ {
+ name: '折线图',
+ code: 'widget-linechart',
+ paramsKey: ['name', 'value']
+ },
+ {
+ name: '百分比图',
+ code: 'widgetPiePercentageChart',
+ paramsKey: ['value']
+ },
+]
+
+export const getOneConfigByCode = function(code) {
+ return lickageParamsConfig.find(item => { return item.code === code })
+}
+
+export const getOneConfigByName = function(name) {
+ return lickageParamsConfig.find(item => { return item.name === name })
+}
+
+/**
+ * 源组件 - 初始化联动逻辑
+ * @param self 组件实例对象 this
+ * @param isActiveClick 主动触发(非echart类click事件触发)
+ * @param buttonConfig 按钮组组件的配置
+ * 40@remarks
+ * 1、v-chart 需添加 ref="myVChart" 以获取实例
+ * 2、 发消息发过去的对象 待封装配置动态兼容
+ */
+export const originWidgetLinkageLogic = function(self, isActiveClick = false, buttonConfig = {}) {
+ // if (self.allComponentLinkage && self.allComponentLinkage.length && self.allComponentLinkage[self.widgetIndex].index !== -1 && self.allComponentLinkage[self.widgetIndex].linkageArr.length) {
+ if (self.optionsSetup.componentLinkage && self.optionsSetup.componentLinkage.length) {
+ if (isActiveClick) { // 主动触发
+ self.allComponentLinkage[self.widgetIndex].linkageArr.forEach(item => {
+ console.log(`bus_${item.originId}_${item.targetId}`, ' -联动逻辑点击-发送消息', buttonConfig)
+ bus.$emit(`bus_${item.originId}_${item.targetId}`, buttonConfig.currentData)
+ })
+ } else { // chart 组件
+ self.$refs.myVChart.chart.on('click', function(params) {
+ self.allComponentLinkage[self.widgetIndex].linkageArr.forEach(item => {
+ console.log(`bus_${item.originId}_${item.targetId}`, ' -联动逻辑点击-发送消息', params)
+ let message = {}
+ const widgetConfigTemp = getOneConfigByCode(self.value.widgetCode)
+ if (widgetConfigTemp && widgetConfigTemp.paramsKey.length) { // 动态加载各组件的参数来封装
+ widgetConfigTemp.paramsKey.forEach(key => {
+ message[key] = params[key]
+ })
+ // 40@remarks 部分组件 传参需要特殊处理下
+ // ……
+ // 40@remarks 专用于测试联动发消息 手动改造消息内容
+ // if (self.value.widgetCode === 'widgetMap2d') {
+ // const nameTemp = ['苹果', '三星', '小米', '华为', 'OPPO', 'VIVO']
+ // // message = {
+ // // name: nameTemp[(params.dataIndex % 6)],
+ // // value: params.value,
+ // // dataIndex: params.dataIndex
+ // // }
+ // // message.name = nameTemp[(+params.value % 6)]
+ // message.name = nameTemp[(parseInt(Math.random() * 6) % 6)]
+ // }
+ // if (self.value.widgetCode === 'widget-piechart') {
+ // message.name = (parseInt(Math.random() * 2) % 2) === 0 ? '深圳市' : '盐田区'
+ // }
+ } else {
+ message = {
+ name: params.name,
+ value: params.value
+ }
+ }
+ bus.$emit(`bus_${item.originId}_${item.targetId}`, message)
+ })
+ })
+ }
+ }
+}
+
+/**
+ * 目标组件 - 初始化联动逻辑
+ * @param self 组件实例对象 this
+ * @returns
+ */
+export const targetWidgetLinkageLogic = function(self) {
+ const busEvents = []
+ // 有无有关联的组件
+ if (!self.allComponentLinkage || !self.allComponentLinkage.length) return
+ self.allComponentLinkage.some(item => {
+ if (item.index !== -1 && item.linkageArr.length) {
+ item.linkageArr.some(obj => {
+ if (obj.targetId === self.value.setup.widgetId) {
+ self.hasLinkage = true
+ busEvents.push({
+ eventName: `bus_${obj.originId}_${obj.targetId}`,
+ paramsConfig: obj.paramsConfig
+ })
+ return true
+ }
+ })
+ }
+ })
+ if (self.hasLinkage) {
+ busEvents.forEach(item => {
+ bus.$on(item.eventName, e => {
+ console.log(item.eventName, ' 接收消息e', e)
+ self.setOptionsData(e, item.paramsConfig)
+ })
+ })
+ }
+}
diff --git a/report-ui/src/views/bigscreenDesigner/designer/tools/configure/barCharts/widget-barchart.js b/report-ui/src/views/bigscreenDesigner/designer/tools/configure/barCharts/widget-barchart.js
index 2f55a78c..c55403b4 100644
--- a/report-ui/src/views/bigscreenDesigner/designer/tools/configure/barCharts/widget-barchart.js
+++ b/report-ui/src/views/bigscreenDesigner/designer/tools/configure/barCharts/widget-barchart.js
@@ -564,6 +564,18 @@ export const widgetBarchart = {
},
],
},
+ {
+ name: '组件联动',
+ list: [
+ {
+ type: 'componentLinkage',
+ label: '',
+ name: 'componentLinkage',
+ required: false,
+ value: []
+ }
+ ]
+ }
],
],
// 数据
diff --git a/report-ui/src/views/bigscreenDesigner/designer/tools/configure/form/widget-select.js b/report-ui/src/views/bigscreenDesigner/designer/tools/configure/form/widget-select.js
index e209a861..14ef32b4 100644
--- a/report-ui/src/views/bigscreenDesigner/designer/tools/configure/form/widget-select.js
+++ b/report-ui/src/views/bigscreenDesigner/designer/tools/configure/form/widget-select.js
@@ -3,7 +3,7 @@
* @Author: qianlishi qianlishi@anji-plus.com
* @Date: 2023-01-09 13:02:59
* @LastEditors: qianlishi qianlishi@anji-plus.com
- * @LastEditTime: 2023-01-12 16:44:50
+ * @LastEditTime: 2023-03-06 15:33:39
*/
export const widgetSelect = {
@@ -33,7 +33,7 @@ export const widgetSelect = {
{
type: 'vue-color',
label: '字体颜色',
- name: 'color',
+ name: 'select_color',
required: false,
placeholder: '',
value: '#FAD400',
@@ -41,7 +41,7 @@ export const widgetSelect = {
{
type: 'vue-color',
label: '字体背景',
- name: 'background',
+ name: 'select_fontSize',
required: false,
placeholder: '',
value: 'rgba(115,170,229,.5)',
diff --git a/report-ui/src/views/bigscreenDesigner/designer/tools/configure/lineCharts/widget-linechart.js b/report-ui/src/views/bigscreenDesigner/designer/tools/configure/lineCharts/widget-linechart.js
index f9fc91a1..b47cbdc6 100644
--- a/report-ui/src/views/bigscreenDesigner/designer/tools/configure/lineCharts/widget-linechart.js
+++ b/report-ui/src/views/bigscreenDesigner/designer/tools/configure/lineCharts/widget-linechart.js
@@ -587,6 +587,18 @@ export const widgetLinechart = {
},
],
},
+ {
+ name: '组件联动',
+ list: [
+ {
+ type: 'componentLinkage',
+ label: '',
+ name: 'componentLinkage',
+ required: false,
+ value: []
+ }
+ ]
+ }
],
],
// 数据
diff --git a/report-ui/src/views/bigscreenDesigner/designer/tools/configure/percentCharts/widget-pie-percentage.js b/report-ui/src/views/bigscreenDesigner/designer/tools/configure/percentCharts/widget-pie-percentage.js
index a8a349fe..3d1d9fc1 100644
--- a/report-ui/src/views/bigscreenDesigner/designer/tools/configure/percentCharts/widget-pie-percentage.js
+++ b/report-ui/src/views/bigscreenDesigner/designer/tools/configure/percentCharts/widget-pie-percentage.js
@@ -169,6 +169,18 @@ export const widgetPiePercentage = {
value: '#173164'
},
]
+ },
+ {
+ name: '组件联动',
+ list: [
+ {
+ type: 'componentLinkage',
+ label: '',
+ name: 'componentLinkage',
+ required: false,
+ value: []
+ }
+ ]
}
],
],
diff --git a/report-ui/src/views/bigscreenDesigner/designer/tools/index.js b/report-ui/src/views/bigscreenDesigner/designer/tools/index.js
index 4a298073..7a20a42d 100644
--- a/report-ui/src/views/bigscreenDesigner/designer/tools/index.js
+++ b/report-ui/src/views/bigscreenDesigner/designer/tools/index.js
@@ -3,8 +3,8 @@
* @version:
* @Author: qianlishi
* @Date: 2021-08-29 06:43:07
- * @LastEditors: qianlishi qianlishi@anji-plus.com
- * @LastEditTime: 2022-11-07 15:35:42
+ * @LastEditors: chengsl
+ * @LastEditTime: 2023-02-24 10:29:26
*/
import { widgetTool } from "./main"
const screenConfig = {
@@ -52,7 +52,7 @@ const screenConfig = {
name: 'backgroundColor',
required: false,
placeholder: '',
- value: 'rgba(45, 86, 126, 1)',
+ value: '#1E1E1E',
},
{
type: 'custom-upload',
@@ -72,6 +72,7 @@ export const converArr = (data) => {
let tempArr = [], newArr = []
for (let i = 0; i < data.length; i++) {
const item = data[i]
+ item.widgetId = ''
if (tempArr.indexOf(item.type) === -1) {
newArr.push({
name: item.tabName,
diff --git a/report-ui/src/views/bigscreenDesigner/designer/tools/main.js b/report-ui/src/views/bigscreenDesigner/designer/tools/main.js
index 660c04cc..e7159139 100644
--- a/report-ui/src/views/bigscreenDesigner/designer/tools/main.js
+++ b/report-ui/src/views/bigscreenDesigner/designer/tools/main.js
@@ -3,8 +3,8 @@
* @version:
* @Author: qianlishi
* @Date: 2021-08-29 07:46:46
- * @LastEditors: qianlishi qianlishi@anji-plus.com
- * @LastEditTime: 2023-01-09 13:16:19
+ * @LastEditors: chengsl
+ * @LastEditTime: 2023-02-23 15:23:20
*/
import { widgetText } from "./configure/texts/widget-text"
@@ -70,7 +70,7 @@ export const widgetTool = [
widgetLineCompare,
widgetDecoratePie,
widgetMoreBarLine,
- widgetWordCloud,
+ // widgetWordCloud,
widgetHeatmap,
widgetRadar,
widgetBarLineStack,
diff --git a/report-ui/src/views/bigscreenDesigner/designer/widget/bar/widgetBarchart.vue b/report-ui/src/views/bigscreenDesigner/designer/widget/bar/widgetBarchart.vue
index c4d12d21..bfcd0ce7 100644
--- a/report-ui/src/views/bigscreenDesigner/designer/widget/bar/widgetBarchart.vue
+++ b/report-ui/src/views/bigscreenDesigner/designer/widget/bar/widgetBarchart.vue
@@ -1,10 +1,11 @@
-
+