import{_ as a}from"./index105.js?v=1761009159";import{P as l,p as e,l as s,k as t,j as o,b as i}from"./utils-lib.js?v=1761009159";import{c as u,y as n,r,V as d,q as c,H as m,v as p,x as v,e as f,B as b,Q as h,C as _,I as g,z as C,R as w,b1 as y,T as x,G as V,ab as j,a9 as k}from"./base-lib.js?v=1761009159";import"./__commonjsHelpers__.js?v=1761009159";const P={class:"p-[20px]"},q={class:"p-[20px]"},O=u({__name:"class-manage",props:{compData:{default:()=>({ignore:[],getClassList:()=>Promise.resolve([]),addClass:()=>Promise.resolve({}),editClass:()=>Promise.resolve({}),deleteClass:()=>Promise.resolve({}),updateOptions:()=>Promise.resolve([]),field:"ps",showEdit:!0})}},setup(u){const O=u,{getClassList:U,addClass:D,editClass:E,deleteClass:H,ignore:L,field:S,updateOptions:T,showEdit:z}=n(O.compData),B=r(""),G=r(""),I=r(!1),Q=r(!1),R=d([]),A=d({label:"",value:0}),F=i(),J=[{label:"分类名称",prop:"label",showOverflowTooltip:!0},{label:"操作",align:"right",render:a=>"all"===a.value||(null==L?void 0:L.includes("".concat(a.value)))?"不可操作":f("div",{class:"flex items-center"},[z&&f("span",{class:"flex items-center"},[f("span",{class:"bt-link",onClick:()=>N(a)},[_("编辑")]),f(y,{direction:"vertical"},null)]),f("span",{class:"bt-link",onClick:()=>X(a)},[_("删除")])])}],K=async()=>{try{I.value=!0;const a=await U();R.value=a||[],T(R.value)}catch(a){}finally{I.value=!1}},M=async()=>{try{if(!B.value)return F.error("请输入分类名称");const a={[S]:B.value},e=await l({loading:"正在添加分类，请稍后...",request:D(a)});Y(e),B.value=""}catch(a){}},N=a=>{Q.value=!0,A.value=a,G.value=a.label},W=async()=>{try{const a={[S]:G.value,id:A.value.value},e=await l({loading:"正在编辑分类，请稍后...",request:E(a)});e.status&&(Q.value=!1),G.value="",Y(e)}catch(a){}},X=async a=>{try{await e({title:"提示",content:"确认删除该分类吗？该分类下的所有数据将会被移动至全部分类下，是否继续？"});const s=await l({loading:"正在删除分类，请稍后...",request:H({id:a.value})});Y(s)}catch(s){}},Y=a=>{a.status&&K(),F.request(a)};return c(()=>{K()}),(l,e)=>{const i=x,u=V,r=s,d=t,c=j,y=k,O=o,U=a,D=m("bt-loading");return p(),v("div",P,[f(U,null,{"header-left":b(()=>[f(i,{modelValue:n(B),"onUpdate:modelValue":e[0]||(e[0]=a=>h(B)?B.value=a:null),placeholder:"请输入分类名称",class:"!w-[41rem]"},null,8,["modelValue"]),f(u,{type:"primary",class:"ml-[1rem]",onClick:M},{default:b(()=>e[4]||(e[4]=[_(" 添加分类 ",-1)])),_:1,__:[4]})]),content:b(()=>[g(f(r,{column:J,data:n(R),"max-height":"250"},null,8,["data"]),[[D,n(I)]])]),popup:b(()=>[f(O,{modelValue:n(Q),"onUpdate:modelValue":e[3]||(e[3]=a=>h(Q)?Q.value=a:null),area:40,title:"编辑分类","show-footer":"",onConfirm:W},{default:b(()=>[C("div",q,[f(y,{onSubmit:e[2]||(e[2]=w(()=>{},["prevent"]))},{default:b(()=>[f(c,{label:"分类名称",prop:"name"},{default:b(()=>[f(d,{modelValue:n(G),"onUpdate:modelValue":e[1]||(e[1]=a=>h(G)?G.value=a:null),autofocus:"",placeholder:"请输入分类名称",onSubmit:W,width:"22rem"},null,8,["modelValue"])]),_:1})]),_:1})])]),_:1},8,["modelValue"])]),_:1}),e[5]||(e[5]=C("ul",{class:"mt-[8px] leading-8 text-small list-disc ml-[20px]"},[C("li",null,"【批量操作-设置分类】可修改当前分类，仅具备批量操作的列表")],-1))])}}});export{O as default};
