crud.9b6cf7d4.js 2.4 KB

1
  1. import{r as o,n as p,A as f,s as w}from"./index.59c4c6ab.js";import"./elementPlus.8e650391.js";import{d as y}from"./dictionary.a8cda1ac.js";import{a as n}from"./authFunction.db0b1d3f.js";import"./vue.86c1cb21.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 i=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)=>{i({pcode:e.code}).then(h=>{m(h.data)})};return{crudOptions:{request:{pageRequest:i,addRequest:u,editRequest:d,delRequest:l},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: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};