import{V as v,Z as h,n as I,d as P,r as u,a as R,gW as f,gX as p,d8 as E,iG as N,cZ as B,ac as M,cn as V,aw as D,c as _,o as b,w as x,l as a,W as U,j as W,X,v as q}from"./index-9PRMimni.js";import{B as Z}from"./Table-0PViRYCf.js";import{_ as $}from"./TableAction.vue_vue_type_script_setup_true_lang-Bj_Y4LtN.js";import{e as G}from"./jobOrder-CGbsc7bp.js";import{_ as L}from"./OnlineDocs.vue_vue_type_script_setup_true_lang-BtgbMnNs.js";import{h as m}from"./has-CjqcrIOV.js";import{i as z}from"./isEmpty-BUg1OsQj.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";import"./OnlyOffice.vue_vue_type_script_setup_true_lang-BH1_y9Dy.js";import"./event-CLiVQHeO.js";import"./account-C850CBTF.js";const{t:r}=v(),A=()=>({columns:[{title:r("common.messagedefine.Num"),key:"num",width:60,render:(i,o)=>o+1},{title:r("jobOrder.SMSFileCode"),key:"formCode"},{title:r("jobOrder.SMSFileEn"),key:"formNameEn"},{title:r("jobOrder.SMSFileCn"),key:"formName"},{title:r("jobOrder.mandatory"),key:"mandatory",render:i=>h(I,{checked:i.mandatory,checkedValue:1,uncheckedValue:0,disabled:!0,onUpdateChecked:o=>{i.mandatory=o}})}]}),H=P({__name:"index",props:{itemParams:{},edit:{type:Boolean}},setup(y,{expose:i}){const o=y,k=B(),{t}=v(),{columns:g}=A(),w=u(),n=u(),S=u(!1),O=R({width:100,title:t("common.optionsText"),key:"action",fixed:"right",align:"center",render(e){return h($,{style:"text",actions:[{ifShow:o.edit&&!m(e,"fileId"),label:t("common.addText"),labelShow:!1,disabled:!o.edit,icon:f(p.add),onClick:()=>s(e,"add",o.itemParams)},{label:t("common.optionsEditText"),labelShow:!1,disabled:!o.edit,icon:f(p.edit),onClick:()=>s(e,"edit",o.itemParams),ifShow:o.edit&&m(e,"fileId")},{label:t("jobOrder.copy"),labelShow:!1,disabled:!o.edit,icon:h(N),onClick:()=>s(e,"copy",o.itemParams),ifShow:o.edit&&m(e,"lastFileCode")&&!z(e.lastFileCode)&&!E(e.fileId)},{ifShow:!o.edit,label:t("common.optionsViewText"),labelShow:!1,icon:f(p.view,"blue"),onClick:()=>s(e,"view",o.itemParams)}]})}});function s(e,l,d){if(!e.formUrl){k.error(t("jobOrder.fileNotExist"));return}c(!0),M(()=>{w.value?.setFormUrl(e,l,d)})}function c(e){S.value=e}async function C(){if(!o.itemParams.id)return;const e=await G(o.itemParams.id);n.value=e.filter(l=>l!==null)}async function F(){return n.value&&n.value.length>0&&n.value.forEach(e=>{if(e.mandatory===1&&!m(e,"fileId"))throw k.error(e.formCode+t("jobOrder.fileRequired")),new Error(t("jobOrder.fileRequired"))}),!0}return V(()=>{c(!1)}),D(()=>{C()}),i({validate:F}),(e,l)=>{const d=U,j=X;return b(),_(j,null,{default:x(()=>[a(S)?(b(),_(L,{key:1,ref_key:"OnlineDocsRef",ref:w,onSuccess:C,onSwitchFile:c,edit:e.edit},null,8,["edit"])):(b(),_(d,{key:0,bordered:!1,class:"proCard","content-class":"pt-[6px]"},{default:x(()=>[W(a(Z),{ref:"basicTableRef",columns:a(g),title:a(t)("jobOrder.smsForms"),dataSource:a(n),pagination:!1,"row-key":T=>T.formCode,autoScrollX:!0,"virtual-scroll":"",actionColumn:a(O)},null,8,["columns","title","dataSource","row-key","actionColumn"])]),_:1}))]),_:1})}}}),ve=q(H,[["__scopeId","data-v-15ec15bf"]]);export{ve as default};
