import{d as T,r as d,Z as $,k as F,j as O,ai as s,o as v,c as y,U as l,O as n,a as m,K as U,u as E,S as p,P as I,V as P,T as k,F as j,a8 as q}from"./vue.1RczIYhx.js";import{$ as A,n as K,w as Q}from"./index.fM6cvGYs.js";import"./elementPlus.CXoFsoPv.js";import{g as Z,c as z}from"./crud.BF5rixMi.js";import{b as G}from"./api.DJaJlKLu.js";import{_ as H}from"./_plugin-vue_export-helper.DlAUqK2U.js";import"./authFunction.VC7PaOWG.js";const J={class:"model-card"},W=["value"],X={class:"dialog-footer"},Y={style:{height:"80vh"}},ee=T({__name:"index",setup(oe,{expose:h}){let r=d({name:null});const t=$({model:"",app:"",menu:""}),u=d(!1),i=d([]),g=d(null),w=(e,o)=>{g.value=o,t.model=e.key,t.app=e.app},c=d(""),x=F(()=>{if(!c.value)return i.value;const e=c.value.toLowerCase();return i.value.filter(o=>o.app.toLowerCase().includes(e)||o.title.toLowerCase().includes(e)||o.key.toLowerCase().includes(e))}),V=e=>{!e.is_catalog&&e.id?(r.value=e,f.doRefresh()):f.setTableData([])},b=async()=>{if(t.menu=r.value.id,u.value=!1,t.menu&&t.model){const e=await G(t);(e==null?void 0:e.code)===2e3&&K("匹配成功"),f.doSearch({form:{menu:t.menu,model:t.model}})}else Q("请选择角色和模型表！")},{crudBinding:D,crudRef:L,crudExpose:f}=A({createCrudOptions:z,props:t,modelDialog:u,selectOptions:r,allModelData:i});return O(async()=>{const e=await Z();i.value=e.data}),h({selectOptions:r,handleRefreshTable:V}),(e,o)=>{const M=s("el-tag"),N=s("el-input"),R=s("el-text"),C=s("el-button"),B=s("el-dialog"),S=s("fs-crud");return v(),y("div",null,[l(B,{ref:"modelRef",modelValue:u.value,"onUpdate:modelValue":o[2]||(o[2]=a=>u.value=a),title:"选择model"},{footer:n(()=>[m("span",X,[l(C,{onClick:o[1]||(o[1]=a=>u.value=!1)},{default:n(()=>o[3]||(o[3]=[p("取消")])),_:1}),l(C,{type:"primary",onClick:b},{default:n(()=>o[4]||(o[4]=[p(" 确定 ")])),_:1})])]),default:n(()=>[I(m("div",null,[l(M,null,{default:n(()=>[p("已选择:"+k(t.model),1)]),_:1})],512),[[P,t.model]]),l(N,{modelValue:c.value,"onUpdate:modelValue":o[0]||(o[0]=a=>c.value=a),placeholder:"搜索模型...",style:{"margin-bottom":"10px"}},null,8,["modelValue"]),m("div",J,[(v(!0),y(j,null,q(x.value,(a,_)=>(v(),y("div",{value:a.key,key:_},[l(R,{type:g.value===_?"primary":"",onClick:te=>w(a,_)},{default:n(()=>[p(k(a.app+"--"+a.title+"("+a.key+")"),1)]),_:2},1032,["type","onClick"])],8,W))),128))])]),_:1},8,["modelValue"]),m("div",Y,[l(S,U({ref_key:"crudRef",ref:L},E(D)),null,16)])])}}}),ie=H(ee,[["__scopeId","data-v-291b137a"]]);export{ie as default};
