1 |
- import{d as L,a as x,az as P,a2 as U,r as V,w as q,K as d,aq as c,e as u,y as f,L as s,u as e,t as h,m as b,f as W,am as y,n as K,j as m,i as w,G as $,ac as H,C as J}from"./vue-A59npLRR.js";import{F as R}from"./index-r6iTpmP6.js";import{c as M,v as O,b as S,_ as Q}from"./index-EwE51S_X.js";import{b as X}from"./validate-_EUdkMt3.js";import"./index-K8IR974I.js";import"./baTable-MdxYOkAk.js";import"./index-XALue448.js";import"./echarts-cxb9vJr1.js";function Y(){return M({url:"/admin/auth.Rule/index",method:"get"})}const Z={class:"title"},ee=L({__name:"popupForm",setup(te,{expose:I}){const v=O(),g=x(),_=x(),t=P("baTable"),{t:l}=U(),a=V({treeKey:S(),defaultCheckedKeys:[],menuRules:[]}),N=V({name:[X({name:"required",title:l("auth.group.Group name")})],auth:[{required:!0,validator:(i,o,r)=>k().length<=0?r(new Error(l("Please select field",{field:l("auth.group.jurisdiction")}))):r()}],pid:[{validator:(i,o,r)=>o&&parseInt(o)==parseInt(t.form.items.id)?r(new Error(l("auth.group.The parent group cannot be the group itself"))):r(),trigger:"blur"}]});Y().then(i=>{a.menuRules=i.data.list});const k=()=>_.value.getCheckedKeys().concat(_.value.getHalfCheckedKeys()),F=(i,o)=>{if(o.isLeaf)return"";let r=!0;for(const p in o.childNodes)o.childNodes[p].isLeaf||(r=!1);return r?"penultimate-node":""};return I({getCheckeds:k}),q(()=>t.form.items.rules,()=>{if(t.form.items.rules&&t.form.items.rules.length)if(t.form.items.rules.includes("*")){let i=[];for(const o in a.menuRules)i.push(a.menuRules[o].id);a.defaultCheckedKeys=i}else a.defaultCheckedKeys=t.form.items.rules;else a.defaultCheckedKeys=[];a.treeKey=S()}),(i,o)=>{const r=d("el-input"),p=d("el-form-item"),z=d("el-tree"),D=d("el-form"),E=d("el-scrollbar"),C=d("el-button"),T=d("el-dialog"),j=c("drag"),A=c("zoom"),B=c("loading"),G=c("blur");return u(),f(T,{class:"ba-operate-dialog","close-on-click-modal":!1,"model-value":["Add","Edit"].includes(e(t).form.operate),onClose:e(t).toggleForm,"destroy-on-close":!0},{header:s(()=>[y((u(),W("div",Z,[b(h(e(t).form.operate?e(l)(e(t).form.operate):""),1)])),[[j,[".ba-operate-dialog",".el-dialog__header"]],[A,".ba-operate-dialog"]])]),footer:s(()=>[w("div",{style:K("width: calc(100% - "+e(t).form.labelWidth/1.8+"px)")},[m(C,{onClick:o[4]||(o[4]=n=>e(t).toggleForm(""))},{default:s(()=>[b(h(e(l)("Cancel")),1)]),_:1}),y((u(),f(C,{loading:e(t).form.submitLoading,onClick:o[5]||(o[5]=n=>e(t).onSubmit(g.value)),type:"primary"},{default:s(()=>[b(h(e(t).form.operateIds&&e(t).form.operateIds.length>1?e(l)("Save and edit next item"):e(l)("Save")),1)]),_:1},8,["loading"])),[[G]])],4)]),default:s(()=>[y((u(),f(E,{class:"ba-table-form-scrollbar"},{default:s(()=>[w("div",{class:$(["ba-operate-form","ba-"+e(t).form.operate+"-form"]),style:K(e(v).layout.shrink?"":"width: calc(100% - "+e(t).form.labelWidth/2+"px)")},[e(t).form.loading?J("",!0):(u(),f(D,{key:0,ref_key:"formRef",ref:g,onKeyup:o[3]||(o[3]=H(n=>e(t).onSubmit(g.value),["enter"])),model:e(t).form.items,"label-position":e(v).layout.shrink?"top":"right","label-width":e(t).form.labelWidth+"px",rules:N},{default:s(()=>[m(R,{label:e(l)("auth.group.Parent group"),modelValue:e(t).form.items.pid,"onUpdate:modelValue":o[0]||(o[0]=n=>e(t).form.items.pid=n),type:"remoteSelect",prop:"pid","input-attr":{params:{isTree:!0},field:"name","remote-url":e(t).api.actionUrl.get("index"),placeholder:e(l)("Click select")}},null,8,["label","modelValue","input-attr"]),m(p,{prop:"name",label:e(l)("auth.group.Group name")},{default:s(()=>[m(r,{modelValue:e(t).form.items.name,"onUpdate:modelValue":o[1]||(o[1]=n=>e(t).form.items.name=n),type:"string",placeholder:e(l)("Please input field",{field:e(l)("auth.group.Group name")})},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),m(p,{prop:"auth",label:e(l)("auth.group.jurisdiction")},{default:s(()=>[(u(),f(z,{ref_key:"treeRef",ref:_,key:a.treeKey,"default-checked-keys":a.defaultCheckedKeys,"default-expand-all":!0,"show-checkbox":"","node-key":"id",props:{children:"children",label:"title",class:F},data:a.menuRules},null,8,["default-checked-keys","props","data"]))]),_:1},8,["label"]),m(R,{label:e(l)("State"),modelValue:e(t).form.items.status,"onUpdate:modelValue":o[2]||(o[2]=n=>e(t).form.items.status=n),type:"radio",data:{content:{0:e(l)("Disable"),1:e(l)("Enable")},childrenAttr:{border:!0}}},null,8,["label","modelValue","data"])]),_:1},8,["model","label-position","label-width","rules"]))],6)]),_:1})),[[B,e(t).form.loading]])]),_:1},8,["model-value","onClose"])}}}),ue=Q(ee,[["__scopeId","data-v-3919ad00"]]);export{ue as default};
|