import{a as X,r,_ as j,f as M,q as z,aj as s,c as b,o as w,S as l,b as g,K as a,L as H,T as K,P as p,Q as x,R as Y,a9 as G,u as y,H as J}from"./vue.D1BjjNmv.js";import{k as W,ar as Z,X as ee,aa as te,ae as le,Y as ae,a9 as R,E as oe}from"./index.D93ign_E.js";import{g as ne,B as se,c as ie}from"./crud.BLPAqjgi.js";import{b as ce}from"./api.CwKatIT6.js";import{_ as de}from"./_plugin-vue_export-helper.DlAUqK2U.js";import"./authFunction.BLxX_QUS.js";const ue={class:"model-card"},re=["value"],pe={class:"dialog-footer"},me={style:{height:"72vh"}},fe=X({__name:"index",setup(_e,{expose:V}){let m=r({name:null});const n=j({model:"",app:"",menu:""}),d=r(!1),f=r([]),B=r(null),T=(e,t)=>{B.value=t,n.model=e.key,n.app=e.app},_=r(""),L=M(()=>{if(!_.value)return f.value;const e=_.value.toLowerCase();return f.value.filter(t=>t.app.toLowerCase().includes(e)||t.title.toLowerCase().includes(e)||t.key.toLowerCase().includes(e))}),E=e=>{!e.is_catalog&&e.id?(m.value=e,c.doRefresh()):c.setTableData([])},S=async()=>{if(n.menu=m.value.id,d.value=!1,n.menu&&n.model){const e=await ce(n);(e==null?void 0:e.code)===2e3&&te("匹配成功"),c.doSearch({form:{menu:n.menu,model:n.model}})}else le("请选择角色和模型表！")},h=M(()=>i.value.length),N=async()=>{await ae.confirm(`确定要批量删除这${i.value.length}条记录吗`,"确认",{distinguishCancelAndClose:!0,confirmButtonText:"确定",cancelButtonText:"取消",closeOnClickModal:!1}),await se(R.pluck(i.value,"id")),oe.info("删除成功"),i.value=[],await c.doRefresh()},$=e=>{const t=c.getBaseTableRef(),k=c.getTableData();R.pluck(k,"id").includes(e.id)?t.toggleRowSelection(e,!1):i.value=R.remove(i.value,C=>C.id!==e.id)},{crudBinding:O,crudRef:U,crudExpose:c,selectedRows:i}=W({createCrudOptions:ie,props:n,modelDialog:d,selectOptions:m,allModelData:f});return z(async()=>{const e=await ne();f.value=e.data}),V({selectOptions:m,handleRefreshTable:E}),(e,t)=>{const k=s("el-tag"),C=s("el-input"),q=s("el-text"),u=s("el-button"),A=s("el-dialog"),F=s("el-tooltip"),D=s("el-table-column"),I=s("el-table"),P=s("el-popover"),Q=s("fs-crud");return w(),b("div",null,[l(A,{ref:"modelRef",modelValue:d.value,"onUpdate:modelValue":t[2]||(t[2]=o=>d.value=o),title:"选择model"},{footer:a(()=>[g("span",pe,[l(u,{onClick:t[1]||(t[1]=o=>d.value=!1)},{default:a(()=>t[3]||(t[3]=[p("取消")])),_:1}),l(u,{type:"primary",onClick:S},{default:a(()=>t[4]||(t[4]=[p(" 确定 ")])),_:1})])]),default:a(()=>[H(g("div",null,[l(k,null,{default:a(()=>[p("已选择:"+x(n.model),1)]),_:1})],512),[[K,n.model]]),l(C,{modelValue:_.value,"onUpdate:modelValue":t[0]||(t[0]=o=>_.value=o),placeholder:"搜索模型...",style:{"margin-bottom":"10px"}},null,8,["modelValue"]),g("div",ue,[(w(!0),b(Y,null,G(L.value,(o,v)=>(w(),b("div",{value:o.key,key:v},[l(q,{type:B.value===v?"primary":"",onClick:ve=>T(o,v)},{default:a(()=>[p(x(o.app+"--"+o.title+"("+o.key+")"),1)]),_:2},1032,["type","onClick"])],8,re))),128))])]),_:1},8,["modelValue"]),g("div",me,[l(Q,J({ref_key:"crudRef",ref:U},y(O)),{"pagination-left":a(()=>[l(F,{content:"批量删除"},{default:a(()=>[l(u,{text:"",type:"danger",disabled:h.value===0,icon:y(ee),circle:"",onClick:N},null,8,["disabled","icon"])]),_:1})]),"pagination-right":a(()=>[l(P,{placement:"top",width:400,trigger:"click"},{reference:a(()=>[l(u,{text:"",type:h.value>0?"primary":""},{default:a(()=>[p("已选中"+x(h.value)+"条数据",1)]),_:1},8,["type"])]),default:a(()=>[l(I,{data:y(i),size:"small"},{default:a(()=>[l(D,{width:"150",property:"id",label:"id"}),l(D,{fixed:"right",label:"操作","min-width":"60"},{default:a(o=>[l(u,{text:"",type:"info",icon:y(Z),onClick:v=>$(o.row),circle:""},null,8,["icon","onClick"])]),_:1})]),_:1},8,["data"])]),_:1})]),_:1},16)])])}}}),we=de(fe,[["__scopeId","data-v-5d32cfca"]]);export{we as default};
