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