2 lines
8.0 KiB
JavaScript
2 lines
8.0 KiB
JavaScript
var A=(t,o,l)=>new Promise((p,v)=>{var w=e=>{try{g(l.next(e))}catch(c){v(c)}},d=e=>{try{g(l.throw(e))}catch(c){v(c)}},g=e=>e.done?p(e.value):Promise.resolve(e.value).then(w,d);g((l=l.apply(t,o)).next())});import{d as U,l as q,H,Y as j,j as E,r as i,o as r,c as C,b as a,w as n,n as f,e as R,t as B,F as N,q as V,D as b,E as L,u as s,a5 as oe,a6 as G,h as T,J as se,M as le,I as ce,N as ie,a7 as re,a8 as de,a9 as O,R as Q,Q as W,U as Y}from"./index-4ec2ce15.js";import{i as K}from"./icon-42fa39e7.js";import{M as X}from"./index-b2b393ee.js";import{p as _e,d as ue,a as pe}from"./project.api-0931840b.js";import{g as me,D as ge}from"./plugin-ae137233.js";const ve={key:0,class:"go-items-list-card"},he={class:"list-content"},fe={class:"list-content-top"},be={class:"go-flex-items-center list-footer",justify:"space-between"},we={class:"go-flex-items-center list-footer-ri"},ye=U({__name:"index",props:{cardData:Object},emits:["preview","delete","resize","edit","release"],setup(t,{emit:o}){var _;const l=t,{EllipsisHorizontalCircleSharpIcon:p,CopyIcon:v,TrashIcon:w,PencilIcon:d,DownloadIcon:g,BrowsersOutlineIcon:e,HammerIcon:c,SendIcon:y}=K.ionicons5,h=q([{label:H("global.r_edit"),key:"edit",icon:j(c)},{lable:H("global.r_more"),key:"select",icon:j(p)}]),m=E([{label:H("global.r_preview"),key:"preview",icon:j(e)},{label:(_=l.cardData)!=null&&_.release?H("global.r_unpublish"):H("global.r_publish"),key:"release",icon:j(y)},{label:H("global.r_delete"),key:"delete",icon:j(w)}]),D=u=>{switch(u){case"preview":$();break;case"delete":k();break;case"release":P();break;case"edit":x();break}},$=()=>{o("preview",l.cardData)},k=()=>{o("delete",l.cardData)},x=()=>{o("edit",l.cardData)},P=()=>{o("release",l.cardData)},I=()=>{o("resize",l.cardData)};return(u,M)=>{const z=i("n-image"),F=i("n-text"),Z=i("n-badge"),J=i("n-button"),ee=i("n-dropdown"),te=i("n-tooltip"),ae=i("n-space"),ne=i("n-card");return t.cardData?(r(),C("div",ve,[a(ne,{hoverable:"",size:"small"},{action:n(()=>[f("div",be,[a(F,{class:"go-ellipsis-1"},{default:n(()=>[R(B(t.cardData.title||t.cardData.id||"未命名"),1)]),_:1}),f("div",we,[a(ae,null,{default:n(()=>[a(F,null,{default:n(()=>[a(Z,{class:"go-animation-twinkle",dot:"",color:t.cardData.release?"#34c749":"#fcbc40"},null,8,["color"]),R(" "+B(t.cardData.release?u.$t("project.release"):u.$t("project.unreleased")),1)]),_:1}),(r(!0),C(N,null,V(h,S=>(r(),C(N,{key:S.key},[S.key==="select"?(r(),b(ee,{key:0,trigger:"hover",placement:"bottom",options:m.value,"show-arrow":!0,onSelect:D},{default:n(()=>[a(J,{size:"small"},{icon:n(()=>[(r(),b(L(S.icon)))]),_:2},1024)]),_:2},1032,["options"])):(r(),b(te,{key:1,placement:"bottom",trigger:"hover"},{trigger:n(()=>[a(J,{size:"small",onClick:Be=>D(S.key)},{icon:n(()=>[(r(),b(L(S.icon)))]),_:2},1032,["onClick"])]),default:n(()=>[(r(),b(L(S.label)))]),_:2},1024))],64))),128))]),_:1})])])]),default:n(()=>[f("div",he,[f("div",fe,[a(s(X),{class:"top-btn",hidden:["remove"],onClose:k,onResize:I})]),f("div",{class:"list-content-img",onClick:I},[a(z,{"object-fit":"contain",height:"180","preview-disabled":"",src:`${t.cardData.image}?time=${new Date().getTime()}`,alt:t.cardData.title,"fallback-src":s(oe)()},null,8,["src","alt","fallback-src"])])])]),_:1})])):G("",!0)}}});const De=T(ye,[["__scopeId","data-v-0814e2b8"]]),ke={class:"list-content"},xe={class:"list-content-img"},He=["src","alt"],Ce=U({__name:"index",props:{modalShow:{required:!0,type:Boolean},cardData:{required:!0,type:Object}},emits:["close","edit"],setup(t,{emit:o}){const l=t,{HammerIcon:p}=K.ionicons5,v=E(!1);se(()=>l.modalShow,c=>{v.value=c},{immediate:!0});const w=q([{label:H("global.r_edit"),key:"edit",icon:j(p)}]),d=c=>{switch(c){case"edit":g();break}},g=()=>{o("edit",l.cardData)},e=()=>{o("close")};return(c,y)=>{const h=i("n-text"),m=i("n-space"),D=i("n-time"),$=i("n-badge"),k=i("n-button"),x=i("n-tooltip"),P=i("n-card"),I=i("n-modal");return r(),b(I,{class:"go-modal-box",show:v.value,"onUpdate:show":y[0]||(y[0]=_=>v.value=_),onAfterLeave:e},{default:n(()=>[a(P,{hoverable:"",size:"small"},{action:n(()=>[a(m,{class:"list-footer",justify:"space-between"},{default:n(()=>[a(h,{depth:"3"},{default:n(()=>[R(B(c.$t("project.last_edit"))+": ",1),a(D,{time:new Date,format:"yyyy-MM-dd hh:mm"},null,8,["time"])]),_:1}),a(m,null,{default:n(()=>[a(h,null,{default:n(()=>{var _,u;return[a($,{class:"go-animation-twinkle",dot:"",color:(_=t.cardData)!=null&&_.release?"#34c749":"#fcbc40"},null,8,["color"]),R(" "+B((u=t.cardData)!=null&&u.release?c.$t("project.release"):c.$t("project.unreleased")),1)]}),_:1}),(r(!0),C(N,null,V(w,_=>(r(),b(x,{key:_.key,placement:"bottom",trigger:"hover"},{trigger:n(()=>[a(k,{size:"small",onClick:u=>d(_.key)},{icon:n(()=>[(r(),b(L(_.icon)))]),_:2},1032,["onClick"])]),default:n(()=>[(r(),b(L(_.label)))]),_:2},1024))),128))]),_:1})]),_:1})]),default:n(()=>{var _,u;return[f("div",ke,[a(m,{class:"list-content-top go-px-0",justify:"center"},{default:n(()=>[a(m,null,{default:n(()=>[a(h,null,{default:n(()=>{var M,z;return[R(B(((M=t.cardData)==null?void 0:M.title)||((z=t.cardData)==null?void 0:z.id)||"未命名"),1)]}),_:1})]),_:1})]),_:1}),a(m,{class:"list-content-top"},{default:n(()=>[a(s(X),{narrow:!0,hidden:["close"],onRemove:e})]),_:1}),f("div",xe,[f("img",{src:(_=t.cardData)==null?void 0:_.image,alt:(u=t.cardData)==null?void 0:u.title},null,8,He)])])]}),_:1})]),_:1},8,["show"])}}});const $e=T(Ce,[["__scopeId","data-v-0b024926"]]),Ie=()=>{const t=E(!1),o=E(null);return{modalData:o,modalShow:t,closeModal:()=>{t.value=!1,o.value=null},resizeHandle:d=>{d&&(t.value=!0,o.value=d)},editHandle:d=>{if(!d)return;const g=le(ce.CHART_HOME_NAME,"href");ie(g,[d.id],void 0,!0)},previewHandle:d=>{re(de(d.id))}}},ze=()=>{const t=E(!0),o=q({page:1,limit:12,count:10}),l=E([]),p=()=>A(void 0,null,function*(){t.value=!0;const e=yield _e({page:o.page,limit:o.limit});if(e&&e.data){const{count:c}=e;o.count=c,l.value=e.data.map(y=>{const{id:h,projectName:m,state:D,createTime:$,indexImage:k,createUserId:x}=y;return{id:h,title:m,createId:x,time:$,image:k,release:D!==-1}}),setTimeout(()=>{t.value=!1},500);return}O()}),v=e=>{o.page=e,p()},w=e=>{o.limit=e,p()},d=e=>{me({type:ge.DELETE,promise:!0,onPositiveCallback:()=>new Promise(c=>{c(ue({ids:e.id}))}),promiseResCallback:c=>{if(c.code===Q.SUCCESS){window.$message.success(window.$t("global.r_delete_success")),p();return}O()}})},g=(e,c)=>A(void 0,null,function*(){const{id:y,release:h}=e,m=yield pe({id:y,state:h?-1:1});if(m&&m.code===Q.SUCCESS){if(l.value=[],p(),h){window.$message.success(window.$t("global.r_unpublish_success"));return}window.$message.success(window.$t("global.r_publish_success"));return}O()});return p(),{loading:t,paginat:o,list:l,fetchList:p,releaseHandle:g,changeSize:w,changePage:v,deleteHandle:d}},Se={class:"go-items-list"},je={class:"list-pagination"},Ee=U({__name:"index",setup(t){const{modalData:o,modalShow:l,closeModal:p,previewHandle:v,resizeHandle:w,editHandle:d}=Ie(),{loading:g,paginat:e,list:c,changeSize:y,changePage:h,releaseHandle:m,deleteHandle:D}=ze();return($,k)=>{const x=i("go-loading"),P=i("n-grid-item"),I=i("n-grid"),_=i("n-pagination");return r(),C(N,null,[f("div",Se,[W(f("div",null,[a(x)],512),[[Y,s(g)]]),W(f("div",null,[a(I,{"x-gap":20,"y-gap":20,cols:"2 s:2 m:3 l:4 xl:4 xxl:4",responsive:"screen"},{default:n(()=>[(r(!0),C(N,null,V(s(c),(u,M)=>(r(),b(P,{key:u.id},{default:n(()=>[a(s(De),{cardData:u,onPreview:s(v),onResize:s(w),onDelete:z=>s(D)(u),onRelease:z=>s(m)(u,M),onEdit:s(d)},null,8,["cardData","onPreview","onResize","onDelete","onRelease","onEdit"])]),_:2},1024))),128))]),_:1})],512),[[Y,!s(g)]]),f("div",je,[a(_,{page:s(e).page,"page-size":s(e).limit,"item-count":s(e).count,"page-sizes":[12,24,36,48],"onUpdate:page":s(h),"onUpdate:pageSize":s(y),"show-size-picker":""},null,8,["page","page-size","item-count","onUpdate:page","onUpdate:pageSize"])])]),s(o)?(r(),b(s($e),{key:0,modalShow:s(l),cardData:s(o),onClose:s(p),onEdit:s(d)},null,8,["modalShow","cardData","onClose","onEdit"])):G("",!0)],64)}}});const Pe=T(Ee,[["__scopeId","data-v-c7933e27"]]),Me={class:"go-project-items"},Re=U({__name:"index",setup(t){return(o,l)=>(r(),C("div",Me,[a(s(Pe))]))}});const qe=T(Re,[["__scopeId","data-v-ba0e1d55"]]);export{qe as default};
|