var $=Object.defineProperty;var R=Object.getOwnPropertySymbols;var A=Object.prototype.hasOwnProperty,N=Object.prototype.propertyIsEnumerable;var x=(o,l,e)=>l in o?$(o,l,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[l]=e,C=(o,l)=>{for(var e in l||(l={}))A.call(l,e)&&x(o,e,l[e]);if(R)for(var e of R(l))N.call(l,e)&&x(o,e,l[e]);return o};var d=(o,l,e)=>new Promise((f,m)=>{var h=s=>{try{i(e.next(s))}catch(u){m(u)}},g=s=>{try{i(e.throw(s))}catch(u){m(u)}},i=s=>s.done?f(s.value):Promise.resolve(s.value).then(h,g);i((e=e.apply(o,l)).next())});import{u as V,a as q,b as O,_ as Z}from"./useCrudSchemas-BcUSI-wT.js";import{e as E,c as j}from"./index-OziN21LA.js";import{m as G}from"./index-BQ7fd9kg.js";import{u as H,F as J}from"./useForm-DFfbRY9m.js";import{n as K}from"./element-plus-C2aeItNs.js";import{l as Q,r as W,Z as X,U as c,S as z,F as Y,m as ee,M as ae,O as te,u as t,B as F,n as le}from"./vue-chunks-l-AyUCfi.js";const me=Q({__name:"check",props:{model:{type:Array,default:()=>[]}},setup(o,{expose:l}){const e=o,{formRegister:f,formMethods:m}=H(),{getFormData:h}=m,{tableRegister:g,tableState:i,tableMethods:s}=V({fetchDataApi:()=>d(this,null,function*(){const{currentPage:a,pageSize:n}=i,r=yield G(C({current:t(a),pageSize:t(n),type:1},t(y)));return yield _(),{list:r.list,total:r.count}})}),{loading:u,dataList:I,total:B,currentPage:b,pageSize:S}=i,{getList:D,setColumn:p,delList:oe,getElTableExpose:P}=s,y=W({}),v=()=>d(this,null,function*(){const a=yield h();y.value=a,D()}),{t:T}=j(),w=a=>{const n=(a?["url","title"]:["content","url","title"]).map(r=>({field:r,path:"hidden",value:!0}));p(n)};w(1);const L=X([{field:"selection",search:{hidden:!0},form:{hidden:!0},detail:{hidden:!0},table:{type:"selection"}},{field:"type",form:{component:"Select",colProps:{span:5},value:1,componentProps:{placeholder:"",clearable:!1,options:[{label:"文字",value:1},{label:"文件",value:2},{label:"h5链接",value:4},{label:"小程序",value:5}],on:{change:a=>{w(),v(),a==1?p([{field:"content",path:"hidden",value:!1}]):a==2?p([{field:"url",path:"hidden",value:!1}]):p([{field:"title",path:"hidden",value:!1}])}}}},table:{hidden:!0}},{field:"name",label:"素材名称",width:150,form:{label:"名称",component:"Input",componentProps:{placeholder:"素材名称"},colProps:{span:6}},detail:{span:24}},{field:"tag",label:"素材标签",width:150,form:{label:"标签",component:"Input",componentProps:{placeholder:""},colProps:{span:6}},formatter:a=>c(K,{type:"primary"},{default:()=>[a.tag]})},{field:"content",label:"内容",form:{hidden:!0}},{field:"url",label:"预览",form:{hidden:!0},table:{}},{field:"title",label:"标题",form:{hidden:!0}},{field:"action",width:"260px",label:T("tableDemo.action"),search:{hidden:!0},table:{hidden:!0},form:{colProps:{span:6},label:" ",formItemProps:{slots:{default:a=>c(Y,null,[c(E,{type:"primary",onClick:()=>v()},{default:()=>[z("查询")]}),c(E,{type:"danger",onClick:()=>delData(data.row)},{default:()=>[z("新增")]})])}}},detail:{hidden:!0}}]),M=()=>d(this,null,function*(){return(yield P()).getSelectionRows()}),_=()=>d(this,null,function*(){le(()=>d(this,null,function*(){const a=yield P();e.model.forEach(n=>{const r=a.data.find(U=>U.materialId==n.materialId);r&&a.toggleRowSelection(r,!0)})}))});l({getSelect:M,setSelects:_});const{allSchemas:k}=q(L);return(a,n)=>(ee(),ae(t(Z),null,{default:te(()=>[c(t(J),{schema:t(k).formSchema,"hide-required-asterisk":"",autoSetPlaceholder:!1,class:"dark:border-1 dark:border-[var(--el-border-color)] dark:border-solid mb-5",onRegister:t(f)},null,8,["schema","onRegister"]),c(t(O),{pageSize:t(S),"onUpdate:pageSize":n[0]||(n[0]=r=>F(S)?S.value=r:null),currentPage:t(b),"onUpdate:currentPage":n[1]||(n[1]=r=>F(b)?b.value=r:null),columns:t(k).tableColumns,data:t(I),loading:t(u),pagination:{total:t(B)},"image-preview":["url"],onRegister:t(g)},null,8,["pageSize","currentPage","columns","data","loading","pagination","onRegister"])]),_:1}))}});export{me as _};
