import{V as f,Z as o,k as b,cb as v,ch as y,d as _,r,ay as T,ac as h,c as L,o as k,w as q,j as w,l,X as g}from"./index-9PRMimni.js";import{B as I}from"./Table-0PViRYCf.js";import{R as F}from"./vesselEquipmentDetails-CJeqdW1Z.js";import"./Table.vue_vue_type_style_index_0_scoped_7b9e6ece_lang-BoW2DV_e.js";import"./vuedraggable.umd-Co2xEC3p.js";import"./Render.vue_vue_type_script_lang-DKUYY0Zw.js";import"./componentMap-CElCaWis.js";import"./propTypes-CebMRUpe.js";import"./format-DgF6KtHk.js";import"./omit-B2_8Y6O_.js";import"./_flatRest-DBrd2CHT.js";import"./flatten-DeoUZLdb.js";import"./print-CT_2hrjP.js";import"./basicModal.vue_vue_type_script_setup_true_lang-CsJydKhW.js";import"./basicModal.vue_vue_type_style_index_0_lang-8QZP7ApW.js";import"./useModal-CO65vga3.js";import"./componentSetting-DVhNDBTO.js";import"./useTimeout-BxFilWvD.js";import"./usePageCache-DluHn7Yy.js";import"./tabsView-BXskTdVh.js";import"./Flex-CTSf12gq.js";const{t:a}=f();function M(){return{columns:[{title:a("equipmentLibrary.equipmentMainLibrary.tableNum"),key:"num",width:80,render:(e,i)=>i+1},{title:a("equipmentLibrary.equipmentMainLibrary.specification.specification"),key:"specification",width:260,ellipsis:!1,render:e=>e.editable?o(b,{value:e.specification,placeholder:a("common.inputText"),class:"w-full",onUpdateValue:i=>{e.specification=i}}):e.specification},{title:a("equipmentLibrary.equipmentMainLibrary.specification.valid"),key:"validFrom",width:250,ellipsis:!1,render(e){return e.editable?o(v,{formattedValue:e.validFrom&&e.validTo?[e.validFrom,e.validTo]:null,type:"daterange",valueFormat:"yyyy-MM-dd",startPlaceholder:a("equipmentLibrary.equipmentMainLibrary.specification.validFrom"),endPlaceholder:a("equipmentLibrary.equipmentMainLibrary.specification.validTo"),onUpdateValue:(i,t)=>{e.validFrom=t?.[0],e.validTo=t?.[1]}}):e.validFrom&&e.validTo?`${e.validFrom} - ${e.validTo}`:""}},{title:a("equipmentLibrary.equipmentMainLibrary.specification.value"),key:"value",width:150,ellipsis:!1,render:e=>e.editable?o(y,{value:e.value,precision:2,placeholder:a("common.inputText"),onUpdateValue:i=>{e.value=i}}):e.value}]}}const O=_({__name:"index",props:{selectedTreeItem:{}},setup(s){const e=s,i=r(),t=r(!1),n=r([]),{columns:p}=M();T(()=>e.selectedTreeItem,()=>{h(()=>{m()})},{immediate:!0,deep:!0});async function m(){t.value=!0;try{n.value=await F({productCode:e.selectedTreeItem?.code,model:e.selectedTreeItem?.model,serialNumber:e.selectedTreeItem?.serialNumber,shipId:e.selectedTreeItem?.shipId}),t.value=!1}catch{n.value=[],t.value=!1}}return(u,x)=>{const c=g;return k(),L(c,null,{default:q(()=>[w(l(I),{ref_key:"basicTableRef",ref:i,columns:l(p),dataSource:l(n),"row-key":d=>d.id,autoScrollX:!0,pagination:!1,immediate:!1,showTableSetting:!1,loading:l(t),"virtual-scroll":""},null,8,["columns","dataSource","row-key","loading"])]),_:1})}}});export{O as default};
