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