import{r as o,h as u,H as l,s as c}from"./index.34b03be2.js";import"./elementPlus.4833989a.js";import{d as m}from"./dictionary.e7fd8c72.js";import"./vue.adf17aba.js";import"./echarts.72dc8373.js";import"./dictionary.8197a0f3.js";const i="/api/system/area/";function h(t){return o({url:i,method:"get",params:t})}function p(t){return o({url:i,method:"post",data:t})}function s(t){return o({url:i+t.id+"/",method:"put",data:t})}function f(t){return o({url:i+t+"/",method:"delete",data:{id:t}})}const O=function({crudExpose:t}){const n=async e=>await h(e);return{crudOptions:{request:{pageRequest:n,addRequest:async({form:e})=>await p(e),editRequest:async({form:e,row:r})=>(e.id=r.id,await s(e)),delRequest:async({row:e})=>await f(e.id)},rowHandle:{fixed:"right",width:200,buttons:{view:{show:!1},edit:{iconRight:"Edit",type:"text"},remove:{iconRight:"Delete",type:"text"}}},pagination:{show:!1},table:{rowKey:"id",lazy:!0,load:(e,r,a)=>{n({pcode:e.code}).then(d=>{a(d.data)})},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:u(e=>()=>{s(e.row).then(r=>{c(r.msg)})})}},dict:l({data:m("button_status_bool")})}}}}};export{O as createCrudOptions};