{"remainingRequest":"D:\\jenkins\\workspace\\xq-web-fvue\\node_modules\\thread-loader\\dist\\cjs.js!D:\\jenkins\\workspace\\xq-web-fvue\\node_modules\\babel-loader\\lib\\index.js!D:\\jenkins\\workspace\\xq-web-fvue\\node_modules\\cache-loader\\dist\\cjs.js??ref--0-0!D:\\jenkins\\workspace\\xq-web-fvue\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!D:\\jenkins\\workspace\\xq-web-fvue\\src\\components\\home\\customChart.vue?vue&type=script&lang=js&","dependencies":[{"path":"D:\\jenkins\\workspace\\xq-web-fvue\\src\\components\\home\\customChart.vue","mtime":1667327529512},{"path":"D:\\jenkins\\workspace\\xq-web-fvue\\babel.config.js","mtime":1667327525434},{"path":"D:\\jenkins\\workspace\\xq-web-fvue\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\xq-web-fvue\\node_modules\\thread-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\xq-web-fvue\\node_modules\\babel-loader\\lib\\index.js","mtime":315532800000},{"path":"D:\\jenkins\\workspace\\xq-web-fvue\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\xq-web-fvue\\node_modules\\vue-loader\\lib\\index.js","mtime":499162500000}],"contextDependencies":[],"result":["import \"core-js/modules/es6.function.name\";\nimport \"core-js/modules/es6.regexp.search\";\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\nimport { mapState } from \"vuex\";\nimport utils from \"@/utils.js\";\nexport default {\n  props: [\"id\"],\n  data: function data() {\n    return {\n      queryOpTransObj: {\n        EQ: \"equal\",\n        BETWEEN: \"between\",\n        GE: \"great_equal\",\n        LE: \"less_equal\",\n        LK: \"like\",\n        IN: \"in\"\n      },\n      fullscreenLoading: false,\n      dialogVisible: false,\n      customChart: \"\",\n      conditions: [],\n      showFiled: [],\n      pagination: {\n        page: 1,\n        pageSize: 20,\n        showTotal: true\n      },\n      chartData: {},\n      conditionValue: {}\n    };\n  },\n  created: function created() {\n    var this_ = this;\n    this.$store.dispatch(\"form/getCustomChart\", this.id).then(function (data) {\n      if (data) {\n        data.conditionfield = JSON.parse(data.conditionfield);\n        data.displayfield = JSON.parse(data.displayfield);\n        data.xaxisField = JSON.parse(data.xaxisField);\n        data.sortfield = JSON.parse(data.sortfield);\n\n        for (var i = 0, c; c = data.conditionfield[i++];) {\n          c.condition = this_.queryOpTransObj[c.condition].toUpperCase();\n        }\n\n        this_.conditions = data.conditionfield;\n        this_.customChart = data;\n        this_.showFiled = JSON.parse(JSON.stringify(this_.customChart.xaxisField.concat(this_.customChart.displayfield)));\n        setTimeout(function () {\n          var chartHeight = document.getElementById(\"chartCard\").offsetHeight;\n          var selectArea = document.getElementById(\"conditionArea\") && document.getElementById(\"conditionArea\").offsetHeight ? document.getElementById(\"conditionArea\").offsetHeight : 0;\n          document.getElementById(\"chartDiv\").style.height = chartHeight - selectArea - 65 + \"px\";\n          document.getElementById(\"chartDataTable\").style.height = chartHeight - selectArea - 95 + \"px\";\n          this_.search();\n        }, 20);\n      }\n    });\n  },\n  methods: {\n    buildQuerys: function buildQuerys() {\n      var queryFilter = {\n        pageBean: this.pagination,\n        querys: [],\n        sorter: []\n      };\n\n      for (var i = 0, c; c = this.conditions[i++];) {\n        var queryValue = \"\";\n\n        if (c.defaultType != \"1\" && c.defaultValue) {\n          queryValue = c.defaultValue;\n        } else if (c.defaultType == \"1\" && this.conditionValue[c.field]) {\n          queryValue = this.conditionValue[c.field];\n        }\n\n        if (queryValue) {\n          queryFilter.querys.push({\n            property: c.field,\n            operation: c.condition,\n            value: queryValue\n          });\n        }\n      }\n\n      for (var i = 0, s; s = this.customChart.sortfield[i++];) {\n        queryFilter.sorter.push({\n          property: s.field,\n          direction: s.sortType.toUpperCase()\n        });\n      }\n\n      return queryFilter;\n    },\n    getValue: function getValue(r, s) {\n      var value = r[s.field.toUpperCase()];\n\n      if (s.dbType == \"date\") {\n        var filter = this.$options.filters[\"dateformat\"];\n        value = filter(value, \"YYYY-MM-DD HH:mm:ss\");\n      }\n\n      return value;\n    },\n    //重置\n    reset: function reset() {\n      this.conditionValue = {};\n      this.search();\n    },\n    handleSizeChange: function handleSizeChange(size) {\n      //每页下拉显示数据\n      this.pagination.pageSize = size;\n      this.search();\n    },\n    handleCurrentChange: function handleCurrentChange(currentPage) {\n      //点击第几页\n      this.pagination.page = currentPage;\n      this.search();\n    },\n    //查询\n    search: function search() {\n      var queryFilter = this.buildQuerys(); //查询条件\n\n      var param = {\n        id: this.id,\n        filter: queryFilter\n      };\n      var this_ = this;\n      this.$store.dispatch(\"form/getChartData\", param).then(function (data) {\n        if (data) {\n          this_.chartData = data;\n          this_.pagination = {\n            pageSize: data.pageSize,\n            page: data.page,\n            total: data.total\n          };\n          this_.buildChart(data.rows);\n        }\n      });\n    },\n    //根据自定义图表的相关设置以及数据生产图表\n    buildChart: function buildChart(data) {\n      var echarts = require(\"echarts\");\n\n      var myChart = echarts.init(document.getElementById(\"chartDiv\"));\n      this.$root.$on(\"resize\", function () {\n        myChart.resize(); //监测图表自适应\n      });\n      myChart.clear();\n      var displayfield = this.customChart.displayfield;\n      var legendData = [];\n      var xAxisData = [];\n      var seriesData = [];\n      var xaxisField = this.customChart.xaxisField;\n      if (xaxisField) xaxisField = xaxisField[0];\n\n      for (var i = 0, d; d = displayfield[i++];) {\n        if (d) {\n          var arr = [];\n\n          if (this.customChart.style == 3) {\n            for (var j = 0, res; res = data[j++];) {\n              if (res) {\n                var value = res[xaxisField.field.toUpperCase()];\n                if (xaxisField.dbType == \"date\" && value && typeof value == \"number\") value = new Date(value).format(\"yyyy-MM-dd HH:mm:dd\");\n                legendData.push(value);\n                arr.push({\n                  value: res[d.field.toUpperCase()],\n                  name: value\n                });\n              }\n            }\n\n            seriesData.push({\n              name: d.comment,\n              type: \"pie\",\n              radius: \"75%\",\n              center: [\"50%\", \"55%\"],\n              data: arr,\n              itemStyle: {\n                emphasis: {\n                  shadowBlur: 10,\n                  shadowOffsetX: 0,\n                  shadowColor: \"rgba(0, 0, 0, 0.5)\"\n                }\n              }\n            });\n          } else {\n            var type = this.customChart.style == 1 ? \"line\" : \"bar\";\n            legendData.push(d.comment);\n\n            for (var j = 0, res; res = data[j++];) {\n              if (i == 1) {\n                var value = res[xaxisField.field.toUpperCase()];\n                if (xaxisField.dbType == \"date\" && value && typeof value == \"number\") value = new Date(value).format(defaultFmt);\n                xAxisData.push(value);\n              }\n\n              if (res) {\n                var value = res[d.field.toUpperCase()];\n                /*if(d.dbType=='date' && value && (typeof value==\"number\")) value=new Date(value).format(defaultFmt);*/\n\n                arr.push(value);\n              }\n            }\n\n            seriesData.push({\n              name: d.comment,\n              type: type,\n              areaStyle: {\n                normal: {}\n              },\n              data: arr\n            });\n          }\n        }\n      }\n\n      var option = {};\n\n      if (this.customChart.style == 3) {\n        option = {\n          title: {\n            text: this.customChart.name,\n            x: \"center\",\n            y: 10,\n            textStyle: {\n              fontSize: 24\n            }\n          },\n          tooltip: {\n            trigger: \"item\",\n            formatter: \"{a} <br/>{b} : {c} ({d}%)\"\n          },\n          toolbox: {\n            feature: {\n              saveAsImage: {}\n            }\n          },\n          legend: {\n            orient: \"vertical\",\n            left: \"left\",\n            data: legendData\n          },\n          series: seriesData\n        };\n      } else {\n        option = {\n          title: {\n            text: this.customChart.name,\n            x: \"center\",\n            y: 10,\n            textStyle: {\n              fontSize: 24\n            }\n          },\n          tooltip: {\n            trigger: \"axis\"\n          },\n          legend: {\n            data: legendData,\n            y: 50\n          },\n          toolbox: {\n            feature: {\n              saveAsImage: {}\n            }\n          },\n          grid: {\n            y: 110,\n            left: \"3%\",\n            right: \"4%\",\n            bottom: \"3%\",\n            containLabel: true\n          },\n          xAxis: [{\n            type: \"category\",\n            boundaryGap: false,\n            //类目起始和结束两端空白策略，默认为true留空，false则顶头\n            data: xAxisData\n          }],\n          yAxis: [{\n            type: \"value\"\n          }],\n          series: seriesData\n        }; //柱状图的时候两端留空。避免柱状图挡住y轴。折线图则不留空，\n\n        if (this.customChart.style == 2) option.xAxis[0][\"boundaryGap\"] = true;\n\n        if (this.customChart.conf) {\n          var obj = JSON.parse(this.customChart.conf);\n          if (obj.yMin == 2) option.yAxis[0][\"min\"] = \"dataMin\";\n          if (obj.xShowAll == 2) option.xAxis[0][\"axisLabel\"] = {\n            interval: 0,\n            //横轴信息全部显示\n            rotate: 30\n          };\n        }\n\n        if ((this.customChart.style == 2 || this.customChart.style == 1) && data.length > 20) {\n          option.dataZoom = [{\n            type: \"inside\",\n            start: 0,\n            end: 10\n          }, {\n            start: 0,\n            end: 10,\n            handleIcon: \"M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4v1.3h1.3v-1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z\",\n            handleSize: \"80%\",\n            handleStyle: {\n              color: \"#fff\",\n              shadowBlur: 3,\n              shadowColor: \"rgba(0, 0, 0, 0.6)\",\n              shadowOffsetX: 2,\n              shadowOffsetY: 2\n            }\n          }];\n          option.grid.bottom = 50;\n        } else {\n          option.grid.bottom = \"3%\";\n          delete option.dataZoom;\n        }\n      }\n\n      myChart.setOption(option);\n    },\n    //回车查询\n    searchEnterFun: function searchEnterFun(e) {\n      var keyCode = window.event ? e.keyCode : e.which;\n\n      if (keyCode == 13) {\n        this.search();\n      }\n    }\n  }\n};",null]}