1 |
- import{r as o,h as m,H as h,s as f}from"./index.34b03be2.js";import"./elementPlus.4833989a.js";import{d as w}from"./dictionary.e7fd8c72.js";import{B as y,n as b,U as g,ai as v}from"./vue.adf17aba.js";import"./echarts.72dc8373.js";import"./dictionary.8197a0f3.js";const a="/api/system/dictionary/";function x(t){return o({url:a,method:"get",params:t})}function R(t){return o({url:a,method:"post",data:t})}function u(t){return o({url:a+t.id+"/",method:"put",data:t})}function D(t){return o({url:a+t+"/",method:"delete",data:{id:t}})}const U=function({crudExpose:t,context:n}){const c=async e=>await x(e),l=async({form:e,row:r})=>(e.id=r.id,await u(e)),d=async({row:e})=>await D(e.id),p=async({form:e})=>await R(e),i=y("$hasPermissions");return{crudOptions:{request:{pageRequest:c,addRequest:p,editRequest:l,delRequest:d},rowHandle:{fixed:"right",width:200,buttons:{view:{show:!1},edit:{iconRight:"Edit",type:"text",show:i("dictionary:Update")},remove:{iconRight:"Delete",type:"text",show:i("dictionary:Delete")},custom:{text:"字典配置",type:"text",show:i("dictionary:Update"),tooltip:{placement:"top",content:"字典配置"},click:e=>{const{row:r}=e;n.subDictRef.value.drawer=!0,b(()=>{n.subDictRef.value.setSearchFormData({form:{parent:r.id}}),n.subDictRef.value.doRefresh()})}}}},columns:{_index:{title:"序号",form:{show:!1},column:{align:"center",width:"70px",columnSetDisabled:!0,formatter:e=>{let r=e.index??1,s=t.crudBinding.value.pagination;return((s.currentPage??1)-1)*s.pageSize+r+1}}},search:{title:"关键词",column:{show:!1},search:{show:!0,component:{props:{clearable:!0},placeholder:"请输入关键词"}},form:{show:!1,component:{props:{clearable:!0}}}},label:{title:"字典名称",search:{show:!0,component:{props:{clearable:!0}}},type:"input",column:{minWidth:120},form:{rules:[{required:!0,message:"字典名称必填项"}],component:{props:{clearable:!0},placeholder:"请输入字典名称"}}},value:{title:"字典编号",search:{disabled:!0,component:{props:{clearable:!0}}},type:"input",column:{minWidth:120},form:{rules:[{required:!0,message:"字典编号必填项"}],component:{props:{clearable:!0},placeholder:"请输入字典编号"},helper:{render(e){return g(v("el-alert"),{title:"使用方法:dictionary('字典编号')",type:"warning"},null)}}}},status:{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:m(e=>()=>{u(e.row).then(r=>{f(r.msg)})})}},dict:h({data:w("button_status_bool")})},sort:{title:"排序",type:"number",column:{minWidth:80},form:{value:1}}}}}};export{U as createCrudOptions};
|