lw-cdp-ui 1.4.29 → 1.4.30
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.
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
v-for="(parsedItem, parsedIndex) in parsedData"
|
|
5
5
|
:key="parsedIndex"
|
|
6
6
|
class="chart-title-card"
|
|
7
|
-
:style="{ height, padding: paddingDefault }">
|
|
7
|
+
:style="{ height: cardHeight, padding: paddingDefault }">
|
|
8
8
|
<template v-for="(item, index) in parsedItem" :key="item.name">
|
|
9
9
|
<template v-if="index === 0">
|
|
10
10
|
<div>
|
|
@@ -68,6 +68,11 @@
|
|
|
68
68
|
<script>
|
|
69
69
|
export default {
|
|
70
70
|
name: 'MetricCard',
|
|
71
|
+
data() {
|
|
72
|
+
return {
|
|
73
|
+
cardHeight: 0
|
|
74
|
+
}
|
|
75
|
+
},
|
|
71
76
|
props: {
|
|
72
77
|
rawData: {
|
|
73
78
|
type: Object,
|
|
@@ -76,7 +81,7 @@ export default {
|
|
|
76
81
|
},
|
|
77
82
|
height: {
|
|
78
83
|
type: String,
|
|
79
|
-
default: '
|
|
84
|
+
default: ''
|
|
80
85
|
},
|
|
81
86
|
subtitle: { type: String, default: '同比变化' },
|
|
82
87
|
tooltip: { type: String, default: '' }
|
|
@@ -93,6 +98,13 @@ export default {
|
|
|
93
98
|
})
|
|
94
99
|
.filter(Boolean)
|
|
95
100
|
|
|
101
|
+
// 处理处理高度
|
|
102
|
+
if (!this.height) {
|
|
103
|
+
this.cardHeight = 200 + (visibleTables.length - 2) * 10 + 'px'
|
|
104
|
+
} else {
|
|
105
|
+
this.cardHeight = this.height
|
|
106
|
+
}
|
|
107
|
+
|
|
96
108
|
return this.transformData(visibleTables, setting)
|
|
97
109
|
},
|
|
98
110
|
columns() {
|
package/dist/lw-cdp-ui.esm.js
CHANGED
|
@@ -20781,6 +20781,11 @@ function bA(e, t, n, r, a, o) {
|
|
|
20781
20781
|
}
|
|
20782
20782
|
const Zc = /* @__PURE__ */ ae(yA, [["render", bA], ["__scopeId", "data-v-7818b7b4"]]), CA = {
|
|
20783
20783
|
name: "MetricCard",
|
|
20784
|
+
data() {
|
|
20785
|
+
return {
|
|
20786
|
+
cardHeight: 0
|
|
20787
|
+
};
|
|
20788
|
+
},
|
|
20784
20789
|
props: {
|
|
20785
20790
|
rawData: {
|
|
20786
20791
|
type: Object,
|
|
@@ -20790,7 +20795,7 @@ const Zc = /* @__PURE__ */ ae(yA, [["render", bA], ["__scopeId", "data-v-7818b7b
|
|
|
20790
20795
|
},
|
|
20791
20796
|
height: {
|
|
20792
20797
|
type: String,
|
|
20793
|
-
default: "
|
|
20798
|
+
default: ""
|
|
20794
20799
|
},
|
|
20795
20800
|
subtitle: { type: String, default: "同比变化" },
|
|
20796
20801
|
tooltip: { type: String, default: "" }
|
|
@@ -20802,7 +20807,7 @@ const Zc = /* @__PURE__ */ ae(yA, [["render", bA], ["__scopeId", "data-v-7818b7b
|
|
|
20802
20807
|
const [i, l] = o.split(".");
|
|
20803
20808
|
return n.find((s) => s.name === i && s.metricId === l);
|
|
20804
20809
|
}).filter(Boolean);
|
|
20805
|
-
return this.transformData(r, e);
|
|
20810
|
+
return this.height ? this.cardHeight = this.height : this.cardHeight = 200 + (r.length - 2) * 10 + "px", this.transformData(r, e);
|
|
20806
20811
|
},
|
|
20807
20812
|
columns() {
|
|
20808
20813
|
var e, t;
|
|
@@ -20863,7 +20868,7 @@ function _A(e, t, n, r, a, o) {
|
|
|
20863
20868
|
(m(!0), B(Q, null, ne(o.parsedData, (u, d) => (m(), B("div", {
|
|
20864
20869
|
key: d,
|
|
20865
20870
|
class: "chart-title-card",
|
|
20866
|
-
style: ve({ height:
|
|
20871
|
+
style: ve({ height: a.cardHeight, padding: o.paddingDefault })
|
|
20867
20872
|
}, [
|
|
20868
20873
|
(m(!0), B(Q, null, ne(u, (f, y) => {
|
|
20869
20874
|
var _, E, x, F, O, D, I, K, W, T, Y, P, ee, q, J, te, re, z, ie, g, G, X, Be, Me, Ve, le, Ae, ze;
|
|
@@ -20935,7 +20940,7 @@ function _A(e, t, n, r, a, o) {
|
|
|
20935
20940
|
], 4))), 128))
|
|
20936
20941
|
], 4);
|
|
20937
20942
|
}
|
|
20938
|
-
const Yc = /* @__PURE__ */ ae(CA, [["render", _A], ["__scopeId", "data-v-
|
|
20943
|
+
const Yc = /* @__PURE__ */ ae(CA, [["render", _A], ["__scopeId", "data-v-a1312350"]]), IA = {
|
|
20939
20944
|
name: "GaugeChart",
|
|
20940
20945
|
props: {
|
|
20941
20946
|
rawData: {
|
package/dist/lw-cdp-ui.umd.js
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
<span style="display:inline-block;width:10px;height:10px;border-radius:50%;background:${n.color};margin-right:5px;"></span>
|
|
22
22
|
${n.seriesName}: ${n.value}
|
|
23
23
|
</div>
|
|
24
|
-
`).join("")},getLegendOption(t,n){var o,a,r,l,i,s,c,h,p,f;return{show:((o=t.legend)==null?void 0:o.show)!==!1,type:((a=t.legend)==null?void 0:a.type)||"scroll",orient:((r=t.legend)==null?void 0:r.orient)||"horizontal",left:((l=t.legend)==null?void 0:l.left)||"left",top:((i=t.legend)==null?void 0:i.top)||"top",padding:((s=t.legend)==null?void 0:s.padding)||[5,5,5,5],itemGap:((c=t.legend)==null?void 0:c.itemGap)||10,itemWidth:((h=t.legend)==null?void 0:h.itemWidth)||14,itemHeight:((p=t.legend)==null?void 0:p.itemHeight)||14,textStyle:{fontSize:12,...(f=t.legend)==null?void 0:f.textStyle}}},getGridOption(t){if(t.grid)return{containLabel:!0,...t.grid}},getToolboxOption(t){var n,o,a,r;if(!(!t.toolbox||t.toolbox.show===!1))return{...t.toolbox,feature:{...t.toolbox.feature||{},saveAsImage:(o=(n=t.toolbox.feature)==null?void 0:n.saveAsImage)!=null&&o.show?{type:"png",pixelRatio:2,...t.toolbox.feature.saveAsImage}:void 0,dataView:(r=(a=t.toolbox.feature)==null?void 0:a.dataView)!=null&&r.show?{readOnly:!0,...t.toolbox.feature.dataView}:void 0}}},getXAxisOption(t){return{type:"category",boundaryGap:!1,data:t[0].headers,axisLabel:{rotate:30,interval:0}}},getYAxisOption(t){var n;return{type:"value",axisLabel:{formatter:((n=t.yAxis)==null?void 0:n.formatter)||this.defaultYAxisFormatter},...t.yAxis}},defaultYAxisFormatter(t){return t>=1e4?(t/1e4).toFixed(1)+"万":t>=1e3?(t/1e3).toFixed(1)+"k":t},getSeriesData(t,n){let o=[];return n.map((a,r)=>{a.rows.map(l=>{var i,s,c,h,p,f,y,w,b,B,V,F,S,E,q,v,_,P,L,G,N,Q,H,Z,M,K,g;o.push({name:l.name,type:"line",stack:((i=t.series)==null?void 0:i.stack)||"total",areaStyle:{opacity:((c=(s=t.series)==null?void 0:s.areaStyle)==null?void 0:c.opacity)||.8,color:(p=(h=t.series)==null?void 0:h.areaStyle)==null?void 0:p.color,...((f=t.series)==null?void 0:f.areaStyle)||{}},emphasis:{focus:((w=(y=t.series)==null?void 0:y.emphasis)==null?void 0:w.focus)||"series"},smooth:((b=t.series)==null?void 0:b.smooth)!==!1,symbol:((B=t.series)==null?void 0:B.symbol)||"circle",symbolSize:((V=t.series)==null?void 0:V.symbolSize)||6,lineStyle:{width:((S=(F=t.series)==null?void 0:F.lineStyle)==null?void 0:S.width)||2,type:(q=(E=t.series)==null?void 0:E.lineStyle)==null?void 0:q.type,color:(_=(v=t.series)==null?void 0:v.lineStyle)==null?void 0:_.color,...((P=t.series)==null?void 0:P.lineStyle)||{}},data:l.values,label:{show:((G=(L=t.series)==null?void 0:L.label)==null?void 0:G.show)||!1,position:((Q=(N=t.series)==null?void 0:N.label)==null?void 0:Q.position)||"top",formatter:((Z=(H=t.series)==null?void 0:H.label)==null?void 0:Z.formatter)||"{@value}",fontSize:((K=(M=t.series)==null?void 0:M.label)==null?void 0:K.fontSize)||12,...((g=t.series)==null?void 0:g.label)||{}},...t.series||{}})})}),o}}};function Ag(t,n,o,a,r,l){return e.openBlock(),e.createElementBlock("div",{ref:"chartRef",class:e.normalizeClass({chart:o.isBi}),style:e.normalizeStyle({height:o.height})},null,6)}const Dd=j(yg,[["render",Ag],["__scopeId","data-v-7818b7b4"]]),bg={name:"MetricCard",props:{rawData:{type:Object,required:!0,default:()=>({})},height:{type:String,default:"300px"},subtitle:{type:String,default:"同比变化"},tooltip:{type:String,default:""}},computed:{parsedData(){var r;const{setting:t,dataSet:n}=this.rawData,{tables:o}=n,a=(r=t==null?void 0:t.displayMetrics)==null?void 0:r.map(l=>{const[i,s]=l.split(".");return o.find(c=>c.name===i&&c.metricId===s)}).filter(Boolean);return this.transformData(a,t)},columns(){var t,n;return((t=this.parsedData)==null?void 0:t.length)<this.rawData.setting.columnCount?(n=this.parsedData)==null?void 0:n.length:this.rawData.setting.columnCount},paddingDefault(){var t,n,o,a,r,l,i,s;return[`${(n=(t=this.rawData.setting)==null?void 0:t.grid)==null?void 0:n.top}px`||0,`${(a=(o=this.rawData.setting)==null?void 0:o.grid)==null?void 0:a.right}px`||0,`${(l=(r=this.rawData.setting)==null?void 0:r.grid)==null?void 0:l.bottom}px`||0,`${(s=(i=this.rawData.setting)==null?void 0:i.grid)==null?void 0:s.left}px`||0]},titleLeftRight(){var o;let{left:t}=((o=this.rawData.setting)==null?void 0:o.title)||{},n={};return t=="left"?n.left=0:t=="center"?(n.left="50%",n.transform="translateX(-50%)"):(n.left="auto",n.right=0),n},legendLeftRight(){var a;let{left:t,top:n}=((a=this.rawData.setting)==null?void 0:a.legend)||{},o={};return t=="left"?o["justify-content"]="flex-start":t=="center"?o["justify-content"]="center":o["justify-content"]="flex-end",n=="top"?o["align-items"]="flex-start":n=="bottom"?o["align-items"]="flex-end":n=="middle"&&(o["align-items"]="center"),o}},methods:{transformData(t,n){const o=[],a=Math.max(...t.map(r=>r.headers.length));for(let r=0;r<a;r++){const l=[];t.forEach(i=>{if(r<i.headers.length){const s=i.headers[r],c=i.metricName,h=i.rows[0].values[r];l.push({name:s!=c?`${s}-${c}`:c,unit:i.unit,unitName:i.unitName,unit:i.unit,setting:n,value:h})}}),l.length>0&&o.push(l)}return o}}},wg={key:0},Eg={key:2,class:"statistic-item"},Bg={class:"number"};function kg(t,n,o,a,r,l){const i=e.resolveComponent("el-icon-warning"),s=e.resolveComponent("el-icon"),c=e.resolveComponent("el-tooltip");return e.openBlock(),e.createElementBlock("div",{class:"chart-title-card-list",style:e.normalizeStyle({gridTemplateColumns:`repeat(${l.columns||1}, 1fr)`})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.parsedData,(h,p)=>(e.openBlock(),e.createElementBlock("div",{key:p,class:"chart-title-card",style:e.normalizeStyle({height:o.height,padding:l.paddingDefault})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h,(f,y)=>{var w,b,B,V,F,S,E,q,v,_,P,L,G,N,Q,H,Z,M,K,g,R,z,me,be,Ee,W,le,Le;return e.openBlock(),e.createElementBlock(e.Fragment,{key:f.name},[y===0?(e.openBlock(),e.createElementBlock("div",wg,[(w=f.setting.title)!=null&&w.show?(e.openBlock(),e.createElementBlock("div",{key:0,class:"title-top",style:e.normalizeStyle({textAlign:((B=(b=f.setting)==null?void 0:b.title)==null?void 0:B.left)||"left",padding:((S=(F=(V=f.setting)==null?void 0:V.title)==null?void 0:F.padding)==null?void 0:S.map(we=>we+"px").join(" "))||0})},[e.createElementVNode("span",{style:e.normalizeStyle({color:((q=(E=f.setting.title)==null?void 0:E.textStyle)==null?void 0:q.color)||f.color,fontWeight:((_=(v=f.setting.title)==null?void 0:v.textStyle)==null?void 0:_.fontWeight)||"normal",fontSize:((L=(P=f.setting.title)==null?void 0:P.textStyle)==null?void 0:L.fontSize)+"px"||"17px"})},e.toDisplayString(f.name),5),f.tooltip?(e.openBlock(),e.createBlock(c,{key:0,effect:"dark",content:f.tooltip,placement:"top"},{default:e.withCtx(()=>[e.createVNode(s,{class:"icon-tooltip"},{default:e.withCtx(()=>[e.createVNode(i)]),_:1})]),_:2},1032,["content"])):e.createCommentVNode("",!0)],4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"statistic-current",style:e.normalizeStyle({...l.legendLeftRight,color:((N=(G=f.setting.legend)==null?void 0:G.textStyle)==null?void 0:N.color)||f.color,padding:((Z=(H=(Q=f.setting)==null?void 0:Q.legend)==null?void 0:H.padding)==null?void 0:Z.map(we=>we+"px").join(" "))||0,fontWeight:((K=(M=f.setting.legend)==null?void 0:M.textStyle)==null?void 0:K.fontWeight)||"bold",fontSize:((R=(g=f.setting.legend)==null?void 0:g.textStyle)==null?void 0:R.fontSize)+"px"||"17px"})},e.toDisplayString((z=f.value)==null?void 0:z.toLocaleString("en-US")),5)])):y==h.length-1?(e.openBlock(),e.createElementBlock("div",{key:1,class:"statistic-footer",style:e.normalizeStyle({left:((be=(me=o.rawData.setting)==null?void 0:me.grid)==null?void 0:be.left)+"px",bottom:((W=(Ee=o.rawData.setting)==null?void 0:Ee.grid)==null?void 0:W.bottom)+"px",right:((Le=(le=o.rawData.setting)==null?void 0:le.grid)==null?void 0:Le.right)+"px"})},[e.createElementVNode("span",null,e.toDisplayString(f.name),1),e.createElementVNode("div",{style:e.normalizeStyle({color:f.value>=0?"#BF1220":"#00B78B"})},e.toDisplayString(Math.abs(f.value))+" "+e.toDisplayString(f.unitName),5)],4)):(e.openBlock(),e.createElementBlock("div",Eg,[e.createElementVNode("span",null,e.toDisplayString(f.name),1),e.createElementVNode("div",Bg,e.toDisplayString(Math.abs(f.value))+" "+e.toDisplayString(f.unitName),1)]))],64)}),128))],4))),128))],4)}const Md=j(bg,[["render",kg],["__scopeId","data-v-998c0c93"]]),xg={name:"GaugeChart",props:{rawData:{type:Object,required:!0},height:{type:String,default:"300px"},isBi:{type:Boolean,default:!0}},data(){return{option:{},echarts:e.inject("echarts"),chart:null}},watch:{rawData:{handler:"updateChart",deep:!0,immediate:!0}},mounted(){this.$nextTick(()=>{this.initChart()})},beforeDestroy(){this.chart&&(this.chart.dispose(),this.chart=null)},methods:{initChart(){this.chart&&this.chart.dispose(),this.chart=e.markRaw(this.echarts.init(this.$refs.chartRef)),this.updateChart(),window.addEventListener("resize",()=>{this.chart&&this.chart.resize()})},updateChart(){if(!this.chart||!this.rawData)return;const{setting:t,dataSet:n,option:o}=this.rawData,{tables:a}=n||{};this.isBi?this.option={title:this.getTitleOption(t),tooltip:this.getTooltipOption(t),series:this.getSeriesData(t,a)}:this.option=o,this.option&&this.chart.setOption(this.option,!0),setTimeout(()=>{this.chart.resize()},10)},getTitleOption(t){var n,o,a,r,l,i;return{show:((n=t.title)==null?void 0:n.show)!==!1,text:((o=t.title)==null?void 0:o.text)||"",textStyle:{fontSize:16,fontWeight:"bold",color:"#333",...(a=t.title)==null?void 0:a.textStyle},left:((r=t.title)==null?void 0:r.left)||"center",top:((l=t.title)==null?void 0:l.top)||"top",padding:((i=t.title)==null?void 0:i.padding)||[5,5,5,5]}},getTooltipOption(t){var n;return{formatter:((n=t.tooltip)==null?void 0:n.formatter)||"{a} <br/>{b}: {c}"}},getMinMaxValues(t){const n=t.flatMap(r=>r.rows.flatMap(l=>l.values)),o=Math.min(...n),a=Math.max(...n);return{min:o,max:a}},getGridCenters(t){const n=t.length,o=Math.ceil(Math.sqrt(n)),a=Math.round(Math.sqrt(n)),r=[];for(let l=0;l<n;l++){const i=Math.floor(l/a),c=((l%a+.5)*(100/a)).toFixed(2)+"%",h=((i+.5)*(100/o)).toFixed(2)+"%";r.push([h,c])}return r},getSeriesData(t,n){let o=this.getGridCenters(n),a=[];return n.forEach((r,l)=>{a.push({type:"gauge",...this.getMinMaxValues(n),name:r.metricName,radius:`${90/n.length}%`,center:o[l],detail:{valueAnimation:!0,formatter:t.formatter||"{value}",color:"inherit",fontSize:14},data:this.parseGaugeData(r)})}),a},parseGaugeData(t){let n=[];return t.headers.forEach((o,a)=>{n.push({name:o,value:t.rows[0].values[a],title:{show:!1},detail:{show:!1}})}),n}}};function Vg(t,n,o,a,r,l){return e.openBlock(),e.createElementBlock("div",{ref:"chartRef",class:e.normalizeClass({chart:o.isBi}),style:e.normalizeStyle({height:o.height})},null,6)}const Rd=j(xg,[["render",Vg],["__scopeId","data-v-6b008f06"]]),_g={name:"FunnelChart",props:{rawData:{type:Object,required:!0},height:{type:String,default:"300px"},isBi:{type:Boolean,default:!0}},data(){return{option:{},echarts:e.inject("echarts"),chart:null}},watch:{rawData:{handler:"updateChart",deep:!0,immediate:!0}},mounted(){this.$nextTick(()=>{this.initChart()})},beforeDestroy(){this.chart&&(this.chart.dispose(),this.chart=null)},methods:{initChart(){this.chart&&this.chart.dispose(),this.chart=e.markRaw(this.echarts.init(this.$refs.chartRef)),this.updateChart(),window.addEventListener("resize",()=>{this.chart&&this.chart.resize()})},updateChart(){if(!this.chart||!this.rawData)return;const{setting:t,dataSet:n,option:o}=this.rawData,{tables:a}=n||{};this.isBi?this.option={title:t.title?this.getTitleOption(t):void 0,tooltip:t.tooltip?this.getTooltipOption(t):void 0,legend:t.legend?this.getLegendOption(t,a):void 0,grid:t.grid?this.getGridOption(t):void 0,series:this.getSeriesData(t,a),color:t.color}:this.option=o,this.option&&this.chart.setOption(this.option,!0),setTimeout(()=>{this.chart.resize()},10)},getTitleOption(t){var n,o,a,r,l,i;return{show:((n=t.title)==null?void 0:n.show)!==!1,text:((o=t.title)==null?void 0:o.text)||"",textStyle:{fontSize:16,fontWeight:"bold",color:"#333",...(a=t.title)==null?void 0:a.textStyle},left:((r=t.title)==null?void 0:r.left)||"center",top:((l=t.title)==null?void 0:l.top)||"top",padding:((i=t.title)==null?void 0:i.padding)||[5,5,5,5]}},getTooltipOption(t){const n=t.tooltip||{};return{show:n.show,trigger:"item",formatter:n.formatter||"{a} <br/>{b}: {c}"}},getLegendOption(t,n){var o,a,r,l,i,s,c,h,p,f;return{show:((o=t.legend)==null?void 0:o.show)!==!1,type:((a=t.legend)==null?void 0:a.type)||"scroll",orient:((r=t.legend)==null?void 0:r.orient)||"horizontal",left:((l=t.legend)==null?void 0:l.left)||"left",top:((i=t.legend)==null?void 0:i.top)||"top",padding:((s=t.legend)==null?void 0:s.padding)||[5,5,5,5],itemGap:((c=t.legend)==null?void 0:c.itemGap)||10,itemWidth:((h=t.legend)==null?void 0:h.itemWidth)||14,itemHeight:((p=t.legend)==null?void 0:p.itemHeight)||14,textStyle:{fontSize:12,...(f=t.legend)==null?void 0:f.textStyle}}},getGridOption(t){const n=t.grid||{};return{top:n.top,left:n.left,right:n.right,bottom:n.bottom,containLabel:n.containLabel}},getGridCenters(t,n={top:8,right:5,bottom:5,left:5}){const o=Math.ceil(Math.sqrt(t)),a=Math.round(Math.sqrt(t)),r=[];for(let l=0;l<t;l++){const i=Math.floor(l/a),c=(l%a*(100/a)+parseInt(n.top)).toFixed(2)+"%",h=(i*(90/o)+parseInt(n.left)).toFixed(2)+"%",p=((90-parseInt(n.right))/o).toFixed(2)+"%",f=((100-parseInt(n.bottom))/a).toFixed(2)+"%";r.push({left:h,top:c,width:p,height:f})}return r},getSeriesData(t,n){const o=n.reduce((s,c)=>s+c.rows.length,0),a=this.getGridCenters(o,t.grid),r=t.series||{},l=t.label||{};let i=[];return n.forEach((s,c)=>{s.rows.forEach((h,p)=>{var y,w;const f=c+p;i.push({name:s.metricName,type:"funnel",...a[f],label:{position:l.position||"inside",formatter:l.formatter||"{b}: {c}",color:l.color,fontSize:l.fontSize},labelLine:{length:l.length,lineStyle:{width:l.lineWidth,type:l.lineType}},itemStyle:{borderColor:r.borderColor||"#fff",borderWidth:r.borderWidth||1,borderRadius:r.borderRadius},emphasis:{label:{show:!0,fontSize:((w=(y=r.emphasis)==null?void 0:y.label)==null?void 0:w.fontSize)||16}},data:h.values.map((b,B)=>({value:b,name:s.headers[B]}))})})}),i}}};function Ig(t,n,o,a,r,l){return e.openBlock(),e.createElementBlock("div",{ref:"chartRef",class:e.normalizeClass({chart:o.isBi}),style:e.normalizeStyle({height:o.height})},null,6)}const Od=j(_g,[["render",Ig],["__scopeId","data-v-3708b699"]]),Sg={name:"ScatterChart",props:{rawData:{type:Object,required:!0},height:{type:String,default:"300px"},isBi:{type:Boolean,default:!0}},data(){return{option:{},echarts:e.inject("echarts"),chart:null}},watch:{rawData:{handler:"updateChart",deep:!0,immediate:!0}},mounted(){this.$nextTick(()=>{this.initChart()})},beforeDestroy(){this.chart&&(this.chart.dispose(),this.chart=null)},methods:{initChart(){this.chart&&this.chart.dispose(),this.chart=e.markRaw(this.echarts.init(this.$refs.chartRef)),this.updateChart(),window.addEventListener("resize",()=>{this.chart&&this.chart.resize()})},updateChart(){if(!this.chart||!this.rawData)return;const{setting:t,dataSet:n,option:o}=this.rawData,{tables:a}=n||{};this.isBi?this.option={title:this.getTitleOption(t),tooltip:this.getTooltipOption(t),legend:this.getLegendOption(t,a),grid:this.getGridOption(t),xAxis:this.getXAxisOption(t,a),yAxis:this.getYAxisOption(t),visualMap:this.getVisualMapOption(t,a),series:this.getSeriesData(t,a),color:t.useThemeColor?void 0:t.color||this.getDefaultColors(),toolbox:this.getToolboxOption(t)}:this.option=o,this.option&&this.chart.setOption(this.option,!0),setTimeout(()=>{this.chart.resize()},10)},getTitleOption(t){var n,o,a,r,l,i;return{show:((n=t.title)==null?void 0:n.show)!==!1,text:((o=t.title)==null?void 0:o.text)||"",textStyle:{fontSize:16,fontWeight:"bold",color:"#333",...(a=t.title)==null?void 0:a.textStyle},left:((r=t.title)==null?void 0:r.left)||"center",top:((l=t.title)==null?void 0:l.top)||"top",padding:((i=t.title)==null?void 0:i.padding)||[5,5,5,5]}},getTooltipOption(t){var n,o;return{show:((n=t.tooltip)==null?void 0:n.show)!==!1,trigger:"item",formatter:((o=t.tooltip)==null?void 0:o.formatter)||(a=>{const r=a.data;return`${a.seriesName}<br/>${a.name}: (${r[1]})`})}},getLegendOption(t,n){var o,a,r,l,i,s,c,h,p,f;return{show:((o=t.legend)==null?void 0:o.show)!==!1,type:((a=t.legend)==null?void 0:a.type)||"scroll",orient:((r=t.legend)==null?void 0:r.orient)||"horizontal",left:((l=t.legend)==null?void 0:l.left)||"left",top:((i=t.legend)==null?void 0:i.top)||"top",padding:((s=t.legend)==null?void 0:s.padding)||[5,5,5,5],itemGap:((c=t.legend)==null?void 0:c.itemGap)||10,itemWidth:((h=t.legend)==null?void 0:h.itemWidth)||14,itemHeight:((p=t.legend)==null?void 0:p.itemHeight)||14,textStyle:{fontSize:12,...(f=t.legend)==null?void 0:f.textStyle}}},getGridOption(t){var n,o,a,r,l;return{left:((n=t.grid)==null?void 0:n.left)||"20",right:((o=t.grid)==null?void 0:o.right)||"20",top:((a=t.grid)==null?void 0:a.top)||"50",bottom:((r=t.grid)==null?void 0:r.bottom)||"20",containLabel:((l=t.grid)==null?void 0:l.containLabel)!==!1}},getXAxisOption(t,n){var o,a,r;return{type:"category",name:((o=t.xAxis)==null?void 0:o.name)||"",data:((a=n[0])==null?void 0:a.headers)||[],axisLabel:((r=t.xAxis)==null?void 0:r.axisLabel)||{},splitLine:{lineStyle:{type:"dashed"}}}},getYAxisOption(t){var n,o;return{type:"value",name:((n=t.yAxis)==null?void 0:n.name)||"",axisLabel:((o=t.yAxis)==null?void 0:o.axisLabel)||{},splitLine:{lineStyle:{type:"dashed"}}}},getVisualMapOption(t,n){var l,i,s,c,h,p,f,y,w;if(!t.visualMap||t.visualMap.top==="-10000")return null;const o=n.flatMap(b=>b.rows.flatMap(B=>B.values.filter(V=>typeof V=="number"&&isFinite(V)))),a=o.length?Math.max(...o):100,r=o.length?Math.min(...o):0;return{left:((l=t.visualMap)==null?void 0:l.left)||"right",top:((i=t.visualMap)==null?void 0:i.top)||"bottom",dimension:((s=t.visualMap)==null?void 0:s.dimension)||2,min:((c=t.visualMap)==null?void 0:c.min)??r,max:((h=t.visualMap)==null?void 0:h.max)??a,itemWidth:((p=t.visualMap)==null?void 0:p.itemWidth)||20,itemHeight:((f=t.visualMap)==null?void 0:f.itemHeight)||120,calculable:((y=t.visualMap)==null?void 0:y.calculable)||!1,inRange:((w=t.visualMap)==null?void 0:w.inRange)||{symbolSize:[0,50]},text:["高","低"]}},getSeriesData(t,n){let o=[];return n.map((a,r)=>{a.rows.map((l,i)=>{var s,c;o.push({name:n.length>1?a.metricName:a.metricName+"-"+l.name,type:"scatter",symbolSize:t.symbolSize||10,data:a.headers.map((h,p)=>{const f=a.rows[i].values[p];return[h,typeof f=="number"&&isFinite(f)?f:0,typeof f=="number"&&isFinite(f)?f:0]}),label:{show:((s=t.label)==null?void 0:s.show)||!1,formatter:((c=t.label)==null?void 0:c.formatter)||"{b}"}})})}),o},getToolboxOption(t){var n,o,a,r,l;if((n=t.toolbox)!=null&&n.show)return{show:!0,feature:{saveAsImage:{show:((a=(o=t.toolbox.feature)==null?void 0:o.saveAsImage)==null?void 0:a.show)||!1},dataView:{show:((l=(r=t.toolbox.feature)==null?void 0:r.dataView)==null?void 0:l.show)||!1}}}},getItemStyleOption(t){return t.itemStyle||{opacity:.8,shadowBlur:10,shadowColor:"rgba(0, 0, 0, 0.5)"}},getDefaultColors(){return["#5E9CC5","#FF7300","#14C566","#FF5E50","#BB83C0","#B77366","#FF8FC0","#A4A69C","#CFD162"]}}};function Fg(t,n,o,a,r,l){return e.openBlock(),e.createElementBlock("div",{ref:"chartRef",class:e.normalizeClass({chart:o.isBi}),style:e.normalizeStyle({height:o.height})},null,6)}const Pd=j(Sg,[["render",Fg],["__scopeId","data-v-f1780bc1"]]),Lg={name:"RadarChart",props:{rawData:{type:Object,required:!0},height:{type:String,default:"300px"},isBi:{type:Boolean,default:!0}},data(){return{option:{},echarts:e.inject("echarts"),chart:null}},watch:{rawData:{handler:"updateChart",deep:!0,immediate:!0}},mounted(){this.$nextTick(()=>{this.initChart()})},beforeDestroy(){this.chart&&(this.chart.dispose(),this.chart=null)},methods:{initChart(){this.chart&&this.chart.dispose(),this.chart=e.markRaw(this.echarts.init(this.$refs.chartRef)),this.updateChart(),window.addEventListener("resize",()=>{this.chart&&this.chart.resize()})},updateChart(){if(!this.chart||!this.rawData)return;const{setting:t,dataSet:n,option:o}=this.rawData,{tables:a}=n||{};this.isBi?this.option={title:this.getTitleOption(t),tooltip:this.getTooltipOption(t),legend:this.getLegendOption(t,a),radar:this.getRadarOption(t,a),series:this.getSeriesData(t,a),color:t.color||this.getDefaultColors()}:this.option=o,this.option&&this.chart.setOption(this.option,!0),setTimeout(()=>{this.chart.resize()},10)},getTitleOption(t){var n,o,a,r,l,i;return{show:((n=t.title)==null?void 0:n.show)!==!1,text:((o=t.title)==null?void 0:o.text)||"",textStyle:{fontSize:16,fontWeight:"bold",color:"#333",...(a=t.title)==null?void 0:a.textStyle},left:((r=t.title)==null?void 0:r.left)||"center",top:((l=t.title)==null?void 0:l.top)||"top",padding:((i=t.title)==null?void 0:i.padding)||[5,5,5,5]}},getTooltipOption(t){var n;return{trigger:"item",formatter:((n=t.tooltip)==null?void 0:n.formatter)||"{a} <br/>{b}: {c}"}},getLegendOption(t,n){var o,a;return{show:((o=t.legend)==null?void 0:o.show)!==!1,textStyle:((a=t.legend)==null?void 0:a.textStyle)||{fontSize:12}}},getRadarOption(t,n){return{indicator:n[0].headers.map((o,a)=>({name:o,max:t.maxValue||Math.max(...n.flatMap(r=>r.rows.flatMap(l=>l.values)))*1.2})),radius:t.radius||"65%",splitNumber:t.splitNumber||5,axisName:{color:t.axisNameColor||"#333"},splitArea:{show:t.showSplitArea!==!1},splitLine:{lineStyle:{color:t.splitLineColor||["rgba(0, 0, 0, 0.1)"]}},axisLine:{lineStyle:{color:t.axisLineColor||"rgba(0, 0, 0, 0.2)"}}}},getSeriesData(t,n){return n.map(o=>{var a,r;return{name:o.metricName,type:"radar",data:[{value:o.rows[0].values,name:o.metricName,areaStyle:t.showArea!==!1?{opacity:.4}:void 0,lineStyle:{width:t.lineWidth||2},symbol:t.symbol||"circle",symbolSize:t.symbolSize||6,label:{show:((a=t.label)==null?void 0:a.show)||!1,formatter:((r=t.label)==null?void 0:r.formatter)||"{c}"}}]}})},getDefaultColors(){return["#3A4DE9","#4BC0C0","#FF9F43","#ED5565","#A0A7E6","#67C23A","#E6A23C","#F56C6C","#909399"]}}};function Ng(t,n,o,a,r,l){return e.openBlock(),e.createElementBlock("div",{ref:"chartRef",class:e.normalizeClass({chart:o.isBi}),style:e.normalizeStyle({height:o.height})},null,6)}const qd=j(Lg,[["render",Ng],["__scopeId","data-v-88abf5da"]]),Tg={name:"MapChart",props:{rawData:{type:Object,required:!0},height:{type:String,default:"300px"},isBi:{type:Boolean,default:!0}},data(){return{option:{},echarts:e.inject("echarts"),chart:null}},watch:{rawData:{handler:"updateChart",deep:!0,immediate:!0}},mounted(){this.$nextTick(()=>{this.initChart()})},beforeDestroy(){this.chart&&(this.chart.dispose(),this.chart=null)},methods:{async initChart(){this.chart&&this.chart.dispose(),this.chart=e.markRaw(this.echarts.init(this.$refs.chartRef)),this.updateChart(),window.addEventListener("resize",()=>{this.chart&&this.chart.resize()})},async updateChart(){var l,i,s,c;if(!this.chart||!this.rawData)return;const{setting:t,dataSet:n,option:o}=this.rawData,{tables:a}=n||{};this.isBi?this.option={title:this.getTitleOption(t),tooltip:this.getTooltipOption(),legend:this.getLegendOption(t,a),visualMap:this.getVisualMapOption(t,a),series:this.getSeriesData(t,a)}:this.option=o;const r=await this.$http.get(`/${this.$config.APP_NAME.toLowerCase()}/map/${((i=(l=this.rawData)==null?void 0:l.setting)==null?void 0:i.mapName)||"china"}.json`);this.echarts.registerMap(((c=(s=this.rawData)==null?void 0:s.setting)==null?void 0:c.mapName)||"china",r),this.option&&this.chart.setOption(this.option,!0),setTimeout(()=>{this.chart.resize()},10)},getTitleOption(t){var n,o,a,r,l,i;return{show:((n=t.title)==null?void 0:n.show)!==!1,text:((o=t.title)==null?void 0:o.text)||"",textStyle:{fontSize:16,fontWeight:"bold",color:"#333",...(a=t.title)==null?void 0:a.textStyle},left:((r=t.title)==null?void 0:r.left)||"center",top:((l=t.title)==null?void 0:l.top)||"top",padding:((i=t.title)==null?void 0:i.padding)||[5,5,5,5]}},getTooltipOption(){return{trigger:"item",showDelay:0,transitionDuration:.2}},getLegendOption(t,n){var o,a,r,l,i,s,c,h,p,f;return{show:((o=t.legend)==null?void 0:o.show)!==!1,type:((a=t.legend)==null?void 0:a.type)||"scroll",orient:((r=t.legend)==null?void 0:r.orient)||"horizontal",left:((l=t.legend)==null?void 0:l.left)||"left",top:((i=t.legend)==null?void 0:i.top)||"top",padding:((s=t.legend)==null?void 0:s.padding)||[5,5,5,5],itemGap:((c=t.legend)==null?void 0:c.itemGap)||10,itemWidth:((h=t.legend)==null?void 0:h.itemWidth)||14,itemHeight:((p=t.legend)==null?void 0:p.itemHeight)||14,textStyle:{fontSize:12,...(f=t.legend)==null?void 0:f.textStyle}}},getVisualMapOption(t,n){const o=n.flatMap(l=>l.rows.flatMap(i=>i.values)),a=Math.max(...o);return{min:Math.min(...o),max:a,text:["高","低"],realtime:!1,calculable:!0,inRange:{color:t.visualMapColors||["#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]},textStyle:{color:t.visualMapTextColor||"#333"}}},getSeriesData(t,n){const o=n.filter(r=>{var l;return(l=t==null?void 0:t.displayMetrics)==null?void 0:l.includes(`${r.name}.${r.metricId}`)});let a=[];return o.forEach(r=>{r.rows.forEach(l=>{var i;a.push({name:l.name,type:"map",map:t.mapName||"china",roam:t.roam!==!1,label:{show:((i=t.label)==null?void 0:i.show)||!1,fontSize:10},emphasis:{label:{show:!0}},data:r.headers.map((s,c)=>{var h;return{name:s,value:((h=l.values)==null?void 0:h[c])||0}})})})}),a}}};function Dg(t,n,o,a,r,l){return e.openBlock(),e.createElementBlock("div",{ref:"chartRef",class:e.normalizeClass({chart:o.isBi}),style:e.normalizeStyle({height:o.height})},null,6)}const vd=j(Tg,[["render",Dg],["__scopeId","data-v-37b2533e"]]),Mg={name:"ReportTable",props:{rawData:{type:Object,required:!0},height:{type:String,default:"100%"},maxHeight:{type:String,default:null},border:{type:Boolean,default:!0},stripe:{type:Boolean,default:!0},size:{type:String,default:"default"},showPagination:{type:Boolean,default:!0},pageSizes:{type:Array,default:()=>[10,20,50,100]},pageSize:{type:Number,default:10}},data(){return{currentPage:1,total:0,tableData:[],metrics:[]}},computed:{pagedTableData(){const t=(this.currentPage-1)*this.pageSize,n=t+this.pageSize;return this.tableData.slice(t,n)}},watch:{rawData:{handler:"updateTable",deep:!0,immediate:!0}},methods:{updateTable(){const{dataSet:t}=this.rawData,n=t.tables;if(!n||n.length===0)return;const o=n[0].originalHeaders.map(a=>a.split(" ")[0]);this.metrics=n.map((a,r)=>({prop:`metric_${r}`,label:a.metricName})),this.tableData=o.map((a,r)=>{let l={time:a};return n.forEach((i,s)=>{l[`metric_${s}`]=i.rows[0].values[r]||0}),l}),this.total=this.tableData.length},handleSortChange({column:t,prop:n,order:o}){this.$emit("sort-change",{column:t,prop:n,order:o})},handleSizeChange(t){this.pageSize=t,this.currentPage=1},handleCurrentChange(t){this.currentPage=t}}},Rg={key:0,class:"pagination-container"};function Og(t,n,o,a,r,l){const i=e.resolveComponent("el-table-column"),s=e.resolveComponent("el-table"),c=e.resolveComponent("el-pagination");return e.openBlock(),e.createElementBlock("div",{class:"report-table-container",style:e.normalizeStyle({height:o.height})},[e.createVNode(s,{data:l.pagedTableData,border:o.border,stripe:o.stripe,size:o.size,"max-height":o.maxHeight,style:{width:"100%"},onSortChange:l.handleSortChange},{default:e.withCtx(()=>[e.createVNode(i,{prop:"time",label:"交易时间",sortable:"",align:"center",width:"180"}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.metrics,(h,p)=>(e.openBlock(),e.createBlock(i,{key:p,prop:h.prop,label:h.label,sortable:"",align:"center"},null,8,["prop","label"]))),128))]),_:1},8,["data","border","stripe","size","max-height","onSortChange"]),o.showPagination?(e.openBlock(),e.createElementBlock("div",Rg,[e.createVNode(c,{"current-page":r.currentPage,"page-sizes":o.pageSizes,"page-size":o.pageSize,size:"small",layout:"total, sizes, prev, pager, next, jumper",total:r.total,onSizeChange:l.handleSizeChange,onCurrentChange:l.handleCurrentChange},null,8,["current-page","page-sizes","page-size","total","onSizeChange","onCurrentChange"])])):e.createCommentVNode("",!0)],4)}const Qd=j(Mg,[["render",Og],["__scopeId","data-v-81083195"]]),Pg={name:"ChartTitle",props:{title:{type:String,default:""},subtitle:{type:String,default:""},align:{type:String,default:"center",validator:t=>["left","center","right"].includes(t)},titleStyle:{type:Object,default:()=>({color:"#333",fontSize:"18px",fontWeight:"bold",marginBottom:"10px"})},subtitleStyle:{type:Object,default:()=>({color:"#666",fontSize:"14px",marginTop:"4px"})},showDivider:{type:Boolean,default:!1},dividerColor:{type:String,default:"#eee"}},computed:{titleText(){return this.title||"图表标题"},textStyle(){return{textAlign:this.align,...this.titleStyle}},containerStyle(){return{borderBottom:this.showDivider?`1px solid ${this.dividerColor}`:"none",paddingBottom:this.showDivider?"10px":"0"}}}};function qg(t,n,o,a,r,l){return e.openBlock(),e.createElementBlock("div",{class:"chart-title-container",style:e.normalizeStyle(o.titleStyle)},[e.createElementVNode("div",{class:"title-text",style:e.normalizeStyle(l.textStyle)},e.toDisplayString(l.titleText),5),o.subtitle?(e.openBlock(),e.createElementBlock("div",{key:0,class:"subtitle-text",style:e.normalizeStyle(o.subtitleStyle)},e.toDisplayString(o.subtitle),5)):e.createCommentVNode("",!0)],4)}const zd=j(Pg,[["render",qg],["__scopeId","data-v-2679bda5"]]),vg={Bar:qa,Line:Nd,Pie:Td,Area:Dd,Metric:Md,Gauge:Rd,Funnel:Od,Scatter:Pd,Radar:qd,Map:vd,ReportTable:Qd,ChartTitle:zd},Qg={name:"lwBiChartItem",components:{BarChart:qa,LineChart:Nd,PieChart:Td,AreaChart:Dd,MetricCard:Md,GaugeChart:Rd,FunnelChart:Od,ScatterChart:Pd,RadarChart:qd,MapChart:vd,ReportTable:Qd,ChartTitle:zd},provide(){return{echarts:e4}},props:{rawData:{type:Object,default:null},height:{type:String,default:"300px"},isBi:{type:Boolean,default:!0}},computed:{isShow(){var t,n,o;return this.rawData&&(((t=this.rawData)==null?void 0:t.setting)&&((n=this.rawData)==null?void 0:n.dataSet)||((o=this.rawData)==null?void 0:o.option))},chartType(){var t;return((t=this.rawData)==null?void 0:t.type)||"Bar"},chartComponent(){return vg[this.chartType]||qa}}};function zg(t,n,o,a,r,l){return l.isShow?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(l.chartComponent),{key:0,rawData:o.rawData,height:o.height,isBi:o.isBi},null,8,["rawData","height","isBi"])):e.createCommentVNode("",!0)}const Ud=j(Qg,[["render",zg]]),Ug={components:{GridLayout:za.GridLayout,GridItem:za.GridItem},data(){return{id:"",searchOptions:[],chartPageRefs:[],chartList:[],globalFilter:{values:{},ranges:{}},searchParams:{}}},props:{chartId:{type:String,default:""},designMode:{type:Boolean,default:!1}},watch:{chartId:{handler(t){this.id=t||this.$route.query.id,this.getDataList()},deep:!0,immediate:!0}},methods:{async getDataList(){let t=await this.$http.get(`${this.$config.API_URL}/bi-manage/{tenantId}/{buCode}/dashboard_render/${this.id}`);this.chartList=(t==null?void 0:t.charts)||[],this.getFilter(t.filterControls)},async changeTimeUnit(t,n){let{data:o,...a}=t,r=await this.$http.get(`${this.$config.API_URL}/bi-manage/{tenantId}/{buCode}/visualize/${a.id}`);r==null||r.models.forEach(c=>{c==null||c.dimensions.forEach(h=>{h.timeSetting.timeUnit=t.timeUnit})});let l=this.unflattenObject(this.searchParams);l.ranges&&Object.entries(l.ranges).map(([c,h])=>{this.globalFilter.ranges[c].timeRange={from:h[0],to:h[1]}}),this.globalFilter.values=l.values;let i={charts:[a],globalFilter:this.globalFilter,visualizes:[r]},s=await this.$http.post(`${this.$config.API_URL}/bi-manage/{tenantId}/{buCode}/dashboard_render/${this.id}/partial_refresh`,i);this.chartList[n].data=(s==null?void 0:s[n].data)||[],this.chartList[n].timeUnit=t.timeUnit},unflattenObject(t){const n={};for(const o in t){const a=o.split(".");let r=n;a.forEach((l,i)=>{i===a.length-1?r[l]=t[o]:((!r[l]||typeof r[l]!="object")&&(r[l]={}),r=r[l])})}return n},search(){let t=JSON.parse(JSON.stringify(this.globalFilter)),n=this.unflattenObject(this.searchParams);n.ranges&&Object.entries(n.ranges).map(([o,a])=>{t.ranges[o].timeRange={from:(a==null?void 0:a[0])||this.globalFilter.ranges[o].timeRange.from,to:(a==null?void 0:a[1])||this.globalFilter.ranges[o].timeRange.to},t.ranges[o].type="ABSOLUTE"}),t.values=n.values,this.getChartList(t),this.chartPageRefs.length>0&&this.chartPageRefs.forEach(o=>{o.searchParams=this.searchParams,o.globalFilter=t,o.search()})},reset(){this.getChartList({values:{},ranges:{}}),this.chartPageRefs.length>0&&this.chartPageRefs.forEach(t=>{t.getChartList({values:{},ranges:{}})})},async getChartList(t={}){let n={charts:this.chartList.map(({data:o,...a})=>a),globalFilter:t};this.chartList=await this.$http.post(`${this.$config.API_URL}/bi-manage/{tenantId}/{buCode}/dashboard/design_mode/render`,n)},removeChart(t){this.modelValue.splice(t,1)},listToTree(t){const n=[],o={};return t.forEach(a=>{o[a.id]={value:a.id,label:a.name,children:[]}}),t.forEach(a=>{const r=o[a.parent];r?r.children.push(o[a.id]):n.push(o[a.id])}),n},async getFilter(t){var n,o;for(const a of t){const{type:r}=a,l=async s=>{const{type:c,dict:h,dataInterfaceUri:p,dimensionTableId:f}=s.options;return c==="DICT"?Object.entries(h).map(([y,w])=>({value:y,label:w})):c==="DATA_INTERFACE"?(await this.$http.get(p)).map(w=>({value:w.id,label:w.name})):(await this.$api.dimensionChild.list({},f)).map(w=>({value:w.id,label:w.name}))},i=async s=>{const{type:c,dict:h,dataInterfaceUri:p,dimensionTableId:f}=s.options;if(c==="DICT")return Object.entries(h).map(([y,w])=>({value:y,label:w}));if(c==="DATA_INTERFACE"){const y=await this.$http.get(p);return this.listToTree(y)}else{const y=await this.$api.dimensionChild.list({},f);return this.listToTree(y)}};switch(r){case"DATA_PICKER":{const s=a.dataPickerSetting,c=await l(s);this.searchParams[`values.${s.code}`]=(s==null?void 0:s.value)||"",this.searchOptions.push({label:a.name,prop:`values.${s.code}`,renderType:"select",options:c,value:(s==null?void 0:s.value)||"",valueKey:"value",labelKey:"label"});break}case"DATA_CASCADE":{const s=a.dataPickerSetting,c=await i(s);this.searchParams[`values.${s.code}`]=(s==null?void 0:s.value)||"",this.searchOptions.push({label:a.name,name:`values.${s.code}`,value:(s==null?void 0:s.value)||"",component:"treeSelect",options:{items:c,placeholder:"请选择"+a.name,checkStrictly:!0}});break}case"DATA_INPUT":{this.searchParams[`values.${a.dataInputSetting.code}`]=((n=a.dataInputSetting)==null?void 0:n.value)||"",this.searchOptions.push({label:a.name,prop:`values.${a.dataInputSetting.code}`,value:((o=a.dataInputSetting)==null?void 0:o.value)||"",renderType:"input"});break}case"DATE_PICKER":{const s=a.datePickerSetting;let c=[];switch(a.datePickerSetting.type){case"TODAY":c=[ae().format("YYYY-MM-DDTHH:mm:ss.SSSZ"),ae().format("YYYY-MM-DDTHH:mm:ss.SSSZ")];break;case"THIS_MONTH":c=[ae().startOf("month").format("YYYY-MM-DDTHH:mm:ss.SSSZ"),ae().endOf("month").format("YYYY-MM-DDTHH:mm:ss.SSSZ")];break;case"THIS_YEAR":c=[ae().startOf("year").format("YYYY-MM-DDTHH:mm:ss.SSSZ"),ae().endOf("year").format("YYYY-MM-DDTHH:mm:ss.SSSZ")];break;case"LAST_10_DAYS":c=[ae().subtract(10,"day").format("YYYY-MM-DDTHH:mm:ss.SSSZ"),ae().format("YYYY-MM-DDTHH:mm:ss.SSSZ")];break;case"LAST_30_DAYS":c=[ae().subtract(30,"day").format("YYYY-MM-DDTHH:mm:ss.SSSZ"),ae().format("YYYY-MM-DDTHH:mm:ss.SSSZ")];break;case"LAST_12_MONTH":c=[ae().subtract(12,"month").format("YYYY-MM-DDTHH:mm:ss.SSSZ"),ae().format("YYYY-MM-DDTHH:mm:ss.SSSZ")];break;case"LAST_5_YEAR":c=[ae().subtract(5,"year").format("YYYY-MM-DDTHH:mm:ss.SSSZ"),ae().format("YYYY-MM-DDTHH:mm:ss.SSSZ")];break;case"LAST_60_SECONDS":c=[ae().subtract(60,"second").toISOString(),ae().toISOString()];break;case"LAST_30_MINUTES":c=[ae().subtract(30,"minute").toISOString(),ae().toISOString()];break;case"LAST_24_HOURS":c=[ae().subtract(24,"hour").toISOString(),ae().toISOString()];break;case"CURRENT_MONDAY_TO_TODAY":c=[ae().startOf("week").add(1,"day").format("YYYY-MM-DDTHH:mm:ss.SSSZ"),ae().format("YYYY-MM-DDTHH:mm:ss.SSSZ")];break;case"YESTERDAY":c=[ae().subtract(1,"day").format("YYYY-MM-DDTHH:mm:ss.SSSZ"),ae().subtract(1,"day").format("YYYY-MM-DDTHH:mm:ss.SSSZ")];break;case"LAST_YEAR":c=[ae().subtract(1,"year").startOf("year").format("YYYY-MM-DDTHH:mm:ss.SSSZ"),ae().subtract(1,"year").endOf("year").format("YYYY-MM-DDTHH:mm:ss.SSSZ")];break;case"ABSOLUTE":c=[a.datePickerSetting.timeRange.from,a.datePickerSetting.timeRange.to];break;default:c=[];break}this.searchParams[`ranges.${s.code}`]=c,this.searchOptions.push({label:a.name,prop:`ranges.${s.code}`,renderType:"dateRange",value:c,valueFormat:"YYYY-MM-DDTHH:mm:ss.SSSZ"}),this.globalFilter.ranges[s.code]={timeRange:{from:(c==null?void 0:c[0])||"",to:(c==null?void 0:c[1])||""},type:s.type};break}}}}}},Gg={class:"lw-bi-chart-global-layout"},Hg={key:0,class:"filter-top"},jg={key:1,class:"grid-item-dashboard"},Zg=["onClick"],Yg={key:1,class:"no-record-panel e-unselect"};function Kg(t,n,o,a,r,l){const i=e.resolveComponent("lw-search"),s=e.resolveComponent("el-radio-button"),c=e.resolveComponent("el-radio-group"),h=e.resolveComponent("lwBiChartPage"),p=e.resolveComponent("lwBiChartItem"),f=e.resolveComponent("el-button"),y=e.resolveComponent("GridItem"),w=e.resolveComponent("GridLayout"),b=e.resolveComponent("el-empty");return e.openBlock(),e.createElementBlock("div",Gg,[r.searchOptions.length>0?(e.openBlock(),e.createBlock(i,{key:0,class:"search-body",options:r.searchOptions,modelValue:r.searchParams,"onUpdate:modelValue":n[0]||(n[0]=B=>r.searchParams=B),hideLabel:!0,onSearch:l.search,onReset:l.reset},null,8,["options","modelValue","onSearch","onReset"])):e.createCommentVNode("",!0),e.createVNode(w,{layout:r.chartList,"onUpdate:layout":n[1]||(n[1]=B=>r.chartList=B),"col-num":12,"row-height":30,"is-draggable":o.designMode,"is-resizable":o.designMode,"use-css-transforms":!1,"vertical-compact":""},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.chartList,(B,V)=>(e.openBlock(),e.createBlock(y,{key:B.i,x:B.x,y:B.y,w:B.w,h:B.h,i:B.i},{default:e.withCtx(()=>{var F,S,E,q;return[e.createElementVNode("div",{class:e.normalizeClass(["lw-bi-chart-global-layout-item",{edit:o.designMode}])},[(S=(F=B.data)==null?void 0:F.setting)!=null&&S.activeDateUnitFilter?(e.openBlock(),e.createElementBlock("div",Hg,[e.createVNode(c,{modelValue:B.timeUnit,"onUpdate:modelValue":v=>B.timeUnit=v,onChange:v=>l.changeTimeUnit(B,V)},{default:e.withCtx(()=>{var v,_,P,L;return[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList((_=(v=B.data)==null?void 0:v.setting)==null?void 0:_.optionalDateUnitRanges,(G,N)=>(e.openBlock(),e.createBlock(s,{label:N,value:G,key:N},null,8,["label","value"]))),128)),Object.keys((L=(P=B.data)==null?void 0:P.setting)==null?void 0:L.optionalDateUnitRanges).length==0?(e.openBlock(),e.createBlock(s,{key:0,disabled:""},{default:e.withCtx(()=>n[2]||(n[2]=[e.createTextVNode(" 未选择周期列表 未选择周期列表 ")])),_:1})):e.createCommentVNode("",!0)]}),_:2},1032,["modelValue","onUpdate:modelValue","onChange"])])):e.createCommentVNode("",!0),(B==null?void 0:B.type)=="Dashboard"?(e.openBlock(),e.createElementBlock("div",jg,[e.createVNode(h,{ref_for:!0,ref:v=>{v&&(r.chartPageRefs[V]=v)},chartId:B.id},null,8,["chartId"])])):e.createCommentVNode("",!0),e.createVNode(p,{rawData:B.data,height:(q=(E=B.data)==null?void 0:E.setting)!=null&&q.activeDateUnitFilter?"calc(100% - 36px)":"100%"},null,8,["rawData","height"]),o.designMode?(e.openBlock(),e.createElementBlock("div",{key:2,class:"remove",onClick:v=>l.removeChart(V)},[e.createVNode(f,{type:"primary",link:"",icon:"el-icon-delete"})],8,Zg)):e.createCommentVNode("",!0)],2)]}),_:2},1032,["x","y","w","h","i"]))),128))]),_:1},8,["layout","is-draggable","is-resizable"]),r.chartList.length===0?(e.openBlock(),e.createElementBlock("div",Yg,[e.createVNode(b,{description:o.designMode?"点击上方工具栏中的按钮,添加图表至当前仪表板":"仪表板中还没有添加任何图表"},null,8,["description"])])):e.createCommentVNode("",!0)])}const Gd=j(Ug,[["render",Kg],["__scopeId","data-v-9e354eb5"]]);/*!
|
|
24
|
+
`).join("")},getLegendOption(t,n){var o,a,r,l,i,s,c,h,p,f;return{show:((o=t.legend)==null?void 0:o.show)!==!1,type:((a=t.legend)==null?void 0:a.type)||"scroll",orient:((r=t.legend)==null?void 0:r.orient)||"horizontal",left:((l=t.legend)==null?void 0:l.left)||"left",top:((i=t.legend)==null?void 0:i.top)||"top",padding:((s=t.legend)==null?void 0:s.padding)||[5,5,5,5],itemGap:((c=t.legend)==null?void 0:c.itemGap)||10,itemWidth:((h=t.legend)==null?void 0:h.itemWidth)||14,itemHeight:((p=t.legend)==null?void 0:p.itemHeight)||14,textStyle:{fontSize:12,...(f=t.legend)==null?void 0:f.textStyle}}},getGridOption(t){if(t.grid)return{containLabel:!0,...t.grid}},getToolboxOption(t){var n,o,a,r;if(!(!t.toolbox||t.toolbox.show===!1))return{...t.toolbox,feature:{...t.toolbox.feature||{},saveAsImage:(o=(n=t.toolbox.feature)==null?void 0:n.saveAsImage)!=null&&o.show?{type:"png",pixelRatio:2,...t.toolbox.feature.saveAsImage}:void 0,dataView:(r=(a=t.toolbox.feature)==null?void 0:a.dataView)!=null&&r.show?{readOnly:!0,...t.toolbox.feature.dataView}:void 0}}},getXAxisOption(t){return{type:"category",boundaryGap:!1,data:t[0].headers,axisLabel:{rotate:30,interval:0}}},getYAxisOption(t){var n;return{type:"value",axisLabel:{formatter:((n=t.yAxis)==null?void 0:n.formatter)||this.defaultYAxisFormatter},...t.yAxis}},defaultYAxisFormatter(t){return t>=1e4?(t/1e4).toFixed(1)+"万":t>=1e3?(t/1e3).toFixed(1)+"k":t},getSeriesData(t,n){let o=[];return n.map((a,r)=>{a.rows.map(l=>{var i,s,c,h,p,f,y,w,b,B,V,F,S,E,q,v,_,P,L,G,N,Q,H,Z,M,K,g;o.push({name:l.name,type:"line",stack:((i=t.series)==null?void 0:i.stack)||"total",areaStyle:{opacity:((c=(s=t.series)==null?void 0:s.areaStyle)==null?void 0:c.opacity)||.8,color:(p=(h=t.series)==null?void 0:h.areaStyle)==null?void 0:p.color,...((f=t.series)==null?void 0:f.areaStyle)||{}},emphasis:{focus:((w=(y=t.series)==null?void 0:y.emphasis)==null?void 0:w.focus)||"series"},smooth:((b=t.series)==null?void 0:b.smooth)!==!1,symbol:((B=t.series)==null?void 0:B.symbol)||"circle",symbolSize:((V=t.series)==null?void 0:V.symbolSize)||6,lineStyle:{width:((S=(F=t.series)==null?void 0:F.lineStyle)==null?void 0:S.width)||2,type:(q=(E=t.series)==null?void 0:E.lineStyle)==null?void 0:q.type,color:(_=(v=t.series)==null?void 0:v.lineStyle)==null?void 0:_.color,...((P=t.series)==null?void 0:P.lineStyle)||{}},data:l.values,label:{show:((G=(L=t.series)==null?void 0:L.label)==null?void 0:G.show)||!1,position:((Q=(N=t.series)==null?void 0:N.label)==null?void 0:Q.position)||"top",formatter:((Z=(H=t.series)==null?void 0:H.label)==null?void 0:Z.formatter)||"{@value}",fontSize:((K=(M=t.series)==null?void 0:M.label)==null?void 0:K.fontSize)||12,...((g=t.series)==null?void 0:g.label)||{}},...t.series||{}})})}),o}}};function Ag(t,n,o,a,r,l){return e.openBlock(),e.createElementBlock("div",{ref:"chartRef",class:e.normalizeClass({chart:o.isBi}),style:e.normalizeStyle({height:o.height})},null,6)}const Dd=j(yg,[["render",Ag],["__scopeId","data-v-7818b7b4"]]),bg={name:"MetricCard",data(){return{cardHeight:0}},props:{rawData:{type:Object,required:!0,default:()=>({})},height:{type:String,default:""},subtitle:{type:String,default:"同比变化"},tooltip:{type:String,default:""}},computed:{parsedData(){var r;const{setting:t,dataSet:n}=this.rawData,{tables:o}=n,a=(r=t==null?void 0:t.displayMetrics)==null?void 0:r.map(l=>{const[i,s]=l.split(".");return o.find(c=>c.name===i&&c.metricId===s)}).filter(Boolean);return this.height?this.cardHeight=this.height:this.cardHeight=200+(a.length-2)*10+"px",this.transformData(a,t)},columns(){var t,n;return((t=this.parsedData)==null?void 0:t.length)<this.rawData.setting.columnCount?(n=this.parsedData)==null?void 0:n.length:this.rawData.setting.columnCount},paddingDefault(){var t,n,o,a,r,l,i,s;return[`${(n=(t=this.rawData.setting)==null?void 0:t.grid)==null?void 0:n.top}px`||0,`${(a=(o=this.rawData.setting)==null?void 0:o.grid)==null?void 0:a.right}px`||0,`${(l=(r=this.rawData.setting)==null?void 0:r.grid)==null?void 0:l.bottom}px`||0,`${(s=(i=this.rawData.setting)==null?void 0:i.grid)==null?void 0:s.left}px`||0]},titleLeftRight(){var o;let{left:t}=((o=this.rawData.setting)==null?void 0:o.title)||{},n={};return t=="left"?n.left=0:t=="center"?(n.left="50%",n.transform="translateX(-50%)"):(n.left="auto",n.right=0),n},legendLeftRight(){var a;let{left:t,top:n}=((a=this.rawData.setting)==null?void 0:a.legend)||{},o={};return t=="left"?o["justify-content"]="flex-start":t=="center"?o["justify-content"]="center":o["justify-content"]="flex-end",n=="top"?o["align-items"]="flex-start":n=="bottom"?o["align-items"]="flex-end":n=="middle"&&(o["align-items"]="center"),o}},methods:{transformData(t,n){const o=[],a=Math.max(...t.map(r=>r.headers.length));for(let r=0;r<a;r++){const l=[];t.forEach(i=>{if(r<i.headers.length){const s=i.headers[r],c=i.metricName,h=i.rows[0].values[r];l.push({name:s!=c?`${s}-${c}`:c,unit:i.unit,unitName:i.unitName,unit:i.unit,setting:n,value:h})}}),l.length>0&&o.push(l)}return o}}},wg={key:0},Eg={key:2,class:"statistic-item"},Bg={class:"number"};function kg(t,n,o,a,r,l){const i=e.resolveComponent("el-icon-warning"),s=e.resolveComponent("el-icon"),c=e.resolveComponent("el-tooltip");return e.openBlock(),e.createElementBlock("div",{class:"chart-title-card-list",style:e.normalizeStyle({gridTemplateColumns:`repeat(${l.columns||1}, 1fr)`})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.parsedData,(h,p)=>(e.openBlock(),e.createElementBlock("div",{key:p,class:"chart-title-card",style:e.normalizeStyle({height:r.cardHeight,padding:l.paddingDefault})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h,(f,y)=>{var w,b,B,V,F,S,E,q,v,_,P,L,G,N,Q,H,Z,M,K,g,R,z,me,be,Ee,W,le,Le;return e.openBlock(),e.createElementBlock(e.Fragment,{key:f.name},[y===0?(e.openBlock(),e.createElementBlock("div",wg,[(w=f.setting.title)!=null&&w.show?(e.openBlock(),e.createElementBlock("div",{key:0,class:"title-top",style:e.normalizeStyle({textAlign:((B=(b=f.setting)==null?void 0:b.title)==null?void 0:B.left)||"left",padding:((S=(F=(V=f.setting)==null?void 0:V.title)==null?void 0:F.padding)==null?void 0:S.map(we=>we+"px").join(" "))||0})},[e.createElementVNode("span",{style:e.normalizeStyle({color:((q=(E=f.setting.title)==null?void 0:E.textStyle)==null?void 0:q.color)||f.color,fontWeight:((_=(v=f.setting.title)==null?void 0:v.textStyle)==null?void 0:_.fontWeight)||"normal",fontSize:((L=(P=f.setting.title)==null?void 0:P.textStyle)==null?void 0:L.fontSize)+"px"||"17px"})},e.toDisplayString(f.name),5),f.tooltip?(e.openBlock(),e.createBlock(c,{key:0,effect:"dark",content:f.tooltip,placement:"top"},{default:e.withCtx(()=>[e.createVNode(s,{class:"icon-tooltip"},{default:e.withCtx(()=>[e.createVNode(i)]),_:1})]),_:2},1032,["content"])):e.createCommentVNode("",!0)],4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"statistic-current",style:e.normalizeStyle({...l.legendLeftRight,color:((N=(G=f.setting.legend)==null?void 0:G.textStyle)==null?void 0:N.color)||f.color,padding:((Z=(H=(Q=f.setting)==null?void 0:Q.legend)==null?void 0:H.padding)==null?void 0:Z.map(we=>we+"px").join(" "))||0,fontWeight:((K=(M=f.setting.legend)==null?void 0:M.textStyle)==null?void 0:K.fontWeight)||"bold",fontSize:((R=(g=f.setting.legend)==null?void 0:g.textStyle)==null?void 0:R.fontSize)+"px"||"17px"})},e.toDisplayString((z=f.value)==null?void 0:z.toLocaleString("en-US")),5)])):y==h.length-1?(e.openBlock(),e.createElementBlock("div",{key:1,class:"statistic-footer",style:e.normalizeStyle({left:((be=(me=o.rawData.setting)==null?void 0:me.grid)==null?void 0:be.left)+"px",bottom:((W=(Ee=o.rawData.setting)==null?void 0:Ee.grid)==null?void 0:W.bottom)+"px",right:((Le=(le=o.rawData.setting)==null?void 0:le.grid)==null?void 0:Le.right)+"px"})},[e.createElementVNode("span",null,e.toDisplayString(f.name),1),e.createElementVNode("div",{style:e.normalizeStyle({color:f.value>=0?"#BF1220":"#00B78B"})},e.toDisplayString(Math.abs(f.value))+" "+e.toDisplayString(f.unitName),5)],4)):(e.openBlock(),e.createElementBlock("div",Eg,[e.createElementVNode("span",null,e.toDisplayString(f.name),1),e.createElementVNode("div",Bg,e.toDisplayString(Math.abs(f.value))+" "+e.toDisplayString(f.unitName),1)]))],64)}),128))],4))),128))],4)}const Md=j(bg,[["render",kg],["__scopeId","data-v-a1312350"]]),xg={name:"GaugeChart",props:{rawData:{type:Object,required:!0},height:{type:String,default:"300px"},isBi:{type:Boolean,default:!0}},data(){return{option:{},echarts:e.inject("echarts"),chart:null}},watch:{rawData:{handler:"updateChart",deep:!0,immediate:!0}},mounted(){this.$nextTick(()=>{this.initChart()})},beforeDestroy(){this.chart&&(this.chart.dispose(),this.chart=null)},methods:{initChart(){this.chart&&this.chart.dispose(),this.chart=e.markRaw(this.echarts.init(this.$refs.chartRef)),this.updateChart(),window.addEventListener("resize",()=>{this.chart&&this.chart.resize()})},updateChart(){if(!this.chart||!this.rawData)return;const{setting:t,dataSet:n,option:o}=this.rawData,{tables:a}=n||{};this.isBi?this.option={title:this.getTitleOption(t),tooltip:this.getTooltipOption(t),series:this.getSeriesData(t,a)}:this.option=o,this.option&&this.chart.setOption(this.option,!0),setTimeout(()=>{this.chart.resize()},10)},getTitleOption(t){var n,o,a,r,l,i;return{show:((n=t.title)==null?void 0:n.show)!==!1,text:((o=t.title)==null?void 0:o.text)||"",textStyle:{fontSize:16,fontWeight:"bold",color:"#333",...(a=t.title)==null?void 0:a.textStyle},left:((r=t.title)==null?void 0:r.left)||"center",top:((l=t.title)==null?void 0:l.top)||"top",padding:((i=t.title)==null?void 0:i.padding)||[5,5,5,5]}},getTooltipOption(t){var n;return{formatter:((n=t.tooltip)==null?void 0:n.formatter)||"{a} <br/>{b}: {c}"}},getMinMaxValues(t){const n=t.flatMap(r=>r.rows.flatMap(l=>l.values)),o=Math.min(...n),a=Math.max(...n);return{min:o,max:a}},getGridCenters(t){const n=t.length,o=Math.ceil(Math.sqrt(n)),a=Math.round(Math.sqrt(n)),r=[];for(let l=0;l<n;l++){const i=Math.floor(l/a),c=((l%a+.5)*(100/a)).toFixed(2)+"%",h=((i+.5)*(100/o)).toFixed(2)+"%";r.push([h,c])}return r},getSeriesData(t,n){let o=this.getGridCenters(n),a=[];return n.forEach((r,l)=>{a.push({type:"gauge",...this.getMinMaxValues(n),name:r.metricName,radius:`${90/n.length}%`,center:o[l],detail:{valueAnimation:!0,formatter:t.formatter||"{value}",color:"inherit",fontSize:14},data:this.parseGaugeData(r)})}),a},parseGaugeData(t){let n=[];return t.headers.forEach((o,a)=>{n.push({name:o,value:t.rows[0].values[a],title:{show:!1},detail:{show:!1}})}),n}}};function Vg(t,n,o,a,r,l){return e.openBlock(),e.createElementBlock("div",{ref:"chartRef",class:e.normalizeClass({chart:o.isBi}),style:e.normalizeStyle({height:o.height})},null,6)}const Rd=j(xg,[["render",Vg],["__scopeId","data-v-6b008f06"]]),_g={name:"FunnelChart",props:{rawData:{type:Object,required:!0},height:{type:String,default:"300px"},isBi:{type:Boolean,default:!0}},data(){return{option:{},echarts:e.inject("echarts"),chart:null}},watch:{rawData:{handler:"updateChart",deep:!0,immediate:!0}},mounted(){this.$nextTick(()=>{this.initChart()})},beforeDestroy(){this.chart&&(this.chart.dispose(),this.chart=null)},methods:{initChart(){this.chart&&this.chart.dispose(),this.chart=e.markRaw(this.echarts.init(this.$refs.chartRef)),this.updateChart(),window.addEventListener("resize",()=>{this.chart&&this.chart.resize()})},updateChart(){if(!this.chart||!this.rawData)return;const{setting:t,dataSet:n,option:o}=this.rawData,{tables:a}=n||{};this.isBi?this.option={title:t.title?this.getTitleOption(t):void 0,tooltip:t.tooltip?this.getTooltipOption(t):void 0,legend:t.legend?this.getLegendOption(t,a):void 0,grid:t.grid?this.getGridOption(t):void 0,series:this.getSeriesData(t,a),color:t.color}:this.option=o,this.option&&this.chart.setOption(this.option,!0),setTimeout(()=>{this.chart.resize()},10)},getTitleOption(t){var n,o,a,r,l,i;return{show:((n=t.title)==null?void 0:n.show)!==!1,text:((o=t.title)==null?void 0:o.text)||"",textStyle:{fontSize:16,fontWeight:"bold",color:"#333",...(a=t.title)==null?void 0:a.textStyle},left:((r=t.title)==null?void 0:r.left)||"center",top:((l=t.title)==null?void 0:l.top)||"top",padding:((i=t.title)==null?void 0:i.padding)||[5,5,5,5]}},getTooltipOption(t){const n=t.tooltip||{};return{show:n.show,trigger:"item",formatter:n.formatter||"{a} <br/>{b}: {c}"}},getLegendOption(t,n){var o,a,r,l,i,s,c,h,p,f;return{show:((o=t.legend)==null?void 0:o.show)!==!1,type:((a=t.legend)==null?void 0:a.type)||"scroll",orient:((r=t.legend)==null?void 0:r.orient)||"horizontal",left:((l=t.legend)==null?void 0:l.left)||"left",top:((i=t.legend)==null?void 0:i.top)||"top",padding:((s=t.legend)==null?void 0:s.padding)||[5,5,5,5],itemGap:((c=t.legend)==null?void 0:c.itemGap)||10,itemWidth:((h=t.legend)==null?void 0:h.itemWidth)||14,itemHeight:((p=t.legend)==null?void 0:p.itemHeight)||14,textStyle:{fontSize:12,...(f=t.legend)==null?void 0:f.textStyle}}},getGridOption(t){const n=t.grid||{};return{top:n.top,left:n.left,right:n.right,bottom:n.bottom,containLabel:n.containLabel}},getGridCenters(t,n={top:8,right:5,bottom:5,left:5}){const o=Math.ceil(Math.sqrt(t)),a=Math.round(Math.sqrt(t)),r=[];for(let l=0;l<t;l++){const i=Math.floor(l/a),c=(l%a*(100/a)+parseInt(n.top)).toFixed(2)+"%",h=(i*(90/o)+parseInt(n.left)).toFixed(2)+"%",p=((90-parseInt(n.right))/o).toFixed(2)+"%",f=((100-parseInt(n.bottom))/a).toFixed(2)+"%";r.push({left:h,top:c,width:p,height:f})}return r},getSeriesData(t,n){const o=n.reduce((s,c)=>s+c.rows.length,0),a=this.getGridCenters(o,t.grid),r=t.series||{},l=t.label||{};let i=[];return n.forEach((s,c)=>{s.rows.forEach((h,p)=>{var y,w;const f=c+p;i.push({name:s.metricName,type:"funnel",...a[f],label:{position:l.position||"inside",formatter:l.formatter||"{b}: {c}",color:l.color,fontSize:l.fontSize},labelLine:{length:l.length,lineStyle:{width:l.lineWidth,type:l.lineType}},itemStyle:{borderColor:r.borderColor||"#fff",borderWidth:r.borderWidth||1,borderRadius:r.borderRadius},emphasis:{label:{show:!0,fontSize:((w=(y=r.emphasis)==null?void 0:y.label)==null?void 0:w.fontSize)||16}},data:h.values.map((b,B)=>({value:b,name:s.headers[B]}))})})}),i}}};function Ig(t,n,o,a,r,l){return e.openBlock(),e.createElementBlock("div",{ref:"chartRef",class:e.normalizeClass({chart:o.isBi}),style:e.normalizeStyle({height:o.height})},null,6)}const Od=j(_g,[["render",Ig],["__scopeId","data-v-3708b699"]]),Sg={name:"ScatterChart",props:{rawData:{type:Object,required:!0},height:{type:String,default:"300px"},isBi:{type:Boolean,default:!0}},data(){return{option:{},echarts:e.inject("echarts"),chart:null}},watch:{rawData:{handler:"updateChart",deep:!0,immediate:!0}},mounted(){this.$nextTick(()=>{this.initChart()})},beforeDestroy(){this.chart&&(this.chart.dispose(),this.chart=null)},methods:{initChart(){this.chart&&this.chart.dispose(),this.chart=e.markRaw(this.echarts.init(this.$refs.chartRef)),this.updateChart(),window.addEventListener("resize",()=>{this.chart&&this.chart.resize()})},updateChart(){if(!this.chart||!this.rawData)return;const{setting:t,dataSet:n,option:o}=this.rawData,{tables:a}=n||{};this.isBi?this.option={title:this.getTitleOption(t),tooltip:this.getTooltipOption(t),legend:this.getLegendOption(t,a),grid:this.getGridOption(t),xAxis:this.getXAxisOption(t,a),yAxis:this.getYAxisOption(t),visualMap:this.getVisualMapOption(t,a),series:this.getSeriesData(t,a),color:t.useThemeColor?void 0:t.color||this.getDefaultColors(),toolbox:this.getToolboxOption(t)}:this.option=o,this.option&&this.chart.setOption(this.option,!0),setTimeout(()=>{this.chart.resize()},10)},getTitleOption(t){var n,o,a,r,l,i;return{show:((n=t.title)==null?void 0:n.show)!==!1,text:((o=t.title)==null?void 0:o.text)||"",textStyle:{fontSize:16,fontWeight:"bold",color:"#333",...(a=t.title)==null?void 0:a.textStyle},left:((r=t.title)==null?void 0:r.left)||"center",top:((l=t.title)==null?void 0:l.top)||"top",padding:((i=t.title)==null?void 0:i.padding)||[5,5,5,5]}},getTooltipOption(t){var n,o;return{show:((n=t.tooltip)==null?void 0:n.show)!==!1,trigger:"item",formatter:((o=t.tooltip)==null?void 0:o.formatter)||(a=>{const r=a.data;return`${a.seriesName}<br/>${a.name}: (${r[1]})`})}},getLegendOption(t,n){var o,a,r,l,i,s,c,h,p,f;return{show:((o=t.legend)==null?void 0:o.show)!==!1,type:((a=t.legend)==null?void 0:a.type)||"scroll",orient:((r=t.legend)==null?void 0:r.orient)||"horizontal",left:((l=t.legend)==null?void 0:l.left)||"left",top:((i=t.legend)==null?void 0:i.top)||"top",padding:((s=t.legend)==null?void 0:s.padding)||[5,5,5,5],itemGap:((c=t.legend)==null?void 0:c.itemGap)||10,itemWidth:((h=t.legend)==null?void 0:h.itemWidth)||14,itemHeight:((p=t.legend)==null?void 0:p.itemHeight)||14,textStyle:{fontSize:12,...(f=t.legend)==null?void 0:f.textStyle}}},getGridOption(t){var n,o,a,r,l;return{left:((n=t.grid)==null?void 0:n.left)||"20",right:((o=t.grid)==null?void 0:o.right)||"20",top:((a=t.grid)==null?void 0:a.top)||"50",bottom:((r=t.grid)==null?void 0:r.bottom)||"20",containLabel:((l=t.grid)==null?void 0:l.containLabel)!==!1}},getXAxisOption(t,n){var o,a,r;return{type:"category",name:((o=t.xAxis)==null?void 0:o.name)||"",data:((a=n[0])==null?void 0:a.headers)||[],axisLabel:((r=t.xAxis)==null?void 0:r.axisLabel)||{},splitLine:{lineStyle:{type:"dashed"}}}},getYAxisOption(t){var n,o;return{type:"value",name:((n=t.yAxis)==null?void 0:n.name)||"",axisLabel:((o=t.yAxis)==null?void 0:o.axisLabel)||{},splitLine:{lineStyle:{type:"dashed"}}}},getVisualMapOption(t,n){var l,i,s,c,h,p,f,y,w;if(!t.visualMap||t.visualMap.top==="-10000")return null;const o=n.flatMap(b=>b.rows.flatMap(B=>B.values.filter(V=>typeof V=="number"&&isFinite(V)))),a=o.length?Math.max(...o):100,r=o.length?Math.min(...o):0;return{left:((l=t.visualMap)==null?void 0:l.left)||"right",top:((i=t.visualMap)==null?void 0:i.top)||"bottom",dimension:((s=t.visualMap)==null?void 0:s.dimension)||2,min:((c=t.visualMap)==null?void 0:c.min)??r,max:((h=t.visualMap)==null?void 0:h.max)??a,itemWidth:((p=t.visualMap)==null?void 0:p.itemWidth)||20,itemHeight:((f=t.visualMap)==null?void 0:f.itemHeight)||120,calculable:((y=t.visualMap)==null?void 0:y.calculable)||!1,inRange:((w=t.visualMap)==null?void 0:w.inRange)||{symbolSize:[0,50]},text:["高","低"]}},getSeriesData(t,n){let o=[];return n.map((a,r)=>{a.rows.map((l,i)=>{var s,c;o.push({name:n.length>1?a.metricName:a.metricName+"-"+l.name,type:"scatter",symbolSize:t.symbolSize||10,data:a.headers.map((h,p)=>{const f=a.rows[i].values[p];return[h,typeof f=="number"&&isFinite(f)?f:0,typeof f=="number"&&isFinite(f)?f:0]}),label:{show:((s=t.label)==null?void 0:s.show)||!1,formatter:((c=t.label)==null?void 0:c.formatter)||"{b}"}})})}),o},getToolboxOption(t){var n,o,a,r,l;if((n=t.toolbox)!=null&&n.show)return{show:!0,feature:{saveAsImage:{show:((a=(o=t.toolbox.feature)==null?void 0:o.saveAsImage)==null?void 0:a.show)||!1},dataView:{show:((l=(r=t.toolbox.feature)==null?void 0:r.dataView)==null?void 0:l.show)||!1}}}},getItemStyleOption(t){return t.itemStyle||{opacity:.8,shadowBlur:10,shadowColor:"rgba(0, 0, 0, 0.5)"}},getDefaultColors(){return["#5E9CC5","#FF7300","#14C566","#FF5E50","#BB83C0","#B77366","#FF8FC0","#A4A69C","#CFD162"]}}};function Fg(t,n,o,a,r,l){return e.openBlock(),e.createElementBlock("div",{ref:"chartRef",class:e.normalizeClass({chart:o.isBi}),style:e.normalizeStyle({height:o.height})},null,6)}const Pd=j(Sg,[["render",Fg],["__scopeId","data-v-f1780bc1"]]),Lg={name:"RadarChart",props:{rawData:{type:Object,required:!0},height:{type:String,default:"300px"},isBi:{type:Boolean,default:!0}},data(){return{option:{},echarts:e.inject("echarts"),chart:null}},watch:{rawData:{handler:"updateChart",deep:!0,immediate:!0}},mounted(){this.$nextTick(()=>{this.initChart()})},beforeDestroy(){this.chart&&(this.chart.dispose(),this.chart=null)},methods:{initChart(){this.chart&&this.chart.dispose(),this.chart=e.markRaw(this.echarts.init(this.$refs.chartRef)),this.updateChart(),window.addEventListener("resize",()=>{this.chart&&this.chart.resize()})},updateChart(){if(!this.chart||!this.rawData)return;const{setting:t,dataSet:n,option:o}=this.rawData,{tables:a}=n||{};this.isBi?this.option={title:this.getTitleOption(t),tooltip:this.getTooltipOption(t),legend:this.getLegendOption(t,a),radar:this.getRadarOption(t,a),series:this.getSeriesData(t,a),color:t.color||this.getDefaultColors()}:this.option=o,this.option&&this.chart.setOption(this.option,!0),setTimeout(()=>{this.chart.resize()},10)},getTitleOption(t){var n,o,a,r,l,i;return{show:((n=t.title)==null?void 0:n.show)!==!1,text:((o=t.title)==null?void 0:o.text)||"",textStyle:{fontSize:16,fontWeight:"bold",color:"#333",...(a=t.title)==null?void 0:a.textStyle},left:((r=t.title)==null?void 0:r.left)||"center",top:((l=t.title)==null?void 0:l.top)||"top",padding:((i=t.title)==null?void 0:i.padding)||[5,5,5,5]}},getTooltipOption(t){var n;return{trigger:"item",formatter:((n=t.tooltip)==null?void 0:n.formatter)||"{a} <br/>{b}: {c}"}},getLegendOption(t,n){var o,a;return{show:((o=t.legend)==null?void 0:o.show)!==!1,textStyle:((a=t.legend)==null?void 0:a.textStyle)||{fontSize:12}}},getRadarOption(t,n){return{indicator:n[0].headers.map((o,a)=>({name:o,max:t.maxValue||Math.max(...n.flatMap(r=>r.rows.flatMap(l=>l.values)))*1.2})),radius:t.radius||"65%",splitNumber:t.splitNumber||5,axisName:{color:t.axisNameColor||"#333"},splitArea:{show:t.showSplitArea!==!1},splitLine:{lineStyle:{color:t.splitLineColor||["rgba(0, 0, 0, 0.1)"]}},axisLine:{lineStyle:{color:t.axisLineColor||"rgba(0, 0, 0, 0.2)"}}}},getSeriesData(t,n){return n.map(o=>{var a,r;return{name:o.metricName,type:"radar",data:[{value:o.rows[0].values,name:o.metricName,areaStyle:t.showArea!==!1?{opacity:.4}:void 0,lineStyle:{width:t.lineWidth||2},symbol:t.symbol||"circle",symbolSize:t.symbolSize||6,label:{show:((a=t.label)==null?void 0:a.show)||!1,formatter:((r=t.label)==null?void 0:r.formatter)||"{c}"}}]}})},getDefaultColors(){return["#3A4DE9","#4BC0C0","#FF9F43","#ED5565","#A0A7E6","#67C23A","#E6A23C","#F56C6C","#909399"]}}};function Ng(t,n,o,a,r,l){return e.openBlock(),e.createElementBlock("div",{ref:"chartRef",class:e.normalizeClass({chart:o.isBi}),style:e.normalizeStyle({height:o.height})},null,6)}const qd=j(Lg,[["render",Ng],["__scopeId","data-v-88abf5da"]]),Tg={name:"MapChart",props:{rawData:{type:Object,required:!0},height:{type:String,default:"300px"},isBi:{type:Boolean,default:!0}},data(){return{option:{},echarts:e.inject("echarts"),chart:null}},watch:{rawData:{handler:"updateChart",deep:!0,immediate:!0}},mounted(){this.$nextTick(()=>{this.initChart()})},beforeDestroy(){this.chart&&(this.chart.dispose(),this.chart=null)},methods:{async initChart(){this.chart&&this.chart.dispose(),this.chart=e.markRaw(this.echarts.init(this.$refs.chartRef)),this.updateChart(),window.addEventListener("resize",()=>{this.chart&&this.chart.resize()})},async updateChart(){var l,i,s,c;if(!this.chart||!this.rawData)return;const{setting:t,dataSet:n,option:o}=this.rawData,{tables:a}=n||{};this.isBi?this.option={title:this.getTitleOption(t),tooltip:this.getTooltipOption(),legend:this.getLegendOption(t,a),visualMap:this.getVisualMapOption(t,a),series:this.getSeriesData(t,a)}:this.option=o;const r=await this.$http.get(`/${this.$config.APP_NAME.toLowerCase()}/map/${((i=(l=this.rawData)==null?void 0:l.setting)==null?void 0:i.mapName)||"china"}.json`);this.echarts.registerMap(((c=(s=this.rawData)==null?void 0:s.setting)==null?void 0:c.mapName)||"china",r),this.option&&this.chart.setOption(this.option,!0),setTimeout(()=>{this.chart.resize()},10)},getTitleOption(t){var n,o,a,r,l,i;return{show:((n=t.title)==null?void 0:n.show)!==!1,text:((o=t.title)==null?void 0:o.text)||"",textStyle:{fontSize:16,fontWeight:"bold",color:"#333",...(a=t.title)==null?void 0:a.textStyle},left:((r=t.title)==null?void 0:r.left)||"center",top:((l=t.title)==null?void 0:l.top)||"top",padding:((i=t.title)==null?void 0:i.padding)||[5,5,5,5]}},getTooltipOption(){return{trigger:"item",showDelay:0,transitionDuration:.2}},getLegendOption(t,n){var o,a,r,l,i,s,c,h,p,f;return{show:((o=t.legend)==null?void 0:o.show)!==!1,type:((a=t.legend)==null?void 0:a.type)||"scroll",orient:((r=t.legend)==null?void 0:r.orient)||"horizontal",left:((l=t.legend)==null?void 0:l.left)||"left",top:((i=t.legend)==null?void 0:i.top)||"top",padding:((s=t.legend)==null?void 0:s.padding)||[5,5,5,5],itemGap:((c=t.legend)==null?void 0:c.itemGap)||10,itemWidth:((h=t.legend)==null?void 0:h.itemWidth)||14,itemHeight:((p=t.legend)==null?void 0:p.itemHeight)||14,textStyle:{fontSize:12,...(f=t.legend)==null?void 0:f.textStyle}}},getVisualMapOption(t,n){const o=n.flatMap(l=>l.rows.flatMap(i=>i.values)),a=Math.max(...o);return{min:Math.min(...o),max:a,text:["高","低"],realtime:!1,calculable:!0,inRange:{color:t.visualMapColors||["#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]},textStyle:{color:t.visualMapTextColor||"#333"}}},getSeriesData(t,n){const o=n.filter(r=>{var l;return(l=t==null?void 0:t.displayMetrics)==null?void 0:l.includes(`${r.name}.${r.metricId}`)});let a=[];return o.forEach(r=>{r.rows.forEach(l=>{var i;a.push({name:l.name,type:"map",map:t.mapName||"china",roam:t.roam!==!1,label:{show:((i=t.label)==null?void 0:i.show)||!1,fontSize:10},emphasis:{label:{show:!0}},data:r.headers.map((s,c)=>{var h;return{name:s,value:((h=l.values)==null?void 0:h[c])||0}})})})}),a}}};function Dg(t,n,o,a,r,l){return e.openBlock(),e.createElementBlock("div",{ref:"chartRef",class:e.normalizeClass({chart:o.isBi}),style:e.normalizeStyle({height:o.height})},null,6)}const vd=j(Tg,[["render",Dg],["__scopeId","data-v-37b2533e"]]),Mg={name:"ReportTable",props:{rawData:{type:Object,required:!0},height:{type:String,default:"100%"},maxHeight:{type:String,default:null},border:{type:Boolean,default:!0},stripe:{type:Boolean,default:!0},size:{type:String,default:"default"},showPagination:{type:Boolean,default:!0},pageSizes:{type:Array,default:()=>[10,20,50,100]},pageSize:{type:Number,default:10}},data(){return{currentPage:1,total:0,tableData:[],metrics:[]}},computed:{pagedTableData(){const t=(this.currentPage-1)*this.pageSize,n=t+this.pageSize;return this.tableData.slice(t,n)}},watch:{rawData:{handler:"updateTable",deep:!0,immediate:!0}},methods:{updateTable(){const{dataSet:t}=this.rawData,n=t.tables;if(!n||n.length===0)return;const o=n[0].originalHeaders.map(a=>a.split(" ")[0]);this.metrics=n.map((a,r)=>({prop:`metric_${r}`,label:a.metricName})),this.tableData=o.map((a,r)=>{let l={time:a};return n.forEach((i,s)=>{l[`metric_${s}`]=i.rows[0].values[r]||0}),l}),this.total=this.tableData.length},handleSortChange({column:t,prop:n,order:o}){this.$emit("sort-change",{column:t,prop:n,order:o})},handleSizeChange(t){this.pageSize=t,this.currentPage=1},handleCurrentChange(t){this.currentPage=t}}},Rg={key:0,class:"pagination-container"};function Og(t,n,o,a,r,l){const i=e.resolveComponent("el-table-column"),s=e.resolveComponent("el-table"),c=e.resolveComponent("el-pagination");return e.openBlock(),e.createElementBlock("div",{class:"report-table-container",style:e.normalizeStyle({height:o.height})},[e.createVNode(s,{data:l.pagedTableData,border:o.border,stripe:o.stripe,size:o.size,"max-height":o.maxHeight,style:{width:"100%"},onSortChange:l.handleSortChange},{default:e.withCtx(()=>[e.createVNode(i,{prop:"time",label:"交易时间",sortable:"",align:"center",width:"180"}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.metrics,(h,p)=>(e.openBlock(),e.createBlock(i,{key:p,prop:h.prop,label:h.label,sortable:"",align:"center"},null,8,["prop","label"]))),128))]),_:1},8,["data","border","stripe","size","max-height","onSortChange"]),o.showPagination?(e.openBlock(),e.createElementBlock("div",Rg,[e.createVNode(c,{"current-page":r.currentPage,"page-sizes":o.pageSizes,"page-size":o.pageSize,size:"small",layout:"total, sizes, prev, pager, next, jumper",total:r.total,onSizeChange:l.handleSizeChange,onCurrentChange:l.handleCurrentChange},null,8,["current-page","page-sizes","page-size","total","onSizeChange","onCurrentChange"])])):e.createCommentVNode("",!0)],4)}const Qd=j(Mg,[["render",Og],["__scopeId","data-v-81083195"]]),Pg={name:"ChartTitle",props:{title:{type:String,default:""},subtitle:{type:String,default:""},align:{type:String,default:"center",validator:t=>["left","center","right"].includes(t)},titleStyle:{type:Object,default:()=>({color:"#333",fontSize:"18px",fontWeight:"bold",marginBottom:"10px"})},subtitleStyle:{type:Object,default:()=>({color:"#666",fontSize:"14px",marginTop:"4px"})},showDivider:{type:Boolean,default:!1},dividerColor:{type:String,default:"#eee"}},computed:{titleText(){return this.title||"图表标题"},textStyle(){return{textAlign:this.align,...this.titleStyle}},containerStyle(){return{borderBottom:this.showDivider?`1px solid ${this.dividerColor}`:"none",paddingBottom:this.showDivider?"10px":"0"}}}};function qg(t,n,o,a,r,l){return e.openBlock(),e.createElementBlock("div",{class:"chart-title-container",style:e.normalizeStyle(o.titleStyle)},[e.createElementVNode("div",{class:"title-text",style:e.normalizeStyle(l.textStyle)},e.toDisplayString(l.titleText),5),o.subtitle?(e.openBlock(),e.createElementBlock("div",{key:0,class:"subtitle-text",style:e.normalizeStyle(o.subtitleStyle)},e.toDisplayString(o.subtitle),5)):e.createCommentVNode("",!0)],4)}const zd=j(Pg,[["render",qg],["__scopeId","data-v-2679bda5"]]),vg={Bar:qa,Line:Nd,Pie:Td,Area:Dd,Metric:Md,Gauge:Rd,Funnel:Od,Scatter:Pd,Radar:qd,Map:vd,ReportTable:Qd,ChartTitle:zd},Qg={name:"lwBiChartItem",components:{BarChart:qa,LineChart:Nd,PieChart:Td,AreaChart:Dd,MetricCard:Md,GaugeChart:Rd,FunnelChart:Od,ScatterChart:Pd,RadarChart:qd,MapChart:vd,ReportTable:Qd,ChartTitle:zd},provide(){return{echarts:e4}},props:{rawData:{type:Object,default:null},height:{type:String,default:"300px"},isBi:{type:Boolean,default:!0}},computed:{isShow(){var t,n,o;return this.rawData&&(((t=this.rawData)==null?void 0:t.setting)&&((n=this.rawData)==null?void 0:n.dataSet)||((o=this.rawData)==null?void 0:o.option))},chartType(){var t;return((t=this.rawData)==null?void 0:t.type)||"Bar"},chartComponent(){return vg[this.chartType]||qa}}};function zg(t,n,o,a,r,l){return l.isShow?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(l.chartComponent),{key:0,rawData:o.rawData,height:o.height,isBi:o.isBi},null,8,["rawData","height","isBi"])):e.createCommentVNode("",!0)}const Ud=j(Qg,[["render",zg]]),Ug={components:{GridLayout:za.GridLayout,GridItem:za.GridItem},data(){return{id:"",searchOptions:[],chartPageRefs:[],chartList:[],globalFilter:{values:{},ranges:{}},searchParams:{}}},props:{chartId:{type:String,default:""},designMode:{type:Boolean,default:!1}},watch:{chartId:{handler(t){this.id=t||this.$route.query.id,this.getDataList()},deep:!0,immediate:!0}},methods:{async getDataList(){let t=await this.$http.get(`${this.$config.API_URL}/bi-manage/{tenantId}/{buCode}/dashboard_render/${this.id}`);this.chartList=(t==null?void 0:t.charts)||[],this.getFilter(t.filterControls)},async changeTimeUnit(t,n){let{data:o,...a}=t,r=await this.$http.get(`${this.$config.API_URL}/bi-manage/{tenantId}/{buCode}/visualize/${a.id}`);r==null||r.models.forEach(c=>{c==null||c.dimensions.forEach(h=>{h.timeSetting.timeUnit=t.timeUnit})});let l=this.unflattenObject(this.searchParams);l.ranges&&Object.entries(l.ranges).map(([c,h])=>{this.globalFilter.ranges[c].timeRange={from:h[0],to:h[1]}}),this.globalFilter.values=l.values;let i={charts:[a],globalFilter:this.globalFilter,visualizes:[r]},s=await this.$http.post(`${this.$config.API_URL}/bi-manage/{tenantId}/{buCode}/dashboard_render/${this.id}/partial_refresh`,i);this.chartList[n].data=(s==null?void 0:s[n].data)||[],this.chartList[n].timeUnit=t.timeUnit},unflattenObject(t){const n={};for(const o in t){const a=o.split(".");let r=n;a.forEach((l,i)=>{i===a.length-1?r[l]=t[o]:((!r[l]||typeof r[l]!="object")&&(r[l]={}),r=r[l])})}return n},search(){let t=JSON.parse(JSON.stringify(this.globalFilter)),n=this.unflattenObject(this.searchParams);n.ranges&&Object.entries(n.ranges).map(([o,a])=>{t.ranges[o].timeRange={from:(a==null?void 0:a[0])||this.globalFilter.ranges[o].timeRange.from,to:(a==null?void 0:a[1])||this.globalFilter.ranges[o].timeRange.to},t.ranges[o].type="ABSOLUTE"}),t.values=n.values,this.getChartList(t),this.chartPageRefs.length>0&&this.chartPageRefs.forEach(o=>{o.searchParams=this.searchParams,o.globalFilter=t,o.search()})},reset(){this.getChartList({values:{},ranges:{}}),this.chartPageRefs.length>0&&this.chartPageRefs.forEach(t=>{t.getChartList({values:{},ranges:{}})})},async getChartList(t={}){let n={charts:this.chartList.map(({data:o,...a})=>a),globalFilter:t};this.chartList=await this.$http.post(`${this.$config.API_URL}/bi-manage/{tenantId}/{buCode}/dashboard/design_mode/render`,n)},removeChart(t){this.modelValue.splice(t,1)},listToTree(t){const n=[],o={};return t.forEach(a=>{o[a.id]={value:a.id,label:a.name,children:[]}}),t.forEach(a=>{const r=o[a.parent];r?r.children.push(o[a.id]):n.push(o[a.id])}),n},async getFilter(t){var n,o;for(const a of t){const{type:r}=a,l=async s=>{const{type:c,dict:h,dataInterfaceUri:p,dimensionTableId:f}=s.options;return c==="DICT"?Object.entries(h).map(([y,w])=>({value:y,label:w})):c==="DATA_INTERFACE"?(await this.$http.get(p)).map(w=>({value:w.id,label:w.name})):(await this.$api.dimensionChild.list({},f)).map(w=>({value:w.id,label:w.name}))},i=async s=>{const{type:c,dict:h,dataInterfaceUri:p,dimensionTableId:f}=s.options;if(c==="DICT")return Object.entries(h).map(([y,w])=>({value:y,label:w}));if(c==="DATA_INTERFACE"){const y=await this.$http.get(p);return this.listToTree(y)}else{const y=await this.$api.dimensionChild.list({},f);return this.listToTree(y)}};switch(r){case"DATA_PICKER":{const s=a.dataPickerSetting,c=await l(s);this.searchParams[`values.${s.code}`]=(s==null?void 0:s.value)||"",this.searchOptions.push({label:a.name,prop:`values.${s.code}`,renderType:"select",options:c,value:(s==null?void 0:s.value)||"",valueKey:"value",labelKey:"label"});break}case"DATA_CASCADE":{const s=a.dataPickerSetting,c=await i(s);this.searchParams[`values.${s.code}`]=(s==null?void 0:s.value)||"",this.searchOptions.push({label:a.name,name:`values.${s.code}`,value:(s==null?void 0:s.value)||"",component:"treeSelect",options:{items:c,placeholder:"请选择"+a.name,checkStrictly:!0}});break}case"DATA_INPUT":{this.searchParams[`values.${a.dataInputSetting.code}`]=((n=a.dataInputSetting)==null?void 0:n.value)||"",this.searchOptions.push({label:a.name,prop:`values.${a.dataInputSetting.code}`,value:((o=a.dataInputSetting)==null?void 0:o.value)||"",renderType:"input"});break}case"DATE_PICKER":{const s=a.datePickerSetting;let c=[];switch(a.datePickerSetting.type){case"TODAY":c=[ae().format("YYYY-MM-DDTHH:mm:ss.SSSZ"),ae().format("YYYY-MM-DDTHH:mm:ss.SSSZ")];break;case"THIS_MONTH":c=[ae().startOf("month").format("YYYY-MM-DDTHH:mm:ss.SSSZ"),ae().endOf("month").format("YYYY-MM-DDTHH:mm:ss.SSSZ")];break;case"THIS_YEAR":c=[ae().startOf("year").format("YYYY-MM-DDTHH:mm:ss.SSSZ"),ae().endOf("year").format("YYYY-MM-DDTHH:mm:ss.SSSZ")];break;case"LAST_10_DAYS":c=[ae().subtract(10,"day").format("YYYY-MM-DDTHH:mm:ss.SSSZ"),ae().format("YYYY-MM-DDTHH:mm:ss.SSSZ")];break;case"LAST_30_DAYS":c=[ae().subtract(30,"day").format("YYYY-MM-DDTHH:mm:ss.SSSZ"),ae().format("YYYY-MM-DDTHH:mm:ss.SSSZ")];break;case"LAST_12_MONTH":c=[ae().subtract(12,"month").format("YYYY-MM-DDTHH:mm:ss.SSSZ"),ae().format("YYYY-MM-DDTHH:mm:ss.SSSZ")];break;case"LAST_5_YEAR":c=[ae().subtract(5,"year").format("YYYY-MM-DDTHH:mm:ss.SSSZ"),ae().format("YYYY-MM-DDTHH:mm:ss.SSSZ")];break;case"LAST_60_SECONDS":c=[ae().subtract(60,"second").toISOString(),ae().toISOString()];break;case"LAST_30_MINUTES":c=[ae().subtract(30,"minute").toISOString(),ae().toISOString()];break;case"LAST_24_HOURS":c=[ae().subtract(24,"hour").toISOString(),ae().toISOString()];break;case"CURRENT_MONDAY_TO_TODAY":c=[ae().startOf("week").add(1,"day").format("YYYY-MM-DDTHH:mm:ss.SSSZ"),ae().format("YYYY-MM-DDTHH:mm:ss.SSSZ")];break;case"YESTERDAY":c=[ae().subtract(1,"day").format("YYYY-MM-DDTHH:mm:ss.SSSZ"),ae().subtract(1,"day").format("YYYY-MM-DDTHH:mm:ss.SSSZ")];break;case"LAST_YEAR":c=[ae().subtract(1,"year").startOf("year").format("YYYY-MM-DDTHH:mm:ss.SSSZ"),ae().subtract(1,"year").endOf("year").format("YYYY-MM-DDTHH:mm:ss.SSSZ")];break;case"ABSOLUTE":c=[a.datePickerSetting.timeRange.from,a.datePickerSetting.timeRange.to];break;default:c=[];break}this.searchParams[`ranges.${s.code}`]=c,this.searchOptions.push({label:a.name,prop:`ranges.${s.code}`,renderType:"dateRange",value:c,valueFormat:"YYYY-MM-DDTHH:mm:ss.SSSZ"}),this.globalFilter.ranges[s.code]={timeRange:{from:(c==null?void 0:c[0])||"",to:(c==null?void 0:c[1])||""},type:s.type};break}}}}}},Gg={class:"lw-bi-chart-global-layout"},Hg={key:0,class:"filter-top"},jg={key:1,class:"grid-item-dashboard"},Zg=["onClick"],Yg={key:1,class:"no-record-panel e-unselect"};function Kg(t,n,o,a,r,l){const i=e.resolveComponent("lw-search"),s=e.resolveComponent("el-radio-button"),c=e.resolveComponent("el-radio-group"),h=e.resolveComponent("lwBiChartPage"),p=e.resolveComponent("lwBiChartItem"),f=e.resolveComponent("el-button"),y=e.resolveComponent("GridItem"),w=e.resolveComponent("GridLayout"),b=e.resolveComponent("el-empty");return e.openBlock(),e.createElementBlock("div",Gg,[r.searchOptions.length>0?(e.openBlock(),e.createBlock(i,{key:0,class:"search-body",options:r.searchOptions,modelValue:r.searchParams,"onUpdate:modelValue":n[0]||(n[0]=B=>r.searchParams=B),hideLabel:!0,onSearch:l.search,onReset:l.reset},null,8,["options","modelValue","onSearch","onReset"])):e.createCommentVNode("",!0),e.createVNode(w,{layout:r.chartList,"onUpdate:layout":n[1]||(n[1]=B=>r.chartList=B),"col-num":12,"row-height":30,"is-draggable":o.designMode,"is-resizable":o.designMode,"use-css-transforms":!1,"vertical-compact":""},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.chartList,(B,V)=>(e.openBlock(),e.createBlock(y,{key:B.i,x:B.x,y:B.y,w:B.w,h:B.h,i:B.i},{default:e.withCtx(()=>{var F,S,E,q;return[e.createElementVNode("div",{class:e.normalizeClass(["lw-bi-chart-global-layout-item",{edit:o.designMode}])},[(S=(F=B.data)==null?void 0:F.setting)!=null&&S.activeDateUnitFilter?(e.openBlock(),e.createElementBlock("div",Hg,[e.createVNode(c,{modelValue:B.timeUnit,"onUpdate:modelValue":v=>B.timeUnit=v,onChange:v=>l.changeTimeUnit(B,V)},{default:e.withCtx(()=>{var v,_,P,L;return[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList((_=(v=B.data)==null?void 0:v.setting)==null?void 0:_.optionalDateUnitRanges,(G,N)=>(e.openBlock(),e.createBlock(s,{label:N,value:G,key:N},null,8,["label","value"]))),128)),Object.keys((L=(P=B.data)==null?void 0:P.setting)==null?void 0:L.optionalDateUnitRanges).length==0?(e.openBlock(),e.createBlock(s,{key:0,disabled:""},{default:e.withCtx(()=>n[2]||(n[2]=[e.createTextVNode(" 未选择周期列表 未选择周期列表 ")])),_:1})):e.createCommentVNode("",!0)]}),_:2},1032,["modelValue","onUpdate:modelValue","onChange"])])):e.createCommentVNode("",!0),(B==null?void 0:B.type)=="Dashboard"?(e.openBlock(),e.createElementBlock("div",jg,[e.createVNode(h,{ref_for:!0,ref:v=>{v&&(r.chartPageRefs[V]=v)},chartId:B.id},null,8,["chartId"])])):e.createCommentVNode("",!0),e.createVNode(p,{rawData:B.data,height:(q=(E=B.data)==null?void 0:E.setting)!=null&&q.activeDateUnitFilter?"calc(100% - 36px)":"100%"},null,8,["rawData","height"]),o.designMode?(e.openBlock(),e.createElementBlock("div",{key:2,class:"remove",onClick:v=>l.removeChart(V)},[e.createVNode(f,{type:"primary",link:"",icon:"el-icon-delete"})],8,Zg)):e.createCommentVNode("",!0)],2)]}),_:2},1032,["x","y","w","h","i"]))),128))]),_:1},8,["layout","is-draggable","is-resizable"]),r.chartList.length===0?(e.openBlock(),e.createElementBlock("div",Yg,[e.createVNode(b,{description:o.designMode?"点击上方工具栏中的按钮,添加图表至当前仪表板":"仪表板中还没有添加任何图表"},null,8,["description"])])):e.createCommentVNode("",!0)])}const Gd=j(Ug,[["render",Kg],["__scopeId","data-v-9e354eb5"]]);/*!
|
|
25
25
|
* vue-router v4.5.0
|
|
26
26
|
* (c) 2024 Eduardo San Martin Morote
|
|
27
27
|
* @license MIT
|