版博士V2.0程序
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 
 

2 satır
8.4 KiB

  1. import{k as G}from"./el-button-1a829d03.js";import{E as K}from"./el-divider-547e00d5.js";import{u as Q,q as L,g as X,E as w,a as H,b as Y,c as Z,d as j,e as ee}from"./el-message-96599589.js";import{i as b,L as O}from"./index-9412139c.js";import{u as te}from"./useDarks-2fae6676.js";import{d as ae,b as oe,h,s as le,o as D,e as F,K as p,L as T,O as y,w as N,u as _,U as A,F as E,P as ne,c as se,_ as re}from"./index-080862c1.js";const ie={class:"filterDiv"},de=ae({__name:"chartDefectRate",setup(ce){const{isDark:z,toggleDark:ue}=te();oe(()=>z.value?"dark":"light");const{formatTableDateTime:fe,formatTableDate:pe,formatDateTime:me,formatDate:x,formatNum:he,show_loading:B,close_loading:v}=Q(),i=h(!1),f=h([]),m=h(""),S=h(""),P=h(""),k=h(""),C=h([]),q={shortcuts:[{text:"最近一周",onClick(e){const n=new Date,t=new Date;t.setTime(t.getTime()-3600*1e3*24*7),e.$emit("pick",[t,n])}},{text:"最近一个月",onClick(e){const n=new Date,t=new Date;t.setTime(t.getTime()-3600*1e3*24*30),e.$emit("pick",[t,n])}},{text:"最近三个月",onClick(e){const n=new Date,t=new Date;t.setTime(t.getTime()-3600*1e3*24*90),e.$emit("pick",[t,n])}}]};le(async()=>{console.log("onMounted - DOM挂载完毕");let e=new Date;i.value=[e.setDate(e.getDate()-30),new Date],B(),await $(),I()});const M=()=>{I()},$=async()=>{await L({model:"product",fields:"*",order:"Name"}).then(e=>{console.log("getProductList",e),e.code===200&&C.value.push(...e.data)})},I=async()=>{B(),await R(),U()},R=async()=>{const e={domain:[]};if(i.value&&(console.log(i.value),e.domain.push({FieldName:"CreateTime",FieldValue:x(i.value[0]),ConditionalType:3}),e.domain.push({FieldName:"CreateTime",FieldValue:x(i.value[1])+" 23:59:59",ConditionalType:5})),f.value.length>0){var n="";for(let t in f.value)n+=f.value[t]+",";e.domain.push({FieldName:"ProductId",FieldValue:n,ConditionalType:6})}m.value&&e.domain.push({FieldName:"BatchId",FieldValue:m.value,ConditionalType:0}),console.log(e),await X(e).then(t=>{if(console.log("getchart_defects_total",t),t.code!==200){v(),w({message:t.data,type:"error",showClose:!0,duration:1e3});return}const o=JSON.parse(t.data)[0];var s=[],d=[];s=Object.keys(o),s.forEach(a=>{d.push({name:a,value:o[a]})});let c={title:{text:"缺陷分布",subtext:"",left:"left",textStyle:{color:"#A8ABB2",fontSize:15}},toolbox:{show:!0,feature:{dataView:{readOnly:!1},restore:{},saveAsImage:{}}},tooltip:{trigger:"item",formatter:"{b} <br/>{c} ({d}%)"},legend:{type:"scroll",orient:"vertical",right:110,top:40,data:s,textStyle:{color:"#4DD0D6",fontSize:12}},color:["#09d0fb","#f88cfb","#95f8fe","#f9f390","#ecfeb7"],series:[{type:"pie",roseType:"area",radius:"85%",center:["40%","50%"],selectedMode:"single",data:d,emphasis:{itemStyle:{shadowBlur:10,shadowOffsetX:0,shadowColor:"rgba(0, 0, 0, 0.5)"}}}]};var l=b(S.value);l.setOption(c,!0)})},U=async()=>{const e={domain:[]};if(i.value&&(console.log(i.value),e.domain.push({FieldName:"CreateTime",FieldValue:x(i.value[0]),ConditionalType:3}),e.domain.push({FieldName:"CreateTime",FieldValue:x(i.value[1])+" 23:59:59",ConditionalType:5})),f.value.length>0){var n="";for(let t in f.value)n+=f.value[t]+",";e.domain.push({FieldName:"ProductId",FieldValue:n,ConditionalType:6})}m.value&&e.domain.push({FieldName:"BatchId",FieldValue:m.value,ConditionalType:0}),console.log(e),H(e).then(t=>{if(console.log("getchart_defects_date",t),t.code!==200){v(),w({message:t.data,type:"error",showClose:!0,duration:1e3});return}v();const o=JSON.parse(t.data);var s=[],d=[],c=[],l=[];console.log(o,o.length);for(var a=0;a<o.length;a++)a===0&&(s=Object.keys(o[a])),s.forEach(r=>{if(r=="Date"){let V=new Date(o[a][r]);d.push(`${V.getMonth()+1}月${V.getDate()}日`)}else r=="Total"?c.push(o[a][r]):a===0&&l.push({name:r,type:"line",yAxisIndex:1,data:[]})});for(var a=0;a<o.length;a++)for(var g=0;g<l.length;g++)l[g].data.push(o[a][l[g].name]);c.length>0&&l.splice(0,0,{name:"检测量(件)",type:"bar",yAxisIndex:0,data:c,itemStyle:{color:new O(0,0,0,1,[{offset:0,color:"#0efdff"},{offset:.5,color:"#188df0"},{offset:1,color:"#188df0"}])},emphasis:{itemStyle:{color:new O(0,0,0,1,[{offset:0,color:"#2378f7"},{offset:.7,color:"#2378f7"},{offset:1,color:"#0efdff"}])}}});let u=s.findIndex(r=>r==="Date");u>-1&&s.splice(u,1),u=s.findIndex(r=>r==="Total"),u>-1&&s.splice(u,1),console.log("dataLegend",s),console.log("dataAxis",d),console.log("data",c),console.log("data2",l);let J={title:{text:"缺陷趋势",subtext:"",textStyle:{color:"#A8ABB2",fontSize:15}},tooltip:{trigger:"axis"},legend:{top:10,left:"center",textStyle:{color:"#4DD0D6",fontSize:12},data:s},toolbox:{show:!0,feature:{dataView:{readOnly:!1},magicType:{type:["line","bar"]},restore:{},saveAsImage:{}}},grid:{left:40,right:40,top:60,btttom:20},xAxis:{type:"category",axisLabel:{rotate:40,interval:0,textStyle:{color:"#A8ABB2",fontSize:12}},axisTick:{show:!0,alignWithLabel:!0},axisLine:{show:!0,symbol:["none","arrow"],symbolOffset:12,lineStyle:{color:"#A8ABB2"}},data:d},yAxis:[{type:"value",name:"检测量(件)",position:"left",min:0,max:function(r){return parseInt(r.max/10+1)*10},interval:function(r){return parseInt(r.max/10+1)*10/5},axisLine:{show:!0,symbol:["none","arrow"],symbolOffset:12,lineStyle:{color:"#A8ABB2"}},axisTick:{show:!1},axisLabel:{textStyle:{color:"#A8ABB2",fontSize:12}}},{type:"value",name:"缺陷数",position:"right",min:0,max:function(r){return parseInt(r.max/10+1)*10},interval:function(r){return parseInt(r.max/10+1)*10/5},axisLabel:{formatter:"{value}",textStyle:{color:"#A8ABB2",fontSize:12}},axisLine:{show:!0,symbol:["none","arrow"],symbolOffset:12,lineStyle:{color:"#A8ABB2"}}}],series:l};var W=b(P.value);W.setOption(J,!0)}),console.error("--------------PT-------------"),e.model="Order",e.fields="ProductId,BatchId,SN,PT1,PT2,PT3,PT5,PT6,PTValue",e.order="CreateTime desc",console.log(e),await L(e).then(t=>{if(console.log("query_table PT",t),t.code!==200){v(),w({message:t.data,type:"error",showClose:!0,duration:1e3});return}v();const o=t.data;let s=["PT1","PT2","PT3","PT4","PT5","PT均值"],d=[],c=[];console.log(o,o.length);for(var l=0;l<10&&l<o.length;l++)d.push(o[l].SN),c.push({name:o[l].SN,type:"line",data:[o[l].PT1,o[l].PT2,o[l].PT3,o[l].PT5,o[l].PT6,o[l].PTValue]});console.log("dataLegend",d),console.log("dataAxis",s),console.log("data",c);let a={title:{text:"PT值变化趋势",subtext:"",textStyle:{color:"#A8ABB2",fontSize:15}},tooltip:{trigger:"axis"},legend:{top:10,left:"center",textStyle:{color:"#4DD0D6",fontSize:12},data:d},toolbox:{show:!0,feature:{dataView:{readOnly:!1},magicType:{type:["line","bar"]},restore:{},saveAsImage:{}}},grid:{left:40,right:40,top:60,btttom:20},xAxis:{type:"category",axisLabel:{rotate:40,interval:0,textStyle:{color:"#A8ABB2",fontSize:12}},axisTick:{show:!0,alignWithLabel:!0},axisLine:{show:!0,symbol:["none","arrow"],symbolOffset:12,lineStyle:{color:"#A8ABB2"}},data:s},yAxis:[{type:"value",name:"PT值",position:"left",min:function(u){return u.min},max:function(u){return u.max},interval:function(u){return parseInt(u.max/10+1)*10/5},axisLine:{show:!0,symbol:["none","arrow"],symbolOffset:12,lineStyle:{color:"#A8ABB2"}},axisTick:{show:!1},axisLabel:{textStyle:{color:"#A8ABB2",fontSize:12}}}],series:c};var g=b(k.value);g.setOption(a,!0)})};return(e,n)=>{const t=ee,o=Y,s=Z,d=j,c=G,l=K;return D(),F(E,null,[p("div",ie,[p("div",null,[T(" 产品: "),y(o,{modelValue:_(f),"onUpdate:modelValue":n[0]||(n[0]=a=>A(f)?f.value=a:null),multiple:"","collapse-tags":"","collapse-tags-tooltip":"",placeholder:"可多选",style:{width:"240px"}},{default:N(()=>[(D(!0),F(E,null,ne(_(C),a=>(D(),se(t,{key:a.Id,label:a.Name,value:a.Id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),p("div",null,[T(" 批次: "),y(s,{modelValue:_(m),"onUpdate:modelValue":n[1]||(n[1]=a=>A(m)?m.value=a:null),clearable:"",wid:"",placeholder:"批次号",style:{width:"150px"}},null,8,["modelValue"])]),p("div",null,[T(" 日期: "),y(d,{modelValue:_(i),"onUpdate:modelValue":n[2]||(n[2]=a=>A(i)?i.value=a:null),type:"daterange",align:"right","unlink-panels":"","range-separator":"至","start-placeholder":"开始日期","end-placeholder":"结束日期","picker-options":q},null,8,["modelValue"])]),p("div",null,[y(c,{type:"primary",onClick:M},{default:N(()=>[T("查询")]),_:1})])]),p("div",null,[p("div",{style:{width:"100%",height:"40vh"},ref_key:"chartPie",ref:S},null,512),y(l,{"content-position":"left"}),p("div",{style:{width:"100%",height:"40vh"},ref_key:"chartBar",ref:P},null,512),y(l,{"content-position":"left"}),p("div",{style:{width:"100%",height:"40vh"},ref_key:"chartBar_PT",ref:k},null,512)])],64)}}});const we=re(de,[["__scopeId","data-v-dc676def"]]);export{we as default};