xt-element-ui 1.1.8 → 1.1.91

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +0,0 @@
1
- (("undefined"!==typeof self?self:this)["webpackJsonpxt_element_ui"]=("undefined"!==typeof self?self:this)["webpackJsonpxt_element_ui"]||[]).push([[2],{"04dd":function(e,t,o){},"1b46":function(e,t,o){"use strict";o.r(t);var l=function(){var e=this,t=e._self._c;return t("div",{ref:"barchart",staticClass:"bar-box"})},i=[],r=o("22f5"),a={name:"XtBar",props:{chartData:{type:Array,default:()=>[{value:65,name:"吴十"},{value:70,name:"唐九"},{value:73,name:"钱一"},{value:78,name:"孙二"},{value:88,name:"刘八"},{value:93,name:"王七"},{value:99,name:"赵六"},{value:103,name:"宋五"},{value:113,name:"李四"},{value:125,name:"张三"}]},theme:{},size:{type:String,default:"medium"},markPoint:{type:Boolean,default:!1},energyType:{type:String,default:""},showZoom:{type:Boolean,default:!1},reverse:{type:Boolean,default:!1},longLable:{type:Boolean,default:!1},longLableSplitNum:{type:Number,default:1},longLablePx:{type:Number,default:150},splitNumber:{type:Number,default:5}},data(){return{myChart:null,name:"数量"}},watch:{chartData:{deep:!0,handler(e,t){const o=this;o.initChart()}},energyType:{deep:!0,handler(e,t){const o=this;"kW.h"==e?o.name="用电量":"m³"==e&&(o.name="用气量"),o.initChart()}},theme(e){this.initChart()}},mounted(){this.initChart()},methods:{initChart(){const e=this,t={type:"category",inverse:this.reverse,axisLabel:{interval:0,formatter:function(t){return!e.reverse&&e.longLable?t.replace(new RegExp(`(.{${e.longLableSplitNum}})`,"g"),"$1\n"):t}},data:e.chartData.map(e=>e.name)},o={type:"value",splitLine:{lineStyle:{type:"dashed"}},name:e.energyType,axisTick:{inside:!0},min:0,splitNumber:e.splitNumber,max:function(t){return Math.ceil(t.max/e.splitNumber)*e.splitNumber},scale:!0,axisLabel:{margin:2,formatter:function(e,t){return e>=1e4&&e<1e7?e=e/1e4+"万":e>=1e7&&(e=e/1e7+"千万"),e}}},l={legend:{right:20,top:0,textStyle:{fontSize:12}},tooltip:{borderWidth:1,trigger:"item"},grid:{top:"10",left:40+(this.reverse&&this.longLable?e.longLablePx:0),right:"10",bottom:(e.showZoom?50:20)+(!e.reverse&&e.longLable?e.longLablePx:0),containLabel:!0},xAxis:this.reverse?o:t,yAxis:this.reverse?t:o,series:[{name:e.name,type:"bar",markPoint:{data:[{type:"min",name:"Min"},{type:"max",name:"Max"}]},avoidLabelOverlap:!0,data:e.chartData.map((e,t)=>{const{name:o,value:l}=e;return{value:l,name:o,tooltip:{borderWidth:1}}})}],dataZoom:e.showZoom?[{height:20,bottom:0}]:[]};this.markPoint||this.$delete(l.series[0],"markPoint"),this.myChart=r["a"].init(e.$refs.barchart,this.theme,l,this.size)}}},n=a,s=(o("9ea1"),o("2877")),c=Object(s["a"])(n,l,i,!1,null,"10acd2fc",null);t["default"]=c.exports},"22f5":function(e,t,o){"use strict";var l={color:["#1890ff","#37c3a4","#29c0ce","#6480D7","#8cce6f","#3a5dca","#ffb74d"],backgroundColor:"#ffffff",textStyle:{fontFamily:"Microsoft YaHei, sans-serif"},title:{textStyle:{color:"#333",fontSize:16},subtextStyle:{color:"#666666",fontSize:12}},line:{itemStyle:{},lineStyle:{width:2}},bar:{itemStyle:{borderRadius:4}},pie:{roseType:"radius",label:{color:"#333"}},radar:{indicator:{color:"#666666"}},map:{label:{color:"#333"},itemStyle:{borderColor:"#fff"}},gauge:{axisLine:{lineStyle:{color:[[1,"#5470c6"]]}}},toolbox:{iconStyle:{borderColor:"#666666"}},xAxis:{axisLine:{lineStyle:{color:"#DFE9EE"}},axisTick:{lineStyle:{color:"#DFE9EE"},show:!1}},yAxis:{axisLine:{lineStyle:{color:"#DFE9EE"}},axisTick:{lineStyle:{color:"#DFE9EE"}},splitLine:{show:!0,lineStyle:{type:"dashed",color:"#DFE9EE"}}},splitArea:{areaStyle:{color:["#f7f8fa","#ffffff"]}},legend:{textStyle:{color:"#333333"}},tooltip:{borderWidth:1,backgroundColor:"#ffffff",textStyle:{color:"#333333"},trigger:"axis"}},i={color:["#0de7ff","#a782ff","#fcdd60","#0de7ff","#ffc5a1","#6291ae","#13ce66"],backgroundColor:"transparent",textStyle:{fontFamily:"Microsoft YaHei, sans-serif"},title:{textStyle:{color:"#333"},subtextStyle:{color:"#666666"}},line:{itemStyle:{},lineStyle:{width:2}},bar:{itemStyle:{borderRadius:4}},pie:{roseType:"radius",label:{color:"#333"}},radar:{indicator:{color:"#666666"}},map:{label:{color:"#333"},itemStyle:{borderColor:"#fff"}},gauge:{axisLine:{lineStyle:{color:[[1,"#5470c6"]]}}},toolbox:{iconStyle:{borderColor:"#666666"}},axisLine:{lineStyle:{color:"#DCDFE6"}},axisTick:{lineStyle:{color:"#DCDFE6"}},splitLine:{lineStyle:{color:"#ebeef5"}},splitArea:{areaStyle:{color:["#f7f8fa","#ffffff"]}},legend:{textStyle:{color:"#666"}},tooltip:{backgroundColor:"rgba(255, 255, 255, 0.95)",borderColor:"#DCDFE6",borderWidth:1,textStyle:{color:"#333"}}},r={color:["#2CDEB3","#A17EE6","#E57E40","#409EFF"],backgroundColor:"#ffffff",textStyle:{fontFamily:"Microsoft YaHei, sans-serif"},title:{textStyle:{color:"#333"},subtextStyle:{color:"#666666"}},line:{itemStyle:{},lineStyle:{width:2}},bar:{itemStyle:{borderRadius:4}},pie:{roseType:"radius",label:{color:"#333"}},radar:{indicator:{color:"#666666"}},map:{label:{color:"#333"},itemStyle:{borderColor:"#fff"}},gauge:{axisLine:{lineStyle:{color:[[1,"#5470c6"]]}}},toolbox:{iconStyle:{borderColor:"#666666"}},axisLine:{lineStyle:{color:"#DCDFE6"}},axisTick:{lineStyle:{color:"#DCDFE6"}},splitLine:{lineStyle:{color:"#ebeef5"}},splitArea:{areaStyle:{color:["#f7f8fa","#ffffff"]}},legend:{textStyle:{color:"#666"}},tooltip:{backgroundColor:"rgba(255, 255, 255, 0.95)",borderColor:"#DCDFE6",borderWidth:1,textStyle:{color:"#333"}}},a={color:["#1685a9","#21a675","#1bd1a5","#8c4356","#0dafc6","#4b5cc4","#758a99","#cca4e3","#205277","#d9b611","#ff8c31","#9d2933","#0288c5","#44cef6"],backgroundColor:"#ffffff",textStyle:{fontFamily:"Microsoft YaHei, sans-serif"},title:{textStyle:{color:"#333"},subtextStyle:{color:"#666666"}},line:{itemStyle:{},lineStyle:{width:2}},bar:{itemStyle:{borderRadius:4}},pie:{roseType:"radius",label:{color:"#333"}},radar:{indicator:{color:"#666666"}},map:{label:{color:"#333"},itemStyle:{borderColor:"#fff"}},gauge:{axisLine:{lineStyle:{color:[[1,"#5470c6"]]}}},toolbox:{iconStyle:{borderColor:"#666666"}},axisLine:{lineStyle:{color:"#DCDFE6"}},axisTick:{lineStyle:{color:"#DCDFE6"}},splitLine:{lineStyle:{color:"#ebeef5"}},splitArea:{areaStyle:{color:["#f7f8fa","#ffffff"]}},legend:{textStyle:{color:"#666"}},tooltip:{backgroundColor:"rgba(255, 255, 255, 0.95)",borderColor:"#DCDFE6",borderWidth:1,textStyle:{color:"#333"}}},n={color:["#e69419","#A5b4da","#F8792C","#97bfb4","#de747b","#d6bac0","#e62737","#f35969","#f1ccb0","#b7394e","#fe9c1c2"],backgroundColor:"#ffffff",textStyle:{fontFamily:"Microsoft YaHei, sans-serif"},title:{textStyle:{color:"#333"},subtextStyle:{color:"#666666"}},line:{itemStyle:{color:"#e69419"},lineStyle:{width:2}},bar:{itemStyle:{borderRadius:4}},pie:{roseType:"radius",label:{color:"#333"}},radar:{indicator:{color:"#666666"}},map:{label:{color:"#333"},itemStyle:{borderColor:"#fff"}},gauge:{axisLine:{lineStyle:{color:[[1,"#5470c6"]]}}},toolbox:{iconStyle:{borderColor:"#666666"}},axisLine:{lineStyle:{color:"#DCDFE6"}},axisTick:{lineStyle:{color:"#DCDFE6"}},splitLine:{lineStyle:{color:"#ebeef5"}},splitArea:{areaStyle:{color:["#f7f8fa","#ffffff"]}},legend:{textStyle:{color:"#666"}},tooltip:{backgroundColor:"rgba(255, 255, 255, 0.95)",borderColor:"#DCDFE6",borderWidth:1,textStyle:{color:"#333"}}};const s={default:l,white:l,dark:i,blue:r,starry:a,orange:n};let c=null;function f(){if(!c&&"undefined"!==typeof window)try{c=o("313e");for(const e in s)c.registerTheme(e,s[e])}catch(e){console.warn("[ExChart] echarts 加载失败:",e.message)}return c}const d={small:{title:14,subtitle:11,legend:11,axisLabel:10,tooltip:11,label:11},medium:{title:16,subtitle:12,legend:12,axisLabel:12,tooltip:12,label:12},large:{title:18,subtitle:14,legend:14,axisLabel:14,tooltip:14,label:14}};function u(){}u.currentTheme="default",u.currentSize="medium",u.inverse=!1,u.baseOption={backgroundColor:"transparent",tooltip:{trigger:"axis",borderWidth:1},legend:{right:20,top:0,show:!0,textStyle:{fontSize:12}},grid:{top:"25%",left:"40",right:"15",bottom:"40"},xAxis:{type:"category",boundaryGap:!1,axisTick:{show:!0,length:4},axisLabel:{fontSize:12,interval:0,formatter:function(e){return!this.reverse&&this.longLable?e.replace(new RegExp(`(.{${this.longLableSplitNum}})`,"g"),"$1\n"):e}}},yAxis:{type:"value",axisTick:{show:!1},min:null,max:null,axisLabel:{show:!1},splitLine:{lineStyle:{type:"dashed",width:1}}}},u.chartInstanceList=[],u.mergeOptions=function(e,t){return Object.assign({},this.baseOption,e,t)},u.applyFontSize=function(e,t){const o=d[t]||d.medium,l=JSON.parse(JSON.stringify(e));return l.title&&l.title.textStyle&&(l.title.textStyle.fontSize=o.title),l.title&&l.title.subtextStyle&&(l.title.subtextStyle.fontSize=o.subtitle),l.legend&&l.legend.textStyle&&(l.legend.textStyle.fontSize=o.legend),l.tooltip&&l.tooltip.textStyle&&(l.tooltip.textStyle.fontSize=o.tooltip),l.pie&&l.pie.label&&"object"===typeof l.pie.label&&(l.pie.label.fontSize=o.label),l.radar&&l.radar.indicator&&"object"===typeof l.radar.indicator&&l.radar.indicator.textStyle&&(l.radar.indicator.textStyle.fontSize=o.label),l.map&&l.map.label&&"object"===typeof l.map.label&&(l.map.label.fontSize=o.label),l},u.init=function(e,t,o,l){const i=f();if(!i||!e)return null;t=t||"default",l=l||"medium",o=o||{};const r=this.currentTheme||t,a=this.currentSize||l;this.currentTheme=r,this.currentSize=a;let n=s[r];n=this.applyFontSize(n,a);const c=this.mergeOptions(n,o),d=i.init(e,r);return d.setOption(c,!0),this.chartInstanceList.push({dom:e,chart:d,customOption:o,size:a}),this.bindResize(d),d},u.changeSingleTheme=function(e,t,o,l){const i=f();if(!i||!e||!t)return;o=o||{},l=l||"default",this.currentTheme=l,t.dispose();const r=i.init(e,l,o),a=this.chartInstanceList.find((function(t){return t.dom===e}));return a&&(a.chart=r),r},u.changeAllTheme=function(e,t){const o=f();o&&e&&(this.currentTheme=e,t&&(this.currentSize=t),this.chartInstanceList.forEach((function(t){const l=t.dom,i=t.chart,r=t.customOption,a=t.size||u.currentSize;i&&i.dispose();const n=o.init(l,e);let c=s[e];c=u.applyFontSize(c,a);const f=u.mergeOptions(c,r);n.setOption(f,!0),t.chart=n,t.size=a,u.bindResize(n)})))},u.bindResize=function(e){e&&!e.resizeLocked&&(window.addEventListener("resize",(function(){e.resize()})),e._resizeLocked=!0)},u.destroy=function(e){e&&e.dispose(),this.chartInstanceList=this.chartInstanceList.filter((function(t){return t.chart!==e}))},u.destroyAll=function(){this.chartInstanceList.forEach((function(e){e.chart&&e.chart.dispose()})),this.chartInstanceList=[]};t["a"]=u},"9ea1":function(e,t,o){"use strict";o("04dd")}}]);
@@ -1 +0,0 @@
1
- (("undefined"!==typeof self?self:this)["webpackJsonpxt_element_ui"]=("undefined"!==typeof self?self:this)["webpackJsonpxt_element_ui"]||[]).push([[3],{"22f5":function(e,t,o){"use strict";var l={color:["#1890ff","#37c3a4","#29c0ce","#6480D7","#8cce6f","#3a5dca","#ffb74d"],backgroundColor:"#ffffff",textStyle:{fontFamily:"Microsoft YaHei, sans-serif"},title:{textStyle:{color:"#333",fontSize:16},subtextStyle:{color:"#666666",fontSize:12}},line:{itemStyle:{},lineStyle:{width:2}},bar:{itemStyle:{borderRadius:4}},pie:{roseType:"radius",label:{color:"#333"}},radar:{indicator:{color:"#666666"}},map:{label:{color:"#333"},itemStyle:{borderColor:"#fff"}},gauge:{axisLine:{lineStyle:{color:[[1,"#5470c6"]]}}},toolbox:{iconStyle:{borderColor:"#666666"}},xAxis:{axisLine:{lineStyle:{color:"#DFE9EE"}},axisTick:{lineStyle:{color:"#DFE9EE"},show:!1}},yAxis:{axisLine:{lineStyle:{color:"#DFE9EE"}},axisTick:{lineStyle:{color:"#DFE9EE"}},splitLine:{show:!0,lineStyle:{type:"dashed",color:"#DFE9EE"}}},splitArea:{areaStyle:{color:["#f7f8fa","#ffffff"]}},legend:{textStyle:{color:"#333333"}},tooltip:{borderWidth:1,backgroundColor:"#ffffff",textStyle:{color:"#333333"},trigger:"axis"}},i={color:["#0de7ff","#a782ff","#fcdd60","#0de7ff","#ffc5a1","#6291ae","#13ce66"],backgroundColor:"transparent",textStyle:{fontFamily:"Microsoft YaHei, sans-serif"},title:{textStyle:{color:"#333"},subtextStyle:{color:"#666666"}},line:{itemStyle:{},lineStyle:{width:2}},bar:{itemStyle:{borderRadius:4}},pie:{roseType:"radius",label:{color:"#333"}},radar:{indicator:{color:"#666666"}},map:{label:{color:"#333"},itemStyle:{borderColor:"#fff"}},gauge:{axisLine:{lineStyle:{color:[[1,"#5470c6"]]}}},toolbox:{iconStyle:{borderColor:"#666666"}},axisLine:{lineStyle:{color:"#DCDFE6"}},axisTick:{lineStyle:{color:"#DCDFE6"}},splitLine:{lineStyle:{color:"#ebeef5"}},splitArea:{areaStyle:{color:["#f7f8fa","#ffffff"]}},legend:{textStyle:{color:"#666"}},tooltip:{backgroundColor:"rgba(255, 255, 255, 0.95)",borderColor:"#DCDFE6",borderWidth:1,textStyle:{color:"#333"}}},r={color:["#2CDEB3","#A17EE6","#E57E40","#409EFF"],backgroundColor:"#ffffff",textStyle:{fontFamily:"Microsoft YaHei, sans-serif"},title:{textStyle:{color:"#333"},subtextStyle:{color:"#666666"}},line:{itemStyle:{},lineStyle:{width:2}},bar:{itemStyle:{borderRadius:4}},pie:{roseType:"radius",label:{color:"#333"}},radar:{indicator:{color:"#666666"}},map:{label:{color:"#333"},itemStyle:{borderColor:"#fff"}},gauge:{axisLine:{lineStyle:{color:[[1,"#5470c6"]]}}},toolbox:{iconStyle:{borderColor:"#666666"}},axisLine:{lineStyle:{color:"#DCDFE6"}},axisTick:{lineStyle:{color:"#DCDFE6"}},splitLine:{lineStyle:{color:"#ebeef5"}},splitArea:{areaStyle:{color:["#f7f8fa","#ffffff"]}},legend:{textStyle:{color:"#666"}},tooltip:{backgroundColor:"rgba(255, 255, 255, 0.95)",borderColor:"#DCDFE6",borderWidth:1,textStyle:{color:"#333"}}},a={color:["#1685a9","#21a675","#1bd1a5","#8c4356","#0dafc6","#4b5cc4","#758a99","#cca4e3","#205277","#d9b611","#ff8c31","#9d2933","#0288c5","#44cef6"],backgroundColor:"#ffffff",textStyle:{fontFamily:"Microsoft YaHei, sans-serif"},title:{textStyle:{color:"#333"},subtextStyle:{color:"#666666"}},line:{itemStyle:{},lineStyle:{width:2}},bar:{itemStyle:{borderRadius:4}},pie:{roseType:"radius",label:{color:"#333"}},radar:{indicator:{color:"#666666"}},map:{label:{color:"#333"},itemStyle:{borderColor:"#fff"}},gauge:{axisLine:{lineStyle:{color:[[1,"#5470c6"]]}}},toolbox:{iconStyle:{borderColor:"#666666"}},axisLine:{lineStyle:{color:"#DCDFE6"}},axisTick:{lineStyle:{color:"#DCDFE6"}},splitLine:{lineStyle:{color:"#ebeef5"}},splitArea:{areaStyle:{color:["#f7f8fa","#ffffff"]}},legend:{textStyle:{color:"#666"}},tooltip:{backgroundColor:"rgba(255, 255, 255, 0.95)",borderColor:"#DCDFE6",borderWidth:1,textStyle:{color:"#333"}}},n={color:["#e69419","#A5b4da","#F8792C","#97bfb4","#de747b","#d6bac0","#e62737","#f35969","#f1ccb0","#b7394e","#fe9c1c2"],backgroundColor:"#ffffff",textStyle:{fontFamily:"Microsoft YaHei, sans-serif"},title:{textStyle:{color:"#333"},subtextStyle:{color:"#666666"}},line:{itemStyle:{color:"#e69419"},lineStyle:{width:2}},bar:{itemStyle:{borderRadius:4}},pie:{roseType:"radius",label:{color:"#333"}},radar:{indicator:{color:"#666666"}},map:{label:{color:"#333"},itemStyle:{borderColor:"#fff"}},gauge:{axisLine:{lineStyle:{color:[[1,"#5470c6"]]}}},toolbox:{iconStyle:{borderColor:"#666666"}},axisLine:{lineStyle:{color:"#DCDFE6"}},axisTick:{lineStyle:{color:"#DCDFE6"}},splitLine:{lineStyle:{color:"#ebeef5"}},splitArea:{areaStyle:{color:["#f7f8fa","#ffffff"]}},legend:{textStyle:{color:"#666"}},tooltip:{backgroundColor:"rgba(255, 255, 255, 0.95)",borderColor:"#DCDFE6",borderWidth:1,textStyle:{color:"#333"}}};const s={default:l,white:l,dark:i,blue:r,starry:a,orange:n};let c=null;function f(){if(!c&&"undefined"!==typeof window)try{c=o("313e");for(const e in s)c.registerTheme(e,s[e])}catch(e){console.warn("[ExChart] echarts 加载失败:",e.message)}return c}const d={small:{title:14,subtitle:11,legend:11,axisLabel:10,tooltip:11,label:11},medium:{title:16,subtitle:12,legend:12,axisLabel:12,tooltip:12,label:12},large:{title:18,subtitle:14,legend:14,axisLabel:14,tooltip:14,label:14}};function y(){}y.currentTheme="default",y.currentSize="medium",y.inverse=!1,y.baseOption={backgroundColor:"transparent",tooltip:{trigger:"axis",borderWidth:1},legend:{right:20,top:0,show:!0,textStyle:{fontSize:12}},grid:{top:"25%",left:"40",right:"15",bottom:"40"},xAxis:{type:"category",boundaryGap:!1,axisTick:{show:!0,length:4},axisLabel:{fontSize:12,interval:0,formatter:function(e){return!this.reverse&&this.longLable?e.replace(new RegExp(`(.{${this.longLableSplitNum}})`,"g"),"$1\n"):e}}},yAxis:{type:"value",axisTick:{show:!1},min:null,max:null,axisLabel:{show:!1},splitLine:{lineStyle:{type:"dashed",width:1}}}},y.chartInstanceList=[],y.mergeOptions=function(e,t){return Object.assign({},this.baseOption,e,t)},y.applyFontSize=function(e,t){const o=d[t]||d.medium,l=JSON.parse(JSON.stringify(e));return l.title&&l.title.textStyle&&(l.title.textStyle.fontSize=o.title),l.title&&l.title.subtextStyle&&(l.title.subtextStyle.fontSize=o.subtitle),l.legend&&l.legend.textStyle&&(l.legend.textStyle.fontSize=o.legend),l.tooltip&&l.tooltip.textStyle&&(l.tooltip.textStyle.fontSize=o.tooltip),l.pie&&l.pie.label&&"object"===typeof l.pie.label&&(l.pie.label.fontSize=o.label),l.radar&&l.radar.indicator&&"object"===typeof l.radar.indicator&&l.radar.indicator.textStyle&&(l.radar.indicator.textStyle.fontSize=o.label),l.map&&l.map.label&&"object"===typeof l.map.label&&(l.map.label.fontSize=o.label),l},y.init=function(e,t,o,l){const i=f();if(!i||!e)return null;t=t||"default",l=l||"medium",o=o||{};const r=this.currentTheme||t,a=this.currentSize||l;this.currentTheme=r,this.currentSize=a;let n=s[r];n=this.applyFontSize(n,a);const c=this.mergeOptions(n,o),d=i.init(e,r);return d.setOption(c,!0),this.chartInstanceList.push({dom:e,chart:d,customOption:o,size:a}),this.bindResize(d),d},y.changeSingleTheme=function(e,t,o,l){const i=f();if(!i||!e||!t)return;o=o||{},l=l||"default",this.currentTheme=l,t.dispose();const r=i.init(e,l,o),a=this.chartInstanceList.find((function(t){return t.dom===e}));return a&&(a.chart=r),r},y.changeAllTheme=function(e,t){const o=f();o&&e&&(this.currentTheme=e,t&&(this.currentSize=t),this.chartInstanceList.forEach((function(t){const l=t.dom,i=t.chart,r=t.customOption,a=t.size||y.currentSize;i&&i.dispose();const n=o.init(l,e);let c=s[e];c=y.applyFontSize(c,a);const f=y.mergeOptions(c,r);n.setOption(f,!0),t.chart=n,t.size=a,y.bindResize(n)})))},y.bindResize=function(e){e&&!e.resizeLocked&&(window.addEventListener("resize",(function(){e.resize()})),e._resizeLocked=!0)},y.destroy=function(e){e&&e.dispose(),this.chartInstanceList=this.chartInstanceList.filter((function(t){return t.chart!==e}))},y.destroyAll=function(){this.chartInstanceList.forEach((function(e){e.chart&&e.chart.dispose()})),this.chartInstanceList=[]};t["a"]=y},a6ba:function(e,t,o){"use strict";o.r(t);var l=function(){var e=this,t=e._self._c;return t("div",{ref:"linechart",staticClass:"line-box"})},i=[],r=o("22f5"),a={name:"XtLine",props:{isDark:{type:Boolean,default:!1},theme:{},size:{type:String,default:"medium"},chartData:{type:Array,default:()=>[{value:53,name:"张三"},{value:10,name:"李四"},{value:60,name:"宋五"}]},isArea:{type:Boolean,default:!1},energyType:{type:String,default:""},intervalvalue:{type:Number,default:0}},data(){return{myChart:null}},watch:{chartData:{deep:!0,handler(e,t){const o=this;o.initChart()}},energyType:{deep:!0,handler(e,t){const o=this;o.initChart()}},theme(e){this.initChart()}},mounted(){this.initChart()},methods:{initChart(){console.log(this.intervalvalue);const e=this,t={animationDuration:500,grid:{top:"18%",left:"30",right:"30",bottom:"20"},xAxis:[{type:"category",splitLine:{show:!0,lineStyle:{type:"dashed"}},axisLabel:{interval:this.intervalvalue},boundaryGap:!1,data:e.chartData.map(e=>e.name)}],yAxis:{type:"value",axisLine:{show:!1,lineStyle:{}},axisTick:{show:!1},splitLine:{lineStyle:{type:"dashed"}},name:e.energyType,scale:!0,axisLabel:{margin:2,formatter:function(e,t){return e>=1e4&&e<1e7?e=Math.floor(e/1e4)+"万":e>=1e7&&(e=Math.floor(e/1e7)+"千万"),e}}},series:[{type:"line",symbol:"circle",areaStyle:e.isArea?{}:null,smooth:!0,avoidLabelOverlap:!0,data:e.chartData.map((e,t)=>e.value)}]};this.myChart=r["a"].init(e.$refs.linechart,this.theme,t,this.size)}}},n=a,s=(o("f09f"),o("2877")),c=Object(s["a"])(n,l,i,!1,null,"386a9c5d",null);t["default"]=c.exports},b599:function(e,t,o){},f09f:function(e,t,o){"use strict";o("b599")}}]);
@@ -1 +0,0 @@
1
- (("undefined"!==typeof self?self:this)["webpackJsonpxt_element_ui"]=("undefined"!==typeof self?self:this)["webpackJsonpxt_element_ui"]||[]).push([[4],{"20f2":function(e,t,l){"use strict";l.r(t);var o=function(){var e=this,t=e._self._c;return t("div",{ref:"multilinechart",staticClass:"multiline-box"})},i=[],a=l("22f5"),r={name:"XtMulti",props:{isDark:{type:Boolean,default:!1},theme:{},size:{type:String,default:"medium"},config:{type:Object,default(){return{interval:0,rotate:0,gridbottom:40,isShowthreshold:!1}}},chartData:{type:Array,default:()=>[{label:"入户数",data:[{label:"01月",value:980},{label:"02月",value:806},{label:"03月",value:930},{label:"04月",value:804},{label:"05月",value:750},{label:"06月",value:660},{label:"07月",value:780},{label:"08月",value:630},{label:"09月",value:806},{label:"10月",value:950},{label:"11月",value:810},{label:"12月",value:703}]},{label:"隐患数",data:[{label:"01月",value:200},{label:"02月",value:120},{label:"03月",value:110},{label:"04月",value:109},{label:"05月",value:108},{label:"06月",value:150},{label:"07月",value:126},{label:"08月",value:130},{label:"09月",value:108},{label:"10月",value:109},{label:"11月",value:140},{label:"12月",value:106}]},{label:"整改数",data:[{label:"01月",value:25},{label:"02月",value:19},{label:"03月",value:34},{label:"04月",value:12},{label:"05月",value:16},{label:"06月",value:20},{label:"07月",value:19},{label:"08月",value:18},{label:"09月",value:14},{label:"10月",value:12},{label:"11月",value:11},{label:"12月",value:16}]}]},colors:{type:Array,default:()=>[]},selectedNew:{type:Object,default:null},energyType:{type:[String,Array],default:""}},data(){return{myChart:null}},watch:{chartData:{deep:!0,handler(e,t){const l=this;this.myChart&&this.myChart.dispose(),this.myChart=null,l.initChart()}},energyType:{deep:!0,handler(e,t){if(e&&t&&e.toString()==t.toString())return;this.myChart&&this.myChart.dispose(),this.myChart=null;const l=this;l.initChart()}},theme(e){this.myChart&&this.myChart.dispose(),this.myChart=null,this.initChart()}},mounted(){this.initChart()},methods:{initChart(){const e=this,t=e=>({type:"value",name:e,axisLine:{show:!1,lineStyle:{}},axisTick:{show:!1},splitLine:{lineStyle:{type:"dashed"}},axisLabel:{formatter:function(e,t){return e>=1e4&&e<1e7?e=Math.floor(e/1e4)+"万":e>=1e7&&(e=Math.floor(e/1e7)+"千万"),e}}}),l={legend:{right:20,top:0,show:!0,data:e.chartData.map(e=>e.label),selectedMode:"multiple",selected:e.selectedNew,textStyle:{fontSize:12}},tooltip:{borderWidth:1,trigger:"axis",axisPointer:{type:"shadow"}},grid:{top:"25%",left:"40",right:"15",bottom:null==this.config.gridbottom?20:this.config.gridbottom},xAxis:{type:"category",axisLabel:{rotate:this.config.rotate},data:e.chartData&&e.chartData.length?e.chartData[0].data.map(e=>e.label):[]},yAxis:"string"==typeof e.energyType?t(e.energyType):this.energyType.map(e=>t(e)),dataZoom:[{type:"inside",xAxisIndex:[0],start:1,end:100}],series:this.getSeriesData()};this.myChart=a["a"].init(e.$refs.multilinechart,this.theme,l,this.size)},getSeriesData(){const e=this,t=[];return e.chartData.map((e,l)=>{e.data.some(e=>!e.value||"--"==e.value),e.label,e.data.map(e=>e.value);const o={animation:!0,name:e.label,type:e.type||"bar",avoidLabelOverlap:!0,data:e.data.map(e=>e.value)};t.push(o)}),t}}},n=r,s=(l("a68f"),l("2877")),c=Object(s["a"])(n,o,i,!1,null,"18661424",null);t["default"]=c.exports},"22f5":function(e,t,l){"use strict";var o={color:["#1890ff","#37c3a4","#29c0ce","#6480D7","#8cce6f","#3a5dca","#ffb74d"],backgroundColor:"#ffffff",textStyle:{fontFamily:"Microsoft YaHei, sans-serif"},title:{textStyle:{color:"#333",fontSize:16},subtextStyle:{color:"#666666",fontSize:12}},line:{itemStyle:{},lineStyle:{width:2}},bar:{itemStyle:{borderRadius:4}},pie:{roseType:"radius",label:{color:"#333"}},radar:{indicator:{color:"#666666"}},map:{label:{color:"#333"},itemStyle:{borderColor:"#fff"}},gauge:{axisLine:{lineStyle:{color:[[1,"#5470c6"]]}}},toolbox:{iconStyle:{borderColor:"#666666"}},xAxis:{axisLine:{lineStyle:{color:"#DFE9EE"}},axisTick:{lineStyle:{color:"#DFE9EE"},show:!1}},yAxis:{axisLine:{lineStyle:{color:"#DFE9EE"}},axisTick:{lineStyle:{color:"#DFE9EE"}},splitLine:{show:!0,lineStyle:{type:"dashed",color:"#DFE9EE"}}},splitArea:{areaStyle:{color:["#f7f8fa","#ffffff"]}},legend:{textStyle:{color:"#333333"}},tooltip:{borderWidth:1,backgroundColor:"#ffffff",textStyle:{color:"#333333"},trigger:"axis"}},i={color:["#0de7ff","#a782ff","#fcdd60","#0de7ff","#ffc5a1","#6291ae","#13ce66"],backgroundColor:"transparent",textStyle:{fontFamily:"Microsoft YaHei, sans-serif"},title:{textStyle:{color:"#333"},subtextStyle:{color:"#666666"}},line:{itemStyle:{},lineStyle:{width:2}},bar:{itemStyle:{borderRadius:4}},pie:{roseType:"radius",label:{color:"#333"}},radar:{indicator:{color:"#666666"}},map:{label:{color:"#333"},itemStyle:{borderColor:"#fff"}},gauge:{axisLine:{lineStyle:{color:[[1,"#5470c6"]]}}},toolbox:{iconStyle:{borderColor:"#666666"}},axisLine:{lineStyle:{color:"#DCDFE6"}},axisTick:{lineStyle:{color:"#DCDFE6"}},splitLine:{lineStyle:{color:"#ebeef5"}},splitArea:{areaStyle:{color:["#f7f8fa","#ffffff"]}},legend:{textStyle:{color:"#666"}},tooltip:{backgroundColor:"rgba(255, 255, 255, 0.95)",borderColor:"#DCDFE6",borderWidth:1,textStyle:{color:"#333"}}},a={color:["#2CDEB3","#A17EE6","#E57E40","#409EFF"],backgroundColor:"#ffffff",textStyle:{fontFamily:"Microsoft YaHei, sans-serif"},title:{textStyle:{color:"#333"},subtextStyle:{color:"#666666"}},line:{itemStyle:{},lineStyle:{width:2}},bar:{itemStyle:{borderRadius:4}},pie:{roseType:"radius",label:{color:"#333"}},radar:{indicator:{color:"#666666"}},map:{label:{color:"#333"},itemStyle:{borderColor:"#fff"}},gauge:{axisLine:{lineStyle:{color:[[1,"#5470c6"]]}}},toolbox:{iconStyle:{borderColor:"#666666"}},axisLine:{lineStyle:{color:"#DCDFE6"}},axisTick:{lineStyle:{color:"#DCDFE6"}},splitLine:{lineStyle:{color:"#ebeef5"}},splitArea:{areaStyle:{color:["#f7f8fa","#ffffff"]}},legend:{textStyle:{color:"#666"}},tooltip:{backgroundColor:"rgba(255, 255, 255, 0.95)",borderColor:"#DCDFE6",borderWidth:1,textStyle:{color:"#333"}}},r={color:["#1685a9","#21a675","#1bd1a5","#8c4356","#0dafc6","#4b5cc4","#758a99","#cca4e3","#205277","#d9b611","#ff8c31","#9d2933","#0288c5","#44cef6"],backgroundColor:"#ffffff",textStyle:{fontFamily:"Microsoft YaHei, sans-serif"},title:{textStyle:{color:"#333"},subtextStyle:{color:"#666666"}},line:{itemStyle:{},lineStyle:{width:2}},bar:{itemStyle:{borderRadius:4}},pie:{roseType:"radius",label:{color:"#333"}},radar:{indicator:{color:"#666666"}},map:{label:{color:"#333"},itemStyle:{borderColor:"#fff"}},gauge:{axisLine:{lineStyle:{color:[[1,"#5470c6"]]}}},toolbox:{iconStyle:{borderColor:"#666666"}},axisLine:{lineStyle:{color:"#DCDFE6"}},axisTick:{lineStyle:{color:"#DCDFE6"}},splitLine:{lineStyle:{color:"#ebeef5"}},splitArea:{areaStyle:{color:["#f7f8fa","#ffffff"]}},legend:{textStyle:{color:"#666"}},tooltip:{backgroundColor:"rgba(255, 255, 255, 0.95)",borderColor:"#DCDFE6",borderWidth:1,textStyle:{color:"#333"}}},n={color:["#e69419","#A5b4da","#F8792C","#97bfb4","#de747b","#d6bac0","#e62737","#f35969","#f1ccb0","#b7394e","#fe9c1c2"],backgroundColor:"#ffffff",textStyle:{fontFamily:"Microsoft YaHei, sans-serif"},title:{textStyle:{color:"#333"},subtextStyle:{color:"#666666"}},line:{itemStyle:{color:"#e69419"},lineStyle:{width:2}},bar:{itemStyle:{borderRadius:4}},pie:{roseType:"radius",label:{color:"#333"}},radar:{indicator:{color:"#666666"}},map:{label:{color:"#333"},itemStyle:{borderColor:"#fff"}},gauge:{axisLine:{lineStyle:{color:[[1,"#5470c6"]]}}},toolbox:{iconStyle:{borderColor:"#666666"}},axisLine:{lineStyle:{color:"#DCDFE6"}},axisTick:{lineStyle:{color:"#DCDFE6"}},splitLine:{lineStyle:{color:"#ebeef5"}},splitArea:{areaStyle:{color:["#f7f8fa","#ffffff"]}},legend:{textStyle:{color:"#666"}},tooltip:{backgroundColor:"rgba(255, 255, 255, 0.95)",borderColor:"#DCDFE6",borderWidth:1,textStyle:{color:"#333"}}};const s={default:o,white:o,dark:i,blue:a,starry:r,orange:n};let c=null;function f(){if(!c&&"undefined"!==typeof window)try{c=l("313e");for(const e in s)c.registerTheme(e,s[e])}catch(e){console.warn("[ExChart] echarts 加载失败:",e.message)}return c}const d={small:{title:14,subtitle:11,legend:11,axisLabel:10,tooltip:11,label:11},medium:{title:16,subtitle:12,legend:12,axisLabel:12,tooltip:12,label:12},large:{title:18,subtitle:14,legend:14,axisLabel:14,tooltip:14,label:14}};function u(){}u.currentTheme="default",u.currentSize="medium",u.inverse=!1,u.baseOption={backgroundColor:"transparent",tooltip:{trigger:"axis",borderWidth:1},legend:{right:20,top:0,show:!0,textStyle:{fontSize:12}},grid:{top:"25%",left:"40",right:"15",bottom:"40"},xAxis:{type:"category",boundaryGap:!1,axisTick:{show:!0,length:4},axisLabel:{fontSize:12,interval:0,formatter:function(e){return!this.reverse&&this.longLable?e.replace(new RegExp(`(.{${this.longLableSplitNum}})`,"g"),"$1\n"):e}}},yAxis:{type:"value",axisTick:{show:!1},min:null,max:null,axisLabel:{show:!1},splitLine:{lineStyle:{type:"dashed",width:1}}}},u.chartInstanceList=[],u.mergeOptions=function(e,t){return Object.assign({},this.baseOption,e,t)},u.applyFontSize=function(e,t){const l=d[t]||d.medium,o=JSON.parse(JSON.stringify(e));return o.title&&o.title.textStyle&&(o.title.textStyle.fontSize=l.title),o.title&&o.title.subtextStyle&&(o.title.subtextStyle.fontSize=l.subtitle),o.legend&&o.legend.textStyle&&(o.legend.textStyle.fontSize=l.legend),o.tooltip&&o.tooltip.textStyle&&(o.tooltip.textStyle.fontSize=l.tooltip),o.pie&&o.pie.label&&"object"===typeof o.pie.label&&(o.pie.label.fontSize=l.label),o.radar&&o.radar.indicator&&"object"===typeof o.radar.indicator&&o.radar.indicator.textStyle&&(o.radar.indicator.textStyle.fontSize=l.label),o.map&&o.map.label&&"object"===typeof o.map.label&&(o.map.label.fontSize=l.label),o},u.init=function(e,t,l,o){const i=f();if(!i||!e)return null;t=t||"default",o=o||"medium",l=l||{};const a=this.currentTheme||t,r=this.currentSize||o;this.currentTheme=a,this.currentSize=r;let n=s[a];n=this.applyFontSize(n,r);const c=this.mergeOptions(n,l),d=i.init(e,a);return d.setOption(c,!0),this.chartInstanceList.push({dom:e,chart:d,customOption:l,size:r}),this.bindResize(d),d},u.changeSingleTheme=function(e,t,l,o){const i=f();if(!i||!e||!t)return;l=l||{},o=o||"default",this.currentTheme=o,t.dispose();const a=i.init(e,o,l),r=this.chartInstanceList.find((function(t){return t.dom===e}));return r&&(r.chart=a),a},u.changeAllTheme=function(e,t){const l=f();l&&e&&(this.currentTheme=e,t&&(this.currentSize=t),this.chartInstanceList.forEach((function(t){const o=t.dom,i=t.chart,a=t.customOption,r=t.size||u.currentSize;i&&i.dispose();const n=l.init(o,e);let c=s[e];c=u.applyFontSize(c,r);const f=u.mergeOptions(c,a);n.setOption(f,!0),t.chart=n,t.size=r,u.bindResize(n)})))},u.bindResize=function(e){e&&!e.resizeLocked&&(window.addEventListener("resize",(function(){e.resize()})),e._resizeLocked=!0)},u.destroy=function(e){e&&e.dispose(),this.chartInstanceList=this.chartInstanceList.filter((function(t){return t.chart!==e}))},u.destroyAll=function(){this.chartInstanceList.forEach((function(e){e.chart&&e.chart.dispose()})),this.chartInstanceList=[]};t["a"]=u},a68f:function(e,t,l){"use strict";l("f7d1")},f7d1:function(e,t,l){}}]);
@@ -1 +0,0 @@
1
- (("undefined"!==typeof self?self:this)["webpackJsonpxt_element_ui"]=("undefined"!==typeof self?self:this)["webpackJsonpxt_element_ui"]||[]).push([[5],{"22f5":function(e,t,o){"use strict";var l={color:["#1890ff","#37c3a4","#29c0ce","#6480D7","#8cce6f","#3a5dca","#ffb74d"],backgroundColor:"#ffffff",textStyle:{fontFamily:"Microsoft YaHei, sans-serif"},title:{textStyle:{color:"#333",fontSize:16},subtextStyle:{color:"#666666",fontSize:12}},line:{itemStyle:{},lineStyle:{width:2}},bar:{itemStyle:{borderRadius:4}},pie:{roseType:"radius",label:{color:"#333"}},radar:{indicator:{color:"#666666"}},map:{label:{color:"#333"},itemStyle:{borderColor:"#fff"}},gauge:{axisLine:{lineStyle:{color:[[1,"#5470c6"]]}}},toolbox:{iconStyle:{borderColor:"#666666"}},xAxis:{axisLine:{lineStyle:{color:"#DFE9EE"}},axisTick:{lineStyle:{color:"#DFE9EE"},show:!1}},yAxis:{axisLine:{lineStyle:{color:"#DFE9EE"}},axisTick:{lineStyle:{color:"#DFE9EE"}},splitLine:{show:!0,lineStyle:{type:"dashed",color:"#DFE9EE"}}},splitArea:{areaStyle:{color:["#f7f8fa","#ffffff"]}},legend:{textStyle:{color:"#333333"}},tooltip:{borderWidth:1,backgroundColor:"#ffffff",textStyle:{color:"#333333"},trigger:"axis"}},i={color:["#0de7ff","#a782ff","#fcdd60","#0de7ff","#ffc5a1","#6291ae","#13ce66"],backgroundColor:"transparent",textStyle:{fontFamily:"Microsoft YaHei, sans-serif"},title:{textStyle:{color:"#333"},subtextStyle:{color:"#666666"}},line:{itemStyle:{},lineStyle:{width:2}},bar:{itemStyle:{borderRadius:4}},pie:{roseType:"radius",label:{color:"#333"}},radar:{indicator:{color:"#666666"}},map:{label:{color:"#333"},itemStyle:{borderColor:"#fff"}},gauge:{axisLine:{lineStyle:{color:[[1,"#5470c6"]]}}},toolbox:{iconStyle:{borderColor:"#666666"}},axisLine:{lineStyle:{color:"#DCDFE6"}},axisTick:{lineStyle:{color:"#DCDFE6"}},splitLine:{lineStyle:{color:"#ebeef5"}},splitArea:{areaStyle:{color:["#f7f8fa","#ffffff"]}},legend:{textStyle:{color:"#666"}},tooltip:{backgroundColor:"rgba(255, 255, 255, 0.95)",borderColor:"#DCDFE6",borderWidth:1,textStyle:{color:"#333"}}},r={color:["#2CDEB3","#A17EE6","#E57E40","#409EFF"],backgroundColor:"#ffffff",textStyle:{fontFamily:"Microsoft YaHei, sans-serif"},title:{textStyle:{color:"#333"},subtextStyle:{color:"#666666"}},line:{itemStyle:{},lineStyle:{width:2}},bar:{itemStyle:{borderRadius:4}},pie:{roseType:"radius",label:{color:"#333"}},radar:{indicator:{color:"#666666"}},map:{label:{color:"#333"},itemStyle:{borderColor:"#fff"}},gauge:{axisLine:{lineStyle:{color:[[1,"#5470c6"]]}}},toolbox:{iconStyle:{borderColor:"#666666"}},axisLine:{lineStyle:{color:"#DCDFE6"}},axisTick:{lineStyle:{color:"#DCDFE6"}},splitLine:{lineStyle:{color:"#ebeef5"}},splitArea:{areaStyle:{color:["#f7f8fa","#ffffff"]}},legend:{textStyle:{color:"#666"}},tooltip:{backgroundColor:"rgba(255, 255, 255, 0.95)",borderColor:"#DCDFE6",borderWidth:1,textStyle:{color:"#333"}}},a={color:["#1685a9","#21a675","#1bd1a5","#8c4356","#0dafc6","#4b5cc4","#758a99","#cca4e3","#205277","#d9b611","#ff8c31","#9d2933","#0288c5","#44cef6"],backgroundColor:"#ffffff",textStyle:{fontFamily:"Microsoft YaHei, sans-serif"},title:{textStyle:{color:"#333"},subtextStyle:{color:"#666666"}},line:{itemStyle:{},lineStyle:{width:2}},bar:{itemStyle:{borderRadius:4}},pie:{roseType:"radius",label:{color:"#333"}},radar:{indicator:{color:"#666666"}},map:{label:{color:"#333"},itemStyle:{borderColor:"#fff"}},gauge:{axisLine:{lineStyle:{color:[[1,"#5470c6"]]}}},toolbox:{iconStyle:{borderColor:"#666666"}},axisLine:{lineStyle:{color:"#DCDFE6"}},axisTick:{lineStyle:{color:"#DCDFE6"}},splitLine:{lineStyle:{color:"#ebeef5"}},splitArea:{areaStyle:{color:["#f7f8fa","#ffffff"]}},legend:{textStyle:{color:"#666"}},tooltip:{backgroundColor:"rgba(255, 255, 255, 0.95)",borderColor:"#DCDFE6",borderWidth:1,textStyle:{color:"#333"}}},n={color:["#e69419","#A5b4da","#F8792C","#97bfb4","#de747b","#d6bac0","#e62737","#f35969","#f1ccb0","#b7394e","#fe9c1c2"],backgroundColor:"#ffffff",textStyle:{fontFamily:"Microsoft YaHei, sans-serif"},title:{textStyle:{color:"#333"},subtextStyle:{color:"#666666"}},line:{itemStyle:{color:"#e69419"},lineStyle:{width:2}},bar:{itemStyle:{borderRadius:4}},pie:{roseType:"radius",label:{color:"#333"}},radar:{indicator:{color:"#666666"}},map:{label:{color:"#333"},itemStyle:{borderColor:"#fff"}},gauge:{axisLine:{lineStyle:{color:[[1,"#5470c6"]]}}},toolbox:{iconStyle:{borderColor:"#666666"}},axisLine:{lineStyle:{color:"#DCDFE6"}},axisTick:{lineStyle:{color:"#DCDFE6"}},splitLine:{lineStyle:{color:"#ebeef5"}},splitArea:{areaStyle:{color:["#f7f8fa","#ffffff"]}},legend:{textStyle:{color:"#666"}},tooltip:{backgroundColor:"rgba(255, 255, 255, 0.95)",borderColor:"#DCDFE6",borderWidth:1,textStyle:{color:"#333"}}};const s={default:l,white:l,dark:i,blue:r,starry:a,orange:n};let c=null;function f(){if(!c&&"undefined"!==typeof window)try{c=o("313e");for(const e in s)c.registerTheme(e,s[e])}catch(e){console.warn("[ExChart] echarts 加载失败:",e.message)}return c}const d={small:{title:14,subtitle:11,legend:11,axisLabel:10,tooltip:11,label:11},medium:{title:16,subtitle:12,legend:12,axisLabel:12,tooltip:12,label:12},large:{title:18,subtitle:14,legend:14,axisLabel:14,tooltip:14,label:14}};function y(){}y.currentTheme="default",y.currentSize="medium",y.inverse=!1,y.baseOption={backgroundColor:"transparent",tooltip:{trigger:"axis",borderWidth:1},legend:{right:20,top:0,show:!0,textStyle:{fontSize:12}},grid:{top:"25%",left:"40",right:"15",bottom:"40"},xAxis:{type:"category",boundaryGap:!1,axisTick:{show:!0,length:4},axisLabel:{fontSize:12,interval:0,formatter:function(e){return!this.reverse&&this.longLable?e.replace(new RegExp(`(.{${this.longLableSplitNum}})`,"g"),"$1\n"):e}}},yAxis:{type:"value",axisTick:{show:!1},min:null,max:null,axisLabel:{show:!1},splitLine:{lineStyle:{type:"dashed",width:1}}}},y.chartInstanceList=[],y.mergeOptions=function(e,t){return Object.assign({},this.baseOption,e,t)},y.applyFontSize=function(e,t){const o=d[t]||d.medium,l=JSON.parse(JSON.stringify(e));return l.title&&l.title.textStyle&&(l.title.textStyle.fontSize=o.title),l.title&&l.title.subtextStyle&&(l.title.subtextStyle.fontSize=o.subtitle),l.legend&&l.legend.textStyle&&(l.legend.textStyle.fontSize=o.legend),l.tooltip&&l.tooltip.textStyle&&(l.tooltip.textStyle.fontSize=o.tooltip),l.pie&&l.pie.label&&"object"===typeof l.pie.label&&(l.pie.label.fontSize=o.label),l.radar&&l.radar.indicator&&"object"===typeof l.radar.indicator&&l.radar.indicator.textStyle&&(l.radar.indicator.textStyle.fontSize=o.label),l.map&&l.map.label&&"object"===typeof l.map.label&&(l.map.label.fontSize=o.label),l},y.init=function(e,t,o,l){const i=f();if(!i||!e)return null;t=t||"default",l=l||"medium",o=o||{};const r=this.currentTheme||t,a=this.currentSize||l;this.currentTheme=r,this.currentSize=a;let n=s[r];n=this.applyFontSize(n,a);const c=this.mergeOptions(n,o),d=i.init(e,r);return d.setOption(c,!0),this.chartInstanceList.push({dom:e,chart:d,customOption:o,size:a}),this.bindResize(d),d},y.changeSingleTheme=function(e,t,o,l){const i=f();if(!i||!e||!t)return;o=o||{},l=l||"default",this.currentTheme=l,t.dispose();const r=i.init(e,l,o),a=this.chartInstanceList.find((function(t){return t.dom===e}));return a&&(a.chart=r),r},y.changeAllTheme=function(e,t){const o=f();o&&e&&(this.currentTheme=e,t&&(this.currentSize=t),this.chartInstanceList.forEach((function(t){const l=t.dom,i=t.chart,r=t.customOption,a=t.size||y.currentSize;i&&i.dispose();const n=o.init(l,e);let c=s[e];c=y.applyFontSize(c,a);const f=y.mergeOptions(c,r);n.setOption(f,!0),t.chart=n,t.size=a,y.bindResize(n)})))},y.bindResize=function(e){e&&!e.resizeLocked&&(window.addEventListener("resize",(function(){e.resize()})),e._resizeLocked=!0)},y.destroy=function(e){e&&e.dispose(),this.chartInstanceList=this.chartInstanceList.filter((function(t){return t.chart!==e}))},y.destroyAll=function(){this.chartInstanceList.forEach((function(e){e.chart&&e.chart.dispose()})),this.chartInstanceList=[]};t["a"]=y},"8d72":function(e,t,o){},ab1c:function(e,t,o){"use strict";o.r(t);var l=function(){var e=this,t=e._self._c;return t("div",{ref:"piechart",staticClass:"pie-box"})},i=[],r=o("22f5"),a={name:"XtPie",props:{theme:{},size:{type:String,default:"medium"},chartData:{type:Array,default:()=>[{value:53,name:"张三"},{value:10,name:"李四"},{value:60,name:"宋五"}]},colors:{type:Array,default:()=>[]},unit:{type:String,default:""},showLegend:{type:Boolean,default:!0},chartMode:{type:String,default:"dark"},roseType:{type:String,default:""},showLabel:{type:Boolean,default:!0},totalLabel:{type:String,default:"总数"}},data(){return{myChart:null}},computed:{totalNum(){return this.chartData.map(e=>parseFloat(e.value)).reduce((e,t)=>e+t,0)}},watch:{chartData:{deep:!0,handler(e,t){const o=this;o.initChart()}},theme(e){this.initChart()}},mounted(){this.$nextTick(()=>{this.initChart()})},methods:{initChart(){const e=this;console.log(this.chartMode);const t={title:{text:`${e.totalLabel}:${e.totalNum}`,textStyle:{color:"#808080",fontSize:20},top:"middle",left:"center"},tooltip:{trigger:"item"},legend:this.showLegend?{top:"top",right:"20",type:"scroll",textStyle:{color:"#808080"}}:null,grid:{left:30,right:0,top:20,bottom:0,containLabel:!0},series:[{name:e.unit,type:"pie",center:["50%","50%"],roseType:this.roseType,radius:["50%","65%"],minAngle:5,avoidLabelOverlap:!0,data:e.chartData.map((e,t)=>{const{name:o,value:l}=e;return{value:l,name:o,labelLine:{show:this.showLabel},emphasis:{labelLine:{show:this.showLabel}},label:{show:this.showLabel},tooltip:{formatter:"{b}:{c} ({d}%)",position:"inside",borderWidth:1}}})}]};this.myChart=r["a"].init(e.$refs.piechart,this.theme,t,this.size)}}},n=a,s=(o("e3c3"),o("2877")),c=Object(s["a"])(n,l,i,!1,null,"5100b648",null);t["default"]=c.exports},e3c3:function(e,t,o){"use strict";o("8d72")}}]);
@@ -1 +0,0 @@
1
- (("undefined"!==typeof self?self:this)["webpackJsonpxt_element_ui"]=("undefined"!==typeof self?self:this)["webpackJsonpxt_element_ui"]||[]).push([[6],{"22f5":function(e,t,o){"use strict";var l={color:["#1890ff","#37c3a4","#29c0ce","#6480D7","#8cce6f","#3a5dca","#ffb74d"],backgroundColor:"#ffffff",textStyle:{fontFamily:"Microsoft YaHei, sans-serif"},title:{textStyle:{color:"#333",fontSize:16},subtextStyle:{color:"#666666",fontSize:12}},line:{itemStyle:{},lineStyle:{width:2}},bar:{itemStyle:{borderRadius:4}},pie:{roseType:"radius",label:{color:"#333"}},radar:{indicator:{color:"#666666"}},map:{label:{color:"#333"},itemStyle:{borderColor:"#fff"}},gauge:{axisLine:{lineStyle:{color:[[1,"#5470c6"]]}}},toolbox:{iconStyle:{borderColor:"#666666"}},xAxis:{axisLine:{lineStyle:{color:"#DFE9EE"}},axisTick:{lineStyle:{color:"#DFE9EE"},show:!1}},yAxis:{axisLine:{lineStyle:{color:"#DFE9EE"}},axisTick:{lineStyle:{color:"#DFE9EE"}},splitLine:{show:!0,lineStyle:{type:"dashed",color:"#DFE9EE"}}},splitArea:{areaStyle:{color:["#f7f8fa","#ffffff"]}},legend:{textStyle:{color:"#333333"}},tooltip:{borderWidth:1,backgroundColor:"#ffffff",textStyle:{color:"#333333"},trigger:"axis"}},i={color:["#0de7ff","#a782ff","#fcdd60","#0de7ff","#ffc5a1","#6291ae","#13ce66"],backgroundColor:"transparent",textStyle:{fontFamily:"Microsoft YaHei, sans-serif"},title:{textStyle:{color:"#333"},subtextStyle:{color:"#666666"}},line:{itemStyle:{},lineStyle:{width:2}},bar:{itemStyle:{borderRadius:4}},pie:{roseType:"radius",label:{color:"#333"}},radar:{indicator:{color:"#666666"}},map:{label:{color:"#333"},itemStyle:{borderColor:"#fff"}},gauge:{axisLine:{lineStyle:{color:[[1,"#5470c6"]]}}},toolbox:{iconStyle:{borderColor:"#666666"}},axisLine:{lineStyle:{color:"#DCDFE6"}},axisTick:{lineStyle:{color:"#DCDFE6"}},splitLine:{lineStyle:{color:"#ebeef5"}},splitArea:{areaStyle:{color:["#f7f8fa","#ffffff"]}},legend:{textStyle:{color:"#666"}},tooltip:{backgroundColor:"rgba(255, 255, 255, 0.95)",borderColor:"#DCDFE6",borderWidth:1,textStyle:{color:"#333"}}},r={color:["#2CDEB3","#A17EE6","#E57E40","#409EFF"],backgroundColor:"#ffffff",textStyle:{fontFamily:"Microsoft YaHei, sans-serif"},title:{textStyle:{color:"#333"},subtextStyle:{color:"#666666"}},line:{itemStyle:{},lineStyle:{width:2}},bar:{itemStyle:{borderRadius:4}},pie:{roseType:"radius",label:{color:"#333"}},radar:{indicator:{color:"#666666"}},map:{label:{color:"#333"},itemStyle:{borderColor:"#fff"}},gauge:{axisLine:{lineStyle:{color:[[1,"#5470c6"]]}}},toolbox:{iconStyle:{borderColor:"#666666"}},axisLine:{lineStyle:{color:"#DCDFE6"}},axisTick:{lineStyle:{color:"#DCDFE6"}},splitLine:{lineStyle:{color:"#ebeef5"}},splitArea:{areaStyle:{color:["#f7f8fa","#ffffff"]}},legend:{textStyle:{color:"#666"}},tooltip:{backgroundColor:"rgba(255, 255, 255, 0.95)",borderColor:"#DCDFE6",borderWidth:1,textStyle:{color:"#333"}}},a={color:["#1685a9","#21a675","#1bd1a5","#8c4356","#0dafc6","#4b5cc4","#758a99","#cca4e3","#205277","#d9b611","#ff8c31","#9d2933","#0288c5","#44cef6"],backgroundColor:"#ffffff",textStyle:{fontFamily:"Microsoft YaHei, sans-serif"},title:{textStyle:{color:"#333"},subtextStyle:{color:"#666666"}},line:{itemStyle:{},lineStyle:{width:2}},bar:{itemStyle:{borderRadius:4}},pie:{roseType:"radius",label:{color:"#333"}},radar:{indicator:{color:"#666666"}},map:{label:{color:"#333"},itemStyle:{borderColor:"#fff"}},gauge:{axisLine:{lineStyle:{color:[[1,"#5470c6"]]}}},toolbox:{iconStyle:{borderColor:"#666666"}},axisLine:{lineStyle:{color:"#DCDFE6"}},axisTick:{lineStyle:{color:"#DCDFE6"}},splitLine:{lineStyle:{color:"#ebeef5"}},splitArea:{areaStyle:{color:["#f7f8fa","#ffffff"]}},legend:{textStyle:{color:"#666"}},tooltip:{backgroundColor:"rgba(255, 255, 255, 0.95)",borderColor:"#DCDFE6",borderWidth:1,textStyle:{color:"#333"}}},n={color:["#e69419","#A5b4da","#F8792C","#97bfb4","#de747b","#d6bac0","#e62737","#f35969","#f1ccb0","#b7394e","#fe9c1c2"],backgroundColor:"#ffffff",textStyle:{fontFamily:"Microsoft YaHei, sans-serif"},title:{textStyle:{color:"#333"},subtextStyle:{color:"#666666"}},line:{itemStyle:{color:"#e69419"},lineStyle:{width:2}},bar:{itemStyle:{borderRadius:4}},pie:{roseType:"radius",label:{color:"#333"}},radar:{indicator:{color:"#666666"}},map:{label:{color:"#333"},itemStyle:{borderColor:"#fff"}},gauge:{axisLine:{lineStyle:{color:[[1,"#5470c6"]]}}},toolbox:{iconStyle:{borderColor:"#666666"}},axisLine:{lineStyle:{color:"#DCDFE6"}},axisTick:{lineStyle:{color:"#DCDFE6"}},splitLine:{lineStyle:{color:"#ebeef5"}},splitArea:{areaStyle:{color:["#f7f8fa","#ffffff"]}},legend:{textStyle:{color:"#666"}},tooltip:{backgroundColor:"rgba(255, 255, 255, 0.95)",borderColor:"#DCDFE6",borderWidth:1,textStyle:{color:"#333"}}};const c={default:l,white:l,dark:i,blue:r,starry:a,orange:n};let s=null;function f(){if(!s&&"undefined"!==typeof window)try{s=o("313e");for(const e in c)s.registerTheme(e,c[e])}catch(e){console.warn("[ExChart] echarts 加载失败:",e.message)}return s}const d={small:{title:14,subtitle:11,legend:11,axisLabel:10,tooltip:11,label:11},medium:{title:16,subtitle:12,legend:12,axisLabel:12,tooltip:12,label:12},large:{title:18,subtitle:14,legend:14,axisLabel:14,tooltip:14,label:14}};function y(){}y.currentTheme="default",y.currentSize="medium",y.inverse=!1,y.baseOption={backgroundColor:"transparent",tooltip:{trigger:"axis",borderWidth:1},legend:{right:20,top:0,show:!0,textStyle:{fontSize:12}},grid:{top:"25%",left:"40",right:"15",bottom:"40"},xAxis:{type:"category",boundaryGap:!1,axisTick:{show:!0,length:4},axisLabel:{fontSize:12,interval:0,formatter:function(e){return!this.reverse&&this.longLable?e.replace(new RegExp(`(.{${this.longLableSplitNum}})`,"g"),"$1\n"):e}}},yAxis:{type:"value",axisTick:{show:!1},min:null,max:null,axisLabel:{show:!1},splitLine:{lineStyle:{type:"dashed",width:1}}}},y.chartInstanceList=[],y.mergeOptions=function(e,t){return Object.assign({},this.baseOption,e,t)},y.applyFontSize=function(e,t){const o=d[t]||d.medium,l=JSON.parse(JSON.stringify(e));return l.title&&l.title.textStyle&&(l.title.textStyle.fontSize=o.title),l.title&&l.title.subtextStyle&&(l.title.subtextStyle.fontSize=o.subtitle),l.legend&&l.legend.textStyle&&(l.legend.textStyle.fontSize=o.legend),l.tooltip&&l.tooltip.textStyle&&(l.tooltip.textStyle.fontSize=o.tooltip),l.pie&&l.pie.label&&"object"===typeof l.pie.label&&(l.pie.label.fontSize=o.label),l.radar&&l.radar.indicator&&"object"===typeof l.radar.indicator&&l.radar.indicator.textStyle&&(l.radar.indicator.textStyle.fontSize=o.label),l.map&&l.map.label&&"object"===typeof l.map.label&&(l.map.label.fontSize=o.label),l},y.init=function(e,t,o,l){const i=f();if(!i||!e)return null;t=t||"default",l=l||"medium",o=o||{};const r=this.currentTheme||t,a=this.currentSize||l;this.currentTheme=r,this.currentSize=a;let n=c[r];n=this.applyFontSize(n,a);const s=this.mergeOptions(n,o),d=i.init(e,r);return d.setOption(s,!0),this.chartInstanceList.push({dom:e,chart:d,customOption:o,size:a}),this.bindResize(d),d},y.changeSingleTheme=function(e,t,o,l){const i=f();if(!i||!e||!t)return;o=o||{},l=l||"default",this.currentTheme=l,t.dispose();const r=i.init(e,l,o),a=this.chartInstanceList.find((function(t){return t.dom===e}));return a&&(a.chart=r),r},y.changeAllTheme=function(e,t){const o=f();o&&e&&(this.currentTheme=e,t&&(this.currentSize=t),this.chartInstanceList.forEach((function(t){const l=t.dom,i=t.chart,r=t.customOption,a=t.size||y.currentSize;i&&i.dispose();const n=o.init(l,e);let s=c[e];s=y.applyFontSize(s,a);const f=y.mergeOptions(s,r);n.setOption(f,!0),t.chart=n,t.size=a,y.bindResize(n)})))},y.bindResize=function(e){e&&!e.resizeLocked&&(window.addEventListener("resize",(function(){e.resize()})),e._resizeLocked=!0)},y.destroy=function(e){e&&e.dispose(),this.chartInstanceList=this.chartInstanceList.filter((function(t){return t.chart!==e}))},y.destroyAll=function(){this.chartInstanceList.forEach((function(e){e.chart&&e.chart.dispose()})),this.chartInstanceList=[]};t["a"]=y},"7c01":function(e,t,o){"use strict";o("cb71")},"7fd9":function(e,t,o){"use strict";o.r(t);var l=function(){var e=this,t=e._self._c;return t("div",{ref:"barchart",staticClass:"bar-box",style:{width:e.width}})},i=[],r=o("22f5"),a={name:"XtTrend",props:{type:{type:String,default:"bar"},theme:{},size:{type:String,default:"medium"},chartData:{type:Array,default:()=>[{value:53,label:"正常设备"},{value:10,label:"正常设备"},{value:60,label:"离线设备"}]},width:{type:String,default:"100%"},energyType:{type:String,default:"m³"}},data(){return{myChart:null}},watch:{type:{handler(){const e=this,t=e.getOption();e.myChart.setOption(t)}},chartData:{deep:!0,handler(e,t){const o=this;o.initChart()}},theme(e){this.initChart()}},mounted(){this.initChart()},methods:{getOption(){const e=this,t={xAxis:{type:"category",axisTick:{show:!1,splitLine:{lineStyle:{}}},axisLabel:{}},tooltip:{borderWidth:1,trigger:"item"},grid:{top:"10",left:"10",right:"10",bottom:"20"},yAxis:{show:!1,type:"value"},series:{type:e.type||"bar",areaStyle:{},showSymbol:!1,smooth:!0,data:e.chartData.map((e,t)=>{const{label:o,value:l}=e;return{value:l,label:o}})}};return t},initChart(){const e=this,t=this.getOption();this.myChart=r["a"].init(e.$refs.barchart,this.theme,t,this.size)}}},n=a,c=(o("7c01"),o("2877")),s=Object(c["a"])(n,l,i,!1,null,"36cddc14",null);t["default"]=s.exports},cb71:function(e,t,o){}}]);
@@ -1,27 +0,0 @@
1
- <script>
2
- export default {
3
- name: "ExCell",
4
- functional: true,
5
- props: {
6
- row: Object,
7
- index: Number,
8
- formatter: Function,
9
- column: {
10
- type: Object,
11
- default: null
12
- }
13
- },
14
- render: (h, ctx) => {
15
- const params = {
16
- row: ctx.props.row,
17
- index: ctx.props.index
18
- };
19
- debugger
20
- if (ctx.props.column) params.column = ctx.props.column;
21
- const isVnode = (it) => typeof it === "object" && it.hasOwnProperty("componentOptions");
22
- const renderNode = ctx.props.formatter(h, params);
23
- // 非Vnode 字符处理
24
- return isVnode(renderNode) ? renderNode : h("span", renderNode);
25
- }
26
- };
27
- </script>
@@ -1,36 +0,0 @@
1
- <template>
2
- <el-table-column v-bind="setAttrs(column)">
3
- <template slot="header" slot-scope="scope">
4
- <slot :name="column.slotHeader || 'header'" :column="scope.column">
5
- <span> {{ scope.column.label }}</span>
6
- </slot>
7
- </template>
8
- <ExColumn v-for="(child, index) in column.children" :key="index" :column="child" />
9
- </el-table-column>
10
- </template>
11
- <script>
12
- export default {
13
- name: "ExColumn",
14
- props: {
15
- column: {
16
- type: Object,
17
- default: () => {
18
- return undefined;
19
- },
20
- required: true
21
- }
22
- },
23
- methods: {
24
- setAttrs(params) {
25
- const { ...options } = params;
26
- if (!options.align) {
27
- options.align = "center";
28
- }
29
- if (options.showTip) {
30
- options.showOverflowTooltip = true;
31
- }
32
- return { ...options };
33
- }
34
- }
35
- };
36
- </script>
@@ -1,380 +0,0 @@
1
- // utils/tableDataProcessor.js
2
-
3
- /**
4
- * 主函数:为表格数据添加小计行
5
- * @param {Array} data - 原始数据
6
- * @param {Object} options - 配置选项
7
- * @returns {Array} 加工后的数据
8
- */
9
- export function enhanceWithSubtotal(data, options = {}) {
10
- const defaultOptions = {
11
- groupFields: [], // 分组字段,如 ['region', 'province', 'city']
12
- sumFields: [], // 求和字段,如 ['sales', 'quantity']
13
- avgFields: [], // 平均字段,如 ['price']
14
- countFields: [], // 计数字段,如 ['product']
15
- subtotalLabel: "小计", // 小计行标签
16
- totalLabel: "总计", // 总计行标签
17
- showTotal: true, // 是否显示总计
18
- sortData: true, // 是否自动排序
19
- formatNumbers: true, // 是否格式化数字
20
- excludeSubtotalRows: false, // 是否排除某些行不参与小计
21
- excludeCondition: null, // 排除条件函数
22
- customCalculations: {} // 自定义计算函数
23
- };
24
-
25
- const config = { ...defaultOptions, ...options };
26
-
27
- // 数据验证
28
- if (!Array.isArray(data) || data.length === 0) {
29
- return data;
30
- }
31
-
32
- if (config.groupFields.length === 0) {
33
- console.warn("未指定分组字段,将返回原始数据");
34
- return data;
35
- }
36
-
37
- // 1. 数据预处理
38
- let processedData = preprocessData(data, config);
39
-
40
- // 2. 计算并插入小计行
41
- processedData = calculateAndInsertSubtotals(processedData, config);
42
-
43
- // 3. 后处理(格式化等)
44
- processedData = postprocessData(processedData, config);
45
-
46
- return processedData;
47
- }
48
-
49
- /**
50
- * 数据预处理
51
- */
52
- function preprocessData(data, config) {
53
- let result = [...data];
54
-
55
- // 标记排除的行
56
- if (config.excludeCondition) {
57
- result = result.map(row => ({
58
- ...row,
59
- _excludedFromSubtotal: config.excludeCondition(row)
60
- }));
61
- }
62
-
63
- // 数据排序
64
- if (config.sortData) {
65
- result.sort((a, b) => {
66
- for (const field of config.groupFields) {
67
- const aVal = String(a[field] || "");
68
- const bVal = String(b[field] || "");
69
- if (aVal !== bVal) {
70
- return aVal.localeCompare(bVal);
71
- }
72
- }
73
- return 0;
74
- });
75
- }
76
-
77
- return result;
78
- }
79
-
80
- /**
81
- * 计算并插入小计行
82
- */
83
- function calculateAndInsertSubtotals(data, config) {
84
- const result = [];
85
- const allSumFields = [...config.sumFields, ...config.avgFields, ...config.countFields];
86
-
87
- // 存储各级分组的小计信息
88
- const subtotalInfo = Array(config.groupFields.length).fill().map(() => ({
89
- startIndex: 0,
90
- currentValue: null,
91
- subtotalRows: []
92
- }));
93
-
94
- for (let i = 0; i <= data.length; i++) {
95
- const row = i < data.length ? data[i] : null;
96
-
97
- // 检查每一级分组是否发生变化
98
- for (let level = config.groupFields.length - 1; level >= 0; level--) {
99
- const field = config.groupFields[level];
100
- const currentValue = row ? row[field] : null;
101
- const info = subtotalInfo[level];
102
-
103
- // 如果是数据末尾或分组值变化
104
- if (row === null || currentValue !== info.currentValue) {
105
- // 如果存在前一个分组,计算并插入小计
106
- if (info.currentValue !== null) {
107
- const startPos = info.startIndex;
108
- const endPos = i;
109
- const groupRows = data.slice(startPos, endPos);
110
-
111
- // 只计算未排除的行
112
- const validRows = config.excludeSubtotalRows
113
- ? groupRows.filter(r => !r._excludedFromSubtotal)
114
- : groupRows;
115
-
116
- if (validRows.length > 0) {
117
- const subtotalRow = createSubtotalRow(
118
- info.currentValue,
119
- level,
120
- validRows,
121
- config,
122
- allSumFields
123
- );
124
-
125
- // 记录小计行插入位置
126
- info.subtotalRows.push({
127
- row: subtotalRow,
128
- insertAfter: endPos - 1,
129
- level
130
- });
131
- }
132
- }
133
-
134
- // 更新分组信息
135
- info.currentValue = currentValue;
136
- info.startIndex = i;
137
- }
138
- }
139
-
140
- // 添加原始数据行
141
- if (row) {
142
- result.push(row);
143
- }
144
- }
145
-
146
- // 插入小计行(从最深层开始)
147
- for (let level = config.groupFields.length - 1; level >= 0; level--) {
148
- const info = subtotalInfo[level];
149
- info.subtotalRows.reverse().forEach(({ row, insertAfter }) => {
150
- // 找到插入位置(考虑已插入的小计行)
151
- const actualPosition = findInsertPosition(result, insertAfter);
152
- result.splice(actualPosition + 1, 0, row);
153
- });
154
- }
155
-
156
- // 添加总计行
157
- if (config.showTotal) {
158
- const validRows = config.excludeSubtotalRows
159
- ? data.filter(row => !row._excludedFromSubtotal)
160
- : data;
161
-
162
- const totalRow = createTotalRow(validRows, config, allSumFields);
163
- result.push(totalRow);
164
- }
165
-
166
- return result;
167
- }
168
-
169
- /**
170
- * 创建小计行
171
- */
172
- function createSubtotalRow(groupValue, level, groupRows, config, allSumFields) {
173
- const subtotalRow = {
174
- _isSubtotal: true,
175
- _subtotalLevel: level,
176
- _rowType: "subtotal",
177
- _groupValue: groupValue
178
- };
179
-
180
- // 设置分组字段
181
- config.groupFields.forEach((field, index) => {
182
- if (index === level) {
183
- subtotalRow[field] = `${config.subtotalLabel}`;
184
- } else if (index < level) {
185
- subtotalRow[field] = groupRows[0][field];
186
- } else {
187
- subtotalRow[field] = "";
188
- }
189
- });
190
-
191
- // 计算数值
192
- calculateRowValues(subtotalRow, groupRows, config, allSumFields);
193
-
194
- return subtotalRow;
195
- }
196
-
197
- /**
198
- * 创建总计行
199
- */
200
- function createTotalRow(allRows, config, allSumFields) {
201
- const totalRow = {
202
- _isSubtotal: true,
203
- _isTotal: true,
204
- _rowType: "total",
205
- _subtotalLevel: -1
206
- };
207
-
208
- // 设置分组字段
209
- if (config.groupFields.length > 0) {
210
- totalRow[config.groupFields[0]] = config.totalLabel;
211
- for (let i = 1; i < config.groupFields.length; i++) {
212
- totalRow[config.groupFields[i]] = "";
213
- }
214
- }
215
-
216
- // 计算总计数值
217
- calculateRowValues(totalRow, allRows, config, allSumFields);
218
-
219
- return totalRow;
220
- }
221
-
222
- /**
223
- * 计算行数值(求和、平均等)
224
- */
225
- function calculateRowValues(targetRow, sourceRows, config, allSumFields) {
226
- // 求和字段
227
- config.sumFields.forEach(field => {
228
- const sum = sourceRows.reduce((total, row) => {
229
- const value = parseFloat(row[field]);
230
- return total + (isNaN(value) ? 0 : value);
231
- }, 0);
232
-
233
- targetRow[field] = config.formatNumbers ? formatNumber(sum) : sum;
234
- });
235
-
236
- // 平均字段
237
- config.avgFields.forEach(field => {
238
- const sum = sourceRows.reduce((total, row) => {
239
- const value = parseFloat(row[field]);
240
- return total + (isNaN(value) ? 0 : value);
241
- }, 0);
242
-
243
- const avg = sourceRows.length > 0 ? sum / sourceRows.length : 0;
244
- targetRow[field] = config.formatNumbers ? formatNumber(avg) : avg;
245
- });
246
-
247
- // 计数字段(去重计数)
248
- config.countFields.forEach(field => {
249
- const uniqueValues = new Set(sourceRows.map(row => row[field]).filter(v => v != null));
250
- targetRow[field] = uniqueValues.size;
251
- });
252
-
253
- // 自定义计算
254
- Object.entries(config.customCalculations).forEach(([field, calculator]) => {
255
- if (typeof calculator === "function") {
256
- targetRow[field] = calculator(sourceRows, field);
257
- }
258
- });
259
- }
260
-
261
- /**
262
- * 格式化数字
263
- */
264
- function formatNumber(num) {
265
- if (typeof num !== "number" || isNaN(num)) return num;
266
-
267
- // 整数不加小数位
268
- if (Number.isInteger(num)) {
269
- return num.toLocaleString();
270
- }
271
-
272
- // 小数保留两位
273
- return num.toLocaleString("zh-CN", {
274
- minimumFractionDigits: 2,
275
- maximumFractionDigits: 2
276
- });
277
- }
278
-
279
- /**
280
- * 查找插入位置(考虑已插入的行)
281
- */
282
- function findInsertPosition(data, originalIndex) {
283
- const currentIndex = originalIndex;
284
- let insertedRowsCount = 0;
285
-
286
- // 统计已插入的小计行数量
287
- for (let i = 0; i <= originalIndex; i++) {
288
- if (data[i] && data[i]._isSubtotal && !data[i]._isTotal) {
289
- insertedRowsCount++;
290
- }
291
- }
292
-
293
- return originalIndex + insertedRowsCount;
294
- }
295
-
296
- /**
297
- * 数据后处理
298
- */
299
- function postprocessData(data, config) {
300
- return data.map(row => {
301
- // 为小计行和总计行添加样式类
302
- if (row._isSubtotal) {
303
- return {
304
- ...row,
305
- _rowClass: row._isTotal ? "total-row" : `subtotal-level-${row._subtotalLevel}`
306
- };
307
- }
308
- return row;
309
- });
310
- }
311
-
312
- /**
313
- * 快速使用函数:简单小计
314
- */
315
- export function quickSubtotal(data, groupBy, sumFields, options = {}) {
316
- return enhanceWithSubtotal(data, {
317
- groupFields: Array.isArray(groupBy) ? groupBy : [groupBy],
318
- sumFields: Array.isArray(sumFields) ? sumFields : [sumFields],
319
- ...options
320
- });
321
- }
322
-
323
- /**
324
- * 计算分组统计信息(不插入行)
325
- */
326
- export function calculateGroupStats(data, groupFields, calcFields) {
327
- const stats = {};
328
-
329
- function processLevel(rows, level = 0, path = []) {
330
- if (level >= groupFields.length) return;
331
-
332
- const field = groupFields[level];
333
- const groups = {};
334
-
335
- rows.forEach(row => {
336
- const key = row[field] || "";
337
- if (!groups[key]) groups[key] = [];
338
- groups[key].push(row);
339
- });
340
-
341
- Object.entries(groups).forEach(([value, groupRows]) => {
342
- const currentPath = [...path, { field, value }];
343
- const pathKey = currentPath.map(p => `${p.field}:${p.value}`).join("|");
344
-
345
- // 计算统计信息
346
- const calculations = {};
347
- calcFields.forEach(calcField => {
348
- if (typeof calcField === "string") {
349
- calculations[calcField] = groupRows.reduce((sum, row) =>
350
- sum + (parseFloat(row[calcField]) || 0), 0);
351
- } else if (typeof calcField === "object") {
352
- // 支持复杂计算配置
353
- const { field: calcFieldName, type = "sum" } = calcField;
354
- if (type === "sum") {
355
- calculations[calcFieldName] = groupRows.reduce((sum, row) =>
356
- sum + (parseFloat(row[calcFieldName]) || 0), 0);
357
- } else if (type === "avg") {
358
- const sum = groupRows.reduce((s, row) => s + (parseFloat(row[calcFieldName]) || 0), 0);
359
- calculations[calcFieldName] = groupRows.length > 0 ? sum / groupRows.length : 0;
360
- }
361
- }
362
- });
363
-
364
- stats[pathKey] = {
365
- path: currentPath,
366
- value,
367
- level,
368
- count: groupRows.length,
369
- calculations,
370
- rows: groupRows
371
- };
372
-
373
- // 递归处理下一层
374
- processLevel(groupRows, level + 1, currentPath);
375
- });
376
- }
377
-
378
- processLevel(data);
379
- return stats;
380
- }