1 |
- import{aZ as q,bK as pu,be as fu,am as J,_ as du,d as Eu,x as A,W as Fu,aO as Cu,Z as Du,r as x,aD as mu,H as vu,o as B,c as T,h as E,l as d,D as f,G as N,m as P,a as V,M as k,L as j,J as _u,F as Bu,E as hu,Q as yu,R as gu,bL as xu}from"./index.js";import{e as bu}from"./execl-upload.7c83427b.js";import{m as K,r as Au,c as Q,I as $,a as wu,s as R,b as X,g as ku,i as Iu}from"./InvoiceTitle.7cca2a.js";import{h as Tu}from"./index.684ecd6b.js";import{u as G,w as Nu}from"./xlsx.ed122d16.js";import Pu from"./ProcessModal.45259b.js";const Su=Au.map(({prop:s})=>s);function Ou(s,c){if(s.length!==c.length)return q.warning("\u5BFC\u5165\u6587\u4EF6\u8868\u5934\u4E0E\u6A21\u677F\u4E0D\u4E00\u81F4"),!1;for(const i in s){const u=s[i].trim(),t=c[i].trim();if(u!==t)return q.warning("\u5BFC\u5165\u6587\u4EF6\u8868\u5934\u4E0E\u6A21\u677F\u4E0D\u4E00\u81F4"),!1}return!0}function Vu(s){const c=[...new Set(s.map(({group:t})=>t))];if(c[0]!=1)return q.warning("\u5206\u7EC4\u7F16\u53F7\u5FC5\u987B\u4ECE1\u5F00\u59CB"),!1;const i=c[c.length-1],u=Array(Number(i)).fill(0).map((t,l)=>l+1);return c.length!==u.length?(q.warning("\u5206\u7EC4\u5FC5\u987B\u4E3A\u8FDE\u7EED\u7F16\u53F7"),!1):!0}function uu(s,c=!1){fu({type:"warning",title:c?"\u5206\u7EC4\u6821\u9A8C\u5931\u8D25":"\u6570\u636E\u6821\u9A8C\u5931\u8D25",message:J("div",{style:"display: flex, flex-direction:column"},{default:()=>Object.keys(s).reduce((i,u)=>[...i,J("p",{},"\u7B2C"+u+(c?"\u7EC4, ":"\u884C, ")+s[u])],[])})})}function ju(s,c){const i=c.map(({label:t})=>t),u={};for(const t in s){const l=s[t],o=l.rawIndex;let y=!1,m=!1,F=!1,v=!1;for(const h in l){const g=l[h];if(Su.includes(h)&&(!g||!String(g).trim()))u[o]?u[o]=u[o]+="\u3001"+K[h]:u[o]=K[h];else if(h==="email"&&!pu(g))y=!0;else if(h==="poCode"){const _=g.slice(0,5),S=g.slice(5);_!=="PO-YL"?m=!0:/\d{2}-\d{4}-\d{4,8}$/.test(S)||(m=!0)}else h==="invtype"&&!i.includes(g)?F=!0:h==="platform_type"&&!["toB","toC"].includes(g)&&(v=!0)}u[o]?(u[o]+="\u4E0D\u80FD\u4E3A\u7A7A",y&&(u[o]+=",\u90AE\u7BB1\u683C\u5F0F\u4E0D\u6B63\u786E"),m&&(u[o]+=",\u5E73\u53F0\u91C7\u8D2DPO\u683C\u5F0F\u4E0D\u6B63\u786E"),F&&(u[o]+=",\u53D1\u7968\u7C7B\u578B\u683C\u5F0F\u4E0D\u6B63\u786E\u5FC5\u987B\u4E3A:"+i.join("\u3001")),v&&(u[o]+=",\u8BA2\u5355\u5E73\u53F0\u7C7B\u578B\u683C\u5F0F\u4E0D\u6B63\u786E")):(y&&(u[o]="\u90AE\u7BB1\u683C\u5F0F\u4E0D\u6B63\u786E"),m&&(u[o]="\u5E73\u53F0\u91C7\u8D2DPO\u683C\u5F0F\u4E0D\u6B63\u786E"),F&&(u[o]="\u53D1\u7968\u7C7B\u578B\u683C\u5F0F\u4E0D\u6B63\u786E\u5FC5\u987B\u4E3A"+i.join("\u3001")),v&&(u[o]="\u8BA2\u5355\u5E73\u53F0\u7C7B\u578B\u683C\u5F0F\u4E0D\u6B63\u786E"))}if(Object.keys(u).length===0)return!0;uu(u)}function qu(s){const c=[...new Set(s.map(({group:t})=>t))],i={};for(const t of c)i[t]=s.filter(l=>l.group===t);const u={};for(const t of Object.keys(i)){const l=i[t];let o=!1,y=!1;if(l.length>10)y=!0;else{let m={};const F=[];[...new Set(l.map(({platform_type:_})=>_))].length!=1&&F.push("\u8BA2\u5355\u5E73\u53F0\u7C7B\u578B"),[...new Set(l.map(({email:_})=>_))].length!=1&&F.push("\u90AE\u7BB1"),[...new Set(l.map(({invtype:_})=>_))].length!=1&&F.push("\u53D1\u7968\u7C7B\u578B"),F.length!==0&&(u[t]=F.join("\u3001")),l.forEach(_=>{const{sequenceNo:S,poCode:U}=_,O=S+"-"+U;m[O]?o=!0:m[O]=!0})}u[t]?(u[t]+=",\u540C\u4E00\u5206\u7EC4\u5185\u5FC5\u987B\u4E00\u81F4",y&&(u[t]+=",\u5206\u7EC4\u6570\u636E\u4E0D\u80FD\u8D85\u8FC7\u5341\u6761"),o&&(u[t]+=",\u5206\u7EC4\u8BA2\u5355\u7F16\u53F7\u548C\u5E73\u53F0\u91C7\u8D2DPO\u4E0D\u80FD\u91CD\u590D")):(y&&(u[t]="\u5206\u7EC4\u6570\u636E\u4E0D\u80FD\u8D85\u8FC7\u5341\u6761"),o&&(u[t]="\u5206\u7EC4\u8BA2\u5355\u7F16\u53F7\u548C\u5E73\u53F0\u91C7\u8D2DPO\u4E0D\u80FD\u91CD\u590D"))}if(Object.keys(u).length===0)return!0;uu(u,!0)}function Hu(s,c){return!(!ju(s,c)||!Vu(s)||!qu(s))}const M=s=>(yu("data-v-64684ff8"),s=s(),gu(),s),Uu={class:"flex flex-col bg-white justify-start items-start",style:{height:"calc(100vh - 48px)",width:"100%"}},Lu={class:"flex w-full"},Ru={class:"flex flex-col w-full"},Gu={class:"flex flex-col w-full"},Mu={class:"w-full flex items-center"},zu=M(()=>E("span",{class:"mb-[8px]",style:{"font-size":"14px"}},"\u4F7F\u7528\u4E2D\u9047\u5230\u7684\u95EE\u9898",-1)),Wu=M(()=>E("div",{class:"flex flex-col"},[E("h1",{class:"font-bold"},"\u4E0A\u4F20\u65F6\u9A8C\u8BC1:"),E("p",null,"1.\u5206\u7EC4\u5FC5\u987B\u4E3A1\u5F00\u59CB\u7684\u8FDE\u7EED\u6574\u6570;"),E("p",null,"2.\u5355\u884C\u6570\u636E\u53EA\u652F\u6301\u4E00\u4E2A\u5E73\u53F0\u91C7\u8D2DPO;"),E("p",null,"3.\u540C\u4E00\u5206\u7EC4\u5E73\u53F0\u7C7B\u578B\u3001\u90AE\u7BB1\u53F7\u3001\u53D1\u7968\u7C7B\u578B\u5FC5\u987B\u4E00\u81F4;"),E("p",null,"4.\u540C\u4E00\u5206\u7EC4\u8BA2\u5355\u7F16\u53F7+\u5E73\u53F0\u91C7\u8D2DPO\u4E0D\u80FD\u91CD\u590D;"),E("p",null,"5.\u540C\u4E00\u5206\u7EC4\u6570\u636E\u4E0D\u80FD\u8D85\u8FC710\u6761;"),E("h1",{class:"font-bold"},"\u6279\u91CF\u521B\u5EFA\u65F6\u9A8C\u8BC1:"),E("p",null,"1.\u6309\u5E73\u53F0\u7C7B\u578B\u548C\u9500\u552E\u8BA2\u5355\u7F16\u53F7\u67E5\u627E\u5FC5\u987B\u627E\u5230\u8BA2\u5355;"),E("p",null,"2.\u8BA2\u5355\u5DF2\u5F00\u7968\u91D1\u989D+\u5F00\u7968\u4E2D\u91D1\u989D+\u6A21\u677F\u5F00\u7968\u91D1\u989D\u5FC5\u987B\u5C0F\u4E8E\u7B49\u4E8E\u5DF2\u8BA4\u6B3E\u603B\u91D1\u989D")],-1)),Yu={key:0},Zu={key:1},Ju=M(()=>E("span",{style:{color:"#f56c6c","font-size":"14px"}},"* ",-1)),Ku={key:1},Qu={key:1,class:"w-full flex justify-end",style:{padding:"10px 0 0 0"}},$u=Eu({__name:"index",emits:["onSuccess"],setup(s,{emit:c}){const i=A(0),u=A(!1),t=A(!1),l=A([]),{currentCompany:o}=Fu();Cu();const y=A([]),m=A({}),F=A({}),v=Du({visible:!1,loading:!1}),h=_.bind(null,!0),g=_.bind(null,!1);function _(r,a){if(!a)return r?m.value={}:F.value={};if(r){const{invoiceType:p,denomination:e}=a;p.split(","),m.value=Q(X(a))}else F.value=Q(X(a))}A([]);const S=Iu.slice(0,7).map(({label:r})=>r);function U({results:r,header:a}){if(t.value=!1,u.value=!1,i.value=0,!Ou(S,a))return;const p=[];for(const e in r){const n=r[e],C={};Object.keys(n).forEach(b=>{const I=ku(b),w=String(n[b]).trim();C[I]=w}),p.push({...C,rawIndex:Number(e)+1,status:0})}p.sort((e,n)=>e.group-n.group),Hu(p,y.value)&&(l.value=p.map((e,n)=>({index:Number(n)+1,...e})))}const O=()=>{v.visible=!0,t.value=!0},z=()=>{l.value=[],t.value=!0};async function W(r,a=!0){v.loading=!0;const{code:p,data:e,message:n}=await Tu({companyNo:r});if(v.loading=!1,p===0){if(a){const{invoiceType:C}=e.list[0],b=C.split(",");y.value=xu.filter(({value:I})=>b.includes(I))}a?h(e.list[0]):g(e.list[0])}else q.warning(n)}async function eu(){await(o.value.companyNo&&W(o.value.companyNo)),await W("GS2404151642335170",!1)}function tu(r){const{status:a,remark:p,group:e}=r;l.value.forEach(n=>{n.group==e&&(n.status==3&&a!=0||(n.remark=p,n.status=a))})}function su(r){const{status:a,remark:p,sequenceNo:e,group:n}=r;l.value.forEach(C=>{C.sequenceNo==e&&C.group==n&&(C.remark=p,C.status=a)})}function Y(){const r=l.value.map((e,n)=>{var C;return{\u5E8F\u53F7:Number(n)+1,\u5206\u7EC4:e.group,\u53D1\u7968\u7C7B\u578B:e.invtype,\u7535\u5B50\u90AE\u7BB1:e.email,\u8BA2\u5355\u7F16\u53F7:e.sequenceNo,\u8BA2\u5355\u5E73\u53F0\u7C7B\u578B:e.platform_type,\u5F00\u7968\u91D1\u989D:e.inv_fee,\u5E73\u53F0\u91C7\u8D2DPO:e.poCode,\u72B6\u6001:(C=R.find(({value:b})=>b==e.status))==null?void 0:C.label,\u5907\u6CE8:e.remark}}),a=G.book_new(),p=G.json_to_sheet(r);G.book_append_sheet(a,p,"sheet"),Nu(a,"\u6279\u91CF\u5BFC\u5165\u6570\u636E.xlsx",{bookType:"xlsx"})}function lu(r,a){u.value=r,i.value=a!=null?a:0}return eu(),(r,a)=>{const p=x("ElInput"),e=x("ElFormItem"),n=x("ElCol"),C=x("ElRow"),b=x("ElForm"),I=x("ElTag"),w=x("ElButton"),au=x("ElPopover"),ou=x("ElTableColumn"),nu=x("ElTable"),iu=mu("loading");return vu((B(),T("div",Uu,[E("div",Lu,[d(b,{"label-width":"120px",style:{width:"100%"}},{default:f(()=>[d(C,null,{default:f(()=>[d(n,{span:12},{default:f(()=>[d(e,{label:"\u9500\u552E\u65B9\u516C\u53F8\u62AC\u5934"},{default:f(()=>[E("div",Ru,[d(p,{modelValue:(m.value||{}).invoice_title,class:"mb-[10px]",disabled:""},null,8,["modelValue"]),d($,{detail:m.value||{}},null,8,["detail"])])]),_:1})]),_:1}),d(n,{span:12},{default:f(()=>[d(e,{label:"\u8D2D\u4E70\u65B9\u516C\u53F8\u62AC\u5934"},{default:f(()=>[E("div",Gu,[d(p,{modelValue:(F.value||{}).invoice_title,class:"mb-[10px]",disabled:""},null,8,["modelValue"]),d($,{detail:F.value||{}},null,8,["detail"])])]),_:1})]),_:1})]),_:1})]),_:1})]),l.value.length===0?(B(),N(P(bu),{key:0,style:{height:"auto !important"},onOnSuccess:U})):V("v-if",!0),E("div",Mu,[d(I,{class:"mb-[10px] mr-[5px]"},{default:f(()=>[k(j(l.value.length)+" / 300 ",1)]),_:1}),zu,d(au,{width:"600px",placement:"top"},{reference:f(()=>[d(w,{class:"mb-[10px]",link:"",icon:P(_u)("question-filled"),type:"info"},null,8,["icon"])]),default:f(()=>[Wu]),_:1}),V(' <ElButton type="primary" size="small" @click="downloadTemplate">\u4E0B\u8F7D\u6279\u91CF\u521B\u5EFA\u53D1\u7968\u7533\u8BF7\u6A21\u677F</ElButton> ')]),d(nu,{stripe:"",border:"",size:"small",data:l.value,"max-height":"500px",style:{width:"100%"}},{default:f(()=>[V(' v-bind="column" '),(B(!0),T(Bu,null,hu(P(wu),(D,ru)=>(B(),N(ou,{type:D.type,label:D.label,minWidth:D.minWidth,prop:D.prop,fixed:D.fixed,key:ru,"show-overflow-tooltip":""},{header:f(()=>[D!=null&&D.required?(B(),T("p",Zu,[Ju,k(" "+j(D.label),1)])):(B(),T("span",Yu,j(D.label),1))]),default:f(({row:L})=>{var Z;return[D.prop==="status"?(B(),N(I,{key:0,type:((Z=P(R).find(({value:H})=>H===L.status))==null?void 0:Z.type)||""},{default:f(()=>{var H;return[k(j(((H=P(R).find(({value:cu})=>cu===L.status))==null?void 0:H.label)||"--"),1)]}),_:2},1032,["type"])):(B(),T("span",Ku,j(L[D.prop]),1))]}),_:2},1032,["type","label","minWidth","prop","fixed"]))),128))]),_:1},8,["data"]),l.value.length!==0?(B(),T("div",Qu,[d(w,{onClick:z},{default:f(()=>[k("\u53D6\u6D88")]),_:1}),t.value?(B(),N(w,{key:1,type:"primary",onClick:Y},{default:f(()=>[k("\u4E0B\u8F7D\u5F53\u524D\u8FDB\u5EA6")]),_:1})):(B(),N(w,{key:0,type:"primary",loading:v.loading,onClick:O},{default:f(()=>[k("\u6279\u91CF\u521B\u5EFA")]),_:1},8,["loading"])),u.value?(B(),N(w,{key:2,onClick:O},{default:f(()=>[k(" \u7EE7\u7EED\u521B\u5EFA ")]),_:1})):V("v-if",!0)])):V("v-if",!0),d(Pu,{data:l.value,visible:v.visible,"onUpdate:visible":a[0]||(a[0]=D=>v.visible=D),companyNo:P(o).companyNo,sellerInvoiceTitle:m.value,purchaserInvoiceTitle:F.value,onUpdateGroup:tu,onUpdateSequenceNo:su,startGroup:i.value,onDownload:Y,onRefresh:z,onStop:lu},null,8,["data","visible","companyNo","sellerInvoiceTitle","purchaserInvoiceTitle","startGroup"])])),[[iu,v.loading]])}}});var ae=du($u,[["__scopeId","data-v-64684ff8"],["__file","C:/Users/89793/Desktop/projects/settle-vue3/src/views/InvoiceSales/batchImportYunlong/index.vue"]]);export{ae as default};
|