importView-082a5e5f.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{Z as N,aO as O,_ as P}from"./index.js";import{a as G,B as R}from"./index-4f5bc708.js";import{l as T,e as j,g as A}from"./index-a4e1ec38.js";import{h as L}from"./patientBasicApi-2879cdeb.js";import{d as Q,b as Y}from"./download-2ecc6b15.js";import{Q as h,aE as Z,aG as $}from"./antd-f259b82a.js";import{d as q,f as p,r as z,B as H,b as J,Y as _,a6 as g,a7 as i,u as c,l as b,_ as e,$ as C,E as w,a1 as K,a2 as W}from"./vue-aed314e3.js";import"./useWindowSizeFn-6e9d633b.js";const y=r=>(K("data-v-7c3d180b"),r=r(),W(),r),X=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=q({__name:"importView",setup(r){const u=N().apiUrl+"/archives/patientBasic/import/batch",v=p(),m=p(),s=p("default"),d=p(null),f=p(""),a=p(0),l=z({success:0,fail:0,total:0});H(()=>n(this,null,function*(){m.value=yield T({dictCode:"sys_login_log_type"}),v.value=""}));const[B,{setModalProps:I}]=G(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 j(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 A(f.value);console.log("res",t),Q({url:t})})}function D(){return n(this,null,function*(){const t=yield L([]);Y(t.base64,t.fileName+".xlsx")})}return J(()=>{d.value&&clearInterval(d.value)}),(t,x)=>(_(),g(c(R),{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(()=>[X,ee,b(c(Z),{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:D},"文件模板"),w(",文件大小不超过5M")]),e("div",le,[b(c($),{class:"button-style",name:"file",beforeUpload:S,maxCount:1,action:u,onChange:V},{default:i(()=>[b(c(O),{type:"primary"},{default:i(()=>[w(" 点击上传 ")]),_:1})]),_:1})])]),_:1}))]),_:1},8,["onRegister"]))}});const ve=P(ne,[["__scopeId","data-v-7c3d180b"]]);export{ve as default};