crud.Chw_tWQI.js 5.1 KB

1
  1. import{T as u,m as a,U as d,F as l}from"./index.T0of0op1.js";import{D as p,U as h,A as f,G as y}from"./api.B0HOyHA-.js";import{a as i}from"./authFunction.occvKyd3.js";import{c as w}from"./commonCrud.Db8L5PNB.js";import"./vue.Bi2Y_N79.js";const Y=function({crudExpose:o}){const s=async e=>await y(e),n=async({form:e,row:t})=>(e.id=t.id,await h(e)),m=async({row:e})=>await p(e.id),c=async({form:e})=>await f(e);return u.get(),{crudOptions:{request:{pageRequest:s,addRequest:c,editRequest:n,delRequest:m},toolbar:{show:!1},actionbar:{buttons:{add:{show:i("user:Create")},batchimport:{text:"批量导入",title:"导入"},export:{text:"导出",title:"导出",show:i("user:Export")},downloadtemplate:{text:"下载模板",title:"下载模板"},batchdelete:{text:"批量删除",title:"批量删除"}}},columns:{_index:{title:"序号",form:{show:!1},column:{align:"center",width:"70px",columnSetDisabled:!0,formatter:e=>{let t=e.index??1,r=o.crudBinding.value.pagination;return((r.currentPage??1)-1)*r.pageSize+t+1}}},code:{title:"设备编号",search:{show:!0},type:"input",column:{minWidth:120},form:{component:{placeholder:"请输入设备编号"},rules:[{required:!0,message:"请输入设备编号"}]}},category_name:{title:"设备分类",search:{show:!0},type:"dict-select",dict:a({url:"/api/system/device/category/",value:"id",label:"name"}),column:{minWidth:100},form:{show:!1,component:{placeholder:"请选择设备分类"},rules:[{required:!0,message:"请选择设备分类"}]}},name:{title:"设备名称",search:{show:!1},type:"input",column:{minWidth:120},form:{component:{placeholder:"请输入设备名称"},rules:[{required:!0,message:"请输入设备名称"}]}},status:{title:"设备状态",type:"dict-select",search:{show:!1},dict:a({data:[{label:"在借",value:1},{label:"空闲",value:2}]}),column:{minWidth:100},form:{component:{placeholder:"请选择设备状态"},rules:[{required:!0,message:"请选择设备状态"}]}},brand:{title:"品牌",type:"input",column:{minWidth:100}},specification:{title:"规格型号",search:{show:!1},type:"input",column:{minWidth:100},form:{component:{placeholder:"请输入规格型号"}}},serial_number:{title:"序列号",type:"input",column:{minWidth:100}},total_quantity:{title:"库存数量",type:"input",column:{minWidth:100}},warehouse:{title:"库存仓库",type:"dict-select",column:{minWidth:150},dict:a({url:"/api/system/warehouse/",value:"id",label:"name"}),form:{component:{placeholder:"请选择库存仓库"}}},is_visible:{title:"是否可见",type:"dict-select",column:{minWidth:120},dict:a({data:[{label:"可见",value:!0},{label:"隐藏",value:!1}]}),form:{component:{placeholder:"请输入是否可见"}}},department:{title:"所属部门",search:{show:!1},type:"input",column:{minWidth:120},form:{component:{placeholder:"请输入所属部门"}}},purchase_date:{title:"采购时间",type:"date",search:{show:!1},column:{minWidth:120,formatter:({value:e})=>e?l(e).format("YYYY-MM-DD"):""},form:{component:{placeholder:"请选择购买日期"},rules:[{required:!0,message:"请选择购买日期"}]},valueResolve({form:e,value:t}){e.purchase_date=t?l(t).format("YYYY-MM-DD"):null},valueBuilder({form:e,value:t}){e.purchase_date=t}},supplier:{title:"供应商",type:"dict-select",search:{show:!1},column:{minWidth:120},dict:a({url:"/api/system/supplier/",value:"id",label:"name"}),form:{component:{placeholder:"请输入供应商"}}},price:{title:"价格",type:"number",search:{show:!1},column:{minWidth:100},form:{component:{placeholder:"请输入设备购入价格"},rules:[{required:!0,message:"请输入设备购入价格"}]}},warranty_expiration:{title:"保质期",type:"date",search:{show:!1},column:{minWidth:120,formatter:({value:e})=>e?l(e).format("YYYY-MM-DD"):""},form:{component:{placeholder:"请选择购买日期"},rules:[{required:!0,message:"请选择购买日期"}]},valueResolve({form:e,value:t}){e.warranty_expiration=t?l(t).format("YYYY-MM-DD"):null},valueBuilder({form:e,value:t}){e.warranty_expiration=t}},image:{title:"设备图片",type:"image-uploader",column:{minWidth:120,show:!1},form:{component:{limit:1,uploader:{type:"form"}},rules:d([{required:!0,message:"此项必传",trigger:"change"}]),helper:"上传设备图片"}},tenant_id:{title:"租户id",type:"dict-select",column:{minWidth:120},dict:a({url:"/api/system/tenant/list/",value:"id",label:"name"}),form:{component:{placeholder:"请填租户id"},rules:[{required:!1,message:"请填租户id"}]}},category:{show:!1,title:"类别id",search:{show:!1},type:"dict-select",column:{show:!1,minWidth:120},dict:a({url:"/api/system/device/category/",value:"id",label:"name"}),form:{component:{placeholder:"请输入类别id"}}},quantity:{show:!1,title:"数量",search:{show:!1},type:"input",column:{show:!1,minWidth:120},form:{component:{placeholder:"请输入数量"}}},tags:{show:!1,title:"设备标签",search:{show:!1},type:"dict-select",column:{show:!1,minWidth:120},dict:a({url:"/api/system/device_tags/",value:"id",label:"name"}),form:{component:{placeholder:"请选择设备标签"},valueResolve({form:e,value:t}){e.tags=Array.from(String(t),Number)},valueBuilder({form:e,value:t}){e.tags=Array.from(String(t),Number)}}},...w({create_datetime:{search:!1},update_datetime:{search:!1}})}}}};export{Y as createCrudOptions};