import{d as b,k as m,O as R,r as y,o as u,c as k,a as t,b as r,u as d,t as V,z as C,A as w,x as j,F as q,h as D,B as J,a5 as L}from"./vue.1703796278973.js";import{a0 as M,ax as $}from"./index.17037962789732.js";import"./index.1703796278973300.js";import"./index.170379627897315.js";import"./index.170379627897317.js";import"./index.1703796278973301.js";import"./index.1703796278973302.js";import"./index.170379627897332.js";import"./index.1703796278973303.js";import"./index.170379627897339.js";import"./index.170379627897316.js";import"./index.170379627897314.js";import"./index.1703796278973304.js";import"./index.1703796278973305.js";import"./index.1703796278973306.js";import"./index.170379627897336.js";import{_ as z}from"./index.vue_vue_type_script_setup_true_name_PermissionButton_lang.1703796278973.js";import{g as G,i as H,b as K}from"./firmware.1703796278973.js";import{o as h}from"./comm.1703796278973.js";import{_ as Q}from"./index.vue_vue_type_script_setup_true_name_TaskPage_lang.1703796278973.js";import{h as U}from"./system.1703796278973.js";import"./index.17037962789733.js";import"./dayjs.min.1703796278973.js";import"./isArray.1703796278973.js";import"./editor.api.1703796278973.js";import"./preload-helper.1703796278973.js";import"./monaco.contribution.1703796278973.js";import"./index.170379627897320.js";import"./index.170379627897321.js";import"./permission.1703796278973.js";import"./index.170379627897337.js";import"./index.170379627897318.js";import"./index.170379627897319.js";import"./index.170379627897325.js";import"./index.170379627897327.js";import"./SelectDevices.1703796278973.js";import"./index.170379627897333.js";import"./moment.1703796278973.js";import"./_plugin-vue_export-helper.1703796278973.js";import"./index.170379627897334.js";import"./default.1703796278973.js";import"./consts.1703796278973.js";import"./404.1703796278973.js";const W=b({name:"TaskPage"}),Le=b({...W,setup(X){const P=U(),n=m({}),S=R(),v=m({}),l=m(!1),p=m({}),g=[{title:"任务名称",dataIndex:"name",key:"name",fixed:"left",width:200,ellipsis:!0,search:{type:"string"}},{title:"推送方式",dataIndex:"mode",key:"mode",ellipsis:!0,search:{type:"select",options:[{label:"设备拉取",value:"pull"},{label:"平台推送",value:"push"}]},scopedSlots:!0,width:200},{title:"说明",dataIndex:"description",key:"description",ellipsis:!0,search:{type:"string"}},{title:"完成比例",dataIndex:"progress",key:"progress",ellipsis:!0,scopedSlots:!0},{title:"操作",key:"action",fixed:"right",width:200,scopedSlots:!0}],T=[{terms:[{column:"firmwareId",value:S.query.id}]}],A=e=>{var i,c;if(!e)return[];const x=e.waiting>0&&((i=e==null?void 0:e.state)==null?void 0:i.value)==="processing",f=((c=e==null?void 0:e.state)==null?void 0:c.value)==="canceled",s=[{key:"view",text:"详情",tooltip:{title:"详情"},icon:"icon-details",onClick:async()=>{F(e.id)}},{key:"view",text:"查看",tooltip:{title:"查看"},icon:"EyeOutlined",onClick:async()=>{I(e)}}];return x?s.push({key:"update",text:"停止",tooltip:{title:"停止"},onClick:async()=>{(await H(e.id)).success&&(h("操作成功","success"),n.value.reload())},icon:"StopOutlined"}):f&&s.push({key:"update",text:"继续升级",tooltip:{title:"继续升级"},onClick:async()=>{(await K(e.id,["canceled"])).success&&(h("操作成功","success"),n.value.reload())},icon:"ControlOutlined"}),s},B=()=>{p.value={},l.value=!0},I=e=>{p.value=L({...e,view:!0}),l.value=!0},F=e=>{P.jumpPage("device/Firmware/Task/Detail",{id:e})},O=e=>{l.value=!1,p.value={},e&&(h("操作成功","success"),n.value.reload())},E=e=>{v.value=e};return(e,x)=>{const f=y("pro-search"),s=y("AIcon"),i=z,c=M,_=$,N=y("page-container");return u(),k(N,null,{default:t(()=>[r(f,{columns:g,target:"search",onSearch:E}),r(_,{ref_key:"tableRef",ref:n,model:"TABLE",columns:g,request:d(G),defaultParams:{sorts:[{name:"createTime",order:"desc"}],terms:T},params:d(v)},{headerTitle:t(()=>[r(i,{type:"primary",onClick:B,hasPermission:"device/Firmware:add"},{icon:t(()=>[r(s,{type:"PlusOutlined"})]),default:t(()=>[V(" 新增 ")]),_:1})]),mode:t(a=>[C("span",null,w(a.mode.text),1)]),progress:t(a=>[C("span",null,w(a.progress)+"%",1)]),action:t(a=>[r(c,null,{default:t(()=>[(u(!0),j(q,null,D(A(a),o=>(u(),k(i,{key:o.key,disabled:o.disabled,popConfirm:o.popConfirm,tooltip:{...o.tooltip},style:{padding:"0px"},onClick:o.onClick,type:"link",hasPermission:"device/Firmware:"+o.key},{icon:t(()=>[r(s,{type:o.icon},null,8,["type"])]),_:2},1032,["disabled","popConfirm","tooltip","onClick","hasPermission"]))),128))]),_:2},1024)]),_:1},8,["request","defaultParams","params"]),d(l)?(u(),k(Q,{key:0,data:d(p),onChange:O},null,8,["data"])):J("",!0)]),_:1})}}});export{Le as default};
