import{P as g}from"./page.3b4d44cb.js";import{d as F}from"./goodsManage.ac38b63c.js";import{b as h,ar as b,E as u,_ as k,c as l,e as P,k as I,i,g as n,h as d,w as y,m,v as B,R as C,S as D}from"./index.0308b213.js";const E={components:{Page:g},setup(){const e=h({btnLoading:!1,formData:new FormData,filePath:""}),o=()=>{let t=document.createElement("a");t.href=window.location.protocol+"//"+window.location.host+"/resource/excel/goods.xlsx",t.target="downloadFile",t.click(),t.remove()},r=()=>{var t;(t=document.getElementById("file"))==null||t.click()},c=t=>{e.formData=new FormData;let s=t.target.files[0];e.formData.append("excel",s),e.filePath=s.name,console.log("\u6587\u4EF6",s)},p=()=>{if(!e.filePath){u.error("\u8BF7\u9009\u62E9\u6587\u4EF6");return}e.btnLoading=!0,F(e.formData).then(t=>{u.success("\u5BFC\u5165\u6210\u529F")}).finally(()=>{e.btnLoading=!1})};return{...b(e),download:o,selectFile:r,receiveFile:c,submit:p}}};const $=e=>(C("data-v-9d5fdde1"),e=e(),D(),e),V={class:"container"},S={class:"row"},L=m("\u4E0B\u8F7D\u5BFC\u5165\u6A21\u677F"),N={class:"row"},x=$(()=>n("span",null,"\u4E0A\u4F20",-1)),O={class:"row"},R=m("\u5BFC\u5165");function z(e,o,r,c,p,t){const s=l("el-button"),f=l("FolderOpened"),_=l("el-icon"),v=l("el-input"),w=l("Page");return P(),I(w,{showBorder:!1},{main:i(()=>[n("div",V,[n("div",S,[d(s,{onClick:o[0]||(o[0]=a=>e.download())},{default:i(()=>[L]),_:1})]),n("div",N,[d(v,{modelValue:e.filePath,"onUpdate:modelValue":o[2]||(o[2]=a=>e.filePath=a),disabled:!0},{append:i(()=>[n("div",{class:"btn-wrap",onClick:o[1]||(o[1]=a=>e.selectFile())},[d(_,{size:18},{default:i(()=>[d(f)]),_:1}),x])]),_:1},8,["modelValue"]),y(n("input",{id:"file",type:"file",onChange:o[3]||(o[3]=(...a)=>e.receiveFile&&e.receiveFile(...a))},null,544),[[B,!1]])]),n("div",O,[d(s,{type:"primary",loading:e.btnLoading,onClick:o[4]||(o[4]=a=>e.submit())},{default:i(()=>[R]),_:1},8,["loading"])])])]),_:1})}const U=k(E,[["render",z],["__scopeId","data-v-9d5fdde1"]]);export{U as default};
