import{_ as x}from"./basicModal.vue_vue_type_script_setup_true_lang-CsJydKhW.js";import"./basicModal.vue_vue_type_style_index_0_lang-8QZP7ApW.js";import{B as E}from"./Table-0PViRYCf.js";import{_ as S}from"./TableAction.vue_vue_type_script_setup_true_lang-Bj_Y4LtN.js";import{d as k,V as T,r,a as v,Z as o,gW as R,gX as I,c_ as M,cZ as B,iz as H,iA as N,hs as A,c as D,o as O,l as n,w as P,j as V}from"./index-9PRMimni.js";import{h as X,s as Z,i as $}from"./modalSchemas-DN-MflMO.js";import{u as j}from"./useModal-CO65vga3.js";const U=k({__name:"SubEquipment",props:{ifExpire:{type:Boolean}},emits:["newSubCounter","openHistory","openReset"],setup(u,{expose:m,emit:p}){const f=u,s=p,{t:e}=T(),d=B(),b=M(),{subEquipmentColumns:y}=X(),[g,{openModal:h}]=j({title:e("counter.subEquipment"),width:1240}),c=r(),a=r(0),w=v({width:180,title:e("common.optionsText"),key:"action",fixed:"right",align:"center",render(t){return o(S,{style:"text",actions:[{label:e("common.optionsEditText"),labelShow:!1,icon:R(I.edit),onClick:()=>s("newSubCounter",{record:t,type:"subEquipment"})},{label:e("counter.sync"),labelShow:!1,icon:o(H),onClick:async()=>{b.warning({title:e("counter.confirm"),content:e("counter.syncContent"),positiveText:e("common.dialogPositiveText"),negativeText:e("common.dialogNegativeText"),onPositiveClick:async()=>{await Z({equipmentId:t.equipmentId,mainEquipmentId:a.value.toString()}),d.success(e("counter.syncSuccess")),l()},onNegativeClick:()=>{}})}},{label:e("counter.reset"),labelShow:!1,icon:o(N),onClick:()=>s("openReset",t,"subEquipment")},{label:e("counter.history"),labelShow:!1,icon:o(A),onClick:()=>s("openHistory",t,"history")}]})}});async function _(t){t&&(a.value=t.equipmentId,h())}async function q(t){return await $({...t,mainEquipmentId:a.value,isExpire:f.ifExpire})}function l(){c.value?.restReload()}return m({showModal:_,reloadTable:l}),(t,z)=>{const C=x;return O(),D(C,{ref:"modalRef",onRegister:n(g),class:"basicModal basicFormModal",showAction:!1},{default:P(()=>[V(n(E),{columns:n(y),"row-key":i=>i.id,showTableSetting:!1,actionColumn:n(w),request:i=>q(i),ref_key:"basicTableRef",ref:c,autoScrollX:!0,"virtual-scroll":""},null,8,["columns","row-key","actionColumn","request"])]),_:1},8,["onRegister"])}}});export{U as _};
