crud.zTuoZC1l.js 4.4 KB

1
  1. import{r as o,p as l,W as n,H as u,E as a}from"./index.BKEMpsLA.js";import{a as i}from"./authFunction.DqglRaEG.js";const s="/api/system/device-damage-records/";function d(t){return o({url:s+"?damage_type=0",method:"get",params:t})}function m(t){return o({url:s,method:"post",data:t})}function c(t){return o({url:s+t.id+"/",method:"put",data:t})}function p(t){return o({url:s+t+"/",method:"delete",data:{id:t}})}function _(){return o({url:s+"?damage_type=0",method:"get"})}function h(t){return o({url:s+t.id+"/cancel_damage/",method:"post",data:t})}const g=function({crudExpose:t}){return{crudOptions:{request:{pageRequest:async e=>await d(e),addRequest:async({form:e})=>await m(e),editRequest:async({form:e,row:r})=>(e.id=r.id,await c(e)),delRequest:async({row:e})=>await p(e.id)},form:{wrapper:{buttons:{ok:{text:"提交"}}}},actionbar:{buttons:{add:{show:i("area:Create")}}},toolbar:{show:!1},rowHandle:{fixed:"right",width:220,buttons:{remove:{show:!0},edit:{show:!0},cancelDamage:{text:"撤销报损",type:"danger",order:98,show:!0,click({row:e}){u.confirm("确认撤销该报损记录?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(async()=>{try{const r=await h(e);console.log("res::::",r),r.code===2e3?(a.success("撤销成功"),t.doRefresh()):a.error(r.msg||"撤销失败")}catch{a.error("请求失败")}}).catch(()=>{})}}}},pagination:{show:!1},columns:{_index:{title:"序号",form:{show:!1},column:{type:"index",align:"center",width:"70px",columnSetDisabled:!0}},damage_no:{title:"编号",search:{show:!0},treeNode:!0,type:"input",column:{minWidth:120},form:{show:!1,component:{placeholder:"请输入编号"}},viewForm:{component:{placeholder:""},rules:[{required:!0,message:""}]}},device:{title:"设备id",type:"dict-select",column:{show:!1,minWidth:120},dict:n({url:"/api/system/device/",value:"id",label:"name"}),form:{component:{placeholder:"请填写设备id"},rules:[{required:!0,message:"请填写设备id"}]},editForm:{component:{disabled:!0}},viewForm:{component:{placeholder:""},rules:[{required:!0,message:""}]}},device_code:{title:"设备编码",type:"input",column:{show:!1,minWidth:120},form:{show:!0,component:{placeholder:"请填写设备编码"},rules:[{required:!0,message:"请填写设备编码"}]},viewForm:{component:{placeholder:""},rules:[{required:!0,message:""}]}},device_name:{title:"设备名称",type:"input",column:{show:!0,minWidth:120},form:{show:!1,component:{placeholder:"请填写设备名称"},rules:[{required:!0,message:"请填写设备名称"}]},viewForm:{component:{placeholder:""},rules:[{required:!0,message:""}]}},quantity:{title:"库存数量",type:"input",column:{minWidth:120},form:{component:{placeholder:"请填写库存数量"},rules:[{required:!1,message:"请填写库存数量"}]},editForm:{component:{disabled:!0}},valueResolve({form:e,value:r}){e.quantity=Number(r)},viewForm:{component:{placeholder:""},rules:[{required:!0,message:""}]}},damage_type:{title:"报损类型",type:"dict-select",dict:n({data:[{label:"报废",value:0}]}),column:{minWidth:120},form:{value:0,show:!0,component:{placeholder:"请填写报损类型"},rules:[{required:!1,message:"请填写报损类型"}]},editForm:{component:{disabled:!0}},viewForm:{component:{placeholder:""},rules:[{required:!0,message:""}]}},damage_reason:{title:"原因",type:"input",column:{minWidth:120},form:{component:{placeholder:"请填写原因"},rules:[{required:!1,message:"请填写原因"}]},viewForm:{component:{placeholder:""},rules:[{required:!0,message:""}]}},estimated_loss:{title:"维修费用",type:"input",column:{minWidth:120,show:!1},form:{show:!1,component:{placeholder:"请填写维修费用"},rules:[{required:!1,message:"请填写维修费用"}]},viewForm:{component:{placeholder:""},rules:[{required:!0,message:""}],show:l(({form:e})=>e&&e.damage_type===1)}},responsible_person:{title:"负责人",type:"input",column:{minWidth:120},form:{component:{placeholder:"请填写负责人"},rules:[{required:!1,message:"请填写负责人"}]},viewForm:{component:{placeholder:""},rules:[{required:!0,message:""}]}},status_display:{title:"状态",type:"input",column:{minWidth:120},form:{show:!1,component:{placeholder:"请填写负责人"},rules:[{required:!1,message:"请填写负责人"}]},viewForm:{component:{placeholder:""},rules:[{required:!0,message:""}]}}}}}},F=Object.freeze(Object.defineProperty({__proto__:null,createCrudOptions:g},Symbol.toStringTag,{value:"Module"}));export{_ as G,F as a,g as c};