import{d as L,u as k,r as c,V as x,D as r,e as B,i as E,o as V,w as s,h as n,p as a,S as d,g as p,q as D,x as P,z as R,P as F}from"./index-5k_MqT6o.js";import{u as H,S as q,c as f,C as N}from"./index-Cl9RbTBn.js";import{L as T}from"./index-BDlrU7am.js";import{u as $,C as z}from"./index-BfmhdFfx.js";import"./index-BHx7dntQ.js";import"./index-CAzgmO3A.js";const O=L({__name:"index",setup(A){const{t:m}=k(),o=c("zh"),i=c([]),{register:h,tableActions:u}=H({title:"问题分类",showSelection:!1,showIndex:!0,immediate:!0,showExport:!1,api:r.categoryList,apiParams:{language_code:o.value},columns:[{prop:"name",label:"分类名称"},{prop:"num",label:"关联问题"},{prop:"weight",label:"权重"},{prop:"status",label:"状态",tagEnums:q}],schema:[],showAction:x(220,230,240),actionProps:{width:200,btnList:[{perm:220,label:"编辑",click:e=>{g({title:"编辑"},t=>{t.setSchema("language_code","options",f(i.value,"name","code").getEnums()),t.setFormModel(e.row)})}},{perm:230,slotName:"hideBtnSlot"},{perm:240,label:"删除",type:"danger",isPopConfirm:!0,popConfirmEmits:{confirm(e){return r.categoryDelete({id:e.row.id}).then(()=>{u.reload()}),!0}}}]}}),[C,{open:g,getFormActions:I}]=$({successCallBack(){u.reload()},api:r.categoryUpdate,formConfig:{schema:[{label:"",prop:"id",type:"input",notShow:!0},{label:"",prop:"category_id",type:"input",notShow:!0},{label:"分类名称",prop:"name",type:"input",props:{maxlength:20,showWordLimit:!0},required:!0},{label:"权重",prop:"weight",type:"input",required:!0},{label:"语种",prop:"language_code",type:"select",options:[]}]}});function w(){g({title:"新增"},e=>{e.setSchema("language_code","options",f(i.value,"name","code").getEnums()),e.setValues("language_code",o.value)})}function _(e){r.categorySetStatus({id:e.id}).then(()=>{u.reload()})}function v(e){u.getData({language_code:o.value})}function b(){r.homeGetLanguageCode().then(e=>{i.value=e})}function S(e){}return b(),(e,t)=>{const y=B("el-popconfirm");return V(),E(F,null,{default:s(()=>[n(a(N),{onRegister:a(h),onSetCallBack:S},{customHeader:s(()=>[t[1]||(t[1]=p("div",null,null,-1)),p("div",null,[P(n(d,{value:"添加分类",onClick:w},null,512),[[R,e.$perm(210)]])])]),formTop:s(()=>[p("div",null,[n(T,{modelValue:a(o),"onUpdate:modelValue":t[0]||(t[0]=l=>D(o)?o.value=l:null),onLanguageChange:v,languages:a(i)},null,8,["modelValue","languages"])])]),hideBtnSlot:s(l=>[n(y,{title:(l.row.status===1?a(m)("确认要隐藏吗"):a(m)("确认显示"))+"?",onConfirm:U=>_(l.row)},{reference:s(()=>[n(d,{value:l.row.status===1?"隐藏":"显示",link:"",style:{margin:"0 10px"}},null,8,["value"])]),_:2},1032,["title","onConfirm"])]),_:1},8,["onRegister"]),n(a(z),{onRegister:a(C)},null,8,["onRegister"])]),_:1})}}});export{O as default};
