import{d as R,r as _,c as s,e as j,f as q,g as y,h as t,i as u,C as h,F as z,m as v,N as H,E as p,R as J,S as K,_ as L}from"./index.0308b213.js";import{b as O,u as w,c as P}from"./system.638e3ebc.js";import"./pawnRequest.956aeb8a.js";const Q=m=>(J("data-v-876dbbea"),m=m(),K(),m),W={class:"pawn-setting-form"},X=Q(()=>y("span",null,"\u57FA\u7840\u8BBE\u7F6E",-1)),Y=v("\u65B0\u589E\u7C7B\u522B"),Z=v("\u6DFB\u52A0\u5B50\u5206\u7C7B"),ee=v("\u4FEE\u6539\u5206\u7C7B"),le={class:"dialog-footer"},te=v("\u53D6\u6D88"),ue=v(" \u4FDD\u5B58 "),ae=R({setup(m){const a=_({name:"",parent_id:0,parent_level:0,level:0}),g=()=>{a.value={name:"",parent_id:0,parent_level:0}},d=_(null),r=_(!1),f=_(!1),c=_(-1),k=()=>{g(),r.value=!0,d.value=null,c.value=-1,f.value=!1},V=e=>{g(),r.value=!0,c.value=-1,f.value=!0,d.value=e,E(d.value)},N=e=>{r.value=!0,a.value=e,d.value=e.parent_id||null,E(d.value),c.value=e.id,f.value=!1},D=()=>{r.value=!1},C=_(),b=()=>{O().then(e=>{C.value=e})};b();const S=e=>{H.alert("\u786E\u8BA4\u5220\u9664\u8BE5\u5206\u7C7B","\u63D0\u793A",{confirmButtonText:"\u786E\u8BA4",showCancelButton:!0,cancelButtonText:"\u53D6\u6D88"}).then(()=>{w({id:e.id,name:e.name,isDelete:1}).then(l=>{p.success("\u5220\u9664\u6210\u529F"),b()})})},E=e=>{if(e<=0)return null;const l=F(C.value,e);a.value.parent_id=l.id,a.value.parent_level=l.level,a.value.level=Number(l.level)+1},F=(e,l)=>{var n;for(const i of e){if(i.id===l)return i;if((n=i.children)!=null&&n.length){const B=F(i.children,l);if(B)return B}}return null},I=()=>{if(!a.value.name){p.error("\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A");return}if(a.value.parent_id&&a.value.parent_level>=3){p.error("\u6700\u591A\u652F\u6301\u4E09\u7EA7\u5206\u7C7B");return}if(a.value.level>3){p.error("\u5206\u7C7B\u5C42\u7EA7\u4E0D\u80FD\u8D85\u8FC7\u4E09\u7EA7");return}c.value>0?w(a.value).then(e=>{p({message:"\u4FEE\u6539\u6210\u529F",type:"success"}),b(),D()}):P(a.value).then(e=>{p({message:"\u4FDD\u5B58\u6210\u529F",type:"success"}),b(),D()})};return(e,l)=>{const n=s("el-button"),i=s("el-table-column"),B=s("Delete"),G=s("el-table"),$=s("el-card"),M=s("el-input"),x=s("el-form-item"),T=s("el-tree-select"),U=s("el-dialog");return j(),q(z,null,[y("div",W,[t($,{shadow:"always","body-style":{padding:"20px"}},{header:u(()=>[X]),default:u(()=>[y("div",null,[t(n,{type:"primary",style:{"margin-bottom":"20px"},onClick:h(k,["stop"])},{default:u(()=>[Y]),_:1},8,["onClick"]),t(G,{data:C.value,style:{width:"100%","margin-bottom":"20px"},"row-key":"id",border:"","default-expand-all":""},{default:u(()=>[t(i,{prop:"name",label:"\u5206\u7C7B\u540D\u79F0"}),t(i,{prop:"address",label:"\u64CD\u4F5C"},{default:u(o=>[t(n,{onClick:h(A=>V(o.row.id),["stop"])},{default:u(()=>[Z]),_:2},1032,["onClick"]),t(n,{onClick:h(A=>N(o.row),["stop"])},{default:u(()=>[ee]),_:2},1032,["onClick"]),t(n,{onClick:h(A=>S(o.row),["stop"])},{default:u(()=>[t(B,{style:{width:"20px",height:"20px"}})]),_:2},1032,["onClick"])]),_:1})]),_:1},8,["data"])])]),_:1})]),t(U,{modelValue:r.value,"onUpdate:modelValue":l[3]||(l[3]=o=>r.value=o),title:c.value>0?"\u4FEE\u6539\u5206\u7C7B":"\u6DFB\u52A0\u5206\u7C7B",width:"500","before-close":D},{footer:u(()=>[y("div",le,[t(n,{onClick:l[2]||(l[2]=o=>r.value=!1)},{default:u(()=>[te]),_:1}),t(n,{type:"primary",onClick:I},{default:u(()=>[ue]),_:1})])]),default:u(()=>[t(x,{label:"\u5206\u7C7B\u540D\u79F0"},{default:u(()=>[t(M,{modelValue:a.value.name,"onUpdate:modelValue":l[0]||(l[0]=o=>a.value.name=o),style:{width:"240px"}},null,8,["modelValue"])]),_:1}),t(x,{label:"\u7236\u5206\u7C7B"},{default:u(()=>[t(T,{modelValue:d.value,"onUpdate:modelValue":[l[1]||(l[1]=o=>d.value=o),E],data:C.value,"check-strictly":"",clearable:"",props:{label:"name",value:"id",children:"children",disabled:o=>c.value===o.id},disabled:f.value},null,8,["modelValue","data","props","disabled"])]),_:1})]),_:1},8,["modelValue","title"])],64)}}});const de=L(ae,[["__scopeId","data-v-876dbbea"]]);export{de as default};
