import{az as C,d as $,r as h,b as F,c as r,at as q,e as f,f as g,g as a,h as o,i as u,u as c,w as D,v as z,k as O,A as E,F as R,m as b,E as v,R as U,S as M,_ as T}from"./index.0308b213.js";import{A as j}from"./index.1d26a072.js";import"./install.524ae6f2.js";import"./useAgent.c0cb1751.js";import"./list.5526c7ef.js";const G=n=>C.request({url:"addon/agent.web.index/previewImportData",method:"post",data:n}),H=n=>C.request({url:"addon/agent.web.index/submitImportData",method:"post",data:n}),J=n=>(U("data-v-70b4207f"),n=n(),M(),n),K={class:"container"},Q={class:"row"},W=b("\u4E0B\u8F7D\u5BFC\u5165\u6A21\u677F"),X={class:"row"},Y=J(()=>a("span",null,"\u4E0A\u4F20",-1)),Z={class:"row"},ee=b("\u9884\u89C8"),te={key:0,class:"table"},oe={class:"table-operation-btn"},le={class:"top"},ae=b("\u5220\u9664"),ne={key:1,class:"op"},se=b("\u63D0\u4EA4\u5E76\u5165\u8D26"),ue=$({setup(n){const p=h(""),w=h(!1),_=h(!1),l=F({filePath:"",formData:null,btnLoading:!1}),i=F({list:[]}),x=()=>{let e=document.createElement("a");e.href=window.location.protocol+"//"+window.location.host+"/resource/excel/\u4EE3\u7406\u6570\u636E\u5BFC\u5165.xlsx",e.target="downloadFile",e.click(),e.remove()},k=()=>{var e;(e=document.getElementById("file"))==null||e.click()},B=e=>{l.formData=new FormData;let t=e.target.files[0];l.formData.append("excel",t),l.filePath=t.name,console.log("\u6587\u4EF6",t)},y=()=>{if(!l.filePath){v.error("\u8BF7\u9009\u62E9\u6587\u4EF6");return}l.btnLoading=!0,G(l.formData).then(e=>{console.log("res",e),i.list=e,w.value=!1,_.value=!0,v.success("\u5F00\u59CB\u9884\u89C8")}).finally(()=>{l.btnLoading=!1})},A=e=>{i.list.splice(e,1)},V=()=>{if(!p.value){v.error("\u8BF7\u9009\u62E9\u4EE3\u7406");return}let e={agentid:p.value,list:i.list};H(e).then(t=>{v.success("\u5BFC\u5165\u6210\u529F"),i.list=[],_.value=!1,l.filePath=""})};return(e,t)=>{const m=r("el-button"),I=r("FolderOpened"),P=r("el-icon"),S=r("el-input"),d=r("el-table-column"),L=r("el-table"),N=q("loading");return f(),g(R,null,[a("div",K,[a("div",Q,[o(m,{onClick:t[0]||(t[0]=s=>x())},{default:u(()=>[W]),_:1})]),a("div",X,[o(S,{modelValue:c(l).filePath,"onUpdate:modelValue":t[2]||(t[2]=s=>c(l).filePath=s),disabled:!0},{append:u(()=>[a("div",{class:"btn-wrap",onClick:t[1]||(t[1]=s=>k())},[o(P,{size:18},{default:u(()=>[o(I)]),_:1}),Y])]),_:1},8,["modelValue"]),D(a("input",{id:"file",type:"file",onChange:B},null,544),[[z,!1]])]),a("div",Z,[o(m,{type:"warning",loading:c(l).btnLoading,onClick:t[3]||(t[3]=s=>y())},{default:u(()=>[ee]),_:1},8,["loading"])])]),_.value?(f(),g("div",te,[D((f(),O(L,{data:c(i).list},{default:u(()=>[o(d,{type:"index",width:"50",label:"\u5E8F\u53F7"}),o(d,{label:"\u8BA2\u5355\u53F7",prop:"order_sn"}),o(d,{label:"\u6E20\u9053",prop:"order_channel"}),o(d,{label:"\u8BA2\u5355\u91D1\u989D",prop:"order_price"}),o(d,{label:"\u8FD4\u4F63\u91D1\u989D",prop:"order_commission"}),o(d,{fixed:"right",label:"\u64CD\u4F5C",width:"290px"},{default:u(({row:s})=>[a("div",oe,[a("div",le,[o(m,{size:"small",type:"danger",onClick:ie=>A(s.index)},{default:u(()=>[ae]),_:2},1032,["onClick"])])])]),_:1})]),_:1},8,["data"])),[[N,w.value]])])):E("",!0),_.value&&c(i).list.length>0?(f(),g("div",ne,[o(c(j),{modelValue:p.value,"onUpdate:modelValue":t[4]||(t[4]=s=>p.value=s)},null,8,["modelValue"]),o(m,{type:"primary",onClick:V},{default:u(()=>[se]),_:1})])):E("",!0)],64)}}});const me=T(ue,[["__scopeId","data-v-70b4207f"]]);export{me as default};
