import{t as L,E as d}from"./index.Df8UJ10K.js";import{a as N,r as m,_ as S,w,aj as s,J as v,o as c,K as t,b as I,S as n,c as W,R as q,a9 as U,P as b}from"./vue.D1BjjNmv.js";import{_ as j}from"./_plugin-vue_export-helper.DlAUqK2U.js";const F={class:"warehouse-select-dialog"},J={class:"dialog-footer"},K=N({__name:"WarehouseSelectDialog",props:{modelValue:{type:Boolean},formId:{}},emits:["update:modelValue","confirm"],setup(g,{emit:V}){const u=g,f=V,r=m(!1),p=m([]),_=m(!1),o=S({warehouseId:null}),y=async()=>{try{_.value=!0;const e=await L({url:"/api/system/warehouse/",method:"get",params:{page:1,limit:20}});e.code===2e3?p.value=e.data||[]:d.error("获取仓库列表失败")}catch(e){console.error("获取仓库列表失败:",e),d.error("获取仓库列表失败")}finally{_.value=!1}};w(()=>u.modelValue,e=>{r.value=e,e&&(y(),o.warehouseId=null)}),w(r,e=>{f("update:modelValue",e)});const i=()=>{r.value=!1,o.warehouseId=null},x=()=>{if(!o.warehouseId){d.warning("请选择仓库");return}if(!u.formId){d.error("表单ID不存在");return}f("confirm",{formId:u.formId,warehouseId:o.warehouseId}),i()};return(e,l)=>{const C=s("el-option"),k=s("el-select"),B=s("el-form-item"),D=s("el-form"),h=s("el-button"),E=s("el-dialog");return c(),v(E,{modelValue:r.value,"onUpdate:modelValue":l[1]||(l[1]=a=>r.value=a),title:"选择领取仓库",width:"500px","before-close":i},{footer:t(()=>[I("div",J,[n(h,{onClick:i},{default:t(()=>l[2]||(l[2]=[b("取消")])),_:1}),n(h,{type:"primary",onClick:x,disabled:!o.warehouseId},{default:t(()=>l[3]||(l[3]=[b(" 确定 ")])),_:1},8,["disabled"])])]),default:t(()=>[I("div",F,[n(D,{model:o,"label-width":"80px"},{default:t(()=>[n(B,{label:"仓库选择",required:""},{default:t(()=>[n(k,{modelValue:o.warehouseId,"onUpdate:modelValue":l[0]||(l[0]=a=>o.warehouseId=a),placeholder:"请选择仓库",style:{width:"100%"},filterable:"",clearable:""},{default:t(()=>[(c(!0),W(q,null,U(p.value,a=>(c(),v(C,{key:a.id,label:a.name,value:a.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1},8,["model"])])]),_:1},8,["modelValue"])}}}),T=j(K,[["__scopeId","data-v-980bc7e2"]]);export{T as default};
