diff --git a/report-ui/src/utils/eventBus.js b/report-ui/src/utils/eventBus.js new file mode 100644 index 00000000..f3aceb6f --- /dev/null +++ b/report-ui/src/utils/eventBus.js @@ -0,0 +1,5 @@ +import Vue from 'vue' + +const eventBus = new Vue() + +export { eventBus } \ No newline at end of file diff --git a/report-ui/src/utils/screen.js b/report-ui/src/utils/screen.js new file mode 100644 index 00000000..68ce161d --- /dev/null +++ b/report-ui/src/utils/screen.js @@ -0,0 +1,17 @@ +export function setAssChartData(widgets, options) { + const selectOptions = options.filter(item => item.uuid).map(item => { + return { + code: item.uuid, + name: item.label + } + }) + widgets.forEach(item => { + const setup = item['options']['setup'] + console.log(setup) + setup.forEach(sItem => { + if (sItem.name == 'assChart') { + sItem['selectOptions'] = selectOptions + } + }) + }) +} \ No newline at end of file diff --git a/report-ui/src/views/bigscreenDesigner/designer/components/dynamicForm.vue b/report-ui/src/views/bigscreenDesigner/designer/components/dynamicForm.vue index b211c16c..2e607796 100644 --- a/report-ui/src/views/bigscreenDesigner/designer/components/dynamicForm.vue +++ b/report-ui/src/views/bigscreenDesigner/designer/components/dynamicForm.vue @@ -88,6 +88,7 @@ size="mini" :disabled="item.disabled" v-model="formData[item.name]" + :multiple="item.multiple" clearable placeholder="请选择" @change="(val) => changed(val, item.name)" @@ -384,6 +385,8 @@ export default { }, // 无论哪个输入框改变 都需要触发事件 将值回传 changed(val, key) { + console.log(val); + console.log(key); if (val.extend) { this.$set(this.formData, key, val.value); } else { diff --git a/report-ui/src/views/bigscreenDesigner/designer/index.vue b/report-ui/src/views/bigscreenDesigner/designer/index.vue index 428c1f41..b20c46d8 100644 --- a/report-ui/src/views/bigscreenDesigner/designer/index.vue +++ b/report-ui/src/views/bigscreenDesigner/designer/index.vue @@ -312,6 +312,7 @@ import VueRulerTool from "vue-ruler-tool"; // 大屏设计页面的标尺插件 import contentMenu from "./components/contentMenu"; import { getToken } from "@/utils/auth"; import { Revoke } from "@/utils/revoke"; //处理历史记录 2022-02-22 +import { setAssChartData } from "@/utils/screen.js"; export default { name: "Login", @@ -444,7 +445,6 @@ export default { watch: { widgets: { handler(val) { - this.handlerLayerWidget(val); //以下部分是记录历史 this.$nextTick(() => { this.revoke.push(this.widgets); @@ -491,7 +491,7 @@ export default { this.widgets = record; }, handlerLayerWidget(val) { - console.log(val) + console.log(val); const layerWidgetArr = []; for (let i = 0; i < val.length; i++) { const obj = {}; @@ -501,11 +501,14 @@ export default { if (el.name == "layerName") { obj.label = el.value; } + if (el.name == "uuid") { + obj.uuid = el.value; + } }); layerWidgetArr.push(obj); } this.layerWidget = layerWidgetArr; - console.log(this.layerWidget); + setAssChartData(this.widgets, this.layerWidget); }, async initEchartData() { const reportCode = this.$route.query.reportCode; @@ -517,6 +520,7 @@ export default { this.dashboard = screenData; this.bigscreenWidth = this.dashboard.width; this.bigscreenHeight = this.dashboard.height; + this.handlerLayerWidget(this.widgets); }, handleBigScreen(data) { const optionScreen = getToolByCode("screen").options; @@ -746,6 +750,7 @@ export default { this.setOptionsOnClickWidget(this.widgets.length - 1); console.log("123", this.widgets); + this.handlerLayerWidget(this.widgets); }, // 对组件默认值处理 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 f5cd456d..f989f810 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-10 09:40:53 + * @LastEditTime: 2023-01-12 14:39:29 */ export const widgetSelect = { @@ -24,11 +24,11 @@ export const widgetSelect = { }, { type: 'el-input-text', - label: '默认值', - name: 'text', + label: '字段属性值', + name: 'field', required: false, - placeholder: '', - value: '超链接', + placeholder: '请输入', + value: '', }, { type: 'vue-color', @@ -52,11 +52,8 @@ export const widgetSelect = { name: 'assChart', required: false, placeholder: '', - selectOptions: [ - { code: 'center', name: '居中' }, - { code: 'left', name: '左对齐' }, - { code: 'right', name: '右对齐' }, - ], + multiple: true, + selectOptions: [], value: '', }, { @@ -102,11 +99,11 @@ export const widgetSelect = { relactiveDom: 'dataType', relactiveDomValue: 'staticData', value: [ - { "axis": "苹果", "data": 1000 }, - { "axis": "三星", "data": 2229 }, - { "axis": "小米", "data": 3879 }, - { "axis": "oppo", "data": 2379 }, - { "axis": "vivo", "data": 4079 }, + { "name": "苹果", "code": 1000 }, + { "name": "三星", "code": 2229 }, + { "name": "小米", "code": 3879 }, + { "name": "oppo", "code": 2379 }, + { "name": "vivo", "code": 4079 }, ], }, { @@ -117,8 +114,8 @@ export const widgetSelect = { placeholder: '', relactiveDom: 'dataType', relactiveDomValue: 'dynamicData', - chartType: 'widget-barchart', - dictKey: 'BAR_PROPERTIES', + chartType: 'widget-select', + dictKey: 'SELECT_PROPERTIES', value: '', }, ], 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 21143686..aa8b1dbe 100644 --- a/report-ui/src/views/bigscreenDesigner/designer/widget/bar/widgetBarchart.vue +++ b/report-ui/src/views/bigscreenDesigner/designer/widget/bar/widgetBarchart.vue @@ -1,16 +1,17 @@ diff --git a/report-ui/src/views/bigscreenDesigner/designer/widget/form/widgetSelect.vue b/report-ui/src/views/bigscreenDesigner/designer/widget/form/widgetSelect.vue index c028f710..05741d7a 100644 --- a/report-ui/src/views/bigscreenDesigner/designer/widget/form/widgetSelect.vue +++ b/report-ui/src/views/bigscreenDesigner/designer/widget/form/widgetSelect.vue @@ -4,11 +4,13 @@ :style="styleObj" v-model="selectValue" :localOptions="options" - label="text" - option="id" + label="name" + option="code" + @[eventChange]="change" />