Files
bj_power/bj_power_wms_client/web/static/assets/Package-CiuyXcgR.js
T

2 lines
5.3 KiB
JavaScript
Raw Normal View History

import{_ as W,I as X,i as Y,c as U,d as _,a as t,w as o,p as S,F as q,h as d,g as E,r as n,J as Z,o as y,H as k,k as j,D as F,e as I,f as u,t as f,K as ee,E as C}from"./index-9NS-icag.js";import{r as V}from"./request-DS_8eNi1.js";import{b as te}from"./format-C9Ok6skr.js";import{f as le,P as ae}from"./help-BMgMow4j.js";const oe={style:{"margin-bottom":"8px"}},ne={class:"pager"},re={__name:"Package",setup(ie){const z=d([]),K=X();Y(async()=>{try{const a=await V.get("/material/list");z.value=Array.isArray(a)?a:(a==null?void 0:a.list)||[]}catch{}await v()});const r=E({boxNo:"",materialCode:""}),m=d(""),i=d([]),w=d(!1);function M(){for(let a of String(m.value).split(/\s+/)){const e=a.trim();e&&!i.value.includes(e)&&i.value.push(e)}m.value=""}function H(a){i.value.splice(a,1)}async function J(){if(!r.boxNo.trim()){C.warning("请输入箱号");return}if(!i.value.length){C.warning("请扫码录入 SN(回车追加)");return}w.value=!0;try{await V.post("/package/bind",{boxNo:r.boxNo.trim(),materialCode:r.materialCode||void 0,snList:[...i.value],operator:K}),C.success(`绑定成功:箱号 ${r.boxNo.trim()}${i.value.length} 个 SN`),i.value=[],m.value="",r.boxNo="",p.current=1,await v()}finally{w.value=!1}}const x=d(""),A=d([]),B=d(0),b=d(!1),p=E({current:1,size:10});function T(a){try{const e=JSON.parse(a||"[]");return Array.isArray(e)?e.join(", "):String(a)}catch{return String(a||"-")}}async function v(){b.value=!0;try{const a=await V.get("/package/query",{params:{boxNo:x.value.trim(),page:p.current,pageSize:p.size}});A.value=(a==null?void 0:a.list)||[],B.value=(a==null?void 0:a.total)||0}finally{b.value=!1}}function N(){p.current=1,v()}return(a,e)=>{const g=n("el-input"),c=n("el-form-item"),O=n("el-option"),R=n("el-select"),L=n("el-form"),s=n("el-table-column"),h=n("el-button"),P=n("el-table"),$=n("el-card"),G=n("el-pagination"),Q=Z("loading");return y(),U(q,null,[_("div",null,[t($,{shadow:"never",class:"mb12",header:"箱号绑定(连续扫码 SN"},{default:o(()=>[t(L,{inline:"","label-width":"90px",onSubmit:e[2]||(e[2]=k(()=>{},["prevent"]))},{default:o(()=>[t(c,{label:"箱号"},{default:o(()=>[t(g,{modelValue:r.boxNo,"onUpdate:modelValue":e[0]||(e[0]=l=>r.boxNo=l),placeholder:"扫描或输入箱号",clearable:"",style:{width:"200px"}},null,8,["modelValue"])]),_:1}),t(c,{label:"物料"},{default:o(()=>[t(R,{modelValue:r.materialCode,"onUpdate:modelValue":e[1]||(e[1]=l=>r.materialCode=l),filterable:"",clearable:"",placeholder:"请选择物料",style:{width:"240px"}},{default:o(()=>[(y(!0),U(q,null,j(z.value,l=>(y(),F(O,{key:l.id,value:l.code,label:`${l.code} ${l.name||""}`},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])]),_:1}),t(c,{label:"操作人"},{default:o(()=>[t(g,{"model-value":S(K),disabled:"",style:{width:"140px"}},null,8,["model-value"])]),_:1})]),_:1}),t(g,{modelValue:m.value,"onUpdate:modelValue":e[3]||(e[3]=l=>m.value=l),type:"textarea",rows:3,autofocus:"",placeholder:"连续扫描 SN,每次回车追加(可一次多条,空白分隔)",style:{"max-width":"560px","margin-bottom":"8px"},onKeydown:I(k(M,["prevent"]),["enter"])},null,8,["modelValue","onKeydown"]),_("div",oe,[e[6]||(e[6]=u("待绑定 SN",-1)),_("b",null,f(i.value.length),1),e[7]||(e[7]=u(" 条",-1))]),t(P,{data:i.value.map((l,D)=>({i:D,v:l})),size:"small",border:"","max-height":"240","empty-text":"暂无 SN",style:{"max-width":"760px"}},{default:o(()=>[t(s,{type:"index",label:"#",width:"56",align:"center"}),t(s,{prop:"v",label:"SN 序列号","min-width":"200"}),t(s,{label:"操作",width:"80",align:"center"},{default:o(({row:l})=>[t(h,{link:"",type:"danger",size:"small",onClick:D=>H(l.i)},{default:o(()=>[...e[8]||(e[8]=[u("移除",-1)])]),_:1},8,["onClick"])]),_:1})]),_:1},8,["data"]),t(h,{type:"primary",class:"mt12",loading:w.value,onClick:J},{default:o(()=>[...e[9]||(e[9]=[u("确认绑定",-1)])]),_:1},8,["loading"])]),_:1}),t($,{shadow:"never",header:"包装查询"},{default:o(()=>[t(L,{inline:"",onSubmit:k(N,["prevent"])},{default:o(()=>[t(c,{label:"箱号"},{default:o(()=>[t(g,{modelValue:x.value,"onUpdate:modelV