index.c3ee09.js 6.1 KB

1
  1. import{aZ as i,_ as k,d as N,x as S,bU as I,r as b,o as r,c as m,G as x,m as _,a as h,l as v,D as f,F as L,E as T,bJ as P,M as w,cZ as $}from"./index.js";import{e as z}from"./execl-upload.7c83427b.js";import"./xlsx.ed122d16.js";const s=[{label:"\u53D1\u7968\u7533\u8BF7\u7F16\u53F7",width:"160px",prop:"invNo",templateValue:""},{label:"\u53D1\u7968\u4EE3\u7801",width:"120px",prop:"inv_code",templateValue:""},{label:"\u53D1\u7968\u53F7\u7801",width:"120px",prop:"inv_number",templateValue:""},{label:"\u6570\u7535\u7968\u53F7\u7801",width:"160px",prop:"inv_number_electionic",templateValue:""},{label:"\u9500\u65B9\u8BC6\u522B\u53F7",width:"160px",prop:"seller_id",templateValue:""},{label:"\u9500\u65B9\u540D\u79F0",width:"120px",prop:"seller_title",templateValue:""},{label:"\u8D2D\u65B9\u8BC6\u522B\u53F7",width:"140px",prop:"buyer_id",templateValue:""},{label:"\u8D2D\u4E70\u65B9\u540D\u79F0",width:"140px",prop:"buyer_title",templateValue:""},{label:"\u5F00\u7968\u65E5\u671F",width:"140px",prop:"open_date",templateValue:""},{label:"\u7A0E\u6536\u5206\u7C7B\u7F16\u7801",width:"140px",prop:"SSFL",templateValue:""},{label:"\u7279\u5B9A\u4E1A\u52A1\u7C7B\u578B",width:"140px",prop:"TDYWLX",templateValue:""},{label:"\u8D27\u7269\u6216\u5E94\u7A0E\u52B3\u52A1\u540D\u79F0",width:"140px",prop:"XMMC",templateValue:""},{label:"\u89C4\u683C\u578B\u53F7",width:"140px",prop:"GGXH",templateValue:""},{label:"\u5355\u4F4D",width:"140px",prop:"DW",templateValue:""},{label:"\u6570\u91CF",width:"140px",prop:"SPSL",templateValue:""},{label:"\u5355\u4EF7",width:"140px",prop:"DJ",templateValue:""},{label:"\u91D1\u989D",width:"140px",prop:"JE",templateValue:""},{label:"\u7A0E\u7387",width:"140px",prop:"SL",templateValue:""},{label:"\u7A0E\u989D",width:"140px",prop:"SE",templateValue:""},{label:"\u4EF7\u7A0E\u5408\u8BA1",width:"140px",prop:"JSHJ",templateValue:""},{label:"\u53D1\u7968\u6765\u6E90",width:"140px",prop:"source",templateValue:""},{label:"\u53D1\u7968\u7968\u79CD",width:"140px",prop:"inv_type",templateValue:""},{label:"\u53D1\u7968\u72B6\u6001",width:"140px",prop:"status",templateValue:""},{label:"\u662F\u5426\u6B63\u6570\u53D1\u7968",width:"140px",prop:"type",templateValue:""},{label:"\u53D1\u7968\u98CE\u9669\u7B49\u7EA7",width:"140px",prop:"warning",templateValue:""},{label:"\u5F00\u7968\u4EBA",width:"140px",prop:"person",templateValue:""},{label:"\u5907\u6CE8",width:"140px",prop:"remark",templateValue:""}],J=s.reduce((u,e)=>({...u,[e.label]:e.prop}),{}),M=[{type:"index",width:"50",fixed:"left",label:"\u5E8F\u53F7"},...s];s.reduce((u,e)=>({...u,[e.label]:e.templateValue}),{});const U=u=>u.length===0;function j(u){if(u.length!==s.length)return!1;for(const e in u)if(s[e].label!==u[e])return!1;return!0}function G(u){const e=[];for(const l of u){const t={},n=Object.keys(l);for(const o of n){const a=J[o];t[a]=l[o]}e.push(t)}return e}const B=[{label:"\u589E\u503C\u7A0E\u4E13\u7528\u53D1\u7968",value:"special"},{label:"\u589E\u503C\u7A0E\u666E\u901A\u53D1\u7968",value:"normal"},{label:"\u589E\u503C\u7A0E\u7535\u5B50\u4E13\u7528\u53D1\u7968",value:"special_electronic"},{label:"\u589E\u503C\u7A0E\u7535\u5B50\u666E\u901A\u53D1\u7968",value:"electronic"}],y=[{label:"\u6570\u7535\u7968\uFF08\u589E\u503C\u7A0E\u4E13\u7528\u53D1\u7968\uFF09",value:"fully_digitalized_special_electronic"},{label:"\u6570\u7535\u7968\uFF08\u666E\u901A\u53D1\u7968\uFF09",value:"fully_digitalized_normal_electronic"}],d=y.map(({label:u})=>u),E=B.map(({label:u})=>u),A=[{label:"\u662F",value:0},{label:"\u5426",value:1}],O=A.map(({label:u})=>u),X=A.reduce((u,e)=>({...u,[e.label]:e.value}),{}),W=[...y,...B].reduce((u,e)=>({...u,[e.label]:e.value}),{});function C(u){for(const e in u){const l=u[e],t=l.inv_type,n=l.type;if(![...d,...E].includes(t))return i.warning(`\u7B2C${Number(e)+1}\u884C,\u53D1\u7968\u7968\u79CD\u5FC5\u987B\u4E3A:${[...d,...E].join(",")}`),!1;if(!O.includes(n))return i.warning(`\u7B2C${Number(e)+1}\u884C,\u662F\u5426\u4E3A\u6B63\u6570\u53D1\u7968\u5FC5\u987B\u4E3A: \u662F/\u5426`),!1;if(d.includes(t)&&l.inv_number_electionic.trim()==="")return i.warning(`\u7B2C${Number(e)+1}\u884C,\u53D1\u7968\u7968\u79CD\u4E3A\u6570\u7535\u7968\u662F,\u6570\u7535\u7968\u53F7\u7801\u4E0D\u80FD\u4E3A\u7A7A`),!1;if(E.includes(t)&&l.inv_number.trim()==="")return i.warning(`\u7B2C${Number(e)+1}\u884C,\u53D1\u7968\u7968\u79CD\u4E3A\u975E\u6570\u7535\u7968\u65F6,\u53D1\u7968\u7968\u53F7\u7801\u4E0D\u80FD\u4E3A\u7A7A`),!1}return!0}function Z(u){const e=[];return u.forEach(l=>{const{inv_number_electionic:t,inv_number:n,inv_type:o,type:a,...p}=l;e.push({inv_number:d.includes(o)?t:n,inv_type:W[o],type:X[a],check_code:"",seller_addr:"",seller_mobile:"",seller_bank:"",seller_bankNo:"",buyer_addr:"",buyer_mobile:"",buyer_bank:"",buyer_bankNo:"",SPBM:"",...p})}),e}const H={class:"flex flex-col bg-white"},Y={key:1,flex:"","justify-end":"","gap-2":"",style:{padding:"10px 0 0 0"}},q=N({__name:"index",emits:["onSuccess"],setup(u,{emit:e}){const l=S([]),t=I({success(){l.value=[],i.success("\u6570\u636E\u5BFC\u5165\u6210\u529F\uFF01"),e("onSuccess")}}),n=({results:a,header:p})=>{if(t.loading=!0,U(a)){i.error("\u8868\u683C\u65E0\u6709\u6548\u6570\u636E\uFF01"),t.loading=!1;return}if(!j(p)){i.error("\u8868\u5934\u4E0E\u5BFC\u5165\u6A21\u677F\u4E0D\u5339\u914D\uFF01"),t.loading=!1;return}const c=G(a);C(c)&&(l.value=c),t.loading=!1};function o(){if(t.loading||!C(l.value))return;const a=Z(l.value);t.run($({data:a}))}return(a,p)=>{const c=b("el-table-column"),V=b("el-table"),F=b("el-button");return r(),m("div",H,[l.value.length===0?(r(),x(_(z),{key:0,class:"mb-[10px]",onOnSuccess:n})):h("v-if",!0),v(V,{data:l.value,stripe:"",border:"","max-height":"500px",size:"small",style:{width:"100%"}},{default:f(()=>[(r(!0),m(L,null,T(_(M),(D,g)=>(r(),x(c,P(D,{key:g,"show-overflow-tooltip":""}),null,16))),128))]),_:1},8,["data"]),l.value.length!==0?(r(),m("div",Y,[v(F,{size:"small",onClick:p[0]||(p[0]=D=>l.value=[])},{default:f(()=>[w("\u53D6\u6D88")]),_:1}),v(F,{size:"small",type:"primary",loading:_(t).loading,onClick:o},{default:f(()=>[w("\u4FDD\u5B58")]),_:1},8,["loading"])])):h("v-if",!0)])}}});var ee=k(q,[["__scopeId","data-v-808cc320"],["__file","C:/Users/89793/Desktop/projects/settle-vue3/src/views/InvoiceSales/invoiceDetailImport/index.vue"]]);export{ee as default};