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