crud.2d94feb0.js 2.6 KB

1
  1. import{r as l,A as n}from"./index.59c4c6ab.js";import"./elementPlus.8e650391.js";import{d as i}from"./dictionary.a8cda1ac.js";import"./vue.86c1cb21.js";const o="/api/system/dictionary/";function u(e){return l({url:o,method:"get",params:e})}function s(e){return l({url:o,method:"post",data:e})}function c(e){return l({url:o+e.id+"/",method:"put",data:e})}function d(e){return l({url:o+e+"/",method:"delete",data:{}})}const q=function({crudExpose:e,context:p}){return{crudOptions:{request:{pageRequest:async t=>await u(t),addRequest:async({form:t})=>{const r=e.getSearchFormData().parent;if(t.parent=r,r)return await s(t)},editRequest:async({form:t,row:a})=>(t.id=a.id,await c(t)),delRequest:async({row:t})=>await d(t.id)},rowHandle:{fixed:"right",width:200,buttons:{view:{show:!1},edit:{iconRight:"Edit",type:"text"},remove:{iconRight:"Delete",type:"text"}}},columns:{_index:{title:"序号",form:{show:!1},column:{align:"center",width:"70px",columnSetDisabled:!0,formatter:t=>{let a=t.index??1,r=e.crudBinding.value.pagination;return((r.currentPage??1)-1)*r.pageSize+a+1}}},label:{title:"名称",search:{show:!0,component:{props:{clearable:!0}}},type:"input",form:{rules:[{required:!0,message:"名称必填项"}],component:{props:{clearable:!0},placeholder:"请输入名称"}}},type:{title:"数据值类型",type:"dict-select",search:{disabled:!0,component:{props:{clearable:!0}}},show:!1,dict:n({data:[{label:"text",value:0},{label:"number",value:1},{label:"date",value:2},{label:"datetime",value:3},{label:"time",value:4},{label:"file",value:5},{label:"boolean",value:6},{label:"images",value:7}]}),form:{rules:[{required:!0,message:"数据值类型必填项"}],value:0,component:{props:{clearable:!0},placeholder:"请选择数据值类型"}}},value:{title:"数据值",search:{show:!0,component:{props:{clearable:!0}}},view:{component:{props:{height:100,width:100}}},type:"input",form:{rules:[{required:!0,message:"数据值必填项"}],component:{props:{clearable:!0},placeholder:"请输入数据值"}}},status:{title:"状态",width:80,search:{show:!0},type:"dict-radio",dict:n({data:i("button_status_bool")}),form:{value:!0,rules:[{required:!0,message:"状态必填项"}]}},sort:{title:"排序",width:70,type:"number",form:{value:1,component:{},rules:[{required:!0,message:"排序必填项"}]}},color:{title:"标签颜色",width:90,search:{disabled:!0},type:"dict-select",dict:n({data:[{label:"success",value:"success",color:"success"},{label:"primary",value:"primary",color:"primary"},{label:"info",value:"info",color:"info"},{label:"danger",value:"danger",color:"danger"},{label:"warning",value:"warning",color:"warning"}]}),form:{component:{props:{clearable:!0}}}}}}}};export{q as createCrudOptions};