import{d as R,o as h,c as g,a as l,J as Me,K as De,r as C,f as T,L as Y,B as be,b as Se,M as $e,i as o,w as n,j as a,O as je,F as E,k as B,s as Ne,l as u,_ as M,m as c,v as Z,P as A,A as L,t as ee,E as Ie,G as Ue,q as ze,y as Be,z as Le,Q as Re,R as Ve}from"./index-e497b666.js";import{g as Fe,d as Oe,r as Ke,u as Ee}from"./xlsx-97c7c9c5.js";import{g as Ae,a as Pe,e as te,d as qe,b as Je}from"./DeviceClassList-c188dd4c.js";import{a as Ge,_ as He}from"./Certificate-813c5f89.js";import{_ as Qe,a as We}from"./RadioGroup-6edab0a1.js";import{_ as Xe}from"./PageHeader-74caddbf.js";import{_ as Ye}from"./DataTable-41a24bfd.js";import{_ as oe}from"./Space-84278c21.js";import{_ as Ze}from"./Popconfirm-7119bd46.js";import{a as et}from"./Upload-e16a41ce.js";import"./get-slot-1efb97e5.js";import"./Add-f2559956.js";const tt={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},ot=l("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M256 112v288"},null,-1),nt=l("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M400 256H112"},null,-1),st=[ot,nt],lt=R({name:"Add",render:function(D,b){return h(),g("svg",tt,st)}}),at={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},rt=l("path",{d:"M320 336h76c55 0 100-21.21 100-75.6s-53-73.47-96-75.6C391.11 99.74 329 48 256 48c-69 0-113.44 45.79-128 91.2c-60 5.7-112 35.88-112 98.4S70 336 136 336h56",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),it=l("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M192 400.1l64 63.9l64-63.9"},null,-1),dt=l("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M256 224v224.03"},null,-1),ut=[rt,it,dt],ct=R({name:"CloudDownloadOutline",render:function(D,b){return h(),g("svg",at,ut)}}),_t={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},pt=l("path",{d:"M320 367.79h76c55 0 100-29.21 100-83.6s-53-81.47-96-83.6c-8.89-85.06-71-136.8-144-136.8c-69 0-113.44 45.79-128 91.2c-60 5.7-112 43.88-112 106.4s54 106.4 120 106.4h56",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),ht=l("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M320 255.79l-64-64l-64 64"},null,-1),kt=l("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M256 448.21V207.79"},null,-1),mt=[pt,ht,kt],ft=R({name:"CloudUploadOutline",render:function(D,b){return h(),g("svg",_t,mt)}}),gt={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},wt=Me('',6),yt=[wt],vt=R({name:"TrashOutline",render:function(D,b){return h(),g("svg",gt,yt)}});const Tt=w=>(Re("data-v-edd7e2e5"),w=w(),Ve(),w),xt={class:"h-full flex flex-col gap-y-3"},Ct={style:{display:"flex","align-items":"center"}},Mt={style:{"padding-left":"20px","font-size":"18px"}},Dt={style:{display:"flex","grid-gap":"20px"}},bt={key:0,style:{"margin-bottom":"10px",display:"flex",gap:"10px"}},St=Tt(()=>l("thead",null,[l("tr",null,[l("th",null,"SN"),l("th",null,"布局编号"),l("th",null,"操作")])],-1)),$t={style:{display:"grid","grid-template-columns":"repeat(auto-fill, minmax(180px, 1fr))","grid-gap":"5px 0"}},jt={style:{"padding-top":"20rpx"}},Nt={style:{display:"flex","justify-content":"flex-end"}},It={style:{"max-height":"700px",display:"flex","flex-direction":"column","overflow-y":"hidden"}},Ut={style:{flex:"1","overflow-y":"auto"}},zt={__name:"index",setup(w){const D=async()=>{_.value.push({T_sn:"",T_id:""})},b=async e=>{_.value.splice(e,1)},ne=async()=>{const e=await Fe({});console.log("下载",e),Oe(e)},se=async({file:e})=>{const t=await le(e.file),d=Ke(t,{type:"binary",cellDates:!0}),p=d.Sheets[d.SheetNames[0]];let j=Ee.sheet_to_json(p).map(U=>({T_sn:U.SN,T_id:U.布局编号}));_.value=[..._.value,...j]},le=e=>new Promise(t=>{const d=new FileReader;d.readAsBinaryString(e),d.onload=p=>{t(p.target.result)}}),V=window.sessionStorage.getItem("task")?JSON.parse(window.sessionStorage.getItem("task")):{},F=C({Selecteds:null,chkData:[]}),P=T([]),_=T([]),q=T([]),O=T(["均匀性布点","作业出入口测点","1号作业出入口测点","2号作业出入口测点","1号风机测点","2号风机测点","风机回风口","1号风机回风口","2号风机回风口","照明灯测点","除湿机测点","风幕机测点","外部环境测点","作业口外部环境测点","产品存放区域测点","温控传感器绑定点1","温控传感器绑定点2","温湿度监测绑定点1","温湿度监测绑定点2"]),ae=()=>[{type:"selection"},{title:"SN",key:"T_sn"}],re=e=>e.T_sn,ie=e=>{P.value=e;const t=[...P.value],d=[];t.forEach(p=>{d.push({T_sn:p,T_id:""})}),_.value=d},de=e=>{m.page=e,I()},ue=e=>{m.page_z=e,I()},N=C({pageCount:0,pageNum:0}),m=C({T_sn:"",T_task_id:JSON.parse(sessionStorage.getItem("task")).T_task_id,page:1,page_z:10}),ce=()=>{m.page=1,I()},I=()=>{Ge(m).then(e=>{let{data:t}=e;t.Code==200&&(t.Data.List!=null?F.chkData=t.Data.List:F.chkData=[],N.pageCount=t.Data.Page_size,N.pageNum=t.Data.Num)})},S=C({T_sn:"",T_class:V.T_class}),$=T("");Y($,e=>{console.log("变化",e),i.T_remark=e});let y=T([]);const _e=e=>e.Id+"|"+e.T_id,J=be(),f=Se(),pe=async()=>{let e={T_copy_task_id:V.T_task_id,T_paste_task_id:""};J.commit("setcopy",e),f.success("复制成功")},he=async()=>{let e={...J.state.setcopyData};if(e.T_copy_task_id==""){f.error("还未复制内容哦");return}e.T_paste_task_id=V.T_task_id,(await Pe(e)).data.Code==200&&(f.success("粘贴成功"),v())},ke=async()=>{if(y.value.length==0){f.error("批量修改至少选择一项");return}r.title="批量修改",r.showModal=!0,i.T_remark="均匀性布点"},me=()=>[{type:"selection",options:[{label:"反选",key:"f2",onSelect:e=>{let t=[...y.value];const p=e.filter(k=>!t.find(j=>k.Id+"|"+k.T_id===j)).map(k=>k.Id+"|"+k.T_id);y.value=p}}]},{title:"布局编号",key:"T_id"},{title:"证书编号",key:"T_Certificate_sn"},{title:"设备编号",key:"T_sn"},{title:"证书有效期",key:"T_failure_time"},{title:"备注",key:"T_remark"},{title:"操作",key:"actions",render(e){return B(oe,{},{default:()=>["修改","删除"].map(t=>t==="修改"?B(c,{type:"primary",size:"small",onClick:()=>we(e)},{default:()=>t}):B(Ze,{onPositiveClick:()=>ve(e)},{default:()=>"是否确认删除?",trigger:()=>B(c,{type:"error",size:"small"},{default:()=>t})}))})}}],G=T([]),r=C({title:"",showModal:!1,showModalobj:!1});Y(()=>r.showModal,e=>{e||(_.value=[])});const i=C({T_snid:"",T_id:0,T_remark:""}),fe=()=>{S.T_sn="",v()};$e();const ge=async()=>{if(r.title==="批量导入")if(_.value.length==0){f.error("缺少布局编号,请选择添加");return}else if(!_.value.every(t=>t.T_id!=""))f.error("请填写编号");else{console.log("提交",_.value);const t=[];_.value.forEach(p=>{t.push(p.T_sn+","+p.T_id)});const d=await xe(t.join("|"),i.value);console.log("返回",d),d.Code==200&&(f.success(d.Msg),r.showModal=!1)}else if(r.title=="批量修改"){let e=[...y.value];for(let t=0;t{console.log("显示编辑",e),O.value.includes(e.T_remark)||($.value=e.T_remark),r.title="修改编号",r.showModal=!0,i.Id=e.Id,i.T_id=`${e.T_id}`,i.T_remark=e.T_remark},ye=()=>{r.title="批量导入",r.showModal=!0,i.T_snid="",i.T_remark="均匀性布点",m.page=1,I()},ve=async e=>{try{const{data:t}=await qe({Id:e.Id});t.Code===200&&(f.success(t.Msg),v())}catch(t){console.log(t)}},Te=async()=>{try{const{data:e}=await te({Id:i.Id,T_id:i.T_id,T_remark:i.T_remark});e.Code===200&&(f.success(e.Msg),r.showModal=!1,v())}catch(e){console.log(e)}},xe=async(e,t)=>{try{const{data:d}=await Je({T_class:S.T_class,T_sn_id_list:e,T_id:t,T_remark:i.T_remark});return d}catch(d){console.log(d)}finally{v()}},H=T(0),v=async()=>{try{const{data:e}=await Ae(S);G.value=e.Data.List||[],H.value=e.Data.Num}catch(e){console.log(e)}};return v(),(e,t)=>{const d=Xe,p=Ye,k=ze,j=et,U=He,x=Be,Q=Qe,Ce=We,W=Le,X=Ne;return h(),g(E,null,[l("div",xt,[o(d,{onBack:e.$router.back},{title:n(()=>[u(" 设备管理 ")]),_:1},8,["onBack"]),o(a(oe),{justify:"space-between"},{default:n(()=>[l("div",Ct,[o(a(M),{style:{width:"300px"},value:S.T_sn,"onUpdate:value":t[0]||(t[0]=s=>S.T_sn=s),onClear:fe,clearable:""},null,8,["value"]),o(a(c),{type:"primary",style:{"margin-left":"10px"},onClick:v},{default:n(()=>[u(" 搜索 ")]),_:1}),l("div",Mt," 数量 :"+Z(H.value),1)]),l("div",Dt,[o(a(c),{type:"primary",onClick:pe},{default:n(()=>[u("复制")]),_:1}),o(a(c),{type:"primary",onClick:he},{default:n(()=>[u("粘贴")]),_:1}),o(a(c),{type:"primary",onClick:ke},{default:n(()=>[u("批量修改")]),_:1}),o(a(c),{type:"primary",onClick:ye},{default:n(()=>[u("批量导入")]),_:1})])]),_:1}),o(p,{remote:"",columns:me(),"checked-row-keys":a(y),"onUpdate:checkedRowKeys":t[1]||(t[1]=s=>je(y)?y.value=s:y=s),"row-key":_e,data:G.value,bordered:!1,"flex-height":"",class:"flex-1"},null,8,["columns","checked-row-keys","data"])]),o(X,{"show-icon":!1,show:r.showModal,"onUpdate:show":t[10]||(t[10]=s=>r.showModal=s),preset:"dialog",style:{width:"800px"},title:r.title},{default:n(()=>[r.title!="修改编号"&&r.title!="批量修改"?(h(),g("div",bt,[o(j,{"default-upload":!1,max:1,onChange:se},{default:n(()=>[o(a(c),{type:"primary"},{icon:n(()=>[o(k,null,{default:n(()=>[o(a(ft))]),_:1})]),default:n(()=>[u(" 上传文件")]),_:1})]),_:1}),o(a(c),{onClick:ne,type:"warning"},{icon:n(()=>[o(k,null,{default:n(()=>[o(a(ct))]),_:1})]),default:n(()=>[u(" 模板下载")]),_:1})])):A("",!0),o(W,{model:i,"label-width":"auto","show-require-mark":""},{default:n(()=>[r.title==="批量导入"?(h(),L(x,{key:0,label:"布局编号",path:"T_snid"},{default:n(()=>[l("div",null,[o(U,{border:!0,"single-line":!0},{default:n(()=>[St,l("tbody",null,[(h(!0),g(E,null,ee(_.value,(s,K)=>(h(),g("tr",null,[l("td",null,[o(a(M),{value:s.T_sn,"onUpdate:value":z=>s.T_sn=z,placeholder:"请输入SN"},null,8,["value","onUpdate:value"])]),l("td",null,[o(a(M),{value:s.T_id,"onUpdate:value":z=>s.T_id=z,placeholder:"请输入编号"},null,8,["value","onUpdate:value"])]),l("td",null,[o(a(c),{onClick:z=>b(K),type:"error"},{default:n(()=>[u("删除行")]),_:2},1032,["onClick"])])]))),256))]),o(a(c),{onClick:D,style:{margin:"10px"},type:"primary"},{icon:n(()=>[o(k,null,{default:n(()=>[o(a(lt))]),_:1})]),default:n(()=>[u(" 添加一行 ")]),_:1}),Ie(o(a(c),{onClick:t[2]||(t[2]=s=>_.value=[]),style:{margin:"10px"}},{icon:n(()=>[o(k,null,{default:n(()=>[o(a(vt))]),_:1})]),default:n(()=>[u(" 全部清空 ")]),_:1},512),[[Ue,_.value.length!=0]])]),_:1})])]),_:1})):r.title!="批量修改"?(h(),L(x,{key:1,label:"编号",path:"T_id"},{default:n(()=>[o(a(M),{value:i.T_id,"onUpdate:value":t[3]||(t[3]=s=>i.T_id=s)},null,8,["value"])]),_:1})):A("",!0),o(x,{label:"备注(默认:均匀性布点)",path:"T_remark"},{default:n(()=>[o(Ce,{value:i.T_remark,"onUpdate:value":t[5]||(t[5]=s=>i.T_remark=s),style:{width:"100%"}},{default:n(()=>[l("div",$t,[(h(!0),g(E,null,ee(O.value,(s,K)=>(h(),L(Q,{value:s,key:K},{default:n(()=>[u(Z(s),1)]),_:2},1032,["value"]))),128))]),l("div",jt,[o(Q,{value:$.value},{default:n(()=>[u(" 其他 ")]),_:1},8,["value"]),O.value.includes(i.T_remark)?A("",!0):(h(),L(a(M),{key:0,value:$.value,"onUpdate:value":t[4]||(t[4]=s=>$.value=s),type:"textarea"},null,8,["value"]))])]),_:1},8,["value"])]),_:1}),l("div",Nt,[o(a(c),{onClick:t[6]||(t[6]=s=>r.showModal=!1),style:{"margin-right":"20px"}},{default:n(()=>[u(" 取消 ")]),_:1}),o(a(c),{type:"primary",onClick:ge},{default:n(()=>[u(" 提交 ")]),_:1})])]),_:1},8,["model"]),o(X,{"show-icon":!1,show:r.showModalobj,"onUpdate:show":t[9]||(t[9]=s=>r.showModalobj=s),style:{width:"900px"},preset:"dialog",title:"选择添加"},{default:n(()=>[l("div",It,[o(W,{inline:"","label-placement":"left",model:m},{default:n(()=>[o(x,{label:"SN"},{default:n(()=>[o(a(M),{value:m.T_sn,"onUpdate:value":t[7]||(t[7]=s=>m.T_sn=s),placeholder:"输入SN"},null,8,["value"])]),_:1}),o(x,null,{default:n(()=>[o(a(c),{type:"primary","attr-type":"button",onClick:ce},{default:n(()=>[u(" 查询 ")]),_:1})]),_:1}),o(x)]),_:1},8,["model"]),l("div",Ut,[o(p,{columns:ae(),data:F.chkData,remote:!0,"max-height":480,pagination:{pageSize:m.page_z,page:m.page,pageCount:N.pageCount,"show-quick-jumper":!0,"show-size-picker":!0,"display-order":["size-picker","pages","quick-jumper"],"page-sizes":[10,20,30,40],prefix(){return`共${N.pageNum}条`}},"onUpdate:page":de,"on-update:page-size":ue,"default-checked-row-keys":q.value,"onUpdate:defaultCheckedRowKeys":t[8]||(t[8]=s=>q.value=s),"row-key":re,"onUpdate:checkedRowKeys":ie},null,8,["columns","data","pagination","default-checked-row-keys"])])])]),_:1},8,["show"])]),_:1},8,["show","title"])],64)}}},Gt=De(zt,[["__scopeId","data-v-edd7e2e5"]]);export{Gt as default};