import{r as a,D as i,m as c,S as l,s as u,w as s}from"./index.Df8UJ10K.js";import{b as d,c as m,D as h,U as p,A as w,d as f}from"./api.w1hqyo_f.js";import"./vue.D1BjjNmv.js";const x=function({crudExpose:o,inventoryDialog:r,inventoryDetailDialog:n}){return{crudOptions:{request:{pageRequest:async e=>await f(e),addRequest:async({form:e})=>await w(e),editRequest:async({form:e,row:t})=>(e.id=t.id,await p(e)),delRequest:async({row:e})=>await h(e.id)},form:{wrapper:{buttons:{ok:{text:"提交",show:a(e=>e.mode!=="view")}}}},actionbar:{buttons:{add:{show:!1},startTaking:{text:"开始盘点",click:async()=>{const e=await m({remark:"例行盘点"});(e==null?void 0:e.code)===2e3&&(r.value.setCheckNo(e.data.check_no),r.value.visible=!0)}}}},toolbar:{show:!1},rowHandle:{fixed:"right",width:220,buttons:{view:{show:!0,click:async({row:e})=>{try{const t=await d(e.id);if((t==null?void 0:t.code)===2e3){n.value.openWithData(t.data);return}s((t==null?void 0:t.message)||"获取详情失败")}catch(t){console.error(t),s("获取详情异常")}}},remove:{show:!1},edit:{show:!1},reanalyze:{text:"取消",iconRight:"",type:"danger",show:a(({row:e})=>e.status===0),order:2,click:async({row:e})=>{try{const t=await c.post(`http://127.0.0.1:8086/api/system/inventory/check-records/${e.id}/cancel/`,{},{headers:{authorization:`JWT ${l.get("token")}`}});if(console.log(t),t.data.code==2e3){u(t.data.msg||"盘点已取消"),o.doSearch();return}}catch(t){console.error("取消失败:",t),s("取消失败")}}}}},pagination:{show:!0},columns:{_index:{title:"序号",form:{show:!1},column:{type:"index",align:"center",width:"70px",columnSetDisabled:!0}},check_no:{title:"编号",search:{show:!0},treeNode:!0,type:"input",column:{minWidth:120},form:{show:!0,rules:[{required:!0,message:"名称必填项"}],component:{placeholder:"请输入"}},viewForm:{component:{placeholder:""},rules:[{required:!0,message:""}]}},start_time:{title:"盘点日期",type:"datetime",column:{minWidth:120},form:{show:!1,component:{placeholder:"请填写盘点日期"},rules:[{required:!0,message:"请填写盘点日期"}]},viewForm:{component:{placeholder:""},rules:[{required:!0,message:""}]},valueResolve({form:e,value:t}){e.start_time=t?i(t).format("YYYY-MM-DD HH:mm:ss"):null}},checker_name:{title:"盘点人",type:"input",column:{minWidth:120},form:{show:!1,component:{placeholder:"请填写盘点人"},rules:[{required:!1,message:"请填写盘点人"}]},viewForm:{component:{placeholder:""},rules:[{required:!1,message:""}]}},status_display:{title:"状态",search:{show:!1},treeNode:!0,type:"input",column:{minWidth:120},form:{show:!1,rules:[{required:!0,message:"维护标题必填项"}],component:{placeholder:"请输入维护标题"}},viewForm:{component:{placeholder:""},rules:[{required:!0,message:""}]}}}}}};export{x as createCrudOptions};
