index.4cf9ee.js 9.2 KB

1
  1. import{_ as Z,d as w,m as W,bs as uu,O as eu,bz as lu,r as V,o as v,A as N,x,h as m,a as H,f as j,c as g,F as tu,y as au,G as I,e as ou,H as k,bm as U,ac as iu,bt as nu,az as n,bp as y,by as pu,a7 as S}from"./index.js";import{e as su}from"./execl-upload.8692a4ce.js";import{h as ru}from"./index.bbfcc729.js";import{e as z}from"./status.b7512d56.js";const $={value0:"companyNo",value1:"companyName",value2:"supplierNo",value3:"supplierName",value4:"payNo",value5:"invoiceType",value6:"invoiceCode",value7:"invoiceNumber",value8:"inv_subtotal_amount",value9:"inv_total",value10:"open_time",value11:"checkNumber"},cu=[],T=[{type:"index",fixed:"left",label:"\u5E8F\u53F7",width:"50"},{label:"\u4E1A\u52A1\u7F16\u53F7",prop:"TODO1",minWidth:"100px"},{label:"\u7C7B\u578B",prop:"TODO2",minWidth:"100px"},{label:"\u8BA2\u5355\u6765\u6E90",prop:"TODO3",minWidth:"100px"},{label:"\u9500\u552E\u65B9\u516C\u53F8\u7EB3\u7A0E\u8BC6\u522B\u53F7",prop:"TODO4",minWidth:"140px"},{label:"\u9500\u552E\u65B9\u516C\u53F8",prop:"TODO5",minWidth:"100px"},{label:"\u8BA2\u5355\u7F16\u53F7",prop:"TODO6",minWidth:"120px"},{label:"\u8BA2\u5355\u4E3B\u5355\u53F7",prop:"TODO7",minWidth:"120px"},{label:"\u5546\u54C1\u7F16\u53F7",prop:"TODO8",minWidth:"100px"},{label:"\u5546\u54C1\u540D\u79F0",prop:"TODO9",minWidth:"100px"},{label:"\u5355\u4F4D",prop:"TODO10",minWidth:"80px"},{label:"\u5546\u54C1\u6570\u91CF",prop:"TODO11",minWidth:"110px"},{label:"\u5546\u54C1\u6570\u91CF",prop:"TODO11",minWidth:"110px"},{label:"\u5546\u54C1\u5355\u4EF7",prop:"TODO12",minWidth:"110px"},{label:"\u8BA2\u5355\u603B\u91D1\u989D",prop:"TODO13",minWidth:"110px"},{label:"\u7A0E\u76EE",prop:"TODO14",minWidth:"80px"},{label:"\u7A0E\u76EE\u540D\u79F0",prop:"TODO15",minWidth:"100px"},{label:"\u5173\u8054\u91D1\u989D",prop:"TODO16",minWidth:"100px"},{label:"\u8D2D\u4E70\u65B9\u516C\u53F8\u540D\u79F0",prop:"TODO17",minWidth:"110px"},{label:"\u8D2D\u4E70\u65B9\u516C\u53F8\u7EB3\u7A0E\u8BC6\u522B\u53F7",prop:"TODO18",minWidth:"140px"},{label:"\u53D1\u7968\u53F7\u7801",prop:"TODO19",minWidth:"100px"},{label:"\u53D1\u7968\u7C7B\u578B",prop:"TODO20",minWidth:"100px"},{label:"\u9500\u552E\u65B9\u516C\u53F8\u540D\u79F0",prop:"TODO21",minWidth:"110px"},{label:"\u9500\u552E\u65B9\u516C\u53F8\u7EB3\u7A0E\u53F7",prop:"TODO",minWidth:"140px"},{label:"\u53D1\u7968\u660E\u7EC6ID",prop:"TODO",minWidth:"110px"},{label:"\u8D27\u7269\u6216\u5E94\u7A0E\u52B3\u52A1\u3001\u670D\u52A1\u540D\u79F0",prop:"TODO",minWidth:"200px"},{label:"\u7C7B\u76EE\u7F16\u53F7",prop:"TODO",minWidth:"90px"},{label:"\u89C4\u683C\u578B\u53F7",prop:"TODO",minWidth:"110px"},{label:"\u5355\u4F4D",prop:"TODO",minWidth:"80px"},{label:"\u6570\u91CF",prop:"TODO",minWidth:"80px"},{label:"\u7A0E\u524D\u5355\u4EF7",prop:"TODO",minWidth:"100px"},{label:"\u7A0E\u524D\u603B\u4EF7",prop:"TODO",minWidth:"100px"},{label:"\u7A0E\u7387",prop:"TODO",minWidth:"80px"},{label:"\u7A0E\u540E\u5355\u4EF7",prop:"TODO",minWidth:"100px"},{label:"\u7A0E\u540E\u603B\u989D",prop:"TODO",minWidth:"100px"},{label:"\u7C7B\u76EE\u7F16\u53F7\u72B6\u6001",prop:"TODO",minWidth:"100px"},{label:"\u7A0E\u7387\u72B6\u6001",prop:"TODO",minWidth:"100px"},{label:"\u5907\u6CE8",prop:"TODO",minWidth:"80px"},{label:"\u5546\u54C1\u7F16\u53F7",prop:"TODO",minWidth:"90px"},{label:"\u64CD\u4F5C\u6570\u91CF",prop:"TODO",minWidth:"90px"},{label:"\u5B50\u5546\u54C1\u7F16\u53F7",prop:"TODO",minWidth:"100px"},{label:"\u5B50\u5546\u54C1\u64CD\u4F5C\u6570\u91CF",prop:"TODO",minWidth:"110px"}];T.slice(1).reduce((A,C)=>({...A,[C.label]:C.detaultData?C.defaultData:""}),{});const du={key:0},mu={key:1},Du={key:1,flex:"","justify-end":"","gap-2":"",style:{padding:"10px 0 0 0"}},Eu=w({__name:"index",props:{visible:{type:Boolean,required:!0}},emits:["onSuccess"],setup(A,{emit:C}){const l=W(!1),o=W([]),Y=A,q=C,P=z.map(({label:a})=>a),M=W(1),_=uu(Y,"visible"),R=a=>`\u5BFC\u5165\u6570\u636E\u7B2C ${a} \u884C \u53D1\u7968\u7C7B\u578B\u683C\u5F0F\u4E0D\u6B63\u786E,\u53D1\u7968\u7C7B\u578B\u5FC5\u987B\u4E3A${P.join(",")}`,{currentCompany:G}=eu(),L=lu(),J=({results:a,header:i})=>{if(l.value=!0,a.length===0){n.error("\u8868\u683C\u65E0\u6709\u6548\u6570\u636E\uFF01"),l.value=!1;return}let f=!0;if(i.length!==T.length-1?f=!1:T.slice(1).forEach((u,p)=>{u.label!==i[p]&&(f=!1)}),!f){n.error("\u8868\u5934\u4E0E\u5BFC\u5165\u6A21\u677F\u4E0D\u5339\u914D\uFF01"),l.value=!1;return}o.value=[];for(const u of a){const p=Object.values(u);let E={};p.forEach((s,F)=>{E["value"+F]=s+""}),o.value.push(E),M.value=M.value+1}const D=[];o.value.forEach((u,p)=>{const E={};for(let s in u){const F=$[s],B=u[s];E[F]=B}D.push(E)});const t=[],r=[],b=[],e=[],h=[],c=[],d=[],O=y(new Date).format("YYYY-MM-DD");if(D.forEach((u,p)=>{const E=u.invoiceType.trim(),s=z.find(({label:X})=>X===E);s?(u.invoiceType=s.value,(s.value==="normal"||s.value==="electronic")&&!u.checkNumber&&r.push(String(p+1))):t.push(String(p+1));const F=u.invoiceType==="fully_digitalized_special_electronic"||u.invoiceType==="fully_digitalized_normal_electronic";(!u.open_time||u.open_time&&!y(u.open_time).isSame(y(O))&&!y(u.open_time).isBefore(y(O)))&&d.push(String(p+1));const B=/^\d+(\.\d+)?$/;!B.test(u.invoiceCode)&&!F&&b.push(String(p+1)),B.test(u.invoiceNumber)||e.push(String(p+1)),(!B.test(u.inv_subtotal_amount)||Number(u.inv_subtotal_amount)<0)&&!F&&h.push(String(p+1)),(!B.test(u.inv_total)||Number(u.inv_total)<0)&&F&&c.push(String(p+1))}),t.length>0){n({type:"error",message:R(t.join(","))}),l.value=!1;return}if(r.length>0){n({type:"error",message:`\u7B2C ${r.join(",")} \u884C,\u6821\u9A8C\u7801\u4E0D\u80FD\u4E3A\u7A7A\u3002`}),l.value=!1,o.value=[];return}if(b.length>0){n({type:"error",message:`\u7B2C ${b.join(",")} \u884C,\u53D1\u7968\u4EE3\u7801\u5FC5\u987B\u4E3A\u6570\u5B57\u3002`}),l.value=!1,o.value=[];return}if(e.length>0){n({type:"error",message:`\u7B2C ${e.join(",")} \u884C,\u53D1\u7968\u53F7\u7801\u5FC5\u987B\u4E3A\u6570\u5B57\u3002`}),l.value=!1,o.value=[];return}if(h.length>0){n({type:"error",message:`\u7B2C ${h.join(",")} \u884C,\u53D1\u7968\u7A0E\u524D\u91D1\u989D\u5FC5\u987B\u4E3A\u6570\u5B57\u4E14\u4E0D\u80FD\u662F\u8D1F\u6570`}),l.value=!1,o.value=[];return}if(c.length>0){n({type:"error",message:`\u7B2C ${c.join(",")} \u884C,\u53D1\u7968\u7A0E\u540E\u91D1\u989D\u5FC5\u987B\u4E3A\u6570\u5B57\u4E14\u4E0D\u80FD\u662F\u8D1F\u6570`}),l.value=!1,o.value=[];return}if(d.length>0){n({type:"error",message:`\u7B2C ${d.join(",")} \u884C,\u5F00\u7968\u65E5\u671F\u4E0D\u80FD\u4E3A\u7A7A\u4E14\u4E0D\u80FD\u8D85\u8FC7\u5F53\u524D\u65E5\u671F`}),l.value=!1,o.value=[];return}l.value=!1},K=async()=>{try{if(l.value)return;l.value=!0;const a=[];o.value.forEach((e,h)=>{const c={};for(let d in e){const O=$[d],u=e[d];c[O]=u}a.push(c)}),a.forEach((e,h)=>{const c=e.invoiceType.trim(),d=z.find(({label:O})=>O===c);e.invoiceType=d.value});const i=a.map(({supplierNo:e})=>e);if([...new Set(i)].length>1){n.error("\u5356\u65B9\u516C\u53F8\u7F16\u7801\u4E0D\u4E00\u81F4"),l.value=!1;return}const D=a[0].supplierNo;if(D!=G.value.companyNo){n.error("\u5356\u65B9\u516C\u53F8\u7F16\u7801\u4E0E\u5F53\u524D\u9009\u4E2D\u7684\u516C\u53F8\u4E0D\u4E00\u81F4"),l.value=!1;return}a.forEach(e=>{(e.invoiceType==="fully_digitalized_special_electronic"||e.invoiceType==="fully_digitalized_normal_electronic")&&(e.inv_subtotal_amount=e.inv_total),delete e.inv_total,delete e.supplierNo,delete e.supplierName,delete e.companyName,delete e.companyNo});const{code:t,message:r,data:b}=await ru({list:a,companyNo:D,is_comon:"0"});l.value=!1,L({code:t,message:r,noMessage:!1,handler:()=>{n.success("\u6570\u636E\u5BFC\u5165\u6210\u529F\uFF01"),q("onSuccess"),_.value=!1},onError(){Number(t)===10004?pu({title:"\u4EE5\u4E0B\u5BF9\u8D26\u5355\u4E0D\u7B26\u5408\u8981\u6C42",message:S("div",null,[S("p",null,"\u5F53\u524D\u529F\u80FD\u4EC5\u652F\u6301\u4E1A\u52A1\u7C7B\u578B\u4E3A\u91C7\u8D2D\u8BA2\u5355\u7684\u5BF9\u8D26\u5355,\u4EE5\u4E0B\u901A\u7528\u8BA2\u5355\u7C7B\u578B\u7684\u5BF9\u8D26\u5355\u4E0D\u652F\u6301\u8BE5\u529F\u80FD\uFF1A"),S("p",null,b.join("\u3001"))])}):n.warning(r)}})}catch{}},Q=()=>{o.value=[]};return(a,i)=>{const f=V("el-table-column"),D=V("el-table");return v(),N(m(nu),{"close-on-click-modal":!1,modelValue:m(_),"onUpdate:modelValue":i[0]||(i[0]=t=>iu(_)?_.value=t:null),title:"\u975E\u8BA2\u5355\u5546\u54C1\u5BFC\u5165",width:"1040px",top:"8vh",center:""},{default:x(()=>[o.value.length===0?(v(),N(m(su),{key:0,style:{"margin-bottom":"10px"},onOnSuccess:J})):H("v-if",!0),j(D,{data:o.value,stripe:"",border:"","max-height":"500px",size:"small",style:{width:"100%"}},{default:x(()=>[(v(!0),g(tu,null,au(m(T),(t,r)=>(v(),N(f,{minWidth:t.minWidth,"show-overflow-tooltip":"",fixed:t.fixed,prop:t.prop,type:t.type,key:r},{header:x(()=>[!m(cu).includes(m($)[t.prop])||t.label==="\u5E8F\u53F7"?(v(),g("span",du,I(t.label),1)):(v(),g("p",mu,[i[1]||(i[1]=ou("span",{style:{color:"#f56c6c","font-size":"14px"}},"* ",-1)),k(" "+I(t.label),1)]))]),_:2},1032,["minWidth","fixed","prop","type"]))),128))]),_:1},8,["data"]),o.value.length!==0?(v(),g("div",Du,[j(m(U),{size:"small",onClick:Q},{default:x(()=>i[2]||(i[2]=[k("\u53D6\u6D88")])),_:1}),j(m(U),{size:"small",type:"primary",loading:l.value,onClick:K},{default:x(()=>i[3]||(i[3]=[k("\u4FDD\u5B58")])),_:1},8,["loading"])])):H("v-if",!0)]),_:1},8,["modelValue"])}}});var Ou=Z(Eu,[["__file","C:/Users/89793/Desktop/projects/ticket-system/src/views/invoiceInOut/adjustOrder/components/NotOrderImportModal/index.vue"]]);export{Ou as default};