var z=Object.defineProperty;var N=Object.getOwnPropertySymbols;var P=Object.prototype.hasOwnProperty,q=Object.prototype.propertyIsEnumerable;var T=(r,o,e)=>o in r?z(r,o,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[o]=e,F=(r,o)=>{for(var e in o||(o={}))P.call(o,e)&&T(r,e,o[e]);if(N)for(var e of N(o))q.call(o,e)&&T(r,e,o[e]);return r};var w=(r,o,e)=>new Promise((x,f)=>{var u=d=>{try{b(e.next(d))}catch(_){f(_)}},p=d=>{try{b(e.throw(d))}catch(_){f(_)}},b=d=>d.done?x(d.value):Promise.resolve(d.value).then(u,p);b((e=e.apply(r,o)).next())});import{h as A,a as H,f as J}from"./uploadAction-50b8a6f7.js";import{_ as K,l as Q,d as W}from"./index-check-dialog.vue_vue_type_style_index_0_lang-bbf68acc.js";import{d as X,G as M,r as C,M as Z,a as ee,j as i,o as ae,c as te,e as a,w as l,k as D,b as y,f as V,F as le,T as oe,$ as ne,E as se}from"./index-90c78f99.js";import"./useCurrentInstance-cd4729ef.js";const ie={class:"flex justify-between items-center"},re=y("span",null,"硬件指标列表",-1),de={class:"flex items-center"},ce=["onClick"],me=["onClick"],ve=X({__name:"index",setup(r){const o=[{type:"index",label:"序号",width:80},{label:"导入文件名称",prop:"importFileName",key:"importFileName"},{label:"导入时间",prop:"importTime",key:"importTime"},{label:"最新操作人",prop:"operator",key:"operator"},{label:"操作",slot:"action",key:"action",width:120,fixed:"right"}],e=M({importFileName:void 0,operator:void 0,importTime:void 0}),x=C(),f=C(),u=C(),p=(...s)=>w(this,[...s],function*(n=u.value.pageParams){const c=yield Q(F(F({},n),e));x.value=c&&c.data.records||[],f.value=c&&c.data.total||0}),b=n=>w(this,null,function*(){const s=yield oe({fileId:n.fileId}),c=URL.createObjectURL(s),m=document.createElement("a");m.style.display="none",m.href=c,m.download=n.importFileName,document.body.appendChild(m),m.click(),document.body.removeChild(m),window.URL.revokeObjectURL(c)}),d=n=>{ne.confirm("确认删除该硬件指标吗?","提示！",{type:"warning"}).then(()=>w(this,null,function*(){yield W(n.fileId),yield p(),se.success("删除成功！")}))},_=C({file:[]}),U=()=>{const n=document.createElement("a");n.href="/硬件指标导入模板.xlsx",n.download="硬件指标导入模板",n.click()},v=M(new Z(p)),Y=n=>{v.visible=!0,v.data=n},E=()=>{u.value.pageNumber=1,p()},L=()=>{e.importFileName=void 0,e.operator=void 0,e.importTime=void 0,u.value.pageNumber=1,u.value.pageSize=10,p()};return ee(()=>w(this,null,function*(){yield p()})),(n,s)=>{const c=i("page-title"),m=i("el-input"),k=i("el-form-item"),h=i("el-col"),I=i("el-date-picker"),g=i("el-button"),R=i("el-row"),B=i("el-form"),j=i("el-upload"),$=i("el-alert"),O=i("table-list"),G=i("el-card");return ae(),te(le,null,[a(c),a(B,{class:"search mb-16","label-suffix":":",model:e},{default:l(()=>[a(R,{gutter:16},{default:l(()=>[a(h,{span:6},{default:l(()=>[a(k,{label:"文件名称"},{default:l(()=>[a(m,{modelValue:e.importFileName,"onUpdate:modelValue":s[0]||(s[0]=t=>e.importFileName=t),placeholder:"请输入"},null,8,["modelValue"])]),_:1})]),_:1}),a(h,{span:6},{default:l(()=>[a(k,{label:"操作人"},{default:l(()=>[a(m,{modelValue:e.operator,"onUpdate:modelValue":s[1]||(s[1]=t=>e.operator=t),placeholder:"请输入"},null,8,["modelValue"])]),_:1})]),_:1}),a(h,{span:6},{default:l(()=>[a(k,{label:"操作时间"},{default:l(()=>[a(I,{modelValue:e.importTime,"onUpdate:modelValue":s[2]||(s[2]=t=>e.importTime=t),editable:!1,format:"YYYY-MM-DD","value-format":"YYYY-MM-DD",type:"date"},null,8,["modelValue"])]),_:1})]),_:1}),a(h,{span:6},{default:l(()=>[a(k,{class:"search_btn"},{default:l(()=>[a(g,{type:"primary",onClick:E},{default:l(()=>[D("查询")]),_:1}),a(g,{onClick:L},{default:l(()=>[D("重置")]),_:1})]),_:1})]),_:1})]),_:1})]),_:1},8,["model"]),a(G,{class:"my-card",shadow:"never"},{header:l(()=>[y("div",ie,[re,y("div",de,[a(j,{"file-list":_.value.file,"onUpdate:fileList":s[3]||(s[3]=t=>_.value.file=t),action:"/kb/api/v1/app/hardwareIndex/import","on-success":t=>V(A)(t,_.value.file,!0,Y),"on-error":t=>V(H)(t),"before-upload":t=>V(J)(t,{types:["xls","xlsx"]}),accept:".xlsx,.xls","show-file-list":!1},{default:l(()=>[a(g,{icon:"Upload",type:"primary"},{default:l(()=>[D(" 导入 ")]),_:1})]),_:1},8,["file-list","on-success","on-error","before-upload"]),a(g,{plain:"",icon:"Download",type:"primary",class:"ml-4",onClick:U},{default:l(()=>[D(" 下载模板 ")]),_:1})])])]),default:l(()=>[a($,{title:"温馨提示：请先下载模板，编辑好数据后允许导入硬件指标文件多次，但仅统计最近一次上传的指标数据。",type:"warning","show-icon":"",style:{"margin-bottom":"8px"},closable:!1}),a(O,{ref_key:"tableListRef",ref:u,column:o,data:x.value,total:f.value,onGetTableData:p},{action:l(({scope:t})=>[y("a",{class:"btn text-primary mr-24",onClick:S=>b(t.row)}," 下载 ",8,ce),y("a",{class:"btn text-danger",onClick:S=>d(t.row)}," 删除 ",8,me)]),_:1},8,["data","total"])]),_:1}),a(K,{visible:v.visible,data:v.data,onClose:s[4]||(s[4]=t=>v.close(t))},null,8,["visible","data"])],64)}}});export{ve as default};
