import{a5 as B,b as F,r as v,ah as y,$ as M,o as q,c as O,p as l,q as i,n as t,P as u,x as d,v as W,aj as T,s as A,D as G,E as H,i as J,l as K,k as Q,m as X,ak as Y,bv as Z}from"./index.8d733f79.js";import{g as ee,c as te,e as ae}from"./deviceRunTime.517fd825.js";import oe from"./editRunTime.c4d73109.js";import ne from"./changeRunState.fada61cb.js";import"./el-input-number.60463ef8.js";import"./index.28f6da25.js";import"./el-date-picker-panel.089dbe6d.js";import"./panel-time-pick.b2dd8e75.js";const le={style:{position:"relative",height:"100%",display:"flex","flex-direction":"column"}},ie=B({name:"TabContent"}),Se=Object.assign(ie,{emits:["jumpToTargetDevice"],setup(se,{expose:$,emit:I}){const{t:f}=F(),{proxy:g}=G(),S=v(!1),r=y({deviceId:"",pageNo:1,pageSize:10}),p=y({total:0,tableData:[],columns:[{prop:"startTime",label:"runTime"},{prop:"stopTime",label:"stopTime"},{prop:"durationDesc",label:"runDuration"},{prop:"stopReason",label:"stopReason"}]});g.$router.hasRoute("deviceStopRecord")||p.columns.pop();const a=y({level:"",nodeId:"",runState:"",factoryId:"",pageNo:1,pageSize:10,isFollow:!1,treeType:""}),N=[{prop:"deviceName",label:"deviceName",fixed:"left",width:150},{prop:"runState",label:"runState",formatter:e=>e.runState==="-"||!e.runState?"-":e.runState==="stop"?f("stop"):f("run")},{prop:"totalRunTime",label:"totalRunTime"},{prop:"beforeRunTime",label:"beforeRunTime",type:"status"},{prop:"afterRunTime",label:"afterRunTime"},{label:"action",type:"action",width:300,fixed:"right"}],_=v([]),R=v(0);function k(e,n){const s={org:"deviceTree",type:"typeTree",regard:"deviceTree"};a.level=e.level,a.nodeId=e.id,a.factoryId=e.factoryId,a.runState="",a.pageNo=1,a.isFollow=n==="regard",a.treeType=s[n],c()}async function c(){const e=await ee(a);R.value=e.data.totalElements||0,_.value=e.data.content||[]}function w(e){g.$refs.changeRunStateRef.showModal({...e,factoryId:a.factoryId})}function C(e){I("jumpToTargetDevice",{...e,factoryId:a.factoryId,level:a.level,nodeId:a.nodeId})}function h(e){g.$refs.editRunTimeRef.showModal(e)}const E=e=>{S.value=!0,r.pageNo=1,r.pageSize=10,r.deviceId=e.deviceId,D()};async function D(){const e=await te(r);p.total=e.data.totalElements,p.tableData=e.data.content}$({initData:k});function z(){ae(a).then(e=>{const n=new Blob([e]),s=document.createElement("a");s.href=URL.createObjectURL(n),s.download=`${f("deviceRunDuration")}.xls`,s.style.display="none",document.body.appendChild(s),s.click(),s.remove(),g.$modal.msgSuccess(f("exportSuccess"))})}return(e,n)=>{const s=H,L=J,m=K,x=Q,V=X,P=M("EditPen"),U=Y,j=Z;return q(),O("div",le,[l(V,null,{default:i(()=>[l(x,{label:e.$t("deviceStatus"),prop:"runState"},{default:i(()=>[l(L,{modelValue:t(a).runState,"onUpdate:modelValue":n[0]||(n[0]=o=>t(a).runState=o),placeholder:e.$t("deviceStatusP"),clearable:""},{default:i(()=>[l(s,{label:e.$t("run"),value:"run"},null,8,["label"]),l(s,{label:e.$t("stop"),value:"stop"},null,8,["label"])]),_:1},8,["modelValue","placeholder"]),l(m,{type:"primary",onClick:c,style:{"margin-left":"16px"}},{default:i(()=>[u(d(e.$t("query")),1)]),_:1})]),_:1},8,["label"])]),_:1}),l(m,{style:{position:"absolute",right:"16px",top:"0"},onClick:z},{default:i(()=>[u(d(e.$t("export")),1)]),_:1}),l(t(T),{class:"f-h",columns:N,tableData:t(_),total:t(R),pageNum:t(a).pageNo,"onUpdate:pageNum":n[1]||(n[1]=o=>t(a).pageNo=o),pageSize:t(a).pageSize,"onUpdate:pageSize":n[2]||(n[2]=o=>t(a).pageSize=o),onPagination:c},{status:i(({scope:o})=>[W("div",null,[u(d(o.row.beforeRunTime)+" ",1),l(U,{onClick:b=>h(o.row),style:{color:"#2E80FD",cursor:"pointer"}},{default:i(()=>[l(P)]),_:2},1032,["onClick"])])]),action:i(({scope:o})=>[l(m,{link:"",type:"primary",onClick:b=>E(o.row)},{default:i(()=>[u(d(e.$t("startStopDetail")),1)]),_:2},1032,["onClick"]),l(m,{link:"",type:"primary",onClick:b=>w(o.row)},{default:i(()=>[u(d(e.$t("changeRunState")),1)]),_:2},1032,["onClick"]),l(m,{link:"",type:"primary",onClick:b=>C(o.row)},{default:i(()=>[u(d(e.$t("statStopSetting")),1)]),_:2},1032,["onClick"])]),_:1},8,["tableData","total","pageNum","pageSize"]),l(t(oe),{ref:"editRunTimeRef",onRegetList:c},null,512),l(t(ne),{ref:"changeRunStateRef",onRegetList:c},null,512),l(j,{title:e.$t("startStopDetail"),modelValue:t(S),"onUpdate:modelValue":n[5]||(n[5]=o=>A(S)?S.value=o:null),width:"800px",class:"startStopDetail"},{default:i(()=>[l(t(T),{tableWrapId:"startStopDetail",style:{height:"100%"},columns:t(p).columns,tableData:t(p).tableData,total:t(p).total,pageNum:t(r).pageNo,"onUpdate:pageNum":n[3]||(n[3]=o=>t(r).pageNo=o),pageSize:t(r).pageSize,"onUpdate:pageSize":n[4]||(n[4]=o=>t(r).pageSize=o),onPagination:D},null,8,["columns","tableData","total","pageNum","pageSize"])]),_:1},8,["title","modelValue"])])}}});export{Se as default};
