版博士V2.0程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

2 lines
4.9 KiB

  1. import{k as U}from"./el-button-1a829d03.js";import{e as $,E as M,a as q,b as H}from"./exportExcel-a5e8f38f.js";import{u as J,q as j,i as K,E as x,b as W,c as A,d as G,e as X}from"./el-message-96599589.js";import"./el-tooltip-4ed993c7.js";import"./useDarks-2fae6676.js";import{d as Y,h as p,l as Z,s as ee,o as y,e as V,K as c,L as m,O as n,w as _,u as s,U as T,F as N,P as te,M as ae,c as le,_ as oe}from"./index-080862c1.js";const ne={class:"filterDiv"},ie={class:"paging"},se=Y({__name:"reportQualifiedRate",setup(re){const{formatTableDateTime:de,formatTableDate:ue,formatDateTime:Q,formatDate:v,formatNum:pe,show_loading:S,close_loading:h}=J(),i=p([]),u=p([]);p("");const b=p([]),k=p([]),g=p(""),r=Z({currentPage:1,pageSize:10,totalCount:0}),E={shortcuts:[{text:"最近一周",onClick(e){const t=new Date,a=new Date;a.setTime(a.getTime()-3600*1e3*24*7),e.$emit("pick",[a,t])}},{text:"最近一个月",onClick(e){const t=new Date,a=new Date;a.setTime(a.getTime()-3600*1e3*24*30),e.$emit("pick",[a,t])}},{text:"最近三个月",onClick(e){const t=new Date,a=new Date;a.setTime(a.getTime()-3600*1e3*24*90),e.$emit("pick",[a,t])}}]};ee(async()=>{console.log("onMounted - DOM挂载完毕"),i.value[0]=i.value[1]=new Date,await I(),f()});const F=e=>{console.log(`每页 ${e} 条`),f()},z=e=>{console.log(`当前页: ${e}`),f()},I=async()=>{await j({model:"product",fields:"*",order:"Name"}).then(e=>{console.log("getProductList",e),e.code===200&&k.value.push(...e.data)})},f=(e=!1)=>{S();const t={domain:[],order:"",pageNum:e?0:r.currentPage,pageSize:e?0:r.pageSize};if(i.value&&i.value.length>0&&(console.log(i.value),t.domain.push({FieldName:"a.CreateTime",FieldValue:v(i.value[0]),ConditionalType:3}),t.domain.push({FieldName:"a.CreateTime",FieldValue:v(i.value[1])+" 23:59:59",ConditionalType:5})),u.value.length>0){var a="";for(let o in u.value)a+=u.value[o]+",";t.domain.push({FieldName:"a.ProductId",FieldValue:a,ConditionalType:6})}g.value&&t.domain.push({FieldName:"a.BatchId",FieldValue:g.value,ConditionalType:0}),console.log(t),K(t).then(o=>{if(console.log("getOrderList",o),o.code!==200){h(),x({message:o.data,type:"error",showClose:!0,duration:1e3});return}const C=JSON.parse(o.data);console.log("isExport=",e),e?B(C):(b.value=C,r.totalCount=o.totalCount,h())})},P=()=>{r.currentPage=1,f()},B=e=>{if(e.length<1){h();return}e.forEach(o=>{o.CreateTime=Q(o.CreateTime),o.QualifiedRatio=w(o)+"%"}),$({header:{Name:"产品名称",Code:"料号",BatchId:"批次号",Qualified:"合格数量",Total:"总数量",QualifiedRatio:"合格率"},keys:["Name","Code","BatchId","Qualified","Total","QualifiedRatio"],data:e,title:"",filename:i.value[0]?v(i.value[0]):"生产报表",autoWidth:!0}),x({message:"生成中,请稍等...",type:"success",showClose:!0,duration:2e3}),h()},w=e=>parseInt(e.Qualified/e.Total*100);return(e,t)=>{const a=X,o=W,C=A,R=G,D=U,d=H,L=M,O=q;return y(),V(N,null,[c("div",ne,[c("div",null,[m(" 产品: "),n(o,{modelValue:s(u),"onUpdate:modelValue":t[0]||(t[0]=l=>T(u)?u.value=l:null),multiple:"","collapse-tags":"","collapse-tags-tooltip":"",placeholder:"可多选",style:{width:"240px"}},{default:_(()=>[(y(!0),V(N,null,te(s(k),l=>(y(),le(a,{key:l.Id,label:l.Name,value:l.Id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),c("div",null,[m(" 批次: "),n(C,{modelValue:s(g),"onUpdate:modelValue":t[1]||(t[1]=l=>T(g)?g.value=l:null),clearable:"",wid:"",placeholder:"批次号",style:{width:"150px"}},null,8,["modelValue"])]),c("div",null,[m(" 日期: "),n(R,{modelValue:s(i),"onUpdate:modelValue":t[2]||(t[2]=l=>T(i)?i.value=l:null),type:"daterange",align:"right","unlink-panels":"","range-separator":"至","start-placeholder":"开始日期","end-placeholder":"结束日期","picker-options":E},null,8,["modelValue"])]),c("div",null,[n(D,{type:"primary",onClick:P},{default:_(()=>[m("查询")]),_:1}),n(D,{type:"success",onClick:t[3]||(t[3]=l=>f(!0))},{default:_(()=>[m("导出")]),_:1})])]),n(L,{data:s(b),onSelectionChange:e.handleSelectionChange,stripe:"",style:{width:"100%"}},{default:_(()=>[n(d,{fixed:"",type:"index",width:"50"}),n(d,{fixed:"",prop:"Name",label:"产品名称"}),n(d,{fixed:"",prop:"Code",label:"料号"}),n(d,{fixed:"",prop:"BatchId",label:"批次号"}),n(d,{align:"right",prop:"Total",label:"检测数量",width:"100"}),n(d,{align:"right",prop:"Qualified",label:"合格数量",width:"80"}),n(d,{align:"right",prop:"Qualified",label:"合格率",width:"80"},{default:_(l=>[m(ae(w(l.row))+"%",1)]),_:1})]),_:1},8,["data","onSelectionChange"]),c("div",ie,[n(O,{"current-page":s(r).currentPage,"onUpdate:currentPage":t[4]||(t[4]=l=>s(r).currentPage=l),"page-size":s(r).pageSize,"onUpdate:pageSize":t[5]||(t[5]=l=>s(r).pageSize=l),"page-sizes":[10,15,20,30,50,100],small:!0,background:!0,layout:"total, sizes, prev, pager, next, jumper",total:s(r).totalCount,onSizeChange:F,onCurrentChange:z},null,8,["current-page","page-size","total"])])],64)}}});const Ce=oe(se,[["__scopeId","data-v-46aa944f"]]);export{Ce as default};