import{r,m as u,v as w,x as l,s as y}from"./index.lP_uh0LI.js";import{a as n}from"./authFunction.z5AMEiSQ.js";import{d as b}from"./dictionary.D0i47SYU.js";import{t as g}from"./index.DBDa3ku2.js";import{K as x}from"./vue.BxlDVA1H.js";const o=`${u.system}area/`;function v(t){return r({url:o,method:"get",params:t})}function C(t){return r({url:o,method:"post",data:t})}function d(t){return r({url:o+t.id+"/",method:"put",data:t})}function _(t){return r({url:o+t+"/",method:"delete",data:{id:t}})}function S(){return r({url:o+"field_permission/",method:"get"})}const q=function({crudExpose:t}){const i=async e=>await v(e),c=async({form:e,row:a})=>(e.id=a.id,await d(e)),m=async({row:e})=>await _(e.id),h=async({form:e})=>await C(e),s=(e,a,p)=>{i({pcode:e.code}).then(f=>{p(f.data)})};return{crudOptions:{request:{pageRequest:i,addRequest:h,editRequest:c,delRequest:m},actionbar:{buttons:{add:{show:n("area:Create")}}},rowHandle:{fixed:"right",width:200,buttons:{view:{show:!1},edit:{iconRight:"Edit",type:"primary",link:!0,show:n("area:Update")},remove:{iconRight:"Delete",type:"primary",link:!0,show:n("area:Delete")}}},pagination:{show:!1},table:{rowKey:"id",lazy:!0,load:s,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:"请输入名称"}}},pcode:{title:"父级地区",search:{disabled:!0},width:130,type:"table-selector",form:{component:{name:x(g),vModel:"modelValue",displayLabel:l(({row:e})=>e?e.pcode_info:null),tableConfig:{url:`${u.system}area/`,label:"name",value:"id",isTree:!0,isMultiple:!1,lazy:!0,load:s,treeProps:{children:"children",hasChildren:"hasChild"},columns:[{prop:"name",label:"地区",width:150},{prop:"code",label:"地区编码"}]}}},column:{show:!1}},code:{title:"地区编码",search:{show:!0},type:"input",column:{minWidth:90},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:l(e=>()=>{d(e.row).then(a=>{y(a.msg)})})}},dict:w({data:b("button_status_bool")})}}}}},j=Object.freeze(Object.defineProperty({__proto__:null,createCrudOptions:q},Symbol.toStringTag,{value:"Module"}));export{S as G,j as a,q as c};
