import{r as o,l as p,P as f,s as w}from"./index.DoJnwA7v.js";import"./elementPlus.CqHltQSO.js";import{d as y}from"./dictionary.BbheqGs8.js";import{a as i}from"./authFunction.DSpD5R8m.js";import"./vue.1RczIYhx.js";const a="/api/system/area/";function g(t){return o({url:a,method:"get",params:t})}function b(t){return o({url:a,method:"post",data:t})}function s(t){return o({url:a+t.id+"/",method:"put",data:t})}function q(t){return o({url:a+t+"/",method:"delete",data:{id:t}})}const O=function({crudExpose:t}){const n=async e=>await g(e),d=async({form:e,row:r})=>(e.id=r.id,await s(e)),l=async({row:e})=>await q(e.id),u=async({form:e})=>await b(e),c=(e,r,m)=>{n({pcode:e.code}).then(h=>{m(h.data)})};return{crudOptions:{request:{pageRequest:n,addRequest:u,editRequest:d,delRequest:l},actionbar:{buttons:{add:{show:i("area:Create")}}},rowHandle:{fixed:"right",width:200,buttons:{view:{show:!1},edit:{iconRight:"Edit",type:"text",show:i("area:Update")},remove:{iconRight:"Delete",type:"text",show:i("area:Delete")}}},pagination:{show:!1},table:{rowKey:"id",lazy:!0,load:c,treeProps:{children:"children",hasChildren:"hasChild"}},columns:{_index:{title:"序号",form:{show:!1},column:{type:"index",align:"center",width:"70px",columnSetDisabled:!0}},name:{title:"名称",search:{show:!0},treeNode:!0,type:"input",column:{minWidth:120},form:{rules:[{required:!0,message:"名称必填项"}],component:{placeholder:"请输入名称"}}},code:{title:"地区编码",search:{show:!0},type:"input",column:{minWidth:90},form:{rules:[{required:!0,message:"地区编码必填项"}],component:{placeholder:"请输入地区编码"}}},pinyin:{title:"拼音",search:{disabled:!0},type:"input",column:{minWidth:120},form:{rules:[{required:!0,message:"拼音必填项"}],component:{placeholder:"请输入拼音"}}},level:{title:"地区层级",search:{disabled:!0},type:"input",column:{minWidth:100},form:{disabled:!1,rules:[{required:!0,message:"拼音必填项"}],component:{placeholder:"请输入拼音"}}},initials:{title:"首字母",column:{minWidth:100},form:{rules:[{required:!0,message:"首字母必填项"}],component:{placeholder:"请输入首字母"}}},enable:{title:"是否启用",search:{show:!0},type:"dict-radio",column:{minWidth:90,component:{name:"fs-dict-switch",activeText:"",inactiveText:"",style:"--el-switch-on-color: var(--el-color-primary); --el-switch-off-color: #dcdfe6",onChange:p(e=>()=>{s(e.row).then(r=>{w(r.msg)})})}},dict:f({data:y("button_status_bool")})}}}}};export{O as createCrudOptions};
