import{S as h,B as d,D as p,U as f,A as w,G as _}from"./api.2N1tLYgs.js";import{D as o,E as W}from"./index.BKEMpsLA.js";import{f as g}from"./vue.YrNK8sx4.js";const v=function({crudExpose:s,context:r,showRejectDialog:l,rejectReason:y,currentFormId:i,expose:b}){const n=async e=>{try{const t=await _(e);return console.log("res::::",t),{...t,records:t.data,total:t.total}}catch{return{code:2e3,msg:"success",records:[],total:0}}},m=async({form:e,row:t})=>(e.id=t.id,await f(e)),c=async({row:e})=>await p(e.id),u=async({form:e})=>await w(e);return h(1),{crudOptions:{request:{pageRequest:n,addRequest:u,editRequest:m,delRequest:c},form:{labelWidth:g(()=>{var e;return(e=r.labelWidthRef)!=null&&e.value?r.labelWidthRef.value+"px":"100px"}),wrapper:{buttons:{ok:{text:"通过",click:async e=>{await d(e.form.id,"approve","同意借用"),W.success("审批通过"),e.close(),s.doRefresh()}},reject:{text:"拒绝",type:"danger",click:async e=>{i.value=e.form.id,l.value=!0,e.close(),s.doRefresh()}}}}},search:{show:!0},toolbar:{show:!1},actionbar:{show:!1},rowHandle:{fixed:"right",width:100,show:!0,buttons:{view:{show:!0,order:1,click:({row:e})=>{window.dispatchEvent(new CustomEvent("approve-view",{detail:e}))}},edit:{show:!1},remove:{show:!1}}},columns:{_index:{title:"序号",form:{show:!1},column:{align:"center",width:"70px",columnSetDisabled:!0,formatter:e=>{let t=e.index??1,a=s.crudBinding.value.pagination;return((a.currentPage??1)-1)*a.pageSize+t+1}}},application_no:{title:"借用单编号",search:{show:!1},type:"input",column:{minWidth:120},form:{show:!0,component:{placeholder:"请输入借用编号"},rules:[{required:!1,message:"请输入借用编号"}]}},borrower_type_label:{title:"借用人角色",column:{minWidth:100}},borrow_type_label:{title:"借用性质",search:{show:!1},type:"input",column:{minWidth:120},form:{show:!0,component:{placeholder:"请输入借用性质"},rules:[{required:!1,message:"请输入借用性质"}]}},"borrower_info.user_code":{title:"学号/工号",search:{show:!0},type:"input",column:{minWidth:120},form:{show:!0,component:{placeholder:""},rules:[{required:!1,message:""}]}},"borrower_info.name":{title:"借用人",search:{show:!0},type:"input",column:{show:!0,minWidth:120},form:{show:!0,component:{placeholder:""},rules:[{required:!1,message:""}]}},emergency_contact:{title:"借用人",search:{show:!1},type:"input",column:{show:!1,minWidth:120},form:{show:!1,component:{placeholder:"请输入借用人"},rules:[{required:!1,message:"请输入借用人"}]}},emergency_phone:{title:"联系方式",search:{show:!1},type:"input",column:{minWidth:120},form:{show:!0,component:{placeholder:"请输入联系方式"},rules:[{required:!1,message:"请输入联系方式"}]}},team_type_label:{title:"个人/团队",search:{show:!1},type:"input",column:{minWidth:120},form:{show:!0,component:{placeholder:"请输入个人/团队"},rules:[{required:!1,message:"请输入个人/团队"}]}},team_members:{title:"团队成员",column:{show:!1,minWidth:120}},team_members_count:{title:"团队人数",column:{show:!1,minWidth:80}},create_datetime:{title:"创建时间",search:{show:!1},type:"input",column:{minWidth:120},form:{show:!0,component:{placeholder:"请输入创建时间"},rules:[{required:!1,message:"请输入创建时间"}]}},status_label:{title:"当前状态",column:{minWidth:80}},actual_start_time:{title:"借出时间",column:{minWidth:140,formatter:({value:e})=>e?o(e).format("YYYY-MM-DD HH:mm:ss"):""}},expected_end_time:{title:"预计归还",search:{show:!1},type:"input",column:{minWidth:120},form:{show:!0,component:{placeholder:"请输入预计归还时间"},rules:[{required:!1,message:"请输入预计归还时间"}]}},actual_end_time:{title:"完结时间",column:{minWidth:140,formatter:({value:e})=>e?o(e).format("YYYY-MM-DD HH:mm:ss"):""}},return_location:{title:"存放仓库",column:{minWidth:120}},purpose:{title:"借用目的",column:{minWidth:150,show:!1}},expected_start_time:{title:"预计开始",column:{minWidth:140,show:!0,formatter:({value:e})=>e?o(e).format("YYYY-MM-DD HH:mm:ss"):""}},approve_time:{title:"审批时间",column:{show:!1,minWidth:140,formatter:({value:e})=>e?o(e).format("YYYY-MM-DD HH:mm"):""},from:{show:!1}},approve_remark:{title:"审批备注",column:{show:!1,minWidth:120},from:{show:!1}},total_items:{title:"设备数量",column:{show:!1,minWidth:80}},applicant_remark:{title:"申请备注",column:{show:!1,minWidth:120},from:{show:!1}},update_datetime:{title:"更新时间",column:{show:!1,minWidth:160,formatter:({value:e})=>e?o(e).format("YYYY-MM-DD HH:mm:ss"):""}},approver_name:{title:"当前审批人",search:{show:!0},type:"input",column:{minWidth:120},form:{show:!1,component:{placeholder:""},rules:[{required:!1,message:""}]}},"items[0].device_category_name":{title:"设备分类",search:{show:!1},type:"input",column:{show:!1,minWidth:120},form:{show:!0,component:{placeholder:""}}}}}}};export{v as createCrudOptions};
