import{t as r,W as l}from"./index.Df8UJ10K.js";import"./vue.D1BjjNmv.js";const i="/api/system/approval/workflow/";function d(a){return r({url:i,method:"get",params:a})}function m(a){return r({url:i,method:"post",data:a})}function p(a){return r({url:i+a.id+"/",method:"put",data:a})}function h(a){return r({url:i+a+"/",method:"delete",data:{id:a}})}function g(a){return r({url:"/api/system/tenant/switch/",method:"post",data:{tenant_id:a}})}const y=function({crudExpose:a}){const s=async e=>{try{const t=await d(e);return{...t,records:t.data,total:t.total}}catch{return{code:2e3,msg:"success",records:[],total:0}}},n=async({form:e,row:t})=>(e.id=t.id,await p(e)),c=async({row:e})=>await h(e.id),u=async({form:e})=>await m(e);return g(1),{crudOptions:{request:{pageRequest:s,addRequest:u,editRequest:n,delRequest:c},columns:{_index:{title:"序号",form:{show:!1},column:{align:"center",width:"70px",columnSetDisabled:!0,formatter:e=>{let t=e.index??1,o=a.crudBinding.value.pagination;return((o.currentPage??1)-1)*o.pageSize+t+1}}},name:{title:"审批单名称",search:{show:!0},type:"input",column:{minWidth:120},form:{component:{placeholder:"请输入审批单名称"},rules:[{required:!0,message:"请输入审批单名称"}]}},workflow_type:{title:"流程类型",search:{show:!0},type:"dict-select",column:{minWidth:120},dict:l({data:[{label:"设备借用申请",value:0},{label:"设备维修申请",value:1},{label:"设备采购申请",value:2},{label:"其他申请",value:3}]}),form:{component:{placeholder:"请选择流程类型"},rules:[{required:!0,message:"请选择流程类型"}]}},description:{title:"流程描述",search:{show:!1},type:"input",column:{minWidth:120},form:{component:{placeholder:"请输入流程描述"},rules:[{required:!1,message:"请输入流程描述"}]}},is_active:{title:"状态",type:"dict-select",search:{show:!1},dict:l({data:[{label:"启用",value:!0},{label:"禁用",value:!1}]}),column:{minWidth:100},form:{component:{placeholder:"请选择状态"},rules:[{required:!0,message:"请选择状态"}]}},"trigger_conditions.equipment_categories":{title:"分类列表",type:"dict-select",search:{show:!1},column:{minWidth:160},dict:l({url:"/api/system/device/category/",value:"id",label:"name"}),form:{component:{placeholder:"请选择分类列表"},valueResolve({form:e,value:t}){e.trigger_conditions.equipment_categories=[t]}}},"trigger_conditions.borrow_types":{title:"借用类型",type:"dict-select",search:{show:!1},column:{minWidth:160},dict:l({data:[{label:"常规借用",value:"0"},{label:"课堂借用",value:"1"},{label:"特殊借用",value:"2"}]}),form:{component:{placeholder:"请选择借用类型"},valueResolve({form:e,value:t}){e.trigger_conditions.borrow_types=[t]}}},"trigger_conditions.team_type":{title:"借用方式",type:"dict-select",search:{show:!1},column:{minWidth:120},dict:l({data:[{label:"个人借用",value:"0"},{label:"团队借用",value:"1"}]}),form:{component:{placeholder:"请选择借用方式"},valueResolve({form:e,value:t}){e.trigger_conditions.team_type=[t]}}},"trigger_conditions.user_types":{title:"用户类型",type:"dict-select",search:{show:!1},column:{minWidth:120},dict:l({data:[{label:"学生",value:"student"},{label:"老师",value:"teacher"}]}),form:{component:{placeholder:"请选择用户类型"},valueResolve({form:e,value:t}){e.trigger_conditions.user_types=[t]}}},tenant_id:{title:"租户id",type:"dict-select",column:{show:!1,minWidth:120},dict:l({url:"/api/system/tenant/list/",value:"id",label:"name"}),form:{component:{placeholder:"请填租户id"},rules:[{required:!1,message:"请填租户id"}]}}}}}};export{y as createCrudOptions};
