import{_ as H,L as J,a as M,u as G,g as Q,r as o,w as X,d as p,D as Y,c as i,o as l,e as I,l as a,f as u,h as r,i as m,a5 as Z,k as ee,H as te,F as T,j as V,E as O,J as L,m as h,t as N,S as n}from"./index-2AiR4orY.js";import{q as se,a as ae,o as F,d as le}from"./template-DuhdlmKS.js";import{F as ne}from"./fileView-tbrBQ2z7.js";import{i as oe}from"./index-BTQtuIEL.js";import{a as ie}from"./Document-C5ye4qW6.js";import"./index-x3tWs_0_.js";import"./applyTemplate-BnHIDwqK.js";const ce={class:"template_center"},re={key:0,class:"temp_top"},de={key:1,class:"template_tabs"},pe={class:"tab_top"},ue=["onClick"],me={class:"template_tab_content ml10"},_e=["onClick"],fe=["src"],ve={class:"file_name"},ye={class:"file_time"},he={key:2,class:"screen_review"},ge={class:"bnts"},ke=J({name:"OfficialDocument"}),be=Object.assign(ke,{setup(we){M();const E=G(),{proxy:Ce}=Q(),g=o("all"),k=o([]),b=o([{id:0,fileName:"全部"}]),c=o(null),_=o(!1),w=o(!0);o(!1);const f=o(!1),y=o(""),S=()=>{C(g.value)},B=()=>{f.value=!1},q=()=>{_.value=!0,["docx","doc","pdf"].indexOf(c.value.nameSuffix)>=0?F({fileId:c.value.id,isTemplate:1}).then(t=>{if(t.status===200){const e=t.data;e.code===1e3?window.Application.Documents.Open(e.file_path,null,!1):n.error(e.msg)}else n.error("接口异常")}).catch(()=>{n.error("接口异常")}).finally(()=>{_.value=!1}):le({fileId:c.value.id,isTemplate:1}).then(t=>{if(t.status===200){const e=t.data;e.code===1e3?n.success("操作成功"):n.error(e.msg)}else n.error("接口异常")}).catch(()=>{n.error("接口异常")}).finally(()=>{_.value=!1})},A=t=>t.coverUrl,R=t=>{c.value=null,g.value=t.id,C(t.id)},C=t=>{w.value=!0;let e={size:1e3,current:1,typeId:null,templateType:"official",name:y.value};t=="all"?e.typeId="":e.typeId=t,ae(e).then(v=>{b.value=v.data.records.filter(d=>oe(d.type))}).finally(()=>{w.value=!1})},P=t=>{c.value=t,f.value=!0},W=async()=>{F({fileId:c.value.id,isTemplate:1}).then(async t=>{if(t.status===200){const e=t.data;if(e.code===1e3){const v=e.file_path;ie(v).then(d=>{n.success(d.msg)}).catch(d=>{n.error(d)})}else n.error(e.msg)}else n.error("接口异常")})};return(()=>{se({templateType:"official"}).then(t=>{k.value=t.data,k.value.splice(0,0,{id:"all",typeName:"全部"})})})(),C("all"),X(()=>E.query,t=>{},{immediate:!0}),(t,e)=>{const v=p("Search"),d=p("el-icon"),j=p("el-input"),z=p("el-tooltip"),K=p("el-scrollbar"),U=p("el-empty"),x=p("el-button"),$=Y("loading");return l(),i("div",ce,[a(f)?I("",!0):(l(),i("div",re,[e[1]||(e[1]=u("div",{class:"add-icon"},"公文排版",-1)),r(j,{class:"document_input ml10",modelValue:a(y),"onUpdate:modelValue":e[0]||(e[0]=s=>ee(y)?y.value=s:null),placeholder:"搜索",clearable:"",onKeyup:Z(S,["enter"])},{suffix:m(()=>[r(d,{onClick:S,class:"input-icon"},{default:m(()=>[r(v)]),_:1})]),_:1},8,["modelValue"])])),a(f)?I("",!0):(l(),i("div",de,[u("div",pe,[(l(!0),i(T,null,V(a(k),s=>(l(),i("div",{class:L(["tab_top_item",{isact:a(g)==s.id}]),key:s.id,onClick:D=>R(s)},N(s.typeName&&s.typeName.length>6?s.typeName.slice(0,6)+"...":s.typeName),11,ue))),128))]),te((l(),i("div",me,[a(b).length>0?(l(),O(K,{key:0,style:{height:"calc(100% - 35px)"}},{default:m(()=>[(l(!0),i(T,null,V(a(b),s=>{var D;return l(),i("div",{class:L(["list flex",{isact:((D=a(c))==null?void 0:D.id)==s.id}]),key:"file_"+s.id,onClick:De=>P(s)},[u("img",{src:A(s),alt:"",class:"file_img"},null,8,fe),u("div",ve,[u("div",null,[r(z,{content:s.name,placement:"top",effect:"dark"},{default:m(()=>[h(N(s.name&&s.name.length>12?s.name.slice(0,12)+"...":s.name),1)]),_:2},1032,["content"])]),u("div",ye,N(s.createTime),1)])],10,_e)}),128))]),_:1})):(l(),O(U,{key:1,description:"暂无文件",class:"review_empty"}))])),[[$,a(w)]])])),a(f)?(l(),i("div",he,[u("div",ge,[r(x,{type:"primary",class:"review_btn",icon:"ArrowLeftBold",onClick:B},{default:m(()=>e[2]||(e[2]=[h(" 返回 ")])),_:1}),r(x,{class:"review_btn",type:"primary",icon:"Edit",loading:a(_),onClick:W},{default:m(()=>e[3]||(e[3]=[h(" 应用到文档 ")])),_:1},8,["loading"]),r(x,{class:"review_btn",type:"primary",icon:"Edit",loading:a(_),onClick:q},{default:m(()=>e[4]||(e[4]=[h(" 立即使用 ")])),_:1},8,["loading"])]),r(ne,{selectData:a(c)},null,8,["selectData"])])):I("",!0)])}}}),Fe=H(be,[["__scopeId","data-v-2e6cce5e"]]);export{Fe as default};
