import{aT as P,a1 as q,_ as z,d as U,w as W,aR as R,aU as H,r as A,o as f,G as v,C as x,l as b,a as g,j as B,c as _,F as G,D as J,L as k,h as K,M as F,aJ as O,a6 as Q,aS as X,aq as y}from"./index.js";import{e as Y}from"./execl-upload.2ba69270.js";import{b as S,c as V,t as T,s as j}from"./shared.6241f91b.js";import{m as I,x as w}from"./status.21dece30.js";import{b as Z}from"./index.54c70d49.js";const m=[{type:"index",fixed:"left",label:"\u5E8F\u53F7",width:"50"},{label:"\u4E1A\u52A1\u7F16\u53F7",prop:"invoiceCode",minWidth:"100px",defaultData:"",required:!0},{label:"\u7C7B\u578B",prop:"type",minWidth:"100px",defaultData:"",required:!0},{label:"\u8BA2\u5355\u6765\u6E90",prop:"source",minWidth:"100px",defaultData:"",required:!0},{label:"\u9500\u552E\u65B9\u516C\u53F8\u7EB3\u7A0E\u8BC6\u522B\u53F7",prop:"seller_code",minWidth:"160px",defaultData:"",required:!0},{label:"\u9500\u552E\u65B9\u516C\u53F8",prop:"seller_name",minWidth:"100px",defaultData:"",required:!0},{label:"\u8BA2\u5355\u7F16\u53F7",prop:"orderCode",minWidth:"120px",defaultData:"",required:!0},{label:"\u8BA2\u5355\u4E3B\u5355\u53F7",prop:"cxCode",minWidth:"120px",defaultData:"",required:!0},{label:"\u5546\u54C1\u7F16\u53F7",prop:"goodNo",minWidth:"100px",defaultData:"",required:!0},{label:"\u5546\u54C1\u540D\u79F0",prop:"goodName",minWidth:"100px",defaultData:"",required:!0},{label:"\u5355\u4F4D",prop:"unit",minWidth:"80px",defaultData:"",required:!0},{label:"\u5546\u54C1\u6570\u91CF",prop:"num",minWidth:"110px",defaultData:"",required:!0},{label:"\u5546\u54C1\u5355\u4EF7",prop:"goodPrice",minWidth:"110px",defaultData:"",required:!0},{label:"\u8BA2\u5355\u603B\u91D1\u989D",prop:"totalPrice",minWidth:"110px",defaultData:"",required:!0},{label:"\u7A0E\u76EE",prop:"cat_code",minWidth:"80px",defaultData:"",required:!0},{label:"\u7A0E\u76EE\u540D\u79F0",prop:"cat_name",minWidth:"100px",defaultData:"",required:!0},{label:"\u7A0E\u7387",prop:"tax",minWidth:"100px",defaultData:"",required:!0},{label:"\u5173\u8054\u91D1\u989D",prop:"inv_fee",minWidth:"100px",defaultData:"",required:!0},{label:"\u8D2D\u4E70\u65B9\u516C\u53F8\u540D\u79F0",prop:"inv_buyer_name",minWidth:"130px",defaultData:"",required:!0},{label:"\u8D2D\u4E70\u65B9\u516C\u53F8\u7EB3\u7A0E\u8BC6\u522B\u53F7",prop:"inv_buyer_code",minWidth:"170px",defaultData:"",required:!0},{label:"\u53D1\u7968\u53F7\u7801",prop:"inv_number",minWidth:"100px",defaultData:"",required:!0},{label:"\u53D1\u7968\u7C7B\u578B",prop:"inv_type",minWidth:"100px",defaultData:"",required:!0},{label:"\u53D1\u7968\u9500\u552E\u65B9\u516C\u53F8",prop:"inv_seller_name",minWidth:"130px",defaultData:"",required:!0},{label:"\u53D1\u7968\u9500\u552E\u65B9\u516C\u53F8\u7EB3\u7A0E\u53F7",prop:"inv_seller_code",minWidth:"170px",defaultData:"",required:!0},{label:"\u53D1\u7968\u660E\u7EC6ID",prop:"inv_item_id",minWidth:"110px",defaultData:"",required:!0},{label:"\u8D27\u7269\u6216\u5E94\u7A0E\u52B3\u52A1\u3001\u670D\u52A1\u540D\u79F0",prop:"inv_good_name",minWidth:"200px",defaultData:"",required:!0},{label:"\u7C7B\u76EE\u7F16\u53F7",prop:"inv_cat_code",minWidth:"90px",defaultData:"",required:!0},{label:"\u89C4\u683C\u578B\u53F7",prop:"inv_spec",minWidth:"110px",defaultData:"",required:!0},{label:"\u53D1\u7968\u5546\u54C1\u5355\u4F4D",prop:"inv_unit",minWidth:"100px",defaultData:"",required:!0},{label:"\u53D1\u7968\u5546\u54C1\u6570\u91CF",prop:"inv_num",minWidth:"100px",defaultData:"",required:!0},{label:"\u7A0E\u524D\u5355\u4EF7",prop:"inv_price",minWidth:"100px",defaultData:"",required:!0},{label:"\u7A0E\u524D\u603B\u4EF7",prop:"inv_subprice",minWidth:"100px",defaultData:"",required:!0},{label:"\u53D1\u7968\u7A0E\u7387",prop:"inv_tax",minWidth:"80px",defaultData:"",required:!0},{label:"\u7A0E\u540E\u5355\u4EF7",prop:"inv_price",minWidth:"100px",defaultData:"",required:!0},{label:"\u7A0E\u540E\u603B\u989D",prop:"inv_total",minWidth:"100px",defaultData:"",required:!0},{label:"\u7C7B\u76EE\u7F16\u53F7\u72B6\u6001",prop:"TODO34",minWidth:"100px",defaultData:"",required:!1},{label:"\u7A0E\u7387\u72B6\u6001",prop:"TODO35",minWidth:"100px",defaultData:"",required:!1},{label:"\u5907\u6CE8",prop:"remark",minWidth:"80px",defaultData:"",required:!0},{label:"\u5165\u8D26\u6708\u4EFD",prop:"TODO37",minWidth:"80px",defaultData:"",required:!0}],ce=[m.slice(1).reduce((a,e)=>({...a,[e.label]:e.defaultData?e.defaultData:""}),{})],$=m.reduce((a,e)=>({...a,[e.label]:e.prop}),{}),M=m.reduce((a,e)=>({...a,[e.prop]:e.label}),{}),ee=m.filter(a=>!!a.required).map(a=>a.prop);function ue(a){P({type:"warning",title:"\u6570\u636E\u6821\u9A8C\u5931\u8D25",message:q("div",{style:"display: flex, flex-direction: column"},{default:()=>Object.keys(a).reduce((e,r)=>[...e,q("p",{},"\u7B2C"+r+"\u884C,"+a[r])],[])})})}function te(a){const e={};let r=!1,o=!1,E=!1;for(const h in a){const p=a[h],l=Number(h)+1;for(const u in p){const n=String(p[u]).trim();ee.includes(u)&&(!n||!String(n).trim())?e[l]?e[l]=e[l]+="\u3001"+M[u]:e[l]=M[u]:u==="type"&&!S[n]?r=!0:u==="source"&&!V[n]?o=!0:u==="inv_type"&&!I[n]&&(E=!0)}e[l]?(e[l]+="\u4E0D\u80FD\u4E3A\u7A7A",r&&(e[l]+=" , \u7C7B\u578B\u5FC5\u987B\u4E3A"+T.map(({label:u})=>u).join("\u3001")),o&&(e[l]+=" ,\u8BA2\u5355\u6765\u6E90\u5FC5\u987B\u4E3A"+j.map(({label:u})=>u).join("\u3001")),E&&(e[l]+=" ,\u53D1\u7968\u7C7B\u578B\u5FC5\u987B\u4E3A"+w.map(({label:u})=>u).join("\u3001"))):(r&&(e[l]="\u7C7B\u578B\u5FC5\u987B\u4E3A"+T.map(({label:u})=>u).join("\u3001")),o&&(e[l]=" \u8BA2\u5355\u6765\u6E90\u5FC5\u987B\u4E3A"+j.map(({label:u})=>u).join("\u3001")),E&&(e[l]=" \u53D1\u7968\u7C7B\u578B\u5FC5\u987B\u4E3A"+w.map(({label:u})=>u).join("\u3001")))}return Object.keys(e).length===0?!0:(ue(e),!1)}function ae(a){return!!te(a)}const re={key:0},le={key:1},ie={key:1,flex:"","justify-end":"","gap-2":"",style:{padding:"10px 0 0 0"}},oe=U({__name:"index",props:{visible:{type:Boolean,required:!0}},emits:["refresh"],setup(a,{emit:e}){const r=W(!1),o=W([]),E=e,p=R(a,"visible"),l=H(),u=({results:d,header:i})=>{if(r.value=!0,d.length===0){y.error("\u8868\u683C\u65E0\u6709\u6548\u6570\u636E\uFF01"),r.value=!1;return}let s=!0;if(i.length!==m.length-1?s=!1:m.slice(1).forEach((t,D)=>{t.label!==i[D]&&(s=!1)}),!s){y.error("\u8868\u5934\u4E0E\u5BFC\u5165\u6A21\u677F\u4E0D\u5339\u914D\uFF01"),r.value=!1;return}o.value=[];const c=[];for(const t of d){const D={};Object.keys(t).forEach(C=>{const N=$[C];D[N]=t[C]}),c.push(D)}ae(c)&&(o.value=c),r.value=!1},n=async()=>{try{if(r.value)return;r.value=!0;const d=[];o.value.forEach(t=>{d.push({...t,inv_type:I[t.inv_type],source:V[t.source],type:S[t.type],buyer_name:t.inv_buyer_name,buyer_code:t.inv_buyer_code,platform_type:"1",channel:"1",goodType:"1"})});const{code:i,message:s,data:c}=await Z({list:d});r.value=!1,l({code:i,message:s,noMessage:!1,handler:()=>{y.success("\u6570\u636E\u5BFC\u5165\u6210\u529F\uFF01"),E("refresh"),p.value=!1}})}catch{}},L=()=>{o.value=[]};return(d,i)=>{const s=A("el-table-column"),c=A("el-table");return f(),v(b(X),{modelValue:b(p),"onUpdate:modelValue":i[0]||(i[0]=t=>Q(p)?p.value=t:null),"close-on-click-modal":!1,title:"\u8BA2\u5355\u5546\u54C1\u5BFC\u5165",width:"1040px",top:"8vh",center:""},{default:x(()=>[o.value.length===0?(f(),v(b(Y),{key:0,style:{"margin-bottom":"10px"},onOnSuccess:u})):g("v-if",!0),B(c,{data:o.value,stripe:"",border:"","max-height":"500px",size:"small",style:{width:"100%"}},{default:x(()=>[(f(!0),_(G,null,J(b(m),(t,D)=>(f(),v(s,{minWidth:t.minWidth,"show-overflow-tooltip":"",fixed:t.fixed,prop:t.prop,type:t.type,key:D},{header:x(()=>[t.required?(f(),_("p",le,[i[1]||(i[1]=K("span",{style:{color:"#f56c6c","font-size":"14px"}},"* ",-1)),F(" "+k(t.label),1)])):(f(),_("span",re,k(t.label),1))]),_:2},1032,["minWidth","fixed","prop","type"]))),128))]),_:1},8,["data"]),o.value.length!==0?(f(),_("div",ie,[B(b(O),{size:"small",onClick:L},{default:x(()=>i[2]||(i[2]=[F("\u53D6\u6D88")])),_:1}),B(b(O),{size:"small",type:"primary",loading:r.value,onClick:n},{default:x(()=>i[3]||(i[3]=[F("\u4FDD\u5B58")])),_:1},8,["loading"])])):g("v-if",!0)]),_:1},8,["modelValue"])}}});var pe=z(oe,[["__file","C:/Users/89793/Desktop/projects/ticket-system/src/views/invoiceInOut/inOutManager/components/OrderImportModal/index.vue"]]),De=Object.freeze(Object.defineProperty({__proto__:null,default:pe},Symbol.toStringTag,{value:"Module"}));export{pe as O,De as i,ce as o};