import{g as O,a as Q,e as X,r as Y}from"./goodsLend-BZovbjyT.js";import{g as x,a as ee}from"./setting-nWDj4rDN.js";import{d as ae,u as le,r as o,a as w,o as oe,f as te,i as l,w as t,t as ne,p as c,v as y,h as E,j as r,k as S,m as _,y as v,l as T,P as se,E as k,K as re,Z as de,$ as ue,_ as ce}from"./index-ByQGGPf6.js";const ie=f=>(de("data-v-00417817"),f=f(),ue(),f),me={class:"inner-toolbar"},pe={class:"toolbar-btns"},_e=ie(()=>E("div",{class:"toolbar-search"},null,-1)),ve=ae({__name:"warehouseLocation",setup(f){const{t:n}=le(),b=ne(),$=se();$==null||$.proxy;const G=o(""),B=o([]),g=o(!1),D=w({page_no:1,page_size:10,company_id:b.state.companId});w({});const I=o([]);o(!1);const R=o([]);o({}),o([]);const C=o(""),u=o(!1);let a=o({name:"",remark:"",code:""});const U=w({name:[{required:!0,message:n("place")+n("location_code"),trigger:"blur"}],code:[{required:!0,message:n("place")+n("location_name"),trigger:"blur"}]}),F=o([]),i=o(""),z=o(),N=()=>{z.value.validate(e=>{if(e)i.value?X(i.value,a.value).then(()=>{k.success(n("edit_success")),u.value=!1,i.value="",a.value.name="",a.value.remark="",h()}):(console.log(i.value),Q(a.value).then(()=>{k.success(n("add_success")),u.value=!1,G.value="",a.value.name="",a.value.remark="",h()}));else return k.error(n("form_erroe")),!1})},A=()=>{u.value=!1,a.value.name="",a.value.remark=""},M=e=>{i.value=e.id,C.value=n("edit"),a.value.code=e.code,a.value.name=e.name,a.value.remark=e.remark,u.value=!0},q=e=>{re.confirm(n("del_info"),n("prompt"),{type:"warning"}).then(()=>{Y(e.id).then(()=>{k.success(n("del_success")),h()})}).catch(()=>{})},P=()=>{x().then(e=>{B.value=e}),ee({dictType:"Warehouse_location_type",page_no:1,page_size:50}).then(e=>{F.value=e.data})},j=e=>{R.value=e},H=()=>{i.value="",C.value=n("add"),a.value={},u.value=!0},h=()=>{g.value=!0,O(D).then(e=>{g.value=!1,I.value=e}).catch(()=>{g.value=!1})};return oe(()=>{h(),P()}),(e,d)=>{const m=c("el-button"),p=c("el-table-column"),K=c("en-table-layout"),V=c("el-input"),L=c("el-form-item"),W=c("el-form"),Z=c("el-dialog");return y(),te("div",null,[l(K,{tableData:I.value,loading:g.value,onSelectionChange:j},{toolbar:t(()=>[E("div",me,[E("div",pe,[r(b).state.user.user.founder!==1?(y(),S(m,{key:0,size:"mini",type:"primary",onClick:H},{default:t(()=>[_(v(e.$t("add")),1)]),_:1})):T("",!0)]),_e])]),"table-columns":t(()=>[l(p,{type:"selection",width:"55"}),l(p,{prop:"code",label:e.$t("location_code")},null,8,["label"]),l(p,{prop:"name",label:e.$t("location_name")},null,8,["label"]),l(p,{prop:"remark",label:e.$t("notes")},null,8,["label"]),l(p,{label:e.$t("operate"),width:"250"},{default:t(s=>[r(b).state.user.user.founder!==1?(y(),S(m,{key:0,size:"mini",onClick:J=>M(s.row)},{default:t(()=>[_(v(e.$t("edit")),1)]),_:2},1032,["onClick"])):T("",!0),r(b).state.user.user.founder!==1?(y(),S(m,{key:1,type:"danger",size:"mini",onClick:J=>q(s.row)},{default:t(()=>[_(v(e.$t("delete")),1)]),_:2},1032,["onClick"])):T("",!0)]),_:1},8,["label"])]),_:1},8,["tableData","loading"]),l(Z,{title:C.value,modelValue:u.value,"onUpdate:modelValue":d[3]||(d[3]=s=>u.value=s),width:"30%",center:"",onClose:A},{footer:t(()=>[l(m,{onClick:A},{default:t(()=>[_(v(e.$t("cancel")),1)]),_:1}),l(m,{type:"primary",onClick:N},{default:t(()=>[_(v(e.$t("submit")),1)]),_:1})]),default:t(()=>[l(W,{ref_key:"addLendFormRef",ref:z,model:r(a),rules:U,"label-width":"90px"},{default:t(()=>[l(L,{label:e.$t("location_code"),prop:"code"},{default:t(()=>[l(V,{placeholder:e.$t("place")+e.$t("location_code"),modelValue:r(a).code,"onUpdate:modelValue":d[0]||(d[0]=s=>r(a).code=s)},null,8,["placeholder","modelValue"])]),_:1},8,["label"]),l(L,{label:e.$t("location_name"),prop:"name"},{default:t(()=>[l(V,{placeholder:e.$t("place")+e.$t("location_name"),modelValue:r(a).name,"onUpdate:modelValue":d[1]||(d[1]=s=>r(a).name=s)},null,8,["placeholder","modelValue"])]),_:1},8,["label"]),l(L,{label:e.$t("notes")},{default:t(()=>[l(V,{type:"textarea",autosize:{minRows:2,maxRows:4},placeholder:e.$t("place")+e.$t("notes"),modelValue:r(a).remark,"onUpdate:modelValue":d[2]||(d[2]=s=>r(a).remark=s)},null,8,["placeholder","modelValue"])]),_:1},8,["label"])]),_:1},8,["model","rules"])]),_:1},8,["title","modelValue"])])}}}),he=ce(ve,[["__scopeId","data-v-00417817"]]);export{he as default};
