|
- var re=Object.defineProperty,ne=Object.defineProperties;var ue=Object.getOwnPropertyDescriptors;var S=Object.getOwnPropertySymbols;var se=Object.prototype.hasOwnProperty,me=Object.prototype.propertyIsEnumerable;var J=(f,i,d)=>i in f?re(f,i,{enumerable:!0,configurable:!0,writable:!0,value:d}):f[i]=d,R=(f,i)=>{for(var d in i||(i={}))se.call(i,d)&&J(f,d,i[d]);if(S)for(var d of S(i))me.call(i,d)&&J(f,d,i[d]);return f},C=(f,i)=>ne(f,ue(i));var k=(f,i,d)=>new Promise((P,g)=>{var Y=a=>{try{D(d.next(a))}catch(U){g(U)}},q=a=>{try{D(d.throw(a))}catch(U){g(U)}},D=a=>a.done?P(a.value):Promise.resolve(a.value).then(Y,q);D((d=d.apply(f,i)).next())});import{_ as de,d as pe,D as ie,A as ce,u as fe,r as M,o as ye,e as v,f as b,g as I,k as o,l as t,F as ve,J as be,I as $,m as A,j as h,h as T,t as E,i as w,Y as O,p as _e}from"./index.11dc4694.js";import{h as he,f as ge,c as K,b as Ve,e as $e,g as Ae,r as we}from"./uploadAction.c865409e.js";import{s as qe,a as Ue,c as ke}from"./contractRecord.342fd9ca.js";import{b as Me}from"./index.f58f6803.js";const Pe={class:"fillPurchasingResult footerPage"},De={class:"el-upload__tip"},Ye=["onClick"],Re={key:1,class:"text-danger text-14"},Ce={class:"footer"},Te=pe({name:"fillContractInfo"}),je=Object.assign(Te,{setup(f){const i=ie.dictStore.uploadUrl,{proxy:d}=_e(),P=ce(),g=fe(),Y=M(),q=(r,u,n)=>{u||n(),/^\d+(\.\d{1,6})?$/.test(u)?u*1>=1e8?n("\u8BF7\u8F93\u5165\u6B63\u786E\u683C\u5F0F\uFF0C\u5C0F\u4E8E100000000"):n():n("\u8BF7\u8F93\u5165\u6B63\u786E\u683C\u5F0F\uFF0C\u6700\u591A\u4FDD\u7559\u516D\u4F4D\u5C0F\u6570")},D={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"}]},a=M({contracts:[]}),U=M([{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}]),z=r=>{a.value.contracts[r].payments.push({})},G=(r,u)=>{a.value.contracts[u].payments.splice(r,1)},H=(r,u)=>{r.ratio=Math.floor(r.paymentAmount/a.value.contracts[u].totalAmount*1*100*100)/100},V=M(!1),Q=r=>k(this,null,function*(){console.log(a.value),r&&r.validate((u,n)=>k(this,null,function*(){if(u)if(g.query.isReplenishment)W();else{let s=0;if(a.value.contracts.forEach(p=>{if(p.payments.reduce((y,B)=>y+B.paymentAmount,0)!==p.totalAmount){s++;return}}),s){d.$message.warning("\u6BCF\u4EFD\u5408\u540C\u4ED8\u6B3E\u91D1\u989D\u603B\u548C\u5FC5\u987B\u7B49\u4E8E\u5408\u540C\u603B\u91D1\u989D");return}V.value=!0;const m=a.value.contracts.map(p=>C(R({},p),{projectCode:N.value,projectId:g.query.id,attachment:p.attachment&&JSON.stringify(Ae(p.attachment))}));try{yield qe(m),V.value=!1,d.$message.success("\u63D0\u4EA4\u6210\u529F"),P.go(-1)}catch(p){V.value=!1}}}))}),W=()=>k(this,null,function*(){V.value=!0;try{const r=[];a.value.contracts.forEach(u=>{u.payments.forEach(n=>{(n.actualPaymentAmount||n.actualPaymentAmount===0)&&!n.isReplenishment&&r.push({actualPaymentAmount:n.actualPaymentAmount,id:n.id,projectCode:n.projectCode})})}),yield Ue(r),d.$message.success("\u63D0\u4EA4\u6210\u529F"),P.go(-1),V.value=!1}catch(r){V.value=!1}}),X=()=>k(this,null,function*(){var u;const r=yield ke(N.value);(u=r.data)!=null&&u.length?a.value.contracts=r.data.map((n,s)=>{var m;return C(R({},n),{bidName:j.value[s].bidName,attachment:n.attachment?we(JSON.parse(n.attachment)):[],payments:((m=n.payments)==null?void 0:m.map(p=>C(R({},p),{isReplenishment:!!p.actualPaymentAmount})))||[]})}):a.value.contracts=j.value.map(n=>({bidName:n.bidName,attachment:[],payments:[]}))}),j=M(),N=M(),Z=()=>k(this,null,function*(){const r=yield Me({id:g.query.id});j.value=r.data.purchases,N.value=r.data.projectCode,X()}),x=(r,u,n,s,m)=>{var p;if(u<0)n("\u5B9E\u9645\u652F\u4ED8\u91D1\u989D\u5FC5\u987B\u5927\u4E8E\u7B49\u4E8E0");else if(s===0)u>a.value.contracts[m].payments[s].paymentAmount&&n("\u5B9E\u9645\u652F\u4ED8\u91D1\u989D\u4E0D\u80FD\u8D85\u8FC7\u5408\u540C\u8BA1\u5212\u4ED8\u6B3E\u91D1\u989D");else{let _=a.value.contracts[m].payments[s].paymentAmount;for(let y=0;y<s;y++)_+=a.value.contracts[m].payments[y].paymentAmount-((p=a.value.contracts[m].payments[y])==null?void 0:p.actualPaymentAmount)||0;u>_&&n(`\u5B9E\u9645\u652F\u4ED8\u91D1\u989D\u4E0D\u80FD\u8D85\u8FC7${_}\u4E07\u5143`)}n()};return ye(()=>{Z(),g.query.isReplenishment&&(U.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}])}),(r,u)=>{const n=v("el-input"),s=v("el-form-item"),m=v("el-col"),p=v("el-date-picker"),_=v("el-row"),y=v("el-button"),B=v("el-upload"),L=v("el-input-number"),ee=v("table-list"),te=v("el-card"),ae=v("el-form");return b(),I("div",Pe,[o(ae,{ref_key:"formRef",ref:Y,model:a.value,rules:D,"label-position":"right","label-width":"180px","label-suffix":":","scroll-to-error":""},{default:t(()=>[(b(!0),I(ve,null,be(a.value.contracts,(F,l)=>(b(),$(te,{key:l,class:"w-full mb-16",header:`${F.bidName}-\u5408\u540C`},{default:t(()=>[o(_,{gutter:40},{default:t(()=>[o(m,{span:12},{default:t(()=>[o(s,{label:"\u5408\u540C\u540D\u79F0",prop:`contracts[${l}].name`,rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5408\u540C\u540D\u79F0"}]},{default:t(()=>[o(n,{modelValue:a.value.contracts[l].name,"onUpdate:modelValue":e=>a.value.contracts[l].name=e,maxlength:"50",placeholder:"\u8BF7\u8F93\u5165",disabled:!!r.$route.query.isReplenishment},null,8,["modelValue","onUpdate:modelValue","disabled"])]),_:2},1032,["prop"])]),_:2},1024),o(m,{span:12},{default:t(()=>[o(s,{label:"\u5408\u540C\u603B\u91D1\u989D",prop:`contracts[${l}].totalAmount`,rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5408\u540C\u603B\u91D1\u989D"},{validator:q,trigger:"blur"}]},{default:t(()=>[o(n,{modelValue:a.value.contracts[l].totalAmount,"onUpdate:modelValue":e=>a.value.contracts[l].totalAmount=e,modelModifiers:{number:!0},placeholder:"\u8BF7\u586B\u5199",disabled:!!r.$route.query.isReplenishment},{suffix:t(()=>[A("\u4E07\u5143")]),_:2},1032,["modelValue","onUpdate:modelValue","disabled"])]),_:2},1032,["prop","rules"])]),_:2},1024),o(m,{span:12},{default:t(()=>[o(s,{label:"\u4F9B\u5E94\u5546\u6536\u6B3E\u5F00\u6237\u884C",prop:`contracts[${l}].supplierBank`,rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4F9B\u5E94\u5546\u6536\u6B3E\u5F00\u6237\u884C"}]},{default:t(()=>[o(n,{modelValue:a.value.contracts[l].supplierBank,"onUpdate:modelValue":e=>a.value.contracts[l].supplierBank=e,maxlength:"50",placeholder:"\u8BF7\u8F93\u5165",disabled:!!r.$route.query.isReplenishment},null,8,["modelValue","onUpdate:modelValue","disabled"])]),_:2},1032,["prop"])]),_:2},1024),o(m,{span:12},{default:t(()=>[o(s,{label:"\u4F9B\u5E94\u5546\u6536\u6B3E\u8D26\u53F7",prop:`contracts[${l}].supplierAccount`,rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4F9B\u5E94\u5546\u6536\u6B3E\u8D26\u53F7"}]},{default:t(()=>[o(n,{modelValue:a.value.contracts[l].supplierAccount,"onUpdate:modelValue":e=>a.value.contracts[l].supplierAccount=e,maxlength:"50",placeholder:"\u8BF7\u8F93\u5165",disabled:!!r.$route.query.isReplenishment},null,8,["modelValue","onUpdate:modelValue","disabled"])]),_:2},1032,["prop"])]),_:2},1024),o(m,{span:12},{default:t(()=>[o(s,{label:"\u8D28\u4FDD\u671F",prop:`contracts[${l}].warrantyPeriod`,rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u8D28\u4FDD\u671F"}]},{default:t(()=>[o(n,{modelValue:a.value.contracts[l].warrantyPeriod,"onUpdate:modelValue":e=>a.value.contracts[l].warrantyPeriod=e,maxlength:"50",placeholder:"\u8BF7\u8F93\u5165",disabled:!!r.$route.query.isReplenishment,onInput:e=>{var c;return a.value.contracts[l].warrantyPeriod=(c=a.value.contracts[l].warrantyPeriod)==null?void 0:c.replace(/[^\d]/g,"")}},{suffix:t(()=>[A(" \u5E74 ")]),_:2},1032,["modelValue","onUpdate:modelValue","disabled","onInput"])]),_:2},1032,["prop"])]),_:2},1024),o(m,{span:12},{default:t(()=>[o(s,{label:"\u8D28\u4FDD\u91D1",prop:`contracts[${l}].retentionMoney`,rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u8D28\u4FDD\u91D1"},{validator:q,trigger:"blur"}]},{default:t(()=>[o(n,{modelValue:a.value.contracts[l].retentionMoney,"onUpdate:modelValue":e=>a.value.contracts[l].retentionMoney=e,modelModifiers:{number:!0},placeholder:"\u8BF7\u586B\u5199",disabled:!!r.$route.query.isReplenishment},{suffix:t(()=>[A("\u4E07\u5143")]),_:2},1032,["modelValue","onUpdate:modelValue","disabled"])]),_:2},1032,["prop","rules"])]),_:2},1024),o(m,{span:12},{default:t(()=>[o(s,{label:"\u5408\u540C\u7B7E\u8BA2\u5B8C\u6210\u65F6\u95F4",prop:`contracts[${l}].contractTime`,rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u5408\u540C\u7B7E\u8BA2\u5B8C\u6210\u65F6\u95F4"}]},{default:t(()=>[o(p,{modelValue:a.value.contracts[l].contractTime,"onUpdate:modelValue":e=>a.value.contracts[l].contractTime=e,type:"date",format:"YYYY-MM-DD","value-format":"YYYY-MM-DD",placeholder:"\u8BF7\u9009\u62E9"},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024),o(m,{span:12},{default:t(()=>[o(s,{label:"\u4EA4\u8D27\u65E5\u671F",prop:`contracts[${l}].deliveryTime`,rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u4EA4\u8D27\u65E5\u671F"}]},{default:t(()=>[o(p,{modelValue:a.value.contracts[l].deliveryTime,"onUpdate:modelValue":e=>a.value.contracts[l].deliveryTime=e,type:"date",format:"YYYY-MM-DD","value-format":"YYYY-MM-DD",placeholder:"\u8BF7\u9009\u62E9"},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])]),_:2},1024)]),_:2},1024),o(_,null,{default:t(()=>[o(m,{span:12},{default:t(()=>[o(s,{label:"\u5408\u540C\u9644\u4EF6",prop:`contracts[${l}].attachment`,rules:[{required:!0,message:"\u8BF7\u4E0A\u4F20\u5408\u540C\u9644\u4EF6"}]},{default:t(()=>[o(B,{"file-list":a.value.contracts[l].attachment,"onUpdate:fileList":e=>a.value.contracts[l].attachment=e,class:"w-full",action:h(i),"on-success":e=>h(he)(e,a.value.contracts[l].attachment),"before-upload":e=>h(ge)(e,{types:h(K)}),accept:h(K).map(e=>`.${e}`).join(","),"on-preview":h(Ve)},{tip:t(()=>[T("div",De," \u652F\u6301"+E(h($e))+"\u6587\u4EF6 ",1)]),default:t(()=>[o(y,{type:"primary",plain:""},{default:t(()=>[A("\u9009\u62E9\u6587\u4EF6")]),_:1})]),_:2},1032,["file-list","onUpdate:fileList","action","on-success","before-upload","accept","on-preview"])]),_:2},1032,["prop"])]),_:2},1024)]),_:2},1024),o(_,null,{default:t(()=>[o(m,{span:24},{default:t(()=>[o(s,{prop:`contracts[${l}].payments`,"label-width":"0",rules:[{required:!0,message:"\u81F3\u5C11\u6DFB\u52A0\u4E00\u7B14\u4ED8\u6B3E\u8BA1\u5212",type:"array"}]},{default:t(()=>[o(ee,{ref_for:!0,ref:"tableListRef",column:U.value,data:a.value.contracts[l].payments,pagination:!1,"empty-temp":!1,class:"w-full"},{number:t(({scope:e})=>[T("span",null,"\u7B2C"+E(e.$index+1)+"\u7B14",1)]),planAmount:t(({scope:e})=>[e.$index>=0?(b(),$(s,{key:0,prop:`contracts[${l}].payments[${e.$index}].planAmount`,rules:[{required:!0,message:"\u8BF7\u8F93\u5165"}],"label-width":"0",style:{"margin-bottom":"0"}},{default:t(()=>[o(n,{modelValue:e.row.planAmount,"onUpdate:modelValue":c=>e.row.planAmount=c,placeholder:"\u8BF7\u586B\u5199",disabled:!!r.$route.query.isReplenishment},null,8,["modelValue","onUpdate:modelValue","disabled"])]),_:2},1032,["prop"])):w("v-if",!0)]),ratio:t(({scope:e})=>[e.$index>=0?(b(),$(s,{key:0,prop:`contracts[${l}].payments[${e.$index}].ratio`,rules:[{required:!0,message:"\u8BF7\u8F93\u5165"}],"label-width":"0",style:{"margin-bottom":"0"}},{default:t(()=>[o(n,{modelValue:e.row.ratio,"onUpdate:modelValue":c=>e.row.ratio=c,modelModifiers:{number:!0},placeholder:"\u81EA\u52A8\u8BA1\u7B97",disabled:""},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["prop"])):w("v-if",!0)]),paymentAmount:t(({scope:e})=>[e.$index>=0?(b(),$(s,{key:0,prop:`contracts[${l}].payments[${e.$index}].paymentAmount`,rules:[{required:!0,message:"\u8BF7\u8F93\u5165"}],"label-width":"0",style:{"margin-bottom":"0"}},{default:t(()=>[o(L,{modelValue:e.row.paymentAmount,"onUpdate:modelValue":c=>e.row.paymentAmount=c,placeholder:"\u8BF7\u586B\u5199",min:0,controls:!1,disabled:!!r.$route.query.isReplenishment,onMousewheel:u[0]||(u[0]=O(()=>{},["prevent"])),onBlur:c=>H(e.row,l)},null,8,["modelValue","onUpdate:modelValue","disabled","onBlur"])]),_:2},1032,["prop"])):w("v-if",!0)]),paymentTime:t(({scope:e})=>[e.$index>=0?(b(),$(s,{key:0,prop:`contracts[${l}].payments[${e.$index}].paymentTime`,rules:[{required:!0,message:"\u8BF7\u9009\u62E9"}],"label-width":"0",style:{"margin-bottom":"0"}},{default:t(()=>[o(p,{modelValue:e.row.paymentTime,"onUpdate:modelValue":c=>e.row.paymentTime=c,type:"date",format:"YYYY-MM-DD","value-format":"YYYY-MM-DD",placeholder:"\u8BF7\u9009\u62E9",disabled:!!r.$route.query.isReplenishment},null,8,["modelValue","onUpdate:modelValue","disabled"])]),_:2},1032,["prop"])):w("v-if",!0)]),action:t(({scope:e})=>[T("a",{class:"text-danger",onClick:c=>G(e.$index,l)},"\u5220\u9664",8,Ye)]),actualPaymentAmount:t(({scope:e})=>[e.$index>=0?(b(),$(s,{key:0,"label-width":"0",prop:`contracts[${l}].payments[${e.$index}].actualPaymentAmount`,rules:[{validator:(c,le,oe)=>x(c,le,oe,e.$index,l)}],style:{"margin-bottom":"25px","margin-top":"20px"}},{default:t(()=>[o(L,{modelValue:e.row.actualPaymentAmount,"onUpdate:modelValue":c=>e.row.actualPaymentAmount=c,placeholder:"\u8BF7\u586B\u5199",min:0,controls:!1,disabled:e.row.isReplenishment,onMousewheel:u[1]||(u[1]=O(()=>{},["prevent"]))},null,8,["modelValue","onUpdate:modelValue","disabled"])]),_:2},1032,["prop","rules"])):w("v-if",!0)]),_:2},1032,["column","data"]),r.$route.query.isReplenishment?w("v-if",!0):(b(),$(y,{key:0,type:"primary",icon:"Plus",plain:"",class:"w-full mt-8",onClick:e=>z(l)},{default:t(()=>[A("\u6DFB\u52A0\u4ED8\u6B3E\u8BA1\u5212")]),_:2},1032,["onClick"])),r.$route.query.isReplenishment?(b(),I("p",Re,"\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")):w("v-if",!0)]),_:2},1032,["prop"])]),_:2},1024)]),_:2},1024)]),_:2},1032,["header"]))),128))]),_:1},8,["model"]),T("div",Ce,[o(y,{onClick:u[2]||(u[2]=F=>h(P).go(-1))},{default:t(()=>[A(" \u8FD4\u56DE ")]),_:1}),o(y,{type:"primary",loading:V.value,onClick:u[3]||(u[3]=F=>Q(Y.value))},{default:t(()=>[A(" \u63D0\u4EA4 ")]),_:1},8,["loading"])])])}}}),Se=de(je,[["__file","/Users/chenlixin/Documents/work/NDKJ/MyProject/ls-project-v2.0/src/pages/declareManage/contractRecord/fillContractInfo/index.vue"]]);export{Se as default};
|