import{u as De,G as ne,r as d,_ as X,ad as se,f as Se,g as s,ac as Y,o as f,j as w,w as a,k as o,h as Z,l as H,Y as V,m as U,i as e,N as u,t as k,X as ue,Q as Ie,a4 as Ce,an as Ue,L as $e,Z as pe,ai as We}from"./vendor.0bc3c1d4.js";import{Q as Ae,$ as Ne,a0 as ie,P as re,a1 as ce}from"./index.b54ecd6f.js";import{g as de,l as Ee,u as Re,a as Te}from"./applyPurchase.ebfca107.js";const Le={class:"flex"},je={class:"flex-sub"},Be={class:"flex"},qe=u("\u7269\u6599\u7BA1\u7406-\u7269\u6599\u7533\u8D2D\u8BE6\u60C5\u4FE1\u606F"),Qe={class:"padding-left",style:{width:"30%","max-width":"400px"}},ze={key:0,class:""},Fe=u("\u64A4 \u56DE"),Ke=u("\u7F16 \u8F91"),Oe={props:{applyPurchaseId:{type:[Number,String],default:null}},emits:["update"],setup(ee,{expose:m,emit:$}){const B=ee,{proxy:D,ctx:g}=ue(),{com_apply_state:b}=D.useDict("com_apply_state"),W=De(),A=ne(),S=d(!1),I=d(!0),{applyPurchaseId:x}=X(B),q=se({form:{}}),{form:r}=X(q);Se(()=>{let v=0;return Object.values(W.state.data.applyPurchaseDetails).map(c=>{v+=c.applyPurchaseNum}),v});function N(){S.value=!0,I.value=!0,Ie(()=>{T()})}function E(){r.value={},S.value=!1,$("update",!0)}function T(){x.value&&de(x.value).then(v=>{r.value=v.data,I.value=!1})}function h(){D.$modal.confirm("\u662F\u5426\u64A4\u56DE\uFF1F").then(()=>{ie(r.value.applyPurchaseId).then(()=>{D.$modal.msg("\u5DF2\u64A4\u56DE"),T(),$("update",!0)})}).catch(()=>{})}function y(){re(!1),r.value.applyPurchaseDetailsList.map(v=>ce(v,!1)),A.push("/impa/impa?showApplyPurchaseDrawerSubmit=true"),E()}return m({show:N,handleClose:E}),(v,c)=>{const C=s("el-descriptions-item"),Q=s("dict-tag"),R=s("el-descriptions"),z=s("el-divider"),L=s("el-button"),F=s("el-drawer"),K=Y("loading");return f(),w(F,{modelValue:S.value,"onUpdate:modelValue":c[0]||(c[0]=O=>S.value=O),title:"\u7533\u8D2D\u6E05\u5355","before-close":E,direction:"rtl","custom-class":"demo-drawer","modal-class":"el-subscribe-drawer",size:"80%"},{footer:a(()=>[o(x)?(f(),Z("div",ze,[o(r).applyPurchaseState==10?(f(),w(L,{key:0,plain:"",onClick:h},{default:a(()=>[Fe]),_:1})):o(r).applyPurchaseState==50?(f(),w(L,{key:1,plain:"",onClick:y},{default:a(()=>[Ke]),_:1})):H("",!0)])):H("",!0)]),default:a(()=>[V((f(),Z("div",Le,[U("div",je,[e(R,{column:2,border:""},{default:a(()=>[e(C,{label:"\u521B\u5EFA\u8005"},{default:a(()=>[u(k(o(r).nickName),1)]),_:1}),e(C,{label:"\u521B\u5EFA\u65F6\u95F4"},{default:a(()=>[u(k(v.parseTime(o(r).createTime)),1)]),_:1}),e(C,{label:"\u7533\u8D2D\u72B6\u6001",span:2},{default:a(()=>[U("div",Be,[e(Q,{options:o(b),value:o(r).applyPurchaseState},null,8,["options","value"])])]),_:1}),e(C,{label:"\u7533\u8D2D\u8BF4\u660E",span:2},{default:a(()=>[u(k(o(r).applyPurchaseExplain),1)]),_:1})]),_:1}),e(z,{"content-position":"center"},{default:a(()=>[qe]),_:1}),e(o(Ae),{list:o(r).applyPurchaseDetailsList,editable:!1},null,8,["list"])]),U("div",Qe,[e(o(Ne),{list:o(r).wfJobList},null,8,["list"])])])),[[K,I.value]])]),_:1},8,["modelValue"])}}},Ge={class:"app-container"},Je=u("\u641C\u7D22 "),Me=u("\u91CD\u7F6E"),Xe=u("\u5BFC\u51FA "),Ye={class:"padding"},Ze=u("\u8BE6\u7EC6 "),He=u("\u64A4\u56DE "),ea=u("\u7F16\u8F91 "),aa=u("\u7269\u6599\u7BA1\u7406-\u7269\u6599\u7533\u8D2D\u8BE6\u60C5\u4FE1\u606F"),la=u("\u6DFB\u52A0"),ta=u("\u5220\u9664"),oa={class:"dialog-footer"},na=u("\u786E \u5B9A"),sa=u("\u53D6 \u6D88"),ua=Ce({name:"ApplyPurchase"}),ca=Object.assign(ua,{setup(ee){const{proxy:m}=ue(),{com_apply_state:$}=m.useDict("com_apply_state"),B=ne(),D=d([]),g=d([]),b=d(!1),W=d(!0),A=d(!0),S=d([]),I=d(null),x=d([]),q=d(!0),r=d(!0),N=d(0),E=d(""),T=se({form:{},queryParams:{pageNum:1,pageSize:10,applyPurchaseExplain:null},rules:{}}),{queryParams:h,form:y,rules:v}=X(T);function c(){W.value=!0,Ee(h.value).then(t=>{D.value=t.rows,N.value=t.total,W.value=!1})}function C(){b.value=!1,Q()}function Q(){y.value={applyPurchaseId:null,applyPurchaseExplain:null,createBy:null,createTime:null,updateBy:null,updateTime:null,remark:null},g.value=[],m.resetForm("applyPurchaseRef")}function R(){h.value.pageNum=1,c()}function z(){m.resetForm("queryRef"),R()}function L(t){S.value=t.map(n=>n.applyPurchaseId),q.value=t.length!=1,r.value=!t.length}function F(){m.$refs.applyPurchaseRef.validate(t=>{t&&(y.value.applyPurchaseDetailsList=g.value,y.value.applyPurchaseId!=null?Re(y.value).then(n=>{m.$modal.msgSuccess("\u4FEE\u6539\u6210\u529F"),b.value=!1,c()}):Te(y.value).then(n=>{m.$modal.msgSuccess("\u65B0\u589E\u6210\u529F"),b.value=!1,c()}))})}function K({row:t,rowIndex:n}){t.index=n+1}function O(){let t={};t.applyPurchaseNum="",t.materialWarehouseImpa="",t.materialWarehouseImpaCode="",t.materialWarehouseImpaDescription="",t.materialWarehouseImpaUnit="",t.materialWarehouseImpaSpecifications="",t.remark="",g.value.push(t)}function me(){if(x.value.length==0)m.$modal.msgError("\u8BF7\u5148\u9009\u62E9\u8981\u5220\u9664\u7684\u7269\u6599\u7BA1\u7406-\u7269\u6599\u7533\u8D2D\u8BE6\u60C5\u6570\u636E");else{const t=g.value,n=x.value;g.value=t.filter(function(_){return n.indexOf(_.index)==-1})}}function he(t){x.value=t.map(n=>n.index)}function _e(){downloadApplyPurchase(h.value)}function fe(t){I.value=t.applyPurchaseId,m.$refs.applyPurchaseDetailSubmitRef.show()}function ye(t){m.$modal.confirm("\u662F\u5426\u64A4\u56DE\uFF1F").then(()=>{ie(t.applyPurchaseId).then(()=>{m.$modal.msg("\u5DF2\u64A4\u56DE"),c()})}).catch(()=>{})}function ve(t){de(t.applyPurchaseId).then(n=>{re(!1),n.data.applyPurchaseDetailsList.map(_=>ce(_,!1)),B.push("/impa/impa?showApplyPurchaseDrawerSubmit=true")})}return Ue(()=>{c()}),$e(()=>{c()}),(t,n)=>{const _=s("el-input"),G=s("el-form-item"),P=s("el-button"),ae=s("el-form"),J=s("el-col"),Pe=s("right-toolbar"),le=s("el-row"),j=s("el-descriptions-item"),te=s("dict-tag"),we=s("el-descriptions"),p=s("el-table-column"),oe=s("el-table"),ge=s("pagination"),be=s("el-divider"),xe=s("el-input-number"),Ve=s("el-dialog"),M=Y("hasPermi"),ke=Y("loading");return f(),Z("div",Ge,[V(e(ae,{model:o(h),ref:"queryRef",inline:!0,"label-width":"68px"},{default:a(()=>[e(G,{label:"\u7533\u8D2D\u8BF4\u660E",prop:"applyPurchaseExplain"},{default:a(()=>[e(_,{maxlength:"100",modelValue:o(h).applyPurchaseExplain,"onUpdate:modelValue":n[0]||(n[0]=l=>o(h).applyPurchaseExplain=l),placeholder:"\u8BF7\u8F93\u5165\u7533\u8D2D\u8BF4\u660E",clearable:"",onKeyup:We(R,["enter"])},null,8,["modelValue","onKeyup"])]),_:1}),e(G,null,{default:a(()=>[e(P,{type:"primary",icon:"Search",onClick:R},{default:a(()=>[Je]),_:1}),e(P,{icon:"Refresh",onClick:z},{default:a(()=>[Me]),_:1})]),_:1})]),_:1},8,["model"]),[[pe,A.value]]),e(le,{gutter:10,class:"mb8",style:{"min-height":"32px"}},{default:a(()=>[V((f(),w(J,{span:1.5},{default:a(()=>[e(P,{type:"warning",plain:"",icon:"Download",onClick:_e},{default:a(()=>[Xe]),_:1})]),_:1},8,["span"])),[[M,["applyPurchase:applyPurchase:export"]]]),e(Pe,{showSearch:A.value,"onUpdate:showSearch":n[1]||(n[1]=l=>A.value=l),onQueryTable:c},null,8,["showSearch"])]),_:1}),V((f(),w(oe,{data:D.value,onSelectionChange:L},{default:a(()=>[e(p,{type:"expand",width:"30"},{default:a(l=>[U("div",Ye,[e(we,{column:1},{default:a(()=>[e(j,{label:"\u7533\u8D2D\u8BF4\u660E"},{default:a(()=>[u(k(l.row.applyPurchaseExplain),1)]),_:2},1024),e(j,{label:"\u7533\u8D2D\u72B6\u6001"},{default:a(()=>[e(te,{options:o($),value:l.row.applyPurchaseState,style:{display:"inline-block"}},null,8,["options","value"])]),_:2},1024),e(j,{label:"\u521B\u5EFA\u8005"},{default:a(()=>[u(k(l.row.nickName),1)]),_:2},1024),e(j,{label:"\u521B\u5EFA\u65F6\u95F4"},{default:a(()=>[u(k(t.parseTime(l.row.createTime)),1)]),_:2},1024)]),_:2},1024)])]),_:1}),e(p,{label:"\u5E8F\u53F7",align:"center",type:"index",width:"50"}),e(p,{label:"\u7533\u8D2D\u8BF4\u660E",align:"center",prop:"applyPurchaseExplain","show-overflow-tooltip":!0}),e(p,{label:"\u72B6\u6001",align:"center",prop:"applyPurchaseState"},{default:a(l=>[e(te,{options:o($),value:l.row.applyPurchaseState},null,8,["options","value"])]),_:1}),e(p,{label:"\u521B\u5EFA\u8005",align:"center",prop:"nickName"}),e(p,{label:"\u521B\u5EFA\u65F6\u95F4",align:"center",prop:"createTime",width:"180"},{default:a(l=>[U("span",null,k(t.parseTime(l.row.createTime)),1)]),_:1}),V((f(),w(p,{label:"\u64CD\u4F5C",align:"center","class-name":"small-padding fixed-width",width:"200",fixed:"right"},{default:a(l=>[V((f(),w(P,{link:"",type:"primary",icon:"View",onClick:i=>fe(l.row)},{default:a(()=>[Ze]),_:2},1032,["onClick"])),[[M,["applyPurchase:applyPurchase:query"]]]),l.row.isWithdraw=="1"?(f(),w(P,{key:0,link:"",icon:"SwitchButton",type:"success",onClick:i=>ye(l.row)},{default:a(()=>[He]),_:2},1032,["onClick"])):l.row.applyPurchaseState=="50"?(f(),w(P,{key:1,link:"",icon:"Edit",type:"success",onClick:i=>ve(l.row)},{default:a(()=>[ea]),_:2},1032,["onClick"])):H("",!0)]),_:1})),[[M,["applyPurchase:applyPurchase:query","applyPurchase:applyPurchase:remove"]]])]),_:1},8,["data"])),[[ke,W.value]]),V(e(ge,{total:N.value,page:o(h).pageNum,"onUpdate:page":n[2]||(n[2]=l=>o(h).pageNum=l),limit:o(h).pageSize,"onUpdate:limit":n[3]||(n[3]=l=>o(h).pageSize=l),onPagination:c},null,8,["total","page","limit"]),[[pe,N.value>0]]),e(Ve,{title:E.value,modelValue:b.value,"onUpdate:modelValue":n[5]||(n[5]=l=>b.value=l),width:"1000px","append-to-body":""},{footer:a(()=>[U("div",oa,[e(P,{type:"primary",onClick:F},{default:a(()=>[na]),_:1}),e(P,{onClick:C},{default:a(()=>[sa]),_:1})])]),default:a(()=>[e(ae,{ref:"applyPurchaseRef",model:o(y),rules:o(v),"label-width":"80px"},{default:a(()=>[e(G,{label:"\u7533\u8D2D\u8BF4\u660E",prop:"applyPurchaseExplain"},{default:a(()=>[e(_,{maxlength:"300",modelValue:o(y).applyPurchaseExplain,"onUpdate:modelValue":n[4]||(n[4]=l=>o(y).applyPurchaseExplain=l),type:"textarea",placeholder:"\u8BF7\u8F93\u5165\u5185\u5BB9"},null,8,["modelValue"])]),_:1}),e(be,{"content-position":"center"},{default:a(()=>[aa]),_:1}),e(le,{gutter:10,class:"mb8",style:{"min-height":"32px"}},{default:a(()=>[e(J,{span:1.5},{default:a(()=>[e(P,{type:"primary",icon:"Plus",onClick:O},{default:a(()=>[la]),_:1})]),_:1},8,["span"]),e(J,{span:1.5},{default:a(()=>[e(P,{type:"danger",icon:"Delete",onClick:me},{default:a(()=>[ta]),_:1})]),_:1},8,["span"])]),_:1}),e(oe,{data:g.value,"row-class-name":K,onSelectionChange:he,ref:"applyPurchaseDetails"},{default:a(()=>[e(p,{type:"selection",width:"50",align:"center"}),e(p,{label:"\u5E8F\u53F7",align:"center",prop:"index",width:"50"}),e(p,{label:"\u7533\u8D2D\u6570\u91CF",prop:"applyPurchaseNum",width:"150"},{default:a(l=>[e(xe,{modelValue:l.row.applyPurchaseNum,"onUpdate:modelValue":i=>l.row.applyPurchaseNum=i,min:1,step:1},null,8,["modelValue","onUpdate:modelValue"])]),_:1}),e(p,{label:"impa",prop:"materialWarehouseImpa",width:"150"},{default:a(l=>[e(_,{maxlength:"100",modelValue:l.row.materialWarehouseImpa,"onUpdate:modelValue":i=>l.row.materialWarehouseImpa=i,placeholder:"\u8BF7\u8F93\u5165impa"},null,8,["modelValue","onUpdate:modelValue"])]),_:1}),e(p,{label:"\u7269\u6599\u76EE\u5F55\u7F16\u53F7",prop:"materialWarehouseImpaCode",width:"150"},{default:a(l=>[e(_,{maxlength:"100",modelValue:l.row.materialWarehouseImpaCode,"onUpdate:modelValue":i=>l.row.materialWarehouseImpaCode=i,placeholder:"\u8BF7\u8F93\u5165\u7269\u6599\u76EE\u5F55\u7F16\u53F7"},null,8,["modelValue","onUpdate:modelValue"])]),_:1}),e(p,{label:"\u63CF\u8FF0",prop:"materialWarehouseImpaDescription",width:"150"},{default:a(l=>[e(_,{maxlength:"100",modelValue:l.row.materialWarehouseImpaDescription,"onUpdate:modelValue":i=>l.row.materialWarehouseImpaDescription=i,placeholder:"\u8BF7\u8F93\u5165\u63CF\u8FF0"},null,8,["modelValue","onUpdate:modelValue"])]),_:1}),e(p,{label:"\u5355\u4F4D",prop:"materialWarehouseImpaUnit",width:"150"},{default:a(l=>[e(_,{maxlength:"100",modelValue:l.row.materialWarehouseImpaUnit,"onUpdate:modelValue":i=>l.row.materialWarehouseImpaUnit=i,placeholder:"\u8BF7\u8F93\u5165\u5355\u4F4D"},null,8,["modelValue","onUpdate:modelValue"])]),_:1}),e(p,{label:"\u89C4\u683C",prop:"materialWarehouseImpaSpecifications",width:"150"},{default:a(l=>[e(_,{maxlength:"100",modelValue:l.row.materialWarehouseImpaSpecifications,"onUpdate:modelValue":i=>l.row.materialWarehouseImpaSpecifications=i,placeholder:"\u8BF7\u8F93\u5165\u89C4\u683C"},null,8,["modelValue","onUpdate:modelValue"])]),_:1}),e(p,{label:"\u5907\u6CE8",prop:"remark",width:"150"},{default:a(l=>[e(_,{maxlength:"300",modelValue:l.row.remark,"onUpdate:modelValue":i=>l.row.remark=i,type:"textarea",placeholder:"\u8BF7\u8F93\u5165\u5907\u6CE8"},null,8,["modelValue","onUpdate:modelValue"])]),_:1})]),_:1},8,["data"])]),_:1},8,["model","rules"])]),_:1},8,["title","modelValue"]),e(o(Oe),{applyPurchaseId:I.value,ref:"applyPurchaseDetailSubmitRef",onUpdate:c},null,8,["applyPurchaseId"])])}}});export{ca as default};