import{r as a,H as l,h as m,s as d}from"./index.ad3efb29.js";import"./elementPlus.4833989a.js";import{d as h}from"./dictionary.bf4815bd.js";import{ax as p}from"./vue.adf17aba.js";const i="/api/system/role/";function P(){return a({url:i+"field_permission/",method:"get"})}function w(e){return a({url:i,method:"get",params:e})}function f(e){return a({url:i,method:"post",data:e})}function c(e){return a({url:i+e.id+"/",method:"put",data:e})}function y(e){return a({url:i+e+"/",method:"delete",data:{id:e}})}const _=p("columnPermission",{state:()=>({permission:[]}),actions:{setPermissionData(e){this.permission=e}}}),o=(e,u)=>{const n=_().permission||[];return n.some(s=>s.field_name===e&&s[u]),!!n.some(s=>s.field_name===e&&s[u])},q=function({crudExpose:e,rolePermission:u,handleDrawerOpen:n,hasPermissions:s}){return{crudOptions:{request:{pageRequest:async t=>await w(t),addRequest:async({form:t})=>await f(t),editRequest:async({form:t,row:r})=>(t.id=r.id,await c(t)),delRequest:async({row:t})=>await y(t.id)},rowHandle:{fixed:"right",width:320,buttons:{view:{show:!0},edit:{show:s("role:Update")},remove:{show:s("role:Delete")},customNew:{type:"primary",text:"权限配置",show:s("role:Update"),tooltip:{placement:"top",content:"权限配置"},click:t=>{const{row:r}=t;n(r)}}}},form:{col:{span:24},labelWidth:"100px",wrapper:{is:"el-dialog",width:"600px"}},columns:{_index:{title:"序号",form:{show:!1},column:{type:"index",align:"center",width:"70px",columnSetDisabled:!0}},id:{title:"ID",type:"text",column:{show:!1},search:{show:!1},form:{show:!1}},name:{title:"角色名称",type:"text",search:{show:!0},column:{minWidth:120,sortable:"custom",show:o("name","is_query")},form:{show:!0,rules:[{required:!0,message:"角色名称必填"}],component:{placeholder:"请输入角色名称"}}},key:{title:"权限标识",type:"text",search:{show:!1},column:{minWidth:120,sortable:"custom",show:o("key","is_query"),columnSetDisabled:!0},form:{show:!0,rules:[{required:!0,message:"权限标识必填"}],component:{placeholder:"输入权限标识"}}},sort:{title:"排序",search:{show:!1},type:"number",column:{minWidth:90,sortable:"custom",show:o("sort","is_query")},form:{show:!0,rules:[{required:!0,message:"排序必填"}],value:1}},admin:{title:"是否管理员",search:{show:!1},type:"dict-radio",dict:l({data:[{label:"是",value:!0,color:"success"},{label:"否",value:!1,color:"danger"}]}),column:{minWidth:130,sortable:"custom",show:o("admin","is_query")},addForm:{show:o("admin","is_create")},editForm:{show:o("admin","is_update")},form:{rules:[{required:!0,message:"是否管理员必填"}],value:!1}},status:{title:"状态",search:{show:!0},type:"dict-radio",column:{width:100,component:{name:"fs-dict-switch",activeText:"",inactiveText:"",style:"--el-switch-on-color: var(--el-color-primary); --el-switch-off-color: #dcdfe6",onChange:m(t=>()=>{c(t.row).then(r=>{d(r.msg)})})},show:o("status","is_query")},form:{show:!0},dict:l({data:h("button_status_bool")})},update_datetime:{title:"更新时间",type:"text",search:{show:!1},column:{minWidth:170,sortable:"custom",show:o("update_datetime","is_query")},form:{show:!1,component:{placeholder:"输入关键词搜索"}}},create_datetime:{title:"创建时间",type:"text",search:{show:!1},column:{sortable:"custom",minWidth:170,show:o("create_datetime","is_query")},form:{show:!1,component:{placeholder:"输入关键词搜索"}}}}}}},S=Object.freeze(Object.defineProperty({__proto__:null,createCrudOptions:q},Symbol.toStringTag,{value:"Module"}));export{P as G,S as a,q as c,_ as u};
