← Back
Editing: index402.js
import{_ as e}from"./index103.js?v=VERSION_NUMBER";import{j as t,k as a,r as s,s as l,e as r,B as i,g as n,al as o,a5 as u,c,q as m,v as p,A as d,x as h,D as g}from"./base-lib.js?v=VERSION_NUMBER";import{n as y,L as _,p as f,K as v,M as b,u as w,a6 as k,cu as C,a7 as j}from"./utils-lib.js?v=VERSION_NUMBER";import{p as x,q as T,r as R,t as O,v as S,w as B,x as L,y as P,z as E,A as q}from"./useMethod5.js?v=VERSION_NUMBER";import{b as z}from"./form-item.js?v=VERSION_NUMBER";import{u as D,a as V}from"./column.js?v=VERSION_NUMBER";import{_ as A}from"./index104.js?v=VERSION_NUMBER";import{B as I}from"./index482.js?v=VERSION_NUMBER";const M=t("WP-SETS-STORE",(()=>{const e=a({name:""}),t=a({id:0,type:1}),l=a({p:1,p_size:999,keyword:"",set_id:0}),r=s(!1),i=s(!1),n=s(!1);return{createFormData:e,wpSetsPluginOrTheme:t,pluginOrThemePamra:l,isRefreshInstallList:r,isRefreshPluginOrThemeList:i,isRefreshSetsList:n,resetCreateFormData:()=>{e.name=""}}})),{wpSetsPluginOrTheme:F,pluginOrThemePamra:N,isRefreshInstallList:H,isRefreshPluginOrThemeList:J,isRefreshSetsList:K}=l(M()),U=()=>{y({title:"创建集合包",area:48,btn:!0,component:()=>_((()=>import("./created-set.js?v=VERSION_NUMBER")),__vite__mapDeps([]),import.meta.url)})},W=e=>{const t={class:"!w-[280px]",clearable:!0};return n((()=>[z("名称","name",{attrs:{...t,placeholder:"请输入集合名称"},rules:[{required:!0,message:"集合名称不能为空",trigger:"blur"}]})]))},G=(e,t)=>{F.value={id:e.id,type:t},y({title:"".concat(1===t?"添加插件":"添加主题","-【请先搜索后勾选需要的").concat(1===t?"插件":"主题","】"),area:60,component:()=>_((()=>import("./edit-set.js?v=VERSION_NUMBER")),__vite__mapDeps([]),import.meta.url)})},Q=async e=>{try{const{data:{msg:e}}=await R({set_id:F.value.id,type:F.value.type});return{data:e,total:0}}catch(t){return{data:[],total:0,other:{search_history:[]}}}},X=()=>[{label:"名称",isCustom:!0,prop:"title"},{label:"状态",prop:"state",width:80,render:e=>r(o,{modelValue:e.state,"onUpdate:modelValue":t=>e.state=t,size:"small","active-value":1,"inactive-value":0,onChange:t=>{v({request:O({item_ids:e.id,state:t?1:0,type:F.value.type}),loading:"正在设置中...",message:!0,success:()=>{J.value=!0}})}},null)},D([{title:"删除",onClick:async e=>{v({request:S({item_ids:e.id,type:F.value.type}),loading:"正在删除中...",message:!0,success:()=>{J.value=!0,K.value=!0}})}}])],Y=()=>[V({key:"name"}),{label:"名称",isCustom:!0,prop:"name"},{label:"等级",isCustom:!0,prop:"title",render:e=>r(I,{modelValue:Number((e.rating/20).toFixed(0)),disabled:!0,"allow-half":!0,class:"!text-[2rem]"},null)}],Z=async e=>{let t;try{if(!e.search)return;t=b.load("正在加载..."),N.value.keyword=e.search,N.value.set_id=F.value.id;const{data:{msg:{list:a}}}=1===F.value.type?await B(u(N.value)):await L(u(N.value));return{data:a,total:0}}catch(a){return{data:[],total:0}}finally{t&&t.close()}},$=async e=>{if(!N.value.keyword||!(null==e?void 0:e.length))return void b.error("请选一个主题或插件以添加");const t=e.map((e=>({slug:e.slug,title:e.name,description:1===F.value.type?e.short_description:e.description})));await P({set_id:F.value.id,items:JSON.stringify(t),type:F.value.type}),J.value=!0,K.value=!0},ee=async e=>{try{const{data:{msg:e}}=await E();return{data:e,total:0}}catch(t){return{data:[],total:0}}},te=()=>[V(),{label:"名称",isCustom:!0,prop:"name"}],ae=async(e,t)=>{try{const a=e.map((e=>e.id)).join(",");await v({loading:"正在安装,请稍后...",message:!0,request:q({set_id:F.value.id,site_ids:a}),success:e=>{e.status&&t&&t()}})}catch(a){return!1}},se={class:"p-[2rem]"},le=c({__name:"index",setup(t){const{mainHeight:a}=w(),{isRefreshSetsList:s}=l(M()),{BtTable:n,BtPage:o,BtRecommendSearch:u,BtRefresh:c,BtColumn:b,BtBatch:R,BtTableCategory:O,BtErrorMask:S,tableRef:B,classList:L,refresh:P,BtSearch:E}=k({request:e=>(async e=>{try{const{data:{list:t,total:a}}=await x({keyword:e.search,p_size:e.limit,p:e.p});return{data:t,total:a}}catch(t){return{data:[],total:0,other:{search_history:[]}}}})(e),columns:[{label:"名称",isCustom:!0,prop:"name",render:e=>r("span",null,[e.name])},{label:"插件",isCustom:!0,prop:"plugins",render:e=>r("span",{class:"bt-link",onClick:()=>{G(e,1)}},["".concat(e.plugins.length," 条(添加插件)")])},{label:"主题",isCustom:!0,prop:"themes",render:e=>r("span",{class:"bt-link",onClick:()=>{G(e,2)}},["".concat(e.themes.length," 条(添加主题)")])},D((e=>[{render:e=>r("div",{class:"inline-block"},[0===e.plugins.length&&0===e.themes.length?r("span",{class:"text-[#999]",style:"cursor:not-allowed"},[i("安装")]):r("span",{class:"bt-link",onClick:()=>{F.value.id=e.id,y({title:"选择网站",area:45,btn:!0,confirmText:"安装",component:()=>_((()=>import("./install-set.js?v=VERSION_NUMBER")),__vite__mapDeps([]),import.meta.url)})}},[i("安装")]),r(A,null,null)])},{render:e=>r("span",{class:"bt-link",onClick:()=>{f({title:"删除【".concat(e.name,"】"),content:"您确定要删除此组吗?",onConfirm:async()=>{await v({request:T({set_id:e.id}),loading:"正在删除中...",message:!0,success:()=>{K.value=!0}})}})}},[i("删除")])}]))],extension:[C("search",{name:"wp-sets",list:[]}),j(s)]});return(t,s)=>{const l=g,u=e;return m(),p("div",se,[r(u,null,{"header-left":d((()=>[r(l,{type:"primary",size:"default",onClick:h(U)},{default:d((()=>s[0]||(s[0]=[i("创建集合包")]))),_:1},8,["onClick"])])),"header-right":d((()=>[r(h(E),{type:"wp-sets",placeholder:"搜索",class:"!w-[270px] mr-[10px]"})])),content:d((()=>[r(h(n),{"min-height":h(a)},null,8,["min-height"])])),"footer-left":d((()=>[r(h(R))])),"footer-right":d((()=>[r(h(o))])),_:1})])}}}),re=Object.freeze(Object.defineProperty({__proto__:null,default:le},Symbol.toStringTag,{value:"Module"}));export{te as a,W as b,ae as c,Q as d,X as e,Z as f,ee as g,Y as h,re as i,$ as o,M as u}; function __vite__mapDeps(indexes) { if (!__vite__mapDeps.viteFileDeps) { __vite__mapDeps.viteFileDeps = [] } return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) }
Save File
Cancel