import{V as y,d as x,r as b,a as S,Z as a,gE as r,ay as q,ac as M,cZ as g,c as N,o as D,w as T,j as p,l,c6 as E,X as R}from"./index-9PRMimni.js";import{_ as B}from"./FormModal.vue_vue_type_script_setup_true_lang-CnORK0py.js";import{B as V}from"./Table-0PViRYCf.js";import{_ as $}from"./TableAction.vue_vue_type_script_setup_true_lang-Bj_Y4LtN.js";import{M as O,N as P}from"./vesselEquipmentDetails-CJeqdW1Z.js";import"./basicModal.vue_vue_type_script_setup_true_lang-CsJydKhW.js";import"./basicModal.vue_vue_type_style_index_0_lang-8QZP7ApW.js";import"./BasicForm-dL_oCSPM.js";import"./Render.vue_vue_type_script_lang-DKUYY0Zw.js";import"./SingleImageUpload-CNx4b9eC.js";import"./ImageUpload.vue_vue_type_style_index_0_scoped_cb086928_lang-D-28kXvw.js";import"./componentSetting-DVhNDBTO.js";import"./ImageUpload-DUsnro3W.js";import"./vuedraggable.umd-Co2xEC3p.js";import"./BasicUpload.vue_vue_type_style_index_0_scoped_a4d0e930_lang-DxRbtP01.js";import"./tabsView-BXskTdVh.js";import"./BasicForm.vue_vue_type_style_index_0_scoped_b9e995ec_lang-CEvcLwxD.js";import"./propTypes-CebMRUpe.js";import"./BasicSelect-C_uwzMkE.js";import"./BasicSelect.vue_vue_type_style_index_0_scoped_772d51cc_lang-Brp6PjEU.js";import"./dictionary-BRse4lkf.js";import"./index-DkvzUEqh.js";import"./index-kKnqLkWM.js";import"./AutoComplete-Dv1Bqed4.js";import"./TreeSelect-BZh2DeCh.js";import"./account-C850CBTF.js";import"./useModal-CO65vga3.js";import"./useForm-CKmgcynv.js";import"./usePageCache-DluHn7Yy.js";import"./Table.vue_vue_type_style_index_0_scoped_7b9e6ece_lang-BoW2DV_e.js";import"./componentMap-CElCaWis.js";import"./format-DgF6KtHk.js";import"./omit-B2_8Y6O_.js";import"./_flatRest-DBrd2CHT.js";import"./flatten-DeoUZLdb.js";import"./print-CT_2hrjP.js";import"./useTimeout-BxFilWvD.js";import"./Flex-CTSf12gq.js";const{t:m}=y();function U(){return{tableColumns:[{title:m("equipmentLibrary.equipmentMainLibrary.tableNum"),key:"num",width:80,render:(o,i)=>i+1},{title:m("equipmentLibrary.equipmentMainLibrary.serviceLetters.serviceLetterName"),key:"letterName"},{title:m("equipmentLibrary.equipmentMainLibrary.serviceLetters.createDate"),key:"createDate",width:200},{title:m("equipmentLibrary.equipmentMainLibrary.serviceLetters.remark"),key:"remark"}]}}const Ie=x({__name:"index",props:{selectedTreeItem:{},isEditable:{type:Boolean}},setup(d){const o=d,i=g(),{t}=y(),s=b(),u=b(),{tableColumns:_}=U(),h=S({width:160,title:t("common.optionsText"),key:"action",fixed:"right",align:"center",render(e){return a($,{style:"text",actions:[{label:t("common.optionsViewText"),labelShow:!1,icon:a(r,{iconName:"view",iconType:"lineIcon"}),onClick:v.bind(null,e)},{label:t("common.optionsEditText"),labelShow:!1,icon:a(r,{iconName:"edit",iconType:"lineIcon"}),onClick:C.bind(null,e),ifShow:()=>o.isEditable},{label:t("common.optionsDelText"),labelShow:!1,icon:a(r,{iconName:"delete",iconType:"lineIcon"}),isConfirm:!0,confirmContent:t("common.dialogContentDeleteText"),onPositiveClick:()=>{L(e)},ifShow:()=>o.isEditable}]})}});q(()=>o.selectedTreeItem,e=>{M(()=>{e?.model&&c(!0)})},{immediate:!0,deep:!0});function k(e){return P({...e,productCode:o.selectedTreeItem?.code,model:o.selectedTreeItem?.model,shipId:o.selectedTreeItem?.shipId})}function c(e){u.value[e?"restReload":"reload"]()}function w(){s.value?.handleOpenModal(t("common.addText"),{},"add")}function C(e){s.value?.handleOpenModal(t("common.optionsEditText"),e,"edit")}function v(e){e.fileUrl?window.open(e.fileUrl,"_blank"):i.error("View failed")}async function L(e){await O(e),i.success(t("common.optionsDelSuccessText")),c(!1)}return(e,f)=>{const I=R;return D(),N(I,null,{default:T(()=>[p(l(V),{ref_key:"basicTableRef",ref:u,columns:l(_),request:n=>k(n),"row-key":n=>n.id,actionColumn:l(h),immediate:!1,autoScrollX:!0,"virtual-scroll":""},E({_:2},[e.isEditable?{name:"toolbar",fn:T(()=>[p(l(r),{iconName:"add",onClick:w})]),key:"0"}:void 0]),1032,["columns","request","row-key","actionColumn"]),p(B,{ref_key:"formModalRef",ref:s,selectedTreeItem:e.selectedTreeItem,onSuccess:f[0]||(f[0]=n=>c(!1))},null,8,["selectedTreeItem"])]),_:1})}}});export{Ie as default};
