import{_ as L,d as T,x as E,w as W,W as K,r as C,o as s,G as v,D as d,m as q,a as k,l as f,c as m,F as N,E as S,L as V,M as D,aZ as F,bW as M,bx as $,Q as G,R as Q,h as R}from"./index.js";import{e as Z}from"./index.4e61d38f.js";import{e as J}from"./execl-upload.7c83427b.js";import"./xlsx.ed122d16.js";const _=[{label:"\u4E1A\u52A1\u516C\u53F8\u7F16\u7801",width:"130px",prop:"companyNo",required:!0},{label:"\u4E1A\u52A1\u516C\u53F8\u540D\u79F0",width:"130px",prop:"companyName",required:!0},{label:"\u6536\u6B3E\u65B9\u516C\u53F8\u7F16\u7801",width:"160px",prop:"trade_in_code",required:!0},{label:"\u6536\u6B3E\u65B9\u516C\u53F8\u540D\u79F0",width:"160px",prop:"trade_in",required:!0},{label:"\u6536\u6B3E\u65B9\u8D26\u6237",width:"140px",prop:"trade_in_account",required:!0},{label:"\u5E73\u53F0\u91C7\u8D2DPO",width:"120px",prop:"palt_po",required:!0},{label:"\u5BA2\u6237PO",width:"140px",prop:"poCode",required:!0},{label:"\u5E73\u53F0\u7269\u6599\u540D\u79F0",width:"140px",prop:"goodName",required:!0},{label:"\u5355\u4F4D",width:"80px",prop:"unit",required:!0},{label:"\u4EA7\u54C1\u6570\u91CF",width:"120px",prop:"goodNum",required:!0},{label:"\u4E1A\u52A1\u516C\u53F8\u6536\u5165\u5355\u4EF7",width:"160px",prop:"comPrice",required:!0},{label:"\u4E1A\u52A1\u516C\u53F8\u6536\u5165\u603B\u4EF7",width:"160px",prop:"com_total",required:!0},{label:"\u7A0E\u7387(%)",width:"120px",prop:"tax",required:!0},{label:"\u7A0E\u6536\u7F16\u7801",width:"120px",prop:"cat_code",required:!0},{label:"\u7A0E\u6536\u7F16\u7801\u540D\u79F0",width:"120px",prop:"cat_name",required:!0},{label:"\u5BA2\u6237DN",width:"120px",prop:"NdCode",required:!0},{label:"\u5BA2\u6237\u673A\u6784\u540D\u79F0",width:"140px",prop:"customerName",required:!0},{label:"\u5BA2\u6237\u4ED8\u6B3E\u94F6\u884C\u6237\u540D",width:"160px",prop:"trade_out",required:!0},{label:"\u5E73\u53F0\u516C\u53F8\u6536\u5165\u5355\u4EF7",width:"140px",prop:"platPrice",required:!0},{label:"\u5E73\u53F0\u516C\u53F8\u6536\u5165\u603B\u4EF7",width:"140px",prop:"plat_total",required:!0},{label:"\u4EA4\u6613\u65F6\u95F4",width:"120px",prop:"tradeTime",required:!0},{label:"\u6CF0e\u8D2DSKU",width:"120px",prop:"skuCode",required:!0},{label:"\u5546\u54C1\u552F\u4E00\u7F16\u53F7(\u91C7\u9500365\u5546\u54C1\u7F16\u53F7)",width:"200px",prop:"goodNo"},{label:"\u5BA2\u6237\u4ED8\u6B3E\u94F6\u884C\u8D26\u53F7",width:"160px",prop:"trade_account",required:!0},{label:"\u5BA2\u6237\u4ED8\u6B3E\u884C\u540D",width:"160px",prop:"trade_bank",required:!0},{label:"\u4EA4\u6613\u7528\u9014",width:"120px",prop:"trade_used",required:!0}],X=()=>[{type:"index",width:"50",fixed:"left",label:"\u5E8F\u53F7"},..._],Y=i=>{var h;return(h=_.find(B=>B.label===i.replace("*","")))==null?void 0:h.prop};const ee=i=>(G("data-v-01415b55"),i=i(),Q(),i),ue={key:0},te={key:1},le=ee(()=>R("span",{style:{color:"#f56c6c","font-size":"14px"}},"* ",-1)),re={key:1,flex:"","justify-end":"","gap-2":"",style:{padding:"10px 0 0 0"}},ae=T({__name:"index",emits:["onSuccess"],setup(i,{expose:h,emit:B}){const x=E(!1),r=E(!1),t=E([]),{logout:U}=W(),O=X(),{currentCompany:P}=K(),w=E(!1),g=E([]),z=({results:n,header:l})=>{if(r.value=!0,n.length===0){F.error("\u8868\u683C\u65E0\u6709\u6548\u6570\u636E\uFF01"),r.value=!1;return}let p=!0;const c=_.map(({label:a})=>a);if(l.length!==_.length?p=!1:c.forEach((a,u)=>{const e=l[u].replace("*","");a!==e&&(p=!1)}),!p){w.value=!0,g.value=[...l],r.value=!1;return}t.value=[];try{const a=[],u=[],e=[];n.forEach((b,H)=>{const A={};Object.keys(b).forEach(y=>{A[Y(y)]=b[y]}),/^\d{4}-\d{2}-\d{2}$/.test(String(A.tradeTime))||e.push(H+1),t.value.push(A)});const o=[...new Set(t.value.map(({companyNo:b})=>b))];if(o.length!==1){F.warning("\u4E0A\u4F20\u6570\u636E\u7684\u6536\u6B3E\u65B9\u516C\u53F8\u5FC5\u987B\u4E3A\u540C\u4E00\u5BB6\u516C\u53F8"),t.value=[];return}if(o[0]!==P.value.companyNo){F.warning("\u4E0A\u4F20\u6570\u636E\u7684\u6536\u6B3E\u65B9\u516C\u53F8\u4E0E\u5F53\u524D\u9009\u4E2D\u7684\u4E1A\u52A1\u516C\u53F8\u4E0D\u4E00\u81F4"),t.value=[];return}if(r.value=!1,e.length!==0){t.value=[],F.error(`\u7B2C${e.join(",")}\u884C,\u4EA4\u6613\u65F6\u95F4\u683C\u5F0F\u9519\u8BEF,\u683C\u5F0F\u4E3A:2020-01-01`);return}}catch{F.error("\u5BFC\u5165\u6570\u636E\u62FC\u63A5\u6709\u8BEF\uFF01"),r.value=!1}},I=async()=>{if(r.value)return;r.value=!0;let n=!0,l=[];const p=_.filter(u=>!!u.required).map(({prop:u})=>u);if(t.value.forEach(u=>{let e={};for(let o in u)e[o]=u[o],p.includes(o)&&!u[o]&&(n=!1);l.push({...e,trade_fee:e.com_total,trade_type:"1",trade_remark:""})}),!n){M({title:"\u5FC5\u586B\u5B57\u6BB5\u7F3A\u5931\uFF01",type:"error"}),r.value=!1;return}const{code:c,message:a}=await Z({data:l});r.value=!1,$({code:c,message:a,logout:U,handler:()=>{x.value=!1,F.success("\u6570\u636E\u5BFC\u5165\u6210\u529F\uFF01"),B("onSuccess")}})},j=()=>{t.value=[]};return h({onDisplay:()=>{x.value=!0,t.value=[]}}),(n,l)=>{const p=C("el-table-column"),c=C("el-table"),a=C("el-button"),u=C("el-dialog");return s(),v(u,{"close-on-click-modal":!1,"close-on-press-escape":!1,modelValue:x.value,"onUpdate:modelValue":l[1]||(l[1]=e=>x.value=e),title:"\u5BFC\u5165\u5E73\u53F0\u8BA2\u5355\u56DE\u6B3E\u6570\u636E",width:"1040px",top:"8vh",center:""},{default:d(()=>[t.value.length===0?(s(),v(q(J),{key:0,onOnSuccess:z})):k("v-if",!0),f(c,{stripe:"",border:"",size:"small",data:t.value,"max-height":"500px",style:{width:"100%"}},{default:d(()=>[(s(!0),m(N,null,S(q(O),(e,o)=>(s(),v(p,{width:e.width,fixed:e.fixed,type:e.type,prop:e.prop,key:o,"show-overflow-tooltip":""},{header:d(()=>[e.required?(s(),m("p",te,[le,D(" "+V(e.label),1)])):(s(),m("span",ue,V(e.label),1))]),_:2},1032,["width","fixed","type","prop"]))),128))]),_:1},8,["data"]),t.value.length!==0?(s(),m("div",re,[f(a,{size:"small",onClick:j},{default:d(()=>[D("\u53D6\u6D88")]),_:1}),f(a,{size:"small",type:"primary",loading:r.value,onClick:I},{default:d(()=>[D("\u4FDD\u5B58")]),_:1},8,["loading"])])):k("v-if",!0),f(u,{modelValue:w.value,"onUpdate:modelValue":l[0]||(l[0]=e=>w.value=e),title:"\u5BFC\u5165\u6587\u4EF6\u8868\u5934\u4E0E\u6A21\u677F\u8868\u5934\u4E0D\u4E00\u81F4,\u5F53\u524D\u5BFC\u5165\u6587\u4EF6\u8868\u5934\u4E3A:","close-on-click-modal":!1,"close-on-press-escape":!1},{default:d(()=>[f(c,{border:"",size:"small"},{default:d(()=>[(s(!0),m(N,null,S(g.value,e=>(s(),v(p,{fit:"",label:e.indexOf("UNKNOWN")!==-1?"":e},null,8,["label"]))),256))]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["modelValue"])}}});var ne=L(ae,[["__scopeId","data-v-01415b55"],["__file","C:/Users/89793/Desktop/projects/settle-vue3/src/views/InvoiceSales/capitalClaim/components/execl-files-business-upload/index.vue"]]);export{ne as default};