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