Sfoglia il codice sorgente

图表分析图形显示错误

zhuliu 1 anno fa
parent
commit
7109859acf

+ 1 - 1
src/utils/chart.js

@@ -13,7 +13,7 @@ export const detectionChartType = (chartType, form) => {
   if (chartType.type === 2 && !form.schema.y.field) {
     op = true
   }
-  if (chartType.value === 18 && form.schema.x.field !== 28 && form.schema.x.expand !== 17) {
+  if (chartType.value === 18 && form.schema.x.field !== 'CO' && form.schema.x.expand !== 17) {
     op = true
   }
   if ((chartType.value === 21 || chartType.value === 23) && form.schema.x.expand !== 18) {

+ 40 - 15
src/views/analyse/custom/components/Tabs/Style.vue

@@ -269,6 +269,9 @@ export default {
   components: {
     StyleType
   },
+  props:{
+    type:{},
+  },
   data() {
     return {
       activeNames: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
@@ -276,26 +279,48 @@ export default {
       positionList: [],
     }
   },
+  watch:{
+    type(val){
+      this.init()
+    }
+  },
   mounted() {
     this.chartIcon = JSON.parse(JSON.stringify(this.$constants.chartType))
-    this.chartIcon.map(item => {
-      let { op, cg } = detectionChartType(item, this.form)
-      if (op && cg) {
-        cg = false
-        this.$store.dispatch('resetSettingColor')
-      }
-      if (op) {
-        this.$set(item, 'disable', true)
-        this.$set(item, 'active', false)
-      }
-      if (cg) {
-        this.$set(item, 'disable', false)
-        this.$set(item, 'active', true)
-      }
-    })
+    this.init()
     this.getPositionList()
   },
   methods: {
+    init(){
+      
+      var disable = true
+      if(this.form.schema.y.field){
+        disable = false
+      }
+
+      this.chartIcon.map(item => {
+        // let { op, cg } = detectionChartType(item, this.form)
+        // if (op && cg) {
+        //   cg = false
+        //   this.$store.dispatch('resetSettingColor')
+        // }
+        // if (op) {
+        //   this.$set(item, 'disable', true)
+        //   this.$set(item, 'active', false)
+        // }
+        // if (cg) {
+        //   this.$set(item, 'disable', false)
+        //   this.$set(item, 'active', true)
+        // }
+        if(item.value == this.form.setting.type){
+          this.$set(item, 'active', true)
+        }
+        if(item.type == 2){
+          this.$set(item, 'disable', disable)
+        }else{
+          this.$set(item, 'disable', !disable)
+        }
+      })
+    },
     getColorName(name){
       if(this.form.schema['y'].fieldKind == 0){
         var data = this.form.source['y']

+ 1 - 1
src/views/analyse/custom/index.vue

@@ -46,7 +46,7 @@
         size="500px">
             <el-container>
                 <el-main>
-                    <component :is='components'></component> 
+                    <component :type="this.form.setting.type" :is='components'></component> 
                 </el-main>
                 <el-footer class="footer-common">
                     <el-button @click="handleClose">取 消</el-button>