import{d as B,u as L,r as f,V as x,D as i,e as E,i as R,o as V,w as n,h as o,p as a,S as m,g as D,q as P,x as N,z as $,P as F}from"./index-5k_MqT6o.js";import{u as q,R as T,S as z,c as w,C as H}from"./index-Cl9RbTBn.js";import{L as I}from"./index-BDlrU7am.js";import{u as U,C as G}from"./index-BfmhdFfx.js";import"./index-BHx7dntQ.js";import"./index-CAzgmO3A.js";const X=B({__name:"index",setup(M){const{t:r}=L(),s=f("zh"),u=f([]),g=f([]),{register:C,tableActions:p}=q({title:"猜你想问",showSelection:!1,showIndex:!0,immediate:!0,showExport:!1,api:i.guessaskList,apiParams:{language_code:s.value},columns:[{prop:"name",label:"猜你想问"},{prop:"type_text",label:"类型"},{prop:"is_rec",label:"是否推荐",tagEnums:T},{prop:"click_num",label:"点击次数"},{prop:"status",label:"状态",tagEnums:z}],schema:[{prop:"name",label:"猜你想问关键词",type:"input"}],showAction:x(410,420,430,440,450),actionProps:{width:300,btnList:[{perm:410,slotName:"recBtnSlot"},{perm:420,slotName:"topBtnSlot"},{perm:430,label:"编辑",click:e=>{_({title:"编辑"},l=>{l.setSchema("type","options",g.value),l.setSchema("language_code","options",w(u.value,"name","code").getEnums()),l.setFormModel(e.row)})}},{perm:440,slotName:"hideBtnSlot"},{perm:450,label:"删除",type:"danger",isPopConfirm:!0,popConfirmEmits:{confirm(e){return i.guessaskDelete({id:e.row.id}).then(()=>{p.reload()}),!0}}}]}}),[v,{open:_,getFormActions:W}]=U({successCallBack(){p.reload()},api:i.guessaskUpdate,formConfig:{schema:[{label:"",prop:"id",type:"input",notShow:!0},{label:"",prop:"guess_ask_id",type:"input",notShow:!0},{label:"猜你想问",prop:"name",type:"input",props:{maxlength:60,showWordLimit:!0},required:!0},{label:"类型",prop:"type",type:"select"},{label:"权重",prop:"weight",type:"input",required:!0},{label:"语种",prop:"language_code",type:"select",options:[]}]}});function S(){_({title:"新增"},e=>{e.setSchema("type","options",g.value),e.setSchema("language_code","options",w(u.value,"name","code").getEnums()),e.setValues("language_code",s.value)})}function c(e,l){i.guessaskSetStatus({id:e.id,field:l}).then(()=>{p.reload()})}function y(e){p.getData({language_code:s.value})}function b(){i.homeGetLanguageCode().then(e=>{u.value=e})}function k(e){g.value=e.typeList}return b(),(e,l)=>{const d=E("el-popconfirm");return V(),R(F,null,{default:n(()=>[o(a(H),{onRegister:a(C),onSetCallBack:k},{searchRight:n(()=>[N(o(m,{value:"添加猜你想问",onClick:S},null,512),[[$,e.$perm(400)]])]),formTop:n(()=>[D("div",null,[o(I,{modelValue:a(s),"onUpdate:modelValue":l[0]||(l[0]=t=>P(s)?s.value=t:null),onLanguageChange:y,languages:a(u)},null,8,["modelValue","languages"])])]),recBtnSlot:n(t=>[o(d,{title:(t.row.is_rec===1?a(r)("确认要取消推荐吗"):a(r)("确认推荐"))+"?",onConfirm:h=>c(t.row,"is_rec")},{reference:n(()=>[o(m,{value:t.row.is_rec===1?"取消推荐":"推荐",type:t.row.is_rec===1?"warning":"primary",link:""},null,8,["value","type"])]),_:2},1032,["title","onConfirm"])]),topBtnSlot:n(t=>[o(d,{title:(t.row.is_top===1?a(r)("确认要取消置顶吗"):a(r)("确认置顶"))+"?",onConfirm:h=>c(t.row,"is_top")},{reference:n(()=>[o(m,{value:t.row.is_top===1?"取消置顶":"置顶",type:t.row.is_top===1?"warning":"primary",link:"",style:{margin:"0 10px"}},null,8,["value","type"])]),_:2},1032,["title","onConfirm"])]),hideBtnSlot:n(t=>[o(d,{title:(t.row.status===1?a(r)("确认要隐藏吗"):a(r)("确认显示"))+"?",onConfirm:h=>c(t.row,"status")},{reference:n(()=>[o(m,{value:t.row.status===1?"隐藏":"显示",link:"",style:{margin:"0 10px"}},null,8,["value"])]),_:2},1032,["title","onConfirm"])]),_:1},8,["onRegister"]),o(a(G),{onRegister:a(v)},null,8,["onRegister"])]),_:1})}}});export{X as default};
