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