You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
haoliang-net/deploy-web/admin/assets/WorkerProduction-DcQlR--g.js

1 line
6.4 KiB
JavaScript

import{D as e,E as t,F as n,M as r,P as i,S as a,T as o,_ as s,b as c,f as l,h as u,i as d,k as f,m as p,w as m,x as h,y as g,z as _}from"./index-yNQwsZKK.js";import{t as v}from"./request-CbM-LIzp.js";import{t as y}from"./echarts-W_05fbm-.js";var b={class:`worker-production`},x={class:`stat-card`},S={class:`stat-label`},C={class:`stat-value`},w={class:`stat-card`},T={class:`stat-label`},E={class:`stat-value`},D={class:`stat-card`},O={class:`stat-label`},k={class:`stat-value`},A={class:`stat-card`},j={class:`stat-label`},M={class:`stat-value name-value`},N=d(h({__name:`WorkerProduction`,setup(d){let h=i({dateRange:[``,``],workerId:``}),N=n([]),P=n({totalQuantity:0,activeWorkerCount:0,avgPerWorker:0,topWorkerName:``}),F=n([]),I=n(),L=n(),R=null,z=null;function B(){!I.value||F.value.length===0||(R?.dispose(),R=y.init(I.value),R.setOption({tooltip:{trigger:`axis`,formatter:e=>{let t=e[0];return`${t.name}<br/>产量: ${t.value}`}},grid:{left:60,right:20,top:20,bottom:40},xAxis:{type:`category`,data:F.value.map(e=>e.workerName),axisLabel:{fontSize:12,rotate:F.value.length>8?30:0}},yAxis:{type:`value`,name:`产量(件)`,axisLabel:{fontSize:12}},series:[{type:`bar`,data:F.value.map(e=>e.totalQuantity),itemStyle:{color:`#67C23A`,borderRadius:[4,4,0,0]},barWidth:`50%`,label:{show:!0,position:`top`,fontSize:12}}]}))}function V(){!L.value||F.value.length===0||(z?.dispose(),z=y.init(L.value),z.setOption({tooltip:{trigger:`item`,formatter:`{b}: {c}件 ({d}%)`},legend:{bottom:0,itemWidth:12,itemHeight:12,textStyle:{fontSize:12}},series:[{type:`pie`,radius:[`40%`,`65%`],center:[`50%`,`45%`],label:{show:!0,formatter:`{b}: {c}件 ({d}%)`,fontSize:12},data:F.value.map(e=>({value:e.totalQuantity,name:e.workerName}))}]}))}async function H(){await a(),B(),V()}function U(){R?.dispose(),z?.dispose(),R=null,z=null}function W(e){return e==null?`-`:Number(e).toFixed(2)}function G(){let e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`}async function K(){try{N.value=(await v.get(`/admin/worker/list`)).data?.items??[]}catch{}}async function q(){let e={startDate:h.dateRange[0]||G(),endDate:h.dateRange[1]||G()};h.workerId&&(e.workerId=h.workerId);try{let[t,n]=await Promise.all([v.get(`/admin/production/worker/summary`,{params:e}),v.get(`/admin/production/worker/list`,{params:e})]);P.value=t.data??{totalQuantity:0,activeWorkerCount:0,avgPerWorker:0,topWorkerName:``},F.value=n.data?.items??[],U(),await H()}catch{}}function J(){q()}function Y(){let e=G();h.dateRange=[e,e],h.workerId=``,q()}return m(async()=>{let e=G();h.dateRange=[e,e],await K(),await q()}),o(()=>{U()}),(n,i)=>{let a=f(`el-date-picker`),o=f(`el-form-item`),d=f(`el-option`),m=f(`el-select`),v=f(`el-button`),y=f(`el-form`),R=f(`el-tooltip`),z=f(`el-card`),B=f(`el-col`),V=f(`el-row`),H=f(`el-table-column`),U=f(`el-table`);return t(),s(`div`,b,[c(y,{inline:!0,model:h,class:`filter-bar`},{default:r(()=>[c(o,{label:`日期范围`},{default:r(()=>[c(a,{modelValue:h.dateRange,"onUpdate:modelValue":i[0]||=e=>h.dateRange=e,type:`daterange`,"value-format":`YYYY-MM-DD`,"range-separator":``,"start-placeholder":`开始日期`,"end-placeholder":`结束日期`},null,8,[`modelValue`])]),_:1}),c(o,{label:`员工`},{default:r(()=>[c(m,{modelValue:h.workerId,"onUpdate:modelValue":i[1]||=e=>h.workerId=e,placeholder:`请选择员工`,clearable:``,filterable:``,style:{"min-width":`220px`}},{default:r(()=>[(t(!0),s(l,null,e(N.value,e=>(t(),u(d,{key:e.id,label:e.name,value:e.id},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`])]),_:1}),c(o,null,{default:r(()=>[c(v,{type:`primary`,onClick:J},{default:r(()=>[...i[2]||=[g(`查询`,-1)]]),_:1}),c(v,{onClick:Y},{default:r(()=>[...i[3]||=[g(`重置`,-1)]]),_:1})]),_:1})]),_:1},8,[`model`]),c(V,{gutter:16,class:`stat-row`},{default:r(()=>[c(B,{span:6},{default:r(()=>[c(z,{shadow:`hover`},{default:r(()=>[p(`div`,x,[p(`div`,S,[i[5]||=g(` 总产量 `,-1),c(R,{content:`选定时间范围内所有员工的总产量。`,placement:`top`},{default:r(()=>[...i[4]||=[p(`span`,{class:`info-icon`},``,-1)]]),_:1})]),p(`div`,C,_(P.value.totalQuantity?.toLocaleString()??`-`),1)])]),_:1})]),_:1}),c(B,{span:6},{default:r(()=>[c(z,{shadow:`hover`},{default:r(()=>[p(`div`,w,[p(`div`,T,[i[7]||=g(` 在岗工人数 `,-1),c(R,{content:`选定时间范围内有产量记录的工人数量。`,placement:`top`},{default:r(()=>[...i[6]||=[p(`span`,{class:`info-icon`},``,-1)]]),_:1})]),p(`div`,E,_(P.value.activeWorkerCount??`-`),1)])]),_:1})]),_:1}),c(B,{span:6},{default:r(()=>[c(z,{shadow:`hover`},{default:r(()=>[p(`div`,D,[p(`div`,O,[i[9]||=g(` 人均产量 `,-1),c(R,{content:`平均每位工人的产量。`,placement:`top`},{default:r(()=>[...i[8]||=[p(`span`,{class:`info-icon`},``,-1)]]),_:1})]),p(`div`,k,_(W(P.value.avgPerWorker)),1)])]),_:1})]),_:1}),c(B,{span:6},{default:r(()=>[c(z,{shadow:`hover`},{default:r(()=>[p(`div`,A,[p(`div`,j,[i[11]||=g(` 最高产量员工 `,-1),c(R,{content:`产量最高的员工姓名。`,placement:`top`},{default:r(()=>[...i[10]||=[p(`span`,{class:`info-icon`},``,-1)]]),_:1})]),p(`div`,M,_(P.value.topWorkerName||`-`),1)])]),_:1})]),_:1})]),_:1}),c(V,{gutter:16,class:`chart-row`},{default:r(()=>[c(B,{span:12},{default:r(()=>[c(z,{shadow:`hover`},{header:r(()=>[...i[12]||=[p(`span`,{class:`card-title`},`员工产量柱状图`,-1)]]),default:r(()=>[p(`div`,{ref_key:`barChartRef`,ref:I,style:{height:`300px`}},null,512)]),_:1})]),_:1}),c(B,{span:12},{default:r(()=>[c(z,{shadow:`hover`},{header:r(()=>[...i[13]||=[p(`span`,{class:`card-title`},`员工产量占比`,-1)]]),default:r(()=>[p(`div`,{ref_key:`pieChartRef`,ref:L,style:{height:`300px`}},null,512)]),_:1})]),_:1})]),_:1}),c(V,{gutter:16,class:`table-row`},{default:r(()=>[c(B,{span:24},{default:r(()=>[c(z,{shadow:`hover`},{header:r(()=>[...i[14]||=[p(`span`,{class:`card-title`},`员工产量明细`,-1)]]),default:r(()=>[c(U,{data:F.value,stripe:``,size:`small`,style:{width:`100%`}},{default:r(()=>[c(H,{prop:`rank`,label:`排名`,width:`60`,align:`center`}),c(H,{prop:`workerName`,label:`员工姓名`}),c(H,{prop:`machineCount`,label:`绑定机床数`,width:`100`,align:`center`}),c(H,{prop:`programCount`,label:`涉及程序数`,width:`100`,align:`center`}),c(H,{prop:`totalQuantity`,label:`总产量`,width:`100`,align:`center`}),c(H,{label:`占比`,width:`100`,align:`center`},{default:r(({row:e})=>[g(_(e.percentage?.toFixed(1))+`% `,1)]),_:1})]),_:1},8,[`data`])]),_:1})]),_:1})]),_:1})])}}}),[[`__scopeId`,`data-v-a68d2356`]]);export{N as default};