st-comp 0.0.157 → 0.0.159

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.
package/es/KlineBasic.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";require("./base-0ca7c43a.cjs");const ge=require("./el-overlay-41994f67.cjs");require("./el-input-6a3805c5.cjs");const he=require("./el-input-number-96ff2e47.cjs"),ve=require("./el-button-62966947.cjs"),be=require("./el-empty-2ece1134.cjs"),de=require("./el-menu-item-4c9eb7ad.cjs");require("./el-tooltip-0ea8fbf8.cjs");require("./el-popper-7adbf1c6.cjs");const e=require("vue"),xe=require("echarts"),J=require("./index-a96158ae.cjs"),se=require("./el-message-d5ed7a4f.cjs"),ae=require("./_plugin-vue_export-helper-f246444f.cjs");require("./el-tag-9732314f.cjs");const fe=require("./el-select-31f8ac8a.cjs");require("./el-scrollbar-ac525239.cjs");require("./vnode-b15eb11b.cjs");require("./index-65b4113e.cjs");require("./index-afc88a4b.cjs");require("./use-form-common-props-74a96df2.cjs");require("./index-375e8de4.cjs");require("./scroll-339681d4.cjs");require("./index-2f958e56.cjs");require("./typescript-b63f8e83.cjs");require("./index-1d85ba4b.cjs");require("./index-eea0bcb3.cjs");require("./config-provider-cfbb9cd8.cjs");require("./index-9e6e8d03.cjs");require("./castArray-a78ae889.cjs");require("./debounce-cf26af24.cjs");function _e(s){const N=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const E in s)if(E!=="default"){const S=Object.getOwnPropertyDescriptor(s,E);Object.defineProperty(N,E,S.get?S:{enumerable:!0,get:()=>s[E]})}}return N.default=s,Object.freeze(N)}const ue=_e(xe);var Ye=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function De(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var pe={exports:{}};(function(s,N){(function(E,S){s.exports=S()})(Ye,function(){var E=1e3,S=6e4,T=36e5,t="millisecond",$="second",D="minute",h="hour",_="day",V="week",l="month",d="quarter",M="year",v="date",I="Invalid Date",F=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,j=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,R={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(c){var i=["th","st","nd","rd"],o=c%100;return"["+c+(i[(o-20)%10]||i[o]||i[0])+"]"}},H=function(c,i,o){var u=String(c);return!u||u.length>=i?c:""+Array(i+1-u.length).join(o)+c},b={s:H,z:function(c){var i=-c.utcOffset(),o=Math.abs(i),u=Math.floor(o/60),a=o%60;return(i<=0?"+":"-")+H(u,2,"0")+":"+H(a,2,"0")},m:function c(i,o){if(i.date()<o.date())return-c(o,i);var u=12*(o.year()-i.year())+(o.month()-i.month()),a=i.clone().add(u,l),y=o-a<0,r=i.clone().add(u+(y?-1:1),l);return+(-(u+(o-a)/(y?a-r:r-a))||0)},a:function(c){return c<0?Math.ceil(c)||0:Math.floor(c)},p:function(c){return{M:l,y:M,w:V,d:_,D:v,h,m:D,s:$,ms:t,Q:d}[c]||String(c||"").toLowerCase().replace(/s$/,"")},u:function(c){return c===void 0}},P="en",W={};W[P]=R;var ee="$isDayjsObject",z=function(c){return c instanceof ne||!(!c||!c[ee])},te=function c(i,o,u){var a;if(!i)return P;if(typeof i=="string"){var y=i.toLowerCase();W[y]&&(a=y),o&&(W[y]=o,a=y);var r=i.split("-");if(!a&&r.length>1)return c(r[0])}else{var n=i.name;W[n]=i,a=n}return!u&&a&&(P=a),a||!u&&P},C=function(c,i){if(z(c))return c.clone();var o=typeof i=="object"?i:{};return o.date=c,o.args=arguments,new ne(o)},Y=b;Y.l=te,Y.i=z,Y.w=function(c,i){return C(c,{locale:i.$L,utc:i.$u,x:i.$x,$offset:i.$offset})};var ne=function(){function c(o){this.$L=te(o.locale,null,!0),this.parse(o),this.$x=this.$x||o.x||{},this[ee]=!0}var i=c.prototype;return i.parse=function(o){this.$d=function(u){var a=u.date,y=u.utc;if(a===null)return new Date(NaN);if(Y.u(a))return new Date;if(a instanceof Date)return new Date(a);if(typeof a=="string"&&!/Z$/i.test(a)){var r=a.match(F);if(r){var n=r[2]-1||0,f=(r[7]||"0").substring(0,3);return y?new Date(Date.UTC(r[1],n,r[3]||1,r[4]||0,r[5]||0,r[6]||0,f)):new Date(r[1],n,r[3]||1,r[4]||0,r[5]||0,r[6]||0,f)}}return new Date(a)}(o),this.init()},i.init=function(){var o=this.$d;this.$y=o.getFullYear(),this.$M=o.getMonth(),this.$D=o.getDate(),this.$W=o.getDay(),this.$H=o.getHours(),this.$m=o.getMinutes(),this.$s=o.getSeconds(),this.$ms=o.getMilliseconds()},i.$utils=function(){return Y},i.isValid=function(){return this.$d.toString()!==I},i.isSame=function(o,u){var a=C(o);return this.startOf(u)<=a&&a<=this.endOf(u)},i.isAfter=function(o,u){return C(o)<this.startOf(u)},i.isBefore=function(o,u){return this.endOf(u)<C(o)},i.$g=function(o,u,a){return Y.u(o)?this[u]:this.set(a,o)},i.unix=function(){return Math.floor(this.valueOf()/1e3)},i.valueOf=function(){return this.$d.getTime()},i.startOf=function(o,u){var a=this,y=!!Y.u(u)||u,r=Y.p(o),n=function(k,O){var U=Y.w(a.$u?Date.UTC(a.$y,O,k):new Date(a.$y,O,k),a);return y?U:U.endOf(_)},f=function(k,O){return Y.w(a.toDate()[k].apply(a.toDate("s"),(y?[0,0,0,0]:[23,59,59,999]).slice(O)),a)},p=this.$W,g=this.$M,m=this.$D,w="set"+(this.$u?"UTC":"");switch(r){case M:return y?n(1,0):n(31,11);case l:return y?n(1,g):n(0,g+1);case V:var B=this.$locale().weekStart||0,q=(p<B?p+7:p)-B;return n(y?m-q:m+(6-q),g);case _:case v:return f(w+"Hours",0);case h:return f(w+"Minutes",1);case D:return f(w+"Seconds",2);case $:return f(w+"Milliseconds",3);default:return this.clone()}},i.endOf=function(o){return this.startOf(o,!1)},i.$set=function(o,u){var a,y=Y.p(o),r="set"+(this.$u?"UTC":""),n=(a={},a[_]=r+"Date",a[v]=r+"Date",a[l]=r+"Month",a[M]=r+"FullYear",a[h]=r+"Hours",a[D]=r+"Minutes",a[$]=r+"Seconds",a[t]=r+"Milliseconds",a)[y],f=y===_?this.$D+(u-this.$W):u;if(y===l||y===M){var p=this.clone().set(v,1);p.$d[n](f),p.init(),this.$d=p.set(v,Math.min(this.$D,p.daysInMonth())).$d}else n&&this.$d[n](f);return this.init(),this},i.set=function(o,u){return this.clone().$set(o,u)},i.get=function(o){return this[Y.p(o)]()},i.add=function(o,u){var a,y=this;o=Number(o);var r=Y.p(u),n=function(g){var m=C(y);return Y.w(m.date(m.date()+Math.round(g*o)),y)};if(r===l)return this.set(l,this.$M+o);if(r===M)return this.set(M,this.$y+o);if(r===_)return n(1);if(r===V)return n(7);var f=(a={},a[D]=S,a[h]=T,a[$]=E,a)[r]||1,p=this.$d.getTime()+o*f;return Y.w(p,this)},i.subtract=function(o,u){return this.add(-1*o,u)},i.format=function(o){var u=this,a=this.$locale();if(!this.isValid())return a.invalidDate||I;var y=o||"YYYY-MM-DDTHH:mm:ssZ",r=Y.z(this),n=this.$H,f=this.$m,p=this.$M,g=a.weekdays,m=a.months,w=a.meridiem,B=function(O,U,Z,A){return O&&(O[U]||O(u,y))||Z[U].slice(0,A)},q=function(O){return Y.s(n%12||12,O,"0")},k=w||function(O,U,Z){var A=O<12?"AM":"PM";return Z?A.toLowerCase():A};return y.replace(j,function(O,U){return U||function(Z){switch(Z){case"YY":return String(u.$y).slice(-2);case"YYYY":return Y.s(u.$y,4,"0");case"M":return p+1;case"MM":return Y.s(p+1,2,"0");case"MMM":return B(a.monthsShort,p,m,3);case"MMMM":return B(m,p);case"D":return u.$D;case"DD":return Y.s(u.$D,2,"0");case"d":return String(u.$W);case"dd":return B(a.weekdaysMin,u.$W,g,2);case"ddd":return B(a.weekdaysShort,u.$W,g,3);case"dddd":return g[u.$W];case"H":return String(n);case"HH":return Y.s(n,2,"0");case"h":return q(1);case"hh":return q(2);case"a":return k(n,f,!0);case"A":return k(n,f,!1);case"m":return String(f);case"mm":return Y.s(f,2,"0");case"s":return String(u.$s);case"ss":return Y.s(u.$s,2,"0");case"SSS":return Y.s(u.$ms,3,"0");case"Z":return r}return null}(O)||r.replace(":","")})},i.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},i.diff=function(o,u,a){var y,r=this,n=Y.p(u),f=C(o),p=(f.utcOffset()-this.utcOffset())*S,g=this-f,m=function(){return Y.m(r,f)};switch(n){case M:y=m()/12;break;case l:y=m();break;case d:y=m()/3;break;case V:y=(g-p)/6048e5;break;case _:y=(g-p)/864e5;break;case h:y=g/T;break;case D:y=g/S;break;case $:y=g/E;break;default:y=g}return a?y:Y.a(y)},i.daysInMonth=function(){return this.endOf(l).$D},i.$locale=function(){return W[this.$L]},i.locale=function(o,u){if(!o)return this.$L;var a=this.clone(),y=te(o,u,!0);return y&&(a.$L=y),a},i.clone=function(){return Y.w(this.$d,this)},i.toDate=function(){return new Date(this.valueOf())},i.toJSON=function(){return this.isValid()?this.toISOString():null},i.toISOString=function(){return this.$d.toISOString()},i.toString=function(){return this.$d.toUTCString()},c}(),re=ne.prototype;return C.prototype=re,[["$ms",t],["$s",$],["$m",D],["$H",h],["$W",_],["$M",l],["$y",M],["$D",v]].forEach(function(c){re[c[1]]=function(i){return this.$g(i,c[0],c[1])}}),C.extend=function(c,i){return c.$i||(c(i,ne,C),c.$i=!0),C},C.locale=te,C.isDayjs=z,C.unix=function(c){return C(1e3*c)},C.en=W[P],C.Ls=W,C.p={},C})})(pe);var Me=pe.exports;const x=De(Me);let Q=null;const we=s=>{const N=J.y(s,{handleReq:E=>{J.v()&&(E.headers.token=J.U())},handleRes:E=>{const{data:S}=E;if(S.code===401)return location.origin.includes("localhost")?location.href=`${location.origin}/#/404`:J.K(),!0}});N.get,Q=N.post},ke=s=>Q("/middleLayer/kline/getKlineBasic",{...s,userId:J.V("id")}),Se=s=>Q("/middleLayer/kline/getKline",s),$e=async s=>Q("/alarm/deliversign/addAlarmPrice",{...s,userId:J.V("id")}),Te=async s=>Q("/alarm/deliversign/findAlarmPriceByUserId",{...s,userId:J.V("id")}),me=async s=>Q("/alarm/deliversign/updateAlarmPrice",{...s,userId:J.V("id")}),Ve=async s=>Q("/alarm/deliversign/deleteAlarmPrice",{...s,userId:J.V("id")}),{round:oe}=J.x,Le=(s,N,E,S,T)=>{const{data:t,time:$}=s,{gridTop:D,gridRight:h,gridLeft:_,maxShowCounts:V,showSubChart:l}=N;return{animation:!1,grid:{top:`${D}px`,right:`${h}px`,bottom:l?"6px":"24px",left:`${_}px`},dataZoom:[{type:"inside",startValue:E,endValue:S,maxValueSpan:V}],tooltip:{trigger:"axis",appendToBody:!0,confine:!0,axisPointer:{type:"cross",label:{rich:{},formatter:d=>{const{axisDimension:M,value:v}=d;return M==="x"?l?"":["6","7","8"].includes(T)?x(v).format("YYYY-MM-DD"):v:String(oe(v))}}},formatter:()=>""},xAxis:{show:!l,type:"category",data:$,splitLine:{show:!1},axisLabel:{formatter:d=>["6","7","8"].includes(T)?x(d).format("YYYY-MM-DD"):d}},yAxis:{type:"value",axisLine:{show:!0},splitLine:{show:!0,lineStyle:{type:"dotted",color:"#333"}},min:d=>oe(d.min),max:d=>oe(d.max)},series:[{type:"candlestick",data:t,itemStyle:{color:"transparent",color0:"#00FFFF",borderColor:"#FF0000",borderColor0:"#00FFFF",borderWidth:1}},...s.mainIndicator.map(d=>({name:d.key,type:"line",silent:!0,symbol:"none",data:d.data,lineStyle:{width:d.width||1},itemStyle:{color:d.color}}))],toolbox:{show:!1},brush:{xAxisIndex:"all",brushLink:"all",transformable:!1,outOfBrush:{colorAlpha:2},brushStyle:{color:"rgba(255,255,255,0.1)",borderColor:"rgba(255,255,255,0.4)"}}}},Be=(s,N,E,S,T)=>{const{variety:t,featureId:$,featureType:D}=E,{gridTop:h,gridLeft:_,gridRight:V}=S;return N.reduce((l,d)=>{const{warnPrice:M}=d,v=s==null?void 0:s.convertToPixel({yAxisIndex:0},M);if(v<=h||v>=(s==null?void 0:s.getHeight()))return l;let I=0;return[...l,{type:"group",name:"warningLine",info:d,draggable:"vertical",children:[{type:"line",info:d,shape:{x1:_,y1:v,x2:(s==null?void 0:s.getWidth())-V,y2:v},style:{stroke:"#FFF",lineWidth:1,lineDash:[8,4]},z:10},{type:"text",info:d,x:(s==null?void 0:s.getWidth())-V,y:v-5,style:{fill:"#FFF",text:M,stroke:"#000",lineWidth:1,opacity:1},z:10}],ondragstart:F=>{I=F.offsetY},ondrag:F=>{var j;if(F.target&&F.target.childAt(1)){const R=s.convertFromPixel({yAxisIndex:0},v+(F.offsetY-I));(j=F.target.childAt(1))==null||j.animate("style",!1).when(1,{text:oe(R,3)}).start()}},ondragend:async F=>{const R=F.offsetY-I;if(R!==0){const H=s==null?void 0:s.convertFromPixel({yAxisIndex:0},R+v),b={id:d.id,warnPrice:oe(H,3),featureId:$,featureCode:t,featureType:D};await me(b),se.ElMessage.success("画线预警修改成功"),T&&T()}}}]},[])},Oe={class:"kline-tips"},Ne=e.defineComponent({__name:"index",props:{data:{type:Array,require:!0}},setup(s){return(N,E)=>(e.openBlock(),e.createElementBlock("div",Oe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.data,(S,T)=>(e.openBlock(),e.createElementBlock("div",{key:T,class:"kline-tips-item",style:e.normalizeStyle({color:S.color})},e.toDisplayString(S.label)+" "+e.toDisplayString(S.value),5))),128))]))}});const ce=ae._export_sfc(Ne,[["__scopeId","data-v-f83b6b36"]]);const Ee={class:"kline-tips"},Fe={__name:"index",props:{data:{type:Object,require:!0},activeIndex:{type:[Number,String],require:!0}},setup(s){const{round:N,formatValue:E}=J.x,S=s,T=e.computed(()=>{const{data:$,activeIndex:D}=S;if($.data&&$.data[D]){const h=$.data[D],_=[{label:"开",value:N(h[0])},{label:"高",value:N(h[3])},{label:"低",value:N(h[2])},{label:"收",value:N(h[1])}];h[4]!==null&&_.push({label:"额",value:E(h[4])});let V;return h[6]>0?V="red":h[6]<0&&(V="green"),_.push({label:"涨跌",value:`${N(h[6])}%`,color:V}),_}return[]}),t=e.computed(()=>{var h;const{data:$,activeIndex:D}=S;return((h=$==null?void 0:$.mainIndicator)==null?void 0:h.map(_=>({label:_.key,value:N(_.data[D]),color:_.color})))||[]});return($,D)=>(e.openBlock(),e.createElementBlock("div",Ee,[e.createVNode(ce,{data:T.value},null,8,["data"]),e.createVNode(ce,{data:t.value},null,8,["data"])]))}},qe=ae._export_sfc(Fe,[["__scopeId","data-v-64b5c2a3"]]);const Ae={class:"klineSub"},Re={class:"klineSub-tips"},Ie={key:0,class:"klineSub-tips-select"},Ce={__name:"index",props:{cycle:{type:[String,Number],default:()=>null},data:{type:Object,require:!0},activeIndex:{type:[Number,String],require:!0},modelValue:{type:String,required:!0},subIndicatorList:{type:Array,required:!0}},emits:["update:modelValue"],setup(s,{expose:N,emit:E}){const{round:S}=J.x;let T,t;const $=E,D=s,h=e.ref(),_=e.computed({get(){return D.modelValue},set(d){$("update:modelValue",d)}}),V=e.computed(()=>{var v;const{data:d,activeIndex:M}=D;return((v=d==null?void 0:d.subIndicator)==null?void 0:v.map(I=>({label:I.key,color:I.color,value:I.data[M]||"-"})))||[]});e.onMounted(()=>{T=ue.init(h.value);let d=!0;t=new ResizeObserver(()=>{if(d){d=null;return}T.resize()}),t.observe(h.value)}),e.onUnmounted(()=>{T.dispose(),t.disconnect(),t=null});const l=(d,M)=>{const v=d[M],I=M===0?d[M]:d[M-1];return v[0]===v[1]?v[0]>=I[1]?{color:"transparent",borderColor:"#FF0000"}:{color:"#00FFFF"}:v[1]>v[0]?{color:"transparent",borderColor:"#FF0000"}:{color:"#00FFFF"}};return N({connect:d=>{ue.connect([d,T])},draw:(d,M)=>{e.nextTick(()=>{const{startValue:v,endValue:I,maxValueSpan:F}=d,{leftYAxisRange:j,rightYAxisRange:R}=D.data.subIndicator[0],H=D.data.subIndicator.map(b=>{if(b.series==="bar")return{name:"subMain",xAxisIndex:0,yAxisIndex:1,type:"bar",silent:!0,symbol:"none",data:b.data.map((P,W)=>b.seriesColor==="kline"?{value:P,itemStyle:l(D.data.data,W)}:b.seriesColor==="value"?{value:P,itemStyle:{color:P>=0?"#FF0000":"#00FFFF"}}:{value:P,itemStyle:{color:b.seriesColor}})};if(b.series==="line")return{xAxisIndex:0,yAxisIndex:b.yAxis==="right"?2:1,name:b.key,type:"line",silent:!0,symbol:"none",data:b.data,lineStyle:{width:1},itemStyle:{color:b.color}}});T.setOption({animation:!1,grid:{left:`${M.gridLeft}px`,top:"10px",right:`${M.gridRight}px`,bottom:"20px"},dataZoom:[{type:"inside",startValue:v,endValue:I,maxValueSpan:F}],tooltip:{trigger:"axis",appendToBody:!0,confine:!0,axisPointer:{type:"cross",label:{rich:{},formatter:b=>{const{axisDimension:P,value:W}=b;if(P==="x")return["6","7","8"].includes(D.cycle)?x(W).format("YYYY-MM-DD"):W;if(b.axisIndex===1)return String(S(W))}}},formatter:()=>""},xAxis:{type:"category",data:D.data.time,axisLine:{show:!0},splitLine:{show:!1},axisLabel:{formatter:b=>["6","7","8"].includes(D.cycle)?x(b).format("YYYY-MM-DD"):b}},yAxis:[{position:"right"},{position:"left",min:j==="cover"?b=>b.min:null,max:j==="cover"?b=>b.max:null,splitNumber:1,axisLine:{show:!0},splitLine:{show:!0,lineStyle:{type:"dotted",color:"#333"}}},{position:"right",min:R==="cover"?b=>b.min:null,max:R==="cover"?b=>b.max:null,splitNumber:1,axisLine:{show:!1},splitLine:{show:!1},axisLabel:{show:!1}}],series:H},!0)})}}),(d,M)=>{const v=fe.ElOption,I=fe.ElSelect;return e.openBlock(),e.createElementBlock("div",Ae,[e.createElementVNode("div",Re,[V.value.length?(e.openBlock(),e.createElementBlock("div",Ie,[e.createVNode(I,{modelValue:_.value,"onUpdate:modelValue":M[0]||(M[0]=F=>_.value=F),size:"small","popper-class":"element-dark",class:"element-dark subIndicator"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.subIndicatorList,F=>(e.openBlock(),e.createBlock(v,{key:F.value,label:F.label,value:F.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])])):e.createCommentVNode("",!0),e.createVNode(ce,{data:V.value},null,8,["data"])]),e.createElementVNode("div",{class:"klineSub-chart",ref_key:"subChartRef",ref:h},null,512)])}}},We=ae._export_sfc(Ce,[["__scopeId","data-v-ab519de5"]]),Pe=e.defineComponent({__name:"index",emits:["closeContextMenuCallBack"],setup(s,{emit:N}){const E=N,S=e.ref(),T=e.ref(),t=e.ref({display:"none",top:"0px",left:"0px"}),$=()=>{t.value.display="none",E("closeContextMenuCallBack"),document.removeEventListener("click",$)},D=h=>{if(h.preventDefault(),t.value.display==="block"){const{offsetX:_,offsetY:V}=h,{offsetWidth:l,offsetHeight:d}=T.value;if(_<=l&&V<=d)return}S.value.click(),t.value={display:"block",top:`${h.offsetY}px`,left:`${h.offsetX}px`},e.nextTick(()=>{const _=S.value.getBoundingClientRect(),V=T.value.getBoundingClientRect();V.left+V.width>=_.right&&(t.value.left=`${h.offsetX-V.width}px`),V.top+V.height>=_.bottom&&(console.log("高度超出"),t.value.top=`${h.offsetY-V.height}px`)}),document.addEventListener("click",$)};return(h,_)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"contextmenuRef",ref:S,class:"contextmenu",onContextmenu:D,onMouseleave:$},[e.renderSlot(h.$slots,"default",{},void 0,!0),t.value.display!=="none"?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"contextmenuContentRef",ref:T,class:"contextmenu-popover",style:e.normalizeStyle(t.value)},[e.renderSlot(h.$slots,"popover",{},void 0,!0)],4)):e.createCommentVNode("",!0)],544))}});const je=ae._export_sfc(Pe,[["__scopeId","data-v-811db6b4"]]);const ye=s=>(e.pushScopeId("data-v-95b8303f"),s=s(),e.popScopeId(),s),He={class:"klineBasic"},ze={class:"klineBasic-tips"},Ue={key:0,class:"klineBasic-sub"},Ze={key:1,class:"klineBasic-empty"},Ke={key:2,class:"klineBasic-error"},Xe=ye(()=>e.createElementVNode("div",{class:"klineBasic-error-content"},"加载失败,请刷新重试",-1)),Je={style:{"text-align":"center"}},Ge=ye(()=>e.createElementVNode("span",{style:{"margin-right":"10px"}},"预警价格:",-1)),Qe={class:"dialog-footer"},et={__name:"index",props:{variety:{type:[String,Number],default:()=>null},varietyName:{type:[String,Number],default:()=>null},featureId:{type:[String,Number],default:()=>null},featureType:{type:[String,Number],default:()=>null},cycle:{type:[String,Number],default:()=>null},mainIndicator:{type:String,default:()=>""},indicatorStore:{type:Object,default:()=>null},startTime:{type:String,default:()=>null},endTime:{type:String,default:()=>null},right:{type:[String,Number],default:1},config:{type:Object,default:()=>({})},env:{type:Object,default:()=>({})},brushRange:{type:[Array,null],default:()=>null}},emits:["change","getFactorData"],setup(s,{expose:N,emit:E}){const S=[{label:"画线预警",key:"drawWarningLine"}];let T=null,t=null,$,D,h=!1,_=!1;const V=E,l=s,d=e.ref(!1),M=e.ref(!1),v=e.ref(null),I=e.ref(null),F=e.ref("VOL"),j=e.ref(0),R=e.ref({}),H=e.ref([]),b=e.ref({}),P=e.ref(!1),W=e.ref(""),ee=e.ref([...S]),z=e.computed(()=>({defaultShowCounts:500,addCounts:2e3,maxShowCounts:5e3,loadCheckCounts:500,showSubChart:!0,gridTop:48,gridLeft:80,gridRight:50,showWarningLine:!0,getFactorData:!0,...l.config}));e.watch(()=>{var r,n;return[l.variety,l.cycle,l.mainIndicator,F.value,(r=l.indicatorStore)==null?void 0:r.filterIndicator,(n=l.indicatorStore)==null?void 0:n.customIndicator]},()=>{Y()},{deep:!0}),e.onMounted(()=>{we(l.env),Y()}),e.onUnmounted(()=>{t==null||t.off("datazoom"),t==null||t.off("highlight"),t==null||t.off("globalout"),t==null||t.dispose(),T==null||T.dispose()});const te=()=>{t||(t=ue.init(v.value),C(),z.value.showSubChart&&I.value.connect(t),T=J.D(v.value),T.listen(()=>{requestAnimationFrame(()=>{t.resize()})}))},C=()=>{t==null||t.on("datazoom",n=>{clearTimeout(D),D=setTimeout(()=>{var p,g,m,w;const{loadCheckCounts:f}=z.value;if((g=(p=t==null?void 0:t.getOption())==null?void 0:p.dataZoom)!=null&&g[0]){const{startValue:B}=(w=(m=t==null?void 0:t.getOption())==null?void 0:m.dataZoom)==null?void 0:w[0];B<f&&h===!1&&_===!1&&(h=!0,ne("history")),c()}clearTimeout(D)},100)}),t==null||t.on("highlight",n=>{var p,g;let f=n.dataIndex||-1;n.batch&&(f=typeof((p=n==null?void 0:n.batch[0])==null?void 0:p.dataIndex)=="number"?(g=n==null?void 0:n.batch[0])==null?void 0:g.dataIndex:-1),clearTimeout($),$=setTimeout(()=>{j.value=f,clearTimeout($)},20)}),t==null||t.on("globalout",()=>{var f,p,g;const n=(g=(p=(f=t==null?void 0:t.getOption())==null?void 0:f.dataZoom)==null?void 0:p[0])==null?void 0:g.endValue;j.value=n});let r=null;t==null||t.on("contextmenu",n=>{r=setTimeout(()=>{n.componentType==="graphic"&&(b.value=n.info,ee.value=[{label:"删除画线",key:"deleteWarningLine"},{label:"修改画线",key:"changeWarningLine"}]),clearTimeout(r),r=null})})},Y=async()=>{var r,n,f,p,g,m;try{if(!l.variety||!l.cycle)return;const{variety:w,featureId:B,cycle:q,indicatorStore:k,mainIndicator:O,right:U,startTime:Z,endTime:A}=l,{defaultShowCounts:K,addCounts:L,showWarningLine:le,getFactorData:ie}=z.value,X={variety:w,featureId:B,cycle:q,mainIndicatorList:k.getIndicatorParams(O),subIndicator:F.value,right:U,showWarningLine:le,getFactorData:ie};Z&&A?(X.startTime=Z,X.endTime=A):Z?(X.startTime=Z,X.limit=K+L):A?(X.endTime=A,X.limit=K+L):(X.endTime=x().add(1,"hour").format("YYYY-MM-DD HH:mm:ss"),X.limit=K+L);const G=await ke(X);if((f=(n=(r=G==null?void 0:G.body)==null?void 0:r.kline)==null?void 0:n.time)!=null&&f.length)d.value=!1,M.value=!1;else{d.value=!0,M.value=!1;return}R.value=(p=G==null?void 0:G.body)==null?void 0:p.kline,H.value=((g=G==null?void 0:G.body)==null?void 0:g.warningLine)||[],re(),c(),ie&&V("getFactorData",(m=G==null?void 0:G.body)==null?void 0:m.factor)}catch(w){throw M.value=!0,d.value=!1,new Error(w)}},ne=async r=>{const{variety:n,cycle:f,indicatorStore:p,mainIndicator:g,right:m}=l,{addCounts:w}=z.value,{time:B}=R.value;if(r==="history"){const q=await Se({variety:n,cycle:f,endTime:B[0],limit:w,mainIndicatorList:p.getIndicatorParams(g),subIndicator:F.value,right:m});R.value={time:[...q.body.time,...R.value.time.slice(1)],data:[...q.body.data,...R.value.data.slice(1)],mainIndicator:R.value.mainIndicator.map((k,O)=>({...k,data:[...q.body.mainIndicator[O].data,...k.data.slice(1)]})),subIndicator:R.value.subIndicator.map((k,O)=>({...k,data:[...q.body.subIndicator[O].data,...k.data.slice(1)]}))},re(!0),q.body.data.length<w&&(_=!0),h=!1}},re=(r=!1)=>{var O,U,Z;te();const{time:n}=R.value,{gridRight:f,gridLeft:p,defaultShowCounts:g,maxShowCounts:m,showSubChart:w}=z.value;let B=n.length-1-g,q=n.length-1;if(r){const A=t.getOption(),K=(U=(O=A==null?void 0:A.xAxis)==null?void 0:O[0])==null?void 0:U.data,L=(Z=A==null?void 0:A.dataZoom)==null?void 0:Z[0],le=K[L==null?void 0:L.startValue],ie=K[L==null?void 0:L.endValue];B=n.findIndex(X=>X===le),q=n.findIndex(X=>X===ie)}const k=Le(R.value,z.value,B,q,l.cycle);if(t.setOption(k,!0),j.value=q,l.brushRange){let A=null,K=null;switch(l.cycle){case"6":{A=n.find(L=>new Date(L).getTime()>=new Date(l.brushRange[0]).getTime()||x(L).format("YYYY-MM-DD")===x(l.brushRange[0]).format("YYYY-MM-DD")),K=n.findLast(L=>new Date(L).getTime()<=new Date(l.brushRange[1]).getTime()||x(L).format("YYYY-MM-DD")===x(l.brushRange[1]).format("YYYY-MM-DD"));break}case"7":{A=n.find(L=>x(L).day(5).format("YYYY-MM-DD")===x(l.brushRange[0]).day(5).format("YYYY-MM-DD")),K=n.findLast(L=>x(L).day(5).format("YYYY-MM-DD")===x(l.brushRange[1]).day(5).format("YYYY-MM-DD"));break}case"8":{A=n.find(L=>x(L).endOf("month").format("YYYY-MM-DD")===x(l.brushRange[0]).endOf("month").format("YYYY-MM-DD")),K=n.findLast(L=>x(L).endOf("month").format("YYYY-MM-DD")===x(l.brushRange[1]).endOf("month").format("YYYY-MM-DD"));break}default:A=n.find(L=>new Date(L).getTime()>=new Date(l.brushRange[0]).getTime()),K=n.findLast(L=>new Date(L).getTime()<=new Date(l.brushRange[1]).getTime())}console.log(A,K),t.dispatchAction({type:"brush",areas:[{brushType:"lineX",coordRange:[A,K],xAxisIndex:0}]})}w&&I.value.draw({startValue:B,endValue:q,maxValueSpan:m},{gridLeft:p,gridRight:f}),i()},c=()=>{if(!t)return;const r=t==null?void 0:t.getOption();r&&(t==null||t.setOption({...r,graphic:[...Be(t,H.value,l,z.value,()=>{o()})]},!0),i())},i=()=>{const{time:r}=R.value;if(l.brushRange&&(r!=null&&r.length)){let n=x(l.brushRange[0]).format("YYYY-MM-DD 00:00:00"),f=x(l.brushRange[1]).format("YYYY-MM-DD 23:59:59"),p=null,g=null;switch(l.cycle){case"6":{p=r.find(m=>x(m).format("YYYY-MM-DD")===x(n).format("YYYY-MM-DD")),g=p;break}case"7":{p=r.find(m=>x(m).day(5).format("YYYY-MM-DD")===x(n).day(5).format("YYYY-MM-DD")),g=r.findLast(m=>x(m).day(5).format("YYYY-MM-DD")===x(f).day(5).format("YYYY-MM-DD"));break}case"8":{p=r.find(m=>x(m).endOf("month").format("YYYY-MM-DD")===x(n).endOf("month").format("YYYY-MM-DD")),g=r.findLast(m=>x(m).endOf("month").format("YYYY-MM-DD")===x(f).endOf("month").format("YYYY-MM-DD"));break}default:p=r.find(m=>{const w=x(m).format("YYYY-MM-DD")===x(n).format("YYYY-MM-DD"),B=new Date(m).getTime()>=new Date(n).getTime();return w&&B}),g=r.findLast(m=>{const w=x(m).format("YYYY-MM-DD")===x(f).format("YYYY-MM-DD"),B=new Date(m).getTime()<=new Date(f).getTime();return w&&B})}t.dispatchAction({type:"brush",areas:[{brushType:"lineX",coordRange:[p,g],xAxisIndex:0}]})}},o=async()=>{const r=await Te({featureId:l.featureId});H.value=(r==null?void 0:r.body)||[],c(),V("change","warningLine",H.value)},u=async r=>{const{variety:n,varietyName:f,featureId:p,featureType:g}=l;if(r.key==="drawWarningLine"){const m=t==null?void 0:t.getOption(),w=m.tooltip[0];t==null||t.setOption({...m,tooltip:{...w,axisPointer:{...w.axisPointer,lineStyle:{width:0},crossStyle:{width:2},label:{...w.axisPointer.label,backgroundColor:"transparent",formatter:q=>""}}}});const B=async q=>{t==null||t.getZr().off("mousedown",B);const k=t==null?void 0:t.convertFromPixel({yAxisIndex:0},q.offsetY),O=Math.round(k*1e3)/1e3;t==null||t.setOption({...m,tooltip:{...w,axisPointer:{...w.axisPointer,lineStyle:{width:1},crossStyle:{width:1},label:{...w.axisPointer.label,backgroundColor:null}}}}),await $e({featureCode:n,featureName:f,featureId:p,featureType:g,warnPrice:O}),se.ElMessage.success("画线预警成功!"),o()};t==null||t.getZr().on("mousedown",B)}else r.key==="deleteWarningLine"?(await Ve({id:b.value.id}),se.ElMessage.success("画线预警删除成功"),o()):r.key==="changeWarningLine"&&(P.value=!0,W.value=b.value.warnPrice)},a=async()=>{const{variety:r,varietyName:n,featureId:f,featureType:p}=l;await me({id:b.value.id,featureCode:r,featureName:n,featureId:f,featureType:p,warnPrice:W.value}),se.ElMessage.success("画线预警修改成功"),o()},y=()=>{ee.value=[...S]};return N({draw:(r,n)=>{r==="warningLine"&&(H.value=n,c())}}),(r,n)=>{var q;const f=de.ElMenuItem,p=de.ElMenu,g=be.ElEmpty,m=ve.ElButton,w=he.ElInputNumber,B=ge.ElDialog;return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",He,[e.createElementVNode("div",ze,[e.createVNode(qe,{data:R.value,activeIndex:j.value},null,8,["data","activeIndex"])]),e.createElementVNode("div",{class:"klineBasic-main",style:e.normalizeStyle({height:z.value.showSubChart?"70%":"100%"})},[e.createVNode(je,{onCloseContextMenuCallBack:y},{popover:e.withCtx(()=>[e.createVNode(p,{style:{borderRadius:"4px",overflow:"hidden",background:"#fff",borderRight:0}},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(ee.value,k=>(e.openBlock(),e.createBlock(f,{style:{height:"36px"},key:k.key,index:k.key,onClick:O=>u(k)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(k.label),1)]),_:2},1032,["index","onClick"]))),128))]),_:1})]),default:e.withCtx(()=>[e.createElementVNode("div",{ref_key:"klineBasicMainRef",ref:v,style:{height:"100%"}},null,512)]),_:1})],4),z.value.showSubChart?(e.openBlock(),e.createElementBlock("div",Ue,[e.createVNode(We,{ref_key:"klineSubRef",ref:I,modelValue:F.value,"onUpdate:modelValue":n[0]||(n[0]=k=>F.value=k),data:R.value,cycle:s.cycle,activeIndex:j.value,subIndicatorList:(q=s.indicatorStore)==null?void 0:q.subIndicatorList},null,8,["modelValue","data","cycle","activeIndex","subIndicatorList"])])):e.createCommentVNode("",!0),d.value?(e.openBlock(),e.createElementBlock("div",Ze,[e.createVNode(g,{class:"klineBasic-empty-content",description:"暂无数据"})])):e.createCommentVNode("",!0),M.value?(e.openBlock(),e.createElementBlock("div",Ke,[Xe,e.createElementVNode("div",Je,[e.createVNode(m,{onClick:Y},{default:e.withCtx(()=>[e.createTextVNode("刷新")]),_:1})])])):e.createCommentVNode("",!0)]),e.createVNode(B,{modelValue:P.value,"onUpdate:modelValue":n[3]||(n[3]=k=>P.value=k),title:"画线预警-修改价格",width:"30%","align-center":""},{footer:e.withCtx(()=>[e.createElementVNode("span",Qe,[e.createVNode(m,{onClick:n[2]||(n[2]=k=>P.value=!1)},{default:e.withCtx(()=>[e.createTextVNode("取消")]),_:1}),e.createVNode(m,{type:"primary",onClick:a},{default:e.withCtx(()=>[e.createTextVNode("确定")]),_:1})])]),default:e.withCtx(()=>[Ge,e.createVNode(w,{modelValue:W.value,"onUpdate:modelValue":n[1]||(n[1]=k=>W.value=k),placeholder:"输入预警价格"},null,8,["modelValue"])]),_:1},8,["modelValue"])],64)}}},tt=ae._export_sfc(et,[["__scopeId","data-v-95b8303f"]]),nt={install(s){s.component("st-klineBasic",tt)}};module.exports=nt;
1
+ "use strict";require("./base-0ca7c43a.cjs");const ve=require("./el-overlay-41994f67.cjs");require("./el-input-6a3805c5.cjs");const be=require("./el-input-number-96ff2e47.cjs"),xe=require("./el-button-62966947.cjs"),_e=require("./el-empty-2ece1134.cjs"),pe=require("./el-menu-item-4c9eb7ad.cjs");require("./el-tooltip-0ea8fbf8.cjs");require("./el-popper-7adbf1c6.cjs");const e=require("vue"),Ye=require("echarts"),J=require("./index-8901a38c.cjs"),ue=require("./el-message-d5ed7a4f.cjs"),le=require("./_plugin-vue_export-helper-f246444f.cjs");require("./el-tag-9732314f.cjs");const me=require("./el-select-31f8ac8a.cjs");require("./el-scrollbar-ac525239.cjs");require("./vnode-b15eb11b.cjs");require("./index-65b4113e.cjs");require("./index-afc88a4b.cjs");require("./use-form-common-props-74a96df2.cjs");require("./index-375e8de4.cjs");require("./scroll-339681d4.cjs");require("./index-2f958e56.cjs");require("./typescript-b63f8e83.cjs");require("./index-1d85ba4b.cjs");require("./index-eea0bcb3.cjs");require("./config-provider-cfbb9cd8.cjs");require("./index-9e6e8d03.cjs");require("./castArray-a78ae889.cjs");require("./debounce-cf26af24.cjs");function we(i){const F=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(i){for(const A in i)if(A!=="default"){const T=Object.getOwnPropertyDescriptor(i,A);Object.defineProperty(F,A,T.get?T:{enumerable:!0,get:()=>i[A]})}}return F.default=i,Object.freeze(F)}const de=we(Ye);var Me=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function De(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var ye={exports:{}};(function(i,F){(function(A,T){i.exports=T()})(Me,function(){var A=1e3,T=6e4,B=36e5,t="millisecond",L="second",k="minute",h="hour",D="day",O="week",s="month",d="quarter",S="year",x="date",I="Invalid Date",q=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,U=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,R={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(f){var a=["th","st","nd","rd"],r=f%100;return"["+f+(a[(r-20)%10]||a[r]||a[0])+"]"}},C=function(f,a,r){var u=String(f);return!u||u.length>=a?f:""+Array(a+1-u.length).join(r)+f},_={s:C,z:function(f){var a=-f.utcOffset(),r=Math.abs(a),u=Math.floor(r/60),o=r%60;return(a<=0?"+":"-")+C(u,2,"0")+":"+C(o,2,"0")},m:function f(a,r){if(a.date()<r.date())return-f(r,a);var u=12*(r.year()-a.year())+(r.month()-a.month()),o=a.clone().add(u,s),y=r-o<0,g=a.clone().add(u+(y?-1:1),s);return+(-(u+(r-o)/(y?o-g:g-o))||0)},a:function(f){return f<0?Math.ceil(f)||0:Math.floor(f)},p:function(f){return{M:s,y:S,w:O,d:D,D:x,h,m:k,s:L,ms:t,Q:d}[f]||String(f||"").toLowerCase().replace(/s$/,"")},u:function(f){return f===void 0}},H="en",P={};P[H]=R;var ee="$isDayjsObject",te=function(f){return f instanceof oe||!(!f||!f[ee])},Z=function f(a,r,u){var o;if(!a)return H;if(typeof a=="string"){var y=a.toLowerCase();P[y]&&(o=y),r&&(P[y]=r,o=y);var g=a.split("-");if(!o&&g.length>1)return f(g[0])}else{var N=a.name;P[N]=a,o=N}return!u&&o&&(H=o),o||!u&&H},W=function(f,a){if(te(f))return f.clone();var r=typeof a=="object"?a:{};return r.date=f,r.args=arguments,new oe(r)},$=_;$.l=Z,$.i=te,$.w=function(f,a){return W(f,{locale:a.$L,utc:a.$u,x:a.$x,$offset:a.$offset})};var oe=function(){function f(r){this.$L=Z(r.locale,null,!0),this.parse(r),this.$x=this.$x||r.x||{},this[ee]=!0}var a=f.prototype;return a.parse=function(r){this.$d=function(u){var o=u.date,y=u.utc;if(o===null)return new Date(NaN);if($.u(o))return new Date;if(o instanceof Date)return new Date(o);if(typeof o=="string"&&!/Z$/i.test(o)){var g=o.match(q);if(g){var N=g[2]-1||0,l=(g[7]||"0").substring(0,3);return y?new Date(Date.UTC(g[1],N,g[3]||1,g[4]||0,g[5]||0,g[6]||0,l)):new Date(g[1],N,g[3]||1,g[4]||0,g[5]||0,g[6]||0,l)}}return new Date(o)}(r),this.init()},a.init=function(){var r=this.$d;this.$y=r.getFullYear(),this.$M=r.getMonth(),this.$D=r.getDate(),this.$W=r.getDay(),this.$H=r.getHours(),this.$m=r.getMinutes(),this.$s=r.getSeconds(),this.$ms=r.getMilliseconds()},a.$utils=function(){return $},a.isValid=function(){return this.$d.toString()!==I},a.isSame=function(r,u){var o=W(r);return this.startOf(u)<=o&&o<=this.endOf(u)},a.isAfter=function(r,u){return W(r)<this.startOf(u)},a.isBefore=function(r,u){return this.endOf(u)<W(r)},a.$g=function(r,u,o){return $.u(r)?this[u]:this.set(o,r)},a.unix=function(){return Math.floor(this.valueOf()/1e3)},a.valueOf=function(){return this.$d.getTime()},a.startOf=function(r,u){var o=this,y=!!$.u(u)||u,g=$.p(r),N=function(V,w){var Y=$.w(o.$u?Date.UTC(o.$y,w,V):new Date(o.$y,w,V),o);return y?Y:Y.endOf(D)},l=function(V,w){return $.w(o.toDate()[V].apply(o.toDate("s"),(y?[0,0,0,0]:[23,59,59,999]).slice(w)),o)},n=this.$W,p=this.$M,m=this.$D,b="set"+(this.$u?"UTC":"");switch(g){case S:return y?N(1,0):N(31,11);case s:return y?N(1,p):N(0,p+1);case O:var c=this.$locale().weekStart||0,v=(n<c?n+7:n)-c;return N(y?m-v:m+(6-v),p);case D:case x:return l(b+"Hours",0);case h:return l(b+"Minutes",1);case k:return l(b+"Seconds",2);case L:return l(b+"Milliseconds",3);default:return this.clone()}},a.endOf=function(r){return this.startOf(r,!1)},a.$set=function(r,u){var o,y=$.p(r),g="set"+(this.$u?"UTC":""),N=(o={},o[D]=g+"Date",o[x]=g+"Date",o[s]=g+"Month",o[S]=g+"FullYear",o[h]=g+"Hours",o[k]=g+"Minutes",o[L]=g+"Seconds",o[t]=g+"Milliseconds",o)[y],l=y===D?this.$D+(u-this.$W):u;if(y===s||y===S){var n=this.clone().set(x,1);n.$d[N](l),n.init(),this.$d=n.set(x,Math.min(this.$D,n.daysInMonth())).$d}else N&&this.$d[N](l);return this.init(),this},a.set=function(r,u){return this.clone().$set(r,u)},a.get=function(r){return this[$.p(r)]()},a.add=function(r,u){var o,y=this;r=Number(r);var g=$.p(u),N=function(p){var m=W(y);return $.w(m.date(m.date()+Math.round(p*r)),y)};if(g===s)return this.set(s,this.$M+r);if(g===S)return this.set(S,this.$y+r);if(g===D)return N(1);if(g===O)return N(7);var l=(o={},o[k]=T,o[h]=B,o[L]=A,o)[g]||1,n=this.$d.getTime()+r*l;return $.w(n,this)},a.subtract=function(r,u){return this.add(-1*r,u)},a.format=function(r){var u=this,o=this.$locale();if(!this.isValid())return o.invalidDate||I;var y=r||"YYYY-MM-DDTHH:mm:ssZ",g=$.z(this),N=this.$H,l=this.$m,n=this.$M,p=o.weekdays,m=o.months,b=o.meridiem,c=function(w,Y,z,Q){return w&&(w[Y]||w(u,y))||z[Y].slice(0,Q)},v=function(w){return $.s(N%12||12,w,"0")},V=b||function(w,Y,z){var Q=w<12?"AM":"PM";return z?Q.toLowerCase():Q};return y.replace(U,function(w,Y){return Y||function(z){switch(z){case"YY":return String(u.$y).slice(-2);case"YYYY":return $.s(u.$y,4,"0");case"M":return n+1;case"MM":return $.s(n+1,2,"0");case"MMM":return c(o.monthsShort,n,m,3);case"MMMM":return c(m,n);case"D":return u.$D;case"DD":return $.s(u.$D,2,"0");case"d":return String(u.$W);case"dd":return c(o.weekdaysMin,u.$W,p,2);case"ddd":return c(o.weekdaysShort,u.$W,p,3);case"dddd":return p[u.$W];case"H":return String(N);case"HH":return $.s(N,2,"0");case"h":return v(1);case"hh":return v(2);case"a":return V(N,l,!0);case"A":return V(N,l,!1);case"m":return String(l);case"mm":return $.s(l,2,"0");case"s":return String(u.$s);case"ss":return $.s(u.$s,2,"0");case"SSS":return $.s(u.$ms,3,"0");case"Z":return g}return null}(w)||g.replace(":","")})},a.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},a.diff=function(r,u,o){var y,g=this,N=$.p(u),l=W(r),n=(l.utcOffset()-this.utcOffset())*T,p=this-l,m=function(){return $.m(g,l)};switch(N){case S:y=m()/12;break;case s:y=m();break;case d:y=m()/3;break;case O:y=(p-n)/6048e5;break;case D:y=(p-n)/864e5;break;case h:y=p/B;break;case k:y=p/T;break;case L:y=p/A;break;default:y=p}return o?y:$.a(y)},a.daysInMonth=function(){return this.endOf(s).$D},a.$locale=function(){return P[this.$L]},a.locale=function(r,u){if(!r)return this.$L;var o=this.clone(),y=Z(r,u,!0);return y&&(o.$L=y),o},a.clone=function(){return $.w(this.$d,this)},a.toDate=function(){return new Date(this.valueOf())},a.toJSON=function(){return this.isValid()?this.toISOString():null},a.toISOString=function(){return this.$d.toISOString()},a.toString=function(){return this.$d.toUTCString()},f}(),ae=oe.prototype;return W.prototype=ae,[["$ms",t],["$s",L],["$m",k],["$H",h],["$W",D],["$M",s],["$y",S],["$D",x]].forEach(function(f){ae[f[1]]=function(a){return this.$g(a,f[0],f[1])}}),W.extend=function(f,a){return f.$i||(f(a,oe,W),f.$i=!0),W},W.locale=Z,W.isDayjs=te,W.unix=function(f){return W(1e3*f)},W.en=P[H],W.Ls=P,W.p={},W})})(ye);var ke=ye.exports;const M=De(ke);let re=null;const Se=i=>{const F=J.y(i,{handleReq:A=>{J.v()&&(A.headers.token=J.U())},handleRes:A=>{const{data:T}=A;if(T.code===401)return location.origin.includes("localhost")?location.href=`${location.origin}/#/404`:J.K(),!0}});F.get,re=F.post},$e=i=>re("/middleLayer/kline/getKlineBasic",{...i,userId:J.V("id")}),Te=i=>re("/middleLayer/kline/getKline",i),Ve=async i=>re("/alarm/deliversign/addAlarmPrice",{...i,userId:J.V("id")}),Le=async i=>re("/alarm/deliversign/findAlarmPriceByUserId",{...i,userId:J.V("id")}),ge=async i=>re("/alarm/deliversign/updateAlarmPrice",{...i,userId:J.V("id")}),Be=async i=>re("/alarm/deliversign/deleteAlarmPrice",{...i,userId:J.V("id")}),{round:ie}=J.x,Oe=(i,F,A,T,B)=>{const{data:t,time:L}=i,{gridTop:k,gridRight:h,gridLeft:D,maxShowCounts:O,showSubChart:s}=F;return{animation:!1,grid:{top:`${k}px`,right:`${h}px`,bottom:s?"6px":"24px",left:`${D}px`},dataZoom:[{type:"inside",startValue:A,endValue:T,maxValueSpan:O}],tooltip:{trigger:"axis",appendToBody:!0,confine:!0,axisPointer:{type:"cross",label:{rich:{},formatter:d=>{const{axisDimension:S,value:x}=d;return S==="x"?s?"":["6","7","8"].includes(B)?M(x).format("YYYY-MM-DD"):x:String(ie(x))}}},formatter:()=>""},xAxis:{show:!s,type:"category",data:L,splitLine:{show:!1},axisLabel:{formatter:d=>["6","7","8"].includes(B)?M(d).format("YYYY-MM-DD"):d}},yAxis:{type:"value",axisLine:{show:!0},splitLine:{show:!0,lineStyle:{type:"dotted",color:"#333"}},min:d=>ie(d.min),max:d=>ie(d.max)},series:[{type:"candlestick",data:t,itemStyle:{color:"transparent",color0:"#00FFFF",borderColor:"#FF0000",borderColor0:"#00FFFF",borderWidth:1}},...i.mainIndicator.map(d=>({name:d.key,type:"line",silent:!0,symbol:"none",data:d.data,lineStyle:{width:d.width||1},itemStyle:{color:d.color}}))],toolbox:{show:!1},brush:{xAxisIndex:"all",brushLink:"all",transformable:!1,outOfBrush:{colorAlpha:2},brushStyle:{color:"rgba(255,255,255,0.1)",borderColor:"rgba(255,255,255,0.4)"}}}},Ne=(i,F,A,T,B)=>{const{variety:t,featureId:L,featureType:k}=A,{gridTop:h,gridLeft:D,gridRight:O}=T;return F.reduce((s,d)=>{const{warnPrice:S}=d,x=i==null?void 0:i.convertToPixel({yAxisIndex:0},S);if(x<=h||x>=(i==null?void 0:i.getHeight()))return s;let I=0;return[...s,{type:"group",name:"warningLine",info:d,draggable:"vertical",children:[{type:"line",info:d,shape:{x1:D,y1:x,x2:(i==null?void 0:i.getWidth())-O,y2:x},style:{stroke:"#FFF",lineWidth:1,lineDash:[8,4]},z:10},{type:"text",info:d,x:(i==null?void 0:i.getWidth())-O,y:x-5,style:{fill:"#FFF",text:S,stroke:"#000",lineWidth:1,opacity:1},z:10}],ondragstart:q=>{I=q.offsetY},ondrag:q=>{var U;if(q.target&&q.target.childAt(1)){const R=i.convertFromPixel({yAxisIndex:0},x+(q.offsetY-I));(U=q.target.childAt(1))==null||U.animate("style",!1).when(1,{text:ie(R,3)}).start()}},ondragend:async q=>{const R=q.offsetY-I;if(R!==0){const C=i==null?void 0:i.convertFromPixel({yAxisIndex:0},R+x),_={id:d.id,warnPrice:ie(C,3),featureId:L,featureCode:t,featureType:k};await ge(_),ue.ElMessage.success("画线预警修改成功"),B&&B()}}}]},[])},Ee={class:"kline-tips"},Fe=e.defineComponent({__name:"index",props:{data:{type:Array,require:!0}},setup(i){return(F,A)=>(e.openBlock(),e.createElementBlock("div",Ee,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.data,(T,B)=>(e.openBlock(),e.createElementBlock("div",{key:B,class:"kline-tips-item",style:e.normalizeStyle({color:T.color})},e.toDisplayString(T.label)+" "+e.toDisplayString(T.value),5))),128))]))}});const fe=le._export_sfc(Fe,[["__scopeId","data-v-f83b6b36"]]);const Ae={class:"kline-tips"},qe={__name:"index",props:{data:{type:Object,require:!0},activeIndex:{type:[Number,String],require:!0}},setup(i){const{round:F,formatValue:A}=J.x,T=i,B=e.computed(()=>{const{data:L,activeIndex:k}=T;if(L.data&&L.data[k]){const h=L.data[k],D=[{label:"开",value:F(h[0])},{label:"高",value:F(h[3])},{label:"低",value:F(h[2])},{label:"收",value:F(h[1])}];h[4]!==null&&D.push({label:"额",value:A(h[4])});let O;return h[6]>0?O="red":h[6]<0&&(O="green"),D.push({label:"涨跌",value:`${F(h[6])}%`,color:O}),D}return[]}),t=e.computed(()=>{var h;const{data:L,activeIndex:k}=T;return((h=L==null?void 0:L.mainIndicator)==null?void 0:h.map(D=>({label:D.key,value:F(D.data[k]),color:D.color})))||[]});return(L,k)=>(e.openBlock(),e.createElementBlock("div",Ae,[e.createVNode(fe,{data:B.value},null,8,["data"]),e.createVNode(fe,{data:t.value},null,8,["data"])]))}},Re=le._export_sfc(qe,[["__scopeId","data-v-64b5c2a3"]]);const Ie={class:"klineSub"},Ce={class:"klineSub-tips"},We={key:0,class:"klineSub-tips-select"},Pe={__name:"index",props:{cycle:{type:[String,Number],default:()=>null},data:{type:Object,require:!0},activeIndex:{type:[Number,String],require:!0},modelValue:{type:String,required:!0},subIndicatorList:{type:Array,required:!0}},emits:["update:modelValue"],setup(i,{expose:F,emit:A}){const{round:T}=J.x;let B,t;const L=A,k=i,h=e.ref(),D=e.computed({get(){return k.modelValue},set(d){L("update:modelValue",d)}}),O=e.computed(()=>{var x;const{data:d,activeIndex:S}=k;return((x=d==null?void 0:d.subIndicator)==null?void 0:x.map(I=>({label:I.key,color:I.color,value:I.data[S]||"-"})))||[]});e.onMounted(()=>{B=de.init(h.value);let d=!0;t=new ResizeObserver(()=>{if(d){d=null;return}B.resize()}),t.observe(h.value)}),e.onUnmounted(()=>{B.dispose(),t.disconnect(),t=null});const s=(d,S)=>{const x=d[S],I=S===0?d[S]:d[S-1];return x[0]===x[1]?x[0]>=I[1]?{color:"transparent",borderColor:"#FF0000"}:{color:"#00FFFF"}:x[1]>x[0]?{color:"transparent",borderColor:"#FF0000"}:{color:"#00FFFF"}};return F({connect:d=>{de.connect([d,B])},draw:(d,S)=>{e.nextTick(()=>{const{startValue:x,endValue:I,maxValueSpan:q}=d,{leftYAxisRange:U,rightYAxisRange:R}=k.data.subIndicator[0],C=k.data.subIndicator.map(_=>{if(_.series==="bar")return{name:"subMain",xAxisIndex:0,yAxisIndex:1,type:"bar",silent:!0,symbol:"none",data:_.data.map((H,P)=>_.seriesColor==="kline"?{value:H,itemStyle:s(k.data.data,P)}:_.seriesColor==="value"?{value:H,itemStyle:{color:H>=0?"#FF0000":"#00FFFF"}}:{value:H,itemStyle:{color:_.seriesColor}})};if(_.series==="line")return{xAxisIndex:0,yAxisIndex:_.yAxis==="right"?2:1,name:_.key,type:"line",silent:!0,symbol:"none",data:_.data,lineStyle:{width:1},itemStyle:{color:_.color}}});B.setOption({animation:!1,grid:{left:`${S.gridLeft}px`,top:"10px",right:`${S.gridRight}px`,bottom:"20px"},dataZoom:[{type:"inside",startValue:x,endValue:I,maxValueSpan:q}],tooltip:{trigger:"axis",appendToBody:!0,confine:!0,axisPointer:{type:"cross",label:{rich:{},formatter:_=>{const{axisDimension:H,value:P}=_;if(H==="x")return["6","7","8"].includes(k.cycle)?M(P).format("YYYY-MM-DD"):P;if(_.axisIndex===1)return String(T(P))}}},formatter:()=>""},xAxis:{type:"category",data:k.data.time,axisLine:{show:!0},splitLine:{show:!1},axisLabel:{formatter:_=>["6","7","8"].includes(k.cycle)?M(_).format("YYYY-MM-DD"):_}},yAxis:[{position:"right"},{position:"left",min:U==="cover"?_=>_.min:null,max:U==="cover"?_=>_.max:null,splitNumber:1,axisLine:{show:!0},splitLine:{show:!0,lineStyle:{type:"dotted",color:"#333"}}},{position:"right",min:R==="cover"?_=>_.min:null,max:R==="cover"?_=>_.max:null,splitNumber:1,axisLine:{show:!1},splitLine:{show:!1},axisLabel:{show:!1}}],series:C},!0)})}}),(d,S)=>{const x=me.ElOption,I=me.ElSelect;return e.openBlock(),e.createElementBlock("div",Ie,[e.createElementVNode("div",Ce,[O.value.length?(e.openBlock(),e.createElementBlock("div",We,[e.createVNode(I,{modelValue:D.value,"onUpdate:modelValue":S[0]||(S[0]=q=>D.value=q),size:"small","popper-class":"element-dark",class:"element-dark subIndicator"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.subIndicatorList,q=>(e.openBlock(),e.createBlock(x,{key:q.value,label:q.label,value:q.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])])):e.createCommentVNode("",!0),e.createVNode(fe,{data:O.value},null,8,["data"])]),e.createElementVNode("div",{class:"klineSub-chart",ref_key:"subChartRef",ref:h},null,512)])}}},je=le._export_sfc(Pe,[["__scopeId","data-v-ab519de5"]]),He=e.defineComponent({__name:"index",emits:["closeContextMenuCallBack"],setup(i,{emit:F}){const A=F,T=e.ref(),B=e.ref(),t=e.ref({display:"none",top:"0px",left:"0px"}),L=()=>{t.value.display="none",A("closeContextMenuCallBack"),document.removeEventListener("click",L)},k=h=>{if(h.preventDefault(),t.value.display==="block"){const{offsetX:D,offsetY:O}=h,{offsetWidth:s,offsetHeight:d}=B.value;if(D<=s&&O<=d)return}T.value.click(),t.value={display:"block",top:`${h.offsetY}px`,left:`${h.offsetX}px`},e.nextTick(()=>{const D=T.value.getBoundingClientRect(),O=B.value.getBoundingClientRect();O.left+O.width>=D.right&&(t.value.left=`${h.offsetX-O.width}px`),O.top+O.height>=D.bottom&&(console.log("高度超出"),t.value.top=`${h.offsetY-O.height}px`)}),document.addEventListener("click",L)};return(h,D)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"contextmenuRef",ref:T,class:"contextmenu",onContextmenu:k,onMouseleave:L},[e.renderSlot(h.$slots,"default",{},void 0,!0),t.value.display!=="none"?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"contextmenuContentRef",ref:B,class:"contextmenu-popover",style:e.normalizeStyle(t.value)},[e.renderSlot(h.$slots,"popover",{},void 0,!0)],4)):e.createCommentVNode("",!0)],544))}});const ze=le._export_sfc(He,[["__scopeId","data-v-811db6b4"]]);const he=i=>(e.pushScopeId("data-v-79254471"),i=i(),e.popScopeId(),i),Ue={class:"klineBasic-tips"},Ze={key:0,class:"klineBasic-sub"},Ke={key:1,class:"klineBasic-empty"},Xe={key:2,class:"klineBasic-error"},Je=he(()=>e.createElementVNode("div",{class:"klineBasic-error-content"},"加载失败,请刷新重试",-1)),Ge={style:{"text-align":"center"}},Qe=he(()=>e.createElementVNode("span",{style:{"margin-right":"10px"}},"预警价格:",-1)),et={class:"dialog-footer"},tt={__name:"index",props:{variety:{type:[String,Number],default:()=>null},varietyName:{type:[String,Number],default:()=>null},featureId:{type:[String,Number],default:()=>null},featureType:{type:[String,Number],default:()=>null},cycle:{type:[String,Number],default:()=>null},mainIndicator:{type:String,default:()=>""},indicatorStore:{type:Object,default:()=>null},startTime:{type:String,default:()=>null},endTime:{type:String,default:()=>null},right:{type:[String,Number],default:1},config:{type:Object,default:()=>({})},env:{type:Object,default:()=>({})},brushRange:{type:[Array,null],default:()=>null}},emits:["change","getFactorData"],setup(i,{expose:F,emit:A}){const T=[{label:"画线预警",key:"drawWarningLine"}];let B=null,t=null,L,k,h=!1,D=!1;const O=A,s=i,d=e.ref(!1),S=e.ref(!1),x=e.ref(!1),I=e.ref(null),q=e.ref(null),U=e.ref("VOL"),R=e.ref(0),C=e.ref({}),_=e.ref([]),H=e.ref({}),P=e.ref(!1),ee=e.ref(""),te=e.ref([...T]),Z=e.computed(()=>({defaultShowCounts:500,addCounts:2e3,maxShowCounts:5e3,loadCheckCounts:500,showSubChart:!0,gridTop:48,gridLeft:80,gridRight:50,showWarningLine:!0,getFactorData:!0,...s.config}));e.watch(()=>{var l,n;return[s.variety,s.cycle,s.mainIndicator,U.value,(l=s.indicatorStore)==null?void 0:l.filterIndicator,(n=s.indicatorStore)==null?void 0:n.customIndicator]},()=>{ae()},{deep:!0}),e.onMounted(()=>{Se(s.env),ae(),window.addEventListener("keydown",$)}),e.onUnmounted(()=>{t==null||t.off("datazoom"),t==null||t.off("highlight"),t==null||t.off("globalout"),t==null||t.dispose(),B==null||B.dispose(),window.removeEventListener("keydown",$)});const W=()=>{t||(t=de.init(I.value),oe(),Z.value.showSubChart&&q.value.connect(t),B=J.D(I.value),B.listen(()=>{requestAnimationFrame(()=>{t.resize()})}))},$=({code:l,ctrlKey:n})=>{if(!(n||d.value))return;const{xAxis:p,dataZoom:m}=t.getOption(),{data:b}=(p==null?void 0:p[0])??{data:[]};let{startValue:c,endValue:v}=(m==null?void 0:m[0])??{};if(b!=null&&b.length){switch(l){case"ArrowUp":{if(v-c<5)return;const V=Math.floor((v-c)/2)+1;c=c+V,v-c<5&&(c=v-4);break}case"ArrowDown":{const V=Math.min(500,v-c);c=c-V-1;break}case"ArrowLeft":{c>0&&(c-=1,v-=1),R.value>0&&(R.value-=1);break}case"ArrowRight":{v<b.length-1&&(c+=1,v+=1),d.value&&R.value<b.length-1&&(R.value+=1);break}}t.dispatchAction({type:"dataZoom",startValue:c,endValue:v}),t.dispatchAction({type:"updateAxisPointer",seriesIndex:0,dataIndex:d.value?R.value:null}),t.dispatchAction({type:"highlight",dataIndex:d.value?R.value:v})}},oe=()=>{t==null||t.on("datazoom",n=>{clearTimeout(k),k=setTimeout(()=>{var m,b,c,v;const{loadCheckCounts:p}=Z.value;if((b=(m=t==null?void 0:t.getOption())==null?void 0:m.dataZoom)!=null&&b[0]){const{startValue:V}=(v=(c=t==null?void 0:t.getOption())==null?void 0:c.dataZoom)==null?void 0:v[0];V<p&&h===!1&&D===!1&&(h=!0,f("history")),r()}clearTimeout(k)},100)}),t==null||t.on("highlight",n=>{var m,b;let p=n.dataIndex||-1;n.batch&&(p=typeof((m=n==null?void 0:n.batch[0])==null?void 0:m.dataIndex)=="number"?(b=n==null?void 0:n.batch[0])==null?void 0:b.dataIndex:-1),clearTimeout(L),L=setTimeout(()=>{R.value=p,clearTimeout(L)},20)}),t==null||t.on("globalout",()=>{var p,m,b;const n=(b=(m=(p=t==null?void 0:t.getOption())==null?void 0:p.dataZoom)==null?void 0:m[0])==null?void 0:b.endValue;R.value=n});let l=null;t==null||t.on("contextmenu",n=>{l=setTimeout(()=>{n.componentType==="graphic"&&(H.value=n.info,te.value=[{label:"删除画线",key:"deleteWarningLine"},{label:"修改画线",key:"changeWarningLine"}]),clearTimeout(l),l=null})})},ae=async()=>{var l,n,p,m,b,c;try{if(!s.variety||!s.cycle)return;const{variety:v,featureId:V,cycle:w,indicatorStore:Y,mainIndicator:z,right:Q,startTime:ne,endTime:j}=s,{defaultShowCounts:K,addCounts:E,showWarningLine:ce,getFactorData:se}=Z.value,X={variety:v,featureId:V,cycle:w,mainIndicatorList:Y.getIndicatorParams(z),subIndicator:U.value,right:Q,showWarningLine:ce,getFactorData:se};ne&&j?(X.startTime=ne,X.endTime=j):ne?(X.startTime=ne,X.limit=K+E):j?(X.endTime=j,X.limit=K+E):(X.endTime=M().add(1,"hour").format("YYYY-MM-DD HH:mm:ss"),X.limit=K+E);const G=await $e(X);if((p=(n=(l=G==null?void 0:G.body)==null?void 0:l.kline)==null?void 0:n.time)!=null&&p.length)S.value=!1,x.value=!1;else{S.value=!0,x.value=!1;return}C.value=(m=G==null?void 0:G.body)==null?void 0:m.kline,_.value=((b=G==null?void 0:G.body)==null?void 0:b.warningLine)||[],a(),r(),se&&O("getFactorData",(c=G==null?void 0:G.body)==null?void 0:c.factor)}catch(v){throw x.value=!0,S.value=!1,new Error(v)}},f=async l=>{const{variety:n,cycle:p,indicatorStore:m,mainIndicator:b,right:c}=s,{addCounts:v}=Z.value,{time:V}=C.value;if(l==="history"){const w=await Te({variety:n,cycle:p,endTime:V[0],limit:v,mainIndicatorList:m.getIndicatorParams(b),subIndicator:U.value,right:c});C.value={time:[...w.body.time,...C.value.time.slice(1)],data:[...w.body.data,...C.value.data.slice(1)],mainIndicator:C.value.mainIndicator.map((Y,z)=>({...Y,data:[...w.body.mainIndicator[z].data,...Y.data.slice(1)]})),subIndicator:C.value.subIndicator.map((Y,z)=>({...Y,data:[...w.body.subIndicator[z].data,...Y.data.slice(1)]}))},a(!0),w.body.data.length<v&&(D=!0),h=!1}},a=(l=!1)=>{var z,Q,ne;W();const{time:n}=C.value,{gridRight:p,gridLeft:m,defaultShowCounts:b,maxShowCounts:c,showSubChart:v}=Z.value;let V=n.length-1-b,w=n.length-1;if(l){const j=t.getOption(),K=(Q=(z=j==null?void 0:j.xAxis)==null?void 0:z[0])==null?void 0:Q.data,E=(ne=j==null?void 0:j.dataZoom)==null?void 0:ne[0],ce=K[E==null?void 0:E.startValue],se=K[E==null?void 0:E.endValue];V=n.findIndex(X=>X===ce),w=n.findIndex(X=>X===se)}const Y=Oe(C.value,Z.value,V,w,s.cycle);if(t.setOption(Y,!0),R.value=w,s.brushRange){let j=null,K=null;switch(s.cycle){case"6":{j=n.find(E=>new Date(E).getTime()>=new Date(s.brushRange[0]).getTime()||M(E).format("YYYY-MM-DD")===M(s.brushRange[0]).format("YYYY-MM-DD")),K=n.findLast(E=>new Date(E).getTime()<=new Date(s.brushRange[1]).getTime()||M(E).format("YYYY-MM-DD")===M(s.brushRange[1]).format("YYYY-MM-DD"));break}case"7":{j=n.find(E=>M(E).day(5).format("YYYY-MM-DD")===M(s.brushRange[0]).day(5).format("YYYY-MM-DD")),K=n.findLast(E=>M(E).day(5).format("YYYY-MM-DD")===M(s.brushRange[1]).day(5).format("YYYY-MM-DD"));break}case"8":{j=n.find(E=>M(E).endOf("month").format("YYYY-MM-DD")===M(s.brushRange[0]).endOf("month").format("YYYY-MM-DD")),K=n.findLast(E=>M(E).endOf("month").format("YYYY-MM-DD")===M(s.brushRange[1]).endOf("month").format("YYYY-MM-DD"));break}default:j=n.find(E=>new Date(E).getTime()>=new Date(s.brushRange[0]).getTime()),K=n.findLast(E=>new Date(E).getTime()<=new Date(s.brushRange[1]).getTime())}console.log(j,K),t.dispatchAction({type:"brush",areas:[{brushType:"lineX",coordRange:[j,K],xAxisIndex:0}]})}v&&q.value.draw({startValue:V,endValue:w,maxValueSpan:c},{gridLeft:m,gridRight:p}),u()},r=()=>{if(!t)return;const l=t==null?void 0:t.getOption();l&&(t==null||t.setOption({...l,graphic:[...Ne(t,_.value,s,Z.value,()=>{o()})]},!0),u())},u=()=>{const{time:l}=C.value;if(s.brushRange&&(l!=null&&l.length)){let n=M(s.brushRange[0]).format("YYYY-MM-DD 00:00:00"),p=M(s.brushRange[1]).format("YYYY-MM-DD 23:59:59"),m=null,b=null;switch(s.cycle){case"6":{m=l.find(c=>M(c).format("YYYY-MM-DD")===M(n).format("YYYY-MM-DD")),b=m;break}case"7":{m=l.find(c=>M(c).day(5).format("YYYY-MM-DD")===M(n).day(5).format("YYYY-MM-DD")),b=l.findLast(c=>M(c).day(5).format("YYYY-MM-DD")===M(p).day(5).format("YYYY-MM-DD"));break}case"8":{m=l.find(c=>M(c).endOf("month").format("YYYY-MM-DD")===M(n).endOf("month").format("YYYY-MM-DD")),b=l.findLast(c=>M(c).endOf("month").format("YYYY-MM-DD")===M(p).endOf("month").format("YYYY-MM-DD"));break}default:m=l.find(c=>{const v=M(c).format("YYYY-MM-DD")===M(n).format("YYYY-MM-DD"),V=new Date(c).getTime()>=new Date(n).getTime();return v&&V}),b=l.findLast(c=>{const v=M(c).format("YYYY-MM-DD")===M(p).format("YYYY-MM-DD"),V=new Date(c).getTime()<=new Date(p).getTime();return v&&V})}t.dispatchAction({type:"brush",areas:[{brushType:"lineX",coordRange:[m,b],xAxisIndex:0}]})}},o=async()=>{const l=await Le({featureId:s.featureId});_.value=(l==null?void 0:l.body)||[],r(),O("change","warningLine",_.value)},y=async l=>{const{variety:n,varietyName:p,featureId:m,featureType:b}=s;if(l.key==="drawWarningLine"){const c=t==null?void 0:t.getOption(),v=c.tooltip[0];t==null||t.setOption({...c,tooltip:{...v,axisPointer:{...v.axisPointer,lineStyle:{width:0},crossStyle:{width:2},label:{...v.axisPointer.label,backgroundColor:"transparent",formatter:w=>""}}}});const V=async w=>{t==null||t.getZr().off("mousedown",V);const Y=t==null?void 0:t.convertFromPixel({yAxisIndex:0},w.offsetY),z=Math.round(Y*1e3)/1e3;t==null||t.setOption({...c,tooltip:{...v,axisPointer:{...v.axisPointer,lineStyle:{width:1},crossStyle:{width:1},label:{...v.axisPointer.label,backgroundColor:null}}}}),await Ve({featureCode:n,featureName:p,featureId:m,featureType:b,warnPrice:z}),ue.ElMessage.success("画线预警成功!"),o()};t==null||t.getZr().on("mousedown",V)}else l.key==="deleteWarningLine"?(await Be({id:H.value.id}),ue.ElMessage.success("画线预警删除成功"),o()):l.key==="changeWarningLine"&&(P.value=!0,ee.value=H.value.warnPrice)},g=async()=>{const{variety:l,varietyName:n,featureId:p,featureType:m}=s;await ge({id:H.value.id,featureCode:l,featureName:n,featureId:p,featureType:m,warnPrice:ee.value}),ue.ElMessage.success("画线预警修改成功"),o()},N=()=>{te.value=[...T]};return F({draw:(l,n)=>{l==="warningLine"&&(_.value=n,r())}}),(l,n)=>{var w;const p=pe.ElMenuItem,m=pe.ElMenu,b=_e.ElEmpty,c=xe.ElButton,v=be.ElInputNumber,V=ve.ElDialog;return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",{class:"klineBasic",onMousemove:n[1]||(n[1]=Y=>d.value=!0),onMouseout:n[2]||(n[2]=Y=>d.value=!1)},[e.createElementVNode("div",Ue,[e.createVNode(Re,{data:C.value,activeIndex:R.value},null,8,["data","activeIndex"])]),e.createElementVNode("div",{class:"klineBasic-main",style:e.normalizeStyle({height:Z.value.showSubChart?"70%":"100%"})},[e.createVNode(ze,{onCloseContextMenuCallBack:N},{popover:e.withCtx(()=>[e.createVNode(m,{style:{borderRadius:"4px",overflow:"hidden",background:"#fff",borderRight:0}},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(te.value,Y=>(e.openBlock(),e.createBlock(p,{style:{height:"36px"},key:Y.key,index:Y.key,onClick:z=>y(Y)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(Y.label),1)]),_:2},1032,["index","onClick"]))),128))]),_:1})]),default:e.withCtx(()=>[e.createElementVNode("div",{ref_key:"klineBasicMainRef",ref:I,style:{height:"100%"}},null,512)]),_:1})],4),Z.value.showSubChart?(e.openBlock(),e.createElementBlock("div",Ze,[e.createVNode(je,{ref_key:"klineSubRef",ref:q,modelValue:U.value,"onUpdate:modelValue":n[0]||(n[0]=Y=>U.value=Y),data:C.value,cycle:i.cycle,activeIndex:R.value,subIndicatorList:(w=i.indicatorStore)==null?void 0:w.subIndicatorList},null,8,["modelValue","data","cycle","activeIndex","subIndicatorList"])])):e.createCommentVNode("",!0),S.value?(e.openBlock(),e.createElementBlock("div",Ke,[e.createVNode(b,{class:"klineBasic-empty-content",description:"暂无数据"})])):e.createCommentVNode("",!0),x.value?(e.openBlock(),e.createElementBlock("div",Xe,[Je,e.createElementVNode("div",Ge,[e.createVNode(c,{onClick:ae},{default:e.withCtx(()=>[e.createTextVNode("刷新")]),_:1})])])):e.createCommentVNode("",!0)],32),e.createVNode(V,{modelValue:P.value,"onUpdate:modelValue":n[5]||(n[5]=Y=>P.value=Y),title:"画线预警-修改价格",width:"30%","align-center":""},{footer:e.withCtx(()=>[e.createElementVNode("span",et,[e.createVNode(c,{onClick:n[4]||(n[4]=Y=>P.value=!1)},{default:e.withCtx(()=>[e.createTextVNode("取消")]),_:1}),e.createVNode(c,{type:"primary",onClick:g},{default:e.withCtx(()=>[e.createTextVNode("确定")]),_:1})])]),default:e.withCtx(()=>[Qe,e.createVNode(v,{modelValue:ee.value,"onUpdate:modelValue":n[3]||(n[3]=Y=>ee.value=Y),placeholder:"输入预警价格"},null,8,["modelValue"])]),_:1},8,["modelValue"])],64)}}},nt=le._export_sfc(tt,[["__scopeId","data-v-79254471"]]),rt={install(i){i.component("st-klineBasic",nt)}};module.exports=rt;