You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
9.6KB

  1. import{E as H,y as K,x as Q,r as w,o as W,b as i,c as y,d as P,f as l,h as a,i as _,u as f,e as V,t as D,L as g,j as b,N as x,k as X,s as Z}from"./index-dd5fae99.js";import{h as ee,f as te,b as R,c as ae,e as le,g as ne,r as oe}from"./uploadAction-3962500e.js";import{s as ue,a as re,c as me}from"./contractRecord-8df6539a.js";const se={class:"fillPurchasingResult footerPage"},ie={class:"el-upload__tip"},de=["onClick"],pe={key:1,class:"text-danger text-14"},ye={class:"footer"},fe=X({name:"fillContractInfo"}),_e=Object.assign(fe,{setup(ce){const T=H.dictStore.uploadUrl,{proxy:A}=Z(),$=K(),h=Q(),k=w(),q=(o,t,u)=>{t||u(),/^\d+(\.\d{1,6})?$/.test(t)?t*1>=1e8?u("请输入正确格式,小于100000000"):u():u("请输入正确格式,最多保留六位小数")},U={name:[{required:!0,message:"请输入合同名称"}],totalAmount:[{required:!0,message:"请输入合同总金额"},{validator:q,trigger:"blur"}],supplierBank:[{required:!0,message:"请输入供应商收款开户行"}],supplierAccount:[{required:!0,message:"请输入供应商收款账号"}],warrantyPeriod:[{required:!0,message:"请输入质保期"}],retentionMoney:[{required:!0,message:"请输入质保金"},{validator:q,trigger:"blur"}],contractTime:[{required:!0,message:"请选择合同签订完成时间"}],deliveryTime:[{required:!0,message:"请选择交货日期"}],attachment:[{required:!0,message:"请上传合同附件"}]},n=w({attachment:[],payments:[]}),Y=w([{label:"付款笔数",key:"number",slot:"number"},{label:"付款计划",key:"planAmount",slot:"planAmount"},{label:"付款比例(%)",key:"ratio",slot:"ratio"},{label:"付款金额(万元)",key:"paymentAmount",slot:"paymentAmount"},{label:"预计付款时间",key:"paymentTime",slot:"paymentTime"},{label:"操作",key:"action",slot:"action",width:80}]),C=()=>{n.value.payments.push({})},B=o=>{n.value.payments.splice(o,1)},N=o=>{o.ratio=Math.floor(o.paymentAmount/n.value.totalAmount*1*100*100)/100},c=w(!1),j=async o=>{console.log(n.value),o&&o.validate(async(t,u)=>{var r;if(t)if(h.query.isReplenishment)F();else{if(!((r=n.value.payments)!=null&&r.length)){A.$message.warning("请至少添加一个付款计划");return}if(n.value.payments.reduce((s,v)=>s+v.paymentAmount,0)!==n.value.totalAmount){A.$message.warning("付款金额总和必须等于合同总金额");return}c.value=!0;const p={...n.value,projectId:h.query.id,attachment:n.value.attachment&&JSON.stringify(ne(n.value.attachment))};try{await ue(p),c.value=!1,A.$message.success("提交成功"),$.go(-1)}catch{c.value=!1}}})},F=async()=>{c.value=!0;try{const o=[];n.value.payments.forEach(t=>{(t.actualPaymentAmount||t.actualPaymentAmount===0)&&!t.isReplenishment&&o.push({actualPaymentAmount:t.actualPaymentAmount,id:t.id,projectCode:t.projectCode})}),await re(o),A.$message.success("提交成功"),$.go(-1),c.value=!1}catch{c.value=!1}},S=async()=>{var t;const o=await me(h.query.id);o.data&&(n.value={...o.data,attachment:o.data.attachment?oe(JSON.parse(o.data.attachment)):[],payments:((t=o.data.payments)==null?void 0:t.map(u=>({...u,isReplenishment:!!u.actualPaymentAmount})))||[]})},L=(o,t,u,r)=>{var d;if(t<0)u("实际支付金额必须大于等于0");else if(r===0)t>n.value.payments[r].paymentAmount&&u("实际支付金额不能超过合同计划付款金额");else{let p=n.value.payments[r].paymentAmount;for(let s=0;s<r;s++)p+=n.value.payments[s].paymentAmount-((d=n.value.payments[s])==null?void 0:d.actualPaymentAmount)||0;t>p&&u(`实际支付金额不能超过${p}万元`)}u()};return W(()=>{S(),h.query.isReplenishment&&(Y.value=[{label:"付款笔数",key:"number",slot:"number"},{label:"付款计划",key:"planAmount",slot:"planAmount"},{label:"付款比例(%)",key:"ratio",slot:"ratio"},{label:"付款金额(万元)",key:"paymentAmount",slot:"paymentAmount"},{label:"预计付款时间",key:"paymentTime",slot:"paymentTime"},{label:"实际支付金额(万元)",key:"actualPaymentAmount",slot:"actualPaymentAmount",width:180}])}),(o,t)=>{const u=i("el-input"),r=i("el-form-item"),d=i("el-col"),p=i("el-date-picker"),s=i("el-row"),v=i("el-button"),I=i("el-upload"),M=i("el-input-number"),O=i("table-list"),E=i("el-form"),J=i("el-card");return y(),P("div",se,[l(J,{class:"w-full"},{default:a(()=>[l(E,{ref_key:"formRef",ref:k,model:n.value,rules:U,"label-position":"right","label-width":"180px","label-suffix":":","scroll-to-error":""},{default:a(()=>[l(s,{gutter:40},{default:a(()=>[l(d,{span:12},{default:a(()=>[l(r,{label:"合同名称",prop:"name"},{default:a(()=>[l(u,{modelValue:n.value.name,"onUpdate:modelValue":t[0]||(t[0]=e=>n.value.name=e),maxlength:"50",placeholder:"请输入",disabled:!!o.$route.query.isReplenishment},null,8,["modelValue","disabled"])]),_:1})]),_:1}),l(d,{span:12},{default:a(()=>[l(r,{label:"合同总金额",prop:"totalAmount"},{default:a(()=>[l(u,{modelValue:n.value.totalAmount,"onUpdate:modelValue":t[1]||(t[1]=e=>n.value.totalAmount=e),modelModifiers:{number:!0},placeholder:"请填写",disabled:!!o.$route.query.isReplenishment},{suffix:a(()=>t[9]||(t[9]=[_("万元")])),_:1},8,["modelValue","disabled"])]),_:1})]),_:1}),l(d,{span:12},{default:a(()=>[l(r,{label:"合同签订完成时间",prop:"contractTime"},{default:a(()=>[l(p,{modelValue:n.value.contractTime,"onUpdate:modelValue":t[2]||(t[2]=e=>n.value.contractTime=e),type:"date",format:"YYYY-MM-DD","value-format":"YYYY-MM-DD",placeholder:"请选择"},null,8,["modelValue"])]),_:1})]),_:1}),l(d,{span:12},{default:a(()=>[l(r,{label:"交货日期",prop:"deliveryTime"},{default:a(()=>[l(p,{modelValue:n.value.deliveryTime,"onUpdate:modelValue":t[3]||(t[3]=e=>n.value.deliveryTime=e),type:"date",format:"YYYY-MM-DD","value-format":"YYYY-MM-DD",placeholder:"请选择"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),l(s,null,{default:a(()=>[l(d,{span:12},{default:a(()=>[l(r,{label:"合同附件",prop:"attachment"},{default:a(()=>[l(I,{"file-list":n.value.attachment,"onUpdate:fileList":t[4]||(t[4]=e=>n.value.attachment=e),class:"w-full",action:f(T),"on-success":e=>f(ee)(e,n.value.attachment),"before-upload":e=>f(te)(e,{types:f(R)}),accept:f(R).map(e=>`.${e}`).join(","),"on-preview":f(ae)},{tip:a(()=>[V("div",ie," 支持"+D(f(le))+"文件 ",1)]),default:a(()=>[l(v,{type:"primary",plain:""},{default:a(()=>t[10]||(t[10]=[_("选择文件")])),_:1})]),_:1},8,["file-list","action","on-success","before-upload","accept","on-preview"])]),_:1})]),_:1})]),_:1}),l(s,null,{default:a(()=>[l(d,{span:24},{default:a(()=>[l(O,{ref:"tableListRef",column:Y.value,data:n.value.payments,pagination:!1,"empty-temp":!1},{number:a(({scope:e})=>[V("span",null,"第"+D(e.$index+1)+"笔",1)]),planAmount:a(({scope:e})=>[e.$index>=0?(y(),g(r,{key:0,prop:`payments[${e.$index}].planAmount`,rules:[{required:!0,message:"请输入"}],"label-width":"0",style:{"margin-bottom":"0"}},{default:a(()=>[l(u,{modelValue:e.row.planAmount,"onUpdate:modelValue":m=>e.row.planAmount=m,placeholder:"请填写",disabled:!!o.$route.query.isReplenishment},null,8,["modelValue","onUpdate:modelValue","disabled"])]),_:2},1032,["prop"])):b("",!0)]),ratio:a(({scope:e})=>[e.$index>=0?(y(),g(r,{key:0,prop:`payments[${e.$index}].ratio`,rules:[{required:!0,message:"请输入"}],"label-width":"0",style:{"margin-bottom":"0"}},{default:a(()=>[l(u,{modelValue:e.row.ratio,"onUpdate:modelValue":m=>e.row.ratio=m,modelModifiers:{number:!0},placeholder:"自动计算",disabled:""},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])):b("",!0)]),paymentAmount:a(({scope:e})=>[e.$index>=0?(y(),g(r,{key:0,prop:`payments[${e.$index}].paymentAmount`,rules:[{required:!0,message:"请输入"}],"label-width":"0",style:{"margin-bottom":"0"}},{default:a(()=>[l(M,{modelValue:e.row.paymentAmount,"onUpdate:modelValue":m=>e.row.paymentAmount=m,placeholder:"请填写",min:0,controls:!1,disabled:!!o.$route.query.isReplenishment,onMousewheel:t[5]||(t[5]=x(()=>{},["prevent"])),onBlur:m=>N(e.row)},null,8,["modelValue","onUpdate:modelValue","disabled","onBlur"])]),_:2},1032,["prop"])):b("",!0)]),paymentTime:a(({scope:e})=>[e.$index>=0?(y(),g(r,{key:0,prop:`payments[${e.$index}].paymentTime`,rules:[{required:!0,message:"请选择"}],"label-width":"0",style:{"margin-bottom":"0"}},{default:a(()=>[l(p,{modelValue:e.row.paymentTime,"onUpdate:modelValue":m=>e.row.paymentTime=m,type:"date",format:"YYYY-MM-DD","value-format":"YYYY-MM-DD",placeholder:"请选择",disabled:!!o.$route.query.isReplenishment},null,8,["modelValue","onUpdate:modelValue","disabled"])]),_:2},1032,["prop"])):b("",!0)]),action:a(({scope:e})=>[V("a",{class:"text-danger",onClick:m=>B(e.$index)},"删除",8,de)]),actualPaymentAmount:a(({scope:e})=>[e.$index>=0?(y(),g(r,{key:0,"label-width":"0",prop:`payments[${e.$index}].actualPaymentAmount`,rules:[{validator:(m,z,G)=>L(m,z,G,e.$index)}],style:{"margin-bottom":"25px","margin-top":"20px"}},{default:a(()=>[l(M,{modelValue:e.row.actualPaymentAmount,"onUpdate:modelValue":m=>e.row.actualPaymentAmount=m,placeholder:"请填写",min:0,controls:!1,disabled:e.row.isReplenishment,onMousewheel:t[6]||(t[6]=x(()=>{},["prevent"]))},null,8,["modelValue","onUpdate:modelValue","disabled"])]),_:2},1032,["prop","rules"])):b("",!0)]),_:1},8,["column","data"]),o.$route.query.isReplenishment?b("",!0):(y(),g(v,{key:0,type:"primary",icon:"Plus",plain:"",class:"w-full mt-8",onClick:C},{default:a(()=>t[11]||(t[11]=[_("添加付款计划")])),_:1})),o.$route.query.isReplenishment?(y(),P("p",pe,"温馨提示:请谨慎填写实际支付金额,填写后不允许修改")):b("",!0)]),_:1})]),_:1})]),_:1},8,["model"])]),_:1}),V("div",ye,[l(v,{onClick:t[7]||(t[7]=e=>f($).go(-1))},{default:a(()=>t[12]||(t[12]=[_(" 返回 ")])),_:1}),l(v,{type:"primary",loading:c.value,onClick:t[8]||(t[8]=e=>j(k.value))},{default:a(()=>t[13]||(t[13]=[_(" 提交 ")])),_:1},8,["loading"])])])}}});export{_e as default};