Files
bj_power/bj_power_mes/public/assets_bak_1791615921/DailyPlan-bwGceuKU.js
T

2 lines
25 KiB
JavaScript
Raw Normal View History

import{_ as Ze,m as ee,o as et,j as V,c as m,b as a,w as o,l as E,F as _,k as D,r as b,e as u,q as k,h as p,v as c,t as N,p as M,f as x,A as O,z as Ve,E as Q}from"./index-CZ641VGk.js";import{c as h}from"./perm-DCTK2KrM.js";import{a as tt,P as lt}from"./help-D7sbn63X.js";const at={key:0,class:"dock-empty"},ot={class:"dock-empty"},nt={key:1,style:{color:"#999"}},st={key:0,class:"dock-empty"},rt={key:0,class:"dock-empty"},dt={key:0,class:"dock-empty",style:{"margin-top":"6px"}},ut=["onClick"],it={key:1,class:"dock-empty"},pt={key:0,class:"dock-empty",style:{"margin-top":"6px"}},ct={key:1,class:"pager"},ft={key:0,style:{width:"100%"}},mt={style:{width:"150px"}},yt={style:{"font-size":"12px",color:"#909399"}},vt={__name:"DailyPlan",setup(gt){function I(){const t=new Date,e=s=>String(s).padStart(2,"0");return`${t.getFullYear()}-${e(t.getMonth()+1)}-${e(t.getDate())}`}function A(t){const e=new Date;e.setDate(e.getDate()+t);const s=d=>String(d).padStart(2,"0");return`${e.getFullYear()}-${s(e.getMonth()+1)}-${s(e.getDate())}`}const i=ee({orderNos:[],dateRange:[I(),A(30)],status:"active",product:"",operator:"",docks:[],qtyMin:null,qtyMax:null,showHistory:!1,sort:"asc"});function Oe(){Object.assign(i,{orderNos:[],dateRange:[I(),A(30)],status:"active",product:"",operator:"",docks:[],qtyMin:null,qtyMax:null,showHistory:!1,sort:"asc"}),C()}const ve=D("flat"),U=D([]),te=D(0),q=D(1),le=D(50),Y=D([]),n=ee({show:!1,id:0,orderNo:"",planDate:"",planRange:[],mode:"AVG",planQty:1,productType:"",productCode:"",productName:"",woQty:"",woStart:"",woDue:"",stationPlanQty:{},combination:[]}),ae=D({}),oe=D({}),j=D([]),S=ee({}),Re=O(()=>Object.values(S).reduce((t,e)=>t+(Number(e)||0),0)),ge=D([]),ne=D(0),L=D(!1),Se=D(0),g=ee({show:!1,row:null}),we=O(()=>{const t=n.planRange;if(!t||t.length!==2||!t[0]||!t[1])return[];const e=f=>String(f).padStart(2,"0"),s=new Date(t[0]+"T00:00:00"),d=new Date(t[1]+"T00:00:00");if(Number.isNaN(s.getTime())||Number.isNaN(d.getTime())||d<s)return[];const r=[];for(let f=new Date(s);f<=d;f.setDate(f.getDate()+1))r.push(`${f.getFullYear()}-${e(f.getMonth()+1)}-${e(f.getDate())}`);return r}),Me=[{v:"PENDING",l:"未启用"},{v:"CONFIRMED",l:"已启用"},{v:"PROCESSING",l:"执行中"},{v:"DONE",l:"已完成"},{v:"CANCELLED",l:"已取消"}],B=t=>(Me.find(e=>e.v===t)||{}).l||t,se=t=>t==="DONE"?"success":t==="PROCESSING"?"warning":t==="CONFIRMED"?"primary":"info",xe={CREATED:"已创建",RELEASED:"已下发",IN_PROGRESS:"执行中",PAUSED:"已暂停",DONE:"已完成",CANCELLED:"已取消"},Qe=t=>xe[t]||t;async function Ie(){const t=await V.get("/stations")||[],e={};t.forEach(r=>{e[r.stationNo]=r.name}),oe.value=e;const s=await V.get("/docks")||[],d={};s.forEach(r=>{r.dockCode&&(d[r.stationNo]||(d[r.stationNo]=[]),d[r.stationNo].includes(r.dockCode)||d[r.stationNo].push(r.dockCode))}),ae.value=d}const $e=O(()=>{const t={};return Object.values(ae.value).forEach(e=>{(e||[]).forEach(s=>{s&&(t[s]=!0)})}),Object.keys(t).sort()}),R=D([]),H=D(!1);async function W(t){H.value=!0;try{const e=await V.get("/work-orders",{params:{keyword:t||"",limit:50}});R.value=Array.isArray(e)?e:[]}catch{R.value=[]}finally{H.value=!1}}function X(t){const e=R.value.find(d=>d.workOrderNo===t);if(!e)return"";const s=Y.value.find(d=>d.id===e.productTypeId);return s?s.name+(s.code?" / "+s.code:""):""}async function be(t){if(!t)return null;let e=R.value.find(s=>s.workOrderNo===t);if(e)return e;try{const s=await V.get("/work-orders",{params:{orderNo:t}});e=(Array.isArray(s)?s:[]).find(r=>r.workOrderNo===t)||null,e&&R.value.push(e)}catch{}return e}function Pe(t){const e=Y.value.find(s=>s.id===t.productTypeId);return e?e.name+(e.code?" / "+e.code:""):""}async function G(){const t=i.dateRange&&i.dateRange[0]?i.dateRange[0]:i.showHistory?"":I(),e=i.dateRange&&i.dateRange[1]?i.dateRange[1]:A(30),s=await V.get("/daily-plans",{params:{planDateStart:t,planDateEnd:e,page:q.value,pageSize:le.value,sort:i.sort}})||{};U.value=s.list||[],te.value=s.total||0;const d=[...new Set(U.value.map(r=>r.orderNo).filter(Boolean))].filter(r=>!R.value.some(f=>f.workOrderNo===r));for(const