test_lgq/niucloud/public/admin/assets/edit-addon-list-39325540.js
2024-01-24 17:36:08 +08:00

2 lines
3.9 KiB
JavaScript

import{d as z,r as v,v as N,D as j,n as A,h as p,c as x,y as m,z as g,u as e,a,t as _,N as i,e as d,w as c,F as C,G as F,R as w,i as R,I as y,B as P,b as $,E as M,Y as O,V as G,ah as U,aj as W,aa as Y,a0 as q}from"./index-4dcc0234.js";/* empty css *//* empty css *//* empty css *//* empty css *//* empty css */import"./el-tooltip-4ed993c7.js";/* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css */import{_ as H}from"./index.vue_vue_type_script_setup_true_lang-9285296e.js";import{u as J}from"./diy-06b37a1b.js";import{z as K}from"./sys-8ead7f22.js";import{S as Q}from"./sortable.esm-be94e56d.js";import{r as X}from"./range-72f9cbd3.js";const Z={class:"content-wrap"},ee={class:"edit-attr-item-wrap"},te={class:"mb-[10px]"},oe={class:"flex items-center pb-[10px]"},ae=["src"],ne={class:"flex flex-col justify-center ml-[10px] leading-[1]"},se={class:"text-[14px]"},le={class:"text-[12px] text-[#999] mt-[8px]"},ie=["onClick"],de={class:"style-wrap"},re=z({__name:"edit-addon-list",setup(ce,{expose:k}){const t=J();t.editComponent.ignore=[],t.editComponent.verify=l=>({code:!0,message:""});const u=v(!1),b=v();N(()=>{j(()=>{const l=Q.create(b.value,{group:"item-wrap",animation:200,onEnd:o=>{const r=t.editComponent.list[o.oldIndex];t.editComponent.list.splice(o.oldIndex,1),t.editComponent.list.splice(o.newIndex,0,r),l.sort(X(t.editComponent.list.length).map(h=>h.toString()))}})})});const n=A({page:1,limit:10,total:0,loading:!0,data:[],searchParam:{title:"",key:""}});((l=1)=>{n.loading=!0,n.page=l,K({...n.searchParam}).then(o=>{n.loading=!1,n.data=o.data,n.total=o.data.length}).catch(()=>{n.loading=!1})})();const S=l=>{const o={id:t.generateRandom(),key:"",title:"",url:"",icon:"",desc:""};for(let r in l)o[r]=l[r];t.editComponent.list.push(o),u.value=!1},T=()=>{u.value=!0};return k({}),(l,o)=>{const r=H,h=M,D=O,E=G,f=U,B=W,V=Y,I=q;return p(),x(C,null,[m(a("div",Z,[a("div",ee,[a("h3",te,_(e(i)("addonListSet")),1),d(D,{"label-width":"100px",class:"px-[10px]"},{default:c(()=>[a("div",{ref_key:"addonBoxRef",ref:b},[(p(!0),x(C,null,F(e(t).editComponent.list,(s,L)=>(p(),x("div",{key:s.id,class:"item-wrap !cursor-move p-[10px] pb-0 relative border border-dashed border-gray-300 mb-[16px]"},[m(a("div",oe,[a("img",{class:"w-[60px] h-[60px] rounded-md",src:e(w)(s.icon)},null,8,ae),a("div",ne,[a("span",se,_(s.title),1),a("span",le,_(s.desc),1)])],512),[[g,s.title]]),m(a("div",{class:"del absolute cursor-pointer z-[2] top-[-8px] right-[-8px]",onClick:me=>e(t).editComponent.list.splice(L,1)},[d(r,{name:"element-CircleCloseFilled",color:"#bbb",size:"20px"})],8,ie),[[g,e(t).editComponent.list.length>1]])]))),128))],512),d(h,{class:"w-full",onClick:T},{default:c(()=>[R(_(e(i)("addAddon")),1)]),_:1})]),_:1})]),d(V,{modelValue:u.value,"onUpdate:modelValue":o[0]||(o[0]=s=>u.value=s),title:e(i)("addonListTips"),width:"600px","close-on-press-escape":!1,"close-on-click-modal":!1},{default:c(()=>[a("div",null,[m((p(),y(B,{data:n.data,size:"large",onCurrentChange:S,"highlight-current-row":"","max-height":"500px"},{empty:c(()=>[a("span",null,_(n.loading?"":e(i)("emptyData")),1)]),default:c(()=>[d(f,{label:e(i)("addonIcon"),width:"120",align:"center"},{default:c(({row:s})=>[s.icon?(p(),y(E,{key:0,class:"w-[50px] h-[50px]",src:e(w)(s.icon),fit:"contain"},null,8,["src"])):P("",!0)]),_:1},8,["label"]),d(f,{prop:"title","show-overflow-tooltip":!0,width:"120",label:e(i)("addonTitle")},null,8,["label"]),d(f,{prop:"desc","show-overflow-tooltip":!0,label:e(i)("addonDesc")},null,8,["label"])]),_:1},8,["data"])),[[I,n.loading]])])]),_:1},8,["modelValue","title"])],512),[[g,e(t).editTab=="content"]]),m(a("div",de,[$(l.$slots,"style")],512),[[g,e(t).editTab=="style"]])],64)}}}),Ie=Object.freeze(Object.defineProperty({__proto__:null,default:re},Symbol.toStringTag,{value:"Module"}));export{Ie as _};