import{g as O,a as X,e as Y,r as Z}from"./goodsLend-CcqvxrmJ.js";import{g as x,a as ee}from"./setting-BD2OoeWh.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 k,h as E,j as d,k as S,m as _,y as v,l as T,Q as se,E as y,L as de,a0 as re,a1 as ue,_ as ce}from"./index-htML_UHV.js";const ie=f=>(re("data-v-22e9c0d9"),f=f(),ue(),f),me={class:"dark:!bg-[#060818] bg-white p-3"},pe={class:"inner-toolbar"},_e={class:"toolbar-btns"},ve=ie(()=>E("div",{class:"toolbar-search"},null,-1)),fe=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?Y(i.value,a.value).then(()=>{y.success(n("edit_success")),u.value=!1,i.value="",a.value.name="",a.value.remark="",h()}):(console.log(i.value),X(a.value).then(()=>{y.success(n("add_success")),u.value=!1,G.value="",a.value.name="",a.value.remark="",h()}));else return y.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=>{de.confirm(n("del_info"),n("prompt"),{type:"warning"}).then(()=>{Z(e.id).then(()=>{y.success(n("del_success")),h()})}).catch(()=>{})},j=()=>{x().then(e=>{B.value=e}),ee({dictType:"Warehouse_location_type",page_no:1,page_size:50}).then(e=>{F.value=e.data})},H=e=>{R.value=e},P=()=>{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(),j()}),(e,r)=>{const m=c("el-button"),p=c("el-table-column"),Q=c("en-table-layout"),V=c("el-input"),L=c("el-form-item"),W=c("el-form"),J=c("el-dialog");return k(),te("div",me,[l(Q,{tableData:I.value,loading:g.value,onSelectionChange:H},{toolbar:t(()=>[E("div",pe,[E("div",_e,[d(b).state.user.user.founder!==1?(k(),S(m,{key:0,size:"small",type:"primary",onClick:P},{default:t(()=>[_(v(e.$t("add")),1)]),_:1})):T("",!0)]),ve])]),"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"),fixed:"right",width:"300"},{default:t(s=>[d(b).state.user.user.founder!==1?(k(),S(m,{key:0,size:"small",onClick:K=>M(s.row)},{default:t(()=>[_(v(e.$t("edit")),1)]),_:2},1032,["onClick"])):T("",!0),d(b).state.user.user.founder!==1?(k(),S(m,{key:1,type:"danger",size:"small",onClick:K=>q(s.row)},{default:t(()=>[_(v(e.$t("delete")),1)]),_:2},1032,["onClick"])):T("",!0)]),_:1},8,["label"])]),_:1},8,["tableData","loading"]),l(J,{title:C.value,modelValue:u.value,"onUpdate:modelValue":r[3]||(r[3]=s=>u.value=s),width:"30%",center:"",onClose:A,class:"!rounded-lg"},{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:d(a),rules:U,"label-width":"120px"},{default:t(()=>[l(L,{label:e.$t("location_code"),prop:"code"},{default:t(()=>[l(V,{placeholder:e.$t("place")+e.$t("location_code"),modelValue:d(a).code,"onUpdate:modelValue":r[0]||(r[0]=s=>d(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:d(a).name,"onUpdate:modelValue":r[1]||(r[1]=s=>d(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:d(a).remark,"onUpdate:modelValue":r[2]||(r[2]=s=>d(a).remark=s)},null,8,["placeholder","modelValue"])]),_:1},8,["label"])]),_:1},8,["model","rules"])]),_:1},8,["title","modelValue"])])}}}),ke=ce(fe,[["__scopeId","data-v-22e9c0d9"]]);export{ke as default};
