From 51c8bfa19e6f3e726c4e71fe1bf883d6454a68fc Mon Sep 17 00:00:00 2001 From: qianlishi <1432731663@qq.com> Date: Tue, 28 Sep 2021 15:41:37 +0800 Subject: [PATCH] update --- report-ui/src/components/Dictionary/index.vue | 17 +++---- .../designerComponents/dynamicComponents.vue | 50 +++++++++++++++++-- .../designerComponents/dynamicForm.vue | 3 +- 3 files changed, 54 insertions(+), 16 deletions(-) diff --git a/report-ui/src/components/Dictionary/index.vue b/report-ui/src/components/Dictionary/index.vue index 4814d6f0..e3c8d020 100644 --- a/report-ui/src/components/Dictionary/index.vue +++ b/report-ui/src/components/Dictionary/index.vue @@ -28,7 +28,8 @@ export default { name: "GetDictionary", props: { dictKey: String, // 字典code - updataDict: String // 回显绑定的值 + updataDict: String, // 回显绑定的值 + value: String }, data() { return { @@ -43,19 +44,17 @@ export default { this.getSystem(); } }, - updataDict: { - immediate: true, - handler() { - this.dictionary = this.updataDict; - } + value: { + handler(val) { + this.dictionary = val; + }, + deep: true } }, created() { this.getSystem(); }, - mounted() { - this.dictionary = this.updataDict; - }, + mounted() {}, methods: { // 获取数据字典 async getSystem() { diff --git a/report-ui/src/views/report/bigscreen/designer/designerComponents/dynamicComponents.vue b/report-ui/src/views/report/bigscreen/designer/designerComponents/dynamicComponents.vue index 93477060..57431603 100644 --- a/report-ui/src/views/report/bigscreen/designer/designerComponents/dynamicComponents.vue +++ b/report-ui/src/views/report/bigscreen/designer/designerComponents/dynamicComponents.vue @@ -26,7 +26,7 @@ @@ -58,7 +58,7 @@ export default { props: { chartType: String, dictKey: String, - props: ["formData"] + formData: Object }, data() { return { @@ -67,9 +67,17 @@ export default { userNameList: [], // 用户 setParamList: [], // 对应的不同的图形数据参数 params: {}, - chartProperties: {}, + chartProperties: {} }; }, + watch: { + formData: { + handler(val) { + this.echoDataSet(val); + }, + deep: true + } + }, computed: { setCode() { let code = ""; @@ -83,6 +91,7 @@ export default { }, mounted() { this.loadDataSet(); + this.echoDataSet(this.formData); }, methods: { async loadDataSet() { @@ -115,8 +124,39 @@ export default { selectParams(val, key) { this.chartProperties[key] = val; }, - getDictKey(){ - return this.dictKey == null ? 'CHART_PROPERTIES' : this.dictKey + getDictKey() { + return this.dictKey == null ? "CHART_PROPERTIES" : this.dictKey; + }, + // 数据集回显 + async echoDataSet(val) { + console.log(val); + const setCode = val.setCode; + + await this.loadDataSet(); + + this.dataSetValue = this.dataSet.filter( + el => setCode == el.setCode + )[0].id; + + await this.selectDataSet(); + this.echoDynamicData(val); + }, + echoDynamicData(val) { + const chartProperties = val.chartProperties; + if (this.userNameList.length > 0) { + } + + if (this.setParamList.length > 0) { + for (let i = 0; i < this.setParamList.length; i++) { + const item = this.setParamList[i]; + if (chartProperties.hasOwnProperty(item)) { + this.params[item] = chartProperties[item]; + } + } + } + console.log(this.params); + // console.log(this.userNameList); + // console.log(this.setParamList); } } }; diff --git a/report-ui/src/views/report/bigscreen/designer/designerComponents/dynamicForm.vue b/report-ui/src/views/report/bigscreen/designer/designerComponents/dynamicForm.vue index afcd303f..91e59467 100644 --- a/report-ui/src/views/report/bigscreen/designer/designerComponents/dynamicForm.vue +++ b/report-ui/src/views/report/bigscreen/designer/designerComponents/dynamicForm.vue @@ -25,7 +25,6 @@ style="width:100%" v-model.trim="formData[item.name]" controls-position="right" - :placeholder="item.placeholder" @change="changed($event, item.name)" /> @@ -137,7 +136,7 @@ v-if="item.type == 'dycustComponents' && inputShow[item.name]" v-model="formData[item.name]" :chart-type="item.chartType" - :dict-key='item.dictKey' + :dict-key="item.dictKey" @change="changed($event, item.name)" />