您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

2 行
11KB

  1. import{d as H,B as K,y as Q,x as W,r as w,o as X,c as i,e as y,f as P,h as l,i as a,j as _,u as f,g as V,t as D,G as g,k as b,T as x,q as Z}from"./index.a2494fc2.js";import{h as ee,f as te,c as T,b as ae,e as le,g as ne,r as oe}from"./uploadAction.0eabe13b.js";import{s as ue,a as re,c as me}from"./contractRecord.0289fb37.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=H({name:"fillContractInfo"}),_e=Object.assign(fe,{setup(ce){const R=K.dictStore.uploadUrl,{proxy:A}=Z(),$=Q(),h=W(),k=w(),q=(o,t,u)=>{t||u(),/^\d+(\.\d{1,6})?$/.test(t)?t*1>=1e8?u("\u8BF7\u8F93\u5165\u6B63\u786E\u683C\u5F0F\uFF0C\u5C0F\u4E8E100000000"):u():u("\u8BF7\u8F93\u5165\u6B63\u786E\u683C\u5F0F\uFF0C\u6700\u591A\u4FDD\u7559\u516D\u4F4D\u5C0F\u6570")},U={name:[{required:!0,message:"\u8BF7\u8F93\u5165\u5408\u540C\u540D\u79F0"}],totalAmount:[{required:!0,message:"\u8BF7\u8F93\u5165\u5408\u540C\u603B\u91D1\u989D"},{validator:q,trigger:"blur"}],supplierBank:[{required:!0,message:"\u8BF7\u8F93\u5165\u4F9B\u5E94\u5546\u6536\u6B3E\u5F00\u6237\u884C"}],supplierAccount:[{required:!0,message:"\u8BF7\u8F93\u5165\u4F9B\u5E94\u5546\u6536\u6B3E\u8D26\u53F7"}],warrantyPeriod:[{required:!0,message:"\u8BF7\u8F93\u5165\u8D28\u4FDD\u671F"}],retentionMoney:[{required:!0,message:"\u8BF7\u8F93\u5165\u8D28\u4FDD\u91D1"},{validator:q,trigger:"blur"}],contractTime:[{required:!0,message:"\u8BF7\u9009\u62E9\u5408\u540C\u7B7E\u8BA2\u5B8C\u6210\u65F6\u95F4"}],deliveryTime:[{required:!0,message:"\u8BF7\u9009\u62E9\u4EA4\u8D27\u65E5\u671F"}],attachment:[{required:!0,message:"\u8BF7\u4E0A\u4F20\u5408\u540C\u9644\u4EF6"}]},n=w({attachment:[],payments:[]}),Y=w([{label:"\u4ED8\u6B3E\u7B14\u6570",key:"number",slot:"number"},{label:"\u4ED8\u6B3E\u8BA1\u5212",key:"planAmount",slot:"planAmount"},{label:"\u4ED8\u6B3E\u6BD4\u4F8B\uFF08%\uFF09",key:"ratio",slot:"ratio"},{label:"\u4ED8\u6B3E\u91D1\u989D\uFF08\u4E07\u5143\uFF09",key:"paymentAmount",slot:"paymentAmount"},{label:"\u9884\u8BA1\u4ED8\u6B3E\u65F6\u95F4",key:"paymentTime",slot:"paymentTime"},{label:"\u64CD\u4F5C",key:"action",slot:"action",width:80}]),C=()=>{n.value.payments.push({})},B=o=>{n.value.payments.splice(o,1)},j=o=>{o.ratio=Math.floor(o.paymentAmount/n.value.totalAmount*1*100*100)/100},c=w(!1),N=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("\u8BF7\u81F3\u5C11\u6DFB\u52A0\u4E00\u4E2A\u4ED8\u6B3E\u8BA1\u5212");return}if(n.value.payments.reduce((s,v)=>s+v.paymentAmount,0)!==n.value.totalAmount){A.$message.warning("\u4ED8\u6B3E\u91D1\u989D\u603B\u548C\u5FC5\u987B\u7B49\u4E8E\u5408\u540C\u603B\u91D1\u989D");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("\u63D0\u4EA4\u6210\u529F"),$.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("\u63D0\u4EA4\u6210\u529F"),$.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})))||[]})},I=(o,t,u,r)=>{var d;if(t<0)u("\u5B9E\u9645\u652F\u4ED8\u91D1\u989D\u5FC5\u987B\u5927\u4E8E\u7B49\u4E8E0");else if(r===0)t>n.value.payments[r].paymentAmount&&u("\u5B9E\u9645\u652F\u4ED8\u91D1\u989D\u4E0D\u80FD\u8D85\u8FC7\u5408\u540C\u8BA1\u5212\u4ED8\u6B3E\u91D1\u989D");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(`\u5B9E\u9645\u652F\u4ED8\u91D1\u989D\u4E0D\u80FD\u8D85\u8FC7${p}\u4E07\u5143`)}u()};return X(()=>{S(),h.query.isReplenishment&&(Y.value=[{label:"\u4ED8\u6B3E\u7B14\u6570",key:"number",slot:"number"},{label:"\u4ED8\u6B3E\u8BA1\u5212",key:"planAmount",slot:"planAmount"},{label:"\u4ED8\u6B3E\u6BD4\u4F8B\uFF08%\uFF09",key:"ratio",slot:"ratio"},{label:"\u4ED8\u6B3E\u91D1\u989D\uFF08\u4E07\u5143\uFF09",key:"paymentAmount",slot:"paymentAmount"},{label:"\u9884\u8BA1\u4ED8\u6B3E\u65F6\u95F4",key:"paymentTime",slot:"paymentTime"},{label:"\u5B9E\u9645\u652F\u4ED8\u91D1\u989D\uFF08\u4E07\u5143\uFF09",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"),L=i("el-upload"),M=i("el-input-number"),O=i("table-list"),J=i("el-form"),E=i("el-card");return y(),P("div",se,[l(E,{class:"w-full"},{default:a(()=>[l(J,{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:"\u5408\u540C\u540D\u79F0",prop:"name"},{default:a(()=>[l(u,{modelValue:n.value.name,"onUpdate:modelValue":t[0]||(t[0]=e=>n.value.name=e),maxlength:"50",placeholder:"\u8BF7\u8F93\u5165",disabled:!!o.$route.query.isReplenishment},null,8,["modelValue","disabled"])]),_:1})]),_:1}),l(d,{span:12},{default:a(()=>[l(r,{label:"\u5408\u540C\u603B\u91D1\u989D",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:"\u8BF7\u586B\u5199",disabled:!!o.$route.query.isReplenishment},{suffix:a(()=>t[9]||(t[9]=[_("\u4E07\u5143")])),_:1},8,["modelValue","disabled"])]),_:1})]),_:1}),l(d,{span:12},{default:a(()=>[l(r,{label:"\u5408\u540C\u7B7E\u8BA2\u5B8C\u6210\u65F6\u95F4",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:"\u8BF7\u9009\u62E9"},null,8,["modelValue"])]),_:1})]),_:1}),l(d,{span:12},{default:a(()=>[l(r,{label:"\u4EA4\u8D27\u65E5\u671F",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:"\u8BF7\u9009\u62E9"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),l(s,null,{default:a(()=>[l(d,{span:12},{default:a(()=>[l(r,{label:"\u5408\u540C\u9644\u4EF6",prop:"attachment"},{default:a(()=>[l(L,{"file-list":n.value.attachment,"onUpdate:fileList":t[4]||(t[4]=e=>n.value.attachment=e),class:"w-full",action:f(R),"on-success":e=>f(ee)(e,n.value.attachment),"before-upload":e=>f(te)(e,{types:f(T)}),accept:f(T).map(e=>`.${e}`).join(","),"on-preview":f(ae)},{tip:a(()=>[V("div",ie," \u652F\u6301"+D(f(le))+"\u6587\u4EF6 ",1)]),default:a(()=>[l(v,{type:"primary",plain:""},{default:a(()=>t[10]||(t[10]=[_("\u9009\u62E9\u6587\u4EF6")])),_: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,"\u7B2C"+D(e.$index+1)+"\u7B14",1)]),planAmount:a(({scope:e})=>[e.$index>=0?(y(),g(r,{key:0,prop:`payments[${e.$index}].planAmount`,rules:[{required:!0,message:"\u8BF7\u8F93\u5165"}],"label-width":"0",style:{"margin-bottom":"0"}},{default:a(()=>[l(u,{modelValue:e.row.planAmount,"onUpdate:modelValue":m=>e.row.planAmount=m,placeholder:"\u8BF7\u586B\u5199",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:"\u8BF7\u8F93\u5165"}],"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:"\u81EA\u52A8\u8BA1\u7B97",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:"\u8BF7\u8F93\u5165"}],"label-width":"0",style:{"margin-bottom":"0"}},{default:a(()=>[l(M,{modelValue:e.row.paymentAmount,"onUpdate:modelValue":m=>e.row.paymentAmount=m,placeholder:"\u8BF7\u586B\u5199",min:0,controls:!1,disabled:!!o.$route.query.isReplenishment,onMousewheel:t[5]||(t[5]=x(()=>{},["prevent"])),onBlur:m=>j(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:"\u8BF7\u9009\u62E9"}],"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:"\u8BF7\u9009\u62E9",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)},"\u5220\u9664",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,G,z)=>I(m,G,z,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:"\u8BF7\u586B\u5199",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]=[_("\u6DFB\u52A0\u4ED8\u6B3E\u8BA1\u5212")])),_:1})),o.$route.query.isReplenishment?(y(),P("p",pe,"\u6E29\u99A8\u63D0\u793A\uFF1A\u8BF7\u8C28\u614E\u586B\u5199\u5B9E\u9645\u652F\u4ED8\u91D1\u989D\uFF0C\u586B\u5199\u540E\u4E0D\u5141\u8BB8\u4FEE\u6539")):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]=[_(" \u8FD4\u56DE ")])),_:1}),l(v,{type:"primary",loading:c.value,onClick:t[8]||(t[8]=e=>N(k.value))},{default:a(()=>t[13]||(t[13]=[_(" \u63D0\u4EA4 ")])),_:1},8,["loading"])])])}}});export{_e as default};