import{d as B,n as J,r as u,f as Q,o as f,l as h,w as l,i as t,a,j as n,C as W,t as C,c as X,F as Y,k as $,y as S,a2 as q,ak as L,H as Z,E as ee,s as ae,D as le,G as te,K as se,b$ as oe,dW as de,J as ue,N as re,_ as ne,__tla as ce}from"./index-b2b3c6c4.js";import{_ as me,__tla as _e}from"./Dialog-70b24cbf.js";import{E as ie,__tla as pe}from"./el-card-bd6e27c9.js";import{a as fe,D as ve,__tla as ye}from"./dict-7f0cc6d2.js";import{d as he,h as Se}from"./tree-0af4953a.js";import{m as w}from"./constants-a1da293a.js";import{g as ke,__tla as xe}from"./index-5a106189.js";import{b as Ve,__tla as be}from"./index-f119fff1.js";import{u as De,__tla as Ce}from"./useMessage-a5edbb0f.js";let U,we=Promise.all([(()=>{try{return ce}catch{}})(),(()=>{try{return _e}catch{}})(),(()=>{try{return pe}catch{}})(),(()=>{try{return ye}catch{}})(),(()=>{try{return xe}catch{}})(),(()=>{try{return be}catch{}})(),(()=>{try{return Ce}catch{}})()]).then(async()=>{U=ne(B({name:"SystemRoleDataPermissionForm",__name:"RoleDataPermissionForm",emits:["success"],setup(Ue,{expose:P,emit:E}){const{t:F}=J(),R=De(),c=u(!1),v=u(!1),d=Q({id:0,name:"",code:"",dataScope:void 0,dataScopeDeptIds:[]}),V=u(),k=u([]),m=u(!1),_=u(),i=u(!1),p=u(!0);P({open:async s=>{var e;c.value=!0,I(),k.value=Se(await ke()),d.id=s.id,d.name=s.name,d.code=s.code,d.dataScope=s.dataScope,(e=s.dataScopeDeptIds)==null||e.forEach(r=>{_.value.setChecked(r,!0,!1)})}});const T=E,g=async()=>{v.value=!0;try{const s={roleId:d.id,dataScope:d.dataScope,dataScopeDeptIds:d.dataScope!==w.DEPT_CUSTOM?[]:_.value.getCheckedKeys(!1)};await Ve(s),R.success(F("common.updateSuccess")),c.value=!1,T("success")}finally{v.value=!1}},I=()=>{var s,e;i.value=!1,m.value=!1,p.value=!0,d.value={id:0,name:"",code:"",dataScope:void 0,dataScopeDeptIds:[]},(s=_.value)==null||s.setCheckedNodes([]),(e=V.value)==null||e.resetFields()},M=()=>{var e;const s=(e=_.value)==null?void 0:e.store.nodesMap;for(let r in s)s[r].expanded!==m.value&&(s[r].expanded=m.value)};return(s,e)=>{const r=L,y=Z,b=ee,N=ae,O=le,A=te,H=se,x=oe,G=de,K=ie,D=ue,j=me,z=re;return f(),h(j,{modelValue:a(c),"onUpdate:modelValue":e[6]||(e[6]=o=>S(c)?c.value=o:null),title:"\u83DC\u5355\u6743\u9650",width:"800"},{footer:l(()=>[t(D,{disabled:a(v),type:"primary",onClick:g},{default:l(()=>[n("\u786E \u5B9A")]),_:1},8,["disabled"]),t(D,{onClick:e[5]||(e[5]=o=>c.value=!1)},{default:l(()=>[n("\u53D6 \u6D88")]),_:1})]),default:l(()=>[W((f(),h(H,{ref_key:"formRef",ref:V,model:a(d),"label-width":"80px"},{default:l(()=>[t(N,{gutter:30},{default:l(()=>[t(b,{span:"12"},{default:l(()=>[t(y,{label:"\u89D2\u8272\u540D\u79F0"},{default:l(()=>[t(r,null,{default:l(()=>[n(C(a(d).name),1)]),_:1})]),_:1})]),_:1}),t(b,{span:"12"},{default:l(()=>[t(y,{label:"\u89D2\u8272\u6807\u8BC6"},{default:l(()=>[t(r,null,{default:l(()=>[n(C(a(d).code),1)]),_:1})]),_:1})]),_:1})]),_:1}),t(y,{label:"\u6743\u9650\u8303\u56F4"},{default:l(()=>[t(A,{modelValue:a(d).dataScope,"onUpdate:modelValue":e[0]||(e[0]=o=>a(d).dataScope=o)},{default:l(()=>[(f(!0),X(Y,null,$(a(fe)(a(ve).SYSTEM_DATA_SCOPE),o=>(f(),h(O,{key:o.value,label:o.label,value:o.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1},8,["model"])),[[z,a(v)]]),a(d).dataScope===a(w).DEPT_CUSTOM?(f(),h(y,{key:0,label:"\u6743\u9650\u8303\u56F4",style:{display:"flex"}},{default:l(()=>[t(K,{class:"card",shadow:"never"},{header:l(()=>[n(" \u5168\u9009/\u5168\u4E0D\u9009: "),t(x,{modelValue:a(i),"onUpdate:modelValue":e[1]||(e[1]=o=>S(i)?i.value=o:null),"active-text":"\u662F","inactive-text":"\u5426","inline-prompt":"",onChange:e[2]||(e[2]=o=>{_.value.setCheckedNodes(i.value?k.value:[])})},null,8,["modelValue"]),n(" \u5168\u90E8\u5C55\u5F00/\u6298\u53E0: "),t(x,{modelValue:a(m),"onUpdate:modelValue":e[3]||(e[3]=o=>S(m)?m.value=o:null),"active-text":"\u5C55\u5F00","inactive-text":"\u6298\u53E0","inline-prompt":"",onChange:M},null,8,["modelValue"]),n(" \u7236\u5B50\u8054\u52A8(\u9009\u4E2D\u7236\u8282\u70B9\uFF0C\u81EA\u52A8\u9009\u62E9\u5B50\u8282\u70B9): "),t(x,{modelValue:a(p),"onUpdate:modelValue":e[4]||(e[4]=o=>S(p)?p.value=o:null),"active-text":"\u662F","inactive-text":"\u5426","inline-prompt":""},null,8,["modelValue"])]),default:l(()=>[t(G,{ref_key:"treeRef",ref:_,"check-strictly":!a(p),data:a(k),props:a(he),"default-expand-all":"","empty-text":"\u52A0\u8F7D\u4E2D\uFF0C\u8BF7\u7A0D\u540E","node-key":"id","show-checkbox":""},null,8,["check-strictly","data","props"])]),_:1})]),_:1})):q("",!0)]),_:1},8,["modelValue"])}}}),[["__file","/Users/RuHu.Xu/Desktop/mall-newfeifan-zx-admin/src/views/system/role/RoleDataPermissionForm.vue"]])});export{we as __tla,U as default};
