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