import{a5 as B,r as s,b as N,aH as q,n as i,o as $,c as x,p as f,q as c,v as u,P as g,x as n,s as b,t as k,l as M,bv as R,bH as U,D as A}from"./index.8d733f79.js";import{E as H}from"./el-progress.ee3fa77d.js";import{K as P,L as j}from"./collector.4eeb72e6.js";const K={"element-loading-background":"rgba(0,0,0,0.4)"},O={class:"importDialog"},z={class:"tit"},G={class:"desc"},J={style:{position:"relative"}},Q={class:"download"},W=["href","download"],X=["href","download"],Y={class:"dialog-footer"},Z=B({name:"importModal"}),le=Object.assign(Z,{emits:["refresh"],setup(ee,{expose:C,emit:T}){const{proxy:y}=A(),v=s(!1),a=s(),p=s([]),l=s(!1),w=s(""),F=s(),r=s(""),{t:m}=N(),E=e=>{l.value=!0,r.value=e,e==="add"?(w.value=m("batchAdd"),F.value=m("importLimit500")):e==="correct"&&(w.value=m("correctFactor"),F.value=m("importLimit500"))},V=e=>{var t,o;(t=a.value)==null||t.clearFiles(),(o=a.value)==null||o.handleStart(e[0])},D=()=>{var e;console.log("\u4E0A\u4F20\u7684\u6587\u4EF6",p.value),p.value.length||y.$modal.msgError(m("uploadFileP")),(e=a.value)==null||e.submit()},I=e=>{v.value=!0;let t="";r.value==="add"?t=P:r.value==="correct"&&(t=j);const o=new FormData;o.append("file",e.file),t(o).then(d=>{var _;y.$modal.msgSuccess(d.msg),r.value==="add"&&T("refresh"),(_=a.value)==null||_.clearFiles(),l.value=!1,v.value=!1}).catch(()=>{var d;(d=a.value)==null||d.clearFiles(),l.value=!1,v.value=!1})},L=()=>{var e;(e=a.value)==null||e.clearFiles()};return C({showModal:E}),(e,t)=>{const o=M,d=H,_=R,S=U;return q(($(),x("div",K,[f(_,{title:i(w),modelValue:i(l),"onUpdate:modelValue":t[2]||(t[2]=h=>b(l)?l.value=h:null),width:"480px","align-center":!0,onClosed:L,"append-to-body":""},{footer:c(()=>[u("div",Y,[f(o,{onClick:t[1]||(t[1]=h=>l.value=!1)},{default:c(()=>[g(n(e.$t("cancel")),1)]),_:1}),f(o,{type:"primary",onClick:D},{default:c(()=>[g(n(e.$t("confirm")),1)]),_:1})])]),default:c(()=>[u("div",O,[u("div",z,[g(n(e.$t("uploadFile")),1),u("span",G,n(i(F)),1)]),u("div",J,[f(d,{ref_key:"uploadRef",ref:a,"file-list":i(p),"onUpdate:file-list":t[0]||(t[0]=h=>b(p)?p.value=h:null),accept:".xlsx,.xls",action:"#","http-request":I,limit:1,"on-exceed":V,"auto-upload":!1},{default:c(()=>[f(o,{type:"primary"},{default:c(()=>[g(n(e.$t("selectImportFile")),1)]),_:1})]),_:1},8,["file-list"]),u("div",Q,[i(r)==="add"?($(),x("a",{key:0,href:"/template/sensorTemplate.xlsx",download:`${e.$t("addSensorTemplate")}.xlsx`},n(e.$t("downImportTemplate")),9,W)):k("",!0),i(r)==="correct"?($(),x("a",{key:1,href:"/template/corretFactorTemplate.xlsx",download:`${e.$t("corretFactorTemplate")}.xlsx`},n(e.$t("downImportTemplate")),9,X)):k("",!0)])])])]),_:1},8,["title","modelValue"])])),[[S,i(v),void 0,{fullscreen:!0,lock:!0}]])}}});export{le as default};
