import{d as V,u as T,r as m,V as $,D as r,e as F,i as W,o as H,w as s,h as n,p as o,S as p,g as _,q as I,x as c,z as d,P as N}from"./index-5k_MqT6o.js";import{u as z,S as O,c as v,C as U}from"./index-Cl9RbTBn.js";import{L as G}from"./index-BDlrU7am.js";import{u as C,C as w}from"./index-BfmhdFfx.js";import"./index-BHx7dntQ.js";import"./index-CAzgmO3A.js";const ee=V({__name:"index",setup(M){const{t:y}=T(),b=m(),t=m("zh"),u=m([]),g=m([]),{register:S,tableActions:i}=z({title:"常用语管理",showSelection:!0,showExport:!1,immediate:!0,api:r.expressionList,apiParams:{language_code:t.value},columns:[{prop:"id",label:"ID",width:50},{prop:"category_name",label:"分类"},{prop:"name",label:"常用语"},{prop:"img",label:"图片",isImage:!0},{prop:"used_num",label:"使用次数"},{prop:"operation_name",label:"编辑人"},{prop:"weight",label:"权重"},{prop:"status",label:"状态",tagEnums:O},{prop:"created_at",label:"新增时间",width:140}],schema:[{label:"常用语",prop:"name",type:"input"},{label:"常用语分类",prop:"category_id",type:"sync-select",api:r.expressionCategoryList,immediate:!0,syncOptions:{label:"name",value:"category_id"},props:{filterable:!0},options:[]},{label:"编辑人",prop:"operation_name",type:"input"}],showAction:$(330,340,350),actionProps:{width:200,btnList:[{perm:330,label:"编辑",click:e=>{f({title:"编辑"},a=>{a.setSchema("category_id","apiParams",{language_code:t.value}),a.setSchema("keyword_id","apiParams",{language_code:t.value}),a.setSchema("question_type","options",g.value),a.setSchema("language_code","options",v(u.value,"name","code").getEnums()),a.setFormModel(e.row)})}},{perm:340,slotName:"hideBtnSlot"},{perm:350,label:"删除",type:"danger",isPopConfirm:!0,popConfirmEmits:{confirm(e){return r.expressionDelete({id:e.row.id}).then(()=>{i.reload()}),!0}}}]}}),[k,{open:f,getFormActions:j}]=C({successCallBack(){i.reload()},api:r.expressionUpdate,formConfig:{schema:[{label:"",prop:"id",type:"input",notShow:!0},{label:"",prop:"question_id",type:"input",notShow:!0},{label:"分类",prop:"category_id",type:"sync-select",api:r.expressionCategoryList,immediate:!0,syncOptions:{label:"name",value:"category_id"},props:{filterable:!0},options:[],required:!0},{label:"常用语",prop:"name",type:"input",props:{type:"textarea",maxlength:2e3,showWordLimit:!0},required:!0},{label:"图片",prop:"img",type:"upload"},{label:"权重",prop:"weight",type:"input",required:!0},{label:"语种",prop:"language_code",type:"select",options:[],change({value:e,setSchema:a}){a("keyword_id","apiParams",{language_code:e}),a("category_id","apiParams",{language_code:e})}}]}}),[x,L]=C({submit(e,a,h){r.expressionSetWeight({id:i.getSelectData().map(l=>l.id),weight:e.weight}).then(l=>{a(),i.reload()}).catch(()=>{h.value=!1})},successCallBack(){i.reload()},formConfig:{schema:[{label:"权重",prop:"weight",type:"input",required:!0}]}});function P(){f({title:"新增"},e=>{e.setSchema("category_id","apiParams",{language_code:t.value}),e.setSchema("keyword_id","apiParams",{language_code:t.value}),e.setSchema("question_type","options",g.value),e.setSchema("language_code","options",v(u.value,"name","code").getEnums()),e.setValues("language_code",t.value)})}function R(e){r.expressionSetStatus({id:e.id}).then(()=>{i.reload()})}function q(){L.open({title:"批量修改权重"},e=>{})}function B(e){i.getData({language_code:t.value}),b.value.searchBoxRef.setSchema("category_id","apiParams",{language_code:t.value})}function D(){r.homeGetLanguageCode().then(e=>{u.value=e})}function E(e,a){g.value=e.questionTypeList,a.setSchema("question_type","options",g.value)}return D(),(e,a)=>{const h=F("el-popconfirm");return H(),W(N,null,{default:s(()=>[n(o(U),{onRegister:o(S),onSetCallBack:E,ref_key:"tableRef",ref:b},{customHeader:s(({selectData:l})=>[a[1]||(a[1]=_("div",null,null,-1)),_("div",null,[c(n(p,{value:"添加常用语",onClick:P},null,512),[[d,e.$perm(290)]]),c(n(p,{type:"default",value:"导入"},null,512),[[d,e.$perm(300)]]),c(n(p,{value:"导出",onClick:o(i).exportTableData},null,8,["onClick"]),[[d,e.$perm(310)]]),c(n(p,{disabled:!l.length,value:"批量修改权重",onClick:q},null,8,["disabled"]),[[d,e.$perm(320)]])])]),formTop:s(()=>[_("div",null,[n(G,{modelValue:o(t),"onUpdate:modelValue":a[0]||(a[0]=l=>I(t)?t.value=l:null),languages:o(u),onLanguageChange:B},null,8,["modelValue","languages"])])]),hideBtnSlot:s(l=>[n(h,{title:(l.row.status===1?o(y)("确认要隐藏吗"):o(y)("确认显示"))+"?",onConfirm:J=>R(l.row)},{reference:s(()=>[n(p,{value:l.row.status===1?"隐藏":"显示",link:"",style:{margin:"0 10px"}},null,8,["value"])]),_:2},1032,["title","onConfirm"])]),_:1},8,["onRegister"]),n(o(w),{onRegister:o(k)},null,8,["onRegister"]),n(o(w),{onRegister:o(x)},null,8,["onRegister"])]),_:1})}}});export{ee as default};
