import{r as s,W as l,I as n,s as d,S as c}from"./index.CL7yl-Wb.js";import{d as m}from"./dictionary.BGob_AR7.js";import"./vue.D1BjjNmv.js";const o="/api/system/role/";function h(t){return s({url:o,method:"get",params:t})}function p(t){return s({url:o,method:"post",data:t})}function i(t){return s({url:o+t.id+"/",method:"put",data:t})}function w(t){return s({url:o+t+"/",method:"delete",data:{id:t}})}const v=function({crudExpose:t,context:a}){return{crudOptions:{request:{pageRequest:async e=>await h(e),addRequest:async({form:e})=>await p(e),editRequest:async({form:e,row:r})=>(e.id=r.id,await i(e)),delRequest:async({row:e})=>await w(e.id)},pagination:{show:!0},actionbar:{buttons:{add:{show:!0}}},rowHandle:{fixed:"right",width:320,buttons:{view:{show:!0},edit:{show:!0},remove:{show:!0},permission:{type:"primary",text:"权限配置",show:n(({row:e})=>{var r;return((r=c.get("userInfo").role_info[0])==null?void 0:r.id)===1}),click:e=>{const{row:r}=e;a.RoleDrawer.handleDrawerOpen(r),a.RoleMenuBtn.setState([]),a.RoleMenuField.setState([])}}}},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",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:r,key:u}=e;return r[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:n(e=>()=>{i(e.row).then(r=>{d(r.msg)})})}},dict:l({value:m("button_status_bool")})}}}}};export{v as createCrudOptions};
