import{t as r,W as c,r as i,s as d}from"./index.Df8UJ10K.js";import{d as m}from"./dictionary.BEN7awPC.js";import{a as o}from"./authFunction.Cmg2kwFe.js";import"./vue.D1BjjNmv.js";const a="/api/system/role/";function h(t){return r({url:a,method:"get",params:t})}function p(t){return r({url:a,method:"post",data:t})}function n(t){return r({url:a+t.id+"/",method:"put",data:t})}function w(t){return r({url:a+t+"/",method:"delete",data:{id:t}})}const D=function({crudExpose:t,context:l}){return{crudOptions:{toolbar:{buttons:{search:{show:!1},refresh:{show:!1},compact:{show:!1},export:{text:"导出",type:"primary",size:"small",icon:"upload",circle:!1,show:!1},columns:{show:!1}}},request:{pageRequest:async e=>await h(e),addRequest:async({form:e})=>await p(e),editRequest:async({form:e,row:s})=>(e.id=s.id,await n(e)),delRequest:async({row:e})=>await w(e.id)},pagination:{show:!0},actionbar:{buttons:{add:{show:o("role:Create")}}},rowHandle:{fixed:"right",width:320,buttons:{view:{show:!0},edit:{show:o("role:Update")},remove:{show:o("role:Delete")},permission:{type:"primary",text:"权限配置",show:o("role:Permission"),click:e=>{const{row:s}=e;l.RoleDrawer.handleDrawerOpen(s),l.RoleMenuBtn.setState([]),l.RoleMenuField.setState([])}}}},form:{col:{span:24},labelWidth:"100px",wrapper:{is:"el-dialog",width:"600px",buttons:{ok:{text:"提交",show:i(e=>e.mode!=="view")}}}},columns:{_index:{title:"序号",form:{show:!1},column:{type:"index",align:"center",width:"70px",columnSetDisabled:!0}},id:{title:"ID",column:{show:!1},search:{show:!1},form:{show:!1}},name:{title:"角色名称",search:{show:!0},column:{minWidth:120,sortable:"custom"},form:{rules:[{required:!0,message:"角色名称必填"}],component:{placeholder:"请输入角色名称"}}},key:{title:"权限标识",search:{show:!1},column:{minWidth:120,sortable:"custom",columnSetDisabled:!0},form:{rules:[{required:!0,message:"权限标识必填"}],component:{placeholder:"输入权限标识"}},valueBuilder(e){const{row:s,key:u}=e;return s[u]}},sort:{title:"排序",search:{show:!1},type:"number",column:{minWidth:90,sortable:"custom"},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:i(e=>()=>{n(e.row).then(s=>{d(s.msg)})})}},dict:c({value:m("button_status_bool")})}}}}};export{D as createCrudOptions};
