import{u as Q}from"./index-M_JNBppB.js";/* empty css                  *//* empty css                   *//* empty css                  *//* empty css                    *//* empty css                      *//* empty css               *//* empty css                  *//* empty css                     *//* empty css                  *//* empty css                 *//* empty css               *//* empty css               *//* empty css                        *//* empty css                       *//* empty css                        */import{t as X}from"./3dmodel-BhTOwEe4.js";import{t as Y}from"./typesList-laraQC3c.js";import{A as Z,B as ee,C as te,D as oe,F as ae,G as le,t as ne,H as se,f as ie,o as re,q as N}from"./element-3_pOinej.js";import{r as d,l as ue,B as f,z as c,O as u,F as n,D as p,u as l,M as b,a7 as k,y as C,L as v,k as S,W as pe,K as x,H as ce}from"./vue-BJk78QHK.js";const me={class:"flex justify-between w-[100%] items-center m-b-[10px]"},de={class:"flex items-center"},ge={class:"m-l-[5px]"},_e={style:{height:"20px","margin-bottom":"6px",overflow:"hidden"}},fe={class:"dialog-footer"},Ge={__name:"threeGroup",emits:["threeCheck"],setup(ve,{expose:B,emit:T}){const D=T,{getImgUrl:I}=Q(),i=d([{title:"主题背景",name:"主题背景",icon:"el-icon-picture"},{title:"装饰图片",name:"装饰图片",icon:"el-icon-picture"},{title:"字体图标",name:"字体图标",icon:"el-icon-s-management"}]),L=d([{name:"我的资源",status:!1},{name:"公共资源",status:!0}]),z=d([]),m=d(!1),s=d(""),a=ue({key:"",type:"",pageNo:1,pageSize:12,total:0,open:!1}),g=d(null);function P(t){return t.split(".").pop()}async function V(){const t={pageNo:1,pageSize:1e3,usedfor:"3dmodel",open:a.open};try{const e=await Y(t);i.value=e.data,!i.value.some(h=>h._id===s.value)&&i.value.length>0&&(s.value=i.value[0]._id),s.value&&await _(),m.value=!0}catch(e){N.error(e)}}function _(){a.type=s.value,X(a).then(t=>{z.value=t.data,a.total=t.total})}function R(){!g.value||!g.value.img?N.error("请选择模型"):(m.value=!1,D("threeCheck",g.value))}function U(t){g.value=t}function G(t){i.value=i.value.filter(e=>e._id!==t),s.value=i.value[0]._id}function j(t){a.pageNo=1,s.value=t.props.name,_()}function A(){a.pageNo=1,V()}function F(t){a.pageSize=t,_()}function $(t){a.pageNo=t,_()}return B({opened:V}),(t,e)=>{const E=ee,h=Z,H=ne,M=le,O=ae,q=se,K=oe,W=te,w=ie,J=re;return c(),f("div",null,[u(J,{title:"三维模型库",modelValue:l(m),"onUpdate:modelValue":e[3]||(e[3]=o=>S(m)?m.value=o:null),width:"75%","close-on-click-modal":!1},{footer:n(()=>[p("span",fe,[u(w,{size:"small",onClick:e[2]||(e[2]=o=>m.value=!1)},{default:n(()=>e[4]||(e[4]=[x("取 消")])),_:1}),u(w,{type:"primary",size:"small",onClick:R},{default:n(()=>e[5]||(e[5]=[x("确 定")])),_:1})])]),default:n(()=>[p("div",me,[u(h,{modelValue:l(a).open,"onUpdate:modelValue":e[0]||(e[0]=o=>l(a).open=o),size:"small",onChange:A},{default:n(()=>[(c(!0),f(b,null,k(l(L),(o,r)=>(c(),C(E,{label:o.name,value:o.status,key:r},{default:n(()=>[p("div",de,[p("span",ge,v(o.name),1)])]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue"])]),u(W,{modelValue:l(s),"onUpdate:modelValue":e[1]||(e[1]=o=>S(s)?s.value=o:null),type:"border-card",onTabClick:j,onTabRemove:G},{default:n(()=>[(c(!0),f(b,null,k(l(i),o=>(c(),C(K,{key:o.name,label:o.name,name:o._id},{label:n(()=>[p("span",null,[p("span",{style:{"margin-left":"10px"},class:ce(["iconfont titleIcon",`icon-${o.icon}`])},null,2),x(v(o.name),1)])]),default:n(()=>[u(O,{gutter:6},{default:n(()=>[(c(!0),f(b,null,k(l(z),r=>(c(),C(M,{key:r.id,span:4,onClick:y=>U(r)},{default:n(()=>{var y;return[p("div",{style:pe([{height:"150px"},((y=l(g))==null?void 0:y._id)===r._id?"border: 4px solid red;":"border: 1px solid #ccc;"])},[u(H,{style:{width:"100%",height:"100%"},src:l(I)(r.img),fit:"fill"},null,8,["src"])],4),p("div",_e,v(r.name)+" （类型:"+v(P(r.url))+"） ",1)]}),_:2},1032,["onClick"]))),128))]),_:1}),u(q,{style:{"margin-top":"16px"},background:"","current-page":l(a).pageNo,"page-size":l(a).pageSize,"page-sizes":[12,24,48],layout:"total, sizes, prev, pager, next, jumper",total:l(a).total,onSizeChange:F,onCurrentChange:$},null,8,["current-page","page-size","total"])]),_:2},1032,["label","name"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["modelValue"])])}}};export{Ge as _};
