importView-fb0e1b34.js 3.9 KB

1
  1. var n=(r,k,u)=>new Promise((v,m)=>{var s=a=>{try{f(u.next(a))}catch(l){m(l)}},d=a=>{try{f(u.throw(a))}catch(l){m(l)}},f=a=>a.done?v(a.value):Promise.resolve(a.value).then(s,d);f((u=u.apply(r,k)).next())});import{Y as D,aN as P,_ as O}from"./index.js";import{a as j,B as G}from"./index-b6d25274.js";import{l as R,e as T,g as Y}from"./index-1a7dcfc1.js";import{j as A}from"./patientBasicApi-ab0fd18a.js";import{d as L,b as Q}from"./download-fac9a150.js";import{Q as h,aE as $,aG as q}from"./antd-49db3de3.js";import{d as z,f as p,r as H,B as J,b as K,Y as _,a6 as g,a7 as i,u as c,l as b,_ as e,$ as C,E as w,a1 as W,a2 as X}from"./vue-8fccce23.js";import"./useWindowSizeFn-e2b93e2a.js";const y=r=>(W("data-v-7c3d180b"),r=r(),X(),r),Z=y(()=>e("h2",{style:{"text-align":"center"}},"数据导入中...",-1)),ee=y(()=>e("h5",{style:{"text-align":"center"}},"请不要离开此页面",-1)),te=y(()=>e("h2",{style:{"text-align":"center"}},"成功",-1)),ae=y(()=>e("h2",{style:{"text-align":"center"}},"失败",-1)),oe={style:{"text-align":"center"}},se=y(()=>e("h2",{style:{"text-align":"center"}},"选择需要导入的文件",-1)),le={class:"flex flex-col justify-center"},ne=z({__name:"importView",setup(r){const u=D().apiUrl+"/archives/patientBasic/import/batch",v=p(),m=p(),s=p("default"),d=p(null),f=p(""),a=p(0),l=H({success:0,fail:0,total:0});J(()=>n(this,null,function*(){m.value=yield R({dictCode:"sys_login_log_type"}),v.value=""}));const[B,{setModalProps:I}]=j(t=>n(this,null,function*(){console.log("🚀 ~ file: code.vue:21 ~ data:",t),I({confirmLoading:!1})}));function S(t){return n(this,null,function*(){console.log("file",t),v.value=t})}function U(){return n(this,null,function*(){console.log("11111")})}function M(){s.value="default"}function E(){s.value="default"}function V(t){return n(this,null,function*(){if(t.file.status==="done"){s.value="done";const x=t.file.response.data;x&&(d.value=setInterval(function(){return n(this,null,function*(){const o=yield T(x);console.log("importStats",o),l.fail=o.failCount,l.success=o.successCount,l.total=o.totalCount,a.value=(o.failCount+o.successCount)/o.totalCount*100,console.log("进度条:",a.value),o.failCount+o.successCount==o.totalCount&&(clearInterval(d.value),setTimeout(()=>{o.failCount?(s.value="fail",f.value=o.exportFileId,a.value=0):(s.value="success",a.value=0)},3e3))})},1e3))}})}function F(){return n(this,null,function*(){const t=yield Y(f.value);console.log("res",t),L({url:t})})}function N(){return n(this,null,function*(){const t=yield A([]);Q(t.base64,t.fileName+".xlsx")})}return K(()=>{d.value&&clearInterval(d.value)}),(t,x)=>(_(),g(c(G),{onRegister:c(B),width:"500px",title:"导入数据",onOk:U,onCancel:M},{default:i(()=>[s.value=="done"?(_(),g(c(h),{key:0,style:{"background-color":"rgb(240 240 240)"}},{default:i(()=>[Z,ee,b(c($),{percent:a.value,showInfo:!1,status:"active"},null,8,["percent"])]),_:1})):s.value=="success"?(_(),g(c(h),{key:1,style:{"background-color":"rgb(240 240 240)"}},{default:i(()=>[te,e("h2",{style:{"text-align":"center"}},[e("a",{onClick:E},"继续导入")])]),_:1})):s.value=="fail"?(_(),g(c(h),{key:2,style:{"background-color":"rgb(240 240 240)"}},{default:i(()=>[ae,e("h5",{style:{"text-align":"center"}},[e("a",{onClick:F},"下载失败文件")]),e("div",oe,[e("span",null," 失败: "+C(l.fail),1),e("span",null," 成功: "+C(l.success),1),e("span",null," 总数: "+C(l.total),1)])]),_:1})):(_(),g(c(h),{key:3,style:{"background-color":"rgb(240 240 240)"}},{default:i(()=>[se,e("h5",{style:{"text-align":"center"}},[w("若您是第一次上传文件,可先下载"),e("a",{onClick:N},"文件模板"),w(",文件大小不超过5M")]),e("div",le,[b(c(q),{class:"button-style",name:"file",beforeUpload:S,maxCount:1,action:u,onChange:V},{default:i(()=>[b(c(P),{type:"primary"},{default:i(()=>[w(" 点击上传 ")]),_:1})]),_:1})])]),_:1}))]),_:1},8,["onRegister"]))}});const ve=O(ne,[["__scopeId","data-v-7c3d180b"]]);export{ve as default};