st-comp 0.0.225 → 0.0.226

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-ef747d02.cjs");const ve=require("./el-dialog-ae86edb8.cjs");require("./el-overlay-9e34965f.cjs");require("./el-input-7fd293af.cjs");const xe=require("./el-input-number-22e21d16.cjs"),be=require("./el-button-eec58cff.cjs"),he=require("./el-empty-1697ded8.cjs"),le=require("./el-menu-item-17dc717e.cjs");require("./el-tooltip-0ea8fbf8.cjs");require("./el-popper-b6c99b28.cjs");const e=require("vue"),_e=require("echarts"),d=require("./dayjs.min-2c20abe6.cjs"),A=require("./index-8901a38c.cjs"),J=require("./el-message-5e6a6be9.cjs"),K=require("./_plugin-vue_export-helper-f246444f.cjs");require("./el-tag-a33c4b22.cjs");const ie=require("./el-select-d8d91db1.cjs");require("./el-scrollbar-bc3f790d.cjs");require("./index-098c2447.cjs");require("./use-form-common-props-fd9b61a0.cjs");require("./index-9780a537.cjs");require("./index-bb833443.cjs");require("./index-f1c702f6.cjs");require("./vnode-b906ae6d.cjs");require("./scroll-b108dabd.cjs");require("./use-global-config-30d7d8ce.cjs");require("./index-c108567d.cjs");require("./typescript-b63f8e83.cjs");require("./index-11547a0c.cjs");require("./index-eea0bcb3.cjs");require("./config-provider-a584d81e.cjs");require("./index-298075cf.cjs");require("./index-f3562b52.cjs");require("./castArray-35947698.cjs");require("./debounce-62f5b6e8.cjs");function Ye(o){const k=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const D in o)if(D!=="default"){const s=Object.getOwnPropertyDescriptor(o,D);Object.defineProperty(k,D,s.get?s:{enumerable:!0,get:()=>o[D]})}}return k.default=o,Object.freeze(k)}const ne=Ye(_e);let z=null;const ke=o=>{const k=A.y(o,{handleReq:D=>{A.v()&&(D.headers.token=A.U())},handleRes:D=>{const{data:s}=D;if(s.code===401)return location.origin.includes("localhost")?location.href=`${location.origin}/#/404`:A.K(),!0}});k.get,z=k.post},we=o=>z("/middleLayer/kline/getKlineBasic",{...o,userId:A.V("id")}),De=o=>z("/middleLayer/kline/getKline",o),Me=async o=>z("/alarm/deliversign/addAlarmPrice",{...o,userId:A.V("id")}),Se=async o=>z("/alarm/deliversign/findAlarmPriceByUserId",{...o,userId:A.V("id")}),ce=async o=>z("/alarm/deliversign/updateAlarmPrice",{...o,userId:A.V("id")}),Ve=async o=>z("/alarm/deliversign/deleteAlarmPrice",{...o,userId:A.V("id")}),{round:U}=A.x,Te=(o,k,D,s,m)=>{const{data:t,time:M}=o,{gridTop:u,gridRight:x,gridLeft:f,maxShowCounts:g,showSubChart:r}=k;return{animation:!1,grid:{top:`${u}px`,right:`${x}px`,bottom:r?"6px":"24px",left:`${f}px`},dataZoom:[{type:"inside",startValue:D,endValue:s,maxValueSpan:g}],tooltip:{trigger:"axis",appendToBody:!0,confine:!0,axisPointer:{type:"cross",label:{rich:{},formatter:a=>{const{axisDimension:b,value:h}=a;return b==="x"?r?"":["6","7","8"].includes(m)?d.dayjs(h).format("YYYY-MM-DD"):h:String(U(h))}}},formatter:()=>""},xAxis:{show:!r,type:"category",data:M,splitLine:{show:!1},axisLabel:{formatter:a=>["6","7","8"].includes(m)?d.dayjs(a).format("YYYY-MM-DD"):a}},yAxis:{type:"value",axisLine:{show:!0},splitLine:{show:!0,lineStyle:{type:"dotted",color:"#333"}},min:a=>U(a.min),max:a=>U(a.max)},series:[{type:"candlestick",data:t,itemStyle:{color:"transparent",color0:"#00FFFF",borderColor:"#FF0000",borderColor0:"#00FFFF",borderWidth:1}},...o.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)"}}}},Le=(o,k,D,s,m)=>{const{variety:t,featureId:M,featureType:u}=D,{gridTop:x,gridLeft:f,gridRight:g}=s;return k.reduce((r,a)=>{const{warnPrice:b}=a,h=o==null?void 0:o.convertToPixel({yAxisIndex:0},b);if(h<=x||h>=(o==null?void 0:o.getHeight()))return r;let E=0;return[...r,{type:"group",name:"warningLine",info:a,draggable:"vertical",children:[{type:"line",info:a,shape:{x1:f,y1:h,x2:(o==null?void 0:o.getWidth())-g,y2:h},style:{stroke:"#FFF",lineWidth:1,lineDash:[8,4]},z:10},{type:"text",info:a,x:(o==null?void 0:o.getWidth())-g,y:h-5,style:{fill:"#FFF",text:b,stroke:"#000",lineWidth:1,opacity:1},z:10}],ondragstart:V=>{E=V.offsetY},ondrag:V=>{var R;if(V.target&&V.target.childAt(1)){const T=o.convertFromPixel({yAxisIndex:0},h+(V.offsetY-E));(R=V.target.childAt(1))==null||R.animate("style",!1).when(1,{text:U(T,3)}).start()}},ondragend:async V=>{const T=V.offsetY-E;if(T!==0){const N=o==null?void 0:o.convertFromPixel({yAxisIndex:0},T+h),p={id:a.id,warnPrice:U(N,3),featureId:M,featureCode:t,featureType:u};await ce(p),J.ElMessage.success("画线预警修改成功"),m&&m()}}}]},[])},Be=e.defineComponent({__name:"index",props:{data:{type:Array,require:!0}},setup(o){const k=o,D=e.ref(null),s=e.ref([]);return e.watch(()=>k.data,()=>{s.value.length===0&&e.nextTick(()=>{Array.from(D.value.children).forEach((m,t)=>{var M,u,x,f,g,r,a,b;((u=(M=k.data)==null?void 0:M[t])==null?void 0:u.label)==="涨跌"?s.value[t]="85px":((f=(x=k.data)==null?void 0:x[t])==null?void 0:f.label)==="至今涨跌"?s.value[t]="105px":((r=(g=k.data)==null?void 0:g[t])==null?void 0:r.label)==="额"?s.value[t]="75px":["开","高","低","收"].includes((b=(a=k.data)==null?void 0:a[t])==null?void 0:b.label)?s.value[t]=`${m.offsetWidth+20}px`:s.value[t]=`${m.offsetWidth+30}px`})})}),(m,t)=>(e.openBlock(),e.createElementBlock("div",{class:"kline-tips",ref_key:"tipsRef",ref:D},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.data,(M,u)=>(e.openBlock(),e.createElementBlock("div",{key:u,class:"kline-tips-item",style:e.normalizeStyle({color:M.color,width:s.value[u]?s.value[u]:null})},e.toDisplayString(M.label)+" "+e.toDisplayString(M.value),5))),128))],512))}});const se=K._export_sfc(Be,[["__scopeId","data-v-cf8cdf15"]]);const Ee={class:"kline-tips"},Ne={__name:"index",props:{data:{type:Object,require:!0},activeIndex:{type:[Number,String],require:!0}},setup(o){const{round:k,formatValue:D}=A.x,s=o,m=e.ref(null);e.watch(()=>s.activeIndex,()=>{m.value===null&&(m.value=s.data.data[s.activeIndex][1])});const t=e.computed(()=>{const{data:u,activeIndex:x}=s;if(u.data&&u.data[x]){const f=u.data[x],g=[{label:"开",value:f[0]},{label:"高",value:f[3]},{label:"低",value:f[2]},{label:"收",value:f[1]}];f[4]!==null&&g.push({label:"额",value:D(f[4])});let r;f[6]>0?r="red":f[6]<0&&(r="green"),g.push({label:"涨跌",value:`${k(f[6])}%`,color:r});const a=(m.value/f[1]-1)*100;let b;return a>0?b="red":a<0&&(b="green"),g.push({label:"至今涨幅",value:`${k(a)}%`,color:b}),g}return[]}),M=e.computed(()=>{var f;const{data:u,activeIndex:x}=s;return((f=u==null?void 0:u.mainIndicator)==null?void 0:f.map(g=>({label:g.key,value:k(g.data[x]),color:g.color})))||[]});return(u,x)=>(e.openBlock(),e.createElementBlock("div",Ee,[e.createVNode(se,{data:t.value},null,8,["data"]),e.createVNode(se,{data:M.value},null,8,["data"])]))}},Fe=K._export_sfc(Ne,[["__scopeId","data-v-85e9befe"]]),qe={class:"kline-averageTips"},Ae=e.defineComponent({__name:"index",props:{data:{type:Array,require:!0}},setup(o){return(k,D)=>(e.openBlock(),e.createElementBlock("div",qe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.data,(s,m)=>(e.openBlock(),e.createElementBlock("div",{key:m,class:"kline-averageTips-item",style:e.normalizeStyle({color:s.color,width:`calc(100% / ${o.data.length} - 10px)`})},e.toDisplayString(s.label)+" "+e.toDisplayString(s.value),5))),128))]))}});const Re=K._export_sfc(Ae,[["__scopeId","data-v-c47865cb"]]);const je={class:"klineSub"},Oe={class:"klineSub-tips"},Ie={key:0,class:"klineSub-tips-select"},$e={__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(o,{expose:k,emit:D}){const{round:s}=A.x;let m,t;const M=D,u=o,x=e.ref(),f=e.computed({get(){return u.modelValue},set(a){M("update:modelValue",a)}}),g=e.computed(()=>{var h;const{data:a,activeIndex:b}=u;return((h=a==null?void 0:a.subIndicator)==null?void 0:h.map(E=>({label:E.key,color:E.color,value:E.data[b]||"-"})))||[]});e.onMounted(()=>{m=ne.init(x.value);let a=!0;t=new ResizeObserver(()=>{if(a){a=null;return}m.resize()}),t.observe(x.value)}),e.onUnmounted(()=>{m.dispose(),t.disconnect(),t=null});const r=(a,b)=>{const h=a[b],E=b===0?a[b]:a[b-1];return h[0]===h[1]?h[0]>=E[1]?{color:"transparent",borderColor:"#FF0000"}:{color:"#00FFFF"}:h[1]>h[0]?{color:"transparent",borderColor:"#FF0000"}:{color:"#00FFFF"}};return k({connect:a=>{ne.connect([a,m])},draw:(a,b)=>{e.nextTick(()=>{const{startValue:h,endValue:E,maxValueSpan:V}=a,{leftYAxisRange:R,rightYAxisRange:T}=u.data.subIndicator[0],N=u.data.subIndicator.map(p=>{if(p.series==="bar")return{name:"subMain",xAxisIndex:0,yAxisIndex:1,type:"bar",silent:!0,symbol:"none",data:p.data.map((O,$)=>p.seriesColor==="kline"?{value:O,itemStyle:r(u.data.data,$)}:p.seriesColor==="value"?{value:O,itemStyle:{color:O>=0?"#FF0000":"#00FFFF"}}:{value:O,itemStyle:{color:p.seriesColor}})};if(p.series==="line")return{xAxisIndex:0,yAxisIndex:p.yAxis==="right"?2:1,name:p.key,type:"line",silent:!0,symbol:"none",data:p.data,lineStyle:{width:1},itemStyle:{color:p.color}}});m.setOption({animation:!1,grid:{left:`${b.gridLeft}px`,top:"10px",right:`${b.gridRight}px`,bottom:"20px"},dataZoom:[{type:"inside",startValue:h,endValue:E,maxValueSpan:V}],tooltip:{trigger:"axis",appendToBody:!0,confine:!0,axisPointer:{type:"cross",label:{rich:{},formatter:p=>{const{axisDimension:O,value:$}=p;if(O==="x")return["6","7","8"].includes(u.cycle)?d.dayjs($).format("YYYY-MM-DD"):$;if(p.axisIndex===1)return String(s($))}}},formatter:()=>""},xAxis:{type:"category",data:u.data.time,axisLine:{show:!0},splitLine:{show:!1},axisLabel:{formatter:p=>["6","7","8"].includes(u.cycle)?d.dayjs(p).format("YYYY-MM-DD"):p}},yAxis:[{position:"right"},{position:"left",min:R==="cover"?p=>p.min:null,max:R==="cover"?p=>p.max:null,splitNumber:1,axisLine:{show:!0},splitLine:{show:!0,lineStyle:{type:"dotted",color:"#333"}}},{position:"right",min:T==="cover"?p=>p.min:null,max:T==="cover"?p=>p.max:null,splitNumber:1,axisLine:{show:!1},splitLine:{show:!1},axisLabel:{show:!1}}],series:N},!0)})}}),(a,b)=>{const h=ie.ElOption,E=ie.ElSelect;return e.openBlock(),e.createElementBlock("div",je,[e.createElementVNode("div",Oe,[g.value.length?(e.openBlock(),e.createElementBlock("div",Ie,[e.createVNode(E,{modelValue:f.value,"onUpdate:modelValue":b[0]||(b[0]=V=>f.value=V),size:"small","popper-class":"element-dark",class:"element-dark subIndicator"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.subIndicatorList,V=>(e.openBlock(),e.createBlock(h,{key:V.value,label:V.label,value:V.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])])):e.createCommentVNode("",!0),e.createVNode(Re,{data:g.value},null,8,["data"])]),e.createElementVNode("div",{class:"klineSub-chart",ref_key:"subChartRef",ref:x},null,512)])}}},Pe=K._export_sfc($e,[["__scopeId","data-v-7ec4c8cf"]]),Ce=e.defineComponent({__name:"index",emits:["closeContextMenuCallBack"],setup(o,{emit:k}){const D=k,s=e.ref(),m=e.ref(),t=e.ref({display:"none",top:"0px",left:"0px"}),M=()=>{t.value.display="none",D("closeContextMenuCallBack"),document.removeEventListener("click",M)},u=x=>{if(x.preventDefault(),t.value.display==="block"){const{offsetX:f,offsetY:g}=x,{offsetWidth:r,offsetHeight:a}=m.value;if(f<=r&&g<=a)return}s.value.click(),t.value={display:"block",top:`${x.offsetY}px`,left:`${x.offsetX}px`},e.nextTick(()=>{const f=s.value.getBoundingClientRect(),g=m.value.getBoundingClientRect();g.left+g.width>=f.right&&(t.value.left=`${x.offsetX-g.width}px`),g.top+g.height>=f.bottom&&(console.log("高度超出"),t.value.top=`${x.offsetY-g.height}px`)}),document.addEventListener("click",M)};return(x,f)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"contextmenuRef",ref:s,class:"contextmenu",onContextmenu:u,onMouseleave:M},[e.renderSlot(x.$slots,"default",{},void 0,!0),t.value.display!=="none"?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"contextmenuContentRef",ref:m,class:"contextmenu-popover",style:e.normalizeStyle(t.value)},[e.renderSlot(x.$slots,"popover",{},void 0,!0)],4)):e.createCommentVNode("",!0)],544))}});const We=K._export_sfc(Ce,[["__scopeId","data-v-811db6b4"]]);const ue=o=>(e.pushScopeId("data-v-9e6456be"),o=o(),e.popScopeId(),o),ze={class:"klineBasic-tips"},Ke={key:0,class:"klineBasic-sub"},Ue={key:1,class:"klineBasic-empty"},He={key:2,class:"klineBasic-error"},Ze=ue(()=>e.createElementVNode("div",{class:"klineBasic-error-content"},"加载失败,请刷新重试",-1)),Xe={style:{"text-align":"center"}},Ge=ue(()=>e.createElementVNode("span",{style:{"margin-right":"10px"}},"预警价格:",-1)),Je={class:"dialog-footer"},Qe={__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(o,{expose:k,emit:D}){const s=[{label:"画线预警",key:"drawWarningLine"}];let m=null,t=null,M,u,x=!1,f=!1;const g=D,r=o,a=e.ref(!1),b=e.ref(!1),h=e.ref(!1),E=e.ref(null),V=e.ref(null),R=e.ref("VOL"),T=e.ref(0),N=e.ref({}),p=e.ref([]),O=e.ref({}),$=e.ref(!1),H=e.ref(""),Q=e.ref([...s]),C=e.computed(()=>({defaultShowCounts:500,addCounts:2e3,maxShowCounts:5e3,loadCheckCounts:500,showSubChart:!0,gridTop:48,gridLeft:80,gridRight:50,showWarningLine:!0,getFactorData:!0,...r.config}));e.watch(()=>{var i,n;return[r.variety,r.cycle,r.mainIndicator,R.value,(i=r.indicatorStore)==null?void 0:i.filterIndicator,(n=r.indicatorStore)==null?void 0:n.customIndicator]},()=>{ee()},{deep:!0}),e.onMounted(()=>{ke(r.env),ee(),window.addEventListener("keydown",oe)}),e.onUnmounted(()=>{t==null||t.off("datazoom"),t==null||t.off("highlight"),t==null||t.off("globalout"),t==null||t.dispose(),m==null||m.dispose(),window.removeEventListener("keydown",oe)});const de=()=>{t||(t=ne.init(E.value),fe(),C.value.showSubChart&&V.value.connect(t),m=A.D(E.value),m.listen(()=>{requestAnimationFrame(()=>{t.resize()})}))},oe=({code:i,ctrlKey:n})=>{if(!(n||a.value))return;const{xAxis:_,dataZoom:y}=t.getOption(),{data:v}=(_==null?void 0:_[0])??{data:[]};let{startValue:l,endValue:c}=(y==null?void 0:y[0])??{};if(v!=null&&v.length){switch(i){case"ArrowUp":{if(c-l<5)return;const S=Math.floor((c-l)/2)+1;l=l+S,c-l<5&&(l=c-4);break}case"ArrowDown":{const S=Math.min(500,c-l);l=l-S-1;break}case"ArrowLeft":{l>0&&(l-=1,c-=1),T.value>0&&(T.value-=1);break}case"ArrowRight":{c<v.length-1&&(l+=1,c+=1),a.value&&T.value<v.length-1&&(T.value+=1);break}}t.dispatchAction({type:"dataZoom",startValue:l,endValue:c}),t.dispatchAction({type:"updateAxisPointer",seriesIndex:0,dataIndex:a.value?T.value:null}),t.dispatchAction({type:"highlight",dataIndex:a.value?T.value:c})}},fe=()=>{t==null||t.on("datazoom",n=>{clearTimeout(u),u=setTimeout(()=>{var y,v,l,c;const{loadCheckCounts:_}=C.value;if((v=(y=t==null?void 0:t.getOption())==null?void 0:y.dataZoom)!=null&&v[0]){const{startValue:S}=(c=(l=t==null?void 0:t.getOption())==null?void 0:l.dataZoom)==null?void 0:c[0];S<_&&x===!1&&f===!1&&(x=!0,pe("history")),Z()}clearTimeout(u)},100)}),t==null||t.on("highlight",n=>{var y,v;let _=n.dataIndex||-1;n.batch&&(_=typeof((y=n==null?void 0:n.batch[0])==null?void 0:y.dataIndex)=="number"?(v=n==null?void 0:n.batch[0])==null?void 0:v.dataIndex:-1),clearTimeout(M),M=setTimeout(()=>{T.value=_,clearTimeout(M)},20)}),t==null||t.on("globalout",()=>{var _,y,v;const n=(v=(y=(_=t==null?void 0:t.getOption())==null?void 0:_.dataZoom)==null?void 0:y[0])==null?void 0:v.endValue;T.value=n});let i=null;t==null||t.on("contextmenu",n=>{i=setTimeout(()=>{n.componentType==="graphic"&&(O.value=n.info,Q.value=[{label:"删除画线",key:"deleteWarningLine"},{label:"修改画线",key:"changeWarningLine"}]),clearTimeout(i),i=null})})},ee=async()=>{var i,n,_,y,v,l;try{if(!r.variety||!r.cycle)return;const{variety:c,featureId:S,cycle:L,indicatorStore:w,mainIndicator:I,right:P,startTime:W,endTime:B}=r,{defaultShowCounts:F,addCounts:Y,showWarningLine:te,getFactorData:G}=C.value,q={variety:c,featureId:S,cycle:L,mainIndicatorList:w.getIndicatorParams(I),subIndicator:R.value,right:P,showWarningLine:te,getFactorData:G};W&&B?(q.startTime=W,q.endTime=B):W?(q.startTime=W,q.limit=F+Y):B?(q.endTime=B,q.limit=F+Y):(q.endTime=d.dayjs().add(1,"hour").format("YYYY-MM-DD HH:mm:ss"),q.limit=F+Y);const j=await we(q);if((_=(n=(i=j==null?void 0:j.body)==null?void 0:i.kline)==null?void 0:n.time)!=null&&_.length)b.value=!1,h.value=!1;else{b.value=!0,h.value=!1;return}N.value=(y=j==null?void 0:j.body)==null?void 0:y.kline,p.value=((v=j==null?void 0:j.body)==null?void 0:v.warningLine)||[],ae(),Z(),G&&g("getFactorData",(l=j==null?void 0:j.body)==null?void 0:l.factor)}catch(c){throw h.value=!0,b.value=!1,new Error(c)}},pe=async i=>{const{variety:n,cycle:_,indicatorStore:y,mainIndicator:v,right:l}=r,{addCounts:c}=C.value,{time:S}=N.value;if(i==="history"){const L=await De({variety:n,cycle:_,endTime:S[0],limit:c,mainIndicatorList:y.getIndicatorParams(v),subIndicator:R.value,right:l});N.value={time:[...L.body.time,...N.value.time.slice(1)],data:[...L.body.data,...N.value.data.slice(1)],mainIndicator:N.value.mainIndicator.map((w,I)=>{var P;return{...w,data:[...((P=L.body.mainIndicator[I])==null?void 0:P.data)??[],...w.data.slice(1)]}}),subIndicator:N.value.subIndicator.map((w,I)=>{var P;return{...w,data:[...((P=L.body.subIndicator[I])==null?void 0:P.data)??[],...w.data.slice(1)]}})},ae(!0),L.body.data.length<c&&(f=!0),x=!1}},ae=(i=!1)=>{var I,P,W;de();const{time:n}=N.value,{gridRight:_,gridLeft:y,defaultShowCounts:v,maxShowCounts:l,showSubChart:c}=C.value;let S=n.length-1-v,L=n.length-1;if(i){const B=t.getOption(),F=(P=(I=B==null?void 0:B.xAxis)==null?void 0:I[0])==null?void 0:P.data,Y=(W=B==null?void 0:B.dataZoom)==null?void 0:W[0],te=F[Y==null?void 0:Y.startValue],G=F[Y==null?void 0:Y.endValue];S=n.findIndex(q=>q===te),L=n.findIndex(q=>q===G)}const w=Te(N.value,C.value,S,L,r.cycle);if(t.setOption(w,!0),T.value=L,r.brushRange){let B=null,F=null;switch(r.cycle){case"6":{B=n.find(Y=>new Date(Y).getTime()>=new Date(r.brushRange[0]).getTime()||d.dayjs(Y).format("YYYY-MM-DD")===d.dayjs(r.brushRange[0]).format("YYYY-MM-DD")),F=n.findLast(Y=>new Date(Y).getTime()<=new Date(r.brushRange[1]).getTime()||d.dayjs(Y).format("YYYY-MM-DD")===d.dayjs(r.brushRange[1]).format("YYYY-MM-DD"));break}case"7":{B=n.find(Y=>d.dayjs(Y).day(5).format("YYYY-MM-DD")===d.dayjs(r.brushRange[0]).day(5).format("YYYY-MM-DD")),F=n.findLast(Y=>d.dayjs(Y).day(5).format("YYYY-MM-DD")===d.dayjs(r.brushRange[1]).day(5).format("YYYY-MM-DD"));break}case"8":{B=n.find(Y=>d.dayjs(Y).endOf("month").format("YYYY-MM-DD")===d.dayjs(r.brushRange[0]).endOf("month").format("YYYY-MM-DD")),F=n.findLast(Y=>d.dayjs(Y).endOf("month").format("YYYY-MM-DD")===d.dayjs(r.brushRange[1]).endOf("month").format("YYYY-MM-DD"));break}default:B=n.find(Y=>new Date(Y).getTime()>=new Date(r.brushRange[0]).getTime()),F=n.findLast(Y=>new Date(Y).getTime()<=new Date(r.brushRange[1]).getTime())}console.log(B,F),t.dispatchAction({type:"brush",areas:[{brushType:"lineX",coordRange:[B,F],xAxisIndex:0}]})}c&&V.value.draw({startValue:S,endValue:L,maxValueSpan:l},{gridLeft:y,gridRight:_}),re()},Z=()=>{if(!t)return;const i=t==null?void 0:t.getOption();i&&(t==null||t.setOption({...i,graphic:[...Le(t,p.value,r,C.value,()=>{X()})]},!0),re())},re=()=>{const{time:i}=N.value;if(r.brushRange&&(i!=null&&i.length)){let n=d.dayjs(r.brushRange[0]).format("YYYY-MM-DD 00:00:00"),_=d.dayjs(r.brushRange[1]).format("YYYY-MM-DD 23:59:59"),y=null,v=null;switch(r.cycle){case"6":{y=i.find(l=>d.dayjs(l).format("YYYY-MM-DD")===d.dayjs(n).format("YYYY-MM-DD")),v=y;break}case"7":{y=i.find(l=>d.dayjs(l).day(5).format("YYYY-MM-DD")===d.dayjs(n).day(5).format("YYYY-MM-DD")),v=i.findLast(l=>d.dayjs(l).day(5).format("YYYY-MM-DD")===d.dayjs(_).day(5).format("YYYY-MM-DD"));break}case"8":{y=i.find(l=>d.dayjs(l).endOf("month").format("YYYY-MM-DD")===d.dayjs(n).endOf("month").format("YYYY-MM-DD")),v=i.findLast(l=>d.dayjs(l).endOf("month").format("YYYY-MM-DD")===d.dayjs(_).endOf("month").format("YYYY-MM-DD"));break}default:y=i.find(l=>{const c=d.dayjs(l).format("YYYY-MM-DD")===d.dayjs(n).format("YYYY-MM-DD"),S=new Date(l).getTime()>=new Date(n).getTime();return c&&S}),v=i.findLast(l=>{const c=d.dayjs(l).format("YYYY-MM-DD")===d.dayjs(_).format("YYYY-MM-DD"),S=new Date(l).getTime()<=new Date(_).getTime();return c&&S})}t.dispatchAction({type:"brush",areas:[{brushType:"lineX",coordRange:[y,v],xAxisIndex:0}]})}},X=async()=>{const i=await Se({featureId:r.featureId});p.value=(i==null?void 0:i.body)||[],Z(),g("change","warningLine",p.value)},ye=async i=>{const{variety:n,varietyName:_,featureId:y,featureType:v}=r;if(i.key==="drawWarningLine"){const l=t==null?void 0:t.getOption(),c=l.tooltip[0];t==null||t.setOption({...l,tooltip:{...c,axisPointer:{...c.axisPointer,lineStyle:{width:0},crossStyle:{width:2},label:{...c.axisPointer.label,backgroundColor:"transparent",formatter:L=>""}}}});const S=async L=>{t==null||t.getZr().off("mousedown",S);const w=t==null?void 0:t.convertFromPixel({yAxisIndex:0},L.offsetY),I=Math.round(w*1e3)/1e3;t==null||t.setOption({...l,tooltip:{...c,axisPointer:{...c.axisPointer,lineStyle:{width:1},crossStyle:{width:1},label:{...c.axisPointer.label,backgroundColor:null}}}}),await Me({featureCode:n,featureName:_,featureId:y,featureType:v,warnPrice:I}),J.ElMessage.success("画线预警成功!"),X()};t==null||t.getZr().on("mousedown",S)}else i.key==="deleteWarningLine"?(await Ve({id:O.value.id}),J.ElMessage.success("画线预警删除成功"),X()):i.key==="changeWarningLine"&&($.value=!0,H.value=O.value.warnPrice)},me=async()=>{const{variety:i,varietyName:n,featureId:_,featureType:y}=r;await ce({id:O.value.id,featureCode:i,featureName:n,featureId:_,featureType:y,warnPrice:H.value}),J.ElMessage.success("画线预警修改成功"),X()},ge=()=>{Q.value=[...s]};return k({draw:(i,n)=>{i==="warningLine"&&(p.value=n,Z())}}),(i,n)=>{var L;const _=le.ElMenuItem,y=le.ElMenu,v=he.ElEmpty,l=be.ElButton,c=xe.ElInputNumber,S=ve.ElDialog;return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",{class:"klineBasic",onMousemove:n[1]||(n[1]=w=>a.value=!0),onMouseout:n[2]||(n[2]=w=>a.value=!1)},[e.createElementVNode("div",ze,[e.createVNode(Fe,{data:N.value,activeIndex:T.value},null,8,["data","activeIndex"])]),e.createElementVNode("div",{class:"klineBasic-main",style:e.normalizeStyle({height:C.value.showSubChart?"70%":"100%"})},[e.createVNode(We,{onCloseContextMenuCallBack:ge},{popover:e.withCtx(()=>[e.createVNode(y,{style:{borderRadius:"4px",overflow:"hidden",background:"#fff",borderRight:0}},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Q.value,w=>(e.openBlock(),e.createBlock(_,{style:{height:"36px"},key:w.key,index:w.key,onClick:I=>ye(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:E,style:{height:"100%"}},null,512)]),_:1})],4),C.value.showSubChart?(e.openBlock(),e.createElementBlock("div",Ke,[e.createVNode(Pe,{ref_key:"klineSubRef",ref:V,modelValue:R.value,"onUpdate:modelValue":n[0]||(n[0]=w=>R.value=w),data:N.value,cycle:o.cycle,activeIndex:T.value,subIndicatorList:(L=o.indicatorStore)==null?void 0:L.subIndicatorList},null,8,["modelValue","data","cycle","activeIndex","subIndicatorList"])])):e.createCommentVNode("",!0),b.value?(e.openBlock(),e.createElementBlock("div",Ue,[e.createVNode(v,{class:"klineBasic-empty-content",description:"暂无数据"})])):e.createCommentVNode("",!0),h.value?(e.openBlock(),e.createElementBlock("div",He,[Ze,e.createElementVNode("div",Xe,[e.createVNode(l,{onClick:ee},{default:e.withCtx(()=>[e.createTextVNode("刷新")]),_:1})])])):e.createCommentVNode("",!0)],32),e.createVNode(S,{modelValue:$.value,"onUpdate:modelValue":n[5]||(n[5]=w=>$.value=w),title:"画线预警-修改价格",width:"30%","align-center":""},{footer:e.withCtx(()=>[e.createElementVNode("span",Je,[e.createVNode(l,{onClick:n[4]||(n[4]=w=>$.value=!1)},{default:e.withCtx(()=>[e.createTextVNode("取消")]),_:1}),e.createVNode(l,{type:"primary",onClick:me},{default:e.withCtx(()=>[e.createTextVNode("确定")]),_:1})])]),default:e.withCtx(()=>[Ge,e.createVNode(c,{modelValue:H.value,"onUpdate:modelValue":n[3]||(n[3]=w=>H.value=w),placeholder:"输入预警价格"},null,8,["modelValue"])]),_:1},8,["modelValue"])],64)}}},et=K._export_sfc(Qe,[["__scopeId","data-v-9e6456be"]]),tt={install(o){o.component("st-klineBasic",et)}};module.exports=tt;
1
+ "use strict";require("./base-ef747d02.cjs");const ve=require("./el-dialog-ae86edb8.cjs");require("./el-overlay-9e34965f.cjs");require("./el-input-7fd293af.cjs");const xe=require("./el-input-number-22e21d16.cjs"),be=require("./el-button-eec58cff.cjs"),he=require("./el-empty-1697ded8.cjs"),le=require("./el-menu-item-17dc717e.cjs");require("./el-tooltip-0ea8fbf8.cjs");require("./el-popper-b6c99b28.cjs");const e=require("vue"),_e=require("echarts"),d=require("./dayjs.min-2c20abe6.cjs"),A=require("./index-8901a38c.cjs"),J=require("./el-message-5e6a6be9.cjs"),K=require("./_plugin-vue_export-helper-f246444f.cjs");require("./el-tag-a33c4b22.cjs");const ie=require("./el-select-d8d91db1.cjs");require("./el-scrollbar-bc3f790d.cjs");require("./index-098c2447.cjs");require("./use-form-common-props-fd9b61a0.cjs");require("./index-9780a537.cjs");require("./index-bb833443.cjs");require("./index-f1c702f6.cjs");require("./vnode-b906ae6d.cjs");require("./scroll-b108dabd.cjs");require("./use-global-config-30d7d8ce.cjs");require("./index-c108567d.cjs");require("./typescript-b63f8e83.cjs");require("./index-11547a0c.cjs");require("./index-eea0bcb3.cjs");require("./config-provider-a584d81e.cjs");require("./index-298075cf.cjs");require("./index-f3562b52.cjs");require("./castArray-35947698.cjs");require("./debounce-62f5b6e8.cjs");function Ye(o){const k=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const D in o)if(D!=="default"){const s=Object.getOwnPropertyDescriptor(o,D);Object.defineProperty(k,D,s.get?s:{enumerable:!0,get:()=>o[D]})}}return k.default=o,Object.freeze(k)}const ne=Ye(_e);let z=null;const ke=o=>{const k=A.y(o,{handleReq:D=>{A.v()&&(D.headers.token=A.U())},handleRes:D=>{const{data:s}=D;if(s.code===401)return location.origin.includes("localhost")?location.href=`${location.origin}/#/404`:A.K(),!0}});k.get,z=k.post},we=o=>z("/middleLayer/kline/getKlineBasic",{...o,userId:A.V("id")}),De=o=>z("/middleLayer/kline/getKline",o),Me=async o=>z("/alarm/deliversign/addAlarmPrice",{...o,userId:A.V("id")}),Se=async o=>z("/alarm/deliversign/findAlarmPriceByUserId",{...o,userId:A.V("id")}),ce=async o=>z("/alarm/deliversign/updateAlarmPrice",{...o,userId:A.V("id")}),Ve=async o=>z("/alarm/deliversign/deleteAlarmPrice",{...o,userId:A.V("id")}),{round:U}=A.x,Te=(o,k,D,s,m)=>{const{data:t,time:M}=o,{gridTop:u,gridRight:x,gridLeft:f,maxShowCounts:g,showSubChart:r}=k;return{animation:!1,grid:{top:`${u}px`,right:`${x}px`,bottom:r?"6px":"24px",left:`${f}px`},dataZoom:[{type:"inside",startValue:D,endValue:s,maxValueSpan:g}],tooltip:{trigger:"axis",appendToBody:!0,confine:!0,axisPointer:{type:"cross",label:{rich:{},formatter:a=>{const{axisDimension:b,value:h}=a;return b==="x"?r?"":["6","7","8"].includes(m)?d.dayjs(h).format("YYYY-MM-DD"):h:String(U(h))}}},formatter:()=>""},xAxis:{show:!r,type:"category",data:M,splitLine:{show:!1},axisLabel:{formatter:a=>["6","7","8"].includes(m)?d.dayjs(a).format("YYYY-MM-DD"):a}},yAxis:{type:"value",axisLine:{show:!0},splitLine:{show:!0,lineStyle:{type:"dotted",color:"#333"}},min:a=>U(a.min),max:a=>U(a.max)},series:[{type:"candlestick",data:t,itemStyle:{color:"transparent",color0:"#00FFFF",borderColor:"#FF0000",borderColor0:"#00FFFF",borderWidth:1}},...o.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)"}}}},Le=(o,k,D,s,m)=>{const{variety:t,featureId:M,featureType:u}=D,{gridTop:x,gridLeft:f,gridRight:g}=s;return k.reduce((r,a)=>{const{warnPrice:b}=a,h=o==null?void 0:o.convertToPixel({yAxisIndex:0},b);if(h<=x||h>=(o==null?void 0:o.getHeight()))return r;let E=0;return[...r,{type:"group",name:"warningLine",info:a,draggable:"vertical",children:[{type:"line",info:a,shape:{x1:f,y1:h,x2:(o==null?void 0:o.getWidth())-g,y2:h},style:{stroke:"#FFF",lineWidth:1,lineDash:[8,4]},z:10},{type:"text",info:a,x:(o==null?void 0:o.getWidth())-g,y:h-5,style:{fill:"#FFF",text:b,stroke:"#000",lineWidth:1,opacity:1},z:10}],ondragstart:V=>{E=V.offsetY},ondrag:V=>{var R;if(V.target&&V.target.childAt(1)){const T=o.convertFromPixel({yAxisIndex:0},h+(V.offsetY-E));(R=V.target.childAt(1))==null||R.animate("style",!1).when(1,{text:U(T,3)}).start()}},ondragend:async V=>{const T=V.offsetY-E;if(T!==0){const N=o==null?void 0:o.convertFromPixel({yAxisIndex:0},T+h),p={id:a.id,warnPrice:U(N,3),featureId:M,featureCode:t,featureType:u};await ce(p),J.ElMessage.success("画线预警修改成功"),m&&m()}}}]},[])},Be=e.defineComponent({__name:"index",props:{data:{type:Array,require:!0}},setup(o){const k=o,D=e.ref(null),s=e.ref([]);return e.watch(()=>k.data,()=>{s.value.length===0&&e.nextTick(()=>{Array.from(D.value.children).forEach((m,t)=>{var M,u,x,f,g,r,a,b;((u=(M=k.data)==null?void 0:M[t])==null?void 0:u.label)==="涨跌"?s.value[t]="85px":((f=(x=k.data)==null?void 0:x[t])==null?void 0:f.label)==="至今涨跌"?s.value[t]="110px":((r=(g=k.data)==null?void 0:g[t])==null?void 0:r.label)==="额"?s.value[t]="75px":["开","高","低","收"].includes((b=(a=k.data)==null?void 0:a[t])==null?void 0:b.label)?s.value[t]=`${m.offsetWidth+20}px`:s.value[t]=`${m.offsetWidth+30}px`})})}),(m,t)=>(e.openBlock(),e.createElementBlock("div",{class:"kline-tips",ref_key:"tipsRef",ref:D},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.data,(M,u)=>(e.openBlock(),e.createElementBlock("div",{key:u,class:"kline-tips-item",style:e.normalizeStyle({color:M.color,width:s.value[u]?s.value[u]:null})},e.toDisplayString(M.label)+" "+e.toDisplayString(M.value),5))),128))],512))}});const se=K._export_sfc(Be,[["__scopeId","data-v-1f923b0e"]]);const Ee={class:"kline-tips"},Ne={__name:"index",props:{data:{type:Object,require:!0},activeIndex:{type:[Number,String],require:!0}},setup(o){const{round:k,formatValue:D}=A.x,s=o,m=e.ref(null);e.watch(()=>s.activeIndex,()=>{m.value===null&&(m.value=s.data.data[s.activeIndex][1])});const t=e.computed(()=>{const{data:u,activeIndex:x}=s;if(u.data&&u.data[x]){const f=u.data[x],g=[{label:"开",value:f[0]},{label:"高",value:f[3]},{label:"低",value:f[2]},{label:"收",value:f[1]}];f[4]!==null&&g.push({label:"额",value:D(f[4])});let r;f[6]>0?r="red":f[6]<0&&(r="green"),g.push({label:"涨跌",value:`${k(f[6])}%`,color:r});const a=(m.value/f[1]-1)*100;let b;return a>0?b="red":a<0&&(b="green"),g.push({label:"至今涨幅",value:`${k(a)}%`,color:b}),g}return[]}),M=e.computed(()=>{var f;const{data:u,activeIndex:x}=s;return((f=u==null?void 0:u.mainIndicator)==null?void 0:f.map(g=>({label:g.key,value:k(g.data[x]),color:g.color})))||[]});return(u,x)=>(e.openBlock(),e.createElementBlock("div",Ee,[e.createVNode(se,{data:t.value},null,8,["data"]),e.createVNode(se,{data:M.value},null,8,["data"])]))}},Fe=K._export_sfc(Ne,[["__scopeId","data-v-85e9befe"]]),qe={class:"kline-averageTips"},Ae=e.defineComponent({__name:"index",props:{data:{type:Array,require:!0}},setup(o){return(k,D)=>(e.openBlock(),e.createElementBlock("div",qe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.data,(s,m)=>(e.openBlock(),e.createElementBlock("div",{key:m,class:"kline-averageTips-item",style:e.normalizeStyle({color:s.color,width:`calc(100% / ${o.data.length} - 10px)`})},e.toDisplayString(s.label)+" "+e.toDisplayString(s.value),5))),128))]))}});const Re=K._export_sfc(Ae,[["__scopeId","data-v-c47865cb"]]);const je={class:"klineSub"},Oe={class:"klineSub-tips"},Ie={key:0,class:"klineSub-tips-select"},$e={__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(o,{expose:k,emit:D}){const{round:s}=A.x;let m,t;const M=D,u=o,x=e.ref(),f=e.computed({get(){return u.modelValue},set(a){M("update:modelValue",a)}}),g=e.computed(()=>{var h;const{data:a,activeIndex:b}=u;return((h=a==null?void 0:a.subIndicator)==null?void 0:h.map(E=>({label:E.key,color:E.color,value:E.data[b]||"-"})))||[]});e.onMounted(()=>{m=ne.init(x.value);let a=!0;t=new ResizeObserver(()=>{if(a){a=null;return}m.resize()}),t.observe(x.value)}),e.onUnmounted(()=>{m.dispose(),t.disconnect(),t=null});const r=(a,b)=>{const h=a[b],E=b===0?a[b]:a[b-1];return h[0]===h[1]?h[0]>=E[1]?{color:"transparent",borderColor:"#FF0000"}:{color:"#00FFFF"}:h[1]>h[0]?{color:"transparent",borderColor:"#FF0000"}:{color:"#00FFFF"}};return k({connect:a=>{ne.connect([a,m])},draw:(a,b)=>{e.nextTick(()=>{const{startValue:h,endValue:E,maxValueSpan:V}=a,{leftYAxisRange:R,rightYAxisRange:T}=u.data.subIndicator[0],N=u.data.subIndicator.map(p=>{if(p.series==="bar")return{name:"subMain",xAxisIndex:0,yAxisIndex:1,type:"bar",silent:!0,symbol:"none",data:p.data.map((O,$)=>p.seriesColor==="kline"?{value:O,itemStyle:r(u.data.data,$)}:p.seriesColor==="value"?{value:O,itemStyle:{color:O>=0?"#FF0000":"#00FFFF"}}:{value:O,itemStyle:{color:p.seriesColor}})};if(p.series==="line")return{xAxisIndex:0,yAxisIndex:p.yAxis==="right"?2:1,name:p.key,type:"line",silent:!0,symbol:"none",data:p.data,lineStyle:{width:1},itemStyle:{color:p.color}}});m.setOption({animation:!1,grid:{left:`${b.gridLeft}px`,top:"10px",right:`${b.gridRight}px`,bottom:"20px"},dataZoom:[{type:"inside",startValue:h,endValue:E,maxValueSpan:V}],tooltip:{trigger:"axis",appendToBody:!0,confine:!0,axisPointer:{type:"cross",label:{rich:{},formatter:p=>{const{axisDimension:O,value:$}=p;if(O==="x")return["6","7","8"].includes(u.cycle)?d.dayjs($).format("YYYY-MM-DD"):$;if(p.axisIndex===1)return String(s($))}}},formatter:()=>""},xAxis:{type:"category",data:u.data.time,axisLine:{show:!0},splitLine:{show:!1},axisLabel:{formatter:p=>["6","7","8"].includes(u.cycle)?d.dayjs(p).format("YYYY-MM-DD"):p}},yAxis:[{position:"right"},{position:"left",min:R==="cover"?p=>p.min:null,max:R==="cover"?p=>p.max:null,splitNumber:1,axisLine:{show:!0},splitLine:{show:!0,lineStyle:{type:"dotted",color:"#333"}}},{position:"right",min:T==="cover"?p=>p.min:null,max:T==="cover"?p=>p.max:null,splitNumber:1,axisLine:{show:!1},splitLine:{show:!1},axisLabel:{show:!1}}],series:N},!0)})}}),(a,b)=>{const h=ie.ElOption,E=ie.ElSelect;return e.openBlock(),e.createElementBlock("div",je,[e.createElementVNode("div",Oe,[g.value.length?(e.openBlock(),e.createElementBlock("div",Ie,[e.createVNode(E,{modelValue:f.value,"onUpdate:modelValue":b[0]||(b[0]=V=>f.value=V),size:"small","popper-class":"element-dark",class:"element-dark subIndicator"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.subIndicatorList,V=>(e.openBlock(),e.createBlock(h,{key:V.value,label:V.label,value:V.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])])):e.createCommentVNode("",!0),e.createVNode(Re,{data:g.value},null,8,["data"])]),e.createElementVNode("div",{class:"klineSub-chart",ref_key:"subChartRef",ref:x},null,512)])}}},Pe=K._export_sfc($e,[["__scopeId","data-v-7ec4c8cf"]]),Ce=e.defineComponent({__name:"index",emits:["closeContextMenuCallBack"],setup(o,{emit:k}){const D=k,s=e.ref(),m=e.ref(),t=e.ref({display:"none",top:"0px",left:"0px"}),M=()=>{t.value.display="none",D("closeContextMenuCallBack"),document.removeEventListener("click",M)},u=x=>{if(x.preventDefault(),t.value.display==="block"){const{offsetX:f,offsetY:g}=x,{offsetWidth:r,offsetHeight:a}=m.value;if(f<=r&&g<=a)return}s.value.click(),t.value={display:"block",top:`${x.offsetY}px`,left:`${x.offsetX}px`},e.nextTick(()=>{const f=s.value.getBoundingClientRect(),g=m.value.getBoundingClientRect();g.left+g.width>=f.right&&(t.value.left=`${x.offsetX-g.width}px`),g.top+g.height>=f.bottom&&(console.log("高度超出"),t.value.top=`${x.offsetY-g.height}px`)}),document.addEventListener("click",M)};return(x,f)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"contextmenuRef",ref:s,class:"contextmenu",onContextmenu:u,onMouseleave:M},[e.renderSlot(x.$slots,"default",{},void 0,!0),t.value.display!=="none"?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"contextmenuContentRef",ref:m,class:"contextmenu-popover",style:e.normalizeStyle(t.value)},[e.renderSlot(x.$slots,"popover",{},void 0,!0)],4)):e.createCommentVNode("",!0)],544))}});const We=K._export_sfc(Ce,[["__scopeId","data-v-811db6b4"]]);const ue=o=>(e.pushScopeId("data-v-eff0fd1a"),o=o(),e.popScopeId(),o),ze={class:"klineBasic-tips"},Ke={key:0,class:"klineBasic-sub"},Ue={key:1,class:"klineBasic-empty"},He={key:2,class:"klineBasic-error"},Ze=ue(()=>e.createElementVNode("div",{class:"klineBasic-error-content"},"加载失败,请刷新重试",-1)),Xe={style:{"text-align":"center"}},Ge=ue(()=>e.createElementVNode("span",{style:{"margin-right":"10px"}},"预警价格:",-1)),Je={class:"dialog-footer"},Qe={__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(o,{expose:k,emit:D}){const s=[{label:"画线预警",key:"drawWarningLine"}];let m=null,t=null,M,u,x=!1,f=!1;const g=D,r=o,a=e.ref(!1),b=e.ref(!1),h=e.ref(!1),E=e.ref(null),V=e.ref(null),R=e.ref("VOL"),T=e.ref(0),N=e.ref({}),p=e.ref([]),O=e.ref({}),$=e.ref(!1),H=e.ref(""),Q=e.ref([...s]),C=e.computed(()=>({defaultShowCounts:500,addCounts:2e3,maxShowCounts:5e3,loadCheckCounts:500,showSubChart:!0,gridTop:48,gridLeft:80,gridRight:50,showWarningLine:!0,getFactorData:!0,...r.config}));e.watch(()=>{var i,n;return[r.variety,r.cycle,r.mainIndicator,R.value,(i=r.indicatorStore)==null?void 0:i.filterIndicator,(n=r.indicatorStore)==null?void 0:n.customIndicator]},()=>{ee()},{deep:!0}),e.onMounted(()=>{ke(r.env),ee(),window.addEventListener("keydown",oe)}),e.onUnmounted(()=>{t==null||t.off("datazoom"),t==null||t.off("highlight"),t==null||t.off("globalout"),t==null||t.dispose(),m==null||m.dispose(),window.removeEventListener("keydown",oe)});const de=()=>{t||(t=ne.init(E.value),fe(),C.value.showSubChart&&V.value.connect(t),m=A.D(E.value),m.listen(()=>{requestAnimationFrame(()=>{t.resize()})}))},oe=({code:i,ctrlKey:n})=>{if(!(n||a.value))return;const{xAxis:_,dataZoom:y}=t.getOption(),{data:v}=(_==null?void 0:_[0])??{data:[]};let{startValue:l,endValue:c}=(y==null?void 0:y[0])??{};if(v!=null&&v.length){switch(i){case"ArrowUp":{if(c-l<5)return;const S=Math.floor((c-l)/2)+1;l=l+S,c-l<5&&(l=c-4);break}case"ArrowDown":{const S=Math.min(500,c-l);l=l-S-1;break}case"ArrowLeft":{l>0&&(l-=1,c-=1),T.value>0&&(T.value-=1);break}case"ArrowRight":{c<v.length-1&&(l+=1,c+=1),a.value&&T.value<v.length-1&&(T.value+=1);break}}t.dispatchAction({type:"dataZoom",startValue:l,endValue:c}),t.dispatchAction({type:"updateAxisPointer",seriesIndex:0,dataIndex:a.value?T.value:null}),t.dispatchAction({type:"highlight",dataIndex:a.value?T.value:c})}},fe=()=>{t==null||t.on("datazoom",n=>{clearTimeout(u),u=setTimeout(()=>{var y,v,l,c;const{loadCheckCounts:_}=C.value;if((v=(y=t==null?void 0:t.getOption())==null?void 0:y.dataZoom)!=null&&v[0]){const{startValue:S}=(c=(l=t==null?void 0:t.getOption())==null?void 0:l.dataZoom)==null?void 0:c[0];S<_&&x===!1&&f===!1&&(x=!0,pe("history")),Z()}clearTimeout(u)},100)}),t==null||t.on("highlight",n=>{var y,v;let _=n.dataIndex||-1;n.batch&&(_=typeof((y=n==null?void 0:n.batch[0])==null?void 0:y.dataIndex)=="number"?(v=n==null?void 0:n.batch[0])==null?void 0:v.dataIndex:-1),clearTimeout(M),M=setTimeout(()=>{T.value=_,clearTimeout(M)},20)}),t==null||t.on("globalout",()=>{const n=setTimeout(()=>{var y,v,l;clearTimeout(n);const _=(l=(v=(y=t==null?void 0:t.getOption())==null?void 0:y.dataZoom)==null?void 0:v[0])==null?void 0:l.endValue;T.value=_},30)});let i=null;t==null||t.on("contextmenu",n=>{i=setTimeout(()=>{n.componentType==="graphic"&&(O.value=n.info,Q.value=[{label:"删除画线",key:"deleteWarningLine"},{label:"修改画线",key:"changeWarningLine"}]),clearTimeout(i),i=null})})},ee=async()=>{var i,n,_,y,v,l;try{if(!r.variety||!r.cycle)return;const{variety:c,featureId:S,cycle:L,indicatorStore:w,mainIndicator:I,right:P,startTime:W,endTime:B}=r,{defaultShowCounts:F,addCounts:Y,showWarningLine:te,getFactorData:G}=C.value,q={variety:c,featureId:S,cycle:L,mainIndicatorList:w.getIndicatorParams(I),subIndicator:R.value,right:P,showWarningLine:te,getFactorData:G};W&&B?(q.startTime=W,q.endTime=B):W?(q.startTime=W,q.limit=F+Y):B?(q.endTime=B,q.limit=F+Y):(q.endTime=d.dayjs().add(1,"hour").format("YYYY-MM-DD HH:mm:ss"),q.limit=F+Y);const j=await we(q);if((_=(n=(i=j==null?void 0:j.body)==null?void 0:i.kline)==null?void 0:n.time)!=null&&_.length)b.value=!1,h.value=!1;else{b.value=!0,h.value=!1;return}N.value=(y=j==null?void 0:j.body)==null?void 0:y.kline,p.value=((v=j==null?void 0:j.body)==null?void 0:v.warningLine)||[],ae(),Z(),G&&g("getFactorData",(l=j==null?void 0:j.body)==null?void 0:l.factor)}catch(c){throw h.value=!0,b.value=!1,new Error(c)}},pe=async i=>{const{variety:n,cycle:_,indicatorStore:y,mainIndicator:v,right:l}=r,{addCounts:c}=C.value,{time:S}=N.value;if(i==="history"){const L=await De({variety:n,cycle:_,endTime:S[0],limit:c,mainIndicatorList:y.getIndicatorParams(v),subIndicator:R.value,right:l});N.value={time:[...L.body.time,...N.value.time.slice(1)],data:[...L.body.data,...N.value.data.slice(1)],mainIndicator:N.value.mainIndicator.map((w,I)=>{var P;return{...w,data:[...((P=L.body.mainIndicator[I])==null?void 0:P.data)??[],...w.data.slice(1)]}}),subIndicator:N.value.subIndicator.map((w,I)=>{var P;return{...w,data:[...((P=L.body.subIndicator[I])==null?void 0:P.data)??[],...w.data.slice(1)]}})},ae(!0),L.body.data.length<c&&(f=!0),x=!1}},ae=(i=!1)=>{var I,P,W;de();const{time:n}=N.value,{gridRight:_,gridLeft:y,defaultShowCounts:v,maxShowCounts:l,showSubChart:c}=C.value;let S=n.length-1-v,L=n.length-1;if(i){const B=t.getOption(),F=(P=(I=B==null?void 0:B.xAxis)==null?void 0:I[0])==null?void 0:P.data,Y=(W=B==null?void 0:B.dataZoom)==null?void 0:W[0],te=F[Y==null?void 0:Y.startValue],G=F[Y==null?void 0:Y.endValue];S=n.findIndex(q=>q===te),L=n.findIndex(q=>q===G)}const w=Te(N.value,C.value,S,L,r.cycle);if(t.setOption(w,!0),T.value=L,r.brushRange){let B=null,F=null;switch(r.cycle){case"6":{B=n.find(Y=>new Date(Y).getTime()>=new Date(r.brushRange[0]).getTime()||d.dayjs(Y).format("YYYY-MM-DD")===d.dayjs(r.brushRange[0]).format("YYYY-MM-DD")),F=n.findLast(Y=>new Date(Y).getTime()<=new Date(r.brushRange[1]).getTime()||d.dayjs(Y).format("YYYY-MM-DD")===d.dayjs(r.brushRange[1]).format("YYYY-MM-DD"));break}case"7":{B=n.find(Y=>d.dayjs(Y).day(5).format("YYYY-MM-DD")===d.dayjs(r.brushRange[0]).day(5).format("YYYY-MM-DD")),F=n.findLast(Y=>d.dayjs(Y).day(5).format("YYYY-MM-DD")===d.dayjs(r.brushRange[1]).day(5).format("YYYY-MM-DD"));break}case"8":{B=n.find(Y=>d.dayjs(Y).endOf("month").format("YYYY-MM-DD")===d.dayjs(r.brushRange[0]).endOf("month").format("YYYY-MM-DD")),F=n.findLast(Y=>d.dayjs(Y).endOf("month").format("YYYY-MM-DD")===d.dayjs(r.brushRange[1]).endOf("month").format("YYYY-MM-DD"));break}default:B=n.find(Y=>new Date(Y).getTime()>=new Date(r.brushRange[0]).getTime()),F=n.findLast(Y=>new Date(Y).getTime()<=new Date(r.brushRange[1]).getTime())}console.log(B,F),t.dispatchAction({type:"brush",areas:[{brushType:"lineX",coordRange:[B,F],xAxisIndex:0}]})}c&&V.value.draw({startValue:S,endValue:L,maxValueSpan:l},{gridLeft:y,gridRight:_}),re()},Z=()=>{if(!t)return;const i=t==null?void 0:t.getOption();i&&(t==null||t.setOption({...i,graphic:[...Le(t,p.value,r,C.value,()=>{X()})]},!0),re())},re=()=>{const{time:i}=N.value;if(r.brushRange&&(i!=null&&i.length)){let n=d.dayjs(r.brushRange[0]).format("YYYY-MM-DD 00:00:00"),_=d.dayjs(r.brushRange[1]).format("YYYY-MM-DD 23:59:59"),y=null,v=null;switch(r.cycle){case"6":{y=i.find(l=>d.dayjs(l).format("YYYY-MM-DD")===d.dayjs(n).format("YYYY-MM-DD")),v=y;break}case"7":{y=i.find(l=>d.dayjs(l).day(5).format("YYYY-MM-DD")===d.dayjs(n).day(5).format("YYYY-MM-DD")),v=i.findLast(l=>d.dayjs(l).day(5).format("YYYY-MM-DD")===d.dayjs(_).day(5).format("YYYY-MM-DD"));break}case"8":{y=i.find(l=>d.dayjs(l).endOf("month").format("YYYY-MM-DD")===d.dayjs(n).endOf("month").format("YYYY-MM-DD")),v=i.findLast(l=>d.dayjs(l).endOf("month").format("YYYY-MM-DD")===d.dayjs(_).endOf("month").format("YYYY-MM-DD"));break}default:y=i.find(l=>{const c=d.dayjs(l).format("YYYY-MM-DD")===d.dayjs(n).format("YYYY-MM-DD"),S=new Date(l).getTime()>=new Date(n).getTime();return c&&S}),v=i.findLast(l=>{const c=d.dayjs(l).format("YYYY-MM-DD")===d.dayjs(_).format("YYYY-MM-DD"),S=new Date(l).getTime()<=new Date(_).getTime();return c&&S})}t.dispatchAction({type:"brush",areas:[{brushType:"lineX",coordRange:[y,v],xAxisIndex:0}]})}},X=async()=>{const i=await Se({featureId:r.featureId});p.value=(i==null?void 0:i.body)||[],Z(),g("change","warningLine",p.value)},ye=async i=>{const{variety:n,varietyName:_,featureId:y,featureType:v}=r;if(i.key==="drawWarningLine"){const l=t==null?void 0:t.getOption(),c=l.tooltip[0];t==null||t.setOption({...l,tooltip:{...c,axisPointer:{...c.axisPointer,lineStyle:{width:0},crossStyle:{width:2},label:{...c.axisPointer.label,backgroundColor:"transparent",formatter:L=>""}}}});const S=async L=>{t==null||t.getZr().off("mousedown",S);const w=t==null?void 0:t.convertFromPixel({yAxisIndex:0},L.offsetY),I=Math.round(w*1e3)/1e3;t==null||t.setOption({...l,tooltip:{...c,axisPointer:{...c.axisPointer,lineStyle:{width:1},crossStyle:{width:1},label:{...c.axisPointer.label,backgroundColor:null}}}}),await Me({featureCode:n,featureName:_,featureId:y,featureType:v,warnPrice:I}),J.ElMessage.success("画线预警成功!"),X()};t==null||t.getZr().on("mousedown",S)}else i.key==="deleteWarningLine"?(await Ve({id:O.value.id}),J.ElMessage.success("画线预警删除成功"),X()):i.key==="changeWarningLine"&&($.value=!0,H.value=O.value.warnPrice)},me=async()=>{const{variety:i,varietyName:n,featureId:_,featureType:y}=r;await ce({id:O.value.id,featureCode:i,featureName:n,featureId:_,featureType:y,warnPrice:H.value}),J.ElMessage.success("画线预警修改成功"),X()},ge=()=>{Q.value=[...s]};return k({draw:(i,n)=>{i==="warningLine"&&(p.value=n,Z())}}),(i,n)=>{var L;const _=le.ElMenuItem,y=le.ElMenu,v=he.ElEmpty,l=be.ElButton,c=xe.ElInputNumber,S=ve.ElDialog;return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",{class:"klineBasic",onMousemove:n[1]||(n[1]=w=>a.value=!0),onMouseout:n[2]||(n[2]=w=>a.value=!1)},[e.createElementVNode("div",ze,[e.createVNode(Fe,{data:N.value,activeIndex:T.value},null,8,["data","activeIndex"])]),e.createElementVNode("div",{class:"klineBasic-main",style:e.normalizeStyle({height:C.value.showSubChart?"70%":"100%"})},[e.createVNode(We,{onCloseContextMenuCallBack:ge},{popover:e.withCtx(()=>[e.createVNode(y,{style:{borderRadius:"4px",overflow:"hidden",background:"#fff",borderRight:0}},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Q.value,w=>(e.openBlock(),e.createBlock(_,{style:{height:"36px"},key:w.key,index:w.key,onClick:I=>ye(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:E,style:{height:"100%"}},null,512)]),_:1})],4),C.value.showSubChart?(e.openBlock(),e.createElementBlock("div",Ke,[e.createVNode(Pe,{ref_key:"klineSubRef",ref:V,modelValue:R.value,"onUpdate:modelValue":n[0]||(n[0]=w=>R.value=w),data:N.value,cycle:o.cycle,activeIndex:T.value,subIndicatorList:(L=o.indicatorStore)==null?void 0:L.subIndicatorList},null,8,["modelValue","data","cycle","activeIndex","subIndicatorList"])])):e.createCommentVNode("",!0),b.value?(e.openBlock(),e.createElementBlock("div",Ue,[e.createVNode(v,{class:"klineBasic-empty-content",description:"暂无数据"})])):e.createCommentVNode("",!0),h.value?(e.openBlock(),e.createElementBlock("div",He,[Ze,e.createElementVNode("div",Xe,[e.createVNode(l,{onClick:ee},{default:e.withCtx(()=>[e.createTextVNode("刷新")]),_:1})])])):e.createCommentVNode("",!0)],32),e.createVNode(S,{modelValue:$.value,"onUpdate:modelValue":n[5]||(n[5]=w=>$.value=w),title:"画线预警-修改价格",width:"30%","align-center":""},{footer:e.withCtx(()=>[e.createElementVNode("span",Je,[e.createVNode(l,{onClick:n[4]||(n[4]=w=>$.value=!1)},{default:e.withCtx(()=>[e.createTextVNode("取消")]),_:1}),e.createVNode(l,{type:"primary",onClick:me},{default:e.withCtx(()=>[e.createTextVNode("确定")]),_:1})])]),default:e.withCtx(()=>[Ge,e.createVNode(c,{modelValue:H.value,"onUpdate:modelValue":n[3]||(n[3]=w=>H.value=w),placeholder:"输入预警价格"},null,8,["modelValue"])]),_:1},8,["modelValue"])],64)}}},et=K._export_sfc(Qe,[["__scopeId","data-v-eff0fd1a"]]),tt={install(o){o.component("st-klineBasic",et)}};module.exports=tt;
package/es/KlineBasic.js CHANGED
@@ -37,17 +37,17 @@ import "./debounce-8d53f4dd.js";
37
37
  let Z = null;
38
38
  const Xe = (n) => {
39
39
  const w = Ce(n, {
40
- handleReq: (L) => {
41
- ze() && (L.headers.token = Ke());
40
+ handleReq: (T) => {
41
+ ze() && (T.headers.token = Ke());
42
42
  },
43
- handleRes: (L) => {
44
- const { data: u } = L;
43
+ handleRes: (T) => {
44
+ const { data: u } = T;
45
45
  if (u.code === 401)
46
46
  return location.origin.includes("localhost") ? location.href = `${location.origin}/#/404` : Ue(), !0;
47
47
  }
48
48
  });
49
49
  w.get, Z = w.post;
50
- }, Ge = (n) => Z("/middleLayer/kline/getKlineBasic", { ...n, userId: ne("id") }), Je = (n) => Z("/middleLayer/kline/getKline", n), Qe = async (n) => Z("/alarm/deliversign/addAlarmPrice", { ...n, userId: ne("id") }), et = async (n) => Z("/alarm/deliversign/findAlarmPriceByUserId", { ...n, userId: ne("id") }), Se = async (n) => Z("/alarm/deliversign/updateAlarmPrice", { ...n, userId: ne("id") }), tt = async (n) => Z("/alarm/deliversign/deleteAlarmPrice", { ...n, userId: ne("id") }), { round: J } = be, nt = (n, w, L, u, m) => {
50
+ }, Ge = (n) => Z("/middleLayer/kline/getKlineBasic", { ...n, userId: ne("id") }), Je = (n) => Z("/middleLayer/kline/getKline", n), Qe = async (n) => Z("/alarm/deliversign/addAlarmPrice", { ...n, userId: ne("id") }), et = async (n) => Z("/alarm/deliversign/findAlarmPriceByUserId", { ...n, userId: ne("id") }), Se = async (n) => Z("/alarm/deliversign/updateAlarmPrice", { ...n, userId: ne("id") }), tt = async (n) => Z("/alarm/deliversign/deleteAlarmPrice", { ...n, userId: ne("id") }), { round: J } = be, nt = (n, w, T, u, m) => {
51
51
  const { data: e, time: D } = n, { gridTop: s, gridRight: g, gridLeft: d, maxShowCounts: v, showSubChart: a } = w;
52
52
  return {
53
53
  animation: !1,
@@ -60,7 +60,7 @@ const Xe = (n) => {
60
60
  dataZoom: [
61
61
  {
62
62
  type: "inside",
63
- startValue: L,
63
+ startValue: T,
64
64
  endValue: u,
65
65
  maxValueSpan: v
66
66
  }
@@ -149,8 +149,8 @@ const Xe = (n) => {
149
149
  }
150
150
  }
151
151
  };
152
- }, ot = (n, w, L, u, m) => {
153
- const { variety: e, featureId: D, featureType: s } = L, { gridTop: g, gridLeft: d, gridRight: v } = u;
152
+ }, ot = (n, w, T, u, m) => {
153
+ const { variety: e, featureId: D, featureType: s } = T, { gridTop: g, gridLeft: d, gridRight: v } = u;
154
154
  return w.reduce((a, o) => {
155
155
  const { warnPrice: b } = o, x = n == null ? void 0 : n.convertToPixel({ yAxisIndex: 0 }, b);
156
156
  if (x <= g || x >= (n == null ? void 0 : n.getHeight()))
@@ -206,15 +206,15 @@ const Xe = (n) => {
206
206
  ondrag: (M) => {
207
207
  var P;
208
208
  if (M.target && M.target.childAt(1)) {
209
- const T = n.convertFromPixel({ yAxisIndex: 0 }, x + (M.offsetY - V));
210
- (P = M.target.childAt(1)) == null || P.animate("style", !1).when(1, { text: J(T, 3) }).start();
209
+ const L = n.convertFromPixel({ yAxisIndex: 0 }, x + (M.offsetY - V));
210
+ (P = M.target.childAt(1)) == null || P.animate("style", !1).when(1, { text: J(L, 3) }).start();
211
211
  }
212
212
  },
213
213
  // 事件:结束拖拽
214
214
  ondragend: async (M) => {
215
- const T = M.offsetY - V;
216
- if (T !== 0) {
217
- const I = n == null ? void 0 : n.convertFromPixel({ yAxisIndex: 0 }, T + x), f = {
215
+ const L = M.offsetY - V;
216
+ if (L !== 0) {
217
+ const I = n == null ? void 0 : n.convertFromPixel({ yAxisIndex: 0 }, L + x), f = {
218
218
  id: o.id,
219
219
  warnPrice: J(I, 3),
220
220
  featureId: D,
@@ -240,18 +240,18 @@ const Xe = (n) => {
240
240
  }
241
241
  },
242
242
  setup(n) {
243
- const w = n, L = S(null), u = S([]);
243
+ const w = n, T = S(null), u = S([]);
244
244
  return ye(() => w.data, () => {
245
245
  u.value.length === 0 && ge(() => {
246
- Array.from(L.value.children).forEach((m, e) => {
246
+ Array.from(T.value.children).forEach((m, e) => {
247
247
  var D, s, g, d, v, a, o, b;
248
- ((s = (D = w.data) == null ? void 0 : D[e]) == null ? void 0 : s.label) === "涨跌" ? u.value[e] = "85px" : ((d = (g = w.data) == null ? void 0 : g[e]) == null ? void 0 : d.label) === "至今涨跌" ? u.value[e] = "105px" : ((a = (v = w.data) == null ? void 0 : v[e]) == null ? void 0 : a.label) === "额" ? u.value[e] = "75px" : ["开", "高", "低", "收"].includes((b = (o = w.data) == null ? void 0 : o[e]) == null ? void 0 : b.label) ? u.value[e] = `${m.offsetWidth + 20}px` : u.value[e] = `${m.offsetWidth + 30}px`;
248
+ ((s = (D = w.data) == null ? void 0 : D[e]) == null ? void 0 : s.label) === "涨跌" ? u.value[e] = "85px" : ((d = (g = w.data) == null ? void 0 : g[e]) == null ? void 0 : d.label) === "至今涨跌" ? u.value[e] = "110px" : ((a = (v = w.data) == null ? void 0 : v[e]) == null ? void 0 : a.label) === "额" ? u.value[e] = "75px" : ["开", "高", "低", "收"].includes((b = (o = w.data) == null ? void 0 : o[e]) == null ? void 0 : b.label) ? u.value[e] = `${m.offsetWidth + 20}px` : u.value[e] = `${m.offsetWidth + 30}px`;
249
249
  });
250
250
  });
251
251
  }), (m, e) => (A(), E("div", {
252
252
  class: "kline-tips",
253
253
  ref_key: "tipsRef",
254
- ref: L
254
+ ref: T
255
255
  }, [
256
256
  (A(!0), E(Q, null, ue(n.data, (D, s) => (A(), E("div", {
257
257
  key: s,
@@ -261,7 +261,7 @@ const Xe = (n) => {
261
261
  ], 512));
262
262
  }
263
263
  });
264
- const we = /* @__PURE__ */ X(at, [["__scopeId", "data-v-cf8cdf15"]]);
264
+ const we = /* @__PURE__ */ X(at, [["__scopeId", "data-v-1f923b0e"]]);
265
265
  const lt = { class: "kline-tips" }, rt = {
266
266
  __name: "index",
267
267
  props: {
@@ -276,7 +276,7 @@ const lt = { class: "kline-tips" }, rt = {
276
276
  }
277
277
  },
278
278
  setup(n) {
279
- const { round: w, formatValue: L } = be, u = n, m = S(null);
279
+ const { round: w, formatValue: T } = be, u = n, m = S(null);
280
280
  ye(() => u.activeIndex, () => {
281
281
  m.value === null && (m.value = u.data.data[u.activeIndex][1]);
282
282
  });
@@ -289,7 +289,7 @@ const lt = { class: "kline-tips" }, rt = {
289
289
  { label: "低", value: d[2] },
290
290
  { label: "收", value: d[1] }
291
291
  ];
292
- d[4] !== null && v.push({ label: "额", value: L(d[4]) });
292
+ d[4] !== null && v.push({ label: "额", value: T(d[4]) });
293
293
  let a;
294
294
  d[6] > 0 ? a = "red" : d[6] < 0 && (a = "green"), v.push({ label: "涨跌", value: `${w(d[6])}%`, color: a });
295
295
  const o = (m.value / d[1] - 1) * 100;
@@ -317,7 +317,7 @@ const lt = { class: "kline-tips" }, rt = {
317
317
  }
318
318
  },
319
319
  setup(n) {
320
- return (w, L) => (A(), E("div", st, [
320
+ return (w, T) => (A(), E("div", st, [
321
321
  (A(!0), E(Q, null, ue(n.data, (u, m) => (A(), E("div", {
322
322
  key: m,
323
323
  class: "kline-averageTips-item",
@@ -346,10 +346,10 @@ const dt = { class: "klineSub" }, ft = { class: "klineSub-tips" }, pt = {
346
346
  // 副图指标列表
347
347
  },
348
348
  emits: ["update:modelValue"],
349
- setup(n, { expose: w, emit: L }) {
349
+ setup(n, { expose: w, emit: T }) {
350
350
  const { round: u } = be;
351
351
  let m, e;
352
- const D = L, s = n, g = S(), d = te({
352
+ const D = T, s = n, g = S(), d = te({
353
353
  get() {
354
354
  return s.modelValue;
355
355
  },
@@ -395,7 +395,7 @@ const dt = { class: "klineSub" }, ft = { class: "klineSub-tips" }, pt = {
395
395
  // 联动
396
396
  draw: (o, b) => {
397
397
  ge(() => {
398
- const { startValue: x, endValue: V, maxValueSpan: M } = o, { leftYAxisRange: P, rightYAxisRange: T } = s.data.subIndicator[0], I = s.data.subIndicator.map((f) => {
398
+ const { startValue: x, endValue: V, maxValueSpan: M } = o, { leftYAxisRange: P, rightYAxisRange: L } = s.data.subIndicator[0], I = s.data.subIndicator.map((f) => {
399
399
  if (f.series === "bar")
400
400
  return {
401
401
  name: "subMain",
@@ -507,8 +507,8 @@ const dt = { class: "klineSub" }, ft = { class: "klineSub-tips" }, pt = {
507
507
  },
508
508
  {
509
509
  position: "right",
510
- min: T === "cover" ? (f) => f.min : null,
511
- max: T === "cover" ? (f) => f.max : null,
510
+ min: L === "cover" ? (f) => f.min : null,
511
+ max: L === "cover" ? (f) => f.max : null,
512
512
  splitNumber: 1,
513
513
  axisLine: {
514
514
  show: !1
@@ -564,12 +564,12 @@ const dt = { class: "klineSub" }, ft = { class: "klineSub-tips" }, pt = {
564
564
  __name: "index",
565
565
  emits: ["closeContextMenuCallBack"],
566
566
  setup(n, { emit: w }) {
567
- const L = w, u = S(), m = S(), e = S({
567
+ const T = w, u = S(), m = S(), e = S({
568
568
  display: "none",
569
569
  top: "0px",
570
570
  left: "0px"
571
571
  }), D = () => {
572
- e.value.display = "none", L("closeContextMenuCallBack"), document.removeEventListener("click", D);
572
+ e.value.display = "none", T("closeContextMenuCallBack"), document.removeEventListener("click", D);
573
573
  }, s = (g) => {
574
574
  if (g.preventDefault(), e.value.display === "block") {
575
575
  const { offsetX: d, offsetY: v } = g, { offsetWidth: a, offsetHeight: o } = m.value;
@@ -606,7 +606,7 @@ const dt = { class: "klineSub" }, ft = { class: "klineSub-tips" }, pt = {
606
606
  }
607
607
  });
608
608
  const gt = /* @__PURE__ */ X(yt, [["__scopeId", "data-v-811db6b4"]]);
609
- const Le = (n) => (Ne("data-v-9e6456be"), n = n(), qe(), n), bt = { class: "klineBasic-tips" }, xt = {
609
+ const Te = (n) => (Ne("data-v-eff0fd1a"), n = n(), qe(), n), bt = { class: "klineBasic-tips" }, xt = {
610
610
  key: 0,
611
611
  class: "klineBasic-sub"
612
612
  }, ht = {
@@ -615,7 +615,7 @@ const Le = (n) => (Ne("data-v-9e6456be"), n = n(), qe(), n), bt = { class: "klin
615
615
  }, _t = {
616
616
  key: 2,
617
617
  class: "klineBasic-error"
618
- }, Yt = /* @__PURE__ */ Le(() => /* @__PURE__ */ U("div", { class: "klineBasic-error-content" }, "加载失败,请刷新重试", -1)), wt = { style: { "text-align": "center" } }, Dt = /* @__PURE__ */ Le(() => /* @__PURE__ */ U("span", { style: { "margin-right": "10px" } }, "预警价格:", -1)), kt = { class: "dialog-footer" }, Mt = {
618
+ }, Yt = /* @__PURE__ */ Te(() => /* @__PURE__ */ U("div", { class: "klineBasic-error-content" }, "加载失败,请刷新重试", -1)), wt = { style: { "text-align": "center" } }, Dt = /* @__PURE__ */ Te(() => /* @__PURE__ */ U("span", { style: { "margin-right": "10px" } }, "预警价格:", -1)), kt = { class: "dialog-footer" }, Mt = {
619
619
  __name: "index",
620
620
  props: {
621
621
  variety: {
@@ -683,10 +683,10 @@ const Le = (n) => (Ne("data-v-9e6456be"), n = n(), qe(), n), bt = { class: "klin
683
683
  // 时段框选
684
684
  },
685
685
  emits: ["change", "getFactorData"],
686
- setup(n, { expose: w, emit: L }) {
686
+ setup(n, { expose: w, emit: T }) {
687
687
  const u = [{ label: "画线预警", key: "drawWarningLine" }];
688
688
  let m = null, e = null, D, s, g = !1, d = !1;
689
- const v = L, a = n, o = S(!1), b = S(!1), x = S(!1), V = S(null), M = S(null), P = S("VOL"), T = S(0), I = S({}), f = S([]), N = S({}), C = S(!1), oe = S(""), de = S([...u]), H = te(() => ({
689
+ const v = T, a = n, o = S(!1), b = S(!1), x = S(!1), V = S(null), M = S(null), P = S("VOL"), L = S(0), I = S({}), f = S([]), N = S({}), C = S(!1), oe = S(""), de = S([...u]), H = te(() => ({
690
690
  defaultShowCounts: 500,
691
691
  // 默认展示条数
692
692
  addCounts: 2e3,
@@ -723,7 +723,7 @@ const Le = (n) => (Ne("data-v-9e6456be"), n = n(), qe(), n), bt = { class: "klin
723
723
  }), ke(() => {
724
724
  e == null || e.off("datazoom"), e == null || e.off("highlight"), e == null || e.off("globalout"), e == null || e.dispose(), m == null || m.dispose(), window.removeEventListener("keydown", xe);
725
725
  });
726
- const Te = () => {
726
+ const Le = () => {
727
727
  e || (e = me.init(V.value), Ae(), H.value.showSubChart && M.value.connect(e), m = He(V.value), m.listen(() => {
728
728
  requestAnimationFrame(() => {
729
729
  e.resize();
@@ -749,11 +749,11 @@ const Le = (n) => (Ne("data-v-9e6456be"), n = n(), qe(), n), bt = { class: "klin
749
749
  break;
750
750
  }
751
751
  case "ArrowLeft": {
752
- l > 0 && (l -= 1, i -= 1), T.value > 0 && (T.value -= 1);
752
+ l > 0 && (l -= 1, i -= 1), L.value > 0 && (L.value -= 1);
753
753
  break;
754
754
  }
755
755
  case "ArrowRight": {
756
- i < y.length - 1 && (l += 1, i += 1), o.value && T.value < y.length - 1 && (T.value += 1);
756
+ i < y.length - 1 && (l += 1, i += 1), o.value && L.value < y.length - 1 && (L.value += 1);
757
757
  break;
758
758
  }
759
759
  }
@@ -764,10 +764,10 @@ const Le = (n) => (Ne("data-v-9e6456be"), n = n(), qe(), n), bt = { class: "klin
764
764
  }), e.dispatchAction({
765
765
  type: "updateAxisPointer",
766
766
  seriesIndex: 0,
767
- dataIndex: o.value ? T.value : null
767
+ dataIndex: o.value ? L.value : null
768
768
  }), e.dispatchAction({
769
769
  type: "highlight",
770
- dataIndex: o.value ? T.value : i
770
+ dataIndex: o.value ? L.value : i
771
771
  });
772
772
  }
773
773
  }, Ae = () => {
@@ -785,12 +785,15 @@ const Le = (n) => (Ne("data-v-9e6456be"), n = n(), qe(), n), bt = { class: "klin
785
785
  var p, y;
786
786
  let h = t.dataIndex || -1;
787
787
  t.batch && (h = typeof ((p = t == null ? void 0 : t.batch[0]) == null ? void 0 : p.dataIndex) == "number" ? (y = t == null ? void 0 : t.batch[0]) == null ? void 0 : y.dataIndex : -1), clearTimeout(D), D = setTimeout(() => {
788
- T.value = h, clearTimeout(D);
788
+ L.value = h, clearTimeout(D);
789
789
  }, 20);
790
790
  }), e == null || e.on("globalout", () => {
791
- var h, p, y;
792
- const t = (y = (p = (h = e == null ? void 0 : e.getOption()) == null ? void 0 : h.dataZoom) == null ? void 0 : p[0]) == null ? void 0 : y.endValue;
793
- T.value = t;
791
+ const t = setTimeout(() => {
792
+ var p, y, l;
793
+ clearTimeout(t);
794
+ const h = (l = (y = (p = e == null ? void 0 : e.getOption()) == null ? void 0 : p.dataZoom) == null ? void 0 : y[0]) == null ? void 0 : l.endValue;
795
+ L.value = h;
796
+ }, 30);
794
797
  });
795
798
  let r = null;
796
799
  e == null || e.on("contextmenu", (t) => {
@@ -861,7 +864,7 @@ const Le = (n) => (Ne("data-v-9e6456be"), n = n(), qe(), n), bt = { class: "klin
861
864
  }
862
865
  }, he = (r = !1) => {
863
866
  var q, z, j;
864
- Te();
867
+ Le();
865
868
  const { time: t } = I.value, { gridRight: h, gridLeft: p, defaultShowCounts: y, maxShowCounts: l, showSubChart: i } = H.value;
866
869
  let k = t.length - 1 - y, F = t.length - 1;
867
870
  if (r) {
@@ -869,7 +872,7 @@ const Le = (n) => (Ne("data-v-9e6456be"), n = n(), qe(), n), bt = { class: "klin
869
872
  k = t.findIndex((O) => O === pe), F = t.findIndex((O) => O === re);
870
873
  }
871
874
  const Y = nt(I.value, H.value, k, F, a.cycle);
872
- if (e.setOption(Y, !0), T.value = F, a.brushRange) {
875
+ if (e.setOption(Y, !0), L.value = F, a.brushRange) {
873
876
  let R = null, $ = null;
874
877
  switch (a.cycle) {
875
878
  case "6": {
@@ -1057,7 +1060,7 @@ const Le = (n) => (Ne("data-v-9e6456be"), n = n(), qe(), n), bt = { class: "klin
1057
1060
  U("div", bt, [
1058
1061
  B(it, {
1059
1062
  data: I.value,
1060
- activeIndex: T.value
1063
+ activeIndex: L.value
1061
1064
  }, null, 8, ["data", "activeIndex"])
1062
1065
  ]),
1063
1066
  U("div", {
@@ -1106,7 +1109,7 @@ const Le = (n) => (Ne("data-v-9e6456be"), n = n(), qe(), n), bt = { class: "klin
1106
1109
  "onUpdate:modelValue": t[0] || (t[0] = (Y) => P.value = Y),
1107
1110
  data: I.value,
1108
1111
  cycle: n.cycle,
1109
- activeIndex: T.value,
1112
+ activeIndex: L.value,
1110
1113
  subIndicatorList: (F = n.indicatorStore) == null ? void 0 : F.subIndicatorList
1111
1114
  }, null, 8, ["modelValue", "data", "cycle", "activeIndex", "subIndicatorList"])
1112
1115
  ])) : G("", !0),
@@ -1169,7 +1172,7 @@ const Le = (n) => (Ne("data-v-9e6456be"), n = n(), qe(), n), bt = { class: "klin
1169
1172
  ], 64);
1170
1173
  };
1171
1174
  }
1172
- }, St = /* @__PURE__ */ X(Mt, [["__scopeId", "data-v-9e6456be"]]), cn = {
1175
+ }, St = /* @__PURE__ */ X(Mt, [["__scopeId", "data-v-eff0fd1a"]]), cn = {
1173
1176
  install(n) {
1174
1177
  n.component("st-klineBasic", St);
1175
1178
  }
@@ -1,5 +1,5 @@
1
- "use strict";require("./base-ef747d02.cjs");const v=require("./el-input-7fd293af.cjs");require("./el-tooltip-0ea8fbf8.cjs");const q=require("./el-popper-b6c99b28.cjs"),e=require("vue"),i=require("./index-098c2447.cjs"),V=require("./_plugin-vue_export-helper-f246444f.cjs"),f=require("./el-message-5e6a6be9.cjs");require("./use-form-common-props-fd9b61a0.cjs");require("./index-9780a537.cjs");require("./typescript-b63f8e83.cjs");require("./index-11547a0c.cjs");require("./use-global-config-30d7d8ce.cjs");require("./index-bb833443.cjs");require("./index-c108567d.cjs");require("./config-provider-a584d81e.cjs");const c=r=>(e.pushScopeId("data-v-445e2903"),r=r(),e.popScopeId(),r),h={class:"variety-text-copy"},y={class:"stats-container"},N={class:"stat-item"},g=c(()=>e.createElementVNode("span",{class:"label"},"品种数量统计:",-1)),E={class:"value"},C=c(()=>e.createElementVNode("br",null,null,-1)),I=c(()=>e.createElementVNode("br",null,null,-1)),w={__name:"index",props:{required:{type:Boolean,default:!0}},setup(r,{expose:u}){const d=e.inject("stConfig"),p=r,o=e.ref(""),_=e.computed(()=>l(o.value).length),l=n=>n?n.split(`
2
- `).reduce((s,a)=>{const t=a.trim().replace(/\s+/gi," ").split(" ")[0];return t&&s.push(t),s},[]):[];return u({validate:n=>new Promise(async(s,a)=>{try{if(p.required&&(!o.value||o.value.trim()===""))return f.ElMessage.error("品种内容不可为空"),n(!1);const{body:t}=await d.request.post("/invest/analysis/strategy/verifyCodes",{codes:l(o.value)});return n(!0,t)}catch(t){return a(t)}})}),(n,s)=>{const a=i.ElIcon,t=q.ElTooltip,x=v.ElInput;return e.openBlock(),e.createElementBlock("div",h,[e.createElementVNode("div",y,[e.createElementVNode("div",N,[g,e.createElementVNode("span",E,e.toDisplayString(_.value),1),e.createVNode(t,{class:"box-item",effect:"dark",placement:"right"},{content:e.withCtx(()=>[e.createTextVNode(" 仅统计符合输入格式的数量, 输入格式示例(代码和名称需空格隔开, 名称可不写):"),C,e.createTextVNode("hc8888 热轧卷板期货指数 "),I,e.createTextVNode("sp8888 纸浆期货指数")]),default:e.withCtx(()=>[e.createVNode(a,null,{default:e.withCtx(()=>[e.createVNode(e.unref(i.info_filled_default))]),_:1})]),_:1})])]),e.createVNode(x,{class:"textarea",modelValue:o.value,"onUpdate:modelValue":s[0]||(s[0]=m=>o.value=m),resize:"none",type:"textarea",placeholder:`文本格式要求示例:
1
+ "use strict";require("./base-ef747d02.cjs");const v=require("./el-input-7fd293af.cjs");require("./el-tooltip-0ea8fbf8.cjs");const q=require("./el-popper-b6c99b28.cjs"),e=require("vue"),i=require("./index-098c2447.cjs"),V=require("./el-message-5e6a6be9.cjs"),f=require("./_plugin-vue_export-helper-f246444f.cjs");require("./use-form-common-props-fd9b61a0.cjs");require("./index-9780a537.cjs");require("./typescript-b63f8e83.cjs");require("./index-11547a0c.cjs");require("./use-global-config-30d7d8ce.cjs");require("./index-bb833443.cjs");require("./index-c108567d.cjs");require("./config-provider-a584d81e.cjs");const c=r=>(e.pushScopeId("data-v-445e2903"),r=r(),e.popScopeId(),r),h={class:"variety-text-copy"},y={class:"stats-container"},N={class:"stat-item"},g=c(()=>e.createElementVNode("span",{class:"label"},"品种数量统计:",-1)),E={class:"value"},C=c(()=>e.createElementVNode("br",null,null,-1)),I=c(()=>e.createElementVNode("br",null,null,-1)),w={__name:"index",props:{required:{type:Boolean,default:!0}},setup(r,{expose:u}){const d=e.inject("stConfig"),p=r,o=e.ref(""),_=e.computed(()=>l(o.value).length),l=n=>n?n.split(`
2
+ `).reduce((s,a)=>{const t=a.trim().replace(/\s+/gi," ").split(" ")[0];return t&&s.push(t),s},[]):[];return u({validate:n=>new Promise(async(s,a)=>{try{if(p.required&&(!o.value||o.value.trim()===""))return V.ElMessage.error("品种内容不可为空"),n(!1);const{body:t}=await d.request.post("/invest/analysis/strategy/verifyCodes",{codes:l(o.value)});return n(!0,t)}catch(t){return a(t)}})}),(n,s)=>{const a=i.ElIcon,t=q.ElTooltip,x=v.ElInput;return e.openBlock(),e.createElementBlock("div",h,[e.createElementVNode("div",y,[e.createElementVNode("div",N,[g,e.createElementVNode("span",E,e.toDisplayString(_.value),1),e.createVNode(t,{class:"box-item",effect:"dark",placement:"right"},{content:e.withCtx(()=>[e.createTextVNode(" 仅统计符合输入格式的数量, 输入格式示例(代码和名称需空格隔开, 名称可不写):"),C,e.createTextVNode("hc8888 热轧卷板期货指数 "),I,e.createTextVNode("sp8888 纸浆期货指数")]),default:e.withCtx(()=>[e.createVNode(a,null,{default:e.withCtx(()=>[e.createVNode(e.unref(i.info_filled_default))]),_:1})]),_:1})])]),e.createVNode(x,{class:"textarea",modelValue:o.value,"onUpdate:modelValue":s[0]||(s[0]=m=>o.value=m),resize:"none",type:"textarea",placeholder:`文本格式要求示例:
3
3
  hc8888  热轧卷板期货指数
4
4
  sp8888  纸浆期货指数
5
- bu8888  石油沥青期货指数`},null,8,["modelValue"])])}}},S=V._export_sfc(w,[["__scopeId","data-v-445e2903"]]),T={install(r){r.component("st-varietyTextCopy",S)}};module.exports=T;
5
+ bu8888  石油沥青期货指数`},null,8,["modelValue"])])}}},S=f._export_sfc(w,[["__scopeId","data-v-445e2903"]]),T={install(r){r.component("st-varietyTextCopy",S)}};module.exports=T;
@@ -4,8 +4,8 @@ import "./el-tooltip-4ed993c7.js";
4
4
  import { E as h } from "./el-popper-b4f97157.js";
5
5
  import { inject as g, ref as E, computed as C, openBlock as V, createElementBlock as I, createElementVNode as n, toDisplayString as S, createVNode as i, withCtx as l, createTextVNode as c, unref as b, pushScopeId as w, popScopeId as T } from "vue";
6
6
  import { i as q, E as B } from "./index-a871c3eb.js";
7
- import { _ as N } from "./_plugin-vue_export-helper-dad06003.js";
8
- import { E as k } from "./el-message-e544a8f5.js";
7
+ import { E as N } from "./el-message-e544a8f5.js";
8
+ import { _ as k } from "./_plugin-vue_export-helper-dad06003.js";
9
9
  import "./use-form-common-props-815d48a6.js";
10
10
  import "./index-960806da.js";
11
11
  import "./typescript-7ae59c4c.js";
@@ -28,7 +28,7 @@ const p = (t) => (w("data-v-445e2903"), t = t(), T(), t), j = { class: "variety-
28
28
  return d({ validate: (s) => new Promise(async (r, a) => {
29
29
  try {
30
30
  if (m.required && (!o.value || o.value.trim() === ""))
31
- return k.error("品种内容不可为空"), s(!1);
31
+ return N.error("品种内容不可为空"), s(!1);
32
32
  const { body: e } = await _.request.post("/invest/analysis/strategy/verifyCodes", { codes: u(o.value) });
33
33
  return s(!0, e);
34
34
  } catch (e) {
@@ -79,7 +79,7 @@ bu8888  石油沥青期货指数`
79
79
  ]);
80
80
  };
81
81
  }
82
- }, G = /* @__PURE__ */ N(A, [["__scopeId", "data-v-445e2903"]]), ne = {
82
+ }, G = /* @__PURE__ */ k(A, [["__scopeId", "data-v-445e2903"]]), ne = {
83
83
  install(t) {
84
84
  t.component("st-varietyTextCopy", G);
85
85
  }