crud.D0I945iN.js 2.5 KB

1
  1. import{r,W as f,ac as l,s as w}from"./index.BQUvI64x.js";import{d as y}from"./dictionary.DtqLlNzM.js";import{a as n}from"./authFunction.DdZbrv5n.js";import{t as b}from"./index.CxC0fn2W.js";import{s as g}from"./vue.D1BjjNmv.js";const o="/api/system/area/";function x(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 W(){return r({url:o+"field_permission/",method:"get"})}const q=function({crudExpose:t}){const s=async e=>await x(e),c=async({form:e,row:a})=>(e.id=a.id,await d(e)),u=async({row:e})=>await _(e.id),h=async({form:e})=>await C(e),i=(e,a,m)=>{s({pcode:e.code}).then(p=>{m(p.data)})};return{crudOptions:{request:{pageRequest:s,addRequest:h,editRequest:c,delRequest:u},actionbar:{buttons:{add:{show:n("area:Create")}}},rowHandle:{fixed:"right",width:200,buttons:{view:{show:!1},edit:{iconRight:"Edit",type:"text",show:n("area:Update")},remove:{iconRight:"Delete",type:"text",show:n("area:Delete")}}},pagination:{show:!1},table:{rowKey:"id",lazy:!0,load:i,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:g(b),vModel:"modelValue",displayLabel:l(({row:e})=>e?e.pcode_info:null),tableConfig:{url:"/api/system/area/",label:"name",value:"id",isTree:!0,isMultiple:!1,lazy:!0,load:i,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=>{w(a.msg)})})}},dict:f({data:y("button_status_bool")})}}}}},j=Object.freeze(Object.defineProperty({__proto__:null,createCrudOptions:q},Symbol.toStringTag,{value:"Module"}));export{W as G,j as a,q as c};